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

  1. Date: Fri, 7 Jun 85 14:17:48 edt
  2. From: Arnold Robbins <gatech!arnold>
  3. Subject: Bourne shell history + tilde + job control + more (Part 8 of 9)
  4. Newsgroups: mod.sources
  5.  
  6. This is part 8 of 9.  It contains the code diffs for the System V Release 2
  7. Bourne shell that comes with BRL Unix (/usr/5bin/sh).
  8.  
  9. Arnold Robbins
  10. arnold@gatech.{UUCP, CSNET}
  11. --------------- You know what to do here -----------------------
  12. :::::::: :fix :::::::
  13. No differences encountered
  14. :::::::: Makefile :::::::
  15. *** ../orig.u/Makefile    Wed May 15 17:11:54 1985
  16. --- Makefile    Fri Jun  7 11:46:36 1985
  17. ***************
  18. *** 3,9
  19.   TESTDIR    = .
  20.   INS    = cp
  21.   INSDIR    = /usr/5bin
  22. ! DEFS    = -DNICE -DNICEVAL=4 -DBRL -DJOBS    # for BSD, add -DBSD    # -DACCT
  23.   CFLAGS    = $(DEFS) -O
  24.   ACCTINC    =                    # -I/usr/src/cmd/acct
  25.   LDFLAGS    = -s -n
  26.  
  27. --- 3,9 -----
  28.   TESTDIR    = .
  29.   INS    = cp
  30.   INSDIR    = /usr/5bin
  31. ! DEFS    = -DNICE -DNICEVAL=4 -DBRL -DJOBS -DBSD # for BSD, add -DBSD    # -DACCT
  32.   CFLAGS    = $(DEFS) -O
  33.   ACCTINC    =                    # -I/usr/src/cmd/acct
  34.   LDFLAGS    = -s -n
  35. ***************
  36. *** 12,18
  37.   OFILES    = setbrk.o blok.o stak.o cmd.o fault.o main.o word.o string.o\
  38.         name.o args.o xec.o service.o error.o io.o print.o macro.o expand.o\
  39.         ctype.o msg.o test.o defs.o hash.o hashserv.o pwd.o func.o\
  40. !       echo.o jobs.o    # for BSD, remove echo.o and add signal.o and ulimit.o
  41.   
  42.   CFILES    = setbrk.c blok.c stak.c cmd.c fault.c main.c word.c string.c\
  43.         name.c args.c xec.c service.c error.c io.c print.c macro.c expand.c\
  44.  
  45. --- 12,19 -----
  46.   OFILES    = setbrk.o blok.o stak.o cmd.o fault.o main.o word.o string.o\
  47.         name.o args.o xec.o service.o error.o io.o print.o macro.o expand.o\
  48.         ctype.o msg.o test.o defs.o hash.o hashserv.o pwd.o func.o\
  49. !       history.o homedir.o \
  50. !       echo.o jobs.o    signal.o ulimit.o # for BSD, add signal.o and ulimit.o
  51.   
  52.   CFILES    = setbrk.c blok.c stak.c cmd.c fault.c main.c word.c string.c\
  53.         name.c args.c xec.c service.c error.c io.c print.c macro.c expand.c\
  54. ***************
  55. *** 17,23
  56.   CFILES    = setbrk.c blok.c stak.c cmd.c fault.c main.c word.c string.c\
  57.         name.c args.c xec.c service.c error.c io.c print.c macro.c expand.c\
  58.         ctype.c msg.c test.c defs.c hash.c hashserv.c pwd.c func.c\
  59. !       echo.c jobs.c    # for BSD, remove echo.c and add signal.c and ulimit.c
  60.   
  61.   all:        sh
  62.   
  63.  
  64. --- 18,25 -----
  65.   CFILES    = setbrk.c blok.c stak.c cmd.c fault.c main.c word.c string.c\
  66.         name.c args.c xec.c service.c error.c io.c print.c macro.c expand.c\
  67.         ctype.c msg.c test.c defs.c hash.c hashserv.c pwd.c func.c\
  68. !       history.c homedir.c \
  69. !       echo.c jobs.c signal.c ulimit.c # for BSD, add signal.c and ulimit.c
  70.   
  71.   all:        sh
  72.   
  73. ***************
  74. *** 37,46
  75.   main.o:        timeout.h
  76.   
  77.   ctype.o:
  78. !     if gould; \
  79. !     then    $(CC) $(CFLAGS) -R -c ctype.c; \
  80. !     else    sh ./:fix ctype; \
  81. !     fi
  82.   
  83.   msg.o:
  84.       if gould; \
  85.  
  86. --- 39,49 -----
  87.   main.o:        timeout.h
  88.   
  89.   ctype.o:
  90. !     $(CC) $(CFLAGS) -S ctype.c
  91. !     sed '/^[     ]*\.data/s/text/data/' < ctype.s > x.s
  92. !     $(CC) -c x.s
  93. !     mv x.o ctype.o
  94. !     rm x.s ctype.s
  95.   
  96.   msg.o:
  97.       $(CC) $(CFLAGS) -S msg.c
  98. ***************
  99. *** 43,52
  100.       fi
  101.   
  102.   msg.o:
  103. !     if gould; \
  104. !     then    $(CC) $(CFLAGS) -R -c msg.c; \
  105. !     else    sh ./:fix msg; \
  106. !     fi
  107.   
  108.   service.o:
  109.       $(CC) $(CFLAGS) $(ACCTINC) -c service.c
  110.  
  111. --- 46,56 -----
  112.       rm x.s ctype.s
  113.   
  114.   msg.o:
  115. !     $(CC) $(CFLAGS) -S msg.c
  116. !     sed '/^[     ]*\.data/s/text/data/' < msg.s > x.s
  117. !     $(CC) -c x.s
  118. !     mv x.o msg.o
  119. !     rm x.s msg.s
  120.   
  121.   service.o:
  122.       $(CC) $(CFLAGS) $(ACCTINC) -c service.c
  123. :::::::: Makefile.gould :::::::
  124. No differences encountered
  125. :::::::: SH_NOTES :::::::
  126. No differences encountered
  127. :::::::: args.c :::::::
  128. *** ../orig.u/args.c    Wed May 15 17:11:55 1985
  129. --- args.c    Wed Jun  5 14:48:23 1985
  130. ***************
  131. *** 15,21
  132.   
  133.   #if BRL
  134.   #if JOBS
  135. ! char    flagadr[17];
  136.   #else
  137.   char    flagadr[16];
  138.   #endif
  139.  
  140. --- 15,21 -----
  141.   
  142.   #if BRL
  143.   #if JOBS
  144. ! char    flagadr[19];
  145.   #else
  146.   char    flagadr[18];
  147.   #endif
  148. ***************
  149. *** 17,23
  150.   #if JOBS
  151.   char    flagadr[17];
  152.   #else
  153. ! char    flagadr[16];
  154.   #endif
  155.   #else    /* !BRL */
  156.   #if JOBS
  157.  
  158. --- 17,23 -----
  159.   #if JOBS
  160.   char    flagadr[19];
  161.   #else
  162. ! char    flagadr[18];
  163.   #endif
  164.   #else    /* !BRL */
  165.   #if JOBS
  166. ***************
  167. *** 21,27
  168.   #endif
  169.   #else    /* !BRL */
  170.   #if JOBS
  171. ! char    flagadr[15];
  172.   #else
  173.   char    flagadr[14];
  174.   #endif
  175.  
  176. --- 21,27 -----
  177.   #endif
  178.   #else    /* !BRL */
  179.   #if JOBS
  180. ! char    flagadr[17];
  181.   #else
  182.   char    flagadr[16];
  183.   #endif
  184. ***************
  185. *** 23,29
  186.   #if JOBS
  187.   char    flagadr[15];
  188.   #else
  189. ! char    flagadr[14];
  190.   #endif
  191.   #endif
  192.   
  193.  
  194. --- 23,29 -----
  195.   #if JOBS
  196.   char    flagadr[17];
  197.   #else
  198. ! char    flagadr[16];
  199.   #endif
  200.   #endif
  201.   
  202. ***************
  203. *** 49,54
  204.   #if JOBS
  205.       'J',
  206.   #endif
  207.        0
  208.   };
  209.   
  210.  
  211. --- 49,56 -----
  212.   #if JOBS
  213.       'J',
  214.   #endif
  215. +     'q',        /* ADR -- -q to not read ~/.shrc */
  216. +     'H',        /* ADR -- -H turn off history mechanism */
  217.        0
  218.   };
  219.   
  220. ***************
  221. *** 74,79
  222.   #if JOBS
  223.       jobflg,
  224.   #endif
  225.         0
  226.   };
  227.   
  228.  
  229. --- 76,83 -----
  230.   #if JOBS
  231.       jobflg,
  232.   #endif
  233. +     quickflg,
  234. +     nohistflg,
  235.         0
  236.   };
  237.   
  238. ***************
  239. *** 109,115
  240.   
  241.           /*
  242.            * Step along 'flagchar[]' looking for matches.
  243. !          * 'sicr' are not legal with 'set' command.
  244.            */
  245.   
  246.           while (*++cp)
  247.  
  248. --- 113,119 -----
  249.   
  250.           /*
  251.            * Step along 'flagchar[]' looking for matches.
  252. !          * 'sicrq' are not legal with 'set' command.
  253.            */
  254.   
  255.           while (*++cp)
  256. ***************
  257. *** 119,125
  258.                   flagc++;
  259.               if (*cp == *flagc)
  260.               {
  261. !                 if (eq(argv[0], setstr) && any(*cp, sicrstr))    /* DAG -- made strings sharable */
  262.                       failed(argv[1], badopt);
  263.                   else
  264.                   {
  265.  
  266. --- 123,129 -----
  267.                   flagc++;
  268.               if (*cp == *flagc)
  269.               {
  270. !                 if (eq(argv[0], setstr) && any(*cp, sicrqstr))    /* DAG -- made strings sharable */
  271.                       failed(argv[1], badopt);
  272.                   else
  273.                   {
  274. ***************
  275. *** 147,152
  276.       }
  277.       else if (argc > 1 && *argp[1] == '+')    /* unset flags x, k, t, n, v, e, u */
  278.                           /* or any added BRL/JOBS flags */
  279.       {
  280.           cp = argp[1];
  281.           while (*++cp)
  282.  
  283. --- 151,157 -----
  284.       }
  285.       else if (argc > 1 && *argp[1] == '+')    /* unset flags x, k, t, n, v, e, u */
  286.                           /* or any added BRL/JOBS flags */
  287. +                         /* or history flag */
  288.       {
  289.           cp = argp[1];
  290.           while (*++cp)
  291. ***************
  292. *** 157,163
  293.               /*
  294.                * step through flags
  295.                */
  296. !             if (!any(*cp, sicrstr) && *cp == *flagc)    /* DAG -- made string sharable */
  297.               {
  298.                   /*
  299.                    * only turn off if already on
  300.  
  301. --- 162,168 -----
  302.               /*
  303.                * step through flags
  304.                */
  305. !             if (!any(*cp, sicrqstr) && *cp == *flagc)    /* DAG -- made string sharable */
  306.               {
  307.                   /*
  308.                    * only turn off if already on
  309. :::::::: blok.c :::::::
  310. No differences encountered
  311. :::::::: brkincr.h :::::::
  312. No differences encountered
  313. :::::::: cmd.c :::::::
  314. No differences encountered
  315. :::::::: ctype.c :::::::
  316. No differences encountered
  317. :::::::: ctype.h :::::::
  318. *** ../orig.u/ctype.h    Wed May 15 17:11:55 1985
  319. --- ctype.h    Thu Apr 25 11:44:38 1985
  320. ***************
  321. *** 80,86
  322.   extern char    _ctype2[];
  323.   
  324.   #define    digit(c)    (((c)"E)==0 && _ctype2[c]&(T_DIG))
  325. ! #define dolchar(c)    (((c)"E)==0 && _ctype2[c]&(T_AST|T_BRC|T_DIG|T_IDC|T_SHN))
  326.   #define defchar(c)    (((c)"E)==0 && _ctype2[c]&(T_DEF))
  327.   #define setchar(c)    (((c)"E)==0 && _ctype2[c]&(T_SET))
  328.   #define digchar(c)    (((c)"E)==0 && _ctype2[c]&(T_AST|T_DIG))
  329.  
  330. --- 80,86 -----
  331.   extern char    _ctype2[];
  332.   
  333.   #define    digit(c)    (((c)"E)==0 && _ctype2[c]&(T_DIG))
  334. ! #define dolchar(c)    (((c)"E)==0 && _ctype2[c]&(T_AST|T_BRC|T_DIG|T_IDC|T_SHN|_PLS))
  335.   #define defchar(c)    (((c)"E)==0 && _ctype2[c]&(T_DEF))
  336.   #define setchar(c)    (((c)"E)==0 && _ctype2[c]&(T_SET))
  337.   #define digchar(c)    (((c)"E)==0 && _ctype2[c]&(T_AST|T_DIG))
  338. :::::::: defs.c :::::::
  339. *** ../orig.u/defs.c    Wed May 15 17:11:56 1985
  340. --- defs.c    Thu May  9 10:57:13 1985
  341. ***************
  342. *** 17,22
  343.   struct ionod    *iopend;    /* documents waiting to be read at NL */
  344.   struct fdsave    fdmap[NOFILE];
  345.   
  346.   /* substitution */
  347.   int                dolc;
  348.   char            **dolv;
  349.  
  350. --- 17,34 -----
  351.   struct ionod    *iopend;    /* documents waiting to be read at NL */
  352.   struct fdsave    fdmap[NOFILE];
  353.   
  354. + /* history stuff */
  355. + int    event_count = 1;
  356. + int    expanded = 0;    /* did a history expansion occur? */
  357. + /* keep track of the parent pid */
  358. + int    ppid;
  359. + #if pyr
  360. + /* keep track of the current universe */
  361. + int    cur_univ;
  362. + #endif
  363.   /* substitution */
  364.   int                dolc;
  365.   char            **dolv;
  366. ***************
  367. *** 36,41
  368.   /* special names */
  369.   char            *pcsadr;
  370.   char            *pidadr;
  371.   char            *cmdadr;
  372.   
  373.   /* transput */ 
  374.  
  375. --- 48,54 -----
  376.   /* special names */
  377.   char            *pcsadr;
  378.   char            *pidadr;
  379. + char            *ppidadr;
  380.   char            *cmdadr;
  381.   
  382.   /* transput */ 
  383. :::::::: defs.h :::::::
  384. *** ../orig.u/defs.h    Wed May 15 17:11:56 1985
  385. --- defs.h    Wed Jun  5 15:19:40 1985
  386. ***************
  387. *** 3,9
  388.    *    UNIX shell
  389.    */
  390.   
  391. ! #if BSD || gould
  392.   #define    void    int    /* avoid compiler bug */
  393.   #endif
  394.   
  395.  
  396. --- 3,9 -----
  397.    *    UNIX shell
  398.    */
  399.   
  400. ! #if BSD || gould || pyr
  401.   #define    void    int    /* avoid compiler bug */
  402.   #endif
  403.   
  404. ***************
  405. *** 87,92
  406.   #define        SYSJOBS        29
  407.   #define        SYSFG        30
  408.   #define        SYSBG        31
  409.   #endif
  410.   
  411.   /* used for input and output of shell */
  412.  
  413. --- 87,93 -----
  414.   #define        SYSJOBS        29
  415.   #define        SYSFG        30
  416.   #define        SYSBG        31
  417. + #define        SYSSUSPEND    32
  418.   #endif
  419.   
  420.   #if pyr
  421. ***************
  422. *** 89,94
  423.   #define        SYSBG        31
  424.   #endif
  425.   
  426.   /* used for input and output of shell */
  427.   #define     INIO         19
  428.   
  429.  
  430. --- 90,105 -----
  431.   #define        SYSSUSPEND    32
  432.   #endif
  433.   
  434. + #if pyr
  435. + #define        SYSATT        33
  436. + #define        SYSUCB        34
  437. + #define        SYSUNIVERSE    35
  438. + #define        U_ATT        1    /* ATT is Universe number 1 */
  439. + #define        U_UCB        2    /* UCB is Universe number 2 */
  440. + #endif
  441. + #define        SYSHISTORY    36
  442.   /* used for input and output of shell */
  443.   #define     INIO         19
  444.   
  445. ***************
  446. *** 111,117
  447.   #include    "mode.h"
  448.   #include    "name.h"
  449.   #include    <signal.h>
  450. ! #if BSD
  451.   #define    SIGUSR1    16
  452.   #define    SIGUSR2    17
  453.   #endif
  454.  
  455. --- 122,128 -----
  456.   #include    "mode.h"
  457.   #include    "name.h"
  458.   #include    <signal.h>
  459. ! #if BSD && ! defined(pyr)    /* avoid dual universe problems */
  460.   #define    SIGUSR1    16
  461.   #define    SIGUSR2    17
  462.   #endif
  463. ***************
  464. *** 115,121
  465.   #define    SIGUSR1    16
  466.   #define    SIGUSR2    17
  467.   #endif
  468. ! #if defined(JOBS) && !defined(BSD)
  469.   #define    SIGSTOP    17
  470.   #define    SIGTSTP    18
  471.   #define    SIGCONT    19
  472.  
  473. --- 126,132 -----
  474.   #define    SIGUSR1    16
  475.   #define    SIGUSR2    17
  476.   #endif
  477. ! #if defined(JOBS) && !defined(BSD) && !defined(pyr)
  478.   #define    SIGSTOP    17
  479.   #define    SIGTSTP    18
  480.   #define    SIGCONT    19
  481. ***************
  482. *** 123,128
  483.   #define    SIGTTOU    22
  484.   #endif
  485.   
  486.   
  487.   /*    error catching */
  488.   extern int         errno;
  489.  
  490. --- 134,140 -----
  491.   #define    SIGTTOU    22
  492.   #endif
  493.   
  494. + #define HISTSIZE    4096
  495.   
  496.   /*    error catching */
  497.   extern int         errno;
  498. ***************
  499. *** 148,153
  500.   extern char                *mactrim();
  501.   extern char                *macro();
  502.   extern char                *execs();
  503.   /* extern char                *copyto();    /* DAG -- (bug fix) static */
  504.   extern int                exname();
  505.   extern char                *staknam();
  506.  
  507. --- 160,168 -----
  508.   extern char                *mactrim();
  509.   extern char                *macro();
  510.   extern char                *execs();
  511. + extern char                *homedir();
  512. + extern char                *username();
  513. + extern char                *retcwd();
  514.   /* extern char                *copyto();    /* DAG -- (bug fix) static */
  515.   extern int                exname();
  516.   extern char                *staknam();
  517. ***************
  518. *** 168,173
  519.   extern BOOL                j_finish();
  520.   extern char                *j_macro();
  521.   #endif
  522.   
  523.   #define     attrib(n,f)        (n->namflg |= f)
  524.   #define     round(a,b)        (((int)(((char *)(a)+b)-1))&~((b)-1))
  525.  
  526. --- 183,189 -----
  527.   extern BOOL                j_finish();
  528.   extern char                *j_macro();
  529.   #endif
  530. + extern int                history();
  531.   
  532.   #define     attrib(n,f)        (n->namflg |= f)
  533.   #define     round(a,b)        (((int)(((char *)(a)+b)-1))&~((b)-1))
  534. ***************
  535. *** 184,189
  536.   extern struct ionod        *iopend;    /* documents waiting to be read at NL */
  537.   extern struct fdsave    fdmap[];
  538.   
  539.   
  540.   /* substitution */
  541.   extern int                dolc;
  542.  
  543. --- 200,208 -----
  544.   extern struct ionod        *iopend;    /* documents waiting to be read at NL */
  545.   extern struct fdsave    fdmap[];
  546.   
  547. + /* history stuff */
  548. + extern int    event_count;
  549. + extern int    expanded;    /* did a history expansion occur? */
  550.   
  551.   /* keep track of the parent pid */
  552.   extern int    ppid;
  553. ***************
  554. *** 185,190
  555.   extern struct fdsave    fdmap[];
  556.   
  557.   
  558.   /* substitution */
  559.   extern int                dolc;
  560.   extern char                **dolv;
  561.  
  562. --- 204,219 -----
  563.   extern int    event_count;
  564.   extern int    expanded;    /* did a history expansion occur? */
  565.   
  566. + /* keep track of the parent pid */
  567. + extern int    ppid;
  568. + #if pyr
  569. + /* keep track of the current universe */
  570. + extern int    cur_univ;
  571. + extern char    *univ_name[];        /* from <universe.h> */
  572. + extern char    *univ_longname[];
  573. + #endif
  574.   /* substitution */
  575.   extern int                dolc;
  576.   extern char                **dolv;
  577. ***************
  578. *** 205,211
  579.   extern char                endoffile[];
  580.   extern char                synmsg[];
  581.   extern char                setstr[];     /* DAG -- made sharable */
  582. ! extern char                sicrstr[];    /* DAG */
  583.   extern char                bang[];        /* DAG */
  584.   extern char                pdstr[];    /* DAG */
  585.   extern char                dotdot[];    /* DAG */
  586.  
  587. --- 234,240 -----
  588.   extern char                endoffile[];
  589.   extern char                synmsg[];
  590.   extern char                setstr[];     /* DAG -- made sharable */
  591. ! extern char                sicrqstr[];    /* ADR */
  592.   extern char                bang[];        /* DAG */
  593.   extern char                pdstr[];    /* DAG */
  594.   extern char                dotdot[];    /* DAG */
  595. ***************
  596. *** 228,233
  597.   extern char                dashd[];    /* DAG */
  598.   extern char                dashf[];    /* DAG */
  599.   extern char                dashg[];    /* DAG */
  600.   extern char                dashk[];    /* DAG */
  601.   extern char                dashn[];    /* DAG */
  602.   extern char                dasho[];    /* DAG */
  603.  
  604. --- 257,263 -----
  605.   extern char                dashd[];    /* DAG */
  606.   extern char                dashf[];    /* DAG */
  607.   extern char                dashg[];    /* DAG */
  608. + extern char                dashi[];    /* ADR */
  609.   extern char                dashk[];    /* DAG */
  610.   #if pyr
  611.   extern char                dashl[];    /* ADR */
  612. ***************
  613. *** 229,234
  614.   extern char                dashf[];    /* DAG */
  615.   extern char                dashg[];    /* DAG */
  616.   extern char                dashk[];    /* DAG */
  617.   extern char                dashn[];    /* DAG */
  618.   extern char                dasho[];    /* DAG */
  619.   extern char                dashp[];    /* DAG */
  620.  
  621. --- 259,267 -----
  622.   extern char                dashg[];    /* DAG */
  623.   extern char                dashi[];    /* ADR */
  624.   extern char                dashk[];    /* DAG */
  625. + #if pyr
  626. + extern char                dashl[];    /* ADR */
  627. + #endif
  628.   extern char                dashn[];    /* DAG */
  629.   extern char                dasho[];    /* DAG */
  630.   extern char                dashp[];    /* DAG */
  631. ***************
  632. *** 274,279
  633.   extern char                ishashed[];    /* DAG */
  634.   extern char                rpnlstr[];    /* DAG */
  635.   extern char                isstr[];    /* DAG */
  636.   #if JOBS
  637.   extern char                rsqbrk[];
  638.   extern char                spspstr[];
  639.  
  640. --- 307,313 -----
  641.   extern char                ishashed[];    /* DAG */
  642.   extern char                rpnlstr[];    /* DAG */
  643.   extern char                isstr[];    /* DAG */
  644. + extern char                rdwstr[];    /* ADR */
  645.   #if JOBS
  646.   extern char                rsqbrk[];
  647.   extern char                spspstr[];
  648. ***************
  649. *** 300,305
  650.   extern char                selsstr[];
  651.   extern char                sfistr[];
  652.   extern char                iesacstr[];
  653.   #endif
  654.   #if SYMLINK
  655.   extern char                nolstat[];
  656.  
  657. --- 334,340 -----
  658.   extern char                selsstr[];
  659.   extern char                sfistr[];
  660.   extern char                iesacstr[];
  661. + extern char                nosusp[];
  662.   #endif
  663.   #if SYMLINK
  664.   extern char                nolstat[];
  665. ***************
  666. *** 339,344
  667.   extern char                supprompt[];
  668.   extern char                profile[];
  669.   extern char                sysprofile[];
  670.   
  671.   /* built in names */
  672.   extern struct namnod    fngnod;
  673.  
  674. --- 374,381 -----
  675.   extern char                supprompt[];
  676.   extern char                profile[];
  677.   extern char                sysprofile[];
  678. + extern char                shrc[];
  679. + extern char                savehist[];
  680.   
  681.   /* built in names */
  682.   extern struct namnod    fngnod;
  683. ***************
  684. *** 355,360
  685.   #if BRL
  686.   extern struct namnod    timenod;
  687.   #endif
  688.   
  689.   /* special names */
  690.   extern char                flagadr[];
  691.  
  692. --- 392,401 -----
  693.   #if BRL
  694.   extern struct namnod    timenod;
  695.   #endif
  696. + #if pyr
  697. + extern struct namnod    univnod;
  698. + #endif
  699. + extern struct namnod    histfnod;
  700.   
  701.   /* special names */
  702.   extern char                flagadr[];
  703. ***************
  704. *** 360,365
  705.   extern char                flagadr[];
  706.   extern char                *pcsadr;
  707.   extern char                *pidadr;
  708.   extern char                *cmdadr;
  709.   
  710.   extern char                defpath[];
  711.  
  712. --- 401,407 -----
  713.   extern char                flagadr[];
  714.   extern char                *pcsadr;
  715.   extern char                *pidadr;
  716. + extern char                *ppidadr;
  717.   extern char                *cmdadr;
  718.   
  719.   extern char                defpath[];
  720. ***************
  721. *** 378,383
  722.   #if BRL
  723.   extern char                timename[];    /* TIMEOUT */
  724.   #endif
  725.   
  726.   /* transput */
  727.   extern char                tmpout[];
  728.  
  729. --- 420,429 -----
  730.   #if BRL
  731.   extern char                timename[];    /* TIMEOUT */
  732.   #endif
  733. + #if pyr
  734. + extern char                univname[];    /* UNIVERSE */
  735. + #endif
  736. + extern char                histfilename[];    /* HISTFILE */
  737.   
  738.   /* transput */
  739.   extern char                tmpout[];
  740. ***************
  741. *** 436,441
  742.   #define        noeotflg    02000000
  743.   #define        dotflg        04000000
  744.   #endif
  745.   
  746.   extern long                flags;
  747.   extern int                rwait;    /* flags read waiting */
  748.  
  749. --- 482,489 -----
  750.   #define        noeotflg    02000000
  751.   #define        dotflg        04000000
  752.   #endif
  753. + #define        quickflg    010000000
  754. + #define        nohistflg    020000000
  755.   
  756.   extern long                flags;
  757.   extern int                rwait;    /* flags read waiting */
  758. ***************
  759. *** 444,450
  760.   #include    <setjmp.h>
  761.   extern jmp_buf            subshell;
  762.   extern jmp_buf            errshell;
  763. ! #if defined(BSD) && !defined(BSD41C)
  764.   #define    setjmp( env )        _setjmp( env )
  765.   #define    longjmp( env, val )    _longjmp( env, val )
  766.   #endif
  767.  
  768. --- 492,498 -----
  769.   #include    <setjmp.h>
  770.   extern jmp_buf            subshell;
  771.   extern jmp_buf            errshell;
  772. ! #if defined(BSD) && !defined(BSD41C) && !defined(pyr)
  773.   #define    setjmp( env )        _setjmp( env )
  774.   #define    longjmp( env, val )    _longjmp( env, val )
  775.   #endif
  776. :::::::: echo.c :::::::
  777. No differences encountered
  778. :::::::: error.c :::::::
  779. *** ../orig.u/error.c    Wed May 15 17:11:56 1985
  780. --- error.c    Wed May 15 16:02:49 1985
  781. ***************
  782. *** 96,101
  783.           exit(99);
  784.       }
  785.   #endif
  786.       exit(exitval);
  787.   }
  788.   
  789.  
  790. --- 96,103 -----
  791.           exit(99);
  792.       }
  793.   #endif
  794. +     histsave (histfnod.namval);
  795.       exit(exitval);
  796.   }
  797.   
  798. :::::::: expand.c :::::::
  799. No differences encountered
  800. :::::::: fault.c :::::::
  801. No differences encountered
  802. :::::::: func.c :::::::
  803. *** ../orig.u/func.c    Wed May 15 17:11:56 1985
  804. --- func.c    Wed Jun  5 16:01:27 1985
  805. ***************
  806. *** 371,376
  807.                       prs_buff(fromastr);    /* DAG */
  808.   
  809.               }
  810.               else if ((iof & IOPUT) == 0)
  811.                   prc_buff('<');
  812.               else if (iof & IOAPP)
  813.  
  814. --- 371,378 -----
  815.                       prs_buff(fromastr);    /* DAG */
  816.   
  817.               }
  818. +             else if (iof & IORDW)
  819. +                 prs_buff(rdwstr);    /* ADR */
  820.               else if ((iof & IOPUT) == 0)
  821.                   prc_buff('<');
  822.               else if (iof & IOAPP)
  823. :::::::: hash.c :::::::
  824. No differences encountered
  825. :::::::: hash.h :::::::
  826. No differences encountered
  827. :::::::: hashserv.c :::::::
  828. No differences encountered
  829. :::::::: io.c :::::::
  830. No differences encountered
  831. :::::::: jobs.c :::::::
  832. *** ../orig.u/jobs.c    Wed May 15 17:11:57 1985
  833. --- jobs.c    Wed Jun  5 11:55:37 1985
  834. ***************
  835. *** 3,8
  836.    *
  837.    *  created by Ron Natalie, BRL
  838.    *  slight changes by Doug Gwyn
  839.    */
  840.   
  841.   #include "defs.h"
  842.  
  843. --- 3,9 -----
  844.    *
  845.    *  created by Ron Natalie, BRL
  846.    *  slight changes by Doug Gwyn
  847. +  *  some more slight changes by Arnold Robbins (mainly for the BSD /bin/sh)
  848.    */
  849.   
  850.   #include "defs.h"
  851. ***************
  852. *** 8,14
  853.   #include "defs.h"
  854.   #include "sym.h"
  855.   
  856. ! #if BSD    /* native /bin/sh */
  857.   #include <sys/ioctl.h>
  858.   #else    /* /usr/5bin/sh */
  859.   #include    <sys/_ioctl.h>
  860.  
  861. --- 9,27 -----
  862.   #include "defs.h"
  863.   #include "sym.h"
  864.   
  865. ! #ifndef TAB    /* very original, early /bin/sh */
  866. ! #include <signal.h>
  867. ! #define comptr(x)    ((COMPTR) x)
  868. ! #define lstptr(x)    ((LSTPTR) x)
  869. ! #define forkptr(x)    ((FORKPTR) x)
  870. ! #define parptr(x)    ((PARPTR) x)
  871. ! #define forptr(x)    ((FORPTR) x)
  872. ! #define whptr(x)    ((WHPTR) x)
  873. ! #define ifptr(x)    ((IFPTR) x)
  874. ! #define swptr(x)    ((SWPTR) x)
  875. ! #endif
  876. ! #if BSD || (JOBS && ! BRL)    /* native /bin/sh */
  877.   #include <sys/ioctl.h>
  878.   #else    /* /usr/5bin/sh */
  879.   #include    <sys/_ioctl.h>
  880. ***************
  881. *** 457,463
  882.                   if(j_stuff(numbuf))
  883.                       return 1;
  884.               }
  885. !             switch(iof & (IODOC|IOPUT|IOMOV|IOAPP))  {
  886.               case IOGET:
  887.                   if(j_stuff(rdinstr))    /* DAG */
  888.                       return 1;
  889.  
  890. --- 470,476 -----
  891.                   if(j_stuff(numbuf))
  892.                       return 1;
  893.               }
  894. !             switch(iof & (IODOC|IOPUT|IOMOV|IOAPP|IORDW))  {
  895.               case IOGET:
  896.                   if(j_stuff(rdinstr))    /* DAG */
  897.                       return 1;
  898. ***************
  899. *** 482,487
  900.                   if(j_stuff(fromastr))    /* DAG */
  901.                       return 1;
  902.                   break;
  903.               }
  904.               if(j_stuff(t->ioname))
  905.                   return 1;
  906.  
  907. --- 495,504 -----
  908.                   if(j_stuff(fromastr))    /* DAG */
  909.                       return 1;
  910.                   break;
  911. +             case IORDW:
  912. +                 if(j_stuff(rdwstr))    /* ADR */
  913. +                     return 1;
  914. +                 break;
  915.               }
  916.               if(j_stuff(t->ioname))
  917.                   return 1;
  918. ***************
  919. *** 503,508
  920.   
  921.       type = t->tretyp & COMMSK;
  922.       switch(type)  {
  923.       case    TFND:    /* added by DAG for System V Release 2 shell */
  924.           return j_stuff(fndptr(t)->fndnam)
  925.               || j_stuff(sfnstr)    /* DAG */
  926.  
  927. --- 520,526 -----
  928.   
  929.       type = t->tretyp & COMMSK;
  930.       switch(type)  {
  931. + #ifdef TFND    /* ADR --- don't put this stuff in the plain BSD /bin/sh */
  932.       case    TFND:    /* added by DAG for System V Release 2 shell */
  933.           return j_stuff(fndptr(t)->fndnam)
  934.               || j_stuff(sfnstr)    /* DAG */
  935. ***************
  936. *** 508,513
  937.               || j_stuff(sfnstr)    /* DAG */
  938.               || j_do(fndptr(t)->fndval)
  939.               || j_stuff(efnstr);    /* DAG */
  940.   
  941.       case    TCOM:
  942.           if(comptr(t)->comset)  {
  943.  
  944. --- 526,532 -----
  945.               || j_stuff(sfnstr)    /* DAG */
  946.               || j_do(fndptr(t)->fndval)
  947.               || j_stuff(efnstr);    /* DAG */
  948. + #endif
  949.   
  950.       case    TCOM:
  951.           if(comptr(t)->comset)  {
  952. :::::::: mac.h :::::::
  953. *** ../orig.u/mac.h    Wed May 15 17:11:57 1985
  954. --- mac.h    Thu Apr 25 11:44:51 1985
  955. ***************
  956. *** 19,24
  957.   #define RQ    '\''
  958.   #define MINUS    '-'
  959.   #define COLON    ':'
  960.   #define TAB    '\t'
  961.   
  962.   
  963.  
  964. --- 19,25 -----
  965.   #define RQ    '\''
  966.   #define MINUS    '-'
  967.   #define COLON    ':'
  968. + #define SQUIGGLE    '~'    /* TILDE defined in BSD tty handler */
  969.   #define TAB    '\t'
  970.   
  971.   
  972. :::::::: macro.c :::::::
  973. *** ../orig.u/macro.c    Wed May 15 17:11:57 1985
  974. --- macro.c    Thu Apr 25 11:44:51 1985
  975. ***************
  976. *** 133,138
  977.               }
  978.               else if (c == '$')
  979.                   v = pidadr;
  980.               else if (c == '!')
  981.                   v = pcsadr;
  982.               else if (c == '#')
  983.  
  984. --- 133,147 -----
  985.               }
  986.               else if (c == '$')
  987.                   v = pidadr;
  988. +             else if (c == '+')
  989. +             {
  990. +                 if (ppid != getppid())    /* parent died */
  991. +                 {
  992. +                     ppid = getppid();
  993. +                     assnum (&ppidadr, ppid);
  994. +                 }
  995. +                 v = ppidadr;
  996. +             }
  997.               else if (c == '!')
  998.                   v = pcsadr;
  999.               else if (c == '#')
  1000. :::::::: main.c :::::::
  1001. *** ../orig.u/main.c    Wed May 15 17:11:57 1985
  1002. --- main.c    Tue May 21 17:17:32 1985
  1003. ***************
  1004. *** 69,77
  1005.           if (argv0[0] != '-' || argv0[1] != 'S')
  1006.               loginsh = 0;
  1007.       }
  1008. ! #endif
  1009. ! #endif
  1010. ! #if !defined(BRL) || !defined(pdp11)
  1011.       loginsh = argv0[0] == '-';
  1012.   #endif
  1013.   
  1014.  
  1015. --- 69,75 -----
  1016.           if (argv0[0] != '-' || argv0[1] != 'S')
  1017.               loginsh = 0;
  1018.       }
  1019. ! #else
  1020.       loginsh = argv0[0] == '-';
  1021.   #endif
  1022.   #endif
  1023. ***************
  1024. *** 74,79
  1025.   #if !defined(BRL) || !defined(pdp11)
  1026.       loginsh = argv0[0] == '-';
  1027.   #endif
  1028.   
  1029.       stdsigs();
  1030.   
  1031.  
  1032. --- 72,78 -----
  1033.   #else
  1034.       loginsh = argv0[0] == '-';
  1035.   #endif
  1036. + #endif
  1037.   
  1038.       stdsigs();
  1039.   
  1040. ***************
  1041. *** 179,184
  1042.       replace(&cmdadr, dolv[0]);    /* cmdadr is $0 */
  1043.   
  1044.       /*
  1045.        * set pidname '$$'
  1046.        */
  1047.       assnum(&pidadr, getpid());
  1048.  
  1049. --- 178,189 -----
  1050.       replace(&cmdadr, dolv[0]);    /* cmdadr is $0 */
  1051.   
  1052.       /*
  1053. +      * set ppidname '$+'
  1054. +      */
  1055. +     ppid = getppid();
  1056. +     assnum (& ppidadr, ppid);
  1057. +     /*
  1058.        * set pidname '$$'
  1059.        */
  1060.       assnum(&pidadr, getpid());
  1061. ***************
  1062. *** 202,207
  1063.       dfault(&mchknod, MAILCHECK);
  1064.       mailchk = stoi(mchknod.namval);
  1065.   
  1066.       if ((beenhere) == FALSE)    /* ? profile */    /* DAG -- only increment once */
  1067.       {
  1068.           ++beenhere;        /* DAG */
  1069.  
  1070. --- 207,239 -----
  1071.       dfault(&mchknod, MAILCHECK);
  1072.       mailchk = stoi(mchknod.namval);
  1073.   
  1074. + #if pyr
  1075. +     /*
  1076. +      * find out current universe, initialize $UNIVERSE
  1077. +      */
  1078. +     cur_univ = setuniverse (U_UCB); /* retrieve old and set to UCB */
  1079. +     if (cur_univ == -1)
  1080. +     {
  1081. +         /* unknown current, default to UCB */
  1082. +         cur_univ = U_UCB;
  1083. +         setuniverse (cur_univ);
  1084. +     }
  1085. +     else if (cur_univ != U_UCB)
  1086. +         setuniverse (cur_univ); /* restore to what it was */
  1087. +     
  1088. +     /*
  1089. +      * force value, ignore whatever was in environment
  1090. +      */
  1091. +     assign (& univnod, univ_name[cur_univ - 1]);
  1092. +     attrib ((& univnod), N_RDONLY);   /* user can not set $UNIVERSE */
  1093. + #endif
  1094. +     /*
  1095. +      * assign default value of $HOME/.history to $HISTFILE
  1096. +      */
  1097. +     (void) catpath ("~", savehist);
  1098. +     dfault (& histfnod, curstak());
  1099.       if ((beenhere) == FALSE)    /* ? profile */    /* DAG -- only increment once */
  1100.       {
  1101.           ++beenhere;        /* DAG */
  1102. ***************
  1103. *** 211,216
  1104.               struct stat    statb;    /* needed for test */
  1105.   #endif
  1106.   
  1107.   #ifndef RES
  1108.   
  1109.               if ((input = pathopen(nullstr, sysprofile)) >= 0)
  1110.  
  1111. --- 243,253 -----
  1112.               struct stat    statb;    /* needed for test */
  1113.   #endif
  1114.   
  1115. +             if (geteuid() != getuid())
  1116. +                 setuid (getuid());
  1117. +             if (getegid() != getgid())
  1118. +                 setgid (getgid());
  1119.   #ifndef RES
  1120.   
  1121.               if ((input = pathopen(nullstr, sysprofile)) >= 0)
  1122. ***************
  1123. *** 232,237
  1124.           }
  1125.           if (rsflag == 0 || rflag == 0)
  1126.               flags |= rshflg;
  1127.           /*
  1128.            * open input file if specified
  1129.            */
  1130.  
  1131. --- 269,288 -----
  1132.           }
  1133.           if (rsflag == 0 || rflag == 0)
  1134.               flags |= rshflg;
  1135. +         /* if all OK, process $HOME/.shrc */
  1136. +         if (geteuid() == getuid() && getegid() == getgid()
  1137. +             && (flags & (rshflg|quickflg)) == 0
  1138. +             && (input = pathopen ("~", shrc)) >= 0)
  1139. +         {
  1140. +             int promptflags = (flags & (ttyflg|intflg|prompt));
  1141. +             /* turn off anything that will cause prompting */
  1142. +             flags &= ~promptflags;
  1143. +             exfile (rflag);
  1144. +             flags |= promptflags;
  1145. +         }
  1146.           /*
  1147.            * open input file if specified
  1148.            */
  1149. ***************
  1150. *** 300,305
  1151.               setmail(mailpnod.namval);
  1152.           else
  1153.               setmail(mailnod.namval);
  1154.       }
  1155.       else
  1156.       {
  1157.  
  1158. --- 351,359 -----
  1159.               setmail(mailpnod.namval);
  1160.           else
  1161.               setmail(mailnod.namval);
  1162. +         /* restore previous history */
  1163. +         histrest (histfnod.namval);
  1164.       }
  1165.       else
  1166.       {
  1167. ***************
  1168. *** 349,355
  1169.                   }
  1170.               }
  1171.   
  1172. !             prs(ps1nod.namval);
  1173.   
  1174.   #if BRL
  1175.               if (userid == 0 && !eq(ps1nod.namval, supprompt))
  1176.  
  1177. --- 403,410 -----
  1178.                   }
  1179.               }
  1180.   
  1181. !             /* do special handling for $PS1 */
  1182. !             pr_prompt(ps1nod.namval);
  1183.   
  1184.   #if BRL
  1185.               if (userid == 0 && !eq(ps1nod.namval, supprompt))
  1186. :::::::: mode.h :::::::
  1187. No differences encountered
  1188. :::::::: msg.c :::::::
  1189. *** ../orig.u/msg.c    Wed May 15 17:11:58 1985
  1190. --- msg.c    Wed Jun  5 15:19:55 1985
  1191. ***************
  1192. *** 42,49
  1193.   char    wtfailed[]    = "is read only";
  1194.   char    notid[]        = "is not an identifier";
  1195.   char     badulimit[]    = "bad ulimit";    /* DAG -- lower case */
  1196. ! char    badreturn[] = "cannot return when not in function";
  1197. ! char    badexport[] = "cannot export functions";
  1198.   char    badunset[]     = "cannot unset";
  1199.   char    nohome[]    = "no home directory";
  1200.   char     badperm[]    = "execute permission denied";
  1201.  
  1202. --- 42,49 -----
  1203.   char    wtfailed[]    = "is read only";
  1204.   char    notid[]        = "is not an identifier";
  1205.   char     badulimit[]    = "bad ulimit";    /* DAG -- lower case */
  1206. ! char    badreturn[]    = "cannot return when not in function";
  1207. ! char    badexport[]    = "cannot export functions";
  1208.   char    badunset[]     = "cannot unset";
  1209.   char    nohome[]    = "no home directory";
  1210.   char     badperm[]    = "execute permission denied";
  1211. ***************
  1212. *** 98,103
  1213.   #if BRL
  1214.   char    timename[]    = "TIMEOUT";
  1215.   #endif
  1216.   
  1217.   /*
  1218.    * string constants
  1219.  
  1220. --- 98,107 -----
  1221.   #if BRL
  1222.   char    timename[]    = "TIMEOUT";
  1223.   #endif
  1224. + #if pyr
  1225. + char    univname[]    = "UNIVERSE";
  1226. + #endif
  1227. + char    histfilename[]    = "HISTFILE";
  1228.   
  1229.   /*
  1230.    * string constants
  1231. ***************
  1232. *** 116,122
  1233.   char    stdprompt[]    = "$ ";
  1234.   char    supprompt[]    = "# ";
  1235.   char    profile[]    = ".profile";
  1236. ! #if !defined(BRL) || defined(pdp11)
  1237.   char    sysprofile[]    = "/etc/profile";
  1238.   #else
  1239.   char    sysprofile[]    = "/usr/5lib/profile";
  1240.  
  1241. --- 120,128 -----
  1242.   char    stdprompt[]    = "$ ";
  1243.   char    supprompt[]    = "# ";
  1244.   char    profile[]    = ".profile";
  1245. ! char    shrc[]        = ".shrc";
  1246. ! char    savehist[]    = ".history";
  1247. ! #if defined(GATECH) || !defined(BRL) || defined(pdp11)
  1248.   char    sysprofile[]    = "/etc/profile";
  1249.   #else
  1250.   char    sysprofile[]    = "/usr/5lib/profile";
  1251. ***************
  1252. *** 122,128
  1253.   char    sysprofile[]    = "/usr/5lib/profile";
  1254.   #endif
  1255.   char    setstr[]    = "set";            /* DAG -- made sharable */
  1256. ! char    sicrstr[]    = "sicr";            /* DAG */
  1257.   char    bang[]        = "!";                /* DAG */
  1258.   char    pdstr[]        = ".";                /* DAG */
  1259.   char    dotdot[]    = "..";                /* DAG */
  1260.  
  1261. --- 128,134 -----
  1262.   char    sysprofile[]    = "/usr/5lib/profile";
  1263.   #endif
  1264.   char    setstr[]    = "set";            /* DAG -- made sharable */
  1265. ! char    sicrqstr[]    = "sicrq";            /* ADR */
  1266.   char    bang[]        = "!";                /* DAG */
  1267.   char    pdstr[]        = ".";                /* DAG */
  1268.   char    dotdot[]    = "..";                /* DAG */
  1269. ***************
  1270. *** 145,150
  1271.   char    dashd[]        = "-d";                /* DAG */
  1272.   char    dashf[]        = "-f";                /* DAG */
  1273.   char    dashg[]        = "-g";                /* DAG */
  1274.   char    dashk[]        = "-k";                /* DAG */
  1275.   char    dashn[]        = "-n";                /* DAG */
  1276.   char    dasho[]        = "-o";                /* DAG */
  1277.  
  1278. --- 151,157 -----
  1279.   char    dashd[]        = "-d";                /* DAG */
  1280.   char    dashf[]        = "-f";                /* DAG */
  1281.   char    dashg[]        = "-g";                /* DAG */
  1282. + char    dashi[]        = "-i";                /* ADR */
  1283.   char    dashk[]        = "-k";                /* DAG */
  1284.   #if pyr
  1285.   char    dashl[]        = "-l";                /* ADR */
  1286. ***************
  1287. *** 146,151
  1288.   char    dashf[]        = "-f";                /* DAG */
  1289.   char    dashg[]        = "-g";                /* DAG */
  1290.   char    dashk[]        = "-k";                /* DAG */
  1291.   char    dashn[]        = "-n";                /* DAG */
  1292.   char    dasho[]        = "-o";                /* DAG */
  1293.   char    dashp[]        = "-p";                /* DAG */
  1294.  
  1295. --- 153,161 -----
  1296.   char    dashg[]        = "-g";                /* DAG */
  1297.   char    dashi[]        = "-i";                /* ADR */
  1298.   char    dashk[]        = "-k";                /* DAG */
  1299. + #if pyr
  1300. + char    dashl[]        = "-l";                /* ADR */
  1301. + #endif
  1302.   char    dashn[]        = "-n";                /* DAG */
  1303.   char    dasho[]        = "-o";                /* DAG */
  1304.   char    dashp[]        = "-p";                /* DAG */
  1305. ***************
  1306. *** 191,196
  1307.   char    ishashed[]    = " is hashed (";        /* DAG */
  1308.   char    rpnlstr[]    = ")\n";            /* DAG */
  1309.   char    isstr[]        = " is ";            /* DAG */
  1310.   #if JOBS
  1311.   char    rsqbrk[]    = "] ";
  1312.   char    spspstr[]    = " \ ";
  1313.  
  1314. --- 201,207 -----
  1315.   char    ishashed[]    = " is hashed (";        /* DAG */
  1316.   char    rpnlstr[]    = ")\n";            /* DAG */
  1317.   char    isstr[]        = " is ";            /* DAG */
  1318. + char    rdwstr[]    = "<> ";
  1319.   #if JOBS
  1320.   char    rsqbrk[]    = "] ";
  1321.   char    spspstr[]    = " \ ";
  1322. ***************
  1323. *** 217,222
  1324.   char    selsstr[]    = "; else ";
  1325.   char    sfistr[]    = "; fi";
  1326.   char    iesacstr[]    = " in ... esac";
  1327.   #endif
  1328.   #if BRL
  1329.   char    drshell[]    = "-rsh";
  1330.  
  1331. --- 228,234 -----
  1332.   char    selsstr[]    = "; else ";
  1333.   char    sfistr[]    = "; fi";
  1334.   char    iesacstr[]    = " in ... esac";
  1335. + char    nosusp[]    = "cannot suspend a login shell\n";    /* yet... */
  1336.   #endif
  1337.   #if BRL
  1338.   char    drshell[]    = "-rsh";
  1339. ***************
  1340. *** 329,334
  1341.       { lbstr,    SYSTST },    /* DAG -- use shared string */
  1342.   #endif
  1343.   
  1344.   #if JOBS
  1345.       { "bg",        SYSBG },
  1346.   #endif
  1347.  
  1348. --- 341,350 -----
  1349.       { lbstr,    SYSTST },    /* DAG -- use shared string */
  1350.   #endif
  1351.   
  1352. + #if pyr
  1353. +     { "att",    SYSATT },
  1354. + #endif
  1355.   #if JOBS
  1356.       { "bg",        SYSBG },
  1357.   #endif
  1358. ***************
  1359. *** 347,352
  1360.   #endif
  1361.   
  1362.       { "hash",    SYSHASH    },
  1363.   
  1364.   #if JOBS
  1365.       { "jobs",    SYSJOBS },
  1366.  
  1367. --- 363,369 -----
  1368.   #endif
  1369.   
  1370.       { "hash",    SYSHASH    },
  1371. +     { "history",    SYSHISTORY },
  1372.   
  1373.   #if JOBS
  1374.       { "jobs",    SYSJOBS },
  1375. ***************
  1376. *** 376,381
  1377.       { "return",    SYSRETURN },
  1378.       { setstr,    SYSSET    },    /* DAG -- use shared string */
  1379.       { "shift",    SYSSHFT    },
  1380.       { "test",    SYSTST },
  1381.       { "times",    SYSTIMES },
  1382.       { "trap",    SYSTRAP    },
  1383.  
  1384. --- 393,401 -----
  1385.       { "return",    SYSRETURN },
  1386.       { setstr,    SYSSET    },    /* DAG -- use shared string */
  1387.       { "shift",    SYSSHFT    },
  1388. + #if JOBS
  1389. +     { "suspend",    SYSSUSPEND },    /* ADR */
  1390. + #endif
  1391.       { "test",    SYSTST },
  1392.       { "times",    SYSTIMES },
  1393.       { "trap",    SYSTRAP    },
  1394. ***************
  1395. *** 381,386
  1396.       { "trap",    SYSTRAP    },
  1397.       { "type",    SYSTYPE },
  1398.   
  1399.   
  1400.   #ifndef RES        
  1401.       { "ulimit",    SYSULIMIT },
  1402.  
  1403. --- 401,409 -----
  1404.       { "trap",    SYSTRAP    },
  1405.       { "type",    SYSTYPE },
  1406.   
  1407. + #if pyr
  1408. +     { "ucb",    SYSUCB },
  1409. + #endif
  1410.   
  1411.   #ifndef RES        
  1412.       { "ulimit",    SYSULIMIT },
  1413. ***************
  1414. *** 387,392
  1415.       { "umask",    SYSUMASK },
  1416.   #endif
  1417.   
  1418.       { "unset",     SYSUNS },
  1419.       { "wait",    SYSWAIT    }
  1420.   };
  1421.  
  1422. --- 410,419 -----
  1423.       { "umask",    SYSUMASK },
  1424.   #endif
  1425.   
  1426. + #if pyr
  1427. +     { "universe",    SYSUNIVERSE },
  1428. + #endif
  1429.       { "unset",     SYSUNS },
  1430.       { "wait",    SYSWAIT    }
  1431.   };
  1432. ***************
  1433. *** 392,394
  1434.   };
  1435.   
  1436.   int    no_commands = sizeof commands / sizeof(struct sysnod);    /* DAG -- improved */
  1437.  
  1438. --- 419,427 -----
  1439.   };
  1440.   
  1441.   int    no_commands = sizeof commands / sizeof(struct sysnod);    /* DAG -- improved */
  1442. + #if pyr
  1443. + #include <sys/types.h>    /* to get sys/inode.h to work (sigh) */
  1444. + #include <sys/inode.h>    /* NUMUNIV is defined to be NCLNK */
  1445. + #include <universe.h>    /* gets char *univ_name[] && char *univ_longname[] */
  1446. + #endif
  1447. :::::::: name.c :::::::
  1448. *** ../orig.u/name.c    Wed May 15 17:11:58 1985
  1449. --- name.c    Wed May  8 10:02:45 1985
  1450. ***************
  1451. *** 15,20
  1452.   #if BRL
  1453.   struct namnod timenod =    /* for TIMEOUT */
  1454.   {
  1455.       (struct namnod *)NIL,
  1456.       (struct namnod *)NIL,
  1457.       timename
  1458.  
  1459. --- 15,24 -----
  1460.   #if BRL
  1461.   struct namnod timenod =    /* for TIMEOUT */
  1462.   {
  1463. +     &acctnod,
  1464. + #if pyr
  1465. +     &univnod,
  1466. + #else
  1467.       (struct namnod *)NIL,
  1468.   #endif
  1469.       timename
  1470. ***************
  1471. *** 16,22
  1472.   struct namnod timenod =    /* for TIMEOUT */
  1473.   {
  1474.       (struct namnod *)NIL,
  1475. !     (struct namnod *)NIL,
  1476.       timename
  1477.   };
  1478.   #endif
  1479.  
  1480. --- 20,26 -----
  1481.       &univnod,
  1482.   #else
  1483.       (struct namnod *)NIL,
  1484. ! #endif
  1485.       timename
  1486.   };
  1487.   #endif
  1488. ***************
  1489. *** 20,26
  1490.       timename
  1491.   };
  1492.   #endif
  1493. ! struct namnod ps2nod =
  1494.   {
  1495.       (struct namnod *)NIL,
  1496.       &acctnod,
  1497.  
  1498. --- 24,31 -----
  1499.       timename
  1500.   };
  1501.   #endif
  1502. ! #if pyr
  1503. ! struct namnod univnod = /* current universe */
  1504.   {
  1505.   #if BRL
  1506.       (struct namnod *)NIL,
  1507. ***************
  1508. *** 22,27
  1509.   #endif
  1510.   struct namnod ps2nod =
  1511.   {
  1512.       (struct namnod *)NIL,
  1513.       &acctnod,
  1514.       ps2name
  1515.  
  1516. --- 27,33 -----
  1517.   #if pyr
  1518.   struct namnod univnod = /* current universe */
  1519.   {
  1520. + #if BRL
  1521.       (struct namnod *)NIL,
  1522.   #else
  1523.       &acctnod,
  1524. ***************
  1525. *** 23,28
  1526.   struct namnod ps2nod =
  1527.   {
  1528.       (struct namnod *)NIL,
  1529.       &acctnod,
  1530.       ps2name
  1531.   };
  1532.  
  1533. --- 29,35 -----
  1534.   {
  1535.   #if BRL
  1536.       (struct namnod *)NIL,
  1537. + #else
  1538.       &acctnod,
  1539.   #endif
  1540.       (struct namnod *)NIL,
  1541. ***************
  1542. *** 24,29
  1543.   {
  1544.       (struct namnod *)NIL,
  1545.       &acctnod,
  1546.       ps2name
  1547.   };
  1548.   struct namnod cdpnod = 
  1549.  
  1550. --- 31,59 -----
  1551.       (struct namnod *)NIL,
  1552.   #else
  1553.       &acctnod,
  1554. + #endif
  1555. +     (struct namnod *)NIL,
  1556. +     univname,
  1557. + };
  1558. + #endif
  1559. + struct namnod histfnod =    /* history file */
  1560. + {
  1561. +     &cdpnod,
  1562. +     &homenod,
  1563. +     histfilename
  1564. + };
  1565. + struct namnod ps2nod =
  1566. + {
  1567. +     &ps1nod,
  1568. + #if BRL
  1569. +     &timenod,
  1570. + #else
  1571. + #if pyr
  1572. +     &univnod,
  1573. + #else
  1574. +     &acctnod,
  1575. + #endif
  1576. + #endif
  1577.       ps2name
  1578.   };
  1579.   struct namnod cdpnod = 
  1580. ***************
  1581. *** 34,40
  1582.   };
  1583.   struct namnod pathnod =
  1584.   {
  1585. -     &mailpnod,
  1586.       (struct namnod *)NIL,
  1587.       pathname
  1588.   };
  1589.  
  1590. --- 64,69 -----
  1591.   };
  1592.   struct namnod pathnod =
  1593.   {
  1594.       (struct namnod *)NIL,
  1595.       (struct namnod *)NIL,
  1596.       pathname
  1597. ***************
  1598. *** 36,41
  1599.   {
  1600.       &mailpnod,
  1601.       (struct namnod *)NIL,
  1602.       pathname
  1603.   };
  1604.   struct namnod ifsnod =
  1605.  
  1606. --- 65,71 -----
  1607.   struct namnod pathnod =
  1608.   {
  1609.       (struct namnod *)NIL,
  1610. +     (struct namnod *)NIL,
  1611.       pathname
  1612.   };
  1613.   struct namnod ifsnod =
  1614. ***************
  1615. *** 40,46
  1616.   };
  1617.   struct namnod ifsnod =
  1618.   {
  1619. !     &homenod,
  1620.       &mailnod,
  1621.       ifsname
  1622.   };
  1623.  
  1624. --- 70,76 -----
  1625.   };
  1626.   struct namnod ifsnod =
  1627.   {
  1628. !     &histfnod,
  1629.       &mailnod,
  1630.       ifsname
  1631.   };
  1632. ***************
  1633. *** 47,53
  1634.   struct namnod ps1nod =
  1635.   {
  1636.       &pathnod,
  1637. !     &ps2nod,
  1638.       ps1name
  1639.   };
  1640.   struct namnod homenod =
  1641.  
  1642. --- 77,83 -----
  1643.   struct namnod ps1nod =
  1644.   {
  1645.       &pathnod,
  1646. !     (struct namnod *)NIL,
  1647.       ps1name
  1648.   };
  1649.   struct namnod homenod =
  1650. ***************
  1651. *** 52,58
  1652.   };
  1653.   struct namnod homenod =
  1654.   {
  1655. -     &cdpnod,
  1656.       (struct namnod *)NIL,
  1657.       homename
  1658.   };
  1659.  
  1660. --- 82,87 -----
  1661.   };
  1662.   struct namnod homenod =
  1663.   {
  1664.       (struct namnod *)NIL,
  1665.       (struct namnod *)NIL,
  1666.       homename
  1667. ***************
  1668. *** 54,59
  1669.   {
  1670.       &cdpnod,
  1671.       (struct namnod *)NIL,
  1672.       homename
  1673.   };
  1674.   struct namnod mailnod =
  1675.  
  1676. --- 83,89 -----
  1677.   struct namnod homenod =
  1678.   {
  1679.       (struct namnod *)NIL,
  1680. +     (struct namnod *)NIL,
  1681.       homename
  1682.   };
  1683.   struct namnod mailnod =
  1684. ***************
  1685. *** 59,65
  1686.   struct namnod mailnod =
  1687.   {
  1688.       (struct namnod *)NIL,
  1689. !     (struct namnod *)NIL,
  1690.       mailname
  1691.   };
  1692.   struct namnod mchknod =
  1693.  
  1694. --- 89,95 -----
  1695.   struct namnod mailnod =
  1696.   {
  1697.       (struct namnod *)NIL,
  1698. !     &mchknod,
  1699.       mailname
  1700.   };
  1701.   struct namnod mchknod =
  1702. ***************
  1703. *** 64,71
  1704.   };
  1705.   struct namnod mchknod =
  1706.   {
  1707. !     &ifsnod,
  1708. !     &ps1nod,
  1709.       mchkname
  1710.   };
  1711.   struct namnod acctnod =
  1712.  
  1713. --- 94,101 -----
  1714.   };
  1715.   struct namnod mchknod =
  1716.   {
  1717. !     (struct namnod *)NIL,
  1718. !     (struct namnod *)NIL,
  1719.       mchkname
  1720.   };
  1721.   struct namnod acctnod =
  1722. ***************
  1723. *** 71,79
  1724.   struct namnod acctnod =
  1725.   {
  1726.       (struct namnod *)NIL,
  1727. - #if BRL
  1728. -     &timenod,    /* lopsided tree, but who cares */
  1729. - #else
  1730.       (struct namnod *)NIL,
  1731.   #endif
  1732.       acctname
  1733.  
  1734. --- 101,106 -----
  1735.   struct namnod acctnod =
  1736.   {
  1737.       (struct namnod *)NIL,
  1738.       (struct namnod *)NIL,
  1739.       acctname
  1740.   };
  1741. ***************
  1742. *** 75,81
  1743.       &timenod,    /* lopsided tree, but who cares */
  1744.   #else
  1745.       (struct namnod *)NIL,
  1746. - #endif
  1747.       acctname
  1748.   };
  1749.   struct namnod mailpnod =
  1750.  
  1751. --- 102,107 -----
  1752.   {
  1753.       (struct namnod *)NIL,
  1754.       (struct namnod *)NIL,
  1755.       acctname
  1756.   };
  1757.   struct namnod mailpnod =
  1758. ***************
  1759. *** 80,87
  1760.   };
  1761.   struct namnod mailpnod =
  1762.   {
  1763. !     (struct namnod *)NIL,
  1764. !     (struct namnod *)NIL,
  1765.       mailpname
  1766.   };
  1767.   
  1768.  
  1769. --- 106,113 -----
  1770.   };
  1771.   struct namnod mailpnod =
  1772.   {
  1773. !     &ifsnod,
  1774. !     &ps2nod,
  1775.       mailpname
  1776.   };
  1777.   
  1778. ***************
  1779. *** 86,92
  1780.   };
  1781.   
  1782.   
  1783. ! struct namnod *namep = &mchknod;
  1784.   
  1785.   /* ========    variable and string handling    ======== */
  1786.   
  1787.  
  1788. --- 112,118 -----
  1789.   };
  1790.   
  1791.   
  1792. ! struct namnod *namep = &mailpnod;
  1793.   
  1794.   /* ========    variable and string handling    ======== */
  1795.   
  1796. :::::::: name.h :::::::
  1797. No differences encountered
  1798. :::::::: print.c :::::::
  1799. *** ../orig.u/print.c    Wed May 15 17:11:58 1985
  1800. --- print.c    Wed May 29 16:24:45 1985
  1801. ***************
  1802. *** 265,267
  1803.   
  1804.       prs_buff(numbuf);
  1805.   }
  1806.  
  1807. --- 265,384 -----
  1808.   
  1809.       prs_buff(numbuf);
  1810.   }
  1811. + void
  1812. + pr_prompt (str)
  1813. + register char *str;
  1814. + {
  1815. +     for (; *str; str++)
  1816. +     {
  1817. +         if (*str != '%')
  1818. +             prc_buff (*str);
  1819. +         else if (*(str+1) == 'd')
  1820. +         {
  1821. +             /* current directory */
  1822. +             str++;
  1823. +             prs_buff (retcwd());
  1824. +         }
  1825. +         else if (*(str+1) == 'e')
  1826. +         {
  1827. +             /* event count */
  1828. +             str++;
  1829. +             if ((flags & nohistflg) == 0)
  1830. +                 prn_buff (event_count);
  1831. +         }
  1832. +         else if (*(str+1) == 'h')
  1833. +         {
  1834. +             /* hostname */
  1835. +             static char *cp = 0;
  1836. +             static int didhost = FALSE;
  1837. +             static int didgt = FALSE;
  1838. + #ifdef BSD
  1839. +             static char buf[257];
  1840. +             if (! didhost)
  1841. +             {
  1842. +                 gethostname (buf, sizeof buf);
  1843. +                 didhost = TRUE;
  1844. +                 cp = buf;
  1845. +             }
  1846. + #else
  1847. + #include <sys/utsname.h>    /* has an extern declaration in it */
  1848. +             static struct utsname name;
  1849. +             if (! didhost)
  1850. +             {
  1851. +                 uname (& name);
  1852. +                 /* avoid emulation bug */
  1853. +                 name.sysname[sizeof(name.sysname)-1] = '\0';
  1854. +                 didhost = TRUE;
  1855. +                 cp = name.sysname;
  1856. +             }
  1857. + #endif
  1858. + #ifdef GATECH
  1859. +             /*
  1860. +              * this is to get rid of the dumb gt- convention.
  1861. +              * a gt w/out the - is also removed.
  1862. +              */
  1863. +             if (! didgt)
  1864. +             {
  1865. +                 didgt = TRUE;
  1866. +                 if (cp[0] == 'g' && cp[1] == 't' && cp[2])
  1867. +                 {
  1868. +                     cp += 2;
  1869. +                     if (cp[0] == '-' && cp[1])
  1870. +                         cp++;
  1871. +                 }
  1872. +             }
  1873. + #endif
  1874. +             prs_buff (cp);
  1875. +             str++;
  1876. +         }
  1877. +         else if (*(str+1) == 'l')
  1878. +         {
  1879. +             /* login name */
  1880. +             static char *cp = 0;
  1881. +             static int didname = FALSE;
  1882. +             str++;
  1883. +             if (! didname)
  1884. +             {
  1885. +                 cp = username ();
  1886. +                 didname = TRUE;
  1887. +             }
  1888. +             if (cp)
  1889. +                 prs_buff (cp);
  1890. +         }
  1891. +         else if (*(str+1) == 't')
  1892. +         {
  1893. +             /* current time, HH:MM */
  1894. +             long l;
  1895. +             char *cp, *ctime ();
  1896. +             str++;
  1897. +             time (& l);
  1898. +             cp = ctime (& l);
  1899. +             cp[16] = '\0';
  1900. +             cp += 11;
  1901. +             prs_buff (cp);
  1902. +         }
  1903. + #if pyr
  1904. +         else if (*(str+1) == 'u')
  1905. +         {
  1906. +             /* current univeserse */
  1907. +             str++;
  1908. +             prs_buff (univ_name[cur_univ-1]);
  1909. +         }
  1910. + #endif
  1911. +         else if (*(str+1) == '\0')    /* % was last char in string */
  1912. +         {
  1913. +             prc_buff (*str);
  1914. +             continue;
  1915. +         }
  1916. +         else
  1917. +             prc_buff (*(++str));
  1918. +     }
  1919. +     flushb();
  1920. + }
  1921. :::::::: pwd.c :::::::
  1922. *** ../orig.u/pwd.c    Wed May 15 17:11:58 1985
  1923. --- pwd.c    Thu Apr 25 11:44:56 1985
  1924. ***************
  1925. *** 455,457
  1926.       return retval;
  1927.       }
  1928.   #endif
  1929.  
  1930. --- 455,466 -----
  1931.       return retval;
  1932.       }
  1933.   #endif
  1934. + char *
  1935. + retcwd()
  1936. + {
  1937. +     if (didpwd == FALSE)
  1938. +         pwd ();
  1939. +     
  1940. +     return (cwdname);
  1941. + }
  1942. :::::::: service.c :::::::
  1943. *** ../orig.u/service.c    Wed May 15 17:11:58 1985
  1944. --- service.c    Wed May 29 15:55:29 1985
  1945. ***************
  1946. *** 79,84
  1947.                   else
  1948.                       fd = dup(fd);
  1949.               }
  1950.               else if ((iof & IOPUT) == 0)
  1951.                   fd = chkopen(ion);
  1952.               else if (flags & rshflg)
  1953.  
  1954. --- 79,89 -----
  1955.                   else
  1956.                       fd = dup(fd);
  1957.               }
  1958. +             else if (iof & IORDW)
  1959. +             {
  1960. +                 if ((fd = open(ion, 2)) < 0)
  1961. +                     failed(ion, badopen);
  1962. +             }
  1963.               else if ((iof & IOPUT) == 0)
  1964.                   fd = chkopen(ion);
  1965.               else if (flags & rshflg)
  1966. ***************
  1967. *** 157,162
  1968.        */
  1969.       register char    *scanp = path;
  1970.       register char    *argp = locstak();
  1971.   
  1972.       while (*scanp && *scanp != COLON)
  1973.           *argp++ = *scanp++;
  1974.  
  1975. --- 162,169 -----
  1976.        */
  1977.       register char    *scanp = path;
  1978.       register char    *argp = locstak();
  1979. +     char    *save = argp;
  1980. +     char    *cp;
  1981.   
  1982.       while (*scanp && *scanp != COLON)
  1983.           *argp++ = *scanp++;
  1984. ***************
  1985. *** 160,165
  1986.   
  1987.       while (*scanp && *scanp != COLON)
  1988.           *argp++ = *scanp++;
  1989.       if (scanp != path)
  1990.           *argp++ = '/';
  1991.       if (*scanp == COLON)
  1992.  
  1993. --- 167,179 -----
  1994.   
  1995.       while (*scanp && *scanp != COLON)
  1996.           *argp++ = *scanp++;
  1997. +     *argp = '\0';
  1998. +     /* try a tilde expansion */
  1999. +     if (*save == SQUIGGLE && (cp = homedir (save + 1)) != nullstr)
  2000. +     {
  2001. +         movstr (cp, save);
  2002. +         argp = save + length (save) - 1;
  2003. +     }
  2004.       if (scanp != path)
  2005.           *argp++ = '/';
  2006.       if (*scanp == COLON)
  2007. :::::::: setbrk.c :::::::
  2008. No differences encountered
  2009. :::::::: signal.vax :::::::
  2010. No differences encountered
  2011. :::::::: stak.c :::::::
  2012. No differences encountered
  2013. :::::::: stak.h :::::::
  2014. No differences encountered
  2015. :::::::: string.c :::::::
  2016. No differences encountered
  2017. :::::::: sym.h :::::::
  2018. No differences encountered
  2019. :::::::: test.c :::::::
  2020. *** ../orig.u/test.c    Wed May 15 17:11:59 1985
  2021. --- test.c    Thu Apr 25 11:45:03 1985
  2022. ***************
  2023. *** 126,132
  2024.           if (eq(a, dashk))                /* DAG */
  2025.               return(ftype(nxtarg(0), S_ISVTX));
  2026.           if (eq(a, dashp))                /* DAG */
  2027. ! #if BSD
  2028.   #define S_IFIFO    S_IFSOCK    /* fifo - map to socket on 4.2BSD */
  2029.   #endif
  2030.               return(filtyp(nxtarg(0),S_IFIFO));
  2031.  
  2032. --- 126,132 -----
  2033.           if (eq(a, dashk))                /* DAG */
  2034.               return(ftype(nxtarg(0), S_ISVTX));
  2035.           if (eq(a, dashp))                /* DAG */
  2036. ! #if BSD && !defined(pyr)
  2037.   #define S_IFIFO    S_IFSOCK    /* fifo - map to socket on 4.2BSD */
  2038.   #endif
  2039.               return(filtyp(nxtarg(0),S_IFIFO));
  2040. :::::::: timeout.h :::::::
  2041. No differences encountered
  2042. :::::::: ulimit.c :::::::
  2043. No differences encountered
  2044. :::::::: word.c :::::::
  2045. *** ../orig.u/word.c    Wed May 15 17:11:59 1985
  2046. --- word.c    Thu Jun  6 14:32:13 1985
  2047. ***************
  2048. *** 19,24
  2049.       struct argnod    *arg = (struct argnod *)locstak();
  2050.       register char    *argp = arg->argval;
  2051.       int        alpha = 1;
  2052.   
  2053.       wdnum = 0;
  2054.       wdset = 0;
  2055.  
  2056. --- 19,25 -----
  2057.       struct argnod    *arg = (struct argnod *)locstak();
  2058.       register char    *argp = arg->argval;
  2059.       int        alpha = 1;
  2060. +     char        *save;
  2061.   
  2062.       wdnum = 0;
  2063.       wdset = 0;
  2064. ***************
  2065. *** 41,46
  2066.               break;    /* out of comment - white space loop */
  2067.           }
  2068.       }
  2069.       if (!eofmeta(c))
  2070.       {
  2071.           do
  2072.  
  2073. --- 42,48 -----
  2074.               break;    /* out of comment - white space loop */
  2075.           }
  2076.       }
  2077. +     save = argp;    /* save start of word */
  2078.       if (!eofmeta(c))
  2079.       {
  2080.           do
  2081. ***************
  2082. *** 72,77
  2083.                               chkpr();
  2084.                       }
  2085.                   }
  2086.               }
  2087.           } while ((c = nextc(0), !eofmeta(c)));
  2088.           argp = endstak(argp);
  2089.  
  2090. --- 74,98 -----
  2091.                               chkpr();
  2092.                       }
  2093.                   }
  2094. +                 /*
  2095. +                  * check for ~login name
  2096. +                  */
  2097. +                 else if (c == SQUIGGLE &&
  2098. +                         validtilde (save, argp))
  2099. +                 {
  2100. +                     char *name, *home;
  2101. +                     name = argp;
  2102. +                     while ((c = nextc(0)) != '/' &&
  2103. +                             !eofmeta(c))
  2104. +                         *name++ = c;
  2105. +                     peekc = c;
  2106. +                     *name = '\0';
  2107. +                     home = homedir(argp);
  2108. +                     if (*home)
  2109. +                         movstr (home, --argp);
  2110. +                     argp += length (argp) - 1;
  2111. +                 }
  2112.               }
  2113.           } while ((c = nextc(0), !eofmeta(c)));
  2114.           argp = endstak(argp);
  2115. ***************
  2116. *** 120,125
  2117.               wdval = EOFSYM;
  2118.           if (iopend && eolchar(c))
  2119.           {
  2120.               copy(iopend);
  2121.               iopend = 0;
  2122.           }
  2123.  
  2124. --- 141,149 -----
  2125.               wdval = EOFSYM;
  2126.           if (iopend && eolchar(c))
  2127.           {
  2128. +             int histon = (flags&nohistflg) == 0;
  2129. +             flags |= nohistflg;    /* no history in here docs */
  2130.               copy(iopend);
  2131.               if (histon)        /* turn history back on */
  2132.                   flags &= ~nohistflg;
  2133. ***************
  2134. *** 121,126
  2135.           if (iopend && eolchar(c))
  2136.           {
  2137.               copy(iopend);
  2138.               iopend = 0;
  2139.           }
  2140.       }
  2141.  
  2142. --- 145,152 -----
  2143.   
  2144.               flags |= nohistflg;    /* no history in here docs */
  2145.               copy(iopend);
  2146. +             if (histon)        /* turn history back on */
  2147. +                 flags &= ~nohistflg;
  2148.               iopend = 0;
  2149.           }
  2150.       }
  2151. ***************
  2152. *** 245,251
  2153.       }
  2154.       else
  2155.       {
  2156. !         f->fend = (f->fnxt = f->fbuf) + len;
  2157.   #if BRL || JOBS
  2158.           eofcount = 0;
  2159.   #endif
  2160.  
  2161. --- 271,278 -----
  2162.       }
  2163.       else
  2164.       {
  2165. !         /* f->fend = (f->fnxt = f->fbuf) + len; */
  2166. !         f->fend = f->fnxt + len;
  2167.   #if BRL || JOBS
  2168.           eofcount = 0;
  2169.   #endif
  2170. ***************
  2171. *** 255,261
  2172.   }
  2173.   
  2174.   static
  2175. ! readb()
  2176.   {
  2177.       register struct fileblk *f = standin;
  2178.       register int    len;
  2179.  
  2180. --- 282,288 -----
  2181.   }
  2182.   
  2183.   static
  2184. ! readblock()    /* ADR -- changed the name */
  2185.   {
  2186.       register struct fileblk *f = standin;
  2187.       register int    len;
  2188. ***************
  2189. *** 275,278
  2190.           }
  2191.       } while ((len = read(f->fdes, f->fbuf, f->fsiz)) < 0 && trapnote);
  2192.       return(len);
  2193.   }
  2194.  
  2195. --- 302,502 -----
  2196.           }
  2197.       } while ((len = read(f->fdes, f->fbuf, f->fsiz)) < 0 && trapnote);
  2198.       return(len);
  2199. + }
  2200. + /* readb --- read a block from the outside world, and history process it */
  2201. + /*
  2202. +  * In BSD systems, using the literal next capability of the tty driver, it
  2203. +  * is actually possible to put a newline in the middle of the input line,
  2204. +  * and then hit return, so that the shell sees two lines of input.
  2205. +  *
  2206. +  * As a design decision, if there is a \n in the middle of what we've read
  2207. +  * from a terminal, treat the commands as two separately typed commands. I.e.
  2208. +  *
  2209. +  *    echo hi ^J echo there
  2210. +  *
  2211. +  * is the same as
  2212. +  *
  2213. +  *    echo hi
  2214. +  *    echo there
  2215. +  *
  2216. +  * The major reason for doing it this way is that the history mechanism knows
  2217. +  * that a \n is the end of a line.
  2218. +  *
  2219. +  * Finally, on USG systems, we just leave this code alone, since it won't
  2220. +  * get executed anyway.
  2221. +  */
  2222. + /*
  2223. +  * In word.c, the readc() function keeps a pointer to what standin pointed to
  2224. +  * when readc first gets called.  Therefore, where standin points to can not 
  2225. +  * not change across calls to readb().  To get around this, we change the
  2226. +  * contents of the structure pointed to by standin, saving and restoring
  2227. +  * it as necessary.
  2228. +  */
  2229. + #define LARGEBUF    (HISTSIZE / 2)    /* size of expanded history */
  2230. + static
  2231. + readb()
  2232. + {
  2233. +     int ilen, i, j;
  2234. +     char ibuf[BUFSIZ];    /* input into scratch area, pass to history */
  2235. +     static char expansion[LARGEBUF];
  2236. +     static int moreinbuf = FALSE;
  2237. +     static int saved_ilen = 0;
  2238. +     static int start_here = 0;
  2239. +     static struct fileblk *f = 0;
  2240. +     auto int gotoutofbuf = 0;
  2241. +     if (expanded)    /* just did a history substitution */
  2242. +         expanded = 0;
  2243. +     if ((flags & nohistflg) || (flags & prompt) == 0 || ! isatty (input)
  2244. +             || standin->fstak != 0)
  2245. +     {
  2246. +         ilen = readblock ();
  2247. +         if (ilen > 0)
  2248. +             standin->fnxt = standin->fbuf;
  2249. +         return (ilen);
  2250. +         /* not doing history expansion at all */
  2251. +     }
  2252. +     if (f == 0)
  2253. +         f = standin;
  2254. +     ilen = 0;
  2255. +     /*
  2256. +      * First, if there was more stuff in the last buffer, go and get it.
  2257. +      * If not get some more from the outside world.
  2258. +      *
  2259. +      * Then, make sure we've read up to a newline.
  2260. +      * This is basically in case someone has done something bizarre
  2261. +      * like 'stty raw', and input is coming in one character at a time.
  2262. +      *
  2263. +      * We use a heuristic.  If amount read is just 1, keep reading till
  2264. +      * we get a newline.  Else, read in a complete line from the terminal.
  2265. +      * Once we're in raw mode, can't reset it until a newline is typed.
  2266. +      *
  2267. +      * If not reading one character at a time, then do the stuff for
  2268. +      * embedded newlines.
  2269. +      */
  2270. +     if (moreinbuf)
  2271. +     {
  2272. +         for (i = 0, j = start_here; f->fbuf[j] != NL && j < saved_ilen; i++, j++)
  2273. +             ibuf[i] = f->fbuf[j];
  2274. + #ifdef notdef
  2275. +         if (f->fbuf[j] != NL)
  2276. +         {
  2277. +             prs ("internal i/o error C in readb\n");
  2278. +             return (0);
  2279. +         }
  2280. + #endif
  2281. +         if (f->fbuf[j] == NL)
  2282. +             ibuf[i++] = NL;
  2283. +         ibuf[i] = '\0';
  2284. +         ilen = i;
  2285. +         /* embedded newline */
  2286. +         moreinbuf = (++j < saved_ilen - 1);
  2287. +         if (moreinbuf)
  2288. +             start_here = j;    /* where to start next time */
  2289. +         gotoutofbuf = 1;
  2290. +     }
  2291. +     else    /* wasn't an embedded \n last time */
  2292. +     {
  2293. +         ilen = readblock ();
  2294. +     
  2295. +         if (ilen <= 0)    /* EOF or error */
  2296. +             return (ilen);
  2297. +         if (ilen == 1)    /* either in raw mode, or an empty line */
  2298. +         {
  2299. +             i = 0;
  2300. +             ibuf[i++] = f->fbuf[0];
  2301. +             if (f->fbuf[0] == NL)
  2302. +             {
  2303. +                 ibuf[i] = '\0';
  2304. +                 goto dohist;
  2305. +             }
  2306. +             while ((ilen = readblock()) > 0)
  2307. +             {
  2308. +                 if (ilen != 1)
  2309. +                 {
  2310. +                     prs ("internal i/o error A in readb\n");
  2311. +                     return (0);
  2312. +                 }
  2313. +                 ibuf[i++] = f->fbuf[0];
  2314. +                 if (f->fbuf[0] == NL)
  2315. +                 {
  2316. +                     ibuf[i] = '\0';
  2317. +                     break;    /* while */
  2318. +                 }
  2319. +             }
  2320. +             ilen = i;
  2321. +             gotoutofbuf = TRUE;
  2322. +             /* force code below to use collected string */
  2323. +         }
  2324. +         else
  2325. +         {
  2326. +             /* reading bunches of characters at once */
  2327. +             for (i = 0; f->fbuf[i] != NL && i < ilen; i++)
  2328. +                 ibuf[i] = f->fbuf[i];
  2329. + #ifdef notdef
  2330. +             if (f->fbuf[i] != NL)
  2331. +             {
  2332. +                 prs ("internal i/o error B in readb\n");
  2333. +                 return (0);
  2334. +             }
  2335. + #endif
  2336. +             ibuf[i++] = NL;
  2337. +             ibuf[i] = '\0';
  2338. +             /* ilen was set by readblock() */
  2339. +             /* embedded newline */
  2340. +             moreinbuf = (i < ilen - 1);
  2341. +             if (moreinbuf)
  2342. +             {
  2343. +                 saved_ilen = ilen;
  2344. +                 start_here = i;
  2345. +                 /* where to start next time */
  2346. +                 gotoutofbuf = 1;
  2347. +             }
  2348. +         }
  2349. +     }
  2350. + dohist:
  2351. +     /* quick heuristic */
  2352. +     if (! gotoutofbuf && ilen == 1 && f->fbuf[0] == NL)
  2353. +     {
  2354. +         f->fnxt = f->fbuf;
  2355. +         return (ilen);
  2356. +     }
  2357. +     if (histsub (ibuf, expansion, sizeof expansion))
  2358. +     {
  2359. +         int olen = length (expansion) - 1;
  2360. +         if (! expanded && ! gotoutofbuf)
  2361. +         {
  2362. +             standin->fnxt = standin->fbuf;
  2363. +             return (ilen);
  2364. +         }
  2365. +         /* else
  2366. +             expanded == TRUE or from buffer */
  2367. +         standin->fnxt = expansion;
  2368. +         return (olen);
  2369. +     }
  2370. +     else
  2371. +     {
  2372. +         /* hist expansion failed, return an empty line */
  2373. +         standin->fnxt = standin->fbuf;
  2374. +         standin->fbuf[0] = NL;
  2375. +         return (1);
  2376. +     }
  2377.   }
  2378. :::::::: xec.c :::::::
  2379. *** ../orig.u/xec.c    Wed May 15 17:12:00 1985
  2380. --- xec.c    Tue Jun  4 17:57:01 1985
  2381. ***************
  2382. *** 27,32
  2383.        */
  2384.       register struct trenod    *t;
  2385.       char        *sav = savstak();
  2386.   
  2387.       sigchk();
  2388.       if (!errorflg)
  2389.  
  2390. --- 27,42 -----
  2391.        */
  2392.       register struct trenod    *t;
  2393.       char        *sav = savstak();
  2394. + #if pyr
  2395. +     auto int change_univ = FALSE;
  2396. +     auto int new_univ = 0;
  2397. +     /*
  2398. +      * univesrses run from 1 to NUMUNIV: We start out at 0
  2399. +      * and increment new_univ in the switch for internal
  2400. +      * commands, below.  new_univ must *not* be assigned to, directly
  2401. +      * or via side effects, any place else.
  2402. +      */
  2403. + #endif
  2404.   
  2405.       sigchk();
  2406.       if (!errorflg)
  2407. ***************
  2408. *** 109,114
  2409.                       if (flags & execpr)
  2410.                           execprint(com);
  2411.   
  2412.                       if (comtype == NOTFOUND)
  2413.                       {
  2414.                           pos = hashdata(cmdhash);
  2415.  
  2416. --- 119,130 -----
  2417.                       if (flags & execpr)
  2418.                           execprint(com);
  2419.   
  2420. +                     /*
  2421. +                      * fix a bug which caused the shell
  2422. +                      * to do not do a second command if
  2423. +                      * the first was not found. (bug fix
  2424. +                      * from USENET)
  2425. +                      */
  2426.                       if (comtype == NOTFOUND)
  2427.                       {
  2428.                           char *errstr;
  2429. ***************
  2430. *** 111,116
  2431.   
  2432.                       if (comtype == NOTFOUND)
  2433.                       {
  2434.                           pos = hashdata(cmdhash);
  2435.                           if (pos == 1)
  2436.                               failed(*com, notfound);
  2437.  
  2438. --- 127,134 -----
  2439.                        */
  2440.                       if (comtype == NOTFOUND)
  2441.                       {
  2442. +                         char *errstr;
  2443.                           pos = hashdata(cmdhash);
  2444.                           if (pos == 1)
  2445.                               errstr = notfound;
  2446. ***************
  2447. *** 113,119
  2448.                       {
  2449.                           pos = hashdata(cmdhash);
  2450.                           if (pos == 1)
  2451. !                             failed(*com, notfound);
  2452.                           else if (pos == 2)
  2453.                               failed(*com, badexec);
  2454.                           else
  2455.  
  2456. --- 131,137 -----
  2457.   
  2458.                           pos = hashdata(cmdhash);
  2459.                           if (pos == 1)
  2460. !                             errstr = notfound;
  2461.                           else if (pos == 2)
  2462.                               errstr = badexec;
  2463.                           else
  2464. ***************
  2465. *** 115,121
  2466.                           if (pos == 1)
  2467.                               failed(*com, notfound);
  2468.                           else if (pos == 2)
  2469. !                             failed(*com, badexec);
  2470.                           else
  2471.                               failed(*com, badperm);
  2472.                           break;
  2473.  
  2474. --- 133,139 -----
  2475.                           if (pos == 1)
  2476.                               errstr = notfound;
  2477.                           else if (pos == 2)
  2478. !                             errstr = badexec;
  2479.                           else
  2480.                               errstr = badperm;
  2481.                           prp();
  2482. ***************
  2483. *** 117,123
  2484.                           else if (pos == 2)
  2485.                               failed(*com, badexec);
  2486.                           else
  2487. !                             failed(*com, badperm);
  2488.                           break;
  2489.                       }
  2490.   
  2491.  
  2492. --- 135,147 -----
  2493.                           else if (pos == 2)
  2494.                               errstr = badexec;
  2495.                           else
  2496. !                             errstr = badperm;
  2497. !                         prp();
  2498. !                         prs_cntl(*com);
  2499. !                         prs (colon);
  2500. !                         prs (errstr);
  2501. !                         newline();
  2502. !                         exitval = 1;
  2503.                           break;
  2504.                       }
  2505.   
  2506. ***************
  2507. *** 193,198
  2508.                               if (j_finish(FALSE))
  2509.                                   break;
  2510.   #endif
  2511.                               flags |= forked;    /* force exit */    
  2512.   #if BRL && pdp11
  2513.                               if (loginsh)
  2514.  
  2515. --- 217,224 -----
  2516.                               if (j_finish(FALSE))
  2517.                                   break;
  2518.   #endif
  2519. +                             histsave (histfnod.namval);
  2520. +                             /* save before setting flag */
  2521.                               flags |= forked;    /* force exit */    
  2522.   #if BRL && pdp11
  2523.                               if (loginsh)
  2524. ***************
  2525. *** 289,294
  2526.   #ifdef RES    /* Research includes login as part of the shell */    
  2527.   
  2528.                           case SYSLOGIN:
  2529.                               flags |= forked;    /* DAG -- bug fix (force bad exec to terminate shell) */
  2530.                               oldsigs();
  2531.                               execa(com, -1);
  2532.  
  2533. --- 315,321 -----
  2534.   #ifdef RES    /* Research includes login as part of the shell */    
  2535.   
  2536.                           case SYSLOGIN:
  2537. +                             histsave (histfnod.namval);
  2538.                               flags |= forked;    /* DAG -- bug fix (force bad exec to terminate shell) */
  2539.                               oldsigs();
  2540.                               execa(com, -1);
  2541. ***************
  2542. *** 298,303
  2543.   #ifndef    BRL
  2544.                           case SYSLOGIN:    
  2545.   #endif
  2546.                               flags |= forked;    /* DAG -- bug fix (force bad exec to terminate shell) */
  2547.                               oldsigs();    
  2548.                               execa(com, -1);
  2549.  
  2550. --- 325,331 -----
  2551.   #ifndef    BRL
  2552.                           case SYSLOGIN:    
  2553.   #endif
  2554. +                             histsave (histfnod.namval);
  2555.                               flags |= forked;    /* DAG -- bug fix (force bad exec to terminate shell) */
  2556.                               oldsigs();    
  2557.                               execa(com, -1);
  2558. ***************
  2559. *** 309,314
  2560.                                   failed(com[0], restricted);    
  2561.                               else    
  2562.                               {    
  2563.                                   flags |= forked;    /* force bad exec to terminate shell */    
  2564.                                   oldsigs();    
  2565.                                   execa(com, -1);
  2566.  
  2567. --- 337,343 -----
  2568.                                   failed(com[0], restricted);    
  2569.                               else    
  2570.                               {    
  2571. +                                 histsave (histfnod.namval);
  2572.                                   flags |= forked;    /* force bad exec to terminate shell */    
  2573.                                   oldsigs();    
  2574.                                   execa(com, -1);
  2575. ***************
  2576. *** 518,524
  2577.                                   if (command == 1 || command == 4)    
  2578.                                   {    
  2579.                                       prl(i);    
  2580. !                                     prc_buff('\n');    
  2581.                                   }    
  2582.                                   break;    
  2583.                               }                
  2584.  
  2585. --- 547,553 -----
  2586.                                   if (command == 1 || command == 4)    
  2587.                                   {    
  2588.                                       prl(i);    
  2589. !                                     prc_buff(NL);    
  2590.                                   }    
  2591.                                   break;    
  2592.                               }                
  2593. ***************
  2594. *** 669,674
  2595.   
  2596.                               j_resume(a1, TRUE);
  2597.                               break;
  2598.   #endif
  2599.   
  2600.                           default:    
  2601.  
  2602. --- 698,714 -----
  2603.   
  2604.                               j_resume(a1, TRUE);
  2605.                               break;
  2606. +                         case SYSSUSPEND:
  2607. +                             exitval = 1;
  2608. +                             if (getppid() == 1)
  2609. +                                 prs (nosusp);
  2610. +                             else
  2611. +                             {
  2612. +                                 exitval = 0;
  2613. +                                 kill (getpid(), SIGSTOP);
  2614. +                             }
  2615. +                             break;
  2616.   #endif
  2617.   
  2618.   #if pyr
  2619. ***************
  2620. *** 671,676
  2621.                               break;
  2622.   #endif
  2623.   
  2624.                           default:    
  2625.                               prs_buff("unknown builtin\n");
  2626.                           }    
  2627.  
  2628. --- 711,754 -----
  2629.                               break;
  2630.   #endif
  2631.   
  2632. + #if pyr
  2633. +                         /*
  2634. +                          * UCB is Universe 2
  2635. +                          * ATT is Universe 1
  2636. +                          * new_univ == 0
  2637. +                          */
  2638. +                         case SYSUCB:
  2639. +                             new_univ++;
  2640. +                             /* fall thru */
  2641. +                         case SYSATT:
  2642. +                             new_univ++;
  2643. +                             if (argn > 1)
  2644. +                             {
  2645. +                                 change_univ = TRUE;
  2646. +                                 com++;
  2647. +                                 goto doit;
  2648. +                             }
  2649. +                             else
  2650. +                             {
  2651. +                                 setuniverse (cur_univ = new_univ);
  2652. +                                 univnod.namflg &= ~N_RDONLY;
  2653. +                                 assign (& univnod, univ_name[cur_univ - 1]);
  2654. +                                 attrib ((& univnod), N_RDONLY);
  2655. +                                 break;
  2656. +                             }
  2657. +                         
  2658. +                         case SYSUNIVERSE:
  2659. +                             if (eq(com[1], dashl))
  2660. +                                 prs_buff (univ_longname[cur_univ - 1]);
  2661. +                             else
  2662. +                                 prs_buff (univ_name[cur_univ - 1]);
  2663. +                             prc_buff (NL);
  2664. +                             break;
  2665. + #endif
  2666. +                         case SYSHISTORY:
  2667. +                             exitval = history (argn, com);
  2668. +                             break;
  2669.                           default:    
  2670.                               prs_buff("unknown builtin\n");
  2671.                           }    
  2672. ***************
  2673. *** 709,714
  2674.               }
  2675.   
  2676.           case TFORK:
  2677.               exitval = 0;
  2678.               if (execflg && (treeflgs & (FAMP | FPOU)) == 0)
  2679.                   parent = 0;
  2680.  
  2681. --- 787,795 -----
  2682.               }
  2683.   
  2684.           case TFORK:
  2685. + #if pyr
  2686. +         doit:
  2687. + #endif
  2688.               exitval = 0;
  2689.               if (execflg && (treeflgs & (FAMP | FPOU)) == 0)
  2690.                   parent = 0;
  2691. ***************
  2692. *** 788,793
  2693.               }
  2694.               else    /* this is the forked branch (child) of execute */
  2695.               {
  2696.   #if BRL
  2697.                   loginsh = 0;
  2698.   #endif
  2699.  
  2700. --- 869,884 -----
  2701.               }
  2702.               else    /* this is the forked branch (child) of execute */
  2703.               {
  2704. + #if pyr
  2705. +                 if (change_univ)
  2706. +                 {
  2707. +                     setuniverse (new_univ);
  2708. +                     univnod.namflg &= ~N_RDONLY;
  2709. +                     assign (& univnod, univ_name[cur_univ - 1]);
  2710. +                     attrib ((& univnod), N_RDONLY);
  2711. +                 }
  2712. + #endif
  2713.   #if BRL
  2714.                   loginsh = 0;
  2715.   #endif
  2716.  
  2717.