diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-06-09 23:18:38 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-06-09 23:18:38 +0800 |
commit | f863ff9c4e82ee8fc0f79617967530e2f6f39465 (patch) | |
tree | 70b35b5f161e28dd6c3cb6f8d378b4e3d51be2f7 /util/checkdir.c | |
parent | 09e0aedae72379659916667ba31f15e46dd86797 (diff) | |
download | pttbbs-f863ff9c4e82ee8fc0f79617967530e2f6f39465.tar pttbbs-f863ff9c4e82ee8fc0f79617967530e2f6f39465.tar.gz pttbbs-f863ff9c4e82ee8fc0f79617967530e2f6f39465.tar.bz2 pttbbs-f863ff9c4e82ee8fc0f79617967530e2f6f39465.tar.lz pttbbs-f863ff9c4e82ee8fc0f79617967530e2f6f39465.tar.xz pttbbs-f863ff9c4e82ee8fc0f79617967530e2f6f39465.tar.zst pttbbs-f863ff9c4e82ee8fc0f79617967530e2f6f39465.zip |
delete obsolete utilities.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3534 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util/checkdir.c')
-rw-r--r-- | util/checkdir.c | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/util/checkdir.c b/util/checkdir.c deleted file mode 100644 index fb02f43a..00000000 --- a/util/checkdir.c +++ /dev/null @@ -1,73 +0,0 @@ -/* $Id$ */ -/* -typedef struct fileheader_t { - char filename[FNLEN]; - char recommend; - char owner[IDLEN + 2]; - char date[6]; - char title[TTLEN + 1]; - int money; - unsigned char filemode; -} fileheader_t; - -*/ -#include "bbs.h" -void dumpfh(fileheader_t fh) -{ - char *c; - printf("dumping fh\n"); - for( c= (char*)&fh; (c-(char*)&fh)<sizeof(fh); c++) - if(isprint(*c)) printf("%c",*c); - else printf("[%02d]",(unsigned int)*c); - printf("\n"); -} -int main(int argc, char **argv) { - int count=0; - fileheader_t pfh, fh; - FILE *fp, *fo=NULL; - int offset=0; - - if(argc < 2) { - fprintf(stderr, "Usage: %s \n", argv[0]); - return 1; - } - - if(!(fp=fopen(argv[1],"r"))) - {printf("fileopen error!\n"); - return 0;} - if(argc >2) - fo=fopen(argv[2],"w"); - - for(count=0; fread(&fh, sizeof(fh), 1, fp) >0; count++) - { - if(fh.owner[0]=='M' && fh.owner[1]=='.') - { - count--; - fseek(fp,FNLEN+1-sizeof(fh),SEEK_CUR); - printf("%d,offset forth!---dump\n", count); - dumpfh(pfh); - dumpfh(fh); - offset=1; - continue; - } - if(fh.filename[1]!='.' && offset==1) - { - fseek(fp,-FNLEN-1-sizeof(fh),SEEK_CUR); - printf("%d,offset back!\n", count); - offset=0; - continue; - } - if(fh.filename[0]==0 || fh.owner[0]==0 || fh.owner[0]=='-') - { - if(fh.filename[0]==0) unlink(fh.filename); - continue; - } - pfh=fh; -fh.recommend =0; - if(fo) - fwrite(&fh, sizeof(fh), 1, fo); - } - fclose(fp); - if(fo) fclose(fo); - return 0; -} |