]> diplodocus.org Git - nmh/blobdiff - uip/replsbr.c
Alter HasSuffixC()'s char * to be const.
[nmh] / uip / replsbr.c
index aec090fe043f44661525b082eed7c95dccb38e94..a9a659696ce147e52553e856d65079ff559148eb 100644 (file)
@@ -65,11 +65,11 @@ void
 replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
        int mime, char *form, char *filter, char *fcc, int fmtproc)
 {
 replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
        int mime, char *form, char *filter, char *fcc, int fmtproc)
 {
-    register int state, i;
-    register struct comp *cptr;
+    int state, i;
+    struct comp *cptr;
     char tmpbuf[SBUFSIZ];
     struct format *fmt;
     char tmpbuf[SBUFSIZ];
     struct format *fmt;
-    register char **ap;
+    char **ap;
     int        char_read = 0, format_len, mask;
     char name[NAMESZ], *cp;
     charstring_t scanl;
     int        char_read = 0, format_len, mask;
     char name[NAMESZ], *cp;
     charstring_t scanl;
@@ -111,23 +111,23 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
     if (!ccto) {
        cptr = fmt_findcomp ("to");
        if (cptr)
     if (!ccto) {
        cptr = fmt_findcomp ("to");
        if (cptr)
-           cptr->c_name = getcpy(NULL);
+           cptr->c_name = mh_xstrdup("");
     }
     if (!cccc) {
         cptr = fmt_findcomp("cc");
        if (cptr)
     }
     if (!cccc) {
         cptr = fmt_findcomp("cc");
        if (cptr)
-           cptr->c_name = getcpy(NULL);
+           cptr->c_name = mh_xstrdup("");
     }
     /* set up the "fcc" pseudo-component */
     if (fcc) {
        cptr = fmt_findcomp ("fcc");
        if (cptr)
     }
     /* set up the "fcc" pseudo-component */
     if (fcc) {
        cptr = fmt_findcomp ("fcc");
        if (cptr)
-           cptr->c_text = getcpy (fcc);
+           cptr->c_text = mh_xstrdup(fcc);
     }
     if ((cp = getenv("USER"))) {
        cptr = fmt_findcomp ("user");
        if (cptr)
     }
     if ((cp = getenv("USER"))) {
        cptr = fmt_findcomp ("user");
        if (cptr)
-           cptr->c_text = getcpy(cp);
+           cptr->c_text = mh_xstrdup(cp);
     }
     if (!ccme)
        ismymbox (NULL);
     }
     if (!ccme)
        ismymbox (NULL);
@@ -187,7 +187,7 @@ finished:
      */
     cptr = fmt_findcomp ("subject");
     if (cptr && (cp = cptr->c_text)) {
      */
     cptr = fmt_findcomp ("subject");
     if (cptr && (cp = cptr->c_text)) {
-       register char *sp = cp;
+       char *sp = cp;
 
        for (;;) {
            while (isspace((unsigned char) *cp))
 
        for (;;) {
            while (isspace((unsigned char) *cp))
@@ -200,7 +200,7 @@ finished:
        }
        if (sp != cptr->c_text) {
            cp = cptr->c_text;
        }
        if (sp != cptr->c_text) {
            cp = cptr->c_text;
-           cptr->c_text = getcpy (sp);
+           cptr->c_text = mh_xstrdup(sp);
            free (cp);
        }
     }
            free (cp);
        }
     }
@@ -285,13 +285,13 @@ static unsigned int bufsiz=0;     /* current size of buf */
 static char *
 replformataddr (char *orig, char *str)
 {
 static char *
 replformataddr (char *orig, char *str)
 {
-    register int len;
+    int len;
     char baddr[BUFSIZ], error[BUFSIZ];
     char baddr[BUFSIZ], error[BUFSIZ];
-    register int isgroup;
-    register char *dst;
-    register char *cp;
-    register char *sp;
-    register struct mailname *mp = NULL;
+    int isgroup;
+    char *dst;
+    char *cp;
+    char *sp;
+    struct mailname *mp = NULL;
     char *fixed_str = fix_addresses (str);
 
     /* if we don't have a buffer yet, get one */
     char *fixed_str = fix_addresses (str);
 
     /* if we don't have a buffer yet, get one */
@@ -382,7 +382,7 @@ static int
 insert (struct mailname *np)
 {
     char buffer[BUFSIZ];
 insert (struct mailname *np)
 {
     char buffer[BUFSIZ];
-    register struct mailname *mp;
+    struct mailname *mp;
 
     if (nodupcheck)
        return 1;
 
     if (nodupcheck)
        return 1;
@@ -402,7 +402,7 @@ insert (struct mailname *np)
 
     if (querysw) {
        snprintf (buffer, sizeof(buffer), "Reply to %s? ", adrformat (np));
 
     if (querysw) {
        snprintf (buffer, sizeof(buffer), "Reply to %s? ", adrformat (np));
-       if (!gans (buffer, anoyes))
+       if (!read_switch (buffer, anoyes))
        return 0;
     }
     mp->m_next = np;
        return 0;
     }
     mp->m_next = np;
@@ -469,11 +469,13 @@ replfilter (FILE *in, FILE *out, char *filter, int fmtproc)
 
            execvp (mhl, arglist);
            errstr = strerror(errno);
 
            execvp (mhl, arglist);
            errstr = strerror(errno);
-           write(2, "unable to exec ", 15);
-           write(2, mhlproc, strlen(mhlproc));
-           write(2, ": ", 2);
-           write(2, errstr, strlen(errstr));
-           write(2, "\n", 1);
+           if (write(2, "unable to exec ", 15) < 0  ||
+               write(2, mhlproc, strlen(mhlproc)) < 0  ||
+               write(2, ": ", 2) < 0  ||
+               write(2, errstr, strlen(errstr)) < 0  ||
+               write(2, "\n", 1) < 0) {
+               advise ("stderr", "write");
+           }
            _exit (-1);
 
        default: 
            _exit (-1);
 
        default: 
@@ -514,10 +516,11 @@ fix_addresses (char *str) {
          * local part.
          */
         while ((cp = getname (str))) {
          * local part.
          */
         while ((cp = getname (str))) {
-            struct adr_node *adr_nodep = mh_xmalloc (sizeof *adr_nodep);
+            struct adr_node *adr_nodep;
             char error[BUFSIZ];
             struct mailname *mp;
 
             char error[BUFSIZ];
             struct mailname *mp;
 
+            NEW(adr_nodep);
             adr_nodep->adr = strdup (cp);
             adr_nodep->escape_local_part = 0;
             adr_nodep->fixed = 0;
             adr_nodep->adr = strdup (cp);
             adr_nodep->escape_local_part = 0;
             adr_nodep->fixed = 0;
@@ -606,8 +609,7 @@ fix_addresses (char *str) {
 
     if (fixed_address) {
         return fixed_str;
 
     if (fixed_address) {
         return fixed_str;
-    } else {
-        free (fixed_str);
-        return str  ?  strdup (str)  :  NULL;
     }
     }
+    free (fixed_str);
+    return str  ?  strdup (str)  :  NULL;
 }
 }