broke dist with -noatfile.
int sendsbr (char **, int, char *, struct stat *, int, char *, int);
int SOprintf (char *, ...);
int what_now (char *, int, int, char *, char *,
int sendsbr (char **, int, char *, struct stat *, int, char *, int);
int SOprintf (char *, ...);
int what_now (char *, int, int, char *, char *,
- int, struct msgs *, char *, int, char *);
+ int, struct msgs *, char *, int, char *, int);
int WhatNow(int, char **);
int writeBase64aux(FILE *, FILE *);
int WhatNow(int, char **);
int writeBase64aux(FILE *, FILE *);
- what_now (ed, nedit, use, drft, NULL, 0, NULLMP, NULL, 0, cwd);
+ what_now (ed, nedit, use, drft, NULL, 0, NULLMP, NULL, 0, cwd, 0);
- what_now (ed, nedit, NOUSE, drft, atfile ? msgnam : NULL, 1, mp,
- anot ? "Resent" : NULL, inplace, cwd);
+ what_now (ed, nedit, NOUSE, drft, msgnam, 1, mp, anot ? "Resent" : NULL,
+ inplace, cwd, atfile);
if (nwhat)
done (0);
what_now (ed, nedit, NOUSE, drft, NULL, 0, mp,
if (nwhat)
done (0);
what_now (ed, nedit, NOUSE, drft, NULL, 0, mp,
- anot ? "Forwarded" : NULL, inplace, cwd);
+ anot ? "Forwarded" : NULL, inplace, cwd, 0);
- what_now (ed, nedit, NOUSE, drft, atfile ? msg : NULL, 0, mp,
- anot ? "Replied" : NULL, inplace, cwd);
+ what_now (ed, nedit, NOUSE, drft, msg, 0, mp, anot ? "Replied" : NULL,
+ inplace, cwd, atfile);
int
what_now (char *ed, int nedit, int use, char *file, char *altmsg, int dist,
int
what_now (char *ed, int nedit, int use, char *file, char *altmsg, int dist,
- struct msgs *mp, char *text, int inplace, char *cwd)
+ struct msgs *mp, char *text, int inplace, char *cwd, int atfile)
{
int found, k, msgnum, vecp;
int len, buflen;
{
int found, k, msgnum, vecp;
int len, buflen;
}
snprintf (buffer, sizeof(buffer), "%d", use);
m_putenv ("mhuse", buffer);
}
snprintf (buffer, sizeof(buffer), "%d", use);
m_putenv ("mhuse", buffer);
+ snprintf (buffer, sizeof(buffer), "%d", atfile);
+ m_putenv ("mhatfile", buffer);
unputenv ("mhmessages");
unputenv ("mhannotate");
unputenv ("mhmessages");
unputenv ("mhannotate");
* static prototypes
*/
static int editfile (char **, char **, char *, int, struct msgs *,
* static prototypes
*/
static int editfile (char **, char **, char *, int, struct msgs *,
+ char *, char *, int, int);
static int sendfile (char **, char *, int);
static void sendit (char *, char **, char *, int);
static int buildfile (char **, char *);
static int sendfile (char **, char *, int);
static void sendit (char *, char **, char *, int);
static int buildfile (char **, char *);
int
WhatNow (int argc, char **argv)
{
int
WhatNow (int argc, char **argv)
{
- int isdf = 0, nedit = 0, use = 0;
+ int isdf = 0, nedit = 0, use = 0, atfile = 1;
char *cp, *dfolder = NULL, *dmsg = NULL;
char *ed = NULL, *drft = NULL, *msgnam = NULL;
char buf[BUFSIZ], prompt[BUFSIZ];
char *cp, *dfolder = NULL, *dmsg = NULL;
char *ed = NULL, *drft = NULL, *msgnam = NULL;
char buf[BUFSIZ], prompt[BUFSIZ];
msgnam = (cp = getenv ("mhaltmsg")) && *cp ? getcpy (cp) : NULL;
msgnam = (cp = getenv ("mhaltmsg")) && *cp ? getcpy (cp) : NULL;
+ if ((cp = getenv ("mhatfile")) && *cp)
+ atfile = atoi(cp);
+
if ((cp = getenv ("mhuse")) && *cp)
use = atoi (cp);
if ((cp = getenv ("mhuse")) && *cp)
use = atoi (cp);
}
/* start editing the draft, unless -noedit was given */
}
/* start editing the draft, unless -noedit was given */
- 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);
done (1);
snprintf (prompt, sizeof(prompt), myprompt, invo_name);
/* Call an editor on the draft file */
if (*++argp)
ed = *argp++;
/* Call an editor on the draft file */
if (*++argp)
ed = *argp++;
- if (editfile (&ed, argp, drft, NOUSE, NULL, msgnam, NULL, 1) == NOTOK)
+ if (editfile (&ed, argp, drft, NOUSE, NULL, msgnam,
+ NULL, 1, atfile) == NOTOK)
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,
- char *altmsg, char *cwd, int save_editor)
+ char *altmsg, char *cwd, int save_editor, int atfile)
{
int pid, status, vecp;
char altpath[BUFSIZ], linkpath[BUFSIZ];
{
int pid, status, vecp;
char altpath[BUFSIZ], linkpath[BUFSIZ];
+ if (altmsg && atfile) {
if (mp == NULL || *altmsg == '/' || cwd == NULL)
strncpy (altpath, altmsg, sizeof(altpath));
else
if (mp == NULL || *altmsg == '/' || cwd == NULL)
strncpy (altpath, altmsg, sizeof(altpath));
else
edsave = getcpy (*ed);
*ed = NULL;
edsave = getcpy (*ed);
*ed = NULL;
unlink (linkpath);
return status;
unlink (linkpath);
return status;
if ((cp = context_find ("automhnproc"))
&& !getenv ("NOMHNPROC")
&& check_draft (file)
if ((cp = context_find ("automhnproc"))
&& !getenv ("NOMHNPROC")
&& check_draft (file)
- && (i = editfile (&cp, NULL, file, NOUSE, NULL, NULL, NULL, 0)))
+ && (i = editfile (&cp, NULL, file, NOUSE, NULL, NULL, NULL, 0, 0)))
args[i++] = *argp++;
args[i] = NULL;
args[i++] = *argp++;
args[i] = NULL;
- i = editfile (&ed, args, file, NOUSE, NULL, NULL, NULL, 0);
+ i = editfile (&ed, args, file, NOUSE, NULL, NULL, NULL, 0, 0);
free (args);
return (i ? NOTOK : OK);
free (args);
return (i ? NOTOK : OK);