From 09e177badcb0d6b79abd203065adc2904d30355a Mon Sep 17 00:00:00 2001 From: Armin Wolfermann Date: Sun, 5 Jan 2003 21:59:59 +0000 Subject: [PATCH] Fix a number of invocations of mutt_yesorno(): Always explicitly use the M_YES and M_NO constants. Fixes a couple of cases in which C-g would be mis-interpreted. --- alias.c | 6 +++--- attach.c | 8 ++++---- commands.c | 2 +- curs_lib.c | 12 ++++++------ main.c | 2 +- muttlib.c | 6 +++--- mx.c | 2 +- pgpkey.c | 2 +- recvcmd.c | 2 +- send.c | 2 +- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/alias.c b/alias.c index 6ccd7464..fdb866d2 100644 --- a/alias.c +++ b/alias.c @@ -249,9 +249,9 @@ retry_name: if (mutt_check_alias_name (buf, fixed)) { - switch (mutt_yesorno (_("Warning: This alias name may not work. Fix it?"), 1)) + switch (mutt_yesorno (_("Warning: This alias name may not work. Fix it?"), M_YES)) { - case 1: + case M_YES: strfcpy (buf, fixed, sizeof (buf)); goto retry_name; case -1: @@ -296,7 +296,7 @@ retry_name: buf[0] = 0; rfc822_write_address (buf, sizeof (buf), new->addr); snprintf (prompt, sizeof (prompt), _("[%s = %s] Accept?"), new->name, buf); - if (mutt_yesorno (prompt, 1) != 1) + if (mutt_yesorno (prompt, M_YES) != M_YES) { mutt_free_alias (&new); return; diff --git a/attach.c b/attach.c index 628eb9a4..7a3c3bca 100644 --- a/attach.c +++ b/attach.c @@ -112,7 +112,7 @@ int mutt_compose_attachment (BODY *a) a->filename, newfile)); if (safe_symlink (a->filename, newfile) == -1) { - if (!mutt_yesorno (_("Can't match nametemplate, continue?"), 1)) + if (mutt_yesorno (_("Can't match nametemplate, continue?"), M_YES) != M_YES) goto bailout; } unlink_newfile = 1; @@ -239,7 +239,7 @@ int mutt_edit_attachment (BODY *a) a->filename, newfile)); if (safe_symlink (a->filename, newfile) == -1) { - if (!mutt_yesorno (_("Can't match nametemplate, continue?"), 1)) + if (mutt_yesorno (_("Can't match nametemplate, continue?"), M_YES) != M_YES) goto bailout; } unlink_newfile = 1; @@ -468,7 +468,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, /* send case: the file is already there */ if (safe_symlink (a->filename, tempfile) == -1) { - if (mutt_yesorno (_("Can't match nametemplate, continue?"), 1) == M_YES) + if (mutt_yesorno (_("Can't match nametemplate, continue?"), M_YES) == M_YES) strfcpy (tempfile, a->filename, sizeof (tempfile)); else goto return_error; @@ -958,7 +958,7 @@ int mutt_print_attachment (FILE *fp, BODY *a) { if (safe_symlink(a->filename, newfile) == -1) { - if (mutt_yesorno (_("Can't match nametemplate, continue?"), 1) != M_YES) + if (mutt_yesorno (_("Can't match nametemplate, continue?"), M_YES) != M_YES) { rfc1524_free_entry (&entry); return 0; diff --git a/commands.c b/commands.c index e89c4f1e..d4c77ea0 100644 --- a/commands.c +++ b/commands.c @@ -288,7 +288,7 @@ void ci_bounce_message (HEADER *h, int *redraw) 0, COLS-extra_space, 0, 0, prompt, sizeof (prompt), 0); strcat (prompt, "...?"); /* __STRCAT_CHECKED__ */ - if (mutt_yesorno (prompt, 1) != 1) + if (mutt_yesorno (prompt, M_YES) != M_YES) { rfc822_free_address (&adr); CLEARLINE (LINES-1); diff --git a/curs_lib.c b/curs_lib.c index 951aef12..695a3a01 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -182,7 +182,7 @@ int mutt_yesorno (const char *msg, int def) * to fit. */ answer_string = safe_malloc (COLS + 1); - snprintf (answer_string, COLS + 1, " ([%s]/%s): ", def ? yes : no, def ? no : yes); + snprintf (answer_string, COLS + 1, " ([%s]/%s): ", def == M_YES ? yes : no, def == M_NO ? no : yes); answer_string_len = strlen (answer_string); printw ("%.*s%s", COLS - answer_string_len, msg, answer_string); FREE (&answer_string); @@ -208,7 +208,7 @@ int mutt_yesorno (const char *msg, int def) #endif (tolower (ch.ch) == 'y')) { - def = 1; + def = M_YES; break; } else if ( @@ -218,7 +218,7 @@ int mutt_yesorno (const char *msg, int def) #endif (tolower (ch.ch) == 'n')) { - def = 0; + def = M_NO; break; } else @@ -234,9 +234,9 @@ int mutt_yesorno (const char *msg, int def) regfree (& reno); #endif - if (def >= 0) + if (def != -1) { - addstr ((char *) (def ? yes : no)); + addstr ((char *) (def == M_YES ? yes : no)); mutt_refresh (); } return (def); @@ -249,7 +249,7 @@ void mutt_query_exit (void) curs_set (1); if (Timeout) timeout (-1); /* restore blocking operation */ - if (mutt_yesorno (_("Exit Mutt?"), 1) == 1) + if (mutt_yesorno (_("Exit Mutt?"), M_YES) == M_YES) { endwin (); exit (1); diff --git a/main.c b/main.c index fc418a31..cf5dfcf6 100644 --- a/main.c +++ b/main.c @@ -683,7 +683,7 @@ int main (int argc, char **argv) if (stat (fpath, &sb) == -1 && errno == ENOENT) { snprintf (msg, sizeof (msg), _("%s does not exist. Create it?"), Maildir); - if (mutt_yesorno (msg, 1) == 1) + if (mutt_yesorno (msg, M_YES) == M_YES) { if (mkdir (fpath, 0700) == -1 && errno != EEXIST) mutt_error ( _("Can't create %s: %s."), Maildir, strerror (errno)); diff --git a/muttlib.c b/muttlib.c index ca66fd42..a9b7f86c 100644 --- a/muttlib.c +++ b/muttlib.c @@ -859,7 +859,7 @@ int mutt_check_overwrite (const char *attname, const char *path, return -1; if (S_ISDIR (st.st_mode)) { - if (mutt_yesorno (_("File is a directory, save under it?"), 1) != M_YES) + if (mutt_yesorno (_("File is a directory, save under it?"), M_YES) != M_YES) return (-1); if (!attname || !attname[0]) { @@ -1180,7 +1180,7 @@ int mutt_save_confirm (const char *s, struct stat *st) if (option (OPTCONFIRMAPPEND)) { snprintf (tmp, sizeof (tmp), _("Append messages to %s?"), s); - if (mutt_yesorno (tmp, 1) < 1) + if (mutt_yesorno (tmp, M_YES) != M_YES) ret = 0; } } @@ -1198,7 +1198,7 @@ int mutt_save_confirm (const char *s, struct stat *st) if (option (OPTCONFIRMCREATE)) { snprintf (tmp, sizeof (tmp), _("Create %s?"), s); - if (mutt_yesorno (tmp, 1) < 1) + if (mutt_yesorno (tmp, M_YES) != M_YES) ret = 0; } } diff --git a/mx.c b/mx.c index 71a2c1ec..f1bf8500 100644 --- a/mx.c +++ b/mx.c @@ -121,7 +121,7 @@ retry_lock: snprintf(msg, sizeof(msg), _("Lock count exceeded, remove lock for %s?"), path); - if(retry && mutt_yesorno(msg, 1) == 1) + if(retry && mutt_yesorno(msg, M_YES) == M_YES) { flags |= DL_FL_FORCE; retry--; diff --git a/pgpkey.c b/pgpkey.c index 0deed48e..1fe06458 100644 --- a/pgpkey.c +++ b/pgpkey.c @@ -622,7 +622,7 @@ static pgp_key_t *pgp_select_key (pgp_key_t *keys, snprintf (buff, sizeof (buff), _("%s Do you really want to use the key?"), _(s)); - if (mutt_yesorno (buff, 0) != 1) + if (mutt_yesorno (buff, M_NO) != M_YES) { mutt_clear_error (); break; diff --git a/recvcmd.c b/recvcmd.c index a57f556c..18cd66d6 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -154,7 +154,7 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr, snprintf (prompt, sizeof (prompt), cur ? _("Bounce message to %s...?") : _("Bounce messages to %s...?"), buf); - if (mutt_yesorno (prompt, 1) != 1) + if (mutt_yesorno (prompt, M_YES) != M_YES) goto bail; if (cur) diff --git a/send.c b/send.c index 2f618f34..3ffd45f3 100644 --- a/send.c +++ b/send.c @@ -236,7 +236,7 @@ static int edit_envelope (ENVELOPE *en) } if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) != 0 || - (!buf[0] && query_quadoption (OPT_SUBJECT, _("No subject, abort?")) != 0)) + (!buf[0] && query_quadoption (OPT_SUBJECT, _("No subject, abort?")) != M_NO)) { mutt_message _("No subject, aborting."); return (-1); -- 2.50.1