home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume28 / mush / patch04a next >
Text File  |  1992-02-23  |  50KB  |  1,415 lines

  1. Newsgroups: comp.sources.misc
  2. From: bart@zigzag.z-code.com (Bart Schaefer)
  3. Subject:  v28i067:  mush - Mail User's Shell, Patch04a/2
  4. Message-ID: <csm-v28i067=mush.213653@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 745678f835c093a01dc4e1fe3e37b59c
  6. Date: Mon, 24 Feb 1992 03:37:20 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: bart@zigzag.z-code.com (Bart Schaefer)
  10. Posting-number: Volume 28, Issue 67
  11. Archive-name: mush/patch04a
  12. Environment: UNIX
  13. Patch-To: mush: Volume 18, Issue 58-79
  14.  
  15. This is Part 01 of Official Patch #4 for Mush 7.2.  To apply this patch,
  16. save this message to a file in your mush source directory and type:
  17.  
  18.     patch -N -p1 < file
  19.  
  20. If you are using an Apollo workstation, you will first need to apply
  21. Part 02 of this patch, and then proceed with:
  22.  
  23.     sh apollo.shar
  24.     patch -N -p1 < apollo.patch
  25.  
  26. See the files README and README.apollo for details.
  27.  
  28. Bug fixes in this patch (see README and README-7.2.4 for other changes):
  29.  
  30.   * A couple of long-standing array overflow and "underflow" bugs found
  31.     and squished.
  32.  
  33.   * Interrupting the "bind" curses-mode command now works more like the
  34.     other interruptible commands.
  35.  
  36.   * The "stty" command behaves itself.
  37.  
  38.   * Non-SYSV systems using DOT_LOCK won't get strange reports from the
  39.     "save" command about messages saved to the lock file.  (That wasn't
  40.     happening but the output was confusing.)
  41.  
  42.   * Using the "folder" curses-mode command will now remove empty folder
  43.     files if the line-mode "folder" would do so.
  44.  
  45.   * SYSV systems should have no more complaints about EWOULDBLOCK not
  46.     being defined in file.c.
  47.  
  48.   * The "folder" command won't print the folder status line if piping
  49.     or otherwise told to shut up (e.g. "mush -N").
  50.  
  51.   * Attempting to reference a $[%x] header-formatted variable during
  52.     initialization no longer causes a core dump.  You still can't do
  53.     it, but at least mush refuses politely.
  54.  
  55.   * The "reply" family of commands do a better job with addresses
  56.     whose real name or comment fields contain double-quote characters.
  57.     Specifically, they put such names in ( ) instead of in " ".
  58.  
  59.   * Over-long lines in init files and "source" files now generate an
  60.     error message instead of truncating silently.
  61.  
  62.   * Systems using DOT_LOCK should no longer find dead lock files lying
  63.     about.  The whole DOT_LOCK procedure has been made more robust so
  64.     it can be used as a failsafe on systems with NFS-mounted spools.
  65.  
  66.   * Tty twiddling is no longer done in headers-only mode ("mush -H").
  67.  
  68.   * The little-used feature of referencing another variable from within
  69.     the autosign and autosign2 variables actually works now.  I probably
  70.     should just have removed it altogether.
  71.  
  72.   * Compiling with SUNTOOL defined no longer breaks the lock-failed case
  73.     in folder updating for line mode.
  74.  
  75.   * The descriptive output from "pick" is now correct when using -x with
  76.     a date search.
  77.  
  78. @OFF
  79.  
  80. As usual, complete sources for Mush (already including the changes in this
  81. patch) can be obtained via anonymous ftp from:
  82.  
  83.                   cse.ogi.edu:pub/mush/mush-7.2.tar.Z
  84.  
  85. It may be a few days before I have a chance to update the cse.ogi.edu
  86. archive, so if you need 7.2.4 _now_, save this patch before retrieving
  87. the rest of the source.
  88.  
  89. Mush 7.2 was most recently posted to comp.sources.misc at patchlevel 2.
  90. Patches 3, 4, and any future patches will be made available for ftp from
  91. cse.ogi.edu, or you can send E-mail to me:
  92.  
  93.                          schaefer@cse.ogi.edu
  94.  
  95. Include in your message a line of the form
  96.  
  97. @PATCH patch-number path-from-ogicse-to-you
  98.  
  99. where patch-number is the number of the patch you need (digit, 1 or 2)
  100. and path-from-ogicse-to-you is either your Internet domain address or
  101. a UUCP path from site ogicse to you at your site.  There continue to
  102. be sendmail configuration problems at ogicse so please do not use mixed
  103. UUCP and Internet addresses and do not use domain names (with `.'s) in
  104. UUCP paths.  Ogicse does do UUCP map lookups now, so user@site.UUCP will
  105. often work if your site is registered.  If you don't get your patches
  106. in 2 or 3 days, try again, but use a different path.
  107.  
  108. You may include one @PATCH line for each patch you need.
  109.  
  110. You can also recieve a complete set of sources by E-mail by including
  111. a line of the form
  112.  
  113. @MUSH path-from-ogicse-to-you
  114.  
  115. where path-from-ogicse-to-you is as above.  You need not request both
  116. source and patches; the source you receive will include all current
  117. patches.  Sources are shipped as a 10-part compressed tar file, encoded
  118. for mailing with the "btoa" utility.  You will receive instructions
  119. explaining how to unpack the tar file in a separate message.
  120.  
  121. Decwrl also operates an E-mail server that accesses anonymous ftp.  To
  122. get instructions, send a message to:
  123.  
  124.                         ftpmail@decwrl.dec.com
  125.  
  126. Include the following lines in the text:
  127.  
  128. help
  129. quit
  130.  
  131. To get the mush sources, send the following:
  132.  
  133. reply your-email-address
  134. connect cse.ogi.edu
  135. chdir pub/mush
  136. btoa                <-- replace with uuencode if you prefer
  137. binary
  138. get mush-7.2.tar.Z
  139. quit
  140.  
  141. Other information, plus questions and answers, on mush and mush patches
  142. is available from the mush-users mailing list, which is gatewayed in
  143. both directions with newsgroup comp.mail.mush.  The list currently
  144. resides at mush-users@apple.com.  Requests to be added to or deleted
  145. from the list should be sent to mush-users-request@apple.com
  146.  
  147. Prereq: "5/22/91"
  148. *** 7.2.3/version.h    Wed May 22 19:08:41 1991
  149. --- 7.2.4/version.h    Thu Jan 30 22:53:42 1992
  150. ***************
  151. *** 1,7 ****
  152.   /* @(#)version.h    (c) Copyright 1989, 1990, 1991 (Dan Heller) */
  153.   
  154.   #define MUSHNAME    "Mail User's Shell"
  155. ! #define RELEASE_DATE    "5/22/91"
  156.   #define RELEASE        7
  157.   #define REVISION    "2"
  158. ! #define PATCHLEVEL    3
  159. --- 1,7 ----
  160.   /* @(#)version.h    (c) Copyright 1989, 1990, 1991 (Dan Heller) */
  161.   
  162.   #define MUSHNAME    "Mail User's Shell"
  163. ! #define RELEASE_DATE    "2/2/92"
  164.   #define RELEASE        7
  165.   #define REVISION    "2"
  166. ! #define PATCHLEVEL    4
  167. *** 7.2.3/README    Wed May 22 23:50:44 1991
  168. --- 7.2.4/README    Sun Feb  2 09:21:32 1992
  169. ***************
  170. *** 1,11 ****
  171. ! /* @(#)README        (c) copyright 9/15/89    (Dan Heller) */
  172.   
  173. ! Author:
  174.       Dan Heller
  175.   
  176.   Network addresses:
  177. !     argv@sun.com        argv@monet.berkeley.edu.
  178. !     argv@garp.mit.edu        dheller@ucbcory.berkeley.edu
  179.   
  180.   When sending mail, mail to the addresses in the order given.
  181.   
  182. --- 1,12 ----
  183. ! /* @(#)README        (c) copyright 2/1/92    (Dan Heller) */
  184.   
  185. ! Authors:
  186.       Dan Heller
  187. +     Bart Schaefer
  188.   
  189.   Network addresses:
  190. !     argv@z-code.com        argv@sun.com        argv@ora.com
  191. !     schaefer@zigzag.z-code.com            schaefer@cse.ogi.edu
  192.   
  193.   When sending mail, mail to the addresses in the order given.
  194.   
  195. ***************
  196. *** 33,47 ****
  197.   may be used in any other product, free or otherwise, without consent from
  198.   the authors.
  199.   
  200.   With that out of the way...
  201.   
  202.   Mush runs on various flavors of unix.  To build mush, you should identify
  203.   which unix you are running:
  204.   
  205. !     Sun (all versions from 3.5 and higher).
  206.       BSD (versions 4.2 and up, or SunOS earlier than 3.5)
  207.       System-V / Version 7 / System III (Bell Labs)
  208.       Xenix (this might be tricky)
  209.   
  210.   You will need to copy "config.h-dist" to config.h and edit it to reflect
  211.   the system dependencies described there.  These consist of "compile-time
  212. --- 34,53 ----
  213.   may be used in any other product, free or otherwise, without consent from
  214.   the authors.
  215.   
  216. + MUSH IS PROVIDED AS IS, WITHOUT WARRANTY.  AUTHORS HEREBY DISCLAIM
  217. + ALL WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
  218. + OF FITNESS FOR A PARTICULAR PURPOSE.
  219.   With that out of the way...
  220.   
  221.   Mush runs on various flavors of unix.  To build mush, you should identify
  222.   which unix you are running:
  223.   
  224. !     SunOS (all versions from 3.5 and higher).
  225.       BSD (versions 4.2 and up, or SunOS earlier than 3.5)
  226.       System-V / Version 7 / System III (Bell Labs)
  227.       Xenix (this might be tricky)
  228. +     Hybrids including HP-UX and IRIX (Version 4.0 and up is best)
  229.   
  230.   You will need to copy "config.h-dist" to config.h and edit it to reflect
  231.   the system dependencies described there.  These consist of "compile-time
  232. ***************
  233. *** 118,123 ****
  234. --- 124,135 ----
  235.       BSD and probably running a system-v flavor of unix -- this defines USG
  236.       so that termio will be used.
  237.   
  238. +     True System V Release 2 systems should define SVR2 to get full support
  239. +     for dot-locking (see DOT_LOCK below).  The default for SYSV is SVR3.
  240. +     See below for SVR4.  Some SVR3 machines (e.g. Motorola SysV/88) are
  241. +     close enough to SVR4 that you may need to use the libraries described
  242. +     below.  However, this does not normally mean you should define SVR4.
  243.       SCO UNIX V.2.0 users should add -lx to OTHERLIBS in makefile.sys.v.
  244.       It may also be desirable to change MANDIR to /usr/man/man.C and
  245.       MANEXT to C in the makefile.  SCO UNIX V.3.2 users should avoid -lx
  246. ***************
  247. *** 128,148 ****
  248.       defined in mush.h.  It should be fairly trivial to generate an
  249.       equivalent function.
  250.   
  251.   If you are using Ultrix:
  252.   
  253.       Start with makefile.bsd.
  254.   
  255. !     For Ultrix 2.2, change LIBES in makefile.bsd from
  256. !     LIBES= -lcurses -ltermlib
  257.       to 
  258. !     LIBES= -lcurses -ltermcap
  259.   
  260. !     For Ultrix V3.0, use the standard makefile.bsd LIBES, but add
  261.       -DSIGRET=void
  262.       to the CFLAGS, or add
  263.       #define SIGRET void
  264.       to config.h (see discussion below).
  265.   
  266.   If you are using HP-UX:
  267.   
  268.       Use makefile.hpux.
  269. --- 140,174 ----
  270.       defined in mush.h.  It should be fairly trivial to generate an
  271.       equivalent function.
  272.   
  273. + If you have System V Release 4:
  274. +     Use makefile.sys.v as above, but define SVR4 and DIRECTORY.  You
  275. +     should also change
  276. +     LIBS=         -lcurses -lPW
  277. +     to
  278. +     LIBS=         -lcurses -lgen
  279.   If you are using Ultrix:
  280.   
  281.       Start with makefile.bsd.
  282.   
  283. !     For Ultrix 2.2, change LIBS in makefile.bsd from
  284. !     LIBS= -lcurses -ltermlib
  285.       to 
  286. !     LIBS= -lcurses -ltermcap
  287.   
  288. !     For Ultrix V3.0, use the standard makefile.bsd LIBS, but add
  289.       -DSIGRET=void
  290.       to the CFLAGS, or add
  291.       #define SIGRET void
  292.       to config.h (see discussion below).
  293.   
  294. +     Ultrix V4.0 is generally the same as 3.0 but may exhibit problems with
  295. +     alignment errors in the environment of forked children (e.g. the MTA).
  296. +     The only workaround is to replace the popen(3) function with one of
  297. +     your own that passes the environment explicitly via execve().  If you
  298. +     never use mush's "setenv" command you'll probably never see this.
  299.   If you are using HP-UX:
  300.   
  301.       Use makefile.hpux.
  302. ***************
  303. *** 153,158 ****
  304. --- 179,196 ----
  305.       from the CFLAGS.  This will cause the portable directory access
  306.       routines in that file to be compiled.
  307.   
  308. + If you are using Apollo Domain/OS:
  309. +     Good luck.
  310. +     Actually, there is some hope for you, but best if you have Domain/OS
  311. +     version 10.3.x with the 4.3 BSD environment installed.  Included with
  312. +     the distribution as of version 7.2.4 is apollo.shar, which contains
  313. +     patches, auxiliary files, and makefile.apollo to put them all together.  
  314. +     Run "sh apollo.shar" and "patch -N -p1 apollo.patch" (or patch by hand)
  315. +     then make using makefile.apollo.  You *should* be able to make this
  316. +     procedure work under the System V environment, but ....
  317.   If you are using Apple A/UX:
  318.   
  319.       Use makefile.sys.v, and add -DAUX -DDIRECTORY to CFLAGS.
  320. ***************
  321. *** 159,164 ****
  322. --- 197,219 ----
  323.   
  324.       Mush uses 4.2-BSD compatible signal handling when AUX is defined.
  325.   
  326. + If you have SGI Iris or Indigo workstations:
  327. +     Silicon Graphics IRIX workstations should use makefile.sys.v.  If you
  328. +     have IRIX version 3.x, you're pretty much on your own.
  329. +     Add -DDIRECTORY to prevent the portable directory routines from being
  330. +     compiled in.  You may optionally add -DSELECT if you want to use the BSD
  331. +     style select() function.  If you do this, you must also add -lbsd to the
  332. +     OTHERLIBS macro definition in the Makefile.
  333. +     
  334. +     For IRIX 4.x you should add -DIRIX4 to CFLAGS and use:
  335. +     CC= cc -signed -cckr
  336. +     OTHERLIBS= -lsun -lmalloc
  337. +     Note that -lsun is used in place of -lbsd here.  This provides network
  338. +     compatibility with sun workstations, or something like that.  You may
  339. +     be able to get by with -lbsd.
  340.   If you are using a hybrid BSD/SysV system:
  341.   
  342.       You may have to use a combination of many of the defines listed
  343. ***************
  344. *** 168,191 ****
  345.       routines ...  you may have to define additional parameters such as
  346.       -DSELECT, -DGETWD, -DDIRECTORY, ... and possibly add -lbsd.
  347.   
  348. - Notes for some hybrid systems:
  349. -     SGI workstations:
  350. -     Silicon Graphics Iris workstations should add -DDIRECTORY to prevent
  351. -     the portable directory routines from being compiled in.
  352. -     You may optionally add -DSELECT if you want to use the BSD style
  353. -     select() function.  If you do this, you must also add -lbsd to the
  354. -     LIBS macro definition in the Makefile.
  355. -     You will also need to #include <sys/times.h> in curs_io.c.
  356.       MIPS workstations:
  357.       These are also hybrid systems that may require additional hand-
  358.       configuration in order to work properly.  There seem to be
  359.       major differences between the last several releases, so your
  360. !     milage may vary.  Currently, lock.c should be compiled with BSD
  361. !     defined, but everything else should be SYSV.  -DGETWD should be
  362. !     used and -lbsd may have to be added to LIBS in the Makefile.
  363.   
  364.   When you decide on an appropriate makefile, _copy_ it to a new file called
  365.   Makefile _before_ making any of local changes.  Please read the following
  366.   sections for addtional configuration information.  In addition to changing
  367. --- 223,243 ----
  368.       routines ...  you may have to define additional parameters such as
  369.       -DSELECT, -DGETWD, -DDIRECTORY, ... and possibly add -lbsd.
  370.   
  371.       MIPS workstations:
  372.       These are also hybrid systems that may require additional hand-
  373.       configuration in order to work properly.  There seem to be
  374.       major differences between the last several releases, so your
  375. !     milage may vary.  Before RISC/OS 3.2, there are numerous curses
  376. !     library bugs, and, lock.c should be compiled with BSD defined, but
  377. !     everything else should be SYSV.  -DGETWD should be used and -lbsd
  378. !     must be added to OTHERLIBS in the Makefile.
  379.   
  380. +     For RISC/OS 3.2 and later, start with makefile.bsd, add -DDIRECTORY
  381. +     to CFLAGS, and use:
  382. +     CC= cc -Wf,-XNd5000 -std0 -systype bsd43
  383. +     OTHERLIBS= -lbsd
  384.   When you decide on an appropriate makefile, _copy_ it to a new file called
  385.   Makefile _before_ making any of local changes.  Please read the following
  386.   sections for addtional configuration information.  In addition to changing
  387. ***************
  388. *** 204,209 ****
  389. --- 256,271 ----
  390.       by itself as an end-of-file marker.  This has been obsleted by "-oi",
  391.       but "-i" still works and is backwards compatible with older sendmails.
  392.   
  393. +     If you are compiling on a machine that has the Rand MH mail system as
  394. +     its native user agent (machines at Rand Corp. and Tektronix boxes
  395. +     running Utek 3.x or 4.x, among others) your system mailbox may be in
  396. +     MMDF format even though your MTA is sendmail.  Define MMDF to parse
  397. +     the mailbox, but also define M_EXECMAIL to use sendmail-style protocol
  398. +     for talking to the MTA.  However, do NOT use /usr/lib/mail/execmail
  399. +     as the MAIL_DELIVERY.  Make sure MAIL_DELIVERY is /usr/lib/sendmail
  400. +     as usual, and that the VERBOSE_ARG, METOO_ARG, and MTA_EXIT macros
  401. +     are the ones associated with the sendmail MAIL_DELIVERY.
  402.   Delivermail:
  403.       Some mailers such as delivermail and MMDF use special strings to separate
  404.       messages stored in a folder.  Older delivermail versions would use "^C".
  405. ***************
  406. *** 226,232 ****
  407. --- 288,308 ----
  408.       If you are using SCO UNIX 3.2 and the MMDF "submit" program gives you
  409.       trouble because of file permissions, define M_EXECMAIL to use the
  410.       execmail program instead.
  411. +     
  412. +     Another reason you may need execmail is that under MMDF, the system
  413. +     knows itself only by its hostname; other names, including the fully-
  414. +     qualified domain name, have to be specified in the local channel file.
  415. +     If this is not done, mail From: user@host.domain will be returned with
  416. +     a "no valid author spec" message.  However, it won't fail if the mail
  417. +     is submitted by root; /usr/lib/mail/execmail is setuid root, so mail
  418. +     submitted that way will succeed.  You should only resort to M_EXECMAIL
  419. +     if you are unable to change the MMDF permissions or cannot edit the
  420. +     channel file.
  421.   
  422. + Smail:
  423. +     If you are using smail-2.x you need to define NO_COMMAS and PICKY_MAILER.
  424. +     On a SYSV system, define MAIL_DELIVERY as /bin/rmail.
  425.   All others:
  426.       Chances are, your MTA uses the "From " format to separate messges in
  427.       a folder.  This includes, /bin/mail, rmail, smail, execmail, and so on.
  428. ***************
  429. *** 260,265 ****
  430. --- 336,352 ----
  431.   MSG_SEPARATOR
  432.       See the discussion above.
  433.   
  434. + MAILDIR
  435. +     This is automatically defined as /usr/mail for SYSV prior to SVR4 and
  436. +     as /usr/spool/mail for BSD and SVR4.  However, some systems are unusual,
  437. +     so you may need to define this explicitly.
  438. + MAIL_DELIVERY
  439. +     This is the program that mush invokes to send your messages off to your
  440. +     list of recipients.  It defaults to "sendmail" (or "submit" for MMDF).
  441. +     See notes below on modifying this via M_EXECMAIL for misconfigured MMDFs.
  442. +     For vanilla SYSV, redefine MAIL_DELIVERY as /bin/mail or /bin/rmail.
  443.   UUCP
  444.       This should be defined if your MTA does not automatically create a
  445.       From: header *and* your machine talks to other computers via uucp.
  446. ***************
  447. *** 285,296 ****
  448.       VERBOSE_ARG defined.  Otherwise, define it to be whatever the verbose
  449.       argument is for your mailer.  The default is -v.
  450.   
  451. ! METOO
  452.       Sendmail uses the -m argument to say, "metoo" -- when sending to sendmail
  453.       aliases (e.g. mailing lists), sendmail will expand the alias, but if your
  454.       address appears in the expansion, you are excluded from getting your own
  455.       mail.  However, if you have the variable metoo set with your variables,
  456. !     then the METOO argument is passed to sendmail to say, "I know I'm on this
  457.       mailing list, but send me a copy of my message even tho I sent it."  For
  458.       sendmail, this is -m.  If your mailer uses something else, then define
  459.       METOO_ARG in the config.h file.  If you don't have it (sys-v), then this
  460. --- 372,383 ----
  461.       VERBOSE_ARG defined.  Otherwise, define it to be whatever the verbose
  462.       argument is for your mailer.  The default is -v.
  463.   
  464. ! METOO_ARG
  465.       Sendmail uses the -m argument to say, "metoo" -- when sending to sendmail
  466.       aliases (e.g. mailing lists), sendmail will expand the alias, but if your
  467.       address appears in the expansion, you are excluded from getting your own
  468.       mail.  However, if you have the variable metoo set with your variables,
  469. !     then the metoo argument is passed to sendmail to say, "I know I'm on this
  470.       mailing list, but send me a copy of my message even tho I sent it."  For
  471.       sendmail, this is -m.  If your mailer uses something else, then define
  472.       METOO_ARG in the config.h file.  If you don't have it (sys-v), then this
  473. ***************
  474. *** 318,323 ****
  475. --- 405,415 ----
  476.       .lock file.  If it exists, mush loops until it goes away and then mush
  477.       creates it mode 600.  Regardless of whether you use dot-locking, mush
  478.       will continue to try to use flock(), or whatever.
  479. +     If your MTA is smail-2.x, you should define DOT_LOCK regardless of
  480. +     your operating system type.  DOT_LOCK may also be helpful in preventing
  481. +     corruption of NFS-mounted mail spools, but only if the MTA can be made
  482. +     to also use this protocol.
  483.   
  484.       Dot-locking requires mush to have write access to the directory where
  485.       your mailbox exists.  Normally, this directory isn't writable by the
  486. *** /dev/null    Sun Feb  2 11:15:57 1992
  487. --- 7.2.4/README-7.2.4    Sun Feb  2 20:00:09 1992
  488. ***************
  489. *** 0 ****
  490. --- 1,133 ----
  491. + This is release 7.2.4 of the Mail User's Shell (mush).
  492. + Mush was last posted as a complete package at release 7.2.2.  Before that,
  493. + the last complete posting was 7.1.1.  If your version of mush is older
  494. + than 7.2.2, refer to README-7.0 and README-7.1 for lists of other changes.
  495. + See README-7.2.0 for changes from 7.1.1 to 7.2.  Patch 3 was bugfixes only;
  496. + there was no README-7.2.3, so the list of bugfixes in that patch has been
  497. + appended.
  498. + Changes in compilation:
  499. +     Be sure to check out the README file for complete details of new info
  500. +     on compilation for SysVr2, SysVr4, Ultrix, Domain/OS, IRIX, and MIPS.
  501. +     There are new preprocessor definitions for SVR2, SVR4, and IRIX4, plus
  502. +     a set of patches and auxiliary files for Apollo.  There are also new
  503. +     instructions for compiling mush to read MMDF-style spool files while
  504. +     still using sendmail as the MTA (some "native" MH sites need this).
  505. +     If you have a csh with filec set and typing ahead at an exiting mush
  506. +     seems to send end-of-file to your shell, define CSH_FILEC_FIX.  It's
  507. +     completely ridiculous that mush has to deal with this so I refuse to
  508. +     mention it in README with the mush-configuration defines.
  509. + New/changed commands:
  510. +     There aren't any.
  511. + New/changed variables:
  512. +     pager
  513. +     If $pager has the value "NONE", mush will not run an external
  514. +     pager and will not pause for input at the end of each screenful
  515. +     of output.
  516. + Tool mode changes:
  517. +     None of these, either.
  518. + Miscellaneous:
  519. +     The config.h file has been reorganized a bit more.
  520. +     The "digestify" script has a clever perl-style startup conditional
  521. +     so you can #! it as a csh script if your path to mush is too long.
  522. +     The environment variable MAIL is now recognized at startup time to
  523. +     specify the location of the spool folder.
  524. +     When SVR2 and DOT_LOCK are defined at compile time, mush assumes that
  525. +     saved-set-group-id is not available.  The file lock.c can be compiled
  526. +     into a separate locking program to handle the setgid requirements.
  527. +     See extensive comments at the top of lock.c.
  528. + Bugs fixed in Patch #4:
  529. +   * A couple of long-standing array overflow and "underflow" bugs found
  530. +     and squished.
  531. +   * Interrupting the "bind" curses-mode command now works more like the
  532. +     other interruptible commands.
  533. +   * The "stty" command behaves itself.
  534. +   * Non-SYSV systems using DOT_LOCK won't get strange reports from the
  535. +     "save" command about messages saved to the lock file.  (That wasn't
  536. +     happening but the output was confusing.)
  537. +   * Using the "folder" curses-mode command will now remove empty folder
  538. +     files if the line-mode "folder" would do so.
  539. +   * SYSV systems should have no more complaints about EWOULDBLOCK not
  540. +     being defined in file.c.
  541. +   * The "folder" command won't print the folder status line if piping
  542. +     or otherwise told to shut up (e.g. "mush -N").
  543. +   * Attempting to reference a $[%x] header-formatted variable during
  544. +     initialization no longer causes a core dump.  You still can't do
  545. +     it, but at least mush refuses politely.
  546. +   * The "reply" family of commands do a better job with addresses whose
  547. +     real name or comment fields that contain double-quote characters.
  548. +     Specifically, they put such names in ( ) instead of in " ".
  549. +   * Over-long lines in init files and "source" files now generate an
  550. +     error message instead of truncating silently.
  551. +   * Systems using DOT_LOCK should no longer find dead lock files lying
  552. +     about.  The whole DOT_LOCK procedure has been made more robust so
  553. +     it can be used as a failsafe on systems with NFS-mounted spools.
  554. +   * Tty twiddling is no longer done in headers-only mode ("mush -H").
  555. +   * The little-used feature of referencing another variable from within
  556. +     the autosign and autosign2 variables actually works now.  I probably
  557. +     should just have removed it altogether.
  558. +   * Compiling with SUNTOOL defined no longer breaks the lock-failed case
  559. +     in folder updating for line mode.
  560. +   * The descriptive output from "pick" is now correct when using -x with
  561. +     a date search.
  562. + Bugs fixed in Patch #3:
  563. +   * The user's real name ($realname) is no longer left empty.
  564. +   * REGCMP users (mostly SysV) no longer get core dumps when using pick.
  565. +   * Attempts to send mail (e.g. via Fcc: headers) to the same file or
  566. +     folder more than once *silently* sends only one copy to the file.
  567. +     (Before, it complained about not being able to write to the file
  568. +     for the second and later attempts.)
  569. +   * SCO UNIX 3.2 users who are having problems with "submit" can now
  570. +     define M_EXECMAIL to use execmail as their interface to MMDF.  This
  571. +     has the pleasant side-effect of making the MTA invocation compatible
  572. +     with sendmail, so resetting the variable "sendmail" works cleanly.
  573. +   * Problems with file locking and lock.c typos for SCO UNIX have been
  574. +     corrected (we hope).
  575. +   * SCO UNIX correctly includes <sys/select.h> (we hope).
  576. +   * Attempts to load folders containing more than the defined maximum
  577. +     number of messages work a bit better.  You still can't load all the
  578. +     messages, but the results are less strange.
  579. +   * Some <curses.h> macro name clashes for unusual UNIXen have been
  580. +     forcibly suppressed.
  581. +   * An amazingly old string overflow bug in toolmode has been fixed.
  582. *** /dev/null    Tue Feb 18 03:03:49 1992
  583. --- 7.2.4/apollo.shar    Tue Feb 18 22:47:32 1992
  584. ***************
  585. *** 0 ****
  586. --- 1,758 ----
  587. + #!/bin/sh
  588. + # shar:    Shell Archiver  (v1.22+)
  589. + #
  590. + #    Run the following text with /bin/sh to create:
  591. + #      README.apollo
  592. + #      makefile.apollo
  593. + #      apollo.patch
  594. + #      apollo_file.c
  595. + #      apollo_pad.c
  596. + #
  597. + echo "x - extracting README.apollo (Text)"
  598. + sed 's/^X//' << 'SHAR_EOF' > README.apollo &&
  599. + XREADME.apollo - modifications to allow mush to operate smoothly in an Apollo
  600. + X        environment.
  601. + X
  602. + XAuthor:
  603. + X    Mike Pelletier, stealth@engin.umich.edu
  604. + X------------
  605. + X
  606. + XSeveral changes have been made to make mush interact more smoothly with
  607. + Xseveral aspects of the Apollo operating and display system.  The changes
  608. + Xinclude modified versions of open(), fopen(), and flock(), a check for
  609. + Xthe height of the screen using the Display Manager "pad" interfaces,
  610. + Xand a change to make input and output in a pad operate more cleanly.
  611. + X
  612. + XNEW OPEN() ROUTINES:
  613. + X
  614. + X  The default operation of the Apollo filesystem closely mimics the
  615. + X  UNIX OS -- any number of processes can have a file open for reading or
  616. + X  writing at any given time, and writing is essentially on a last come,
  617. + X  first served basis -- the last update to the file is what sticks.
  618. + X  This mode is called FILE_$COWRITERS.  However, this only works correctly
  619. + X  when all the processes in question are running on the same machine.
  620. + X  If a process on another machine tries to open() the file, it will fail
  621. + X  completely no matter what access mode it wants, saying "Text file busy."
  622. + X  In the case of mail, it's very common to have a mail transfer agent
  623. + X  on one central machine, and a user on another machine, and if the COWRITERS
  624. + X  lock mode were used, one or the other would fail to access the file
  625. + X  if they both tried at the same time, even if the user just wanted to
  626. + X  read the mailbox, not update it.
  627. + X  
  628. + X  The Apollo filesystem has another locking mode that works for
  629. + X  processes on multiple nodes, with the caveat that only one
  630. + X  process at a time may have write access to the file.  This is
  631. + X  called FILE_$NR_XOR_1W mode.  In this case, if a MTA opened a users
  632. + X  mailbox for writing to deliver new mail, the user could still open
  633. + X  and read the mailbox at the start of a mail session, and vice-versa
  634. + X  for the end of a mail session.
  635. + X  
  636. + X  The open() replacements in apollo_file.c simply change the default
  637. + X  concurrency control mode from FILE_$COWRITERS to FILE_$NR_XOR_1W,
  638. + X  and can stall for a certain amount of time if the attempt to open
  639. + X  the file fails for concurrency reasons, say if an MTA was updating
  640. + X  the mailbox at the same time that a user wanted to end a mail session.
  641. + X  The stall and frequency of checking can be set with setdeadtime() and
  642. + X  setintervaltime() according to the needs of the application.  A user-
  643. + X  agent would want a longer stall with more frequent checks than a
  644. + X  transfer agent, since the transfer agent can always queue the request
  645. + X  and try again later whereas a user gets upset if he or she gets a
  646. + X  "can't update system mailbox" error.
  647. + X
  648. + X  Since only one routine can have a file open for reading at a time, the
  649. + X  flock() command is essentially useless.  In order to release a lock,
  650. + X  the application must close the file.
  651. + X
  652. + X  These routines are #define-level compatible with their UNIX counterparts.
  653. + X  I.e., #define open apollo_open, #define fopen apollo_fopen,
  654. + X  #define flock apollo_flock may be put in the application header file,
  655. + X  surrounded with "#ifdef apollo .. #endif".
  656. + X
  657. + XDISPLAY MANAGER PAD ROUTINES:
  658. + X
  659. + X  The foremost routine in apollo_pad.c is apollo_ispad().  This simply
  660. + X  returns the logical truth value of the question "Is the standard output
  661. + X  stream a display manager pad?"
  662. + X
  663. + X  Based on this, the screen height for mush may be set according to the
  664. + X  number of lines in the pad, using the apollo_padheight() function.  This
  665. + X  is handled in init.c.
  666. + X
  667. + X  Other special cases to note if the output stream is a pad include the
  668. + X  fact that cbreak and echo mode should not be changed.  If this is done,
  669. + X  the pad will switch into vt100 mode, which is essentially a different
  670. + X  window from the pad.  The switch is visually unpleasant, interrupting
  671. + X  the flow of text, and any transcript is lost once the vt100 window exits.
  672. + X
  673. + X  Also, pagers should not be used in DM pads.  Since they switch into
  674. + X  cbreak mode, the previous problem comes up, and besides, the DM pad
  675. + X  has a large number of commands available for quick scrolling and
  676. + X  searching within the pad, as well as the HOLD key, so pagers aren't
  677. + X  even really necessary.
  678. + X
  679. + X  All these changes are transparent to someone using mush from a terminal.
  680. + X  These only apply when someone is sitting at the display console of an
  681. + X  Apollo workstation.
  682. + X
  683. + X------------------------
  684. + X
  685. + X        Many thanks to Paul Killey <paul@engin.umich.edu>
  686. + X        for his invaluable assistance in making these modifications.
  687. + X
  688. + X            Mike Pelletier, <stealth@engin.umich.edu>
  689. + SHAR_EOF
  690. + chmod 0600 README.apollo || echo "restore of README.apollo fails"
  691. + set `wc -c README.apollo`;Sum=$1
  692. + if test "$Sum" != "4455"
  693. + then echo original size 4455, current size $Sum;fi
  694. + echo "x - extracting makefile.apollo (Text)"
  695. + sed 's/^X//' << 'SHAR_EOF' > makefile.apollo &&
  696. + X# makefile.apollo
  697. + X#
  698. + XHDRS= mush.h config.h-dist strings.h bindings.h options.h version.h glob.h
  699. + X
  700. + XSRCS= main.c init.c misc.c mail.c hdrs.c execute.c commands.c print.c dates.c \
  701. + X      signals.c setopts.c msgs.c pick.c sort.c expr.c folders.c \
  702. + X      loop.c viewopts.c curses.c curs_io.c bind.c file.c strings.c \
  703. + X      lock.c macros.c options.c addrs.c malloc.c glob.c command2.c \
  704. + X      apollo_file.c apollo_pad.c
  705. + XOBJS= main.o init.o misc.o mail.o hdrs.o execute.o commands.o print.o file.o \
  706. + X      signals.o setopts.o msgs.o pick.o sort.o expr.o strings.o \
  707. + X      folders.o dates.o loop.o viewopts.o curses.o curs_io.o bind.o \
  708. + X      lock.o macros.o options.o addrs.o malloc.o glob.o command2.o \
  709. + X      apollo_file.o apollo_pad.o
  710. + X
  711. + XHELP_FILES= README README-7.0 README-7.1 README-7.2.0 README-7.2.2 \
  712. + X    README-7.2.4 mush.1 cmd_help Mushrc Mailrc Gnurc \
  713. + X    sample.mushrc advanced.mushrc digestify
  714. + X
  715. + XMAKES= makefile.bsd makefile.xenix makefile.sys.v makefile.hpux makefile.sun \
  716. + X    makefile.apollo
  717. + X
  718. + XFIXES= file.c init.c lock.c mail.c main.c msgs.c
  719. + X
  720. + XCC= cc -A nansi
  721. + XCFLAGS= -O -DCURSES -DBSD
  722. + XLDFLAGS=
  723. + XLINTFLAGS= -bxah -Dlint -DCURSES -DBSD
  724. + XLIBS= -lcurses -ltermcap
  725. + XOTHERLIBS=
  726. + X
  727. + Xmush: $(OBJS)
  728. + X    @echo loading...
  729. + X    @$(CC) $(LDFLAGS) $(OBJS) $(LIBS) $(OTHERLIBS) -o mush
  730. + X
  731. + X$(FIXES): apollo.patch
  732. + X    @echo '$@ needs patching -- run "patch -N -p1 < apollo.patch"'; exit 1
  733. + X
  734. + X$(OBJS): config.h mush.h
  735. + Xloop.o: version.h
  736. + X
  737. + Xlint:
  738. + X    lint $(LINTFLAGS) $(SRCS)
  739. + X
  740. + Xclean:
  741. + X    rm -f *.o core mush
  742. + X
  743. + XBINDIR= /usr/local/bin
  744. + XLIBDIR= /usr/local/lib
  745. + XMRCDIR= /usr/lib
  746. + XMANDIR= /usr/local/man/man1
  747. + XMANEXT= 1
  748. + X
  749. + Xinstall: mush
  750. + X    mv mush $(BINDIR)
  751. + X    strip $(BINDIR)/mush
  752. + X    chmod 0755 $(BINDIR)/mush
  753. + X    cp mush.1 $(MANDIR)/mush.$(MANEXT)
  754. + X    chmod 0644 $(MANDIR)/mush.$(MANEXT)
  755. + X    cp cmd_help $(LIBDIR)
  756. + X    chmod 0644 $(LIBDIR)/cmd_help
  757. + X    cp Mushrc $(MRCDIR)/Mushrc
  758. + X    chmod 0644 $(MRCDIR)/Mushrc
  759. + SHAR_EOF
  760. + chmod 0644 makefile.apollo || echo "restore of makefile.apollo fails"
  761. + set `wc -c makefile.apollo`;Sum=$1
  762. + if test "$Sum" != "1828"
  763. + then echo original size 1828, current size $Sum;fi
  764. + echo "x - extracting apollo.patch (Text)"
  765. + sed 's/^X//' << 'SHAR_EOF' > apollo.patch &&
  766. + X*** 7.2.4/file.c    Thu Jan 30 20:50:48 1992
  767. + X--- apollo/file.c    Fri Feb 14 07:48:54 1992
  768. + X***************
  769. + X*** 467,473 ****
  770. + X--- 467,477 ----
  771. + X  mask_fopen(file, mode)
  772. + X  char *file, *mode;
  773. + X  {
  774. + X+ #ifdef apollo
  775. + X+     int needs_chmod = (Access(file, F_OK) < 0);
  776. + X+ #else
  777. + X      int omask = umask(077);
  778. + X+ #endif
  779. + X      FILE *fp;
  780. + X  #ifdef SYSV
  781. + X      /* XENIX and other older sytems can't handle "a+".    Even newer
  782. + X***************
  783. + X*** 482,490 ****
  784. + X      if (fp = fopen(file, mode))
  785. + X          (void) fseek(fp, 0L, 2); /* assure we're at the end of the file */
  786. + X      } else
  787. + X! #endif /* SYSV */
  788. + X      fp = fopen(file, mode);
  789. + X      (void) umask(omask);
  790. + X      return fp;
  791. + X  }
  792. + X  
  793. + X--- 486,500 ----
  794. + X      if (fp = fopen(file, mode))
  795. + X          (void) fseek(fp, 0L, 2); /* assure we're at the end of the file */
  796. + X      } else
  797. + X! #endif /* M_XENIX || SYSV && !USG */
  798. + X      fp = fopen(file, mode);
  799. + X+ #ifdef apollo
  800. + X+     /* Initial file ACL's override umask so make sure mode is right */
  801. + X+     if (fp && needs_chmod)
  802. + X+     (void) chmod(file, 0600);
  803. + X+ #else
  804. + X      (void) umask(omask);
  805. + X+ #endif
  806. + X      return fp;
  807. + X  }
  808. + X  
  809. + X*** 7.2.4/init.c    Thu Jan 30 00:14:42 1992
  810. + X--- apollo/init.c    Thu Jan 30 20:51:42 1992
  811. + X***************
  812. + X*** 90,95 ****
  813. + X--- 90,102 ----
  814. + X      (void) add_option(&set_options, argv);
  815. + X      }
  816. + X      crt = 24;
  817. + X+ #ifdef apollo
  818. + X+     if (apollo_ispad()) {
  819. + X+     /* If a pad, set the screen height properly */
  820. + X+     screen = apollo_padheight() - 2;
  821. + X+     crt = screen + 3;
  822. + X+     } else
  823. + X+ #endif /* apollo */
  824. + X      screen = 18;
  825. + X      wrapcolumn = 0; /* Default is no wrap */
  826. + X      escape = DEF_ESCAPE;
  827. + X*** 7.2.4/lock.c    Sun Feb  2 19:43:53 1992
  828. + X--- apollo/lock.c    Sun Feb  2 19:46:24 1992
  829. + X***************
  830. + X*** 303,308 ****
  831. + X--- 303,311 ----
  832. + X  {
  833. + X      struct options *tmp;
  834. + X      FILE *fp;
  835. + X+ #ifdef apollo
  836. + X+     int oldinterval, olddead;
  837. + X+ #endif /* apollo */
  838. + X      
  839. + X      for (tmp = exclude_list; tmp; tmp = tmp->next)
  840. + X      if (strcmp(tmp->option, filename) == 0) {
  841. + X***************
  842. + X*** 317,323 ****
  843. + X      if (dot_lock(filename) != 0)
  844. + X      return NULL_FILE;
  845. + X  #endif /* DOT_LOCK */
  846. + X!     if (!(fp = mask_fopen(filename, mode)))
  847. + X      return NULL_FILE;
  848. + X      if (tmp = (struct options *)malloc(sizeof(struct options))) {
  849. + X      tmp->option = savestr(filename);
  850. + X--- 320,336 ----
  851. + X      if (dot_lock(filename) != 0)
  852. + X      return NULL_FILE;
  853. + X  #endif /* DOT_LOCK */
  854. + X! #ifdef apollo
  855. + X!     /* Set up only one open attempt and no wait time on failure */
  856. + X!     oldinterval = setintervaltime(0);
  857. + X!     olddead = setdeadtime(1);
  858. + X! #endif /* apollo */
  859. + X!     fp = mask_fopen(filename, mode);
  860. + X! #ifdef apollo
  861. + X!     (void) setintervaltime(oldinterval);
  862. + X!     (void) setdeadtime(olddead);
  863. + X! #endif /* apollo */
  864. + X!     if (!fp)
  865. + X      return NULL_FILE;
  866. + X      if (tmp = (struct options *)malloc(sizeof(struct options))) {
  867. + X      tmp->option = savestr(filename);
  868. + X***************
  869. + X*** 384,389 ****
  870. + X--- 397,408 ----
  871. + X  
  872. + X      if (!(mail_fp = exclusive_fopen(filename, mode)))
  873. + X      return NULL_FILE;
  874. + X+ 
  875. + X+ #ifndef apollo
  876. + X+     /* On the Apollo, mask_fopen() implies a lock,
  877. + X+      * so we needn't mess with any of this stuff.
  878. + X+      */
  879. + X+ 
  880. + X      fd = fileno(mail_fp);
  881. + X  
  882. + X      if (mode[0] != 'r' || mode[1] == '+')
  883. + X***************
  884. + X*** 436,441 ****
  885. + X--- 455,462 ----
  886. + X      (void) exclusive_fclose(mail_fp);
  887. + X      return NULL_FILE;
  888. + X      }
  889. + X+ #endif /* !apollo */
  890. + X+ 
  891. + X      return mail_fp;
  892. + X  }
  893. + X  
  894. + X*** 7.2.4/mail.c    Thu May 16 20:05:57 1991
  895. + X--- apollo/mail.c    Thu Jan 30 20:26:42 1992
  896. + X***************
  897. + X*** 601,606 ****
  898. + X--- 601,612 ----
  899. + X          if (!*p || *p == 'i')
  900. + X          switch (line[1]) {
  901. + X              case 'p' :
  902. + X+ #ifdef apollo
  903. + X+             if (apollo_ispad()) {
  904. + X+                 p = "NONE";        /* The pad IS the pager */
  905. + X+                 break;
  906. + X+             }
  907. + X+ #endif /* apollo */
  908. + X              if (!*p && !(p = do_set(set_options, "pager")))
  909. + X                  p = DEF_PAGER;
  910. + X              if (!*p || !strcmp(p, "internal"))
  911. + X*** 7.2.4/main.c    Wed Jan 29 23:34:31 1992
  912. + X--- apollo/main.c    Thu Jan 30 21:08:54 1992
  913. + X***************
  914. + X*** 140,145 ****
  915. + X--- 140,150 ----
  916. + X      (void) signal(SIGINT, catch);
  917. + X      (void) signal(SIGQUIT, catch);
  918. + X      (void) signal(SIGHUP, catch);
  919. + X+ #ifdef apollo
  920. + X+         if (apollo_ispad())
  921. + X+             turnon(glob_flags, ECHO_FLAG);
  922. + X+         else
  923. + X+ #endif /* apollo */
  924. + X      if (istool || hdrs_only)
  925. + X          turnon(glob_flags, ECHO_FLAG);
  926. + X      if (!hdrs_only)
  927. + X*** 7.2.4/msgs.c    Wed Nov 13 01:28:43 1991
  928. + X--- apollo/msgs.c    Thu Jan 30 20:30:55 1992
  929. + X***************
  930. + X*** 31,36 ****
  931. + X--- 31,41 ----
  932. + X  #ifdef MSG_SEPARATOR
  933. + X      turnon(flg, NO_SEPARATOR);
  934. + X  #endif /* MMDF */
  935. + X+ #ifdef apollo
  936. + X+     if (!istool && apollo_ispad())
  937. + X+     pager = "NONE";        /* The pad IS the pager */
  938. + X+     else
  939. + X+ #endif /* apollo */
  940. + X      if (!istool && isoff(flg, NO_PAGE) &&
  941. + X          crt < msg[n].m_lines && isoff(flg, M_TOP)) {
  942. + X      if (!(pager = do_set(set_options, "pager")))
  943. + X*** 7.2.4/mush.h    Wed Jan 29 21:57:49 1992
  944. + X--- apollo/mush.h    Thu Jan 30 20:25:40 1992
  945. + X***************
  946. + X*** 56,61 ****
  947. + X--- 56,67 ----
  948. + X  #ifdef BSD
  949. + X  #define fputs Fputs    /* See comments in print.c */
  950. + X  #endif /* BSD */
  951. + X+ #ifdef apollo        /* See apollo_file.c */
  952. + X+ extern FILE *apollo_lkfopen();
  953. + X+ #define fopen(f,m)    apollo_lkfopen(f,m)
  954. + X+ #define open(p,f,m)    apollo_lkopen(p,f,m)
  955. + X+ #define flock(d,o)    apollo_flock(d,o)
  956. + X+ #endif /* apollo */
  957. + X  
  958. + X  #if defined(BSD) || defined(GETWD)
  959. + X  extern char *getwd();
  960. + SHAR_EOF
  961. + chmod 0644 apollo.patch || echo "restore of apollo.patch fails"
  962. + set `wc -c apollo.patch`;Sum=$1
  963. + if test "$Sum" != "5160"
  964. + then echo original size 5160, current size $Sum;fi
  965. + echo "x - extracting apollo_file.c (Text)"
  966. + sed 's/^X//' << 'SHAR_EOF' > apollo_file.c &&
  967. + X/*
  968. + X *    Take unix open() args, and call ios_$open() appropriately.
  969. + X *
  970. + X *    Written by Paul Killey, paul@engin.umich.edu
  971. + X *    Incorporated into mush by Mike Pelletier, stealth@engin.umich.edu
  972. + X *                    Mon Oct 25 13:09:38 EDT 1991
  973. + X */
  974. + X
  975. + X#ifdef apollo
  976. + X
  977. + X#ifdef __STDC__
  978. + X#include <apollo_$std.h>
  979. + X#include <apollo/base.h>
  980. + X#include <apollo/ios.h>
  981. + X#include <apollo/error.h>
  982. + X#include <apollo/type_uids.h>
  983. + X#include <apollo/cal.h>
  984. + X#include <apollo/time.h>
  985. + X#else
  986. + X#include "/sys/ins/base.ins.c"
  987. + X#include "/sys/ins/ios.ins.c"
  988. + X#include "/sys/ins/error.ins.c"
  989. + X#include "/sys/ins/type_uids.ins.c"
  990. + X#include "/sys/ins/cal.ins.c"
  991. + X#include "/sys/ins/time.ins.c"
  992. + X#endif /* __STDC__ */
  993. + X
  994. + X
  995. + X#include <stdio.h>
  996. + X#include <sys/file.h>
  997. + X
  998. + Xstd_$call boolean unix_fio_$status_to_errno();
  999. + X
  1000. + X/*
  1001. + X * total amount of time to try for.
  1002. + X */
  1003. + X#ifndef DEADTIME
  1004. + X#define DEADTIME    15
  1005. + X#endif
  1006. + X
  1007. + X/*
  1008. + X * number of tries to make.
  1009. + X */
  1010. + X#ifndef INTERVAL
  1011. + X#define INTERVAL    3
  1012. + X#endif
  1013. + X
  1014. + Xstatic int lockdeadtime = DEADTIME;
  1015. + Xstatic int lockintervaltime = INTERVAL;
  1016. + X
  1017. + Xapollo_lkopen(path, flags, mode)
  1018. + X    char * path;
  1019. + X    int flags, mode;
  1020. + X{
  1021. + X
  1022. + X    ios_$open_options_t    ios_open_options;
  1023. + X    ios_$create_mode_t    ios_create_options;
  1024. + X    status_$t            status;
  1025. + X    ios_$id_t            stream_id;
  1026. + X
  1027. + X    int i;
  1028. + X
  1029. + X
  1030. + X/*
  1031. + X *    From file.h
  1032. + X *
  1033. + X *    #define    O_RDONLY    000        open for reading
  1034. + X *    #define    O_WRONLY    001        open for writing
  1035. + X *    #define    O_RDWR        002        open for read & write
  1036. + X *    #define    O_NDELAY    FNDELAY        non-blocking open
  1037. + X *    #define    O_APPEND    FAPPEND        append on each write
  1038. + X *    #define    O_CREAT        FCREAT        open with file create
  1039. + X *    #define    O_TRUNC        FTRUNC        open with truncation
  1040. + X *    #define    O_EXCL        FEXCL        error on create if file exists
  1041. + X */
  1042. + X
  1043. + X/*
  1044. + X *    First, figure out the open mode ...
  1045. + X */
  1046. + X
  1047. + X    if (flags == O_RDONLY)
  1048. + X    ios_open_options = ios_$no_open_options;
  1049. + X    else
  1050. + X    ios_open_options = ios_$write_opt;
  1051. + X
  1052. + X    if (flags & O_WRONLY)
  1053. + X    ios_open_options |= ios_$no_read_opt;
  1054. + X
  1055. + X    if (flags & O_NDELAY)
  1056. + X    ios_open_options |= ios_$no_open_delay_opt;
  1057. + X
  1058. + X/*
  1059. + X *    Now, check the create mode ...
  1060. + X */
  1061. + X
  1062. + X    if (flags & O_EXCL)
  1063. + X    ios_create_options = ios_$no_pre_exist_mode;
  1064. + X    else if (flags & O_TRUNC)
  1065. + X    ios_create_options = ios_$truncate_mode;
  1066. + X    else
  1067. + X    ios_create_options = ios_$preserve_mode;
  1068. + X
  1069. + X/*
  1070. + X *    OK, now what?  These routines are intended for mail applications
  1071. + X *    where I wanted some consistency across applications.  My rules are:
  1072. + X *        (1)    Try every ten seconds for a minute to open the file.
  1073. + X *            If the failure is ios_$concurrency, sleep an try again.
  1074. + X *        (2)    Unless a non-blocking open is desired, in which case
  1075. + X *            return.  (That runs counter to what I wanted here, so
  1076. + X *            I don't call it with that flag, because I *want* this
  1077. + X *            routine to do things so callers can take it easy.
  1078. + X *        (3)    Or, if there is any other error, return.
  1079. + X */
  1080. + X
  1081. + X
  1082. + X    for (i = 0; i < lockdeadtime; i += lockintervaltime) {
  1083. + X    if (flags & O_CREAT)
  1084. + X#ifdef __STDC__
  1085. + X        ios_$create(path, (short) strlen(path),
  1086. + X        uid_$nil,
  1087. + X        ios_create_options, ios_open_options, &stream_id, &status);
  1088. + X#else
  1089. + X         ios_$create(*path, (short) strlen(path), uid_$nil,
  1090. + X            ios_create_options, ios_open_options, stream_id, status);
  1091. + X#endif /* _STDC__ */
  1092. + X          else
  1093. + X#ifdef __STDC__
  1094. + X              stream_id = ios_$open(path, (short)strlen(path),
  1095. + X                ios_open_options, &status);
  1096. + X#else
  1097. + X        stream_id = ios_$open(*path, (short)strlen(path),
  1098. + X                ios_open_options, status);
  1099. + X#endif /* __STDC__ */
  1100. + X
  1101. + X    if (status.all == status_$ok) {
  1102. + X        if ((ios_open_options & ios_$write_opt) &&
  1103. + X            (ios_create_options ==  ios_$truncate_mode)) {
  1104. + X#ifdef __STDC__
  1105. + X            ios_$truncate(stream_id, &status);
  1106. + X#else
  1107. + X            ios_$truncate(stream_id, status);
  1108. + X#endif
  1109. + X            if (status.all != status_$ok &&
  1110. + X                status.all != ios_$illegal_operation) {
  1111. + X            unix_fio_$status_to_errno (status, path, strlen(path));
  1112. + X#ifdef __STDC__
  1113. + X            ios_$close(stream_id, &status);
  1114. + X#else
  1115. + X            ios_$close(stream_id, status);
  1116. + X#endif
  1117. + X            return (-1);
  1118. + X            }
  1119. + X        }
  1120. + X#ifdef __STDC__
  1121. + X        ios_$set_obj_flag(stream_id, ios_$of_sparse_ok, true, &status);
  1122. + X#else
  1123. + X        ios_$set_obj_flag(stream_id, ios_$of_sparse_ok, true, status);
  1124. + X#endif
  1125. + X        if (flags & O_APPEND)
  1126. + X#ifdef  __STDC__
  1127. + X            ios_$set_conn_flag(stream_id, ios_$cf_append, true, &status);
  1128. + X#else
  1129. + X            ios_$set_conn_flag(stream_id, ios_$cf_append, true, status);
  1130. + X#endif
  1131. + X        return (stream_id);
  1132. + X    }
  1133. + X
  1134. + X    if (status.all == ios_$concurrency_violation &&
  1135. + X        (flags & O_NDELAY) == 0)
  1136. + X        apollo_sleep(INTERVAL);
  1137. + X    else {
  1138. + X        /* error_$print (status); */
  1139. + X        unix_fio_$status_to_errno (status, *path, (short)strlen(path));
  1140. + X        return (-1);
  1141. + X    }
  1142. + X    }
  1143. + X    /* error_$print (status); */
  1144. + X    unix_fio_$status_to_errno (status, path, strlen(path));
  1145. + X
  1146. + X    return (-1);
  1147. + X}
  1148. + X
  1149. + X
  1150. + X/*
  1151. + X *    An interface to get a FILE *
  1152. + X */
  1153. + X
  1154. + XFILE *
  1155. + Xapollo_lkfopen(file, mode)
  1156. + X    char *file, *mode;
  1157. + X{
  1158. + X     int rw, f, oflags;
  1159. + X    FILE *fp; 
  1160. + X    rw = (mode[1] == '+');
  1161. + X
  1162. + X    switch (*mode) {
  1163. + X    case 'a':
  1164. + X    oflags = O_CREAT | (rw ? O_RDWR : O_WRONLY);
  1165. + X    break;
  1166. + X    case 'r':
  1167. + X    oflags = rw ? O_RDWR : O_RDONLY;
  1168. + X    break;
  1169. + X    case 'w':
  1170. + X    oflags = O_TRUNC | O_CREAT | (rw ? O_RDWR : O_WRONLY);
  1171. + X    break;
  1172. + X    default:
  1173. + X    return (NULL);
  1174. + X    }
  1175. + X
  1176. + X    f = apollo_lkopen(file, oflags, 0666);
  1177. + X    if (f < 0)
  1178. + X    return (NULL);
  1179. + X
  1180. + X    /*
  1181. + X     *  should just use ios_$position_to_eof_opt!
  1182. + X     */
  1183. + X
  1184. + X    if (*mode == 'a')
  1185. + X    lseek(f, (long)0, L_XTND);
  1186. + X
  1187. + X    fp = fdopen(f, mode);
  1188. + X
  1189. + X    return(fp);
  1190. + X}
  1191. + X
  1192. + X
  1193. + Xapollo_sleep(seconds)
  1194. + X    unsigned int seconds;
  1195. + X{
  1196. + X    status_$t s;
  1197. + X    time_$clock_t sleeptime;
  1198. + X
  1199. + X    cal_$sec_to_clock((unsigned long)seconds, &sleeptime);
  1200. + X
  1201. + X    time_$wait(time_$relative, sleeptime, &s);
  1202. + X
  1203. + X    return(s.all);
  1204. + X}
  1205. + X
  1206. + X/*
  1207. + X * The following functions set the amount of time that the open
  1208. + X * command waits for the file, and how frequently it tries.
  1209. + X */
  1210. + X
  1211. + Xsetdeadtime(n)
  1212. + X    int n;
  1213. + X{
  1214. + X    int oldvalue = lockdeadtime;
  1215. + X    lockdeadtime = n;
  1216. + X    return(oldvalue);
  1217. + X}
  1218. + X
  1219. + Xsetintervaltime(n)
  1220. + X{
  1221. + X    int oldvalue = lockintervaltime;
  1222. + X    lockintervaltime = n;
  1223. + X    return(oldvalue);
  1224. + X}
  1225. + X
  1226. + X/*
  1227. + X * Because of Domain/OS's file locking semantics, the flock() command
  1228. + X * isn't really meaningful in the UNIX usage.
  1229. + X */
  1230. + X
  1231. + Xapollo_flock(fd, operation)
  1232. + X{
  1233. + X    return 0;
  1234. + X}
  1235. + X
  1236. + X#endif
  1237. + SHAR_EOF
  1238. + chmod 0600 apollo_file.c || echo "restore of apollo_file.c fails"
  1239. + set `wc -c apollo_file.c`;Sum=$1
  1240. + if test "$Sum" != "6006"
  1241. + then echo original size 6006, current size $Sum;fi
  1242. + echo "x - extracting apollo_pad.c (Text)"
  1243. + sed 's/^X//' << 'SHAR_EOF' > apollo_pad.c &&
  1244. + X/*
  1245. + X * apollo_pad.c: 10/24/1991 version 1.2
  1246. + X *
  1247. + X * apollo_ispad() - returns true if output is going into an Display Manger
  1248. + X *             pad.  Needed because "more" won't work right in a pad.
  1249. + X *
  1250. + X * apollo_padheight() - Returns the height in characters of the pad associated
  1251. + X *            with stdout.  If an error occurs or the stream isn't
  1252. + X *            a pad, a default value of 20 is returned.
  1253. + X *
  1254. + X *    Written by Mike Pelletier, <stealth@engin.umich.edu>, based heavily
  1255. + X *    on work by Paul Killey, <paul@engin.umich.edu>.
  1256. + X */
  1257. + X
  1258. + X#ifdef apollo
  1259. + X
  1260. + X#ifdef __STDC__
  1261. + X#include <apollo/base.h>
  1262. + X#include <apollo/pad.h>
  1263. + X#include <apollo/ios.h>
  1264. + X#else
  1265. + X#include "/sys/ins/base.ins.c"
  1266. + X#include "/sys/ins/pad.ins.c"
  1267. + X#include "/sys/ins/ios.ins.c"
  1268. + X#endif /* __STDC__ */
  1269. + X
  1270. + X#ifdef __STDC__
  1271. + Xextern status_$t errno_$status;
  1272. + X#else
  1273. + Xextern  status_$t unix_fio_$status;
  1274. + X#define errno_$status unix_fio_$status
  1275. + X#endif
  1276. + X
  1277. + X/*
  1278. + X *    Return true if we're outputting into an Apollo DM pad...
  1279. + X */
  1280. + X
  1281. + Xapollo_ispad() {
  1282. + X
  1283. + X    short disunit = 1;
  1284. + X    pad_$display_type_t distype;
  1285. + X    status_$t status;
  1286. + X
  1287. + X#ifdef __STDC__
  1288. + X    pad_$inq_disp_type(ios_$stdout, &distype, &disunit, &status);
  1289. + X#else
  1290. + X    pad_$inq_disp_type(ios_$stdout, distype, disunit, status);
  1291. + X#endif /* __STDC__ */
  1292. + X
  1293. + X    return (status.all == status_$ok);
  1294. + X}
  1295. + X
  1296. + X
  1297. + X/*
  1298. + X * Returns the height of the pad associated with stdout
  1299. + X */
  1300. + X
  1301. + Xapollo_padheight() {
  1302. + X
  1303. + X    static short FontHeight, FontWidth, FontNameLength;
  1304. + X    static int height;
  1305. + X    status_$t Status;
  1306. + X    char FontName[256];
  1307. + X    short WindowCount;
  1308. + X
  1309. + X#ifdef __STDC__
  1310. + X    pad_$window_list_t CurrentWindow;
  1311. + X#else
  1312. + X    pad_$window_desc_t CurrentWindow;
  1313. + X#endif /* __STDC__ */
  1314. + X
  1315. + X#ifdef __STDC__
  1316. + X    pad_$inq_font(ios_$stdout, &FontWidth, &FontHeight, FontName, 256,
  1317. + X            &FontNameLength, &Status);
  1318. + X#else
  1319. + X    pad_$inq_font(ios_$stdout, FontWidth, FontHeight, FontName, 256,
  1320. + X            FontNameLength, Status);
  1321. + X#endif /* __STDC__ */
  1322. + X
  1323. + X    if (Status.all == status_$ok) {
  1324. + X#ifdef __STDC__
  1325. + X    pad_$set_scale(ios_$stdout, 1, 1, &Status);
  1326. + X    pad_$inq_windows(ios_$stdout, CurrentWindow, 1, &WindowCount, &Status);
  1327. + X    height = CurrentWindow[0].height / FontHeight;
  1328. + X#else
  1329. + X        pad_$set_scale(ios_$stdout, 1, 1, Status);
  1330. + X        pad_$inq_windows(ios_$stdout, CurrentWindow, 1, WindowCount, Status);
  1331. + X        height = CurrentWindow.height / FontHeight;
  1332. + X#endif /* __STDC__ */
  1333. + X    } else {
  1334. + X    height = 20;
  1335. + X    }
  1336. + X}
  1337. + X
  1338. + X#endif /* apollo */
  1339. + SHAR_EOF
  1340. + chmod 0600 apollo_pad.c || echo "restore of apollo_pad.c fails"
  1341. + set `wc -c apollo_pad.c`;Sum=$1
  1342. + if test "$Sum" != "2324"
  1343. + then echo original size 2324, current size $Sum;fi
  1344. + exit 0
  1345.  
  1346. -- 
  1347. Bart Schaefer                                     schaefer@zigzag.z-code.com
  1348. Z-Code Software Corp.                             schaefer@z-code.com
  1349. New male in /home/schaefer:
  1350.   1  N  Benjamin Timothy Schaefer  Nov 26 1991 (3572g) Happy Birthday!
  1351.  
  1352. exit 0 # Just in case...
  1353.