summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-11-15 07:03:42 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-11-15 07:03:42 +0800
commite644996aa66e0e3f1ab9c14ef3135bfde2dd5912 (patch)
tree112623d73caa364e2cd30842f5f8f0163dc384b4 /mbbsd
parentf6e922eff16029374e8853e1c71469861c5d8997 (diff)
downloadpttbbs-e644996aa66e0e3f1ab9c14ef3135bfde2dd5912.tar
pttbbs-e644996aa66e0e3f1ab9c14ef3135bfde2dd5912.tar.gz
pttbbs-e644996aa66e0e3f1ab9c14ef3135bfde2dd5912.tar.bz2
pttbbs-e644996aa66e0e3f1ab9c14ef3135bfde2dd5912.tar.lz
pttbbs-e644996aa66e0e3f1ab9c14ef3135bfde2dd5912.tar.xz
pttbbs-e644996aa66e0e3f1ab9c14ef3135bfde2dd5912.tar.zst
pttbbs-e644996aa66e0e3f1ab9c14ef3135bfde2dd5912.zip
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1336 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/announce.c9
-rw-r--r--mbbsd/bbs.c24
-rw-r--r--mbbsd/board.c13
-rw-r--r--mbbsd/friend.c5
-rw-r--r--mbbsd/kaede.c18
5 files changed, 37 insertions, 32 deletions
diff --git a/mbbsd/announce.c b/mbbsd/announce.c
index c3a267a9..c316db20 100644
--- a/mbbsd/announce.c
+++ b/mbbsd/announce.c
@@ -346,20 +346,19 @@ a_pasteitem(menu_t * pm, int mode)
if (HAS_PERM(PERM_BBSADM))
Link(copyfile, newpath);
else {
- snprintf(buf, sizeof(buf),
- "/bin/cp %s %s", copyfile, newpath);
- system(buf);
+ Copy(copyfile, newpath);
}
} else if (dashf(copyfile)) {
stampfile(newpath, &item);
memcpy(copytitle, "◇", 2);
- snprintf(buf, sizeof(buf), "/bin/cp %s %s", copyfile, newpath);
+ Copy(copyfile, newpath);
} else if (dashd(copyfile)) {
stampdir(newpath, &item);
memcpy(copytitle, "◆", 2);
snprintf(buf, sizeof(buf),
"/bin/cp -r %s/* %s/.D* %s", copyfile, copyfile,
newpath);
+ system(buf);
} else {
outs("無法拷貝!");
igetch();
@@ -368,8 +367,6 @@ a_pasteitem(menu_t * pm, int mode)
strlcpy(item.owner, *copyowner ? copyowner : cuser.userid,
sizeof(item.owner));
strlcpy(item.title, copytitle, sizeof(item.title));
- if (!*copyowner)
- system(buf);
a_additem(pm, &item);
copyfile[0] = '\0';
}
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 7dc00eda..eb357b50 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -581,17 +581,15 @@ do_general(int isbid)
else {
if(!isbid)
{
- sprintf(buf,"種類:");
- for(i=0; i<8 && bp->posttype[i*2]; i++)
- sprintf(buf+6+7*i,"%d.%2.2s ", i+1, bp->posttype+2*i);
- if(i==0)
- {
- strcat(buf, "1.問題 2.建議 3.討論 4.心得 5.閒聊 6.請益 "
- "7.公告 8.情報 ");
- i=8;
- }
- sprintf(buf+6+7*i,"(1-%d或不選)",i);
- getdata(21, 0, buf, save_title, 3, LCECHO);
+ move(21,0);
+ prints("種類:");
+ for(i=0; i<8 && bp->posttype[i*4]; i++)
+ strncpy(ctype[i],bp->posttype+4*i,4);
+ if(i==0) i=8;
+ for(aborted=0; aborted<i; aborted++)
+ prints("%d.%4.4s ", i+1, ctype[i]);
+ prints(buf,"(1-%d或不選)",i);
+ getdata(21, 6+7*i, buf, save_title, 3, LCECHO);
local_article = save_title[0] - '1';
if (local_article >= 0 && local_article <= 6)
snprintf(save_title, sizeof(save_title),
@@ -844,7 +842,7 @@ b_posttype(int ent, fileheader_t * fhdr, char *direct)
{
boardheader_t *bp;
int i, aborted;
- char filepath[256], genbuf[6], title[3], posttype_f, posttype[33];
+ char filepath[256], genbuf[6], title[5], posttype_f, posttype[33];
if(!currmode & MODE_BOARD) return DONOTHING;
@@ -861,7 +859,7 @@ b_posttype(int ent, fileheader_t * fhdr, char *direct)
genbuf[4]=0;
sprintf(title,"%d.",i+1);
if(!getdata_buf(2,10, title, genbuf, 5, DOECHO)) break;
- sprintf(posttype+i*4,"%4.4s", genbuf);
+ sprintf(posttype+i*4,"%-4.4s", genbuf);
if( posttype_f & (1<<i) )
{
if(getdata(2, 20, "設定範本格式?(Y/n)", genbuf, 3, LCECHO) &&
diff --git a/mbbsd/board.c b/mbbsd/board.c
index 23aec763..ffcb395b 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -1065,8 +1065,6 @@ set_menu_BM(char *BM)
}
}
-static char *privateboard =
-"\n\n\n\n 對不起 此板目前只准看板好友進入 請先向板主申請入境許\可";
static void
choose_board(int newflag)
@@ -1352,7 +1350,6 @@ choose_board(int newflag)
case 'K':
if (HAS_PERM(PERM_BASIC)) {
char c, fname[80], genbuf[256];
- int fd;
c = getans("請選擇 1)清除不可見看板 2)備份我的最愛 3)取回最愛備份 [Q]");
if(!c)
break;
@@ -1364,19 +1361,17 @@ choose_board(int newflag)
break;
case '2':
setuserfile(fname, FAV3);
- sprintf(genbuf, "cp -f %s %s.bak", fname, fname);
- system(genbuf);
+ sprintf(genbuf, "%s.bak", fname);
+ Copy(fname, genbuf);
break;
case '3':
setuserfile(fname, FAV3);
sprintf(genbuf, "%s.bak", fname);
- if((fd = open(genbuf, O_RDONLY)) < 0){
+ if(!dashf(genbuf)){
vmsg("你沒有備份你的最愛喔");
break;
}
- close(fd);
- sprintf(genbuf, "cp -f %s.bak %s", fname, fname);
- system(genbuf);
+ Copy(genbuf, fname);
freefav(fav);
load_brdbuf();
favchange = 1;
diff --git a/mbbsd/friend.c b/mbbsd/friend.c
index ab9f1076..6d7ed3f5 100644
--- a/mbbsd/friend.c
+++ b/mbbsd/friend.c
@@ -333,9 +333,8 @@ friend_edit(int type)
if (type == FRIEND_ALOHA || type == FRIEND_POST) {
if (dashf(fpath)) {
- snprintf(genbuf, sizeof(genbuf),
- "/bin/cp %s %s.old", fpath, fpath);
- system(genbuf);
+ sprintf(genbuf,"%s.old",fpath);
+ Copy(fpath, genbuf);
}
}
dirty = 0;
diff --git a/mbbsd/kaede.c b/mbbsd/kaede.c
index 8b9d859e..e52bb6fc 100644
--- a/mbbsd/kaede.c
+++ b/mbbsd/kaede.c
@@ -1,4 +1,4 @@
-/* $Id: kaede.c,v 1.15 2003/06/28 08:52:18 kcwu Exp $ */
+/* $Id$ */
#include "bbs.h"
char *
@@ -74,6 +74,22 @@ Rename(char *src, char *dst)
}
int
+Copy(char *src, char *dst)
+{
+ FILE *fi, *fo;
+ char buf[513];
+ fi=fopen(src, "r");
+ if(!fi) return -1;
+ fo=fopen(dst, "w");
+ if(!fo) {fclose(fi); return -1;}
+ buf[512]=0;
+ while(fgets(buf,512,fi))
+ fputs(buf,fo);
+ fclose(fo);
+ fclose(fi);
+ return 0;
+}
+int
Link(char *src, char *dst)
{
char cmd[200];