]> diplodocus.org Git - nmh/blobdiff - uip/whatnowsbr.c
Add comment describing concat().
[nmh] / uip / whatnowsbr.c
index b9518e8b8b9c7bebd3f6b30255fc8b5b9c9ea0ac..088ca242a7b16fce99ba83f350d7cdb0251933cb 100644 (file)
@@ -216,7 +216,7 @@ WhatNow (int argc, char **argv)
     if ((drft == NULL && (drft = getenv ("mhdraft")) == NULL) || *drft == 0)
        drft = getcpy (m_draft (dfolder, dmsg, 1, &isdf));
 
     if ((drft == NULL && (drft = getenv ("mhdraft")) == NULL) || *drft == 0)
        drft = getcpy (m_draft (dfolder, dmsg, 1, &isdf));
 
-    msgnam = (cp = getenv ("mhaltmsg")) && *cp ? getcpy (cp) : NULL;
+    msgnam = (cp = getenv ("mhaltmsg")) && *cp ? mh_xstrdup(cp) : NULL;
 
     if ((cp = getenv ("mhatfile")) && *cp)
        atfile = atoi(cp);
 
     if ((cp = getenv ("mhatfile")) && *cp)
        atfile = atoi(cp);
@@ -237,9 +237,9 @@ WhatNow (int argc, char **argv)
     snprintf (prompt, sizeof(prompt), myprompt, invo_name);
     for (;;) {
 #ifdef READLINE_SUPPORT
     snprintf (prompt, sizeof(prompt), myprompt, invo_name);
     for (;;) {
 #ifdef READLINE_SUPPORT
-       if (!(argp = getans_via_readline (prompt, aleqs))) {
+       if (!(argp = read_switch_multiword_via_readline (prompt, aleqs))) {
 #else /* ! READLINE_SUPPORT */
 #else /* ! READLINE_SUPPORT */
-       if (!(argp = getans (prompt, aleqs))) {
+       if (!(argp = read_switch_multiword (prompt, aleqs))) {
 #endif /* READLINE_SUPPORT */
            (void) m_unlink (LINK);
            done (1);
 #endif /* READLINE_SUPPORT */
            (void) m_unlink (LINK);
            done (1);
@@ -328,10 +328,7 @@ WhatNow (int argc, char **argv)
                if (fgets(cwd, sizeof (cwd), f) == NULL) {
                    advise (buf, "fgets");
                }
                if (fgets(cwd, sizeof (cwd), f) == NULL) {
                    advise (buf, "fgets");
                }
-
-               if (strchr(cwd, '\n') != (char *)0)
-                       *strchr(cwd, '\n') = '\0';
-
+                TrimSuffixC(cwd, '\n');
                pclose(f);
            }
            else {
                pclose(f);
            }
            else {
@@ -438,7 +435,7 @@ WhatNow (int argc, char **argv)
                while (fgets(shell, sizeof (shell), f) != (char *)0) {
                    char *ctype;
 
                while (fgets(shell, sizeof (shell), f) != (char *)0) {
                    char *ctype;
 
-                   *(strchr(shell, '\n')) = '\0';
+                    TrimSuffixC(shell, '\n');
 
                    if (*shell == '/') {
                        strncpy(file, shell, sizeof(file));
 
                    if (*shell == '/') {
                        strncpy(file, shell, sizeof(file));
@@ -523,7 +520,7 @@ WhatNow (int argc, char **argv)
            writelscmd(buf, sizeof(buf), "-d --", argp);
            if ((f = popen_in_dir(cwd, buf, "r")) != (FILE *)0) {
                while (fgets(shell, sizeof (shell), f) != (char *)0) {
            writelscmd(buf, sizeof(buf), "-d --", argp);
            if ((f = popen_in_dir(cwd, buf, "r")) != (FILE *)0) {
                while (fgets(shell, sizeof (shell), f) != (char *)0) {
-                   *(strchr(shell, '\n')) = '\0';
+                    TrimSuffixC(shell, '\n');
                    annotate(drft, ATTACH_FIELD, shell, 1, 0, 0, 1);
                }
                pclose(f);
                    annotate(drft, ATTACH_FIELD, shell, 1, 0, 0, 1);
                }
                pclose(f);
@@ -942,15 +939,14 @@ buildfile (char **argp, char *file)
     X("client host", -6, CLIESW) \
     X("server host", 6, SERVSW) \
     X("snoop", -5, SNOOPSW) \
     X("client host", -6, CLIESW) \
     X("server host", 6, SERVSW) \
     X("snoop", -5, SNOOPSW) \
-    X("draftfolder +folder", -6, SDRFSW) \
-    X("draftmessage msg", -6, SDRMSW) \
-    X("nodraftfolder", -3, SNDRFSW) \
-    X("sasl", SASLminc(-4), SASLSW) \
-    X("nosasl", SASLminc(-6), NOSASLSW) \
-    X("saslmaxssf", SASLminc(-10), SASLMXSSFSW) \
-    X("saslmech", SASLminc(-5), SASLMECHSW) \
-    X("authservice", SASLminc(-11), AUTHSERVICESW) \
-    X("user username", SASLminc(-4), USERSW) \
+    X("draftfolder +folder", 0, SDRFSW) \
+    X("draftmessage msg", 0, SDRMSW) \
+    X("nodraftfolder", 0, SNDRFSW) \
+    X("sasl", SASLminc(4), SASLSW) \
+    X("nosasl", SASLminc(6), NOSASLSW) \
+    X("saslmech", SASLminc(5), SASLMECHSW) \
+    X("authservice", SASLminc(0), AUTHSERVICESW) \
+    X("user username", SASLminc(4), USERSW) \
     X("attach fieldname", 6, SNDATTACHSW) \
     X("noattach", 0, SNDNOATTACHSW) \
     X("attachformat", 7, SNDATTACHFORMAT) \
     X("attach fieldname", 6, SNDATTACHSW) \
     X("noattach", 0, SNDNOATTACHSW) \
     X("attachformat", 7, SNDATTACHFORMAT) \
@@ -1165,7 +1161,6 @@ sendit (char *sp, char **arg, char *file, int pushed)
                case WIDTHSW:
                case CLIESW:
                case SERVSW:
                case WIDTHSW:
                case CLIESW:
                case SERVSW:
-               case SASLMXSSFSW:
                case USERSW:
                case PORTSW:
                case MTSSM:
                case USERSW:
                case PORTSW:
                case MTSSM:
@@ -1209,7 +1204,7 @@ sendit (char *sp, char **arg, char *file, int pushed)
     if ((cp = context_find ("Aliasfile"))) {
        char **ap, *dp;
 
     if ((cp = context_find ("Aliasfile"))) {
        char **ap, *dp;
 
-       dp = getcpy (cp);
+       dp = mh_xstrdup(cp);
        for (ap = brkstring (dp, " ", "\n"); ap && *ap; ap++) {
            vec[vecp++] = "-alias";
            vec[vecp++] = *ap;
        for (ap = brkstring (dp, " ", "\n"); ap && *ap; ap++) {
            vec[vecp++] = "-alias";
            vec[vecp++] = *ap;
@@ -1238,7 +1233,7 @@ sendit (char *sp, char **arg, char *file, int pushed)
            adios(NULL, "unable to create temporary file in %s",
                  get_temp_dir());
        }
            adios(NULL, "unable to create temporary file in %s",
                  get_temp_dir());
        }
-       distfile = getcpy (cp);
+       distfile = mh_xstrdup(cp);
        (void) m_unlink(distfile);
        if (link (altmsg, distfile) == NOTOK)
            adios (distfile, "unable to link %s to", altmsg);
        (void) m_unlink(distfile);
        if (link (altmsg, distfile) == NOTOK)
            adios (distfile, "unable to link %s to", altmsg);
@@ -1255,13 +1250,6 @@ sendit (char *sp, char **arg, char *file, int pushed)
         if (user == NULL) {
             adios (NULL, "must specify -user with -saslmech xoauth2");
         }
         if (user == NULL) {
             adios (NULL, "must specify -user with -saslmech xoauth2");
         }
-
-        vec[vecp++] = "-authservice";
-        if (saslmech  &&  ! strcasecmp(saslmech, "xoauth2")) {
-            vec[vecp++] = mh_oauth_do_xoauth (user, auth_svc, snoop ? stderr : NULL);
-        } else {
-            vec[vecp++] = auth_svc;
-        }
     }
 #else
     NMH_UNUSED(saslmech);
     }
 #else
     NMH_UNUSED(saslmech);
@@ -1277,7 +1265,7 @@ sendit (char *sp, char **arg, char *file, int pushed)
 
     closefds (3);
 
 
     closefds (3);
 
-    if (sendsbr (vec, vecp, program, file, &st, 1) == OK)
+    if (sendsbr (vec, vecp, program, file, &st, 1, auth_svc) == OK)
        done (0);
 }
 
        done (0);
 }
 
@@ -1334,7 +1322,7 @@ removefile (char *drft)
 
 
 /*
 
 
 /*
- * Return 1 if we already have a MIME-Verson header, 0 otherwise.
+ * Return 1 if we already have a MIME-Version header, 0 otherwise.
  */
 
 static int
  */
 
 static int