From be853ae4903b4b2a2740eb86acdd68abd3963d26 Mon Sep 17 00:00:00 2001 From: gdr Date: Fri, 16 Jan 1998 04:16:17 +0000 Subject: [PATCH] Initial checkin as submitted by Dave Tribby. --- usr.bin/cksum/Makefile | 23 +++ usr.bin/cksum/cksum.1 | 207 +++++++++++++++++++++++++ usr.bin/cksum/cksum.c | 187 ++++++++++++++++++++++ usr.bin/cksum/cksum.desc | 10 ++ usr.bin/cksum/cksum.rez | 30 ++++ usr.bin/cksum/crc.c | 232 ++++++++++++++++++++++++++++ usr.bin/cksum/crc32.c | 141 +++++++++++++++++ usr.bin/cksum/extern.h | 46 ++++++ usr.bin/cksum/print.c | 104 +++++++++++++ usr.bin/cksum/sum.desc | 10 ++ usr.bin/cksum/sum1.c | 126 +++++++++++++++ usr.bin/cksum/sum2.c | 94 +++++++++++ usr.bin/cksum/tests/afile.n | 15 ++ usr.bin/cksum/tests/afile.r | 15 ++ usr.bin/cksum/tests/afile.r.crc | 1 + usr.bin/cksum/tests/afile.r.o1 | 1 + usr.bin/cksum/tests/afile2.n | 15 ++ usr.bin/cksum/tests/afile2.r | 15 ++ usr.bin/cksum/tests/cksum.noasm | Bin 0 -> 96674 bytes usr.bin/cksum/tests/cksum.noasm.crc | 1 + usr.bin/cksum/tests/cksum.noasm.o1 | 1 + usr.bin/cksum/tests/cksum.noasm.o2 | 1 + usr.bin/cksum/tests/cksum.noasm.o3 | 1 + usr.bin/cksum/tests/crc.list | 4 + usr.bin/cksum/tests/dotests | 153 ++++++++++++++++++ usr.bin/cksum/tests/fulltests | 29 ++++ usr.bin/cksum/tests/o1.list | 4 + usr.bin/cksum/tests/o2.list | 4 + usr.bin/cksum/tests/o3.list | 4 + 29 files changed, 1474 insertions(+) create mode 100644 usr.bin/cksum/Makefile create mode 100644 usr.bin/cksum/cksum.1 create mode 100644 usr.bin/cksum/cksum.c create mode 100644 usr.bin/cksum/cksum.desc create mode 100644 usr.bin/cksum/cksum.rez create mode 100644 usr.bin/cksum/crc.c create mode 100644 usr.bin/cksum/crc32.c create mode 100644 usr.bin/cksum/extern.h create mode 100644 usr.bin/cksum/print.c create mode 100644 usr.bin/cksum/sum.desc create mode 100644 usr.bin/cksum/sum1.c create mode 100644 usr.bin/cksum/sum2.c create mode 100644 usr.bin/cksum/tests/afile.n create mode 100644 usr.bin/cksum/tests/afile.r create mode 100644 usr.bin/cksum/tests/afile.r.crc create mode 100644 usr.bin/cksum/tests/afile.r.o1 create mode 100644 usr.bin/cksum/tests/afile2.n create mode 100644 usr.bin/cksum/tests/afile2.r create mode 100644 usr.bin/cksum/tests/cksum.noasm create mode 100644 usr.bin/cksum/tests/cksum.noasm.crc create mode 100644 usr.bin/cksum/tests/cksum.noasm.o1 create mode 100644 usr.bin/cksum/tests/cksum.noasm.o2 create mode 100644 usr.bin/cksum/tests/cksum.noasm.o3 create mode 100644 usr.bin/cksum/tests/crc.list create mode 100644 usr.bin/cksum/tests/dotests create mode 100644 usr.bin/cksum/tests/fulltests create mode 100644 usr.bin/cksum/tests/o1.list create mode 100644 usr.bin/cksum/tests/o2.list create mode 100644 usr.bin/cksum/tests/o3.list diff --git a/usr.bin/cksum/Makefile b/usr.bin/cksum/Makefile new file mode 100644 index 0000000..70ac9a1 --- /dev/null +++ b/usr.bin/cksum/Makefile @@ -0,0 +1,23 @@ +# +# This makefile is intended for use with dmake(1) on Apple IIGS +# $Id: Makefile,v 1.1 1998/01/16 04:16:10 gdr Exp $ +# +# Created by Dave Tribby, December 1997 + +PROG= cksum +SRCS= cksum.c crc.c print.c sum1.c sum2.c crc32.c + +CFLAGS = -v +.INCLUDE : /src/gno/prog.mk + +# Under UNIX, chsum whould be linked to sum (and cksum.1 to sum.1) +# For GNO, just copy the program. (Need to invoke "dmake sum") +sum: cksum + cp cksum sum + +# +# Additional dependancies +# + +cksum.o:: extern.h +print.o:: extern.h diff --git a/usr.bin/cksum/cksum.1 b/usr.bin/cksum/cksum.1 new file mode 100644 index 0000000..161149c --- /dev/null +++ b/usr.bin/cksum/cksum.1 @@ -0,0 +1,207 @@ +.\" Copyright (c) 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" This code is derived from software contributed to Berkeley by +.\" the Institute of Electrical and Electronics Engineers, Inc. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)cksum.1 8.2 (Berkeley) 4/28/95 +.\" $Id: cksum.1,v 1.1 1998/01/16 04:16:10 gdr Exp $ +.\" +.TH CKSUM 1 "December 1997" "GNO" "Commands and Applications" +.SH NAME +.BR cksum +\- display file checksums and block counts +.SH SYNOPSIS +.BR cksum +.RB [ "-o 1" " | " 2 " | " 3 +.RI "] [" file\0 ...] +.PP +.BR sum +.RI [ file\0 ...] +.SH DESCRIPTION +The +.BR cksum +utility writes to the standard output three whitespace separated +fields for each input file. +These fields are a checksum +.BR CRC , +the total number of octets in the file and the file name. +If no file name is specified, the standard input is used and no file name +is written. +.PP +The +.BR sum +utility is identical to the +.BR cksum +utility, except that it defaults to using historic algorithm 1, +described below. +It is provided for compatibility. +You can either install the +.BR sum +program (which has the same content as the +.BR cksum +program file) or create a +.IR gsh (1) +alias that invokes +.BR cksum : +.nf + alias sum "cksum -o 1" +.fi +.PP +The program options are as follows: +.RS +.IP \fB-o\fR +Use historic algorithms instead of the (superior) default one. +.PP +.RS +Algorithm 1 is the algorithm used by historic +systems as the +.BR sum (1) +algorithm and by historic +systems as the +.BR sum +algorithm when using the +.BR -r +option. +This is a 16-bit checksum, with a right rotation before each addition; +overflow is discarded. +.PP +.RS +Algorithm 2 is the algorithm used by historic +systems as the +default +.BR sum +algorithm. +This is a 32-bit checksum, and is defined as follows: +.nf + s = sum of all bytes; + r = s % 2^16 + (s % 2^32) / 2^16; + cksum = (r % 2^16) + r / 2^16; +.fi +.PP +.RS +Algorithm 3, a 32-bit checksum, is commonly called the +.BR "32bit CRC" +algorithm. +.PP +.RS +Algorithms 1 and 2 write the same fields as +the default algorithm except the size of the file is +expressed in blocks. +For historic reasons, the block size is 1024 for algorithm 1 and 512 +for algorithm 2. +Partial blocks are rounded up. +.RE +.PP +The default +.BR CRC +used is based on the polynomial used for +.BR CRC +error checking +in the networking standard +POSIX-3. +The +.BR CRC +checksum encoding is defined by the generating polynomial: +.PP +.nf +G(x) = x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1 +.fi +.PP +Mathematically, the +.BR CRC +value corresponding to a given file is defined by +the following procedure: +.PP +.RS +The +.BR n +bits to be evaluated are considered to be the coefficients of a mod 2 +polynomial M(x) of degree +.BR n-1 . +These +.BR n +bits are the bits from the file, with the most significant bit being the most +significant bit of the first octet of the file and the last bit being the least +significant bit of the last octet, padded with zero bits (if necessary) to +achieve an integral number of octets, followed by one or more octets +representing the length of the file as a binary value, least significant octet +first. +The smallest number of octets capable of representing this integer are used. +.PP +.RS +M(x) is multiplied by x^32 (i.e., shifted left 32 bits) and divided by +G(x) using mod 2 division, producing a remainder R(x) of degree <= 31. +The coefficients of R(x) are considered to be a 32-bit sequence. +The bit sequence is complemented and the result is the CRC. +.PP +.RS +The default calculation is identical to that given in pseudo-code +in the +article "Computation of Cyclic Redundancy Checks Via Table Lookup" +by +Dilip V. Sarwate, +.IR "Communications of the ACM" ", August 1988." +.RE +.PP +The +.BR cksum +and +.BR sum +utilities exit 0 on success, and >0 if an error occurs. +.SH VERSION +This manual page documents +.BR cksum +version 2.0. +.SH ATTRIBUTIONS +This command was ported from FreeBSD source code +for distribution with GNO/ME 2.0.6. +.SH HISTORY +A version of +.BR sum +translated from GNU code in 1991 by Marek Pawlowski was distributed with +earlier releases of GNO. Unfortunately, as that version reads files it +translates carriage return characters into new line characters. To use +.BR cksum +to calulate a checksum that matches the old +.BR sum , +use +.IR tr (1) +to translate the input stream. For example, +.nf + tr '\\r' '\\n' < filename | cksum -o 1 +.fi +.SH STANDARDS +The +.BR cksum +utility is expected to conform to +POSIX-2. diff --git a/usr.bin/cksum/cksum.c b/usr.bin/cksum/cksum.c new file mode 100644 index 0000000..78c89a8 --- /dev/null +++ b/usr.bin/cksum/cksum.c @@ -0,0 +1,187 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * James W. Williams of NASA Goddard Space Flight Center. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Modified for GNO (Apple IIGS) by Dave Tribby, December 1997 + * + * Constructs unacceptable to compiler are replaced using #ifndef __ORCAC__ + * + * Changes not related to compiler are replaced using #ifndef __GNO__ + * + * Added prototyped headers, surrounded by #ifndef __STDC__ + */ + + +#ifndef __GNO__ +#ifndef lint +static const char copyright[] = +"@(#) Copyright (c) 1991, 1993\n\ + The Regents of the University of California. All rights reserved.\n"; +#endif /* not lint */ + +#ifndef lint +#if 0 +static char sccsid[] = "@(#)cksum.c 8.2 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id: cksum.c,v 1.1 1998/01/16 04:16:11 gdr Exp $"; +#endif /* not lint */ +#endif /* not GNO */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "extern.h" + +static void usage __P((void)); + + +/* Interface to check on how much stack space a C program uses. */ +#if defined(__GNO__) && defined(__STACK_CHECK__) +#ifndef _GNO_GNO_H_ +#include +#endif +static void report_stack(void) +{ + fprintf(stderr,"\n ==> %d stack bytes used <== \n", _endStackCheck()); +} +#endif + + +int +#ifndef __STDC__ +main(argc, argv) + int argc; + char **argv; +#else +main(int argc, + char *argv[]) +#endif +{ + register int ch, fd, rval; + u_long len, val; + char *fn, *p; + int (*cfncn) __P((int, unsigned long *, unsigned long *)); + void (*pfncn) __P((char *, unsigned long, unsigned long)); + +#if defined(__GNO__) && defined(__STACK_CHECK__) + _beginStackCheck(); + atexit(report_stack); +#endif + if ((p = rindex(argv[0], '/')) == NULL) + p = argv[0]; + else + ++p; + if (!strcmp(p, "sum")) { + cfncn = csum1; + pfncn = psum1; + } else { + cfncn = crc; + pfncn = pcrc; + } + + while ((ch = getopt(argc, argv, "o:")) != -1) + switch (ch) { + case 'o': + if (!strcmp(optarg, "1")) { + cfncn = csum1; + pfncn = psum1; + } else if (!strcmp(optarg, "2")) { + cfncn = csum2; + pfncn = psum2; + } else if (*optarg == '3') { + cfncn = crc32; + pfncn = pcrc; + } else { + warnx("illegal argument to -o option"); + usage(); + } + break; + case '?': + default: + usage(); + } +#ifndef __ORCAC__ + argv += optind; +#else + argv = argv + optind; +#endif + + fd = STDIN_FILENO; + fn = NULL; + rval = 0; + do { + if (*argv) { + fn = *argv++; +#ifndef __GNO__ + if ((fd = open(fn, O_RDONLY, 0)) < 0) { +#else /* Under GNO, 3rd param only valid when creating */ + if ((fd = open(fn, O_RDONLY)) < 0) { +#endif + warn("%s", fn); + rval = 1; + continue; + } + } + if (cfncn(fd, &val, &len)) { + warn("%s", fn ? fn : "stdin"); + rval = 1; + } else + pfncn(fn, val, len); + (void)close(fd); + } while (*argv); + exit(rval); +} + +static void +#ifndef __STDC__ +usage() +#else +usage(void) +#endif +{ + (void)fprintf(stderr, "usage: cksum [-o 1 | 2] [file ...]\n"); + (void)fprintf(stderr, " sum [file ...]\n"); + exit(1); +} diff --git a/usr.bin/cksum/cksum.desc b/usr.bin/cksum/cksum.desc new file mode 100644 index 0000000..482a5cb --- /dev/null +++ b/usr.bin/cksum/cksum.desc @@ -0,0 +1,10 @@ +Name: cksum +Version: 2.0 (December 1997) +Shell: GNO +Author: Dave Tribby (from FreeBSD code) +Contact: tribby@cup.hp.com +Where: /usr/bin +FTP: ground.isca.uiowa.edu apple2.caltech.edu trenco.myrias.com + + Display file checksums and block counts + diff --git a/usr.bin/cksum/cksum.rez b/usr.bin/cksum/cksum.rez new file mode 100644 index 0000000..1e64faf --- /dev/null +++ b/usr.bin/cksum/cksum.rez @@ -0,0 +1,30 @@ +/* + * Resources for version and comment + * $Id: cksum.rez,v 1.1 1998/01/16 04:16:11 gdr Exp $ + */ +#define PROG "cksum/sum" +#define DESC "Display file checksums and block counts" + +#include "Types.rez" + +/* + * Version + */ +resource rVersion (1, purgeable3) { + { 2, 0, 0, /* Version 2.0.0 */ + release, /* development|alpha|beta|final|release */ + 0 }, /* non-final release number */ + verUS, /* Country */ + PROG, /* Program name */ + DESC " Released with GNO/ME." +}; + + +/* + * Comment + */ +resource rComment (1, purgeable3) { + PROG " v2.0 (December 1997)\n" + "GNO utility: " DESC "\n" + "Ported from FreeBSD code by Dave Tribby." +}; diff --git a/usr.bin/cksum/crc.c b/usr.bin/cksum/crc.c new file mode 100644 index 0000000..ff50a6e --- /dev/null +++ b/usr.bin/cksum/crc.c @@ -0,0 +1,232 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * James W. Williams of NASA Goddard Space Flight Center. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Modified for GNO (Apple IIGS) by Dave Tribby, December 1997 + * + * Constructs unacceptable to compiler are replaced using #ifndef __ORCAC__ + * + * Changes not related to compiler are replaced using #ifndef __GNO__ + * + * Added prototyped headers, surrounded by #ifndef __STDC__ + */ + + +#ifndef __GNO__ +#ifndef lint +static char sccsid[] = "@(#)crc.c 8.1 (Berkeley) 6/17/93"; +#endif /* not lint */ +#endif /* not GNO */ + +#include +#include + +static u_long crctab[] = { + 0x0, + 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, + 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, + 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, + 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, + 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, + 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, + 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, + 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, + 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, + 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, + 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, + 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, + 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, + 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, + 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, + 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07, + 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, + 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, + 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, + 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, + 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, + 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, + 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, + 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f, + 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, + 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, + 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, + 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, + 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629, + 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, + 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, + 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, + 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, + 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8, + 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, + 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, + 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, + 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, + 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, + 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21, + 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, + 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087, + 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, + 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, + 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, + 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, + 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, + 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, + 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, + 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, + 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 +}; + +/* + * Compute a POSIX 1003.2 checksum. This routine has been broken out so that + * other programs can use it. It takes a file descriptor to read from and + * locations to store the crc and the number of bytes read. It returns 0 on + * success and 1 on failure. Errno is set on failure. + */ +#ifndef __GNO__ +u_long crc_total = ~0; /* The crc over a number of files. */ + /* Doesn't seem to be used, so leave it out! */ +#endif + +int +#ifndef __STDC__ +crc(fd, cval, clen) + register int fd; + u_long *cval, *clen; +#else +crc(register int fd, + u_long *cval, + u_long *clen) +#endif +{ + register u_char *p; + register int nr; + register u_long crc, len; +#ifndef __GNO__ + u_char buf[16 * 1024]; +#else + static u_char buf[16 * 1024]; +#endif +#if defined(__NOASM__) || !defined(__ORCAC__) +#define COMPUTE(var, ch) (var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)] +#else + /* Replace macro with hand-optimized code for Apple IIGS */ + u_long var8; +#endif + + crc = len = 0; +#ifndef __GNO__ + crc_total = ~crc_total; +#endif + while ((nr = read(fd, buf, sizeof(buf))) > 0) + for (len += nr, p = buf; nr--; ++p) { +#if defined(__NOASM__) || !defined(__ORCAC__) + COMPUTE(crc, *p); +#else + asm{ + lda crc+1 ; Shift crc left by 1 byte + sta var8+2 ; and store in var8. + lda crc-1 + and #0xFF00 + sta var8 + + lda crc+3 ; Exclusive OR low-order byte + eor [p] ; of crc with value of *p, + and #0x00FF + asl A ; then use as index into + asl A ; array of u_long values. + tax + + lda >crctab,X ; Get low-order word, + eor var8 ; combine with shifted crc, + sta crc ; and save as new crc. + + inx + inx + lda >crctab,X ; Get high-order word, + eor var8+2 ; combine with shifted crc, + sta crc+2 ; and save as new crc. + } +#endif +#ifndef __GNO__ + COMPUTE(crc_total, *p); +#endif + } + if (nr < 0) + return (1); + + *clen = len; + + /* Include the length of the file. */ + for (; len != 0; len >>= 8) { +#if defined(__NOASM__) || !defined(__ORCAC__) + COMPUTE(crc, len & 0xff); +#else + asm{ + lda crc+1 ; Shift crc left by 1 byte + sta var8+2 ; and store in var8. + lda crc-1 + and #0xFF00 + sta var8 + + lda crc+3 ; Exclusive OR low-order bytes + eor len ; of crc and len. + and #0x00FF + asl A ; then use as index into + asl A ; array of u_long values. + tax + + lda >crctab,X ; Get low-order word, + eor var8 ; combine with shifted crc, + sta crc ; and save as new crc. + + inx + inx + lda >crctab,X ; Get high-order word, + eor var8+2 ; combine with shifted crc, + sta crc+2 ; and save as new crc. + } +#endif +#ifndef __GNO__ + COMPUTE(crc_total, len & 0xff); +#endif + } + + *cval = ~crc; +#ifndef __GNO__ + crc_total = ~crc_total; +#endif + return (0); +} diff --git a/usr.bin/cksum/crc32.c b/usr.bin/cksum/crc32.c new file mode 100644 index 0000000..c1b7acd --- /dev/null +++ b/usr.bin/cksum/crc32.c @@ -0,0 +1,141 @@ +/* + * This code implements the AUTODIN II polynomial used by Ethernet, + * and can be used to calculate multicast address hash indices. + * It assumes that the low order bits will be transmitted first, + * and consequently the low byte should be sent first when + * the crc computation is finished. The crc should be complemented + * before transmission. + * The variable corresponding to the macro argument "crc" should + * be an unsigned long and should be preset to all ones for Ethernet + * use. An error-free packet will leave 0xDEBB20E3 in the crc. + * Spencer Garrett + */ + +/* + * Modified for GNO (Apple IIGS) by Dave Tribby, December 1997 + * + * Constructs unacceptable to compiler are replaced using #ifndef __ORCAC__ + * + * Changes not related to compiler are replaced using #ifndef __GNO__ + * + * Added prototyped headers, surrounded by #ifndef __STDC__ + */ + + +#define CRC(crc, ch) (crc = (crc >> 8) ^ crctab[(crc ^ (ch)) & 0xff]) + +/* generated using the AUTODIN II polynomial + * x^32 + x^26 + x^23 + x^22 + x^16 + + * x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + 1 + */ +unsigned long crctab[256] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, + 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, + 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, + 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, + 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, + 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, + 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, + 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, + 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, + 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, + 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, + 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, + 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, + 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, + 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, + 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, + 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, + 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, + 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, + 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, + 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, + 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, + 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, + 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, + 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, + 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, + 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, + 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, + 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, + 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, + 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, + 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, + 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, + 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, +}; + +#include +#include +#ifdef __GNO__ +#include +#endif + +u_long crc32_total = 0 ; + +int +#ifndef __STDC__ +crc32(fd, cval, clen) + register int fd; + u_long *cval, *clen; +#else +crc32(register int fd, + u_long *cval, + u_long *clen) +#endif +{ + u_long crc = ~0; +#ifndef __GNO__ + char buf[BUFSIZ], *p ; +#else + static char buf[BUFSIZ] ; + char *p ; +#endif + int len, nr ; + FILE *in; + + len = 0 ; + crc32_total = ~crc32_total ; + while (nr = read(fd, buf, sizeof(buf))) + for (len += nr, p = buf; nr--; ++p) { + CRC(crc, *p) ; + CRC(crc32_total, *p) ; + } + if (nr < 0) + return 1 ; + + *clen = len ; + *cval = ~crc ; + crc32_total = ~crc32_total ; + return 0 ; +} diff --git a/usr.bin/cksum/extern.h b/usr.bin/cksum/extern.h new file mode 100644 index 0000000..2d43490 --- /dev/null +++ b/usr.bin/cksum/extern.h @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)extern.h 8.1 (Berkeley) 6/6/93 + */ + +#include + +__BEGIN_DECLS +int crc __P((int, unsigned long *, unsigned long *)); +void pcrc __P((char *, unsigned long, unsigned long)); +void psum1 __P((char *, unsigned long, unsigned long)); +void psum2 __P((char *, unsigned long, unsigned long)); +int csum1 __P((int, unsigned long *, unsigned long *)); +int csum2 __P((int, unsigned long *, unsigned long *)); +int crc32 __P((int, unsigned long *, unsigned long *)); +__END_DECLS diff --git a/usr.bin/cksum/print.c b/usr.bin/cksum/print.c new file mode 100644 index 0000000..d280820 --- /dev/null +++ b/usr.bin/cksum/print.c @@ -0,0 +1,104 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Modified for GNO (Apple IIGS) by Dave Tribby, December 1997 + * + * Constructs unacceptable to compiler are replaced using #ifndef __ORCAC__ + * + * Changes not related to compiler are replaced using #ifndef __GNO__ + * + * Added prototyped headers, surrounded by #ifndef __STDC__ + */ + + +#ifndef __GNO__ +#ifndef lint +static char sccsid[] = "@(#)print.c 8.1 (Berkeley) 6/6/93"; +#endif /* not lint */ +#endif /* not GNO */ + +#include +#include +#include "extern.h" + +void +#ifndef __STDC__ +pcrc(fn, val, len) + char *fn; + u_long val, len; +#else +pcrc(char *fn, + u_long val, + u_long len) +#endif +{ + (void)printf("%lu %lu", val, len); + if (fn) + (void)printf(" %s", fn); + (void)printf("\n"); +} + +void +#ifndef __STDC__ +psum1(fn, val, len) + char *fn; + u_long val, len; +#else +psum1(char *fn, + u_long val, + u_long len) +#endif +{ + (void)printf("%lu %lu", val, (len + 1023) / 1024); + if (fn) + (void)printf(" %s", fn); + (void)printf("\n"); +} + +void +#ifndef __STDC__ +psum2(fn, val, len) + char *fn; + u_long val, len; +#else +psum2(char *fn, + u_long val, + u_long len) +#endif +{ + (void)printf("%lu %lu", val, (len + 511) / 512); + if (fn) + (void)printf(" %s", fn); + (void)printf("\n"); +} diff --git a/usr.bin/cksum/sum.desc b/usr.bin/cksum/sum.desc new file mode 100644 index 0000000..ece3fc6 --- /dev/null +++ b/usr.bin/cksum/sum.desc @@ -0,0 +1,10 @@ +Name: sum +Version: 2.0 (December 1997) +Shell: GNO +Author: Dave Tribby (from FreeBSD code) +Contact: tribby@cup.hp.com +Where: /usr/bin +FTP: ground.isca.uiowa.edu apple2.caltech.edu trenco.myrias.com + + Display file checksums and block counts (same as cksum) + diff --git a/usr.bin/cksum/sum1.c b/usr.bin/cksum/sum1.c new file mode 100644 index 0000000..051006a --- /dev/null +++ b/usr.bin/cksum/sum1.c @@ -0,0 +1,126 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Modified for GNO (Apple IIGS) by Dave Tribby, December 1997 + * + * Constructs unacceptable to compiler are replaced using #ifndef __ORCAC__ + * + * Changes not related to compiler are replaced using #ifndef __GNO__ + * + * Added prototyped headers, surrounded by #ifndef __STDC__ + */ + + +#ifndef __GNO__ +#ifndef lint +static char sccsid[] = "@(#)sum1.c 8.1 (Berkeley) 6/6/93"; +#endif /* not lint */ +#endif /* not GNO */ + +#include +#include + +int +#ifndef __STDC__ +csum1(fd, cval, clen) + register int fd; + u_long *cval, *clen; +#else +csum1(register int fd, + u_long *cval, + u_long *clen) +#endif +{ + register u_long total; + register int nr; +#ifndef __GNO__ + register u_int crc; +#else + register u_long crc; +#endif + register u_char *p; +#ifndef __GNO__ + u_char buf[8192]; +#else + static u_char buf[8192]; +#endif + + /* + * 16-bit checksum, rotating right before each addition; + * overflow is discarded. + */ + crc = total = 0; + while ((nr = read(fd, buf, sizeof(buf))) > 0) +#if defined(__NOASM__) || !defined(__ORCAC__) + for (total += nr, p = buf; nr--; ++p) { + if (crc & 1) + crc |= 0x10000; + crc = ((crc >> 1) + *p) & 0xffff; + } +#else + /* Hand-optimized code for Apple IIGS */ + asm{ + ldx #0 ; Use x-reg to index into buf. + clc ; total = + lda nr ; nr + adc total ; + total + sta total + bcc nextchar ; If total overflows, + inc total+2 ; increment high-order word. + nextchar: + clc + lda crc ; Get current crc. + bit #1 ; If low-order bit is set, + beq rotate ; set carry flag for rotate. + sec + rotate: + ror A ; Rotate right 1 bit. + sta crc ; Temporarially store result. + lda >buf,x ; Get next character + and #0xff ; (low-order byte only) + clc ; and add to crc. + adc crc + sta crc + inx ; Bump pointer. + dec nr ; Decrement byte counter. + bne nextchar ; Stay in loop until done. + } +#endif + if (nr < 0) + return(1); + + *cval = crc; + *clen = total; + return(0); +} diff --git a/usr.bin/cksum/sum2.c b/usr.bin/cksum/sum2.c new file mode 100644 index 0000000..410b3ab --- /dev/null +++ b/usr.bin/cksum/sum2.c @@ -0,0 +1,94 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Modified for GNO (Apple IIGS) by Dave Tribby, December 1997 + * + * Constructs unacceptable to compiler are replaced using #ifndef __ORCAC__ + * + * Changes not related to compiler are replaced using #ifndef __GNO__ + * + * Added prototyped headers, surrounded by #ifndef __STDC__ + */ + + +#ifndef __GNO__ +#ifndef lint +static char sccsid[] = "@(#)sum2.c 8.1 (Berkeley) 6/6/93"; +#endif /* not lint */ +#endif /* not GNO */ + +#include +#include + +int +#ifndef __STDC__ +csum2(fd, cval, clen) + register int fd; + u_long *cval, *clen; +#else +csum2(register int fd, + u_long *cval, + u_long *clen) +#endif +{ + register u_long crc, total; + register int nr; + register u_char *p; +#ifndef __GNO__ + u_char buf[8192]; +#else + static u_char buf[8192]; +#endif + + /* + * Draft 8 POSIX 1003.2: + * + * s = sum of all bytes + * r = s % 2^16 + (s % 2^32) / 2^16 + * crc = (r % 2^16) + r / 2^16 + */ + crc = total = 0; + while ((nr = read(fd, buf, sizeof(buf))) > 0) + for (total += nr, p = buf; nr--; ++p) + crc += *p; + if (nr < 0) + return(1); + + crc = (crc & 0xffff) + (crc >> 16); + crc = (crc & 0xffff) + (crc >> 16); + + *cval = crc; + *clen = total; + return(0); +} diff --git a/usr.bin/cksum/tests/afile.n b/usr.bin/cksum/tests/afile.n new file mode 100644 index 0000000..4960723 --- /dev/null +++ b/usr.bin/cksum/tests/afile.n @@ -0,0 +1,15 @@ +This is line one +of some ASCII text to be used for testing the checksum program. +A + B + C + D + E + f + g + h + i +jklmn +OPQRS +tUvWxYz +This is the last line \ No newline at end of file diff --git a/usr.bin/cksum/tests/afile.r b/usr.bin/cksum/tests/afile.r new file mode 100644 index 0000000..4960723 --- /dev/null +++ b/usr.bin/cksum/tests/afile.r @@ -0,0 +1,15 @@ +This is line one +of some ASCII text to be used for testing the checksum program. +A + B + C + D + E + f + g + h + i +jklmn +OPQRS +tUvWxYz +This is the last line \ No newline at end of file diff --git a/usr.bin/cksum/tests/afile.r.crc b/usr.bin/cksum/tests/afile.r.crc new file mode 100644 index 0000000..75fa27a --- /dev/null +++ b/usr.bin/cksum/tests/afile.r.crc @@ -0,0 +1 @@ +251823970 176 diff --git a/usr.bin/cksum/tests/afile.r.o1 b/usr.bin/cksum/tests/afile.r.o1 new file mode 100644 index 0000000..133a60c --- /dev/null +++ b/usr.bin/cksum/tests/afile.r.o1 @@ -0,0 +1 @@ +57216 1 diff --git a/usr.bin/cksum/tests/afile2.n b/usr.bin/cksum/tests/afile2.n new file mode 100644 index 0000000..ca6fc6c --- /dev/null +++ b/usr.bin/cksum/tests/afile2.n @@ -0,0 +1,15 @@ +This is line one +of some ASCII text to be used for testing the checksum program. +tUvWxYz +OPQRS +jklmn + i + h + g + f + E + D + C + B +A +This is the last line \ No newline at end of file diff --git a/usr.bin/cksum/tests/afile2.r b/usr.bin/cksum/tests/afile2.r new file mode 100644 index 0000000..ca6fc6c --- /dev/null +++ b/usr.bin/cksum/tests/afile2.r @@ -0,0 +1,15 @@ +This is line one +of some ASCII text to be used for testing the checksum program. +tUvWxYz +OPQRS +jklmn + i + h + g + f + E + D + C + B +A +This is the last line \ No newline at end of file diff --git a/usr.bin/cksum/tests/cksum.noasm b/usr.bin/cksum/tests/cksum.noasm new file mode 100644 index 0000000000000000000000000000000000000000..9c4079e40e6477418562e22d58934059a8ede985 GIT binary patch literal 96674 zcmeEv2|!d;_xOFYFANMIi{LVj`$lADq-mC#<5F&Axs)Od4zdcUsg=Xvh+(L0qG^ia z0|rA}QVh3JA+fBf#!|B~Q_|L{rc5pQpL5@vna3j8_x089`~EZV=FYqC-gD1A_uO;N z-OdXY6Z$zW!axGw3}MVPivMD0*ozDyI?u=NsbP<&XBaaxN2kTc|H$PfL_sF=c?$T@ z!H0ny5b^*YF5|oP)~{DF{#Hv}TRF_6@>Y14-MNXTm@LVlafkUkXa z<}iU$;L{u?nOX6PY4aarh*Cj_C4nK|(xlA+p%lLnkmMOvGa0f2GAElD5_m%(Pzro* zfJt)VQONuqB-owEkSLn8IZTxFN%KH5rcJwL7DM*<6Y}Nb45_*y5Y>%=%+H)Qjm&+Y zCZHVG5~oE2r{TxTVghda5&2agQcYY6vSo|D+cu)#2NCVJ5!dy4{p>1Y7@(fwBE+?V z=*J!=u7`;}<}fK{PFF2qxNrS#M!K2Nw?9G_EM`g#n06hpiO8l0iGIU=qHn!}Y$Bvo z%N#pRA4Zpio8rVdV)~^gMCQ$`4>(MEE=cmrFs7$vWKGM=ij7NB=>`rQr0X27qj$O) z^RtYZx;dG~c->tC2kKPB)rlaQ17a?9Bas}cb{R!Ag+o;isLJ(mfTWy5QeNsx6+A+O zLx|qGlL!)|3lrQzY=mr*G_F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sy%GNkKWthaPJ{HGE*dmt213s!Bux zN$F!=x&#z>R3s-a$0W(g7Uka3U57d-Ap*(AyyeO^M{g08c1N6uLs1lXfz(?Wz<@u} z>grO(kGkr~C-yDj8QL;g;lkWoW@b z1K~z1S&e=*d2Z~~d3@@`+mx5u%O$=dS%EHnX~f-T&!^;fkI;Q2)GES zfD6C8coyb08Pzus_;n+Q@QeY8d@@Fb{VK!_Jr z)qomsK`N+0wP;8Us;)6LsLE<;;K`ffCOI!|lK%@g*d%aM;~W;aQJ3R%c|;!QhP=Gy zmccOMB?JZ3$gmi~jU81?9j)j8E{Fds2-XbnzTEAKx0i#rm(}z39(4fK!9a*+v$^ot z(W++6C!4=TKU}t%E8-M4l4&Y`E0hMY>e^x3(^eEUb-8ZaQ&a7g*JC(U@MP*(do@=I z*NR2r$nxh~nblR8DC|va@OT9ccS#12RF0+?qa4S~yK_BaQRw{lfjO+6pi;8 zOQ(+)d)(zFil68>M4Zzl`;&p43w7YKCV969kNUxHYC1O*8iCd3sM{7XHguKHgPqRP zcF=8$_b0NgF<)Eduxc=+T(_!#dk-cYwvM$Blm!Y@-Eya{3M_V;qGP<7Q>sk0WdRDVpdH9m z5`l@B}aqA6v`#4c)M`2Vt$bPA{lmwkF zR#sMT`MZzH;3VaL2O2b?YJiBQ@H&WxCF2oVQcd>+2;FA^&^xV=+y!hIVGZJW0Bjmy z#wT~L%$h0;bOQdWTz6yyhLs`R<+^!r~w3e{$_(c}fykC0~@FV?`VJG%!=}C5w N?Sm1&Ej%4&{{p$p4Hy6b literal 0 HcmV?d00001 diff --git a/usr.bin/cksum/tests/cksum.noasm.crc b/usr.bin/cksum/tests/cksum.noasm.crc new file mode 100644 index 0000000..4505c70 --- /dev/null +++ b/usr.bin/cksum/tests/cksum.noasm.crc @@ -0,0 +1 @@ +1781117251 96674 cksum.noasm diff --git a/usr.bin/cksum/tests/cksum.noasm.o1 b/usr.bin/cksum/tests/cksum.noasm.o1 new file mode 100644 index 0000000..fc7a86e --- /dev/null +++ b/usr.bin/cksum/tests/cksum.noasm.o1 @@ -0,0 +1 @@ +31666 95 cksum.noasm diff --git a/usr.bin/cksum/tests/cksum.noasm.o2 b/usr.bin/cksum/tests/cksum.noasm.o2 new file mode 100644 index 0000000..882b545 --- /dev/null +++ b/usr.bin/cksum/tests/cksum.noasm.o2 @@ -0,0 +1 @@ +2287 189 cksum.noasm diff --git a/usr.bin/cksum/tests/cksum.noasm.o3 b/usr.bin/cksum/tests/cksum.noasm.o3 new file mode 100644 index 0000000..89c7d89 --- /dev/null +++ b/usr.bin/cksum/tests/cksum.noasm.o3 @@ -0,0 +1 @@ +4066366474 31138 cksum.noasm diff --git a/usr.bin/cksum/tests/crc.list b/usr.bin/cksum/tests/crc.list new file mode 100644 index 0000000..37fcfe0 --- /dev/null +++ b/usr.bin/cksum/tests/crc.list @@ -0,0 +1,4 @@ +1999883380 176 afile.n +251823970 176 afile.r +3656921661 176 afile2.n +611656130 176 afile2.r diff --git a/usr.bin/cksum/tests/dotests b/usr.bin/cksum/tests/dotests new file mode 100644 index 0000000..10c08b2 --- /dev/null +++ b/usr.bin/cksum/tests/dotests @@ -0,0 +1,153 @@ +# Tests for cksum command; invoked by command file "fulltests" +# Written by Dave Tribby (January 1998) +# $Id: dotests,v 1.1 1998/01/16 04:16:16 gdr Exp $ + +# Location of the cksum command to be tested +set testcmd="../cksum" + +# Record starting time +echo -n "Testing command $testcmd beginning at" +date + +set src="afile.n afile.r afile2.n afile2.r" +set cmp="o1.list" +set dest="/tmp/$cmp" +echo "Algorithm 1 on files $src" +$testcmd -o 1 $src > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + +set cmp="o2.list" +set dest="/tmp/$cmp" +echo "Algorithm 2 on files $src" +$testcmd -o 2 $src > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + +set cmp="o3.list" +set dest="/tmp/$cmp" +echo "Algorithm 3 on files $src" +$testcmd -o 3 $src > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + +set cmp="crc.list" +set dest="/tmp/$cmp" +echo "CRC algorithm on files $src" +$testcmd $src > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + +# Run algorithms on a single file, using stdin + +set src="afile.r" +set cmp="$src.o1" +set dest="/tmp/$cmp" +echo "Algorithm 1 on file $src from stdin" +$testcmd -o 1 < $src > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + +set dest="/tmp/${cmp}B" +echo "Algorithm 1 on file $src from pipe" +cat $src | $testcmd -o1 > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + +set cmp="$src.crc" +set dest="/tmp/$cmp" +echo "CRC algorithm on file $src from stdin" +$testcmd < $src > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + + +# Run algorithms on a large file (executable of cksum w/o asm code) + +set src="cksum.noasm" +set cmp="$src.o1" +set dest="/tmp/$cmp" +echo "Algorithm 1 on file $src" +$testcmd -o 1 $src > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + +set cmp="$src.o2" +set dest="/tmp/$cmp" +echo "Algorithm 2 on file $src" +$testcmd -o 2 $src > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + +set cmp="$src.o3" +set dest="/tmp/$cmp" +echo "Algorithm 3 on file $src" +$testcmd -o 3 $src > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + +set cmp="$src.crc" +set dest="/tmp/$cmp" +echo "Default (crc) algorithm on file $src" +$testcmd $src > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + + +echo "***** Error Messages *****" + +set dest="/tmp/err.cond" + +echo "" +echo "Expected error: illegal option" +$testcmd -x $src > $dest +echo " Error completion status = $status (expected: 1)" + +echo "" +echo "Expected error: illegal argument to -o option" +$testcmd -o 4 $src > $dest +echo " Error completion status = $status (expected: 1)" + +echo "" +echo "Expected error: option requires an argument -- o" +$testcmd -o +echo " Error completion status = $status (expected: 1)" + +echo "" +set src="badname" +echo "Expected error: $src: no such file or directory" +$testcmd $src > $dest +echo " Error completion status = $status (expected: 1)" diff --git a/usr.bin/cksum/tests/fulltests b/usr.bin/cksum/tests/fulltests new file mode 100644 index 0000000..00e6d27 --- /dev/null +++ b/usr.bin/cksum/tests/fulltests @@ -0,0 +1,29 @@ +# gsh script to run tests and collect results +# Written by Dave Tribby * August 1997 +# $Id: fulltests,v 1.1 1998/01/16 04:16:16 gdr Exp $ + +# Name of gsh script containing test cases +set command="dotests" +# Sometimes the file type is modified by editing; make it executable +chtyp -l exec $command + +# Filenames for raw and modified results +set raw_file="/tmp/rawlist" +set result_file="test.list" + +# Location of tr command that knows how to handle classes +set trcmd="/src/gno/usr.bin/tr/tr" + +# --- Begin the tests --- + +echo -n "Executing test script \"$command\" from directory " +pwd + +# Create a new gsh invocation and record all I/O +echo "$command ; exit" | script $raw_file + +# Cleanup control chars using either of the following... +echo "Done with tests. Removing control characters from results file" +$trcmd -c -ds '[:print:]\r' '\r' < $raw_file > $result_file + +echo "Tests results have been saved as \"$result_file\"" diff --git a/usr.bin/cksum/tests/o1.list b/usr.bin/cksum/tests/o1.list new file mode 100644 index 0000000..600772e --- /dev/null +++ b/usr.bin/cksum/tests/o1.list @@ -0,0 +1,4 @@ +16530 1 afile.n +57216 1 afile.r +37978 1 afile2.n +9721 1 afile2.r diff --git a/usr.bin/cksum/tests/o2.list b/usr.bin/cksum/tests/o2.list new file mode 100644 index 0000000..22e2a80 --- /dev/null +++ b/usr.bin/cksum/tests/o2.list @@ -0,0 +1,4 @@ +12875 1 afile.n +12917 1 afile.r +12875 1 afile2.n +12917 1 afile2.r diff --git a/usr.bin/cksum/tests/o3.list b/usr.bin/cksum/tests/o3.list new file mode 100644 index 0000000..cfc01d2 --- /dev/null +++ b/usr.bin/cksum/tests/o3.list @@ -0,0 +1,4 @@ +1860549981 176 afile.n +2660487471 176 afile.r +2517397231 176 afile2.n +93190675 176 afile2.r