diff options
author | ptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-06-02 03:02:54 +0800 |
---|---|---|
committer | ptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-06-02 03:02:54 +0800 |
commit | f544847b7d7fb9ece4290268d90d1e5e833de5b9 (patch) | |
tree | c7d0bdfca6d2407a67cd926326f80920e3696bb1 | |
parent | 8c28203de4580efafd474e9015acc692e7810ddf (diff) | |
download | pttbbs-f544847b7d7fb9ece4290268d90d1e5e833de5b9.tar pttbbs-f544847b7d7fb9ece4290268d90d1e5e833de5b9.tar.gz pttbbs-f544847b7d7fb9ece4290268d90d1e5e833de5b9.tar.bz2 pttbbs-f544847b7d7fb9ece4290268d90d1e5e833de5b9.tar.lz pttbbs-f544847b7d7fb9ece4290268d90d1e5e833de5b9.tar.xz pttbbs-f544847b7d7fb9ece4290268d90d1e5e833de5b9.tar.zst pttbbs-f544847b7d7fb9ece4290268d90d1e5e833de5b9.zip |
add tools to translate man from eagle bbs system (ex.bbs.ntu.edu.tw)
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2042 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | util/Makefile | 3 | ||||
-rw-r--r-- | util/transman.c | 56 |
2 files changed, 58 insertions, 1 deletions
diff --git a/util/Makefile b/util/Makefile index 04c0d4cc..52f02a62 100644 --- a/util/Makefile +++ b/util/Makefile @@ -22,7 +22,8 @@ CPROG_WITH_UTIL= \ openvice parse_news openticket topusr \ indexuser yearsold toplazyBM toplazyBBM \ reaper buildAnnounce inndBM shmctl \ - outmail chkhbf checkmoney merge_dir + outmail chkhbf checkmoney merge_dir \ + transman # 下面這些程式, 會直接被 compile CPROG_WITHOUT_UTIL= \ diff --git a/util/transman.c b/util/transman.c new file mode 100644 index 00000000..6ed5988e --- /dev/null +++ b/util/transman.c @@ -0,0 +1,56 @@ +/* $Id: transman 1298 2003-11-04 12:27:48Z Ptt $ */ +// 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; +} |