Re: whatnow: problems with edit--draft left
Ralph Corderoy <[email protected]>
| Newsgroups | gmane.mail.nmh.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Marcin,
> After saving the file I mostly (not always) get the following error:
>
> whatnow: problems with edit--draft left in /home/saper/Mail/drafts/,1
https://git.savannah.nongnu.org/cgit/nmh.git/tree/uip/whatnowsbr.c#n760
760 if ((status = pidwait (pid, NOTOK))) {
761 if (((status & 0xff00) != 0xff00)
762 && (!reedit || (status & 0x00ff))) {
763 if (!use && (status & 0xff00) &&
764 (rename (file, cp = m_backup (file)) != -1)) {
765 inform("problems with edit--draft left in %s", cp);
766 } else {
767 inform("problems with edit--%s preserved", file);
768 }
769 }
770 status = -2; /* maybe "reedit ? -2 : -1"? */
771 break;
772 }
773
The inform()s are poor as they don't pass on the detail, e.g. ed(1)'s
exit status.
My guess is you're imperfect in your ed-ing. :-)
$ man 1p ed | sed -n '/^EXIT STATUS/,/^[^ ]/p'
EXIT STATUS
The following exit values shall be returned:
0 Successful completion without any file or command errors.
>0 An error occurred.
CONSEQUENCES OF ERRORS
$
Here's an example.
$ ed /tmp/foo
/tmp/foo: No such file or directory
a
foo
.
wq
4
$ echo $?
0
$ ed /tmp/foo
4
/bar
?
$a
bar
.
wq
8
$ echo $?
1
$
Consider having a shell-script wrapper for ed which does its own checks,
if you can think of some, before returning its own exit status.
> $ diff orig/nmh-1.8/uip/whatnowsbr.c nmh-1.8/uip/whatnowsbr.c
Can we have a ‘diff -u’ another time please.
> 760a761
> > fprintf(stderr, "status = 0x%04x use = 0x%02x reedit = 0x%02x");
fprintf() is not being passed the parameters to print so it printing
what it finds on the stack.
> By the way, the system is not very reliable in counting comma files
> - it managed to overwrite my ",1" once.
nmh doesn't count comma files; the presence of ,1 doesn't make it use ,2
instead. Email 42 is moved to ,42 even if a previous 42 was moved to
,42 and it is still sitting there. A better scheme can be used by
setting rmmproc to what you prefer; see mh_profile(5).
--
Cheers, Ralph.