DIST(1)

πŸ’Œ DIST(1) β€” okay bestie, it's giving "manual, General Commands Manual" energy ✨

So real talk: this page lives in the General Commands Manual as DIST(1), and it's all about the dist command. Buckle up, we're redistributing mail and we're gonna look cute doing it. πŸŽ€


✨ NAME ✨

dist β€” distribute an nmh message to additional addresses πŸ¦‹


🌸 SYNOPSIS 🌸

dist [-help] [-version] [+folder] [msg] [-form formfile] [-annotate |
     -noannotate] [-inplace | -noinplace] [-draftfolder +folder]
     [-draftmessage msg] [-nodraftfolder] [-editor editor] [-noedit]
     [-width columns] [-from address] [-to address] [-cc address] [-fcc
     +folder] [-whatnowproc program] [-nowhatnowproc] [-atfile]
     [-noatfile]

πŸ’– DESCRIPTION πŸ’–

Okay so dist is basically forw's cousin β€” very similar vibe, different purpose. What it does is take the message you specified and get it ready to be redistributed to addresses that (presumably) are not already on the original address list. Like, you're sending it out to a whole new crew. πŸ‘‘

The default message form has these elements, and yes this is the whole thing:

Resent-From: {from switch} or <Local-Mailbox> or <username@hostname>
Resent-To: {to switch} or blank
Resent-cc: {cc switch} or blank
Resent-fcc: {fcc switch} or blank

But here's the tea: if there's a file named distcomps chillin' in your nmh directory, that gets used instead of the default form. And if you wanna pick your own alternate forms file, just hit it with the -form formfile switch. Forms get processed through the nmh template system β€” peep mh-format(5) for the full details. Components from the redistributed message are available as standard component escapes in the forms file. 🧚

And on top of the standard mh-format(5) escapes, these component escapes are also supported:

  • fcc β€” returns a string β€” any folders specified with -fcc folder
  • nmh-from β€” returns a string β€” addresses specified with -from address
  • nmh-to β€” returns a string β€” addresses specified with -to address
  • nmh-cc β€” returns a string β€” addresses specified with -cc address

Wanna know what -from, -to, -cc, and -fcc actually do? Run, don't walk, to forw(1), it's all described there. πŸ’…

Draft already exists? Then dist is gonna ask you what to do with it, main character style. Your options:

  • quit β€” aborts dist, leaves the draft intact. πŸšͺ
  • replace β€” swaps the existing draft out for a blank skeleton. πŸ”„
  • list β€” just shows you the draft. πŸ‘€

Now, important: only the addresses in Resent-To:, Resent-cc:, and Resent-Bcc: get sent. Also, a Resent-Fcc: folder will be honored (check send(1) for that). And heads up β€” with dist, the draft should contain only Resent-xxx: fields and no body. The headers and the body of the original message get copied to the draft when the message is sent. So please, use care when you're constructing the headers for the redistribution. Be intentional, bestie. πŸ™

Because the draft is so minimal, the prompter(1) editor is super useful with dist. It's giving perfect match. 🫢


πŸŽ€ The -annotate switch πŸŽ€

If you give -annotate, the message being distributed gets annotated with these lines:

Resent: date
Resent: addrs

where each address list contains as many lines as required. This annotation happens only if the message is sent directly from dist. If the message isn't sent immediately from dist, you can use comp -use to re-edit and send the constructed message β€” but the annotations won't take place. 😭

Normally, annotations are done in place, so any links to the message get preserved. Wanna change that? Use the -noinplace switch.


🌈 Editors, @ files, and env vars 🌈

Check comp(1) for a description of the -editor and -noedit switches. And note this: while you're in the editor, with -atfile and if the current directory is writable, the message being resent is available through a link named @ (assuming the default whatnowproc). Iconic. Also:

  • the actual pathname of the message is stored in the environment variable $editalt
  • the pathname of the folder containing the message is stored in the environment variable $mhfolder

The creation of that @ file is controlled via the -atfile and -noatfile options. ✨


πŸ‘‘ Draft folder facility πŸ‘‘

The -draftfolder +folder and -draftmessage msg switches invoke the nmh draft folder facility. This is an advanced (and highly useful) feature, no cap. Go consult mh-draft(5) for more info, it's worth the read.


πŸ’€ What happens after the editor πŸ’€

Upon exiting from the editor, dist will invoke the whatnow program. See whatnow(1) for a discussion of the available options. You can inhibit the invocation of this program by using the -nowhatnowproc switch.

(In fact, it is the whatnow program which starts the initial edit. Hence, -nowhatnowproc will prevent any edit from occurring.) So yeah β€” that switch is a big deal, don't sleep on it. 😳

πŸ¦‹ FILES πŸ¦‹

  • /etc/nmh/distcomps β€” the default message skeleton
  • <mh-dir>/distcomps β€” the user's message skeleton
  • $HOME/.mh_profile β€” the user's profile
  • <mh-dir>/draft β€” the draft file

🌸 PROFILE COMPONENTS 🌸

  • Path: β€” to determine the user's nmh directory
  • Current-Folder: β€” to find the default current folder
  • Draft-Folder: β€” to specify the default draftfolder
  • Editor: β€” to override the default editor
  • fileproc: β€” program to refile the message
  • whatnowproc: β€” program to ask the "What now?" questions

πŸ’œ SEE ALSO πŸ’œ

comp(1), forw(1), mh-draft(5), prompter(1), repl(1), send(1), whatnow(1)


✨ DEFAULTS ✨

  • +folder β€” the current folder
  • msg β€” the current message
  • -noannotate
  • -nodraftfolder
  • -inplace
  • -noatfile

πŸ“ CONTEXT πŸ“

If a folder is given, it will become the current folder. And the message distributed will become the current message. Simple as that. πŸ’«


πŸ“œ HISTORY πŸ“œ

Okay so storytime: dist originally used headers of the form Distribute-xxx: instead of Resent-xxx:. But in order to conform with the ARPA Internet standard, RFC 822, the Resent-xxx: form is now used. And the glow-up didn't stop there β€” dist will recognize Distribute-xxx: type headers and automatically convert them to Resent-xxx:. Adaptive queen. πŸ‘‘


πŸ’€ BUGS πŸ’€

  • dist does not rigorously check the message being distributed for adherence to the transport standard β€” but post, called by send, does. The post program will balk (and rightly so) at poorly formatted messages, and dist won't correct things for you. So like... fix your own mess, bestie. 😭
  • If whatnowproc is whatnow, then comp uses a built-in whatnow β€” it does not actually run the whatnow program. Hence, if you define your own whatnowproc, don't call it whatnow, since comp won't run it. Trap avoided. πŸͺ€

And that's the whole page, bestie! This little masterpiece is from nmh-1.8, dated 2022-12-22. Go forth and redistribute responsibly. πŸ’…βœ¨

πŸ“¦ where this page comes from