]> diplodocus.org Git - nmh/blobdiff - uip/post.c
Document argsplit changes in mh-profile man page.
[nmh] / uip / post.c
index 7bed6f8a70e0a47512dec02a7472bde15816248a..9b8bcbeff2df02b601c28f2fad1a6d50f7347507 100644 (file)
@@ -185,8 +185,6 @@ static short fccind = 0;    /* index into fccfold[] */
 static short outputlinelen = OUTPUTLINELEN;
 
 static int pfd = NOTOK;                /* fd to write annotation list to        */
 static short outputlinelen = OUTPUTLINELEN;
 
 static int pfd = NOTOK;                /* fd to write annotation list to        */
-static uid_t myuid= -1;                /* my user id                            */
-static gid_t mygid= -1;                /* my group id                           */
 static int recipients = 0;     /* how many people will get a copy       */
 static int unkadr = 0;         /* how many of those were unknown        */
 static int badadr = 0;         /* number of bad addrs                   */
 static int recipients = 0;     /* how many people will get a copy       */
 static int unkadr = 0;         /* how many of those were unknown        */
 static int badadr = 0;         /* number of bad addrs                   */
@@ -263,7 +261,7 @@ static int insert (struct mailname *);
 static void pl (void);
 static void anno (void);
 static int annoaux (struct mailname *);
 static void pl (void);
 static void anno (void);
 static int annoaux (struct mailname *);
-static void insert_fcc (struct headers *, unsigned char *);
+static void insert_fcc (struct headers *, char *);
 static void make_bcc_file (int);
 static void verify_all_addresses (int, char *);
 static void chkadr (void);
 static void make_bcc_file (int);
 static void verify_all_addresses (int, char *);
 static void chkadr (void);
@@ -923,12 +921,9 @@ putfmt (char *name, char *str, FILE *out)
 static void
 start_headers (void)
 {
 static void
 start_headers (void)
 {
-    unsigned char  *cp;
-    char sigbuf[BUFSIZ];
+    char  *cp, sigbuf[BUFSIZ];
     struct mailname *mp;
 
     struct mailname *mp;
 
-    myuid = getuid ();
-    mygid = getgid ();
     time (&tclock);
 
     /*
     time (&tclock);
 
     /*
@@ -1257,13 +1252,13 @@ annoaux (struct mailname *mp)
 
 
 static void
 
 
 static void
-insert_fcc (struct headers *hdr, unsigned char *pp)
+insert_fcc (struct headers *hdr, char *pp)
 {
 {
-    unsigned char *cp;
+    char *cp;
 
 
-    for (cp = pp; isspace (*cp); cp++)
+    for (cp = pp; isspace ((unsigned char) *cp); cp++)
        continue;
        continue;
-    for (pp += strlen (pp) - 1; pp > cp && isspace (*pp); pp--)
+    for (pp += strlen (pp) - 1; pp > cp && isspace ((unsigned char) *pp); pp--)
        continue;
     if (pp >= cp)
        *++pp = 0;
        continue;
     if (pp >= cp)
        *++pp = 0;
@@ -1284,9 +1279,9 @@ make_bcc_file (int dashstuff)
 {
     int fd, i;
     pid_t child_id;
 {
     int fd, i;
     pid_t child_id;
-    char *vec[6];
+    char **vec;
     FILE *out;
     FILE *out;
-    char *tfile = NULL;
+    char *tfile = NULL, *program;
 
     tfile = m_mktemp2(NULL, "bccs", NULL, &out);
     if (tfile == NULL) adios("bcc", "unable to create temporary file");
 
     tfile = m_mktemp2(NULL, "bccs", NULL, &out);
     if (tfile == NULL) adios("bcc", "unable to create temporary file");
@@ -1338,8 +1333,6 @@ make_bcc_file (int dashstuff)
      * of MIME encapsulation.
      */
     if (filter != NULL) {
      * of MIME encapsulation.
      */
     if (filter != NULL) {
-       vec[0] = r1bindex (mhlproc, '/');
-
        for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
            sleep (5);
        switch (child_id) {
        for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
            sleep (5);
        switch (child_id) {
@@ -1349,7 +1342,7 @@ make_bcc_file (int dashstuff)
            case OK: 
                dup2 (fileno (out), 1);
 
            case OK: 
                dup2 (fileno (out), 1);
 
-               i = 1;
+               vec = argsplit(mhlproc, &program, &i);
                vec[i++] = "-forward";
                vec[i++] = "-form";
                vec[i++] = filter;
                vec[i++] = "-forward";
                vec[i++] = "-form";
                vec[i++] = filter;
@@ -1362,7 +1355,7 @@ make_bcc_file (int dashstuff)
                    vec[i++] = "-nodashstuffing";
                vec[i] = NULL;
 
                    vec[i++] = "-nodashstuffing";
                vec[i] = NULL;
 
-               execvp (mhlproc, vec);
+               execvp (program, vec);
                fprintf (stderr, "unable to exec ");
                perror (mhlproc);
                _exit (-1);
                fprintf (stderr, "unable to exec ");
                perror (mhlproc);
                _exit (-1);
@@ -1405,7 +1398,7 @@ static int
 find_prefix (void)
 {
     int        result = OK;
 find_prefix (void)
 {
     int        result = OK;
-    unsigned char buffer[BUFSIZ];
+    char buffer[BUFSIZ];
     FILE *in;
 
     if ((in = fopen (tmpfil, "r")) == NULL)
     FILE *in;
 
     if ((in = fopen (tmpfil, "r")) == NULL)
@@ -1413,10 +1406,10 @@ find_prefix (void)
 
     while (fgets (buffer, sizeof(buffer) - 1, in))
        if (buffer[0] == '-' && buffer[1] == '-') {
 
     while (fgets (buffer, sizeof(buffer) - 1, in))
        if (buffer[0] == '-' && buffer[1] == '-') {
-           unsigned char *cp;
+           char *cp;
 
            for (cp = buffer + strlen (buffer) - 1; cp >= buffer; cp--)
 
            for (cp = buffer + strlen (buffer) - 1; cp >= buffer; cp--)
-               if (!isspace (*cp))
+               if (!isspace ((unsigned char) *cp))
                    break;
            *++cp = '\0';
            if (strcmp (buffer + 2, prefix) == 0) {
                    break;
            *++cp = '\0';
            if (strcmp (buffer + 2, prefix) == 0) {
@@ -1513,7 +1506,8 @@ post (char *file, int bccque, int talk, char *envelope)
     sigon ();
 
     if (sm_mts == MTS_SENDMAIL_PIPE) {
     sigon ();
 
     if (sm_mts == MTS_SENDMAIL_PIPE) {
-       char *sargv[16], **argp;
+       char **argp, *program;
+       int argc;
 
        for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
            sleep (5);
 
        for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++)
            sleep (5);
@@ -1526,17 +1520,16 @@ post (char *file, int bccque, int talk, char *envelope)
                    adios (file, "can't reopen for sendmail");
                }
 
                    adios (file, "can't reopen for sendmail");
                }
 
-               argp = sargv;
-               *argp++ = "sendmail";
-               *argp++ = "-t"; /* read msg for recipients */
-               *argp++ = "-i"; /* don't stop on "." */
+               argp = argsplit(sendmail, &program, &argc);
+               argp[argc++] = "-t"; /* read msg for recipients */
+               argp[argc++] = "-i"; /* don't stop on "." */
                if (whomsw)
                if (whomsw)
-                   *argp++ = "-bv";
+                   argp[argc++] = "-bv";
                if (snoop)
                if (snoop)
-                   *argp++ = "-v";
-               *argp = NULL;
+                   argp[argc++] = "-v";
+               argp[argc] = NULL;
 
 
-               execv (sendmail, sargv);
+               execv (program, argp);
                adios (sendmail, "can't exec");
 
            default: 
                adios (sendmail, "can't exec");
 
            default: