From 8169dbaa2fa3fcba5a0d1b3f3983c9ec42f2833d Mon Sep 17 00:00:00 2001 From: piaip Date: Tue, 19 Apr 2011 16:45:26 +0000 Subject: add :w, ZZ (vi-style) to commenting (thanks for S3p's suggestion) git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5342 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/mbbsd/bbs.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c index da1c1202..3ba95167 100644 --- a/pttbbs/mbbsd/bbs.c +++ b/pttbbs/mbbsd/bbs.c @@ -3039,15 +3039,21 @@ recommend(int ent, fileheader_t * fhdr, const char *direct) // make sure to do modification { - char ans[2]; + // to hold ':wq', ':q!' 'ZZ' + char ans[5]; sprintf(buf+strlen(buf), ANSI_REVERSE "%-*s" ANSI_RESET " ½T©w[y/N]:", maxlength, msg); move(b_lines, 0); clrtoeol(); - if(!getdata(b_lines, 0, buf, ans, sizeof(ans), LCECHO) || - ans[0] != 'y') - return FULLUPDATE; + if(!getdata(b_lines, 0, buf, ans, sizeof(ans), LCECHO)) + return FULLUPDATE; + if (ans[0] == 'y' || + strncmp(ans, ":w", 2) == 0 || + strcmp(ans, "zz") == 0) { + // success! + } else + return FULLUPDATE; } // log if you want -- cgit v1.2.3