diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-06-24 01:04:32 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-06-24 01:04:32 +0800 |
commit | 3e1adccc79b103308400861b7a22d0fc0bcd6351 (patch) | |
tree | 15a6b853de51d8a3c4e036c0af3f40793cc65db8 /ColaBBS_to_PttBBS/cntpasswd.c | |
parent | a545d2f4f3dc28c0b12d35b192ec1bcedce86e4b (diff) | |
download | pttbbs-not-maintained@4903.tar.gz pttbbs-not-maintained@4903.tar.zst pttbbs-not-maintained@4903.zip |
enhancenot-maintained@4903
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/not-maintained@2863 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'ColaBBS_to_PttBBS/cntpasswd.c')
-rw-r--r-- | ColaBBS_to_PttBBS/cntpasswd.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/ColaBBS_to_PttBBS/cntpasswd.c b/ColaBBS_to_PttBBS/cntpasswd.c index fd9f778a..40a97ac1 100644 --- a/ColaBBS_to_PttBBS/cntpasswd.c +++ b/ColaBBS_to_PttBBS/cntpasswd.c @@ -1,6 +1,6 @@ /* $Id$ */ #include "bbs.h" -/* usage: ./cntpasswd < ColaBBS/.PASSWDS > ~/.PASSWDS */ +// usage: cd home/; cntpasswd */*/USERDATA.DAT > ~/.PASSWDS ; tunepasswd typedef struct { char userid[IDLEN + 1]; @@ -16,21 +16,20 @@ int main(int argc, char **argv) { fuserect_t fu; userec_t u; - memset(&u, 0, sizeof(u)); - while( read(0, &fu, sizeof(fu)) == sizeof(fu) ){ -#if 0 - printf("(%s), (%s), (%s), (%s)\n", - fu.userid, fu.passwd, fu.nick, fu.name); -#endif - if( !fu.userid[0] ) - continue; + int fd, i; - memset(&u, 0, sizeof(u)); - strlcpy(u.userid, fu.userid, sizeof(u.userid)); - strlcpy(u.passwd, fu.passwd, sizeof(u.passwd)); - strlcpy(u.realname, fu.name, sizeof(u.realname)); - strlcpy(u.username, fu.nick, sizeof(u.username)); - write(1, &u, sizeof(u)); + for( i = 1 ; i < argc ; ++i ){ + if( (fd = open(argv[i], O_RDONLY)) > 0 && + read(fd, &fu, sizeof(fu)) == sizeof(fu) && + fu.userid[0] ){ + + memset(&u, 0, sizeof(u)); + strlcpy(u.userid, fu.userid, sizeof(u.userid)); + strlcpy(u.passwd, fu.passwd, sizeof(u.passwd)); + strlcpy(u.realname, fu.name, sizeof(u.realname)); + strlcpy(u.username, fu.nick, sizeof(u.username)); + write(1, &u, sizeof(u)); + } } return 0; } |