1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#include "bbs.h"
/* Vote limits were added in r2342 which uses previously unused pads.
* This program zero outs those pads. */
void transform(boardheader_t *new, boardheader_t *old)
{
memcpy(new, old, sizeof(boardheader_t));
new->limit_posts = (unsigned char) 0;
new->limit_logins = (unsigned char) 0;
memset(new->pad, 0, sizeof(new->pad));
memset(new->pad2, 0, sizeof(new->pad2));
memset(new->pad3, 0, sizeof(new->pad3));
}
int main(void)
{
int fd, fdw;
boardheader_t new, old;
printf("You're going to zero out vote limits in your .BRD\n");
printf("The new file will be named .BRD.trans.tmp\n");
/*
printf("Press any key to continue\n");
getchar();
*/
if (chdir(BBSHOME) < 0) {
perror("chdir");
exit(-1);
}
if ((fd = open(FN_BOARD, O_RDONLY)) < 0 ||
(fdw = open(FN_BOARD".trans.tmp", O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0 ) {
perror("open");
exit(-1);
}
while (read(fd, &old, sizeof(old)) > 0) {
transform(&new, &old);
write(fdw, &new, sizeof(new));
}
close(fd);
close(fdw);
return 0;
}
|