home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume18 / mush / part04 < prev    next >
Internet Message Format  |  1991-04-21  |  51KB

  1. From: argv@zipcode.com (Dan Heller)
  2. Newsgroups: comp.sources.misc
  3. Subject: v18i061:  mush - Mail User's Shell, Part04/22
  4. Message-ID: <1991Apr21.024926.11204@sparky.IMD.Sterling.COM>
  5. Date: 21 Apr 91 02:49:26 GMT
  6. Approved: kent@sparky.imd.sterling.com
  7. X-Checksum-Snefru: bc3a673f 7fdca7a6 131ee928 3077fc47
  8.  
  9. Submitted-by: Dan Heller <argv@zipcode.com>
  10. Posting-number: Volume 18, Issue 61
  11. Archive-name: mush/part04
  12. Supersedes: mush: Volume 12, Issue 28-47
  13.  
  14. #!/bin/sh
  15. # do not concatenate these parts, unpack them in order with /bin/sh
  16. # file bindings.h continued
  17. #
  18. if test ! -r _shar_seq_.tmp; then
  19.     echo 'Please unpack part 1 first!'
  20.     exit 1
  21. fi
  22. (read Scheck
  23.  if test "$Scheck" != 4; then
  24.     echo Please unpack part "$Scheck" next!
  25.     exit 1
  26.  else
  27.     exit 0
  28.  fi
  29. ) < _shar_seq_.tmp || exit 1
  30. if test ! -f _shar_wnt_.tmp; then
  31.     echo 'x - still skipping bindings.h'
  32. else
  33. echo 'x - continuing file bindings.h'
  34. sed 's/^X//' << 'SHAR_EOF' >> 'bindings.h' &&
  35. #define C_PREV_MSG    15L
  36. #define C_FIRST_MSG    16L
  37. #define C_LAST_MSG    17L
  38. #define C_TOP_PAGE    18L
  39. #define C_BOTTOM_PAGE    19L
  40. #define C_NEXT_SCREEN    20L
  41. #define C_PREV_SCREEN    21L
  42. #define C_SOURCE    22L
  43. #define C_SAVEOPTS    23L
  44. #define C_NEXT_SEARCH    24L
  45. #define C_PREV_SEARCH    25L
  46. #define C_CONT_SEARCH    26L
  47. #define C_PRESERVE    27L
  48. #define C_REV_SORT    28L
  49. #define C_SORT        29L
  50. #define C_QUIT_HARD    30L
  51. #define C_QUIT        31L
  52. #define C_EXIT_HARD    32L
  53. #define C_EXIT        33L
  54. #define C_UPDATE    34L
  55. #define C_FOLDER    35L
  56. #define C_SHELL_ESC    36L
  57. #define C_CURSES_ESC    37L
  58. #define C_PRINT_MSG    38L
  59. #define C_CHDIR        39L
  60. #define C_VAR_SET    40L
  61. #define C_IGNORE    41L
  62. #define C_ALIAS        42L
  63. #define C_OWN_HDR    43L
  64. #define C_VERSION    44L
  65. #define C_MAIL_FLAGS    45L
  66. #define C_MAIL        46L
  67. #define C_REPLY_ALL    47L
  68. #define C_REPLY_SENDER    48L
  69. #define C_DISPLAY_NEXT    49L
  70. #define C_DISPLAY_MSG    50L
  71. #define C_TOP_MSG    51L
  72. #define C_BIND_MACRO    52L
  73. #define C_BIND        53L
  74. #define C_UNBIND    54L
  75. #define C_MAP_BANG    55L
  76. #define C_MAP        56L
  77. #define C_MACRO        57L
  78. #define C_MARK_MSG    58L
  79. #define C_HELP        59L/* THIS MUST BE THE LAST ITEM */
  80. X
  81. struct cmd_map {
  82. X    /* long so glob_flags can be saved in mac_stack */
  83. X    long m_cmd;   /* the command this is mapped to  */
  84. X    char *m_str;  /* the string user types (cbreak) */
  85. X    char *x_str;  /* the string executed if a macro */
  86. X    struct cmd_map *m_next;
  87. };
  88. X
  89. #ifdef CURSES
  90. X
  91. /*
  92. X * Pointers to the current active command or macro and to the map list.
  93. X *  This ought to be handled by having getcmd() return struct cmd_map *,
  94. X *  but curses_command() depends too heavily on getcmd() returning int.
  95. X */
  96. extern struct cmd_map *active_cmd, *cmd_map;
  97. X
  98. #endif /* CURSES */
  99. X
  100. /* This must be OUTSIDE the #ifdef CURSES -- needed in other modes */
  101. extern struct cmd_map *mac_hide;
  102. X
  103. /*
  104. X * Special bracketing recognized within an executing
  105. X *  macro as surrounding a curses function name
  106. X */
  107. #define MAC_LONG_CMD    '['
  108. #define MAC_LONG_END    ']'
  109. #define MAC_GET_STR    "getstr"
  110. #define MAC_GET_LINE    "getline"
  111. #define MAX_LONG_CMD    32
  112. X
  113. /*
  114. X * External declarations for map and map! purposes
  115. X */
  116. extern char *c_macro();
  117. extern struct cmd_map *line_map, *bang_map;
  118. SHAR_EOF
  119. echo 'File bindings.h is complete' &&
  120. chmod 0644 bindings.h ||
  121. echo 'restore of bindings.h failed'
  122. Wc_c="`wc -c < 'bindings.h'`"
  123. test 2970 -eq "$Wc_c" ||
  124.     echo 'bindings.h: original size 2970, current size' "$Wc_c"
  125. rm -f _shar_wnt_.tmp
  126. fi
  127. # ============= cmd_help ==============
  128. if test -f 'cmd_help' -a X"$1" != X"-c"; then
  129.     echo 'x - skipping cmd_help (File already exists)'
  130.     rm -f _shar_wnt_.tmp
  131. else
  132. > _shar_wnt_.tmp
  133. echo 'x - extracting cmd_help (Text)'
  134. sed 's/^X//' << 'SHAR_EOF' > 'cmd_help' &&
  135. /* @(#)cmd_help    10/24/88 (Dan Heller) */
  136. X
  137. %about%
  138. Mush, the Mail User's Shell was conceived, written and performed by
  139. X
  140. Dan Heller                                            Bart Schaefer
  141. argv@zipcode.com                               schaefer@zipcode.com
  142. argv@ora.com                                   schaefer@cse.ogi.edu
  143. argv@monet.berkeley.edu
  144. argv@uunet.uu.net
  145. X
  146. Mush is copyright (c) 1986, 1987, 1988, 1989, 1990, 1991 by Dan Heller.
  147. X                     All Rights Reserved.
  148. X
  149. This software is not in the public domain.  It is freely available
  150. under the restrictions discussed in the README file accompanying
  151. this distribution.
  152. X
  153. Dan Heller is currently working on his second book, The Motif
  154. Programmer's Manual for O'Reilly && Associates.  Bart Schaefer
  155. recently completed his Ph.D. in Computer Science and Engineering
  156. at the Oregon Graduate Institute.  Bart and Dan have co-founded
  157. Z-Code Software Corporation to produce, among other things, Z-Mail,
  158. the successor to Mush.  If you like Mush, talk to us about Z-Mail :-).
  159. X
  160. History:
  161. X    Mush was created as a friendlier and more versatile replacement
  162. for the commonly available UNIX mail utilities.  It originated in
  163. 1985 as "frankenmail", with strictly a SunWindows interface, but
  164. soon expanded to line and curses modes under the demands of excited
  165. users.  Bart climbed aboard on version 6.0 in October 1987.  The
  166. current version, 7.2, is the culmination of efforts by Dan, Bart,
  167. and numerous contributors from around UseNet:
  168. X
  169. X    Don Lewis                           Rich Burridge
  170. X    Bill Randle                         Bill Petro
  171. X    Marc Rouleau (MMDF support)         Akkana
  172. X    James Bohem                         Michael Berman
  173. X    Mike O'Carroll (DOS ports)          David St. Pierre
  174. X    Kevin Sheehan
  175. X
  176. and many others who may have been lost or weren't listed for fear
  177. of misspelling.
  178. X
  179. Discussion and support of Mush is available via the newsgroup
  180. comp.mail.mush or mailing list mush-users@apple.com, which are
  181. one and the same in content.  If you cannot get the newsgroup
  182. at your site, you can request to join mush-users by sending such
  183. a request to mush-users-request@apple.com.
  184. %%
  185. X
  186. %?%
  187. X      ? [command]
  188. X
  189. The `?' command gives you a list of legal commands.  Most commands
  190. accept -? as an option.  This provides you with specialized help for
  191. that particular command.
  192. X
  193. If the optional argument is given, help for that command is shown.
  194. %%
  195. X
  196. %ignore%
  197. X      ignore/unignore [headers]
  198. X
  199. Use this command to set the message headers you would like not
  200. to be printed when you read a message. If no header specified,
  201. then a list of all headers currently being ignored is printed.
  202. You must specify a header for unignore.
  203. X
  204. You can set the variable $alwaysignore to force normally
  205. ignored headers to be ignored while saving messages, forwarding
  206. messages or including messages into message buffers.
  207. X
  208. See also the variable $show_hdrs.
  209. %%
  210. X
  211. %set%
  212. X      set/unset [variable [= value]]
  213. X
  214. With no parameters, set lists all variables and their values.
  215. To set a boolean variable (on or off), use:
  216. X        set variable
  217. To set a variable's value to a string, use:
  218. X        set variable = value
  219. X
  220. If you want double-quotes or white-space embedded in a string,
  221. encase the string in single quotes.  If you want single quotes
  222. in a string, encase the string in double quotes.
  223. X
  224. For a list of all variables with special meanings, use:
  225. X        set ?all
  226. For help on a particular one of these variables, use:
  227. X        set ?variable_name
  228. %%
  229. X
  230. %readmsg%
  231. X      print [msg_list]
  232. X      type [msg_list]
  233. X      top [msg_list]
  234. X      next [msg_list]
  235. X      previous [msg_list]
  236. X
  237. You can read messages in different ways.  "type" and "print" display
  238. the current message.  "top" displays the first N lines of the current
  239. message where N is the value of the variable "toplines", or "crt" if
  240. "toplines" is not set.  "next" advances to the next unread message and
  241. print that.  "previous" moves back to read the first unread message
  242. before the current message.  "^" displays the first message, "$"
  243. displays the last.
  244. X
  245. Any of these commands can be followed by a message list, and each
  246. message in that list is displayed (or piped to other commands).
  247. X
  248. See also "help msg_list" and the variable $autoprint.
  249. %%
  250. X
  251. %alts%
  252. X      alts [hostnames] [*[user]] [!path!user] [user@host]
  253. X
  254. The alts command sets a list of hostnames on which you have an
  255. account.  Normally, when you respond to all recipients of mail,
  256. your account name is listed as if you wished to send yourself mail.
  257. If you don't have metoo set, then your name is removed from the
  258. mailing list if the host specified is in the alternates list.
  259. Hostnames may be given either as a single name or as a UUCP path
  260. (separated by `!' characters).
  261. X
  262. The special parameter `*' instructs alts to match all hostnames;
  263. in that case, only your login name is tested.  A user name may be
  264. appended to the `*', in which case that name is tested instead of
  265. your local login name.  A user name at a specific host machine
  266. may be specified either with the syntax "user@host" or by beginning
  267. the UUCP path to the host with a `!' character.  The leading `!'
  268. is used to differentiate paths that already end in a user name from
  269. those to which your local login name should be appended.
  270. %%
  271. X
  272. %source%
  273. X      source/saveopts [file]
  274. X
  275. The source/saveopts commands load/save all variable settings,
  276. options, aliases, cmd's, ignored headers ...  everything you can set,
  277. it loads or saves.  The file read or written follows these rules:
  278. X
  279. 1) If a filename is given, that file is used
  280. 2) The file described by the environment variable MAILRC
  281. 3) In the user's home directory: .mushrc (if it exists)
  282. 4) In the user's home directory: .mailrc (if it exists)
  283. X
  284. If saveopts is used and the file exists, confirmation is requested
  285. before the file is overwritten.
  286. %%
  287. X
  288. %help%
  289. X      help [item]
  290. X
  291. Type "help" with no arguments for a list of valid items.
  292. %%
  293. X
  294. %general%
  295. This is the general help message.  To get help on a specific
  296. command, try "command -?".  Extended help is given by typing
  297. "help item" where item is one of:
  298. X    path, msg_list, prompt, hdr_format
  299. Help with msg_list is highly advisable!
  300. X
  301. Type "?" to get a list of available commands.  Try "? command"
  302. to get help on the particular command that you specify.
  303. X
  304. Use "set ?variable" to get help with specific variables.
  305. %%
  306. X
  307. %path%
  308. Whenever "path" is specified, the following syntax is legal
  309. besides the normal path addressing scheme used by unix:
  310. X ~[user]   -- the home directory of specified user (yours by default)
  311. X %[user]   --/usr/spool/mail/login_name [user_name] (yours by default)
  312. X +file     --the directory described by `set folder'; file is `file'
  313. %%
  314. X
  315. %msg_list%
  316. A "msg_list" references one or more messages.  The user
  317. specifies a group of messages according to a special syntax.
  318. X
  319. X *      All messages.
  320. X ^      The first message.
  321. X $      The last message.
  322. X .      The current message.
  323. X N-M    A range of messages between N and M, inclusive.
  324. X
  325. In the last case, N and M may be * ^ $ . or digits referencing
  326. explicit message numbers.  The range must be in ascending order.
  327. X
  328. You can also negate messages by placing the message list inside
  329. braces, `{' `}' -- thus, the expression "2-19 {11-14}"
  330. references messages 2 through 19 except for those from 11
  331. through 14.
  332. X
  333. Commands can be "piped" to one another, because the return value
  334. of a command is a msg_list, not text.  For example,
  335. X        pick -f fred | lpr
  336. finds all messages "from fred" and send them to the printer.
  337. X
  338. Commands dealing with more than one message process them in numeric
  339. order -- not necessarily the order specified.  Thus, the command
  340. "save 1-5 9 7 6 file" saves the messages in ascending order, not in
  341. the order given.
  342. %%
  343. X
  344. %hdr_format%
  345. This variable controls the display of message headers.  Use:
  346. X        set hdr_format="string"
  347. to change the header display.  The string uses printf style
  348. formatting and follows these conventions:
  349. X    %a  address of the author
  350. X    %c  number of characters (bytes) in the message
  351. X    %d  entire date of the message (see "date_received" variable)
  352. X    %f  "From" field (author name and address)
  353. X    %i  the message-id (may or may not be present)
  354. X    %l  number of lines in the message
  355. X    %M  month name of the message
  356. X    %N  day of the month (number)
  357. X    %n  name of the author
  358. X    %s  subject of the message
  359. X    %t  "To" field (recipients)
  360. X    %T  time of the message (see "mil_time" variable)
  361. X    %u  user name (login) of the author
  362. X    %W  day of the week (Sun, Mon, etc.)
  363. X    %Y  year of the message 
  364. X    %y  year (last 2 digits only)
  365. X    \n  a newline
  366. X    \t  a tab
  367. X
  368. A field specifier may be used in any % expansion.  Thus, "%20s"
  369. displays the first 20 characters of the Subject.  No matter
  370. what the formatting string, the message number, the status of
  371. the message and a '>' (if this is the "current" message) is
  372. before any user defined format is printed.
  373. %%
  374. X
  375. %prompt%
  376. This variable controls the prompt that mush displays.
  377. X        set prompt = "string"
  378. The "string" follows printf style formatting conventions:
  379. X    %F  full path of the current working folder
  380. X    %f  name (path tail) of the current folder
  381. X    %m  current message number
  382. X    %n  number of new messages
  383. X    %u  number of unread messages
  384. X    %d  number of deleted messages
  385. X    %t  total number of messages
  386. X    %T  current time
  387. X    %N  day of the month (number) (today)
  388. X    %W  weekday name (today)
  389. X    %M  month name (this month)
  390. X    %Y  year (this year)
  391. X    %y  year (last 2 digits only)
  392. X    %$  introduces variable name 
  393. X    \n  newline
  394. X    \t  tab
  395. X
  396. The special sequence %$ must be followed by the name of a variable.
  397. The value of that variable is inserted into the prompt at the time
  398. the prompt is displayed.  When setting a %$variable sequence in your
  399. prompt, be sure to enclose the string in single quotes ('') to
  400. prevent the shell from expanding the variable at that time.
  401. %%
  402. X
  403. %preserve%
  404. X      preserve [msg_list]
  405. X
  406. The "preserve" command marks messages to be saved in your system
  407. mailbox.  Unless explicitly preserved, all mail that you read is
  408. saved at quit time in ~/mbox (or the file specified by $mbox).
  409. Deleted messages are preserved only if first undeleted (see
  410. "delete -?").  When a message is preserved, the `P' status bit
  411. appears in the header summary display for that message.
  412. X
  413. The "unpreserve" command reverses the effect of "preserve".
  414. X
  415. Setting the boolean variable $hold is equivalent to preserving
  416. each message as you read it, except that no `P' status is set.
  417. %%
  418. X
  419. %mark%
  420. X      mark [-[A|B|C|D|E]] [msg_list]
  421. X      unmark [msg_list]
  422. X
  423. The "mark" command places a tag on messages that you wish to
  424. reference later.  If no argument or a msg_list only is given, the
  425. mark is temporary and is not saved when the folder is updated.  
  426. The command "headers -H:m" (abbreviated as ":m") can be used to
  427. reference all messages having this temporary mark.
  428. X
  429. A "priority" may be set on messages by specifying a `-' followed
  430. by a letter in the range A through E.  The "sort" and "pick" commands
  431. can be used to order or select messages according to their priorities.
  432. Message priority is saved across folder updates.
  433. X
  434. Messages may have both a temporary mark and a priority, but may not
  435. have more than one priority.  The presence of a temporary mark is
  436. shown by a `+' character immediately following the message number
  437. in the "headers" command display, while the priority letter is
  438. displayed in the same place if the message unmarked but prioritized.
  439. X
  440. The "unmark" command removes temporary marks only.  To remove the
  441. priority of a message, do not specify a priority:
  442. X
  443. X    mark - [msg_list]
  444. X
  445. See also the commands "set", "sort", "pick" and "headers".
  446. %%
  447. X
  448. %save%
  449. X      save/write/copy [-s|-S|-a|-A] [-f] [msg_list] [filename]
  450. X
  451. If no filename is specified, ~/mbox (or the value of the variable
  452. "mbox") is used.  Save and write append the message to the file if
  453. it already exists.  Specifying -f overwrites the file (e.g., erasing
  454. it first).
  455. X
  456. To save messages to a filename beginning with a digit, escape
  457. the filename with a backslash (\).
  458. X
  459. The "write" command writes message without the headers (message
  460. body only).  Save and write both mark messages for deletion unless
  461. $keepsave is set.  The "copy" command is identical to "save" except
  462. that messages are not marked for deletion (identical to having the
  463. variable "keepsave" set).
  464. X
  465. The -s and -S options save messages to files named by the
  466. subject of the message.  If more than one message is specified,
  467. then the message subject of each message is used.  If -S is
  468. specified, then the subject of the first message is used for all
  469. messages.  Spaces and forward slashes (/) are converted to
  470. underscores (_).
  471. X
  472. The -a and -A options save messages by author's login name.
  473. %%
  474. X
  475. %lpr%
  476. X      lpr [-n] [-h] [msg_list]
  477. X
  478. Send a message to the printer.  The options are:
  479. X  -n      print body of message only (no headers)
  480. X  -h      do not print ignored headers
  481. X  -Pxx    print on printer xx
  482. X
  483. The variable $printer can be used to specify a default printer;
  484. for example, "set printer=lp" is the same as always using "-Plp".
  485. The variable $print_cmd can be used to specify a program other
  486. than "lpr" to use for printing.
  487. X
  488. NOTE:  Some systems require that the printer name be introduced
  489. by "-d" rather than "-P".  Mush may have been configured so that
  490. both -P and -d will produce the correct result, but if an error
  491. occurs, try the other option.
  492. X
  493. See also the variable $alwaysignore.
  494. %%
  495. X
  496. %mail%
  497. X      mail [mail-flags] [recipients]
  498. X
  499. Compose and send a mail message.  The possible flags are:
  500. X  -b bcc-addrs    set blind-carbon-copy recipients
  501. X  -c cc-addrs     set carbon-copy recipients
  502. X  -e              immediately enter editor (autoedit)
  503. X  -E              edit outgoing headers
  504. X  -f [msg-list]   forward msg-list (not indented)
  505. X  -F              add fortune to the end of message
  506. X  -h file         read file as prepared draft (with headers)
  507. X  -H file         read file as prepared text (without headers)
  508. X  -i [msg-list]   include msg-list in letter
  509. X  -I [msg-list]   include msg-list with headers in letter
  510. X  -s [subject]    prompt for or set subject
  511. X  -u              do not append signatures and fortunes
  512. X  -U              send draft immediately (use with -h or -H)
  513. X  -v              verbose (not available on some systems)
  514. X
  515. The -f option adds new headers and automatically sends the
  516. indicated messages to the list of recipients unless -E or -e
  517. is also given.  The -I and -i options copies the indicated
  518. messages into the text of your letter, surrounded by the text
  519. of variables pre_indent_str, indent_str, and post_indent_str.
  520. X
  521. The -h option reads a draft file, which should already include
  522. message headers.  The -H option reads a text file, which should
  523. NOT include headers.  If the -U option is also given, the draft
  524. is sent immediately.
  525. X
  526. See also the variables $ask, $askcc, $autoedit, $autoinclude,
  527. $autosign, $autosign2, $dot, $edit_hdrs, $escape, $fortune,
  528. $fortunates, $logfile, $record, $no_expand, $no_hdrs, $realname,
  529. $sendmail, $verbose, $verify, and $wrapcolumn.
  530. %%
  531. X
  532. %respond%
  533. X      replysender/replyall [msg-list] [-r path] [mail-flags] [recipients]
  534. X
  535. The "replysender" command replies only to the sender of a
  536. message, whereas "replyall" responds to everyone on the To: and
  537. Cc: lines of the message.
  538. X
  539. The command "reply" is identical to "replysender".
  540. X
  541. If a message list is indicated, then each message on the list is
  542. replied to in the same manner.  If -r is specified with a host or
  543. path (uucp-style), then each address in the list is routed via
  544. this path.  This overrides the value of auto_route (see man page).
  545. X
  546. The address of the author is obtained from certain headers in his
  547. message to you.  Unless you specify otherwise, mush searches for the
  548. headers Reply-To: Return-Path: and From:.  You can override these
  549. values by setting the variable reply_to_hdr.
  550. X
  551. X    set reply_to_hdr = "sender reply-to return-path from_"
  552. X
  553. This example shows that mush searches (in order) for the headers
  554. listed in the reply_to_hdr variable.  If one header isn't found, then
  555. mush looks for the next in the list.  If none of the headers in the
  556. list are found, the default headers (mentioned above) are searched.
  557. The last header listed in the example is the special "From " header.
  558. See the man page for more details.
  559. X
  560. Type "mail -?" for information on legal mail flags.
  561. X
  562. See also the variables $auto_route, $domain_route, $in_reply_to,
  563. $known_hosts, $metoo, $reply_to_hdr, and those listed by "mail -?".
  564. %%
  565. X
  566. %sort%
  567. X      sort [-i] [-r|a|d|l|R|s|S]
  568. X
  569. X  -i         ignore case in alphabetical sorts
  570. X  -r         reverse order of next criteria
  571. X
  572. X  -a         by author (alphabetical)
  573. X  -d         according to date
  574. X  -l         by length (size in characters, not lines)
  575. X  -p         by priority (marks)
  576. X  -R         by subject including Re:
  577. X  -s         by subject ignoring Re: (alphabetical)
  578. X  -S         by status
  579. X
  580. Any combination of the options can be given.  Each comparison
  581. proceeds from left to right through the list of criteria,
  582. stopping when an ordering has been determined or no criteria
  583. remain.  The optional -r flag reverses the order of the next
  584. comparison specified.  Example:
  585. X
  586. X      sort -i -a -r -d
  587. X
  588. The above sorts by author first, ignoring case, and then sorts by
  589. reverse date (most recent first) for each author.  The -r option can
  590. be given once for each criterion and applies only to the first
  591. criterion that follows it.  Giving -r twice in succession (-r -r)
  592. does NOT negate the reversal!  Whatever option follows the rightmost
  593. -r has its sense reversed.
  594. X
  595. Unlike -r, the -i option is recognized at most once and applies
  596. to all alphabetical sorts in the list of criteria.
  597. X
  598. By default (no parameters), sort orders messages by status:
  599. New, unread messages are first, followed by preserved messages
  600. and finally the deleted messages are placed at the end.  If -r
  601. is the only flag given, the status order is reversed.
  602. X
  603. If the $date_received variable is set, sorting by date is
  604. done using the date you received the message.  Otherwise,
  605. messages are sorted by date sent by the original author.
  606. X
  607. See also the variable $sort.
  608. %%
  609. X
  610. %pick%
  611. X      pick [+<num>] [-<num>] [-r msg_list] [-x] [-i] [-h hdr] [-f|s|t]
  612. X        [-d [-][date]] [-ago [+|-] [n days] [n weeks] [n months]]
  613. X        [-p priority] [[-e] <pat>]
  614. X
  615. Search for patterns within messages.  Entire messages are
  616. searched for <pattern> unless -f, -h, -s, or -t is specified.
  617. Only one of -d, -f, -h, -s, -t and -ago can be specified; no
  618. pattern is used with -d and -ago; and -x may not be used in
  619. conjunction with +<num> and/or -<num>.
  620. X
  621. X  +<num>        return only the first <num>ber messages matched
  622. X  -<num>        return only the last <num>ber messages matched
  623. X  -x            return all the messages which do NOT match
  624. X  -e            remaining arguments are the <pat> (`e'xpression)
  625. X  -f            match pattern in the "From:" field (author) only
  626. X  -s            match pattern in the "Subject:" header only
  627. X  -t            match pattern in the "To:" field only
  628. X  -h hdr        match pattern in specified header field only
  629. X  -i            ignore case of letters in when matching
  630. X  -r msg_list   restrict the range of messages search to msg_list
  631. X  -d            select messages sent on [+ after] [- before] date
  632. X        A "date" is of the form:  [+-][month]/[date[/year]]
  633. X        Omitted fields default to today's values.  Examples:
  634. X          pick -d 4/20     messages on Apr 20, this year
  635. X          pick -d -/2/85   on or before the 2nd, this month, 1985
  636. X          pick -d +5/4     on or after May 4, this year
  637. X          pick -d /        finds today's messages only
  638. X        At least one `/' char must be used in a date.  There is
  639. X        no strong date checking; 2/30 would be considered valid.
  640. X  -ago          select messages relative to the current date
  641. X        Date formats for "ago" are more verbose than for -d; see
  642. X        the manual page for details.
  643. X  -p [A-E]      select messages with specified priority
  644. X        Multiple -p flags may be used to search for several
  645. X        priorities at once.
  646. X
  647. Examples:
  648. X    Find the first 5 messages with the subject "Telephone Message":
  649. X        pick +5 -s Telephone Message
  650. X    Find the first 2 messages of the last 4 that are to "mush-users":
  651. X        pick -4 +2 -t mush-users
  652. X    Find those among messages 1 to 10 that are 2 months or more old:
  653. X        pick -r 1-10 -ago -2m
  654. X    Find messages that are 1 week old or newer:
  655. X        pick -ago +1w
  656. X    Find messages that contain "-request" in the Resent-From field:
  657. X        pick -h resent-from -e -request
  658. X
  659. A description of the pick operation is printed before the search
  660. is performed, unless the value of the variable $quiet contains the
  661. field "pick", or pick is piped to another mush command.
  662. %%
  663. X
  664. %alias%
  665. X      alias [name [namelist]]
  666. X
  667. Options for alias:
  668. X alias                       print all namelists
  669. X alias name                  print namelist associated with name
  670. X alias name namelist         set "name" to the value of namelist
  671. X unalias namelist            unalias names in namelist
  672. X
  673. A "namelist" consists of one or more addresses.  An address may
  674. be a name already set to another list, a valid user, a file or
  675. a program.  Filenames must be full pathnames, i.e., they must
  676. begin with a '/' (or with a ~, which expands to some home dir).
  677. A "program" must start with a pipe symbol and be encased in
  678. quotes:
  679. X
  680. X    "|program_name"
  681. X
  682. The command "expand" fully expands addresses (including sublists)
  683. associated with the given alias.
  684. X
  685. See also the variable $no_expand.
  686. %%
  687. X
  688. %from%
  689. X      from [+|-] [msg-list] [pattern]
  690. X
  691. With no parameters, "from" displays the current message's header
  692. line.  If given a message list, "from" displays the headers of the
  693. listed messages.
  694. X
  695. The special parameters `-' and `+' can be given to move the
  696. current message pointer to the previous or next message
  697. respectively, while also printing that message's header.
  698. X
  699. If a message list was given in addition to `-' or `+', then
  700. the current message pointer is set to the first or last
  701. message, respectively, in the message list given.
  702. X
  703. If a pattern is given, that pattern is searched for in the From:
  704. header of the message.  If both a message list and a pattern are
  705. given, the pattern search is restricted to the listed messages.
  706. X
  707. Examples:
  708. X
  709. X        from - 10-30 {16}
  710. displays the headers of messages 10 through 30 except for
  711. message 16 and set the current message pointer to 10.
  712. X
  713. X        from + Dan
  714. displays the headers of all messages that contain "Dan" in the
  715. author's name and set the current message pointer to the last
  716. one of that kind in the list.
  717. X
  718. X        from +
  719. displays the header of the message after the current message
  720. and increment the current message pointer to that message.
  721. X
  722. See also the "headers" command and "help hdr_format".
  723. %%
  724. X
  725. %my_hdr%
  726. X      my_hdr [header[: string]]
  727. X
  728. This command is used to set, unset or view your personalized
  729. message headers.  These headers are included in all your
  730. outgoing mail.
  731. X
  732. Options for my_hdr:
  733. X  my_hdr                        show all headers
  734. X  my_hdr header                 show value of header
  735. X  my_hdr header: string         set header to string
  736. X  un_hdr header                 unset header
  737. X
  738. Note that there is no space between the header name and the
  739. colon in the third form of the command.
  740. %%
  741. X
  742. %fkey%
  743. X      fkey [<sequence> [command]]
  744. X      unfkey <sequence>
  745. X
  746. This command is used to make function key settings in Suntools
  747. (graphics) mode.  When run as a tool (-t on command line),
  748. choose the Options item, and the "function key" menu option.
  749. X
  750. The unfkey command removes the setting for a given string.
  751. %%
  752. X
  753. %cmd%
  754. X      cmd [name [value]]
  755. X
  756. This function is used to establish command aliases; cmd's are
  757. just like aliases in the C-shell.  Options are:
  758. X  cmd                       view all commands
  759. X  cmd command               show value of command
  760. X  cmd command value         set command to value
  761. X  uncmd command             unset command
  762. X
  763. The value must be quoted if it is to contain command separators
  764. such as `;' or `|'.
  765. X
  766. If you want to reference history commands within a cmd,
  767. escape the ! with a backslash.  For example:
  768. X
  769. X        cmd r 'replysender \!* ; delete -t'
  770. X
  771. causes "r" to reply using whatever parameters you have given on
  772. the command line and then delete that message and print the next
  773. message (-t parameter to "delete").
  774. %%
  775. X
  776. %headers%
  777. X      headers [+|-|N] [[-H]:c]
  778. X  +     print the next screenful (or use the 'z' command).
  779. X  -     print the previous screenful (or use 'z-' ).
  780. X  N     print a screenful starting at message number N.
  781. X  -H:c  where `c' is one of
  782. X     a  all messages (mostly for the mush startup option -H:c)
  783. X     d  deleted messages
  784. X     m  marked messages
  785. X     n  new messages
  786. X     o  old messages
  787. X     p  preserved messages
  788. X     r  replied-to messages
  789. X     s  saved messages
  790. X     u  unread messages
  791. X
  792. The "headers" command prints out a screenful of headers.
  793. Deleted messages are not normally shown; set "show_deleted" to
  794. include deleted messages.
  795. X
  796. The command ":c" is equivalent to "headers -H:c".  The -H can be
  797. omitted, i.e., "headers :c" also works.
  798. X
  799. See also "help hdr_format".
  800. %%
  801. X
  802. %folder%
  803. X      folder [-N] [-n] [-r] [%[user]|#|&|file]
  804. X
  805. X  -N       do not display the list of headers
  806. X  -n       do not update the current folder before changing
  807. X  -r       read only mode (cannot write changes to new folder)
  808. X  %[user]  change to /usr/spool/mail/[user] (you by default)
  809. X  #        change to folder accessed previous to current folder
  810. X  &        change to "mbox" -- default is $mbox or ~/mbox
  811. X
  812. The "folder" command changes the current folder; with no parameters,
  813. it prints the name of the current folder.  For compatibility with
  814. older versions, the single character `!' is equivalent to -n.
  815. X
  816. "Folder" treats the characters `+' and `~' as metacharacters when
  817. they are the first character of a file name.  `~' is expanded to the
  818. name of the user's home directory, or to another user's home if it
  819. is given as "~username" (no `/' between the `~' and the name).  `+'
  820. is expanded to the user's folder directory ("~/Mail" or the value of
  821. $folder); no `/' is required between `+' and the file name, so both
  822. "+file" and "+/file" refer to the same file.
  823. X
  824. The "update" command updates the current folder.  In this case, only
  825. the -N and -r options are recognized; "update -r" changes the current
  826. folder to read only mode AFTER updating it.
  827. X
  828. See also the variable $folder.
  829. %%
  830. X
  831. %quit%
  832. X      quit/exit
  833. X
  834. These commands end a mush session.  "quit" updates your mailbox; if
  835. new mail has come in, you are told so and given an option whether to
  836. really quit or not.  "exit" terminates mush neither updating your
  837. mailbox nor checking for new mail.
  838. %%
  839. X
  840. %ls%
  841. X      ls [options]
  842. X
  843. The "ls" command is exactly like the UNIX command "ls".  All
  844. parameters are the same.  The "folders" command is equivalent
  845. to doing "ls -FR $folder" from the Mush prompt.
  846. %%
  847. X
  848. %shell%
  849. X      sh [command]
  850. X
  851. If a "command" is given, that UNIX command is executed under the
  852. Bourne shell.  If no command is specified, then an interactive shell
  853. is started. The environment variable SHELL or the local mail shell
  854. variable $shell describes the shell to invoke.  If none is set, then
  855. the default shell is defined by the system administrator (currently
  856. set to csh).
  857. X
  858. Users on systems with job control probably have little use for the
  859. sh command.
  860. %%
  861. X
  862. %stop%
  863. X      stop
  864. X
  865. The stop command sends a stop signal to the mail shell.  It is
  866. equivalent to your tty job-control stop character (often ^Z).
  867. Since the mush shell never needs to be exited, the command 'q'
  868. may be "cmd"ed to "stop;await" and csh users may have
  869. X        alias mail %mush
  870. to bring mush into the foreground rather than having to invoke
  871. it again.  New mail is then read into the shell automatically
  872. and much time and energy is saved.
  873. %%
  874. X
  875. %curses%
  876. X      curses
  877. X
  878. The curses-based interface for Mush does not require a graphics
  879. display, but does require a terminal which can handle upline
  880. cursor movement capabilities.  All commands are one or two
  881. keystroke commands and are executed as soon as the key is typed.
  882. X
  883. For a list of current key-to-command bindings, use the "bind"
  884. command (defaults to 'b' in curses mode).
  885. X
  886. See also the variable $curses_help.
  887. %%
  888. X
  889. %bind%
  890. X      bind [<sequence> <curses-command> [<parameters>]]
  891. X      unbind <sequence>
  892. X
  893. Binding is done for the curses interface only.  It allows the
  894. user to bind keystrokes or key sequences to curses-interface
  895. commands.  You cannot bind keystrokes to regular mush commands
  896. using bind.
  897. X
  898. A bound key-sequence (input by the user) is converted into
  899. the curses command it is bound to.  For a list of all curses
  900. commands, issue the "bind" command and follow the instructions
  901. to get a list.  Currently, parameters are ignored for all curses
  902. commands except the special command "macro".
  903. X
  904. When specifying sequences, you may enter almost anything at the
  905. keyboard that you want to type.  This includes most control
  906. characters.  A special syntax is provided to specify control
  907. characters if you wish to set up default key bindings in your
  908. initialization file without using real control characters.
  909. X
  910. To bind keystrokes that are control characters in the
  911. initialization file, you must use the notation "\CX" where "X"
  912. is an upper-case letter representing the control key you want to
  913. use. "\CN" would be control-N; "\n" is carriage return.  You may
  914. not bind keyboard generated signals; for most users, those key
  915. sequences are control-C and control-\.  For users with job
  916. control, the suspend characters (usually control-Z and
  917. control-Y) are also ignored.
  918. X
  919. Trying to bind a key sequence which prefixes another sequence is
  920. an error and the user is warned that the longer binding does not
  921. work.  The binding does take place, however, because it is
  922. possible to unbind the shorter sequence, thus validating the
  923. longer sequence.
  924. X
  925. The special curses command "macro" allows a string to be
  926. executed just as if the user typed it directly.  Issue the
  927. "bind-macro" command for more details.
  928. X
  929. Bindings are removed with the "unbind" command.
  930. %%
  931. X
  932. %msg_flags%
  933. X      flags [[+|-] [flag-bits]] [msg-list]
  934. X
  935. Any sensible combination of these flag-bits may be used:
  936. X  D    deleted
  937. X  f    forwarded
  938. X  N    new
  939. X  O    old
  940. X  P    preserved
  941. X  p    printed
  942. X  R    read
  943. X  r    replied-to
  944. X  S    saved
  945. X  U    unread
  946. X
  947. This command displays the status of messages by default.  If a
  948. msg-list is specified, it tells which bits of the message are set.
  949. If any (one or more) of the bits are given and no + or - modifier is
  950. specified, then the status of each message in the list is set to that
  951. status absolutely (other status flags are lost).  However, if a +
  952. or - is specified, then the status is modified for that bit to on (+)
  953. or off (-).
  954. X
  955. If no list is given, the current message is used.
  956. %%
  957. X
  958. %setenv%
  959. X      setenv VARIABLE [value]
  960. X
  961. Variable names may be any string, but traditionally environment
  962. variables are all upper case.  If no "value" is specified, then
  963. the variable name is set to an empty string.  If the value contains
  964. spaces, you should enclose the string in quotation marks.  Use
  965. printenv to print a list of all your environment variables.
  966. %%
  967. X
  968. %unsetenv%
  969. X      unsetenv VARIABLE
  970. X
  971. You must specify one and only one variable to unset in your
  972. environment variable settings.  Use printenv to print a list of
  973. all your environment variables.
  974. %%
  975. X
  976. %printenv%
  977. X      printenv [VARIABLE]
  978. X
  979. Display the entire current environment, or the value of the
  980. specified environment variable.
  981. X
  982. Also see "setenv" and "unsetenv".
  983. %%
  984. X
  985. %edit_msg%
  986. X      edit [msg_list]
  987. X
  988. The "edit" command lets you edit messages in your folder.  The
  989. editor used is determined by the variable $editor, the environment
  990. variable EDITOR, the variable $visual and the environment variable
  991. VISUAL in that order.  If none of those variables are set, the
  992. default visual editor is used.  The "v" command is the same as "edit"
  993. but tests only $visual and VISUAL.
  994. X
  995. When editing messages, be careful not to remove certain message
  996. headers such as Date:, From:, or any others that look important.
  997. If you remove or change something you shouldn't have, you are
  998. notified and the temporary file used to edit the message is
  999. not removed.
  1000. %%
  1001. X
  1002. %bind-macro%
  1003. X      bind-macro [<sequence> [<expansion>]]
  1004. X
  1005. The "bind-macro" command allows you to set macros in curses
  1006. mode, so that one keystroke (or a few) acts as though you
  1007. had typed a longer sequence.  Using "bind-macro" is equivalent
  1008. to specifying the "macro" special command as a parameter to
  1009. the "bind" command.
  1010. X
  1011. Given no parameters, "bind-macro" lists all current curses
  1012. mode macros.  Given only a <sequence>, it shows the current
  1013. binding for that sequence.  Given both a <sequence> and an
  1014. <expansion>, it creates a macro such that, when the
  1015. <sequence> is typed in curses mode, the effect is the same
  1016. as if the <expansion> had been typed instead.
  1017. X
  1018. The same format for control characters that is used for the
  1019. "bind" command may be used in both the <sequence> and the
  1020. <expansion>, i.e.,
  1021. X    \Cx     control-x (where x is a capital letter)
  1022. X    \E      the escape character (\C[ does NOT work!)
  1023. X    \n      a newline (other C-style escapes also work)
  1024. X
  1025. Example:
  1026. X    bind-macro F [folder]+record\n
  1027. X
  1028. If you are in curses mode and hit the F key, then the curses
  1029. mode command "folder" executes and +record (followed by
  1030. a carriage return) is entered as if you typed it.
  1031. X
  1032. Macros are removed with the "unbind" command, see "bind -?".
  1033. X
  1034. Also see the "map" and "map!" commands.
  1035. %%
  1036. X
  1037. %map%
  1038. X      map [<sequence> [<expansion>]]
  1039. X      unmap <sequence>
  1040. X
  1041. The "map" command allows you to use one keystroke (or a few) and
  1042. have it act as though you had typed a longer sequence.
  1043. X
  1044. Given no parameters, "map" lists all current line mode
  1045. macros.  Given only a <sequence>, it shows the current
  1046. binding for that sequence.  Given both a <sequence> and an
  1047. <expansion>, it creates a macro such that, when the
  1048. <sequence> is typed in line mode, the effect is the same
  1049. as if the <expansion> had been typed instead.
  1050. X
  1051. The same format for control characters that is used for the
  1052. "bind" command may be used in both the <sequence> and the
  1053. <expansion>, i.e.,
  1054. X    \Cx     control-x (where x is a capital letter)
  1055. X    \E      the escape character (\C[ does NOT work!)
  1056. X    \n      a newline (other C-style escapes also work)
  1057. X
  1058. Example:
  1059. X    map & print\n
  1060. X
  1061. If you are not in curses mode and hit the & key, then mush acts
  1062. as if you typed the word "print" and hit carriage return.
  1063. X
  1064. To type a character without having the mapping expanded, precede
  1065. the character with a backslash (\).
  1066. X
  1067. Mappings are removed with the "unmap" command.
  1068. X
  1069. Also see the "map!" and "bind" commands.
  1070. %%
  1071. X
  1072. %map!%
  1073. X      map! [<sequence> [<expansion>]]
  1074. X      unmap! <sequence>
  1075. X
  1076. The "map!" command allows you to set macros in message
  1077. composition mode, so that one keystroke (or a few) acts
  1078. as though you had typed a longer sequence.  map!'s take
  1079. effect regardless of whether you started the letter from
  1080. curses mode or line mode.
  1081. X
  1082. Given no parameters, "map!" lists all composition mode
  1083. macros.  Given only a <sequence>, it shows the current
  1084. binding for that sequence.  Given both a <sequence> and an
  1085. <expansion>, it creates a macro such that, when the
  1086. <sequence> is typed in message composition mode, the effect
  1087. is the same as if the <expansion> had been typed instead.
  1088. X
  1089. The same format for control characters that is used for the
  1090. "bind" command may be used in both the <sequence> and the
  1091. <expansion>, i.e.,
  1092. X    \Cx     control-x (where x is a capital letter)
  1093. X    \E      the escape character (\C[ does NOT work!)
  1094. X    \n      a newline (other C-style escapes also work)
  1095. X
  1096. Example:
  1097. X    map! ! <BANG>
  1098. X
  1099. If you are typing in a letter regardless of which interface you
  1100. use and you hit the ! key, then mush reacts as if you typed the
  1101. keys "<BANG>".
  1102. X
  1103. To type a character without having the mapping expanded, precede
  1104. the character with a backslash (\).
  1105. X
  1106. Mappings are removed with the "unmap!" command.
  1107. X
  1108. Also see the "bind" and "map" commands.
  1109. %%
  1110. X
  1111. %eval%
  1112. X      eval [-h|-p] args ...
  1113. X
  1114. This command causes its arguments to be re-parsed and then
  1115. executed as a mush command.  Example:
  1116. X
  1117. X    set initprompt='"$hostname:$cwd "'
  1118. X    eval set prompt=$initprompt
  1119. X
  1120. If the -h flag is given, then eval looks for formatting parameters
  1121. as defined for the variable $hdr_format, and expands the formats
  1122. for the "current" message before executing the command.  Example:
  1123. X
  1124. X    eval -h pick -f %f
  1125. X
  1126. finds all messages from the same author as the current message.
  1127. X
  1128. If the -p flag is given, then eval expands formatting parameters as
  1129. as defined for the variable $prompt.  The -h and -p flags may not be
  1130. used together in the same eval.
  1131. %%
  1132. X
  1133. %pipe_msg%
  1134. X      pipe [-p pattern] [msg-list] [unix-command] [cmd-args]
  1135. X
  1136. This command is used to send a message to a unix command.  The
  1137. command takes its input from the message(s) passed to the pipe
  1138. command.  By default, the entire message (including headers) is
  1139. sent.  Ignored headers (see "ignore -?" and "set ?show_hdrs") can
  1140. be suppressed by setting the variable $alwaysignore.
  1141. X
  1142. You can pipe (|) messages to this command rather than give a
  1143. msg-list, but if no msg-list is given and there is no pipe, the
  1144. current message is used.  The unix-command is executed via "sh",
  1145. so csh aliases may not be used.
  1146. X
  1147. If invoked with a capital letter (Pipe), only the bodies of the
  1148. messages are fed to the unix-command -- all headers are omitted.
  1149. X
  1150. A pattern can be specified to indicate which line should start
  1151. the lines that are sent to the unix command.  The pattern must
  1152. match literally (no regular-expressions) at the beginning of a
  1153. line.  Once the pattern is found, that line and all succeeding
  1154. lines are sent to the unix command.
  1155. X
  1156. If the unix-command is omitted, then /bin/sh is used and the 
  1157. pattern searched for is "#!".  Therefore, "pipe" with no arguments
  1158. can be used to treat a message as a shell script.
  1159. X
  1160. Examples:
  1161. X    pipe patch         -- send the current message to "patch"
  1162. X    pipe -p %! lpr     -- send the message to a postscript printer
  1163. X    pipe 2 7 more      -- send messages 2 and 7 through "more"
  1164. X    1 | Pipe nroff     -- send the body of message 1 to "nroff"
  1165. %%
  1166. X
  1167. %merge%
  1168. X      merge [-N] folder-name
  1169. X
  1170. The contents of the specified folder are read into the current
  1171. folder.  If -N is not specified, a header summary is printed
  1172. for each message read (see "headers -?").
  1173. X
  1174. A list of all the merged messages is returned for use in pipes.
  1175. %%
  1176. X
  1177. %echo%
  1178. X    echo [-n] [-h | -p] args
  1179. X
  1180. Echo simply echoes the parameters to the command back to the user.
  1181. X
  1182. If the -n flag is given, then no newline is appended.
  1183. If the -h flag is given, then echo looks for formatting parameters
  1184. as if the "from" command were given on the "current" message.
  1185. If the -p flag is given, then echo looks for formatting parameters
  1186. as if your prompt were changed temporarily.
  1187. X
  1188. Examples:
  1189. X    echo -h This message is from %a and is dated %d
  1190. might produce:
  1191. X    This message is from island!argv and is dated Dec 14, 1988.
  1192. X
  1193. X    echo -p There are %n new messages to read in %f.
  1194. might produce:
  1195. X    There are 5 new messages to read in /usr/spool/mail/argv.
  1196. X
  1197. Note that -h and -p cannot be specified together.
  1198. %%
  1199. X
  1200. %undigest%
  1201. X    undigest [-m] [-p pattern] [msg_list] [filename]
  1202. X
  1203. A "digest" is a mail message which is a collection of other mail messages
  1204. mailed to a "moderator" by other users.  The moderator compiles all the
  1205. messages into a folder and sends the result to all the subscribers of the
  1206. mailing list.  The undigest command disassembles the entries into the set
  1207. of messages which comprises the digest.
  1208. X
  1209. The -m option merges these messages into the current folder.  Otherwise,
  1210. if a filename is specified, a new folder is created and the user can change
  1211. folders to read the messages separately.
  1212. X
  1213. The -p option specifies an alternate pattern to use as the digest article
  1214. separator.  The pattern must match literally at the beginning of a line.
  1215. The default pattern is "--------" (eight hyphens).
  1216. X
  1217. If a message list is specified, each digest is disassembled to the same
  1218. filename (if given).  If no filename is given and the user did not request
  1219. a merge, then a folder is created based on the subject of the digest.
  1220. %%
  1221. X
  1222. %await%
  1223. X    await [-T delay]
  1224. X
  1225. Instructs the shell to wait for new mail to arrive.  New mail is checked
  1226. every 30 seconds by default; a different delay can be specified by using
  1227. the -T option.
  1228. X
  1229. If this command is used in a pipe, its output is its input plus the list
  1230. of new messages that have arrived.  For example, to show the headers of
  1231. all new messages, and set the current message to the first new message:
  1232. X
  1233. X    await | from -
  1234. X
  1235. The await command terminates only when new mail arrives or a keyboard
  1236. interrupt is generated.
  1237. %%
  1238. X
  1239. %cd%
  1240. X      cd [directory]
  1241. X
  1242. Change the current working directory to the specified directory,
  1243. or to the user's home directory if none was given.
  1244. X
  1245. If the variable $cdpath is set to a list of directory names, and the
  1246. argument directory is not an absolute path, mush searches the cdpath
  1247. directories in the order given for the new directory and changes to
  1248. the first one found.  NOTE:  The current directory "." is always
  1249. searched first, before any directory in $cdpath.
  1250. %%
  1251. X
  1252. %pwd%
  1253. X      pwd
  1254. X
  1255. Prints the current working directory.  The variable $cwd also
  1256. holds the current working directory unless reset by the user.
  1257. %%
  1258. X
  1259. %delete%
  1260. X      delete/undelete [msg-list]
  1261. X
  1262. The "delete" command marks the listed messages as deleted.  If
  1263. no message list is given, the current message is deleted.
  1264. X
  1265. Deleted messages are not shown in the header summary display
  1266. except in curses mode and when the variable $show_deleted is set.
  1267. Deleted messages are ignored by the "pipe" command and by the
  1268. commands that display messages (see "print -?"), but most other
  1269. commands include all messages whether deleted or not.
  1270. X
  1271. Deleted messages are lost forever when the folder is updated (by
  1272. the "update" command, by changing folders without the "!" flag,
  1273. or by exiting with "quit").  Messages can be recovered by the
  1274. "undelete" command at any time BEFORE the folder is updated.
  1275. X
  1276. See also the variable $show_deleted.
  1277. %%
  1278. X
  1279. %history%
  1280. X      history [-h] [-r] [number]
  1281. X
  1282. Display the command history that mush has recorded, as in csh.
  1283. Option -h suppresses the history numbers, and option -r shows
  1284. the history in reverse order (most recent first).  If a number
  1285. is given, that many commands of history are displayed.
  1286. X
  1287. The number of commands that mush records is controlled by the
  1288. variable $history.  If $history is not set, mush saves only
  1289. the previous command (equivalent to history=1).
  1290. X
  1291. The basic forms of history reference are (N is a number and
  1292. str is any string):
  1293. X
  1294. X  !str      most recent command beginning with str
  1295. X  !?str?    most recent command containing str
  1296. X  !N        command N from the history list
  1297. X  !-N       command N previous to the current one
  1298. X  !!        previous command (same as !-1)
  1299. X  !$        last word of previous command
  1300. X  !*        all arguments of previous command
  1301. X
  1302. Modifiers (H can be str, ?str?, N or -N, n is a number or $):
  1303. X
  1304. X  !H:$      last word of referenced command
  1305. X  !H:n      n'th word of referenced command
  1306. X  !H:n-m    n'th through m'th words of command
  1307. X  !H:-n     word 0 (command name) through n of command
  1308. X  !H:*      all arguments of command (same as !H:1-$)
  1309. X  !H:n-     word n through next-to-last word
  1310. X  !H:p      print but don't execute command
  1311. X
  1312. X  !{R}str   append str to reference R (R is any form above)
  1313. X
  1314. It is not currently possible to combine :p with any of the
  1315. other modifiers.
  1316. X
  1317. Also see the variable $nonobang.
  1318. %%
  1319. X
  1320. %folders%
  1321. X      folders
  1322. X
  1323. List the files in the directory described by the variable $folder.
  1324. These files are assumed to be folders of mail messages that can
  1325. be read in by the "folder" command (see "folder -?").
  1326. X
  1327. Also see the "ls" command.
  1328. %%
  1329. X
  1330. %stty%
  1331. X      stty [options]
  1332. X
  1333. The "stty" command is equivalent to the UNIX command "stty".  All
  1334. options are the same.  Some settings are temporarily changed
  1335. while mush is running, but are restored when mush exits.
  1336. %%
  1337. SHAR_EOF
  1338. chmod 0644 cmd_help ||
  1339. echo 'restore of cmd_help failed'
  1340. Wc_c="`wc -c < 'cmd_help'`"
  1341. test 43712 -eq "$Wc_c" ||
  1342.     echo 'cmd_help: original size 43712, current size' "$Wc_c"
  1343. rm -f _shar_wnt_.tmp
  1344. fi
  1345. # ============= command2.c ==============
  1346. if test -f 'command2.c' -a X"$1" != X"-c"; then
  1347.     echo 'x - skipping command2.c (File already exists)'
  1348.     rm -f _shar_wnt_.tmp
  1349. else
  1350. > _shar_wnt_.tmp
  1351. echo 'x - extracting command2.c (Text)'
  1352. sed 's/^X//' << 'SHAR_EOF' > 'command2.c' &&
  1353. /* @(#)command2.c    (c) copyright 1991 (Dan Heller) */
  1354. X
  1355. #include "mush.h"
  1356. X
  1357. /*
  1358. X * Note that all of the routines in here act upon and return 0 or -1.
  1359. X * if -1, then the main loop will clear message lists.
  1360. X */
  1361. X
  1362. /* This is the bottom half of commands.c */
  1363. X
  1364. /*
  1365. X * Do an ls from the system.
  1366. X * Read from a popen and use wprint in case the tool does this command.
  1367. X * The folders command uses this command.
  1368. X */
  1369. ls(x, argv)
  1370. int x;
  1371. char **argv;
  1372. {
  1373. X    register char  *p, *tmp;
  1374. X    char       buf[128];
  1375. X    register FILE  *pp;
  1376. X
  1377. X    if (*++argv && !strcmp(*argv, "-?"))
  1378. X    return help(0, "ls", cmd_help);
  1379. X    p = buf + strlen(sprintf(buf, "%s -C", LS_COMMAND));
  1380. X    for ( ; *argv; ++argv) {
  1381. X    x = 0;
  1382. X    if (**argv != '-')
  1383. X        tmp = getpath(*argv, &x);
  1384. X    else
  1385. X        tmp = *argv;
  1386. X    if (x == -1) {
  1387. X        wprint("%s: %s\n", *argv, tmp);
  1388. X        return -1;
  1389. X    }
  1390. X    *p++ = ' ';
  1391. X    p += Strcpy(p, tmp);
  1392. X    }
  1393. X    if (!(pp = popen(buf, "r"))) {
  1394. X    error(buf);
  1395. X    return -1;
  1396. X    }
  1397. X    (void) do_pager(NULL, TRUE);
  1398. X    while (fgets(buf, 127, pp) && do_pager(buf, FALSE) != EOF)
  1399. X    ;
  1400. X    (void) pclose(pp);
  1401. X    (void) do_pager(NULL, FALSE);
  1402. X    return 0;
  1403. }
  1404. X
  1405. /*ARGSUSED*/
  1406. sh(un_used, argv)
  1407. int un_used;
  1408. char **argv;
  1409. {
  1410. X    register char *p;
  1411. X    char buf[128];
  1412. X
  1413. X    if (*++argv && !strcmp(*argv, "-?"))
  1414. X    return help(0, "shell", cmd_help);
  1415. X    if (!(p = do_set(set_options, "shell")))
  1416. X    p = DEF_SHELL;
  1417. X    if (!*argv)
  1418. X    if (istool) {
  1419. X        print("You can't run an interactive shell from tool mode (yet).");
  1420. X        return -1;
  1421. X    } else
  1422. X        (void) strcpy(buf, p);
  1423. X    else
  1424. X    (void) argv_to_string(buf, argv);
  1425. X    if (!istool)
  1426. X    echo_on();
  1427. X    (void) system(buf);
  1428. X    if (!istool)
  1429. X    echo_off();
  1430. X    return 0;
  1431. }
  1432. X
  1433. #ifdef SIGSTOP
  1434. stop(argc, argv)
  1435. int argc;
  1436. char **argv;
  1437. {
  1438. X    if (istool)
  1439. X    print("Not a tool-based option.");
  1440. X    if (argc && *++argv && !strcmp(*argv, "-?"))
  1441. X    return help(0, "stop", cmd_help);
  1442. X    if (kill(getpid(), SIGTSTP) == -1)
  1443. X    error("couldn't stop myself");
  1444. X    return 0;
  1445. }
  1446. #endif /* SIGSTOP */
  1447. X
  1448. extern char **environ;
  1449. static int spaces = 0;
  1450. X
  1451. Setenv(i, argv)
  1452. int i;
  1453. char **argv;
  1454. {
  1455. X    char *newstr;
  1456. X
  1457. X    if (i < 2)
  1458. X    return Printenv(i, argv);
  1459. X    else if (i > 3 || !strcmp(argv[1], "-?"))
  1460. X    return help(0, "setenv", cmd_help);
  1461. X
  1462. X    if (i == 3) {
  1463. X    if (newstr = malloc((unsigned) (strlen(argv[1]) + strlen(argv[2]) + 2)))
  1464. X        (void) sprintf(newstr, "%s=%s", argv[1], argv[2]);
  1465. X    } else {
  1466. X    if (newstr = malloc((unsigned)(strlen(argv[1]) + 2)))
  1467. X        (void) sprintf(newstr, "%s=", argv[1]);
  1468. X    }
  1469. X    if (!newstr) {
  1470. X    error("setenv: out of memory");
  1471. SHAR_EOF
  1472. true || echo 'restore of command2.c failed'
  1473. fi
  1474. echo 'End of  part 4'
  1475. echo 'File command2.c is continued in part 5'
  1476. echo 5 > _shar_seq_.tmp
  1477. exit 0
  1478. exit 0 # Just in case...
  1479. -- 
  1480. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1481. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1482. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1483. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1484.