diff options
author | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-09-19 12:33:09 +0800 |
---|---|---|
committer | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-09-19 12:33:09 +0800 |
commit | 098f190b2fcb394558424d0d4d56c1f27ee4956c (patch) | |
tree | 1a5764704984b21054b9a8ee684a362bcbfe7518 /upgrade | |
parent | 2949732db80f63afe3e0291fc72552b3c90402be (diff) | |
download | pttbbs-098f190b2fcb394558424d0d4d56c1f27ee4956c.tar pttbbs-098f190b2fcb394558424d0d4d56c1f27ee4956c.tar.gz pttbbs-098f190b2fcb394558424d0d4d56c1f27ee4956c.tar.bz2 pttbbs-098f190b2fcb394558424d0d4d56c1f27ee4956c.tar.lz pttbbs-098f190b2fcb394558424d0d4d56c1f27ee4956c.tar.xz pttbbs-098f190b2fcb394558424d0d4d56c1f27ee4956c.tar.zst pttbbs-098f190b2fcb394558424d0d4d56c1f27ee4956c.zip |
Always display designated system banner first.
Let user choose whether to display user songs.
r4856_adbanner will reset all users to not display user songs.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4856 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'upgrade')
-rw-r--r-- | upgrade/r4856_adbanner.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/upgrade/r4856_adbanner.c b/upgrade/r4856_adbanner.c new file mode 100644 index 00000000..031b7885 --- /dev/null +++ b/upgrade/r4856_adbanner.c @@ -0,0 +1,54 @@ +#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->uflag &= ~ADBANNER_USONG_FLAG; + + // 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; +} |