From d15c59c0a5da62f529343a6623686436ecef0752 Mon Sep 17 00:00:00 2001 From: victor Date: Wed, 19 Jan 2005 01:27:07 +0000 Subject: fix missing initialization (default is insert mode) fix possible error about anonymous mode git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2409 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- include/proto.h | 2 +- mbbsd/bbs.c | 2 +- mbbsd/edit.c | 16 ++++++++-------- mbbsd/mail.c | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/proto.h b/include/proto.h index 61897662..a6d3140d 100644 --- a/include/proto.h +++ b/include/proto.h @@ -192,7 +192,7 @@ int dice_main(void); /* edit */ int vedit(char *fpath, int saveheader, int *islocal); -void write_header(FILE *fp); +void write_header(FILE *fp, int ifuseanony); void addsignature(FILE *fp, int ifuseanony); void auto_backup(void); void restore_backup(void); diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 5e4e827f..361738e3 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -1082,7 +1082,7 @@ cross_post(int ent, fileheader_t * fhdr, char *direct) strlcpy(save_title, xfile.title, sizeof(save_title)); save_currboard = currboard; currboard = xboard; - write_header(xptr); + write_header(xptr, 0); currboard = save_currboard; fprintf(xptr, "※ [本文轉錄自 %s 看板]\n\n", currboard); diff --git a/mbbsd/edit.c b/mbbsd/edit.c index 69756bc2..7e499d3e 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -144,6 +144,7 @@ void init_edit_buffer(editor_internal_t *buf) buf->insert_character = 1; buf->redraw_everything = 1; + buf->indent_mode = 0; buf->line_dirty = 0; buf->currpnt = 0; buf->totaln = 0; @@ -946,7 +947,7 @@ read_file(char *fpath) } void -write_header(FILE * fp) +write_header(FILE * fp, int ifuseanony) { if (curredit & EDIT_MAIL || curredit & EDIT_LIST) { @@ -965,8 +966,7 @@ write_header(FILE * fp) memset(&postlog, 0, sizeof(postlog)); strlcpy(postlog.author, cuser.userid, sizeof(postlog.author)); - if (curr_buf) - curr_buf->ifuseanony = 0; + ifuseanony = 0; #ifdef HAVE_ANONYMOUS if (currbrdattr & BRD_ANONYMOUS) { int defanony = (currbrdattr & BRD_DEFAULTANONYMOUS); @@ -979,14 +979,14 @@ write_header(FILE * fp) if (!real_name[0] && defanony) { strlcpy(real_name, "Anonymous", sizeof(real_name)); strlcpy(postlog.author, real_name, sizeof(postlog.author)); - curr_buf->ifuseanony = 1; + ifuseanony = 1; } else { if (!strcmp("r", real_name) || (!defanony && !real_name[0])) strlcpy(postlog.author, cuser.userid, sizeof(postlog.author)); else { snprintf(postlog.author, sizeof(postlog.author), "%s.", real_name); - curr_buf->ifuseanony = 1; + ifuseanony = 1; } } } @@ -1040,7 +1040,7 @@ addsignature(FILE * fp, int ifuseanony) ") \n◆ From: %s\n", fromhost); return; } - if (curr_buf && !curr_buf->ifuseanony) { + if (ifuseanony) { num = showsignature(fpath, &i); if (num){ msg[34] = ch = isdigit(cuser.signature) ? cuser.signature : 'X'; @@ -1069,7 +1069,7 @@ addsignature(FILE * fp, int ifuseanony) } #ifdef HAVE_ORIGIN #ifdef HAVE_ANONYMOUS - if (curr_buf && curr_buf->ifuseanony) + if (ifuseanony) fprintf(fp, "\n--\n※ 發信站: " BBSNAME "(" MYHOSTNAME ") \n◆ From: %s\n", "暱名天使的家"); else { @@ -1155,7 +1155,7 @@ write_file(char *fpath, int saveheader, int *islocal) abort_bbs(0); } if (saveheader) - write_header(fp); + write_header(fp, curr_buf->ifuseanony); } for (p = curr_buf->firstline; p; p = v) { v = p->next; diff --git a/mbbsd/mail.c b/mbbsd/mail.c index 631c9182..1f3e7f76 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -1101,7 +1101,7 @@ mail_cross_post(int ent, fileheader_t * fhdr, char *direct) strlcpy(save_title, xfile.title, sizeof(save_title)); save_currboard = currboard; currboard = xboard; - write_header(xptr); + write_header(xptr, 0); currboard = save_currboard; fprintf(xptr, "※ [本文轉錄自 %s 信箱]\n\n", cuser.userid); -- cgit v1.2.3