* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
* static prototypes
*/
static int editfile (char **, char **, char *, int, struct msgs *,
* static prototypes
*/
static int editfile (char **, char **, char *, int, struct msgs *,
static int sendfile (char **, char *, int);
static void sendit (char *, char **, char *, int);
static int buildfile (char **, char *);
static int check_draft (char *);
static int whomfile (char **, char *);
static int removefile (char *);
static int sendfile (char **, char *, int);
static void sendit (char *, char **, char *, int);
static int buildfile (char **, char *);
static int check_draft (char *);
static int whomfile (char **, char *);
static int removefile (char *);
-static void writelscmd(char *, int, char **);
+static void writelscmd(char *, int, char *, char **);
static void writesomecmd(char *buf, int bufsz, char *cmd, char *trailcmd, char **argp);
static FILE* popen_in_dir(const char *dir, const char *cmd, const char *type);
static int system_in_dir(const char *dir, const char *cmd);
static void writesomecmd(char *buf, int bufsz, char *cmd, char *trailcmd, char **argp);
static FILE* popen_in_dir(const char *dir, const char *cmd, const char *type);
static int system_in_dir(const char *dir, const char *cmd);
char *cp, *dfolder = NULL, *dmsg = NULL;
char *ed = NULL, *drft = NULL, *msgnam = NULL;
char buf[BUFSIZ], prompt[BUFSIZ];
char **argp, **arguments;
struct stat st;
char *cp, *dfolder = NULL, *dmsg = NULL;
char *ed = NULL, *drft = NULL, *msgnam = NULL;
char buf[BUFSIZ], prompt[BUFSIZ];
char **argp, **arguments;
struct stat st;
- char *attach = (char *)0; /* attachment header field name */
- char cwd[MAXPATHLEN + 1]; /* current working directory */
- char file[MAXPATHLEN + 1]; /* file name buffer */
- char shell[MAXPATHLEN + 1]; /* shell response buffer */
+ char *attach = NMH_ATTACH_HEADER;/* attachment header field name */
+ char cwd[PATH_MAX + 1]; /* current working directory */
+ char file[PATH_MAX + 1]; /* file name buffer */
+ char shell[PATH_MAX + 1]; /* shell response buffer */
FILE *f; /* read pointer for bgnd proc */
char *l; /* set on -l to alist command */
int n; /* set on -n to alist command */
FILE *f; /* read pointer for bgnd proc */
char *l; /* set on -l to alist command */
int n; /* set on -n to alist command */
case HELPSW:
snprintf (buf, sizeof(buf), "%s [switches] [file]", invo_name);
print_help (buf, whatnowswitches, 1);
case HELPSW:
snprintf (buf, sizeof(buf), "%s [switches] [file]", invo_name);
print_help (buf, whatnowswitches, 1);
if (!(attach = *argp++) || *attach == '-')
adios (NULL, "missing argument to %s", argp[-2]);
continue;
if (!(attach = *argp++) || *attach == '-')
adios (NULL, "missing argument to %s", argp[-2]);
continue;
- if (!nedit && editfile (&ed, NULL, drft, use, NULL, msgnam, NULL, 1) < 0)
+ if (!nedit && editfile (&ed, NULL, drft, use, NULL, msgnam,
+ NULL, 1, atfile) < 0)
done (1);
snprintf (prompt, sizeof(prompt), myprompt, invo_name);
for (;;) {
done (1);
snprintf (prompt, sizeof(prompt), myprompt, invo_name);
for (;;) {
- if (editfile (&ed, argp, drft, NOUSE, NULL, msgnam, NULL, 1) == NOTOK)
+ if (editfile (&ed, argp, drft, NOUSE, NULL, msgnam,
+ NULL, 1, atfile) == NOTOK)
}
else {
writesomecmd(buf, BUFSIZ, "cd", "pwd", argp);
}
else {
writesomecmd(buf, BUFSIZ, "cd", "pwd", argp);
/*
* Build a command line that causes the user's shell to list the file name
* arguments. This handles and wildcard expansion, tilde expansion, etc.
*/
/*
* Build a command line that causes the user's shell to list the file name
* arguments. This handles and wildcard expansion, tilde expansion, etc.
*/
* We feed all the file names to the shell at once, otherwise you can't
* provide a file name with a space in it.
*/
* We feed all the file names to the shell at once, otherwise you can't
* provide a file name with a space in it.
*/
if ((f = popen_in_dir(cwd, buf, "r")) != (FILE *)0) {
while (fgets(shell, sizeof (shell), f) != (char *)0) {
*(strchr(shell, '\n')) = '\0';
if ((f = popen_in_dir(cwd, buf, "r")) != (FILE *)0) {
while (fgets(shell, sizeof (shell), f) != (char *)0) {
*(strchr(shell, '\n')) = '\0';
* new C99 mandated 'number of chars that would have been written'
*/
/* length checks here and inside the loop allow for the
* new C99 mandated 'number of chars that would have been written'
*/
/* length checks here and inside the loop allow for the
if (ln < 0 || ln + trailln > bufsz)
adios((char *)0, "arguments too long");
if (ln < 0 || ln + trailln > bufsz)
adios((char *)0, "arguments too long");
-writelscmd(char *buf, int bufsz, char **argp)
+writelscmd(char *buf, int bufsz, char *lsoptions, char **argp)
- writesomecmd(buf, bufsz, "ls", "", argp);
+ char *lscmd = concat ("ls ", lsoptions, " --", NULL);
+ writesomecmd(buf, bufsz, lscmd, "", argp);
+ free (lscmd);
+
+ /* 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)
if (getcwd(olddir, sizeof(olddir)) == 0)
adios("getcwd", "could not get working directory");
if (chdir(dir) != 0)
+
+ /* 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)
if (getcwd(olddir, sizeof(olddir)) == 0)
adios("getcwd", "could not get working directory");
if (chdir(dir) != 0)
static int
editfile (char **ed, char **arg, char *file, int use, struct msgs *mp,
static int
editfile (char **ed, char **arg, char *file, int use, struct msgs *mp,
if (mp == NULL || *altmsg == '/' || cwd == NULL)
strncpy (altpath, altmsg, sizeof(altpath));
else
if (mp == NULL || *altmsg == '/' || cwd == NULL)
strncpy (altpath, altmsg, sizeof(altpath));
else
strncpy (linkpath, LINK, sizeof(linkpath));
else
snprintf (linkpath, sizeof(linkpath), "%s/%s", cwd, LINK);
strncpy (linkpath, LINK, sizeof(linkpath));
else
snprintf (linkpath, sizeof(linkpath), "%s/%s", cwd, LINK);
if (((status & 0xff00) != 0xff00)
&& (!reedit || (status & 0x00ff))) {
if (!use && (status & 0xff00) &&
if (((status & 0xff00) != 0xff00)
&& (!reedit || (status & 0x00ff))) {
if (!use && (status & 0xff00) &&
/* Translate MIME composition file, if necessary */
if ((cp = context_find ("automimeproc"))
&& (!strcmp (cp, "1"))
/* Translate MIME composition file, if necessary */
if ((cp = context_find ("automimeproc"))
&& (!strcmp (cp, "1"))
&& check_draft (file)
&& (buildfile (NULL, file) == NOTOK))
return 0;
/* For backwards compatibility */
if ((cp = context_find ("automhnproc"))
&& check_draft (file)
&& (buildfile (NULL, file) == NOTOK))
return 0;
/* For backwards compatibility */
if ((cp = context_find ("automhnproc"))
- && (i = editfile (&cp, NULL, file, NOUSE, NULL, NULL, NULL, 0)))
+ && (i = editfile (&cp, NULL, file, NOUSE, NULL, NULL, NULL, 0, 0)))
- i = editfile (&ed, args, file, NOUSE, NULL, NULL, NULL, 0);
+ i = editfile (&ed, args, file, NOUSE, NULL, NULL, NULL, 0, 0);
static struct swit sendswitches[] = {
#define ALIASW 0
{ "alias aliasfile", 0 },
static struct swit sendswitches[] = {
#define ALIASW 0
{ "alias aliasfile", 0 },
+#define TLSSW 45
+ { "tls", TLSminc(-3) },
+#define NTLSSW 46
+ { "notls", TLSminc(-5) },
+#define MTSSW 47
+ { "mts smtp|sendmail/smtp|sendmail/pipe", 2 },
+#define MESSAGEIDSW 48
+ { "messageid localname|random", 2 },
char *cp, buf[BUFSIZ], **argp;
char **arguments, *vec[MAXARGS];
struct stat st;
char *cp, buf[BUFSIZ], **argp;
char **arguments, *vec[MAXARGS];
struct stat st;
- char *attach = (char *)0; /* attachment header field name */
- int attachformat = 0; /* mhbuild format specifier for
+ char *attach = NMH_ATTACH_HEADER;/* attachment header field name */
+ int attachformat = 1; /* mhbuild format specifier for
vec[vecp++] = --cp;
if (!(cp = *argp++) || *cp == '-') {
advise (NULL, "missing argument to %s", argp[-2]);
vec[vecp++] = --cp;
if (!(cp = *argp++) || *cp == '-') {
advise (NULL, "missing argument to %s", argp[-2]);
if ((cp = getenv ("SIGNATURE")) == NULL || *cp == 0)
if ((cp = context_find ("signature")) && *cp)
m_putenv ("SIGNATURE", cp);
if ((cp = getenv ("SIGNATURE")) == NULL || *cp == 0)
if ((cp = context_find ("signature")) && *cp)
m_putenv ("SIGNATURE", cp);
-#ifdef UCI
- else {
- snprintf (buf, sizeof(buf), "%s/.signature", mypath);
- if ((fp = fopen (buf, "r")) != NULL
- && fgets (buf, sizeof(buf), fp) != NULL) {
- fclose (fp);
- if (cp = strchr (buf, '\n'))
- *cp = 0;
- m_putenv ("SIGNATURE", buf);
- }
- }
-#endif /* UCI */
if (link (altmsg, distfile) == NOTOK)
adios (distfile, "unable to link %s to", altmsg);
} else {
if (link (altmsg, distfile) == NOTOK)
adios (distfile, "unable to link %s to", altmsg);
} else {