summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-05-25 12:05:26 +0800
committerwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-05-25 12:05:26 +0800
commitff7ae115c5db1fe56f3c6114bf08ed8ecf0c9847 (patch)
treed80531d82774d0c8d340f760968dba13a3d11d07 /util
parent983c3a4eefe0366ac29cd0ad90a859774500302c (diff)
downloadpttbbs-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 'util')
-rw-r--r--util/Makefile2
-rw-r--r--util/transman.c56
-rw-r--r--util/wretch_man.c124
3 files changed, 1 insertions, 181 deletions
diff --git a/util/Makefile b/util/Makefile
index 20477500..58c7bde8 100644
--- a/util/Makefile
+++ b/util/Makefile
@@ -22,7 +22,7 @@ CPROG_WITH_UTIL= \
yearsold toplazyBM toplazyBBM writemoney \
reaper buildAnnounce inndBM mailangel \
outmail chkhbf merge_dir \
- transman angel gamblegive wretch_man \
+ angel gamblegive \
chesscountry tunepasswd buildir xchatd \
uhash_loader
diff --git a/util/transman.c b/util/transman.c
deleted file mode 100644
index 711e8ead..00000000
--- a/util/transman.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $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;
-}
diff --git a/util/wretch_man.c b/util/wretch_man.c
deleted file mode 100644
index d055980d..00000000
--- a/util/wretch_man.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* $Id$ */
-/* tool to convert wretch bbs to ptt bbs */
-
-#include "bbs.h"
-
-struct wretch_fheader_t {
- time4_t chrono;
- char pad[4];
- int xmode;
- int xid;
- char xname[32]; /* 檔案名稱 */
- char owner[80]; /* 作者 (E-mail address) */
- char nick[50]; /* 暱稱 */
- char date[9]; /* [96/12/01] */
- char title[72]; /* 主題 (TTLEN + 1) */
- char score;
- char pad2[4];
-};
-
-#define POST_MARKED 0x00000002 /* marked */
-#define POST_BOTTOM1 0x00002000 /* 置底文章的正本 */
-
-#define GEM_RESTRICT 0x0800 /* 限制級精華區,須 manager 才能看 */
-#define GEM_RESERVED 0x1000 /* 限制級精華區,須 sysop 才能更改 */
-#define GEM_FOLDER 0x00010000 /* folder / article */
-#define GEM_BOARD 0x00020000 /* 看板精華區 */
-
-static const char radix32[32] = {
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
- 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
- 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
-};
-
-char *path;
-char *board;
-
-int transman(char *fname, char *newpath)
-{
- int fd;
- char *p;
- char buf[PATHLEN];
- struct wretch_fheader_t whdr;
- fileheader_t fhdr;
-
- if (fname[0] == '.')
- snprintf(buf, PATHLEN, "%s/%s", path, fname);
- else
- snprintf(buf, PATHLEN, "%s/%c/%s", path, fname[7], fname);
-
- if ((fd = open(buf, O_RDONLY, 0)) == -1)
- return -1;
-
- while (read(fd, &whdr, sizeof(whdr)) == sizeof(whdr)) {
- if (strcmp(whdr.xname, "..") == 0 || strchr(whdr.xname, '/'))
- continue;
-
- if (!(whdr.xmode & 0xffff0000)) {
- /* article */
- stampfile(newpath, &fhdr);
- strlcpy(fhdr.title, "◇ ", sizeof(fhdr.title));
-
- if (whdr.xname[0] == '@')
- snprintf(buf, sizeof(buf), "%s/@/%s", path, whdr.xname);
- else
- snprintf(buf, sizeof(buf), "%s/%c/%s", path, whdr.xname[7], whdr.xname);
-
- copy_file(buf, newpath);
- }
- else if (whdr.xmode & GEM_FOLDER) {
- /* folder */
- stampdir(newpath, &fhdr);
- strlcpy(fhdr.title, "◆ ", sizeof(fhdr.title));
-
- transman(whdr.xname, newpath);
- }
-
- p = strrchr(newpath, '/');
- *p = '\0';
-
- if (whdr.xmode & 0x0800)
- fhdr.filemode |= FILE_BM;
-
- strncat(fhdr.title, whdr.title, sizeof(fhdr.title) - strlen(fhdr.title) - 1);
- strlcpy(fhdr.owner, whdr.owner, sizeof(fhdr.title));
-
- setadir(buf, newpath);
- append_record(buf, &fhdr, sizeof(fhdr));
- }
-
- close(fd);
- return 0;
-}
-
-int main(int argc, char *argv[])
-{
- char buf[PATHLEN];
-
- if (argc < 2) {
- printf("%s <path> <board>\n", argv[0]);
- return 0;
- }
-
- path = argv[1];
- board = argv[2];
-
- if (!dashd(path)) {
- printf("%s is not directory\n", path);
- return 0;
- }
-
- setapath(buf, board);
-
- if (!dashd(buf)) {
- printf("%s is not directory\n", buf);
- return 0;
- }
-
- attach_SHM();
-
- transman(".DIR", buf);
-
- return 0;
-}