home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / source / brik.zoo / brik.3 < prev   
Internet Message Format  |  1989-07-22  |  39KB

  1. From ra!tut!draken!kth!mcvax!uunet!allbery Sat Jul 22 13:43:05 EET DST 1989
  2. Article 205 of comp.sources.misc:
  3. Path: chyde!ra!tut!draken!kth!mcvax!uunet!allbery
  4. >From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5. Newsgroups: comp.sources.misc
  6. Subject: v07i096: brik: a general-purpose CRC-32 program (part 03/03)
  7. Message-ID: <61159@uunet.UU.NET>
  8. Date: 22 Jul 89 01:04:03 GMT
  9. Sender: allbery@uunet.UU.NET
  10. Reply-To: dhesi@bsu-cs.bsu.edu (Rahul Dhesi)
  11. Lines: 1478
  12. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  13.  
  14. Posting-number: Volume 7, Issue 96
  15. Submitted-by: dhesi@bsu-cs.bsu.edu (Rahul Dhesi)
  16. Archive-name: brik2/part03
  17.  
  18. #! /bin/sh
  19. # This is a shell archive, meaning:
  20. # 1. Remove everything above the #! /bin/sh line.
  21. # 2. Save the resulting text in a file.
  22. # 3. Execute the file with /bin/sh (not csh) to create:
  23. #    brik.1
  24. #    addbfcrc.asm
  25. #    makefile.nix
  26. #    makefile.msc
  27. #    assert.h
  28. #    descrip.mms
  29. #    makefile.tcc
  30. #    addbfcrc.c
  31. #    crc.lst
  32. #    makebrik.com
  33. #    turboc.cfg
  34. #    brik.prj
  35. #    options.opt
  36. # This archive created: Mon Jul 17 01:23:05 1989
  37. export PATH; PATH=/bin:/usr/bin:$PATH
  38. echo shar: "extracting 'brik.1'" '(25300 characters)'
  39. if test -f 'brik.1'
  40. then
  41.     echo shar: "will not over-write existing file 'brik.1'"
  42. else
  43. sed 's/^X//' << \SHAR_EOF > 'brik.1'
  44. X.\" ::[[ @(#) brik.1 1.12 89/07/12 00:11:50 ]]::
  45. X.\"
  46. X.TH BRIK 1 "Jul 8, 1989"
  47. X.AT 3
  48. X.\" ******* sh is a sub heading macro
  49. X.de sh
  50. X.br
  51. X.ne 5
  52. X.PP
  53. X\fB\\$1\fR
  54. X.PP
  55. X..
  56. X.\" ******** ex is for indented examples, no fill
  57. X.de ex
  58. X.RS 5
  59. X.nf
  60. X.sp 1
  61. X..
  62. X.\" ******** ef is for indented examples, with fill
  63. X.de ef
  64. X.RS 5
  65. X.fi
  66. X.sp 1
  67. X..
  68. X.\" ******* ee is to end ex and ef
  69. X.de ee
  70. X.fi
  71. X.RE
  72. X.sp 1
  73. X..
  74. X.\"
  75. X.SH NAME
  76. Xbrik \- calculate 32-bit CRC
  77. X.SH SYNOPSIS
  78. X.B brik \-h
  79. X.sp  0
  80. X.B brik \-gcGCbafvsqWHT
  81. X.I file ...
  82. X.SH DESCRIPTION
  83. X.I Brik
  84. Xgenerates and verifies 32-bit CRC values (checksums).  It is
  85. Xdesigned to generate CRCs for text files that are the same on all computer
  86. Xsystems that use the ASCII character set, provided each text file is in the
  87. Xusual text file format for each system.  
  88. X.I Brik
  89. Xwill also optionally use
  90. Xbinary CRCs calculated using every byte in a file.  Such binary CRCs are
  91. Xportable across systems for binary files that are moved from system to system
  92. Xwithout any newline conversion.  
  93. X.I Brik
  94. Xcan be asked to decide by examining
  95. Xeach file whether to calculate a text mode or binary mode CRC for it.
  96. X.PP
  97. XChanges from version 1.0 are summarized at the end of this document.
  98. X.PP
  99. XThe general usage format is:
  100. X.ef
  101. Xbrik -gcGCbafvsqWHT
  102. X[
  103. X.I file
  104. X] ...
  105. X.ee
  106. XThe brackets mean that
  107. X.IR file ,
  108. Xwhich is the name of a file, is optional.  The
  109. Xthree dots indicate that more than one filename may be typed (separated by
  110. Xblanks).  Exactly one of the options
  111. X.BR \-c ,
  112. X.BR \-C ,
  113. X.BR \-g ,
  114. X.BR \-G ,
  115. Xor
  116. X.BR \-h ,
  117. Xis required.  The
  118. X.B \-h
  119. Xoption gives a help screen.
  120. X.PP
  121. XIn addition to
  122. X.BR \-h ,
  123. Xthe 
  124. X.I Brik
  125. Xoptions available (as they appear on the help
  126. Xscreen) are:
  127. X.TP
  128. X.B \-g
  129. Xlook for
  130. X.I Checksum:
  131. Xheader, generate CRC for rest of file
  132. X.TP
  133. X.B \-c
  134. Xget CRC from header, verify CRC of rest of file
  135. X.TP
  136. X.B \-G
  137. Xgenerate CRC for entire file (add
  138. X.B \-b
  139. Xfor binary files)
  140. X.TP
  141. X.B \-C
  142. Xverify all file CRCs from output of
  143. X.B \-G
  144. X.RB ( \-f
  145. Xis not needed)
  146. X.TP
  147. X.B \-b
  148. Xuse binary mode -- read file byte by byte, not line by line
  149. X.TP
  150. X.B \-a
  151. Xautomatically decide whether each file is text or binary
  152. X.TP
  153. X.B \-f
  154. Xread filenames (wildcards ok) from specified files
  155. X.TP
  156. X.B \-v
  157. Xbe verbose, report all results (else only errors are reported)
  158. X.TP
  159. X.B \-s
  160. Xbe silent, say nothing, just return status code
  161. X.TP
  162. X.B \-q
  163. Xbe quiet, don't print header for
  164. X.B \-G
  165. X.TP
  166. X.B \-W
  167. Xafter generating CRC with
  168. X.BR \-g ,
  169. Xwrite it to original header
  170. X.TP
  171. X.B \-H
  172. Xafter generating CRC with
  173. X.BR \-g ,
  174. Xprint header to stdout
  175. X.TP
  176. X.B \-T
  177. Xinclude trailing empty lines, normally ignored (text mode only)
  178. X.sh "VERIFYING CRC HEADERS"
  179. XThe primary intended use of 
  180. X.I Brik
  181. Xis to verify
  182. X.I Checksum:
  183. Xheaders in Usenet
  184. Xpostings and in C and Pascal source files.  A
  185. X.I Checksum:
  186. Xheader looks like
  187. Xthis:
  188. X.ex
  189. X\&Checksum: 9485762645b   (verify with "brik")
  190. X.ee
  191. XThe word
  192. X.I Checksum:
  193. Xmust occur at the beginning of a line.  It is followed by a colon, an
  194. Xoptional blank, a ten-digit decimal 32-bit CRC, and any arbitrary
  195. Xoptional string such as the comment shown above.  The CRC value may
  196. Xbe followed by a one-character suffix identifying the type of the
  197. XCRC.  These suffixes are described later.
  198. X.PP
  199. XWhen 
  200. X.I Brik
  201. Xis invoked with
  202. Xthe syntax
  203. X.ef
  204. Xbrik -c
  205. X.I file ...
  206. X.ee
  207. Xit will search for the
  208. X.I Checksum:
  209. Xheader in each specified
  210. X.I file,
  211. Xread the CRC
  212. Xvalue from that header, calculate the CRC-32 for all lines in the file
  213. X(except trailing empty lines) that occur *after* the header line, and
  214. Xreport an error if the two values do not match.  
  215. X.ne 6
  216. X.sh "CALCULATING CRC HEADERS"
  217. XThe command
  218. X.ef
  219. Xbrik \-g
  220. X.I file ...
  221. X.ee
  222. Xtells 
  223. X.I Brik
  224. Xto look for the
  225. X.I Checksum:
  226. Xheader in each specified
  227. X.I file,
  228. Xcalculate the CRC of the lines in the file following the header, and
  229. Xprint the CRC and filename without changing the file in any way.  You
  230. Xcan also ask 
  231. X.I Brik
  232. Xto update the
  233. X.I Checksum:
  234. Xheader with the following command:
  235. X.ef
  236. Xbrik \-gW
  237. X.I file ...
  238. X.ee
  239. XThis causes 
  240. X.I Brik
  241. Xto update the
  242. X.I Checksum:
  243. Xheader in the file with the newly-calculated CRC.  If there is not
  244. Xenough space for the CRC in the existing header, 
  245. X.I Brik
  246. Xreports an error and does not change the existing header.  To
  247. Xinitially add a
  248. X.I Checksum:
  249. Xheader to a file, insert a line of the following form into the
  250. Xfile with a text editor:
  251. X.ex
  252. X\&Checksum: XXXXXXXXXX  -- this is an optional comment
  253. X.ee
  254. XThe word
  255. X.I Checksum
  256. Xmust be at the beginning of a line.  The ten `X' characters shown can
  257. Xbe any ten characters.  They will be later replaced by the calculated
  258. XCRC value.  They do not need to be `X'.  The comment following them
  259. Xis optional and can be any arbitrary string of characters after the
  260. XCRC field, separated from it by blanks.  As an example, in a C
  261. Xsource file called
  262. X.I main.c,
  263. Xyou might have:
  264. X.ex
  265. X/*
  266. X\&Checksum: XXXXXXXXXX  (verify or update with brik)
  267. X*/
  268. X.ee
  269. XOnce a header like this exists in the file, invoke 
  270. X.I Brik
  271. Xas follows:
  272. X.ex
  273. Xbrik \-gW main.c
  274. X.ee
  275. XThis will cause the ten `X' characters to be replaced with the calculated
  276. Xchecksum, giving something like this:
  277. X.ex
  278. X/*
  279. X\&Checksum: 1922837484  (verify or update with brik)
  280. X*/
  281. X.ee
  282. XLater you can use the command
  283. X.ex
  284. Xbrik \-c main.c
  285. X.ee
  286. Xto verify that the contents of the file following the header have the
  287. Xsame CRC as the stored value.
  288. X.PP
  289. XIf 
  290. X.I Brik
  291. Xis invoked with the
  292. X.B \-c
  293. Xor
  294. X.B \-g
  295. Xoptions and it cannot find a
  296. X.I Checksum:
  297. Xheader in a file, it prints a row of question marks.  If it is invoked
  298. Xwith the
  299. X.B \-gW
  300. Xoption and it does not find enough character positions after the
  301. X.I Checksum:
  302. Xstring to hold the CRC, it does not fill in the CRC and prints an
  303. Xerror message.
  304. X.PP
  305. X.I Brik
  306. Xcan be asked to generate a complete
  307. X.I Checksum:
  308. Xheader but print it to
  309. Xstandard output instead of writing it to the file.  Do this by adding the
  310. X.B \-H
  311. Xoption.  If both
  312. X.B \-W
  313. Xand
  314. X.B \-H
  315. Xare given, the
  316. X.I Checksum:
  317. Xheader will be written both to the file and to standard output.
  318. X.sh "WHOLE-FILE CRCS"
  319. XA "whole-file" CRC calculation is done for the entire contents of a file,
  320. Xwithout looking for a
  321. X.I Checksum:
  322. Xheader.  The command
  323. X.ef
  324. Xbrik \-G
  325. X.I file ...
  326. X.ee
  327. Xasks 
  328. X.I Brik
  329. Xto do this calculation for all specified files.  The output from this
  330. Xcommand is a list of files and their whole-file CRCs.  It is sent to
  331. Xthe standard output stream, which in most cases is your screen.  The
  332. Xoutput should be saved in a file by redirecting it.  For example, the
  333. Xcommand
  334. X.ex
  335. Xbrik \-G *.h *.c > crc.lst
  336. X.ee
  337. Xon an MS-DOS system might yield the following in the output file
  338. X.I crc.lst:
  339. X.ex
  340. X# CRC-32        filename
  341. X# ------        --------
  342. X
  343. X2566277976      getopt.c
  344. X 100594287      brik.c
  345. X1151475469      vms.c
  346. X3929503738      turboc.c
  347. X2424271922      addbfcrc.c
  348. X1943472856      assert.h
  349. X2601923477      brik.h
  350. X.ee
  351. XThe output of the
  352. X.B \-G
  353. Xoption is in free format.  The output file may be edited
  354. Xby hand.  Empty lines and lines beginning with '#' will be ignored by
  355. X.I Brik
  356. Xwhen it is later asked to read this file.
  357. X.PP
  358. XThis list of filenames and whole-file CRCs may be verified by a
  359. Xcommand like this:
  360. X.ex
  361. Xbrik \-C crc.lst
  362. X.ee
  363. XThis makes 
  364. X.I Brik
  365. Xread the file
  366. X.I crc.lst,
  367. Xget the CRCs and filenames from it, do the CRC calculation again for
  368. Xeach file, and report an error if it does not match the CRC recorded
  369. Xinside
  370. X.I crc.lst.
  371. X.PP
  372. X\&**IX and MS-DOS users (and others who can pipe the output of one
  373. Xcommand into another) could use a command like the following to see
  374. Xif 
  375. X.I "Brik's"
  376. X.B \-G
  377. Xand
  378. X.B \-C
  379. Xoptions are working:
  380. X.ex
  381. Xbrik \-G file ... | brik \-C
  382. X.ee
  383. XThis invokes "brik \-G" on some files, sending the output to a pipe
  384. Xwhere it becomes the input of "brik \-C".  If no filename is
  385. Xspecified, 
  386. X.I Brik
  387. Xreads from standard input, so "brik \-C" will read from the pipe and
  388. Xconcurrently verify all the CRCs that are being generated by
  389. X"brik \-G".
  390. X.PP
  391. XWhole-file CRCs are normally generated in text mode, in which a file
  392. Xis treated as lines of text.  You can also generate whole-file CRCs
  393. Xin binary mode.  See below.
  394. X.sh "BINARY VERSUS TEXT MODE"
  395. X.I Brik
  396. Xcan work in two different modes.  The most common mode, used unless
  397. Xyou specify otherwise, is text mode.
  398. X.PP
  399. XIn this mode
  400. X.I Brik
  401. Xreads all files line by line, and forces each line of text to be
  402. Xterminated by a newline character of constant value before doing a CRC
  403. Xcalculation.  Thus, no matter what newline character is used by your system,
  404. Xthe CRC calculation will be unaffected.  This means that whether your
  405. Xoperating system uses linefeeds to terminate lines (e.g. **IX), or a carriage
  406. Xreturn and a linefeed (e.g. MS-DOS) or a carriage return only
  407. X(e.g. Macintosh) or nothing but a record length field (e.g. VAX/VMS),
  408. Xthe CRC calculation in text mode gives the same results.
  409. X.PP
  410. XIf a file is not intended to be a text file, the text mode CRC
  411. Xcalculated by
  412. X.I Brik
  413. Xmay not be reliable and may be different on different systems.  If
  414. X.I Brik
  415. Xis calculating a text mode CRC on a file that appears to contain
  416. Xbinary data, it still calculates the text-mode CRC but adds a "*"
  417. Xcharacter after the CRC to indicate to warn the user.
  418. X.PP
  419. X.I Brik
  420. Xcan be asked to operate in binary mode by adding a
  421. X.B \-b
  422. Xoption.  Binary mode is applicable only to the
  423. X.B \-G
  424. Xcommand, which acts on whole
  425. Xfiles.  Thus
  426. X.ef
  427. Xbrik \-G
  428. X.I file ...
  429. X.ee
  430. Xfinds whole-file CRCs of all specified files in text mode, while
  431. X.ef
  432. Xbrik \-Gb
  433. X.I file ...
  434. X.ee
  435. Xdoes the same in binary mode.  In binary mode 
  436. X.I Brik
  437. Xsimply reads and calculates the CRC for all bytes in a file.  If a
  438. Xfile is moved from one system to another without any newline
  439. Xconversion or any other changes,
  440. X.I Brik
  441. Xshould calculate the same binary mode CRC for it on both systems.
  442. X.PP
  443. XThe output from "brik \-Gb" includes a trailing
  444. X.B b
  445. Xsuffix in each CRC, so "brik \-C" will correctly use binary mode for
  446. Xsuch CRCs and it is never necessary to type "brik \-Cb" instead.
  447. X.PP
  448. XIn its auto-check mode,
  449. X.I Brik
  450. Xwill itself examine each file and determine whether it is a text or
  451. Xbinary file and calculate a CRC accordingly.  To do this, use the
  452. X.B \-a
  453. Xoption.  Although
  454. X.I Brik
  455. Xcan determine the type of each file with a high degree of
  456. Xreliability, it is still possible for it to come to a wrong
  457. Xconclusion about some files.
  458. X.PP
  459. XThe output from "brik \-Ga" will include a trailing
  460. X.B b
  461. Xcharacter in the CRC for those files that appeared to be binary to 
  462. X.I Brik.
  463. X\& You may find both text and binary CRCs in the output.
  464. X.sh "TRAILING EMPTY LINES"
  465. XThe normal behavior of 
  466. X.I Brik
  467. Xin text mode is to ignore any trailing empty lines in a file.  An
  468. Xempty line is a line that contains nothing, not even blanks or
  469. Xtabs.  (Just hitting a carriage return when you are editing a text
  470. Xfile usually produces an empty line.)  If manipulating a text file
  471. Xcauses trailing empty lines to be added or deleted, the CRC
  472. Xcalculated by 
  473. X.I Brik
  474. Xwill be unaffected.  You can override this if necessary with the
  475. X.B \-T
  476. Xoption, which makes 
  477. X.I Brik
  478. Xinclude trailing empty lines in the CRC calculation.  For example,
  479. X.ex
  480. Xbrik \-gWT
  481. X.ee
  482. Xwill update the
  483. X.I Checksum:
  484. Xheader with a CRC that includes all lines in a text file.  Similarly
  485. X.ex
  486. Xbrik \-GT
  487. X.ee
  488. Xwill find whole-file CRCs that include all lines in a text file.
  489. X.PP
  490. XWhen 
  491. X.I Brik
  492. Xis given the
  493. X.B \-T
  494. Xoption, it adds a
  495. X.B T
  496. Xsuffix to each generated CRC.  Then, when the CRC is verified with
  497. X.B \-c
  498. Xor
  499. X.BR \-C ,
  500. X.I Brik
  501. Xwill correctly include trailing empty lines when needed without
  502. Xhaving to be explicitly told to do so.
  503. X.PP
  504. XIn binary mode 
  505. X.I Brik
  506. Xalways reads all bytes in a file, so it does not ignore trailing
  507. Xempty lines, and the
  508. X.B \-T
  509. Xswitch is not needed.
  510. X.PP
  511. XThe effects of the
  512. X.B \-T
  513. Xand
  514. X.B \-b
  515. Xoptions are mutually exclusive.  If both are given, whichever is
  516. Xused later overrides the first.  So
  517. X.B \-bT
  518. Xis equivalent
  519. Xto
  520. X.B \-T
  521. Xand
  522. X.B \-Tb
  523. Xis equivalent to
  524. X.BR \-T .
  525. X.sh "FILENAME CONVENTIONS"
  526. XUnder MS-DOS and VAX/VMS, wildcards are allowed on the command line
  527. Xand will be expanded by 
  528. X.I Brik.
  529. X\& Under **IX, wildcards are expected to be expanded by
  530. Xthe shell and are not expanded by 
  531. X.I Brik.
  532. X\& If no filename is given, 
  533. X.I Brik
  534. Xreads its standard input.  By default this is keyboard input, but it
  535. Xis expected that input will usually be redirected to come from a file
  536. Xor a pipe.  Also, if a filename is explicitly specified as a dash
  537. X("\-"), it stands for standard input.
  538. X.PP
  539. XThe following five commands (valid under the **IX operating system)
  540. X.ex
  541. Xbrik \-c myfile            # "myfile"
  542. Xbrik \-c < myfile          # stdin = "myfile"
  543. Xcat myfile | brik \-c      # stdin = a pipe
  544. Xbrik \-c \- < myfile        # "\-" = stdin = "myfile"
  545. Xcat myfile | brik \-c \-    # "\-" = stdin = a pipe
  546. X.ee
  547. Xall have the effect of verifying the
  548. X.I Checksum:
  549. Xheader in the file
  550. X.I myfile.
  551. X.PP
  552. XStandard input can also be read when using the
  553. X.B \-C
  554. Xoption.  For example, suppose we have already given the command
  555. X.ex
  556. Xbrik \-G *.c *.h > crc.lst
  557. X.ee
  558. Xto create a file called "crc.lst" that contains a list of whole-file
  559. XCRCs.  We can now verify the integrity of these files with any of the
  560. Xfollowing commands:
  561. X.ex
  562. Xbrik \-C crc.lst          # "crc.lst"
  563. Xbrik \-C < crc.lst        # stdin = "crc.lst"
  564. Xbrik \-C \- < crc.lst      # "\-" = stdin = "crc.lst"
  565. Xcat crc.lst | brik \-C    # stdin = a pipe
  566. Xcat crc.lst | brik \-C \-  # "\-" = stdin = a pipe
  567. X.ee
  568. X.sh "INDIRECT FILE NAMING"
  569. XThe
  570. X.B \-f
  571. Xoption allows you to have filenames in a list rather than on the
  572. Xcommand line.  For example, suppose you want to generate whole-file CRCs of
  573. Xfiles whose names are selected by some other program.  You could use
  574. X.I find
  575. X(under **IX) or
  576. X.I Stuff
  577. X(under MS-DOS) to generate a list of filenames.  When
  578. Xthe
  579. X.B \-f
  580. Xoption is given, 
  581. X.I Brik
  582. Xreads filenames, one per line, from the file(s)
  583. Xspecified.  Thus you could do the following:
  584. X.ex
  585. Xfind . \-mtime +3 \-print > flist
  586. Xbrik \-Gf flist > crc.lst
  587. X.ee
  588. XThe first command asks
  589. X.I find
  590. Xto generate a list of names of all files that
  591. Xwere modified more than 3 days ago, and sends the output to the file
  592. X.I flist.
  593. X\& The contents of
  594. X.I flist
  595. Xmight now look like this, as an example:
  596. X.ex
  597. X\&./sez.doc
  598. X\&./brik.doc
  599. X\&./stuff.doc
  600. X\&./looz.doc
  601. X.ee
  602. XThe second command above asks 
  603. X.I Brik
  604. Xto read the file called
  605. X.I flist,
  606. Xget a list of filenames from it, one per line, and generate the
  607. Xwhole-file CRC of each of these files.  We additionally redirect the
  608. Xoutput of "brik \-Gf" to the file called
  609. X.I crc.lst.
  610. X\& Given the above contents
  611. Xof
  612. X.I flist,
  613. Xthe following two commands are exactly equivalent:
  614. X.ex
  615. Xbrik \-Gf flist >crc.lst
  616. Xbrik \-G ./sez.doc ./brik.doc ./stuff.doc ./looz.doc >crc.lst
  617. X.ee
  618. XThe advantage of the
  619. X.B \-f
  620. Xoption is that once you have filenames in a file, you need not type
  621. Xthem again at the command line.  The
  622. X.B \-f
  623. Xoption also allows you to feed 
  624. X.I Brik
  625. Xthrough a pipe filenames generated by another program.  Consider this
  626. Xcommand:
  627. X.ex
  628. Xfind . \-mtime +3 \-print | brik \-Gf \- > crc.lst
  629. X.ee
  630. XUnder **IX this concurrently invokes both
  631. X.I find
  632. Xand 
  633. X.I Brik.
  634. X\& As
  635. X.I find
  636. Xgenerates a filename and sends it to its standard output (a pipe), 
  637. X.I Brik
  638. Xreads the filename from its standard input and generates its
  639. Xwhole-file CRC.  The following pipeline
  640. X.ex
  641. Xfind . \-mtime +3 \-print | brik \-Gf \- | brik \-C \-
  642. X.ee
  643. Xinvokes
  644. X.I find
  645. Xto generate filenames, 
  646. X.I Brik
  647. Xto print the whole-file CRCs of those files, and 
  648. X.I Brik
  649. Xagain to immediately verify them.
  650. X.PP
  651. XUnder MS-DOS and VAX/VMS (and any other operating system under which
  652. X.I Brik
  653. Xhas been installed to expand wildcards itself), a file specified by
  654. Xthe \-f option can itself contain wildcards in the filenames.  For
  655. Xexample, suppose the file "wildfile" contains the following lines:
  656. X.ex
  657. X/bin/*.exe
  658. X/bin/*.com
  659. X/doc/*.doc
  660. X.ee
  661. XNow if we invoke 
  662. X.I Brik
  663. Xwith the command
  664. X.ex
  665. Xbrik \-Gf wildfile
  666. X.ee
  667. Xit will read filespecs from "wildfile," expand wildcards in each
  668. Xfilespec, and generate whole-file CRCs for all matching files.
  669. X.PP
  670. XIf you are checking whole-file CRCs with the
  671. X.B \-C
  672. Xoption, you do not normally need to use the
  673. X.B \-f
  674. Xoption.  When used with
  675. X.BR \-C ,
  676. Xthe
  677. X.B \-f
  678. Xoption introduces an additional level of file naming indirection. For
  679. Xexample, the command
  680. X.ex
  681. Xbrik \-C crc.lst
  682. X.ee
  683. Xtakes a list of CRCs and filenames from "crc.lst" and
  684. Xverifies them.  However, the command
  685. X.ex
  686. Xbrik \-Cf master.lst
  687. X.ee
  688. Xdoes not do the same thing.  Instead, it takes a list of files from
  689. X"master.lst," looks inside each of
  690. X.I those
  691. Xfiles for a list of CRCs and filenames, and verifies them.
  692. X.PP
  693. XAs an example of the use of \-Cf, consider this sequence:
  694. X.ex
  695. Xbrik \-Gb /bin/*.exe > exelist
  696. Xbrik \-Gb /bin/*.com > comlist
  697. Xbrik \-GT /doc/*.doc > doclist
  698. Xbrik \-G  /doc/*.man > manlist
  699. X.ee
  700. XNow we have four files called "exelist," "comlist," "doclist," and
  701. X"manlist" containing whole-file CRCs of various types.  We can test
  702. Xthe integrity of files listed in these in four separate commands like
  703. Xthis:
  704. X.ex
  705. Xbrik \-C exelist
  706. Xbrik \-C comlist
  707. Xbrik \-C doclist
  708. Xbrik \-C manlist
  709. X.ee
  710. XBut we could also do this in a single step by first creating a file
  711. Xcalled "biglist" that contains the names of these four files:
  712. X.ex
  713. Xexelist
  714. Xcomlist
  715. Xdoclist
  716. Xmanlist
  717. X.ee
  718. Xand then use
  719. X.B \-Cf
  720. Xthus:
  721. X.ex
  722. Xbrik \-Cf biglist
  723. X.ee
  724. XThis causes 
  725. X.I Brik
  726. Xto read filenames from "biglist," look inside each of those files
  727. X("exelist," "comlist," "doclist," and "manlist") and check the CRCs
  728. Xfound there.  A **IX example to do the same thing in a more compact
  729. Xway might be:
  730. X.ex
  731. Xcat exelist comlist doclist manlist | brik \-Cf \-
  732. X.ee
  733. XThe above examples are somewhat contrived, however.  We could also use
  734. Xthe following command:
  735. X.ex
  736. Xbrik \-C exelist comlist doclist manlist
  737. X.ee
  738. X.sh "SILENT VERSUS VERBOSE VERSUS QUIET"
  739. X.I Brik
  740. Xaccepts options 
  741. X.BR \-s ,
  742. X.BR \-q ,
  743. Xand
  744. X.B \-v
  745. Xthat control the degree of verbosity.
  746. X.PP
  747. XNormally 
  748. X.I Brik
  749. Xprints a message only if it detects an error.  For example,
  750. Xif you give the command
  751. X.ex
  752. Xbrik \-c *.c *.h
  753. X.ee
  754. Xand 
  755. X.I Brik
  756. Xfinds that all
  757. X.I Checksum:
  758. Xheaders contain CRCs that match the calculated value, it prints nothing.
  759. X.PP
  760. XThe
  761. X.B \-v
  762. Xswitch makes 
  763. X.I Brik
  764. Xprint a message for each file tested that contains the
  765. Xword "ok" if stored and calculated CRCs matched and "BAD" if they did not.
  766. X.PP
  767. XIn all messages reporting file CRCs, 
  768. X.I Brik
  769. Xprints the actual CRC it calculated,
  770. Xor a row of question marks if it could not calculate one.  \fIBrik\fP
  771. Xfails to calculate a CRC if it is trying to calculate a header-based
  772. XCRC (commands
  773. X.B \-c
  774. Xand
  775. X.BR \-g )
  776. Xbut does not find a
  777. X.I Checksum:
  778. Xheader in a file.
  779. X.PP
  780. XThe
  781. X.B \-s
  782. Xswitch tells 
  783. X.I Brik
  784. Xto be silent.  This will cause nothing to be printed if 
  785. X.I Brik
  786. Xdoes not find a
  787. X.I Checksum
  788. Xheader or if CRCs don't match.  However, the
  789. Xstatus code on exit is still set.  The
  790. X.B \-s
  791. Xoption is useful for invoking 
  792. X.I Brik
  793. Xfrom within a shell script (**IX) or a batch file (MS-DOS) and later
  794. Xtesting the error code it returned when it exited.
  795. X.PP
  796. XThe
  797. X.B \-s
  798. Xswitch does not suppress the error message printed if 
  799. X.I Brik
  800. Xis given a filename and the file cannot be found.  For example, if
  801. Xthe command
  802. X.ex
  803. Xbrik \-cs myfile
  804. X.ee
  805. Xis given but "myfile" does not exist, 
  806. X.I Brik
  807. Xwill print an
  808. Xerror message even though the
  809. X.B \-s
  810. Xoption was given.
  811. X.PP
  812. XThe
  813. X.B \-q
  814. Xswitch makes 
  815. X.I Brik
  816. Xslightly quieter.  Its only effect is to suppress the introductory
  817. Xcomments that are otherwise generated by the
  818. X.B \-C
  819. Xoption.
  820. X.PP
  821. X.sh "VAX/VMS BUGS"
  822. X.TP
  823. Xo
  824. XUnder VAX/VMS, file manipulation is unpredictable and the VAX/VMS C
  825. Xruntime library in particular is very unreliable.  One result is that
  826. Xunder VAX/VMS, the
  827. X.B \-gW
  828. Xoption will work only for stream-LF files, which are the only type of
  829. Xfile that VAX/VMS seems to handle correctly.  Fortunately, the
  830. X.B \-c
  831. Xoption will correctly work for VAX/VMS standard text files.
  832. X.TP
  833. Xo
  834. XThe VAX/VMS implementation of 
  835. X.I Brik
  836. Xsimply ignores filenames that correspond to nonexistent files instead
  837. Xof giving an error message.  VMS users are invited to fix this bug
  838. X(probably somewhere in the
  839. X.I nextfile()
  840. Xfunction in the file
  841. X.IR vms.c )
  842. Xand send me the fix.
  843. X.TP
  844. Xo
  845. XTo avoid annoying error messages, 
  846. X.I Brik
  847. Xunder VAX/VMS always exits with
  848. Xa status code of 1.
  849. X.TP
  850. Xo
  851. XDue to a problem in the VAX/VMS command interpreter, if any uppercase
  852. Xoption characters are typed (e.g. \fB\-C\fP,
  853. X.BR \-G ,
  854. X.BR \-T ), 
  855. X.I Brik
  856. Xwill not recognize
  857. Xthem as uppercase unless they are enclosed in double quotes.  An
  858. Xexample of a correct command under VAX/VMS:
  859. X.sp 1
  860. X.nf
  861. X\&  brik "\-GT" *.*
  862. X.sp 1
  863. X.fi
  864. XAn example of a command that won't work:
  865. X.sp 1
  866. X\&  brik \-GT *.*
  867. X.sh "USAGE HINTS"
  868. XThis section discusses some ways of using 
  869. X.I Brik.
  870. X.TP
  871. X\- 
  872. X.I Brik
  873. Xis currently used to create and verify checksums of articles posted
  874. Xon the Usenet newsgroup comp.binaries.ibm.pc.  While reading Usenet
  875. Xnews with
  876. X.I rn,
  877. Xfor example, you can verify the
  878. X.I Checksum:
  879. Xheader of such an article with the command:
  880. X.sp 1
  881. X\&  | brik \-cv
  882. X.sp 1
  883. XThis feeds the current article to 
  884. X.I Brik
  885. Xas standard input and asks it to verbosely verify the checksum.
  886. X.TP
  887. X\-
  888. XC and Pascal source files that are being distributed can be given their own
  889. X.I Checksum:
  890. Xheaders.  The advantage of this over listing CRCs separately is
  891. Xthat each file contains its checksum no matter where it goes.  The
  892. Xrecipient can easily verify that each source file was received
  893. Xintact.  This is especially valuable when source files are being sent
  894. Xby electronic mail through an IBM mainframe-based network, such as
  895. XBITNET, that can cause corruption of text files.
  896. X.sp 1
  897. XCreate the
  898. X.I Checksum
  899. Xheader with a text editor and initialize its value
  900. Xwith the command:
  901. X.sp 1
  902. X\&  brik \-gW file ...
  903. X.sp 1
  904. XThe recipient can verify the checksum with the command:
  905. X.sp 1
  906. X\&  brik \-cv file ...
  907. X.sp 1
  908. X.TP
  909. X\-
  910. XTo keep track of any unexpected filesystem corruption or unauthorized
  911. Xchanges to system files, 
  912. X.I Brik
  913. Xcan be used to create a list of
  914. Xchecksums.  This should be done using the
  915. X.B \-b
  916. Xoption (all binary checksums)
  917. Xor the
  918. X.B \-a
  919. Xoption (use text or binary as appropriate).  Under **IX this
  920. Xcan be done with a command like this one:
  921. X.sp 1
  922. X.nf
  923. X\&  find /bin /usr/bin /lib /usr/lib /usr/new \\
  924. X\&   \-type f \-print | \\
  925. X\&  grep \-v '^/usr/bin/beta' | \\
  926. X\&  grep \-v '^/usr/new/lib/news' | \\
  927. X\&  brik \-Gbf \- > crc.list
  928. X.fi
  929. X.sp 1
  930. XThis example uses 
  931. X.I find
  932. Xto print the pathnames of certain files,
  933. X.I grep
  934. Xto
  935. Xfilter out certain directory subtrees, and then 
  936. X.I Brik
  937. Xto print checksums of
  938. Xall selected files.  Periodically a background job can be run to compare
  939. Xthe file list against current files and report any discrepancies:
  940. X.sp 1
  941. X\&  brik \-C crc.lst | mail \-s 'brik output' postmaster
  942. X.sp 1
  943. XUnder MS-DOS, create a list of checksums with the help of
  944. X.I Stuff,
  945. Xa
  946. X.IR find -like
  947. Xfile finder program that is distributed with
  948. X.I zoo
  949. X2.01:
  950. X.sp 1
  951. X\&  stuff /bin /msdos /turboc | brik \-Gaf \- > crc.list
  952. X.sp 1
  953. XThis is a simple mechanism that can be used to detect unexpected file
  954. Xchanges caused by hardware problems or malicious programs such as
  955. Xviruses and worms.  Be warned, however, that since 
  956. X.I Brik
  957. Xuses a published CRC algorithm, very clever deviant programs are
  958. Xpossible that could change a file without affecting its CRC.
  959. X.sp 1
  960. XTo avoid too many false alarms, only files that do not change much
  961. X(such as system binaries) should be selected.
  962. X.SH CHANGES
  963. XChanges from version 1.0 are as follows.
  964. X.TP
  965. X\-
  966. XThe CRC calculation has been recoded in 8086 assembly code suitable
  967. Xfor Turbo C/MS-DOS.  As a result 
  968. X.I Brik 2.0
  969. Xunder MS-DOS is much faster than version 1.0.
  970. X.TP
  971. X\- 
  972. XThe new 
  973. X.B \-a 
  974. Xflag makes 
  975. X.I Brik
  976. Xautomatically determine for each file whether it is text or binary
  977. Xand calculate the CRC accordingly
  978. X.TP
  979. X\- 
  980. XWhen 
  981. X.I Brik
  982. Xis asked to calculate a text mode CRC but the file appears to be
  983. Xbinary, it now does not print a warning message but instead adds a
  984. X"*" suffix to the calculated CRC to indicate that the CRC may not be
  985. Xreliable.
  986. X.TP
  987. X\- 
  988. XThe new 
  989. X.B \-H 
  990. Xflag makes 
  991. X.I Brik
  992. Xprint the formatted
  993. X.I Checksum:
  994. Xheader to standard output.
  995. X.TP
  996. X\- 
  997. XDetection of binary files is now more reliable under MS-DOS.  If a
  998. Xcontrol Z character occurs near the beginning of a binary file, 
  999. X.I Brik
  1000. Xwill not be fooled by the apparent end-of-file but will in most cases
  1001. Xreliably detect that the file is binary.
  1002. X.TP
  1003. X\- 
  1004. XThe new 
  1005. X.B \-q 
  1006. Xflag suppresses the introductory comments from the output of
  1007. Xthe \-G command.
  1008. X.SH BUGS
  1009. X.I Brik
  1010. Xis designed to work with computer systems that use the 7-bit ASCII
  1011. Xcharacter set and 8-bit bytes with the eighth (parity) bit set to zero.
  1012. X.PP
  1013. X.I Brik
  1014. Xhas not been tested with computer systems that use ASCII characters
  1015. Xwith the eighth bit set or those that use EBCDIC
  1016. Xcharacters.  Although it will calculate a CRC on such machines, the
  1017. Xprobability of this CRC being the same as the one calculated on
  1018. Xmachines that use 7-bit ASCII is approximately 0.00000000023.
  1019. X.PP
  1020. X.ne 4
  1021. X.SH DIAGNOSTICS
  1022. XError messages are intended to be self-explanatory.
  1023. X.PP
  1024. XThe exit status returned
  1025. Xis 1 if
  1026. X.I Brik
  1027. Xwas invoked with incorrect arguments, else it is the number of files
  1028. Xfound with missing or invalid CRCs, but not greater than an
  1029. Xoperating-system-dependent maximum value.
  1030. X.SH COPYRIGHT
  1031. XBoth this documentation and
  1032. X.I Brik
  1033. Xare Copyright 1989 Rahul Dhesi, all
  1034. Xrights reserved.  Permission is granted to copy, use, and distribute for any
  1035. Xcommercial or noncommercial purpose in accordance with the requirements of
  1036. Xversion 1.0 of the
  1037. X.I GNU General Public license.
  1038. X.PP
  1039. XNote:  This software has not been endorsed by the Free Software Foundation,
  1040. Xthe creator of the GNU license, and I am not affiliated with that
  1041. Xorganization.
  1042. X.SH AUTHOR
  1043. X.nf
  1044. XRahul Dhesi
  1045. XUUCP: {iuvax,pur-ee}!bsu-cs!dhesi
  1046. XInternet: dhesi@bsu-cs.bsu.edu
  1047. X.fi
  1048. SHAR_EOF
  1049. fi
  1050. echo shar: "extracting 'addbfcrc.asm'" '(2254 characters)'
  1051. if test -f 'addbfcrc.asm'
  1052. then
  1053.     echo shar: "will not over-write existing file 'addbfcrc.asm'"
  1054. else
  1055. sed 's/^X//' << \SHAR_EOF > 'addbfcrc.asm'
  1056. X; ::[[ @(#) addbfcrc.asm 1.1 89/07/08 10:48:28 ]]::
  1057. X; assembly implementation of addbfcrc() for Turbo C 2.0 -- small memory model
  1058. X
  1059. X; The following code was obtained from compiling addbfcrc.c using
  1060. X; Turbo C 2.0, then hand-optimized.  In the interest of making
  1061. X; faster CRC-32 calculations available to all, I hereby release
  1062. X; the contents of this file to the public domain.  This code is for
  1063. X; the small memory model only.  It will probably need to be revised
  1064. X; for use with other C compilers.
  1065. X;                                    -- Rahul Dhesi 1989/07/08
  1066. X
  1067. X_DATA   segment word public 'DATA'
  1068. X_DATA   ends
  1069. X
  1070. X        extrn   _crccode:word
  1071. X        extrn   _crctab:word
  1072. X        public  _addbfcrc
  1073. X
  1074. X_TEXT   segment byte public 'CODE'
  1075. X
  1076. XDGROUP  group   _DATA
  1077. X        assume  cs:_TEXT,ds:DGROUP,ss:DGROUP
  1078. X
  1079. X;void addbfcrc (buf, size) char *buf, int size
  1080. X
  1081. X_addbfcrc       proc    near
  1082. X        push    bp
  1083. X        mov     bp,sp
  1084. X        sub     sp,2
  1085. X        push    si
  1086. X        push    di
  1087. X        mov     cx,word ptr [bp+6]      ;cx = size
  1088. X        mov     si,word ptr [bp+4]      ;si = buf
  1089. X
  1090. X        xor     di,di                   ;i = 0
  1091. X
  1092. X        jcxz    done                    ;if size = 0, nothing to do
  1093. X@loop:
  1094. X
  1095. X;      crccode = crctab[(int) ((crccode) ^ (buf[i])) & 0xff] ^
  1096. X;         (((crccode) >> 8) & 0x00FFFFFFL);
  1097. X
  1098. X;       (dx,ax) <- ((crccode) >> 8) & 0x00FFFFFFL
  1099. X        mov     dx,word ptr DGROUP:_crccode+2
  1100. X        mov     ax,word ptr DGROUP:_crccode
  1101. X        mov     al,ah
  1102. X        mov     ah,dl
  1103. X        mov     dl,dh
  1104. X        xor     dh,dh
  1105. X
  1106. X        mov     bx,di                   ;bx <= i
  1107. X
  1108. X        mov     bl,byte ptr [bx+si]     ;bl <- buf[i]
  1109. X
  1110. X        xor     bl,byte ptr DGROUP:_crccode ;bl <- (bl ^ crccode) & 0xff
  1111. X        xor     bh,bh                   ;bx <- bl
  1112. X        shl     bx,1
  1113. X        shl     bx,1                    ;bx <- 4 * bx (for subscript)
  1114. X
  1115. X        xor     ax,word ptr DGROUP:_crctab[bx]
  1116. X        xor     dx,word ptr DGROUP:_crctab[bx+2]
  1117. X        mov     word ptr DGROUP:_crccode+2,dx
  1118. X        mov     word ptr DGROUP:_crccode,ax
  1119. X
  1120. X        inc     di              ; i++
  1121. X        loop    @loop
  1122. Xdone:
  1123. X
  1124. X        pop     di
  1125. X        pop     si
  1126. X        mov     sp,bp
  1127. X        pop     bp
  1128. X        ret     
  1129. X_addbfcrc       endp
  1130. X
  1131. X_TEXT   ends
  1132. X        end
  1133. SHAR_EOF
  1134. fi
  1135. echo shar: "extracting 'makefile.nix'" '(1242 characters)'
  1136. if test -f 'makefile.nix'
  1137. then
  1138.     echo shar: "will not over-write existing file 'makefile.nix'"
  1139. else
  1140. sed 's/^X//' << \SHAR_EOF > 'makefile.nix'
  1141. X# Makefile for brik
  1142. X# ::[[ @(#) makefile.nix 1.2 89/07/08 10:41:32 ]]::
  1143. X
  1144. X# Please see brik.h for configuration options.
  1145. X
  1146. X# Make sure this file is called "makefile" (rename it if necessary).  Then
  1147. X# type one of the following.
  1148. X#
  1149. X# "make bsd", "make sys_v", "make ultrix", "make uport"
  1150. X#                   -- makes brik in current directory
  1151. X# "make install"    -- makes brik, then moves it into DESTDIR defined below
  1152. X# "make clean"      -- deletes "core", objects, and executable
  1153. X
  1154. X# Directory where we want to move executable brik on "make install"
  1155. XDESTDIR=/usr/local/bin/.
  1156. X
  1157. X# CFLAGS and CMORE are flags for the C compiler. 
  1158. X# LDFLAGS and LDMORE are flags for the loader.
  1159. X
  1160. XCFLAGS=-O
  1161. XCMORE=
  1162. XLDFLAGS=
  1163. XLDMORE=
  1164. X
  1165. XCC=cc
  1166. XLD=cc
  1167. X
  1168. X.c.o :
  1169. X    $(CC) -c $(CFLAGS) $(CMORE) $*.c
  1170. X
  1171. XOBJS = brik.o initcrc.o addbfcrc.o
  1172. X
  1173. Xall:
  1174. X    @echo 'Please type "make sys_v", "make bsd", "make ultrix", or "make uport"'
  1175. X
  1176. Xsys_v:
  1177. X    make "CMORE=-DSYS_V" brik
  1178. X
  1179. Xbsd:
  1180. X    make "CMORE=-DBSD" brik
  1181. X
  1182. Xuport:
  1183. X    make "CMORE=-Ml -DSYS_V" "LDMORE=-Ml" brik
  1184. X
  1185. Xultrix:
  1186. X    make "CMORE=-DBSD -DULTRIX_BUG" brik
  1187. X
  1188. Xbrik: $(OBJS)
  1189. X    $(LD) $(LDFLAGS) $(LDMORE) -o brik $(OBJS)
  1190. X
  1191. Xbrik.o: brik.c brik.h assert.h
  1192. X
  1193. Xinitcrc.o: initcrc.c brik.h
  1194. X
  1195. Xinstall: brik
  1196. X    mv brik $(DESTDIR)/brik
  1197. X
  1198. Xclean:
  1199. X    /bin/rm -f $(OBJS) core brik
  1200. SHAR_EOF
  1201. fi
  1202. echo shar: "extracting 'makefile.msc'" '(902 characters)'
  1203. if test -f 'makefile.msc'
  1204. then
  1205.     echo shar: "will not over-write existing file 'makefile.msc'"
  1206. else
  1207. sed 's/^X//' << \SHAR_EOF > 'makefile.msc'
  1208. X# Makefile for Microsoft C 5.1 thanks to Tom Horsley <tom@ssd.harris.com>.
  1209. X# Slightly modified.  You will need a good "make" utility.  Not tested.
  1210. X#                                   -- Rahul Dhesi
  1211. X
  1212. X# "make brik.exe"   -- make brik.exe in current directory
  1213. X# "make clean"      -- delete brik.exe and *.obj, needs "rm" to be present
  1214. X
  1215. X# define your library directory below
  1216. XLIB = C:\C51\LIB
  1217. X
  1218. X# see "brik.h" for other optional compile-time symbols
  1219. XCFLAGS = -DMSC51
  1220. X
  1221. XOBJS = brik.obj getopt.obj turboc.obj initcrc.obj addbfcrc.obj
  1222. X
  1223. Xbrik.exe: $(OBJS)
  1224. X    $(CC) -Febrik.exe -F 8000 $(OBJS) $(LIB)\setargv.obj /link /NOE
  1225. X
  1226. Xturboc.obj: turboc.c brik.h assert.h
  1227. X
  1228. Xinitcrc.obj: initcrc.c
  1229. X
  1230. Xbrik.obj: brik.c brik.h assert.h
  1231. X
  1232. Xgetopt.obj: getopt.c
  1233. X
  1234. X# there is also addbfcrc.asm for speed, designed to work
  1235. X# with Turbo C.  It may need to be revised for MSC.  -- R.D.
  1236. X
  1237. Xaddbfcrc.obj: addbfcrc.c
  1238. X
  1239. Xclean:
  1240. X    rm -f *.obj brik.exe
  1241. SHAR_EOF
  1242. fi
  1243. echo shar: "extracting 'assert.h'" '(754 characters)'
  1244. if test -f 'assert.h'
  1245. then
  1246.     echo shar: "will not over-write existing file 'assert.h'"
  1247. else
  1248. sed 's/^X//' << \SHAR_EOF > 'assert.h'
  1249. X/* @(#) assert.h 1.5 89/03/08 14:59:02 */
  1250. X
  1251. X/* I claim no copyright over the contents of this file.  -- Rahul Dhesi */
  1252. X
  1253. X/*
  1254. XChecksum: 3376323427      (check or update this with "brik")
  1255. X*/
  1256. X
  1257. X/*
  1258. X**   Assertions are enabled only if NDEBUG is not defined.
  1259. X**   Not all compilers define __FILE__ and __LINE__.  If yours
  1260. X**   doesn't, you can just let NDEBUG remain #defined in brik.h and no
  1261. X**   assertions will be compiled in.  Or, if you want to enable
  1262. X**   assertions, redefine the assert() macro so it works with your
  1263. X**   compiler.
  1264. X*/
  1265. X
  1266. X#ifndef OK_STDIO
  1267. X# include <stdio.h>
  1268. X# define OK_STDIO
  1269. X#endif
  1270. X
  1271. X#ifndef NDEBUG
  1272. X#define assert(E) \
  1273. X{if(!(E))fprintf(stderr,"Assertion error in %s line %d\n",__FILE__,__LINE__);}
  1274. X#else
  1275. X#define assert(E)
  1276. X#endif /* NDEBUG */
  1277. SHAR_EOF
  1278. fi
  1279. echo shar: "extracting 'descrip.mms'" '(712 characters)'
  1280. if test -f 'descrip.mms'
  1281. then
  1282.     echo shar: "will not over-write existing file 'descrip.mms'"
  1283. else
  1284. sed 's/^X//' << \SHAR_EOF > 'descrip.mms'
  1285. X# Makefile for brik -- for VAX/VMS "mms".  If you don't have mms,
  1286. X#  use the "makebrik.com" command file instead.
  1287. X#
  1288. X# Don't forget to define a symbol "brik" like this:
  1289. X#  $ brik:==$disk:[dir]brik.exe
  1290. X# where "disk" is your device name and "dir" is the directory in which
  1291. X# brik.exe is kept.
  1292. X
  1293. X# ::[[ @(#) descrip.mms 1.2 89/07/08 10:44:01 ]]::
  1294. X
  1295. X# Please see brik.h for configuration options.
  1296. X
  1297. XCFLAGS = /define=VMS
  1298. XOBJS = brik.obj, addbfcrc.obj, getopt.obj, vms.obj, initcrc.obj
  1299. XCC = cc
  1300. X
  1301. X.c.obj :
  1302. X    $(CC) $(CFLAGS) $*.c
  1303. X
  1304. Xbrik.exe : $(OBJS)
  1305. X    link/executable=brik.exe  $(OBJS), options/opt
  1306. X
  1307. Xbrik.obj : brik.c brik.h assert.h
  1308. X
  1309. Xaddbfcrc.obj : addbfcrc.c
  1310. X
  1311. Xvms.obj : vms.c
  1312. X
  1313. Xgetopt.obj : getopt.c
  1314. X
  1315. Xinitcrc.obj : initcrc.c
  1316. SHAR_EOF
  1317. fi
  1318. echo shar: "extracting 'makefile.tcc'" '(701 characters)'
  1319. if test -f 'makefile.tcc'
  1320. then
  1321.     echo shar: "will not over-write existing file 'makefile.tcc'"
  1322. else
  1323. sed 's/^X//' << \SHAR_EOF > 'makefile.tcc'
  1324. X# needs NDMAKE (tested with version 4.31), Turbo C 2.0, Turbo Assembler
  1325. X# (tested with version 1.0).  Can be easily modified to use Micoroft
  1326. X# assembler instead.  Will work with Borland's make program (tested 
  1327. X# with version 2.0) if you comment out the .SUFFIXES line.
  1328. X
  1329. XCC = tcc
  1330. XCFLAGS = -c -DTURBOC -DLINT -DNDEBUG
  1331. XLD = tcc
  1332. XLDFLAGS = -eBRIK
  1333. XAS = tasm
  1334. XASFLAGS = -mx
  1335. X
  1336. X# To use Borland's make program, comment out the following line
  1337. X.SUFFIXES : .exe .obj .asm .c
  1338. X
  1339. X.asm.obj :
  1340. X    $(AS) $(ASFLAGS) $*.asm
  1341. X
  1342. X.c.obj :
  1343. X    $(CC) $(CFLAGS) $*.c
  1344. X
  1345. XOBJS = brik.obj initcrc.obj getopt.obj turboc.obj addbfcrc.obj
  1346. X
  1347. Xbrik.exe: $(OBJS)
  1348. X    $(LD) $(LDFLAGS) $(OBJS)
  1349. X
  1350. Xbrik.obj: brik.c brik.h assert.h
  1351. X
  1352. Xaddbfcrc.obj: addbfcrc.asm
  1353. SHAR_EOF
  1354. fi
  1355. echo shar: "extracting 'addbfcrc.c'" '(651 characters)'
  1356. if test -f 'addbfcrc.c'
  1357. then
  1358.     echo shar: "will not over-write existing file 'addbfcrc.c'"
  1359. else
  1360. sed 's/^X//' << \SHAR_EOF > 'addbfcrc.c'
  1361. X/* ::[[ @(#) addbfcrc.c 1.10 89/07/08 10:34:48 ]]:: */
  1362. X/* Adapted from zmodem source code, which contained Gary Brown's code */
  1363. X
  1364. X#ifndef LINT
  1365. Xstatic char sccsid[]="::[[ @(#) addbfcrc.c 1.10 89/07/08 10:34:48 ]]::";
  1366. X#endif
  1367. X
  1368. Xtypedef unsigned long tcrc;      /* type of crc value -- same as in brik.c */
  1369. Xextern tcrc crccode;             /* holds all crc values */
  1370. Xextern tcrc crctab[];            /* the crc calculation table */
  1371. X
  1372. Xvoid addbfcrc (buf, size)
  1373. Xregister char *buf;
  1374. Xregister int size;
  1375. X{
  1376. X   int i;
  1377. X   for (i = 0;  i < size;  i ++) {
  1378. X      crccode = crctab[(int) ((crccode) ^ (buf[i])) & 0xff] ^
  1379. X         (((crccode) >> 8) & 0x00FFFFFFL);
  1380. X   }
  1381. X}
  1382. SHAR_EOF
  1383. fi
  1384. echo shar: "extracting 'crc.lst'" '(646 characters)'
  1385. if test -f 'crc.lst'
  1386. then
  1387.     echo shar: "will not over-write existing file 'crc.lst'"
  1388. else
  1389. sed 's/^X//' << \SHAR_EOF > 'crc.lst'
  1390. X# Whole file CRCs generated by Brik v2.0.  Use "brik -C" to verify them.
  1391. X
  1392. X# CRC-32        filename
  1393. X# ------        --------
  1394. X
  1395. X1539374499      addbfcrc.asm
  1396. X2893546047      addbfcrc.c
  1397. X1943472856      assert.h
  1398. X2680503236      brik.h
  1399. X2417647845      brik.prj
  1400. X3056859226      descrip.mms
  1401. X2566277976      getopt.c
  1402. X1764729989      initcrc.c
  1403. X4163595257      makebrik.com
  1404. X3874945495      makefile.msc
  1405. X 596215296      makefile.nix
  1406. X 566402493      makefile.tcc
  1407. X 900930479      options.opt
  1408. X1446083007      turboc.cfg
  1409. X1151475469      vms.c
  1410. X4124789894      brik.c
  1411. X 775774555      turboc.c
  1412. X2597900720      brik.1
  1413. X1364707051      brik.doc
  1414. X3651763827      install
  1415. SHAR_EOF
  1416. fi
  1417. echo shar: "extracting 'makebrik.com'" '(382 characters)'
  1418. if test -f 'makebrik.com'
  1419. then
  1420.     echo shar: "will not over-write existing file 'makebrik.com'"
  1421. else
  1422. sed 's/^X//' << \SHAR_EOF > 'makebrik.com'
  1423. X$! This command file compiles brik for VAX/VMS and also defines a
  1424. X$! symbol so you can type "brik" to execute the program.
  1425. X$!
  1426. X$ cc /define=VMS brik.c
  1427. X$ cc /define=VMS addbfcrc
  1428. X$ cc /define=VMS initcrc.c
  1429. X$ cc /define=VMS vms.c
  1430. X$ cc /define=VMS getopt.c
  1431. X$ link/executable=brik.exe  brik,addbfcrc,initcrc,vms,getopt, options/opt
  1432. X$ brik:==$'f$trnlnm("sys$disk")''f$directory()'brik.exe
  1433. SHAR_EOF
  1434. fi
  1435. echo shar: "extracting 'turboc.cfg'" '(163 characters)'
  1436. if test -f 'turboc.cfg'
  1437. then
  1438.     echo shar: "will not over-write existing file 'turboc.cfg'"
  1439. else
  1440. sed 's/^X//' << \SHAR_EOF > 'turboc.cfg'
  1441. X-wamp
  1442. X-wuse
  1443. X-wrvl
  1444. X-wsig
  1445. X-wamb
  1446. X-wstv
  1447. X-wpro
  1448. X-wnod
  1449. X-wucp
  1450. X-a
  1451. X-f-
  1452. X-A
  1453. X-N
  1454. X-O
  1455. X-Z
  1456. X-k
  1457. X-d
  1458. X-Ic:\turboc\include
  1459. X-Lc:\turboc\lib
  1460. X-eC:\BRIK\BRIK
  1461. X-j10
  1462. X-g0
  1463. X-DTURBOC
  1464. X-DLINT
  1465. X-DDEBUG
  1466. SHAR_EOF
  1467. fi
  1468. echo shar: "extracting 'brik.prj'" '(93 characters)'
  1469. if test -f 'brik.prj'
  1470. then
  1471.     echo shar: "will not over-write existing file 'brik.prj'"
  1472. else
  1473. sed 's/^X//' << \SHAR_EOF > 'brik.prj'
  1474. Xaddbfcrc.obj
  1475. Xbrik.c          (assert.h brik.h)
  1476. Xgetopt.c
  1477. Xturboc.c        (assert.h)
  1478. Xinitcrc.c
  1479. SHAR_EOF
  1480. fi
  1481. echo shar: "extracting 'options.opt'" '(28 characters)'
  1482. if test -f 'options.opt'
  1483. then
  1484.     echo shar: "will not over-write existing file 'options.opt'"
  1485. else
  1486. sed 's/^X//' << \SHAR_EOF > 'options.opt'
  1487. Xsys$share:vaxcrtl.exe/share
  1488. SHAR_EOF
  1489. fi
  1490. exit 0
  1491. #    End of shell archive
  1492.  
  1493.  
  1494.