summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--innbbsd/bbslink.c20
-rw-r--r--innbbsd/bbslink2.c22
-rw-r--r--innbbsd/receive_article.c32
-rw-r--r--mbbsd/admin.c13
-rw-r--r--mbbsd/announce.c10
-rw-r--r--mbbsd/cache.c6
-rw-r--r--mbbsd/gamble.c4
-rw-r--r--mbbsd/record.c6
-rw-r--r--mbbsd/stuff.c12
-rw-r--r--mbbsd/syspost.c14
-rw-r--r--mbbsd/user.c6
-rw-r--r--mbbsd/vote.c6
-rw-r--r--util/account.c6
-rw-r--r--util/buildAnnounce.c73
-rw-r--r--util/initbbs.c24
-rw-r--r--util/kenben.c8
-rw-r--r--util/parse_news.c4
-rw-r--r--util/post.c6
-rw-r--r--util/smtest.c11
-rw-r--r--util/util_cache.c4
20 files changed, 146 insertions, 141 deletions
diff --git a/innbbsd/bbslink.c b/innbbsd/bbslink.c
index 2b0b6f37..fa5716ac 100644
--- a/innbbsd/bbslink.c
+++ b/innbbsd/bbslink.c
@@ -460,7 +460,7 @@ save_article(board, filename, sover)
if (Verbose)
printf("<save_article> %s %s\n", board, filename);
- FN = fopen(fileglue("%s/boards/%s/%s", BBSHOME, board, filename), "w");
+ FN = fopen(fileglue("%s/boards/%c/%s/%s", BBSHOME, board[0], board, filename), "w");
if (FN == NULL)
{
bbslog("<save_article> err: %s %s\n", board, filename);
@@ -484,7 +484,7 @@ save_article(board, filename, sover)
times.actime = sover->mtime;
times.modtime = sover->mtime;
- utime(fileglue("%s/boards/%s/%s", BBSHOME, board, filename), &times);
+ utime(fileglue("%s/boards/%c/%s/%s", BBSHOME, board[0], board, filename), &times);
utime(fileglue("%s/.bcache/%s", BBSHOME, board), NULL);
}
#endif
@@ -508,7 +508,7 @@ process_article(board, filename, userid, nickname, subject)
{
subject = "無題";
}
- filepath = fileglue("%s/boards/%s/%s", BBSHOME, board, filename);
+ filepath = fileglue("%s/boards/%c/%s/%s", BBSHOME, board[0], board, filename);
if (isfile(filepath))
{
linkoverview_t lover;
@@ -682,17 +682,17 @@ read_outgoing(sover)
#endif
}
BODY = "";
- FD = open(fileglue("%s/boards/%s/%s", BBSHOME, board, filename), O_RDONLY);
+ FD = open(fileglue("%s/boards/%c/%s/%s", BBSHOME, board[0], board, filename), O_RDONLY);
if (FD < 0)
{
if (Verbose)
- printf(" !! can't open %s/boards/%s/%s\n", BBSHOME, board, filename);
+ printf(" !! can't open %s/boards/%c/%s/%s\n", BBSHOME, board[0], board, filename);
else
- fprintf(stderr, "can't open %s/boards/%s/%s\n", BBSHOME, board, filename);
+ fprintf(stderr, "can't open %s/boards/%c/%s/%s\n", BBSHOME, board[0], board, filename);
return -1;
}
- FD_SIZE = filesize(fileglue("%s/boards/%s/%s", BBSHOME, board, filename));
+ FD_SIZE = filesize(fileglue("%s/boards/%c/%s/%s", BBSHOME, board[0], board, filename));
if (FD_BUF == NULL)
{
FD_BUF = (char *) mymalloc(FD_SIZE + 1 + strlen(COMMENT));
@@ -709,7 +709,7 @@ read_outgoing(sover)
FD_END += strlen(COMMENT);
if (Verbose)
{
- printf("<read in> %s/boards/%s/%s\n", BBSHOME, board, filename);
+ printf("<read in> %s/boards/%c/%s/%s\n", BBSHOME, board[0], board, filename);
}
*ORGANIZATION = '\0';
@@ -1301,7 +1301,7 @@ cancel_outgoing(board, filename, from, subject)
bbslog("<cancel_outgoing> Try to move moderated post from %s to deleted\n", board);
if (Verbose)
printf("Try to move moderated post from %s to deleted\n", board);
- FN = popen(fileglue("%s/bbspost post %s/boards/deleted > %s",
+ FN = popen(fileglue("%s/bbspost post %s/boards/d/deleted > %s",
INNDHOME, BBSHOME, TMPFILE), "w");
if (FN == NULL)
{
@@ -1323,7 +1323,7 @@ cancel_outgoing(board, filename, from, subject)
if (strncmp(result, "post to ", 8) == 0)
{
/* try to remove it */
- strncpy(filepath, fileglue("%s/boards/%s/%s", BBSHOME, board, filename), sizeof filepath);
+ strncpy(filepath, fileglue("%s/boards/%c/%s/%s", BBSHOME, board[0], board, filename), sizeof filepath);
if (isfile(filepath))
{
Rename(filepath, fileglue("%s.cancel", filepath));
diff --git a/innbbsd/bbslink2.c b/innbbsd/bbslink2.c
index d79c23a9..70d39766 100644
--- a/innbbsd/bbslink2.c
+++ b/innbbsd/bbslink2.c
@@ -427,7 +427,7 @@ save_article(board, filename, sover)
if (Verbose)
printf("<save_article> %s %s\n", board, filename);
- FN = fopen(fileglue("%s/boards/%s/%s", BBSHOME, board, filename), "w");
+ FN = fopen(fileglue("%s/boards/%c/%s/%s", BBSHOME, board[0], board, filename), "w");
if (FN == NULL)
{
bbslog("<save_article> err: %s %s\n", board, filename);
@@ -451,7 +451,7 @@ save_article(board, filename, sover)
times.actime = sover->mtime;
times.modtime = sover->mtime;
- utime(fileglue("%s/boards/%s/%s", BBSHOME, board, filename), &times);
+ utime(fileglue("%s/boards/%c/%s/%s", BBSHOME, board[0], board, filename), &times);
utime(fileglue("%s/.bcache/%s", BBSHOME, board), NULL);
}
#endif
@@ -475,7 +475,7 @@ process_article(board, filename, userid, nickname, subject)
{
subject = "無題";
}
- filepath = fileglue("%s/boards/%s/%s", BBSHOME, board, filename);
+ filepath = fileglue("%s/boards/%c/%s/%s", BBSHOME, board[0], board, filename);
if (isfile(filepath))
{
linkoverview_t lover;
@@ -649,17 +649,17 @@ read_outgoing(sover)
#endif
}
BODY = "";
- FD = open(fileglue("%s/boards/%s/%s", BBSHOME, board, filename), O_RDONLY);
+ FD = open(fileglue("%s/boards/%c/%s/%s", BBSHOME, board[0], board, filename), O_RDONLY);
if (FD < 0)
{
if (Verbose)
- printf(" !! can't open %s/boards/%s/%s\n", BBSHOME, board, filename);
+ printf(" !! can't open %s/boards/%c/%s/%s\n", BBSHOME, board[0], board, filename);
else
- fprintf(stderr, "can't open %s/boards/%s/%s\n", BBSHOME, board, filename);
+ fprintf(stderr, "can't open %s/boards/%c/%s/%s\n", BBSHOME, board[0], board, filename);
return -1;
}
- FD_SIZE = filesize(fileglue("%s/boards/%s/%s", BBSHOME, board, filename));
+ FD_SIZE = filesize(fileglue("%s/boards/%c/%s/%s", BBSHOME, board[0], board, filename));
if (FD_BUF == NULL)
{
FD_BUF = (char *) mymalloc(FD_SIZE + 1 + strlen(COMMENT));
@@ -676,7 +676,7 @@ read_outgoing(sover)
FD_END += strlen(COMMENT);
if (Verbose)
{
- printf("<read in> %s/boards/%s/%s\n", BBSHOME, board, filename);
+ printf("<read in> %s/boards/%c/%s/%s\n", BBSHOME, board[0], board, filename);
}
*ORGANIZATION = '\0';
@@ -1248,7 +1248,7 @@ cancel_outgoing(board, filename, from, subject)
bbslog("<cancel_outgoing> Try to move moderated post from %s to deleted\n", board);
if (Verbose)
printf("Try to move moderated post from %s to deleted\n", board);
- FN = popen(fileglue("%s/bbspost post %s/boards/deleted > %s",
+ FN = popen(fileglue("%s/bbspost post %s/boards/d/deleted > %s",
INNDHOME, BBSHOME, TMPFILE), "w");
if (FN == NULL)
{
@@ -1270,7 +1270,7 @@ cancel_outgoing(board, filename, from, subject)
if (strncmp(result, "post to ", 8) == 0)
{
/* try to remove it */
- strncpy(filepath, fileglue("%s/boards/%s/%s", BBSHOME, board, filename), sizeof filepath);
+ strncpy(filepath, fileglue("%s/boards/%c/%s/%s", BBSHOME, board[0], board, filename), sizeof filepath);
if (isfile(filepath))
{
Rename(filepath, fileglue("%s.cancel", filepath));
@@ -1691,7 +1691,7 @@ woju
/*
woju
*/
- sprintf(OUTING, "%s/boards/%s/", BBSHOME, argv[1]);
+ sprintf(OUTING, "%s/boards/%c/%s/", BBSHOME, argv[1][0], argv[1]);
fname = OUTING + strlen(OUTING);
if (initial_bbs("link") == 0)
diff --git a/innbbsd/receive_article.c b/innbbsd/receive_article.c
index 40f2609c..d036fe41 100644
--- a/innbbsd/receive_article.c
+++ b/innbbsd/receive_article.c
@@ -466,7 +466,7 @@ receive_article()
{
goto boardcont;
}
- boardhome = (char *) fileglue("%s/boards/%s", BBSHOME, boardptr);
+ boardhome = (char *) fileglue("%s/boards/%c/%s", BBSHOME, boardptr[0], boardptr);
if (!isdir(boardhome))
{
bbslog(":Err: unable to write %s\n", boardhome);
@@ -485,8 +485,8 @@ receive_article()
fname = (char *) fileglue("%s/%s", boardptr, fname);
if (firstpath[0] == '\0')
{
- sprintf(firstpath, "%s/boards/%s", BBSHOME, fname);
- firstpathbase = firstpath + strlen(BBSHOME) + strlen("/boards/");
+ sprintf(firstpath, "%s/boards/%c, %s", BBSHOME, fname[0], fname);
+ firstpathbase = firstpath + strlen(BBSHOME) + strlen("/boards/x/");
}
if (strlen(fname) + strlen(hispaths) + 1 < sizeof(hispaths))
{
@@ -540,7 +540,7 @@ receive_control()
newsfeeds_t *nf;
bbslog("control post %s\n", HEADER[CONTROL_H]);
- boardhome = (char *) fileglue("%s/boards/control", BBSHOME);
+ boardhome = (char *) fileglue("%s/boards/c/control", BBSHOME);
testandmkdir(boardhome);
*firstpath = '\0';
if (isdir(boardhome))
@@ -549,12 +549,12 @@ receive_control()
if (fname != NULL)
{
if (firstpath[0] == '\0')
- sprintf(firstpath, "%s/boards/control/%s", BBSHOME, fname);
+ sprintf(firstpath, "%s/boards/c/control/%s", BBSHOME, fname);
if (storeDB(HEADER[MID_H], (char *) fileglue("control/%s", fname)) < 0)
{
}
bbsfeedslog(fileglue("control/%s", fname), 'C');
- firstpathbase = firstpath + strlen(BBSHOME) + strlen("/boards/");
+ firstpathbase = firstpath + strlen(BBSHOME) + strlen("/boards/x/");
splitptr = (char **) BNGsplit(GROUPS);
for (ngptr = *splitptr; ngptr != NULL; ngptr = *(++splitptr))
{
@@ -611,7 +611,7 @@ cancel_article_front(msgid)
{
*ptr++ = '\0';
}
- sprintf(filename, "%s/boards/%s", BBSHOME, file);
+ sprintf(filename, "%s/boards/%c/%s", BBSHOME, file[0], file);
bbslog("cancel post %s\n", filename);
if (isfile(filename))
{
@@ -653,7 +653,7 @@ cancel_article_front(msgid)
#ifdef KEEP_NETWORK_CANCEL
bbslog("cancel post %s\n", filename);
- boardhome = (char *) fileglue("%s/boards/deleted", BBSHOME);
+ boardhome = (char *) fileglue("%s/boards/d/deleted", BBSHOME);
testandmkdir(boardhome);
if (isdir(boardhome))
{
@@ -685,8 +685,8 @@ cancel_article_front(msgid)
{
if (firstpath[0] == '\0')
{
- sprintf(firstpath, "%s/boards/deleted/%s", BBSHOME, fname);
- firstpathbase = firstpath + strlen(BBSHOME) + strlen("/boards/");
+ sprintf(firstpath, "%s/boards/d/deleted/%s", BBSHOME, fname);
+ firstpathbase = firstpath + strlen(BBSHOME) + strlen("/boards/x/");
}
if (storeDB(HEADER[MID_H], (char *) fileglue("deleted/%s", fname)) < 0)
{
@@ -700,7 +700,7 @@ cancel_article_front(msgid)
{
char board[256];
newsfeeds_t *nf;
- char *filebase = filename + strlen(BBSHOME) + strlen("/boards/");
+ char *filebase = filename + strlen(BBSHOME) + strlen("/boards/x/");
char *filetail = strrchr(filename, '/');
if (filetail != NULL)
{
@@ -900,10 +900,10 @@ cancelpost(fileheader_t *fhdr, char* boardname)
int fd;
char fpath[MAXPATHLEN];
- sprintf(fpath, BBSHOME "/boards/%s/%s", boardname, fhdr->filename);
+ sprintf(fpath, BBSHOME "/boards/%c/%s/%s", boardname[0], boardname, fhdr->filename);
if ((fd = open(fpath, O_RDONLY)) >= 0) {
fileheader_t postfile;
- char fn2[MAXPATHLEN] = BBSHOME "/boards/deleted", *junkdir;
+ char fn2[MAXPATHLEN] = BBSHOME "/boards/d/deleted", *junkdir;
stampfile(fn2, &postfile);
memcpy(postfile.owner, fhdr->owner, IDLEN + TTLEN + 10);
@@ -1039,7 +1039,7 @@ cancel_article(homepath, board, file)
return 0;
}
size = sizeof(header);
- sprintf(dirname, "%s/boards/%s/.DIR", homepath, board);
+ sprintf(dirname, "%s/boards/%c/%s/.DIR", homepath, board[0], board);
if ((fd = open(dirname, O_RDONLY)) == -1) {
bbslog("cancel_article: open `%s` error\n", dirname);
return 0;
@@ -1173,11 +1173,11 @@ cancel_article(homepath, board, file)
PATH bdir;
struct stat stbuf;
- sprintf(bdir, "%s/boards/%s", homepath, board);
+ sprintf(bdir, "%s/boards/%c/%s", homepath, board[0], board);
stat(bdir, &stbuf);
#endif
- sprintf(fname, "%s/boards/%s/%s", homepath, board, file);
+ sprintf(fname, "%s/boards/%c/%s/%s", homepath, board[0], board, file);
unlink(fname);
/* kill it now! the function is far small then original.. :) */
/* because it won't make system load heavy like before */
diff --git a/mbbsd/admin.c b/mbbsd/admin.c
index 54fb017f..04804809 100644
--- a/mbbsd/admin.c
+++ b/mbbsd/admin.c
@@ -1,4 +1,4 @@
-/* $Id: admin.c,v 1.2 2002/03/07 16:44:18 in2 Exp $ */
+/* $Id: admin.c,v 1.3 2002/03/09 17:27:57 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -241,8 +241,8 @@ int m_mod_board(char *bname) {
if(HAS_PERM(PERM_SYSOP) ) {
char actionbuf[512];
- sprintf(actionbuf, BBSHOME "/bin/buildir boards/%s &",
- bh.brdname);
+ sprintf(actionbuf, BBSHOME "/bin/buildir boards/%c/%s &",
+ bh.brdname[0], bh.brdname);
system(actionbuf);
}
break;
@@ -284,9 +284,10 @@ int m_mod_board(char *bname) {
else {
strcpy(bname, bh.brdname);
sprintf(genbuf,
- "/bin/tar zcvf tmp/board_%s.tgz boards/%s man/%s >/dev/null 2>&1;"
- "/bin/rm -fr boards/%s man/%s",
- bname, bname, bname, bname, bname);
+ "/bin/tar zcvf tmp/board_%s.tgz boards/%c/%s man/boards/%c/%s >/dev/null 2>&1;"
+ "/bin/rm -fr boards/%c/%s man/boards/%c/%s",
+ bname, bname[0], bname, bname[0],
+ bname, bname[0], bname, bname[0], bname);
system(genbuf);
memset(&bh, 0, sizeof(bh));
sprintf(bh.title, "%s 看板 %s 刪除", bname, cuser.userid);
diff --git a/mbbsd/announce.c b/mbbsd/announce.c
index 960a45aa..0cbce01e 100644
--- a/mbbsd/announce.c
+++ b/mbbsd/announce.c
@@ -1,4 +1,4 @@
-/* $Id: announce.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: announce.c,v 1.2 2002/03/09 17:27:57 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -805,12 +805,12 @@ static void a_newitem(menu_t *pm, int mode) {
for(d = 0; d <= 3; d++) {
switch(d) {
case 0:
- sprintf(lpath, "%s%s%s/%s",
- BBSHOME, "/man/boards/",currboard , buf);
+ sprintf(lpath, BBSHOME "/man/boards/%c/%s/%s",
+ currboard[0], currboard, buf);
break;
case 1:
- sprintf(lpath, "%s%s%s",
- BBSHOME, "/man/boards/" , buf);
+ sprintf(lpath, "%s%s/%c/%s",
+ BBSHOME, "/man/boards/" , buf[0], buf);
break;
case 2:
sprintf(lpath, "%s%s%s",
diff --git a/mbbsd/cache.c b/mbbsd/cache.c
index 73f8ac5b..57ed0d3f 100644
--- a/mbbsd/cache.c
+++ b/mbbsd/cache.c
@@ -1,4 +1,4 @@
-/* $Id: cache.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: cache.c,v 1.2 2002/03/09 17:27:57 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -63,7 +63,7 @@ unsigned int safe_sleep(unsigned int seconds) {
#if defined(_BBS_UTIL_C_)
static void setapath(char *buf, char *boardname) {
- sprintf(buf, "man/boards/%s", boardname);
+ sprintf(buf, "man/boards/%c/%s", boardname[0], boardname);
}
static char *str_dotdir = ".DIR";
@@ -758,7 +758,7 @@ void setbtotal(int bid) {
char genbuf[256];
int num,fd;
- sprintf(genbuf, "boards/%s/.DIR", bh->brdname);
+ sprintf(genbuf, "boards/%c/%s/.DIR", bh->brdname[0], bh->brdname);
if((fd = open(genbuf, O_RDWR)) < 0)
return; /* .DIR掛了 */
diff --git a/mbbsd/gamble.c b/mbbsd/gamble.c
index 23867450..a2fc3c37 100644
--- a/mbbsd/gamble.c
+++ b/mbbsd/gamble.c
@@ -1,4 +1,4 @@
-/* $Id: gamble.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: gamble.c,v 1.2 2002/03/09 17:27:57 in2 Exp $ */
#include <stdio.h>
#include <time.h>
#include <string.h>
@@ -32,7 +32,7 @@ int post_msg(char* bname, char* title, char *msg, char* author)
char genbuf[256];
/* 在 bname 版發表新文章 */
- sprintf(genbuf, "boards/%s", bname);
+ sprintf(genbuf, "boards/%c/%s", bname[0], bname);
stampfile(genbuf, &fhdr);
fp = fopen(genbuf,"w");
diff --git a/mbbsd/record.c b/mbbsd/record.c
index 59bc6a75..321132f3 100644
--- a/mbbsd/record.c
+++ b/mbbsd/record.c
@@ -1,4 +1,4 @@
-/* $Id: record.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: record.c,v 1.2 2002/03/09 17:27:57 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -301,9 +301,9 @@ int delete_files(char* dirname, int (*filecheck)(), int record) {
char genbuf[256];
char deleted[256];
fileheader_t delfh;
- char deletedDIR[] = "boards/deleted/.DIR";
+ char deletedDIR[] = "boards/d/deleted/.DIR";
- strcpy(deleted, "boards/deleted");
+ strcpy(deleted, "boards/d/deleted");
if(!(fp = fopen(dirname, "r")))
return ans;
diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c
index 9218b7f0..cede4a9d 100644
--- a/mbbsd/stuff.c
+++ b/mbbsd/stuff.c
@@ -1,4 +1,4 @@
-/* $Id: stuff.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: stuff.c,v 1.2 2002/03/09 17:27:57 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -26,7 +26,7 @@ extern userec_t cuser;
/* set file path for boards/user home */
/* ----------------------------------------------------- */
static char *str_home_file = "home/%c/%s/%s";
-static char *str_board_file = "boards/%s/%s";
+static char *str_board_file = "boards/%c/%s/%s";
#define STR_DOTDIR ".DIR"
static char *str_dotdir = STR_DOTDIR;
@@ -56,7 +56,7 @@ void setuserfile(char *buf, char *fname) {
}
void setapath(char *buf, char *boardname) {
- sprintf(buf, "man/boards/%s", boardname);
+ sprintf(buf, "man/boards/%c/%s", boardname[0], boardname);
}
void setadir(char *buf, char *path) {
@@ -64,17 +64,17 @@ void setadir(char *buf, char *path) {
}
void setbpath(char *buf, char *boardname) {
- sprintf(buf, "boards/%s", boardname);
+ sprintf(buf, "boards/%c/%s", boardname[0], boardname);
}
void setbdir(char *buf, char *boardname) {
- sprintf(buf, str_board_file, boardname,
+ sprintf(buf, str_board_file, boardname[0], boardname,
currmode & MODE_ETC ? ".ETC" :
(currmode & MODE_DIGEST ? fn_mandex : str_dotdir));
}
void setbfile(char *buf, char *boardname, char *fname) {
- sprintf(buf, str_board_file, boardname, fname);
+ sprintf(buf, str_board_file, boardname[0], boardname, fname);
}
void setdirpath(char *buf, char *direct, char *fname) {
diff --git a/mbbsd/syspost.c b/mbbsd/syspost.c
index b7aefe10..67edc632 100644
--- a/mbbsd/syspost.c
+++ b/mbbsd/syspost.c
@@ -1,4 +1,4 @@
-/* $Id: syspost.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: syspost.c,v 1.2 2002/03/09 17:27:57 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <time.h>
@@ -19,7 +19,7 @@ void post_change_perm(int oldperm, int newperm, char *sysopid, char *userid) {
char genbuf[200], reason[30];
int i, flag=0;
- strcpy(genbuf, "boards/Security");
+ strcpy(genbuf, "boards/S/Security");
stampfile(genbuf, &fhdr);
if(!(fp = fopen(genbuf,"w")))
return;
@@ -49,7 +49,7 @@ void post_change_perm(int oldperm, int newperm, char *sysopid, char *userid) {
sprintf(fhdr.title, "[公安報告] 站長%s修改%s權限報告",
cuser.userid, userid);
strcpy(fhdr.owner, "[系統安全局]");
- append_record("boards/Security/.DIR", &fhdr, sizeof(fhdr));
+ append_record("boards/S/Security/.DIR", &fhdr, sizeof(fhdr));
}
}
@@ -58,7 +58,7 @@ void post_violatelaw(char* crime, char* police, char* reason, char* result){
fileheader_t fhdr;
time_t now;
FILE *fp;
- strcpy(genbuf, "boards/Security");
+ strcpy(genbuf, "boards/S/Security");
stampfile(genbuf, &fhdr);
if(!(fp = fopen(genbuf,"w")))
return;
@@ -72,9 +72,9 @@ void post_violatelaw(char* crime, char* police, char* reason, char* result){
fclose(fp);
sprintf(fhdr.title, "[報告] %-20s 違法判決報告", crime);
strcpy(fhdr.owner, "[Ptt法院]");
- append_record("boards/Security/.DIR", &fhdr, sizeof(fhdr));
+ append_record("boards/S/Security/.DIR", &fhdr, sizeof(fhdr));
- strcpy(genbuf, "boards/ViolateLaw");
+ strcpy(genbuf, "boards/V/ViolateLaw");
stampfile(genbuf, &fhdr);
if(!(fp = fopen(genbuf,"w")))
return;
@@ -89,7 +89,7 @@ void post_violatelaw(char* crime, char* police, char* reason, char* result){
sprintf(fhdr.title, "[報告] %-20s 違法判決報告", crime);
strcpy(fhdr.owner, "[Ptt法院]");
- append_record("boards/ViolateLaw/.DIR", &fhdr, sizeof(fhdr));
+ append_record("boards/V/ViolateLaw/.DIR", &fhdr, sizeof(fhdr));
}
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 41aacfa9..72850ad7 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -1,4 +1,4 @@
-/* $Id: user.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: user.c,v 1.2 2002/03/09 17:27:57 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -519,7 +519,7 @@ void uinfo_query(userec_t *u, int real, int unum) {
passwd_update(unum, &x);
now = time(0);
if(money_change) {
- strcpy(genbuf, "boards/Security");
+ strcpy(genbuf, "boards/S/Security");
stampfile(genbuf, &fhdr);
if(!(fp = fopen(genbuf,"w")))
return;
@@ -542,7 +542,7 @@ void uinfo_query(userec_t *u, int real, int unum) {
sprintf(fhdr.title, "[公安報告] 站長%s修改%s錢報告", cuser.userid,
x.userid);
strcpy(fhdr.owner, "[系統安全局]");
- append_record("boards/Security/.DIR", &fhdr, sizeof(fhdr));
+ append_record("boards/S/Security/.DIR", &fhdr, sizeof(fhdr));
}
}
}
diff --git a/mbbsd/vote.c b/mbbsd/vote.c
index 62916c99..b16857ce 100644
--- a/mbbsd/vote.c
+++ b/mbbsd/vote.c
@@ -1,4 +1,4 @@
-/* $Id: vote.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: vote.c,v 1.2 2002/03/09 17:27:57 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -281,10 +281,10 @@ static void b_result_one(boardheader_t *fh, int ind) {
b_suckinfile(frp, b_newresults);
fclose(frp);
}
- sprintf(inbuf, "boards/%s", bname);
+ sprintf(inbuf, "boards/%c/%s", bname[0], bname);
vote_report(bname, b_report, inbuf);
if(!(fh->brdattr &BRD_NOCOUNT)) {
- sprintf(inbuf, "boards/%s", "Record");
+ sprintf(inbuf, "boards/%c/%s", 'R', "Record");
vote_report(bname, b_report, inbuf);
}
unlink(b_report);
diff --git a/util/account.c b/util/account.c
index e4166092..1be06f59 100644
--- a/util/account.c
+++ b/util/account.c
@@ -1,4 +1,4 @@
-/* $Id: account.c,v 1.1 2002/03/07 15:13:45 in2 Exp $ */
+/* $Id: account.c,v 1.2 2002/03/09 17:29:20 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -54,7 +54,7 @@ keeplog(fpath, board, title)
board = "Record";
- sprintf(genbuf, "boards/%s", board);
+ sprintf(genbuf, "boards/%c/%s", board[0], board);
stampfile(genbuf, &fhdr);
sprintf(buf, "mv %s %s", fpath, genbuf);
system(buf);
@@ -63,7 +63,7 @@ keeplog(fpath, board, title)
*/
strcpy(fhdr.title, title);
strcpy(fhdr.owner, "[歷史老師]");
- sprintf(genbuf, "boards/%s/.DIR", board);
+ sprintf(genbuf, "boards/%c/%s/.DIR", board[0], board);
append_record(genbuf, &fhdr, sizeof(fhdr));
if((bid = getbnum(board)) > 0)touchbtotal(bid);
diff --git a/util/buildAnnounce.c b/util/buildAnnounce.c
index 0e754f22..3fa8a6a7 100644
--- a/util/buildAnnounce.c
+++ b/util/buildAnnounce.c
@@ -15,36 +15,35 @@ extern void resolve_boards();
void buildchilds(int level,char *path,boardheader_t *bptr)
{
- char newpath[512];
- boardheader_t *ptr;
- fileheader_t item;
-
- if(bptr->firstchild[1]==(boardheader_t*)~0 || bptr->firstchild[1]==NULL)
- return;
- for(ptr =(void*) bptr->firstchild[1];
- ptr!=(boardheader_t*)~0 ;ptr=ptr->next[1])
- {
-
+ char newpath[512];
+ boardheader_t *ptr;
+ fileheader_t item;
+
+ if(bptr->firstchild[1]==(boardheader_t*)~0 || bptr->firstchild[1]==NULL)
+ return;
+ for(ptr =(void*) bptr->firstchild[1];
+ ptr!=(boardheader_t*)~0 ;ptr=ptr->next[1]){
+
if(
- (ptr->brdattr&(BRD_BAD | BRD_GROUPBOARD | BRD_NOCOUNT | BRD_HIDE))!=0
- ||
- (ptr->level && !(ptr->brdattr & BRD_POSTMASK))) continue;
+ (ptr->brdattr&(BRD_BAD | BRD_GROUPBOARD | BRD_NOCOUNT | BRD_HIDE))!=0
+ ||
+ (ptr->level && !(ptr->brdattr & BRD_POSTMASK)))
+ continue;
printf("%*.*s+-%-14s %-s \n",level*2,level*2,"| | | | | | | | |",
- ptr->brdname, ptr->title);
- if(ptr->brdattr & BRD_GROUPBOARD)
- {
- sprintf(newpath,"%s/%s",path,ptr->brdname);
- mkdir(newpath,0766);
- buildchilds(level+1,newpath,ptr);
- }
- else
- {
- printf("%s4\n",ptr->brdname);
- sprintf(newpath,"/bin/ln -s "BBSHOME"/man/boards/%s %s/%s",
- ptr->brdname,path,ptr->brdname);
- system(newpath);
- }
- printf("%s5\n",ptr->brdname);
+ ptr->brdname, ptr->title);
+ if(ptr->brdattr & BRD_GROUPBOARD){
+ sprintf(newpath,"%s/%s",path,ptr->brdname);
+ mkdir(newpath,0766);
+ buildchilds(level+1,newpath,ptr);
+ }
+ else{
+ printf("%s4\n",ptr->brdname);
+ sprintf(newpath,"/bin/ln -s "BBSHOME"/man/boards/%c/%s %s/%s",
+ /* maybe something wrong with this ^^^^^ */
+ ptr->brdname[0], ptr->brdname,path,ptr->brdname);
+ system(newpath);
+ }
+ printf("%s5\n",ptr->brdname);
sprintf(newpath,"%s/.DIR",path);
strcpy(item.owner,ptr->BM);
strtok(item.owner,"/");
@@ -52,18 +51,18 @@ void buildchilds(int level,char *path,boardheader_t *bptr)
item.savemode = 'D';
sprintf(item.filename,ptr->brdname);
append_record(newpath, &item, sizeof(item));
- }
+ }
}
int main()
{
- char path[512];
- setsid();
- strcpy(path,GROUPROOT);
- system("rm -rf "GROUPROOT);
- mkdir(GROUPROOT,0766);
- resolve_boards();
- buildchilds(0,path,&bcache[0]);
- return 0;
+ char path[512];
+ setsid();
+ strcpy(path,GROUPROOT);
+ system("rm -rf "GROUPROOT);
+ mkdir(GROUPROOT,0766);
+ resolve_boards();
+ buildchilds(0,path,&bcache[0]);
+ return 0;
}
diff --git a/util/initbbs.c b/util/initbbs.c
index ce6c4361..c70ab826 100644
--- a/util/initbbs.c
+++ b/util/initbbs.c
@@ -1,4 +1,4 @@
-/* $Id: initbbs.c,v 1.1 2002/03/07 15:13:46 in2 Exp $ */
+/* $Id: initbbs.c,v 1.2 2002/03/09 17:29:20 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -51,9 +51,9 @@ static void newboard(FILE *fp, boardheader_t *b) {
char buf[256];
fwrite(b, sizeof(boardheader_t), 1, fp);
- sprintf(buf, "boards/%s", b->brdname);
+ sprintf(buf, "boards/%c/%s", b->brdname[0], b->brdname);
mkdir(buf, 0755);
- sprintf(buf, "man/boards/%s", b->brdname);
+ sprintf(buf, "man/boards/%c/%s", b->brdname[0], b->brdname);
mkdir(buf, 0755);
}
@@ -159,31 +159,31 @@ static void initMan() {
f.money = 0;
f.filemode = 0;
- if((fp = fopen("man/boards/Note/.DIR", "w"))) {
+ if((fp = fopen("man/boards/N/Note/.DIR", "w"))) {
strcpy(f.filename, "SONGBOOK");
strcpy(f.title, "◆ 【點 歌 歌 本】");
fwrite(&f, sizeof(f), 1, fp);
- mkdir("man/boards/Note/SONGBOOK", 0755);
+ mkdir("man/boards/N/Note/SONGBOOK", 0755);
strcpy(f.filename, "SONGO");
strcpy(f.title, "◆ <點歌> 動態看板");
fwrite(&f, sizeof(f), 1, fp);
- mkdir("man/boards/Note/SONGO", 0755);
+ mkdir("man/boards/N/Note/SONGO", 0755);
strcpy(f.filename, "SYS");
strcpy(f.title, "◆ <系統> 動態看板");
fwrite(&f, sizeof(f), 1, fp);
- mkdir("man/boards/Note/SYS", 0755);
+ mkdir("man/boards/N/Note/SYS", 0755);
strcpy(f.filename, "AD");
strcpy(f.title, "◆ <廣告> 動態看板");
fwrite(&f, sizeof(f), 1, fp);
- mkdir("man/boards/Note/AD", 0755);
+ mkdir("man/boards/N/Note/AD", 0755);
strcpy(f.filename, "NEWS");
strcpy(f.title, "◆ <新聞> 動態看板");
fwrite(&f, sizeof(f), 1, fp);
- mkdir("man/boards/Note/NEWS", 0755);
+ mkdir("man/boards/N/Note/NEWS", 0755);
fclose(fp);
}
@@ -191,9 +191,9 @@ static void initMan() {
}
static void initSymLink() {
- symlink(BBSHOME "/man/boards/Note/SONGBOOK", BBSHOME "/etc/SONGBOOK");
- symlink(BBSHOME "/man/boards/Note/SONGO", BBSHOME "/etc/SONGO");
- symlink(BBSHOME "/man/boards/EditExp", BBSHOME "/etc/editexp");
+ symlink(BBSHOME "/man/boards/N/Note/SONGBOOK", BBSHOME "/etc/SONGBOOK");
+ symlink(BBSHOME "/man/boards/N/Note/SONGO", BBSHOME "/etc/SONGO");
+ symlink(BBSHOME "/man/boards/E/EditExp", BBSHOME "/etc/editexp");
}
static void initHistory() {
diff --git a/util/kenben.c b/util/kenben.c
index 5733f4da..e5d52385 100644
--- a/util/kenben.c
+++ b/util/kenben.c
@@ -13,9 +13,9 @@ void main()
fgets(line,255,fin);
line[12] = '\0';
- sprintf(genbuf, "cd ~/boards/%s;grep "
- "超過一個月無廣告以外的本站文章發表。"
- " *.A > ~/pttbbs/util/kenken.txt",line);
+ sprintf(genbuf, "cd ~/boards/%c/%s;grep "
+ "超過一個月無廣告以外的本站文章發表。"
+ " *.A > ~/pttbbs/util/kenken.txt", line[0], line);
system(genbuf);
fout = fopen("kenken.txt","r");
@@ -33,7 +33,7 @@ void main()
break;
}
}
- sprintf(genbuf, "cd ~/boards/%s;rm %s",line, tok);
+ sprintf(genbuf, "cd ~/boards/%c/%s;rm %s", line[0], line, tok);
// printf("%s \n", genbuf);
system(genbuf);
}
diff --git a/util/parse_news.c b/util/parse_news.c
index bebed3f4..fc24a2d6 100644
--- a/util/parse_news.c
+++ b/util/parse_news.c
@@ -1,4 +1,4 @@
-/* $Id: parse_news.c,v 1.1 2002/03/07 15:13:46 in2 Exp $ */
+/* $Id: parse_news.c,v 1.2 2002/03/09 17:29:20 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -10,7 +10,7 @@
#include "pttstruct.h"
#include "util.h"
-#define NEWSDIRECT BBSHOME "/boards/newspaper"
+#define NEWSDIRECT BBSHOME "/boards/n/newspaper"
#define MOVIEDIRECT BBSHOME "/etc/NEWS"
int main() {
diff --git a/util/post.c b/util/post.c
index efec797f..d4907096 100644
--- a/util/post.c
+++ b/util/post.c
@@ -1,4 +1,4 @@
-/* $Id: post.c,v 1.1 2002/03/07 15:13:46 in2 Exp $ */
+/* $Id: post.c,v 1.2 2002/03/09 17:29:20 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
@@ -13,7 +13,7 @@ void keeplog(FILE *fin, char *fpath, char *board, char *title, char *owner) {
FILE *fout;
int bid;
- sprintf(genbuf, BBSHOME "/boards/%s", board);
+ sprintf(genbuf, BBSHOME "/boards/%c/%s", board[0], board);
stampfile(genbuf, &fhdr);
if(!(fout = fopen(genbuf, "w"))) {
@@ -31,7 +31,7 @@ void keeplog(FILE *fin, char *fpath, char *board, char *title, char *owner) {
fhdr.title[sizeof(fhdr.title) - 1] = '\0';
strcpy(fhdr.owner, owner);
- sprintf(genbuf, BBSHOME "/boards/%s/.DIR", board);
+ sprintf(genbuf, BBSHOME "/boards/%c/%s/.DIR", board[0], board);
append_record(genbuf, &fhdr, sizeof(fhdr));
if((bid = getbnum(board)) > 0)
touchbtotal(bid);
diff --git a/util/smtest.c b/util/smtest.c
index 16a2360d..7657762f 100644
--- a/util/smtest.c
+++ b/util/smtest.c
@@ -170,7 +170,7 @@ int main()
(allbrd[i].brdattr & BRD_BAD) ||
(allbrd[i].level != 0)) continue;
- sprintf(fname, BBSHOME "/boards/%s/.DIR",allbrd[i].brdname);
+ sprintf(fname, BBSHOME "/boards/%c/%s/.DIR", allbrd[i].brdname[0], allbrd[i].brdname);
/* get date to choose junk board */
/* exception when ood == 2 */
@@ -237,6 +237,10 @@ int main()
allbrd[i].brdname, BTLEN-26, BTLEN-26, allbrd[i].title,
IDLEN - 5, IDLEN-5,hdr.date, IDLEN * 3, IDLEN * 3, allbrd[i].BM);
+ /* if you want to unmark these code,
+ make sure board, man path have changed to [man/]boards/<First char of brdname>/brdname
+ */
+
// strcpy(bname, allbrd[i].brdname);
// sprintf(genbuf,
// "/bin/tar zcvf ~/tmp/board_%s.tgz boards/%s man/%s>/dev/null 2>&1;"
@@ -283,8 +287,9 @@ int main()
bid = getbnum(bname);
strcpy(bname,"jourslamdunk");
sprintf(genbuf,
- "/bin/tar zcvf ~/tmp/board_%s.tgz boards/%s man/%s>/dev/null 2>&1;"
- "/bin/rm -fr ~/boards/%s man/%s",bname, bname, bname,bname,bname);
+ "/bin/tar zcvf ~/tmp/board_%s.tgz boards/%c/%s man/%c/%s>/dev/null 2>&1;"
+ "/bin/rm -fr ~/boards/%c/%s man/%c/%s",
+ bname, bname[0], bname, bname[0], bname, bname[0], bname, bname[0], bname);
system(genbuf);
memset(&bh, 0, sizeof(bh));
diff --git a/util/util_cache.c b/util/util_cache.c
index 12a01994..0e1ab5a1 100644
--- a/util/util_cache.c
+++ b/util/util_cache.c
@@ -1,4 +1,4 @@
-/* $Id: util_cache.c,v 1.1 2002/03/07 15:13:46 in2 Exp $ */
+/* $Id: util_cache.c,v 1.2 2002/03/09 17:29:20 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -50,7 +50,7 @@ unsigned int safe_sleep(unsigned int seconds) {
}
void setapath(char *buf, char *boardname) {
- sprintf(buf, "man/boards/%s", boardname);
+ sprintf(buf, "man/boards/%c/%s", boardname[0], boardname);
}
static char *str_dotdir = ".DIR";