diff options
author | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-01-30 16:38:11 +0800 |
---|---|---|
committer | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-01-30 16:38:11 +0800 |
commit | eae64d6b29a669ab1ed32bcb10e3de803544e705 (patch) | |
tree | e311648ab2bf816a4db5fc3cad29902d82797f71 /mbbsd | |
parent | a213953b467d6f70300363694b2a9474a98feb7a (diff) | |
download | pttbbs-eae64d6b29a669ab1ed32bcb10e3de803544e705.tar pttbbs-eae64d6b29a669ab1ed32bcb10e3de803544e705.tar.gz pttbbs-eae64d6b29a669ab1ed32bcb10e3de803544e705.tar.bz2 pttbbs-eae64d6b29a669ab1ed32bcb10e3de803544e705.tar.lz pttbbs-eae64d6b29a669ab1ed32bcb10e3de803544e705.tar.xz pttbbs-eae64d6b29a669ab1ed32bcb10e3de803544e705.tar.zst pttbbs-eae64d6b29a669ab1ed32bcb10e3de803544e705.zip |
Do not overwrite chess_list when creating man files.
Using symbolic link instead of direct directory name.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2447 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/admin.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/mbbsd/admin.c b/mbbsd/admin.c index 00442c70..52099be9 100644 --- a/mbbsd/admin.c +++ b/mbbsd/admin.c @@ -277,12 +277,14 @@ AddingChessCountryFiles(const char* apath) /* creating member list */ snprintf(filename, sizeof(filename), "%s/chess_list", apath); - fp = fopen(filename, "w"); - fputs("棋國國名\n" - "帳號 階級 加入日期 等級或被誰俘虜\n" - "────── ─── ───── ───────\n", - fp); - fclose(fp); + if (!dashf(filename)) { + fp = fopen(filename, "w"); + fputs("棋國國名\n" + "帳號 階級 加入日期 等級或被誰俘虜\n" + "────── ─── ───── ───────\n", + fp); + fclose(fp); + } strlcpy(symbolicname, apath, sizeof(symbolicname)); stampfile(symbolicname, &fh); @@ -295,7 +297,11 @@ AddingChessCountryFiles(const char* apath) /* creating profession photos' dir */ snprintf(filename, sizeof(filename), "%s/chess_photo", apath); mkdir(filename, 0755); - strcpy(fh.filename, "chess_photo"); + + strlcpy(symbolicname, apath, sizeof(symbolicname)); + stampfile(symbolicname, &fh); + symlink("chess_photo", symbolicname); + strcpy(fh.title, "◆ 棋國照片檔 (不能刪除,系統需要)"); strcpy(fh.owner, "SYSOP"); append_record(adir, &fh, sizeof(fileheader_t)); @@ -304,7 +310,7 @@ AddingChessCountryFiles(const char* apath) /* 自動設立精華區 */ void -setup_man(boardheader_t * board) +setup_man(boardheader_t * board, boardheader_t * oldboard) { char genbuf[200]; @@ -312,8 +318,10 @@ setup_man(boardheader_t * board) mkdir(genbuf, 0755); #ifdef CHESSCOUNTRY - if (board->chesscountry != CHESSCODE_NONE) - AddingChessCountryFiles(genbuf); + if (oldboard == NULL || oldboard->chesscountry != board->chesscountry) + if (board->chesscountry != CHESSCODE_NONE) + AddingChessCountryFiles(genbuf); + // else // doesn't remove files.. #endif } @@ -608,7 +616,7 @@ m_mod_board(char *bname) setapath(tar, newbh.brdname); Rename(src, tar); } - setup_man(&newbh); + setup_man(&newbh, &bh); substitute_record(fn_board, &newbh, sizeof(newbh), bid); reset_board(bid); sort_bcache(); @@ -891,7 +899,7 @@ m_newbrd(int recover) add_board_record(&newboard); getbcache(class_bid)->childcount = 0; pressanykey(); - setup_man(&newboard); + setup_man(&newboard, NULL); outs("\n新板成立"); post_newboard(newboard.title, newboard.brdname, newboard.BM); log_usies("NewBoard", newboard.title); |