ast@cs.vu.nl (Andy Tanenbaum) (09/28/88)
Johan Stevenson (the person who was the driving force behind Atari MINIX) just sent me a very useful little program that combines ls -l and sum. It is called crc, and the call: crc file1 ... prints for each argument both the file length and a checksum. The checksum uses a crc algorithm, and is not compatible with sum. Below is a shell archive containing both the program and the crc output for the full 1.3 distribution as it is on my Sun workstation at the university. After you apply all the 1.3 updates, compare your distribution to this list to see if you got it right. One of these days I will compare my disk at home (the master machine) with the Sun to see if I got it right. Andy Tanenbaum (ast@cs.vu.nl) : 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 'crc.c' sed 's/^X//' > 'crc.c' << '+ END-OF-FILE ''crc.c' X/* crc - list length and checksum Author: Johan W. Stevenson */ X X X#include <stdio.h> X Xint errs; X Xmain(argc,argv) Xchar **argv; X{ X X if (argc <= 1) X crc((char *)0); X else X do { X if (freopen(argv[1], "r", stdin) == NULL) X error("cannot open %s", argv[1]); X else X crc(argv[1]); X argv++; X argc--; X } while (argc > 1); X exit(errs != 0); X} X X/* crctab calculated by Mark G. Mendel, Network Systems Corporation */ Xstatic unsigned short crctab[256] = { X 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, X 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, X 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, X 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, X 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, X 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, X 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, X 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, X 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, X 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, X 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, X 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, X 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, X 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, X 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, X 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, X 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, X 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, X 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, X 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, X 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, X 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, X 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, X 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, X 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, X 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, X 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, X 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, X 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, X 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, X 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, X 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 X}; X X/* X * updcrc macro derived from article Copyright (C) 1986 Stephen Satchell. X * NOTE: First argument must be in range 0 to 255. X * Second argument is referenced twice. X * X * Programmers may incorporate any or all code into their programs, X * giving proper credit within the source. Publication of the X * source routines is permitted so long as proper credit is given X * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg, X * Omen Technology. X */ X X#define updcrc(cp, crc) ( crctab[((crc >> 8) & 255)] ^ (crc << 8) ^ cp) X Xcrc(fname) Xchar *fname; X{ X register int c; X register int i; X register long len = 0; X register unsigned short crc = 0; X X while ((c = getc(stdin)) != EOF) { X len++; X crc = updcrc(c, crc); X } X printf("%05u %6ld", crc, len, fname); X if (fname) X printf(" %s", fname); X printf("\n"); X} X Xerror(s, a1, a2, a3, a4) Xchar *s; X{ X X fprintf(stderr, "crc: "); X fprintf(stderr, s, a1, a2, a3, a4); X fprintf(stderr, "\n"); X errs++; X} + END-OF-FILE crc.c chmod 'u=rw,g=r,o=r' 'crc.c' set `wc -c 'crc.c'` count=$1 case $count in 3512) :;; *) echo 'Bad character count in ''crc.c' >&2 echo 'Count should be 3512' >&2 esac echo Extracting 'log' sed 's/^X//' > 'log' << '+ END-OF-FILE ''log' X41007 6207 commands/animals.c X48404 19498 commands/ar.c X16433 1615 commands/ascii.c X16506 5839 commands/ast.c X60664 4941 commands/at.c X30600 1730 commands/atrun.c X11818 14134 commands/badblocks.c X09785 6370 commands/banner.c X01345 622 commands/basename.c X03957 7987 commands/cal.c X10463 1439 commands/cat.c X36776 11781 commands/cc.c X42817 5931 commands/cdiff.c X57375 732 commands/chgrp.c X27811 2687 commands/chmem.c X34212 6964 commands/chmod.c X46813 727 commands/chown.c X05561 757 commands/clr.c X06733 2220 commands/cmp.c X06836 3433 commands/comm.c X31356 38532 commands/compress.c X63905 3546 commands/cp.c X54611 5843 commands/cpdir.c X27715 5143 commands/cron.c X11198 2223 commands/date.c X49446 5662 commands/dd.c X22124 3577 commands/df.c X16917 5383 commands/diff.c X39760 512 commands/dis88 X37626 3982 commands/diskcheck.c X26190 28473 commands/dosread.c X02565 4395 commands/du.c X48277 723 commands/echo.c X07544 42036 commands/ed.c X23787 2763 commands/expr.c X47116 773 commands/factor.c X41725 9890 commands/fdisk.c X18084 5493 commands/fgrep.c X61039 3220 commands/file.c X28049 12342 commands/find.c X04128 4592 commands/fix.c X51360 299 commands/getlf.c X10255 2751 commands/grep.c X32905 3148 commands/gres.c X01913 1159 commands/head.c X54112 4249 commands/help.c X55302 557 commands/kill.c X20222 4005 commands/libpack.c X44726 2074 commands/libupack.c X18018 1111 commands/ln.c X59287 3973 commands/login.c X60732 7645 commands/lorder.c X06347 1647 commands/lpr.c X49285 13438 commands/ls.c X37830 512 commands/make X56643 512 commands/mined X01732 1319 commands/mkdir.c X52749 25884 commands/mkfs.c X05593 555 commands/mknod.c X39898 5582 commands/more.c X25884 1163 commands/mount.c X37282 3733 commands/mv.c X53701 3923 commands/nm.c X21321 5148 commands/od.c X65009 2392 commands/passwd.c X25508 12000 commands/paste.c X46629 12100 commands/pr.c X44668 2025 commands/prep.c X32932 190 commands/printenv.c X24885 1646 commands/pwd.c X11400 507 commands/readall.c X52678 4113 commands/readclock.c X12013 14455 commands/readfs.c X56057 1456 commands/rev.c X44299 2929 commands/rm.c X33027 2958 commands/rmdir.c X58915 20224 commands/roff.c X30068 45809 commands/sed.c X33160 512 commands/sh X05947 1146 commands/shar.c X08693 1521 commands/size.c X13037 427 commands/sleep.c X47291 31413 commands/sort.c X45875 2073 commands/split.c X44600 4052 commands/strings.c X20678 2829 commands/strip.c X45523 4700 commands/stty.c X03641 1140 commands/su.c X59580 1781 commands/sum.c X57610 140 commands/sync.c X50173 4209 commands/tail.c X19539 9656 commands/tar.c X51512 1178 commands/tee.c X28429 4140 commands/term.c X14056 3832 commands/termcap.c X29234 4230 commands/test.c X49230 2638 commands/time.c X58865 1282 commands/touch.c X10498 3267 commands/tr.c X01207 1737 commands/traverse.c X05558 6938 commands/treecmp.c X47860 2431 commands/tset.c X30205 6563 commands/tsort.c X59715 382 commands/tty.c X20827 1114 commands/umount.c X06117 3263 commands/uniq.c X30359 424 commands/update.c X54324 3180 commands/uudecode.c X02849 1808 commands/uuencode.c X55996 2966 commands/vol.c X56043 2880 commands/wc.c X28719 1686 commands/who.c X25742 279 commands/whoami.c X58277 23674 doc/USER_GUIDE X36003 3239 doc/dis88.man X33297 14653 doc/elle.man X42220 39018 doc/lib.doc X40393 38509 doc/man_pages X63945 44305 doc/net.man X19878 4197 fs/at_makefile X61318 2988 fs/buf.h X31034 10863 fs/cache.c X49601 2925 fs/const.h X32651 273 fs/dev.h X54203 8530 fs/device.c X43804 474 fs/file.h X08379 3225 fs/filedes.c X03291 1502 fs/fproc.h X32100 1013 fs/glo.h X62665 7839 fs/inode.c X05436 1943 fs/inode.h X37259 5662 fs/link.c X15515 15303 fs/main.c X05005 4190 fs/makefile X43484 7670 fs/misc.c X59037 6257 fs/mount.c X08819 9226 fs/open.c X59312 1557 fs/param.h X44200 10716 fs/path.c X46842 4266 fs/pc_makefile X08656 8462 fs/pipe.c X01700 5864 fs/protect.c X11848 1440 fs/putc.c X15755 12205 fs/read.c X14710 5397 fs/stadir.c X11343 8912 fs/super.c X10348 2081 fs/super.h X46563 4312 fs/table.c X03667 2620 fs/time.c X56368 710 fs/type.h X42080 5396 fs/utility.c X00551 7367 fs/write.c X45442 1683 h/callnr.h X55177 7424 h/com.h X21531 4403 h/const.h X48562 2191 h/error.h X03794 1412 h/sgtty.h X06265 1115 h/signal.h X51139 861 h/stat.h X16557 4001 h/type.h X32234 3646 include/a.out.h X50166 133 include/ar.h X61900 152 include/assert.h X26992 673 include/ctype.h X36672 1133 include/errno.h X40434 351 include/fcntl.h X08357 66 include/grp.h X09580 2132 include/limits.h X47777 81 include/memory.h X64720 128 include/pwd.h X65152 634 include/regexp.h X62754 98 include/setjmp.h X03794 1412 include/sgtty.h X06265 1115 include/signal.h X56753 1307 include/stdio.h X42727 263 include/string.h X34166 139 include/time.h X08000 352 include/unistd.h X54909 74 include/utime.h X13220 217 include/utmp.h X17574 3026 kernel/at_makefile X64098 16075 kernel/at_wini.c X61767 9461 kernel/clock.c X35525 40525 kernel/console.c X46559 2880 kernel/const.h X09961 3543 kernel/dmp.c X37030 26551 kernel/floppy.c X57617 941 kernel/glo.h X24617 27165 kernel/klib88.s X01335 11156 kernel/main.c X42475 3015 kernel/makefile X36060 5296 kernel/memory.c X09331 13834 kernel/mpx88.s X50370 3183 kernel/pc_makefile X56408 9952 kernel/printer.c X33362 13732 kernel/proc.c X21644 2324 kernel/proc.h X12176 18813 kernel/ps_wini.c X61265 18997 kernel/rs232.c X14553 19824 kernel/system.c X38305 3634 kernel/table.c X61842 28048 kernel/tty.c X61705 7512 kernel/tty.h X44806 4708 kernel/ttymaps.h X27554 742 kernel/type.h X14198 26433 kernel/xt_wini.c X38561 653 lib/READ_ME X44585 67 lib/abort.c X62378 35 lib/abs.c X00847 116 lib/access.c X53180 130 lib/alarm.c X15118 2103 lib/amoeba.c X02865 1052 lib/atoi.c X09958 308 lib/atol.c X05346 495 lib/bcmp.c X46098 116 lib/bcopy.c X32077 526 lib/brk.c X45837 128 lib/brk2.c X32537 998 lib/bsearch.c X13825 329 lib/bzero.c X45333 2076 lib/call.c X38438 95 lib/chdir.c X24400 114 lib/chmod.c X35694 160 lib/chown.c X52416 97 lib/chroot.c X63814 142 lib/cleanup.c X09772 117 lib/close.c X17351 113 lib/creat.c X52070 880 lib/crypt.c X19954 619 lib/ctermid.c X40552 1960 lib/ctime.c X29735 609 lib/ctype.c X00864 553 lib/cuserid.c X00979 4102 lib/doprintf.c X44155 112 lib/dup.c X07247 130 lib/dup2.c X29888 2327 lib/exec.c X32310 1858 lib/execlp.c X25467 298 lib/exit.c X09724 314 lib/fclose.c X45926 830 lib/fdopen.c X61312 356 lib/fflush.c X12779 224 lib/ffs.c X58025 617 lib/fgetc.c X56675 305 lib/fgets.c X36305 985 lib/fopen.c X41218 103 lib/fork.c X34967 309 lib/fprintf.c X12884 721 lib/fputc.c X23657 102 lib/fputs.c X26759 350 lib/fread.c X10093 175 lib/freopen.c X46552 969 lib/fseek.c X24992 156 lib/fstat.c X58766 407 lib/ftell.c X34432 315 lib/fwrite.c X23802 2784 lib/getcwd.c X49079 172 lib/getegid.c X11147 494 lib/getenv.c X20964 172 lib/geteuid.c X30382 133 lib/getgid.c X35565 2051 lib/getgrent.c X30802 429 lib/getlogin.c X14641 445 lib/getpass.c X01525 107 lib/getpid.c X47346 1734 lib/getpwent.c X34634 228 lib/gets.c X42731 133 lib/getuid.c X01733 96 lib/gtty.c X38698 113 lib/index.c X34565 1710 lib/ioctl.c X41007 187 lib/isatty.c X49081 438 lib/itoa.c X62370 205 lib/kill.c X36738 293 lib/lib.h X18984 146 lib/link.c X34936 811 lib/lsearch.c X53203 261 lib/lseek.c X19750 4607 lib/malloc.c X08173 296 lib/memccpy.c X18528 280 lib/memchr.c X58142 331 lib/memcmp.c X02386 691 lib/memcpy.c X27776 260 lib/memset.c X60920 139 lib/message.c X31402 160 lib/mknod.c X23306 420 lib/mktemp.c X63119 181 lib/mount.c X39272 111 lib/open.c X33919 105 lib/pause.c X43918 1474 lib/perror.c X10862 215 lib/pipe.c X11127 1048 lib/popen.c X04176 360 lib/printdat.c X50919 4044 lib/printk.c X11770 1225 lib/prints.c X36117 117 lib/puts.c X50428 2820 lib/qsort.c X65186 172 lib/rand.c X49122 179 lib/read.c X55285 27651 lib/regexp.c X06232 2106 lib/regsub.c X10614 156 lib/rindex.c X65445 1643 lib/run X18260 5928 lib/scanf.c X33815 299 lib/setbuf.c X06203 121 lib/setgid.c X13969 121 lib/setuid.c X16064 843 lib/signal.c X47616 235 lib/sleep.c X06501 294 lib/sprintf.c X12818 164 lib/stat.c X03184 211 lib/stb.c X32278 91 lib/stderr.c X07568 100 lib/stime.c X46909 267 lib/strcat.c X54813 276 lib/strchr.c X21978 167 lib/strcmp.c X60457 159 lib/strcpy.c X46371 698 lib/strcspn.c X37192 124 lib/strlen.c X50373 442 lib/strncat.c X09417 486 lib/strncmp.c X24852 541 lib/strncpy.c X64825 670 lib/strpbrk.c X51316 301 lib/strrchr.c X31009 705 lib/strspn.c X29781 856 lib/strstr.c X47083 1663 lib/strtok.c X10475 96 lib/stty.c X01903 278 lib/swab.c X40136 103 lib/sync.c X43423 4481 lib/syslib.c X38766 436 lib/system.c X39955 5964 lib/termcap.c X33646 258 lib/time.c X49116 304 lib/times.c X23871 1367 lib/ttyname.c X15882 137 lib/umask.c X08177 96 lib/umount.c X28421 286 lib/ungetc.c X42356 374 lib/uniqport.c X32976 96 lib/unlink.c X12074 187 lib/utime.c X18953 189 lib/wait.c X47336 154 lib/write.c X59150 7857 mm/alloc.c X49710 1833 mm/at_makefile X05784 7234 mm/break.c X43289 744 mm/const.h X37617 17077 mm/exec.c X17024 9871 mm/forkexit.c X34366 1572 mm/getset.c X06761 799 mm/glo.h X41965 7272 mm/main.c X24264 1826 mm/makefile X46388 1661 mm/mproc.h X21684 677 mm/param.h X39295 1890 mm/pc_makefile X54292 1487 mm/putc.c X55828 13811 mm/signal.c X09215 3143 mm/table.c X17333 238 mm/type.h X20567 4181 mm/utility.c X59092 251 test/makefile X29539 100 test/run X20503 22 test/t10a.c X51001 840 test/t11a.c X42075 462 test/t11b.c X01801 5927 test/test0.c X45629 1116 test/test1.c X32574 1765 test/test10.c X11430 1821 test/test11.c X39909 432 test/test12.c X55929 736 test/test13.c X64882 39248 test/test17.c X07191 32979 test/test18.c X03527 4544 test/test19.c X23963 1016 test/test2.c X49300 1461 test/test3.c X19872 1019 test/test4.c X26501 4532 test/test5.c X47521 1253 test/test6.c X43244 526 test/test7.c X27162 1882 test/test8.c X54372 3466 test/test9.c X59520 2249 tools/at_makefile X24715 8072 tools/bootblok.s X12808 1298 tools/changemem X51921 45901 tools/fsck.c X34431 3158 tools/fsck1.s X39871 44 tools/group X21308 6082 tools/init.c X43560 327 tools/message X52749 25884 tools/mkfs.c X52059 97 tools/passwd X59520 2249 tools/pc_makefile X00735 105 tools/profile X09800 197 tools/rc X12541 4 tools/ttys X10241 22 tools/ttytype X17960 11073 commands/dis88/README X19257 7600 commands/dis88/dis.h X42961 20594 commands/dis88/dis88 X03273 5589 commands/dis88/disfp.c X61857 25688 commands/dis88/dishand.c X58032 17458 commands/dis88/dismain.c X16516 777 commands/dis88/disrel.c X12188 30238 commands/dis88/distabs.c X55558 1473 commands/dis88/makefile X18912 1803 commands/make/ReadMe X05068 2100 commands/make/check.c X14691 2457 commands/make/h.h X36629 6577 commands/make/input.c X30757 2366 commands/make/macro.c X32093 4332 commands/make/main.c X05145 7681 commands/make/make.c X22415 498 commands/make/makefile X12045 1795 commands/make/reader.c X27048 4916 commands/make/rules.c X43569 96 commands/mined/makefile X63267 6878 commands/mined/mined.h X49653 60035 commands/mined/mined1.c X09064 44895 commands/mined/mined2.c X58305 127 commands/sh/makefile X38542 7321 commands/sh/sh.h X35063 14561 commands/sh/sh1.c X12818 11571 commands/sh/sh2.c X13189 16895 commands/sh/sh3.c X34776 12321 commands/sh/sh4.c X24520 9258 commands/sh/sh5.c X26188 92 commands/sh/sh6.c + END-OF-FILE log chmod 'u=rw,g=r,o=r' 'log' set `wc -c 'log'` count=$1 case $count in 11822) :;; *) echo 'Bad character count in ''log' >&2 echo 'Count should be 11822' >&2 esac exit 0
daveb@gonzo.UUCP (Dave Brower) (09/30/88)
In article <1443@ast.cs.vu.nl> ast@cs.vu.nl (Andy Tanenbaum) writes: >Johan Stevenson (the person who was the driving force behind Atari MINIX) >just sent me a very useful little program that combines ls -l and sum. It >is called crc, and the call: crc file1 ... prints for each argument both >the file length and a checksum... It would be nice to print the other file vitals -- owner & perms. -dB
jsp@myth.UUCP (Johnnie Peters) (10/02/88)
In article <1443@ast.cs.vu.nl>, ast@cs.vu.nl (Andy Tanenbaum) writes: > Johan Stevenson (the person who was the driving force behind Atari MINIX) Has Atari MINIX been released yet?? -- Johnnie --
johan@nlgvax.UUCP (Johan Stevenson) (10/02/88)
In article <430@gonzo.UUCP> daveb@gonzo.UUCP (Dave Brower) writes: >In article <1443@ast.cs.vu.nl> ast@cs.vu.nl (Andy Tanenbaum) writes: >>Johan Stevenson (the person who was the driving force behind Atari MINIX) >>just sent me a very useful little program that combines ls -l and sum. It >>is called crc, and the call: crc file1 ... prints for each argument both >>the file length and a checksum... > >It would be nice to print the other file vitals -- owner & perms. > >-dB I happen to have such a program as well. It is called inodes(1). The list of file names are read from stdin. All inode types are recognized (directory, special files, and on capable machines: symbolic links and sockets). See the shar file below. Typical uses is: $ find . -print | inodes The big question is: can we standardize on either crc(1) or inodes(1)? Preferences? PS. I even have a version, called tinodes(1), that produces the same output straight from a tar file. Johan W. Stevenson, Philips Research Laboratories, Project Centre Geldrop, Building XR, Room 15, Willem Alexanderlaan 7B, 5664 AN Geldrop, The Netherlands. phone: +31 40 892205 email: johan@pcg.philips.nl -------------------------------- : This is a shar archive. Extract with sh, not csh. : This archive ends with exit, so do not worry about trailing junk. echo 'Extracting inodes.c' sed 's/^X//' > inodes.c << '+ END-OF-FILE inodes.c' X/* X * Tabulate inode characteristics X * X * Author: Johan W. Stevenson X */ X#include <stdio.h> X#include <sys/types.h> X#include <sys/stat.h> X X#define NAMSIZ 256 X Xstruct linkbuf { X struct linkbuf *l_nxt; X ino_t l_ino; X dev_t l_dev; X char l_nam[NAMSIZ]; X}; X Xchar line[NAMSIZ]; Xstruct stat statbuf; Xstruct linkbuf *lhead; X Xmain() { X while (gets(line)) { X#ifdef S_IFLNK X if (lstat(line, &statbuf) < 0) { X#else X if (stat(line, &statbuf) < 0) { X#endif X fprintf(stderr, "cannot stat %s\n", line); X continue; X } X switch (statbuf.st_mode & S_IFMT) { X case S_IFDIR: dir(); break; X case S_IFCHR: dev('c'); break; X case S_IFBLK: dev('b'); break; X case S_IFREG: reg(); break; X#ifdef S_IFLNK X case S_IFLNK: lnk(); break; X#endif X#ifdef S_IFSOCK X case S_IFSOCK: sock(); break; X#endif X default: X fprintf(stderr, "%s: bad mode 0%o\n", line, statbuf.st_mode); X continue; X } X } X exit(0); X} X Xdir() { X register struct stat *p = &statbuf; X X printf( X "d %04o %2d %2d X X %s\n", X p->st_mode & 07777, X p->st_uid, X p->st_gid, X line X ); X} X Xdev(c) { X register struct stat *p = &statbuf; X X printf( X "%c %04o %2d %2d %5d %6d %s\n", X c, X p->st_mode & 07777, X p->st_uid, X p->st_gid, X major(p->st_rdev), X minor(p->st_rdev), X line X ); X} X Xreg() { X register struct stat *p = &statbuf; X X if (p->st_nlink > 1) { X register struct linkbuf *lp; X X for (lp = lhead; lp != NULL; lp = lp->l_nxt) X if (lp->l_ino == p->st_ino && lp->l_dev == p->st_dev) { X printf( X "i XXXX X X X X %s -> %s\n", X line, X lp->l_nam X ); X return; X } X lp = (struct linkbuf *) malloc(sizeof(*lp)); X if (lp == NULL) { X fprintf(stderr, "inodes: out of memory, link information lost\n"); X } else { X lp->l_nxt = lhead; X lhead = lp; X lp->l_ino = p->st_ino; X lp->l_dev = p->st_dev; X strcpy(lp->l_nam, line); X } X } X printf( X "f %04o %2d %2d %05u %6ld %s\n", X p->st_mode & 07777, X p->st_uid, X p->st_gid, X crc(), X p->st_size, X line X ); X} X X#ifdef S_IFLNK Xlnk() { X register struct stat *p = &statbuf; X char buf[NAMSIZ]; X register i; X X i = readlink(line, buf, sizeof(buf)); X if (i < 0) { X fprintf(stderr, "cannot readlink %s\n", line); X return; X } X buf[i] = 0; X printf( X "l %04o %2d %2d X X %s -> %s\n", X p->st_mode & 07777, X p->st_uid, X p->st_gid, X line, X buf X ); X} X#endif X X#ifdef S_IFSOCK Xsock() { X register struct stat *p = &statbuf; X X printf( X "s %04o %2d %2d X X %s\n", X p->st_mode & 07777, X p->st_uid, X p->st_gid, X line X ); X} X#endif X X/* crctab calculated by Mark G. Mendel, Network Systems Corporation */ Xstatic unsigned short crctab[256] = { X 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, X 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, X 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, X 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, X 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, X 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, X 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, X 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, X 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, X 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, X 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, X 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, X 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, X 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, X 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, X 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, X 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, X 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, X 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, X 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, X 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, X 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, X 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, X 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, X 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, X 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, X 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, X 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, X 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, X 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, X 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, X 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 X}; X X/* X * updcrc macro derived from article Copyright (C) 1986 Stephen Satchell. X * NOTE: First argument must be in range 0 to 255. X * Second argument is referenced twice. X * X * Programmers may incorporate any or all code into their programs, X * giving proper credit within the source. Publication of the X * source routines is permitted so long as proper credit is given X * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg, X * Omen Technology. X */ X X#define updcrc(cp, crc) ( crctab[((crc >> 8) & 255)] ^ (crc << 8) ^ cp) X Xcrc() X{ X register unsigned short crc; X register i, c; X register FILE *f; X X if ((f = fopen(line, "r")) == NULL) { X fprintf(stderr, "can't open %s\n", line); X return(0); X } X crc = 0; X while ((c = getc(f)) != EOF) { X crc = updcrc(c, crc); X } X if (ferror(f)) X fprintf(stderr, "read error on %s\n", line); X fclose(f); X return(crc); X} + END-OF-FILE inodes.c chmod 'u=r,g=r,o=r' 'inodes.c' echo 'SENT: -r--r--r-- 1 johan 5557 Oct 1 21:01 inodes.c' echo -n 'RCVD: ' /bin/ls -l inodes.c exit 0
frank@morgan.com (Frank Wortner) (10/04/88)
Johan Stevenson <nlgvax!johan> writes: [... discussion of is programs, crc and inodes --- crc prints a crc checksum of files, while inodes does the same and includes ownership, permissions ...] >The big question is: can we standardize on either crc(1) or inodes(1)? >Preferences? Inodes, of course! Frank
ast@cs.vu.nl (Andy Tanenbaum) (10/04/88)
In article <147@nlgvax.UUCP> johan@nlgvax.UUCP (Johan Stevenson) writes: >The big question is: can we standardize on either crc(1) or inodes(1)? I think we should use crc. What I want to be able to do is go to a directory on one machine and type: crc * and then do it on another machine, and then run diff on the two files. This tells which files differ. If uids and other stuff are present, the two files may differ on the other stuff, and it is a lot of work to figure out if the data are the same. Inodes is a perhaps useful program, but not for this application. While we are on the subject of inodes, it would be useful to have a program that allowed one to interactively edit an i-node. V7 actually had such a program (called lsi, as I recall). It is useful for repairing sick disks. Andy Tanenbaum (ast@cs.vu.nl)
brucee@runx.ips.oz (Bruce Evans) (10/08/88)
Johan Stevenson writes: >Typical uses is: > $ find . -print | inodes >The big question is: can we standardize on either crc(1) or inodes(1)? Inodes(1) is better. It is too difficult to feed lots of files to crc because of the exec stack limit. The file permissions and types are worth having. But printing the uid and gid needs to be made optional. They are purely local. The arg list and not stdin should probably be used when argc > 1. Please replace the fgets(3) by gets(3). Gets() crashes on long lines. Bruce Evans Internet: brucee@runx.ips.oz.au UUCP: uunet!runx.ips.oz.au!brucee
henry@utzoo.uucp (Henry Spencer) (10/09/88)
In article <1461@ast.cs.vu.nl> ast@cs.vu.nl (Andy Tanenbaum) writes: >While we are on the subject of inodes, it would be useful to have a program >that allowed one to interactively edit an i-node. V7 actually had such a >program (called lsi, as I recall). It is useful for repairing sick disks. Not in a standard V7. Various places wrote their own, and PWB had fsdb, but V7 itself didn't come with anything along those lines except clri. At least, not the V7 distribution we got. (The V7 distribution did not remain absolutely invariant over the years; this might have been a late addition, as our V7 tape was definitely an early one.) -- The meek can have the Earth; | Henry Spencer at U of Toronto Zoology the rest of us have other plans.|uunet!attcan!utzoo!henry henry@zoo.toronto.edu
brucee@runx.ips.oz (Bruce Evans) (10/16/88)
Andy Tanenbaum writes: >In article <147@nlgvax.UUCP> johan@nlgvax.UUCP (Johan Stevenson) writes: >>The big question is: can we standardize on either crc(1) or inodes(1)? >I think we should use crc. What I want to be able to do is go to a >directory on one machine and type: > crc * >and then do it on another machine, and then run diff on the two files. Except you don't want want to go to _every_ directory one by one. There are about 30 in 1.3c, and the crc list posted show what happens when it is done by hand: some get omitted. We also need fairly complete pathnames to give diff enough context, e.g. ./minix/lib/* or ./lib/* or lib/*, and this fails due to the exec limit. No doubt it works on a Sun. Wouldn't Minix be better off if all development and maintenance were forced on it? My solution was to make a small modification to crc so I could say cd /user; find include src -type f -print | sort | crc > my_crclist to get a canonical output, i.e., crc now reads filenames from stdin if no arguments are given, and works as before with arguments. In future, the argument '-' should probably mean stdin. Lots of other commands would benefit from this interface but the old ones are probably stuck in the mud. I am keeping 1.3c in /user and local changes in /usr but such absolute names are undesirable in the crc list. I had to edit and sort the master crc list to match. There were fancy headers :-(. The find strips out directories with "-type f", since directories usually contain junk relating to deleted files which makes their crc's useless. Executable files should be ignored too since they depend on local things like library order and stack sizes. There does not seem to be an option in find to do this. I think the source directories should be cleaned up so they contain no executable files anyway. The main offenders are test and tools. I have begun moving files from them to /etc and /etc/system. Find will also expose rubbish in the master directories. Like treecmp. Previously I posted something in favour of inodes (make it this crc with file permissions as well) but needed a simpler solution to handle the current crc list. Actually the inodes output could be readily converted to the crc output with a filter to extract the fields (in C or maybe sed; we don't have awk and sh is too slow). Given this, the official crc list could contain lots of other fields. It would be nice to duplicate the original time stamps. The current inodes is far too slow on large lists. It is probably just searching for links. Minor changes to crc follow. I cleaned it up a bit too. The cdiff was done with -c1 to give only 1 line of context. I think this is the best compromise between ambiguous diffs and large cdiffs produced with -c3. *** /user/sys/commands/crc.c Wed Oct 5 22:40:20 1988 --- crc.c Sat Oct 15 00:24:39 1988 *************** *** 2,7 **** ! ! #include <stdio.h> ! ! int errs; --- 2,8 ---- ! #include <stdio.h> ! #include <string.h> ! ! int errs; ! char line[256]; *************** *** 12,20 **** if (argc <= 1) ! crc((char *)0); ! else ! do { ! if (freopen(argv[1], "r", stdin) == NULL) ! error("cannot open %s", argv[1]); ! else ! crc(argv[1]); argv++; --- 13,23 ---- if (argc <= 1) ! while (fgets(line, sizeof line, stdin) != NULL) ! { ! if (index(line, '\n') != NULL) ! *index(line, '\n') = 0; ! crc(line); ! } ! else ! do { ! crc(argv[1]); argv++; *************** *** 78,81 **** { ! register int c; ! register int i; register long len = 0; --- 81,84 ---- { ! register FILE *fp; ! register int c; register long len = 0; *************** *** 83,85 **** ! while ((c = getc(stdin)) != EOF) { len++; --- 86,92 ---- ! if ((fp = fopen(fname, "r")) == NULL) { ! fprintf(stderr, "crc: cannot open %s\n", fname); ! errs++; ! } ! while ((c = getc(fp)) != EOF) { len++; *************** *** 87,102 **** } ! printf("%05u %6ld", crc, len, fname); ! if (fname) ! printf(" %s", fname); ! printf("\n"); ! } ! ! error(s, a1, a2, a3, a4) ! char *s; ! { ! ! fprintf(stderr, "crc: "); ! fprintf(stderr, s, a1, a2, a3, a4); ! fprintf(stderr, "\n"); ! errs++; ! } --- 94,97 ---- } ! fclose(fp); ! printf("%05u %6ld %s\n", crc, len, fname); ! } Bruce Evans Internet: brucee@runx.ips.oz.au UUCP: uunet!runx.ips.oz.au!brucee
deraadt@dataspan.UUCP (Theo De Raadt) (10/17/88)
In article <13@myth.UUCP>, jsp@myth.UUCP (Johnnie Peters) writes: >In article <1443@ast.cs.vu.nl>, ast@cs.vu.nl (Andy Tanenbaum) writes: >> Johan Stevenson (the person who was the driving force behind Atari MINIX) >Has Atari MINIX been released yet?? How about another question, does someone have a 68K version of Minix? I would like to read some of this. <tdr. -- _____ _ ----------------------------------- / / / / \ _ _ /_/_ Theo de Raadt: (403) 289-4620 / /_ _ ___ __/_ /__/ _\ _\ __/ / DATASPAN / / /</_(_) (_/</_/ \_(_/\(_/\(_/_(_/ ..!alberta!calgary!dataspan!deraadt