;;
forw )
options=(-annotate -noannotate -form -format -noformat
- -filter -inplace -noinplace -mime -nomime
+ -filter -mime -nomime
-editor -noedit -whatnowproc
-nowhatnowproc -build -file
-version -help)
repl )
options=(-annotate -noannotate -group -nogroup -cc
-nocc -query -noquery -form -format -noformat -filter
- -inplace -noinplace -mime -nomime -fcc -width
+ -mime -nomime -fcc -width
-editor -noedit -whatnowproc
-nowhatnowproc -build -file -version -help)
;;
compctl -K mhfseq -x 's[+][@]' \
-K mhcomp -S / -q - 'c[-1]' -K mhfseq -\
's[-]' -k "(annotate noannotate cc nocc \
- editor noedit fcc filter form group nogroup inplace noinplace
+ editor noedit fcc filter form group nogroup \
query noquery width whatnowproc nowhatnowproc help)" - 'c[-1,(cc|nocc)]' \
-k "(all to cc me)" - 'C[-1,-(filter|form)]' -K mhfile - \
'C[-1,-(editor|whatnowproc)]' -c -- repl
/*
** prototypes for some routines in uip
*/
-int annotate(char *, char *, char *, int, int, int, int);
+int annotate(char *, char *, char *, int, int, int);
void annolist(char *, char *, char *, int);
void annopreserve(int);
int distout(char *, char *, char *);
void replout(FILE *, char *, char *, struct msgs *, int,
char *, char *, char *);
int what_now(char *, int, int, char *, char *, int, struct msgs *,
- char *, int, char *);
+ char *, char *);
/*
** from the former mts.h
.RI [ msgs ]
.RB [ \-component
.IR field ]
-.RB [ \-inplace " | " \-noinplace ]
.RB [ \-date " | " \-nodate ]
.RB [ \-append ]
.RB [ \-list ]
which means that it may only consist of alphanumerics and dashes,
The body specified is arbitrary text.
.PP
-Normally
.B anno
-does the annotation inplace in order to preserve
-any links to the message. You may change this by using the
-.B \-noinplace
-switch.
+always does the annotation inplace in order to preserve
+any links to the message.
.PP
The
.B -list
.nf
.RI ` +folder "' defaults to the current folder"
.RI ` msgs "' defaults to cur"
-.RB ` \-inplace '
.RB ` \-date '
.fi
.RB [ \-form
.IR formfile ]
.RB [ \-annotate " | " \-noannotate ]
-.RB [ \-inplace " | " \-noinplace ]
.RB [ \-editor
.IR editor ]
.RB [ \-noedit ]
.RB \*(lq comp
.BR \-use \*(rq
may be used to re\-edit and send the constructed
-message, but the annotations won't take place. Normally annotations are
-done inplace in order to preserve any links to the message. You may use
-the
-.B \-noinplace
-switch to change this.
+message, but the annotations won't take place. Annotations are always
+done inplace in order to preserve any links to the message.
.PP
See
.BR comp (1)
.RB ` +folder "' defaults to the current folder"
.RB ` msg "' defaults to cur"
.RB ` \-noannotate '
-.RB ` \-inplace '
.fi
.SH CONTEXT
.RB [ \-format " | " \-noformat ]
.RB [ \-filter
.IR filterfile ]
-.RB [ \-inplace " | " \-noinplace ]
.RB [ \-mime " | " \-nomime ]
.RB [ \-editor
.IR editor ]
.RB \*(lq comp
.BR \-use \*(rq
may be used to re\-edit and send the constructed
-message, but the annotations won't take place. Normally annotations
-are done inplace in order to preserve any links to the message. You may
-change this by using the
-.B \-noinplace
-switch.
+message, but the annotations won't take place. Annotations
+are always done inplace in order to preserve any links to the message.
.PP
See
.BR comp (1)
.RB ` msgs "' defaults to cur"
.RB ` \-noannotate '
.RB ` \-noformat '
-.RB ` \-inplace '
.RB ` \-nomime '
.fi
.RI [ msgs ]
.RB [ \-component
.IR field ]
-.RB [ \-inplace " | " \-noinplace ]
.RB [ \-date " | " \-nodate ]
.RB [ \-version ]
.RB [ \-help ]
.RB [ \-form
.IR formfile ]
.RB [ \-annotate " | " \-noannotate ]
-.RB [ \-inplace " | " \-noinplace ]
.RB [ \-editor
.IR editor ]
.RB [ \-noedit ]
.RB [ \-format " | " \-noformat ]
.RB [ \-filter
.IR filterfile ]
-.RB [ \-inplace " | " \-noinplace ]
.RB [ \-mime " | " \-nomime ]
.RB [ \-editor
.IR editor ]
.RB [ \-format " | " \-noformat ]
.RB [ \-filter
.IR filterfile ]
-.RB [ \-inplace " | " \-noinplace ]
.RB [ \-mime " | " \-nomime ]
.RB [ \-fcc
.IR +folder ]
if annotations are to occur.
.RE
.PP
-.B $mhinplace
-.RS 5
-This is set by
-.BR dist ,
-.BR forw ,
-and
-.B repl
-if annotations are to occur.
-.RE
-.PP
.B $mhfolder
.RS 5
This is the folder containing the alternate message.
.RB [ \-format " | " \-noformat ]
.RB [ \-filter
.IR filterfile ]
-.RB [ \-inplace " | " \-noinplace ]
.RB [ \-mime " | " \-nomime ]
.RB [ \-fcc
.IR +folder ]
.BR repl ,
.RB \*(lq "comp\ \-use" \*(rq
may be used to re\-edit and send the constructed
-message, but the annotations won't take place. Normally annotations are
-done inplace in order to preserve any links to the message. You may use
-the
-.B \-noinplace
-switch to change this.
+message, but the annotations won't take place. Annotations are always
+done inplace in order to preserve any links to the message.
.PP
Although the default template specifies that a copy of the reply will be
put in
.RB ` "\-nocc\ all" "' with `\-nogroup', `\-cc\ all' with `\-group'"
.RB ` \-noannotate '
.RB ` \-noformat '
-.RB ` \-inplace '
.RB ` \-nomime '
.RB ` \-noquery '
.fi
static struct swit switches[] = {
#define COMPSW 0
{ "component field", 0 },
-#define INPLSW 1
- { "inplace", 0 },
-#define NINPLSW 2
- { "noinplace", 0 },
-#define DATESW 3
+#define DATESW 1
{ "date", 0 },
-#define NDATESW 4
+#define NDATESW 2
{ "nodate", 0 },
-#define TEXTSW 5
+#define TEXTSW 3
{ "text body", 0 },
-#define VERSIONSW 6
+#define VERSIONSW 4
{ "version", 0 },
-#define HELPSW 7
+#define HELPSW 5
{ "help", 0 },
-#define LISTSW 8
+#define LISTSW 6
{ "list", 1 },
-#define DELETESW 9
+#define DELETESW 7
{ "delete", 2 },
-#define NUMBERSW 10
+#define NUMBERSW 8
{ "number", 2 },
-#define APPENDSW 11
+#define APPENDSW 9
{ "append", 1 },
-#define PRESERVESW 12
+#define PRESERVESW 10
{ "preserve", 1 },
-#define NOPRESERVESW 13
+#define NOPRESERVESW 11
{ "nopreserve", 3 },
{ NULL, 0 }
};
int
main(int argc, char **argv)
{
- int inplace = 1, datesw = 1;
+ int datesw = 1;
int msgnum;
char *cp, *maildir;
unsigned char *comp = NULL;
datesw = 0;
continue;
- case INPLSW:
- inplace++;
- continue;
- case NINPLSW:
- inplace = 0;
- continue;
-
case TEXTSW:
if (text)
adios(NULL, "only one body at a time!");
if (list)
annolist(m_name(msgnum), comp, text, number);
else
- annotate(m_name(msgnum), comp, text, inplace, datesw, delete, append);
+ annotate(m_name(msgnum), comp, text, datesw, delete, append);
}
}
/*
** static prototypes
*/
-static int annosbr(int, char *, char *, char *, int, int, int, int);
+static int annosbr(int, char *, char *, char *, int, int, int);
/*
** This "local" global and the annopreserve() function are a hack that
static int preserve_actime_and_modtime = 0;
int
-annotate(char *file, char *comp, char *text, int inplace, int datesw,
+annotate(char *file, char *comp, char *text, int datesw,
int delete, int append)
{
int i, fd;
b.actime = s.st_atime;
b.modtime = s.st_mtime;
- i = annosbr(fd, file, comp, text, inplace, datesw, delete, append);
+ i = annosbr(fd, file, comp, text, datesw, delete, append);
if (preserve_actime_and_modtime && utime(file, &b) == -1)
advise("can't set access and modification times for %s", file);
}
static int
-annosbr(int fd, char *file, char *comp, char *text, int inplace,
- int datesw, int delete, int append)
+annosbr(int fd, char *file, char *comp, char *text, int datesw, int delete,
+ int append)
{
int mode, tmpfd;
char *cp, *sp;
- char buffer[BUFSIZ], tmpfil[BUFSIZ];
+ char tmpfil[BUFSIZ];
struct stat st;
FILE *tmp;
int c; /* current character */
cpydata(fd, fileno(tmp), file, tmpfil);
fclose(tmp);
- if (inplace) {
- if ((tmpfd = open(tmpfil, O_RDONLY)) == NOTOK)
- adios(tmpfil, "unable to open for re-reading");
+ if ((tmpfd = open(tmpfil, O_RDONLY)) == NOTOK)
+ adios(tmpfil, "unable to open for re-reading");
- lseek(fd, (off_t) 0, SEEK_SET);
+ lseek(fd, (off_t) 0, SEEK_SET);
- /*
- ** We're making the file shorter if we're deleting a
- ** header field so the file has to be truncated or it
- ** will contain garbage.
- */
-
- if (delete >= -1 && ftruncate(fd, 0) == -1)
- adios(tmpfil, "unable to truncate.");
+ /*
+ ** We're making the file shorter if we're deleting a
+ ** header field so the file has to be truncated or it
+ ** will contain garbage.
+ */
- cpydata(tmpfd, fd, tmpfil, file);
- close(tmpfd);
- unlink(tmpfil);
- } else {
- strncpy(buffer, m_backup(file), sizeof(buffer));
- if (rename(file, buffer) == NOTOK) {
- switch (errno) {
- case ENOENT: /* unlinked early - no annotations */
- unlink(tmpfil);
- break;
+ if (delete >= -1 && ftruncate(fd, 0) == -1)
+ adios(tmpfil, "unable to truncate.");
- default:
- admonish(buffer, "unable to rename %s to",
- file);
- break;
- }
- return 1;
- }
- if (rename(tmpfil, file) == NOTOK) {
- admonish(file, "unable to rename %s to", tmpfil);
- return 1;
- }
- }
+ cpydata(tmpfd, fd, tmpfil, file);
+ close(tmpfd);
+ unlink(tmpfil);
/*
** Close the delete file so that we don't run out of file pointers if
if (nwhat)
done(0);
- what_now(ed, nedit, use, drft, NULL, 0, NULLMP, NULL, 0, cwd);
+ what_now(ed, nedit, use, drft, NULL, 0, NULLMP, NULL, cwd);
done(1);
return 1;
}
{ "noedit", 0 },
#define FORMSW 4
{ "form formfile", 0 },
-#define INPLSW 5
- { "inplace", 0 },
-#define NINPLSW 6
- { "noinplace", 0 },
-#define WHATSW 7
+#define WHATSW 5
{ "whatnowproc program", 0 },
-#define NWHATSW 8
+#define NWHATSW 6
{ "nowhatnowproc", 0 },
-#define VERSIONSW 9
+#define VERSIONSW 7
{ "version", 0 },
-#define HELPSW 10
+#define HELPSW 8
{ "help", 0 },
-#define FILESW 11
+#define FILESW 9
{ "file file", -4 }, /* interface from msh */
{ NULL, 0 }
};
int
main(int argc, char **argv)
{
- int anot = 0, inplace = 1, nedit = 0;
+ int anot = 0, nedit = 0;
int nwhat = 0, in, out;
char *cp, *cwd, *maildir, *msgnam;
char *ed = NULL, *file = NULL, *folder = NULL;
adios(NULL, "missing argument to %s",
argp[-2]);
continue;
-
- case INPLSW:
- inplace++;
- continue;
- case NINPLSW:
- inplace = 0;
- continue;
}
}
if (*cp == '+' || *cp == '@') {
if (nwhat)
done(0);
what_now(ed, nedit, NOUSE, drft, msgnam, 1, mp, anot ? "Resent" : NULL,
- inplace, cwd);
+ cwd);
done(1);
return 1;
}
{ "format", 5 },
#define NFRMTSW 7
{ "noformat", 7 },
-#define INPLSW 8
- { "inplace", 0 },
-#define NINPLSW 9
- { "noinplace", 0 },
-#define MIMESW 10
+#define MIMESW 8
{ "mime", 0 },
-#define NMIMESW 11
+#define NMIMESW 9
{ "nomime", 0 },
-#define DGSTSW 12
+#define DGSTSW 10
{ "digest list", 0 },
-#define ISSUESW 13
+#define ISSUESW 11
{ "issue number", 0 },
-#define VOLUMSW 14
+#define VOLUMSW 12
{ "volume number", 0 },
-#define WHATSW 15
+#define WHATSW 13
{ "whatnowproc program", 0 },
-#define NWHATSW 16
+#define NWHATSW 14
{ "nowhatnowproc", 0 },
-#define VERSIONSW 17
+#define VERSIONSW 15
{ "version", 0 },
-#define HELPSW 18
+#define HELPSW 16
{ "help", 0 },
-#define FILESW 19
+#define FILESW 17
{ "file file", 4 }, /* interface from msh */
#ifdef MHE
-#define BILDSW 22
+#define BILDSW 18
{ "build", 5 }, /* interface from mhe */
#endif /* MHE */
int
main(int argc, char **argv)
{
- int msgp = 0, anot = 0, inplace = 1, mime = 0;
+ int msgp = 0, anot = 0, mime = 0;
int issue = 0, volume = 0;
int nedit = 0, nwhat = 0, in;
int out, msgnum;
filter = NULL;
continue;
- case INPLSW:
- inplace++;
- continue;
- case NINPLSW:
- inplace = 0;
- continue;
-
case MIMESW:
mime++;
filter = NULL;
if (nwhat)
done(0);
what_now(ed, nedit, NOUSE, drft, NULL, 0, mp,
- anot ? "Forwarded" : NULL, inplace, cwd);
+ anot ? "Forwarded" : NULL, cwd);
done(1);
return 1;
}
strncat(buffer, m_name(msgnum),
sizeof(buffer)-strlen(buffer)-1);
}
- annotate(draft, attach_hdr, buffer, 1, 0, -2, 1);
+ annotate(draft, attach_hdr, buffer, 0, -2, 1);
}
{ "format", 5 },
#define NFRMTSW 12
{ "noformat", 7 },
-#define INPLSW 13
- { "inplace", 0 },
-#define NINPLSW 14
- { "noinplace", 0 },
-#define MIMESW 15
+#define MIMESW 13
{ "mime", 0 },
-#define NMIMESW 16
+#define NMIMESW 14
{ "nomime", 0 },
-#define QURYSW 17
+#define QURYSW 15
{ "query", 0 },
-#define NQURYSW 18
+#define NQURYSW 16
{ "noquery", 0 },
-#define WHATSW 19
+#define WHATSW 17
{ "whatnowproc program", 0 },
-#define NWHATSW 20
+#define NWHATSW 18
{ "nowhatnowproc", 0 },
-#define VERSIONSW 21
+#define VERSIONSW 19
{ "version", 0 },
-#define HELPSW 22
+#define HELPSW 20
{ "help", 0 },
-#define FILESW 23
+#define FILESW 21
{ "file file", 4 }, /* interface from msh */
#ifdef MHE
-#define BILDSW 24
+#define BILDSW 22
{ "build", 5 }, /* interface from mhe */
#endif
int
main(int argc, char **argv)
{
- int anot = 0, inplace = 1;
+ int anot = 0;
int nedit = 0, nwhat = 0;
char *cp, *cwd, *dp, *maildir, *file = NULL;
char *folder = NULL, *msg = NULL;
filter = NULL;
continue;
- case INPLSW:
- inplace++;
- continue;
- case NINPLSW:
- inplace = 0;
- continue;
-
case MIMESW:
mime++;
filter = NULL;
if (nwhat)
done(0);
what_now(ed, nedit, NOUSE, drft, msg, 0, mp, anot ? "Replied" : NULL,
- inplace, cwd);
+ cwd);
done(1);
return 1;
}
snprintf(buffer, sizeof buffer, "+%s %s",
mp->foldpath, m_name(mp->lowsel));
- annotate(drft, attach_hdr, buffer, 1, 0, -2, 1);
+ annotate(drft, attach_hdr, buffer, 0, -2, 1);
}
/* return dynamically allocated buffers */
int debugsw = 0; /* global */
int forwsw = 1;
-int inplace = 1;
int pushsw = 0;
int verbsw = 0;
char *altmsg = NULL;
if (!(annotext = getenv("mhannotate")) || !*annotext) {
annotext = NULL;
}
- if (annotext && ((cp = getenv("mhinplace")) && *cp)) {
- inplace = atoi(cp);
- }
if (!(altmsg = getenv("mhaltmsg")) || !*altmsg) {
altmsg = NULL; /* used by dist interface - see below */
}
}
if (debugsw) {
- advise(NULL, "annotate%s as `%s'", inplace ? " inplace" : "",
- annotext);
+ advise(NULL, "annotate as `%s'", annotext);
}
for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
if (is_selected(mp, msgnum)) {
if (debugsw) {
advise(NULL, "annotate message %d", msgnum);
}
- annotate(m_name(msgnum), annotext, NULL, inplace,
- 1, -2, 0);
+ annotate(m_name(msgnum), annotext, NULL, 1, -2, 0);
}
}
if (*shell == '/')
annotate(drft, attach_hdr,
- shell, 1, 0,
+ shell, 0,
-2, 1);
else {
sprintf(file, "%s/%s", cwd,
shell);
annotate(drft, attach_hdr,
- file, 1, 0,
+ file, 0,
-2, 1);
}
}
if (**arguments != '\0') {
n = atoi(*arguments);
annotate(drft, attach_hdr,
- NULL, 1, 0,
+ NULL, 0,
n, 1);
for (argp = arguments + 1; *argp != NULL; argp++) {
!= NULL) {
*(strchr(shell, '\n')) = '\0';
annotate(drft, attach_hdr, shell,
- 1, 0, 0, 1);
+ 0, 0, 1);
}
pclose(f);
} else {
*/
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, char *cwd)
{
int found, k, msgnum, vecp;
int len, buflen;
unputenv("mhmessages");
unputenv("mhannotate");
- unputenv("mhinplace");
if (text && mp && !is_readonly(mp)) {
found = 0;
if (found) {
m_putenv("mhmessages", buffer);
m_putenv("mhannotate", text);
- snprintf(buffer, sizeof(buffer), "%d", inplace);
- m_putenv("mhinplace", buffer);
}
}