home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume1 / bourne / part5 < prev    next >
Internet Message Format  |  1986-11-30  |  49KB

  1. Date: Fri, 7 Jun 85 14:08:23 edt
  2. From: Arnold Robbins <gatech!arnold>
  3. Subject: Bourne shell history + tilde + job control + more (Part 5 of 9)
  4. Newsgroups: mod.sources
  5.  
  6. This is part 5 of 9.  It contains the first set of code diffs for the System V
  7. Release 2 Bourne shell.
  8.  
  9. BSD users who happen to also have source for System V Release 2 will probably
  10. want to use this version of the shell, since it has many bug fixes and
  11. improvements over the (much) earlier version that comes with Berkeley Unix.
  12.  
  13. Arnold Robbins
  14. arnold@gatech.{UUCP, CSNET}
  15. ----------- pretend your screen is really a paper towel ------------
  16. :::::::: :fix :::::::
  17. No differences encountered
  18. :::::::: args.c :::::::
  19. *** ../orig.u/args.c    Wed May 15 17:08:06 1985
  20. --- args.c    Mon May 20 15:20:33 1985
  21. ***************
  22. *** 13,19
  23.   extern struct dolnod *freeargs();
  24.   static struct dolnod *dolh;
  25.   
  26. ! char    flagadr[14];
  27.   
  28.   char    flagchar[] =
  29.   {
  30.  
  31. --- 13,23 -----
  32.   extern struct dolnod *freeargs();
  33.   static struct dolnod *dolh;
  34.   
  35. ! #if JOBS
  36. ! char    flagadr[19];
  37. ! #else
  38. ! char    flagadr[17];
  39. ! #endif
  40.   
  41.   char    flagchar[] =
  42.   {
  43. ***************
  44. *** 30,35
  45.       'h',
  46.       'f',
  47.       'a',
  48.        0
  49.   };
  50.   
  51.  
  52. --- 34,46 -----
  53.       'h',
  54.       'f',
  55.       'a',
  56. + #if JOBS
  57. +     'J',
  58. +     'I',
  59. + #endif
  60. +     'E',
  61. +     'q',    /* ADR --- -q to not read ~/.shrc */
  62. +     'H',    /* ADR --- -H to turn off history mechanism */
  63.        0
  64.   };
  65.   
  66. ***************
  67. *** 48,53
  68.       hashflg,
  69.       nofngflg,
  70.       exportflg,
  71.         0
  72.   };
  73.   
  74.  
  75. --- 59,71 -----
  76.       hashflg,
  77.       nofngflg,
  78.       exportflg,
  79. + #if JOBS
  80. +     jobflg,
  81. +     infoflg,
  82. + #endif
  83. +     noeotflg,
  84. +     quickflg,
  85. +     nohistflg,
  86.         0
  87.   };
  88.   
  89. ***************
  90. *** 83,89
  91.   
  92.           /*
  93.            * Step along 'flagchar[]' looking for matches.
  94. !          * 'sicr' are not legal with 'set' command.
  95.            */
  96.   
  97.           while (*++cp)
  98.  
  99. --- 101,107 -----
  100.   
  101.           /*
  102.            * Step along 'flagchar[]' looking for matches.
  103. !          * 'sicrq' are not legal with 'set' command.
  104.            */
  105.   
  106.           while (*++cp)
  107. ***************
  108. *** 93,99
  109.                   flagc++;
  110.               if (*cp == *flagc)
  111.               {
  112. !                 if (eq(argv[0], "set") && any(*cp, "sicr"))
  113.                       failed(argv[1], badopt);
  114.                   else
  115.                   {
  116.  
  117. --- 111,117 -----
  118.                   flagc++;
  119.               if (*cp == *flagc)
  120.               {
  121. !                 if (eq(argv[0], "set") && any(*cp, "sicrq"))
  122.                       failed(argv[1], badopt);
  123.                   else
  124.                   {
  125. ***************
  126. *** 97,102
  127.                       failed(argv[1], badopt);
  128.                   else
  129.                   {
  130.                       flags |= flagval[flagc-flagchar];
  131.                       if (flags & errflg)
  132.                           eflag = errflg;
  133.  
  134. --- 115,124 -----
  135.                       failed(argv[1], badopt);
  136.                   else
  137.                   {
  138. + #if JOBS
  139. +                     if (*cp == 'J')
  140. +                         j_init();
  141. + #endif
  142.                       flags |= flagval[flagc-flagchar];
  143.                       if (flags & errflg)
  144.                           eflag = errflg;
  145. ***************
  146. *** 116,121
  147.           argc--;
  148.       }
  149.       else if (argc > 1 && *argp[1] == '+')    /* unset flags x, k, t, n, v, e, u */
  150.       {
  151.           cp = argp[1];
  152.           while (*++cp)
  153.  
  154. --- 138,144 -----
  155.           argc--;
  156.       }
  157.       else if (argc > 1 && *argp[1] == '+')    /* unset flags x, k, t, n, v, e, u */
  158. +                         /* or jobs or history flag */
  159.       {
  160.           cp = argp[1];
  161.           while (*++cp)
  162. ***************
  163. *** 126,132
  164.               /*
  165.                * step through flags
  166.                */
  167. !             if (!any(*cp, "sicr") && *cp == *flagc)
  168.               {
  169.                   /*
  170.                    * only turn off if already on
  171.  
  172. --- 149,155 -----
  173.               /*
  174.                * step through flags
  175.                */
  176. !             if (!any(*cp, "sicrq") && *cp == *flagc)
  177.               {
  178.                   /*
  179.                    * only turn off if already on
  180. ***************
  181. *** 133,139
  182.                    */
  183.                   if ((flags & flagval[flagc-flagchar]))
  184.                   {
  185. !                     flags &= ~(flagval[flagc-flagchar]);
  186.                       if (*cp == 'e')
  187.                           eflag = 0;
  188.                   }
  189.  
  190. --- 156,165 -----
  191.                    */
  192.                   if ((flags & flagval[flagc-flagchar]))
  193.                   {
  194. ! #if JOBS
  195. !                     if (*cp != 'J' || !j_finish(FALSE))
  196. ! #endif
  197. !                         flags &= ~(flagval[flagc-flagchar]);
  198.                       if (*cp == 'e')
  199.                           eflag = 0;
  200.                   }
  201. :::::::: blok.c :::::::
  202. *** ../orig.u/blok.c    Wed May 15 17:08:06 1985
  203. --- blok.c    Thu May 16 16:56:01 1985
  204. ***************
  205. *** 102,107
  206.   {
  207.       register struct blk *p;
  208.   
  209.       if ((p = ap) && p < bloktop)
  210.       {
  211.   #ifdef DEBUG
  212.  
  213. --- 102,116 -----
  214.   {
  215.       register struct blk *p;
  216.   
  217. + #if gould
  218. + /*
  219. +  *    On Vax, <bloktop skips things on stack, doesn't on Gould
  220. +  *    where stack is below text.
  221. +  */
  222. +     int csrt();
  223. +     if ((p = ap) && p < bloktop && p > (struct blk *)csrt)
  224. + #else
  225.       if ((p = ap) && p < bloktop)
  226.   #endif
  227.       {
  228. ***************
  229. *** 103,108
  230.       register struct blk *p;
  231.   
  232.       if ((p = ap) && p < bloktop)
  233.       {
  234.   #ifdef DEBUG
  235.           chkbptr(p);
  236.  
  237. --- 112,118 -----
  238.       if ((p = ap) && p < bloktop && p > (struct blk *)csrt)
  239.   #else
  240.       if ((p = ap) && p < bloktop)
  241. + #endif
  242.       {
  243.   #ifdef DEBUG
  244.           chkbptr(p);
  245. :::::::: brkincr.h :::::::
  246. *** ../orig.u/brkincr.h    Wed May 15 17:08:07 1985
  247. --- brkincr.h    Thu May 16 16:57:06 1985
  248. ***************
  249. *** 1,4
  250.   /*    @(#)brkincr.h    1.2    */
  251.   /*    3.0 SID #    1.1    */
  252.   #define BRKINCR 01000
  253.   #define BRKMAX 04000
  254.  
  255. --- 1,9 -----
  256.   /*    @(#)brkincr.h    1.2    */
  257.   /*    3.0 SID #    1.1    */
  258. + #if gould
  259. + #define BRKINCR 0x1000
  260. + #define BRKMAX 0x2000
  261. + #else
  262.   #define BRKINCR 01000
  263.   #define BRKMAX 04000
  264.   #endif
  265. ***************
  266. *** 2,4
  267.   /*    3.0 SID #    1.1    */
  268.   #define BRKINCR 01000
  269.   #define BRKMAX 04000
  270.  
  271. --- 6,9 -----
  272.   #else
  273.   #define BRKINCR 01000
  274.   #define BRKMAX 04000
  275. + #endif
  276. :::::::: cmd.c :::::::
  277. No differences encountered
  278. :::::::: ctype.c :::::::
  279. *** ../orig.u/ctype.c    Wed May 15 17:08:09 1985
  280. --- ctype.c    Mon May 20 16:14:46 1985
  281. ***************
  282. *** 21,26
  283.       0,    0,    0,    0,    0,    0,    0,    0,
  284.   
  285.   /*    sp    !    "    #    $    %    &    '    */
  286.       _SPC,    0,    _DQU,    0,    _DOL1,    0,    _AMP,    0,
  287.   
  288.   /*    (    )    *    +    ,    -    .    /    */
  289.  
  290. --- 21,29 -----
  291.       0,    0,    0,    0,    0,    0,    0,    0,
  292.   
  293.   /*    sp    !    "    #    $    %    &    '    */
  294. + #if JOBS
  295. +     _SPC,    0,    _DQU,    0,    _DOL1,    _PCT,    _AMP,    0,
  296. + #else
  297.       _SPC,    0,    _DQU,    0,    _DOL1,    0,    _AMP,    0,
  298.   #endif
  299.   
  300. ***************
  301. *** 22,27
  302.   
  303.   /*    sp    !    "    #    $    %    &    '    */
  304.       _SPC,    0,    _DQU,    0,    _DOL1,    0,    _AMP,    0,
  305.   
  306.   /*    (    )    *    +    ,    -    .    /    */
  307.       _BRA,    _KET,    0,    0,    0,    0,    0,    0,
  308.  
  309. --- 25,31 -----
  310.       _SPC,    0,    _DQU,    0,    _DOL1,    _PCT,    _AMP,    0,
  311.   #else
  312.       _SPC,    0,    _DQU,    0,    _DOL1,    0,    _AMP,    0,
  313. + #endif
  314.   
  315.   /*    (    )    *    +    ,    -    .    /    */
  316.       _BRA,    _KET,    0,    0,    0,    0,    0,    0,
  317. :::::::: ctype.h :::::::
  318. *** ../orig.u/ctype.h    Wed May 15 17:08:09 1985
  319. --- ctype.h    Thu May 16 16:59:28 1985
  320. ***************
  321. *** 46,51
  322.   #define _BSL    (T_ESC)
  323.   #define _DQU    (T_QOT)
  324.   #define _DOL1    (T_SUB|T_ESC)
  325.   
  326.   #define _CBR    T_BRC
  327.   #define _CKT    T_DEF
  328.  
  329. --- 46,54 -----
  330.   #define _BSL    (T_ESC)
  331.   #define _DQU    (T_QOT)
  332.   #define _DOL1    (T_SUB|T_ESC)
  333. + #if JOBS
  334. + #define _PCT    (T_SUB|T_ESC)
  335. + #endif
  336.   
  337.   #define _CBR    T_BRC
  338.   #define _CKT    T_DEF
  339. ***************
  340. *** 77,83
  341.   extern char    _ctype2[];
  342.   
  343.   #define    digit(c)    (((c)"E)==0 && _ctype2[c]&(T_DIG))
  344. ! #define dolchar(c)    (((c)"E)==0 && _ctype2[c]&(T_AST|T_BRC|T_DIG|T_IDC|T_SHN))
  345.   #define defchar(c)    (((c)"E)==0 && _ctype2[c]&(T_DEF))
  346.   #define setchar(c)    (((c)"E)==0 && _ctype2[c]&(T_SET))
  347.   #define digchar(c)    (((c)"E)==0 && _ctype2[c]&(T_AST|T_DIG))
  348.  
  349. --- 80,86 -----
  350.   extern char    _ctype2[];
  351.   
  352.   #define    digit(c)    (((c)"E)==0 && _ctype2[c]&(T_DIG))
  353. ! #define dolchar(c)    (((c)"E)==0 && _ctype2[c]&(T_AST|T_BRC|T_DIG|T_IDC|T_SHN|_PLS))
  354.   #define defchar(c)    (((c)"E)==0 && _ctype2[c]&(T_DEF))
  355.   #define setchar(c)    (((c)"E)==0 && _ctype2[c]&(T_SET))
  356.   #define digchar(c)    (((c)"E)==0 && _ctype2[c]&(T_AST|T_DIG))
  357. :::::::: defs.c :::::::
  358. *** ../orig.u/defs.c    Wed May 15 17:08:10 1985
  359. --- defs.c    Mon May 20 15:56:37 1985
  360. ***************
  361. *** 17,22
  362.   struct ionod    *iopend;    /* documents waiting to be read at NL */
  363.   struct fdsave    fdmap[NOFILE];
  364.   
  365.   /* substitution */
  366.   int                dolc;
  367.   char            **dolv;
  368.  
  369. --- 17,34 -----
  370.   struct ionod    *iopend;    /* documents waiting to be read at NL */
  371.   struct fdsave    fdmap[NOFILE];
  372.   
  373. + /* history stuff */
  374. + int    event_count = 1;    /* event counting for the prompt */
  375. + int    expanded;        /* did a history expansion occur */
  376. + /* keep track of the parent pid */
  377. + int    ppid;
  378. + #if pyr
  379. + /* keep track of the current universe */
  380. + int    cur_univ;
  381. + #endif
  382.   /* substitution */
  383.   int                dolc;
  384.   char            **dolv;
  385. ***************
  386. *** 36,41
  387.   /* special names */
  388.   char            *pcsadr;
  389.   char            *pidadr;
  390.   char            *cmdadr;
  391.   
  392.   /* transput */ 
  393.  
  394. --- 48,54 -----
  395.   /* special names */
  396.   char            *pcsadr;
  397.   char            *pidadr;
  398. + char            *ppidadr;
  399.   char            *cmdadr;
  400.   
  401.   /* transput */ 
  402. ***************
  403. *** 58,63
  404.   /* execflgs */
  405.   int                exitval;
  406.   int                retval;
  407.   BOOL            execbrk;
  408.   int                loopcnt;
  409.   int                breakcnt;
  410.  
  411. --- 71,79 -----
  412.   /* execflgs */
  413.   int                exitval;
  414.   int                retval;
  415. + #if gould
  416. + int            execbrk;
  417. + #else
  418.   BOOL            execbrk;
  419.   #endif
  420.   int                loopcnt;
  421. ***************
  422. *** 59,64
  423.   int                exitval;
  424.   int                retval;
  425.   BOOL            execbrk;
  426.   int                loopcnt;
  427.   int                breakcnt;
  428.   int             funcnt;
  429.  
  430. --- 75,81 -----
  431.   int            execbrk;
  432.   #else
  433.   BOOL            execbrk;
  434. + #endif
  435.   int                loopcnt;
  436.   int                breakcnt;
  437.   int             funcnt;
  438. :::::::: defs.h :::::::
  439. *** ../orig.u/defs.h    Wed May 15 17:08:11 1985
  440. --- defs.h    Wed Jun  5 15:20:27 1985
  441. ***************
  442. *** 3,8
  443.    *    UNIX shell
  444.    */
  445.   
  446.   
  447.   /* error exits from various parts of shell */
  448.   #define     ERROR        1
  449.  
  450. --- 3,11 -----
  451.    *    UNIX shell
  452.    */
  453.   
  454. + #if JOBS || gould || pyr
  455. + #define        void    int    /* avoid compiler bug */
  456. + #endif
  457.   
  458.   /* error exits from various parts of shell */
  459.   #define     ERROR        1
  460. ***************
  461. *** 74,79
  462.   #define        SYSMEM        27
  463.   #define        SYSTYPE      28
  464.   
  465.   /* used for input and output of shell */
  466.   #define     INIO         19
  467.   
  468.  
  469. --- 77,99 -----
  470.   #define        SYSMEM        27
  471.   #define        SYSTYPE      28
  472.   
  473. + #if JOBS
  474. + #define        SYSJOBS        29
  475. + #define        SYSFG        30
  476. + #define        SYSBG        31
  477. + #define        SYSSUSPEND    32
  478. + #endif
  479. + #if pyr
  480. + #define        SYSATT        33
  481. + #define        SYSUCB        34
  482. + #define        SYSUNIVERSE    35
  483. + #define        U_ATT        1    /* ATT is Universe number 1 */
  484. + #define        U_UCB        2    /* UCB is Universe number 2 */
  485. + #endif
  486. + #define        SYSHISTORY    36
  487.   /* used for input and output of shell */
  488.   #define     INIO         19
  489.   
  490. ***************
  491. *** 96,101
  492.   #include    "mode.h"
  493.   #include    "name.h"
  494.   #include    <signal.h>
  495.   
  496.   
  497.   /*    error catching */
  498.  
  499. --- 116,133 -----
  500.   #include    "mode.h"
  501.   #include    "name.h"
  502.   #include    <signal.h>
  503. + #if defined(JOBS) && ! defined (pyr)    /* avoid dual universe problems */
  504. + #define        SIGUSR1 16
  505. + #define        SIGUSR2    17
  506. + #else
  507. + #if ! defined (pyr)    /* avoid dual universe problems */
  508. + #define        SIGSTOP    17
  509. + #define        SIGTSTP    18
  510. + #define        SIGCONT    19
  511. + #define        SIGTTIN    21
  512. + #define        SIGTTOU    22
  513. + #endif
  514. + #endif
  515.   
  516.   #define        HISTSIZE    4096
  517.   
  518. ***************
  519. *** 97,102
  520.   #include    "name.h"
  521.   #include    <signal.h>
  522.   
  523.   
  524.   /*    error catching */
  525.   extern int         errno;
  526.  
  527. --- 129,135 -----
  528.   #endif
  529.   #endif
  530.   
  531. + #define        HISTSIZE    4096
  532.   
  533.   /*    error catching */
  534.   extern int         errno;
  535. ***************
  536. *** 122,127
  537.   extern char                *mactrim();
  538.   extern char                *macro();
  539.   extern char                *execs();
  540.   extern char                *copyto();
  541.   extern int                exname();
  542.   extern char                *staknam();
  543.  
  544. --- 155,163 -----
  545.   extern char                *mactrim();
  546.   extern char                *macro();
  547.   extern char                *execs();
  548. + extern char                *homedir();
  549. + extern char                *username();
  550. + extern char                *retcwd();
  551.   extern char                *copyto();
  552.   extern int                exname();
  553.   extern char                *staknam();
  554. ***************
  555. *** 130,135
  556.   extern int                printexp();
  557.   extern char                **setenv();
  558.   extern long                time();
  559.   
  560.   #define     attrib(n,f)        (n->namflg |= f)
  561.   #define     round(a,b)        (((int)(((char *)(a)+b)-1))&~((b)-1))
  562.  
  563. --- 166,178 -----
  564.   extern int                printexp();
  565.   extern char                **setenv();
  566.   extern long                time();
  567. + #if JOBS
  568. + extern int                cwdir();    /* chdir() interface */
  569. + extern BOOL                unpost();
  570. + extern BOOL                j_finish();
  571. + extern char                *j_macro();
  572. + #endif
  573. + extern int                history();
  574.   
  575.   #define     attrib(n,f)        (n->namflg |= f)
  576.   #define     round(a,b)        (((int)(((char *)(a)+b)-1))&~((b)-1))
  577. ***************
  578. *** 146,151
  579.   extern struct ionod        *iopend;    /* documents waiting to be read at NL */
  580.   extern struct fdsave    fdmap[];
  581.   
  582.   
  583.   /* substitution */
  584.   extern int                dolc;
  585.  
  586. --- 189,197 -----
  587.   extern struct ionod        *iopend;    /* documents waiting to be read at NL */
  588.   extern struct fdsave    fdmap[];
  589.   
  590. + /* history stuff */
  591. + extern int    event_count;    /* event counting for the prompt */
  592. + extern int    expanded;    /* did a history expansion occur? */
  593.   
  594.   /* keep track of the parent pid */
  595.   extern int    ppid;
  596. ***************
  597. *** 147,152
  598.   extern struct fdsave    fdmap[];
  599.   
  600.   
  601.   /* substitution */
  602.   extern int                dolc;
  603.   extern char                **dolv;
  604.  
  605. --- 193,208 -----
  606.   extern int    event_count;    /* event counting for the prompt */
  607.   extern int    expanded;    /* did a history expansion occur? */
  608.   
  609. + /* keep track of the parent pid */
  610. + extern int    ppid;
  611. + #if pyr
  612. + /* keep track of the current universe */
  613. + extern int    cur_univ;
  614. + extern char    *univ_name[];        /* from <universe.h> */
  615. + extern char    *univ_longname[];
  616. + #endif
  617.   /* substitution */
  618.   extern int                dolc;
  619.   extern char                **dolv;
  620. ***************
  621. *** 166,171
  622.   extern char                unexpected[];
  623.   extern char                endoffile[];
  624.   extern char                synmsg[];
  625.   
  626.   /* name tree and words */
  627.   extern struct sysnod    reserved[];
  628.  
  629. --- 222,274 -----
  630.   extern char                unexpected[];
  631.   extern char                endoffile[];
  632.   extern char                synmsg[];
  633. + extern char                dashi[];    /* ADR -- for history */
  634. + extern char                dashr[];    /* ADR */
  635. + extern char                dashs[];    /* ADR */
  636. + extern char                rdwstr[];    /* ADR */
  637. + #if JOBS
  638. + extern char                rsqbrk[];
  639. + extern char                spspstr[];
  640. + extern char                fgdstr[];
  641. + extern char                stpdstr[];
  642. + extern char                lotspstr[];
  643. + extern char                psgpstr[];
  644. + extern char                ptinstr[];
  645. + extern char                ptoustr[];
  646. + extern char                bgdstr[];
  647. + extern char                spcstr[];
  648. + extern char                rdinstr[];
  649. + extern char                appdstr[];
  650. + extern char                inlnstr[];
  651. + extern char                sfnstr[];
  652. + extern char                efnstr[];
  653. + extern char                semspstr[];
  654. + extern char                lpnstr[];
  655. + extern char                rpnstr[];
  656. + extern char                insstr[];
  657. + extern char                sdostr[];
  658. + extern char                sdonstr[];
  659. + extern char                sthnstr[];
  660. + extern char                selsstr[];
  661. + extern char                sfistr[];
  662. + extern char                iesacstr[];
  663. + extern char                casestr[];
  664. + extern char                pipestr[];
  665. + extern char                toastr[];
  666. + extern char                fromastr[];
  667. + extern char                andstr[];
  668. + extern char                orstr[];
  669. + extern char                forstr[];
  670. + extern char                amperstr[];
  671. + extern char                forstr[];
  672. + extern char                whilestr[];
  673. + extern char                untilstr[];
  674. + extern char                ifstr[];
  675. + extern char                casestr[];
  676. + #endif
  677. + #if SYMLINK
  678. + extern char                nolstat[];
  679. + #endif
  680.   
  681.   /* name tree and words */
  682.   extern struct sysnod    reserved[];
  683. ***************
  684. *** 186,191
  685.   extern char                supprompt[];
  686.   extern char                profile[];
  687.   extern char                sysprofile[];
  688.   
  689.   /* built in names */
  690.   extern struct namnod    fngnod;
  691.  
  692. --- 289,296 -----
  693.   extern char                supprompt[];
  694.   extern char                profile[];
  695.   extern char                sysprofile[];
  696. + extern char                shrc[];
  697. + extern char                savehist[];
  698.   
  699.   /* built in names */
  700.   extern struct namnod    fngnod;
  701. ***************
  702. *** 199,204
  703.   extern struct namnod    mchknod;
  704.   extern struct namnod    acctnod;
  705.   extern struct namnod    mailpnod;
  706.   
  707.   /* special names */
  708.   extern char                flagadr[];
  709.  
  710. --- 304,313 -----
  711.   extern struct namnod    mchknod;
  712.   extern struct namnod    acctnod;
  713.   extern struct namnod    mailpnod;
  714. + #if pyr
  715. + extern struct namnod    univnod;
  716. + #endif
  717. + extern struct namnod    histfnod;
  718.   
  719.   /* special names */
  720.   extern char                flagadr[];
  721. ***************
  722. *** 204,209
  723.   extern char                flagadr[];
  724.   extern char                *pcsadr;
  725.   extern char                *pidadr;
  726.   extern char                *cmdadr;
  727.   
  728.   extern char                defpath[];
  729.  
  730. --- 313,319 -----
  731.   extern char                flagadr[];
  732.   extern char                *pcsadr;
  733.   extern char                *pidadr;
  734. + extern char                *ppidadr;
  735.   extern char                *cmdadr;
  736.   
  737.   extern char                defpath[];
  738. ***************
  739. *** 219,224
  740.   extern char                mchkname[];
  741.   extern char                acctname[];
  742.   extern char                mailpname[];
  743.   
  744.   /* transput */
  745.   extern char                tmpout[];
  746.  
  747. --- 329,338 -----
  748.   extern char                mchkname[];
  749.   extern char                acctname[];
  750.   extern char                mailpname[];
  751. + #if pyr
  752. + extern char                univname[];    /* UNIVERSE */
  753. + #endif
  754. + extern char                histfilename[];    /* HISTFILE */
  755.   
  756.   /* transput */
  757.   extern char                tmpout[];
  758. ***************
  759. *** 236,241
  760.   extern int                peekn;
  761.   extern char                *comdiv;
  762.   extern char                devnull[];
  763.   
  764.   /* flags */
  765.   #define        noexec        01
  766.  
  767. --- 350,361 -----
  768.   extern int                peekn;
  769.   extern char                *comdiv;
  770.   extern char                devnull[];
  771. + extern BOOL        catcheof;    /* set to catch EOF in readc() */
  772. + #if JOBS
  773. + extern int        j_original_pg;
  774. + extern int        j_default_pg;
  775. + extern BOOL        j_top_level;
  776. + #endif
  777.   
  778.   /* flags */
  779.   #define        noexec        01
  780. ***************
  781. *** 257,262
  782.   #define        hashflg        040000
  783.   #define        nofngflg    0200000
  784.   #define        exportflg    0400000
  785.   
  786.   extern long                flags;
  787.   extern int                rwait;    /* flags read waiting */
  788.  
  789. --- 377,390 -----
  790.   #define        hashflg        040000
  791.   #define        nofngflg    0200000
  792.   #define        exportflg    0400000
  793. + #if JOBS
  794. + #define        jobflg        01000000
  795. + #define        infoflg        02000000
  796. + #endif
  797. + #define        dotflg        04000000
  798. + #define        noeotflg    010000000
  799. + #define        quickflg    020000000
  800. + #define        nohistflg    040000000
  801.   
  802.   extern long                flags;
  803.   extern int                rwait;    /* flags read waiting */
  804. ***************
  805. *** 265,270
  806.   #include    <setjmp.h>
  807.   extern jmp_buf            subshell;
  808.   extern jmp_buf            errshell;
  809.   
  810.   /* fault handling */
  811.   #include    "brkincr.h"
  812.  
  813. --- 393,402 -----
  814.   #include    <setjmp.h>
  815.   extern jmp_buf            subshell;
  816.   extern jmp_buf            errshell;
  817. + #if defined(JOBS) && !defined(pyr)
  818. + #define setjmp(env)    _setjmp(env)
  819. + #define longjmp(env, val)    _longjmp(env, val)
  820. + #endif
  821.   
  822.   /* fault handling */
  823.   #include    "brkincr.h"
  824. ***************
  825. *** 271,276
  826.   
  827.   extern unsigned            brkincr;
  828.   #define     MINTRAP        0
  829.   #define     MAXTRAP        20
  830.   
  831.   #define     TRAPSET        2
  832.  
  833. --- 403,411 -----
  834.   
  835.   extern unsigned            brkincr;
  836.   #define     MINTRAP        0
  837. + #if defined (JOBS)
  838. + #define        MAXTRAP        32
  839. + #else
  840.   #define     MAXTRAP        20
  841.   #endif
  842.   
  843. ***************
  844. *** 272,277
  845.   extern unsigned            brkincr;
  846.   #define     MINTRAP        0
  847.   #define     MAXTRAP        20
  848.   
  849.   #define     TRAPSET        2
  850.   #define     SIGSET        4
  851.  
  852. --- 407,413 -----
  853.   #define        MAXTRAP        32
  854.   #else
  855.   #define     MAXTRAP        20
  856. + #endif
  857.   
  858.   #define     TRAPSET        2
  859.   #define     SIGSET        4
  860. ***************
  861. *** 278,284
  862.   #define     SIGMOD        8
  863.   #define     SIGCAUGHT    16
  864.   
  865. ! extern int                fault();
  866.   extern BOOL                trapnote;
  867.   extern char                *trapcom[];
  868.   extern BOOL                trapflg[];
  869.  
  870. --- 414,421 -----
  871.   #define     SIGMOD        8
  872.   #define     SIGCAUGHT    16
  873.   
  874. ! extern void                fault();
  875. ! extern void                done();
  876.   extern BOOL                trapnote;
  877.   extern char                *trapcom[];
  878.   extern BOOL                trapflg[];
  879. ***************
  880. *** 293,298
  881.   /* execflgs */
  882.   extern int                exitval;
  883.   extern int                retval;
  884.   extern BOOL                execbrk;
  885.   extern int                loopcnt;
  886.   extern int                breakcnt;
  887.  
  888. --- 430,438 -----
  889.   /* execflgs */
  890.   extern int                exitval;
  891.   extern int                retval;
  892. + #if gould
  893. + extern int                execbrk;
  894. + #else
  895.   extern BOOL                execbrk;
  896.   #endif
  897.   extern int                loopcnt;
  898. ***************
  899. *** 294,299
  900.   extern int                exitval;
  901.   extern int                retval;
  902.   extern BOOL                execbrk;
  903.   extern int                loopcnt;
  904.   extern int                breakcnt;
  905.   extern int                funcnt;
  906.  
  907. --- 434,440 -----
  908.   extern int                execbrk;
  909.   #else
  910.   extern BOOL                execbrk;
  911. + #endif
  912.   extern int                loopcnt;
  913.   extern int                breakcnt;
  914.   extern int                funcnt;
  915. ***************
  916. *** 332,337
  917.   extern char                badunset[];
  918.   extern char                nohome[];
  919.   extern char                badperm[];
  920.   
  921.   /*    'builtin' error messages    */
  922.   
  923.  
  924. --- 473,487 -----
  925.   extern char                badunset[];
  926.   extern char                nohome[];
  927.   extern char                badperm[];
  928. + #if JOBS
  929. + extern char                cjpostr[];
  930. + extern char                jcoffstr[];
  931. + extern char                jpanstr[];
  932. + extern char                jinvstr[];
  933. + extern char                ncjstr[];
  934. + extern char                nstpstr[];
  935. + extern char                tasjstr[];
  936. + #endif
  937.   
  938.   /*    'builtin' error messages    */
  939.   
  940. :::::::: dup.h :::::::
  941. No differences encountered
  942. :::::::: echo.c :::::::
  943. *** ../orig.u/echo.c    Wed May 15 17:08:12 1985
  944. --- echo.c    Tue May 21 18:05:45 1985
  945. ***************
  946. *** 4,9
  947.    *
  948.    *    Bell Telephone Laboratories
  949.    *
  950.    */
  951.   #include    "defs.h"
  952.   
  953.  
  954. --- 4,11 -----
  955.    *
  956.    *    Bell Telephone Laboratories
  957.    *
  958. +  *    DAG -- changed to support 7th Edition "-n" option;
  959. +  *    still not fully compatible since \ escapes are interpreted
  960.    */
  961.   #include    "defs.h"
  962.   
  963. ***************
  964. *** 17,22
  965.       register char    *cp;
  966.       register int    i, wd;
  967.       int    j;
  968.       
  969.       if(--argc == 0) {
  970.           prc_buff('\n');
  971.  
  972. --- 19,27 -----
  973.       register char    *cp;
  974.       register int    i, wd;
  975.       int    j;
  976. + #if JOBS
  977. +     int    no_nl;
  978. + #endif
  979.       
  980.       if(--argc == 0) {
  981.           prc_buff('\n');
  982. ***************
  983. *** 23,28
  984.           exit(0);
  985.       }
  986.   
  987.       for(i = 1; i <= argc; i++) 
  988.       {
  989.           sigchk();
  990.  
  991. --- 28,40 -----
  992.           exit(0);
  993.       }
  994.   
  995. + #if JOBS
  996. +     if (no_nl = eq(argv[1], "-n"))    /* old-style no-newline flag */
  997. +     {
  998. +         --argc;            /* skip over "-n" argument */
  999. +         ++argv;
  1000. +     }
  1001. + #endif
  1002.       for(i = 1; i <= argc; i++) 
  1003.       {
  1004.           sigchk();
  1005. ***************
  1006. *** 76,82
  1007.               }
  1008.               prc_buff(*cp);
  1009.           }
  1010. !         prc_buff(i == argc? '\n': ' ');
  1011.       }
  1012.       exit(0);
  1013.   }
  1014.  
  1015. --- 88,95 -----
  1016.               }
  1017.               prc_buff(*cp);
  1018.           }
  1019. !         if (i != argc)
  1020. !             prc_buff(' ');
  1021.       }
  1022.   #if JOBS
  1023.       if (!no_nl)
  1024. ***************
  1025. *** 78,83
  1026.           }
  1027.           prc_buff(i == argc? '\n': ' ');
  1028.       }
  1029.       exit(0);
  1030.   }
  1031.   
  1032.  
  1033. --- 91,100 -----
  1034.           if (i != argc)
  1035.               prc_buff(' ');
  1036.       }
  1037. + #if JOBS
  1038. +     if (!no_nl)
  1039. + #endif
  1040. +         prc_buff ('\n');
  1041.       exit(0);
  1042.   }
  1043.   
  1044. :::::::: error.c :::::::
  1045. *** ../orig.u/error.c    Wed May 15 17:08:12 1985
  1046. --- error.c    Tue May 21 18:04:08 1985
  1047. ***************
  1048. *** 56,61
  1049.       }
  1050.   }
  1051.   
  1052.   done()
  1053.   {
  1054.       register char    *t;
  1055.  
  1056. --- 56,62 -----
  1057.       }
  1058.   }
  1059.   
  1060. + void
  1061.   done()
  1062.   {
  1063.       register char    *t;
  1064. ***************
  1065. *** 75,80
  1066.   #ifdef ACCT
  1067.       doacct();
  1068.   #endif
  1069.       exit(exitval);
  1070.   }
  1071.   
  1072.  
  1073. --- 76,82 -----
  1074.   #ifdef ACCT
  1075.       doacct();
  1076.   #endif
  1077. +     histsave (histfnod.namval);
  1078.       exit(exitval);
  1079.   }
  1080.   
  1081. :::::::: expand.c :::::::
  1082. *** ../orig.u/expand.c    Wed May 15 17:08:13 1985
  1083. --- expand.c    Thu May 16 17:46:53 1985
  1084. ***************
  1085. *** 9,14
  1086.   #include    "defs.h"
  1087.   #include    <sys/types.h>
  1088.   #include    <sys/stat.h>
  1089.   #include    <sys/dir.h>
  1090.   
  1091.   #define MAXDIR    64
  1092.  
  1093. --- 9,17 -----
  1094.   #include    "defs.h"
  1095.   #include    <sys/types.h>
  1096.   #include    <sys/stat.h>
  1097. + #if JOBS
  1098. + #include    <dir.h>
  1099. + #else
  1100.   #include    <sys/dir.h>
  1101.   #endif
  1102.   
  1103. ***************
  1104. *** 10,15
  1105.   #include    <sys/types.h>
  1106.   #include    <sys/stat.h>
  1107.   #include    <sys/dir.h>
  1108.   
  1109.   #define MAXDIR    64
  1110.   struct direct        *getdir();
  1111.  
  1112. --- 13,19 -----
  1113.   #include    <dir.h>
  1114.   #else
  1115.   #include    <sys/dir.h>
  1116. + #endif
  1117.   
  1118.   #if JOBS
  1119.   #define        getdir(dirf)    readdir(dirf)
  1120. ***************
  1121. *** 11,16
  1122.   #include    <sys/stat.h>
  1123.   #include    <sys/dir.h>
  1124.   
  1125.   #define MAXDIR    64
  1126.   struct direct        *getdir();
  1127.   
  1128.  
  1129. --- 15,24 -----
  1130.   #include    <sys/dir.h>
  1131.   #endif
  1132.   
  1133. + #if JOBS
  1134. + #define        getdir(dirf)    readdir(dirf)
  1135. + #define        entry        e->d_name
  1136. + #else
  1137.   #define MAXDIR    64
  1138.   struct direct        *getdir();
  1139.   
  1140. ***************
  1141. *** 18,23
  1142.   static int        nxtdir = -1;
  1143.   static int        maxdir = 0;
  1144.   static char        entry[DIRSIZ+1];
  1145.   
  1146.   /*
  1147.    * globals (file name generation)
  1148.  
  1149. --- 26,32 -----
  1150.   static int        nxtdir = -1;
  1151.   static int        maxdir = 0;
  1152.   static char        entry[DIRSIZ+1];
  1153. + #endif
  1154.   
  1155.   /*
  1156.    * globals (file name generation)
  1157. ***************
  1158. *** 34,40
  1159.   expand(as, rcnt)
  1160.       char    *as;
  1161.   {
  1162. !     int    count, dirf;
  1163.       BOOL    dir = 0;
  1164.       char    *rescan = 0;
  1165.       register char    *s, *cs;
  1166.  
  1167. --- 43,54 -----
  1168.   expand(as, rcnt)
  1169.       char    *as;
  1170.   {
  1171. !     int    count;
  1172. ! #if JOBS
  1173. !     DIR    *dirf;
  1174. ! #else
  1175. !     int    dirf;
  1176. ! #endif
  1177.       BOOL    dir = 0;
  1178.       char    *rescan = 0;
  1179.       register char    *s, *cs;
  1180. ***************
  1181. *** 109,114
  1182.           }
  1183.       }
  1184.   
  1185.       if ((dirf = open(*s ? s : ".", 0)) > 0)
  1186.       {
  1187.           if (fstat(dirf, &statb) != -1 &&
  1188.  
  1189. --- 123,131 -----
  1190.           }
  1191.       }
  1192.   
  1193. + #if JOBS
  1194. +     if (dirf = opendir(*s ? s : ".", 0))
  1195. + #else
  1196.       if ((dirf = open(*s ? s : ".", 0)) > 0)
  1197.   #endif
  1198.       {
  1199. ***************
  1200. *** 110,115
  1201.       }
  1202.   
  1203.       if ((dirf = open(*s ? s : ".", 0)) > 0)
  1204.       {
  1205.           if (fstat(dirf, &statb) != -1 &&
  1206.               (statb.st_mode & S_IFMT) == S_IFDIR)
  1207.  
  1208. --- 127,133 -----
  1209.       if (dirf = opendir(*s ? s : ".", 0))
  1210.   #else
  1211.       if ((dirf = open(*s ? s : ".", 0)) > 0)
  1212. + #endif
  1213.       {
  1214.   #if JOBS
  1215.           if (fstat(dirf->dd_fd, &statb) != -1 &&
  1216. ***************
  1217. *** 111,116
  1218.   
  1219.       if ((dirf = open(*s ? s : ".", 0)) > 0)
  1220.       {
  1221.           if (fstat(dirf, &statb) != -1 &&
  1222.               (statb.st_mode & S_IFMT) == S_IFDIR)
  1223.               dir++;
  1224.  
  1225. --- 129,137 -----
  1226.       if ((dirf = open(*s ? s : ".", 0)) > 0)
  1227.   #endif
  1228.       {
  1229. + #if JOBS
  1230. +         if (fstat(dirf->dd_fd, &statb) != -1 &&
  1231. + #else
  1232.           if (fstat(dirf, &statb) != -1 &&
  1233.   #endif
  1234.               (statb.st_mode & S_IFMT) == S_IFDIR)
  1235. ***************
  1236. *** 112,117
  1237.       if ((dirf = open(*s ? s : ".", 0)) > 0)
  1238.       {
  1239.           if (fstat(dirf, &statb) != -1 &&
  1240.               (statb.st_mode & S_IFMT) == S_IFDIR)
  1241.               dir++;
  1242.           else
  1243.  
  1244. --- 133,139 -----
  1245.           if (fstat(dirf->dd_fd, &statb) != -1 &&
  1246.   #else
  1247.           if (fstat(dirf, &statb) != -1 &&
  1248. + #endif
  1249.               (statb.st_mode & S_IFMT) == S_IFDIR)
  1250.               dir++;
  1251.           else
  1252. ***************
  1253. *** 115,120
  1254.               (statb.st_mode & S_IFMT) == S_IFDIR)
  1255.               dir++;
  1256.           else
  1257.               close(dirf);
  1258.       }
  1259.   
  1260.  
  1261. --- 137,145 -----
  1262.               (statb.st_mode & S_IFMT) == S_IFDIR)
  1263.               dir++;
  1264.           else
  1265. + #if JOBS
  1266. +             closedir(dirf);
  1267. + #else
  1268.               close(dirf);
  1269.   #endif
  1270.       }
  1271. ***************
  1272. *** 116,121
  1273.               dir++;
  1274.           else
  1275.               close(dirf);
  1276.       }
  1277.   
  1278.       count = 0;
  1279.  
  1280. --- 141,147 -----
  1281.               closedir(dirf);
  1282.   #else
  1283.               close(dirf);
  1284. + #endif
  1285.       }
  1286.   
  1287.       count = 0;
  1288. ***************
  1289. *** 139,144
  1290.   
  1291.           while ((e = getdir(dirf)) && (trapnote & SIGSET) == 0)
  1292.           {
  1293.               *(movstrn(e->d_name, entry, DIRSIZ)) = 0;
  1294.   
  1295.               if (entry[0] == '.' && *cs != '.')
  1296.  
  1297. --- 165,171 -----
  1298.   
  1299.           while ((e = getdir(dirf)) && (trapnote & SIGSET) == 0)
  1300.           {
  1301. + #if !defined (JOBS)
  1302.               *(movstrn(e->d_name, entry, DIRSIZ)) = 0;
  1303.   #endif
  1304.   
  1305. ***************
  1306. *** 140,145
  1307.           while ((e = getdir(dirf)) && (trapnote & SIGSET) == 0)
  1308.           {
  1309.               *(movstrn(e->d_name, entry, DIRSIZ)) = 0;
  1310.   
  1311.               if (entry[0] == '.' && *cs != '.')
  1312.   #ifndef BOURNE
  1313.  
  1314. --- 167,173 -----
  1315.           {
  1316.   #if !defined (JOBS)
  1317.               *(movstrn(e->d_name, entry, DIRSIZ)) = 0;
  1318. + #endif
  1319.   
  1320.               if (entry[0] == '.' && *cs != '.')
  1321.   #ifndef BOURNE
  1322. ***************
  1323. *** 159,164
  1324.                   count++;
  1325.               }
  1326.           }
  1327.           close(dirf);
  1328.   
  1329.           if (rescan)
  1330.  
  1331. --- 187,195 -----
  1332.                   count++;
  1333.               }
  1334.           }
  1335. + #if JOBS
  1336. +         closedir(dirf);
  1337. + #else
  1338.           close(dirf);
  1339.   #endif
  1340.   
  1341. ***************
  1342. *** 160,165
  1343.               }
  1344.           }
  1345.           close(dirf);
  1346.   
  1347.           if (rescan)
  1348.           {
  1349.  
  1350. --- 191,197 -----
  1351.           closedir(dirf);
  1352.   #else
  1353.           close(dirf);
  1354. + #endif
  1355.   
  1356.           if (rescan)
  1357.           {
  1358. ***************
  1359. *** 191,196
  1360.   }
  1361.   
  1362.   
  1363.   reset_dir()
  1364.   {
  1365.       nxtdir = -1;
  1366.  
  1367. --- 223,229 -----
  1368.   }
  1369.   
  1370.   
  1371. + #if !defined (JOBS)
  1372.   reset_dir()
  1373.   {
  1374.       nxtdir = -1;
  1375. ***************
  1376. *** 231,236
  1377.           return(&dirbuf[nxtdir]);
  1378.       }
  1379.   }
  1380.   
  1381.   
  1382.   gmatch(s, p)
  1383.  
  1384. --- 264,270 -----
  1385.           return(&dirbuf[nxtdir]);
  1386.       }
  1387.   }
  1388. + #endif
  1389.   
  1390.   
  1391.   gmatch(s, p)
  1392. :::::::: fault.c :::::::
  1393. *** ../orig.u/fault.c    Wed May 15 17:08:14 1985
  1394. --- fault.c    Wed May 22 11:50:16 1985
  1395. ***************
  1396. *** 8,14
  1397.   
  1398.   #include    "defs.h"
  1399.   
  1400. ! extern int    done();
  1401.   
  1402.   char    *trapcom[MAXTRAP];
  1403.   BOOL    trapflg[MAXTRAP] =
  1404.  
  1405. --- 8,14 -----
  1406.   
  1407.   #include    "defs.h"
  1408.   
  1409. ! extern void    done();
  1410.   
  1411.   char    *trapcom[MAXTRAP];
  1412.   BOOL    trapflg[MAXTRAP] =
  1413. ***************
  1414. *** 31,37
  1415.       0,     /* software termination */
  1416.       0,    /* unassigned */
  1417.       0,    /* unassigned */
  1418. !     0,    /* death of child */
  1419.       0,    /* power fail */
  1420.   };
  1421.   
  1422.  
  1423. --- 31,37 -----
  1424.       0,     /* software termination */
  1425.       0,    /* unassigned */
  1426.       0,    /* unassigned */
  1427. !     0,    /* death of child (if not BSD) */
  1428.       0,    /* power fail */
  1429.   };
  1430.   
  1431. ***************
  1432. *** 35,41
  1433.       0,    /* power fail */
  1434.   };
  1435.   
  1436. ! int     (*(sigval[]))() = 
  1437.   {
  1438.       0,
  1439.       done,
  1440.  
  1441. --- 35,41 -----
  1442.       0,    /* power fail */
  1443.   };
  1444.   
  1445. ! void     (*(sigval[MAXTRAP]))() =     /* DAG -- make sure ther are MAXTRAP */
  1446.   {
  1447.       0,
  1448.       done,
  1449. ***************
  1450. *** 54,59
  1451.       fault,
  1452.       fault,
  1453.       done,
  1454.       done,
  1455.       done,
  1456.       done
  1457.  
  1458. --- 54,62 -----
  1459.       fault,
  1460.       fault,
  1461.       done,
  1462. + #if JOBS
  1463. +     0,    /* SIGSTOP */
  1464. + #else
  1465.       done,
  1466.   #endif
  1467.       done,
  1468. ***************
  1469. *** 55,60
  1470.       fault,
  1471.       done,
  1472.       done,
  1473.       done,
  1474.       done
  1475.   };
  1476.  
  1477. --- 58,64 -----
  1478.       0,    /* SIGSTOP */
  1479.   #else
  1480.       done,
  1481. + #endif
  1482.       done,
  1483.       done,
  1484.   #if JOBS
  1485. ***************
  1486. *** 56,61
  1487.       done,
  1488.       done,
  1489.       done,
  1490.       done
  1491.   };
  1492.   
  1493.  
  1494. --- 60,78 -----
  1495.       done,
  1496.   #endif
  1497.       done,
  1498. +     done,
  1499. + #if JOBS
  1500. +     done,
  1501. +     done,
  1502. +     done,
  1503. +     done,
  1504. +     done,
  1505. +     done,
  1506. +     done,
  1507. +     done,
  1508. +     done,
  1509. +     done,
  1510. +     done,
  1511.       done
  1512.   #endif
  1513.   };
  1514. ***************
  1515. *** 57,62
  1516.       done,
  1517.       done,
  1518.       done
  1519.   };
  1520.   
  1521.   /* ========    fault handling routines       ======== */
  1522.  
  1523. --- 74,80 -----
  1524.       done,
  1525.       done,
  1526.       done
  1527. + #endif
  1528.   };
  1529.   
  1530.   /* ========    fault handling routines       ======== */
  1531. ***************
  1532. *** 62,67
  1533.   /* ========    fault handling routines       ======== */
  1534.   
  1535.   
  1536.   fault(sig)
  1537.   register int    sig;
  1538.   {
  1539.  
  1540. --- 80,86 -----
  1541.   /* ========    fault handling routines       ======== */
  1542.   
  1543.   
  1544. + void    /* DAG */
  1545.   fault(sig)
  1546.   register int    sig;
  1547.   {
  1548. ***************
  1549. *** 105,111
  1550.       setsig(SIGALRM);
  1551.       setsig(SIGTERM);
  1552.       setsig(SIGUSR1);
  1553. !     setsig(SIGUSR2);
  1554.   }
  1555.   
  1556.   ignsig(n)
  1557.  
  1558. --- 124,132 -----
  1559.       setsig(SIGALRM);
  1560.       setsig(SIGTERM);
  1561.       setsig(SIGUSR1);
  1562. ! #ifndef JOBS
  1563. !     setsig(SIGUSR2);    /* aka SIGSTOP */
  1564. ! #endif
  1565.   }
  1566.   
  1567.   ignsig(n)
  1568. :::::::: func.c :::::::
  1569. *** ../orig.u/func.c    Wed May 15 17:08:15 1985
  1570. --- func.c    Wed Jun  5 16:04:53 1985
  1571. ***************
  1572. *** 305,310
  1573.                       {
  1574.                           struct argnod    *arg = swl->regptr;
  1575.   
  1576.                           if (arg)
  1577.                           {
  1578.                               prs_buff(arg->argval);
  1579.  
  1580. --- 305,311 -----
  1581.                       {
  1582.                           struct argnod    *arg = swl->regptr;
  1583.   
  1584. +                         prc_buff (NL);    /* DAG (was missing) */
  1585.                           if (arg)
  1586.                           {
  1587.                               prs_buff(arg->argval);
  1588. ***************
  1589. *** 323,328
  1590.                           prs_buff(";;");
  1591.                           swl = swl->regnxt;
  1592.                       }
  1593.                   }
  1594.                   break;
  1595.               } 
  1596.  
  1597. --- 324,330 -----
  1598.                           prs_buff(";;");
  1599.                           swl = swl->regnxt;
  1600.                       }
  1601. +                     prs_buff ("\nesac");    /* DAG (was missing) */
  1602.                   }
  1603.                   break;
  1604.               } 
  1605. ***************
  1606. *** 354,360
  1607.           iof = iop->iofile;
  1608.           ion = iop->ioname;
  1609.   
  1610. !         if (*ion)
  1611.           {
  1612.               prn_buff(iof & IOUFD);
  1613.   
  1614.  
  1615. --- 356,362 -----
  1616.           iof = iop->iofile;
  1617.           ion = iop->ioname;
  1618.   
  1619. !         if (ion && *ion)    /* DAG -- added safety check */
  1620.           {
  1621.               prn_buff(iof & IOUFD);
  1622.   
  1623. ***************
  1624. *** 368,373
  1625.                       prs_buff("<&");
  1626.   
  1627.               }
  1628.               else if ((iof & IOPUT) == 0)
  1629.                   prc_buff('<');
  1630.               else if (iof & IOAPP)
  1631.  
  1632. --- 370,377 -----
  1633.                       prs_buff("<&");
  1634.   
  1635.               }
  1636. +             else if (iof & IORDW)
  1637. +                 prs_buff(rdwstr);    /* ADR */
  1638.               else if ((iof & IOPUT) == 0)
  1639.                   prc_buff('<');
  1640.               else if (iof & IOAPP)
  1641. :::::::: hash.c :::::::
  1642. *** ../orig.u/hash.c    Wed May 15 17:08:16 1985
  1643. --- hash.c    Tue May 21 18:08:16 1985
  1644. ***************
  1645. *** 86,91
  1646.       int             res;        
  1647.   
  1648.       i = hash(str);
  1649.   
  1650.       if(table[i] == 0)
  1651.       {            
  1652.  
  1653. --- 86,94 -----
  1654.       int             res;        
  1655.   
  1656.       i = hash(str);
  1657. + #if gould
  1658. +     i &= ~(0x80000000 >> (shift - 1));    /* work around compiler bug */
  1659. + #endif
  1660.   
  1661.       if(table[i] == 0)
  1662.       {            
  1663. :::::::: hash.h :::::::
  1664. No differences encountered
  1665. :::::::: hashserv.c :::::::
  1666. No differences encountered
  1667. :::::::: io.c :::::::
  1668. *** ../orig.u/io.c    Wed May 15 17:08:19 1985
  1669. --- io.c    Thu May 16 18:03:36 1985
  1670. ***************
  1671. *** 7,12
  1672.    */
  1673.   
  1674.   #include    "defs.h"
  1675.   #include    "dup.h"
  1676.   #include    <fcntl.h>
  1677.   
  1678.  
  1679. --- 7,13 -----
  1680.    */
  1681.   
  1682.   #include    "defs.h"
  1683. + #ifdef RES    /* DAG -- conditionalize */
  1684.   #include    "dup.h"
  1685.   #include    <sys/types.h>
  1686.   #include    <sys/stat.h>
  1687. ***************
  1688. *** 8,13
  1689.   
  1690.   #include    "defs.h"
  1691.   #include    "dup.h"
  1692.   #include    <fcntl.h>
  1693.   
  1694.   short topfd;
  1695.  
  1696. --- 9,17 -----
  1697.   #include    "defs.h"
  1698.   #ifdef RES    /* DAG -- conditionalize */
  1699.   #include    "dup.h"
  1700. + #include    <sys/types.h>
  1701. + #include    <sys/stat.h>
  1702. + #else
  1703.   #include    <fcntl.h>
  1704.   #endif
  1705.   
  1706. ***************
  1707. *** 9,14
  1708.   #include    "defs.h"
  1709.   #include    "dup.h"
  1710.   #include    <fcntl.h>
  1711.   
  1712.   short topfd;
  1713.   
  1714.  
  1715. --- 13,19 -----
  1716.   #include    <sys/stat.h>
  1717.   #else
  1718.   #include    <fcntl.h>
  1719. + #endif
  1720.   
  1721.   short topfd;
  1722.   
  1723. ***************
  1724. *** 293,298
  1725.   {
  1726.       register int    f;
  1727.   
  1728.       f = fcntl(fd, F_DUPFD, 10);
  1729.       return(f);
  1730.   }
  1731.  
  1732. --- 298,316 -----
  1733.   {
  1734.       register int    f;
  1735.   
  1736. + #ifdef RES    /* DAG -- bug fix */
  1737. +     for ( f = 10; f <= INIO; ++f )
  1738. +     {
  1739. +         struct stat    statb;
  1740. +         if (fstat(fd, &statb) != 0)    /* if already in use, try another */
  1741. +         {
  1742. +             dup (fd | DUPFLG, f);
  1743. +             return f;
  1744. +         }
  1745. +     }
  1746. +     return -1;    /* no free file descriptors */
  1747. + #else
  1748.       f = fcntl(fd, F_DUPFD, 10);
  1749.   #endif
  1750.       return(f);
  1751. ***************
  1752. *** 294,299
  1753.       register int    f;
  1754.   
  1755.       f = fcntl(fd, F_DUPFD, 10);
  1756.       return(f);
  1757.   }
  1758.   
  1759.  
  1760. --- 312,318 -----
  1761.       return -1;    /* no free file descriptors */
  1762.   #else
  1763.       f = fcntl(fd, F_DUPFD, 10);
  1764. + #endif
  1765.       return(f);
  1766.   }
  1767.   
  1768. :::::::: mac.h :::::::
  1769. *** ../orig.u/mac.h    Wed May 15 17:08:19 1985
  1770. --- mac.h    Thu May 16 18:04:59 1985
  1771. ***************
  1772. *** 19,24
  1773.   #define RQ    '\''
  1774.   #define MINUS    '-'
  1775.   #define COLON    ':'
  1776.   #define TAB    '\t'
  1777.   
  1778.   
  1779.  
  1780. --- 19,25 -----
  1781.   #define RQ    '\''
  1782.   #define MINUS    '-'
  1783.   #define COLON    ':'
  1784. + #define SQUIGGLE    '~'    /* TILDE defined in BSD tty handler */
  1785.   #define TAB    '\t'
  1786.   
  1787.   
  1788. :::::::: macro.c :::::::
  1789. *** ../orig.u/macro.c    Wed May 15 17:08:20 1985
  1790. --- macro.c    Thu May 16 18:13:16 1985
  1791. ***************
  1792. *** 67,73
  1793.       d = readc();
  1794.       if (!subchar(d))
  1795.           return(d);
  1796. !     if (d == DOLLAR)
  1797.       {
  1798.           register int    c;
  1799.   
  1800.  
  1801. --- 67,74 -----
  1802.       d = readc();
  1803.       if (!subchar(d))
  1804.           return(d);
  1805. ! #if JOBS
  1806. !     if (d == PERCENT && (flags&jobflg))
  1807.       {
  1808.           register int    c;
  1809.   
  1810. ***************
  1811. *** 71,76
  1812.       {
  1813.           register int    c;
  1814.   
  1815.           if ((c = readc(), dolchar(c)))
  1816.           {
  1817.               struct namnod *n = (struct namnod *)NIL;
  1818.  
  1819. --- 72,95 -----
  1820.       {
  1821.           register int    c;
  1822.   
  1823. +         peekc = (c = readc()) | MARK;
  1824. +         if (digchar(c) || c == PERCENT)
  1825. +         {
  1826. +             register char *v;
  1827. +             if (v = j_macro())    /* %number or %% handled */
  1828. +                 while (c = *v++)
  1829. +                     pushstak(c | quote);
  1830. +             /* else expands to nothingness */
  1831. +             goto retry;
  1832. +         }
  1833. +     }
  1834. +     else
  1835. + #endif
  1836. +         if (d == DOLLAR)
  1837. +         {
  1838. +         register int    c;
  1839.           if ((c = readc(), dolchar(c)))
  1840.           {
  1841.               struct namnod *n = (struct namnod *)NIL;
  1842. ***************
  1843. *** 114,119
  1844.               }
  1845.               else if (c == '$')
  1846.                   v = pidadr;
  1847.               else if (c == '!')
  1848.                   v = pcsadr;
  1849.               else if (c == '#')
  1850.  
  1851. --- 133,147 -----
  1852.               }
  1853.               else if (c == '$')
  1854.                   v = pidadr;
  1855. +             else if (c == '+')
  1856. +             {
  1857. +                 if (ppid != getppid())    /* parent died */
  1858. +                 {
  1859. +                     ppid = getppid();
  1860. +                     assnum (&ppidadr, ppid);
  1861. +                 }
  1862. +                 v = ppidadr;
  1863. +             }
  1864.               else if (c == '!')
  1865.                   v = pcsadr;
  1866.               else if (c == '#')
  1867. ***************
  1868. *** 207,213
  1869.           }
  1870.           else
  1871.               peekc = c | MARK;
  1872. !     }
  1873.       else if (d == endch)
  1874.           return(d);
  1875.       else if (d == SQUOTE)
  1876.  
  1877. --- 235,241 -----
  1878.           }
  1879.           else
  1880.               peekc = c | MARK;
  1881. !         }
  1882.       else if (d == endch)
  1883.           return(d);
  1884.       else if (d == SQUOTE)
  1885. ***************
  1886. *** 273,278
  1887.           push(&cb);
  1888.           estabf(argc);
  1889.       }
  1890.       {
  1891.           register struct trenod *t = makefork(FPOU, cmd(EOFSYM, MTFLG | NLFLG));
  1892.           int        pv[2];
  1893.  
  1894. --- 301,309 -----
  1895.           push(&cb);
  1896.           estabf(argc);
  1897.       }
  1898. + #if JOBS
  1899. +     set_wfence();
  1900. + #endif
  1901.       {
  1902.           register struct trenod *t = makefork(FPOU, cmd(EOFSYM, MTFLG | NLFLG));
  1903.           int        pv[2];
  1904. :::::::: main.c :::::::
  1905. *** ../orig.u/main.c    Wed May 15 17:08:21 1985
  1906. --- main.c    Thu Jun  6 09:41:44 1985
  1907. ***************
  1908. *** 11,16
  1909.   #include    "timeout.h"
  1910.   #include    <sys/types.h>
  1911.   #include    <sys/stat.h>
  1912.   #include        "dup.h"
  1913.   
  1914.   #ifdef RES
  1915.  
  1916. --- 11,17 -----
  1917.   #include    "timeout.h"
  1918.   #include    <sys/types.h>
  1919.   #include    <sys/stat.h>
  1920. + #ifdef RES    /* DAG -- conditionalize */
  1921.   #include        "dup.h"
  1922.   #endif
  1923.   
  1924. ***************
  1925. *** 12,17
  1926.   #include    <sys/types.h>
  1927.   #include    <sys/stat.h>
  1928.   #include        "dup.h"
  1929.   
  1930.   #ifdef RES
  1931.   #include    <sgtty.h>
  1932.  
  1933. --- 13,19 -----
  1934.   #include    <sys/stat.h>
  1935.   #ifdef RES    /* DAG -- conditionalize */
  1936.   #include        "dup.h"
  1937. + #endif
  1938.   
  1939.   #ifdef RES
  1940.   #include    <sgtty.h>
  1941. ***************
  1942. *** 15,20
  1943.   
  1944.   #ifdef RES
  1945.   #include    <sgtty.h>
  1946.   #endif
  1947.   
  1948.   static BOOL    beenhere = FALSE;
  1949.  
  1950. --- 17,24 -----
  1951.   
  1952.   #ifdef RES
  1953.   #include    <sgtty.h>
  1954. + #else
  1955. + #include    <fcntl.h>    /* DAG -- for defines */
  1956.   #endif
  1957.   
  1958.   BOOL        catcheof = FALSE;    /* not yet */
  1959. ***************
  1960. *** 17,22
  1961.   #include    <sgtty.h>
  1962.   #endif
  1963.   
  1964.   static BOOL    beenhere = FALSE;
  1965.   char        tmpout[20] = "/tmp/sh-";
  1966.   struct fileblk    stdfile;
  1967.  
  1968. --- 21,27 -----
  1969.   #include    <fcntl.h>    /* DAG -- for defines */
  1970.   #endif
  1971.   
  1972. + BOOL        catcheof = FALSE;    /* not yet */
  1973.   static BOOL    beenhere = FALSE;
  1974.   char        tmpout[20] = "/tmp/sh-";
  1975.   struct fileblk    stdfile;
  1976. ***************
  1977. *** 43,48
  1978.       register int    rflag = ttyflg;
  1979.       int        rsflag = 1;    /* local restricted flag */
  1980.       struct namnod    *n;
  1981.   
  1982.       stdsigs();
  1983.   
  1984.  
  1985. --- 48,56 -----
  1986.       register int    rflag = ttyflg;
  1987.       int        rsflag = 1;    /* local restricted flag */
  1988.       struct namnod    *n;
  1989. + #if JOBS
  1990. +     char *sim;    /* BRL security, for better checking of restricted */
  1991. + #endif
  1992.   
  1993.       stdsigs();
  1994.   
  1995. ***************
  1996. *** 77,82
  1997.   
  1998.   #ifndef RES
  1999.   
  2000.       if (c > 0 && any('r', simple(*v)))
  2001.           rflag = 0;
  2002.   
  2003.  
  2004. --- 85,94 -----
  2005.   
  2006.   #ifndef RES
  2007.   
  2008. + #ifdef JOBS
  2009. +     /* smarter check for restricted shell, courtesy of BRL */
  2010. +     if (c > 0 && (eq(sim = simple(*v), "rsh") || eq(sim,"-rsh")))
  2011. + #else
  2012.       if (c > 0 && any('r', simple(*v)))
  2013.   #endif
  2014.           rflag = 0;
  2015. ***************
  2016. *** 78,83
  2017.   #ifndef RES
  2018.   
  2019.       if (c > 0 && any('r', simple(*v)))
  2020.           rflag = 0;
  2021.   
  2022.   #endif
  2023.  
  2024. --- 90,96 -----
  2025.       if (c > 0 && (eq(sim = simple(*v), "rsh") || eq(sim,"-rsh")))
  2026.   #else
  2027.       if (c > 0 && any('r', simple(*v)))
  2028. + #endif
  2029.           rflag = 0;
  2030.   
  2031.   #endif
  2032. ***************
  2033. *** 108,113
  2034.       dolv = v + c - dolc;
  2035.       dolc--;
  2036.   
  2037.       /*
  2038.        * return here for shell file execution
  2039.        * but not for parenthesis subshells
  2040.  
  2041. --- 121,147 -----
  2042.       dolv = v + c - dolc;
  2043.       dolc--;
  2044.   
  2045. + #if JOBS
  2046. +     j_default_pg = getpid();
  2047. +     j_original_pg = getpgrp();
  2048. +     /* enable job control if argv[0] has a 'j' in its simple name */
  2049. +     if ((flags & jobflg) == 0 && c > 0 && any('j', simple(*v))
  2050. +         && comdiv == 0 /* set by options */ && (flags & stdflg))
  2051. +     {
  2052. +         j_init();
  2053. +         flags |= jobflg;
  2054. +         {            /* append 'J' to $- string */
  2055. +         register char *flagc = flagadr;
  2056. +         while (*flagc)
  2057. +             flagc++;
  2058. +         *flagc++ = 'J';
  2059. +         *flagc = 0;
  2060. +         }
  2061. +     }
  2062. + #endif
  2063.       /*
  2064.        * return here for shell file execution
  2065.        * but not for parenthesis subshells
  2066. ***************
  2067. *** 125,130
  2068.       assnum(&pidadr, getpid());
  2069.   
  2070.       /*
  2071.        * set up temp file names
  2072.        */
  2073.       settmp();
  2074.  
  2075. --- 159,170 -----
  2076.       assnum(&pidadr, getpid());
  2077.   
  2078.       /*
  2079. +      * set ppidname '$+'
  2080. +      */
  2081. +     ppid = getppid();
  2082. +     assnum (& ppidadr, ppid);
  2083. +     /*
  2084.        * set up temp file names
  2085.        */
  2086.       settmp();
  2087. ***************
  2088. *** 137,143
  2089.       dfault(&mchknod, MAILCHECK);
  2090.       mailchk = stoi(mchknod.namval);
  2091.   
  2092. !     if ((beenhere++) == FALSE)    /* ? profile */
  2093.       {
  2094.           if (*(simple(cmdadr)) == '-')
  2095.           {            /* system profile */
  2096.  
  2097. --- 177,188 -----
  2098.       dfault(&mchknod, MAILCHECK);
  2099.       mailchk = stoi(mchknod.namval);
  2100.   
  2101. ! #if pyr
  2102. !     /*
  2103. !      * find out current universe, initialize $UNIVERSE
  2104. !      */
  2105. !     cur_univ = setuniverse (U_UCB);    /* retrieve old and set to UCB */
  2106. !     if (cur_univ == -1)
  2107.       {
  2108.           /* unknown current, default to UCB */
  2109.           cur_univ = U_UCB;
  2110. ***************
  2111. *** 139,144
  2112.   
  2113.       if ((beenhere++) == FALSE)    /* ? profile */
  2114.       {
  2115.           if (*(simple(cmdadr)) == '-')
  2116.           {            /* system profile */
  2117.   
  2118.  
  2119. --- 184,214 -----
  2120.       cur_univ = setuniverse (U_UCB);    /* retrieve old and set to UCB */
  2121.       if (cur_univ == -1)
  2122.       {
  2123. +         /* unknown current, default to UCB */
  2124. +         cur_univ = U_UCB;
  2125. +         setuniverse (cur_univ);
  2126. +     }
  2127. +     else if (cur_univ != U_UCB)
  2128. +         setuniverse (cur_univ);    /* reset to what it was */
  2129. +     
  2130. +     /*
  2131. +      * force value, ignore whatever was in environment
  2132. +      */
  2133. +     assign (& univnod, univ_name[cur_univ - 1]);
  2134. +     attrib ((&univnod), N_RDONLY);    /* user can not set $UNIVERSE */
  2135. + #endif
  2136. +     /*
  2137. +      * assign default value of $HOME/.history to $HISTFILE
  2138. +      */
  2139. +     (void) catpath ("~", savehist);
  2140. +     dfault (& histfnod, curstak());
  2141. +     if (beenhere == FALSE)        /* ? profile */
  2142. +     {
  2143. +         static struct statb;
  2144. +         ++beenhere;        /* DAG */
  2145.           if (*(simple(cmdadr)) == '-')
  2146.           {            /* system profile */
  2147.               struct stat statb;
  2148. ***************
  2149. *** 141,147
  2150.       {
  2151.           if (*(simple(cmdadr)) == '-')
  2152.           {            /* system profile */
  2153.   #ifndef RES
  2154.   
  2155.               if ((input = pathopen(nullstr, sysprofile)) >= 0)
  2156.  
  2157. --- 211,217 -----
  2158.           ++beenhere;        /* DAG */
  2159.           if (*(simple(cmdadr)) == '-')
  2160.           {            /* system profile */
  2161. !             struct stat statb;
  2162.   #ifndef RES
  2163.   
  2164.               if ((input = pathopen(nullstr, sysprofile)) >= 0)
  2165. ***************
  2166. *** 149,155
  2167.   
  2168.   #endif
  2169.   
  2170. !             if ((input = pathopen(nullstr, profile)) >= 0)
  2171.               {
  2172.                   exfile(rflag);
  2173.                   flags &= ~ttyflg;
  2174.  
  2175. --- 219,230 -----
  2176.   
  2177.   #endif
  2178.   
  2179. !             if ((input = pathopen(nullstr, profile)) >= 0
  2180. !                 && geteuid() == 0
  2181. !                 && (fstat(input, &statb) != 0
  2182. !                     || statb.st_uid != 0))
  2183. !                 close (input);    /* protect superuser, c/o BRL */
  2184. !             else
  2185.               {
  2186.                   exfile(rflag);
  2187.                   flags &= ~ttyflg;
  2188. ***************
  2189. *** 157,162
  2190.           }
  2191.           if (rsflag == 0 || rflag == 0)
  2192.               flags |= rshflg;
  2193.           /*
  2194.            * open input file if specified
  2195.            */
  2196.  
  2197. --- 232,251 -----
  2198.           }
  2199.           if (rsflag == 0 || rflag == 0)
  2200.               flags |= rshflg;
  2201. +         
  2202. +         /* if all ok, process $HOME/.shrc */
  2203. +         if (geteuid() == getuid() && getegid() == getgid()
  2204. +             && (flags & (rshflg|quickflg)) == 0
  2205. +             && (input = pathopen("~", shrc)) >= 0)
  2206. +         {
  2207. +             int promptflags = flags & (ttyflg|intflg|prompt);
  2208. +             /* turn off anything that will cause prompting */
  2209. +             flags &= ~promptflags;
  2210. +             exfile (rflag);
  2211. +             flags |= promptflags;
  2212. +         }
  2213.           /*
  2214.            * open input file if specified
  2215.            */
  2216. ***************
  2217. *** 221,226
  2218.               setmail(mailpnod.namval);
  2219.           else
  2220.               setmail(mailnod.namval);
  2221.       }
  2222.       else
  2223.       {
  2224.  
  2225. --- 310,318 -----
  2226.               setmail(mailpnod.namval);
  2227.           else
  2228.               setmail(mailnod.namval);
  2229. +         /* restore previous history */
  2230. +         histrest (histfnod.namval);
  2231.       }
  2232.       else
  2233.       {
  2234. ***************
  2235. *** 256,262
  2236.           if ((flags & prompt) && standin->fstak == 0 && !eof)
  2237.           {
  2238.   
  2239. !             if (mailp)
  2240.               {
  2241.                   time(&curtime);
  2242.   
  2243.  
  2244. --- 348,354 -----
  2245.           if ((flags & prompt) && standin->fstak == 0 && !eof)
  2246.           {
  2247.   
  2248. !             if (mailp && *mailp)    /* BRL to check for *mailp */
  2249.               {
  2250.                   time(&curtime);
  2251.   
  2252. ***************
  2253. *** 267,273
  2254.                   }
  2255.               }
  2256.   
  2257. !             prs(ps1nod.namval);
  2258.   
  2259.   #ifdef TIME_OUT
  2260.               alarm(TIMEOUT);
  2261.  
  2262. --- 359,368 -----
  2263.                   }
  2264.               }
  2265.   
  2266. !             /* do special handling for $PS1 */
  2267. !             pr_prompt(ps1nod.namval);
  2268. !             if (userid == 0 && ! eq(ps1nod.namval, supprompt))
  2269. !                 prs(supprompt);    /* append "# " */
  2270.   
  2271.   #ifdef TIME_OUT
  2272.               alarm(TIMEOUT);
  2273. ***************
  2274. *** 276,281
  2275.               flags |= waiting;
  2276.           }
  2277.   
  2278.           trapnote = 0;
  2279.           peekc = readc();
  2280.           if (eof)
  2281.  
  2282. --- 371,377 -----
  2283.               flags |= waiting;
  2284.           }
  2285.   
  2286. +         catcheof = TRUE;
  2287.           trapnote = 0;
  2288.           peekc = readc();
  2289.           catcheof = FALSE;
  2290. ***************
  2291. *** 278,283
  2292.   
  2293.           trapnote = 0;
  2294.           peekc = readc();
  2295.           if (eof)
  2296.               return;
  2297.   
  2298.  
  2299. --- 374,380 -----
  2300.           catcheof = TRUE;
  2301.           trapnote = 0;
  2302.           peekc = readc();
  2303. +         catcheof = FALSE;
  2304.           if (eof)
  2305.               return;
  2306.   
  2307. :::::::: mode.h :::::::
  2308. No differences encountered
  2309. :::::::: msg.c :::::::
  2310. *** ../orig.u/msg.c    Wed May 15 17:08:23 1985
  2311. --- msg.c    Wed Jun  5 15:20:45 1985
  2312. ***************
  2313. *** 48,53
  2314.   char    nohome[]    = "no home directory";
  2315.   char     badperm[]    = "execute permission denied";
  2316.   char    longpwd[]    = "sh error: pwd too long";
  2317.   /*
  2318.    * messages for 'builtin' functions
  2319.    */
  2320.  
  2321. --- 48,66 -----
  2322.   char    nohome[]    = "no home directory";
  2323.   char     badperm[]    = "execute permission denied";
  2324.   char    longpwd[]    = "sh error: pwd too long";
  2325. + #if JOBS
  2326. + char    cjpostr[]    = ": couldn't jpost\n";
  2327. + char    jcoffstr[]    = "job control not enabled\n";
  2328. + char    jpanstr[]    = "sh bug: j_print_ent--no number ";
  2329. + char    jinvstr[]    = "invalid job number\n";
  2330. + char    ncjstr[]    = "no current job\n";
  2331. + char    nstpstr[]    = ": not stopped\n";
  2332. + char    tasjstr[]    = "There are stopped jobs.\n";
  2333. + #endif
  2334. + #if SYMLINK
  2335. + char    nolstat[]    = ": can't lstat component";
  2336. + #endif
  2337.   /*
  2338.    * messages for 'builtin' functions
  2339.    */
  2340. ***************
  2341. *** 66,71
  2342.   char    mchkname[]    = "MAILCHECK";
  2343.   char    acctname[]      = "SHACCT";
  2344.   char    mailpname[]    = "MAILPATH";
  2345.   
  2346.   /*
  2347.    * string constants
  2348.  
  2349. --- 79,88 -----
  2350.   char    mchkname[]    = "MAILCHECK";
  2351.   char    acctname[]      = "SHACCT";
  2352.   char    mailpname[]    = "MAILPATH";
  2353. + #if pyr
  2354. + char    univname[]    = "UNIVERSE";
  2355. + #endif
  2356. + char    histfilename[]    = "HISTFILE";
  2357.   
  2358.   /*
  2359.    * string constants
  2360. ***************
  2361. *** 85,90
  2362.   char    supprompt[]    = "# ";
  2363.   char    profile[]    = ".profile";
  2364.   char    sysprofile[]    = "/etc/profile";
  2365.   
  2366.   /*
  2367.    * tables
  2368.  
  2369. --- 102,151 -----
  2370.   char    supprompt[]    = "# ";
  2371.   char    profile[]    = ".profile";
  2372.   char    sysprofile[]    = "/etc/profile";
  2373. + char    shrc[]        = ".shrc";
  2374. + char    savehist[]    = ".history";
  2375. + char    dashi[]        = "-i";        /* for history.c */
  2376. + char    dashr[]        = "-r";
  2377. + char    dashs[]        = "-s";
  2378. + char    rdwstr[]    = "<> ";
  2379. + #if JOBS
  2380. + char    rsqbrk[]    = "] ";
  2381. + char    spspstr[]    = " \ ";
  2382. + char    fgdstr[]    = "foreground \ \ \ \ \ \ ";
  2383. + char    stpdstr[]    = "stopped";
  2384. + char    lotspstr[]    = " \ \ \ \ \ \ \ \ \ ";
  2385. + char    psgpstr[]    = " (signal) ";
  2386. + char    ptinstr[]    = " (tty in) ";
  2387. + char    ptoustr[]    = " (tty out)";
  2388. + char    bgdstr[]    = "background \ \ \ \ \ \ ";
  2389. + char    spcstr[]    = " ";
  2390. + char    rdinstr[]    = "< ";
  2391. + char    appdstr[]    = ">> ";
  2392. + char    inlnstr[]    = "<< ";
  2393. + char    sfnstr[]    = "(){ ";
  2394. + char    efnstr[]    = " }";
  2395. + char    semspstr[]    = "; ";
  2396. + char    lpnstr[]    = "(";
  2397. + char    rpnstr[]    = ")";
  2398. + char    insstr[]    = " in ";
  2399. + char    sdostr[]    = "; do ";
  2400. + char    sdonstr[]    = "; done";
  2401. + char    sthnstr[]    = "; then ";
  2402. + char    selsstr[]    = "; else ";
  2403. + char    sfistr[]    = "; fi";
  2404. + char    iesacstr[]    = " in ... esac";
  2405. + char    casestr[]    = "case ";
  2406. + char    pipestr[]    = " | ";
  2407. + char    toastr[]    = ">&";
  2408. + char    fromastr[]    = "<&";
  2409. + char    andstr[]    = " && ";
  2410. + char    orstr[]        = " || ";
  2411. + char    forstr[]    = "for ";
  2412. + char    amperstr[]    = " &";    
  2413. + char    whilestr[]    = "while ";
  2414. + char    untilstr[]    = "until ";
  2415. + char    ifstr[]        = "if ";
  2416. + #endif
  2417.   
  2418.   /*
  2419.    * tables
  2420. ***************
  2421. *** 130,135
  2422.       "Alarm call",
  2423.       "Terminated",
  2424.       "Signal 16",
  2425.       "Signal 17",
  2426.       "Child death",
  2427.       "Power Fail"
  2428.  
  2429. --- 191,218 -----
  2430.       "Alarm call",
  2431.       "Terminated",
  2432.       "Signal 16",
  2433. + #if JOBS
  2434. +     "Stop",
  2435. +     "Stop from keyboard",
  2436. +     "Continue",
  2437. +     "Child status change",
  2438. +     "Background read",
  2439. +     "Background write",
  2440. +     "I/O possible",
  2441. +     "CPU time lmit",
  2442. +     "File size limit",
  2443. +     "Virtual time alarm",
  2444. +     "Profiling timer alarm",
  2445. + #if gould
  2446. +     "Stack overflow",
  2447. + #else
  2448. +     "Signal 28",
  2449. + #endif
  2450. +     "Signal 29",
  2451. +     "Signal 30",
  2452. +     "Signal 31",
  2453. +     "Signal 32",
  2454. + #else
  2455.       "Signal 17",
  2456.       "Child death",
  2457.       "Power Fail"
  2458. ***************
  2459. *** 133,138
  2460.       "Signal 17",
  2461.       "Child death",
  2462.       "Power Fail"
  2463.   };
  2464.   
  2465.   char    export[] = "export";
  2466.  
  2467. --- 216,222 -----
  2468.       "Signal 17",
  2469.       "Child death",
  2470.       "Power Fail"
  2471. + #endif
  2472.   };
  2473.   
  2474.   char    export[] = "export";
  2475. ***************
  2476. *** 149,154
  2477.       { "[",        SYSTST },
  2478.   #endif
  2479.   
  2480.       { "break",    SYSBREAK },
  2481.       { "cd",        SYSCD    },
  2482.       { "continue",    SYSCONT    },
  2483.  
  2484. --- 233,246 -----
  2485.       { "[",        SYSTST },
  2486.   #endif
  2487.   
  2488. + #if pyr
  2489. +     { "att",    SYSATT },
  2490. + #endif
  2491. + #if JOBS
  2492. +     { "bg",        SYSBG },
  2493. + #endif
  2494.       { "break",    SYSBREAK },
  2495.       { "cd",        SYSCD    },
  2496.       { "continue",    SYSCONT    },
  2497. ***************
  2498. *** 157,162
  2499.       { "exec",    SYSEXEC    },
  2500.       { "exit",    SYSEXIT    },
  2501.       { "export",    SYSXPORT },
  2502.       { "hash",    SYSHASH    },
  2503.   
  2504.   #ifdef RES
  2505.  
  2506. --- 249,259 -----
  2507.       { "exec",    SYSEXEC    },
  2508.       { "exit",    SYSEXIT    },
  2509.       { "export",    SYSXPORT },
  2510. + #if JOBS
  2511. +     { "fg",        SYSFG },
  2512. + #endif
  2513.       { "hash",    SYSHASH    },
  2514.       { "history",    SYSHISTORY },
  2515.   
  2516. ***************
  2517. *** 158,163
  2518.       { "exit",    SYSEXIT    },
  2519.       { "export",    SYSXPORT },
  2520.       { "hash",    SYSHASH    },
  2521.   
  2522.   #ifdef RES
  2523.       { "login",    SYSLOGIN },
  2524.  
  2525. --- 255,261 -----
  2526.   #endif
  2527.   
  2528.       { "hash",    SYSHASH    },
  2529. +     { "history",    SYSHISTORY },
  2530.   
  2531.   #if JOBS
  2532.       { "jobs",    SYSJOBS },
  2533. ***************
  2534. *** 159,164
  2535.       { "export",    SYSXPORT },
  2536.       { "hash",    SYSHASH    },
  2537.   
  2538.   #ifdef RES
  2539.       { "login",    SYSLOGIN },
  2540.       { "newgrp",    SYSLOGIN },
  2541.  
  2542. --- 257,266 -----
  2543.       { "hash",    SYSHASH    },
  2544.       { "history",    SYSHISTORY },
  2545.   
  2546. + #if JOBS
  2547. +     { "jobs",    SYSJOBS },
  2548. + #endif
  2549.   #ifdef RES
  2550.       { "login",    SYSLOGIN },
  2551.       { "newgrp",    SYSLOGIN },
  2552. ***************
  2553. *** 172,177
  2554.       { "return",    SYSRETURN },
  2555.       { "set",    SYSSET    },
  2556.       { "shift",    SYSSHFT    },
  2557.       { "test",    SYSTST },
  2558.       { "times",    SYSTIMES },
  2559.       { "trap",    SYSTRAP    },
  2560.  
  2561. --- 274,282 -----
  2562.       { "return",    SYSRETURN },
  2563.       { "set",    SYSSET    },
  2564.       { "shift",    SYSSHFT    },
  2565. + #if JOBS
  2566. +     { "suspend",    SYSSUSPEND },
  2567. + #endif
  2568.       { "test",    SYSTST },
  2569.       { "times",    SYSTIMES },
  2570.       { "trap",    SYSTRAP    },
  2571. ***************
  2572. *** 177,182
  2573.       { "trap",    SYSTRAP    },
  2574.       { "type",    SYSTYPE },
  2575.   
  2576.   
  2577.   #ifndef RES        
  2578.       { "ulimit",    SYSULIMIT },
  2579.  
  2580. --- 282,290 -----
  2581.       { "trap",    SYSTRAP    },
  2582.       { "type",    SYSTYPE },
  2583.   
  2584. + #if pyr
  2585. +     { "ucb",    SYSUCB },
  2586. + #endif
  2587.   
  2588.   #ifndef RES        
  2589.       { "ulimit",    SYSULIMIT },
  2590. ***************
  2591. *** 183,188
  2592.       { "umask",    SYSUMASK },
  2593.   #endif
  2594.   
  2595.       { "unset",     SYSUNS },
  2596.       { "wait",    SYSWAIT    }
  2597.   };
  2598.  
  2599. --- 291,300 -----
  2600.       { "umask",    SYSUMASK },
  2601.   #endif
  2602.   
  2603. + #if pyr
  2604. +     { "universe",    SYSUNIVERSE },
  2605. + #endif
  2606.       { "unset",     SYSUNS },
  2607.       { "wait",    SYSWAIT    }
  2608.   };
  2609. ***************
  2610. *** 187,194
  2611.       { "wait",    SYSWAIT    }
  2612.   };
  2613.   
  2614. ! #ifdef RES
  2615. !     int no_commands = 26;
  2616. ! #else
  2617. !     int no_commands = 27;
  2618.   #endif
  2619.  
  2620. --- 299,308 -----
  2621.       { "wait",    SYSWAIT    }
  2622.   };
  2623.   
  2624. ! int no_commands = sizeof commands / sizeof(struct sysnod);    /* DAG -- improved */
  2625. ! #if pyr
  2626. ! #include <sys/types.h>        /* to get <sys/inode.h> to work (sigh) */
  2627. ! #include <sys/inode.h>        /* NUMUNIV defined to be NUMCLNK */
  2628. ! #include <universe.h>    /* gets char *univ_name[] && cha *univ_longname[] */
  2629.   #endif
  2630.  
  2631.