summaryrefslogtreecommitdiffstats
path: root/mbbsd/syspost.c
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd/syspost.c')
-rw-r--r--mbbsd/syspost.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/mbbsd/syspost.c b/mbbsd/syspost.c
index 6654d5ba..b4d56c73 100644
--- a/mbbsd/syspost.c
+++ b/mbbsd/syspost.c
@@ -1,13 +1,16 @@
/* $Id$ */
#include "bbs.h"
-int
-post_msg(const char *bname, const char *title, const char *msg, const char *author)
+int
+post_msg_fpath(const char* bname, const char* title, const char *msg, const char* author, char *fname)
{
FILE *fp;
int bid;
fileheader_t fhdr;
- char fname[PATHLEN];
+ char dirfn[PATHLEN];
+
+ // fname should be lengthed in PATHLEN
+ assert(fname);
/* 在 bname 板發表新文章 */
setbpath(fname, bname);
@@ -27,13 +30,20 @@ post_msg(const char *bname, const char *title, const char *msg, const char *auth
/* 將檔案加入列表 */
strlcpy(fhdr.title, title, sizeof(fhdr.title));
strlcpy(fhdr.owner, author, sizeof(fhdr.owner));
- setbdir(fname, bname);
- if (append_record(fname, &fhdr, sizeof(fhdr)) != -1)
+ setbdir(dirfn, bname);
+ if (append_record(dirfn, &fhdr, sizeof(fhdr)) != -1)
if ((bid = getbnum(bname)) > 0)
setbtotal(bid);
return 0;
}
+int
+post_msg(const char* bname, const char* title, const char *msg, const char* author)
+{
+ char fname[PATHLEN];
+ return post_msg_fpath(bname, title, msg, author, fname);
+}
+
int
post_file(const char *bname, const char *title, const char *filename, const char *author)
{