diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-01-16 21:28:48 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-01-16 21:28:48 +0800 |
commit | f20ec866a1837924674452effdd1bc99df77e258 (patch) | |
tree | cdff800c75bdacefb68fbc180b4d0610cd4b990d | |
parent | ab3ed372972ab2a54d56914c7696412da1a38f48 (diff) | |
download | pttbbs-f20ec866a1837924674452effdd1bc99df77e258.tar pttbbs-f20ec866a1837924674452effdd1bc99df77e258.tar.gz pttbbs-f20ec866a1837924674452effdd1bc99df77e258.tar.bz2 pttbbs-f20ec866a1837924674452effdd1bc99df77e258.tar.lz pttbbs-f20ec866a1837924674452effdd1bc99df77e258.tar.xz pttbbs-f20ec866a1837924674452effdd1bc99df77e258.tar.zst pttbbs-f20ec866a1837924674452effdd1bc99df77e258.zip |
move post_msg() and post_file() from gamble.c to syspost.c
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@608 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | include/proto.h | 5 | ||||
-rw-r--r-- | mbbsd/gamble.c | 56 | ||||
-rw-r--r-- | mbbsd/syspost.c | 55 |
3 files changed, 58 insertions, 58 deletions
diff --git a/include/proto.h b/include/proto.h index 4cfcef28..7d847285 100644 --- a/include/proto.h +++ b/include/proto.h @@ -1,4 +1,4 @@ -/* $Id: proto.h,v 1.32 2003/01/09 11:44:28 in2 Exp $ */ +/* $Id: proto.h,v 1.33 2003/01/16 13:28:48 kcwu Exp $ */ #ifndef INCLUDE_PROTO_H #define INCLUDE_PROTO_H @@ -213,7 +213,6 @@ void friend_delete(char *uident, int type); /* gamble */ int ticket_main(); -int post_msg(char* bname, char* title, char *msg, char* author); int openticket(int bid); int ticket(int bid); @@ -448,6 +447,8 @@ int userid_is_BM(char *userid, char *list); int is_uBM(char *list, char *id); /* syspost */ +int post_msg(char* bname, char* title, char *msg, char* author); +int post_file(char *bname, char *title, char *filename, char *author); void post_newboard(char *bgroup, char *bname, char *bms); void post_violatelaw(char *crime, char *police, char *reason, char *result); void post_change_perm(int oldperm, int newperm, char *sysopid, char *userid); diff --git a/mbbsd/gamble.c b/mbbsd/gamble.c index 8ade3999..ed4cb724 100644 --- a/mbbsd/gamble.c +++ b/mbbsd/gamble.c @@ -1,4 +1,4 @@ -/* $Id: gamble.c,v 1.29 2002/12/26 09:46:04 kcwu Exp $ */ +/* $Id: gamble.c,v 1.30 2003/01/16 13:28:48 kcwu Exp $ */ #include "bbs.h" #ifndef _BBS_UTIL_C_ @@ -9,60 +9,6 @@ static char betname[MAX_ITEM][MAX_ITEM_LEN]; static int currbid; -int -post_msg(char *bname, char *title, char *msg, char *author) -{ - FILE *fp; - int bid; - fileheader_t fhdr; - char genbuf[256]; - - /* 在 bname 板發表新文章 */ - snprintf(genbuf, sizeof(genbuf), "boards/%c/%s", bname[0], bname); - stampfile(genbuf, &fhdr); - fp = fopen(genbuf, "w"); - - if (!fp) - return -1; - - fprintf(fp, "作者: %s 看板: %s\n標題: %s \n", author, bname, title); - fprintf(fp, "時間: %s\n", ctime(&now)); - - /* 文章的內容 */ - fprintf(fp, "%s", msg); - fclose(fp); - - /* 將檔案加入列表 */ - strlcpy(fhdr.title, title, sizeof(fhdr.title)); - strlcpy(fhdr.owner, author, sizeof(fhdr.owner)); - setbdir(genbuf, bname); - if (append_record(genbuf, &fhdr, sizeof(fhdr)) != -1) - if ((bid = getbnum(bname)) > 0) - setbtotal(bid); - return 0; -} - -int -post_file(char *bname, char *title, char *filename, char *author) -{ - int size = dashs(filename); - char *msg; - FILE *fp; - - if (size <= 0) - return -1; - if (!(fp = fopen(filename, "r"))) - return -1; - msg = (char *)malloc(size + 1); - size = fread(msg, 1, size, fp); - msg[size] = 0; - size = post_msg(bname, title, msg, author); - fclose(fp); - free(msg); - return size; -} - - static int load_ticket_record(char *direct, int ticket[]) { diff --git a/mbbsd/syspost.c b/mbbsd/syspost.c index 36939485..a44ffdb3 100644 --- a/mbbsd/syspost.c +++ b/mbbsd/syspost.c @@ -1,6 +1,59 @@ -/* $Id: syspost.c,v 1.16 2002/11/15 05:56:10 lwms Exp $ */ +/* $Id: syspost.c,v 1.17 2003/01/16 13:28:48 kcwu Exp $ */ #include "bbs.h" +int +post_msg(char *bname, char *title, char *msg, char *author) +{ + FILE *fp; + int bid; + fileheader_t fhdr; + char genbuf[256]; + + /* 在 bname 板發表新文章 */ + snprintf(genbuf, sizeof(genbuf), "boards/%c/%s", bname[0], bname); + stampfile(genbuf, &fhdr); + fp = fopen(genbuf, "w"); + + if (!fp) + return -1; + + fprintf(fp, "作者: %s 看板: %s\n標題: %s \n", author, bname, title); + fprintf(fp, "時間: %s\n", ctime(&now)); + + /* 文章的內容 */ + fprintf(fp, "%s", msg); + fclose(fp); + + /* 將檔案加入列表 */ + strlcpy(fhdr.title, title, sizeof(fhdr.title)); + strlcpy(fhdr.owner, author, sizeof(fhdr.owner)); + setbdir(genbuf, bname); + if (append_record(genbuf, &fhdr, sizeof(fhdr)) != -1) + if ((bid = getbnum(bname)) > 0) + setbtotal(bid); + return 0; +} + +int +post_file(char *bname, char *title, char *filename, char *author) +{ + int size = dashs(filename); + char *msg; + FILE *fp; + + if (size <= 0) + return -1; + if (!(fp = fopen(filename, "r"))) + return -1; + msg = (char *)malloc(size + 1); + size = fread(msg, 1, size, fp); + msg[size] = 0; + size = post_msg(bname, title, msg, author); + fclose(fp); + free(msg); + return size; +} + void post_change_perm(int oldperm, int newperm, char *sysopid, char *userid) { |