summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-03-10 01:29:36 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-03-10 01:29:36 +0800
commit90451291f8f509d0f0e3f1c442bb3325de30d9b0 (patch)
tree1d5737feb5cb95e231206b875c21d2d8f88607c6 /util
parenta0baab6a9bbe6e76779927273f3faeba5b4d3990 (diff)
downloadpttbbs-90451291f8f509d0f0e3f1c442bb3325de30d9b0.tar
pttbbs-90451291f8f509d0f0e3f1c442bb3325de30d9b0.tar.gz
pttbbs-90451291f8f509d0f0e3f1c442bb3325de30d9b0.tar.bz2
pttbbs-90451291f8f509d0f0e3f1c442bb3325de30d9b0.tar.lz
pttbbs-90451291f8f509d0f0e3f1c442bb3325de30d9b0.tar.xz
pttbbs-90451291f8f509d0f0e3f1c442bb3325de30d9b0.tar.zst
pttbbs-90451291f8f509d0f0e3f1c442bb3325de30d9b0.zip
boards/<hash>/<brdname>
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@15 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util')
-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
8 files changed, 70 insertions, 66 deletions
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";