summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-11-21 14:09:37 +0800
committerwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-11-21 14:09:37 +0800
commit4f9a777998858d0aea9ccb5daf390a54fece4923 (patch)
tree1839d77f6817adda12ea725500e424f387ede9be /util
parent5a9ee439a653535e033702bae7c70443cfc01216 (diff)
downloadpttbbs-4f9a777998858d0aea9ccb5daf390a54fece4923.tar
pttbbs-4f9a777998858d0aea9ccb5daf390a54fece4923.tar.gz
pttbbs-4f9a777998858d0aea9ccb5daf390a54fece4923.tar.bz2
pttbbs-4f9a777998858d0aea9ccb5daf390a54fece4923.tar.lz
pttbbs-4f9a777998858d0aea9ccb5daf390a54fece4923.tar.xz
pttbbs-4f9a777998858d0aea9ccb5daf390a54fece4923.tar.zst
pttbbs-4f9a777998858d0aea9ccb5daf390a54fece4923.zip
added util to zero vote limits.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2346 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util')
-rw-r--r--util/zerovotelimit.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/util/zerovotelimit.c b/util/zerovotelimit.c
new file mode 100644
index 00000000..0405d180
--- /dev/null
+++ b/util/zerovotelimit.c
@@ -0,0 +1,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;
+}