char *mhlreply = "mhl.reply"; /* repl -filter */
char *mhlforward = "mhl.forward"; /* forw -filter */
-char *draft = "draft";
+char *draftfolder = "drafts";
char *inbox = "Inbox";
char *defaultfolder = "inbox";
-noverbose -version -help)
;;
comp )
- options=(-form -use -nouse -file -draftfolder -draftmessage
- -nodraftfolder -editor -noedit -whatnowproc -nowhatnowproc
+ options=(-form -use -nouse -file
+ -editor -noedit -whatnowproc -nowhatnowproc
-version -help )
;;
flist* )
;;
forw )
options=(-annotate -noannotate -form -format -noformat
- -filter -inplace -noinplace -mime -nomime -draftfolder
- -draftmessage -nodraftfolder -editor -noedit -whatnowproc
+ -filter -inplace -noinplace -mime -nomime
+ -editor -noedit -whatnowproc
-nowhatnowproc -dashstuffing -nodashstuffing -build -file
-version -help)
;;
repl )
options=(-annotate -noannotate -group -nogroup -cc
-nocc -query -noquery -form -format -noformat -filter
- -inplace -noinplace -mime -nomime -fcc -width -draftfolder
- -draftmessage -nodraftfolder -editor -noedit -whatnowproc
+ -inplace -noinplace -mime -nomime -fcc -width
+ -editor -noedit -whatnowproc
-nowhatnowproc -build -file -version -help)
;;
rmf )
#
# Extract nmh message names and numbers for completion. Use of the
# correct folder, if it is not the current one, requires that it
-# should be the previous command line argument. If the previous
-# argument is `-draftmessage', a hard wired draft folder name is used.
+# should be the previous command line argument.
#
mhfseq() {
local folder foldpath words pos nums
# First try the previous word.
if [[ $words[$pos-1] = [@+]* ]]; then
folder=$words[$pos-1]
- # Next look and see if we're looking for a draftmessage
- elif [[ $words[$pos-1] = -draftmessage ]]; then
- # EDIT ME: shortcut -- hard-wire draftfolder here
- # Should really look for a +draftfolder argument.
- folder=+drafts
fi
# Else use the current folder ($folder empty)
's[-]' -k "(sequence all noall recurse norecurse showzero noshowzero \
alpha noalpha fast nofast help)" -- flist flists
-compctl -K mhfseq -x 's[+][@],c[-1,-draftfolder] s[+][@]' \
- -K mhcomp -S / -q - 'c[-1,-draftmessage]' -K mhfseq - \
+compctl -K mhfseq -x 's[+][@],c[-1] s[+][@]' \
+ -K mhcomp -S / -q - 'c[-1]' -K mhfseq - \
'C[-1,-(editor|whatnowproc)]' -c - \
- 's[-]' -k "(draftfolder draftmessage nodraftfolder editor noedit \
+ 's[-]' -k "(editor noedit \
file form use nouse whatnowproc nowhatnowproc help)" - \
'c[-1,-form]' -K mhfile -- comp
compctl -K mhfseq -x 's[+][@]' \
- -K mhcomp -S / -q - 'c[-1,-draftmessage]' -K mhfseq -\
- 's[-]' -k "(annotate noannotate cc nocc draftfolder nodraftfolder \
- draftmessage editor noedit fcc filter form group nogroup inplace noinplace
+ -K mhcomp -S / -q - 'c[-1]' -K mhfseq -\
+ 's[-]' -k "(annotate noannotate cc nocc \
+ editor noedit fcc filter form group nogroup inplace noinplace
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
extern char *defaultfolder;
extern char *digestcomps;
extern char *distcomps;
-extern char *draft;
+extern char *draftfolder;
extern char *faceproc;
extern char *fileproc;
extern char *foldprot;
int m_atoi (char *);
char *m_backup (char *);
int m_convert (struct msgs *, char *);
-char *m_draft (char *, char *, int, int *);
+char *m_draft (char *);
int m_getfld (int, unsigned char *, unsigned char *, int, FILE *);
int m_gmprot (void);
char *m_maildir (char *);
.IR field ]
.RB [ \-inplace " | " \-noinplace ]
.RB [ \-date " | " \-nodate ]
-.RB [ \-draft ]
.RB [ \-append ]
.RB [ \-list ]
.RB [ \-delete ]
.B -text
option specifies the field body.
.PP
-The messages are either the
+The messages are the
.I msgs
-in the named folder, or the draft if invoked with the
-.B -draft
-option.
+in the named folder.
.PP
Usually, annotation is performed by the commands
.BR dist ,
.RB [ \-use " | " \-nouse ]
.RB [ \-file
.IR file ]
-.RB [ \-draftfolder
-.IR +folder ]
-.RB [ \-draftmessage
-.IR msg ]
-.RB [ \-nodraftfolder ]
.RB [ \-editor
.IR editor ]
.RB [ \-noedit ]
.B refile
is required.)
.PP
-The
-.B \-draftfolder
-.I +folder
-and
-.B \-draftmessage
-.I msg
-switches invoke the
-.B nmh
-draft folder facility. This is an advanced (and highly
-useful) feature. Consult the
+Consult the
.BR mh-draft (5)
man page for more information.
.PP
^%etcdir%/components~^The standard message skeleton
^or <mh\-dir>/components~^Rather than the standard skeleton
^$HOME/\&.mh\(ruprofile~^The user profile
-^<mh\-dir>/draft~^The draft file
+^<mh\dir>/drafts~^The draft folder
.fi
.SH "PROFILE COMPONENTS"
.ta 2.4i
.ta \w'ExtraBigProfileName 'u
^Path:~^To determine the user's nmh directory
-^Draft\-Folder:~^To find the default draft\-folder
+^Draft\-Folder:~^To set the default draft\-folder
^Editor:~^To override the default editor
^Msg\-Protect:~^To set mode when creating a new message (draft)
^fileproc:~^Program to refile the message
.nf
.RB ` +folder "' defaults to the current folder"
.RB ` msg "' defaults to the current message"
-.RB ` \-nodraftfolder '
.RB ` \-nouse '
.fi
.IR formfile ]
.RB [ \-annotate " | " \-noannotate ]
.RB [ \-inplace " | " \-noinplace ]
-.RB [ \-draftfolder
-.IR +folder ]
-.RB [ \-draftmessage
-.IR msg ]
-.RB [ \-nodraftfolder ]
.RB [ \-editor
.IR editor ]
.RB [ \-noedit ]
.IR formfile .
The form used will be prepended to the message being resent.
.PP
-If the draft already exists,
-.B dist
-will ask you as to the disposition of the draft. A reply of
-.B quit
-will abort
-.BR dist ,
-leaving the draft intact;
-.B replace
-will replace the existing draft with a blank skeleton; and
-.B list
-will display the draft.
-.PP
Only those addresses in
.RI \*(lq Resent\-To: \*(rq,
.RI \*(lq Resent\-cc: \*(rq,
the folder containing the message is stored in the environment variable
.BR $mhfolder .
.PP
-The
-.B \-draftfolder
-.I +folder
-and
-.B \-draftmessage
-.I msg
-switches invoke the
-.B nmh
-draft folder facility. This is an advanced (and highly
-useful) feature. Consult the
+Consult the
.BR mh-draft (5)
man page for more information.
.PP
^%etcdir%/distcomps~^The standard message skeleton
^or <mh\-dir>/distcomps~^Rather than the standard skeleton
^$HOME/\&.mh\(ruprofile~^The user profile
-^<mh\-dir>/draft~^The draft file
+^<mh\-dir>/drafts~^The draft folder
.fi
.SH "PROFILE COMPONENTS"
.ta \w'ExtraBigProfileName 'u
^Path:~^To determine the user's nmh directory
^Current\-Folder:~^To find the default current folder
-^Draft\-Folder:~^To find the default draft\-folder
+^Draft\-Folder:~^To set the default draft\-folder
^Editor:~^To override the default editor
^fileproc:~^Program to refile the message
^whatnowproc:~^Program to ask the \*(lqWhat now?\*(rq questions
.RB ` +folder "' defaults to the current folder"
.RB ` msg "' defaults to cur"
.RB ` \-noannotate '
-.RB ` \-nodraftfolder '
.RB ` \-inplace '
.fi
.IR filterfile ]
.RB [ \-inplace " | " \-noinplace ]
.RB [ \-mime " | " \-nomime ]
-.RB [ \-draftfolder
-.IR +folder ]
-.RB [ \-draftmessage
-.IR msg ]
-.RB [ \-nodraftfolder ]
.RB [ \-editor
.IR editor ]
.RB [ \-noedit ]
.B \-form
.IR formfile .
.PP
-If the draft already exists,
-.B forw
-will ask you as to the disposition
-of the draft. A reply of
-.B quit
-will abort
-.BR forw ,
-leaving the draft intact;
-.B replace
-will replace the existing draft with a blank skeleton; and
-.B list
-will display the draft.
-.PP
If the
.B \-annotate
switch is given, each message being forwarded will
.PP
prior to sending the draft.
.PP
-The
-.B \-draftfolder
-.I +folder
-and
-.B \-draftmessage
-.I msg
-switches invoke the
-.B nmh
-draft folder facility. This is an advanced (and highly
-useful) feature. Consult the
+Consult the
.BR mh-draft (5)
man page for more information.
.PP
^%etcdir%/mhl.forward~^The standard message filter
^or <mh\-dir>/mhl.forward~^Rather than the standard filter
^$HOME/\&.mh\(ruprofile~^The user profile
-^<mh\-dir>/draft~^The draft file
+^<mh\-dir>/drafts~^The draft folder
.fi
.SH "PROFILE COMPONENTS"
.ta \w'ExtraBigProfileName 'u
^Path:~^To determine the user's nmh directory
^Current\-Folder:~^To find the default current folder
-^Draft\-Folder:~^To find the default draft\-folder
+^Draft\-Folder:~^To set the default draft\-folder
^Editor:~^To override the default editor
^Msg\-Protect:~^To set mode when creating a new message (draft)
^fileproc:~^Program to refile the message
.RB ` +folder "' defaults to the current folder"
.RB ` msgs "' defaults to cur"
.RB ` \-noannotate '
-.RB ` \-nodraftfolder '
.RB ` \-noformat '
.RB ` \-inplace '
.RB ` \-dashstuffing '
.RB [ \-use " | " \-nouse ]
.RB [ \-file
.IR file ]
-.RB [ \-draftfolder
-.IR +folder ]
-.RB [ \-draftmessage
-.IR msg ]
-.RB [ \-nodraftfolder ]
.RB [ \-editor
.IR editor ]
.RB [ \-noedit ]
.IR formfile ]
.RB [ \-annotate " | " \-noannotate ]
.RB [ \-inplace " | " \-noinplace ]
-.RB [ \-draftfolder
-.IR +folder ]
-.RB [ \-draftmessage
-.IR msg ]
-.RB [ \-nodraftfolder ]
.RB [ \-editor
.IR editor ]
.RB [ \-noedit ]
.IR filterfile ]
.RB [ \-inplace " | " \-noinplace ]
.RB [ \-mime " | " \-nomime ]
-.RB [ \-draftfolder
-.IR +folder ]
-.RB [ \-draftmessage
-.IR msg ]
-.RB [ \-nodraftfolder ]
.RB [ \-editor
.IR editor ]
.RB [ \-noedit ]
.IR +folder ]
.RB [ \-width
.IR columns ]
-.RB [ \-draftfolder
-.IR +folder ]
-.RB [ \-draftmessage
-.IR msg ]
-.RB [ \-nodraftfolder ]
.RB [ \-editor
.IR editor ]
.RB [ \-noedit ]
.B send
.RB [ \-alias
.IR aliasfile ]
-.RB [ \-draft ]
-.RB [ \-draftfolder
-.IR +folder ]
-.RB [ \-draftmessage
-.IR msg ]
-.RB [ \-nodraftfolder ]
.RB [ \-filter
.IR filterfile ]
.RB [ \-nofilter ]
.HP 5
.B whatnow
-.RB [ \-draftfolder
-.IR +folder ]
-.RB [ \-draftmessage
-.IR msg ]
-.RB [ \-nodraftfolder ]
.RB [ \-editor
.IR editor ]
.RB [ \-noedit ]
.BR forw ,
and
.B repl
-commands have two additional switches,
-.B \-draftfolder
-.I +folder
-and
-.B \-draftmessage
-.I msg
-which allow you to manipulate the various draft messages you are composing.
+commands allow you to manipulate various draft messages simultanely
.PP
-If
-.B \-draftfolder
-.I +folder
-is used, these commands are
-directed to construct a draft message in the indicated folder.
+Draft messages are created in the draft folder.
(The
.RI \*(lq Draft\-Folder \*(rq
-profile entry may be used to declare a default draft folder for use with
-.BR comp ,
-.BR dist ,
-.BR forw ,
-and
-.BR repl ).
+profile entry may be used to change the default draft folder.
.PP
-If the swith
-.B \-draftmessage
-.I msg
-is given, the specified draft is used to compose the message. If
-.B \-draftmessage
-.I msg
-is not used, then the
-draft defaults to `new' (create a new draft) unless the user invokes
+New drafts are created unless the user invokes
.B comp
with
.BR \-use ,
-in which case the default is `cur'.
+in which case the current draft is used.
.PP
-Hence, the user may have several message compositions in progress
-simultaneously. Now, all of the
-.B nmh
-tools are available on each of the user's message drafts (e.g.
-.BR show ,
-.BR scan ,
-.BR pick ,
-and so on). If the folder does not exist, the user is asked if it should be
-created (just like with
-.BR refile ).
-Also, the last draft message
+The last draft message
the user was composing is known as `cur' in the draft folder.
.PP
-Furthermore, the
-.B send
-command has these switches as well. Hence,
-from the shell, the user can send off whatever drafts desired using the
+The user can send off whatever drafts desired from the shell using the
standard
.B nmh
-`msgs' convention with
-.B \-draftmessage
-.IR msgs .
-If no `msgs' are given, it defaults to `cur'.
-.PP
-In addition, all five programs have a
-.B \-nodraftfolder
-switch, which undoes the last occurrence of
-.B \-draftfolder
-.I folder
-(useful if the latter occurs in the user's
-.B nmh
-profile).
-.PP
-If the user does not give the
-.B \-draftfolder
-.I +folder
-switch, then all these commands act \*(lqnormally\*(rq. Note that the
-.B \-draft
-switch to
+`msgs' convention to the
.B send
-and
-.B show
-still refers to the file called `draft' in the user's
-.B nmh
-directory. In the interests of economy of expression, when using
-.B comp
-or
-.BR send ,
-the user needn't prefix the draft `msg' or `msgs' with
-.BR \-draftmessage .
-Both of these
-commands accept a `file' or `files' argument, and they will, if given
-.B \-draftfolder
-.I +folder
-treat these arguments as `msg' or `msgs'. (This may appear to be
-inconsistent, at first, but it saves a lot of typing) Hence,
-.PP
-.RS
-.nf
-send -draftfolder +drafts first
-.fi
-.RE
-.PP
-is the same as
+command..
+If no `msgs' are given, it defaults to `cur'.
.PP
.RS
.nf
-send -draftfolder +drafts -draftmessage first
+send first
.fi
.RE
.PP
.RS 5
.nf
Draft\-Folder: +drafts
-sendf: \-draftfolder +drafts
.fi
.RE
.PP
-Furthermore, let's assume that the program
-.B sendf
-is a (symbolic) link in the user's
-.I $HOME/bin/
-directory to
-.BR send .
-Then, any of the commands
+Any of the commands
.PP
.RS 5
.nf
.fi
.RE
.PP
-constructs the message draft in the `draft' folder using the `new'
+constructs the message draft in the draft folder using the `new'
message number. Furthermore, they each define `cur' in this folder to
be that message draft. If the user were to use the
.B quit
.PP
.RS 5
.nf
-sendf
+send
.fi
.RE
.PP
.PP
.RS 5
.nf
-sendf `pick +drafts -to nmh-workers`
+send `pick +drafts -to nmh-workers`
.fi
.RE
.PP
.B send
doesn't mind sending more than one draft at a time.
.PP
-Note that the argument
-.B \-draftfolder
-.I +folder
-is not included in the profile entry for
-.BR send ,
-since when
-.BR comp ,
-et. al., invoke
-.B send
-directly, they supply
-.B send
-with the UNIX pathname of the message draft, and
-.B not
-a
-.B \-draftmessage
-.I msg
-argument. As far as
-.B send
-is concerned, a draft folder is not being used.
-.PP
It is important to realize that
.B nmh
treats the draft folder like a standard
.B nmh
-folder in nearly all respects. There are two exceptions:
-.PP
-First, under no circumstancs will the
-.B \-draftfolder
-.I folder
-switch cause the named folder to become the current folder.
-.PP
-Obviously, if the folder appeared in the context of a standard
-.I +folder
-argument to an
-.B nmh
-program, as in
-.PP
-.RS 5
-.nf
-scan +drafts
-.fi
-.RE
-.PP
-it might become the current folder, depending on the context changes of the
-.B nmh
-program in question.
-.PP
-Second, although conceptually
+folder in nearly all respects. There is one exception:
+Although conceptually
.B send
deletes the `msgs' named in the draft folder, it does not call
.I delete\-prog
to perform the deletion.
-
-.SS "What Happens if the Draft Exists"
-When the
-.BR comp ,
-.BR dist ,
-.BR forw ,
-and
-.B repl
-commands
-are invoked and the draft you indicated already exists, these programs
-will prompt the user for a reponse directing the program's action.
-The prompt is
-.PP
-.RS 5
-.nf
-Draft ``/home/foobar/nmhbox/draft'' exists (xx bytes).
-Disposition?
-.fi
-.RE
-.PP
-The appropriate responses and their meanings are:
-.PP
-.RS 5
-.fc ^ ~
-.nf
-.ta \w'replace 'u
-.BR ^replace~^ "- deletes the draft and starts afresh"
-.BR ^list~^ "- lists the draft"
-.BR ^refile~^ "- files the draft into a folder and starts afresh"
-.BR ^quit~^ "- leaves the draft intact and exits"
-.fi
-.RE
-.PP
-In addition, if you specified
-.B \-draftfolder
-.I folder
-to the command, then one other response will be accepted:
-.PP
-.RS 5
-.fc ^ ~
-.nf
-.ta \w'replace 'u
-.BR ^new~^ "- finds a new draft"
-.fi
-.RE
-.PP
-just as if
-.B \-draftmessage
-.I new
-had been given.
-Finally, the
-.B comp
-command will accept one more response:
-.PP
-.RS 5
-.fc ^ ~
-.nf
-.ta \w'replace 'u
-.BR ^use~^ "- re-uses the draft"
-.fi
-.RE
-.PP
-just as if
-.B \-use
-had been given.
-
.SH CONTEXT
None
.na
.B refile
.RI [ msgs ]
-.RB [ \-draft ]
.RB [ \-link " | " \-nolink ]
.RB [ \-preserve " | " \-nopreserve ]
.RB [ \-unlink " | " \-nounlink ]
option forces
the message files to be deleted by renaming or unlinking them as
described above.
-.PP
-The
-.B \-draft
-switch tells
-.B refile
-to file the <mh\-dir>/draft.
.SH FILES
.fc ^ ~
.IR +folder ]
.RB [ \-width
.IR columns ]
-.RB [ \-draftfolder
-.IR +folder ]
-.RB [ \-draftmessage
-.IR msg ]
-.RB [ \-nodraftfolder ]
.RB [ \-editor
.IR editor ]
.RB [ \-noedit ]
.BR repl 's
formatting of these fields.
.PP
-If the draft already exists,
-.B repl
-will ask you as to the disposition
-of the draft. A reply of
-.B quit
-will abort
-.BR repl ,
-leaving the
-draft intact;
-.B replace
-will replace the existing draft with a blank
-skeleton; and
-.B list
-will display the draft.
-.PP
See
.BR comp (1)
for a description of the
.I subject
component.
.PP
-The
-.B \-draftfolder
-.I +folder
-and
-.B \-draftmessage
-.I msg
-switches invoke
-the
-.B nmh
-draft folder facility. This is an advanced (and highly
-useful) feature. Consult the
+Consult the
.BR mh-draft (5)
man page for more
information.
^%etcdir%/mhl.reply~^The standard message filter
^or <mh\-dir>/mhl.reply~^Rather than the standard filter
^$HOME/\&.mh\(ruprofile~^The user profile
-^<mh\-dir>/draft~^The draft file
+^<mh\-dir>/drafts~^The draft folder
.fi
.SH "PROFILE COMPONENTS"
^Path:~^To determine the user's nmh directory
^Alternate\-Mailboxes:~^To determine the user's mailboxes
^Current\-Folder:~^To find the default current folder
-^Draft\-Folder:~^To find the default draft\-folder
+^Draft\-Folder:~^To set the default draft\-folder
^Editor:~^To override the default editor
^Msg\-Protect:~^To set mode when creating a new message (draft)
^fileproc:~^Program to refile the message
.RB ` \-nogroup '
.RB ` "\-nocc\ all" "' with `\-nogroup', `\-cc\ all' with `\-group'"
.RB ` \-noannotate '
-.RB ` \-nodraftfolder '
.RB ` \-noformat '
.RB ` \-inplace '
.RB ` \-nomime '
.B send
.RB [ \-alias
.IR aliasfile ]
-.RB [ \-draft ]
-.RB [ \-draftfolder
-.IR +folder ]
-.RB [ \-draftmessage
-.IR msg ]
-.RB [ \-nodraftfolder ]
.RB [ \-filter
.IR filterfile ]
.RB [ \-nofilter ]
.IR port-name/number ]
.RB [ \-width
.IR columns ]
-.RB [ file
+.RB [ msg
\&...]
.RB [ \-version ]
.RB [ \-help ]
.ad
.SH DESCRIPTION
.B Send
-will cause each of the specified files to be delivered
+will cause each of the specified messages to be delivered
to each of the destinations in the \*(lqTo:\*(rq, \*(lqcc:\*(rq,
\*(lqBcc:\*(rq, \*(lqDcc:\*(rq, and \*(lqFcc:\*(rq fields of the message. If
.B send
of information can be gathered about each step of the message's entry
into the transport system.
.PP
-The
-.B \-draftfolder
-.I +folder
-and
-.B \-draftmessage
+.B Send
+with no
.I msg
-switches invoke
-the
-.B nmh
-draft folder facility. This is an advanced (and highly
-useful) feature. Consult the
+argument will send the current message in the draft folder.
+.B Send
+always takes messages from the draft folder.
+(But, a
+.I +folder
+argument might be added in the future.)
+Consult the
.BR mh-draft (5)
-man page for more
-information.
+man page for more information.
.PP
-.B Send
-with no
-.I file
-argument will query whether the draft
-is the intended file, whereas
-.B \-draft
-will suppress this question.
Once the transport system has successfully accepted custody of the
-message, the file will be renamed with a leading comma, which allows
+message, the message will be renamed with a leading comma, which allows
it to be retrieved until the next draft message is sent. If there are
errors in the formatting of the message,
.B send
.nf
.ta \w'%etcdir%/ExtraBigFileName 'u
^$HOME/\&.mh\(ruprofile~^The user profile
+^<mh\-dir>/drafts~^The draft folder
.fi
.SH "PROFILE COMPONENTS"
.ta 2.4i
.ta \w'ExtraBigProfileName 'u
^Path:~^To determine the user's nmh directory
-^Draft\-Folder:~^To find the default draft\-folder
+^Draft\-Folder:~^To set the default draft\-folder
^Aliasfile:~^For a default alias file
^Signature:~^To determine the user's mail signature
^mailproc:~^Program to post failure notices
.SH DEFAULTS
.nf
-.RB ` file "' defaults to <mh\-dir>/draft"
+.RB ` msg "' defaults to the current message in the draft folder"
.RB ` \-alias "' defaults to %etcdir%/MailAliases"
-.RB ` \-nodraftfolder '
.RB ` \-nofilter '
.RB ` \-format '
.RB ` \-forward '
.B show
.RI [ +folder ]
.RI [ msgs ]
-.RB [ \-draft ]
.RB [\-showproc
.IR program ]
.RB [ \-showmimeproc
each file is listed with a one\-line header and two lines of
separation.
.PP
-.RB \*(lq "show \-draft" \*(rq
-will list the file <mh\-dir>/draft if it
-exists.
-.PP
If the profile entry \*(lqUnseen\-Sequence\*(rq is present and
non\-empty, then
.B show
.HP 5
.na
.B whatnow
-.RB [ \-draftfolder
-.IR +folder ]
-.RB [ \-draftmessage
-.IR msg ]
-.RB [ \-nodraftfolder ]
.RB [ \-editor
.IR editor ]
.RB [ \-noedit ]
switch sets the prompting string for
.BR whatnow .
.PP
-The
-.B \-draftfolder
-.I +folder
-and
-.B \-draftmessage
-.I msg
-switches invoke
-the
-.B nmh
-draft folder facility. This is an advanced (and highly
-useful) feature. Consult the
+Consult the
.BR mh-draft (5)
man page for more
information.
.nf
.ta \w'%etcdir%/ExtraBigFileName 'u
^$HOME/\&.mh\(ruprofile~^The user profile
-^<mh\-dir>/draft~^The draft file
+^<mh\-dir>/drafts~^The draft folder
.fi
.SH "PROFILE COMPONENTS"
.ta 2.4i
.ta \w'ExtraBigProfileName 'u
^Path:~^To determine the user's nmh directory
-^Draft\-Folder:~^To find the default draft\-folder
+^Draft\-Folder:~^To set the default draft\-folder
^Editor:~^To override the default editor
^<lasteditor>\-next:~^To name an editor to be used after exit
^~^from <lasteditor>
#include <errno.h>
+/*
+** `which' should either be "cur" to use the current draft
+** or "new" to start with a new draft.
+*/
char *
-m_draft (char *folder, char *msg, int use, int *isdf)
+m_draft(char *which)
{
register char *cp;
register struct msgs *mp;
static char buffer[BUFSIZ];
+ char *folder;
- if (*isdf == -1 || folder == NULL || *folder == '\0') {
- if (*isdf == -1 || (cp = context_find ("Draft-Folder")) == NULL) {
- *isdf = 0;
- return m_maildir (msg && *msg ? msg : draft);
- } else {
- folder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
- *cp != '@' ? TFOLDER : TSUBCWF);
- }
- }
- *isdf = 1;
+ cp = draftfolder;
+ folder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
+ *cp != '@' ? TFOLDER : TSUBCWF);
chdir (m_maildir (""));
strncpy (buffer, m_maildir (folder), sizeof(buffer));
mp->msgflags |= ALLOW_NEW; /* allow the "new" sequence */
/*
- * If we have been give a valid message name, then use that.
- * Else, if we are given the "use" option, then use the
- * current message. Else, use special sequence "new".
+ * The draft message name to return is defined by `which'.
+ * Usually it is "cur" (for the current draft) or "new"
+ * (to start a new draft).
*/
- if (!m_convert (mp, msg && *msg ? msg : use ? "cur" : "new"))
+ if (!m_convert (mp, which))
done (1);
seq_setprev (mp);
- if (mp->numsel > 1)
- adios (NULL, "only one message draft at a time!");
-
- snprintf (buffer, sizeof(buffer), "%s/%s", mp->foldpath, m_name (mp->lowsel));
- cp = buffer;
-
- seq_setcur (mp, mp->lowsel);/* set current message for folder */
- seq_save (mp); /* synchronize message sequences */
- folder_free (mp); /* free folder/message structure */
+ snprintf (buffer, sizeof(buffer), "%s/%s", mp->foldpath,
+ m_name (mp->lowsel));
+ seq_setcur (mp, mp->lowsel);
+ seq_save (mp);
+ folder_free (mp);
- return cp;
+ return buffer;
}
{ "context", &context },
{ "mh-sequences", &mh_seq },
{ "backup-prefix", &backup_prefix },
+ { "draft-folder", &draftfolder },
{ "altmsg-link", &altmsglink },
{ "buildmimeproc", &buildmimeproc },
{ "faceproc", &faceproc },
* COPYRIGHT file in the root directory of the nmh distribution for
* complete copyright information.
*
- * Four new options have been added: delete, list, number, and draft.
+ * Three new options have been added: delete, list, and number.
* Message header fields are used by the new MIME attachment code in
* the send command. Adding features to generalize the anno command
* seemed to be a better approach than the creation of a new command
* whose features would overlap with those of the anno command.
*
- * The -draft option causes anno to operate on the current draft file
- * instead of on a message sequence.
- *
* The -delete option deletes header elements that match the -component
* field name. If -delete is used without the -text option, the first
* header field whose field name matches the component name is deleted.
{ "version", 0 },
#define HELPSW 7
{ "help", 0 },
-#define DRFTSW 8
- { "draft", 2 },
-#define LISTSW 9
+#define LISTSW 8
{ "list", 1 },
-#define DELETESW 10
+#define DELETESW 9
{ "delete", 2 },
-#define NUMBERSW 11
+#define NUMBERSW 10
{ "number", 2 },
-#define APPENDSW 12
+#define APPENDSW 11
{ "append", 1 },
-#define PRESERVESW 13
+#define PRESERVESW 12
{ "preserve", 1 },
-#define NOPRESERVESW 14
+#define NOPRESERVESW 13
{ "nopreserve", 3 },
{ NULL, 0 }
};
struct msgs *mp;
int append = 0; /* append annotations instead of default prepend */
int delete = -2; /* delete header element if set */
- char *draft = (char *)0; /* draft file name */
- int isdf = 0; /* return needed for m_draft() */
int list = 0; /* list header elements if set */
int number = 0; /* delete specific number of like elements if set */
delete = 0;
continue;
- case DRFTSW: /* draft message specified */
- draft = "";
- continue;
-
case LISTSW: /* produce a listing */
list = 1;
continue;
app_msgarg(&msgs, cp);
}
- /*
- * We're dealing with the draft message instead of message numbers.
- * Get the name of the draft and deal with it just as we do with
- * message numbers below.
- */
-
- if (draft != (char *)0) {
- if (msgs.size != 0)
- adios(NULL, "can only have message numbers or -draft.");
-
- draft = getcpy(m_draft(folder, (char *)0, 1, &isdf));
-
- make_comp(&comp);
-
- if (list)
- annolist(draft, comp, text, number);
- else
- annotate (draft, comp, text, inplace, datesw, delete, append);
-
- done(0);
- return 1;
- }
-
#ifdef UCI
if (strcmp(invo_name, "fanno") == 0) /* ugh! */
datesw = 0;
#include <fcntl.h>
static struct swit switches[] = {
-#define DFOLDSW 0
- { "draftfolder +folder", 0 },
-#define DMSGSW 1
- { "draftmessage msg", 0 },
-#define NDFLDSW 2
- { "nodraftfolder", 0 },
-#define EDITRSW 3
+#define EDITRSW 0
{ "editor editor", 0 },
-#define NEDITSW 4
+#define NEDITSW 1
{ "noedit", 0 },
-#define FILESW 5
- { "file file", 0 },
-#define FORMSW 6
+#define FORMSW 2
{ "form formfile", 0 },
-#define USESW 7
+#define USESW 3
{ "use", 0 },
-#define NUSESW 8
+#define NUSESW 4
{ "nouse", 0 },
-#define WHATSW 9
+#define WHATSW 5
{ "whatnowproc program", 0 },
-#define NWHATSW 10
+#define NWHATSW 6
{ "nowhatnowproc", 0 },
-#define VERSIONSW 11
+#define VERSIONSW 7
{ "version", 0 },
-#define HELPSW 12
+#define HELPSW 8
{ "help", 0 },
{ NULL, 0 }
};
{ NULL, 0 }
};
-static struct swit aqrul[] = {
- { "quit", 0 },
- { "replace", 0 },
- { "use", 0 },
- { "list", 0 },
- { "refile", 0 },
- { NULL, 0 }
-};
-
int
main (int argc, char **argv)
{
int use = NOUSE, nedit = 0, nwhat = 0;
- int i, in, isdf = 0, out;
- char *cp, *cwd, *maildir, *dfolder = NULL;
- char *ed = NULL, *file = NULL, *form = NULL;
+ int i, in, out;
+ char *cp, *cwd, *maildir;
+ char *ed = NULL, *form = NULL;
char *folder = NULL, *msg = NULL, buf[BUFSIZ];
char drft[BUFSIZ], **argp, **arguments;
struct msgs *mp = NULL;
case NUSESW:
use = NOUSE;
continue;
-
- case FILESW: /* compatibility */
- if (file)
- adios (NULL, "only one file at a time!");
- if (!(file = *argp++) || *file == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- isdf = NOTOK;
- continue;
-
- case DFOLDSW:
- if (dfolder)
- adios (NULL, "only one draft folder at a time!");
- if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- dfolder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
- *cp != '@' ? TFOLDER : TSUBCWF);
- continue;
- case DMSGSW:
- if (file)
- adios (NULL, "only one draft message at a time!");
- if (!(file = *argp++) || *file == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- continue;
- case NDFLDSW:
- dfolder = NULL;
- isdf = NOTOK;
- continue;
}
}
if (*cp == '+' || *cp == '@') {
if (!context_find ("path"))
free (path ("./", TFOLDER));
- /*
- * Check if we are using a draft folder
- * and have specified a message in it.
- */
- if ((dfolder || context_find ("Draft-Folder")) && !folder && msg && !file) {
- file = msg;
- msg = NULL;
- }
if (form && (folder || msg))
adios (NULL, "can't mix forms and folders/msgs");
- if (folder || msg) {
+ if (!use && (folder || msg)) {
/*
- * Use a message as the "form" for the new message.
+ * Take a message as the "form" for the new message.
*/
if (!msg)
msg = "cur";
if (mp->numsel > 1)
adios (NULL, "only one message at a time!");
- if ((in = open (form = getcpy (m_name (mp->lowsel)), O_RDONLY)) == NOTOK)
+ if ((in = open (form = getcpy (m_name (mp->lowsel)),
+ O_RDONLY)) == NOTOK)
adios (form, "unable to open message");
} else
in = open_form(&form, components);
try_it_again:
- strncpy (drft, m_draft (dfolder, file, use, &isdf), sizeof(drft));
+ strncpy (drft, m_draft(use ? (msg?msg:"cur") : "new"), sizeof(drft));
/*
* Check if we have an existing draft
adios (drft, "unable to stat");
printf ("Draft \"%s\" exists (%ld bytes).", drft, (long) st.st_size);
for (i = LISTDSW; i != YESW;) {
- if (!(argp = getans ("\nDisposition? ", isdf ? aqrunl : aqrul)))
+ if (!(argp = getans ("\nDisposition? ", aqrunl)))
done (1);
- switch (i = smatch (*argp, isdf ? aqrunl : aqrul)) {
+ switch (i = smatch (*argp, aqrunl)) {
case NOSW:
done (0);
case NEWSW:
- file = NULL;
use = NOUSE;
goto try_it_again;
case YESW:
{ "annotate", 0 },
#define NANNOSW 1
{ "noannotate", 0 },
-#define DFOLDSW 2
- { "draftfolder +folder", 0 },
-#define DMSGSW 3
- { "draftmessage msg", 0 },
-#define NDFLDSW 4
- { "nodraftfolder", 0 },
-#define EDITRSW 5
+#define EDITRSW 2
{ "editor editor", 0 },
-#define NEDITSW 6
+#define NEDITSW 3
{ "noedit", 0 },
-#define FORMSW 7
+#define FORMSW 4
{ "form formfile", 0 },
-#define INPLSW 8
+#define INPLSW 5
{ "inplace", 0 },
-#define NINPLSW 9
+#define NINPLSW 6
{ "noinplace", 0 },
-#define WHATSW 10
+#define WHATSW 7
{ "whatnowproc program", 0 },
-#define NWHATSW 11
+#define NWHATSW 8
{ "nowhatnowproc", 0 },
-#define VERSIONSW 12
+#define VERSIONSW 9
{ "version", 0 },
-#define HELPSW 13
+#define HELPSW 10
{ "help", 0 },
-#define FILESW 14
+#define FILESW 11
{ "file file", -4 }, /* interface from msh */
{ NULL, 0 }
};
-static struct swit aqrnl[] = {
-#define NOSW 0
- { "quit", 0 },
-#define YESW 1
- { "replace", 0 },
-#define LISTDSW 2
- { "list", 0 },
-#define REFILSW 3
- { "refile +folder", 0 },
-#define NEWSW 4
- { "new", 0 },
- { NULL, 0 }
-};
-
-
-static struct swit aqrl[] = {
- { "quit", 0 },
- { "replace", 0 },
- { "list", 0 },
- { "refile +folder", 0 },
- { NULL, 0 }
-};
-
int
main (int argc, char **argv)
{
int anot = 0, inplace = 1, nedit = 0;
- int nwhat = 0, i, in, isdf = 0, out;
- char *cp, *cwd, *maildir, *msgnam, *dfolder = NULL;
- char *dmsg = NULL, *ed = NULL, *file = NULL, *folder = NULL;
+ int nwhat = 0, in, out;
+ char *cp, *cwd, *maildir, *msgnam;
+ char *ed = NULL, *file = NULL, *folder = NULL;
char *form = NULL, *msg = NULL, buf[BUFSIZ], drft[BUFSIZ];
char **argp, **arguments;
struct msgs *mp = NULL;
- struct stat st;
#ifdef LOCALE
setlocale(LC_ALL, "");
case NINPLSW:
inplace = 0;
continue;
-
- case DFOLDSW:
- if (dfolder)
- adios (NULL, "only one draft folder at a time!");
- if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- dfolder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
- *cp != '@' ? TFOLDER : TSUBCWF);
- continue;
- case DMSGSW:
- if (dmsg)
- adios (NULL, "only one draft message at a time!");
- if (!(dmsg = *argp++) || *dmsg == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- continue;
- case NDFLDSW:
- dfolder = NULL;
- isdf = NOTOK;
- continue;
}
}
if (*cp == '+' || *cp == '@') {
in = open_form(&form, distcomps);
-try_it_again:
- strncpy (drft, m_draft (dfolder, dmsg, NOUSE, &isdf), sizeof(drft));
+ strncpy (drft, m_draft("new"), sizeof(drft));
- /* Check if draft already exists */
- if (stat (drft, &st) != NOTOK) {
- printf ("Draft \"%s\" exists (%ld bytes).", drft, (long) st.st_size);
- for (i = LISTDSW; i != YESW;) {
- if (!(argp = getans ("\nDisposition? ", isdf ? aqrnl : aqrl)))
- done (1);
- switch (i = smatch (*argp, isdf ? aqrnl : aqrl)) {
- case NOSW:
- done (0);
- case NEWSW:
- dmsg = NULL;
- goto try_it_again;
- case YESW:
- break;
- case LISTDSW:
- showfile (++argp, drft);
- break;
- case REFILSW:
- if (refile (++argp, drft) == 0)
- i = YESW;
- break;
- default:
- advise (NULL, "say what?");
- break;
- }
- }
- }
if ((out = creat (drft, m_gmprot ())) == NOTOK)
adios (drft, "unable to create");
{ "annotate", 0 },
#define NANNOSW 1
{ "noannotate", 0 },
-#define DFOLDSW 2
- { "draftfolder +folder", 0 },
-#define DMSGSW 3
- { "draftmessage msg", 0 },
-#define NDFLDSW 4
- { "nodraftfolder", 0 },
-#define EDITRSW 5
+#define EDITRSW 2
{ "editor editor", 0 },
-#define NEDITSW 6
+#define NEDITSW 3
{ "noedit", 0 },
-#define FILTSW 7
+#define FILTSW 4
{ "filter filterfile", 0 },
-#define FORMSW 8
+#define FORMSW 5
{ "form formfile", 0 },
-#define FRMTSW 9
+#define FRMTSW 6
{ "format", 5 },
-#define NFRMTSW 10
+#define NFRMTSW 7
{ "noformat", 7 },
-#define INPLSW 11
+#define INPLSW 8
{ "inplace", 0 },
-#define NINPLSW 12
+#define NINPLSW 9
{ "noinplace", 0 },
-#define MIMESW 13
+#define MIMESW 10
{ "mime", 0 },
-#define NMIMESW 14
+#define NMIMESW 11
{ "nomime", 0 },
-#define DGSTSW 15
+#define DGSTSW 12
{ "digest list", 0 },
-#define ISSUESW 16
+#define ISSUESW 13
{ "issue number", 0 },
-#define VOLUMSW 17
+#define VOLUMSW 14
{ "volume number", 0 },
-#define WHATSW 18
+#define WHATSW 15
{ "whatnowproc program", 0 },
-#define NWHATSW 19
+#define NWHATSW 16
{ "nowhatnowproc", 0 },
-#define BITSTUFFSW 20
+#define BITSTUFFSW 17
{ "dashstuffing", 0 }, /* interface to mhl */
-#define NBITSTUFFSW 21
+#define NBITSTUFFSW 18
{ "nodashstuffing", 0 },
-#define VERSIONSW 22
+#define VERSIONSW 19
{ "version", 0 },
-#define HELPSW 23
+#define HELPSW 20
{ "help", 0 },
-#define FILESW 24
+#define FILESW 21
{ "file file", 4 }, /* interface from msh */
#ifdef MHE
-#define BILDSW 25
+#define BILDSW 22
{ "build", 5 }, /* interface from mhe */
#endif /* MHE */
{ NULL, 0 }
};
-static struct swit aqrnl[] = {
-#define NOSW 0
- { "quit", 0 },
-#define YESW 1
- { "replace", 0 },
-#define LISTDSW 2
- { "list", 0 },
-#define REFILSW 3
- { "refile +folder", 0 },
-#define NEWSW 4
- { "new", 0 },
- { NULL, 0 }
-};
-
-static struct swit aqrl[] = {
- { "quit", 0 },
- { "replace", 0 },
- { "list", 0 },
- { "refile +folder", 0 },
- { NULL, 0 }
-};
-
static char drft[BUFSIZ];
static char delim3[] =
{
int msgp = 0, anot = 0, inplace = 1, mime = 0;
int issue = 0, volume = 0, dashstuff = 0;
- int nedit = 0, nwhat = 0, i, in;
- int out, isdf = 0, msgnum;
- char *cp, *cwd, *maildir, *dfolder = NULL;
- char *dmsg = NULL, *digest = NULL, *ed = NULL;
+ int nedit = 0, nwhat = 0, in;
+ int out, msgnum;
+ char *cp, *cwd, *maildir;
+ char *digest = NULL, *ed = NULL;
char *file = NULL, *filter = NULL, *folder = NULL;
char *form = NULL, buf[BUFSIZ], value[10];
char **argp, **arguments, *msgs[MAXARGS];
- struct stat st;
#ifdef MHE
int buildsw = 0;
adios (NULL, "bad argument %s %s", argp[-2], cp);
continue;
- case DFOLDSW:
- if (dfolder)
- adios (NULL, "only one draft folder at a time!");
- if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- dfolder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
- *cp != '@' ? TFOLDER : TSUBCWF);
- continue;
- case DMSGSW:
- if (dmsg)
- adios (NULL, "only one draft message at a time!");
- if (!(dmsg = *argp++) || *dmsg == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- continue;
- case NDFLDSW:
- dfolder = NULL;
- isdf = NOTOK;
- continue;
-
case BITSTUFFSW:
dashstuff = 1; /* trinary logic */
continue;
if (file && (msgp || folder))
adios (NULL, "can't mix files and folders/msgs");
-try_it_again:
-
#ifdef MHE
strncpy (drft, buildsw ? m_maildir ("draft")
- : m_draft (dfolder, NULL, NOUSE, &isdf), sizeof(drft));
-
- /* Check if a draft already exists */
- if (!buildsw && stat (drft, &st) != NOTOK) {
+ : m_draft("new"), sizeof(drft));
#else
- strncpy (drft, m_draft (dfolder, dmsg, NOUSE, &isdf), sizeof(drft));
-
- /* Check if a draft already exists */
- if (stat (drft, &st) != NOTOK) {
+ strncpy (drft, m_draft("new"), sizeof(drft));
#endif /* MHE */
- printf ("Draft \"%s\" exists (%ld bytes).", drft, (long) st.st_size);
- for (i = LISTDSW; i != YESW;) {
- if (!(argp = getans ("\nDisposition? ", isdf ? aqrnl : aqrl)))
- done (1);
- switch (i = smatch (*argp, isdf ? aqrnl : aqrl)) {
- case NOSW:
- done (0);
- case NEWSW:
- dmsg = NULL;
- goto try_it_again;
- case YESW:
- break;
- case LISTDSW:
- showfile (++argp, drft);
- break;
- case REFILSW:
- if (refile (++argp, drft) == 0)
- i = YESW;
- break;
- default:
- advise (NULL, "say what?");
- break;
- }
- }
- }
if (file) {
/*
{ "libdir", &mhlibdir },
{ "backup-prefix", &backup_prefix },
{ "altmsg-link", &altmsglink },
+ { "draft-folder", &draftfolder },
{ NULL, NULL },
};
#include <errno.h>
static struct swit switches[] = {
-#define DRAFTSW 0
- { "draft", 0 },
-#define LINKSW 1
+#define LINKSW 0
{ "link", 0 },
-#define NLINKSW 2
+#define NLINKSW 1
{ "nolink", 0 },
-#define PRESSW 3
+#define PRESSW 2
{ "preserve", 0 },
-#define NPRESSW 4
+#define NPRESSW 3
{ "nopreserve", 0 },
-#define UNLINKSW 5
+#define UNLINKSW 4
{ "unlink", 0 },
-#define NUNLINKSW 6
+#define NUNLINKSW 5
{ "nounlink", 0 },
-#define SRCSW 7
+#define SRCSW 6
{ "src +folder", 0 },
-#define FILESW 8
+#define FILESW 7
{ "file file", 0 },
-#define RPROCSW 9
+#define RPROCSW 8
{ "rmmproc program", 0 },
-#define NRPRCSW 10
+#define NRPRCSW 9
{ "normmproc", 0 },
-#define VERSIONSW 11
+#define VERSIONSW 10
{ "version", 0 },
-#define HELPSW 12
+#define HELPSW 11
{ "help", 0 },
{ NULL, 0 }
};
main (int argc, char **argv)
{
int linkf = 0, preserve = 0, filep = 0;
- int foldp = 0, isdf = 0, unlink_msgs = 0;
+ int foldp = 0, unlink_msgs = 0;
int i, msgnum;
char *cp, *folder = NULL, buf[BUFSIZ];
char **argp, **arguments;
folder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
*cp != '@' ? TFOLDER : TSUBCWF);
continue;
- case DRAFTSW:
- if (filep > NFOLDERS)
- adios (NULL, "only %d files allowed!", NFOLDERS);
- isdf = 0;
- files[filep++] = getcpy (m_draft (NULL, NULL, 1, &isdf));
- continue;
case FILESW:
if (filep > NFOLDERS)
adios (NULL, "only %d files allowed!", NFOLDERS);
{ "cc all|to|cc|me", 0 },
#define NCCSW 5
{ "nocc type", 0 },
-#define DFOLDSW 6
- { "draftfolder +folder", 0 },
-#define DMSGSW 7
- { "draftmessage msg", 0 },
-#define NDFLDSW 8
- { "nodraftfolder", 0 },
-#define EDITRSW 9
+#define EDITRSW 6
{ "editor editor", 0 },
-#define NEDITSW 10
+#define NEDITSW 7
{ "noedit", 0 },
-#define FCCSW 11
+#define FCCSW 8
{ "fcc folder", 0 },
-#define FILTSW 12
+#define FILTSW 9
{ "filter filterfile", 0 },
-#define FORMSW 13
+#define FORMSW 10
{ "form formfile", 0 },
-#define FRMTSW 14
+#define FRMTSW 11
{ "format", 5 },
-#define NFRMTSW 15
+#define NFRMTSW 12
{ "noformat", 7 },
-#define INPLSW 16
+#define INPLSW 13
{ "inplace", 0 },
-#define NINPLSW 17
+#define NINPLSW 14
{ "noinplace", 0 },
-#define MIMESW 18
+#define MIMESW 15
{ "mime", 0 },
-#define NMIMESW 19
+#define NMIMESW 16
{ "nomime", 0 },
-#define QURYSW 20
+#define QURYSW 17
{ "query", 0 },
-#define NQURYSW 21
+#define NQURYSW 18
{ "noquery", 0 },
-#define WHATSW 22
+#define WHATSW 19
{ "whatnowproc program", 0 },
-#define NWHATSW 23
+#define NWHATSW 20
{ "nowhatnowproc", 0 },
-#define WIDTHSW 24
+#define WIDTHSW 21
{ "width columns", 0 },
-#define VERSIONSW 25
+#define VERSIONSW 22
{ "version", 0 },
-#define HELPSW 26
+#define HELPSW 23
{ "help", 0 },
-#define FILESW 27
+#define FILESW 24
{ "file file", 4 }, /* interface from msh */
#ifdef MHE
-#define BILDSW 28
+#define BILDSW 25
{ "build", 5 }, /* interface from mhe */
#endif
{ NULL, 0 }
};
-static struct swit aqrnl[] = {
-#define NOSW 0
- { "quit", 0 },
-#define YESW 1
- { "replace", 0 },
-#define LISTDSW 2
- { "list", 0 },
-#define REFILSW 3
- { "refile +folder", 0 },
-#define NEWSW 4
- { "new", 0 },
- { NULL, 0 }
-};
-
-static struct swit aqrl[] = {
- { "quit", 0 },
- { "replace", 0 },
- { "list", 0 },
- { "refile +folder", 0 },
- { NULL, 0 }
-};
-
short ccto = -1; /* global for replsbr */
short cccc = -1;
short ccme = -1;
int
main (int argc, char **argv)
{
- int i, isdf = 0;
int anot = 0, inplace = 1;
int nedit = 0, nwhat = 0;
char *cp, *cwd, *dp, *maildir, *file = NULL;
- char *folder = NULL, *msg = NULL, *dfolder = NULL;
- char *dmsg = NULL, *ed = NULL, drft[BUFSIZ], buf[BUFSIZ];
+ char *folder = NULL, *msg = NULL;
+ char *ed = NULL, drft[BUFSIZ], buf[BUFSIZ];
char **argp, **arguments;
struct msgs *mp = NULL;
- struct stat st;
FILE *in;
#ifdef MHE
if ((outputlinelen = atoi (cp)) < 10)
adios (NULL, "impossible width %d", outputlinelen);
continue;
-
- case DFOLDSW:
- if (dfolder)
- adios (NULL, "only one draft folder at a time!");
- if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- dfolder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
- *cp != '@' ? TFOLDER : TSUBCWF);
- continue;
- case DMSGSW:
- if (dmsg)
- adios (NULL, "only one draft message at a time!");
- if (!(dmsg = *argp++) || *dmsg == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- continue;
- case NDFLDSW:
- dfolder = NULL;
- isdf = NOTOK;
- continue;
}
}
if (*cp == '+' || *cp == '@') {
if (file && (msg || folder))
adios (NULL, "can't mix files and folders/msgs");
-try_it_again:
-
#ifdef MHE
strncpy (drft, buildsw ? m_maildir ("reply")
- : m_draft (dfolder, NULL, NOUSE, &isdf), sizeof(drft));
-
- /* Check if a draft exists */
- if (!buildsw && stat (drft, &st) != NOTOK) {
+ : m_draft("new"), sizeof(drft));
#else
- strncpy (drft, m_draft (dfolder, dmsg, NOUSE, &isdf), sizeof(drft));
-
- /* Check if a draft exists */
- if (stat (drft, &st) != NOTOK) {
+ strncpy (drft, m_draft("new"), sizeof(drft));
#endif /* MHE */
- printf ("Draft \"%s\" exists (%ld bytes).", drft, (long) st.st_size);
- for (i = LISTDSW; i != YESW;) {
- if (!(argp = getans ("\nDisposition? ", isdf ? aqrnl : aqrl)))
- done (1);
- switch (i = smatch (*argp, isdf ? aqrnl : aqrl)) {
- case NOSW:
- done (0);
- case NEWSW:
- dmsg = NULL;
- goto try_it_again;
- case YESW:
- break;
- case LISTDSW:
- showfile (++argp, drft);
- break;
- case REFILSW:
- if (refile (++argp, drft) == 0)
- i = YESW;
- break;
- default:
- advise (NULL, "say what?");
- break;
- }
- }
- }
if (file) {
/*
else
folder = pluspath (cp);
} else
- app_msgarg(&msgs, cp);
+ app_msgarg(&msgs, cp);
}
if (!context_find ("path"))
{ "alias aliasfile", 0 },
#define DEBUGSW 1
{ "debug", -5 },
-#define DRAFTSW 2
- { "draft", 0 },
-#define DFOLDSW 3
- { "draftfolder +folder", 6 },
-#define DMSGSW 4
- { "draftmessage msg", 6 },
-#define NDFLDSW 5
- { "nodraftfolder", 0 },
-#define FILTSW 6
+#define FILTSW 2
{ "filter filterfile", 0 },
-#define NFILTSW 7
+#define NFILTSW 3
{ "nofilter", 0 },
-#define FRMTSW 8
+#define FRMTSW 4
{ "format", 0 },
-#define NFRMTSW 9
+#define NFRMTSW 5
{ "noformat", 0 },
-#define FORWSW 10
+#define FORWSW 6
{ "forward", 0 },
-#define NFORWSW 11
+#define NFORWSW 7
{ "noforward", 0 },
-#define MIMESW 12
+#define MIMESW 8
{ "mime", 0 },
-#define NMIMESW 13
+#define NMIMESW 9
{ "nomime", 0 },
-#define MSGDSW 14
+#define MSGDSW 10
{ "msgid", 0 },
-#define NMSGDSW 15
+#define NMSGDSW 11
{ "nomsgid", 0 },
-#define PUSHSW 16
+#define PUSHSW 12
{ "push", 0 },
-#define NPUSHSW 17
+#define NPUSHSW 13
{ "nopush", 0 },
-#define UNIQSW 19
+#define UNIQSW 14
{ "unique", -6 },
-#define NUNIQSW 20
+#define NUNIQSW 15
{ "nounique", -8 },
-#define VERBSW 21
+#define VERBSW 16
{ "verbose", 0 },
-#define NVERBSW 22
+#define NVERBSW 17
{ "noverbose", 0 },
-#define WATCSW 23
+#define WATCSW 18
{ "watch", 0 },
-#define NWATCSW 24
+#define NWATCSW 19
{ "nowatch", 0 },
-#define WIDTHSW 25
+#define WIDTHSW 20
{ "width columns", 0 },
-#define VERSIONSW 26
+#define VERSIONSW 21
{ "version", 0 },
-#define HELPSW 27
+#define HELPSW 22
{ "help", 0 },
-#define BITSTUFFSW 28
+#define BITSTUFFSW 23
{ "dashstuffing", -12 },
-#define NBITSTUFFSW 29
+#define NBITSTUFFSW 24
{ "nodashstuffing", -14 },
-#define MAILSW 30
+#define MAILSW 25
{ "mail", -4 },
-#define SAMLSW 31
+#define SAMLSW 26
{ "saml", -4 },
-#define SENDSW 32
+#define SENDSW 27
{ "send", -4 },
-#define SOMLSW 33
+#define SOMLSW 28
{ "soml", -4 },
-#define CLIESW 34
+#define CLIESW 29
{ "client host", -6 },
-#define SERVSW 35
+#define SERVSW 30
{ "server host", 6 },
-#define SNOOPSW 36
+#define SNOOPSW 31
{ "snoop", 5 },
-#define ATTACHSW 40
+#define ATTACHSW 32
{ "attach", 6 },
-#define ATTACHFORMATSW 41
+#define ATTACHFORMATSW 33
{ "attachformat", 7 },
-#define PORTSW 42
+#define PORTSW 34
{ "port server-port-name/number" , 4 },
{ NULL, 0 }
};
-static struct swit anyl[] = {
-#define NOSW 0
- { "no", 0 },
-#define YESW 1
- { "yes", 0 },
-#define LISTDSW 2
- { "list", 0 },
- { NULL, 0 }
-};
-
extern int debugsw; /* from sendsbr.c */
extern int forwsw;
extern int inplace;
main (int argc, char **argv)
{
int msgp = 0, distsw = 0, vecp = 1;
- int isdf = 0, mime = 0;
+ int mime = 0;
int msgnum, status;
- char *cp, *dfolder = NULL, *maildir = NULL;
+ char *cp, *maildir = NULL;
char buf[BUFSIZ], **ap, **argp, **arguments;
char *msgs[MAXARGS], *vec[MAXARGS];
struct msgs *mp;
print_version(invo_name);
done (1);
- case DRAFTSW:
- msgs[msgp++] = draft;
- continue;
-
- case DFOLDSW:
- if (dfolder)
- adios (NULL, "only one draft folder at a time!");
- if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- dfolder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
- *cp != '@' ? TFOLDER : TSUBCWF);
- continue;
- case DMSGSW:
- if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- msgs[msgp++] = cp;
- continue;
- case NDFLDSW:
- dfolder = NULL;
- isdf = NOTOK;
- continue;
-
case PUSHSW:
pushsw++;
continue;
}
}
- if (dfolder == NULL) {
- if (msgp == 0) {
-#ifdef WHATNOW
- if ((cp = getenv ("mhdraft")) && *cp) {
- msgs[msgp++] = cp;
- goto go_to_it;
- }
-#endif /* WHATNOW */
- msgs[msgp++] = getcpy (m_draft (NULL, NULL, 1, &isdf));
- if (stat (msgs[0], &st) == NOTOK)
- adios (msgs[0], "unable to stat draft file");
- cp = concat ("Use \"", msgs[0], "\"? ", NULL);
- for (status = LISTDSW; status != YESW;) {
- if (!(argp = getans (cp, anyl)))
- done (1);
- switch (status = smatch (*argp, anyl)) {
- case NOSW:
- done (0);
- case YESW:
- break;
- case LISTDSW:
- showfile (++argp, msgs[0]);
- break;
- default:
- advise (NULL, "say what?");
- break;
- }
- }
- } else {
- for (msgnum = 0; msgnum < msgp; msgnum++)
- msgs[msgnum] = getcpy (m_maildir (msgs[msgnum]));
- }
- } else {
- if (!context_find ("path"))
- free (path ("./", TFOLDER));
-
- if (!msgp)
- msgs[msgp++] = "cur";
- maildir = m_maildir (dfolder);
-
- if (chdir (maildir) == NOTOK)
- adios (maildir, "unable to change directory to");
-
- /* read folder and create message structure */
- if (!(mp = folder_read (dfolder)))
- adios (NULL, "unable to read folder %s", dfolder);
-
- /* check for empty folder */
- if (mp->nummsg == 0)
- adios (NULL, "no messages in %s", dfolder);
-
- /* parse all the message ranges/sequences and set SELECTED */
- for (msgnum = 0; msgnum < msgp; msgnum++)
- if (!m_convert (mp, msgs[msgnum]))
- done (1);
- seq_setprev (mp); /* set the previous-sequence */
-
- for (msgp = 0, msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
- if (is_selected (mp, msgnum)) {
- msgs[msgp++] = getcpy (m_name (msgnum));
- unset_exists (mp, msgnum);
- }
- }
+ if (!context_find ("path"))
+ free (path ("./", TFOLDER));
- mp->msgflags |= SEQMOD;
- seq_save (mp);
+ if (!msgp)
+ msgs[msgp++] = "cur";
+ maildir = m_maildir (draftfolder);
+
+ if (chdir (maildir) == NOTOK)
+ adios (maildir, "unable to change directory to");
+
+ /* read folder and create message structure */
+ if (!(mp = folder_read (draftfolder)))
+ adios (NULL, "unable to read draft folder %s", draftfolder);
+
+ /* check for empty folder */
+ if (mp->nummsg == 0)
+ adios (NULL, "no messages in draft folder %s", draftfolder);
+
+ /* parse all the message ranges/sequences and set SELECTED */
+ for (msgnum = 0; msgnum < msgp; msgnum++)
+ if (!m_convert (mp, msgs[msgnum]))
+ done (1);
+ seq_setprev (mp); /* set the previous-sequence */
+
+ for (msgp = 0, msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
+ if (is_selected (mp, msgnum)) {
+ msgs[msgp++] = getcpy (m_name (msgnum));
+ unset_exists (mp, msgnum);
+ }
}
-#ifdef WHATNOW
-go_to_it:
-#endif /* WHATNOW */
+ mp->msgflags |= SEQMOD;
+ seq_save (mp);
if ((cp = getenv ("SIGNATURE")) == NULL || *cp == 0)
if ((cp = context_find ("signature")) && *cp)
{ "showmimeproc program", 0 },
#define NSHOWSW 11
{ "noshowproc", 0 },
-#define DRFTSW 12
- { "draft", 0 },
-#define FILESW 13
+#define FILESW 12
{ "file file", -4 }, /* interface from showfile */
-#define VERSIONSW 14
+#define VERSIONSW 13
{ "version", 0 },
-#define HELPSW 15
+#define HELPSW 14
{ "help", 0 },
{ NULL, 0 }
};
int
main (int argc, char **argv)
{
- int draftsw = 0, headersw = 1, msgp = 0;
+ int headersw = 1, msgp = 0;
int nshow = 0, checkmime = 1, mime;
- int vecp = 1, procp = 1, isdf = 0, mode = SHOW, msgnum;
+ int vecp = 1, procp = 1, mode = SHOW, msgnum;
char *cp, *maildir, *file = NULL, *folder = NULL, *proc;
char buf[BUFSIZ], **argp, **arguments;
char *msgs[MAXARGS], *vec[MAXARGS];
print_version(invo_name);
done (1);
- case DRFTSW:
- if (file)
- adios (NULL, "only one file at a time!");
- draftsw++;
- if (mode == SHOW)
- continue;
-usage:
- adios (NULL,
- "usage: %s [+folder] [switches] [switches for showproc]",
- invo_name);
case FILESW:
if (mode != SHOW)
- goto usage;
- if (draftsw || file)
+usage:
+ adios (NULL, "usage: %s [+folder] [switches] [switches for showproc]", invo_name);
+
+ if (file)
adios (NULL, "only one file at a time!");
if (!(cp = *argp++) || *cp == '-')
adios (NULL, "missing argument to %s", argp[-2]);
if (!context_find ("path"))
free (path ("./", TFOLDER));
- if (draftsw || file) {
+ if (file) {
if (msgp)
adios (NULL, "only one file at a time!");
- vec[vecp++] = draftsw
- ? getcpy (m_draft (folder, msgp ? msgs[0] : NULL, 1, &isdf))
- : file;
+ vec[vecp++] = file;
goto go_to_it;
}
#ifdef WHATNOW
if (!msgp && !folder && mode == SHOW && (cp = getenv ("mhdraft")) && *cp) {
- draftsw++;
vec[vecp++] = cp;
goto go_to_it;
}
} else {
/* check if any messages are non-text MIME messages */
if (checkmime && !getenv ("NOMHNPROC")) {
- if (!draftsw && !file) {
+ if (!file) {
/* loop through selected messages and check for MIME */
for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
if (is_selected (mp, msgnum) && is_nontext (m_name (msgnum))) {
break;
}
} else {
- /* check the file or draft for MIME */
+ /* check the file for MIME */
if (is_nontext (vec[vecp - 1]))
mime = 1;
}
proc = showproc;
}
- if (folder && !draftsw && !file)
+ if (folder && !file)
m_putenv ("mhfolder", folder);
/*
* For backward compatibility, if the "proc" is mhn,
* then add "-show" option. Add "-file" if showing
- * file or draft.
+ * file.
*/
if (strcmp (r1bindex (proc, '/'), "mhn") == 0) {
- if (draftsw || file) {
+ if (file) {
vec[vecp] = vec[vecp - 1];
vec[vecp - 1] = "-file";
vecp++;
vec[vecp] = NULL;
}
- /* If the "proc" is "mhshow", add "-file" if showing file or draft.
+ /* If the "proc" is "mhshow", add "-file" if showing file.
*/
- if (strcmp (r1bindex (proc, '/'), "mhshow") == 0 && (draftsw || file) ) {
+ if (strcmp (r1bindex (proc, '/'), "mhshow") == 0 && file ) {
vec[vecp] = vec[vecp - 1];
vec[vecp - 1] = "-file";
vec[++vecp] = NULL;
* checking for mhn here, since we've already taken care of mhl.
*/
if (!strcmp (r1bindex (proc, '/'), "mhl")
- && !draftsw
&& !file
&& chdir (maildir = concat (m_maildir (""), "/", NULL)) != NOTOK) {
mp->foldpath = concat (mp->foldpath, "/", NULL);
#include <h/utils.h>
static struct swit whatnowswitches[] = {
-#define DFOLDSW 0
- { "draftfolder +folder", 0 },
-#define DMSGSW 1
- { "draftmessage msg", 0 },
-#define NDFLDSW 2
- { "nodraftfolder", 0 },
-#define EDITRSW 3
+#define EDITRSW 0
{ "editor editor", 0 },
-#define NEDITSW 4
+#define NEDITSW 1
{ "noedit", 0 },
-#define PRMPTSW 5
+#define PRMPTSW 2
{ "prompt string", 4 },
-#define VERSIONSW 6
+#define VERSIONSW 3
{ "version", 0 },
-#define HELPSW 7
+#define HELPSW 4
{ "help", 0 },
-#define ATTACHSW 8
+#define ATTACHSW 5
{ "attach header-field-name", 0 },
{ NULL, 0 }
};
{ "send [<switches>]", 0 },
#define PUSHSW 6
{ "push [<switches>]", 0 },
-#define QUITSW 8
+#define QUITSW 7
{ "quit [-delete]", 0 },
-#define DELETESW 9
+#define DELETESW 8
{ "delete", 0 },
-#define CDCMDSW 10
+#define CDCMDSW 9
{ "cd [directory]", 0 },
-#define PWDCMDSW 11
+#define PWDCMDSW 10
{ "pwd", 0 },
-#define LSCMDSW 12
+#define LSCMDSW 11
{ "ls", 0 },
-#define ATTACHCMDSW 13
+#define ATTACHCMDSW 12
{ "attach", 0 },
-#define DETACHCMDSW 14
+#define DETACHCMDSW 13
{ "detach [-n]", 2 },
-#define ALISTCMDSW 15
+#define ALISTCMDSW 14
{ "alist [-ln] ", 2 },
{ NULL, 0 }
};
int
WhatNow (int argc, char **argv)
{
- int isdf = 0, nedit = 0, use = 0;
- char *cp, *dfolder = NULL, *dmsg = NULL;
+ int nedit = 0, use = 0;
+ char *cp;
char *ed = NULL, *drft = NULL, *msgnam = NULL;
char buf[BUFSIZ], prompt[BUFSIZ];
char **argp, **arguments;
print_version(invo_name);
done (1);
- case DFOLDSW:
- if (dfolder)
- adios (NULL, "only one draft folder at a time!");
- if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- dfolder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
- *cp != '@' ? TFOLDER : TSUBCWF);
- continue;
- case DMSGSW:
- if (dmsg)
- adios (NULL, "only one draft message at a time!");
- if (!(dmsg = *argp++) || *dmsg == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- continue;
- case NDFLDSW:
- dfolder = NULL;
- isdf = NOTOK;
- continue;
-
case EDITRSW:
if (!(ed = *argp++) || *ed == '-')
adios (NULL, "missing argument to %s", argp[-2]);
}
if ((drft == NULL && (drft = getenv ("mhdraft")) == NULL) || *drft == 0)
- drft = getcpy (m_draft (dfolder, dmsg, 1, &isdf));
+ drft = getcpy (m_draft("cur"));
msgnam = (cp = getenv ("mhaltmsg")) && *cp ? getcpy (cp) : NULL;
{ "push", 0 },
#define NSPSHSW 13
{ "nopush", 0 },
-#define UNIQSW 15
+#define UNIQSW 14
{ "unique", -6 },
-#define NUNIQSW 16
+#define NUNIQSW 15
{ "nounique", -8 },
-#define VERBSW 17
+#define VERBSW 16
{ "verbose", 0 },
-#define NVERBSW 18
+#define NVERBSW 17
{ "noverbose", 0 },
-#define WATCSW 19
+#define WATCSW 18
{ "watch", 0 },
-#define NWATCSW 20
+#define NWATCSW 19
{ "nowatch", 0 },
-#define WIDTHSW 21
+#define WIDTHSW 20
{ "width columns", 0 },
-#define SVERSIONSW 22
+#define SVERSIONSW 21
{ "version", 0 },
-#define SHELPSW 23
+#define SHELPSW 22
{ "help", 0 },
-#define BITSTUFFSW 24
+#define BITSTUFFSW 23
{ "dashstuffing", -12 },
-#define NBITSTUFFSW 25
+#define NBITSTUFFSW 24
{ "nodashstuffing", -14 },
-#define MAILSW 26
+#define MAILSW 25
{ "mail", -4 },
-#define SAMLSW 27
+#define SAMLSW 26
{ "saml", -4 },
-#define SSNDSW 28
+#define SSNDSW 27
{ "send", -4 },
-#define SOMLSW 29
+#define SOMLSW 28
{ "soml", -4 },
-#define CLIESW 30
+#define CLIESW 29
{ "client host", -6 },
-#define SERVSW 31
+#define SERVSW 30
{ "server host", 6 },
-#define SNOOPSW 32
+#define SNOOPSW 31
{ "snoop", -5 },
-#define SDRFSW 33
- { "draftfolder +folder", -6 },
-#define SDRMSW 34
- { "draftmessage msg", -6 },
-#define SNDRFSW 35
- { "nodraftfolder", -3 },
-#define SNDATTACHSW 39
+#define SNDATTACHSW 32
{ "attach file", 6 },
-#define SNDATTACHFORMAT 40
+#define SNDATTACHFORMAT 33
{ "attachformat", 7 },
-#define PORTSW 41
+#define PORTSW 34
{ "port server-port-name/number", 4 },
{ NULL, 0 }
};
vec[vecp++] = cp;
continue;
- case SDRFSW:
- case SDRMSW:
- if (!(cp = *argp++) || *cp == '-') {
- advise (NULL, "missing argument to %s", argp[-2]);
- return;
- }
- case SNDRFSW:
- continue;
-
case SNDATTACHSW:
if (!(attach = *argp++) || *attach == '-') {
advise (NULL, "missing argument to %s", argp[-2]);