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
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;
}
snprintf (buffer, sizeof(buffer), "%d", use);
m_putenv ("mhuse", buffer);
+ snprintf (buffer, sizeof(buffer), "%d", atfile);
+ m_putenv ("mhatfile", buffer);
unputenv ("mhmessages");
unputenv ("mhannotate");
* static prototypes
*/
static int editfile (char **, char **, char *, int, struct msgs *,
- char *, char *, int);
+ char *, char *, int, int);
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 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];
msgnam = (cp = getenv ("mhaltmsg")) && *cp ? getcpy (cp) : NULL;
+ if ((cp = getenv ("mhatfile")) && *cp)
+ atfile = atoi(cp);
+
if ((cp = getenv ("mhuse")) && *cp)
use = atoi (cp);
}
/* 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);
/* 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)
done (1);
break;
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];
*ed = defaulteditor;
}
- if (altmsg) {
+ if (altmsg && atfile) {
if (mp == NULL || *altmsg == '/' || cwd == NULL)
strncpy (altpath, altmsg, sizeof(altpath));
else
edsave = getcpy (*ed);
*ed = NULL;
- if (altmsg)
+ if (altmsg && atfile)
unlink (linkpath);
return status;
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)))
return 0;
/*
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);