If the initial edit fails, no new draft is created, but any existing
re-used draft is preserved. Failures of later edits are ignored and
another prompt is printed.
is used to create a new message to be mailed. It copies a
message form to the draft being composed and then invokes an editor on
the draft (unless the
is used to create a new message to be mailed. It copies a
message form to the draft being composed and then invokes an editor on
the draft (unless the
switch with an empty string argument is given,
in which case the initial edit is suppressed).
.PP
switch with an empty string argument is given,
in which case the initial edit is suppressed).
.PP
after the initial edit.
.PP
When started, the editor is started on the draft (unless the
after the initial edit.
.PP
When started, the editor is started on the draft (unless the
switch with an empty string argument is given,
in which case the initial edit is suppressed). Then,
.B whatnow
switch with an empty string argument is given,
in which case the initial edit is suppressed). Then,
.B whatnow
.BR whatnow 's
actions in complex ways.
.PP
.BR whatnow 's
actions in complex ways.
.PP
+If the initial edit fails, no new draft is created, but any
+existing re-used draft is preserved.
+Failures of later edits are ignored and another prompt is printed.
+.PP
The
.B \-prompt
.I string
The
.B \-prompt
.I string
-
-.SH BUGS
-If the initial edit fails,
-.B whatnow
-deletes your draft (by renaming
-it with a leading comma); failure of a later edit preserves the draft.
/* start editing the draft, unless editor is the empty string */
if (*ed) {
if (editfile(&ed, NULL, drft, use, NULL, msgnam, NULL) <0) {
/* start editing the draft, unless editor is the empty string */
if (*ed) {
if (editfile(&ed, NULL, drft, use, NULL, msgnam, NULL) <0) {
+ if (!use) {
+ unlink(drft);
+ }
+ advise(NULL, "Try again.");
/* 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) == NOTOK)
- done(1);
+ editfile(&ed, argp, drft, NOUSE, NULL, msgnam, NULL);
vec[vecp] = NULL;
execvp(*ed, vec);
vec[vecp] = NULL;
execvp(*ed, vec);
- fprintf(stderr, "unable to exec ");
+ fprintf(stderr, "%s: unable to exec ", invo_name);
perror(*ed);
_exit(-1);
default:
if ((status = pidwait(pid, NOTOK))) {
perror(*ed);
_exit(-1);
default:
if ((status = pidwait(pid, NOTOK))) {
- if (((status & 0xff00) != 0xff00) &&
- (!edsave || (status & 0x00ff))) {
- if (!use && (status & 0xff00) && (rename(file, cp = m_backup(file)) != NOTOK)) {
- advise(NULL, "problems with edit--draft left in %s", cp);
- } else {
- advise(NULL, "problems with edit--%s preserved", file);
- }
+ if ((status & 0xff00) == 0xff00) {
+ /* cmd not found or pidwait() failed */
+ status = -1;
+ break;
- status = -2; /* maybe "edsave ? -2 : -1"? */
+ if (status & 0x00ff) {
+ /* terminated by signal */
+ advise(NULL, "%s terminated by signal %d",
+ *ed, status & 0x7f);
+ } else {
+ /* failure exit */
+ advise(NULL, "%s exited with return code %d",
+ *ed, (status & 0xff00) >> 8);
+ }
+ status = -1;
edsave = getcpy(*ed);
*ed = NULL;
edsave = getcpy(*ed);
*ed = NULL;
vec[vecp] = NULL;
execvp("send", vec);
vec[vecp] = NULL;
execvp("send", vec);
- fprintf(stderr, "unable to exec ");
+ fprintf(stderr, "%s: unable to exec ", invo_name);
perror("send");
_exit(-1);
perror("send");
_exit(-1);
case 0:
execvp(*vec, vec);
case 0:
execvp(*vec, vec);
- fprintf(stderr, "unable to exec ");
+ fprintf(stderr, "%s: unable to exec ", invo_name);