From 337338b404931f06f0db2119c9e145e8ca5a9860 Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Sun, 30 Oct 2011 11:35:54 +0100 Subject: [PATCH] Removed the draft message in favor for a consistent draft folder facility - reworked sbr/m_draft.c (of course) - removed the -draftfolder/-draftmessage/-nodraftfolder switches - removed the -draft switch from anno and refile - no more need to question on existing draft message - yay! Everything is more consistent now. Cornercases went away. :-) (Also fixed the switch numbering, as already done for other files earlier.) --- config/config.c | 2 +- docs/COMPLETION-BASH | 12 +-- docs/COMPLETION-ZSH | 20 ++--- h/mh.h | 2 +- h/prototypes.h | 2 +- man/anno.man | 7 +- man/comp.man | 21 +---- man/dist.man | 33 +------- man/forw.man | 34 +------- man/mh-chart.man | 31 ------- man/mh-draft.man | 225 ++++---------------------------------------------- man/refile.man | 7 -- man/repl.man | 37 +-------- man/send.man | 47 ++++------- man/show.man | 5 -- man/whatnow.man | 21 +---- sbr/m_draft.c | 44 +++++----- sbr/readconfig.c | 1 + uip/anno.c | 48 ++--------- uip/comp.c | 90 +++++--------------- uip/dist.c | 105 ++++------------------- uip/forw.c | 135 ++++++------------------------ uip/mhparam.c | 1 + uip/refile.c | 34 +++----- uip/repl.c | 130 ++++++----------------------- uip/rmm.c | 2 +- uip/send.c | 208 +++++++++++++++------------------------------- uip/show.c | 50 ++++------- uip/whatnowsbr.c | 116 +++++++++----------------- 29 files changed, 313 insertions(+), 1157 deletions(-) diff --git a/config/config.c b/config/config.c index 97a24ff..5d11ef3 100644 --- a/config/config.c +++ b/config/config.c @@ -121,7 +121,7 @@ char *mhlformat = "mhl.format"; /* show */ char *mhlreply = "mhl.reply"; /* repl -filter */ char *mhlforward = "mhl.forward"; /* forw -filter */ -char *draft = "draft"; +char *draftfolder = "drafts"; char *inbox = "Inbox"; char *defaultfolder = "inbox"; diff --git a/docs/COMPLETION-BASH b/docs/COMPLETION-BASH index 1e84c1e..806c934 100644 --- a/docs/COMPLETION-BASH +++ b/docs/COMPLETION-BASH @@ -41,8 +41,8 @@ _nmh() -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* ) @@ -58,8 +58,8 @@ _nmh() ;; 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) ;; @@ -96,8 +96,8 @@ _nmh() 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 ) diff --git a/docs/COMPLETION-ZSH b/docs/COMPLETION-ZSH index fe8e422..666f7e1 100644 --- a/docs/COMPLETION-ZSH +++ b/docs/COMPLETION-ZSH @@ -43,8 +43,7 @@ function mhcomp { # # 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 @@ -55,11 +54,6 @@ mhfseq() { # 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) @@ -125,17 +119,17 @@ compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - \ '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 diff --git a/h/mh.h b/h/mh.h index 58d1e1d..35c8b41 100644 --- a/h/mh.h +++ b/h/mh.h @@ -306,7 +306,7 @@ extern char *defaulteditor; extern char *defaultfolder; extern char *digestcomps; extern char *distcomps; -extern char *draft; +extern char *draftfolder; extern char *faceproc; extern char *fileproc; extern char *foldprot; diff --git a/h/prototypes.h b/h/prototypes.h index 4907410..c54172b 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -67,7 +67,7 @@ int lkopen(char *, int, mode_t); 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 *); diff --git a/man/anno.man b/man/anno.man index f97efa5..1436f73 100644 --- a/man/anno.man +++ b/man/anno.man @@ -14,7 +14,6 @@ anno \- annotate messages .IR field ] .RB [ \-inplace " | " \-noinplace ] .RB [ \-date " | " \-nodate ] -.RB [ \-draft ] .RB [ \-append ] .RB [ \-list ] .RB [ \-delete ] @@ -39,11 +38,9 @@ option specifies the field name, and the .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 , diff --git a/man/comp.man b/man/comp.man index b9c4bc6..1e0c9f8 100644 --- a/man/comp.man +++ b/man/comp.man @@ -15,11 +15,6 @@ comp \- compose a message .RB [ \-use " | " \-nouse ] .RB [ \-file .IR file ] -.RB [ \-draftfolder -.IR +folder ] -.RB [ \-draftmessage -.IR msg ] -.RB [ \-nodraftfolder ] .RB [ \-editor .IR editor ] .RB [ \-noedit ] @@ -120,16 +115,7 @@ argument to .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 @@ -161,7 +147,7 @@ will prevent any edit from occurring.) ^%etcdir%/components~^The standard message skeleton ^or /components~^Rather than the standard skeleton ^$HOME/\&.mh\(ruprofile~^The user profile -^/draft~^The draft file +^/drafts~^The draft folder .fi .SH "PROFILE COMPONENTS" @@ -170,7 +156,7 @@ will prevent any edit from occurring.) .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 @@ -184,7 +170,6 @@ dist(1), forw(1), repl(1), send(1), whatnow(1), mh-profile(5) .nf .RB ` +folder "' defaults to the current folder" .RB ` msg "' defaults to the current message" -.RB ` \-nodraftfolder ' .RB ` \-nouse ' .fi diff --git a/man/dist.man b/man/dist.man index 7598e46..4f0ff85 100644 --- a/man/dist.man +++ b/man/dist.man @@ -14,11 +14,6 @@ dist \- redistribute a message to additional addresses .IR formfile ] .RB [ \-annotate " | " \-noannotate ] .RB [ \-inplace " | " \-noinplace ] -.RB [ \-draftfolder -.IR +folder ] -.RB [ \-draftmessage -.IR msg ] -.RB [ \-nodraftfolder ] .RB [ \-editor .IR editor ] .RB [ \-noedit ] @@ -53,18 +48,6 @@ forms file with the switch .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, @@ -120,16 +103,7 @@ and the pathname of 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 @@ -155,7 +129,7 @@ will prevent any edit from occurring.) ^%etcdir%/distcomps~^The standard message skeleton ^or /distcomps~^Rather than the standard skeleton ^$HOME/\&.mh\(ruprofile~^The user profile -^/draft~^The draft file +^/drafts~^The draft folder .fi .SH "PROFILE COMPONENTS" @@ -165,7 +139,7 @@ will prevent any edit from occurring.) .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 @@ -179,7 +153,6 @@ comp(1), forw(1), repl(1), send(1), whatnow(1) .RB ` +folder "' defaults to the current folder" .RB ` msg "' defaults to cur" .RB ` \-noannotate ' -.RB ` \-nodraftfolder ' .RB ` \-inplace ' .fi diff --git a/man/forw.man b/man/forw.man index 3ff187f..e5c25c9 100644 --- a/man/forw.man +++ b/man/forw.man @@ -18,11 +18,6 @@ forw \- forward messages .IR filterfile ] .RB [ \-inplace " | " \-noinplace ] .RB [ \-mime " | " \-nomime ] -.RB [ \-draftfolder -.IR +folder ] -.RB [ \-draftmessage -.IR msg ] -.RB [ \-nodraftfolder ] .RB [ \-editor .IR editor ] .RB [ \-noedit ] @@ -78,19 +73,6 @@ alternate forms file with the switch .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 @@ -228,16 +210,7 @@ What now? mime .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 @@ -343,7 +316,7 @@ User's Manual for more information on making digests. ^%etcdir%/mhl.forward~^The standard message filter ^or /mhl.forward~^Rather than the standard filter ^$HOME/\&.mh\(ruprofile~^The user profile -^/draft~^The draft file +^/drafts~^The draft folder .fi .SH "PROFILE COMPONENTS" @@ -353,7 +326,7 @@ User's Manual for more information on making digests. .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 @@ -371,7 +344,6 @@ mhbuild(1), comp(1), repl(1), send(1), whatnow(1), mh\-format(5), .RB ` +folder "' defaults to the current folder" .RB ` msgs "' defaults to cur" .RB ` \-noannotate ' -.RB ` \-nodraftfolder ' .RB ` \-noformat ' .RB ` \-inplace ' .RB ` \-dashstuffing ' diff --git a/man/mh-chart.man b/man/mh-chart.man index c498b74..a630b76 100644 --- a/man/mh-chart.man +++ b/man/mh-chart.man @@ -63,11 +63,6 @@ mh-chart \- Chart of nmh Commands .RB [ \-use " | " \-nouse ] .RB [ \-file .IR file ] -.RB [ \-draftfolder -.IR +folder ] -.RB [ \-draftmessage -.IR msg ] -.RB [ \-nodraftfolder ] .RB [ \-editor .IR editor ] .RB [ \-noedit ] @@ -96,11 +91,6 @@ mh-chart \- Chart of nmh Commands .IR formfile ] .RB [ \-annotate " | " \-noannotate ] .RB [ \-inplace " | " \-noinplace ] -.RB [ \-draftfolder -.IR +folder ] -.RB [ \-draftmessage -.IR msg ] -.RB [ \-nodraftfolder ] .RB [ \-editor .IR editor ] .RB [ \-noedit ] @@ -192,11 +182,6 @@ is equivalent to .IR filterfile ] .RB [ \-inplace " | " \-noinplace ] .RB [ \-mime " | " \-nomime ] -.RB [ \-draftfolder -.IR +folder ] -.RB [ \-draftmessage -.IR msg ] -.RB [ \-nodraftfolder ] .RB [ \-editor .IR editor ] .RB [ \-noedit ] @@ -579,11 +564,6 @@ all/to/cc/me] .IR +folder ] .RB [ \-width .IR columns ] -.RB [ \-draftfolder -.IR +folder ] -.RB [ \-draftmessage -.IR msg ] -.RB [ \-nodraftfolder ] .RB [ \-editor .IR editor ] .RB [ \-noedit ] @@ -633,12 +613,6 @@ all/to/cc/me] .B send .RB [ \-alias .IR aliasfile ] -.RB [ \-draft ] -.RB [ \-draftfolder -.IR +folder ] -.RB [ \-draftmessage -.IR msg ] -.RB [ \-nodraftfolder ] .RB [ \-filter .IR filterfile ] .RB [ \-nofilter ] @@ -716,11 +690,6 @@ or .HP 5 .B whatnow -.RB [ \-draftfolder -.IR +folder ] -.RB [ \-draftmessage -.IR msg ] -.RB [ \-nodraftfolder ] .RB [ \-editor .IR editor ] .RB [ \-noedit ] diff --git a/man/mh-draft.man b/man/mh-draft.man index 63b7b0d..bd84166 100644 --- a/man/mh-draft.man +++ b/man/mh-draft.man @@ -19,109 +19,33 @@ The .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 @@ -133,17 +57,10 @@ profile: .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 @@ -154,7 +71,7 @@ repl .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 @@ -163,7 +80,7 @@ was done, the draft could be sent with simply .PP .RS 5 .nf -sendf +send .fi .RE .PP @@ -195,7 +112,7 @@ or .PP .RS 5 .nf -sendf `pick +drafts -to nmh-workers` +send `pick +drafts -to nmh-workers` .fi .RE .PP @@ -212,123 +129,15 @@ example, as many message drafts as desired can appear, since .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 diff --git a/man/refile.man b/man/refile.man index f9b805a..cfbf616 100644 --- a/man/refile.man +++ b/man/refile.man @@ -9,7 +9,6 @@ refile \- file message in other folders .na .B refile .RI [ msgs ] -.RB [ \-draft ] .RB [ \-link " | " \-nolink ] .RB [ \-preserve " | " \-nopreserve ] .RB [ \-unlink " | " \-nounlink ] @@ -160,12 +159,6 @@ override this profile specification. The 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 /draft. .SH FILES .fc ^ ~ diff --git a/man/repl.man b/man/repl.man index bb4a7e5..80096eb 100644 --- a/man/repl.man +++ b/man/repl.man @@ -28,11 +28,6 @@ all/to/cc/me] .IR +folder ] .RB [ \-width .IR columns ] -.RB [ \-draftfolder -.IR +folder ] -.RB [ \-draftmessage -.IR msg ] -.RB [ \-nodraftfolder ] .RB [ \-editor .IR editor ] .RB [ \-noedit ] @@ -190,21 +185,6 @@ switch will guide .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 @@ -390,17 +370,7 @@ 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. @@ -466,7 +436,7 @@ switch. ^%etcdir%/mhl.reply~^The standard message filter ^or /mhl.reply~^Rather than the standard filter ^$HOME/\&.mh\(ruprofile~^The user profile -^/draft~^The draft file +^/drafts~^The draft folder .fi .SH "PROFILE COMPONENTS" @@ -477,7 +447,7 @@ switch. ^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 @@ -495,7 +465,6 @@ mhbuild(1), comp(1), forw(1), send(1), whatnow(1), mh\-format(5) .RB ` \-nogroup ' .RB ` "\-nocc\ all" "' with `\-nogroup', `\-cc\ all' with `\-group'" .RB ` \-noannotate ' -.RB ` \-nodraftfolder ' .RB ` \-noformat ' .RB ` \-inplace ' .RB ` \-nomime ' diff --git a/man/send.man b/man/send.man index 7d0a4a2..2edb7da 100644 --- a/man/send.man +++ b/man/send.man @@ -10,12 +10,6 @@ send \- send a message .B send .RB [ \-alias .IR aliasfile ] -.RB [ \-draft ] -.RB [ \-draftfolder -.IR +folder ] -.RB [ \-draftmessage -.IR msg ] -.RB [ \-nodraftfolder ] .RB [ \-filter .IR filterfile ] .RB [ \-nofilter ] @@ -32,7 +26,7 @@ send \- send a message .IR port-name/number ] .RB [ \-width .IR columns ] -.RB [ file +.RB [ msg \&...] .RB [ \-version ] .RB [ \-help ] @@ -43,7 +37,7 @@ send \- send a message .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 @@ -172,30 +166,21 @@ and network mail. Hence, by specifying both switches, a large detail 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 @@ -313,6 +298,7 @@ for more information. .nf .ta \w'%etcdir%/ExtraBigFileName 'u ^$HOME/\&.mh\(ruprofile~^The user profile +^/drafts~^The draft folder .fi .SH "PROFILE COMPONENTS" @@ -321,7 +307,7 @@ for more information. .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 @@ -333,9 +319,8 @@ comp(1), dist(1), forw(1), repl(1), mh\-alias(5), post(8) .SH DEFAULTS .nf -.RB ` file "' defaults to /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 ' diff --git a/man/show.man b/man/show.man index bdca14f..b2b9dc9 100644 --- a/man/show.man +++ b/man/show.man @@ -10,7 +10,6 @@ show \- show (display) messages .B show .RI [ +folder ] .RI [ msgs ] -.RB [ \-draft ] .RB [\-showproc .IR program ] .RB [ \-showmimeproc @@ -161,10 +160,6 @@ If the standard output is not a terminal, no queries are made, and each file is listed with a one\-line header and two lines of separation. .PP -.RB \*(lq "show \-draft" \*(rq -will list the file /draft if it -exists. -.PP If the profile entry \*(lqUnseen\-Sequence\*(rq is present and non\-empty, then .B show diff --git a/man/whatnow.man b/man/whatnow.man index 087511f..3f2c6f8 100644 --- a/man/whatnow.man +++ b/man/whatnow.man @@ -8,11 +8,6 @@ whatnow \- prompting front-end for sending messages .HP 5 .na .B whatnow -.RB [ \-draftfolder -.IR +folder ] -.RB [ \-draftmessage -.IR msg ] -.RB [ \-nodraftfolder ] .RB [ \-editor .IR editor ] .RB [ \-noedit ] @@ -168,17 +163,7 @@ The 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. @@ -188,7 +173,7 @@ information. .nf .ta \w'%etcdir%/ExtraBigFileName 'u ^$HOME/\&.mh\(ruprofile~^The user profile -^/draft~^The draft file +^/drafts~^The draft folder .fi .SH "PROFILE COMPONENTS" @@ -197,7 +182,7 @@ information. .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 ^\-next:~^To name an editor to be used after exit ^~^from diff --git a/sbr/m_draft.c b/sbr/m_draft.c index ceee73a..4a64804 100644 --- a/sbr/m_draft.c +++ b/sbr/m_draft.c @@ -11,23 +11,21 @@ #include +/* +** `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)); @@ -57,23 +55,19 @@ m_draft (char *folder, char *msg, int use, int *isdf) 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; } diff --git a/sbr/readconfig.c b/sbr/readconfig.c index 1dfd99d..5db7920 100644 --- a/sbr/readconfig.c +++ b/sbr/readconfig.c @@ -19,6 +19,7 @@ static struct procstr procs[] = { { "context", &context }, { "mh-sequences", &mh_seq }, { "backup-prefix", &backup_prefix }, + { "draft-folder", &draftfolder }, { "altmsg-link", &altmsglink }, { "buildmimeproc", &buildmimeproc }, { "faceproc", &faceproc }, diff --git a/uip/anno.c b/uip/anno.c index db1b96c..7fd22c1 100644 --- a/uip/anno.c +++ b/uip/anno.c @@ -5,15 +5,12 @@ * 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. @@ -62,19 +59,17 @@ static struct swit switches[] = { { "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 } }; @@ -98,8 +93,6 @@ main (int argc, char **argv) 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 */ @@ -164,10 +157,6 @@ main (int argc, char **argv) delete = 0; continue; - case DRFTSW: /* draft message specified */ - draft = ""; - continue; - case LISTSW: /* produce a listing */ list = 1; continue; @@ -214,29 +203,6 @@ main (int argc, char **argv) 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; diff --git a/uip/comp.c b/uip/comp.c index f713b6f..554d310 100644 --- a/uip/comp.c +++ b/uip/comp.c @@ -11,31 +11,23 @@ #include 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 } }; @@ -56,23 +48,14 @@ static struct swit aqrunl[] = { { 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; @@ -136,33 +119,6 @@ main (int argc, char **argv) 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 == '@') { @@ -183,20 +139,12 @@ main (int argc, char **argv) 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"; @@ -223,13 +171,14 @@ main (int argc, char **argv) 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 @@ -250,13 +199,12 @@ try_it_again: 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: diff --git a/uip/dist.c b/uip/dist.c index 10ef995..0b8edb3 100644 --- a/uip/dist.c +++ b/uip/dist.c @@ -15,70 +15,40 @@ static struct swit switches[] = { { "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, ""); @@ -152,25 +122,6 @@ main (int argc, char **argv) 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 == '@') { @@ -195,36 +146,8 @@ main (int argc, char **argv) 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"); diff --git a/uip/forw.c b/uip/forw.c index 8a7ed34..6e33dc3 100644 --- a/uip/forw.c +++ b/uip/forw.c @@ -21,83 +21,55 @@ static struct swit switches[] = { { "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[] = @@ -122,14 +94,13 @@ main (int argc, char **argv) { 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; @@ -251,25 +222,6 @@ main (int argc, char **argv) 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; @@ -295,45 +247,12 @@ main (int argc, char **argv) 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) { /* diff --git a/uip/mhparam.c b/uip/mhparam.c index b18ddb4..4d00717 100644 --- a/uip/mhparam.c +++ b/uip/mhparam.c @@ -64,6 +64,7 @@ static struct proc procs [] = { { "libdir", &mhlibdir }, { "backup-prefix", &backup_prefix }, { "altmsg-link", &altmsglink }, + { "draft-folder", &draftfolder }, { NULL, NULL }, }; diff --git a/uip/refile.c b/uip/refile.c index b8b64d0..2ac8916 100644 --- a/uip/refile.c +++ b/uip/refile.c @@ -13,31 +13,29 @@ #include 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 } }; @@ -62,7 +60,7 @@ int 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; @@ -133,12 +131,6 @@ main (int argc, char **argv) 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); diff --git a/uip/repl.c b/uip/repl.c index 7a9384b..db41ebb 100644 --- a/uip/repl.c +++ b/uip/repl.c @@ -23,53 +23,47 @@ static struct swit switches[] = { { "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 @@ -88,28 +82,6 @@ static struct swit ccswitches[] = { { 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; @@ -133,15 +105,13 @@ void docc (char *, int); 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 @@ -291,25 +261,6 @@ main (int argc, char **argv) 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 == '@') { @@ -339,45 +290,12 @@ main (int argc, char **argv) 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) { /* diff --git a/uip/rmm.c b/uip/rmm.c index 53103fd..e04efaa 100644 --- a/uip/rmm.c +++ b/uip/rmm.c @@ -76,7 +76,7 @@ main (int argc, char **argv) else folder = pluspath (cp); } else - app_msgarg(&msgs, cp); + app_msgarg(&msgs, cp); } if (!context_find ("path")) diff --git a/uip/send.c b/uip/send.c index d1a183e..45b5e26 100644 --- a/uip/send.c +++ b/uip/send.c @@ -17,93 +17,75 @@ static struct swit switches[] = { { "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; @@ -120,9 +102,9 @@ int 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; @@ -164,28 +146,6 @@ main (int argc, char **argv) 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; @@ -293,77 +253,39 @@ main (int argc, char **argv) } } - 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) diff --git a/uip/show.c b/uip/show.c index eda19ca..413daeb 100644 --- a/uip/show.c +++ b/uip/show.c @@ -35,13 +35,11 @@ static struct swit switches[] = { { "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 } }; @@ -62,9 +60,9 @@ int mhl (int, char **); 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]; @@ -107,20 +105,12 @@ main (int argc, char **argv) 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]); @@ -189,18 +179,15 @@ usage: 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; } @@ -281,7 +268,7 @@ 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))) { @@ -289,7 +276,7 @@ go_to_it: ; break; } } else { - /* check the file or draft for MIME */ + /* check the file for MIME */ if (is_nontext (vec[vecp - 1])) mime = 1; } @@ -302,16 +289,16 @@ go_to_it: ; 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++; @@ -320,9 +307,9 @@ go_to_it: ; 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; @@ -344,7 +331,6 @@ go_to_it: ; * 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); diff --git a/uip/whatnowsbr.c b/uip/whatnowsbr.c index c0f331a..f8b7223 100644 --- a/uip/whatnowsbr.c +++ b/uip/whatnowsbr.c @@ -44,23 +44,17 @@ #include 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 } }; @@ -83,21 +77,21 @@ static struct swit aleqs[] = { { "send []", 0 }, #define PUSHSW 6 { "push []", 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 } }; @@ -128,8 +122,8 @@ static int copyf (char *, char *); 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; @@ -175,25 +169,6 @@ WhatNow (int argc, char **argv) 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]); @@ -223,7 +198,7 @@ WhatNow (int argc, char **argv) } 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; @@ -1009,53 +984,47 @@ static struct swit sendswitches[] = { { "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 } }; @@ -1219,15 +1188,6 @@ sendit (char *sp, char **arg, char *file, int pushed) 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]); -- 1.7.10.4