ast@cs.vu.nl (Andy Tanenbaum) (07/14/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 'LISTING' sed 's/^X//' > 'LISTING' << '+ END-OF-FILE ''LISTING' X-rw-r--r-- 1 ast 646 Jul 14 13:52 brk.c.cdif X-rw-r--r-- 1 ast 8357 Jul 14 13:52 crypt.c.cdif X-rw-r--r-- 1 ast 3882 Jul 14 13:52 ctime.c.cdif X-rw-r--r-- 1 ast 236 Jul 14 13:52 fopen.c.cdif X-rw-r--r-- 1 ast 1718 Jul 14 13:52 fseek.c.cdif X-rw-r--r-- 1 ast 483 Jul 14 13:52 getc.c.cdif X-rw-r--r-- 1 ast 854 Jul 14 13:52 getenv.c.cdif X-rw-r--r-- 1 ast 3199 Jul 14 13:52 ioctl.c.cdif X-rw-r--r-- 1 ast 5107 Jul 14 13:53 malloc.c.cdif X-rw-r--r-- 1 ast 1054 Jul 14 13:53 strncat.c.cdif X-rw-r--r-- 1 ast 926 Jul 14 13:53 strncmp.c.cdif X-rw-r--r-- 1 ast 1001 Jul 14 13:53 strncpy.c.cdif X-rw-r--r-- 1 ast 1060 Jul 14 13:53 system.c.cdif X-rw-r--r-- 1 ast 3085 Jul 14 13:53 termcap.c.cdif X-rw-r--r-- 1 ast 426 Jul 14 13:53 wait.c.cdif + END-OF-FILE LISTING chmod 'u=rw,g=r,o=r' 'LISTING' set `wc -c 'LISTING'` count=$1 case $count in 877) :;; *) echo 'Bad character count in ''LISTING' >&2 echo 'Count should be 877' >&2 esac echo Extracting 'brk.c.cdif' sed 's/^X//' > 'brk.c.cdif' << '+ END-OF-FILE ''brk.c.cdif' X*** /local/ast/minix/tape3a/lib/brk.c Mon May 16 23:23:01 1988 X--- brk.c Wed Jul 13 11:55:40 1988 X*************** X*** 21,31 **** X int incr; X { X char *newsize, *oldsize; X- extern int endv, dorgv; X X oldsize = brksize; X newsize = brksize + incr; X! if (incr > 0 && newsize < oldsize) return( (char *) -1); X if (brk(newsize) == 0) X return(oldsize); X else X--- 21,31 ---- X int incr; X { X char *newsize, *oldsize; X X oldsize = brksize; X newsize = brksize + incr; X! if (incr > 0 && newsize < oldsize || incr < 0 && newsize > oldsize) X! return( (char *) -1); X if (brk(newsize) == 0) X return(oldsize); X else + END-OF-FILE brk.c.cdif chmod 'u=rw,g=r,o=r' 'brk.c.cdif' set `wc -c 'brk.c.cdif'` count=$1 case $count in 646) :;; *) echo 'Bad character count in ''brk.c.cdif' >&2 echo 'Count should be 646' >&2 esac echo Extracting 'crypt.c.cdif' sed 's/^X//' > 'crypt.c.cdif' << '+ END-OF-FILE ''crypt.c.cdif' X*** /local/ast/minix/tape3a/lib/crypt.c Mon May 16 23:23:03 1988 X--- crypt.c Wed Jul 13 11:55:42 1988 X*************** X*** 1,294 **** X! /* From Andy Tanenbaum's book "Computer Networks", X! rewritten in C X! */ X! X! struct block { X! unsigned char b_data[64]; X! }; X! X! struct ordering { X! unsigned char o_data[64]; X! }; X! X! static struct block key; X! X! static struct ordering InitialTr = { X! 58,50,42,34,26,18,10, 2,60,52,44,36,28,20,12, 4, X! 62,54,46,38,30,22,14, 6,64,56,48,40,32,24,16, 8, X! 57,49,41,33,25,17, 9, 1,59,51,43,35,27,19,11, 3, X! 61,53,45,37,29,21,13, 5,63,55,47,39,31,23,15, 7, X! }; X! X! static struct ordering FinalTr = { X! 40, 8,48,16,56,24,64,32,39, 7,47,15,55,23,63,31, X! 38, 6,46,14,54,22,62,30,37, 5,45,13,53,21,61,29, X! 36, 4,44,12,52,20,60,28,35, 3,43,11,51,19,59,27, X! 34, 2,42,10,50,18,58,26,33, 1,41, 9,49,17,57,25, X! }; X! X! static struct ordering swap = { X! 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48, X! 49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64, X! 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, X! 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32, X! }; X! X! static struct ordering KeyTr1 = { X! 57,49,41,33,25,17, 9, 1,58,50,42,34,26,18, X! 10, 2,59,51,43,35,27,19,11, 3,60,52,44,36, X! 63,55,47,39,31,23,15, 7,62,54,46,38,30,22, X! 14, 6,61,53,45,37,29,21,13, 5,28,20,12, 4, X! }; X! X! static struct ordering KeyTr2 = { X! 14,17,11,24, 1, 5, 3,28,15, 6,21,10, X! 23,19,12, 4,26, 8,16, 7,27,20,13, 2, X! 41,52,31,37,47,55,30,40,51,45,33,48, X! 44,49,39,56,34,53,46,42,50,36,29,32, X! }; X! X! static struct ordering etr = { X! 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, X! 8, 9,10,11,12,13,12,13,14,15,16,17, X! 16,17,18,19,20,21,20,21,22,23,24,25, X! 24,25,26,27,28,29,28,29,30,31,32, 1, X! }; X! X! static struct ordering ptr = { X! 16, 7,20,21,29,12,28,17, 1,15,23,26, 5,18,31,10, X! 2, 8,24,14,32,27, 3, 9,19,13,30, 6,22,11, 4,25, X! }; X! X! static unsigned char s_boxes[8][64] = { X! { 14, 4,13, 1, 2,15,11, 8, 3,10, 6,12, 5, 9, 0, 7, X! 0,15, 7, 4,14, 2,13, 1,10, 6,12,11, 9, 5, 3, 8, X! 4, 1,14, 8,13, 6, 2,11,15,12, 9, 7, 3,10, 5, 0, X! 15,12, 8, 2, 4, 9, 1, 7, 5,11, 3,14,10, 0, 6,13, X! }, X! X! { 15, 1, 8,14, 6,11, 3, 4, 9, 7, 2,13,12, 0, 5,10, X! 3,13, 4, 7,15, 2, 8,14,12, 0, 1,10, 6, 9,11, 5, X! 0,14, 7,11,10, 4,13, 1, 5, 8,12, 6, 9, 3, 2,15, X! 13, 8,10, 1, 3,15, 4, 2,11, 6, 7,12, 0, 5,14, 9, X! }, X! X! { 10, 0, 9,14, 6, 3,15, 5, 1,13,12, 7,11, 4, 2, 8, X! 13, 7, 0, 9, 3, 4, 6,10, 2, 8, 5,14,12,11,15, 1, X! 13, 6, 4, 9, 8,15, 3, 0,11, 1, 2,12, 5,10,14, 7, X! 1,10,13, 0, 6, 9, 8, 7, 4,15,14, 3,11, 5, 2,12, X! }, X! X! { 7,13,14, 3, 0, 6, 9,10, 1, 2, 8, 5,11,12, 4,15, X! 13, 8,11, 5, 6,15, 0, 3, 4, 7, 2,12, 1,10,14, 9, X! 10, 6, 9, 0,12,11, 7,13,15, 1, 3,14, 5, 2, 8, 4, X! 3,15, 0, 6,10, 1,13, 8, 9, 4, 5,11,12, 7, 2,14, X! }, X! X! { 2,12, 4, 1, 7,10,11, 6, 8, 5, 3,15,13, 0,14, 9, X! 14,11, 2,12, 4, 7,13, 1, 5, 0,15,10, 3, 9, 8, 6, X! 4, 2, 1,11,10,13, 7, 8,15, 9,12, 5, 6, 3, 0,14, X! 11, 8,12, 7, 1,14, 2,13, 6,15, 0, 9,10, 4, 5, 3, X! }, X! X! { 12, 1,10,15, 9, 2, 6, 8, 0,13, 3, 4,14, 7, 5,11, X! 10,15, 4, 2, 7,12, 9, 5, 6, 1,13,14, 0,11, 3, 8, X! 9,14,15, 5, 2, 8,12, 3, 7, 0, 4,10, 1,13,11, 6, X! 4, 3, 2,12, 9, 5,15,10,11,14, 1, 7, 6, 0, 8,13, X! }, X! X! { 4,11, 2,14,15, 0, 8,13, 3,12, 9, 7, 5,10, 6, 1, X! 13, 0,11, 7, 4, 9, 1,10,14, 3, 5,12, 2,15, 8, 6, X! 1, 4,11,13,12, 3, 7,14,10,15, 6, 8, 0, 5, 9, 2, X! 6,11,13, 8, 1, 4,10, 7, 9, 5, 0,15,14, 2, 3,12, X! }, X! X! { 13, 2, 8, 4, 6,15,11, 1,10, 9, 3,14, 5, 0,12, 7, X! 1,15,13, 8,10, 3, 7, 4,12, 5, 6,11, 0,14, 9, 2, X! 7,11, 4, 1, 9,12,14, 2, 0, 6,10,13,15, 3, 5, 8, X! 2, 1,14, 7, 4,10, 8,13,15,12, 9, 0, 3, 5, 6,11, X! }, X! }; X! X! static int rots[] = { X! 1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1, X! }; X! X! static X! transpose(data, t, n) X! register struct block *data; X! register struct ordering *t; X! register int n; X { X! struct block x; X! X! x = *data; X! X! while (n-- > 0) { X! data->b_data[n] = x.b_data[t->o_data[n] - 1]; X! } X! } X! X! static X! rotate(key) X! register struct block *key; X! { X! register unsigned char *p = key->b_data; X! register unsigned char *ep = &(key->b_data[55]); X! int data0 = key->b_data[0], data28 = key->b_data[28]; X! X! while (p++ < ep) *(p-1) = *p; X! key->b_data[27] = data0; X! key->b_data[55] = data28; X! } X! X! static struct ordering *EP = &etr; X! X! static X! f(i, key, a, x) X! struct block *key, *a; X! register struct block *x; X! { X! struct block e, ikey, y; X! int k; X! register unsigned char *p, *q, *r; X! X! e = *a; X! transpose(&e, EP, 48); X! for (k = rots[i]; k; k--) rotate(key); X! ikey = *key; X! transpose(&ikey, &KeyTr2, 48); X! p = &(y.b_data[48]); X! q = &(e.b_data[48]); X! r = &(ikey.b_data[48]); X! while (p > y.b_data) { X! *--p = *--q ^ *--r; X! } X! q = x->b_data; X! for (k = 0; k < 8; k++) { X! register int xb, r; X! X! r = *p++ << 5; X! r += *p++ << 3; X! r += *p++ << 2; X! r += *p++ << 1; X! r += *p++; X! r += *p++ << 4; X! X! xb = s_boxes[k][r]; X! X! *q++ = (xb >> 3) & 1; X! *q++ = (xb>>2) & 1; X! *q++ = (xb>>1) & 1; X! *q++ = (xb & 1); X! } X! transpose(x, &ptr, 32); X! } X! X! setkey(k) X! register char *k; X! { X! X! key = *((struct block *) k); X! transpose(&key, &KeyTr1, 56); X! } X! X! encrypt(blck, edflag) X! char *blck; X! { X! register struct block *p = (struct block *) blck; X register int i; X X! transpose(p, &InitialTr, 64); X! for (i = 15; i>= 0; i--) { X! int j = edflag ? i : 15 - i; X! register int k; X! struct block b, x; X! X! b = *p; X! for (k = 31; k >= 0; k--) { X! p->b_data[k] = b.b_data[k + 32]; X! } X! f(j, &key, p, &x); X! for (k = 31; k >= 0; k--) { X! p->b_data[k+32] = b.b_data[k] ^ x.b_data[k]; X! } X! } X! transpose(p, &swap, 64); X! transpose(p, &FinalTr, 64); X! } X! X! char * X! crypt(pw,salt) X! register char *pw; X! char *salt; X! { X! /* Unfortunately, I had to look at the sources of V7 crypt. X! There was no other way to find out what this routine X! actually does. X! */ X! X! char pwb[66]; X! static char result[16]; X! register char *p = pwb; X! struct ordering new_etr; X! register int i; X! X! while (*pw && p < &pwb[64]) { X! register int j = 7; X! X! while (j--) { X! *p++ = (*pw >> j) & 01; X! } X pw++; X- *p++ = 0; X } X! while (p < &pwb[64]) *p++ = 0; X! X! setkey(p = pwb); X! X! while (p < &pwb[66]) *p++ = 0; X! X! new_etr = etr; X! EP = &new_etr; X! for (i = 0; i < 2; i++) { X! register char c = *salt++; X! register int j; X! X! result[i] = c; X! if ( c > 'Z') c -= 6 + 7 + '.'; /* c was a lower case letter */ X! else if ( c > '9') c -= 7 + '.';/* c was upper case letter */ X! else c -= '.'; /* c was digit, '.' or '/'. */ X! /* now, 0 <= c <= 63 */ X! for (j = 0; j < 6; j++) { X! if ((c >> j) & 01) { X! int t = 6*i + j; X! int temp = new_etr.o_data[t]; X! new_etr.o_data[t] = new_etr.o_data[t+24]; X! new_etr.o_data[t+24] = temp; X! } X! } X } X! X! if (result[1] == 0) result[1] = result[0]; X! X! for (i = 0; i < 25; i++) encrypt(pwb,0); X! EP = &etr; X! X! p = pwb; X! pw = result+2; X! while (p < &pwb[66]) { X! register int c = 0; X! register int j = 6; X! X! while (j--) { X! c <<= 1; X! c |= *p++; X! } X! c += '.'; /* becomes >= '.' */ X! if (c > '9') c += 7; /* not in [./0-9], becomes upper */ X! if (c > 'Z') c += 6; /* not in [A-Z], becomes lower */ X! *pw++ = c; X } X! *pw = 0; X! return result; X } X--- 1,40 ---- X! char *crypt(pw, salt) X! char *pw, *salt; X { X! static char buf[14]; X! register char bits[67]; X register int i; X+ register int j, rot; X X! for (i=0; i < 67; i++) X! bits[i] = 0; X! if (salt[1] == 0) X! salt[1] = salt[0]; X! rot = (salt[1] * 4 - salt[0]) % 128; X! for (i=0; *pw && i < 8; i++) { X! for (j=0; j < 7; j++) X! bits[i+j*8] = (*pw & (1 << j) ? 1 : 0); X! bits[i+56] = (salt[i / 4] & (1 << (i % 4)) ? 1 : 0); X pw++; X } X! bits[64] = (salt[0] & 1 ? 1 : 0); X! bits[65] = (salt[1] & 1 ? 1 : 0); X! bits[66] = (rot & 1 ? 1 : 0); X! while (rot--) { X! for (i=65; i >= 0; i--) X! bits[i+1] = bits[i]; X! bits[0] = bits[66]; X } X! for (i=0; i < 12; i++) { X! buf[i+2] = 0; X! for (j=0; j < 6; j++) X! buf[i+2] |= (bits[i*6+j] ? (1 << j) : 0); X! buf[i+2] += 48; X! if (buf[i+2] > '9') buf[i+2] += 7; X! if (buf[i+2] > 'Z') buf[i+2] += 6; X } X! buf[0] = salt[0]; X! buf[1] = salt[1]; X! buf[13] = '\0'; X! return(buf); X } + END-OF-FILE crypt.c.cdif chmod 'u=rw,g=r,o=r' 'crypt.c.cdif' set `wc -c 'crypt.c.cdif'` count=$1 case $count in 8357) :;; *) echo 'Bad character count in ''crypt.c.cdif' >&2 echo 'Count should be 8357' >&2 esac echo Extracting 'ctime.c.cdif' sed 's/^X//' > 'ctime.c.cdif' << '+ END-OF-FILE ''ctime.c.cdif' X*** /local/ast/minix/tape3a/lib/ctime.c Mon May 16 23:23:03 1988 X--- ctime.c Wed Jul 13 11:55:43 1988 X*************** X*** 8,27 **** X "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" X }; X static char *days[] = { X! "Thu", "Fri", "Sat", "Sun", "Mon", "Tue", "Wed" X }; X X! #define MIN 60L X! #define HOUR (60 * MIN) X! #define DAY (24 * HOUR) X! #define YEAR (365 * DAY) X X! char * X! ctime(pt) X long *pt; X { X- struct tm tm; X- static char buf[26]; X register long t = *pt; X X tm.tm_year = 0; X--- 8,38 ---- X "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" X }; X static char *days[] = { X! "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" X }; X X! /* To compute which date falls on which day of the week, we need to know the X! * day of the week corresponding to Jan 1 of each year 1970 - 1999. The table X! * newyear[] gives this, with 0 = Mon, 1 = Tue, 2 = Wed, ..., 6 = Sun. After X! * Jan 1, 2000 this program will screw up. It probably won't be the only one. X! */ X! static int newyear[] = { X! 3, 4, 5, 0, 1, 2, 3, 5, 6, 0, /* 1970 - 1979 */ X! 1, 3, 4, 5, 6, 1, 2, 3, 4, 6, /* 1980 - 1989 */ X! 0, 1, 2, 4, 5, 6, 0, 2, 3, 4 /* 1990 - 1999 */ X! }; X X! #define MIN 60L /* # seconds in a minute */ X! #define HOUR (60 * MIN) /* # seconds in an hour */ X! #define DAY (24 * HOUR) /* # seconds in a day */ X! #define YEAR (365 * DAY) /* # seconds in a year */ X! X! static struct tm tm; X! static char buf[26]; X! X! char *ctime(pt) X long *pt; X { X register long t = *pt; X X tm.tm_year = 0; X*************** X*** 30,62 **** X tm.tm_hour = 0; X tm.tm_min = 0; X tm.tm_sec = 0; X! while (t >= YEAR) { X if ((tm.tm_year % 4) == 2) X t -= DAY; X tm.tm_year += 1; X t -= YEAR; X } X tm.tm_year += 1970; X days_per_month[1] = 28; X! if ((tm.tm_year % 4) == 0) X days_per_month[1]++; X while (t >= (days_per_month[tm.tm_mon] * DAY)) X t -= days_per_month[tm.tm_mon++] * DAY; X while (t >= DAY) { X t -= DAY; X tm.tm_mday++; X } X while (t >= HOUR) { X t -= HOUR; X tm.tm_hour++; X } X while (t >= MIN) { X t -= MIN; X tm.tm_min++; X } X tm.tm_sec = (int) t; X sprintf(buf, "%s %s %2d %02d:%02d:%02d %d\n", X! days[(t / DAY) % 7], months[tm.tm_mon], X tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_year); X return buf; X } X--- 41,111 ---- X tm.tm_hour = 0; X tm.tm_min = 0; X tm.tm_sec = 0; X! X! /* t is elapsed time in seconds since Jan 1, 1970. */ X! while (t >= YEAR) { /* how many years can we subtract from t? */ X if ((tm.tm_year % 4) == 2) X+ { X+ if ( t < YEAR + DAY ) X+ break; X t -= DAY; X+ } X tm.tm_year += 1; X t -= YEAR; X } X tm.tm_year += 1970; X+ X+ /* t is now the offset into the current year, in seconds. */ X+ tm.tm_yday = (t/DAY); /* day # of the year, Jan 1 = 0 */ X+ tm.tm_wday = ((newyear[tm.tm_year - 1970] + tm.tm_yday - 1) % 7) + 1; X+ X days_per_month[1] = 28; X! if ((tm.tm_year % 4) == 0) /* check for leap year */ X days_per_month[1]++; X+ X+ /* Compute month. */ X while (t >= (days_per_month[tm.tm_mon] * DAY)) X t -= days_per_month[tm.tm_mon++] * DAY; X+ tm.tm_mon++; /* Jan is month 1, not month 0 */ X+ X+ /* Month established, now compute day of the month */ X while (t >= DAY) { X t -= DAY; X tm.tm_mday++; X } X+ X+ /* Day established, now do hour. */ X while (t >= HOUR) { X t -= HOUR; X tm.tm_hour++; X } X+ X+ /* Hour established, now do minute. */ X while (t >= MIN) { X t -= MIN; X tm.tm_min++; X } X+ X+ /* Residual time is # seconds. */ X tm.tm_sec = (int) t; X+ X+ /* Generate output in ASCII in buf. */ X sprintf(buf, "%s %s %2d %02d:%02d:%02d %d\n", X! days[tm.tm_wday - 1], months[tm.tm_mon-1], X tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_year); X return buf; X+ } X+ X+ struct tm *localtime(pt) X+ long *pt; X+ { X+ ctime(pt); X+ return &tm; X+ } X+ X+ struct tm *gmtime(pt) X+ long *pt; X+ { X+ ctime(pt); X+ return &tm; X } + END-OF-FILE ctime.c.cdif chmod 'u=rw,g=r,o=r' 'ctime.c.cdif' set `wc -c 'ctime.c.cdif'` count=$1 case $count in 3882) :;; *) echo 'Bad character count in ''ctime.c.cdif' >&2 echo 'Count should be 3882' >&2 esac echo Extracting 'fopen.c.cdif' sed 's/^X//' > 'fopen.c.cdif' << '+ END-OF-FILE ''fopen.c.cdif' X*** /local/ast/minix/tape3a/lib/fopen.c Mon May 16 23:23:06 1988 X--- fopen.c Wed Jul 13 11:55:45 1988 X*************** X*** 1,4 **** X--- 1,6 ---- X #include <stdio.h> X+ #include <errno.h> X+ #include "lib.h" X X #define PMODE 0666 X + END-OF-FILE fopen.c.cdif chmod 'u=rw,g=r,o=r' 'fopen.c.cdif' set `wc -c 'fopen.c.cdif'` count=$1 case $count in 236) :;; *) echo 'Bad character count in ''fopen.c.cdif' >&2 echo 'Count should be 236' >&2 esac echo Extracting 'fseek.c.cdif' sed 's/^X//' > 'fseek.c.cdif' << '+ END-OF-FILE ''fseek.c.cdif' X*** /local/ast/minix/tape3a/lib/fseek.c Mon May 16 23:23:07 1988 X--- fseek.c Wed Jul 13 11:55:46 1988 X*************** X*** 7,13 **** X { X int count; X long lseek(); X! long pos; X X iop->_flags &= ~(_EOF | _ERR); X /* Clear both the end of file and error flags */ X--- 7,13 ---- X { X int count; X long lseek(); X! long pos = -1L; X X iop->_flags &= ~(_EOF | _ERR); X /* Clear both the end of file and error flags */ X*************** X*** 17,33 **** X count = iop->_count; X pos = offset; X X! if ( where == 0 ) X! pos += count - lseek(fileno(iop), 0L, 1); X else X! offset -= count; X X! if ( count > 0 && pos <= count X! && pos >= iop->_buf - iop->_ptr ) { X iop->_ptr += (int) pos; X iop->_count -= (int) pos; X return(0); X } X } X pos = lseek(fileno(iop), offset, where); X iop->_count = 0; X--- 17,39 ---- X count = iop->_count; X pos = offset; X X! if ( where == 0 ) { X! long L_tmp = lseek(fileno(iop), 0L, 1); X! /* determine where we are */ X! X! pos += (long) count - L_tmp; X! } X else X! offset -= (long) count; X X! if ( count > 0 && pos <= (long) count X! && pos >= (long) iop->_buf - (long) iop->_ptr ) { X iop->_ptr += (int) pos; X iop->_count -= (int) pos; X return(0); X } X+ if (where == 1) X+ offset += (long) count; /* restore offset */ X } X pos = lseek(fileno(iop), offset, where); X iop->_count = 0; X*************** X*** 35,39 **** X fflush(iop); X pos = lseek(fileno(iop), offset, where); X } X! return((pos == -1) ? -1 : 0 ); X } X--- 41,45 ---- X fflush(iop); X pos = lseek(fileno(iop), offset, where); X } X! return((pos == -1L) ? -1 : 0 ); X } + END-OF-FILE fseek.c.cdif chmod 'u=rw,g=r,o=r' 'fseek.c.cdif' set `wc -c 'fseek.c.cdif'` count=$1 case $count in 1718) :;; *) echo 'Bad character count in ''fseek.c.cdif' >&2 echo 'Count should be 1718' >&2 esac echo Extracting 'getc.c.cdif' sed 's/^X//' > 'getc.c.cdif' << '+ END-OF-FILE ''getc.c.cdif' X*** /local/ast/minix/tape3a/lib/getc.c Mon May 16 23:23:08 1988 X--- getc.c Wed Jul 13 11:55:47 1988 X*************** X*** 32,40 **** X iop->_ptr = iop->_buf; X } X X if (testflag(iop,UNBUFF)) X return (ch & CMASK); X else X! return (--iop->_count, *iop->_ptr++ & CMASK); X } X X--- 32,41 ---- X iop->_ptr = iop->_buf; X } X X+ iop->_count--; /* account one char */ X if (testflag(iop,UNBUFF)) X return (ch & CMASK); X else X! return (*iop->_ptr++ & CMASK); X } X + END-OF-FILE getc.c.cdif chmod 'u=rw,g=r,o=r' 'getc.c.cdif' set `wc -c 'getc.c.cdif'` count=$1 case $count in 483) :;; *) echo 'Bad character count in ''getc.c.cdif' >&2 echo 'Count should be 483' >&2 esac echo Extracting 'getenv.c.cdif' sed 's/^X//' > 'getenv.c.cdif' << '+ END-OF-FILE ''getenv.c.cdif' X*** /local/ast/minix/tape3a/lib/getenv.c Mon May 16 23:23:09 1988 X--- getenv.c Wed Jul 13 11:55:48 1988 X*************** X*** 1,14 **** X char *getenv(name) X register char *name; X { X extern char **environ; X register char **v = environ, *p, *q; X X! while ((p = *v++) != 0) { X! q = name; X! while (*q && *q++ == *p++) /* nothing */ ; X! if (*q || *p != '=') continue; X! return(p+1); X } X return(0); X } X--- 1,21 ---- X+ #define NULL (char *) 0 X+ X char *getenv(name) X register char *name; X { X extern char **environ; X register char **v = environ, *p, *q; X X! if (v && name) { /* added if statement */ X! while ((p = *v++) != NULL) { /* was, while((p = *v) != NULL */ X! q = name; X! while (*p++ == *q) X! if (*q++ == 0) X! continue; X! if (*(p - 1) != '=') X! continue; X! return(p); X! } X } X return(0); X } + END-OF-FILE getenv.c.cdif chmod 'u=rw,g=r,o=r' 'getenv.c.cdif' set `wc -c 'getenv.c.cdif'` count=$1 case $count in 854) :;; *) echo 'Bad character count in ''getenv.c.cdif' >&2 echo 'Count should be 854' >&2 esac echo Extracting 'ioctl.c.cdif' sed 's/^X//' > 'ioctl.c.cdif' << '+ END-OF-FILE ''ioctl.c.cdif' X*** /local/ast/minix/tape3a/lib/ioctl.c Mon Jun 27 23:07:47 1988 X--- ioctl.c Wed Jul 13 11:55:51 1988 X*************** X*** 11,26 **** X } u; X X { X! int n; X! long erase, kill, intr, quit, xon, xoff, eof, brk; X X M.TTY_REQUEST = request; X M.TTY_LINE = fd; X X switch(request) { X case TIOCSETP: X! erase = u.argp->sg_erase & 0377; X! kill = u.argp->sg_kill & 0377; X M.TTY_SPEK = (erase << 8) | kill; X M.TTY_FLAGS = u.argp->sg_flags; X M.TTY_SPEED = (u.argp->sg_ospeed << 8) | u.argp->sg_ispeed; X--- 11,26 ---- X } u; X X { X! int n, ispeed, ospeed; X! long erase, kill, intr, quit, xon, xoff, eof, brk, speed; X X M.TTY_REQUEST = request; X M.TTY_LINE = fd; X X switch(request) { X case TIOCSETP: X! erase = u.argp->sg_erase & BYTE; X! kill = u.argp->sg_kill & BYTE; X M.TTY_SPEK = (erase << 8) | kill; X M.TTY_FLAGS = u.argp->sg_flags; X M.TTY_SPEED = (u.argp->sg_ospeed << 8) | u.argp->sg_ispeed; X*************** X*** 28,39 **** X return(n); X X case TIOCSETC: X! intr = u.argt->t_intrc & 0377; X! quit = u.argt->t_quitc & 0377; X! xon = u.argt->t_startc & 0377; X! xoff = u.argt->t_stopc & 0377; X! eof = u.argt->t_eofc & 0377; X! brk = u.argt->t_brkc & 0377; /* not used at the moment */ X M.TTY_SPEK = (intr<<24) | (quit<<16) | (xon<<8) | (xoff<<0); X M.TTY_FLAGS = (eof<<8) | (brk<<0); X n = callx(FS, IOCTL); X--- 28,39 ---- X return(n); X X case TIOCSETC: X! intr = u.argt->t_intrc & BYTE; X! quit = u.argt->t_quitc & BYTE; X! xon = u.argt->t_startc & BYTE; X! xoff = u.argt->t_stopc & BYTE; X! eof = u.argt->t_eofc & BYTE; X! brk = u.argt->t_brkc & BYTE; /* not used at the moment */ X M.TTY_SPEK = (intr<<24) | (quit<<16) | (xon<<8) | (xoff<<0); X M.TTY_FLAGS = (eof<<8) | (brk<<0); X n = callx(FS, IOCTL); X*************** X*** 41,59 **** X X case TIOCGETP: X n = callx(FS, IOCTL); X! u.argp->sg_erase = (M.TTY_SPEK >> 8) & 0377; X! u.argp->sg_kill = (M.TTY_SPEK >> 0) & 0377; X! u.argp->sg_flags = M.TTY_FLAGS; X return(n); X X case TIOCGETC: X n = callx(FS, IOCTL); X! u.argt->t_intrc = (M.TTY_SPEK >> 24) & 0377; X! u.argt->t_quitc = (M.TTY_SPEK >> 16) & 0377; X! u.argt->t_startc = (M.TTY_SPEK >> 8) & 0377; X! u.argt->t_stopc = (M.TTY_SPEK >> 0) & 0377; X! u.argt->t_eofc = (M.TTY_FLAGS >> 8) & 0377; X! u.argt->t_brkc = (M.TTY_FLAGS >> 8) & 0377; X return(n); X X default: X--- 41,62 ---- X X case TIOCGETP: X n = callx(FS, IOCTL); X! u.argp->sg_erase = (M.TTY_SPEK >> 8) & BYTE; X! u.argp->sg_kill = (M.TTY_SPEK >> 0) & BYTE; X! u.argp->sg_flags = M.TTY_FLAGS & 0xFFFF; X! speed = (M.TTY_FLAGS >> 16) & 0xFFFFL; X! u.argp->sg_ispeed = speed & BYTE; X! u.argp->sg_ospeed = (speed >> 8) & BYTE; X return(n); X X case TIOCGETC: X n = callx(FS, IOCTL); X! u.argt->t_intrc = (M.TTY_SPEK >> 24) & BYTE; X! u.argt->t_quitc = (M.TTY_SPEK >> 16) & BYTE; X! u.argt->t_startc = (M.TTY_SPEK >> 8) & BYTE; X! u.argt->t_stopc = (M.TTY_SPEK >> 0) & BYTE; X! u.argt->t_eofc = (M.TTY_FLAGS >> 8) & BYTE; X! u.argt->t_brkc = (M.TTY_FLAGS >> 8) & BYTE; X return(n); X X default: + END-OF-FILE ioctl.c.cdif chmod 'u=rw,g=r,o=r' 'ioctl.c.cdif' set `wc -c 'ioctl.c.cdif'` count=$1 case $count in 3199) :;; *) echo 'Bad character count in ''ioctl.c.cdif' >&2 echo 'Count should be 3199' >&2 esac echo Extracting 'malloc.c.cdif' sed 's/^X//' > 'malloc.c.cdif' << '+ END-OF-FILE ''malloc.c.cdif' X*** /local/ast/minix/tape3a/lib/malloc.c Mon May 16 23:23:15 1988 X--- malloc.c Wed Jul 13 11:55:54 1988 X*************** X*** 28,58 **** X * An area returned by malloc() is called a slot. Each slot X * contains the number of bytes requested, but preceeded by X * an extra pointer to the next the slot in memory. X! * 'bottom' and 'top' point to the first/last slot. X * More memory is asked for using brk() and appended to top. X * The list of free slots is maintained to keep malloc() fast. X! * 'empty' points the the first free slot. Free slots are X * linked together by a pointer at the start of the X * user visable part, so just after the next-slot pointer. X * Free slots are merged together by free(). X */ X X extern char *sbrk(), *brk(); X! static char *bottom, *top, *empty; X X static grow(len) X unsigned len; X { X register char *p; X X! ASSERT(NextSlot(top) == 0); X! p = (char *) Align((ptrint)top + len, BRKSIZE); X! if (p < top || brk(p) != 0) X return(0); X! NextSlot(top) = p; X NextSlot(p) = 0; X! free(top); X! top = p; X return(1); X } X X--- 28,58 ---- X * An area returned by malloc() is called a slot. Each slot X * contains the number of bytes requested, but preceeded by X * an extra pointer to the next the slot in memory. X! * '_bottom' and '_top' point to the first/last slot. X * More memory is asked for using brk() and appended to top. X * The list of free slots is maintained to keep malloc() fast. X! * '_empty' points the the first free slot. Free slots are X * linked together by a pointer at the start of the X * user visable part, so just after the next-slot pointer. X * Free slots are merged together by free(). X */ X X extern char *sbrk(), *brk(); X! static char *_bottom, *_top, *_empty; X X static grow(len) X unsigned len; X { X register char *p; X X! ASSERT(NextSlot(_top) == 0); X! p = (char *) Align((ptrint)_top + len, BRKSIZE); X! if (p < _top || brk(p) != 0) X return(0); X! NextSlot(_top) = p; X NextSlot(p) = 0; X! free(_top); X! _top = p; X return(1); X } X X*************** X*** 66,84 **** X size = PTRSIZE; /* avoid slots less that 2*PTRSIZE */ X for (ntries = 0; ntries < 2; ntries++) { X len = Align(size, PTRSIZE) + PTRSIZE; X! if (bottom == 0) { X p = sbrk(2 * PTRSIZE); X p = (char *) Align((ptrint)p, PTRSIZE); X p += PTRSIZE; X! top = bottom = p; X NextSlot(p) = 0; X } X #ifdef SLOWDEBUG X! for (p = bottom; (next = NextSlot(p)) != 0; p = next) X ASSERT(next > p); X! ASSERT(p == top); X #endif X! for (prev = 0, p = empty; p != 0; prev = p, p = NextFree(p)) { X next = NextSlot(p); X new = p + len; X if (new > next) X--- 66,84 ---- X size = PTRSIZE; /* avoid slots less that 2*PTRSIZE */ X for (ntries = 0; ntries < 2; ntries++) { X len = Align(size, PTRSIZE) + PTRSIZE; X! if (_bottom == 0) { X p = sbrk(2 * PTRSIZE); X p = (char *) Align((ptrint)p, PTRSIZE); X p += PTRSIZE; X! _top = _bottom = p; X NextSlot(p) = 0; X } X #ifdef SLOWDEBUG X! for (p = _bottom; (next = NextSlot(p)) != 0; p = next) X ASSERT(next > p); X! ASSERT(p == _top); X #endif X! for (prev = 0, p = _empty; p != 0; prev = p, p = NextFree(p)) { X next = NextSlot(p); X new = p + len; X if (new > next) X*************** X*** 93,99 **** X if (prev) X NextFree(prev) = NextFree(p); X else X! empty = NextFree(p); X return(p); X } X if (grow(len) == 0) X--- 93,99 ---- X if (prev) X NextFree(prev) = NextFree(p); X else X! _empty = NextFree(p); X return(p); X } X if (grow(len) == 0) X*************** X*** 116,122 **** X /* X * extend old if there is any free space just behind it X */ X! for (prev = 0, p = empty; p != 0; prev = p, p = NextFree(p)) { X if (p > next) X break; X if (p == next) { /* 'next' is a free slot: merge */ X--- 116,122 ---- X /* X * extend old if there is any free space just behind it X */ X! for (prev = 0, p = _empty; p != 0; prev = p, p = NextFree(p)) { X if (p > next) X break; X if (p == next) { /* 'next' is a free slot: merge */ X*************** X*** 124,130 **** X if (prev) X NextFree(prev) = NextFree(p); X else X! empty = NextFree(p); X next = NextSlot(old); X break; X } X--- 124,130 ---- X if (prev) X NextFree(prev) = NextFree(p); X else X! _empty = NextFree(p); X next = NextSlot(old); X break; X } X*************** X*** 177,190 **** X register char *prev, *next; X X ASSERT(NextSlot(p) > p); X! for (prev = 0, next = empty; next != 0; prev = next, next = NextFree(next)) X if (p < next) X break; X NextFree(p) = next; X if (prev) X NextFree(prev) = p; X else X! empty = p; X if (next) { X ASSERT(NextSlot(p) <= next); X if (NextSlot(p) == next) { /* merge p and next */ X--- 177,190 ---- X register char *prev, *next; X X ASSERT(NextSlot(p) > p); X! for (prev = 0, next = _empty; next != 0; prev = next, next = NextFree(next)) X if (p < next) X break; X NextFree(p) = next; X if (prev) X NextFree(prev) = p; X else X! _empty = p; X if (next) { X ASSERT(NextSlot(p) <= next); X if (NextSlot(p) == next) { /* merge p and next */ + END-OF-FILE malloc.c.cdif chmod 'u=rw,g=r,o=r' 'malloc.c.cdif' set `wc -c 'malloc.c.cdif'` count=$1 case $count in 5107) :;; *) echo 'Bad character count in ''malloc.c.cdif' >&2 echo 'Count should be 5107' >&2 esac echo Extracting 'strncat.c.cdif' sed 's/^X//' > 'strncat.c.cdif' << '+ END-OF-FILE ''strncat.c.cdif' X*** /local/ast/minix/tape3a/lib/strncat.c Mon May 16 23:23:24 1988 X--- strncat.c Wed Jul 13 11:56:04 1988 X*************** X*** 1,21 **** X! char *strncat(s1, s2, n) X! register char *s1, *s2; X int n; X { X! /* Append s2 to the end of s1, but no more than n characters */ X X! char *original = s1; X! X! if (n == 0) return(s1); X! X! /* Find the end of s1. */ X! while (*s1 != 0) s1++; X! X! /* Now copy s2 to the end of s1. */ X! while (*s2 != 0) { X! *s1++ = *s2++; X! if (--n == 0) break; X } X! *s1 = 0; X! return(original); X } X--- 1,29 ---- X! /* X! strncat.c - char *strncat( char *s1, char *s2, int n ) X! X! Strncat appends up to n characters from s2 to the end of s1. X! It returns s1. X! */ X! X! char *strncat( s1, s2, n ) X! char *s1; X! register char *s2; X int n; X { X! register char *rs1; X X! rs1 = s1; X! if ( n > 0 ) X! { X! while ( *rs1++ != 0 ) X! ; X! --rs1; X! while ( (*rs1++ = *s2++) != 0 ) X! if ( --n == 0 ) X! { X! *rs1 = 0; X! break; X! } X } X! return s1; X } + END-OF-FILE strncat.c.cdif chmod 'u=rw,g=r,o=r' 'strncat.c.cdif' set `wc -c 'strncat.c.cdif'` count=$1 case $count in 1054) :;; *) echo 'Bad character count in ''strncat.c.cdif' >&2 echo 'Count should be 1054' >&2 esac echo Extracting 'strncmp.c.cdif' sed 's/^X//' > 'strncmp.c.cdif' << '+ END-OF-FILE ''strncmp.c.cdif' X*** /local/ast/minix/tape3a/lib/strncmp.c Mon May 16 23:23:25 1988 X--- strncmp.c Wed Jul 13 11:56:05 1988 X*************** X*** 1,13 **** X! int strncmp(s1, s2, n) X! register char *s1, *s2; X int n; X { X! /* Compare two strings, but at most n characters. */ X! X! while (1) { X! if (*s1 != *s2) return(*s1 - *s2); X! if (*s1 == 0 || --n == 0) return(0); X! s1++; X! s2++; X! } X } X--- 1,23 ---- X! /* X! strncmp.c - int strncmp( char *s1, char *s2, int n ) X! X! Strcmp compares s1 to s2, up to at most n characters X! (lexicographically with native character comparison). X! It returns X! positive if s1 > s2 X! zero if s1 = s2 X! negative if s1 < s2. X! */ X! X! int strncmp( s1, s2, n ) X! register char *s1; X! register char *s2; X int n; X { X! if ( n <= 0 ) X! return 0; X! while ( *s1++ == *s2++ ) X! if ( s1[-1] == 0 || --n == 0 ) X! return 0; X! return s1[-1] - s2[-1]; X } + END-OF-FILE strncmp.c.cdif chmod 'u=rw,g=r,o=r' 'strncmp.c.cdif' set `wc -c 'strncmp.c.cdif'` count=$1 case $count in 926) :;; *) echo 'Bad character count in ''strncmp.c.cdif' >&2 echo 'Count should be 926' >&2 esac echo Extracting 'strncpy.c.cdif' sed 's/^X//' > 'strncpy.c.cdif' << '+ END-OF-FILE ''strncpy.c.cdif' X*** /local/ast/minix/tape3a/lib/strncpy.c Mon May 16 23:23:25 1988 X--- strncpy.c Wed Jul 13 11:56:05 1988 X*************** X*** 1,15 **** X! char *strncpy(s1, s2, n) X! register char *s1, *s2; X int n; X { X! /* Copy s2 to s1, but at most n characters. */ X X! char *original = s1; X! X! while (*s2 != 0) { X! *s1++ = *s2++; X! if (--n == 0) break; X } X! *s1 = 0; X! return(original); X } X--- 1,27 ---- X! /* X! strncpy.c - char *strncpy( char *s1, char *s2, int n ) X! X! Strncpy writes exactly n (or 0 if n < 0) characters to s1. X! It copies up to n characters from s2, and null-pads the rest. X! The result is null terminated iff strlen( s2 ) < n. X! It returns the target string. X! */ X! X! char *strncpy( s1, s2, n ) X! char *s1; X! register char *s2; X int n; X { X! register char *rs1; X X! rs1 = s1; X! if ( n > 0 ) X! { X! while ( (*rs1++ = *s2++) != 0 && --n != 0 ) X! ; X! if ( n != 0 ) X! while ( --n != 0 ) X! *rs1++ = 0; X } X! return s1; X } + END-OF-FILE strncpy.c.cdif chmod 'u=rw,g=r,o=r' 'strncpy.c.cdif' set `wc -c 'strncpy.c.cdif'` count=$1 case $count in 1001) :;; *) echo 'Bad character count in ''strncpy.c.cdif' >&2 echo 'Count should be 1001' >&2 esac echo Extracting 'system.c.cdif' sed 's/^X//' > 'system.c.cdif' << '+ END-OF-FILE ''system.c.cdif' X*** /local/ast/minix/tape3a/lib/system.c Mon May 16 23:23:26 1988 X--- system.c Wed Jul 13 11:56:06 1988 X*************** X*** 1,25 **** X! #include <stdio.h> X X! #ifndef NIL X! #define NIL 0 X! #endif X! X! X! system( cmd ) X char *cmd; X { X int retstat, procid, waitstat; X X! if( (procid = fork()) == 0 ) X! { X! execl( "/bin/sh", "sh", "-c", cmd, NIL ); X exit( 127 ); X } X X! while( (waitstat = wait(&retstat)) != procid && waitstat != -1 ) X! ; X! if (waitstat == -1) X! retstat = -1; X X! return( retstat ); X } X--- 1,20 ---- X! #include <stdio.h> X X! system(cmd) X char *cmd; X { X int retstat, procid, waitstat; X X! if ( (procid = fork()) == 0) { X! /* Child does an exec of the command. */ X! execl( "/bin/sh", "sh", "-c", cmd, 0 ); X exit( 127 ); X } X X! /* Check to see if fork failed. */ X! if (procid < 0) exit(1); X X! while ( (waitstat = wait(&retstat)) != procid && waitstat != -1 ) ; X! if (waitstat == -1) retstat = -1; X! return(retstat); X } + END-OF-FILE system.c.cdif chmod 'u=rw,g=r,o=r' 'system.c.cdif' set `wc -c 'system.c.cdif'` count=$1 case $count in 1060) :;; *) echo 'Bad character count in ''system.c.cdif' >&2 echo 'Count should be 1060' >&2 esac echo Extracting 'termcap.c.cdif' sed 's/^X//' > 'termcap.c.cdif' << '+ END-OF-FILE ''termcap.c.cdif' X*** /local/ast/minix/tape3a/lib/termcap.c Mon May 16 23:23:27 1988 X--- termcap.c Wed Jul 13 11:56:07 1988 X*************** X*** 7,12 **** X--- 7,20 ---- X * X * A public domain implementation of the termcap(3) routines. X */ X+ X+ /* efth 1988-Apr-29 X+ X+ - Correct when TERM != name and TERMCAP is defined [tgetent] X+ - Correct the comparison for the terminal name [tgetent] X+ - Correct the value of ^x escapes [tgetstr] X+ */ X+ X #include <stdio.h> X X #define CAPABLEN 2 X*************** X*** 14,24 **** X #define ISSPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n') X #define ISDIGIT(x) ((x) >= '0' && (x) <= '9') X X- extern short ospeed; /* output speed */ X- extern char PC; /* padding character */ X- extern char *BC; /* back cursor movement */ X- extern char *UP; /* up cursor movement */ X- X char *capab; /* the capability itself */ X int incr; /* set by %i flag */ X X--- 22,27 ---- X*************** X*** 41,65 **** X short len = strlen(name); X X capab = bp; X! if ((file = getenv("TERMCAP")) != (char *) NULL) { X! if (*file != '/' && X! (cp = getenv("TERM")) != NULL && strcmp(name, cp) == 0) { X! (void) strcpy(bp, file); X! return(1); X! } X! } else X file = "/etc/termcap"; X if ((fp = fopen(file, "r")) == (FILE *) NULL) X return(-1); X while (fgets(bp, 1024, fp) != NULL) { X /* skip V6 two letter name */ X for (cp = bp ; *cp != '|' ; cp++) X ; X for (++cp ; ISSPACE(*cp) ; cp++) X ; X! if (strncmp(name, cp, len) == 0) { X! while (*(cp = &bp[strlen(bp) - 2]) == '\\') X! fgets(cp, 1024, fp); X fclose(fp); X return(1); X } X--- 44,79 ---- X short len = strlen(name); X X capab = bp; X! X! /* Fixed problem: If TERM != name and TERMCAP was defined, */ X! /* then should look in /etc/termcap, but didn't. (efth) */ X! X! if ( (file = getenv("TERMCAP")) == NULL ) X! file = "/etc/termcap"; X! else if ( *file != '/' ) X! if ( (cp = getenv("TERM")) != NULL && strcmp( name, cp ) == 0 ) { X! strcpy( bp, file ); X! return( 1 ); X! } else X file = "/etc/termcap"; X+ X+ X if ((fp = fopen(file, "r")) == (FILE *) NULL) X return(-1); X+ X while (fgets(bp, 1024, fp) != NULL) { X+ /* Read in the rest of the definition now (efth) */ X+ while (*(cp = &bp[strlen(bp) - 2]) == '\\') X+ fgets(cp, 1024, fp); X+ X /* skip V6 two letter name */ X for (cp = bp ; *cp != '|' ; cp++) X ; X for (++cp ; ISSPACE(*cp) ; cp++) X ; X! X! /* Make sure "name" matches exactly (efth) */ X! if (strncmp(name, cp, len) == 0 && cp[len] == '|') { X fclose(fp); X return(1); X } X*************** X*** 157,163 **** X for (ret = *area, cp++; *cp && *cp != ':' ; (*area)++, cp++) X switch(*cp) { X case '^' : X! **area = *++cp - 'A'; X break; X case '\\' : X switch(*++cp) { X--- 171,177 ---- X for (ret = *area, cp++; *cp && *cp != ':' ; (*area)++, cp++) X switch(*cp) { X case '^' : X! **area = *++cp - '@'; /* fix (efth)*/ X break; X case '\\' : X switch(*++cp) { + END-OF-FILE termcap.c.cdif chmod 'u=rw,g=r,o=r' 'termcap.c.cdif' set `wc -c 'termcap.c.cdif'` count=$1 case $count in 3085) :;; *) echo 'Bad character count in ''termcap.c.cdif' >&2 echo 'Count should be 3085' >&2 esac echo Extracting 'wait.c.cdif' sed 's/^X//' > 'wait.c.cdif' << '+ END-OF-FILE ''wait.c.cdif' X*** /local/ast/minix/tape3a/lib/wait.c Mon May 16 23:23:29 1988 X--- wait.c Wed Jul 13 11:56:09 1988 X*************** X*** 5,10 **** X { X int k; X k = callm1(MM, WAIT, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR); X! if (status != 0) *status = M.m2_i1; X return(k); X } X--- 5,10 ---- X { X int k; X k = callm1(MM, WAIT, 0, 0, 0, NIL_PTR, NIL_PTR, NIL_PTR); X! if (k >= 0 && status != 0) *status = M.m2_i1; X return(k); X } + END-OF-FILE wait.c.cdif chmod 'u=rw,g=r,o=r' 'wait.c.cdif' set `wc -c 'wait.c.cdif'` count=$1 case $count in 426) :;; *) echo 'Bad character count in ''wait.c.cdif' >&2 echo 'Count should be 426' >&2 esac exit 0