** prototypes
*/
struct format *fmt_scan(struct format *, char *, int, int *);
-char *new_fs(char *, char *, char *, char *);
int fmt_compile(char *, struct format **);
int makedir(char *);
char *nmh_getpass(const char *);
char *norm_charmap(char *);
-char *new_fs(char *, char *, char *, char *);
+char *new_fs(char *, char *);
int peekc(FILE *ib);
int pidwait(pid_t, int);
int pidstatus(int, FILE *, char *);
** default format for `scan' and `inc'
*/
# define FORMAT \
-"%4(msg)%<(cur)+%| %>%<{replied}-%?{encrypted}E%| %>\
+"=%4(msg)%<(cur)+%| %>%<{replied}-%?{encrypted}E%| %>\
%4(year{date})-%02(mon{date})-%02(mday{date}) \
%<(mymbox{from})%<{to}To:%14(decode(friendly{to}))%>%>\
%<(zero)%17(decode(friendly{from}))%> %(decode{subject})\n"
.B %libdir%/ap
.RB [ \-form
.IR formatfile ]
-.RB [ \-format
-.IR string ]
.RB [ \-normalize " | " \-nonormalize ]
.RB [ \-width
.IR columns ]
To override the output format used by
.BR ap ,
the
-.B \-format
-.I string
-or
-.B \-format
+.B \-form
.I file
-switches are used. This permits individual fields of
-the address to be extracted with ease. The string is simply a format
-string, and the file is simply a format file. See
+switch is used. This permits individual fields of
+the address to be extracted with ease.
+The
+.I file
+is either the name of a format file or it may be
+a format string directly, if prepended with an equal sign `='.
+See
.BR mh\-format (5)
for the details.
.PP
.BR ap :
.PP
.RS 5
+.nf
%<{error}%{error}: %{text}%|%(putstr(proper{text}))%>
+.fi
.RE
.PP
which says that if an error was detected, print the error, a `:', and
.SH DEFAULTS
.nf
-.RB ` \-format "' defaults as described above"
+.RB ` \-form "' defaults as described above"
.RB ` \-normalize '
.RB ` \-width "' defaults to the width of the terminal"
.fi
.SH BUGS
The argument to the
-.B \-format
+.B \-form
switch must be interpreted as a single token
by the shell that invokes
.BR ap .
.B %libdir%/dp
.RB [ \-form
.IR formatfile ]
-.RB [ \-format
-.IR string ]
.RB [ \-width
.IR columns ]
.RB [ \-version ]
To override the output format used by
.BR dp ,
the
-.B \-format
-.I string
-or
-.B \-format
+.B \-form
.I file
-switches are used.
+switch is used.
This permits individual fields of the address to be extracted with ease.
-The string is simply a format string and the file is simply a format file.
+The
+.I file
+is either the name of a format file or
+a format string directly, if prepended with an equal sign `='.
See
.BR mh\-format (5)
for the details.
.BR dp :
.PP
.RS 5
+.nf
%<(nodate{text})error: %{text}%|%(putstr(pretty{text}))%>
+.fi
.RE
.PP
which says that if an error was detected, print the error, a `:',
.SH DEFAULTS
.nf
-.RB ` \-format "' default as described above"
+.RB ` \-form "' default as described above"
.RB ` \-width "' default to the width of the terminal"
.fi
.SH BUGS
The argument to the
-.B \-format
+.B \-form
switch must be interpreted as a single token by the shell that invokes
.BR dp .
Therefore, one must usually place the argument to this switch inside double\-quotes.
.B %libdir%/fmtdump
.RB [ \-form
.IR formatfile ]
-.RB [ \-format
-.IR string ]
.RB [ \-version ]
.RB [ \-help ]
.ad
interprets the file. This is useful when debugging a complicated format file.
.PP
The
-.B \-format
-.I string
-and
.B \-form
.I formatfile
-switches may be
-used to specify a format string or format file to read. The string
-is simply a format string and the file is simply a format file.
+switch may be used to specify a format file to read.
+It may also be a format string directly, if prepended with an equal sign `='.
See
.BR mh-format (5)
for the details.
.RB [ \-changecur " | " \-nochangecur ]
.RB [ \-form
.IR formfile ]
-.RB [ \-format
-.IR string ]
.RB [ \-file
.IR name ]
.RB [ \-silent " | " \-nosilent ]
The interpretation of the
.B \-form
.IR formatfile ,
-.B \-format
-.IR string ,
and
.B \-width
.I columns
.RB ` +folder "' defaulted by \*(lqInbox\*(rq above"
.RB ` \-noaudit '
.RB ` \-changecur '
-.RB ` \-format "' defaulted as described above"
+.RB ` \-form "' defaulted as described above"
.RB ` \-nosilent '
.RB ` \-truncate "' if `" \-file " name' not given, `" \-notruncate "' otherwise"
.RB ` \-width "' defaulted to the width of the terminal"
.SH BUGS
The argument to the
-.B \-format
+.B \-form
switch must be interpreted as a single
token by the shell that invokes
.BR inc .
.B %libdir%/ap
.RB [ \-form
.IR formatfile ]
-.RB [ \-format
-.IR string ]
.RB [ \-normalize " | " \-nonormalize ]
.RB [ \-width
.IR columns ]
.B %libdir%/dp
.RB [ \-form
.IR formatfile ]
-.RB [ \-format
-.IR string ]
.RB [ \-width
.IR columns ]
.RB [ \-version ]
.B %libdir%/fmtdump
.RB [ \-form
.IR formatfile ]
-.RB [ \-format
-.IR string ]
.RB [ \-version ]
.RB [ \-help ]
.RB [ \-changecur " | " \-nochangecur ]
.RB [ \-form
.IR formfile ]
-.RB [ \-format
-.IR string ]
.RB [ \-file
.IR name ]
.RB [ \-silent " | " \-nosilent ]
.RI [ command ]
.RB [ \-form
.IR formatfile ]
-.RB [ \-format
-.IR string ]
.RB [ \-width
.IR columns ]
.RB [ \-bell " | " \-nobell ]
.RB [ \-clear " | " \-noclear ]
.RB [ \-form
.IR formatfile ]
-.RB [ \-format
-.IR string ]
.RB [ \-width
.IR columns ]
.RB [ \-file
.B \-form
.I formatfile
switch.
+Note: In contrast to any other
+.B mmh
+tool, the
+.B \-form
+switch does only take file names, but no format strings with a prepended
+equal sign `='.
.PP
Finally, the
.B \-folder
None
.SH BUGS
+In contrast to any other
+.B mmh
+tool, the
+.B \-form
+switch does only take file names, but no format strings with a prepended
+equal sign `='.
+.PP
There should be some way to pass `bell' and `clear' information to the
front\-end.
.PP
.RI [ command ]
.RB [ \-form
.IR formatfile ]
-.RB [ \-format
-.IR string ]
.RB [ \-width
.IR columns ]
.RB [ \-bell " | " \-nobell ]
Alternately, if no command is specified (or is bogus), then
.B rcvtty
will instead write a one\-line scan listing. The default output format
-of this scan listing may be overridden by using either the
+of this scan listing may be overridden by using the
.B \-form
.I formatfile
-or
-.B \-format
-.I string
option, similar to the
equivalent options for
.B scan
.RB [ \-clear " | " \-noclear ]
.RB [ \-form
.IR formatfile ]
-.RB [ \-format
-.IR string ]
.RB [ \-width
.IR columns ]
.RB [ \-file
To override the output format used by
.BR scan ,
the
-.B \-format
-.I string
-or
.B \-form
.I file
-switches are used. This permits individual fields of
-the scan listing to be extracted with ease. The string is simply a format
-string and the file is simply a format file. See
+switch is used. This permits individual fields of
+the scan listing to be extracted with ease.
+.I file
+is either the name of a format file or a format string directly,
+if prepended with an equal sign `='.
+See
.BR mh\-format (5)
for the details.
.PP
.nf
.RB ` +folder "' defaults to the current folder"
.RB ` msgs "' defaults to all"
-.RB ` \-format "' defaulted as described above"
+.RB ` \-form "' defaulted as described above"
.RB ` \-width "' defaulted to the width of the terminal"
.fi
.SH BUGS
The argument to the
-.B \-format
+.B \-form
switch must be interpreted as a single
token by the shell that invokes
.BR scan .
** Copy first available format string, store in static memory and normalize it.
*/
char *
-new_fs(char *form, char *format, char *def_form, char *default_fs)
+new_fs(char *form, char *def_form)
{
struct stat st;
register FILE *fp;
}
if (form) {
- if ((fp = fopen(etcpath(form), "r")) == NULL) {
- adios(form, "unable to open format file");
+ if (*form == '=') {
+ formats = getcpy(form+1);
+ } else {
+ if ((fp = fopen(etcpath(form), "r")) == NULL) {
+ adios(form, "unable to open format file");
+ }
+ if (fstat(fileno(fp), &st) == -1) {
+ adios(form, "unable to stat format file");
+ }
+ formats = mh_xmalloc((size_t) st.st_size + 1);
+ if (read(fileno(fp), formats, (int)st.st_size) != st.st_size) {
+ adios(form, "error reading format file");
+ }
+ formats[st.st_size] = '\0';
+ fclose(fp);
}
- if (fstat(fileno(fp), &st) == -1) {
- adios(form, "unable to stat format file");
- }
- formats = mh_xmalloc((size_t) st.st_size + 1);
- if (read(fileno(fp), formats, (int)st.st_size) != st.st_size) {
- adios(form, "error reading format file");
- }
- formats[st.st_size] = '\0';
- fclose(fp);
-
- } else if (format) {
- formats = getcpy(format);
-
} else if (def_form) {
- if ((fp = fopen(etcpath(def_form), "r")) == NULL) {
- adios(def_form, "unable to open format file");
+ if (*def_form == '=') {
+ formats = getcpy(def_form+1);
+ } else {
+ if ((fp = fopen(etcpath(def_form), "r")) == NULL) {
+ adios(def_form, "unable to open format file");
+ }
+ if (fstat(fileno(fp), &st) == -1) {
+ adios(def_form, "unable to stat format file");
+ }
+ formats = mh_xmalloc((size_t) st.st_size + 1);
+ if (read(fileno(fp), formats, (int)st.st_size) != st.st_size) {
+ adios(def_form, "error reading format file");
+ }
+ formats[st.st_size] = '\0';
+ fclose(fp);
}
- if (fstat(fileno(fp), &st) == -1) {
- adios(def_form, "unable to stat format file");
- }
- formats = mh_xmalloc((size_t) st.st_size + 1);
- if (read(fileno(fp), formats, (int)st.st_size) != st.st_size) {
- adios(def_form, "error reading format file");
- }
- formats[st.st_size] = '\0';
- fclose(fp);
-
- } else {
- formats = getcpy(default_fs);
}
normalize(formats); /* expand escapes */
#define WIDTH 78
#define WBUFSIZ BUFSIZ
-#define FORMAT "%<{error}%{error}: %{text}%|%(putstr(proper{text}))%>"
+#define FORMAT "=%<{error}%{error}: %{text}%|%(putstr(proper{text}))%>"
static struct swit switches[] = {
#define FORMSW 0
{ "form formatfile", 0 },
-#define FMTSW 1
- { "format string", 5 },
-#define NORMSW 2
+#define NORMSW 1
{ "normalize", 0 },
-#define NNORMSW 3
+#define NNORMSW 2
{ "nonormalize", 0 },
-#define WIDTHSW 4
+#define WIDTHSW 3
{ "width columns", 0 },
-#define VERSIONSW 5
+#define VERSIONSW 4
{ "version", 0 },
-#define HELPSW 6
+#define HELPSW 5
{ "help", 0 },
{ NULL, 0 }
};
{
int addrp = 0, normalize = AD_HOST;
int width = 0, status = 0;
- char *cp, *form = NULL, *format = NULL, *nfs;
+ char *cp, *form = NULL, *nfs;
char buf[BUFSIZ], **argp;
char **arguments, *addrs[NADDRS];
case FORMSW:
if (!(form = *argp++) || *form == '-')
adios(NULL, "missing argument to %s", argp[-2]);
- format = NULL;
- continue;
- case FMTSW:
- if (!(format = *argp++) || *format == '-')
- adios(NULL, "missing argument to %s", argp[-2]);
- form = NULL;
continue;
case WIDTHSW:
adios(NULL, "usage: %s [switches] addrs ...", invo_name);
/* get new format string */
- nfs = new_fs(form, format, NULL, FORMAT);
+ nfs = new_fs(form, FORMAT);
if (width == 0) {
if ((width = sc_width()) < WIDTH / 2)
close(out);
} else {
- nfs = new_fs(form, NULL, components, NULL);
+ nfs = new_fs(form, components);
strncpy(drft, m_draft(seq_beyond), sizeof(drft));
if ((out = creat(drft, m_gmprot())) == NOTOK) {
adios(drft, "unable to create");
if ((out = creat(drft, m_gmprot())) == NOTOK)
adios(drft, "unable to create");
- nfs = new_fs(form, NULL, distcomps, NULL);
+ nfs = new_fs(form, distcomps);
if (write(out, nfs, strlen(nfs)) != strlen(nfs)) {
adios(drft, "error writing");
}
#define WIDTH 78
#define WBUFSIZ BUFSIZ
-#define FORMAT "%<(nodate{text})error: %{text}%|%(putstr(pretty{text}))%>"
+#define FORMAT "=%<(nodate{text})error: %{text}%|%(putstr(pretty{text}))%>"
static struct swit switches[] = {
#define FORMSW 0
{ "form formatfile", 0 },
-#define FMTSW 1
- { "format string", 5 },
-#define WIDTHSW 2
+#define WIDTHSW 1
{ "width columns", 0 },
-#define VERSIONSW 3
+#define VERSIONSW 2
{ "version", 0 },
-#define HELPSW 4
+#define HELPSW 3
{ "help", 0 },
{ NULL, 0 }
};
main(int argc, char **argv)
{
int datep = 0, width = 0, status = 0;
- char *cp, *form = NULL, *format = NULL, *nfs;
+ char *cp, *form = NULL, *nfs;
char buf[BUFSIZ], **argp, **arguments;
char *dates[NDATES];
if (!(form = *argp++) || *form == '-')
adios(NULL, "missing argument to %s",
argp[-2]);
- format = NULL;
- continue;
- case FMTSW:
- if (!(format = *argp++) || *format == '-')
- adios(NULL, "missing argument to %s",
- argp[-2]);
- form = NULL;
continue;
case WIDTHSW:
adios(NULL, "usage: %s [switches] dates ...", invo_name);
/* get new format string */
- nfs = new_fs(form, format, NULL, FORMAT);
+ nfs = new_fs(form, FORMAT);
if (width == 0) {
if ((width = sc_width()) < WIDTH / 2)
static struct swit switches[] = {
#define FORMSW 0
{ "form formatfile", 0 },
-#define FMTSW 1
- { "format string", 5 },
-#define VERSIONSW 2
+#define VERSIONSW 1
{ "version", 0 },
-#define HELPSW 3
+#define HELPSW 2
{ "help", 0 },
{ NULL, 0 }
};
main(int argc, char **argv)
{
int ncomps;
- char *cp, *form = NULL, *format = NULL;
+ char *cp, *form = NULL;
char buf[BUFSIZ], *nfs, **argp, **arguments;
struct format *fmt;
if (!(form = *argp++) || *form == '-')
adios(NULL, "missing argument to %s",
argp[-2]);
- format = NULL;
- continue;
- case FMTSW:
- if (!(format = *argp++) || *format == '-')
- adios(NULL, "missing argument to %s",
- argp[-2]);
- form = NULL;
continue;
}
/*
** Get new format string. Must be before chdir().
*/
- nfs = new_fs(form, format, NULL, FORMAT);
+ nfs = new_fs(form, FORMAT);
ncomps = fmt_compile(nfs, &fmt);
fmt_dump(fmt);
cpydata(in, out, form, drft);
close(in);
} else {
- nfs = new_fs(form, NULL, forwcomps, NULL);
+ nfs = new_fs(form, forwcomps);
if (write(out, nfs, strlen(nfs)) != strlen(nfs)) {
adios(drft, "error writing");
}
char *cp = NULL;
/* Get new format string */
- nfs = new_fs(form, NULL, NULL, NULL);
+ nfs = new_fs(form, NULL);
fmtsize = strlen(nfs) + 256;
/* Compile format string */
{ "file name", 0 },
#define FORMSW 5
{ "form formatfile", 0 },
-#define FMTSW 6
- { "format string", 5 },
-#define SILSW 7
+#define SILSW 6
{ "silent", 0 },
-#define NSILSW 8
+#define NSILSW 7
{ "nosilent", 0 },
-#define TRNCSW 9
+#define TRNCSW 8
{ "truncate", 0 },
-#define NTRNCSW 10
+#define NTRNCSW 9
{ "notruncate", 0 },
-#define WIDTHSW 11
+#define WIDTHSW 10
{ "width columns", 0 },
-#define VERSIONSW 12
+#define VERSIONSW 11
{ "version", 0 },
-#define HELPSW 13
+#define HELPSW 12
{ "help", 0 },
};
** not truncate mailspool
*/
char *cp, *maildir = NULL, *folder = NULL;
- char *format = NULL, *form = NULL;
+ char *form = NULL;
char *audfile = NULL, *from = NULL;
char buf[BUFSIZ], **argp, *nfs, **arguments;
struct msgs *mp = NULL;
if (!(form = *argp++) || *form == '-')
adios(NULL, "missing argument to %s",
argp[-2]);
- format = NULL;
- continue;
- case FMTSW:
- if (!(format = *argp++) || *format == '-')
- adios(NULL, "missing argument to %s",
- argp[-2]);
- form = NULL;
continue;
case WIDTHSW:
#endif /* MHE */
/* Get new format string */
- nfs = new_fs(form, format, NULL, FORMAT);
+ nfs = new_fs(form, FORMAT);
if (noisy) {
printf("Incorporating new mail into %s...\n\n", folder);
if (ptos(name, &cp))
return 1;
- nfs = new_fs(NULL, NULL, NULL, cp);
+ cp = concat("=", cp, NULL);
+ nfs = new_fs(cp, NULL);
+ free(cp);
c1->c_nfs = getcpy(nfs);
c1->c_flags |= FORMAT;
return 0;
if (!mh_strcasecmp(name, "decode")) {
char *nfs;
- nfs = new_fs(NULL, NULL, NULL, "%(decode{text})");
+ nfs = new_fs("=%(decode{text})", NULL);
c1->c_nfs = getcpy(nfs);
c1->c_flags |= FORMAT;
return 0;
adios(drft, "unable to create");
/* get new format string */
- cp = new_fs(form ? form : rcvdistcomps, NULL, NULL, NULL);
+ cp = new_fs(form ? form : rcvdistcomps, NULL);
format_len = strlen(cp);
ncomps = fmt_compile(cp, &fmt) + 1;
if (!(nxtbuf = compbuffers =
#endif
#define SCANFMT \
-"%2(hour{dtimenow}):%02(min{dtimenow}): %<(size)%5(size) %>%<{encrypted}E%>\
+"=%2(hour{dtimenow}):%02(min{dtimenow}): %<(size)%5(size) %>%<{encrypted}E%>\
%<(mymbox{from})%<{to}To:%14(friendly{to})%>%>%<(zero)%17(friendly{from})%> \
%{subject}"
{ "biff", 0 },
#define FORMSW 1
{ "form formatfile", 0 },
-#define FMTSW 2
- { "format string", 5 },
-#define WIDTHSW 3
+#define WIDTHSW 2
{ "width columns", 0 },
-#define NLSW 4
+#define NLSW 3
{ "newline", 0 },
-#define NNLSW 5
+#define NNLSW 4
{ "nonewline", 0 },
-#define BELSW 6
+#define BELSW 5
{ "bell", 0 },
-#define NBELSW 7
+#define NBELSW 6
{ "nobell", 0 },
-#define VERSIONSW 8
+#define VERSIONSW 7
{ "version", 0 },
-#define HELPSW 9
+#define HELPSW 8
{ "help", 0 },
{ NULL, 0 }
};
static int biff = 0;
static int width = 0;
static char *form = NULL;
-static char *format = NULL;
/*
** static prototypes
if (!(form = *argp++) || *form == '-')
adios(NULL, "missing argument to %s",
argp[-2]);
- format = NULL;
- continue;
- case FMTSW:
- if (!(format = *argp++) || *format == '-')
- adios(NULL, "missing argument to %s",
- argp[-2]);
- form = NULL;
continue;
case WIDTHSW:
rewind(stdin);
/* get new format string */
- nfs = new_fs(form, format, NULL, SCANFMT);
+ nfs = new_fs(form, SCANFMT);
scan(stdin, 0, 0, nfs, width, 0, 0, NULL, 0L, 0);
if (newline)
write(fd, "\n\r", 2);
umask(mask);
/* get new format string */
- cp = new_fs(form, NULL, NULL, NULL);
+ cp = new_fs(form, NULL);
format_len = strlen(cp);
/* compile format string */
{ "noclear", 0 },
#define FORMSW 2
{ "form formatfile", 0 },
-#define FMTSW 3
- { "format string", 5 },
-#define WIDTHSW 4
+#define WIDTHSW 3
{ "width columns", 0 },
-#define FILESW 5
+#define FILESW 4
{ "file file", 4 },
-#define VERSIONSW 6
+#define VERSIONSW 5
{ "version", 0 },
-#define HELPSW 7
+#define HELPSW 6
{ "help", 0 },
{ NULL, 0 }
};
int i, state, msgnum;
int seqnum[NUMATTRS], unseen, num_unseen_seq = 0;
char *cp, *maildir, *file = NULL, *folder = NULL;
- char *form = NULL, *format = NULL, buf[BUFSIZ];
+ char *form = NULL, buf[BUFSIZ];
char **argp, *nfs, **arguments;
struct msgs_array msgs = { 0, 0, NULL };
struct msgs *mp;
if (!(form = *argp++) || *form == '-')
adios(NULL, "missing argument to %s",
argp[-2]);
- format = NULL;
- continue;
- case FMTSW:
- if (!(format = *argp++) || *format == '-')
- adios(NULL, "missing argument to %s",
- argp[-2]);
- form = NULL;
continue;
case WIDTHSW:
/*
** Get new format string. Must be before chdir().
*/
- nfs = new_fs(form, format, NULL, FORMAT);
+ nfs = new_fs(form, FORMAT);
/*
** We are scanning a maildrop file