diff options
Diffstat (limited to 'util/cleanident.c')
-rw-r--r-- | util/cleanident.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/util/cleanident.c b/util/cleanident.c new file mode 100644 index 00000000..0d32374c --- /dev/null +++ b/util/cleanident.c @@ -0,0 +1,19 @@ +/* $Id$ */ +#include "bbs.h" + +int main(int argc, char **argv) +{ + userec_t usr; + int fd, i; + if( argc == 1 || (fd = open(argv[1], O_RDWR)) < 0 ){ + fprintf(stderr, "usage: cleanident path_to_passwd\n"); + return 1; + } + for( i = 0 ; read(fd, &usr, sizeof(usr)) == sizeof(usr) ; ++ i ){ + memset(usr.pad0, 0, sizeof(usr.pad0)); + if( lseek(fd, i * sizeof(usr), SEEK_SET) != -1 ) + write(fd, &usr, sizeof(usr)); + } + printf("%d users cleaned\n", i); + return 0; +} |