]> diplodocus.org Git - nmh/blobdiff - uip/mshcmds.c
lkopen_dot() would block forever if another process held a lock
[nmh] / uip / mshcmds.c
index 6ea1126c5039bb0b88edbcf0df6aa2d1df031d63..6627c6ab61d2c61c3db51d15be677550084d5833 100644 (file)
@@ -14,8 +14,6 @@
 #include <h/scansbr.h>
 #include <h/tws.h>
 #include <h/mts.h>
-#include <errno.h>
-#include <signal.h>
 #include <h/msh.h>
 #include <h/picksbr.h>
 #include <h/utils.h>
@@ -1013,7 +1011,7 @@ forw (char *proc, char *filter, int vecp, char **vec)
                break;
        }
 
-    unlink (tmpfil);
+    (void) m_unlink (tmpfil);
 }
 
 
@@ -1228,8 +1226,9 @@ markcmd (char **args)
                        (long) Msgs[msgnum].m_start,
                        (long) Msgs[msgnum].m_stop,
                        snprintb (buf, sizeof(buf),
-                               (unsigned) mp->msgstats[msgnum - mp->lowoff],
-                               seq_bits (mp)));
+                                 (unsigned) *bvector_bits (msgstat (mp,
+                                                                     msgnum)),
+                                 seq_bits (mp)));
                    if (Msgs[msgnum].m_scanl)
                        printf ("%s", Msgs[msgnum].m_scanl);
                }                           
@@ -2071,7 +2070,7 @@ scancmd (char **args)
        }
 
     if (clearsw)
-       clear_screen ();
+       nmh_clear_screen ();
 }
 
 
@@ -2105,10 +2104,10 @@ showcmd (char **args)
     char *cp, *proc = showproc, buf[BUFSIZ];
     char *msgs[MAXARGS], *vec[MAXARGS];
 
-    if (!mh_strcasecmp (cmd_name, "next"))
+    if (!strcasecmp (cmd_name, "next"))
        mode = 1;
     else
-       if (!mh_strcasecmp (cmd_name, "prev"))
+       if (!strcasecmp (cmd_name, "prev"))
            mode = -1;
     while ((cp = *args++)) {
        if (*cp == '-')
@@ -2332,8 +2331,7 @@ static int
 is_nontext (int msgnum)
 {
     int        result, state;
-    unsigned char *bp, *dp;
-    char *cp;
+    char *bp, *dp, *cp;
     char buf[BUFSIZ], name[NAMESZ];
     FILE *fp;
 
@@ -2351,7 +2349,7 @@ is_nontext (int msgnum)
            /*
             * Check Content-Type field
             */
-           if (!mh_strcasecmp (name, TYPE_FIELD)) {
+           if (!strcasecmp (name, TYPE_FIELD)) {
                int passno;
                char c;
 
@@ -2365,7 +2363,7 @@ is_nontext (int msgnum)
                passno = 1;
 
 again:
-               for (; isspace (*bp); bp++)
+               for (; isspace ((unsigned char) *bp); bp++)
                    continue;
                if (*bp == '(') {
                    int i;
@@ -2407,27 +2405,27 @@ invalid:
                if (!*bp)
                    goto invalid;
                if (passno > 1) {
-                   if ((result = (mh_strcasecmp (bp, "plain") != 0)))
+                   if ((result = (strcasecmp (bp, "plain") != 0)))
                        goto out;
                    *dp = c;
-                   for (dp++; isspace (*dp); dp++)
+                   for (dp++; isspace ((unsigned char) *dp); dp++)
                        continue;
                    if (*dp) {
                        if ((result = !uprf (dp, "charset")))
                            goto out;
                        dp += sizeof "charset" - 1;
-                       while (isspace (*dp))
+                       while (isspace ((unsigned char) *dp))
                            dp++;
                        if (*dp++ != '=')
                            goto invalid;
-                       while (isspace (*dp))
+                       while (isspace ((unsigned char) *dp))
                            dp++;
                        if (*dp == '"') {
                            if ((bp = strchr(++dp, '"')))
                                *bp = '\0';
                        } else {
                            for (bp = dp; *bp; bp++)
-                               if (isspace (*bp)) {
+                               if (isspace ((unsigned char) *bp)) {
                                    *bp = '\0';
                                    break;
                                }
@@ -2439,7 +2437,7 @@ invalid:
                    /* Check the character set */
                    result = !check_charset (dp, strlen (dp));
                } else {
-                   if (!(result = (mh_strcasecmp (bp, "text") != 0))) {
+                   if (!(result = (strcasecmp (bp, "text") != 0))) {
                        *dp = c;
                        bp = dp;
                        passno = 2;
@@ -2458,21 +2456,21 @@ out:
            /*
             * Check Content-Transfer-Encoding field
             */
-           if (!mh_strcasecmp (name, ENCODING_FIELD)) {
+           if (!strcasecmp (name, ENCODING_FIELD)) {
                cp = add (buf, NULL);
                while (state == FLDPLUS) {
                    bufsz = sizeof buf;
                    state = m_getfld (&gstate, name, buf, &bufsz, fp);
                    cp = add (buf, cp);
                }
-               for (bp = cp; isspace (*bp); bp++)
+               for (bp = cp; isspace ((unsigned char) *bp); bp++)
                    continue;
                for (dp = bp; istoken (*dp); dp++)
                    continue;
                *dp = '\0';
-               result = (mh_strcasecmp (bp, "7bit")
-                      && mh_strcasecmp (bp, "8bit")
-                      && mh_strcasecmp (bp, "binary"));
+               result = (strcasecmp (bp, "7bit")
+                      && strcasecmp (bp, "8bit")
+                      && strcasecmp (bp, "binary"));
 
                free (cp);
                if (result) {
@@ -2615,9 +2613,10 @@ sortcmd (char **args)
        }
        else                    /* m_scaln is already NULL */
            twscopy (&Msgs[msgnum].m_tb, &tb);
-       Msgs[msgnum].m_stats = mp->msgstats[msgnum - mp->lowoff];
+       Msgs[msgnum].m_stats = bvector_create (0);
+       bvector_copy (Msgs[msgnum].m_stats, msgstat (mp, msgnum));
        if (mp->curmsg == msgnum)
-           Msgs[msgnum].m_stats |= CUR;
+            bvector_set (Msgs[msgnum].m_stats, CUR);
     }
 
     qsort ((char *) &Msgs[mp->lowsel], mp->hghsel - mp->lowsel + 1,
@@ -2628,8 +2627,9 @@ sortcmd (char **args)
            free (Msgs[msgnum].m_scanl);        /* from subjsort */
            Msgs[msgnum].m_scanl = NULL;
        }
-       mp->msgstats[msgnum - mp->lowoff] = Msgs[msgnum].m_stats & ~CUR;
-       if (Msgs[msgnum].m_stats & CUR)
+       bvector_clear (Msgs[msgnum].m_stats, CUR);
+       bvector_copy (msgstat (mp, msgnum), Msgs[msgnum].m_stats);
+       if (bvector_at (Msgs[msgnum].m_stats, CUR))
            seq_setcur (mp, msgnum);
     }
            
@@ -2658,7 +2658,7 @@ get_fields (char *datesw, char *subjsw, int msgnum, struct Msg *msgp)
        switch (state = m_getfld (&gstate, name, buf, &bufsz, zp)) {
            case FLD: 
            case FLDPLUS: 
-               if (!mh_strcasecmp (name, datesw)) {
+               if (!strcasecmp (name, datesw)) {
                    bp = getcpy (buf);
                    while (state == FLDPLUS) {
                        bufsz = sizeof buf;
@@ -2676,7 +2676,7 @@ get_fields (char *datesw, char *subjsw, int msgnum, struct Msg *msgp)
                        break;          /* all done! */
                    gotdate++;
                }
-               else if (subjsw && !mh_strcasecmp(name, subjsw)) {
+               else if (subjsw && !strcasecmp(name, subjsw)) {
                    bp = getcpy (buf);
                    while (state == FLDPLUS) {
                        bufsz = sizeof buf;
@@ -2759,7 +2759,7 @@ sosmash (char *subj, char *s)
     if (s) {
        cp = s;
        dp = s; /* dst pointer */
-       if (!mh_strcasecmp (subj, "subject"))
+       if (!strcasecmp (subj, "subject"))
            while ((c = *cp)) {
                if (! isspace(c)) {
                    if(uprf(cp, "re:"))
@@ -2842,7 +2842,7 @@ ready: ;
     }
 
     if (!fmsh)
-       unlink (tmpfil);
+       (void) m_unlink (tmpfil);
     return status;
 }