!<arch>
compare.r       362839733   9     1     100666  1073      `
include /usr/style/io/globdefs
define	NAMESIZE	50
# compare _ compare two files for equality
	character arg1(MAXLINE), arg2(MAXLINE)
	character line1(MAXLINE), line2(MAXLINE)
	integer equal, getarg, getlin, open
	integer infil1, infil2, lineno, m1, m2

	if (getarg(1, arg1, MAXLINE) == EOF
	   | getarg(2, arg2, MAXLINE) == EOF)
		call error("usage: compare file1 file2.")
	infil1 = open(arg1, READ)
	if (infil1 == ERR)
		call cant(arg1)
	infil2 = open(arg2, READ)
	if (infil2 == ERR)
		call cant(arg2)
	lineno = 0
	repeat {
		m1 = getlin(line1, infil1)
		m2 = getlin(line2, infil2)
		if (m1 == EOF | m2 == EOF)
			break
		lineno = lineno + 1
		if (equal(line1, line2) == NO)
			call difmsg(lineno, line1, line2)
		}
	if (m1 == EOF & m2 != EOF)
		call remark("eof on file 1.")
	else if (m2 == EOF & m1 != EOF)
		call remark("eof on file 2.")
	stop
	end

#difmsg
	subroutine difmsg(lineno, line1, line2)
	integer line1(MAXLINE), line2(MAXLINE)
	integer lineno

	call putdec(lineno, 5)
	call putc(NEWLINE)
	call putlin(line1, STDOUT)
	call putlin(line2, STDOUT)
	return
	end

concat.r        362839741   9     1     100666  352       `
include /usr/style/io/globdefs
define	NAMESIZE	50
# concat _ concatenate named files onto standard output
	character name(NAMESIZE)
	integer getarg, open
	integer fin, i

	for (i = 1; getarg(i, name, NAMESIZE) != EOF; i = i + 1) {
		fin = open(name, READ)
		if (fin == ERR)
			call cant(name)
		call fcopy(fin, STDOUT)
		call close(fin)
		}
	stop
	end
include.r       362839740   9     1     100666  1315      `
include /usr/style/io/globdefs
define	NFILES	5
# include _ replace  include file  by contents of file
	character line(MAXLINE), str(MAXLINE)
	integer equal, getlin, getwrd, open
	integer infile(NFILES), len, level, loc
#	string incl "include"
	integer incl(8)
	data incl(1) /LETI/
	data incl(2) /LETN/
	data incl(3) /LETC/
	data incl(4) /LETL/
	data incl(5) /LETU/
	data incl(6) /LETD/
	data incl(7) /LETE/
	data incl(8) /EOS/

	infile(1) = STDIN
	for (level = 1; level > 0; level = level - 1) {
		while (getlin(line, infile(level)) != EOF) {
			loc = 1
			len = getwrd(line, loc, str)
			if (equal(str, incl) == NO)
				call putlin(line, STDOUT)
			else {
				level = level + 1
				if (level > NFILES)
					call error("includes nested too deeply.")
				len = getwrd(line, loc, str)
				infile(level) = open(str, READ)
				if (infile(level) == ERR)
					call cant(str)
				}
			}
		if (level > 1)
			call close(infile(level))
		}
	stop
	end
# getwrd _ get non\(hyblank word from in(i) into  out, increment i
	integer function getwrd(in, i, out)
	character in(ARB), out(ARB)
	integer i, j

	while (in(i) == BLANK | in(i) == TAB)
		i = i + 1
	j = 1
	while (in(i) != EOS & in(i) != BLANK
	   & in(i) != TAB & in(i) != NEWLINE) {
		out(j) = in(i)
		i = i + 1
		j = j + 1
		}
	out(j) = EOS
	getwrd = j - 1
	return
	end


io.a            362839748   9     1     100666  20842     `
eÿfcopy.o       $	¶�  ìˆ   šÌ       �   ~         ˆ   ’   Š      Œ     ˆ     „         >   h      ˆ   ’   Š      Œ     ˆ      	   
   
            d  fcopy       (   (   8  H  X  h   X  x ˆ      ˜  ¨ ¸ È Ø  è  (   8  H  X  h   X  x ø      (   è  (   (   (                   fcopy.  "   entry       lino        stsp        lval        stst        lvalp       call        getlin.     rval4       ing4        ine4        lnt2        lif2        goto        putlin.     retrn       getarg.o      ›
¨0	¶�  \  f D      f  J       :        \  ¾  ^    \        :   d   	   P  8   T      
   X    f             \  ^     P    `  j  b    ^    ^     P    `    \    f        P  º     º  f      Ü        º  8   º  P j         º  P    º     Ä         º  8   T                      P  gtarg             (   8 H  X   (   h  x  H  ˆ ˜      ¨ ¸ È  Ø  X   è  ø    è  X   è  ( X   8X   X   h  h  (   è  Hh  x  H  ˆ X     h  (   è  hh  ˆ x     ( X   X   è  ( X   è  è  ˆ¸ È  Ø  X   è  ø    è  ˜   ¨X   è  è  H( X   Ø  X   X   è  ø    è  X   8X   8                                    gtarg.  "   entry       rval4p      i4i2        stst        lino        stsp        lval        call        iargc.      ige4        lnt2        lif2        goto        rval4       alvalp      ing4        gas4        gmv4        retrn       iad4        getarg.     isb4        min0.       ile4        gar1        i1i4        type.o        ©
Z	¶�  ´   œ         Þ         ä        è         *   >      ì        Î            ð        ô         f   z   	   ø     
   Ê            ü                 ¢   ¶      ø        Æ                               type    0   9      a   z      A   Z    (   8   H  X 8   H  h x ˆ ˜  ¨  (   H  ¸  (   ¨  (   (   8   H  X 8   H  h x ˆ ˜  ¨  (   H  ¸  (   ¨  (   (   8   H  X 8   H  h x ˆ ˜  ¨  (   H  ¸  (   ¨  (   (   8   ¸  (   (   (   (   È (   È                                       type.   "   entry       lino        rval4p      rval4       ige4        ile4        lan2        lnt2        lif2        goto        gmv4        retrn       fopen.o       >
Tå	¶     L ¸      $    d  d  à            &   P   d  < (  d  à        d      d  
   d  < (          (                $  $        ˜   š     $      (         $      ( (       $      ( P           d      <   
   
   
   
                  (  H  (  x    (  ¸ È Ø è  ø  (     (  x    8H(  (  xH  ø  (     (  8H˜ ¸ Ø è  Ø      H  (  (  8Ø è  ø  X(  (  xx  ˆ(  ¸(  (  xx  ˆ(  ¸(  (  xx  ˆ  ¸XX                                                            fopen.  "   fopen_   $rval4       c0       gmv4        i_       d.23047   
 arvalp      d0       à buf_      c1       ing4        ine4        lnt2        lif2        goto        .23049   P gal1        name1_   (i4i1        gas1        .23048   > c2       iad4        c3       stsp        ft       lval        name4_   (stst        lvalp       mode_     call        open.       c4       ilt4        .23050   š retrn       c5       gal4        _filcom   xcpos_      c6       gas4        c7       ceof_    ( c8       c9       cstat_   P rval4p      d1       æ d2       ì d3       ò d4       ø d5       þ d6       base     "cbuf_    x create.o      &º		¶�  ÔL  P ,      T  0        8  ”  	   ”     <        6   l   
   ”  < X  ”            ”  8    ”              ”  < X  @         L  X  N  D  P    L    T     T  H      Ä   Ê              L  T  N    L    ˜     L  X  N     P    L    T           d      <  create              ¶       (   (   8  H  (   8  X    8  h x ˆ ˜  ¨  (   8  ¸    8  X    È Ø (   8  8  è H  (   ¨  (   (   8  ¸    8  È Ø (   ø      (8     H  (   8  8  Hˆ ˜  ¨  (   X(   (   ø    (h     H  (   ø    x   (ˆ     H  (   X(   X                                              create. "   entry       lino        rval4       gmv4        arvalp      ing4        ine4        lnt2        lif2        goto        gal1        i4i1        gas1        iad4        stsp        lval        stst        call        creat.      ilt4        retrn       close.      lvalp       open.       fseek.o       >
Xå	¶  ü (    œ       0   (      *      ,     (     0      (  H   h  H   h  ˆ ˜      ¨  ¸ ¸ fseek.  "   fseek_   0 stsp        ft       ( lvalp       fd_       stst        byte_     call        seek0.      gmv4        retrn       base     . cant.o        $~{	¶�  pn   
 „       v   T      n      p   Z   r     n         n   ^   p     n               d  cant      : can't open.     (   8  H   X  h  X  x ˆ      (   8  h  X  x ˜      (   ¨ (   ¨                                 cant.   "   entry       lino        stsp        lvalp       stst        lval        call        putlin.     error.      retrn       remove.o      E
dâ	¶  0ž   ^ ä       ¤   ’   ø   ø   €    –         &   P   ø   P ¨   ø   €        ø   ’     ø   
   ø   P ¨   š       ž   ¨         ž     ¤      d   P                  (    8      H X h x  ˆ    ˜      8    ¨ ¸     È (  ˆ    ˜      ¨ ¸ Ø  è  ø       (  ((                              remove. "   rval4       gmv4        arvalp      ing4        ine4        lnt2        lif2        goto        gal1        i4i1        gas1        iad4        stsp        lval        stst        call        unlink.     retrn       putdec.o      5Î	¶�  L&  < ð       0       &     (  2  *    ,    &    ^        ^      Z  	   Z         b   –   
   &  "  (    &        Z      Z     J              Z     Z  ^      Â   ü      &  Z  ( 2  (    &        Z      Z     ª               
  putdec    
           (   8  H   X  h  X  h  X  x ˆ      ˜  (   (   ¨  ¨  ¸ ˜  (   ¨  È   Ø è ø   (   8  h  X  x      (   ¨  ¨  ¸ ˜  (    (   (   (   ¨  ˜  (   ¨  ¨  Ø è ø   (   8  ¨  (   X  x      (   ¨  ¨  ¸ ˜  (    (   (   8(   8                          putdec. "   entry       lino        stsp        lvalp       stst        lval        call        itoc.       gmv4        rval4       iad4        rval4p      ile4        lnt2        lif2        goto        putc.       gal4        retrn       putd.o o      F
¼â	¶  ´æ   > Ø       ð   æ      è   ô   ê   Ú   ì     æ           Þ                N   ~   æ   â   è      ê     æ        Þ       :   Þ              š   Ð   æ     ( ô   è      ê     æ        Þ       †      
    
           (   8  H  8  H  8  X h      x  ˆ  ˆ  ˜ x  ˆ  ¨   ¸ È Ø  è    H  8  (   8  X ø      ˆ  ˆ  ˜ x  è  ˆ  x  ˆ  ˆ  ¸ È Ø  è    ˆ     8  (   8  X ø      ˆ  ˆ  ˜ x  è                    putd.   "   stsp        lvalp       stst        lval        call        itoc.       gmv4        rval4       iad4        rval4p      ile4        lnt2        lif2        goto        putch.      gal4        retrn       putc.o o      F
Žã	¶  ,    ¨       4   ,      .   (   0     ,     4         (  H   h  x  h  ˜ ¨      ¸  È È     putc.   "   putc_    4 stsp        ft       , lvalp       ch_       stst        lval        c0       ( call        putch.      gmv4        retrn       base     2 getc.o o      F
Žã	¶  ,    ¨       4   ,      .   (   0     ,     4          (  H   h  x  h  ˜ ¨      ¸  È È     getc.   "   getc_    4 stsp        ft       , lvalp       ch_       stst        lval        c0       ( call        getch.      gmv4        retrn       base     2 putch.o       F
Žã	¶  ŒF    ð       P        X   F      H   X   J   B   L     F     T      P         (   H X  x  ˜   ¸  È  ¸  È  ¸  è ø       (    ((    putch.  "   putch_   P rval4p      inchar_   i4i1        gmv1        c_       X stsp        ft       F lvalp       fd_       stst        lval        c0       B call        write.      gmv4        nb_      T retrn       base     N getch.o       &U	¶�  @|   8      †  6        T         V      X  <           	   \    †  
   \                  |     ~  ’  €  `  ‚    |    Ž     Ž  T          Ä      d    †     d          &        Ž  `      à        ’    †     ’          "        |  h  ~    |                   getch (16hbad fd in getch:i5)                 read error in getch.   (   8   H  X h x  ˆ  (   H  ˜  ¨ ¸   È Ø (   H  è ø  (   H  è   (   (   (   ( ¸   8 ˜  8 ˜  8 HX     ø  (   H  H  hh x  ˆ  (   H  è ø  (   H  è   (   ˆ  (   (   H  H  hh x  ˆ  (   x ˆø  (   x ˆ  (   ˆ  (   (   ( ˜  8 H˜     (   (   (   (                                                                         getch.  "   entry       lino        rval4p      rval4       ilt4        lnt2        lif2        goto        lval        iowf        lvalp       iio4        endio       ing4        gmv4        gmv4p       retrn       stsp        stst        call        read.       ieq4        rval1       i1i4        error.      getlin.o      &š	¶�  <h   \      r  ü                 ^                    	   $    r  
   $  ö   (                    $  v     v  ,      Š   Ì     h     j  ~  l  $  n    h    z     z        Ð        0    r     $  ö   (              ^        z  $        <     v  ö   ~         Z        h  4  j    h              v  ö   L      €  ®     v  $    ö   (          v  r  !     "   #   v  $    v  $   r   %   &   h  P  j    h     '     (    d  getlin (17hbad fd in getlin:i5)                d    read error in getlin.     
 too long line in getlin.   (   8   H  X h x  ˆ  (   H  ˜  ¨ ¸   È Ø (   H  è ø  (   H     H  è (   ((   (   (   H  ø  (   H  H  X h x  ˆ  (   8 ¸   H ˜  H ˜  H Xh     ø  (   H  H  xh x  ˆ  (   H  è ø  (   H     H  è (   ((   ˆ  (   (   H  H  xh x  ˆ  (   H     ˆ ˜(   ˆ  (   (   8 ˜  H X¨     (   (   (   H  ¸   H  xh x  ˆ  (   H  H  È   H  è (   H  ø  (   ((   (   H  H  Èø  (   ˆ  (   (   8 ˜  H X¨     (   ((   (                                                                                                                  getlin. "   entry       lino        rval4p      rval4       ilt4        lnt2        lif2        goto        lval        iowf        lvalp       iio4        endio       ing4        gmv4        alvalp      gas4        retrn       stsp        stst        call        read.       ieq4        rval1       i1i4        error.      arvalp      iad4        putlin.o      $‚	¶�  P~  D      ˆ  F        N  Œ     Œ  R    Œ  :   V          B   x      Œ   Œ  Œ  :       	   Œ  N    Œ  
            Œ  R      ”   ®      ~  Z  €    ~           ~     €  Œ  ‚  Œ  N    „    ~    �     �  Œ  N               ~  r  €    ~           �  ˆ           d     putlin           too long line in putlin.write error.   (   (   8  H  (   8  8  X 8  h    8  x ˆ ˜ ¨ ¸  È  (   8  Ø    8  h    è ø (   8  8  H  (   È  (   (   8  8  ¨ ¸  È  (   ( 8 H Xh     (   (   ( x  H 8 H 8  8  ˆ( X˜     H  (   8  8  8  ˆˆ ¨ ¸  È  (   ( 8 H Xh     (   (   8  H  (   ¨(   ¨                                                                    putlin. "   entry       lino        rval4       gmv4        ile4        arvalp      ing4        ine4        lan2        lnt2        lif2        goto        gal1        i4i1        gas1        iad4        igt4        stsp        lval        stst        call        error.      lvalp       isb4        write.      retrn       error.o       i
»B	¶�  ¸ $    `       *   $      &     $           d     (   8  H X      h   x       error.  "   stsp        lvalp       stst        call        remark.     stop        retrn       itoc.o        5èÍ	¶�  8F  t        ú       ð     Z     \    Z    N        î               J           J       J     Z  N  \    ^    Z    F     J  î   F       ,        N      N     N      J           æ   T                J             4     J       J     J  î           !   J         "   #      R  $   R  J      r  Þ  %   J  î   V  &   J  î   R  î     '   R  î   V    (   J       J  )   R       R  *   Z  +   ,     -          itoc          
       -         0   1   2   3   4   5   6   7   8   9 ÿÿþÿ                       (   8 H  X   h  x   H  ˆ ˜      ¨  X   ¸  È    ¸  Ø è X   ¸  ¨  X   X   X   ¸  ¸  ø ¨  X   h   H   H  ˆ      ¨  X   ¸  È    ¸  ¸  ø (   è X   ¸  ¸  8¨  X   ¸  ¸  H¸  (   Xhxˆ ˜ X   X   (   ¸  ¨¸  (   ¨¸xˆ ˜ X   ¸  ¸  ø ¨  X   ¸  È    ¸  è X   X   ¸  ¸  È¨  X   X   ¸  ¨  X   ¸  ¸  ¨xˆ ˜ X   ¸  Ø   ¨  X   ¸  È    ¸  Ø   è X   ¸  È    ¸  è X   ¸  ¸  È¨  X   ¸  ¸  ø ¨  X   ˜ X   X   èX   è                                                                                                            itoc.   "   entry       rval4p      i4i2        stst        lino        stsp        lvalp       call        iabs.       gmv4        rval4       alvalp      ing4        gas4        iad4        lval        mod.        gar4        idv4        ieq4        ige4        lor2        lnt2        lif2        goto        ilt4        lan2        isb4        arvalp      retrn       ctoi.o        5õÍ	¶�  <J6  ,      L  ,               2           6        :   T         :          
            >  L            B        ˆ        €  P  ‚         „    €    |     |  >      Ì   Ô              F  L    |    :    L        :           h   !   "     #    d     ctoi        	             
         0   1   2   3   4   5   6   7   8   9 ÿÿþÿ       (   (   8   H    X  h 8   H    X  h x ˆ ˜  ¨  (   8   X  ¸ È   (   ¨  (   (   (   X  Ø  (   8   H    X  è ø ˆ ˜  ¨  (     ( 8   8   ( HX     Ø  (   X  X  h ˆ ˜  ¨  (   ¨  (   (   X  X  hX  ¸ X  xØ  (   8   X  ¸ È   (   ¨  (   (   ˆ(   ˆ                                                                                                ctoi.   "   entry       lino        rval4p      arvalp      rval4       ieq4        lor2        lnt2        lif2        goto        iad4        gmv4p       gmv4        ing4        ine4        stsp        lval        stst        alvalp      call        index.      imp4        isb4        retrn       remark.o      i
ÈB	¶�  @   ü       $    ,    0  0      0  0  
      4   <     0  0        P   l   ,      ,  ,  ö    (        0   (                0   (          ´         (                 (                   d                    .   
    (    (      8 (      H X h  x    (      ˆ X h  x      8 (    ˜    (  ¨  ¸  È    Ø    È  ¸  È  è ø             ˆ X h  x    Ø      (8¨  ¸  È    Ø    È  ¸  È  è ø      HH                                    remark. "   rval4       gmv4        iad4        igt4        lnt2        lif2        goto        ieq4        arvalp      stsp        lval        stst        gal1        call        write.      gar1        i1i4        i4i1        gas1        retrn       index.o       !ÃC	¶�  ¬    ´       ®   š             ®      ®   ”    ¤         6   x      ®   ”           T   Z        	   
   ®         ®               ¨   ®            d  index              (   (   8  H  (   8  X    8  h x ˆ ˜  ¨  (   8  X    ¸   È ˆ ˜  ¨  (   Ø (   (   8  8  è H  (   ¨  (   (   8  H  (   Ø (   Ø                         index.  "   entry       lino        rval4       gmv4        arvalp      ing4        ine4        lnt2        lif2        goto        rval4p      ieq4        retrn       iad4        readf.o       w
–Á	¶�  8               ö                 <          ô                                             z   ˜           ô                        ´   Þ     ô                           ô                                    ( 8     H  X h x  ˆ  H  ˜  H  ¨    H  ¸ È Ø è  ø   8   8  ø   8  (     ˜  H  H  X h x  ˆ  H  ¸ ˜  H  ¨    H  ¸ È Ø H  ˜  H  H  X h x  ˆ  H  ¨    H  8   HÈ H  H  X˜  ˆ  H  ¨    H  ¸ È Ø Ø                             readf.  "   rval4p      i4i2        stst        rval4       ile4        lnt2        lif2        goto        gmv4        alvalp      ing4        gas4        retrn       stsp        lvalp       lval        call        read.       gar1        i1i4        iad4        length.o      !ÏC	¶�  ¬€    œ       ‚   l         t   ‚      ‚   x     f    |         <   V      ‚   x     ‚         	   
         d  length               (   (   8  H  (   8  8  X h    8  x ˆ ˜ ¨  ¸  (   8  8  X H  (   ¸  (   (   È (   È                           length. "   entry       lino        rval4       gmv4        iad4        arvalp      ing4        ine4        lnt2        lif2        goto        retrn       scopy.o       á
3î	¶�  `È    À       Ê   º         Ð            Ì      Ì   ®    À         B   ˆ   	   Ð   ´    Ì   ®      
   Ð   Ä     Ð      Ì   Ä     Ì      "         Ð   ´    À                d   d  scopy          (   8   H  (   (   8   H  (   X  h    X  x ˆ ˜ ¨  ¸  (   X  È    X  h    Ø (   X  X  è H  (   X  X  è H  (   ¸  (   (   X  È    X  x Ø (   ø (   ø                           scopy.  "   entry       lino        rval4p      gmv4        rval4       arvalp      ing4        ine4        lnt2        lif2        goto        alvalp      gas4        iad4        retrn       min.o         ¾
³þ	¶�  4V    x       X   R                   2         X      B            X   	   
        min    (   8   8   H X h  x  (   8   ˆ  (   x  (   (   8   ˆ  (   (   ˜ (   ˜     min.    "   entry       lino        rval4p      ilt4        lnt2        lif2        goto        gmv4        retrn       max.o         ¾
ºþ	¶�  4V    x       X   R                   2         X      B            X   	   
        max    (   8   8   H X h  x  (   8   ˆ  (   x  (   (   8   ˆ  (   (   ˜ (   ˜     max.    "   entry       lino        rval4p      igt4        lnt2        lif2        goto        gmv4        retrn       equal.o       $‡s	¶�  4Ä   
 œ       Æ   ²         ¸   Ê      Ê   ¦    Ê   ¬        :   Š      Ê   ¦    ¼         Z   l   	   ¸   Æ   
           Ê   ¸     Ê               À   Æ            d   d  equal              (   (   8  H  (   8  X    8  X    h x ˆ  ˜  (   8  X    8  ¨ h x ˆ  ˜  (   8  H  (   ¸ (   (   8  8  È H  (   ˜  (   (   8  H  (   ¸ (   ¸                               equal.  "   entry       lino        rval4       gmv4        arvalp      ieq4        lnt2        lif2        goto        ing4        retrn       iad4        open.o        &õ	¶�  ”2  L        :          "  z  	   z  
   &        6   l   
   z  < >  z  
          z  "    z              z  "      ˆ   œ      "    :             z  < >  *         2  >  4     6    2    :     :  .      ô   ú                    d      <  fopen                  (   (   8  H  (   8  X    8  h x ˆ ˜  ¨  (   8  ¸    8  X    È Ø (   8  8  è H  (   ¨  (   (   8  8  ø ˆ ˜  ¨  (   8  h H  (   (   (   8  ¸    8  È Ø (    ( 8 H  8 Xh     H  (   8  8  xˆ ˜  ¨  (   (   (   (                                           fopen.  "   entry       lino        rval4       gmv4        arvalp      ing4        ine4        lnt2        lif2        goto        gal1        i4i1        gas1        iad4        ile4        retrn       stsp        lval        stst        lvalp       call        open.       ilt4        makecopy.r      362839737   9     1     100666  505       `
include /usr/style/io/globdefs
define	NAMESIZE	50
# makecopy _ copy one file to another
	character iname(NAMESIZE), oname(NAMESIZE)
	integer create, getarg, open
	integer fin, fout

	if (getarg(1, iname, NAMESIZE) == EOF 
	   | getarg(2, oname, NAMESIZE) == EOF)
		call error("usage: makecopy input output.")
	fin = open(iname, READ)
	if (fin == ERR)
		call cant(iname)
	fout = create(oname, WRITE)
	if (fout == ERR)
		call cant(oname)
	call fcopy(fin, fout)
	call close(fin)
	call close(fout)
	stop
	end

print.r         362839736   9     1     100666  1675      `
include /usr/style/io/globdefs
define	NAMESIZE	50
define	MARGIN1	3
define	MARGIN2	2
define	MARGIN3	2
define	MARGIN4	3
define	BOTTOM	60
define	PAGELEN	66
# print  (default input STDIN) _ print files with headings
	character name(NAMESIZE)
	integer getarg, open
	integer fin, i
#	string null ""
	integer null(1)
	data null(1) /EOS/

	for (i = 1; getarg(i, name, NAMESIZE) != EOF; i = i + 1) {
		fin = open(name, READ)
		if (fin == ERR)
			call cant(name)
		call fprint(name, fin)
		call close(fin)
		}
	if (i == 1)		# no files specified
		call fprint(null, STDIN)
	stop
	end

# fprint _ print file "name" from  fin
	subroutine fprint(name, fin)
	integer line(MAXLINE), name(NAMESIZE)
	integer getlin, open
	integer fin, lineno, pageno

	pageno = 0
	lineno = 0
	while (getlin(line, fin) != EOF) {
		if (lineno == 0) {
			call skip(MARGIN1)
			pageno = pageno + 1
			call head(name, pageno)
			call skip(MARGIN2)
			lineno = MARGIN1 + MARGIN2 + 1
			}
		call putlin(line, STDOUT)
		lineno = lineno + 1
		if (lineno >= BOTTOM) {
			call skip(PAGELEN-lineno)
			lineno = 0
			}
		}
	if (lineno > 0)
		call skip(PAGELEN-lineno)
	return
	end

# skip _ output  n  blank lines
	subroutine skip(n)
	integer i, n

	for (i = 1; i <= n; i = i + 1)
		call putc(NEWLINE)
	return
	end

# head _ print top of page header
	subroutine head(name, pageno)
	integer name(NAMESIZE)
	integer pageno
#	string page " Page  "
	integer page(7)
	data page(1) /BLANK/
	data page(2) /LETP/
	data page(3) /LETA/
	data page(4) /LETG/
	data page(5) /LETE/
	data page(6) /BLANK/
	data page(7) /EOS/

	call putlin(name, STDOUT)
	call putlin(page, STDOUT)
	call putdec(pageno, 1)
	call putc(NEWLINE)
	return
	end

scompare.r      362839739   9     1     100666  856       `
include /usr/style/io/globdefs
define	INFILE1	1
define	INFILE2	2
define	NAMESIZE	50
# compare  (simple version) _ compare file 1 to file 2
	character line1(MAXLINE), line2(MAXLINE)
	integer equal, getlin
	integer lineno, m1, m2

	lineno = 0
	repeat {
		m1 = getlin(line1, INFILE1)
		m2 = getlin(line2, INFILE2)
		if (m1 == EOF | m2 == EOF)
			break
		lineno = lineno + 1
		if (equal(line1, line2) == NO)
			call difmsg(lineno, line1, line2)
		}
	if (m1 == EOF & m2 != EOF)
		call remark("eof on file 1.")
	else if (m2 == EOF & m1 != EOF)
		call remark("eof on file 2.")
	# else they match
	stop
	end

# difmsg _ print line numbers and differing lines
	subroutine difmsg(lineno, line1, line2)
	character line1(ARB), line2(ARB)
	integer lineno

	call putdec(lineno, 5)
	call putc(NEWLINE)
	call putlin(line1, STDOUT)
	call putlin(line2, STDOUT)
	return
	end
sprint.r        362839740   9     1     100666  1540      `
include /usr/style/io/globdefs
define	NAMESIZE	50
define	MARGIN1	3
define	MARGIN2	2
define	MARGIN3	2
define	MARGIN4	3
define	BOTTOM	60
define	PAGELEN	66
# print _ print files with headings
	character name(NAMESIZE)
	integer getarg, open
	integer fin, i

	for (i = 1; getarg(i, name, NAMESIZE) != EOF; i = i + 1) {
		fin = open(name, READ)
		if (fin == ERR)
			call cant(name)
		call fprint(name, fin)
		call close(fin)
		}
	stop
	end

# fprint _ print file "name" from  fin
	subroutine fprint(name, fin)
	character line(MAXLINE), name(NAMESIZE)
	integer getlin, open
	integer fin, lineno, pageno

	pageno = 0
	lineno = 0
	while (getlin(line, fin) != EOF) {
		if (lineno == 0) {
			call skip(MARGIN1)
			pageno = pageno + 1
			call head(name, pageno)
			call skip(MARGIN2)
			lineno = MARGIN1 + MARGIN2 + 1
			}
		call putlin(line, STDOUT)
		lineno = lineno + 1
		if (lineno >= BOTTOM) {
			call skip(PAGELEN-lineno)
			lineno = 0
			}
		}
	if (lineno > 0)
		call skip(PAGELEN-lineno)
	return
	end

# skip _ output  n  blank lines
	subroutine skip(n)
	integer i, n

	for (i = 1; i <= n; i = i + 1)
		call putc(NEWLINE)
	return
	end

# head _ print top of page header
	subroutine head(name, pageno)
	character name(NAMESIZE)
	integer pageno
#	string page " Page  "
	integer page(7)
	data page(1) /BLANK/
	data page(2) /LETP/
	data page(3) /LETA/
	data page(4) /LETG/
	data page(5) /LETE/
	data page(6) /BLANK/
	data page(7) /EOS/

	call putlin(name, STDOUT)
	call putlin(page, STDOUT)
	call putdec(pageno, 1)
	call putc(NEWLINE)
	return
	end
