diff options
author | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-05-25 12:05:26 +0800 |
---|---|---|
committer | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-05-25 12:05:26 +0800 |
commit | ff7ae115c5db1fe56f3c6114bf08ed8ecf0c9847 (patch) | |
tree | d80531d82774d0c8d340f760968dba13a3d11d07 /trans/transman.c | |
parent | 983c3a4eefe0366ac29cd0ad90a859774500302c (diff) | |
download | pttbbs-ff7ae115c5db1fe56f3c6114bf08ed8ecf0c9847.tar pttbbs-ff7ae115c5db1fe56f3c6114bf08ed8ecf0c9847.tar.gz pttbbs-ff7ae115c5db1fe56f3c6114bf08ed8ecf0c9847.tar.bz2 pttbbs-ff7ae115c5db1fe56f3c6114bf08ed8ecf0c9847.tar.lz pttbbs-ff7ae115c5db1fe56f3c6114bf08ed8ecf0c9847.tar.xz pttbbs-ff7ae115c5db1fe56f3c6114bf08ed8ecf0c9847.tar.zst pttbbs-ff7ae115c5db1fe56f3c6114bf08ed8ecf0c9847.zip |
Move transform programs to seperate directory.
Add transformation program for SOB
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4322 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'trans/transman.c')
-rw-r--r-- | trans/transman.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/trans/transman.c b/trans/transman.c new file mode 100644 index 00000000..711e8ead --- /dev/null +++ b/trans/transman.c @@ -0,0 +1,56 @@ +/* $Id$ */ +// tools to translate the format of eagle bbs -> Ptt bbs */ + +#include "bbs.h" + +int transman(char *path) +{ + char name[128]; + char buf[512], filename[512], *direct=""; + int n=0; + fileheader_t fh; + FILE *fp; + + chdir(path); + + fp = fopen(".Names", "r"); + if(fp) + for(n=0; fgets(buf,512,fp)>0; n++) + { + strtok(buf,"\r\n"); + if(buf[0]=='#') continue; + if(buf[0]=='N') + strcpy(name, buf+5); + else + if(buf[0]=='P') + { + direct = buf+7; + strcpy(filename, "."); + stampfile(filename, &fh); + unlink(filename); + if(dashd(direct)) + { + sprintf(fh.title, "¡» %s", name); + transman(direct); + } + else + sprintf(fh.title, "¡º %s", name); + rename(direct, filename); + append_record(".DIR", &fh, sizeof(fh)); + } + } + chdir(".."); + return n; +} + +int main(int argc, char* argv[]) +{ + if(argc < 2) + { + printf("%s <path>\n", argv[0]); + return 0; + } + + transman(argv[1]); + return 0; +} |