Mark the old -attach switches as deprecated (and make them not show
up in help). Still more documentation cleanup to do.
extern struct swit anoyes[]; /* standard yes/no switches */
extern struct swit anoyes[]; /* standard yes/no switches */
-#define ATTACHFORMATS 3 /* Number of send attach formats. */
-
/*
* general folder attributes
*/
/*
* general folder attributes
*/
#define LINK "@" /* Name of link to file to which you are */
/* replying. */
#define LINK "@" /* Name of link to file to which you are */
/* replying. */
-#define NMH_ATTACH_HEADER "Nmh-Attachment" /* Default header for -attach */
-
/*
* credentials management
*/
/*
* credentials management
*/
\&...]
.RB [ \-version ]
.RB [ \-help ]
\&...]
.RB [ \-version ]
.RB [ \-help ]
-.RB [ \-attach
-.IR header-field-name ]
-.RB [ \-noattach ]
-.RB [ \-attachformat
-.IR 0 " | " 1 " | " 2 ]
.ad
.SH DESCRIPTION
.B Send
.ad
.SH DESCRIPTION
.B Send
.RI [ file ]
.RB [ \-version ]
.RB [ \-help ]
.RI [ file ]
.RB [ \-version ]
.RB [ \-help ]
-.RB [ \-attach
-.IR header-field-name ]
-.RB [ \-noattach ]
.ad
.SH DESCRIPTION
.B Whatnow
.ad
.SH DESCRIPTION
.B Whatnow
.SH DEFAULTS
.nf
.RB ` \-prompt "' defaults to \*(lqWhat\ Now?\ \*(rq"
.SH DEFAULTS
.nf
.RB ` \-prompt "' defaults to \*(lqWhat\ Now?\ \*(rq"
-.RB ` \-attach "' defaults to \*(lqNmh-Attachment\*(rq"
.fi
.SH BUGS
If the initial edit fails,
.fi
.SH BUGS
If the initial edit fails,
# whatnow's exit status is always 1 so that is not a failure
set +e
echo "attach $testname_quoted" | \
# whatnow's exit status is always 1 so that is not a failure
set +e
echo "attach $testname_quoted" | \
- run_prog whatnow -attach foo -noedit -prompt '' 2>>$actualerr >>$actual
+ run_prog whatnow -noedit -prompt '' 2>>$actualerr >>$actual
- run_prog whatnow -attach foo -noedit -prompt '' 2>>$actualerr >>$actual
+ run_prog whatnow -noedit -prompt '' 2>>$actualerr >>$actual
echo "detach $testname_quoted" | \
echo "detach $testname_quoted" | \
- run_prog whatnow -attach foo -noedit -prompt '' 2>>$actualerr >>$actual
+ run_prog whatnow -noedit -prompt '' 2>>$actualerr >>$actual
- run_prog whatnow -attach foo -noedit -prompt '' 2>>$actualerr >>$actual
+ run_prog whatnow -noedit -prompt '' 2>>$actualerr >>$actual
set -e
check "$expectederr" "$actualerr"
set -e
check "$expectederr" "$actualerr"
cat >"$expected" <<EOF
whatnow: attach command requires file argument(s).
whatnow: attach command requires file argument(s).
cat >"$expected" <<EOF
whatnow: attach command requires file argument(s).
whatnow: attach command requires file argument(s).
-#text/plain; name="context" <> [context]{attachment} ${MH_TEST_DIR}/Mail/context
+Attaching ${MH_TEST_DIR}/Mail/context as a text/plain
EOF
else
cat >"$expected" <<EOF
EOF
else
cat >"$expected" <<EOF
at -v
whatnow: attach command requires file argument(s).
at -v Mail/context
at -v
whatnow: attach command requires file argument(s).
at -v Mail/context
-#text/plain; name="context" <> [context]{attachment} ${MH_TEST_DIR}/Mail/context
+Attaching ${MH_TEST_DIR}/Mail/context as a text/plain
static char *get_file_info(const char *, const char *);
#endif /* MIMETYPEPROC */
static char *get_file_info(const char *, const char *);
#endif /* MIMETYPEPROC */
int
attach(char *attachment_header_field_name, char *draft_file_name,
char *body_file_name, size_t body_file_name_len,
int
attach(char *attachment_header_field_name, char *draft_file_name,
char *body_file_name, size_t body_file_name_len,
/*
* Try to use external command to determine mime type, and possibly
* encoding. Caller is responsible for free'ing returned memory.
/*
* Try to use external command to determine mime type, and possibly
* encoding. Caller is responsible for free'ing returned memory.
#endif /* MIMETYPEPROC */
#endif /* MIMETYPEPROC */
/*
* Construct an mhbuild directive for the draft file. This starts
* with the content type. Append a file name attribute, and depending
/*
* Construct an mhbuild directive for the draft file. This starts
* with the content type. Append a file name attribute, and depending
return build_directive;
}
return build_directive;
}
X("saslmaxssf", SASLminc(-10), SASLMXSSFSW) \
X("saslmech mechanism", SASLminc(-5), SASLMECHSW) \
X("user username", SASLminc(-4), USERSW) \
X("saslmaxssf", SASLminc(-10), SASLMXSSFSW) \
X("saslmech mechanism", SASLminc(-5), SASLMECHSW) \
X("user username", SASLminc(-4), USERSW) \
- X("attach", 6, ATTACHSW) \
- X("noattach", 0, NOATTACHSW) \
+ X("attach", -6, ATTACHSW) \
+ X("noattach", -8, NOATTACHSW) \
X("attachformat", 7, ATTACHFORMATSW) \
X("port server-port-name/number", 4, PORTSW) \
X("tls", TLSminc(-3), TLSSW) \
X("attachformat", 7, ATTACHFORMATSW) \
X("port server-port-name/number", 4, PORTSW) \
X("tls", TLSminc(-3), TLSSW) \
X("prompt string", 4, PRMPTSW) \
X("version", 0, VERSIONSW) \
X("help", 0, HELPSW) \
X("prompt string", 4, PRMPTSW) \
X("version", 0, VERSIONSW) \
X("help", 0, HELPSW) \
- X("attach header-field-name", 0, ATTACHSW) \
- X("noattach", 0, NOATTACHSW) \
+ X("attach header-field-name", -6, ATTACHSW) \
+ X("noattach", -8, NOATTACHSW) \
+
#define X(sw, minchars, id) id,
DEFINE_SWITCH_ENUM(WHATNOW);
#define X(sw, minchars, id) id,
DEFINE_SWITCH_ENUM(WHATNOW);
char buf[BUFSIZ], prompt[BUFSIZ];
char **argp, **arguments;
struct stat st;
char buf[BUFSIZ], prompt[BUFSIZ];
char **argp, **arguments;
struct stat st;
- char *attach = NMH_ATTACH_HEADER;/* attachment header field name */
char cwd[PATH_MAX + 1]; /* current working directory */
char file[PATH_MAX + 1]; /* file name buffer */
char shell[PATH_MAX + 1]; /* shell response buffer */
char cwd[PATH_MAX + 1]; /* current working directory */
char file[PATH_MAX + 1]; /* file name buffer */
char shell[PATH_MAX + 1]; /* shell response buffer */
- if (!(attach = *argp++) || *attach == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
+ advise(NULL, "The -attach switch is deprecated");
continue;
case NOATTACHSW:
continue;
case NOATTACHSW:
+ advise(NULL, "The -noattach switch is deprecated");
- if (attach == (char *)0) {
- advise((char *)0, "can't list because no header field name was given.");
- break;
- }
-
advise((char *)0, "usage is alist [-ln].");
else
advise((char *)0, "usage is alist [-ln].");
else
- annolist(drft, attach, l, n);
+ annolist(drft, ATTACH_FIELD, l, n);
int verbose = 0;
char **ap;
int verbose = 0;
char **ap;
- if (attach == (char *)0) {
- advise((char *)0, "can't attach because no header field name was given.");
- break;
- }
-
for (ap = argp+1; *ap; ++ap) {
if (strcmp(*ap, "-v") == 0) {
++argp;
for (ap = argp+1; *ap; ++ap) {
if (strcmp(*ap, "-v") == 0) {
++argp;
if ((f = popen_in_dir(cwd, buf, "r")) != (FILE *)0) {
while (fgets(shell, sizeof (shell), f) != (char *)0) {
if ((f = popen_in_dir(cwd, buf, "r")) != (FILE *)0) {
while (fgets(shell, sizeof (shell), f) != (char *)0) {
*(strchr(shell, '\n')) = '\0';
if (*shell == '/') {
*(strchr(shell, '\n')) = '\0';
if (*shell == '/') {
- (void)annotate(drft, attach, shell, 1, 0, -2, 1);
- if (verbose) {
- build_directive =
- construct_build_directive (shell, NULL, 1);
- }
+ strncpy(file, shell, sizeof(file));
+ file[sizeof(file) - 1] = '\0';
- (void)sprintf(file, "%s/%s", cwd, shell);
- (void)annotate(drft, attach, file, 1, 0, -2, 1);
- if (verbose) {
- build_directive =
- construct_build_directive (file, NULL, 1);
- }
+ snprintf(file, sizeof(file), "%s/%s", cwd, shell);
+ }
+
+ annotate(drft, ATTACH_FIELD, file, 1, 0, -2, 1);
+ if (verbose) {
+ ctype = mime_type(file);
- printf ("%s", build_directive);
- free (build_directive);
+ printf ("Attaching %s as a %s", file, ctype);
+ free (ctype);
* Detach files from current draft.
*/
* Detach files from current draft.
*/
- if (attach == (char *)0) {
- advise((char *)0, "can't detach because no header field name was given.");
- break;
- }
-
/*
* Scan the arguments for a -n. Mixed file names and numbers aren't allowed,
* so this catches a -n anywhere in the argument list.
/*
* Scan the arguments for a -n. Mixed file names and numbers aren't allowed,
* so this catches a -n anywhere in the argument list.
if (**arguments != '\0') {
n = atoi(*arguments);
if (**arguments != '\0') {
n = atoi(*arguments);
- (void)annotate(drft, attach, (char *)0, 1, 0, n, 1);
+ annotate(drft, ATTACH_FIELD, (char *)0, 1, 0, n, 1);
for (argp = arguments + 1; *argp != (char *)0; argp++) {
if (atoi(*argp) > n) {
for (argp = arguments + 1; *argp != (char *)0; argp++) {
if (atoi(*argp) > n) {
if ((f = popen_in_dir(cwd, buf, "r")) != (FILE *)0) {
while (fgets(shell, sizeof (shell), f) != (char *)0) {
*(strchr(shell, '\n')) = '\0';
if ((f = popen_in_dir(cwd, buf, "r")) != (FILE *)0) {
while (fgets(shell, sizeof (shell), f) != (char *)0) {
*(strchr(shell, '\n')) = '\0';
- (void)annotate(drft, attach, shell, 1, 0, 0, 1);
+ annotate(drft, ATTACH_FIELD, shell, 1, 0, 0, 1);