X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/a4038080951f894bc9829ea7380bd4b26ab67f26..2d8a2d23b4c17ffb277d008f4e011fcc2bb2fa7e:/uip/whatnowsbr.c?ds=sidebyside diff --git a/uip/whatnowsbr.c b/uip/whatnowsbr.c index fd42f826..98fe9eaa 100644 --- a/uip/whatnowsbr.c +++ b/uip/whatnowsbr.c @@ -40,7 +40,6 @@ #include #include -#include #include #include @@ -417,7 +416,7 @@ WhatNow (int argc, char **argv) * Build a command line that causes the user's shell to list the file name * arguments. This handles and wildcard expansion, tilde expansion, etc. */ - writelscmd(buf, sizeof(buf), "-d", argp); + writelscmd(buf, sizeof(buf), "-d --", argp); /* * Read back the response from the shell, which contains a number of lines @@ -506,7 +505,7 @@ WhatNow (int argc, char **argv) * We feed all the file names to the shell at once, otherwise you can't * provide a file name with a space in it. */ - writelscmd(buf, sizeof(buf), "-d", argp); + 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'; @@ -552,10 +551,10 @@ writesomecmd(char *buf, int bufsz, char *cmd, char *trailcmd, char **argp) int trailln = strlen(trailcmd) + 4; if (ln < 0 || ln + trailln > bufsz) adios((char *)0, "arguments too long"); - + cp = buf + ln; - - while (*++argp != (char *)0) { + + while (*argp && *++argp) { ln = strlen(*argp); /* +1 for leading space */ if (ln + trailln + 1 > bufsz - (cp-buf)) @@ -580,7 +579,7 @@ writesomecmd(char *buf, int bufsz, char *cmd, char *trailcmd, char **argp) static void writelscmd(char *buf, int bufsz, char *lsoptions, char **argp) { - char *lscmd = concat ("ls ", lsoptions, " --", NULL); + char *lscmd = concat ("ls ", lsoptions, NULL); writesomecmd(buf, bufsz, lscmd, "", argp); free (lscmd); } @@ -618,7 +617,7 @@ popen_in_dir(const char *dir, const char *cmd, const char *type) /* ensure that $SHELL exists, as the cmd was written relying on a non-blank $SHELL... */ setenv("SHELL","/bin/sh",0); /* don't overwrite */ - + if (getcwd(olddir, sizeof(olddir)) == 0) adios("getcwd", "could not get working directory"); if (chdir(dir) != 0) @@ -852,7 +851,6 @@ sendfile (char **arg, char *file, int pushsw) advise (NULL, "unable to fork, so sending directly..."); case OK: vec = argsplit(sendproc, &program, &vecp); - vec[vecp++] = invo_name; if (pushsw) vec[vecp++] = "-push"; if (arg) @@ -1029,6 +1027,7 @@ check_draft (char *msgnam) X("attachformat", 7, SNDATTACHFORMAT) \ X("port server-port-name/number", 4, PORTSW) \ X("tls", TLSminc(-3), TLSSW) \ + X("initialtls", TLSminc(-10), INITTLSSW) \ X("notls", TLSminc(-5), NTLSSW) \ X("mts smtp|sendmail/smtp|sendmail/pipe", 2, MTSSW) \ X("messageid localname|random", 2, MESSAGEIDSW) \ @@ -1202,6 +1201,7 @@ sendit (char *sp, char **arg, char *file, int pushed) case SASLSW: case NOSASLSW: case TLSSW: + case INITTLSSW: case NTLSSW: vec[vecp++] = --cp; continue;