home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume12 / mush / part19 < prev    next >
Encoding:
Text File  |  1990-05-05  |  47.1 KB  |  1,538 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v12i047: Mail User's Shell, Part19/19
  3. from: argv@Eng.Sun.COM (Dan Heller)
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 12, Issue 47
  7. Submitted-by: argv@Eng.Sun.COM (Dan Heller)
  8. Archive-name: mush/part19
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then feed it
  12. # into a shell via "sh file" or similar.  To overwrite existing files,
  13. # type "sh file -c".
  14. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  15. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  16. # If this archive is complete, you will see the following message at the end:
  17. #        "End of archive 19 (of 19)."
  18. # Contents:  mush/Gnurc mush/Mailrc mush/advanced.mushrc
  19. #   mush/bindings.h mush/config.h-dist mush/digestify mush/execute.c
  20. #   mush/glob.h mush/lock.c mush/mail.icon.1 mush/mail.icon.2
  21. #   mush/makefile.hpux mush/makefile.sys.v
  22. # Wrapped by argv@turnpike on Wed May  2 13:59:57 1990
  23. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  24. if test -f 'mush/Gnurc' -a "${1}" != "-c" ; then 
  25.   echo shar: Will not clobber existing file \"'mush/Gnurc'\"
  26. else
  27. echo shar: Extracting \"'mush/Gnurc'\" \(3198 characters\)
  28. sed "s/^X//" >'mush/Gnurc' <<'END_OF_FILE'
  29. X# .mushrc to simulate Gnu emacs (NOT Rmail!) for curses mode
  30. X# -- Bart Schaefer (schaefer@cse.ogc.edu)
  31. X#---------------------------------------------------------------------------
  32. X# Shortcomings:
  33. X#  In compose mode, can't use C-h, C-r, C-w, DEL, etc.
  34. X#  Ought to delete most of the default bindings.  If you want remove the
  35. X#   default bindings, you can:
  36. X#    Run "mush -noinit" and do a "saveopts";
  37. X#    Edit the saved file and change every "bind" to an "unbind";
  38. X#    Remove all other extranous commands;
  39. X#    Include the resulting list at the TOP of this file.
  40. X#---------------------------------------------------------------------------
  41. X#
  42. Xset no_reverse
  43. X#
  44. X# TTY setup -- you may want to customize this, because the old interrupt
  45. X#  character and so on might not be reset correctly when mush exits.
  46. X#
  47. Xcmd ntty 'stty intr ^G dsusp undef stop undef start undef lnext undef'
  48. Xcmd rtty 'stty intr ^C dsusp ^Y stop ^S start ^Q lnext ^V'
  49. Xcmd exit 'rtty; \exit'
  50. Xcmd xit exit
  51. Xcmd x exit
  52. Xcmd quit 'update; exit'
  53. Xcmd q quit
  54. Xcmd curses 'ntty; \curses; rtty'
  55. X#
  56. X# Curses mode bindings
  57. X#
  58. X# Exiting -- try to make sure tty gets reset
  59. Xbind-macro '\CX\CC' '[line-mode]exit\n'
  60. Xbind-macro x [no-op]
  61. Xbind-macro X [no-op]
  62. Xbind-macro q [no-op]
  63. Xbind-macro Q [no-op]
  64. X# Files (folders)
  65. Xbind '\CX\CF' folder
  66. Xbind '\CX\CS' update
  67. Xbind-macro '\CXi' '[line-mode]merge '
  68. Xbind '\CX\CV' folder
  69. Xbind-macro '\CX\CW' '[save-list]*\n'
  70. X# Help
  71. Xbind '\CX\CH' help    # Can't use just C-h, it's a prefix of the others
  72. Xbind-macro '\CHa' '[bind]_\n\n\CH'    # List all curses commands
  73. Xbind-macro '\CHc' '[line-mode]bind '    # Show one binding
  74. Xbind-macro '\CHf' '[line-mode]? '    # Explain line-mode function
  75. X# Error Recovery -- very primitive, sorry
  76. Xbind '\CXu' undelete-list
  77. Xbind '\C_' undelete-list
  78. X# Searching -- sorry, can't be incremental
  79. X#  also can't repeat with same key
  80. Xbind '\CS' search-next
  81. Xbind '\CR' search-back
  82. X# Motion (the important part)
  83. Xbind '\CB' back-msg
  84. Xbind '\Eb' back-msg
  85. Xbind '\CP' back-msg
  86. Xbind '\CF' next-msg
  87. Xbind '\Ef' next-msg
  88. Xbind '\CN' next-msg
  89. Xbind '\Ea' back-msg
  90. Xbind '\Ee' next-msg
  91. Xbind '\E[' top-page
  92. Xbind '\E]' bottom-page
  93. Xbind '\CX[' screen-back
  94. Xbind '\CX]' screen-next
  95. Xbind '\E<' first-msg
  96. Xbind '\E>' last-msg
  97. Xbind '\CV' screen-next
  98. Xbind '\Ev' screen-back
  99. X# Killing/deleting ("forward", i.e. at cursor, only)
  100. Xbind '\CD' delete
  101. Xbind '\Ed' delete
  102. Xbind '\CK' delete
  103. Xbind '\Ek' delete
  104. Xbind-macro '\CW' '[line-mode]delete [getstr] | set kill\n[no-op]'
  105. Xbind-macro '\CY' '[undelete-list]$kill\n'
  106. X# Marking -- somewhat limited because can't use C-SPC (C-@)
  107. Xbind-macro '\CX\CX' '[line-mode].|set mark\n[no-op]'
  108. Xbind-macro '\Eh' '[line-mode]h|set mark\n[no-op]'
  109. Xbind-macro '\CXCP' '[line-mode]h|set mark\n[no-op]'
  110. Xbind-macro '\CXh' '[line-mode]*|set mark\n[no-op]'
  111. X# Buffers -- treated same as folders
  112. Xbind '\CXb' folder
  113. Xbind-macro '\CX\CB' '[folder]?\n\CH'    # List folders and back out
  114. Xbind-macro '\CXk' '[delete-list]*\n'
  115. X# Shells
  116. Xbind-macro '\E!'\
  117. X    '[line-mode]rtty\n[shell-escape][getline][line-mode]ntty\n'
  118. Xbind-macro '\Ex!' '[line-mode]rtty;sh\n[line-mode]ntty\n'
  119. X# Macros
  120. X#  Sorry, no appending to macros, and end with <RETURN> not `C-x )'
  121. Xbind '\CX(' bind-macro
  122. X#
  123. X# Lastly, actually reset the tty
  124. X#
  125. Xif iscurses
  126. X    ntty
  127. Xendif
  128. END_OF_FILE
  129. if test 3198 -ne `wc -c <'mush/Gnurc'`; then
  130.     echo shar: \"'mush/Gnurc'\" unpacked with wrong size!
  131. fi
  132. # end of 'mush/Gnurc'
  133. fi
  134. if test -f 'mush/Mailrc' -a "${1}" != "-c" ; then 
  135.   echo shar: Will not clobber existing file \"'mush/Mailrc'\"
  136. else
  137. echo shar: Extracting \"'mush/Mailrc'\" \(1955 characters\)
  138. sed "s/^X//" >'mush/Mailrc' <<'END_OF_FILE'
  139. X# .mushrc to cause Mush to emulate UCB Mail
  140. X# -- Bart Schaefer (schaefer@cse.ogi.edu)
  141. X#
  142. X# This file can be used as either the DEFAULT_RC or the ALT_DEF_RC (see
  143. X#  config.h) but such use is NOT recommended.  Instead, you should modify
  144. X#  one of those files to "source" this file.
  145. X#
  146. X#----------------------------------------------------------------------------
  147. X# Shortcomings:
  148. X#  Mush does not support the "noisy phone line" flags of Mail
  149. X#   (-i command line option or "set ignore" to ignore RUBOUT characters)
  150. X#  Mush will never remove a system mailbox (no "unset keep" equivalent)
  151. X#  See comments below on (lack of) command prefix recognition
  152. X#----------------------------------------------------------------------------
  153. X#
  154. X# Set up prompting, headers
  155. X#
  156. Xset prompt='& '
  157. Xset mil_time date_received
  158. Xset hdr_format='%8.80a %D %M %-2N %5T  %l/%c "%.29s"'
  159. X#
  160. X# Set up mailing/replying miscellaneous
  161. X#
  162. Xset indent_str = "    "
  163. Xset reply_to_hdr auto_route
  164. X#
  165. X# Set up command interface
  166. X#  Note that a full emulation is difficult, because Mush does not support
  167. X#  command prefix recognition (e.g., Mail interprets "Rep" as "Reply").
  168. X#
  169. X# Don't barf if history doesn't work, but still do cmd expansion
  170. X#
  171. Xset nonobang
  172. X#
  173. X# This stuff is fine, but really needs prefix recognition.
  174. X#
  175. Xcmd Reply replysender
  176. Xcmd R replysender
  177. Xcmd alt alternates
  178. Xcmd chdir cd
  179. Xcmd chd cd
  180. Xcmd + next
  181. Xcmd ch cd
  182. Xcmd c copy
  183. Xcmd file folder
  184. Xcmd fi folder
  185. Xcmd hold preserve
  186. Xcmd ho hold
  187. Xcmd reply replyall
  188. Xcmd r replyall
  189. Xcmd retain "set show_hdrs='\!*'"    # Not quite right, but ...
  190. Xcmd se set
  191. Xcmd shell sh
  192. Xcmd so source
  193. Xcmd un undelete
  194. Xcmd unread 'flags \!* U'    # "unread" is undocumented in Mail
  195. Xcmd uns unset
  196. Xcmd vi v
  197. Xcmd z 'z \!* + | from -'    # "z" changes current message in Mail
  198. Xcmd z+ z
  199. Xcmd z- 'z \!* -'
  200. X#
  201. X# You may want this file sourced, especially if you are not using the
  202. X#  supplied Mushrc file as your DEFAULT_RC.
  203. X#
  204. X# set ALT_DEF_RC = "/usr/lib/Mail.rc"
  205. X# source $ALT_DEF_RC
  206. X# unset ALT_DEF_RC
  207. END_OF_FILE
  208. if test 1955 -ne `wc -c <'mush/Mailrc'`; then
  209.     echo shar: \"'mush/Mailrc'\" unpacked with wrong size!
  210. fi
  211. # end of 'mush/Mailrc'
  212. fi
  213. if test -f 'mush/advanced.mushrc' -a "${1}" != "-c" ; then 
  214.   echo shar: Will not clobber existing file \"'mush/advanced.mushrc'\"
  215. else
  216. echo shar: Extracting \"'mush/advanced.mushrc'\" \(4967 characters\)
  217. sed "s/^X//" >'mush/advanced.mushrc' <<'END_OF_FILE'
  218. X# advanced.mushrc
  219. X# by Bart Schaefer
  220. X# with special thanks to Phil Lapsley <phil@east.Berkeley.EDU>, who
  221. X# provided the original files on which this example is based.  Most of
  222. X# Phil's stuff is still here -- just reorganized and updated to use
  223. X# mush 6.4 features that were unavailable when Phil did the originals.
  224. X#
  225. X# This file is intended to demonstrate helpful ways to use the
  226. X# .mushrc, not advanced mush commands.
  227. X
  228. X# The variable $thisfolder is always set EXCEPT when the .mushrc file
  229. X# is read the first time.  A test for non-existance of $thisfolder
  230. X# allows the same .mushrc file to be sourced repeatedly without
  231. X# redundant execution of the initialization commands.
  232. X#
  233. Xif ! $?thisfolder
  234. X    # Ignore the usual stuff
  235. X    ignore    received via message-id status
  236. X    # Hide folders in ~/.mail and save read mail in spool
  237. X    set        folder=~/.mail hold
  238. X    # Remember a few commands, set up editors, act like a shell
  239. X    set        history=20 editor=ex visual=vi unix
  240. X    # Prompt has folder name, message number, history number
  241. X    set        prompt="%f %m (!) & "
  242. X    # Header summaries show name, date, and subject
  243. X    set        hdr_format="%25n %-15d  %27s"
  244. X    # Initialize the cmds below (see later comments)
  245. X    set        first_time=1
  246. X
  247. X    # These two commands are used for automated "bursting" of the spool
  248. X    # mailbox.  This means that the messages are reorganized into new
  249. X    # folders to be read in a prearranged order.  See comments below.
  250. X    #
  251. X    # n brings up the next folder, not the next message
  252. X    cmd        n    'source ~/.mushrc'
  253. X    # N gets the next folder without "bursting"
  254. X    cmd        N    'set first_time=0; source ~/.mushrc'
  255. X
  256. X    # Delete messages by pattern-matching.  Examples:
  257. X    #  del f mailer-daemon        Delete mail from mailer-daemon
  258. X    #  del t mush-users            Delete mail to mush-users
  259. X    cmd        del    'pick -i -\!* | delete'
  260. X    # Forwarding
  261. X    cmd        for    'mail -f'
  262. X    # Quick folder change
  263. X    cmd        F    'folder'
  264. X
  265. X    # Some useful aliases
  266. X    alias    dheller    'The Mush God <argv@sun.com>'
  267. X    alias    barts    'Archangel Mushael <schaefer@cse.ogi.edu>'
  268. X
  269. X    # On init, don't source beyond this point
  270. X    exit
  271. Xendif    # End of init section -- read on startup only
  272. X
  273. X# This part of the file handles "bursting".  A burst is done when the
  274. X# n cmd is used the first time.  This is most useful if you habitually
  275. X# have lots of mail when you first log in each morning; unwanted mail
  276. X# can be deleted, and other mail organized for you.
  277. X#
  278. X# The folders in this example bursting scheme are:
  279. X#    mush-users    anything to or cc'ed to mush-users
  280. X#    stats        daily stats
  281. X#    root        root mail other than daily stats
  282. X# Mail not falling into one of these categories is left in the system
  283. X# mailbox to be dealt with first.
  284. X#
  285. Xif $first_time
  286. X    # Kill off some uucp garbage
  287. X    pick -i -s "file c.* delete" | delete
  288. X    pick -i -s "file .* can.t access" | delete
  289. X    pick -i -s "remote access to path/file denied" | delete
  290. X    # Nuke the boring usenet stuff
  291. X    pick -i -f usenet | pick -i -s "uucp map for" | delete
  292. X    pick -i -t usenet | pick -i -s "returned mail" | delete
  293. X    pick -i -t usenet | pick -i -s "automatic test echo" | delete
  294. X    pick -i -t "owner-post" | pick -i -s "unknown mailer" | delete
  295. X    pick -i -s "usenet disk space report" | delete
  296. X    pick -i -s "very old news articles" | delete
  297. X    pick -i -s "uucp map for" | delete
  298. X    # Wipe out some uninteresting daily stats
  299. X    pick -i -s "the maid was here." | delete
  300. X    pick -i -s "daily accounting" | delete
  301. X    pick -i -t netsurvey | delete
  302. X    # Get rid of these things for good.  This isn't essential, but
  303. X    # avoids complexity in the later "pick" commands.
  304. X    update
  305. X    # Save anything "to" or "cc" to mush-users in that folder.
  306. X    pick -i -t mush-users | save +mush-users
  307. X    pick -i -h cc mush-users | save +mush-users
  308. X    # Also save interesting daily stat mail and generic root mail
  309. X    pick -i -f root | pick -i -s stats | save +stats
  310. X    pick -i -f root | pick -i -s report | save +stats
  311. X    pick -i -f uucp | pick -i -s report | save +stats
  312. X    pick -i -f root | pick -i -s summary | save +stats
  313. X    pick -i -f root | pick -i -s munge | save +stats
  314. X    pick -i -t root | save +root
  315. X    # Again, make the changes permanent.  Saved mail gets deleted.
  316. X    # This won't work if you have $keepsave set.
  317. X    update
  318. X
  319. X    # Make sure we don't burst again needlessly.
  320. X    set first_time=0
  321. X
  322. X    # Stop sourcing here.  Otherwise, we'd change folders without
  323. X    # handling the mail left in the system mailbox.
  324. X    exit
  325. Xendif
  326. X
  327. X# Finally, handle stepping through the folders one by one.  This has been
  328. X# set up for sendmail, where the system mailbox is /usr/spool/mail/$USER,
  329. X# but could easily be modified for other mailers.
  330. X#
  331. X# $thisfolder:t returns the tail only of the folder name.
  332. X
  333. Xif $thisfolder:t == $USER
  334. X    folder +stats
  335. X    exit
  336. Xendif
  337. X
  338. Xif $thisfolder:t == stats
  339. X    folder +mush-users
  340. X    exit
  341. Xendif
  342. X
  343. Xif $thisfolder:t == mush-users
  344. X    folder +root
  345. X    exit
  346. Xendif
  347. X
  348. X# Default back to the system mailbox
  349. Xfolder %
  350. X
  351. X# End of advanced.mushrc
  352. END_OF_FILE
  353. if test 4967 -ne `wc -c <'mush/advanced.mushrc'`; then
  354.     echo shar: \"'mush/advanced.mushrc'\" unpacked with wrong size!
  355. fi
  356. # end of 'mush/advanced.mushrc'
  357. fi
  358. if test -f 'mush/bindings.h' -a "${1}" != "-c" ; then 
  359.   echo shar: Will not clobber existing file \"'mush/bindings.h'\"
  360. else
  361. echo shar: Extracting \"'mush/bindings.h'\" \(2947 characters\)
  362. sed "s/^X//" >'mush/bindings.h' <<'END_OF_FILE'
  363. X/* bindings.h  -- command bindings */
  364. X
  365. X#define MAX_BIND_LEN 20   /* max length a string can be to bind to a command */
  366. X#define MAX_MACRO_LEN 256 /* max length of a macro bound to a command */
  367. X
  368. X/* to see if a key sequence matches, prefixes or misses a set binding */
  369. X#define NO_MATCH    0
  370. X#define MATCH        1
  371. X#define A_PREFIX_B    2
  372. X#define B_PREFIX_A    3
  373. X
  374. X/*
  375. X * Constants to define curses mode functions.
  376. X */
  377. X#ifdef NULL_MAP
  378. X#undef NULL_MAP
  379. X#endif /* NULL_MAP */
  380. X#define NULL_MAP    (struct cmd_map *)0
  381. X
  382. X#define C_ERROR        (-1L)
  383. X#define C_NULL        0L
  384. X#define C_GOTO_MSG    1L
  385. X#define C_WRITE_LIST    2L
  386. X#define C_WRITE_MSG    3L
  387. X#define C_SAVE_LIST    4L
  388. X#define C_SAVE_MSG    5L
  389. X#define C_COPY_LIST    6L
  390. X#define C_COPY_MSG    7L
  391. X#define C_DELETE_LIST    8L
  392. X#define C_DELETE_MSG    9L
  393. X#define C_UNDEL_LIST    10L
  394. X#define C_UNDEL_MSG    11L
  395. X#define C_REDRAW    12L
  396. X#define C_REVERSE    13L
  397. X#define C_NEXT_MSG    14L
  398. X#define C_PREV_MSG    15L
  399. X#define C_FIRST_MSG    16L
  400. X#define C_LAST_MSG    17L
  401. X#define C_TOP_PAGE    18L
  402. X#define C_BOTTOM_PAGE    19L
  403. X#define C_NEXT_SCREEN    20L
  404. X#define C_PREV_SCREEN    21L
  405. X#define C_SOURCE    22L
  406. X#define C_SAVEOPTS    23L
  407. X#define C_NEXT_SEARCH    24L
  408. X#define C_PREV_SEARCH    25L
  409. X#define C_CONT_SEARCH    26L
  410. X#define C_PRESERVE    27L
  411. X#define C_REV_SORT    28L
  412. X#define C_SORT        29L
  413. X#define C_QUIT_HARD    30L
  414. X#define C_QUIT        31L
  415. X#define C_EXIT_HARD    32L
  416. X#define C_EXIT        33L
  417. X#define C_UPDATE    34L
  418. X#define C_FOLDER    35L
  419. X#define C_SHELL_ESC    36L
  420. X#define C_CURSES_ESC    37L
  421. X#define C_PRINT_MSG    38L
  422. X#define C_CHDIR        39L
  423. X#define C_VAR_SET    40L
  424. X#define C_IGNORE    41L
  425. X#define C_ALIAS        42L
  426. X#define C_OWN_HDR    43L
  427. X#define C_VERSION    44L
  428. X#define C_MAIL_FLAGS    45L
  429. X#define C_MAIL        46L
  430. X#define C_REPLY_ALL    47L
  431. X#define C_REPLY_SENDER    48L
  432. X#define C_DISPLAY_NEXT    49L
  433. X#define C_DISPLAY_MSG    50L
  434. X#define C_TOP_MSG    51L
  435. X#define C_BIND_MACRO    52L
  436. X#define C_BIND        53L
  437. X#define C_UNBIND    54L
  438. X#define C_MAP_BANG    55L
  439. X#define C_MAP        56L
  440. X#define C_MACRO        57L
  441. X#define C_HELP        58L/* THIS MUST BE THE LAST ITEM */
  442. X
  443. Xstruct cmd_map {
  444. X    /* long so glob_flags can be saved in mac_stack */
  445. X    long m_cmd;   /* the command this is mapped to  */
  446. X    char *m_str;  /* the string user types (cbreak) */
  447. X    char *x_str;  /* the string executed if a macro */
  448. X    struct cmd_map *m_next;
  449. X};
  450. X
  451. X#ifdef CURSES
  452. X
  453. X/*
  454. X * Pointers to the current active command or macro and to the map list.
  455. X *  This ought to be handled by having getcmd() return struct cmd_map *,
  456. X *  but curses_command() depends too heavily on getcmd() returning int.
  457. X */
  458. Xextern struct cmd_map *active_cmd, *cmd_map;
  459. X
  460. X#endif /* CURSES */
  461. X
  462. X/* This must be OUTSIDE the #ifdef CURSES -- needed in other modes */
  463. Xextern struct cmd_map *mac_hide;
  464. X
  465. X/*
  466. X * Special bracketing recognized within an executing
  467. X *  macro as surrounding a curses function name
  468. X */
  469. X#define MAC_LONG_CMD    '['
  470. X#define MAC_LONG_END    ']'
  471. X#define MAC_GET_STR    "getstr"
  472. X#define MAC_GET_LINE    "getline"
  473. X#define MAX_LONG_CMD    32
  474. X
  475. X/*
  476. X * External declarations for map and map! purposes
  477. X */
  478. Xextern char *c_macro();
  479. Xextern struct cmd_map *line_map, *bang_map;
  480. END_OF_FILE
  481. if test 2947 -ne `wc -c <'mush/bindings.h'`; then
  482.     echo shar: \"'mush/bindings.h'\" unpacked with wrong size!
  483. fi
  484. # end of 'mush/bindings.h'
  485. fi
  486. if test -f 'mush/config.h-dist' -a "${1}" != "-c" ; then 
  487.   echo shar: Will not clobber existing file \"'mush/config.h-dist'\"
  488. else
  489. echo shar: Extracting \"'mush/config.h-dist'\" \(5391 characters\)
  490. sed "s/^X//" >'mush/config.h-dist' <<'END_OF_FILE'
  491. X/* config.h 1.1    (c) copyright 1986 (Dan Heller) */
  492. X
  493. X/* Default names and locations for files */
  494. X#define MAILRC        ".mushrc"
  495. X#define ALTERNATE_RC    ".mailrc"
  496. X#define DEFAULT_RC    "/usr/lib/Mushrc"
  497. X#define ALT_DEF_RC    "/usr/lib/Mail.rc"
  498. X#define COMMAND_HELP    "/usr/lib/cmd_help"
  499. X#ifdef SUNTOOL
  500. X#    define TOOL_HELP    "/usr/lib/tool_help"
  501. X#endif /* SUNTOOL */
  502. X#define ALTERNATE_HOME    "/tmp"       /* Path must be read/write to EVERYONE */
  503. X#define EDFILE      ".edXXXXXX"  /* file/pathname added to user's "home" */
  504. X
  505. X/*
  506. X * Define INTERNAL_MALLOC and recompile if you have trouble with mush
  507. X * core-dumping due to malloc/free errors.  Also, if you run a System 5
  508. X * variant, you might notice a performance improvement if you define this
  509. X * variable.  It uses the malloc distributed by Larry Wall for perl v2.
  510. X */
  511. X/* #define INTERNAL_MALLOC /**/
  512. X
  513. X/*
  514. X * Define TIMEZONE if your system has neither the SysV external variable
  515. X * tzname nor the BSD timezone() function.  The example below is for
  516. X * Gould BSD4.3 systems; others should define it as a string, e.g. "PST"
  517. X * If TIMEZONE is defined, DAYLITETZ can also be defined, e.g. "PDT"
  518. X */
  519. X/* #define TIMEZONE T->tm_zone /**/
  520. X
  521. X/* mail delivery system macros and defines... */
  522. X
  523. X/*
  524. X * If you are using MMDF, define MMDF here.
  525. X */
  526. X/* #define MMDF /**/
  527. X#ifdef MMDF
  528. X/*
  529. X * If MMDF delivers mail the user's home directory, define HOMEMAIL.
  530. X * Also check the definition of the delivery file name MAILFILE, below.
  531. X */
  532. X/* #define HOMEMAIL /**/
  533. X#define MAIL_DELIVERY    "exec /usr/mmdf/bin/submit -mlnr"
  534. X#define VERBOSE_ARG    "Ww"
  535. X#define MTA_EXIT    9    /* exit status for successful submit */
  536. X#else /* MMDF */
  537. X/*
  538. X * If you are not using MMDF, check these definitions.
  539. X */
  540. X#define MAIL_DELIVERY    "/usr/lib/sendmail -i" /* "-i" works like "-oi" */
  541. X#define VERBOSE_ARG    "-v"    /* undef if none exists */
  542. X#define METOO_ARG    "-m"    /* man sendmail for more info. */
  543. X#define MTA_EXIT    0    /* exit status for successful mail delivery */
  544. X#endif /* MMDF */
  545. X
  546. X/* If your mail transfer agent uses something *besides* "From " to separate
  547. X * adjacent messages in a folder, define MSG_SEPARATOR to be this string.
  548. X * If that string is 4 ^A's, then the string would be "\001\001\001\001".
  549. X * With the exception of MMDF, below, you should OMIT a trailing newline
  550. X * from the setting of MSG_SEPARATOR.
  551. X * If you don't know what any of this means, leave it alone.
  552. X */
  553. X/* #define MSG_SEPARATOR "From " /**/
  554. X#ifdef MMDF
  555. X/*
  556. X * These values should be identical (respectively) to the contents of
  557. X * delim1 and delim2 in MMDFSRC/conf/yoursite/conf.c (sans newline).
  558. X */
  559. X#define MSG_SEPARATOR    "\001\001\001\001\n"
  560. X#define END_MSG_SEP    "\001\001\001\001\n"
  561. X/*
  562. X * You only need to define LCKDFLDIR if you have MMDF configured to use the
  563. X * locking routines in lib/util/lk_lock.c (ie., link(2)-based locking).
  564. X * Most of you WILL NOT need this, since you probably use one of the more
  565. X * sophisticated locking modules provided with MMDF.  Remember to alter the
  566. X * Makefile so as to access the MMDF library at the link step.
  567. X */
  568. X/* #define LCKDFLDIR    "/usr/spool/mmdf/lockfiles" /* (for example) */
  569. X#else /* !MMDF */
  570. X#ifdef M_XENIX
  571. X#define DOT_LOCK    /* DOT_LOCK should be used for SCO Xenix */
  572. X#endif /* M_XENIX */
  573. X#endif /* MMDF */
  574. X
  575. X/* If your mailer does not understand commas between addresses, you should
  576. X * define NO_COMMAS.  This includes pre-3.0 smail and default MTAs used on
  577. X * xenix, and sys-v systems.
  578. X * This does NOT apply to MMDF or sendmail.
  579. X */
  580. X/* #define NO_COMMAS /**/
  581. X
  582. X/*
  583. X * Most RFC822 compliant mailers (sendmail) will add the headers From:
  584. X * and Date: on outgoing mail.  If the user or UA sends these headers,
  585. X * most MTAs will not append them automatically.  However, there are
  586. X * certain MTAs which will not allow this -- these "picky mailers" will
  587. X * precede such headers with a '>' and make the headers very ugly and
  588. X * somewhat redundant or contradictory.  It is advisable to set this
  589. X * *UNLESS* your MTA is not RFC822 compiant -- therefore you should NOT
  590. X * set this (xenix, sys-v).
  591. X */
  592. X/* #define PICKY_MAILER /**/
  593. X
  594. X/* Headers that will NOT be included when forwarding mail */
  595. X#define IGNORE_ON_FWD    "status"    /* comma or space separated list */
  596. X
  597. X#define    MAXMSGS        1000    /* maximum number of messages we can read */
  598. X#define HDRSIZ BUFSIZ    /* This should not be < BUFSIZ! (but can be >) */
  599. X
  600. X/* If your system supports the vprintf() functions, True for sys-v and
  601. X * later sun versions (3.0+ ?).  Typically not true for BSD systems, but
  602. X * that will probably change in the future.
  603. X */
  604. X#if defined(SYSV) || defined(sun)
  605. X#define VPRINTF
  606. X#endif /* SYSV || sun */
  607. X
  608. X#define LS_COMMAND    "ls"
  609. X#define FORTUNE        "/usr/games/fortune"
  610. X#define LPR        "lpr"
  611. X#define SIGNATURE    ".signature"
  612. X#ifdef HOMEMAIL
  613. X#define MAILFILE    "Mailbox"    /* or whatever */
  614. X#else /* HOMEMAIL */
  615. X#define MAILDIR        "/usr/spool/mail"
  616. X#endif /* HOMEMAIL */
  617. X
  618. X/* default settings for some variable strings */
  619. X#define DEF_PROMPT    "Msg %m of %t: "
  620. X#define DEF_PAGER    "more" /* set to "internal" to use internal pager */
  621. X#define DEF_SHELL    "csh"
  622. X#define DEF_EDITOR    "vi"
  623. X#define DEF_FOLDER    "~/Mail"        /* default Mail folder */
  624. X#define DEF_MBOX    "~/mbox"    /* default mbox */
  625. X#define DEF_INDENT_STR    "> "        /* indent included mail */
  626. X#define DEF_PRINTER    "lp"
  627. X#define DEF_ESCAPE    "~"
  628. X#define DEF_HDR_FMT    "%25f %7d (%l/%c) \"%s\"" /* default hdr_format */
  629. X#define DEF_CURSES_HELP    \
  630. X    "display save mail reply next-msg back-msg screen-next screen-back"
  631. END_OF_FILE
  632. if test 5391 -ne `wc -c <'mush/config.h-dist'`; then
  633.     echo shar: \"'mush/config.h-dist'\" unpacked with wrong size!
  634. fi
  635. # end of 'mush/config.h-dist'
  636. fi
  637. if test -f 'mush/digestify' -a "${1}" != "-c" ; then 
  638.   echo shar: Will not clobber existing file \"'mush/digestify'\"
  639. else
  640. echo shar: Extracting \"'mush/digestify'\" \(3468 characters\)
  641. sed "s/^X//" >'mush/digestify' <<'END_OF_FILE'
  642. X#! ../bin/mush -F!
  643. X#
  644. X# Mush digestifier.  Makes a folder or a list of messages into a digest.
  645. X#
  646. X# A "digest" is a collection of E-mail messages bundled together into a
  647. X# single message for ease of redistribution.  The individual messages
  648. X# in the digest are called "articles".  Each article has a small set of
  649. X# essential headers (usually From:, Date:, and Subject:) and is divided
  650. X# from the preceding and following articles by an "article separator"
  651. X# string (usually eight hyphens, "--------").  The Mush built-in command
  652. X# "undigest" unpacks most digests, including those made by this script.
  653. X#
  654. X# Usage:
  655. X#  From your shell:        digestify -f mailbox
  656. X#  From within mush:    
  657. X#    First:        cmd digest "set digest = '\!*' ; source digestify"
  658. X#    Then:        digest [msg-list]
  659. X#    Or:        message-selection-command | digest
  660. X#
  661. X# Note that by default it makes a digest of the ENTIRE folder!
  662. X#
  663. X
  664. X#
  665. X# Rudimentary sanity checks
  666. X#
  667. Xif ! $?version
  668. X    echo "You must have Mush version 7.0 or higher to run this script"
  669. X    exit
  670. Xendif
  671. Xif ! $?thisfolder
  672. X    echo "You can't use this script as an init file; try using -F"
  673. X    exit
  674. Xendif
  675. X
  676. X#
  677. X# Set up defaults
  678. X#
  679. Xif ! $?digest
  680. X    set digest = *
  681. X    if $?interact
  682. X    unset interact        # Assume non-interactive if no input list
  683. X    endif
  684. Xelse
  685. X    set interact        # Note that this is interactive
  686. X    if "X$digest" == X
  687. X        set digest = *        # Default to all messages for empty input
  688. X    else
  689. X    $digest | set digest    # Pre-expand message numbers
  690. X    endif
  691. Xendif
  692. X
  693. X#
  694. X# Suppress any "that isn't set" messages from "unset"
  695. X#
  696. Xif $?warning
  697. X    set savewarn
  698. Xendif
  699. Xunset warning oldpre oldpost oldindent oldign oldshow
  700. X
  701. X#
  702. X# Save everything in case the user wants it back.
  703. X# Could wrap all this with "if $?interact" but this script
  704. X# might be read by "mush -F", in which case we need this.
  705. X#
  706. Xif $?pre_indent_str
  707. X    set oldpre = "$pre_indent_str"
  708. Xendif
  709. Xif $?post_indent_str
  710. X    set oldpost = "$post_indent_str"
  711. Xendif
  712. Xif $?indent_str
  713. X    set oldindent = "$indent_str"
  714. Xendif
  715. Xif $?alwaysignore
  716. X    set oldign = "$alwaysignore"
  717. Xendif
  718. Xif $?show_hdrs
  719. X    set oldshow = "$show_hdrs"
  720. Xendif
  721. Xif $?quiet
  722. X    set oldquiet = "$quiet"
  723. Xendif
  724. Xif $?no_expand
  725. X    set savenoex
  726. Xendif
  727. X
  728. X#
  729. X# Prepare to form the digest.
  730. X#
  731. Xset indent_str no_expand alwaysignore=include quiet=await,newmail
  732. Xunset post_indent_str
  733. Xalias DIGEST $thisfolder        # Any target in place of $thisfolder
  734. Xset pre_indent_str="--------"        # Insert your digest separator here
  735. Xset show_hdrs=from,date,subject        # Add any other headers you want
  736. X
  737. X#
  738. X# Now do it.  All that work for a two-line operation ....
  739. X# NOTE: If you change DIGEST above, remove the "await" command here!
  740. X# Backslashes prevent any cmd expansion from confusing us.
  741. X#
  742. X\delete $digest
  743. X\mail -UH /dev/null -I $digest -s "Digest of $thisfolder" DIGEST; \await -T 1
  744. X
  745. X#
  746. X# Clean out the deleted stuff if not interactive
  747. X#
  748. Xif ! $?interact
  749. X    \update
  750. Xendif
  751. X
  752. X#
  753. X# Be neat and put everything back the way it was.
  754. X#
  755. Xunset indent_str no_expand alwaysignore quiet pre_indent_str show_hdrs
  756. Xunalias DIGEST
  757. Xif $?savenoex
  758. X    set no_expand
  759. Xendif
  760. Xif $?oldquiet
  761. X    set quiet = "$oldquiet"
  762. Xendif
  763. Xif $?oldpre
  764. X    set pre_indent_str = "$oldpre"
  765. Xendif
  766. Xif $?oldpost
  767. X    set post_indent_str = "$oldpost"
  768. Xendif
  769. Xif $?oldindent
  770. X    set indent_str = "$oldindent"
  771. Xendif
  772. Xif $?oldign
  773. X    set alwaysignore = "$oldign"
  774. Xendif
  775. Xif $?oldshow
  776. X    set show_hdrs = "$oldshow"
  777. Xendif
  778. Xunset oldpre oldpost oldindent oldign oldshow oldquiet nonoex digest
  779. Xif $?savewarn
  780. X    unset savewarn
  781. X    set warning
  782. Xendif
  783. END_OF_FILE
  784. if test 3468 -ne `wc -c <'mush/digestify'`; then
  785.     echo shar: \"'mush/digestify'\" unpacked with wrong size!
  786. fi
  787. chmod +x 'mush/digestify'
  788. # end of 'mush/digestify'
  789. fi
  790. if test -f 'mush/execute.c' -a "${1}" != "-c" ; then 
  791.   echo shar: Will not clobber existing file \"'mush/execute.c'\"
  792. else
  793. echo shar: Extracting \"'mush/execute.c'\" \(4203 characters\)
  794. sed "s/^X//" >'mush/execute.c' <<'END_OF_FILE'
  795. X/* execute.c     (c) copyright    10/28/86 (Dan Heller) */
  796. X
  797. X#include "mush.h"
  798. X#ifdef BSD
  799. X#include <sys/wait.h>
  800. X#else
  801. X#ifndef SYSV
  802. X#include <wait.h>
  803. X#endif /* SYSV */
  804. X#endif /* BSD */
  805. X
  806. X#ifdef lint
  807. X#include <sys/resource.h>
  808. X#endif /* lint */
  809. X
  810. Xstatic jmp_buf execjbuf;
  811. X
  812. X#ifdef SUNTOOL
  813. X
  814. X/*ARGSUSED*/
  815. Xstatic
  816. XNotify_value
  817. Xmy_wait3(tty, pid, status, rusage)
  818. XTty tty;
  819. Xint pid;
  820. Xunion wait *status;
  821. Xstruct rusage *rusage;
  822. X{
  823. X    extern Panel_item edit_item;
  824. X    Textsw textsw = (Textsw)window_get(tty, WIN_CLIENT_DATA);
  825. X    char *file = (char *)window_get(textsw, TEXTSW_CLIENT_DATA);
  826. X    int i = 0;
  827. X
  828. X    if (WIFSTOPPED(*status)) {
  829. X    kill(pid, SIGCONT);
  830. X    return (NOTIFY_IGNORED);
  831. X    }
  832. X    if (pid != exec_pid || exec_pid <= 0) /* if the editor didn't die, return */
  833. X    return NOTIFY_DONE;
  834. X    /* editor died -- reset exec_pid so no one thinks we're running */
  835. X    exec_pid = 0;
  836. X    (void) window_set(tty, TTY_ARGV, TTY_ARGV_DO_NOT_FORK, NULL);
  837. X    wprint("Editor done.\n");
  838. X    (void) window_set(tty_sw, WIN_SHOW, FALSE, NULL);
  839. X#ifdef SUN_4_0 /* SunOS 4.0+ */
  840. X    (void) window_set(textsw,
  841. X    WIN_SHOW,        TRUE,
  842. X    TEXTSW_FILE_CONTENTS,    file,
  843. X    NULL);
  844. X#else /* SUN_4_0 */
  845. X    textsw_load_file(textsw, file, 1, 0, 0);
  846. X    textsw_set(textsw, WIN_SHOW, TRUE, NULL);
  847. X#endif /* SUN_4_0 */
  848. X    textsw_normalize_view(textsw, (Textsw_index)0);
  849. X    (void) unlink(file);
  850. X    set_comp_items(panel_get(edit_item, PANEL_PARENT_PANEL));
  851. X
  852. X    return NOTIFY_DONE;
  853. X}
  854. X
  855. Xtool_edit_letter(textsw, argv)
  856. XTextsw textsw;
  857. Xchar **argv;
  858. X{
  859. X    Rect *msg_rect = (Rect *)window_get(textsw, WIN_RECT);
  860. X
  861. X    wprint("Starting \"%s\"...\n", *argv);
  862. X#ifdef SUN_4_0
  863. X    window_set(textsw, WIN_SHOW, FALSE, NULL);
  864. X#else /* SUN_4_0 */
  865. X    textsw_set(textsw, WIN_SHOW, FALSE, NULL);
  866. X#endif /* SUN_4_0 */
  867. X    ttysw_output(tty_sw, "\f", 1);  /* clear screen */
  868. X    (void) window_set(tty_sw,
  869. X    WIN_RECT,    msg_rect,
  870. X    TTY_ARGV,    argv,
  871. X    WIN_SHOW,    TRUE,
  872. X    NULL);
  873. X    if ((exec_pid = (int) window_get(tty_sw, TTY_PID)) == -1) {
  874. X    error("Couldn't execute %s", *argv);
  875. X    return -1;
  876. X    }
  877. X    notify_set_wait3_func(tty_sw, my_wait3, exec_pid);
  878. X    Debug("tty pid = %d\n", exec_pid);
  879. X    return 0;
  880. X}
  881. X#endif /* SUNTOOL */
  882. X
  883. Xexecute(argv)
  884. Xchar **argv;
  885. X{
  886. X#ifdef SYSV
  887. X    int status;
  888. X#else
  889. X    union wait status;
  890. X#endif /* SYSV */
  891. X#ifdef SIGCONT
  892. X    SIGRET (*oldstop)(), (*oldcont)();
  893. X#endif /* SIGCONT */
  894. X    int pid;
  895. X    SIGRET (*oldint)(), (*oldquit)();
  896. X
  897. X    oldint = signal(SIGINT, SIG_IGN);
  898. X    oldquit = signal(SIGQUIT, SIG_IGN);
  899. X#ifdef SIGCONT
  900. X    oldstop = signal(SIGTSTP, SIG_DFL);
  901. X    oldcont = signal(SIGCONT, SIG_DFL);
  902. X#endif /* SIGCONT */
  903. X    turnon(glob_flags, IGN_SIGS);
  904. X
  905. X    echo_on();
  906. X    if (!setjmp(execjbuf)) {
  907. X    if ((exec_pid = vfork()) == 0) {
  908. X        (void) signal(SIGINT, SIG_DFL);
  909. X        (void) signal(SIGQUIT, SIG_DFL);
  910. X        (void) signal(SIGPIPE, SIG_DFL);
  911. X        (void) closefileds(3);    /* close all descriptors above 2 */
  912. X        execvp(*argv, argv);
  913. X        if (errno == ENOENT)
  914. X        print("%s: command not found.\n", *argv);
  915. X        else
  916. X        error(*argv);
  917. X        _exit(-1);
  918. X    }
  919. X    /* Parent's got to do something; sigchldcatcher may also be waiting.
  920. X     * This loop will usually get broken by the longjmp() (except tool),
  921. X     * but in certain circumstances sigchldcatcher isn't yet active.
  922. X     */
  923. X    while ((pid = wait(&status)) != -1 && pid != exec_pid)
  924. X        Debug("The exec loop caught a signal? (pid = %d)\n", pid);
  925. X    }
  926. X    /* reset our ttymodes */
  927. X    echo_off();
  928. X    (void) signal(SIGINT, oldint);
  929. X    (void) signal(SIGQUIT, oldquit);
  930. X#ifdef SIGCONT
  931. X    (void) signal(SIGTSTP, oldstop);
  932. X    (void) signal(SIGCONT, oldcont);
  933. X#endif /* SIGCONT */
  934. X    turnoff(glob_flags, IGN_SIGS);
  935. X}
  936. X
  937. XSIGRET
  938. Xsigchldcatcher()
  939. X{
  940. X#ifdef SYSV
  941. X    int status;
  942. X#else
  943. X    union wait status;
  944. X#endif /* SYSV */
  945. X    int       pid;
  946. X
  947. X#ifdef BSD
  948. X    while ((pid = wait3(&status, WNOHANG, (struct rusage *)0)) > 0) {
  949. X    Debug("%d died...\n", pid);
  950. X    if (pid == exec_pid)
  951. X        break;
  952. X    }
  953. X#else
  954. X#ifndef SYSV
  955. X    while ((pid = wait2(&status, WNOHANG)) > 0 && pid != exec_pid)
  956. X    Debug("%d died...\n", pid);
  957. X#else /* SYSV */
  958. X    while ((pid = wait((int *)0)) > 0 && pid != exec_pid)
  959. X    Debug("%d died...\n", pid);
  960. X#endif /* SYSV */
  961. X#endif /* BSD */
  962. X    if (pid == exec_pid && pid > 0) {
  963. X    exec_pid = 0;
  964. X    longjmp(execjbuf, 1);
  965. X    }
  966. X}
  967. END_OF_FILE
  968. if test 4203 -ne `wc -c <'mush/execute.c'`; then
  969.     echo shar: \"'mush/execute.c'\" unpacked with wrong size!
  970. fi
  971. # end of 'mush/execute.c'
  972. fi
  973. if test -f 'mush/glob.h' -a "${1}" != "-c" ; then 
  974.   echo shar: Will not clobber existing file \"'mush/glob.h'\"
  975. else
  976. echo shar: Extracting \"'mush/glob.h'\" \(1985 characters\)
  977. sed "s/^X//" >'mush/glob.h' <<'END_OF_FILE'
  978. X#ifdef BSD
  979. X#define DIRECTORY
  980. X#endif /* BSD */
  981. X
  982. X#ifdef DIRECTORY
  983. X#include <sys/dir.h>
  984. X#define dirent direct
  985. X#else /* !DIRECTORY */
  986. X
  987. X/*
  988. X *  4.2BSD directory access emulation for non-4.2 systems.
  989. X *  Based upon routines in appendix D of Portable C and Unix System
  990. X *  Programming by J. E. Lapin (Rabbit Software).
  991. X *
  992. X *  No responsibility is taken for any error in accuracies inherent
  993. X *  either to the comments or the code of this program, but if
  994. X *  reported to me then an attempt will be made to fix them.
  995. X */
  996. X
  997. X#ifndef  DEV_BSIZE
  998. X#define  DEV_BSIZE  512           /* Device block size. */
  999. X#endif
  1000. X
  1001. X#define  DIRBLKSIZ  DEV_BSIZE
  1002. X#define  MAXNAMLEN  255           /* Name must be no longer than this. */
  1003. X
  1004. Xstruct dirent
  1005. X{
  1006. X  long  d_fileno ;                /* Inode number of entry. */
  1007. X  short d_reclen ;                /* Length of this record. */
  1008. X  short d_namlen ;                /* Length of d_name string. */
  1009. X  char  d_name[MAXNAMLEN + 1] ;   /* Directory name. */
  1010. X} ;
  1011. X
  1012. X/*  The DIRSIZ macro gives the minimum record length that will hold the
  1013. X *  directory entry. This requires the amount of space in struct direct
  1014. X *  without the d_name field, plus enough space for the name with a
  1015. X *  terminating null byte (dp->d_namlen+1), rounded up to a 4 byte
  1016. X *  boundary.
  1017. X */
  1018. X
  1019. X#undef   DIRSIZ
  1020. X#define  DIRSIZ(dp)                                \
  1021. X         ((sizeof (struct dirent) - (MAXNAMLEN+1)) \
  1022. X         + (((dp)->d_namlen+1 + 3) &~ 3))
  1023. X
  1024. X/*  Definitions for library routines operating on directories. */
  1025. X
  1026. Xtypedef struct _dirdesc
  1027. X{
  1028. X  int    dd_fd ;
  1029. X  long   dd_loc ;
  1030. X  long   dd_size ;
  1031. X  char   dd_buf[DIRBLKSIZ] ;
  1032. X} DIR ;
  1033. X
  1034. X#ifndef  NULL
  1035. X#define  NULL  0
  1036. X#endif
  1037. X
  1038. Xextern  DIR              *opendir() ;
  1039. Xextern  struct dirent    *readdir() ;
  1040. Xextern  long             telldir() ;
  1041. Xextern  void             seekdir() ;
  1042. X#define rewinddir(dirp)  seekdir((dirp), (long) 0)
  1043. Xextern  void             closedir() ;
  1044. X
  1045. X#endif /* DIRECTORY */
  1046. X
  1047. X#define DELIM " \t;|"
  1048. X#define META "/?*[{"
  1049. X#define FMETA "?*[{"
  1050. END_OF_FILE
  1051. if test 1985 -ne `wc -c <'mush/glob.h'`; then
  1052.     echo shar: \"'mush/glob.h'\" unpacked with wrong size!
  1053. fi
  1054. # end of 'mush/glob.h'
  1055. fi
  1056. if test -f 'mush/lock.c' -a "${1}" != "-c" ; then 
  1057.   echo shar: Will not clobber existing file \"'mush/lock.c'\"
  1058. else
  1059. echo shar: Extracting \"'mush/lock.c'\" \(4593 characters\)
  1060. sed "s/^X//" >'mush/lock.c' <<'END_OF_FILE'
  1061. X/*
  1062. X * lock.c -- deal with file locking on various architectures and UNIXs.
  1063. X * dot_lock() creates a file with the same name as the parameter passed
  1064. X * with the appendage ".lock" -- this is to be compatible with certain
  1065. X * systems that don't use flock or lockf or whatever they have available
  1066. X * that they don't use.
  1067. X */
  1068. X
  1069. X#ifdef USG
  1070. X#include <unistd.h>
  1071. X#endif /* USG */
  1072. X#include "mush.h"
  1073. X#if defined(SYSV) && !defined(USG)
  1074. X#include <sys/locking.h>
  1075. X#endif /* SYSV && !USG */
  1076. X
  1077. X#ifdef DOT_LOCK
  1078. Xextern int sgid;
  1079. X#ifdef BSD
  1080. Xextern int rgid;
  1081. X#endif /* BSD */
  1082. X
  1083. Xdot_lock(filename)
  1084. Xchar *filename;
  1085. X{
  1086. X    char buf[MAXPATHLEN];
  1087. X    int lockfd, cnt = 0;
  1088. X    SIGRET (*oldint)(), (*oldquit)();
  1089. X
  1090. X#ifdef SYSV
  1091. X    /* Only the spoolfile needs to be dot_locked -- other files are
  1092. X     * handled by lock_fopen, below.  To avoid collisions with 14-char
  1093. X     * file name limits, we allow dot_locking ONLY of the spoolfile.
  1094. X     */
  1095. X    if (strcmp(spoolfile, filename) != 0)
  1096. X    return 0;
  1097. X#endif
  1098. X#ifdef BSD
  1099. X    setregid(rgid, sgid);
  1100. X#else /* BSD */
  1101. X    setgid(sgid);
  1102. X#endif /* BSD */
  1103. X#ifdef M_XENIX
  1104. X    (void) sprintf(buf, "/tmp/%.10s.mlk", login);
  1105. X#else /* M_XENIX */
  1106. X    (void) sprintf(buf, "%s.lock", filename);
  1107. X#endif /* M_XENIX */
  1108. X    on_intr();
  1109. X    while ((lockfd = open(buf, O_CREAT|O_WRONLY|O_EXCL, 0444)) == -1) {
  1110. X    if (errno != EEXIST) {
  1111. X        error("unable to lock %s", filename);
  1112. X        break;
  1113. X    }
  1114. X    if (cnt++ == 0)
  1115. X        print("%s already locked, waiting", filename);
  1116. X    else
  1117. X        print_more(".");
  1118. X    sleep(1);
  1119. X    if (ison(glob_flags, WAS_INTR)) {
  1120. X        print_more("\nAborted.\n");
  1121. X        break;
  1122. X    }
  1123. X    }
  1124. X    off_intr();
  1125. X    if (lockfd != -1) {
  1126. X    if (cnt)
  1127. X        print("done.\n");
  1128. X    (void) close(lockfd);
  1129. X    }
  1130. X#ifdef BSD
  1131. X    setregid(sgid, rgid);
  1132. X#else
  1133. X    setgid(getgid());
  1134. X#endif /* BSD */
  1135. X    return lockfd == -1? -1 : 0;
  1136. X}
  1137. X#endif /* DOT_LOCK */
  1138. X
  1139. X#ifdef SYSV
  1140. X
  1141. X/*
  1142. X * Define some BSD names for the SYSV world
  1143. X */
  1144. X#ifdef USG
  1145. X#define LOCK_SH F_RDLCK
  1146. X#define LOCK_EX F_WRLCK
  1147. X#define LOCK_UN F_UNLCK
  1148. X#else /* USG */
  1149. X#define LOCK_SH LK_LOCK
  1150. X#define LOCK_EX LK_LOCK
  1151. X#define LOCK_UN LK_UNLCK
  1152. X#endif /* USG */
  1153. X#define LOCK_NB 0    /* Always non-blocking in this case */
  1154. X
  1155. X#ifdef HPUX
  1156. X#undef EWOULDBLOCK
  1157. X#endif /* HPUX */
  1158. X#define EWOULDBLOCK    EAGAIN
  1159. X
  1160. Xflock(fd, op)
  1161. Xint fd, op;
  1162. X{
  1163. X#ifndef USG
  1164. X    (void) locking(fd, op, 0); /* old xenix (sys III) */
  1165. X    return 0;
  1166. X#else
  1167. X    struct flock l;
  1168. X
  1169. X    l.l_len = 0L;
  1170. X    l.l_start = 0L;
  1171. X    l.l_whence = 1;
  1172. X    l.l_type = op;
  1173. X
  1174. X    return fcntl(fd, F_SETLK, &l);
  1175. X#endif /* USG */
  1176. X}
  1177. X
  1178. X#endif /* SYSV */
  1179. X
  1180. XFILE *
  1181. Xlock_fopen(filename, mode)
  1182. Xchar *filename;
  1183. Xchar *mode;
  1184. X{
  1185. X    FILE *mail_fp = NULL_FILE;
  1186. X#ifndef LCKDFLDIR
  1187. X    int fd, lk;
  1188. X    int cnt = 0;
  1189. X    SIGRET (*oldint)(), (*oldquit)();
  1190. X#else /* LCKDFLDIR */
  1191. X    extern FILE *lk_fopen();
  1192. X#endif /* !LCKDFLDIR */
  1193. X
  1194. X    if (debug && do_set(set_options, "deadlock")) {
  1195. X    (void) un_set(&set_options, "deadlock");
  1196. X    return NULL_FILE;
  1197. X    }
  1198. X
  1199. X#ifdef LCKDFLDIR
  1200. X    return lk_fopen(filename, mode, NULL, NULL, 0);
  1201. X#else /* !LCKDFLDIR */
  1202. X
  1203. X#ifdef DOT_LOCK
  1204. X    if (dot_lock(filename) == 0)
  1205. X#endif /* DOT_LOCK */
  1206. X    mail_fp = mask_fopen(filename, mode);
  1207. X    if (!mail_fp)
  1208. X    return NULL_FILE;
  1209. X    fd = fileno(mail_fp);
  1210. X
  1211. X    if (mode[0] != 'r' || mode[1] == '+')
  1212. X    lk = LOCK_EX | LOCK_NB;
  1213. X    else
  1214. X    lk = LOCK_SH | LOCK_NB;
  1215. X
  1216. X    on_intr();
  1217. X    while (isoff(glob_flags, WAS_INTR) && flock(fd, lk)) {
  1218. X    if (errno == EWOULDBLOCK) {
  1219. X        if (isoff(glob_flags, REDIRECT))
  1220. X        if (!cnt++)
  1221. X            print("\nwaiting to lock");
  1222. X        else
  1223. X            print(".");
  1224. X    } else {
  1225. X        error("Unable to lock \"%s\"", filename);
  1226. X        (void) fclose(mail_fp);
  1227. X        off_intr();
  1228. X        return NULL_FILE;
  1229. X    }
  1230. X    (void) fflush(stdout);
  1231. X    sleep(1);
  1232. X    }
  1233. X    if (cnt)
  1234. X    print("\n");
  1235. X    cnt = (ison(glob_flags, WAS_INTR) != 0);
  1236. X    off_intr();
  1237. X    if (cnt) {
  1238. X    (void) fclose(mail_fp);
  1239. X    return NULL_FILE;
  1240. X    }
  1241. X    return mail_fp;
  1242. X#endif /* LCKDFLDIR */
  1243. X}
  1244. X
  1245. X/*ARGSUSED*/
  1246. Xclose_lock(filename, fp)
  1247. Xchar *filename;
  1248. XFILE *fp;
  1249. X#ifdef LCKDFLDIR
  1250. X{
  1251. X    return lk_fclose(fp, filename, NULL, NULL);
  1252. X}
  1253. X#else /* !LCKDFLDIR */
  1254. X{
  1255. X#ifdef DOT_LOCK
  1256. X    char buf[MAXPATHLEN];
  1257. X#endif /* DOT_LOCK */
  1258. X
  1259. X    fflush(fp);
  1260. X#ifdef DOT_LOCK
  1261. X#ifdef BSD
  1262. X    setregid(rgid, sgid);
  1263. X#else
  1264. X    setgid(sgid);
  1265. X#endif /* BSD */
  1266. X#ifdef SYSV
  1267. X    if (strcmp(spoolfile, filename) == 0)
  1268. X#endif /* SYSV */
  1269. X#ifdef M_XENIX
  1270. X    (void) unlink(sprintf(buf, "/tmp/%.10s.mlk", login));
  1271. X#else /* M_XENIX */
  1272. X    (void) unlink(sprintf(buf, "%s.lock", filename));
  1273. X#endif /* M_XENIX */
  1274. X#ifdef BSD
  1275. X    setregid(sgid, rgid);
  1276. X#else
  1277. X    setgid(getgid());
  1278. X#endif /* BSD */
  1279. X#endif /* DOT_LOCK */
  1280. X
  1281. X    (void) flock(fileno(fp), LOCK_UN);
  1282. X    return fclose(fp);
  1283. X}
  1284. X#endif /* LCKDFLDIR */
  1285. END_OF_FILE
  1286. if test 4593 -ne `wc -c <'mush/lock.c'`; then
  1287.     echo shar: \"'mush/lock.c'\" unpacked with wrong size!
  1288. fi
  1289. # end of 'mush/lock.c'
  1290. fi
  1291. if test -f 'mush/mail.icon.1' -a "${1}" != "-c" ; then 
  1292.   echo shar: Will not clobber existing file \"'mush/mail.icon.1'\"
  1293. else
  1294. echo shar: Extracting \"'mush/mail.icon.1'\" \(1933 characters\)
  1295. sed "s/^X//" >'mush/mail.icon.1' <<'END_OF_FILE'
  1296. X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
  1297. X */
  1298. X    0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x0000,0x0000,0x0001,
  1299. X    0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
  1300. X    0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
  1301. X    0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
  1302. X    0x8000,0x0000,0x0000,0x0001,0x8000,0x1FFF,0xFFFF,0xFE01,
  1303. X    0x8000,0xFE00,0x0000,0x0181,0x8007,0x01C0,0x0000,0x0061,
  1304. X    0x8018,0x0030,0x0000,0x0011,0x8020,0x7008,0x0000,0x0011,
  1305. X    0x80C1,0xFC06,0x0000,0x0009,0x8101,0xFC01,0x0000,0x0009,
  1306. X    0x8103,0xFE01,0x0000,0x0005,0x8203,0xFE00,0x8000,0x0005,
  1307. X    0x8403,0xFE00,0x4000,0x0005,0x8401,0xFC00,0x4000,0x0005,
  1308. X    0x8801,0xFC00,0x2000,0x0005,0x8800,0x7000,0x2000,0x0005,
  1309. X    0x8800,0x0000,0x3000,0x0005,0x9000,0x0000,0x1000,0x0005,
  1310. X    0x9000,0x0000,0x1000,0x0005,0x93FF,0xFFFF,0x9000,0x0025,
  1311. X    0xA200,0x0000,0x9000,0x00E5,0xA200,0x0000,0x9000,0x03A5,
  1312. X    0xA200,0x0000,0x9000,0x0625,0xA3FF,0xFFFF,0x9000,0x1C25,
  1313. X    0xA000,0x0000,0x1000,0x3425,0xA000,0x0000,0x1000,0xC425,
  1314. X    0xA000,0x0000,0x1003,0x8425,0xA000,0x0000,0x1006,0x0425,
  1315. X    0xA000,0x0000,0x101C,0x0425,0xA000,0x0000,0x11F0,0x0425,
  1316. X    0xA000,0x0000,0x13E0,0x0445,0xA000,0x0000,0x13E0,0x0585,
  1317. X    0xA000,0x0000,0x13E0,0x0605,0xA000,0x0000,0x11C0,0x0405,
  1318. X    0xA000,0x0000,0x1000,0x000D,0xA000,0x0000,0x1000,0x0011,
  1319. X    0xA000,0x0000,0x1000,0x0021,0xA000,0x0000,0x1000,0x00C1,
  1320. X    0xA000,0x0000,0x1000,0x0101,0xA000,0x0000,0x1000,0x0601,
  1321. X    0xA000,0x0000,0x1000,0x0801,0xA000,0x0000,0x1000,0x3801,
  1322. X    0xA000,0x0000,0x1000,0x4801,0xA000,0x0000,0x1000,0x8801,
  1323. X    0xA000,0x0000,0x1003,0x0801,0xA000,0x0000,0x1004,0x0801,
  1324. X    0xA000,0x0000,0x101C,0x0801,0xA000,0x0000,0x1024,0x0801,
  1325. X    0xA000,0x0000,0x1044,0x0801,0xA000,0x0000,0x1184,0x0801,
  1326. X    0xA000,0x0000,0x1204,0x0801,0xA000,0x0000,0x1404,0x0801,
  1327. X    0xBFFF,0xFFFF,0xF804,0x0801,0x8000,0x0000,0x0004,0x0801,
  1328. X    0x8000,0x0000,0x0004,0x0801,0x8000,0x0000,0x0004,0x0801,
  1329. X    0x8000,0x0000,0x0004,0x0801,0xFFFF,0xFFFF,0xFFFF,0xFFFF
  1330. END_OF_FILE
  1331. if test 1933 -ne `wc -c <'mush/mail.icon.1'`; then
  1332.     echo shar: \"'mush/mail.icon.1'\" unpacked with wrong size!
  1333. fi
  1334. # end of 'mush/mail.icon.1'
  1335. fi
  1336. if test -f 'mush/mail.icon.2' -a "${1}" != "-c" ; then 
  1337.   echo shar: Will not clobber existing file \"'mush/mail.icon.2'\"
  1338. else
  1339. echo shar: Extracting \"'mush/mail.icon.2'\" \(1933 characters\)
  1340. sed "s/^X//" >'mush/mail.icon.2' <<'END_OF_FILE'
  1341. X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
  1342. X */
  1343. X    0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x0000,0x0000,0x0001,
  1344. X    0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x00E0,0x0001,
  1345. X    0x8000,0x0000,0x00DE,0x0001,0x8000,0x0000,0x00C1,0xE001,
  1346. X    0x8000,0x0000,0x00C0,0x1801,0x8000,0x0000,0x00C0,0x0801,
  1347. X    0x8000,0x0000,0x00C0,0x0801,0x8000,0x1FFF,0xFFC0,0x0E01,
  1348. X    0x8000,0xFE00,0x00C0,0x0981,0x8007,0x01C0,0x00C0,0x0861,
  1349. X    0x8018,0x0030,0x00C0,0x0811,0x8020,0x7008,0x00C0,0x0811,
  1350. X    0x80C1,0xFC06,0x00C0,0x1809,0x8101,0xBC01,0x00C0,0x6009,
  1351. X    0x8103,0x1E01,0x00C1,0x8005,0x8202,0x0E00,0x80C6,0x0005,
  1352. X    0x8404,0x0400,0x40D8,0x0005,0x8408,0x0200,0x40E0,0x0005,
  1353. X    0x8810,0x0100,0x20C0,0x0005,0x8820,0x6080,0x20C0,0x0005,
  1354. X    0x8840,0x4040,0x30C0,0x0005,0x9081,0x3020,0x10C0,0x0005,
  1355. X    0x9041,0x9C10,0x10C0,0x0005,0x93E0,0x8A0F,0x90C0,0x0005,
  1356. X    0xA210,0x6404,0x90C0,0x0005,0xA208,0x3002,0x90C0,0x0005,
  1357. X    0xA204,0x1401,0x90C0,0x0005,0xA3FF,0xFFFF,0x90C0,0x0005,
  1358. X    0xA000,0x0000,0x10C0,0x0005,0xA000,0x0000,0x10C0,0x0005,
  1359. X    0xA000,0x0000,0x10C0,0x0005,0xA000,0x0000,0x10C0,0x0005,
  1360. X    0xA000,0x0000,0x10C0,0x0005,0xA000,0x0000,0x11C0,0x0005,
  1361. X    0xA000,0x0000,0x13E0,0x0005,0xA000,0x0000,0x13E0,0x0005,
  1362. X    0xA000,0x0000,0x13E0,0x0005,0xA000,0x0000,0x11C0,0x0005,
  1363. X    0xA000,0x0000,0x1000,0x000D,0xA000,0x0000,0x1000,0x0011,
  1364. X    0xA000,0x0000,0x1000,0x0021,0xA000,0x0000,0x1000,0x00C1,
  1365. X    0xA000,0x0000,0x1000,0x0101,0xA000,0x0000,0x1000,0x0601,
  1366. X    0xA000,0x0000,0x1000,0x0801,0xA000,0x0000,0x1000,0x3001,
  1367. X    0xA000,0x0000,0x1000,0x4001,0xA000,0x0000,0x1000,0x8001,
  1368. X    0xA000,0x0000,0x1003,0x8001,0xA000,0x0000,0x1004,0x8001,
  1369. X    0xA000,0x0000,0x1018,0x8001,0xA000,0x0000,0x1020,0x8001,
  1370. X    0xA000,0x0000,0x1060,0x8001,0xA000,0x0000,0x1180,0x8001,
  1371. X    0xA000,0x0000,0x1280,0x8001,0xA000,0x0000,0x1480,0x8001,
  1372. X    0xBFFF,0xFFFF,0xFC80,0x8001,0x8000,0x0000,0x0080,0x8001,
  1373. X    0x8000,0x0000,0x0080,0x8001,0x8000,0x0000,0x0080,0x8001,
  1374. X    0x8000,0x0000,0x0080,0x8001,0xFFFF,0xFFFF,0xFFFF,0xFFFF
  1375. END_OF_FILE
  1376. if test 1933 -ne `wc -c <'mush/mail.icon.2'`; then
  1377.     echo shar: \"'mush/mail.icon.2'\" unpacked with wrong size!
  1378. fi
  1379. # end of 'mush/mail.icon.2'
  1380. fi
  1381. if test -f 'mush/makefile.hpux' -a "${1}" != "-c" ; then 
  1382.   echo shar: Will not clobber existing file \"'mush/makefile.hpux'\"
  1383. else
  1384. echo shar: Extracting \"'mush/makefile.hpux'\" \(1687 characters\)
  1385. sed "s/^X//" >'mush/makefile.hpux' <<'END_OF_FILE'
  1386. X# Mush makefile for HP/UX.
  1387. X#
  1388. XHDRS1= mush.h config.h
  1389. XHDRS2= strings.h options.h
  1390. XHDRS3= bindings.h glob.h
  1391. XHDRS4= version.h
  1392. XSRCS1= commands.c dates.c execute.c expr.c folders.c \
  1393. X    hdrs.c init.c loop.c mail.c main.c misc.c msgs.c pick.c \
  1394. X    print.c setopts.c signals.c sort.c viewopts.c options.c lock.c
  1395. XSRCS2= bind.c curs_io.c curses.c file.c strings.c macros.c \
  1396. X    addrs.c malloc.c glob.c
  1397. X
  1398. XOBJS1= commands.o dates.o execute.o expr.o folders.o \
  1399. X    hdrs.o init.o loop.o mail.o main.o misc.o msgs.o pick.o \
  1400. X    print.o setopts.o signals.o sort.o viewopts.o options.o lock.o
  1401. XOBJS2= bind.o curs_io.o curses.o file.o strings.o macros.o \
  1402. X    addrs.o malloc.o glob.o
  1403. X
  1404. XHELP_FILES= README README-7.0 README-7.1 mush.1 cmd_help \
  1405. X    Mushrc Mailrc Gnurc sample.mushrc advanced.mushrc digestify
  1406. X
  1407. X# If your HP-UX version is older than 6.5, you will need remove -DDIRECTORY
  1408. X
  1409. XHPFLAGS=    -DHPUX -DSELECT -DDIRECTORY
  1410. XCFLAGS=     -O -DSYSV -DUSG -DCURSES -DREGCMP -DSIGRET=void $(HPFLAGS)
  1411. XLDFLAGS=
  1412. XLIBS=         -lcurses -lPW -lmalloc
  1413. XOTHERLIBS=
  1414. X# Use some variant of this one if you #define MMDF in config.h
  1415. X#OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a
  1416. XPROG=        mush
  1417. X
  1418. X$(PROG): $(OBJS1) $(OBJS2)
  1419. X    @echo loading...
  1420. X    @$(CC) $(LDFLAGS) $(OBJS1) $(OBJS2) -o $(PROG) $(LIBS) $(OTHERLIBS)
  1421. X
  1422. X$(OBJS1): $(HDRS1) $(HDRS2)
  1423. X$(OBJS2): $(HDRS1) $(HDRS2) $(HDRS3)
  1424. Xloop.o: version.h
  1425. X
  1426. XBINDIR= /usr/local/bin
  1427. XLIBDIR= /usr/local/lib
  1428. XMRCDIR= /usr/lib
  1429. XMANDIR= /usr/local/man/man1
  1430. XMANEXT= 1
  1431. X
  1432. Xinstall: mush
  1433. X    cp mush $(BINDIR)
  1434. X    strip $(BINDIR)/mush
  1435. X    chmod 0755 $(BINDIR)/mush
  1436. X    cp mush.1 $(MANDIR)/mush.$(MANEXT)
  1437. X    chmod 0644 $(MANDIR)/mush.$(MANEXT)
  1438. X    cp cmd_help $(LIBDIR)
  1439. X    chmod 0644 $(LIBDIR)/cmd_help
  1440. X    cp Mushrc $(MRCDIR)/Mushrc
  1441. X    chmod 0644 $(MRCDIR)/Mushrc
  1442. END_OF_FILE
  1443. if test 1687 -ne `wc -c <'mush/makefile.hpux'`; then
  1444.     echo shar: \"'mush/makefile.hpux'\" unpacked with wrong size!
  1445. fi
  1446. # end of 'mush/makefile.hpux'
  1447. fi
  1448. if test -f 'mush/makefile.sys.v' -a "${1}" != "-c" ; then 
  1449.   echo shar: Will not clobber existing file \"'mush/makefile.sys.v'\"
  1450. else
  1451. echo shar: Extracting \"'mush/makefile.sys.v'\" \(1899 characters\)
  1452. sed "s/^X//" >'mush/makefile.sys.v' <<'END_OF_FILE'
  1453. X# Mush makefile for system V.  Note: SIGRET should return void for normal
  1454. X# sys-v, but Att PC users should *not* have it defined.  See the README!!
  1455. X#
  1456. XHDRS1= mush.h config.h
  1457. XHDRS2= strings.h options.h
  1458. XHDRS3= bindings.h glob.h
  1459. XHDRS4= version.h
  1460. XSRCS1= commands.c dates.c execute.c expr.c folders.c \
  1461. X    hdrs.c init.c loop.c mail.c main.c misc.c msgs.c pick.c \
  1462. X    print.c setopts.c signals.c sort.c viewopts.c options.c lock.c
  1463. XSRCS2= bind.c curs_io.c curses.c file.c strings.c macros.c \
  1464. X    addrs.c malloc.c glob.c
  1465. X
  1466. XOBJS1= commands.o dates.o execute.o expr.o folders.o \
  1467. X    hdrs.o init.o loop.o mail.o main.o misc.o msgs.o pick.o \
  1468. X    print.o setopts.o signals.o sort.o viewopts.o options.o lock.o
  1469. XOBJS2= bind.o curs_io.o curses.o file.o strings.o macros.o \
  1470. X    addrs.o malloc.o glob.o
  1471. X
  1472. XHELP= README README-7.0 README-7.1 mush.1 cmd_help \
  1473. X    Mushrc Mailrc Gnurc sample.mushrc advanced.mushrc digestify
  1474. X
  1475. X# Sun OS systems who wish to compile with sys-v options:
  1476. X# CC= /usr/5bin/cc
  1477. X# CFLAGS=     -O -DSYSV -DCURSES -DUSG -DDIRECTORY
  1478. X# LIBS= -L/usr/5lib -lcurses
  1479. X
  1480. X# IRIX 3.2 systems (SGI Iris workstations) should add -DDIRECTORY to CFLAGS
  1481. X
  1482. XCFLAGS=     -O -DSYSV -DUSG -DCURSES -DREGCMP -DSIGRET=void
  1483. XLDFLAGS=
  1484. XLIBS=         -lcurses -lPW
  1485. XOTHERLIBS=
  1486. X# Use some variant of this one if you #define MMDF in config.h
  1487. X#OTHERLIBS=/usr/src/mmdf/lib/libmmdf.a
  1488. XPROG=        mush
  1489. X
  1490. X$(PROG): $(OBJS1) $(OBJS2)
  1491. X    @echo loading...
  1492. X    @$(CC) $(LDFLAGS) $(OBJS1) $(OBJS2) -o $(PROG) $(LIBS) $(OTHERLIBS)
  1493. X
  1494. X$(OBJS1): $(HDRS1) $(HDRS2)
  1495. X$(OBJS2): $(HDRS1) $(HDRS2) $(HDRS3)
  1496. Xloop.o: version.h
  1497. X
  1498. XBINDIR= /usr/local/bin
  1499. XLIBDIR= /usr/local/lib
  1500. XMRCDIR= /usr/lib
  1501. XMANDIR= /usr/local/man/man1
  1502. XMANEXT= 1
  1503. X
  1504. Xinstall: mush
  1505. X    cp mush $(BINDIR)
  1506. X    strip $(BINDIR)/mush
  1507. X    chmod 0755 $(BINDIR)/mush
  1508. X    cp mush.1 $(MANDIR)/mush.$(MANEXT)
  1509. X    chmod 0644 $(MANDIR)/mush.$(MANEXT)
  1510. X    cp cmd_help $(LIBDIR)
  1511. X    chmod 0644 $(LIBDIR)/cmd_help
  1512. X    cp Mushrc $(MRCDIR)/Mushrc
  1513. X    chmod 0644 $(MRCDIR)/Mushrc
  1514. END_OF_FILE
  1515. if test 1899 -ne `wc -c <'mush/makefile.sys.v'`; then
  1516.     echo shar: \"'mush/makefile.sys.v'\" unpacked with wrong size!
  1517. fi
  1518. # end of 'mush/makefile.sys.v'
  1519. fi
  1520. echo shar: End of archive 19 \(of 19\).
  1521. cp /dev/null ark19isdone
  1522. MISSING=""
  1523. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ; do
  1524.     if test ! -f ark${I}isdone ; then
  1525.     MISSING="${MISSING} ${I}"
  1526.     fi
  1527. done
  1528. if test "${MISSING}" = "" ; then
  1529.     echo You have unpacked all 19 archives.
  1530.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1531. else
  1532.     echo You still need to unpack the following archives:
  1533.     echo "        " ${MISSING}
  1534. fi
  1535. ##  End of shell archive.
  1536. exit 0
  1537.  
  1538.