]> granicus.if.org Git - mutt/commitdiff
Fix a number of invocations of mutt_yesorno(): Always explicitly use
authorArmin Wolfermann <aw@osn.de>
Sun, 5 Jan 2003 21:59:59 +0000 (21:59 +0000)
committerArmin Wolfermann <aw@osn.de>
Sun, 5 Jan 2003 21:59:59 +0000 (21:59 +0000)
the M_YES and M_NO constants.  Fixes a couple of cases in which C-g
would be mis-interpreted.

alias.c
attach.c
commands.c
curs_lib.c
main.c
muttlib.c
mx.c
pgpkey.c
recvcmd.c
send.c

diff --git a/alias.c b/alias.c
index 6ccd7464b0e329bb58d3ded992695ba6741b3b64..fdb866d2cc8df0dc557638ff2373140d8674c70a 100644 (file)
--- 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;
index 628eb9a4ce88006313ae156f2e84676205314489..7a3c3bca11b6cb8a09dd65d3051b4b22c4e9325a 100644 (file)
--- 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;
index e89c4f1e15267632d896736ee16ce257de507f7a..d4c77ea0a90f9f82dcdefc833536fa9737004f1d 100644 (file)
@@ -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);
index 951aef1221d436d3344d429523301ba876b8fd69..695a3a0116a6ca37768b52568882ea008bc7aca3 100644 (file)
@@ -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 fc418a312f6c9d499b417c68d2fdcb0a87348d3f..cf5dfcf6fd5a8ad8a9b793b15e99b891d5f4ed85 100644 (file)
--- 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));
index ca66fd42ae15ce35bf19db4559d4d7a2e635ffce..a9b7f86cf80ada8fc27175708c33ab258da01556 100644 (file)
--- 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 71a2c1ec10b5cda4f92c947c1f2dc37e48111424..f1bf85008a5b7059d8be41a708ec7f01a1c8dfe1 100644 (file)
--- 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--;
index 0deed48e0974ee17ef8aecc6b94ec7dc15250cf0..1fe06458c19aebe1bc70d3a2c7f3d281ed5b49a5 100644 (file)
--- 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;
index a57f556c7d03ea076923978c24b77df0c7cce097..18cd66d61f812130ab5522a53bc9689c26fab071 100644 (file)
--- 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 2f618f34c0cc4742cb9bfe3b4b629fccfe1154ce..3ffd45f39225776baed6bad21bef878073a68773 100644 (file)
--- 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);