Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!mcvax!botter!ast From: ast@cs.vu.nl (Andy Tanenbaum) Newsgroups: comp.os.minix Subject: Definitive MINIX 1.2 updates (Part 2 of 4) Message-ID: <1563@botter.cs.vu.nl> Date: Sun, 9-Aug-87 17:53:28 EDT Article-I.D.: botter.1563 Posted: Sun Aug 9 17:53:28 1987 Date-Received: Tue, 11-Aug-87 00:45:22 EDT Reply-To: ast@cs.vu.nl (Andy Tanenbaum) Distribution: world Organization: VU Informatica, Amsterdam Lines: 1049 : 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 echo Extracting \c\m\d\s\:\a\r\.\c sed 's/^X//' > \c\m\d\s\:\a\r\.\c << '+ END-OF-FILE '\c\m\d\s\:\a\r\.\c X244c244 X< ar_fd = open_archive(argv[2], (show_fl || pr_fl) ? READ : APPEND); X--- X> ar_fd = open_archive(argv[2], (show_fl || pr_fl || ex_fl) ? READ : APPEND); + END-OF-FILE cmds:ar.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\a\r\.\c set `sum \c\m\d\s\:\a\r\.\c` sum=$1 case $sum in 26299) :;; *) echo 'Bad sum in '\c\m\d\s\:\a\r\.\c >&2 esac echo Extracting \c\m\d\s\:\b\a\s\e\n\a\m\e\. sed 's/^X//' > \c\m\d\s\:\b\a\s\e\n\a\m\e\. << '+ END-OF-FILE '\c\m\d\s\:\b\a\s\e\n\a\m\e\. X27c27 X< prints("%s \n",d); X--- X> prints("%s\n",d); X35,36c35,36 X< prints("%s \n",c); X< } X--- X> prints("%s\n",c); X> } + END-OF-FILE cmds:basename. chmod 'u=rw,g=r,o=r' \c\m\d\s\:\b\a\s\e\n\a\m\e\. set `sum \c\m\d\s\:\b\a\s\e\n\a\m\e\.` sum=$1 case $sum in 07740) :;; *) echo 'Bad sum in '\c\m\d\s\:\b\a\s\e\n\a\m\e\. >&2 esac echo Extracting \c\m\d\s\:\c\a\t\.\c sed 's/^X//' > \c\m\d\s\:\c\a\t\.\c << '+ END-OF-FILE '\c\m\d\s\:\c\a\t\.\c X86c86 X< if (write(1, buffer, next - buffer) <= 0) quit(); X--- X> if (write(1, buffer, (int) (next - buffer)) <= 0) quit(); + END-OF-FILE cmds:cat.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\c\a\t\.\c set `sum \c\m\d\s\:\c\a\t\.\c` sum=$1 case $sum in 13846) :;; *) echo 'Bad sum in '\c\m\d\s\:\c\a\t\.\c >&2 esac echo Extracting \c\m\d\s\:\c\p\.\c sed 's/^X//' > \c\m\d\s\:\c\p\.\c << '+ END-OF-FILE '\c\m\d\s\:\c\p\.\c X47a48 X> exit(0); + END-OF-FILE cmds:cp.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\c\p\.\c set `sum \c\m\d\s\:\c\p\.\c` sum=$1 case $sum in 31554) :;; *) echo 'Bad sum in '\c\m\d\s\:\c\p\.\c >&2 esac echo Extracting \c\m\d\s\:\d\f\.\c sed 's/^X//' > \c\m\d\s\:\d\f\.\c << '+ END-OF-FILE '\c\m\d\s\:\d\f\.\c X37d36 X< extern char *itoa(); X133a133 X> return(0); X146a147 X> extern char *itoa(); + END-OF-FILE cmds:df.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\d\f\.\c set `sum \c\m\d\s\:\d\f\.\c` sum=$1 case $sum in 26779) :;; *) echo 'Bad sum in '\c\m\d\s\:\d\f\.\c >&2 esac echo Extracting \c\m\d\s\:\d\o\s\r\e\a\d\.\c sed 's/^X//' > \c\m\d\s\:\d\o\s\r\e\a\d\.\c << '+ END-OF-FILE '\c\m\d\s\:\d\o\s\r\e\a\d\.\c X16c16 X< #define DRIVE "/dev/fdX" X--- X> #define DRIVE "/dev/atX" X186c186 X< print_string(TRUE, "Diskette is neither 360K nor 1.2M\n"); X--- X> print_string(TRUE, "Diskette is not DOS 2.0 360K or 1.2M\n"); X279c279 X< while (*pathname != '/' && *pathname && i < 11) X--- X> while (*pathname != '/' && *pathname && i < 12) X494,506c494,502 X< for (i = 0, ptr = name; i < 8 && *ptr != '.' && *ptr; i++) X< entry->d_name[i] = *ptr++; X< while (i < 8) X< entry->d_name[i++] = ' '; X< r = strlen(name); X< while (r && name[r - 1] != '.') X< r--; X< X< i = 0; X< while (r && i < 3 && name[r]) X< entry->d_ext[i++] = name[r++]; X< while (i < 3) X< entry->d_ext[i++] = ' '; X--- X> bcopy(" ",&entry->d_name[0],11); /* clear entry */ X> for (i = 0, ptr = name; i < 8 && *ptr != '.' && *ptr; i++) X> entry->d_name[i] = *ptr++; X> while (*ptr != '.' && *ptr) X> ptr++; X> if (*ptr == '.') X> ptr++; X> for (i=0;i < 3 && *ptr; i++) X> entry->d_ext[i] = *ptr++; X584c580 X< day -= mon_len[i]; X--- X> day -= mon_len[i++]; X641c637 X< return (buffer - begin); X--- X> return (int) (buffer - begin); X819c815 X< write(2, buf, buf_ptr - buf); X--- X> write(2, buf, (int) (buf_ptr - buf)); + END-OF-FILE cmds:dosread.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\d\o\s\r\e\a\d\.\c set `sum \c\m\d\s\:\d\o\s\r\e\a\d\.\c` sum=$1 case $sum in 38592) :;; *) echo 'Bad sum in '\c\m\d\s\:\d\o\s\r\e\a\d\.\c >&2 esac echo Extracting \c\m\d\s\:\h\e\a\d\.\c sed 's/^X//' > \c\m\d\s\:\h\e\a\d\.\c << '+ END-OF-FILE '\c\m\d\s\:\h\e\a\d\.\c X1a2,3 X> /* change to use putc() instead of prints() -- Dean Long 3/7/87 */ X> X8d9 X< char lbuf[256]; X43,44c44,47 X< else X< do_file(n); X--- X> else { X> do_file(n); X> fflush(stdout); X> } X48d50 X< fflush(stdout); X57,58c59,70 X< /* Print the first 'n' lines of a file. */ X< while (n--) do_line(); X--- X> int c; X> X> /* Print the first 'n' lines of a file. */ X> while(n) X> switch (c = getc(stdin)) { X> case EOF : X> return; X> case '\n': X> --n; X> default : X> putc((char)c, stdout); X> } X62,80c74,79 X< do_line() X< { X< /* Print one line. */ X< X< char c, *cp; X< cp = lbuf; X< while ( (c = getc(stdin)) != '\n') *cp++ = c; X< *cp++ = '\n'; X< *cp++ = 0; X< prints("%s",lbuf); X< } X< X< X< usage() X< { X< std_err("Usage: head [-n] [file ...]\n"); X< exit(1); X< } X< X--- X> usage() X> { X> std_err("Usage: head [-n] [file ...]\n"); X> exit(1); X> } X> + END-OF-FILE cmds:head.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\h\e\a\d\.\c set `sum \c\m\d\s\:\h\e\a\d\.\c` sum=$1 case $sum in 26082) :;; *) echo 'Bad sum in '\c\m\d\s\:\h\e\a\d\.\c >&2 esac echo Extracting \c\m\d\s\:\k\i\l\l\.\c sed 's/^X//' > \c\m\d\s\:\k\i\l\l\.\c << '+ END-OF-FILE '\c\m\d\s\:\k\i\l\l\.\c X33,35c33,35 X< prints("usage: kill pid\n"); X< exit(1); X< } X--- X> prints("Usage: kill pid\n"); X> exit(1); X> } + END-OF-FILE cmds:kill.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\k\i\l\l\.\c set `sum \c\m\d\s\:\k\i\l\l\.\c` sum=$1 case $sum in 52732) :;; *) echo 'Bad sum in '\c\m\d\s\:\k\i\l\l\.\c >&2 esac echo Extracting \c\m\d\s\:\l\n\.\c sed 's/^X//' > \c\m\d\s\:\l\n\.\c << '+ END-OF-FILE '\c\m\d\s\:\l\n\.\c X11a12 X> char *last_comp(); + END-OF-FILE cmds:ln.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\l\n\.\c set `sum \c\m\d\s\:\l\n\.\c` sum=$1 case $sum in 44606) :;; *) echo 'Bad sum in '\c\m\d\s\:\l\n\.\c >&2 esac echo Extracting \c\m\d\s\:\l\o\g\i\n\.\c sed 's/^X//' > \c\m\d\s\:\l\o\g\i\n\.\c << '+ END-OF-FILE '\c\m\d\s\:\l\o\g\i\n\.\c X55,57c55,57 X< execl(pwd->pw_shell, "-", 0); X< } X< execl("/bin/sh", "-", 0); X--- X> execl(pwd->pw_shell, "-", (char *) 0); X> } X> execl("/bin/sh", "-", (char *) 0); + END-OF-FILE cmds:login.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\l\o\g\i\n\.\c set `sum \c\m\d\s\:\l\o\g\i\n\.\c` sum=$1 case $sum in 14607) :;; *) echo 'Bad sum in '\c\m\d\s\:\l\o\g\i\n\.\c >&2 esac echo Extracting \c\m\d\s\:\l\s\.\c sed 's/^X//' > \c\m\d\s\:\l\s\.\c << '+ END-OF-FILE '\c\m\d\s\:\l\s\.\c X359c359,366 X< fprintf(stdout, "%s\n",fp->name); X--- X> m = 0; X> p1 = fp->name; X> while (*p1 != 0 && (m < DIRNAMELEN || *p1 == '/') ) { X> fprintf(stdout, "%c", *p1); X> m = (*p1 == '/' ? 0 : m + 1); X> p1++; X> } X> fprintf(stdout, "\n"); + END-OF-FILE cmds:ls.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\l\s\.\c set `sum \c\m\d\s\:\l\s\.\c` sum=$1 case $sum in 63056) :;; *) echo 'Bad sum in '\c\m\d\s\:\l\s\.\c >&2 esac echo Extracting \c\m\d\s\:\m\a\k\e\.\c sed 's/^X//' > \c\m\d\s\:\m\a\k\e\.\c << '+ END-OF-FILE '\c\m\d\s\:\m\a\k\e\.\c X153c153 X< /* sysV and MONIX and LATTICE */ X--- X> /* sysV and MINIX and LATTICE */ X1899c1899 X< execl(SHELL,"sh","-c",cmd,0); X--- X> execl(SHELL, "sh", "-c", cmd, (char *) 0); + END-OF-FILE cmds:make.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\m\a\k\e\.\c set `sum \c\m\d\s\:\m\a\k\e\.\c` sum=$1 case $sum in 25797) :;; *) echo 'Bad sum in '\c\m\d\s\:\m\a\k\e\.\c >&2 esac echo Extracting \c\m\d\s\:\m\i\n\e\d\1\.\c sed 's/^X//' > \c\m\d\s\:\m\i\n\e\d\1\.\c << '+ END-OF-FILE '\c\m\d\s\:\m\i\n\e\d\1\.\c X533c533 X< execl("/bin/sh", "sh", "-i", 0); X--- X> execl("/bin/sh", "sh", "-i", (char *) 0); + END-OF-FILE cmds:mined1.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\m\i\n\e\d\1\.\c set `sum \c\m\d\s\:\m\i\n\e\d\1\.\c` sum=$1 case $sum in 44548) :;; *) echo 'Bad sum in '\c\m\d\s\:\m\i\n\e\d\1\.\c >&2 esac echo Extracting \c\m\d\s\:\m\k\f\s\.\c sed 's/^X//' > \c\m\d\s\:\m\k\f\s\.\c << '+ END-OF-FILE '\c\m\d\s\:\m\k\f\s\.\c X5c5 X< * with blocksize = zonesize. During the course of action the X--- X> * with blocksize = zonesize. During the course of time the X10,12c10,12 X< * To compile this program for MS-DOS, say cc -DDOS mkfs.c diskio.asm X< * To compile this program for UNIX, say cc -DUNIX mkfs.c X< * To compile this program for MINIX, say cc mkfs.c X--- X> * To compile this program for MS-DOS, use: cc -DDOS mkfs.c diskio.asm X> * To compile this program for UNIX, use: cc -DUNIX mkfs.c X> * To compile this program for MINIX, use: cc mkfs.c X32a33,34 X> #undef major X> #undef minor X55d56 X< #define ZONE_MAP 3 X61c62 X< #define N_BLOCKS 32000 /* must be multiple of 8 */ X--- X> #define N_BLOCKS 32000 /* must be multiple of 8 */ X73,77c74,79 X< nrinodes, lct=1, disk, fd, print=0, file=0, override=0, simple=0; X< X< long current_time; X< char zero[BLOCK_SIZE], *lastp; X< char umap[(N_BLOCKS+8)/8]; /* bit map tells if block read yet */ X--- X> nrinodes, lct=1, disk, fd, print=0, file=0, override=0, simple=0, dflag; X> X> long current_time, bin_time; X> char zero[BLOCK_SIZE], *lastp; X> char umap[(N_BLOCKS+8)/8]; /* bit map tells if block read yet */ X> int zone_map = 3; /* where is zone map? (depends on # inodes) */ X86d87 X< X106,108c107,118 X< /* process parameters and switches */ X< X< current_time = time(0L); X--- X> X> /* Get two times, the current time and the mod time of the binary of X> * mkfs itself. When the -d flag is used, the later time is put into X> * the i_modtimes of all the files. This feature is useful when producing X> * a set of file systems, and one wants all the times to be identical. X> * First you set the time of the mkfs binary to what you want, then go. X> */ X> current_time = time(0L); /* time mkfs is being run */ X> stat(argv[0], &statbuf); X> bin_time = statbuf.st_mtime; /* time when mkfs binary was last modified */ X> X> /* process parameters and switches */ X128c138,139 X< default : X--- X> case 'd' : current_time = bin_time; dflag=1; break; X> default : X226c237,238 X< int i, inodeblks, initblks, initzones, nrzones; X--- X> unsigned int i, inodeblks, initblks, initzones, nrzones, bs; X> unsigned int map_size, bit_map_len, b_needed, b_allocated, residual; X233,236c245,249 X< sup->s_ninodes = inodes; X< sup->s_nzones = zones; X< sup->s_imap_blocks = (inodes + (1<> BIT_MAP_SHIFT; X< sup->s_zmap_blocks = (zones + (1<> BIT_MAP_SHIFT; X--- X> bs = 1 << BIT_MAP_SHIFT; X> sup->s_ninodes = inodes; X> sup->s_nzones = zones; X> sup->s_imap_blocks = (inodes + bs)/bs; X> sup->s_zmap_blocks = (zones + bs - 1)/bs; X261,266c274,313 X< insert_bit(ZONE_MAP, 0, 1); /* bit zero must always be allocated */ X< insert_bit(INODE_MAP, 0, 1); /* inode zero used by root-directory */ X< X< /* Mark all bits beyond the end of the legal inodes/zones as allocated. */ X< insert_bit(ZONE_MAP,nrzones-initzones+1, 8*BLOCK_SIZE-(nrzones-initzones+1)); X< insert_bit(INODE_MAP, inodes+1, 8*BLOCK_SIZE - inodes - 1); X--- X> X> /* Mark all bits beyond the end of the legal inodes and zones as allocated. X> * Unfortunately, the coding the bit maps is inconsistent. The rules are: X> * For inodes: Every i-node occupies a bit map slot, even i-node 0 X> * The first i-node on the disk is i-node 1, not 0 X> * For zones: Zone map bit 0 is for the last i-node block on disk X> * The first zone available goes with bit 1 in the map X> * X> * Thus for i-nodes, every i-node, starting at 0 occupies a bit map slot, X> * but for zones, only those starting with the final i-node block occupy X> * bit slots. This is inconsistent. In retrospect it would might have been X> * simpler to have bit 0 of the zone map be zone 0 on the disk. Although X> * this would have increased the zone bit map by a few dozen bits, it would X> * have prevented a number of bugs in the early days. This is an example of X> * what happens when one ignores the maxim: First make it work, then make X> * it optimal. For both maps, 0 = available, 1 = in use. X> */ X> X> /* Mark bits beyond end of inodes as allocated. (Fails if >8192 inodes). */ X> map_size = 1 << BIT_MAP_SHIFT; X> bit_map_len = nrinodes + 1; /* # bits needed in map */ X> residual = bit_map_len % (8 * BLOCK_SIZE); X> if (residual == 0) residual = 8 * BLOCK_SIZE; X> b_needed = (bit_map_len + map_size - 1 ) >> BIT_MAP_SHIFT; X> zone_map += b_needed - 1; /* if imap > 1, adjust start of zone map */ X> insert_bit(INODE_MAP + b_needed - 1, residual, 8 * BLOCK_SIZE - residual); X> X> bit_map_len = nrzones - initzones + 1; /* # bits needed in map */ X> residual = bit_map_len % (8 * BLOCK_SIZE); X> if (residual == 0) residual = 8 * BLOCK_SIZE; X> b_needed = (bit_map_len + map_size - 1 ) >> BIT_MAP_SHIFT; X> b_allocated = (nrzones + map_size - 1 ) >> BIT_MAP_SHIFT; X> insert_bit(zone_map + b_needed - 1, residual, 8 * BLOCK_SIZE - residual); X> if (b_needed != b_allocated) { X> insert_bit(zone_map + b_allocated - 1, 0, map_size); X> } X> X> insert_bit(zone_map, 0, 1); /* bit zero must always be allocated */ X> insert_bit(INODE_MAP, 0, 1); /* inode zero not used but must be allocated */ X> X364a412 X> long timeval; X375c423,424 X< if (ct) add_zone (inode, z, (long) j, file_time(f) ); X--- X> timeval = (dflag ? current_time : file_time(f) ); X> if (ct) add_zone (inode, z, (long) j, timeval ); X448c497,498 X< int b, off, blk[INTS_PER_BLOCK], indir, i; X--- X> int b, off, indir, i; X> zone_nr blk[NR_INDIRECTS]; X472,474c522,524 X< for (i = 0; i < INTS_PER_BLOCK; i++) X< if (blk[i] == 0) { X< blk[i] = z; X--- X> for (i = 0; i < NR_INDIRECTS; i++) X> if (blk[i] == 0) { X> blk[i] = (zone_nr) z; X555d604 X< X559c608 X< insert_bit(ZONE_MAP, z - zoff, 1); X--- X> insert_bit(zone_map, z - zoff, 1); X571c620 X< char buf[BLOCK_SIZE]; X--- X> int buf[BLOCK_SIZE/sizeof(int)]; X575,576c624,625 X< w = i/8; X< s = i % 8; X--- X> w = i / (8*sizeof(int)); X> s = i % (8*sizeof(int)); X622c671 X< for (k = 0; k < MAX_TOKEN; k++) parse[k] = 0; X--- X> for (k = 0; k < MAX_TOKENS; k++) parse[k] = 0; X678c727 X< write (2, s, s0-s ); X--- X> write (2, s, (int)(s0-s) ); X829c878 X< if ((fd=creat(string,BWRITE)) == 0) X--- X> if ((fd = creat(string,BWRITE)) == 0) X1096a1146 X> + END-OF-FILE cmds:mkfs.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\m\k\f\s\.\c set `sum \c\m\d\s\:\m\k\f\s\.\c` sum=$1 case $sum in 34721) :;; *) echo 'Bad sum in '\c\m\d\s\:\m\k\f\s\.\c >&2 esac echo Extracting \c\m\d\s\:\m\v\.\c sed 's/^X//' > \c\m\d\s\:\m\v\.\c << '+ END-OF-FILE '\c\m\d\s\:\m\v\.\c X1c1,4 X< /* mv - move files Author: Adri Koppes */ X--- X> /* mv - move files Author: Adri Koppes X> * X> * 4/25/87 - J. Paradis Bug fixes for directory handling X> */ X7c10 X< struct stat st; X--- X> struct stat st, st1; X26,37c29 X< if ((st.st_mode & S_IFMT) == S_IFDIR) { X< if (!stat(argv[2], &st) && (st.st_mode & S_IFMT) == S_IFDIR) { X< std_err ("mv: target "); X< std_err (argv[2]); X< std_err (" exists\n"); X< exit (1); X< } X< } X< else { X< setgid (getgid ()); X< setuid (getuid ()); X< } X--- X> X41,42d32 X< setgid (getgid ()); X< setuid (getuid ()); X67a58,68 X> char name[64]; X> X> /* It's too dangerous to fool with "." or ".." ! */ X> if((strcmp(old, ".") == 0) || (strcmp(old, "..") == 0)) { X> cant(old); X> } X> X> /* Don't move a file to itself. */ X> if (stat(old, &st)==0 && stat(new, &st1)==0 && st.st_dev == st1.st_dev && X> st.st_ino == st1.st_ino) X> cant(old); X73c74 X< char name[64], *p, *rindex(); X--- X> char *p, *rindex(); X91c92,94 X< execl ("/bin/cp", "cp", old, new, 0); X--- X> setgid (getgid ()); X> setuid (getuid ()); X> execl ("/bin/cp", "cp", old, new, (char *) 0); X103,114c106,161 X< utime (new, &st.st_atime); X< unlink(old); X< } X< X< cant(name) X< char *name; X< { X< std_err("mv: can't move "); X< std_err (name); X< std_err ("\n"); X< exit (1); X< } X--- X> X> /* If this was a directory that we moved, then we have X> ** to update its ".." entry (in case it was moved some- X> ** where else in the tree...) X> */ X> if ((st.st_mode & S_IFMT) == S_IFDIR) { X> int i; X> char parent[64], dotdot[64]; X> X> strcpy(parent, new); X> X> /* Determine the name for the parent of X> ** the new name by counting back until we X> ** hit a '/' or the begining of the string X> */ X> X> for(i = (strlen(parent) - 1); i > 0; i--) { X> if(parent[i] == '/') break; X> } X> X> /* If there are no slashes, then the name is X> ** in the current directory, so its parent X> ** is ".". Otherwise, the parent is the name X> ** up to the last slash. X> */ X> if(i == 0) { X> strcpy(parent, "."); X> } X> else { X> /* null-terminate name at last slash */ X> parent[i] = '\0'; X> } X> X> /* Unlink the ".." entry */ X> strcpy(dotdot, new); X> strcat(dotdot, "/.."); X> unlink(dotdot); X> X> /* Now link it to its parent */ X> link(parent, dotdot); X> } X> X> utime (new, &st.st_atime); X> unlink(old); X> } X> X> cant(name) X> char *name; X> { X> std_err("mv: can't move "); X> std_err (name); X> std_err ("\n"); X> exit (1); X> } X> X> + END-OF-FILE cmds:mv.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\m\v\.\c set `sum \c\m\d\s\:\m\v\.\c` sum=$1 case $sum in 44861) :;; *) echo 'Bad sum in '\c\m\d\s\:\m\v\.\c >&2 esac echo Extracting \c\m\d\s\:\o\d\.\c sed 's/^X//' > \c\m\d\s\:\o\d\.\c << '+ END-OF-FILE '\c\m\d\s\:\o\d\.\c X26c26 X< if (*p == '-') { X--- X> if (argc > 1 && *p == '-') { X168,169c168,169 X< bdump(words, k, c) X< int words[8]; X--- X> bdump(bytes, k, c) X> char bytes[16]; X174,186c174,176 X< int c1, c2; X< X< i = 0; X< if (linenr++ != 1) printf(" "); X< while (i < k) { X< c1 = words[i>>1] & 0377; X< c2 = (words[i>>1]>>8) & 0377; X< byte(c1, c); X< i++; X< if (i == k) {printf("\n"); return;} X< byte(c2, c); X< i++; X< } X--- X> X> if (linenr++ != 1) printf(" "); X> for (i = 0; i < k; i++) byte(bytes[i] & 0377, c); + END-OF-FILE cmds:od.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\o\d\.\c set `sum \c\m\d\s\:\o\d\.\c` sum=$1 case $sum in 27139) :;; *) echo 'Bad sum in '\c\m\d\s\:\o\d\.\c >&2 esac echo Extracting \c\m\d\s\:\p\a\s\s\w\d\.\c sed 's/^X//' > \c\m\d\s\:\p\a\s\s\w\d\.\c << '+ END-OF-FILE '\c\m\d\s\:\p\a\s\s\w\d\.\c X50a51,54 X> if (password[0] == '\0') { X> std_err("password cannot be null\n"); X> exit(1); X> } + END-OF-FILE cmds:passwd.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\p\a\s\s\w\d\.\c set `sum \c\m\d\s\:\p\a\s\s\w\d\.\c` sum=$1 case $sum in 08089) :;; *) echo 'Bad sum in '\c\m\d\s\:\p\a\s\s\w\d\.\c >&2 esac echo Extracting \c\m\d\s\:\p\r\.\c sed 's/^X//' > \c\m\d\s\:\p\r\.\c << '+ END-OF-FILE '\c\m\d\s\:\p\r\.\c X257,259c257,260 X< do { X< putchar(c); X< } while ((c = getc(filep)) != '\n' && c != EOF); X--- X> while (c != '\n' && c != EOF) { X> putchar(c); X> c = getc(filep); X> } + END-OF-FILE cmds:pr.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\p\r\.\c set `sum \c\m\d\s\:\p\r\.\c` sum=$1 case $sum in 02036) :;; *) echo 'Bad sum in '\c\m\d\s\:\p\r\.\c >&2 esac echo Extracting \c\m\d\s\:\p\w\d\.\c sed 's/^X//' > \c\m\d\s\:\p\w\d\.\c << '+ END-OF-FILE '\c\m\d\s\:\p\w\d\.\c X12c12,13 X< register char name[128], *n; X--- X> register *n; X> char name[128]; + END-OF-FILE cmds:pwd.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\p\w\d\.\c set `sum \c\m\d\s\:\p\w\d\.\c` sum=$1 case $sum in 20465) :;; *) echo 'Bad sum in '\c\m\d\s\:\p\w\d\.\c >&2 esac echo Extracting \c\m\d\s\:\r\m\.\c sed 's/^X//' > \c\m\d\s\:\r\m\.\c << '+ END-OF-FILE '\c\m\d\s\:\r\m\.\c X107,109c107,109 X< stderr3 ("rm: remove ", name, " with mode "); X< octal(s.st_mode & 0777); X< std_err("? "); X--- X> stderr3 ("rm: remove ", name, " (mode = "); X> octal(s.st_mode & 0777); X> std_err(") ? "); X132,133c132,133 X< execl ("/bin/rmdir", "rmdir", name, 0); X< execl ("/usr/bin/rmdir", "rmdir", name, 0); X--- X> execl ("/bin/rmdir", "rmdir", name, (char*) 0); X> execl ("/usr/bin/rmdir", "rmdir", name, (char*) 0); + END-OF-FILE cmds:rm.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\r\m\.\c set `sum \c\m\d\s\:\r\m\.\c` sum=$1 case $sum in 59181) :;; *) echo 'Bad sum in '\c\m\d\s\:\r\m\.\c >&2 esac echo Extracting \c\m\d\s\:\r\m\d\i\r\.\c sed 's/^X//' > \c\m\d\s\:\r\m\d\i\r\.\c << '+ END-OF-FILE '\c\m\d\s\:\r\m\d\i\r\.\c X1c1,3 X< /* rmdir - remove a directory Author: Adri Koppes */ X--- X> /* rmdir - remove a directory Author: Adri Koppes X> * (modified by Paul Polderman) X> */ X29a32,33 X> extern char *rindex(); X> X37a42 X> register char *p; X49,55c54,60 X< strcpy (dots, dirname); X< while (dirname[fd]) X< if (dirname[fd++] == '/') X< sl = fd; X< dots[sl] = '\0'; X< if (access (dots, 2)) { X< stderr2(dirname, " no permission\n"); X--- X> if (p = rindex(dirname, '/')) X> p++; X> else X> p = dirname; X> X> if (strcmp(p, ".") == 0 || strcmp(p, "..") == 0) { X> stderr2(dirname, " will not remove \".\" or \"..\"\n"); X59,61c64,71 X< stat ("", &cwd); X< if ((s.st_ino == cwd.st_ino) && (s.st_dev == cwd.st_dev)) { X< std_err ("rmdir: can't remove current directory\n"); X--- X> X> strcpy (dots, dirname); X> while (dirname[fd]) X> if (dirname[fd++] == '/') X> sl = fd; X> dots[sl] = '\0'; X> if (access (dots, 2)) { X> stderr2(dirname, " no permission\n"); X65,67c75,77 X< if ((fd = open (dirname, 0)) < 0) { X< stderr2("can't read ", dirname); X< std_err("\n"); X--- X> stat ("", &cwd); X> if ((s.st_ino == cwd.st_ino) && (s.st_dev == cwd.st_dev)) { X> std_err ("rmdir: can't remove current directory\n"); X70a81,86 X> if ((fd = open (dirname, 0)) < 0) { X> stderr2("can't read ", dirname); X> std_err("\n"); X> error++; X> return; X> } X81,86c97,106 X< strcat (dots, "/."); X< unlink (dots); X< strcat (dots, "."); X< unlink (dots); X< if (unlink (dirname)) { X< stderr2("can't remove ", dirname); X--- X> strcat (dots, "/.."); X> patch_path(dots); X> for (p = dots; *p; p++) /* find end of dots */ X> ; X> unlink(dots); /* dirname/.. */ X> *(p - 1) = '\0'; X> unlink(dots); /* dirname/. */ X> *(p - 3) = '\0'; X> if (unlink(dots)) { /* dirname */ X> stderr2("can't remove ", dots); X99a120,148 X> X> patch_path(dir) X> char *dir; /* pathname ending with "/.." */ X> { X> register char *p, *s; X> struct stat pst, st; X> X> if (stat(dir, &pst) < 0) X> return; X> p = dir; X> while (*p == '/') p++; X> while (1) { X> s = p; /* remember start of new pathname part */ X> while (*p && *p != '/') X> p++; /* find next slash */ X> if (*p == '\0') X> return; /* if end of pathname, return */ X> X> /* check if this part of pathname == the original pathname */ X> *p = '\0'; X> stat(dir, &st); X> if (st.st_ino == pst.st_ino && st.st_dev == pst.st_dev X> && strcmp(s, "..") == 0) X> return; X> /* if not, try next part */ X> *p++ = '/'; X> while (*p == '/') p++; X> } X> } + END-OF-FILE cmds:rmdir.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\r\m\d\i\r\.\c set `sum \c\m\d\s\:\r\m\d\i\r\.\c` sum=$1 case $sum in 26410) :;; *) echo 'Bad sum in '\c\m\d\s\:\r\m\d\i\r\.\c >&2 esac echo Extracting \c\m\d\s\:\r\o\f\f\.\c sed 's/^X//' > \c\m\d\s\:\r\o\f\f\.\c << '+ END-OF-FILE '\c\m\d\s\:\r\o\f\f\.\c X1c1,16 X< /* roff - text justifier Author: George Sicherman */ X--- X> /* roff - text justifier Author: George L. Sicherman */ X> X> /* X> * roff - C version. X> * the Colonel. 19 May 1983. X> * X> * Copyright 1983 by G. L. Sicherman. X> * You may use and alter this software freely for noncommercial ends X> * so long as you leave this message alone. X> * X> * Fix by Tim Maroney, 31 Dec 1984. X> * .hc implemented, 8 Feb 1985. X> * Fix to hyphenating with underlining, 12 Feb 1985. X> * Fixes to long-line hang and .bp by Dave Tutelman, 30 Mar 1985. X> * Fix to centering valve with long input lines, 4 May 1987. X> */ X14,16c29,32 X< #define UNDERL 0200 X< X< char cumbuf[BUFSIZ]; X--- X> #define UNDERL '\200' X> X> char cumbuf[BUFSIZ]; X> X48d63 X< int center = 0; X67d81 X< X128,130c142,144 X< char *ttyname(); X< X< /* This routine is not needed -- X--- X> /* This routine is not needed. X> char *ttyname(); X> X138c152 X< */ X--- X> * ------- end of mesg */ X145,147c159,162 X< if (center || !o_fi) { X< if (assylen) writeline(0,1); X< else blankline(); X--- X> if (o_ce || !o_fi) { X> if (assylen) writeline(0,1); X> else blankline(); X> if (o_ce) o_ce--; X213,214d227 X< center=o_ce; X< if (o_ce) o_ce--; X227a241,244 X> * Tutelman's fix #1, modified by the Colonel. X> */ X> if (!o_fi || o_ce) goto giveup; X> /* X242c259 X< if (*hc!=o_hc) continue; X--- X> if ((*hc&~UNDERL)!=o_hc) continue; X293c310 X< for (t=s; *s; s++) if (*s != o_hc) *t++ = *s; X--- X> for (t=s; *s; s++) if ((*s&~UNDERL) != o_hc) *t++ = *s; X307c324 X< while (*s) n += (o_hc != *s++); X--- X> while (*s) n += (o_hc != (~UNDERL & *s++)); X372,373c389,393 X< if (s>0) o_bp=page_no-r; X< else if (s<0) o_bp=page_no+r; X--- X> /* X> * Tutelman's fix #2 - the signs were reversed! X> */ X> if (s>0) o_bp=page_no+r; X> else if (s<0) o_bp=page_no-r; X388,389c408,413 X< nread(&o_ce); X< writebreak(); X--- X> /* X> * Fix to centering. Set counter _after_ breaking! --G.L.S. X> */ X> nread(&r); X> writebreak(); X> o_ce = r; X735c759 X< if (c==EOF || c=='\n') break;; X--- X> if (c==EOF || c=='\n') break; X836c860 X< if (center) for (j=0; j<(o_ll-assylen+1)/2; j++) spit(' '); X--- X> if (o_ce) for (j=0; j<(o_ll-assylen+1)/2; j++) spit(' '); X1085c1109,1112 X< c = *t; X--- X> /* X> * fix - last char translates to space. X> */ X> c = *t? *t: ' '; X1123,1125c1150 X< * strhas - does string have character? X< * USG and BSD both have this in their libraries. Now, if X< * they could just agree on the name of the function ... X--- X> * strhas - does string have character? Allow UNDERL flag. X1132c1157 X< for (; *p; p++) if (*p==c) return p; X--- X> for (; *p; p++) if ((*p&~UNDERL)==c) return p; + END-OF-FILE cmds:roff.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\r\o\f\f\.\c set `sum \c\m\d\s\:\r\o\f\f\.\c` sum=$1 case $sum in 47876) :;; *) echo 'Bad sum in '\c\m\d\s\:\r\o\f\f\.\c >&2 esac echo Extracting \c\m\d\s\:\s\p\l\i\t\.\c sed 's/^X//' > \c\m\d\s\:\s\p\l\i\t\.\c << '+ END-OF-FILE '\c\m\d\s\:\s\p\l\i\t\.\c X66c66 X< if (write(fd, base, index-base) != index-base) X--- X> if (write(fd,base,(int)(index-base)) != (int)(index-base)) X73c73 X< if (write(fd, base, index - base) != index - base) quit(); X--- X> if (write(fd, base, (int) (index-base)) != (int) (index-base)) quit(); + END-OF-FILE cmds:split.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\s\p\l\i\t\.\c set `sum \c\m\d\s\:\s\p\l\i\t\.\c` sum=$1 case $sum in 15949) :;; *) echo 'Bad sum in '\c\m\d\s\:\s\p\l\i\t\.\c >&2 esac echo Extracting \c\m\d\s\:\t\a\r\.\c sed 's/^X//' > \c\m\d\s\:\t\a\r\.\c << '+ END-OF-FILE '\c\m\d\s\:\t\a\r\.\c X60a61,62 X> char path[NAME_SIZE]; X> char pathname[NAME_SIZE]; X111,112c113,116 X< for (i = 3; i < argc; i++) X< add_file(argv[i]); X--- X> for (i = 3; i < argc; i++) { X> add_file(argv[i]); X> path[0] = '\0'; X> } X158,163c162,167 X< string_print(NIL_PTR, "linked to %s", X< header.member.m_link); X< else X< string_print(NIL_PTR, "%d tape blocks", block_size()); X< print("\n"); X< skip_entry(); X--- X> string_print(NIL_PTR, "linked to %s\n", X> header.member.m_link); X> else { X> string_print(NIL_PTR, "%d tape blocks\n", block_size()); X> skip_entry(); X> } X248c252 X< execl(MKDIR, "mkdir", dir_name, 0); X--- X> execl(MKDIR, "mkdir", dir_name, (char *) 0); X281,283c285 X< char path[NAME_SIZE]; X< X< char pathname[NAME_SIZE]; X--- X> + END-OF-FILE cmds:tar.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\t\a\r\.\c set `sum \c\m\d\s\:\t\a\r\.\c` sum=$1 case $sum in 45064) :;; *) echo 'Bad sum in '\c\m\d\s\:\t\a\r\.\c >&2 esac echo Extracting \c\m\d\s\:\w\c\.\c sed 's/^X//' > \c\m\d\s\:\w\c\.\c << '+ END-OF-FILE '\c\m\d\s\:\w\c\.\c X55c55 X< if (*cp++ == '-') { X--- X> if (argc >1 && *cp++ == '-') { + END-OF-FILE cmds:wc.c chmod 'u=rw,g=r,o=r' \c\m\d\s\:\w\c\.\c set `sum \c\m\d\s\:\w\c\.\c` sum=$1 case $sum in 34156) :;; *) echo 'Bad sum in '\c\m\d\s\:\w\c\.\c >&2 esac e2 m2 m