summaryrefslogtreecommitdiffstats
path: root/upgrade
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-09-17 17:50:16 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-09-17 17:50:16 +0800
commit42dd732f9f1bfe4b79c925b0e3d14a68c7312174 (patch)
tree055b6c72b7e23d8704a2fa646b2780b176720509 /upgrade
parent2a83fe8bd5b10cb1b6e1b9b4f8fc76096e185456 (diff)
downloadpttbbs-42dd732f9f1bfe4b79c925b0e3d14a68c7312174.tar
pttbbs-42dd732f9f1bfe4b79c925b0e3d14a68c7312174.tar.gz
pttbbs-42dd732f9f1bfe4b79c925b0e3d14a68c7312174.tar.bz2
pttbbs-42dd732f9f1bfe4b79c925b0e3d14a68c7312174.tar.lz
pttbbs-42dd732f9f1bfe4b79c925b0e3d14a68c7312174.tar.xz
pttbbs-42dd732f9f1bfe4b79c925b0e3d14a68c7312174.tar.zst
pttbbs-42dd732f9f1bfe4b79c925b0e3d14a68c7312174.zip
* move WATER_* from uflag2 to cuser.pager_ui_type (standalone variable)
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4848 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'upgrade')
-rw-r--r--upgrade/r4848_watermode.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/upgrade/r4848_watermode.c b/upgrade/r4848_watermode.c
new file mode 100644
index 00000000..e9db7fc5
--- /dev/null
+++ b/upgrade/r4848_watermode.c
@@ -0,0 +1,57 @@
+#define _UTIL_C_
+#include "bbs.h"
+#include <time.h>
+
+int transform(userec_t *new, userec_t *old, int i)
+{
+ userec_t *u = new;
+
+ memcpy(new, old, sizeof(userec_t));
+
+ if (!u->userid[0])
+ return 0;
+
+ u->pager_ui_type = (u->uflag2 & 3) % PAGER_UI_TYPES;
+
+ printf("%-13s: wateremode: %d -> %d\n",
+ u->userid, u->uflag2 & 3, u->pager_ui_type);
+
+ // force convert!
+ // passwd_update(n+1, u);
+
+ return 0;
+}
+
+int main(void)
+{
+ int fd, fdw;
+ userec_t new;
+ userec_t old;
+ int i = 0;
+
+ printf("sizeof(userec_t)=%u\n", (unsigned int)sizeof(userec_t));
+ printf("You're going to convert your .PASSWDS\n");
+ printf("The new file will be named .PASSWDS.trans.tmp\n");
+
+ if (chdir(BBSHOME) < 0) {
+ perror("chdir");
+ exit(-1);
+ }
+
+ if ((fd = open(FN_PASSWD, O_RDONLY)) < 0 ||
+ (fdw = open(FN_PASSWD".trans.tmp", O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0 ) {
+ perror("open");
+ exit(-1);
+ }
+
+ while (read(fd, &old, sizeof(old)) > 0) {
+ transform(&new, &old, ++i);
+ write(fdw, &new, sizeof(new));
+ }
+
+ close(fd);
+ close(fdw);
+
+ // printf("total %d records converted.\n", accs);
+ return 0;
+}