ast@cs.vu.nl (Andy Tanenbaum) (05/30/88)
: This is a shar archive. Extract with sh, not csh.
: This archive ends with exit, so do not worry about trailing junk.
: --------------------------- cut here --------------------------
PATH=/bin:/usr/bin:/usr/ucb
echo Extracting 'od.c.diff'
sed 's/^X//' > 'od.c.diff' << '+ END-OF-FILE ''od.c.diff'
X3c3
X< #include "stdio.h"
X---
X> #include <stdio.h>
X66d65
X< fflush(stdout);
X83d81
X< fflush(stdout);
X111d108
X< fflush(stdout);
X282c279
X< for (i = 0; i < 7; i++) printf("%c", ((l>>(18-3*i)) & 07) + '0');
X---
X> for (i = 0; i < 7; i++) printf("%c", (int)((l>>(18-3*i)) & 07) + '0');
X284c281
X< for (i = 0; i < 7; i++) printf("%c", hexit( ((l>>(24-4*i)) & 0x0F)) );
X---
X> for (i = 0; i < 7; i++) printf("%c", hexit( (int)((l>>(24-4*i)) & 0x0F)) );
+ END-OF-FILE od.c.diff
chmod 'u=rw,g=r,o=r' 'od.c.diff'
set `wc -c 'od.c.diff'`
count=$1
case $count in
451) :;;
*) echo 'Bad character count in ''od.c.diff' >&2
echo 'Count should be 451' >&2
esac
echo Extracting 'passwd.c.diff'
sed 's/^X//' > 'passwd.c.diff' << '+ END-OF-FILE ''passwd.c.diff'
X3c3
X< #include "signal.h"
X---
X> #include <signal.h>
X20c20
X< char *getpass (), *crypt ();
X---
X> char *getpass (), *crypt (), *itoa ();
X102,103c102,103
X< fclose (fpin);
X< fclose (fpout);
X---
X> close (fpin);
X> close (fpout);
+ END-OF-FILE passwd.c.diff
chmod 'u=rw,g=r,o=r' 'passwd.c.diff'
set `wc -c 'passwd.c.diff'`
count=$1
case $count in
232) :;;
*) echo 'Bad character count in ''passwd.c.diff' >&2
echo 'Count should be 232' >&2
esac
echo Extracting 'pr.c.diff'
sed 's/^X//' > 'pr.c.diff' << '+ END-OF-FILE ''pr.c.diff'
X0a1,2
X> /* pr - print files Author: Michiel Huisjes */
X>
X4a7,18
X> * Modified: Jacob P. Bunschoten. (30 nov 87)
X> * When "columns" is not given and numbering is on:
X> * line numbers are correlated with input lines.
X> * (try pr [-1] -n file )
X> * tabs are accounted for.
X> * When numbering is turned on, width know this.
X> * automatic line-folding. -f to get the original program.
X> * backspaces are accounted for. -b to disable this.
X> * multi-column mode changed.
X> * header can be given and used.
X> * format changed may occur between printing of several files:
X> * pr -l30 file1 -w75 file2
X10c24
X< * -columns : Print files in n-colums.
X---
X> * -columns : Print files in n-columns.
X13c27,28
X< * -w with : Take the width of the page to be n instead of default 72
X---
X> * -w width : Take the width of the page to be n instead of default 72
X> * -f : do not fold lines.
X16c31
X< #include "stdio.h"
X---
X> #include <stdio.h>
X18,19d32
X< char *colbuf;
X<
X21a35,36
X> #define NUM_WIDTH 8
X> #define TAB_WIDTH 8 /* fixed tab_width */
X22a38,40
X> /* Used to compute next (fixed) tabstop */
X> #define TO_TAB(x) (( (x) + TAB_WIDTH ) & ~07 )
X>
X28a47,53
X> /* EAT: eat rest of input line */
X> #define EAT(fp) while((c=getc(fp))!='\n' && c!=EOF)
X> /* L_BUF: calculate address of pointer to char (string)
X> used in format
X> */
X> #define L_BUF(i,j) * (char **) (line_buf + \
X> (i + j*length)*sizeof(char *))
X32a58,61
X> BOOL ext_header_set = FALSE; /* external header given */
X> BOOL back_space = TRUE; /* back space correction in line width */
X> BOOL dont_fold = FALSE; /* original. If the line does not fit
X> eat it. */
X37a67
X> char *line_buf; /* used in format for multi-column output */
X40a71
X> static char *myalloc();
X48c79
X< int index = 1;
X---
X> int index = 1; /* index is one ahead of argc */
X50c81,85
X< while (argc > index) {
X---
X> setbuf(stdout, output);
X> do {
X> if (argc == index ) /* No arguments (left) */
X> goto pr_files;
X>
X55,56c90,91
X< }
X< if (*ptr != '-') {
X---
X> }
X> if (*ptr != '-') { /* no flags */
X58c93
X< break;
X---
X> goto pr_files;
X62c97,99
X< continue;
X---
X> if (columns <= 0)
X> columns = 1;
X> continue; /* Fetch next flag */
X73a111
X> ext_header_set = TRUE;
X76c114,115
X< width = atoi(ptr);
X---
X> if ((width = atoi(ptr)) <= 0)
X> width = DEF_WIDTH;
X80c119,120
X< length = atoi(ptr);
X---
X> if ((length = atoi(ptr)) <= 0)
X> length = DEF_LENGTH;
X82a123,128
X> case 'b': /* back_space correction off */
X> back_space = FALSE;
X> break;
X> case 'f': /* do not fold lines */
X> dont_fold = TRUE;
X> break;
X87c133
X< }
X---
X> continue; /* Scan for next flags */
X89,90c135
X< if (!no_header)
X< length -= 10;
X---
X> /* ============== flags are read. Print the file(s) ========= */
X92,93c137
X< if (length <= 0)
X< length = DEF_LENGTH;
X---
X> pr_files:
X95,106c139,140
X< if (columns) {
X< cwidth = width / columns + 1;
X< if (columns > width) {
X< fprintf(stderr, "Too many columns for pagewidth.\n");
X< exit(1);
X< }
X< if ((colbuf = (char *) sbrk(cwidth * columns * length)) < 0) {
X< fprintf(stderr, "No memory available for a page of %d x %d. Use chmem to allocate more.\n",
X< length, cwidth);
X< exit(1);
X< }
X< }
X---
X> if (!no_header)
X> length -= 10;
X108c142,146
X< setbuf(stdout, output);
X---
X> if (length <= 0 ) {
X> fprintf(stderr,"Minimal length shuold be %d\n",no_header ?
X> 1: 11);
X> exit(1);
X> }
X110,113c148,156
X< if (argc == index) {
X< header = "";
X< print(stdin);
X< }
X---
X> if (columns) {
X> cwidth = width / columns + 1;
X> if (columns > width) {
X> fprintf(stderr, "Too many columns for pagewidth.\n");
X> exit(1);
X> }
X> /* allocate piece of mem to hold some pointers */
X> line_buf = myalloc( length * columns * sizeof(char *) );
X> }
X115,127c158,160
X< while (index != argc) {
X< if ((file = fopen(argv[index], "r")) == (FILE *) 0) {
X< fprintf(stderr, "Cannot open %s\n", argv[index++]);
X< continue;
X< }
X< header = argv[index];
X< if (columns)
X< format(file);
X< else
X< print(file);
X< fclose(file);
X< index++;
X< }
X---
X> while (index <= argc ) { /* print all files, including stdin */
X> if (index < argc && (*argv[index] == '-' || *argv[index] == '+' ))
X> break; /* Format change */
X129,132c162,180
X< if (columns) {
X< if (brk(colbuf) < 0) {
X< fprintf(stderr, "Can't reset memory!\n");
X< exit(1);
X---
X> if ( argc == index ) { /* no file specified, so stdin */
X> if (!ext_header_set )
X> header = "";
X> file = stdin;
X> } else {
X> if ((file = fopen(argv[index], "r")) == (FILE *) 0) {
X> fprintf(stderr, "Cannot open %s\n", argv[index++]);
X> continue;
X> }
X> if (!ext_header_set)
X> header = argv[index];
X> }
X> if (columns)
X> format(file);
X> else
X> print(file);
X> fclose(file);
X> if (++index >= argc )
X> break; /* all files (including stdin) done */
X134c182,188
X< }
X---
X> if (index >= argc)
X> break;
X> /* when control comes here. format changes are to be done.
X> * reinitialize some variables
X> */
X> if (!no_header)
X> length += 10;
X135a190,195
X> start_page = 1;
X> ext_header_set = FALSE;
X> if (columns)
X> free(line_buf);
X> } while (index <= argc); /* "pr -l60" should work too */
X>
X140,141c200,201
X< char skip_page(lines, filep)
X< int lines;
X---
X> char skip_page(lines, width, filep)
X> int lines, width;
X144a205,206
X> int char_cnt;
X> int w;
X147c209,230
X< while ((c = getc(filep)) != '\n' && c != EOF);
X---
X> w = width;
X> if (number) /* first lines are shorter */
X> if ( !columns || /* called from print(file) */
X> !(lines%columns)) /* called from format(file) */
X> w -= NUM_WIDTH;
X>
X> char_cnt = 0;
X> while ((c = getc(filep)) != '\n' && c != EOF && char_cnt < w ) {
X> /*
X> * Calculate if this line is longer
X> * than "width (w)" characters
X> */
X> if (c == '\b' && back_space) {
X> if (--char_cnt < 0)
X> char_cnt = 0;
X> } else if (c == '\t')
X> char_cnt = TO_TAB(char_cnt);
X> else
X> char_cnt++;
X> }
X> if (dont_fold && c!='\n' && c!=EOF)
X> EAT(filep);
X149c232
X< } while (lines && c != EOF);
X---
X> } while (lines > 0 && c != EOF);
X151c234
X< return c;
X---
X> return c; /* last char read */
X156a240
X> char buf[512];
X160a245,246
X> short wdth;
X> short line, col;
X163c249
X< /* Check printing of page */
X---
X> /* Check printing of page */
X167c253
X< c = skip_page(columns * length, filep);
X---
X> c = (char) skip_page(columns * length, cwidth, filep);
X170d255
X<
X175c260,267
X< index = 0;
X---
X> for(line=0; line < length; line++)
X> for(col=0; col < columns; col++) {
X> if ( L_BUF(line, col) != NIL_PTR )
X> free( L_BUF(line, col) );
X> L_BUF(line, col) = (char *) NIL_PTR;
X> }
X> line = 0;
X> col = 0;
X177,178c269,280
X< for (i = 0; i < cwidth - 1; i++) {
X< if ((c = getc(filep)) == '\n' || c == EOF)
X---
X> index = 0;
X> wdth = cwidth-1;
X> if ( number && ! col ) /* need room for numbers */
X> wdth -= NUM_WIDTH;
X>
X> /* intermidiate colums are shortened by 1 char */
X> /* last column not */
X> if (col+1 == columns)
X> wdth++;
X> for (i = 0 ; i < wdth - 1; i++) {
X> c = getc(filep);
X> if ( c == '\n' || c == EOF)
X180c282,298
X< colbuf[index++] = c;
X---
X>
X> if (c == '\b' && back_space) {
X> buf[index++] = '\b';
X> if (--i < 0) { /* just in case ... */
X> i=0;
X> index = 0;
X> }
X> } else if (c == '\t') {
X> int cnt, max;
X>
X> max = TO_TAB(i);
X> for (cnt = i; cnt < max; cnt++)
X> buf[index++] = ' ';
X> i = max -1;
X> }
X> else
X> buf[index++] = (char) c;
X182c300,303
X< /* First char is EOF */
X---
X> buf[index++] = '\0';
X> /* collected enough chars (or eoln, or EOF) */
X>
X> /* First char is EOF */
X185,196c306,322
X< while (c != '\n' && c != EOF)
X< c = getc(filep);
X< colbuf[index++] = '\0';
X< while (++i < cwidth)
X< index++;
X< lines--;
X< if (c == EOF) {
X< maxcol = columns - lines / length;
X< while (lines--)
X< for (i = 0; i < cwidth; i++)
X< colbuf[index++] = '\0';
X< }
X---
X>
X> /* alloc mem to hold this (sub) string */
X> L_BUF(line,col) = myalloc(index * sizeof(char));
X> strcpy( L_BUF(line, col), buf );
X>
X> line++;
X> line %= length;
X> if (line == 0) {
X> col++;
X> col %= columns;
X> }
X> if (dont_fold && c != '\n' && c != EOF)
X> EAT(filep);
X> lines--; /* line ready for output */
X> if (c == EOF) {
X> maxcol = columns - lines / length;
X> }
X198c324
X< print_page(colbuf, page_number, maxcol);
X---
X> print_page(page_number, maxcol);
X202,203c328
X< print_page(buf, pagenr, maxcol)
X< char buf[];
X---
X> print_page(pagenr, maxcol)
X207a333,334
X> short width;
X> char *p;
X211,213c338,339
X< for (i = 0; i < length; i++) {
X< if (number)
X< printf("%d\t", linenr++);
X---
X>
X> for (i = 0; i < length; i++) {
X215,219c341,351
X< start = (i + j * length) * cwidth;
X< for (pad = 0; pad < cwidth - 1 && buf[start + pad]; pad++)
X< putchar (buf[start + pad]);
X< if (j < maxcol - 1) /* Do not pad last column */
X< while (pad++ < cwidth - 1)
X---
X> width = cwidth;
X> if (number && j == 0) { /* first columns */
X> printf("%*.*d ", NUM_WIDTH-1, NUM_WIDTH-1, linenr++);
X> width -= NUM_WIDTH;
X> }
X> pad = 0;
X> if (p = (char *) L_BUF(i,j) )
X> for (; pad < width - 1 && *p; pad++)
X> putchar ( *p++ );
X> if (j < maxcol - 1)
X> while (pad++ < width - 1)
X234a367,369
X> short cnt, i, max;
X> short w = width;
X> BOOL pr_number = TRUE; /* only real lines are numbered, not folded parts */
X235a371,373
X> if (number)
X> width -= NUM_WIDTH;
X>
X237c375
X< /* Check printing of page */
X---
X> /* Check printing of page */
X238a377
X>
X240c379,382
X< c = skip_page(length, filep);
X---
X> pr_number = FALSE;
X> c = skip_page(length, w, filep);
X> if (c == '\n')
X> pr_number = TRUE;
X243c385
X<
X---
X>
X246a389,392
X> linenr = (page_number -1 ) * length + 1;
X> if (!no_header)
X> out_header(page_number);
X>
X250,253c396,397
X< /* Print the page */
X< lines = length;
X< if (!no_header)
X< out_header(page_number);
X---
X> /* Print the page */
X> lines = length;
X255,258c399,419
X< if (number)
X< printf("%d\t", linenr++);
X< while (c != '\n' && c != EOF) {
X< putchar(c);
X---
X> if (number )
X> if (pr_number)
X> printf("%*.*d ", NUM_WIDTH-1,
X> NUM_WIDTH-1, linenr++);
X> else
X> printf("%*c ", NUM_WIDTH-1, ' ');
X> pr_number = FALSE;
X> cnt = 0;
X> while (c != '\n' && c != EOF && cnt < width) {
X> if (c=='\t') {
X> int i, max;
X> max = TO_TAB(cnt);
X> for (i = cnt; i < max; i++ )
X> putchar(' ');
X> cnt = max -1;
X> }
X> else if (c=='\b' && back_space) {
X> putchar('\b');
X> cnt--;
X> } else
X> putchar(c);
X259a421
X> cnt++;
X261a424,425
X> if (dont_fold && c!= '\n' && c!= EOF)
X> EAT(filep);
X263c427,430
X< c = getc(filep);
X---
X> if ( c == '\n') {
X> c = getc(filep);
X> pr_number = TRUE;
X> }
X269d435
X< /* End of file */
X272c438
X< /* Fill last page */
X---
X> /* Fill last page */
X278a445,457
X> char *myalloc(size)
X> int size; /* How many bytes */
X> {
X> char *ptr, *malloc();
X>
X> ptr = malloc((unsigned)size);
X> if (ptr == (char *) 0) {
X> fprintf(stderr,"malloc returned %d\n",ptr);
X> exit(1);
X> }
X> return (char *) ptr;
X> }
X>
X338c517
X< printf("\n\n%s %d %0d:%0d %d", moname[month], day + 1, hour + 1, minute, year);
X---
X> printf("\n\n%s %d %0d:%0d %d", moname[month], day + 1, hour + 0, minute, year);
+ END-OF-FILE pr.c.diff
chmod 'u=rw,g=r,o=r' 'pr.c.diff'
set `wc -c 'pr.c.diff'`
count=$1
case $count in
11668) :;;
*) echo 'Bad character count in ''pr.c.diff' >&2
echo 'Count should be 11668' >&2
esac
echo Extracting 'pwd.c.diff'
sed 's/^X//' > 'pwd.c.diff' << '+ END-OF-FILE ''pwd.c.diff'
X3c3,5
X< #include "stat.h"
X---
X> #include <sys/types.h>
X> #include <sys/stat.h>
X> #include <sys/dir.h>
X5,8d6
X< struct direct {
X< unsigned short d_ino;
X< char d_name[14];
X< }
X12c10
X< register *n;
X---
X> register char *n;
+ END-OF-FILE pwd.c.diff
chmod 'u=rw,g=r,o=r' 'pwd.c.diff'
set `wc -c 'pwd.c.diff'`
count=$1
case $count in
228) :;;
*) echo 'Bad character count in ''pwd.c.diff' >&2
echo 'Count should be 228' >&2
esac
echo Extracting 'readfs.c.diff'
sed 's/^X//' > 'readfs.c.diff' << '+ END-OF-FILE ''readfs.c.diff'
X30,35c30,35
X< #include "fs/const.h"
X< #include "h/type.h"
X< #include "h/const.h"
X< #include "fs/type.h"
X< #include "fs/buf.h"
X< #include "fs/super.h"
X---
X> #include <fs/const.h>
X> #include <minix/type.h>
X> #include <minix/const.h>
X> #include <fs/type.h>
X> #include <fs/buf.h>
X> #include <fs/super.h>
+ END-OF-FILE readfs.c.diff
chmod 'u=rw,g=r,o=r' 'readfs.c.diff'
set `wc -c 'readfs.c.diff'`
count=$1
case $count in
300) :;;
*) echo 'Bad character count in ''readfs.c.diff' >&2
echo 'Count should be 300' >&2
esac
echo Extracting 'rev.c.diff'
sed 's/^X//' > 'rev.c.diff' << '+ END-OF-FILE ''rev.c.diff'
X3c3
X< #include "blocksize.h"
X---
X> #include <minix/blocksize.h>
+ END-OF-FILE rev.c.diff
chmod 'u=rw,g=r,o=r' 'rev.c.diff'
set `wc -c 'rev.c.diff'`
count=$1
case $count in
64) :;;
*) echo 'Bad character count in ''rev.c.diff' >&2
echo 'Count should be 64' >&2
esac
echo Extracting 'rm.c.diff'
sed 's/^X//' > 'rm.c.diff' << '+ END-OF-FILE ''rm.c.diff'
X3c3,5
X< #include "stat.h"
X---
X> #include <sys/types.h>
X> #include <sys/stat.h>
X> #include <sys/dir.h>
X5,9d6
X< struct direct {
X< unsigned short d_ino;
X< char d_name[14];
X< };
X<
X91c88
X< strcat (rname, d.d_name);
X---
X> strncat (rname, d.d_name, DIRSIZ);
+ END-OF-FILE rm.c.diff
chmod 'u=rw,g=r,o=r' 'rm.c.diff'
set `wc -c 'rm.c.diff'`
count=$1
case $count in
276) :;;
*) echo 'Bad character count in ''rm.c.diff' >&2
echo 'Count should be 276' >&2
esac
echo Extracting 'rmdir.c.diff'
sed 's/^X//' > 'rmdir.c.diff' << '+ END-OF-FILE ''rmdir.c.diff'
X5,6c5,8
X< #include "../include/signal.h"
X< #include "../include/stat.h"
X---
X> #include <signal.h>
X> #include <sys/types.h>
X> #include <sys/stat.h>
X> #include <sys/dir.h>
X8,11d9
X< struct direct {
X< unsigned short d_ino;
X< char d_name[14];
X< };
+ END-OF-FILE rmdir.c.diff
chmod 'u=rw,g=r,o=r' 'rmdir.c.diff'
set `wc -c 'rmdir.c.diff'`
count=$1
case $count in
255) :;;
*) echo 'Bad character count in ''rmdir.c.diff' >&2
echo 'Count should be 255' >&2
esac
echo Extracting 'roff.c.diff'
sed 's/^X//' > 'roff.c.diff' << '+ END-OF-FILE ''roff.c.diff'
X18,21c18,22
X< #include "sgtty.h"
X< #include "signal.h"
X< #include "stdio.h"
X< #include "stat.h"
X---
X> #include <sgtty.h>
X> #include <signal.h>
X> #include <stdio.h>
X> #include <sys/types.h>
X> #include <sys/stat.h>
X124c125
X< done(1);
X---
X> exit(1);
X134c135
X< done(0);
X---
X> exit(0);
X683c684
X< done(1);
X---
X> exit(1);
X785c786
X< done(1);
X---
X> exit(1);
X887c888
X< done(1);
X---
X> exit(1);
X1214,1222c1215
X< done(1);
X< }
X<
X< done(n)
X< int n;
X< {
X< fflush(stdout);
X< _cleanup();
X< exit(n);
X---
X> exit(1);
+ END-OF-FILE roff.c.diff
chmod 'u=rw,g=r,o=r' 'roff.c.diff'
set `wc -c 'roff.c.diff'`
count=$1
case $count in
525) :;;
*) echo 'Bad character count in ''roff.c.diff' >&2
echo 'Count should be 525' >&2
esac
echo Extracting 'shar.c.diff'
sed 's/^X//' > 'shar.c.diff' << '+ END-OF-FILE ''shar.c.diff'
X4c4
X< #include "blocksize.h"
X---
X> #include <minix/blocksize.h>
+ END-OF-FILE shar.c.diff
chmod 'u=rw,g=r,o=r' 'shar.c.diff'
set `wc -c 'shar.c.diff'`
count=$1
case $count in
64) :;;
*) echo 'Bad character count in ''shar.c.diff' >&2
echo 'Count should be 64' >&2
esac
echo Extracting 'size.c.diff'
sed 's/^X//' > 'size.c.diff' << '+ END-OF-FILE ''size.c.diff'
X49c49
X< if ( (head[0] & 0xFFFF) != MAGIC) {
X---
X> if ( (head[0] & 0xFFFFL) != MAGIC) {
+ END-OF-FILE size.c.diff
chmod 'u=rw,g=r,o=r' 'size.c.diff'
set `wc -c 'size.c.diff'`
count=$1
case $count in
91) :;;
*) echo 'Bad character count in ''size.c.diff' >&2
echo 'Count should be 91' >&2
esac
echo Extracting 'sort.c.diff'
sed 's/^X//' > 'sort.c.diff' << '+ END-OF-FILE ''sort.c.diff'
X34,35c34,36
X< #include "stat.h"
X< #include "signal.h"
X---
X> #include <sys/types.h>
X> #include <sys/stat.h>
X> #include <signal.h>
X63,66c64
X< typedef enum { /* Boolean types */
X< FALSE = 0,
X< TRUE
X< } BOOL;
X---
X> typedef int BOOL;
X67a66,68
X> #define FALSE 0
X> #define TRUE 1
X>
X280c281
X< if (*ptr == '-' && table[*(ptr + 1)] & DIGIT) {
X---
X> if (ptr && *ptr == '-' && table[*(ptr + 1)] & DIGIT) {
X314c315
X< while (argc > 1 && ((ptr = argv[arg_count])[0] == '-' || *ptr == '+')) {
X---
X> while (arg_count < argc && ((ptr = argv[arg_count])[0] == '-' || *ptr == '+')) {
X467c468
X< long rest; /* Rest in memory */
X---
X> int rest; /* Rest in memory */
X468a470
X> long lseek();
X481,482c483,484
X< for (size = 0; i + size != MEMORY_SIZE; size++)
X< mem_top[size] = mem_top[i + size];
X---
X> for (rest = 0; i + rest != MEMORY_SIZE; rest++)
X> mem_top[rest] = mem_top[i + rest];
X484c486
X< cur_pos = &mem_top[size];
X---
X> cur_pos = &mem_top[rest];
X499,500c501,502
X< (void) lseek(fd, i - MEMORY_SIZE, 1); /* Do this next time */
X< rest = size - rest - i + MEMORY_SIZE;/* Calculate rest */
X---
X> (void) lseek(fd, (long)(i - MEMORY_SIZE), 1); /* Do this next time */
X> size = size - rest - i + MEMORY_SIZE;/* Calculate rest */
X503c505
X< get_file(fd, rest); /* Get rest of file */
X---
X> get_file(fd, size); /* Get rest of file */
X506,507c508,510
X< mread(fd, cur_pos, size);
X< cur_pos = cur_pos + size; /* Reassign cur_pos */
X---
X> rest = size;
X> mread(fd, cur_pos, rest);
X> cur_pos = cur_pos + rest; /* Reassign cur_pos */
X1240c1243
X< register unsigned size;
X---
X> register size;
X1253,1254c1256,1257
X< char *mbrk(size)
X< register unsigned size;
X---
X> char *mbrk(address)
X> char *address;
X1257d1259
X< register char *address;
X1259c1261
X< if ((address = brk(size)) < 0)
X---
X> if ((address = brk(address)) < 0)
+ END-OF-FILE sort.c.diff
chmod 'u=rw,g=r,o=r' 'sort.c.diff'
set `wc -c 'sort.c.diff'`
count=$1
case $count in
1845) :;;
*) echo 'Bad character count in ''sort.c.diff' >&2
echo 'Count should be 1845' >&2
esac
echo Extracting 'split.c.diff'
sed 's/^X//' > 'split.c.diff' << '+ END-OF-FILE ''split.c.diff'
X3c3
X< #include "blocksize.h"
X---
X> #include <minix/blocksize.h>
X60c60
X< fd = newfile();
X---
X> fd = -1;
X65a66,67
X> if (fd == -1)
X> fd = newfile();
X70c72
X< fd = newfile();
X---
X> fd = -1;
X72a75,78
X> if (index == base)
X> continue;
X> if (fd == -1)
X> fd = newfile();
+ END-OF-FILE split.c.diff
chmod 'u=rw,g=r,o=r' 'split.c.diff'
set `wc -c 'split.c.diff'`
count=$1
case $count in
292) :;;
*) echo 'Bad character count in ''split.c.diff' >&2
echo 'Count should be 292' >&2
esac
echo Extracting 'stty.c.diff'
sed 's/^X//' > 'stty.c.diff' << '+ END-OF-FILE ''stty.c.diff'
X3c3
X< #include "sgtty.h"
X---
X> #include <sgtty.h>
X33c33
X< option(argv[k], argv[k+1]);
X---
X> option(argv[k], k+1 < argc ? argv[k+1] : "");
+ END-OF-FILE stty.c.diff
chmod 'u=rw,g=r,o=r' 'stty.c.diff'
set `wc -c 'stty.c.diff'`
count=$1
case $count in
140) :;;
*) echo 'Bad character count in ''stty.c.diff' >&2
echo 'Count should be 140' >&2
esac
echo Extracting 'su.c.diff'
sed 's/^X//' > 'su.c.diff' << '+ END-OF-FILE ''su.c.diff'
X3,5c3,5
X< #include "sgtty.h"
X< #include "stdio.h"
X< #include "pwd.h"
X---
X> #include <sgtty.h>
X> #include <stdio.h>
X> #include <pwd.h>
X51c51
X< execn (shell);
X---
X> execl (shell, 0);
+ END-OF-FILE su.c.diff
chmod 'u=rw,g=r,o=r' 'su.c.diff'
set `wc -c 'su.c.diff'`
count=$1
case $count in
183) :;;
*) echo 'Bad character count in ''su.c.diff' >&2
echo 'Count should be 183' >&2
esac
echo Extracting 'sum.c.diff'
sed 's/^X//' > 'sum.c.diff' << '+ END-OF-FILE ''sum.c.diff'
X62c62
X< int size = 0;
X---
X> long size = 0;
X64c64
X< unsigned tmp;
X---
X> unsigned tmp, blks;
X85c85,86
X< putd((size+BUFSIZ-1)/BUFSIZ, 6, 0);
X---
X> blks = (size + (long)BUFSIZ - 1L)/(long)BUFSIZ;
X> putd(blks, 6, 0);
+ END-OF-FILE sum.c.diff
chmod 'u=rw,g=r,o=r' 'sum.c.diff'
set `wc -c 'sum.c.diff'`
count=$1
case $count in
226) :;;
*) echo 'Bad character count in ''sum.c.diff' >&2
echo 'Count should be 226' >&2
esac
echo Extracting 'tail.c.diff'
sed 's/^X//' > 'tail.c.diff' << '+ END-OF-FILE ''tail.c.diff'
X3c3
X< #include "stdio.h"
X---
X> #include <stdio.h>
X30c30
X< done(0) ;
X---
X> exit(0) ;
X55c55
X< done(1) ;
X---
X> exit(1) ;
X63c63
X< done(1) ;
X---
X> exit(1) ;
X70c70
X< done(0) ;
X---
X> exit(0) ;
X112,113c112,113
X<
X< if (lines ) /* lines */
X---
X> count++; /* start counting at 1 */
X> if (lines ) /* lines */
X164,172d163
X<
X<
X<
X< done(n)
X< int n;
X< {
X< _cleanup(); /* flush stdio's internal buffers */
X< exit(n);
X< }
+ END-OF-FILE tail.c.diff
chmod 'u=rw,g=r,o=r' 'tail.c.diff'
set `wc -c 'tail.c.diff'`
count=$1
case $count in
576) :;;
*) echo 'Bad character count in ''tail.c.diff' >&2
echo 'Count should be 576' >&2
esac
echo Extracting 'tar.c.diff'
sed 's/^X//' > 'tar.c.diff' << '+ END-OF-FILE ''tar.c.diff'
X13c13,15
X< #include "stat.h"
X---
X> #include <sys/types.h>
X> #include <sys/stat.h>
X> #include <sys/dir.h>
X15,19d16
X< struct direct {
X< unsigned short d_ino;
X< char d_name[14];
X< };
X<
X204c201
X< chmod(file, convert(header.member.m_mode, INT_TYPE));
X---
X> chmod(file, (int)convert(header.member.m_mode, INT_TYPE));
X471c468
X< int *argptr = &args;
X---
X> char *argptr = (char *)&args;
X483c480,481
X< scan_ptr = (char *) *argptr;
X---
X> scan_ptr = *((char **)argptr);
X> argptr += sizeof(char *);
X486c484,485
X< scan_ptr = num_out((long) *argptr);
X---
X> scan_ptr = num_out((long) *((int *)argptr));
X> argptr += sizeof(int);
X492c491
X< argptr++;
X---
X> argptr += sizeof(long);
X495c494,495
X< scan_ptr = num_out((long) *argptr);
X---
X> scan_ptr = num_out((long) *((int *)argptr));
X> argptr += sizeof(int);
X506d505
X< argptr++;
+ END-OF-FILE tar.c.diff
chmod 'u=rw,g=r,o=r' 'tar.c.diff'
set `wc -c 'tar.c.diff'`
count=$1
case $count in
867) :;;
*) echo 'Bad character count in ''tar.c.diff' >&2
echo 'Count should be 867' >&2
esac
echo Extracting 'tee.c.diff'
sed 's/^X//' > 'tee.c.diff' << '+ END-OF-FILE ''tee.c.diff'
X3,4c3,4
X< #include "blocksize.h"
X< #include "signal.h"
X---
X> #include <minix/blocksize.h>
X> #include <signal.h>
+ END-OF-FILE tee.c.diff
chmod 'u=rw,g=r,o=r' 'tee.c.diff'
set `wc -c 'tee.c.diff'`
count=$1
case $count in
112) :;;
*) echo 'Bad character count in ''tee.c.diff' >&2
echo 'Count should be 112' >&2
esac
echo Extracting 'test.c.diff'
sed 's/^X//' > 'test.c.diff' << '+ END-OF-FILE ''test.c.diff'
X2c2,3
X< #include <stat.h>
X---
X> #include <sys/types.h>
X> #include <sys/stat.h>
X14c15
X< unary-operator ::= "-r"|"-w"|"-f"|"-d"|"-s"|"-t"|"-z"|"-n";
X---
X> unary-operator ::= "-r"|"-w"|"-x"|"-f"|"-d"|"-s"|"-t"|"-z"|"-n";
X41a43
X> #define FILEX 23
X54a57
X> {"-x", FILEX, UNOP},
X182a186,187
X> case FILEX:
X> return access(nm, 1) == 0;
+ END-OF-FILE test.c.diff
chmod 'u=rw,g=r,o=r' 'test.c.diff'
set `wc -c 'test.c.diff'`
count=$1
case $count in
335) :;;
*) echo 'Bad character count in ''test.c.diff' >&2
echo 'Count should be 335' >&2
esac
echo Extracting 'time.c.diff'
sed 's/^X//' > 'time.c.diff' << '+ END-OF-FILE ''time.c.diff'
X3,4c3,6
X< #include "signal.h"
X< #include "../h/const.h"
X---
X> #include <signal.h>
X> #include <sys/types.h>
X> #include <sys/times.h>
X> #include <minix/const.h>
X9,13d10
X< struct time_buf {
X< long user, sys;
X< long childu, childs;
X< };
X<
X21c18
X< struct time_buf pre_buf, post_buf;
X---
X> struct tms pre_buf, post_buf;
X58,59c55,56
X< print_time("user ", post_buf.childu - pre_buf.childu);
X< print_time("sys ", post_buf.childs - pre_buf.childs);
X---
X> print_time("user ", post_buf.tms_cutime - pre_buf.tms_cutime);
X> print_time("sys ", post_buf.tms_cstime - pre_buf.tms_cstime);
+ END-OF-FILE time.c.diff
chmod 'u=rw,g=r,o=r' 'time.c.diff'
set `wc -c 'time.c.diff'`
count=$1
case $count in
591) :;;
*) echo 'Bad character count in ''time.c.diff' >&2
echo 'Count should be 591' >&2
esac
echo Extracting 'touch.c.diff'
sed 's/^X//' > 'touch.c.diff' << '+ END-OF-FILE ''touch.c.diff'
X2,3c2,4
X< #include "stat.h"
X< #include "errno.h"
X---
X> #include <sys/types.h>
X> #include <sys/stat.h>
X> #include <errno.h>
+ END-OF-FILE touch.c.diff
chmod 'u=rw,g=r,o=r' 'touch.c.diff'
set `wc -c 'touch.c.diff'`
count=$1
case $count in
123) :;;
*) echo 'Bad character count in ''touch.c.diff' >&2
echo 'Count should be 123' >&2
esac
echo Extracting 'umount.c.diff'
sed 's/^X//' > 'umount.c.diff' << '+ END-OF-FILE ''umount.c.diff'
X3c3
X< #include "errno.h"
X---
X> #include <errno.h>
X4a5,6
X> #define BUFSIZE 1024
X>
X5a8,9
X> char *mounttable = "/etc/mtab";
X> char buffer[BUFSIZE], *p = &buffer[0], *q;
X21a26
X> do_mtab(argv[1]);
X23a29,66
X>
X> do_mtab(devname)
X> char *devname;
X> {
X> /* Remove an entry from mtab. */
X> int n, fd;
X> char line[256];
X>
X> /* Read in the mount table and then overwrite the file. */
X> fd = open(mounttable, 2);
X> n = read(fd, buffer, BUFSIZE);
X> close(fd);
X> q = &buffer[n];
X> fd = creat(mounttable, 0554);
X>
X> n = strlen(devname);
X> while (getline(line) != 0) {
X> if (strncmp(line, devname, n) == 0) continue;
X> write(fd, line, strlen(line));
X> }
X> }
X>
X> int getline(ptr)
X> char *ptr;
X> {
X> char c;
X>
X> while (p < q) {
X> c = *p++;
X> *ptr++ = c;
X> if (c == '\n') {
X> *ptr++ = 0;
X> return(1);
X> }
X> }
X> return(0);
X> }
X>
+ END-OF-FILE umount.c.diff
chmod 'u=rw,g=r,o=r' 'umount.c.diff'
set `wc -c 'umount.c.diff'`
count=$1
case $count in
857) :;;
*) echo 'Bad character count in ''umount.c.diff' >&2
echo 'Count should be 857' >&2
esac
echo Extracting 'uniq.c.diff'
sed 's/^X//' > 'uniq.c.diff' << '+ END-OF-FILE ''uniq.c.diff'
X16c16
X< #include "stdio.h"
X---
X> #include <stdio.h>
+ END-OF-FILE uniq.c.diff
chmod 'u=rw,g=r,o=r' 'uniq.c.diff'
set `wc -c 'uniq.c.diff'`
count=$1
case $count in
52) :;;
*) echo 'Bad character count in ''uniq.c.diff' >&2
echo 'Count should be 52' >&2
esac
echo Extracting 'update.c.diff'
sed 's/^X//' > 'update.c.diff' << '+ END-OF-FILE ''update.c.diff'
X3c3
X< #include "signal.h"
X---
X> #include <signal.h>
X18,21c18,21
X< open("/bin", 0);
X< open("/lib", 0);
X< open("/etc", 0);
X< open("/tmp", 0);
X---
X> /*open("/bin", 0);*/
X> /*open("/lib", 0);*/
X> /*open("/etc", 0);*/
X> /*open("/tmp", 0);*/
+ END-OF-FILE update.c.diff
chmod 'u=rw,g=r,o=r' 'update.c.diff'
set `wc -c 'update.c.diff'`
count=$1
case $count in
244) :;;
*) echo 'Bad character count in ''update.c.diff' >&2
echo 'Count should be 244' >&2
esac
echo Extracting 'uudecode.c.diff'
sed 's/^X//' > 'uudecode.c.diff' << '+ END-OF-FILE ''uudecode.c.diff'
X7,9c7,10
X< #include "stdio.h"
X< #include "pwd.h"
X< #include "stat.h"
X---
X> #include <stdio.h>
X> #include <pwd.h>
X> #include <sys/types.h>
X> #include <sys/stat.h>
X32c33
X< xit(1);
X---
X> exit(1);
X40c41
X< xit(2);
X---
X> exit(2);
X47c48
X< xit(3);
X---
X> exit(3);
X65c66
X< xit(3);
X---
X> exit(3);
X71c72
X< xit(4);
X---
X> exit(4);
X83c84
X< xit(4);
X---
X> exit(4);
X91c92
X< xit(5);
X---
X> exit(5);
X93c94
X< xit(0);
X---
X> exit(0);
X114c115
X< xit(10);
X---
X> exit(10);
X203,209d203
X< }
X<
X< xit(n)
X< int n;
X< {
X< _cleanup();
X< exit(n);
+ END-OF-FILE uudecode.c.diff
chmod 'u=rw,g=r,o=r' 'uudecode.c.diff'
set `wc -c 'uudecode.c.diff'`
count=$1
case $count in
559) :;;
*) echo 'Bad character count in ''uudecode.c.diff' >&2
echo 'Count should be 559' >&2
esac
echo Extracting 'uuencode.c.diff'
sed 's/^X//' > 'uuencode.c.diff' << '+ END-OF-FILE ''uuencode.c.diff'
X8,9c8,10
X< #include "stdio.h"
X< #include "stat.h"
X---
X> #include <stdio.h>
X> #include <sys/types.h>
X> #include <sys/stat.h>
X27c28
X< xit(1);
X---
X> exit(1);
X35c36
X< xit(2);
X---
X> exit(2);
X46c47
X< xit(0);
X---
X> exit(0);
X108,114d108
X< }
X<
X< xit(n)
X< int n;
X< {
X< _cleanup();
X< exit(n);
+ END-OF-FILE uuencode.c.diff
chmod 'u=rw,g=r,o=r' 'uuencode.c.diff'
set `wc -c 'uuencode.c.diff'`
count=$1
case $count in
299) :;;
*) echo 'Bad character count in ''uuencode.c.diff' >&2
echo 'Count should be 299' >&2
esac
echo Extracting 'wc.c.diff'
sed 's/^X//' > 'wc.c.diff' << '+ END-OF-FILE ''wc.c.diff'
X3,4c3
X< #include "stdio.h"
X< #define isdigit(c) (c >= '0' && c <= '9)
X---
X> #include <stdio.h>
X130c129
X< while((c = getc(stdin)) > 0) {
X---
X> while((c = getc(stdin)) >= 0) {
+ END-OF-FILE wc.c.diff
chmod 'u=rw,g=r,o=r' 'wc.c.diff'
set `wc -c 'wc.c.diff'`
count=$1
case $count in
178) :;;
*) echo 'Bad character count in ''wc.c.diff' >&2
echo 'Count should be 178' >&2
esac
exit 0