home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume3 / texchk / part1 next >
SHell self-extracting ARchive  |  1986-11-30  |  37.2 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: SHell self-extracting ARchive (archive/shar).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert SHell self-extracting ARchive (archive/shar) magic Supported
100% dexvert Internet Message Format (text/imf) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news or mail text default
99% file makefile script text default
98% file C source text default
97% file C source, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/329 Shell Archive Format default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/rfc822 default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 46 72 6f 6d 3a 20 74 61 | 6c 63 6f 74 74 21 74 68 |From: ta|lcott!th|
|00000010| 69 6e 6b 21 6d 61 73 73 | 61 72 0a 53 75 62 6a 65 |ink!mass|ar.Subje|
|00000020| 63 74 3a 20 74 65 78 63 | 68 6b 20 28 70 61 72 74 |ct: texc|hk (part|
|00000030| 20 31 20 6f 66 20 32 29 | 20 2d 20 73 79 6e 74 61 | 1 of 2)| - synta|
|00000040| 78 20 63 68 65 63 6b 65 | 72 20 66 6f 72 20 4c 61 |x checke|r for La|
|00000050| 54 65 58 0a 4e 65 77 73 | 67 72 6f 75 70 73 3a 20 |TeX.News|groups: |
|00000060| 6d 6f 64 2e 73 6f 75 72 | 63 65 73 0a 41 70 70 72 |mod.sour|ces.Appr|
|00000070| 6f 76 65 64 3a 20 6a 70 | 6e 40 70 61 6e 64 61 2e |oved: jp|n@panda.|
|00000080| 55 55 43 50 0a 0a 4d 6f | 64 2e 73 6f 75 72 63 65 |UUCP..Mo|d.source|
|00000090| 73 3a 20 20 56 6f 6c 75 | 6d 65 20 33 2c 20 49 73 |s: Volu|me 3, Is|
|000000a0| 73 75 65 20 36 33 0a 53 | 75 62 6d 69 74 74 65 64 |sue 63.S|ubmitted|
|000000b0| 20 62 79 3a 20 74 61 6c | 63 6f 74 74 21 74 68 69 | by: tal|cott!thi|
|000000c0| 6e 6b 21 6d 61 73 73 61 | 72 0a 0a 0a 54 68 69 73 |nk!massa|r...This|
|000000d0| 20 69 73 20 27 74 65 78 | 63 68 6b 27 2c 20 61 20 | is 'tex|chk', a |
|000000e0| 73 79 6e 74 61 78 20 63 | 68 65 63 6b 65 72 20 66 |syntax c|hecker f|
|000000f0| 6f 72 20 74 68 65 20 4c | 61 54 65 58 20 54 65 58 |or the L|aTeX TeX|
|00000100| 20 6d 61 63 72 6f 20 70 | 61 63 6b 61 67 65 2e 0a | macro p|ackage..|
|00000110| 0a 4a 50 20 4d 61 73 73 | 61 72 0a 6d 61 73 73 61 |.JP Mass|ar.massa|
|00000120| 72 40 74 68 69 6e 6b 2e | 63 6f 6d 0a 69 68 6e 70 |r@think.|com.ihnp|
|00000130| 34 21 74 68 69 6e 6b 21 | 6d 61 73 73 61 72 0a 0a |4!think!|massar..|
|00000140| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000150| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000160| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000170| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000180| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 0a 23 |--------|------.#|
|00000190| 21 20 2f 62 69 6e 2f 73 | 68 0a 23 20 54 68 69 73 |! /bin/s|h.# This|
|000001a0| 20 69 73 20 61 20 73 68 | 65 6c 6c 20 61 72 63 68 | is a sh|ell arch|
|000001b0| 69 76 65 2c 20 6d 65 61 | 6e 69 6e 67 3a 0a 23 20 |ive, mea|ning:.# |
|000001c0| 31 2e 20 52 65 6d 6f 76 | 65 20 65 76 65 72 79 74 |1. Remov|e everyt|
|000001d0| 68 69 6e 67 20 61 62 6f | 76 65 20 74 68 65 20 23 |hing abo|ve the #|
|000001e0| 21 20 2f 62 69 6e 2f 73 | 68 20 6c 69 6e 65 2e 0a |! /bin/s|h line..|
|000001f0| 23 20 32 2e 20 53 61 76 | 65 20 74 68 65 20 72 65 |# 2. Sav|e the re|
|00000200| 73 75 6c 74 69 6e 67 20 | 74 65 78 74 20 69 6e 20 |sulting |text in |
|00000210| 61 20 66 69 6c 65 2e 0a | 23 20 33 2e 20 45 78 65 |a file..|# 3. Exe|
|00000220| 63 75 74 65 20 74 68 65 | 20 66 69 6c 65 20 77 69 |cute the| file wi|
|00000230| 74 68 20 2f 62 69 6e 2f | 73 68 20 28 6e 6f 74 20 |th /bin/|sh (not |
|00000240| 63 73 68 29 20 74 6f 20 | 63 72 65 61 74 65 20 74 |csh) to |create t|
|00000250| 68 65 20 66 69 6c 65 73 | 3a 0a 23 09 52 45 41 44 |he files|:.#.READ|
|00000260| 4d 45 0a 23 09 4d 61 6b | 65 66 69 6c 65 0a 23 09 |ME.#.Mak|efile.#.|
|00000270| 74 65 78 63 68 6b 2e 31 | 0a 23 09 63 6d 64 73 2e |texchk.1|.#.cmds.|
|00000280| 68 0a 23 09 63 74 6f 6f | 6c 73 2e 68 0a 23 09 74 |h.#.ctoo|ls.h.#.t|
|00000290| 65 78 63 68 61 72 73 2e | 68 0a 23 09 74 65 78 63 |exchars.|h.#.texc|
|000002a0| 68 6b 2e 68 0a 23 09 74 | 65 78 63 68 6b 2e 63 0a |hk.h.#.t|exchk.c.|
|000002b0| 23 20 54 68 69 73 20 61 | 72 63 68 69 76 65 20 63 |# This a|rchive c|
|000002c0| 72 65 61 74 65 64 3a 20 | 54 75 65 20 44 65 63 20 |reated: |Tue Dec |
|000002d0| 31 37 20 30 39 3a 35 39 | 3a 34 30 20 31 39 38 35 |17 09:59|:40 1985|
|000002e0| 0a 65 78 70 6f 72 74 20 | 50 41 54 48 3b 20 50 41 |.export |PATH; PA|
|000002f0| 54 48 3d 2f 62 69 6e 3a | 24 50 41 54 48 0a 65 63 |TH=/bin:|$PATH.ec|
|00000300| 68 6f 20 73 68 61 72 3a | 20 65 78 74 72 61 63 74 |ho shar:| extract|
|00000310| 69 6e 67 20 22 27 52 45 | 41 44 4d 45 27 22 20 27 |ing "'RE|ADME'" '|
|00000320| 28 31 36 38 37 20 63 68 | 61 72 61 63 74 65 72 73 |(1687 ch|aracters|
|00000330| 29 27 0a 69 66 20 74 65 | 73 74 20 2d 66 20 27 52 |)'.if te|st -f 'R|
|00000340| 45 41 44 4d 45 27 0a 74 | 68 65 6e 0a 09 65 63 68 |EADME'.t|hen..ech|
|00000350| 6f 20 73 68 61 72 3a 20 | 77 69 6c 6c 20 6e 6f 74 |o shar: |will not|
|00000360| 20 6f 76 65 72 2d 77 72 | 69 74 65 20 65 78 69 73 | over-wr|ite exis|
|00000370| 74 69 6e 67 20 66 69 6c | 65 20 22 27 52 45 41 44 |ting fil|e "'READ|
|00000380| 4d 45 27 22 0a 65 6c 73 | 65 0a 63 61 74 20 3c 3c |ME'".els|e.cat <<|
|00000390| 20 5c 53 48 41 52 5f 45 | 4f 46 20 3e 20 27 52 45 | \SHAR_E|OF > 'RE|
|000003a0| 41 44 4d 45 27 0a 49 6e | 73 74 72 75 63 74 69 6f |ADME'.In|structio|
|000003b0| 6e 73 20 66 6f 72 20 69 | 6e 73 74 61 6c 6c 69 6e |ns for i|nstallin|
|000003c0| 67 20 74 65 78 63 68 6b | 3a 0a 0a 20 20 41 73 73 |g texchk|:.. Ass|
|000003d0| 75 6d 69 6e 67 20 79 6f | 75 20 61 72 65 20 72 75 |uming yo|u are ru|
|000003e0| 6e 6e 69 6e 67 20 61 20 | 42 53 44 20 34 2e 32 20 |nning a |BSD 4.2 |
|000003f0| 6f 72 20 63 6f 6d 70 61 | 74 69 62 6c 65 20 73 79 |or compa|tible sy|
|00000400| 73 74 65 6d 3a 0a 0a 20 | 20 20 20 45 64 69 74 20 |stem:.. | Edit |
|00000410| 74 68 65 20 66 69 6c 65 | 20 4d 61 6b 65 66 69 6c |the file| Makefil|
|00000420| 65 2e 0a 20 20 20 20 20 | 20 20 20 20 43 68 61 6e |e.. | Chan|
|00000430| 67 65 20 74 68 65 20 42 | 49 4e 20 76 61 72 69 61 |ge the B|IN varia|
|00000440| 62 6c 65 20 74 6f 20 74 | 68 65 20 64 69 72 65 63 |ble to t|he direc|
|00000450| 74 6f 72 79 20 77 68 65 | 72 65 20 79 6f 75 20 77 |tory whe|re you w|
|00000460| 61 6e 74 20 74 68 65 0a | 20 20 20 20 20 20 20 20 |ant the.| |
|00000470| 20 20 20 65 78 65 63 75 | 74 61 62 6c 65 20 74 6f | execu|table to|
|00000480| 20 67 6f 2e 0a 20 20 20 | 20 20 20 20 20 20 43 68 | go.. | Ch|
|00000490| 61 6e 67 65 20 74 68 65 | 20 4d 53 20 76 61 72 69 |ange the| MS vari|
|000004a0| 61 62 6c 65 20 74 6f 20 | 62 65 20 74 68 65 20 27 |able to |be the '|
|000004b0| 78 27 20 77 68 69 63 68 | 20 6d 61 6b 65 73 20 2f |x' which| makes /|
|000004c0| 75 73 72 2f 6d 61 6e 2f | 6d 61 6e 78 0a 20 20 20 |usr/man/|manx. |
|000004d0| 20 20 20 20 20 20 20 20 | 61 63 63 65 70 74 61 62 | |acceptab|
|000004e0| 6c 65 20 74 6f 20 79 6f | 75 2e 0a 20 20 20 20 20 |le to yo|u.. |
|000004f0| 20 20 20 20 43 68 61 6e | 67 65 20 74 68 65 20 43 | Chan|ge the C|
|00000500| 43 20 76 61 72 69 61 62 | 6c 65 20 69 66 20 79 6f |C variab|le if yo|
|00000510| 75 20 77 69 73 68 20 74 | 6f 20 63 6f 6d 70 69 6c |u wish t|o compil|
|00000520| 65 20 77 69 74 68 20 6f | 74 68 65 72 20 74 68 61 |e with o|ther tha|
|00000530| 6e 20 27 63 63 27 2e 0a | 20 20 20 20 54 79 70 65 |n 'cc'..| Type|
|00000540| 20 27 6d 61 6b 65 20 69 | 6e 73 74 61 6c 6c 20 2d | 'make i|nstall -|
|00000550| 6e 27 20 74 6f 20 69 6e | 73 75 72 65 20 74 68 61 |n' to in|sure tha|
|00000560| 74 20 79 6f 75 20 75 6e | 64 65 72 73 74 61 6e 64 |t you un|derstand|
|00000570| 20 77 68 61 74 20 69 73 | 0a 20 20 20 20 20 20 68 | what is|. h|
|00000580| 61 70 70 65 6e 69 6e 67 | 2e 0a 20 20 20 20 54 79 |appening|.. Ty|
|00000590| 70 65 20 27 6d 61 6b 65 | 20 69 6e 73 74 61 6c 6c |pe 'make| install|
|000005a0| 27 2e 0a 20 20 20 20 54 | 79 70 65 20 27 6d 61 6b |'.. T|ype 'mak|
|000005b0| 65 20 6d 61 6e 27 2e 0a | 20 20 20 20 54 79 70 65 |e man'..| Type|
|000005c0| 20 27 74 65 78 63 68 6b | 20 2d 63 20 2d 76 20 3c | 'texchk| -c -v <|
|000005d0| 79 6f 75 72 2d 6f 77 6e | 2d 6c 61 74 65 78 2d 66 |your-own|-latex-f|
|000005e0| 69 6c 65 3e 27 20 61 6e | 64 20 76 65 72 69 66 79 |ile>' an|d verify|
|000005f0| 20 74 68 61 74 20 69 74 | 20 69 73 0a 20 20 20 20 | that it| is. |
|00000600| 20 20 70 72 6f 64 75 63 | 69 6e 67 20 72 65 61 73 | produc|ing reas|
|00000610| 6f 6e 61 62 6c 65 20 6f | 75 74 70 75 74 2e 0a 20 |onable o|utput.. |
|00000620| 20 20 20 54 79 70 65 20 | 27 6d 61 6b 65 20 63 6c | Type |'make cl|
|00000630| 65 61 6e 27 2e 0a 0a 20 | 20 41 73 73 75 6d 69 6e |ean'... | Assumin|
|00000640| 67 20 79 6f 75 20 61 72 | 65 20 6f 6e 20 61 20 6e |g you ar|e on a n|
|00000650| 6f 6e 20 42 53 44 20 34 | 2e 32 20 63 6f 6d 70 61 |on BSD 4|.2 compa|
|00000660| 74 69 62 6c 65 20 73 79 | 73 74 65 6d 3a 0a 0a 20 |tible sy|stem:.. |
|00000670| 20 20 20 59 6f 75 20 77 | 69 6c 6c 20 70 72 6f 62 | You w|ill prob|
|00000680| 61 62 6c 79 20 68 61 76 | 65 20 74 6f 20 63 68 61 |ably hav|e to cha|
|00000690| 6e 67 65 20 74 68 65 20 | 63 61 6c 6c 20 74 6f 20 |nge the |call to |
|000006a0| 27 72 69 6e 64 65 78 27 | 20 69 6e 20 63 74 6f 6f |'rindex'| in ctoo|
|000006b0| 6c 73 2e 63 2e 0a 20 20 | 20 20 28 43 6f 6d 70 69 |ls.c.. | (Compi|
|000006c0| 6c 69 6e 67 20 77 69 74 | 68 20 22 2d 44 72 69 6e |ling wit|h "-Drin|
|000006d0| 64 65 78 3d 73 74 72 72 | 63 68 72 22 20 69 73 20 |dex=strr|chr" is |
|000006e0| 73 75 66 66 69 63 69 65 | 6e 74 20 2d 20 73 65 65 |sufficie|nt - see|
|000006f0| 20 74 68 65 20 4d 61 6b | 65 66 69 6c 65 29 2e 0a | the Mak|efile)..|
|00000700| 0a 20 20 20 20 49 66 20 | 79 6f 75 72 20 63 6f 6d |. If |your com|
|00000710| 70 69 6c 65 72 20 69 73 | 20 62 72 61 69 6e 20 64 |piler is| brain d|
|00000720| 61 6d 61 67 65 64 20 79 | 6f 75 20 6d 61 79 20 68 |amaged y|ou may h|
|00000730| 61 76 65 20 74 6f 20 65 | 78 74 65 6e 73 69 76 65 |ave to e|xtensive|
|00000740| 6c 79 20 20 20 20 0a 20 | 20 20 20 20 20 73 68 6f |ly . | sho|
|00000750| 72 74 65 6e 20 61 6e 64 | 20 72 65 76 69 73 65 20 |rten and| revise |
|00000760| 74 68 65 20 6e 61 6d 65 | 73 20 6f 66 20 76 61 72 |the name|s of var|
|00000770| 69 6f 75 73 20 76 61 72 | 69 61 62 6c 65 73 20 61 |ious var|iables a|
|00000780| 6e 64 20 70 72 65 70 72 | 6f 63 65 73 73 6f 72 0a |nd prepr|ocessor.|
|00000790| 20 20 20 20 20 20 63 6f | 6e 73 74 61 6e 74 73 2e | co|nstants.|
|000007a0| 0a 0a 20 20 20 20 54 61 | 6b 65 20 6f 75 74 20 74 |.. Ta|ke out t|
|000007b0| 68 65 20 2d 44 42 53 44 | 34 32 20 66 6c 61 67 20 |he -DBSD|42 flag |
|000007c0| 66 72 6f 6d 20 74 68 65 | 20 4d 61 6b 65 66 69 6c |from the| Makefil|
|000007d0| 65 2e 20 20 49 66 20 79 | 6f 75 72 20 73 79 73 74 |e. If y|our syst|
|000007e0| 65 6d 20 64 6f 65 73 0a | 20 20 20 20 6e 6f 74 20 |em does.| not |
|000007f0| 68 61 76 65 20 3c 73 74 | 72 69 6e 67 2e 68 3e 20 |have <st|ring.h> |
|00000800| 28 42 65 72 6b 65 6c 65 | 79 20 63 61 6c 6c 65 64 |(Berkele|y called|
|00000810| 20 69 74 20 73 74 72 69 | 6e 67 73 2e 68 29 2c 20 | it stri|ngs.h), |
|00000820| 79 6f 75 20 6d 61 79 20 | 68 61 76 65 0a 20 20 20 |you may |have. |
|00000830| 20 74 6f 20 65 64 69 74 | 20 63 74 6f 6f 6c 73 2e | to edit| ctools.|
|00000840| 63 20 61 6e 64 20 74 65 | 78 63 68 6b 2e 63 20 74 |c and te|xchk.c t|
|00000850| 6f 20 64 65 63 6c 61 72 | 65 20 74 68 65 20 73 74 |o declar|e the st|
|00000860| 72 78 78 78 20 66 75 6e | 63 74 69 6f 6e 73 2e 0a |rxxx fun|ctions..|
|00000870| 0a 20 20 20 20 4d 6f 64 | 75 6c 6f 20 74 68 65 73 |. Mod|ulo thes|
|00000880| 65 20 63 68 61 6e 67 65 | 73 2c 20 49 20 67 6f 74 |e change|s, I got|
|00000890| 20 74 65 78 63 68 6b 20 | 74 6f 20 72 75 6e 20 75 | texchk |to run u|
|000008a0| 6e 64 65 72 20 42 52 4c | 27 73 20 53 59 53 54 45 |nder BRL|'s SYSTE|
|000008b0| 4d 20 56 0a 20 20 20 20 | 20 20 65 6d 75 6c 61 74 |M V. | emulat|
|000008c0| 69 6f 6e 20 70 61 63 6b | 61 67 65 20 73 6f 20 68 |ion pack|age so h|
|000008d0| 6f 70 65 66 75 6c 6c 79 | 20 69 74 20 77 69 6c 6c |opefully| it will|
|000008e0| 20 72 75 6e 20 6f 6e 20 | 6d 6f 73 74 20 73 79 73 | run on |most sys|
|000008f0| 74 65 6d 73 2e 0a 0a 0a | 54 68 65 20 66 69 6c 65 |tems....|The file|
|00000900| 73 20 63 74 6f 6f 6c 73 | 2e 63 20 61 6e 64 20 63 |s ctools|.c and c|
|00000910| 74 6f 6f 6c 73 2e 68 20 | 61 72 65 20 70 6f 74 65 |tools.h |are pote|
|00000920| 6e 74 69 61 6c 6c 79 20 | 75 73 65 66 75 6c 20 69 |ntially |useful i|
|00000930| 6e 20 74 68 65 69 72 20 | 6f 77 6e 20 0a 72 69 67 |n their |own .rig|
|00000940| 68 74 2e 20 20 54 68 65 | 79 20 63 6f 6e 74 61 69 |ht. The|y contai|
|00000950| 6e 20 61 20 6c 69 62 72 | 61 72 79 20 6f 66 20 72 |n a libr|ary of r|
|00000960| 6f 75 74 69 6e 65 73 20 | 49 20 66 69 6e 64 20 6f |outines |I find o|
|00000970| 72 20 66 6f 75 6e 64 20 | 75 73 65 66 75 6c 2e 20 |r found |useful. |
|00000980| 20 59 6f 75 0a 6d 69 67 | 68 74 20 6c 6f 6f 6b 20 | You.mig|ht look |
|00000990| 74 68 72 6f 75 67 68 20 | 69 74 20 66 6f 72 20 66 |through |it for f|
|000009a0| 75 6e 63 74 69 6f 6e 73 | 20 79 6f 75 20 77 69 6c |unctions| you wil|
|000009b0| 6c 20 66 69 6e 64 20 75 | 73 65 66 75 6c 20 6f 72 |l find u|seful or|
|000009c0| 20 79 6f 75 20 63 6f 75 | 6c 64 0a 69 6e 73 74 61 | you cou|ld.insta|
|000009d0| 6c 6c 20 74 68 65 20 77 | 68 6f 6c 65 20 74 68 69 |ll the w|hole thi|
|000009e0| 6e 67 20 61 73 20 61 20 | 6c 69 62 72 61 72 79 20 |ng as a |library |
|000009f0| 61 73 20 68 61 73 20 62 | 65 65 6e 20 64 6f 6e 65 |as has b|een done|
|00000a00| 20 68 65 72 65 20 61 74 | 20 54 4d 43 2e 0a 0a 4a | here at| TMC...J|
|00000a10| 50 20 4d 61 73 73 61 72 | 0a 6d 61 73 73 61 72 40 |P Massar|.massar@|
|00000a20| 74 68 69 6e 6b 2e 63 6f | 6d 0a 69 68 6e 70 34 21 |think.co|m.ihnp4!|
|00000a30| 74 68 69 6e 6b 21 6d 61 | 73 73 61 72 0a 53 48 41 |think!ma|ssar.SHA|
|00000a40| 52 5f 45 4f 46 0a 69 66 | 20 74 65 73 74 20 31 36 |R_EOF.if| test 16|
|00000a50| 38 37 20 2d 6e 65 20 22 | 60 77 63 20 2d 63 20 3c |87 -ne "|`wc -c <|
|00000a60| 20 27 52 45 41 44 4d 45 | 27 60 22 0a 74 68 65 6e | 'README|'`".then|
|00000a70| 0a 09 65 63 68 6f 20 73 | 68 61 72 3a 20 65 72 72 |..echo s|har: err|
|00000a80| 6f 72 20 74 72 61 6e 73 | 6d 69 74 74 69 6e 67 20 |or trans|mitting |
|00000a90| 22 27 52 45 41 44 4d 45 | 27 22 20 27 28 73 68 6f |"'README|'" '(sho|
|00000aa0| 75 6c 64 20 68 61 76 65 | 20 62 65 65 6e 20 31 36 |uld have| been 16|
|00000ab0| 38 37 20 63 68 61 72 61 | 63 74 65 72 73 29 27 0a |87 chara|cters)'.|
|00000ac0| 66 69 0a 66 69 0a 65 63 | 68 6f 20 73 68 61 72 3a |fi.fi.ec|ho shar:|
|00000ad0| 20 65 78 74 72 61 63 74 | 69 6e 67 20 22 27 4d 61 | extract|ing "'Ma|
|00000ae0| 6b 65 66 69 6c 65 27 22 | 20 27 28 35 39 32 20 63 |kefile'"| '(592 c|
|00000af0| 68 61 72 61 63 74 65 72 | 73 29 27 0a 69 66 20 74 |haracter|s)'.if t|
|00000b00| 65 73 74 20 2d 66 20 27 | 4d 61 6b 65 66 69 6c 65 |est -f '|Makefile|
|00000b10| 27 0a 74 68 65 6e 0a 09 | 65 63 68 6f 20 73 68 61 |'.then..|echo sha|
|00000b20| 72 3a 20 77 69 6c 6c 20 | 6e 6f 74 20 6f 76 65 72 |r: will |not over|
|00000b30| 2d 77 72 69 74 65 20 65 | 78 69 73 74 69 6e 67 20 |-write e|xisting |
|00000b40| 66 69 6c 65 20 22 27 4d | 61 6b 65 66 69 6c 65 27 |file "'M|akefile'|
|00000b50| 22 0a 65 6c 73 65 0a 63 | 61 74 20 3c 3c 20 5c 53 |".else.c|at << \S|
|00000b60| 48 41 52 5f 45 4f 46 20 | 3e 20 27 4d 61 6b 65 66 |HAR_EOF |> 'Makef|
|00000b70| 69 6c 65 27 0a 43 43 20 | 3d 20 63 63 0a 0a 23 75 |ile'.CC |= cc..#u|
|00000b80| 73 65 20 74 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |se the f|ollowing|
|00000b90| 20 44 45 46 49 4e 45 53 | 20 6c 69 6e 65 20 66 6f | DEFINES| line fo|
|00000ba0| 72 20 6e 6f 6e 2d 42 53 | 44 20 73 79 73 74 65 6d |r non-BS|D system|
|00000bb0| 73 0a 23 44 45 46 49 4e | 45 53 20 3d 20 2d 44 72 |s.#DEFIN|ES = -Dr|
|00000bc0| 69 6e 64 65 78 3d 73 74 | 72 63 68 72 0a 44 45 46 |index=st|rchr.DEF|
|00000bd0| 49 4e 45 53 20 3d 20 2d | 44 42 53 44 34 32 0a 0a |INES = -|DBSD42..|
|00000be0| 23 75 73 65 20 74 68 65 | 20 66 6f 6c 6c 6f 77 69 |#use the| followi|
|00000bf0| 6e 67 20 43 46 4c 41 47 | 53 20 6c 69 6e 65 20 66 |ng CFLAG|S line f|
|00000c00| 6f 72 20 64 65 62 75 67 | 67 69 6e 67 0a 23 43 46 |or debug|ging.#CF|
|00000c10| 4c 41 47 53 20 3d 20 2d | 67 20 24 28 44 45 46 49 |LAGS = -|g $(DEFI|
|00000c20| 4e 45 53 29 0a 43 46 4c | 41 47 53 20 3d 20 2d 4f |NES).CFL|AGS = -O|
|00000c30| 20 24 28 44 45 46 49 4e | 45 53 29 0a 0a 53 4f 55 | $(DEFIN|ES)..SOU|
|00000c40| 52 43 45 53 20 3d 20 74 | 65 78 63 68 6b 2e 63 20 |RCES = t|exchk.c |
|00000c50| 63 6d 64 73 2e 63 20 74 | 65 78 63 68 61 72 73 2e |cmds.c t|exchars.|
|00000c60| 63 20 65 72 72 6f 72 73 | 2e 63 20 76 65 72 62 61 |c errors|.c verba|
|00000c70| 74 69 6d 2e 63 20 63 74 | 6f 6f 6c 73 2e 63 0a 4f |tim.c ct|ools.c.O|
|00000c80| 42 4a 45 43 54 53 20 3d | 20 74 65 78 63 68 6b 2e |BJECTS =| texchk.|
|00000c90| 6f 20 63 6d 64 73 2e 6f | 20 74 65 78 63 68 61 72 |o cmds.o| texchar|
|00000ca0| 73 2e 6f 20 65 72 72 6f | 72 73 2e 6f 20 76 65 72 |s.o erro|rs.o ver|
|00000cb0| 62 61 74 69 6d 2e 6f 20 | 63 74 6f 6f 6c 73 2e 6f |batim.o |ctools.o|
|00000cc0| 0a 4c 49 42 53 20 3d 0a | 42 49 4e 20 3d 20 2f 75 |.LIBS =.|BIN = /u|
|00000cd0| 73 72 2f 6c 6f 63 61 6c | 0a 4d 53 3d 31 0a 4d 41 |sr/local|.MS=1.MA|
|00000ce0| 4e 20 3d 20 2f 75 73 72 | 2f 6d 61 6e 2f 6d 61 6e |N = /usr|/man/man|
|00000cf0| 24 28 4d 53 29 0a 0a 74 | 65 78 63 68 6b 3a 20 24 |$(MS)..t|exchk: $|
|00000d00| 28 4f 42 4a 45 43 54 53 | 29 0a 09 24 28 43 43 29 |(OBJECTS|)..$(CC)|
|00000d10| 20 2d 6f 20 74 65 78 63 | 68 6b 20 24 28 43 46 4c | -o texc|hk $(CFL|
|00000d20| 41 47 53 29 20 24 28 4f | 42 4a 45 43 54 53 29 20 |AGS) $(O|BJECTS) |
|00000d30| 24 28 4c 49 42 53 29 0a | 69 6e 73 74 61 6c 6c 3a |$(LIBS).|install:|
|00000d40| 20 74 65 78 63 68 6b 0a | 09 72 6d 20 2d 66 20 24 | texchk.|.rm -f $|
|00000d50| 28 42 49 4e 29 2f 74 65 | 78 63 68 6b 0a 09 6d 76 |(BIN)/te|xchk..mv|
|00000d60| 20 74 65 78 63 68 6b 20 | 24 28 42 49 4e 29 2f 74 | texchk |$(BIN)/t|
|00000d70| 65 78 63 68 6b 0a 6d 61 | 6e 3a 20 0a 09 63 70 20 |exchk.ma|n: ..cp |
|00000d80| 74 65 78 63 68 6b 2e 31 | 20 24 28 4d 41 4e 29 2f |texchk.1| $(MAN)/|
|00000d90| 74 65 78 63 68 6b 2e 24 | 28 4d 53 29 0a 09 6d 61 |texchk.$|(MS)..ma|
|00000da0| 6e 20 74 65 78 63 68 6b | 0a 63 6c 65 61 6e 3a 0a |n texchk|.clean:.|
|00000db0| 09 72 6d 20 2d 66 20 74 | 65 78 63 68 6b 20 2a 2e |.rm -f t|exchk *.|
|00000dc0| 6f 20 2a 7e 0a 53 48 41 | 52 5f 45 4f 46 0a 69 66 |o *~.SHA|R_EOF.if|
|00000dd0| 20 74 65 73 74 20 35 39 | 32 20 2d 6e 65 20 22 60 | test 59|2 -ne "`|
|00000de0| 77 63 20 2d 63 20 3c 20 | 27 4d 61 6b 65 66 69 6c |wc -c < |'Makefil|
|00000df0| 65 27 60 22 0a 74 68 65 | 6e 0a 09 65 63 68 6f 20 |e'`".the|n..echo |
|00000e00| 73 68 61 72 3a 20 65 72 | 72 6f 72 20 74 72 61 6e |shar: er|ror tran|
|00000e10| 73 6d 69 74 74 69 6e 67 | 20 22 27 4d 61 6b 65 66 |smitting| "'Makef|
|00000e20| 69 6c 65 27 22 20 27 28 | 73 68 6f 75 6c 64 20 68 |ile'" '(|should h|
|00000e30| 61 76 65 20 62 65 65 6e | 20 35 39 32 20 63 68 61 |ave been| 592 cha|
|00000e40| 72 61 63 74 65 72 73 29 | 27 0a 66 69 0a 66 69 0a |racters)|'.fi.fi.|
|00000e50| 65 63 68 6f 20 73 68 61 | 72 3a 20 65 78 74 72 61 |echo sha|r: extra|
|00000e60| 63 74 69 6e 67 20 22 27 | 74 65 78 63 68 6b 2e 31 |cting "'|texchk.1|
|00000e70| 27 22 20 27 28 32 34 39 | 34 20 63 68 61 72 61 63 |'" '(249|4 charac|
|00000e80| 74 65 72 73 29 27 0a 69 | 66 20 74 65 73 74 20 2d |ters)'.i|f test -|
|00000e90| 66 20 27 74 65 78 63 68 | 6b 2e 31 27 0a 74 68 65 |f 'texch|k.1'.the|
|00000ea0| 6e 0a 09 65 63 68 6f 20 | 73 68 61 72 3a 20 77 69 |n..echo |shar: wi|
|00000eb0| 6c 6c 20 6e 6f 74 20 6f | 76 65 72 2d 77 72 69 74 |ll not o|ver-writ|
|00000ec0| 65 20 65 78 69 73 74 69 | 6e 67 20 66 69 6c 65 20 |e existi|ng file |
|00000ed0| 22 27 74 65 78 63 68 6b | 2e 31 27 22 0a 65 6c 73 |"'texchk|.1'".els|
|00000ee0| 65 0a 63 61 74 20 3c 3c | 20 5c 53 48 41 52 5f 45 |e.cat <<| \SHAR_E|
|00000ef0| 4f 46 20 3e 20 27 74 65 | 78 63 68 6b 2e 31 27 0a |OF > 'te|xchk.1'.|
|00000f00| 2e 54 48 20 54 45 58 43 | 48 4b 20 31 20 33 2f 31 |.TH TEXC|HK 1 3/1|
|00000f10| 33 2f 38 35 0a 2e 53 48 | 20 4e 41 4d 45 0a 54 45 |3/85..SH| NAME.TE|
|00000f20| 58 43 48 4b 20 2d 20 73 | 79 6e 74 61 78 20 63 68 |XCHK - s|yntax ch|
|00000f30| 65 63 6b 65 72 20 66 6f | 72 20 4c 61 54 65 58 2e |ecker fo|r LaTeX.|
|00000f40| 0a 2e 53 48 20 53 59 4e | 4f 50 53 49 53 0a 2e 42 |..SH SYN|OPSIS..B|
|00000f50| 20 74 65 78 63 68 6b 0a | 5b 20 2d 76 20 2d 63 20 | texchk.|[ -v -c |
|00000f60| 5d 20 5b 20 66 69 6c 65 | 31 20 66 69 6c 65 32 20 |] [ file|1 file2 |
|00000f70| 2e 2e 2e 20 5d 0a 2e 53 | 48 20 44 45 53 43 52 49 |... ]..S|H DESCRI|
|00000f80| 50 54 49 4f 4e 0a 42 79 | 20 64 65 66 61 75 6c 74 |PTION.By| default|
|00000f90| 0a 2e 49 20 74 65 78 63 | 68 6b 20 0a 72 65 61 64 |..I texc|hk .read|
|00000fa0| 73 20 66 72 6f 6d 20 73 | 74 61 6e 64 61 72 64 20 |s from s|tandard |
|00000fb0| 69 6e 70 75 74 20 61 6e | 64 20 6f 75 74 70 75 74 |input an|d output|
|00000fc0| 73 20 65 72 72 6f 72 20 | 6d 65 73 73 61 67 65 73 |s error |messages|
|00000fd0| 20 61 6e 64 20 77 68 61 | 74 6e 6f 74 20 74 6f 0a | and wha|tnot to.|
|00000fe0| 73 74 61 6e 64 61 72 64 | 20 65 72 72 6f 72 2e 20 |standard| error. |
|00000ff0| 20 49 66 20 66 69 6c 65 | 6e 61 6d 65 73 20 61 72 | If file|names ar|
|00001000| 65 20 67 69 76 65 6e 20 | 61 73 20 61 72 67 75 6d |e given |as argum|
|00001010| 65 6e 74 73 2c 20 65 61 | 63 68 20 66 69 6c 65 20 |ents, ea|ch file |
|00001020| 69 73 20 72 65 61 64 0a | 61 6e 64 20 70 61 72 73 |is read.|and pars|
|00001030| 65 64 20 69 6e 20 74 75 | 72 6e 2e 0a 2e 50 50 0a |ed in tu|rn...PP.|
|00001040| 2e 49 20 74 65 78 63 68 | 6b 0a 63 68 65 63 6b 73 |.I texch|k.checks|
|00001050| 20 66 6f 72 20 74 68 65 | 20 70 72 6f 70 65 72 20 | for the| proper |
|00001060| 6e 65 73 74 69 6e 67 20 | 6f 66 20 6d 61 74 63 68 |nesting |of match|
|00001070| 69 6e 67 20 27 7b 27 20 | 27 7d 27 20 61 6e 64 20 |ing '{' |'}' and |
|00001080| 27 5b 27 20 27 5d 27 20 | 70 61 69 72 73 2c 0a 6d |'[' ']' |pairs,.m|
|00001090| 61 74 63 68 69 6e 67 20 | 27 5c 5c 62 65 67 69 6e |atching |'\\begin|
|000010a0| 7b 3c 65 6e 76 69 72 6f | 6e 6d 65 6e 74 3e 7d 27 |{<enviro|nment>}'|
|000010b0| 20 27 5c 5c 65 6e 64 7b | 3c 65 6e 76 69 72 6f 6e | '\\end{|<environ|
|000010c0| 6d 65 6e 74 3e 7d 20 70 | 61 69 72 73 2c 20 61 6e |ment>} p|airs, an|
|000010d0| 64 20 4d 61 74 68 20 4d | 6f 64 65 0a 61 6e 64 20 |d Math M|ode.and |
|000010e0| 44 69 73 70 6c 61 79 20 | 4d 61 74 68 20 4d 6f 64 |Display |Math Mod|
|000010f0| 65 20 63 6f 6e 73 74 72 | 75 63 74 73 2e 20 20 49 |e constr|ucts. I|
|00001100| 66 20 69 6d 70 72 6f 70 | 65 72 20 6e 65 73 74 69 |f improp|er nesti|
|00001110| 6e 67 20 69 73 20 64 65 | 74 65 63 74 65 64 2c 20 |ng is de|tected, |
|00001120| 61 6e 20 65 72 72 6f 72 | 0a 6d 65 73 73 61 67 65 |an error|.message|
|00001130| 20 63 6f 6e 73 69 73 74 | 69 6e 67 20 6f 66 20 61 | consist|ing of a|
|00001140| 20 72 65 61 73 6f 6e 2c | 20 61 20 6c 69 6e 65 20 | reason,| a line |
|00001150| 6e 75 6d 62 65 72 2c 20 | 61 6e 64 20 74 68 65 20 |number, |and the |
|00001160| 61 63 74 75 61 6c 20 6c | 69 6e 65 20 6f 66 20 74 |actual l|ine of t|
|00001170| 65 78 74 0a 6f 6e 20 77 | 68 69 63 68 20 74 68 65 |ext.on w|hich the|
|00001180| 20 65 72 72 6f 72 20 6f | 63 63 75 72 72 65 64 20 | error o|ccurred |
|00001190| 69 73 20 64 69 73 70 6c | 61 79 65 64 2e 0a 2e 50 |is displ|ayed...P|
|000011a0| 50 0a 49 6e 20 67 65 6e | 65 72 61 6c 2c 20 74 68 |P.In gen|eral, th|
|000011b0| 65 20 70 72 6f 67 72 61 | 6d 20 77 69 6c 6c 20 68 |e progra|m will h|
|000011c0| 61 6c 74 20 61 66 74 65 | 72 20 66 69 6e 64 69 6e |alt afte|r findin|
|000011d0| 67 20 61 6e 64 20 70 72 | 69 6e 74 69 6e 67 20 74 |g and pr|inting t|
|000011e0| 68 65 20 66 69 72 73 74 | 0a 65 72 72 6f 72 2c 20 |he first|.error, |
|000011f0| 62 65 63 61 75 73 65 20 | 61 74 74 65 6d 70 74 73 |because |attempts|
|00001200| 20 61 74 20 66 75 72 74 | 68 65 72 20 64 69 61 67 | at furt|her diag|
|00001210| 6e 6f 73 69 73 20 77 6f | 75 6c 64 20 6c 69 6b 65 |nosis wo|uld like|
|00001220| 6c 79 20 72 65 73 75 6c | 74 20 69 6e 20 61 0a 73 |ly resul|t in a.s|
|00001230| 74 72 65 61 6d 20 6f 66 | 20 73 70 75 72 69 6f 75 |tream of| spuriou|
|00001240| 73 20 65 72 72 6f 72 20 | 6d 65 73 73 61 67 65 73 |s error |messages|
|00001250| 2e 20 20 0a 2e 50 50 0a | 55 6e 6c 69 6b 65 20 4c |. ..PP.|Unlike L|
|00001260| 61 54 65 58 0a 2e 49 20 | 74 65 78 63 68 6b 0a 69 |aTeX..I |texchk.i|
|00001270| 73 20 66 61 73 74 2e 20 | 20 49 74 20 63 61 6e 20 |s fast. | It can |
|00001280| 67 72 6f 76 65 6c 20 6f | 76 65 72 20 61 20 6c 61 |grovel o|ver a la|
|00001290| 72 67 65 20 66 69 6c 65 | 20 69 6e 20 61 20 6d 61 |rge file| in a ma|
|000012a0| 74 74 65 72 20 6f 66 20 | 61 20 66 65 77 20 73 65 |tter of |a few se|
|000012b0| 63 6f 6e 64 73 2c 0a 61 | 6e 64 20 63 61 6e 20 62 |conds,.a|nd can b|
|000012c0| 65 20 72 75 6e 20 72 65 | 70 65 61 74 65 64 6c 79 |e run re|peatedly|
|000012d0| 20 77 69 74 68 6f 75 74 | 20 63 61 75 73 69 6e 67 | without| causing|
|000012e0| 20 74 68 65 20 43 50 55 | 20 74 6f 20 62 65 67 20 | the CPU| to beg |
|000012f0| 66 6f 72 20 6d 65 72 63 | 79 2e 0a 2e 50 50 0a 54 |for merc|y...PP.T|
|00001300| 68 65 20 63 6f 6d 6d 61 | 6e 64 20 6c 69 6e 65 20 |he comma|nd line |
|00001310| 6f 70 74 69 6f 6e 73 20 | 61 72 65 3a 0a 2e 54 50 |options |are:..TP|
|00001320| 0a 2e 42 20 5c 2d 76 0a | 56 65 72 62 6f 73 65 20 |..B \-v.|Verbose |
|00001330| 6f 70 74 69 6f 6e 2e 20 | 20 50 72 6f 64 75 63 65 |option. | Produce|
|00001340| 73 20 6f 6e 20 74 68 65 | 20 73 74 61 6e 64 61 72 |s on the| standar|
|00001350| 64 20 6f 75 74 70 75 74 | 20 61 20 74 72 61 63 65 |d output| a trace|
|00001360| 20 6f 66 20 65 61 63 68 | 20 65 6e 76 69 72 6f 6e | of each| environ|
|00001370| 6d 65 6e 74 0a 2e 49 20 | 74 65 78 63 68 6b 20 0a |ment..I |texchk .|
|00001380| 65 6e 74 65 72 73 20 61 | 6e 64 20 6c 65 61 76 65 |enters a|nd leave|
|00001390| 73 2c 20 61 6c 6f 6e 67 | 20 77 69 74 68 20 74 68 |s, along| with th|
|000013a0| 65 20 6e 75 6d 62 65 72 | 20 6f 66 20 74 68 65 20 |e number| of the |
|000013b0| 6c 69 6e 65 20 69 74 20 | 69 73 20 63 75 72 72 65 |line it |is curre|
|000013c0| 6e 74 6c 79 20 0a 70 72 | 6f 63 65 73 73 69 6e 67 |ntly .pr|ocessing|
|000013d0| 2e 20 20 54 68 69 73 20 | 69 73 20 75 73 65 64 20 |. This |is used |
|000013e0| 62 61 73 69 63 61 6c 6c | 79 20 74 6f 20 61 73 73 |basicall|y to ass|
|000013f0| 75 72 65 20 79 6f 75 72 | 73 65 6c 66 20 74 68 61 |ure your|self tha|
|00001400| 74 0a 2e 49 20 74 65 78 | 63 68 6b 0a 69 73 20 61 |t..I tex|chk.is a|
|00001410| 63 74 75 61 6c 6c 79 20 | 64 6f 69 6e 67 20 73 6f |ctually |doing so|
|00001420| 6d 65 74 68 69 6e 67 2c | 20 69 66 20 79 6f 75 20 |mething,| if you |
|00001430| 67 69 76 65 20 69 74 20 | 61 20 68 75 67 65 20 66 |give it |a huge f|
|00001440| 69 6c 65 20 74 6f 20 70 | 72 6f 63 65 73 73 2e 0a |ile to p|rocess..|
|00001450| 28 41 6e 64 20 69 73 20 | 6d 69 6c 64 6c 79 20 69 |(And is |mildly i|
|00001460| 6e 74 65 72 65 73 74 69 | 6e 67 29 2e 0a 2e 54 50 |nteresti|ng)...TP|
|00001470| 0a 2e 42 20 5c 2d 63 0a | 43 68 65 63 6b 20 6d 6f |..B \-c.|Check mo|
|00001480| 64 65 2e 20 20 54 65 6c | 6c 73 0a 2e 49 20 74 65 |de. Tel|ls..I te|
|00001490| 78 63 68 6b 0a 74 6f 20 | 63 68 65 63 6b 20 65 61 |xchk.to |check ea|
|000014a0| 63 68 20 6b 65 79 77 6f | 72 64 20 28 65 2e 67 2e |ch keywo|rd (e.g.|
|000014b0| 2c 20 5c 5c 68 73 70 61 | 63 65 2c 20 5c 5c 6d 62 |, \\hspa|ce, \\mb|
|000014c0| 6f 78 29 20 69 6e 20 74 | 68 65 20 66 69 6c 65 20 |ox) in t|he file |
|000014d0| 61 67 61 69 6e 73 74 20 | 61 20 6c 69 73 74 20 6f |against |a list o|
|000014e0| 66 20 0a 6b 6e 6f 77 6e | 20 6b 65 79 77 6f 72 64 |f .known| keyword|
|000014f0| 73 2c 20 61 6e 64 20 69 | 73 73 75 65 20 61 20 77 |s, and i|ssue a w|
|00001500| 61 72 6e 69 6e 67 20 69 | 66 20 74 68 65 20 6b 65 |arning i|f the ke|
|00001510| 79 77 6f 72 64 20 69 73 | 20 6e 6f 74 20 69 6e 20 |yword is| not in |
|00001520| 74 68 65 20 6c 69 73 74 | 2e 0a 41 6c 73 6f 2c 20 |the list|..Also, |
|00001530| 65 61 63 68 20 6b 65 79 | 77 6f 72 64 20 69 73 20 |each key|word is |
|00001540| 63 68 65 63 6b 65 64 20 | 61 73 20 74 6f 20 77 68 |checked |as to wh|
|00001550| 65 74 68 65 72 20 69 74 | 20 69 73 20 6f 6e 6c 79 |ether it| is only|
|00001560| 20 6c 65 67 61 6c 20 69 | 66 20 67 69 76 65 6e 20 | legal i|f given |
|00001570| 0a 69 6e 73 69 64 65 20 | 6f 66 20 6d 61 74 68 20 |.inside |of math |
|00001580| 6d 6f 64 65 2c 20 61 6e | 64 20 69 66 20 73 6f 20 |mode, an|d if so |
|00001590| 61 6e 64 20 69 66 20 6d | 61 74 68 20 6d 6f 64 65 |and if m|ath mode|
|000015a0| 20 69 73 20 6e 6f 74 20 | 65 6e 61 62 6c 65 64 2c | is not |enabled,|
|000015b0| 20 61 6e 20 65 72 72 6f | 72 0a 6d 65 73 73 61 67 | an erro|r.messag|
|000015c0| 65 20 69 73 20 67 69 76 | 65 6e 20 28 62 75 74 20 |e is giv|en (but |
|000015d0| 70 72 6f 63 65 73 73 69 | 6e 67 20 63 6f 6e 74 69 |processi|ng conti|
|000015e0| 6e 75 65 73 29 2e 0a 2e | 53 48 20 46 49 4c 45 53 |nues)...|SH FILES|
|000015f0| 0a 2f 75 73 72 2f 73 72 | 63 2f 6c 6f 63 61 6c 2f |./usr/sr|c/local/|
|00001600| 63 6d 64 2f 74 65 78 63 | 68 6b 09 09 73 6f 75 72 |cmd/texc|hk..sour|
|00001610| 63 65 20 64 69 72 65 63 | 74 6f 72 79 2e 0a 2e 62 |ce direc|tory...b|
|00001620| 72 0a 2f 75 73 72 2f 6c | 6f 63 61 6c 2f 74 65 78 |r./usr/l|ocal/tex|
|00001630| 63 68 6b 09 09 09 65 78 | 65 63 75 74 61 62 6c 65 |chk...ex|ecutable|
|00001640| 20 69 6d 61 67 65 2e 0a | 2e 53 48 20 41 55 54 48 | image..|.SH AUTH|
|00001650| 4f 52 0a 4a 50 20 4d 61 | 73 73 61 72 2c 20 54 68 |OR.JP Ma|ssar, Th|
|00001660| 69 6e 6b 69 6e 67 20 4d | 61 63 68 69 6e 65 73 20 |inking M|achines |
|00001670| 43 6f 72 70 6f 72 61 74 | 69 6f 6e 0a 2e 53 48 20 |Corporat|ion..SH |
|00001680| 42 55 47 53 0a 2e 49 20 | 74 65 78 63 68 6b 0a 6d |BUGS..I |texchk.m|
|00001690| 61 6b 65 73 20 6e 6f 20 | 63 6c 61 69 6d 73 20 74 |akes no |claims t|
|000016a0| 6f 20 62 65 69 6e 67 20 | 70 65 72 66 65 63 74 2e |o being |perfect.|
|000016b0| 20 20 49 74 20 69 73 20 | 71 75 69 74 65 20 70 6f | It is |quite po|
|000016c0| 73 73 69 62 6c 65 20 74 | 68 61 74 20 61 6e 20 27 |ssible t|hat an '|
|000016d0| 65 72 72 6f 72 27 0a 66 | 6c 61 67 67 65 64 20 62 |error'.f|lagged b|
|000016e0| 79 0a 2e 49 20 74 65 78 | 63 68 6b 0a 69 73 20 6e |y..I tex|chk.is n|
|000016f0| 6f 74 20 72 65 61 6c 6c | 79 20 61 6e 20 65 72 72 |ot reall|y an err|
|00001700| 6f 72 20 61 74 20 61 6c | 6c 20 69 66 20 72 75 6e |or at al|l if run|
|00001710| 20 74 68 72 6f 75 67 68 | 20 4c 61 54 65 58 2e 0a | through| LaTeX..|
|00001720| 2e 50 50 0a 49 74 20 64 | 6f 65 73 20 6e 6f 74 20 |.PP.It d|oes not |
|00001730| 63 68 65 63 6b 20 66 6f | 72 20 6e 75 6d 62 65 72 |check fo|r number|
|00001740| 20 6f 66 20 61 72 67 75 | 6d 65 6e 74 73 2c 20 70 | of argu|ments, p|
|00001750| 72 65 73 65 6e 63 65 20 | 6f 66 20 6f 70 74 69 6f |resence |of optio|
|00001760| 6e 61 6c 20 61 72 67 75 | 6d 65 6e 74 73 2c 0a 65 |nal argu|ments,.e|
|00001770| 74 63 2e 0a 2e 50 50 0a | 49 74 20 64 6f 65 73 20 |tc...PP.|It does |
|00001780| 6e 6f 74 20 6b 6e 6f 77 | 20 74 68 61 74 20 63 65 |not know| that ce|
|00001790| 72 74 61 69 6e 20 6b 65 | 79 77 6f 72 64 73 20 63 |rtain ke|ywords c|
|000017a0| 61 6e 20 6f 6e 6c 79 20 | 62 65 20 75 73 65 64 20 |an only |be used |
|000017b0| 69 6e 20 63 65 72 74 61 | 69 6e 20 6d 6f 64 65 73 |in certa|in modes|
|000017c0| 2e 0a 2e 50 50 0a 49 74 | 20 64 6f 65 73 20 6e 6f |...PP.It| does no|
|000017d0| 74 20 75 6e 64 65 72 73 | 74 61 6e 64 20 74 68 61 |t unders|tand tha|
|000017e0| 74 20 27 5b 27 20 61 6e | 64 20 27 5d 27 20 63 61 |t '[' an|d ']' ca|
|000017f0| 6e 20 62 65 20 75 73 65 | 64 20 69 6e 20 72 65 67 |n be use|d in reg|
|00001800| 75 6c 61 72 20 74 65 78 | 74 0a 77 69 74 68 6f 75 |ular tex|t.withou|
|00001810| 74 20 6e 65 63 65 73 73 | 61 72 69 6c 79 20 62 65 |t necess|arily be|
|00001820| 69 6e 67 20 70 61 69 72 | 65 64 2e 20 41 6c 73 6f |ing pair|ed. Also|
|00001830| 2c 20 5c 5c 6c 65 66 74 | 5d 2c 20 66 6f 72 20 65 |, \\left|], for e|
|00001840| 78 61 6d 70 6c 65 2c 0a | 77 69 6c 6c 20 63 6f 6e |xample,.|will con|
|00001850| 66 75 73 65 20 69 74 20 | 74 6f 74 61 6c 6c 79 2e |fuse it |totally.|
|00001860| 0a 2e 50 50 0a 41 6c 74 | 68 6f 75 67 68 20 6e 6f |..PP.Alt|hough no|
|00001870| 74 20 6f 66 66 69 63 69 | 61 6c 6c 79 20 70 61 72 |t offici|ally par|
|00001880| 74 20 6f 66 20 4c 61 54 | 65 58 2c 20 0a 2e 49 20 |t of LaT|eX, ..I |
|00001890| 74 65 78 63 68 6b 0a 75 | 6e 64 65 72 73 74 61 6e |texchk.u|nderstan|
|000018a0| 64 73 20 74 68 65 20 27 | 24 24 27 20 63 6f 6e 73 |ds the '|$$' cons|
|000018b0| 74 72 75 63 74 20 6f 66 | 20 54 65 58 2e 0a 53 48 |truct of| TeX..SH|
|000018c0| 41 52 5f 45 4f 46 0a 69 | 66 20 74 65 73 74 20 32 |AR_EOF.i|f test 2|
|000018d0| 34 39 34 20 2d 6e 65 20 | 22 60 77 63 20 2d 63 20 |494 -ne |"`wc -c |
|000018e0| 3c 20 27 74 65 78 63 68 | 6b 2e 31 27 60 22 0a 74 |< 'texch|k.1'`".t|
|000018f0| 68 65 6e 0a 09 65 63 68 | 6f 20 73 68 61 72 3a 20 |hen..ech|o shar: |
|00001900| 65 72 72 6f 72 20 74 72 | 61 6e 73 6d 69 74 74 69 |error tr|ansmitti|
|00001910| 6e 67 20 22 27 74 65 78 | 63 68 6b 2e 31 27 22 20 |ng "'tex|chk.1'" |
|00001920| 27 28 73 68 6f 75 6c 64 | 20 68 61 76 65 20 62 65 |'(should| have be|
|00001930| 65 6e 20 32 34 39 34 20 | 63 68 61 72 61 63 74 65 |en 2494 |characte|
|00001940| 72 73 29 27 0a 66 69 0a | 66 69 0a 65 63 68 6f 20 |rs)'.fi.|fi.echo |
|00001950| 73 68 61 72 3a 20 65 78 | 74 72 61 63 74 69 6e 67 |shar: ex|tracting|
|00001960| 20 22 27 63 6d 64 73 2e | 68 27 22 20 27 28 38 30 | "'cmds.|h'" '(80|
|00001970| 33 20 63 68 61 72 61 63 | 74 65 72 73 29 27 0a 69 |3 charac|ters)'.i|
|00001980| 66 20 74 65 73 74 20 2d | 66 20 27 63 6d 64 73 2e |f test -|f 'cmds.|
|00001990| 68 27 0a 74 68 65 6e 0a | 09 65 63 68 6f 20 73 68 |h'.then.|.echo sh|
|000019a0| 61 72 3a 20 77 69 6c 6c | 20 6e 6f 74 20 6f 76 65 |ar: will| not ove|
|000019b0| 72 2d 77 72 69 74 65 20 | 65 78 69 73 74 69 6e 67 |r-write |existing|
|000019c0| 20 66 69 6c 65 20 22 27 | 63 6d 64 73 2e 68 27 22 | file "'|cmds.h'"|
|000019d0| 0a 65 6c 73 65 0a 63 61 | 74 20 3c 3c 20 5c 53 48 |.else.ca|t << \SH|
|000019e0| 41 52 5f 45 4f 46 20 3e | 20 27 63 6d 64 73 2e 68 |AR_EOF >| 'cmds.h|
|000019f0| 27 0a 74 79 70 65 64 65 | 66 20 73 74 72 75 63 74 |'.typede|f struct|
|00001a00| 20 7b 0a 0a 20 20 20 69 | 6e 74 20 63 6d 64 6c 65 | {.. i|nt cmdle|
|00001a10| 6e 67 74 68 3b 0a 20 20 | 20 63 68 61 72 20 2a 63 |ngth;. | char *c|
|00001a20| 6d 64 3b 0a 20 20 20 63 | 68 61 72 20 69 73 5f 6d |md;. c|har is_m|
|00001a30| 61 74 68 5f 6d 6f 64 65 | 5f 6f 6e 6c 79 3b 0a 20 |ath_mode|_only;. |
|00001a40| 20 20 75 6e 73 69 67 6e | 65 64 20 66 6c 61 67 73 | unsign|ed flags|
|00001a50| 3b 0a 0a 20 7d 20 4c 61 | 74 65 78 5f 43 6f 6d 6d |;.. } La|tex_Comm|
|00001a60| 61 6e 64 2c 20 2a 50 74 | 72 5f 4c 61 74 65 78 5f |and, *Pt|r_Latex_|
|00001a70| 43 6f 6d 6d 61 6e 64 3b | 0a 0a 0a 65 78 74 65 72 |Command;|...exter|
|00001a80| 6e 20 4c 61 74 65 78 5f | 43 6f 6d 6d 61 6e 64 20 |n Latex_|Command |
|00001a90| 43 6f 6d 6d 61 6e 64 5f | 54 61 62 6c 65 5b 5d 3b |Command_|Table[];|
|00001aa0| 20 0a 20 0a 65 78 74 65 | 72 6e 20 63 68 61 72 20 | . .exte|rn char |
|00001ab0| 2a 4d 61 74 68 5f 45 6e | 76 69 72 6f 6e 6d 65 6e |*Math_En|vironmen|
|00001ac0| 74 73 5b 5d 3b 0a 0a 23 | 64 65 66 69 6e 65 20 43 |ts[];..#|define C|
|00001ad0| 4f 4d 4d 41 4e 44 5f 54 | 41 42 4c 45 5f 53 49 5a |OMMAND_T|ABLE_SIZ|
|00001ae0| 45 20 28 73 69 7a 65 6f | 66 28 43 6f 6d 6d 61 6e |E (sizeo|f(Comman|
|00001af0| 64 5f 54 61 62 6c 65 29 | 2f 73 69 7a 65 6f 66 28 |d_Table)|/sizeof(|
|00001b00| 4c 61 74 65 78 5f 43 6f | 6d 6d 61 6e 64 29 29 0a |Latex_Co|mmand)).|
|00001b10| 0a 23 64 65 66 69 6e 65 | 20 49 53 5f 4d 41 54 48 |.#define| IS_MATH|
|00001b20| 5f 4d 4f 44 45 28 69 29 | 20 28 43 6f 6d 6d 61 6e |_MODE(i)| (Comman|
|00001b30| 64 5f 54 61 62 6c 65 5b | 28 69 29 5d 2e 69 73 5f |d_Table[|(i)].is_|
|00001b40| 6d 61 74 68 5f 6d 6f 64 | 65 5f 6f 6e 6c 79 29 0a |math_mod|e_only).|
|00001b50| 0a 23 64 65 66 69 6e 65 | 20 4e 4f 54 5f 46 4f 55 |.#define| NOT_FOU|
|00001b60| 4e 44 20 2d 31 20 0a 0a | 65 78 74 65 72 6e 20 69 |ND -1 ..|extern i|
|00001b70| 6e 74 20 63 6f 6d 6d 61 | 6e 64 5f 6c 6f 6f 6b 75 |nt comma|nd_looku|
|00001b80| 70 20 28 29 3b 0a 0a 20 | 20 2f 2a 20 41 52 47 55 |p ();.. | /* ARGU|
|00001b90| 4d 45 4e 54 53 3a 0a 20 | 20 20 20 20 63 68 61 72 |MENTS:. | char|
|00001ba0| 20 2a 63 6f 6d 6d 61 6e | 64 3b 0a 20 20 2a 2f 0a | *comman|d;. */.|
|00001bb0| 0a 20 20 2f 2a 20 27 63 | 6f 6d 6d 61 6e 64 27 20 |. /* 'c|ommand' |
|00001bc0| 69 73 20 74 68 65 20 6e | 61 6d 65 20 6f 66 20 61 |is the n|ame of a|
|00001bd0| 20 70 72 65 73 75 6d 65 | 64 20 6c 61 74 65 78 20 | presume|d latex |
|00001be0| 63 6f 6d 6d 61 6e 64 2c | 20 69 6e 63 6c 75 64 69 |command,| includi|
|00001bf0| 6e 67 20 74 68 65 20 2a | 2f 0a 20 20 2f 2a 20 69 |ng the *|/. /* i|
|00001c00| 6e 69 74 69 61 6c 20 62 | 61 63 6b 73 6c 61 73 68 |nitial b|ackslash|
|00001c10| 2e 20 20 20 52 65 74 75 | 72 6e 73 20 4e 4f 54 5f |. Retu|rns NOT_|
|00001c20| 46 4f 55 4e 44 20 69 66 | 20 63 6f 6d 6d 61 6e 64 |FOUND if| command|
|00001c30| 20 69 73 20 6e 6f 74 20 | 69 6e 20 74 68 65 20 63 | is not |in the c|
|00001c40| 6f 6d 6d 61 6e 64 20 2a | 2f 0a 20 20 2f 2a 20 74 |ommand *|/. /* t|
|00001c50| 61 62 6c 65 2c 20 6f 74 | 68 65 72 77 69 73 65 20 |able, ot|herwise |
|00001c60| 74 68 65 20 69 6e 64 65 | 78 20 69 6e 74 6f 20 74 |the inde|x into t|
|00001c70| 68 65 20 63 6f 6d 6d 61 | 6e 64 20 74 61 62 6c 65 |he comma|nd table|
|00001c80| 20 6f 66 20 74 68 65 20 | 65 6e 74 72 79 20 66 6f | of the |entry fo|
|00001c90| 72 20 2a 2f 0a 20 20 2f | 2a 20 74 68 65 20 69 6e |r */. /|* the in|
|00001ca0| 70 75 74 20 63 6f 6d 6d | 61 6e 64 2e 20 2a 2f 0a |put comm|and. */.|
|00001cb0| 0a 65 78 74 65 72 6e 20 | 69 6e 74 20 69 73 5f 6d |.extern |int is_m|
|00001cc0| 61 74 68 5f 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 28 |ath_envi|ronment(|
|00001cd0| 29 3b 0a 0a 20 20 2f 2a | 20 41 52 47 55 4d 45 4e |);.. /*| ARGUMEN|
|00001ce0| 54 53 3a 0a 20 20 20 20 | 20 63 68 61 72 20 2a 6b |TS:. | char *k|
|00001cf0| 65 79 77 6f 72 64 3b 0a | 20 20 2a 2f 0a 0a 20 20 |eyword;.| */.. |
|00001d00| 2f 2a 20 52 65 74 75 72 | 6e 73 20 31 20 6f 72 20 |/* Retur|ns 1 or |
|00001d10| 30 20 2a 2f 0a 53 48 41 | 52 5f 45 4f 46 0a 69 66 |0 */.SHA|R_EOF.if|
|00001d20| 20 74 65 73 74 20 38 30 | 33 20 2d 6e 65 20 22 60 | test 80|3 -ne "`|
|00001d30| 77 63 20 2d 63 20 3c 20 | 27 63 6d 64 73 2e 68 27 |wc -c < |'cmds.h'|
|00001d40| 60 22 0a 74 68 65 6e 0a | 09 65 63 68 6f 20 73 68 |`".then.|.echo sh|
|00001d50| 61 72 3a 20 65 72 72 6f | 72 20 74 72 61 6e 73 6d |ar: erro|r transm|
|00001d60| 69 74 74 69 6e 67 20 22 | 27 63 6d 64 73 2e 68 27 |itting "|'cmds.h'|
|00001d70| 22 20 27 28 73 68 6f 75 | 6c 64 20 68 61 76 65 20 |" '(shou|ld have |
|00001d80| 62 65 65 6e 20 38 30 33 | 20 63 68 61 72 61 63 74 |been 803| charact|
|00001d90| 65 72 73 29 27 0a 66 69 | 0a 66 69 0a 65 63 68 6f |ers)'.fi|.fi.echo|
|00001da0| 20 73 68 61 72 3a 20 65 | 78 74 72 61 63 74 69 6e | shar: e|xtractin|
|00001db0| 67 20 22 27 63 74 6f 6f | 6c 73 2e 68 27 22 20 27 |g "'ctoo|ls.h'" '|
|00001dc0| 28 31 30 38 31 34 20 63 | 68 61 72 61 63 74 65 72 |(10814 c|haracter|
|00001dd0| 73 29 27 0a 69 66 20 74 | 65 73 74 20 2d 66 20 27 |s)'.if t|est -f '|
|00001de0| 63 74 6f 6f 6c 73 2e 68 | 27 0a 74 68 65 6e 0a 09 |ctools.h|'.then..|
|00001df0| 65 63 68 6f 20 73 68 61 | 72 3a 20 77 69 6c 6c 20 |echo sha|r: will |
|00001e00| 6e 6f 74 20 6f 76 65 72 | 2d 77 72 69 74 65 20 65 |not over|-write e|
|00001e10| 78 69 73 74 69 6e 67 20 | 66 69 6c 65 20 22 27 63 |xisting |file "'c|
|00001e20| 74 6f 6f 6c 73 2e 68 27 | 22 0a 65 6c 73 65 0a 63 |tools.h'|".else.c|
|00001e30| 61 74 20 3c 3c 20 5c 53 | 48 41 52 5f 45 4f 46 20 |at << \S|HAR_EOF |
|00001e40| 3e 20 27 63 74 6f 6f 6c | 73 2e 68 27 0a 2f 2a 20 |> 'ctool|s.h'./* |
|00001e50| 2d 2a 2d 20 4d 6f 64 65 | 3a 20 43 3b 20 50 61 63 |-*- Mode|: C; Pac|
|00001e60| 6b 61 67 65 3a 20 28 43 | 54 4f 4f 4c 53 20 43 29 |kage: (C|TOOLS C)|
|00001e70| 20 2d 2a 2d 20 2a 2f 0a | 0a 23 69 66 6e 64 65 66 | -*- */.|.#ifndef|
|00001e80| 20 42 6f 6f 6c 0a 23 64 | 65 66 69 6e 65 20 42 6f | Bool.#d|efine Bo|
|00001e90| 6f 6c 20 69 6e 74 0a 23 | 65 6e 64 69 66 0a 0a 23 |ol int.#|endif..#|
|00001ea0| 69 66 6e 64 65 66 20 54 | 0a 23 64 65 66 69 6e 65 |ifndef T|.#define|
|00001eb0| 20 54 20 31 0a 23 65 6e | 64 69 66 0a 0a 23 69 66 | T 1.#en|dif..#if|
|00001ec0| 6e 64 65 66 20 46 0a 23 | 64 65 66 69 6e 65 20 46 |ndef F.#|define F|
|00001ed0| 20 30 0a 23 65 6e 64 69 | 66 0a 0a 23 69 66 6e 64 | 0.#endi|f..#ifnd|
|00001ee0| 65 66 20 4d 41 58 49 4e | 54 0a 23 64 65 66 69 6e |ef MAXIN|T.#defin|
|00001ef0| 65 20 4d 41 58 49 4e 54 | 20 32 31 34 37 34 38 33 |e MAXINT| 2147483|
|00001f00| 36 34 37 0a 23 64 65 66 | 69 6e 65 20 4d 41 58 49 |647.#def|ine MAXI|
|00001f10| 4e 54 53 54 52 20 22 32 | 31 34 37 34 38 33 36 34 |NTSTR "2|14748364|
|00001f20| 37 22 0a 23 65 6e 64 69 | 66 0a 0a 23 69 66 6e 64 |7".#endi|f..#ifnd|
|00001f30| 65 66 20 4d 41 58 50 41 | 54 48 4c 45 4e 0a 23 64 |ef MAXPA|THLEN.#d|
|00001f40| 65 66 69 6e 65 20 4d 41 | 58 50 41 54 48 4c 45 4e |efine MA|XPATHLEN|
|00001f50| 20 38 30 0a 23 65 6e 64 | 69 66 0a 0a 65 78 74 65 | 80.#end|if..exte|
|00001f60| 72 6e 20 63 68 61 72 20 | 2a 65 6d 61 6c 6c 6f 63 |rn char |*emalloc|
|00001f70| 28 29 3b 0a 0a 20 20 2f | 2a 20 69 6e 74 20 73 70 |();.. /|* int sp|
|00001f80| 61 63 65 3b 20 2a 2f 0a | 20 20 2f 2a 20 73 70 61 |ace; */.| /* spa|
|00001f90| 63 65 20 6d 75 73 74 20 | 62 65 20 67 72 65 61 74 |ce must |be great|
|00001fa0| 65 72 20 74 68 61 6e 20 | 30 20 2a 2f 0a 20 20 2f |er than |0 */. /|
|00001fb0| 2a 20 43 61 75 73 65 73 | 20 65 78 65 63 75 74 75 |* Causes| executu|
|00001fc0| 74 69 6f 6e 20 74 6f 20 | 68 61 6c 74 20 77 69 74 |tion to |halt wit|
|00001fd0| 68 20 61 20 27 46 61 74 | 61 6c 20 65 72 72 6f 72 |h a 'Fat|al error|
|00001fe0| 27 20 6d 65 73 73 61 67 | 65 20 69 66 20 6d 65 6d |' messag|e if mem|
|00001ff0| 6f 72 79 20 2a 2f 0a 20 | 20 2f 2a 20 63 61 6e 6e |ory */. | /* cann|
|00002000| 6f 74 20 62 65 20 61 6c | 6c 6f 63 61 74 65 64 2c |ot be al|located,|
|00002010| 20 6f 74 68 65 72 77 69 | 73 65 20 72 65 74 75 72 | otherwi|se retur|
|00002020| 6e 73 20 70 6f 69 6e 74 | 65 72 20 74 6f 20 6d 61 |ns point|er to ma|
|00002030| 6c 6c 6f 63 2d 65 64 20 | 73 70 61 63 65 20 2a 2f |lloc-ed |space */|
|00002040| 0a 0a 65 78 74 65 72 6e | 20 63 68 61 72 20 2a 61 |..extern| char *a|
|00002050| 6e 65 77 73 74 72 28 29 | 3b 0a 0a 20 20 2f 2a 20 |newstr()|;.. /* |
|00002060| 63 68 61 72 20 2a 61 73 | 74 72 69 6e 67 3b 20 2a |char *as|tring; *|
|00002070| 2f 0a 20 20 2f 2a 20 65 | 6d 61 6c 6c 6f 63 27 73 |/. /* e|malloc's|
|00002080| 20 73 70 61 63 65 20 61 | 6e 64 20 63 6f 70 69 65 | space a|nd copie|
|00002090| 73 20 61 73 74 72 69 6e | 67 20 69 6e 74 6f 20 74 |s astrin|g into t|
|000020a0| 68 61 74 20 73 70 61 63 | 65 2e 20 20 52 65 74 75 |hat spac|e. Retu|
|000020b0| 72 6e 73 20 70 6f 69 6e | 74 65 72 20 2a 2f 0a 20 |rns poin|ter */. |
|000020c0| 20 2f 2a 20 74 6f 20 6e | 65 77 20 73 74 72 69 6e | /* to n|ew strin|
|000020d0| 67 2e 20 2a 2f 0a 0a 0a | 65 78 74 65 72 6e 20 69 |g. */...|extern i|
|000020e0| 6e 74 20 63 6f 70 79 28 | 29 3b 0a 0a 20 20 2f 2a |nt copy(|);.. /*|
|000020f0| 20 63 68 61 72 20 2a 64 | 65 73 74 2c 20 2a 73 72 | char *d|est, *sr|
|00002100| 63 3b 20 69 6e 74 20 6e | 3b 20 2a 2f 0a 20 20 2f |c; int n|; */. /|
|00002110| 2a 20 63 6f 70 69 65 73 | 20 65 78 61 63 74 6c 79 |* copies| exactly|
|00002120| 20 6e 20 62 79 74 65 73 | 2e 20 2a 2f 0a 20 20 2f | n bytes|. */. /|
|00002130| 2a 20 72 65 74 75 72 6e | 20 76 61 6c 75 65 20 75 |* return| value u|
|00002140| 6e 64 65 66 69 6e 65 64 | 2e 20 20 55 73 65 20 6f |ndefined|. Use o|
|00002150| 6e 6c 79 20 61 73 20 70 | 72 6f 63 65 64 75 72 65 |nly as p|rocedure|
|00002160| 2e 20 2a 2f 0a 0a 65 78 | 74 65 72 6e 20 69 6e 74 |. */..ex|tern int|
|00002170| 20 66 69 6c 6c 28 29 3b | 0a 0a 20 20 2f 2a 20 63 | fill();|.. /* c|
|00002180| 68 61 72 20 2a 61 64 64 | 72 2c 20 63 68 3b 20 69 |har *add|r, ch; i|
|00002190| 6e 74 20 6e 3b 20 2a 2f | 0a 20 20 2f 2a 20 63 6f |nt n; */|. /* co|
|000021a0| 70 69 65 73 20 63 68 20 | 69 6e 74 6f 20 6e 20 63 |pies ch |into n c|
|000021b0| 6f 6e 73 65 63 75 74 69 | 76 65 20 62 79 74 65 73 |onsecuti|ve bytes|
|000021c0| 2e 20 2a 2f 0a 20 20 2f | 2a 20 72 65 74 75 72 6e |. */. /|* return|
|000021d0| 20 76 61 6c 75 65 20 75 | 6e 64 65 66 69 6e 65 64 | value u|ndefined|
|000021e0| 2e 20 20 55 73 65 20 6f | 6e 6c 79 20 61 73 20 70 |. Use o|nly as p|
|000021f0| 72 6f 63 65 64 75 72 65 | 2e 20 2a 2f 0a 0a 65 78 |rocedure|. */..ex|
|00002200| 74 65 72 6e 20 69 6e 74 | 20 74 6f 5f 75 70 70 65 |tern int| to_uppe|
|00002210| 72 5f 69 66 5f 6c 6f 77 | 65 72 28 29 3b 0a 0a 20 |r_if_low|er();.. |
|00002220| 20 2f 2a 20 63 68 61 72 | 20 63 68 3b 20 20 52 65 | /* char| ch; Re|
|00002230| 74 75 72 6e 73 20 70 6f | 73 73 69 62 6c 79 20 75 |turns po|ssibly u|
|00002240| 70 70 65 72 2d 63 61 73 | 65 64 20 76 61 6c 75 65 |pper-cas|ed value|
|00002250| 2e 20 2a 2f 0a 0a 65 78 | 74 65 72 6e 20 69 6e 74 |. */..ex|tern int|
|00002260| 20 74 6f 5f 6c 6f 77 65 | 72 5f 69 66 5f 75 70 70 | to_lowe|r_if_upp|
|00002270| 65 72 28 29 3b 0a 0a 20 | 20 2f 2a 20 63 68 61 72 |er();.. | /* char|
|00002280| 20 63 68 3b 20 20 52 65 | 74 75 72 6e 73 20 70 6f | ch; Re|turns po|
|00002290| 73 73 69 62 6c 79 20 6c | 6f 77 65 72 2d 63 61 73 |ssibly l|ower-cas|
|000022a0| 65 64 20 76 61 6c 75 65 | 2e 20 2a 2f 0a 0a 65 78 |ed value|. */..ex|
|000022b0| 74 65 72 6e 20 69 6e 74 | 20 62 75 66 66 63 6f 6e |tern int| buffcon|
|000022c0| 63 61 74 28 29 3b 0a 0a | 20 20 2f 2a 20 63 68 61 |cat();..| /* cha|
|000022d0| 72 20 2a 62 75 66 66 65 | 72 2c 20 2a 73 31 2c 20 |r *buffe|r, *s1, |
|000022e0| 2a 73 32 3b 20 2a 2f 0a | 20 20 2f 2a 20 73 31 20 |*s2; */.| /* s1 |
|000022f0| 61 6e 64 20 73 32 20 6d | 75 73 74 20 62 65 20 6e |and s2 m|ust be n|
|00002300| 75 6c 6c 20 74 65 72 6d | 69 6e 61 74 65 64 2e 20 |ull term|inated. |
|00002310| 20 42 75 66 66 65 72 20 | 6d 75 73 74 20 62 65 20 | Buffer |must be |
|00002320| 61 74 20 6c 65 61 73 74 | 20 2a 2f 0a 20 20 2f 2a |at least| */. /*|
|00002330| 20 73 74 72 6c 65 6e 28 | 73 31 29 20 2b 20 73 74 | strlen(|s1) + st|
|00002340| 72 6c 65 6e 28 73 32 29 | 20 2b 20 31 20 63 68 61 |rlen(s2)| + 1 cha|
|00002350| 72 61 63 74 65 72 73 20 | 6c 6f 6e 67 2e 20 20 42 |racters |long. B|
|00002360| 75 66 66 65 72 20 69 73 | 20 6e 75 6c 6c 20 2a 2f |uffer is| null */|
|00002370| 0a 20 20 2f 2a 20 74 65 | 72 6d 69 6e 61 74 65 64 |. /* te|rminated|
|00002380| 20 75 70 6f 6e 20 63 6f | 6d 70 6c 65 74 69 6f 6e | upon co|mpletion|
|00002390| 2e 20 2a 2f 0a 0a 20 20 | 2f 2a 20 72 65 74 75 72 |. */.. |/* retur|
|000023a0| 6e 20 76 61 6c 75 65 20 | 75 6e 64 65 66 69 6e 65 |n value |undefine|
|000023b0| 64 2e 20 20 55 73 65 20 | 6f 6e 6c 79 20 61 73 20 |d. Use |only as |
|000023c0| 70 72 6f 63 65 64 75 72 | 65 2e 20 2a 2f 0a 0a 65 |procedur|e. */..e|
|000023d0| 78 74 65 72 6e 20 69 6e | 74 20 6e 62 75 66 66 63 |xtern in|t nbuffc|
|000023e0| 6f 6e 63 61 74 28 29 3b | 0a 0a 20 20 2f 2a 20 63 |oncat();|.. /* c|
|000023f0| 68 61 72 20 2a 62 75 66 | 66 65 72 3b 20 69 6e 74 |har *buf|fer; int|
|00002400| 20 6e 3b 20 63 68 61 72 | 20 2a 73 31 2c 2a 73 32 | n; char| *s1,*s2|
|00002410| 2c 2a 73 33 2c 2a 73 34 | 2c 2a 73 35 2c 2a 73 36 |,*s3,*s4|,*s5,*s6|
|00002420| 3b 20 2a 2f 0a 20 20 2f | 2a 20 61 6c 6c 20 74 68 |; */. /|* all th|
|00002430| 65 20 73 74 72 69 6e 67 | 73 20 6d 75 73 74 20 62 |e string|s must b|
|00002440| 65 20 6e 75 6c 6c 20 74 | 65 72 6d 69 6e 61 74 65 |e null t|erminate|
|00002450| 64 2e 20 20 42 75 66 66 | 65 72 20 6d 75 73 74 20 |d. Buff|er must |
|00002460| 62 65 20 62 69 67 20 65 | 6e 6f 75 67 68 20 2a 2f |be big e|nough */|
|00002470| 0a 20 20 2f 2a 20 74 6f | 20 68 6f 6c 64 20 74 68 |. /* to| hold th|
|00002480| 65 20 6e 75 6c 6c 20 74 | 65 72 6d 69 6e 61 74 65 |e null t|erminate|
|00002490| 64 20 72 65 73 75 6c 74 | 2e 20 20 30 20 3c 20 6e |d result|. 0 < n|
|000024a0| 20 3c 20 37 20 2e 20 0a | 20 20 2f 2a 20 72 65 74 | < 7 . .| /* ret|
|000024b0| 75 72 6e 73 20 2d 31 20 | 69 66 20 6e 20 69 73 20 |urns -1 |if n is |
|000024c0| 6f 75 74 20 6f 66 20 72 | 61 6e 67 65 2c 20 6f 74 |out of r|ange, ot|
|000024d0| 68 65 72 77 69 73 65 20 | 30 20 2a 2f 0a 0a 65 78 |herwise |0 */..ex|
|000024e0| 74 65 72 6e 20 69 6e 74 | 20 73 6c 63 6f 6d 70 61 |tern int| slcompa|
|000024f0| 72 65 28 29 3b 0a 0a 20 | 20 2f 2a 20 63 68 61 72 |re();.. | /* char|
|00002500| 20 2a 73 31 3b 20 69 6e | 74 20 6c 31 3b 20 63 68 | *s1; in|t l1; ch|
|00002510| 61 72 20 2a 73 32 3b 20 | 69 6e 74 20 6c 32 20 2a |ar *s2; |int l2 *|
|00002520| 2f 0a 20 20 2f 2a 20 64 | 6f 65 73 20 6e 6f 74 20 |/. /* d|oes not |
|00002530| 73 74 6f 70 20 69 66 20 | 69 74 20 65 6e 63 6f 75 |stop if |it encou|
|00002540| 6e 74 65 72 73 20 61 20 | 6e 75 6c 6c 20 63 68 61 |nters a |null cha|
|00002550| 72 61 63 74 65 72 2e 20 | 2a 2f 0a 20 20 2f 2a 20 |racter. |*/. /* |
|00002560| 72 65 74 75 72 6e 73 20 | 30 20 69 66 20 65 71 75 |returns |0 if equ|
|00002570| 61 6c 2c 20 2d 31 20 69 | 66 20 6e 6f 74 20 65 71 |al, -1 i|f not eq|
|00002580| 75 61 6c 20 2a 2f 0a 0a | 65 78 74 65 72 6e 20 69 |ual */..|extern i|
|00002590| 6e 74 20 73 6c 67 65 5f | 63 6f 6d 70 61 72 65 28 |nt slge_|compare(|
|000025a0| 29 3b 0a 0a 20 20 2f 2a | 20 63 68 61 72 20 2a 73 |);.. /*| char *s|
|000025b0| 31 3b 20 69 6e 74 20 6c | 31 3b 20 63 68 61 72 20 |1; int l|1; char |
|000025c0| 2a 73 32 3b 20 69 6e 74 | 20 6c 32 20 2a 2f 0a 20 |*s2; int| l2 */. |
|000025d0| 20 2f 2a 20 64 6f 65 73 | 20 6e 6f 74 20 73 74 6f | /* does| not sto|
|000025e0| 70 20 69 66 20 69 74 20 | 65 6e 63 6f 75 6e 74 65 |p if it |encounte|
|000025f0| 72 73 20 61 20 6e 75 6c | 6c 20 63 68 61 72 61 63 |rs a nul|l charac|
|00002600| 74 65 72 2e 20 2a 2f 0a | 20 20 2f 2a 20 72 65 74 |ter. */.| /* ret|
|00002610| 75 72 6e 73 20 30 20 69 | 66 20 65 71 75 61 6c 2c |urns 0 i|f equal,|
|00002620| 20 2d 31 20 69 66 20 73 | 31 20 3c 20 73 32 2c 20 | -1 if s|1 < s2, |
|00002630| 31 20 69 66 20 73 31 20 | 3e 20 73 32 20 2a 2f 0a |1 if s1 |> s2 */.|
|00002640| 0a 65 78 74 65 72 6e 20 | 69 6e 74 20 6e 6f 63 61 |.extern |int noca|
|00002650| 73 65 5f 63 6f 6d 70 61 | 72 65 28 29 3b 0a 0a 20 |se_compa|re();.. |
|00002660| 20 2f 2a 20 63 68 61 72 | 20 2a 73 31 3b 20 69 6e | /* char| *s1; in|
|00002670| 74 20 6c 31 3b 20 63 68 | 61 72 20 2a 73 32 3b 20 |t l1; ch|ar *s2; |
|00002680| 69 6e 74 20 6c 32 20 2a | 2f 0a 20 20 2f 2a 20 64 |int l2 *|/. /* d|
|00002690| 6f 65 73 20 6e 6f 74 20 | 73 74 6f 70 20 69 66 20 |oes not |stop if |
|000026a0| 69 74 20 65 6e 63 6f 75 | 6e 74 65 72 73 20 61 20 |it encou|nters a |
|000026b0| 6e 75 6c 6c 20 63 68 61 | 72 61 63 74 65 72 2e 20 |null cha|racter. |
|000026c0| 2a 2f 0a 20 20 2f 2a 20 | 72 65 74 75 72 6e 73 20 |*/. /* |returns |
|000026d0| 30 20 69 66 20 65 71 75 | 61 6c 2c 20 2d 31 20 69 |0 if equ|al, -1 i|
|000026e0| 66 20 73 31 20 3c 20 73 | 32 2c 20 31 20 69 66 20 |f s1 < s|2, 1 if |
|000026f0| 73 31 20 3e 20 73 32 20 | 20 63 61 73 65 20 69 6e |s1 > s2 | case in|
|00002700| 64 65 70 65 6e 64 65 6e | 74 6c 79 2e 20 2a 2f 0a |dependen|tly. */.|
|00002710| 0a 65 78 74 65 72 6e 20 | 63 68 61 72 20 2a 20 73 |.extern |char * s|
|00002720| 74 72 66 69 6e 64 28 29 | 3b 0a 0a 20 20 2f 2a 20 |trfind()|;.. /* |
|00002730| 63 68 61 72 20 2a 73 31 | 3b 20 63 68 61 72 20 2a |char *s1|; char *|
|00002740| 73 32 3b 20 69 6e 74 20 | 66 61 73 74 3b 20 2a 2f |s2; int |fast; */|
|00002750| 0a 20 20 2f 2a 20 66 69 | 6e 64 73 20 73 32 20 61 |. /* fi|nds s2 a|
|00002760| 73 20 61 20 73 75 62 73 | 74 72 69 6e 67 20 6f 66 |s a subs|tring of|
|00002770| 20 73 31 2e 20 20 73 31 | 20 61 6e 64 20 73 32 20 | s1. s1| and s2 |
|00002780| 61 72 65 20 6e 75 6c 6c | 20 74 65 72 6d 69 6e 61 |are null| termina|
|00002790| 74 65 64 2e 20 2a 2f 0a | 20 20 2f 2a 20 72 65 74 |ted. */.| /* ret|
|000027a0| 75 72 6e 73 20 30 20 69 | 66 20 6e 6f 74 20 66 6f |urns 0 i|f not fo|
|000027b0| 75 6e 64 2c 20 6f 74 68 | 65 72 77 69 73 65 20 70 |und, oth|erwise p|
|000027c0| 6f 69 6e 74 65 72 20 69 | 6e 74 6f 20 73 31 20 74 |ointer i|nto s1 t|
|000027d0| 6f 20 66 69 72 73 74 20 | 6d 61 74 63 68 69 6e 67 |o first |matching|
|000027e0| 20 2a 2f 0a 20 20 2f 2a | 20 63 68 61 72 61 63 74 | */. /*| charact|
|000027f0| 65 72 2e 20 2a 2f 0a 0a | 20 20 2f 2a 20 57 41 52 |er. */..| /* WAR|
|00002800| 4e 49 4e 47 3a 20 20 77 | 69 6c 6c 20 61 63 63 65 |NING: w|ill acce|
|00002810| 73 73 20 6f 66 66 20 74 | 68 65 20 65 6e 64 20 6f |ss off t|he end o|
|00002820| 66 20 73 31 20 69 6e 20 | 74 68 65 20 69 6e 74 65 |f s1 in |the inte|
|00002830| 72 65 73 74 20 6f 66 20 | 65 66 66 69 63 69 65 6e |rest of |efficien|
|00002840| 63 79 20 2a 2f 0a 20 20 | 2f 2a 20 69 66 20 27 66 |cy */. |/* if 'f|
|00002850| 61 73 74 27 20 69 73 20 | 6e 6f 6e 2d 7a 65 72 6f |ast' is |non-zero|
|00002860| 2e 20 2a 2f 0a 0a 65 78 | 74 65 72 6e 20 63 68 61 |. */..ex|tern cha|
|00002870| 72 20 2a 20 73 74 72 6e | 63 66 69 6e 64 28 29 3b |r * strn|cfind();|
|00002880| 0a 0a 20 20 2f 2a 20 63 | 68 61 72 20 2a 73 31 3b |.. /* c|har *s1;|
|00002890| 20 63 68 61 72 20 2a 73 | 32 3b 20 69 6e 74 20 66 | char *s|2; int f|
|000028a0| 61 73 74 3b 20 2a 2f 0a | 20 20 2f 2a 20 66 69 6e |ast; */.| /* fin|
|000028b0| 64 73 20 73 32 20 61 73 | 20 61 20 73 75 62 73 74 |ds s2 as| a subst|
|000028c0| 72 69 6e 67 20 6f 66 20 | 73 31 20 63 61 73 65 20 |ring of |s1 case |
|000028d0| 69 6e 64 65 70 65 6e 64 | 65 6e 74 6c 79 2e 20 20 |independ|ently. |
|000028e0| 73 31 20 61 6e 64 20 73 | 32 20 61 72 65 20 2a 2f |s1 and s|2 are */|
|000028f0| 0a 20 20 2f 2a 20 6e 75 | 6c 6c 20 74 65 72 6d 69 |. /* nu|ll termi|
|00002900| 6e 61 74 65 64 2e 20 2a | 2f 0a 20 20 2f 2a 20 72 |nated. *|/. /* r|
|00002910| 65 74 75 72 6e 73 20 30 | 20 69 66 20 6e 6f 74 20 |eturns 0| if not |
|00002920| 66 6f 75 6e 64 2c 20 6f | 74 68 65 72 77 69 73 65 |found, o|therwise|
|00002930| 20 70 6f 69 6e 74 65 72 | 20 69 6e 74 6f 20 73 31 | pointer| into s1|
|00002940| 20 74 6f 20 66 69 72 73 | 74 20 6d 61 74 63 68 69 | to firs|t matchi|
|00002950| 6e 67 20 2a 2f 0a 20 20 | 2f 2a 20 63 68 61 72 61 |ng */. |/* chara|
|00002960| 63 74 65 72 2e 20 2a 2f | 0a 0a 20 20 2f 2a 20 57 |cter. */|.. /* W|
|00002970| 41 52 4e 49 4e 47 3a 20 | 20 77 69 6c 6c 20 61 63 |ARNING: | will ac|
|00002980| 63 65 73 73 20 6f 66 66 | 20 74 68 65 20 65 6e 64 |cess off| the end|
|00002990| 20 6f 66 20 73 31 20 69 | 6e 20 74 68 65 20 69 6e | of s1 i|n the in|
|000029a0| 74 65 72 65 73 74 20 6f | 66 20 65 66 66 69 63 69 |terest o|f effici|
|000029b0| 65 6e 63 79 20 2a 2f 0a | 20 20 2f 2a 20 69 66 20 |ency */.| /* if |
|000029c0| 27 66 61 73 74 27 20 69 | 73 20 6e 6f 6e 2d 7a 65 |'fast' i|s non-ze|
|000029d0| 72 6f 2e 20 2a 2f 0a 0a | 65 78 74 65 72 6e 20 63 |ro. */..|extern c|
|000029e0| 68 61 72 20 2a 20 73 74 | 72 73 65 61 72 63 68 28 |har * st|rsearch(|
|000029f0| 29 3b 0a 0a 20 20 2f 2a | 20 63 68 61 72 20 2a 73 |);.. /*| char *s|
|00002a00| 31 3b 20 69 6e 74 20 6c | 31 3b 20 63 68 61 72 20 |1; int l|1; char |
|00002a10| 2a 73 32 3b 20 69 6e 74 | 20 6c 32 20 2a 2f 0a 20 |*s2; int| l2 */. |
|00002a20| 20 2f 2a 20 66 69 6e 64 | 73 20 73 32 20 61 73 20 | /* find|s s2 as |
|00002a30| 61 20 73 75 62 73 74 72 | 69 6e 67 20 6f 66 20 73 |a substr|ing of s|
|00002a40| 31 2e 20 20 44 6f 65 73 | 20 6e 6f 74 20 73 74 6f |1. Does| not sto|
|00002a50| 70 20 69 66 20 69 74 20 | 65 6e 63 6f 75 6e 74 65 |p if it |encounte|
|00002a60| 72 73 20 61 20 6e 75 6c | 6c 2e 20 2a 2f 0a 20 20 |rs a nul|l. */. |
|00002a70| 2f 2a 20 72 65 74 75 72 | 6e 73 20 70 6f 69 6e 74 |/* retur|ns point|
|00002a80| 65 72 20 69 6e 74 6f 20 | 73 31 2c 20 6f 74 68 65 |er into |s1, othe|
|00002a90| 72 77 69 73 65 20 28 63 | 68 61 72 20 2a 29 20 30 |rwise (c|har *) 0|
|00002aa0| 20 69 66 20 73 65 61 72 | 63 68 20 66 61 69 6c 73 | if sear|ch fails|
|00002ab0| 20 2a 2f 0a 20 20 2f 2a | 20 63 61 73 65 20 64 65 | */. /*| case de|
|00002ac0| 70 65 6e 64 65 6e 74 20 | 2a 2f 0a 0a 65 78 74 65 |pendent |*/..exte|
|00002ad0| 72 6e 20 63 68 61 72 20 | 2a 20 73 74 72 6e 63 73 |rn char |* strncs|
|00002ae0| 65 61 72 63 68 28 29 3b | 0a 0a 20 20 2f 2a 20 63 |earch();|.. /* c|
|00002af0| 68 61 72 20 2a 73 31 3b | 20 69 6e 74 20 6c 31 3b |har *s1;| int l1;|
|00002b00| 20 63 68 61 72 20 2a 73 | 32 3b 20 69 6e 74 20 6c | char *s|2; int l|
|00002b10| 32 20 2a 2f 0a 20 20 2f | 2a 20 66 69 6e 64 73 20 |2 */. /|* finds |
|00002b20| 73 32 20 61 73 20 61 20 | 73 75 62 73 74 72 69 6e |s2 as a |substrin|
|00002b30| 67 20 6f 66 20 73 31 2e | 20 2a 2f 0a 20 20 2f 2a |g of s1.| */. /*|
|00002b40| 20 72 65 74 75 72 6e 73 | 20 70 6f 69 6e 74 65 72 | returns| pointer|
|00002b50| 20 69 6e 74 6f 20 73 31 | 2c 20 6f 74 68 65 72 77 | into s1|, otherw|
|00002b60| 69 73 65 20 28 63 68 61 | 72 20 2a 29 20 30 20 69 |ise (cha|r *) 0 i|
|00002b70| 66 20 73 65 61 72 63 68 | 20 66 61 69 6c 73 20 2a |f search| fails *|
|00002b80| 2f 0a 20 20 2f 2a 20 63 | 61 73 65 20 69 6e 64 65 |/. /* c|ase inde|
|00002b90| 70 65 6e 64 65 6e 74 20 | 2a 2f 0a 0a 65 78 74 65 |pendent |*/..exte|
|00002ba0| 72 6e 20 69 6e 74 20 72 | 65 6d 6f 76 65 5f 65 78 |rn int r|emove_ex|
|00002bb0| 63 65 73 73 5f 62 6c 61 | 6e 6b 73 28 29 3b 0a 0a |cess_bla|nks();..|
|00002bc0| 20 20 2f 2a 20 63 68 61 | 72 20 2a 6e 65 77 73 74 | /* cha|r *newst|
|00002bd0| 72 69 6e 67 2c 20 2a 6f | 6c 64 73 74 72 69 6e 67 |ring, *o|ldstring|
|00002be0| 3b 20 2a 2f 0a 20 20 2f | 2a 20 6e 65 77 73 74 72 |; */. /|* newstr|
|00002bf0| 69 6e 67 20 6d 75 73 74 | 20 62 65 20 6c 6f 6e 67 |ing must| be long|
|00002c00| 20 65 6e 6f 75 67 68 20 | 74 6f 20 68 6f 6c 64 20 | enough |to hold |
|00002c10| 74 68 65 20 72 65 73 75 | 6c 74 2c 20 77 68 69 63 |the resu|lt, whic|
|00002c20| 68 20 6d 61 79 20 62 65 | 20 61 73 20 2a 2f 0a 20 |h may be| as */. |
|00002c30| 20 2f 2a 20 6c 6f 6e 67 | 20 61 73 20 6f 6c 64 73 | /* long| as olds|
|00002c40| 74 72 69 6e 67 2e 20 20 | 6f 6c 64 73 74 72 69 6e |tring. |oldstrin|
|00002c50| 67 20 6d 75 73 74 20 62 | 65 20 6e 75 6c 6c 20 74 |g must b|e null t|
|00002c60| 65 72 6d 69 6e 61 74 65 | 64 2e 20 2a 2f 0a 20 20 |erminate|d. */. |
|00002c70| 2f 2a 20 61 6e 20 65 78 | 63 65 73 73 20 62 6c 61 |/* an ex|cess bla|
|00002c80| 6e 6b 20 69 73 20 61 6e | 79 20 62 6c 61 6e 6b 20 |nk is an|y blank |
|00002c90| 62 65 66 6f 72 65 20 74 | 68 65 20 66 69 72 73 74 |before t|he first|
|00002ca0| 20 6e 6f 6e 2d 62 6c 61 | 6e 6b 20 63 68 61 72 61 | non-bla|nk chara|
|00002cb0| 63 74 65 72 2c 20 2a 2f | 0a 20 20 2f 2a 20 61 6e |cter, */|. /* an|
|00002cc0| 79 20 62 6c 61 6e 6b 20 | 61 66 74 65 72 20 74 68 |y blank |after th|
|00002cd0| 65 20 6c 61 73 74 20 6e | 6f 6e 2d 62 6c 61 6e 6b |e last n|on-blank|
|00002ce0| 20 63 68 61 72 61 63 74 | 65 72 2c 20 61 6e 64 20 | charact|er, and |
|00002cf0| 61 6e 79 20 62 6c 61 6e | 6b 20 69 6d 6d 65 64 69 |any blan|k immedi|
|00002d00| 61 74 65 6c 79 20 2a 2f | 0a 20 20 2f 2a 20 66 6f |ately */|. /* fo|
|00002d10| 6c 6c 6f 77 69 6e 67 20 | 61 20 62 6c 61 6e 6b 2e |llowing |a blank.|
|00002d20| 20 2a 2f 0a 20 20 2f 2a | 20 72 65 74 75 72 6e 73 | */. /*| returns|
|00002d30| 20 6c 65 6e 67 74 68 20 | 6f 66 20 6e 65 77 73 74 | length |of newst|
|00002d40| 72 69 6e 67 20 2a 2f 0a | 0a 65 78 74 65 72 6e 20 |ring */.|.extern |
|00002d50| 69 6e 74 20 79 65 73 5f | 6f 72 5f 6e 6f 5f 63 68 |int yes_|or_no_ch|
|00002d60| 65 63 6b 28 29 3b 0a 0a | 20 20 2f 2a 20 63 68 61 |eck();..| /* cha|
|00002d70| 72 20 2a 61 73 74 72 69 | 6e 67 3b 20 2a 2f 0a 20 |r *astri|ng; */. |
|00002d80| 20 2f 2a 20 72 65 74 75 | 72 6e 73 20 31 20 66 6f | /* retu|rns 1 fo|
|00002d90| 72 20 79 65 73 2c 20 30 | 20 66 6f 72 20 6e 6f 2c |r yes, 0| for no,|
|00002da0| 20 2d 31 20 66 6f 72 20 | 6e 65 69 74 68 65 72 2e | -1 for |neither.|
|00002db0| 20 2a 2f 0a 20 20 2f 2a | 20 61 73 74 72 69 6e 67 | */. /*| astring|
|00002dc0| 20 6d 75 73 74 20 62 65 | 20 6f 6e 65 20 6f 66 20 | must be| one of |
|00002dd0| 22 59 45 53 22 2c 20 22 | 59 22 2c 20 22 4e 4f 22 |"YES", "|Y", "NO"|
|00002de0| 2c 20 22 4e 22 20 69 6e | 20 61 6e 79 20 63 61 70 |, "N" in| any cap|
|00002df0| 69 74 61 6c 69 7a 61 74 | 69 6f 6e 2e 20 2a 2f 0a |italizat|ion. */.|
|00002e00| 0a 0a 2f 2a 20 54 68 65 | 73 65 20 72 6f 75 74 69 |../* The|se routi|
|00002e10| 6e 65 73 20 72 65 74 75 | 72 6e 20 54 20 69 66 20 |nes retu|rn T if |
|00002e20| 65 76 65 72 79 20 63 68 | 61 72 20 73 61 74 69 73 |every ch|ar satis|
|00002e30| 66 69 65 73 20 61 20 63 | 65 72 74 61 69 6e 20 63 |fies a c|ertain c|
|00002e40| 6f 6e 64 69 74 69 6f 6e | 2e 20 2a 2f 0a 2f 2a 20 |ondition|. */./* |
|00002e50| 54 68 65 73 65 20 72 65 | 74 75 72 6e 73 20 61 6c |These re|turns al|
|00002e60| 6c 20 72 65 74 75 72 6e | 73 20 54 20 69 66 20 67 |l return|s T if g|
|00002e70| 69 76 65 6e 20 61 20 6e | 75 6c 6c 20 73 74 72 69 |iven a n|ull stri|
|00002e80| 6e 67 2e 20 2a 2f 0a 0a | 65 78 74 65 72 6e 20 42 |ng. */..|extern B|
|00002e90| 6f 6f 6c 20 61 6c 6c 5f | 64 69 67 69 74 73 28 29 |ool all_|digits()|
|00002ea0| 3b 0a 65 78 74 65 72 6e | 20 42 6f 6f 6c 20 61 6c |;.extern| Bool al|
|00002eb0| 6c 5f 77 68 69 74 65 73 | 70 61 63 65 28 29 3b 0a |l_whites|pace();.|
|00002ec0| 65 78 74 65 72 6e 20 42 | 6f 6f 6c 20 61 6c 6c 5f |extern B|ool all_|
|00002ed0| 75 70 70 65 72 63 61 73 | 65 28 29 3b 0a 65 78 74 |uppercas|e();.ext|
|00002ee0| 65 72 6e 20 42 6f 6f 6c | 20 61 6c 6c 5f 6c 6f 77 |ern Bool| all_low|
|00002ef0| 65 72 63 61 73 65 28 29 | 3b 0a 65 78 74 65 72 6e |ercase()|;.extern|
|00002f00| 20 42 6f 6f 6c 20 61 6c | 6c 5f 61 6c 70 68 61 62 | Bool al|l_alphab|
|00002f10| 65 74 69 63 28 29 3b 0a | 65 78 74 65 72 6e 20 42 |etic();.|extern B|
|00002f20| 6f 6f 6c 20 61 6c 6c 5f | 61 6c 70 68 61 6e 75 6d |ool all_|alphanum|
|00002f30| 65 72 69 63 28 29 3b 0a | 65 78 74 65 72 6e 20 42 |eric();.|extern B|
|00002f40| 6f 6f 6c 20 61 6c 6c 5f | 61 73 63 69 69 28 29 3b |ool all_|ascii();|
|00002f50| 0a 0a 0a 65 78 74 65 72 | 6e 20 69 6e 74 20 73 74 |...exter|n int st|
|00002f60| 72 5f 74 6f 5f 70 6f 73 | 5f 69 6e 74 28 29 3b 0a |r_to_pos|_int();.|
|00002f70| 0a 20 20 2f 2a 20 63 68 | 61 72 20 2a 61 73 74 72 |. /* ch|ar *astr|
|00002f80| 69 6e 67 3b 20 69 6e 74 | 20 6c 6f 77 2c 68 69 67 |ing; int| low,hig|
|00002f90| 68 3b 20 2a 2f 0a 20 20 | 2f 2a 20 6c 6f 77 20 6d |h; */. |/* low m|
|00002fa0| 75 73 74 20 62 65 20 3e | 3d 20 30 2e 20 2a 2f 0a |ust be >|= 0. */.|
|00002fb0| 20 20 2f 2a 20 72 65 74 | 75 72 6e 73 20 2d 31 20 | /* ret|urns -1 |
|00002fc0| 69 66 20 2a 61 73 74 72 | 69 6e 67 20 69 73 20 6e |if *astr|ing is n|
|00002fd0| 6f 74 20 63 6f 6d 70 6f | 73 65 64 20 6f 66 20 64 |ot compo|sed of d|
|00002fe0| 69 67 69 74 73 2e 20 2a | 2f 0a 20 20 2f 2a 20 72 |igits. *|/. /* r|
|00002ff0| 65 74 75 72 6e 73 20 2d | 32 20 69 66 20 74 68 65 |eturns -|2 if the|
|00003000| 20 69 6e 74 65 67 65 72 | 20 69 73 20 6f 75 74 20 | integer| is out |
|00003010| 6f 66 20 72 61 6e 67 65 | 2e 20 2a 2f 0a 20 20 2f |of range|. */. /|
|00003020| 2a 20 64 65 73 70 69 74 | 65 20 69 74 73 20 6e 61 |* despit|e its na|
|00003030| 6d 65 2c 20 30 20 63 61 | 6e 20 62 65 20 72 65 74 |me, 0 ca|n be ret|
|00003040| 75 72 6e 65 64 20 61 73 | 20 61 20 6c 65 67 69 74 |urned as| a legit|
|00003050| 69 6d 61 74 65 20 76 61 | 6c 75 65 2e 20 2a 2f 0a |imate va|lue. */.|
|00003060| 20 20 2f 2a 20 74 72 65 | 61 74 73 20 61 6c 6c 20 | /* tre|ats all |
|00003070| 64 69 67 69 74 20 73 74 | 72 69 6e 67 73 20 61 73 |digit st|rings as|
|00003080| 20 64 65 63 69 6d 61 6c | 2e 20 2a 2f 0a 0a 0a 65 | decimal|. */...e|
|00003090| 78 74 65 72 6e 20 69 6e | 74 20 73 72 65 76 65 72 |xtern in|t srever|
|000030a0| 73 65 28 29 3b 0a 0a 20 | 20 2f 2a 20 63 68 61 72 |se();.. | /* char|
|000030b0| 20 2a 62 75 66 66 65 72 | 3b 20 63 68 61 72 20 2a | *buffer|; char *|
|000030c0| 61 73 74 72 69 6e 67 3b | 20 2a 2f 0a 20 20 2f 2a |astring;| */. /*|
|000030d0| 20 70 75 74 73 20 74 68 | 65 20 63 68 61 72 61 63 | puts th|e charac|
|000030e0| 74 65 72 73 20 6f 66 20 | 61 73 74 72 69 6e 67 20 |ters of |astring |
|000030f0| 69 6e 20 72 65 76 65 72 | 73 65 20 6f 72 64 65 72 |in rever|se order|
|00003100| 20 69 6e 74 6f 20 62 75 | 66 66 65 72 2e 20 2a 2f | into bu|ffer. */|
|00003110| 0a 20 20 2f 2a 20 62 75 | 66 66 65 72 20 6d 75 73 |. /* bu|ffer mus|
|00003120| 74 20 62 65 20 61 74 20 | 6c 65 61 73 74 20 61 73 |t be at |least as|
|00003130| 20 6c 6f 6e 67 20 61 73 | 20 61 73 74 72 69 6e 67 | long as| astring|
|00003140| 20 2b 20 31 2e 20 2a 2f | 0a 20 20 2f 2a 20 62 75 | + 1. */|. /* bu|
|00003150| 66 66 65 72 20 69 73 20 | 6e 75 6c 6c 20 74 65 72 |ffer is |null ter|
|00003160| 6d 69 6e 61 74 65 64 20 | 77 68 65 6e 20 64 6f 6e |minated |when don|
|00003170| 65 2e 20 2a 2f 0a 20 20 | 2f 2a 20 4e 6f 20 72 65 |e. */. |/* No re|
|00003180| 74 75 72 6e 20 76 61 6c | 75 65 2e 20 20 55 73 65 |turn val|ue. Use|
|00003190| 20 6f 6e 6c 79 20 61 73 | 20 70 72 6f 63 65 64 75 | only as| procedu|
|000031a0| 72 65 2e 20 2a 2f 0a 0a | 65 78 74 65 72 6e 20 63 |re. */..|extern c|
|000031b0| 68 61 72 20 2a 69 70 5f | 73 72 65 76 65 72 73 65 |har *ip_|sreverse|
|000031c0| 28 29 3b 0a 0a 20 20 2f | 2a 20 63 68 61 72 20 2a |();.. /|* char *|
|000031d0| 61 73 74 72 69 6e 67 3b | 20 2a 2f 0a 20 20 2f 2a |astring;| */. /*|
|000031e0| 20 52 65 74 75 72 6e 73 | 20 61 73 74 72 69 6e 67 | Returns| astring|
|000031f0| 20 77 69 74 68 20 69 74 | 73 20 63 68 61 72 61 63 | with it|s charac|
|00003200| 74 65 72 73 20 72 65 76 | 65 72 73 65 64 2e 20 2a |ters rev|ersed. *|
|00003210| 2f 0a 20 20 2f 2a 20 72 | 65 76 65 72 73 61 6c 20 |/. /* r|eversal |
|00003220| 69 73 20 64 6f 6e 65 20 | 69 6e 20 70 6c 61 63 65 |is done |in place|
|00003230| 2e 20 2a 2f 0a 0a 0a 0a | 23 64 65 66 69 6e 65 20 |. */....|#define |
|00003240| 50 41 54 48 5f 4d 41 58 | 50 41 54 48 4c 45 4e 20 |PATH_MAX|PATHLEN |
|00003250| 32 35 36 0a 0a 63 68 61 | 72 20 2a 74 65 6d 70 5f |256..cha|r *temp_|
|00003260| 70 61 74 68 28 29 3b 0a | 0a 2f 2a 0a 20 20 63 68 |path();.|./*. ch|
|00003270| 61 72 20 2a 64 69 72 3b | 20 63 68 61 72 20 2a 66 |ar *dir;| char *f|
|00003280| 69 6c 65 6e 61 6d 65 3b | 0a 0a 20 20 52 65 74 75 |ilename;|.. Retu|
|00003290| 72 6e 73 20 61 20 70 6f | 69 6e 74 65 72 20 74 6f |rns a po|inter to|
|000032a0| 20 61 20 63 68 61 72 61 | 63 74 65 72 20 73 74 72 | a chara|cter str|
|000032b0| 69 6e 67 20 63 6f 6e 74 | 61 69 6e 69 6e 67 20 74 |ing cont|aining t|
|000032c0| 68 65 20 73 74 72 69 6e | 67 0a 20 20 3c 64 69 72 |he strin|g. <dir|
|000032d0| 3e 2f 3c 66 69 6c 65 6e | 61 6d 65 3e 2e 20 20 54 |>/<filen|ame>. T|
|000032e0| 68 65 20 70 6f 69 6e 74 | 65 72 20 70 6f 69 6e 74 |he point|er point|
|000032f0| 73 20 74 6f 20 61 20 62 | 75 66 66 65 72 20 77 68 |s to a b|uffer wh|
|00003300| 69 63 68 20 77 69 6c 6c | 20 6d 61 79 20 67 65 74 |ich will| may get|
|00003310| 0a 20 20 6f 76 65 72 77 | 72 69 74 74 65 6e 20 69 |. overw|ritten i|
|00003320| 66 20 61 6e 79 20 66 75 | 6e 63 74 69 6f 6e 73 20 |f any fu|nctions |
|00003330| 69 6e 20 74 68 69 73 20 | 70 61 63 6b 61 67 65 20 |in this |package |
|00003340| 61 72 65 20 73 75 62 73 | 65 71 75 65 6e 74 6c 79 |are subs|equently|
|00003350| 20 63 61 6c 6c 65 64 2e | 0a 20 20 30 20 69 73 20 | called.|. 0 is |
|00003360| 72 65 74 75 72 6e 65 64 | 20 69 66 20 74 68 65 20 |returned| if the |
|00003370| 70 61 74 68 6e 61 6d 65 | 20 77 6f 75 6c 64 20 65 |pathname| would e|
|00003380| 78 63 65 65 64 20 50 41 | 54 48 5f 4d 41 58 50 41 |xceed PA|TH_MAXPA|
|00003390| 54 48 4c 45 4e 2d 31 20 | 63 68 61 72 73 2e 0a 2a |THLEN-1 |chars..*|
|000033a0| 2f 0a 0a 0a 63 68 61 72 | 20 2a 70 65 72 6d 5f 70 |/...char| *perm_p|
|000033b0| 61 74 68 28 29 3b 0a 0a | 2f 2a 0a 20 20 63 68 61 |ath();..|/*. cha|
|000033c0| 72 20 2a 64 69 72 3b 20 | 63 68 61 72 20 2a 66 69 |r *dir; |char *fi|
|000033d0| 6c 65 6e 61 6d 65 3b 0a | 0a 20 20 53 61 6d 65 20 |lename;.|. Same |
|000033e0| 61 73 20 74 65 6d 70 5f | 70 61 74 68 2c 20 65 78 |as temp_|path, ex|
|000033f0| 63 65 70 74 20 74 68 65 | 20 70 61 74 68 6e 61 6d |cept the| pathnam|
|00003400| 65 20 73 74 72 69 6e 67 | 20 69 73 20 6d 61 6c 6c |e string| is mall|
|00003410| 6f 63 27 65 64 20 61 6e | 64 20 69 73 20 74 68 75 |oc'ed an|d is thu|
|00003420| 73 0a 20 20 70 65 72 6d | 61 6e 65 6e 74 20 75 6e |s. perm|anent un|
|00003430| 6c 65 73 73 20 73 70 65 | 63 69 66 69 63 61 6c 6c |less spe|cificall|
|00003440| 79 20 66 72 65 65 64 20 | 62 79 20 74 68 65 20 75 |y freed |by the u|
|00003450| 73 65 72 2e 20 20 46 75 | 72 74 68 65 72 2c 20 6e |ser. Fu|rther, n|
|00003460| 6f 20 6c 69 6d 69 74 0a | 20 20 6f 6e 20 74 68 65 |o limit.| on the|
|00003470| 20 73 69 7a 65 20 6f 66 | 20 74 68 65 20 70 61 74 | size of| the pat|
|00003480| 68 20 69 73 20 6d 61 64 | 65 2e 0a 2a 2f 0a 0a 0a |h is mad|e..*/...|
|00003490| 63 68 61 72 20 2a 6d 61 | 6b 65 5f 70 61 74 68 28 |char *ma|ke_path(|
|000034a0| 29 3b 0a 0a 2f 2a 0a 20 | 20 63 68 61 72 20 2a 64 |);../*. | char *d|
|000034b0| 69 72 3b 20 63 68 61 72 | 20 2a 66 69 6c 65 6e 61 |ir; char| *filena|
|000034c0| 6d 65 3b 20 63 68 61 72 | 20 2a 65 78 74 65 6e 73 |me; char| *extens|
|000034d0| 69 6f 6e 3b 20 42 6f 6f | 6c 20 70 65 72 6d 3b 0a |ion; Boo|l perm;.|
|000034e0| 0a 20 20 43 72 65 61 74 | 65 73 20 3c 64 69 72 3e |. Creat|es <dir>|
|000034f0| 2f 3c 66 69 6c 65 6e 61 | 6d 65 3e 3c 65 78 74 65 |/<filena|me><exte|
|00003500| 6e 73 69 6f 6e 3e 20 2e | 20 20 54 68 65 20 73 74 |nsion> .| The st|
|00003510| 72 69 6e 67 20 72 65 74 | 75 72 6e 65 64 20 69 73 |ring ret|urned is|
|00003520| 20 70 65 72 6d 61 6e 65 | 6e 74 0a 20 20 6f 72 20 | permane|nt. or |
|00003530| 6e 6f 74 20 64 65 70 65 | 6e 64 69 6e 67 20 6f 6e |not depe|nding on|
|00003540| 20 27 70 65 72 6d 27 2e | 20 20 49 66 20 70 65 72 | 'perm'.| If per|
|00003550| 6d 20 69 73 20 6e 6f 74 | 20 74 72 75 65 2c 20 30 |m is not| true, 0|
|00003560| 20 77 69 6c 6c 20 62 65 | 20 72 65 74 75 72 6e 65 | will be| returne|
|00003570| 64 20 69 66 0a 20 20 74 | 68 65 20 72 65 73 75 6c |d if. t|he resul|
|00003580| 74 69 6e 67 20 70 61 74 | 68 20 65 78 63 65 65 64 |ting pat|h exceed|
|00003590| 73 20 50 41 54 48 5f 4d | 41 58 50 41 54 48 4c 45 |s PATH_M|AXPATHLE|
|000035a0| 4e 2d 31 20 63 68 61 72 | 73 2e 0a 2a 2f 0a 0a 0a |N-1 char|s..*/...|
|000035b0| 63 68 61 72 20 2a 6d 61 | 6b 65 5f 70 61 74 68 5f |char *ma|ke_path_|
|000035c0| 6e 75 6d 65 72 69 63 5f | 65 78 74 65 6e 73 69 6f |numeric_|extensio|
|000035d0| 6e 28 29 3b 0a 0a 2f 2a | 0a 20 20 63 68 61 72 20 |n();../*|. char |
|000035e0| 2a 64 69 72 3b 20 63 68 | 61 72 20 2a 66 69 6c 65 |*dir; ch|ar *file|
|000035f0| 6e 61 6d 65 3b 20 69 6e | 74 20 65 78 74 65 6e 73 |name; in|t extens|
|00003600| 69 6f 6e 3b 20 42 6f 6f | 6c 20 70 65 72 6d 3b 0a |ion; Boo|l perm;.|
|00003610| 0a 20 20 53 61 6d 65 20 | 61 73 20 6d 61 6b 65 5f |. Same |as make_|
|00003620| 70 61 74 68 20 65 78 63 | 65 70 74 20 74 68 61 74 |path exc|ept that|
|00003630| 20 65 78 74 65 6e 73 69 | 6f 6e 20 69 73 20 66 69 | extensi|on is fi|
|00003640| 72 73 74 20 63 6f 6e 76 | 65 72 74 65 64 20 69 6e |rst conv|erted in|
|00003650| 74 6f 20 61 0a 20 20 73 | 74 72 69 6e 67 20 75 73 |to a. s|tring us|
|00003660| 69 6e 67 20 73 70 72 69 | 6e 74 66 2e 0a 2a 2f 0a |ing spri|ntf..*/.|
|00003670| 0a 0a 63 68 61 72 20 2a | 6a 75 73 74 5f 66 69 6c |..char *|just_fil|
|00003680| 65 6e 61 6d 65 28 29 3b | 0a 0a 2f 2a 20 20 0a 20 |ename();|../* . |
|00003690| 20 63 68 61 72 20 2a 70 | 61 74 68 3b 20 42 6f 6f | char *p|ath; Boo|
|000036a0| 6c 20 6e 65 77 3b 20 42 | 6f 6f 6c 20 70 65 72 6d |l new; B|ool perm|
|000036b0| 3b 0a 0a 20 20 47 69 76 | 65 6e 20 61 20 70 61 74 |;.. Giv|en a pat|
|000036c0| 68 20 6f 66 20 74 68 65 | 20 66 6f 72 6d 20 2f 3c |h of the| form /<|
|000036d0| 78 3e 2f 3c 79 3e 2f 3c | 7a 3e 20 72 65 74 75 72 |x>/<y>/<|z> retur|
|000036e0| 6e 73 20 3c 7a 3e 2e 20 | 20 49 66 20 6e 65 77 20 |ns <z>. | If new |
|000036f0| 69 73 20 6e 6f 74 20 73 | 65 74 0a 20 20 74 68 65 |is not s|et. the|
|00003700| 6e 20 61 20 70 6f 69 6e | 74 65 72 20 69 6e 74 6f |n a poin|ter into|
|00003710| 20 74 68 65 20 6f 72 69 | 67 69 6e 61 6c 20 69 6e | the ori|ginal in|
|00003720| 70 75 74 20 73 74 72 69 | 6e 67 20 69 73 20 72 65 |put stri|ng is re|
|00003730| 74 75 72 6e 65 64 2e 20 | 20 49 66 20 6e 65 77 20 |turned. | If new |
|00003740| 69 73 0a 20 20 73 65 74 | 20 61 20 63 6f 70 79 20 |is. set| a copy |
|00003750| 69 73 20 72 65 74 75 72 | 6e 65 64 2c 20 65 69 74 |is retur|ned, eit|
|00003760| 68 65 72 20 70 65 72 6d | 61 6e 65 6e 74 20 6f 72 |her perm|anent or|
|00003770| 20 6e 6f 74 20 64 65 70 | 65 6e 64 69 6e 67 20 6f | not dep|ending o|
|00003780| 6e 20 70 65 72 6d 2e 0a | 2a 2f 0a 0a 0a 23 64 65 |n perm..|*/...#de|
|00003790| 66 69 6e 65 20 41 4e 53 | 57 45 52 5f 4e 4f 20 30 |fine ANS|WER_NO 0|
|000037a0| 0a 23 64 65 66 69 6e 65 | 20 41 4e 53 57 45 52 5f |.#define| ANSWER_|
|000037b0| 59 45 53 20 31 0a 23 64 | 65 66 69 6e 65 20 41 4e |YES 1.#d|efine AN|
|000037c0| 53 57 45 52 5f 48 45 4c | 50 20 32 0a 23 64 65 66 |SWER_HEL|P 2.#def|
|000037d0| 69 6e 65 20 41 4e 53 57 | 45 52 5f 51 55 49 54 20 |ine ANSW|ER_QUIT |
|000037e0| 33 0a 23 64 65 66 69 6e | 65 20 41 4e 53 57 45 52 |3.#defin|e ANSWER|
|000037f0| 5f 45 4f 46 20 34 0a 0a | 23 64 65 66 69 6e 65 20 |_EOF 4..|#define |
|00003800| 41 54 5f 45 4f 46 20 2d | 31 0a 23 64 65 66 69 6e |AT_EOF -|1.#defin|
|00003810| 65 20 54 4f 4f 5f 4d 41 | 4e 59 5f 43 48 41 52 53 |e TOO_MA|NY_CHARS|
|00003820| 20 2d 32 0a 23 64 65 66 | 69 6e 65 20 49 4f 45 52 | -2.#def|ine IOER|
|00003830| 52 4f 52 20 2d 33 0a 23 | 64 65 66 69 6e 65 20 54 |ROR -3.#|define T|
|00003840| 4f 4f 5f 4d 41 4e 59 5f | 4c 49 4e 45 53 20 2d 34 |OO_MANY_|LINES -4|
|00003850| 0a 23 64 65 66 69 6e 65 | 20 4c 49 4e 45 5f 54 4f |.#define| LINE_TO|
|00003860| 4f 5f 4c 4f 4e 47 20 2d | 35 0a 0a 65 78 74 65 72 |O_LONG -|5..exter|
|00003870| 6e 20 72 65 61 64 5f 79 | 65 73 5f 6f 72 5f 6e 6f |n read_y|es_or_no|
|00003880| 20 28 29 3b 0a 0a 20 20 | 2f 2a 20 46 49 4c 45 20 | ();.. |/* FILE |
|00003890| 2a 69 70 6f 72 74 2c 20 | 2a 6f 70 6f 72 74 3b 20 |*iport, |*oport; |
|000038a0| 63 68 61 72 20 2a 70 72 | 6f 6d 70 74 3b 20 63 68 |char *pr|ompt; ch|
|000038b0| 61 72 20 2a 68 65 6c 70 | 73 74 72 69 6e 67 3b 20 |ar *help|string; |
|000038c0| 63 68 61 72 20 2a 71 75 | 69 74 73 74 72 69 6e 67 |char *qu|itstring|
|000038d0| 3b 20 2a 2f 0a 0a 20 20 | 2f 2a 20 70 72 69 6e 74 |; */.. |/* print|
|000038e0| 73 20 70 72 6f 6d 70 74 | 2c 20 74 68 65 6e 20 72 |s prompt|, then r|
|000038f0| 65 61 64 73 20 66 72 6f | 6d 20 69 70 6f 72 74 20 |eads fro|m iport |
|00003900| 75 6e 74 69 6c 20 69 73 | 20 67 65 74 73 20 27 59 |until is| gets 'Y|
|00003910| 27 2c 20 27 4e 27 2c 20 | 27 59 45 53 27 20 6f 72 |', 'N', |'YES' or|
|00003920| 20 2a 2f 0a 20 20 2f 2a | 20 27 4e 4f 27 20 28 63 | */. /*| 'NO' (c|
|00003930| 61 73 65 20 69 6e 64 65 | 70 65 6e 64 65 6e 74 6c |ase inde|pendentl|
|00003940| 79 29 2e 20 20 49 66 20 | 68 65 6c 70 73 74 72 69 |y). If |helpstri|
|00003950| 6e 67 20 61 6e 64 2f 6f | 72 20 71 75 69 74 73 74 |ng and/o|r quitst|
|00003960| 72 69 6e 67 20 61 72 65 | 20 6e 6f 74 20 2a 2f 0a |ring are| not */.|
|00003970| 20 20 2f 2a 20 22 22 20 | 6f 72 20 28 63 68 61 72 | /* "" |or (char|
|00003980| 20 2a 29 20 30 20 74 68 | 65 6e 20 69 66 20 74 68 | *) 0 th|en if th|
|00003990| 65 20 75 73 65 72 20 74 | 79 70 65 73 20 69 6e 20 |e user t|ypes in |
|000039a0| 6f 6e 65 20 6f 66 20 74 | 68 6f 73 65 20 41 4e 53 |one of t|hose ANS|
|000039b0| 57 45 52 5f 48 45 4c 50 | 20 2a 2f 0a 20 20 2f 2a |WER_HELP| */. /*|
|000039c0| 20 6f 72 20 41 4e 53 57 | 45 52 5f 51 55 49 54 20 | or ANSW|ER_QUIT |
|000039d0| 61 72 65 20 72 65 74 75 | 72 6e 65 64 2c 20 6f 74 |are retu|rned, ot|
|000039e0| 68 65 72 77 69 73 65 20 | 41 4e 53 57 45 52 5f 4e |herwise |ANSWER_N|
|000039f0| 4f 20 6f 72 20 41 4e 53 | 57 45 52 5f 59 45 53 20 |O or ANS|WER_YES |
|00003a00| 61 72 65 20 2a 2f 0a 20 | 20 2f 2a 20 65 76 65 6e |are */. | /* even|
|00003a10| 74 75 61 6c 6c 79 20 72 | 65 74 75 72 6e 65 64 2e |tually r|eturned.|
|00003a20| 20 2a 2f 0a 0a 0a 65 78 | 74 65 72 6e 20 69 6e 74 | */...ex|tern int|
|00003a30| 20 67 65 74 6c 69 6e 65 | 20 28 29 3b 0a 0a 20 20 | getline| ();.. |
|00003a40| 2f 2a 20 46 49 4c 45 20 | 2a 69 70 6f 72 74 3b 20 |/* FILE |*iport; |
|00003a50| 63 68 61 72 20 2a 62 75 | 66 66 65 72 3b 20 69 6e |char *bu|ffer; in|
|00003a60| 74 20 62 75 66 6c 65 6e | 3b 20 2a 2f 0a 0a 20 20 |t buflen|; */.. |
|00003a70| 2f 2a 20 72 65 61 64 73 | 20 61 20 6c 69 6e 65 20 |/* reads| a line |
|00003a80| 69 6e 74 6f 20 62 75 66 | 66 65 72 2e 20 20 44 6f |into buf|fer. Do|
|00003a90| 65 73 20 6e 6f 74 20 70 | 75 74 20 74 68 65 20 27 |es not p|ut the '|
|00003aa0| 5c 6e 27 20 69 6e 74 6f | 20 62 75 66 66 65 72 2e |\n' into| buffer.|
|00003ab0| 20 2a 2f 0a 20 20 2f 2a | 20 52 65 74 75 72 6e 73 | */. /*| Returns|
|00003ac0| 20 41 54 5f 45 4f 46 20 | 69 66 20 61 74 20 65 6e | AT_EOF |if at en|
|00003ad0| 64 20 6f 66 20 66 69 6c | 65 20 77 68 65 6e 20 63 |d of fil|e when c|
|00003ae0| 61 6c 6c 65 64 2e 20 20 | 49 66 20 69 74 20 65 6e |alled. |If it en|
|00003af0| 63 6f 75 6e 74 65 72 73 | 20 2a 2f 0a 20 20 2f 2a |counters| */. /*|
|00003b00| 20 65 6e 64 20 6f 66 20 | 66 69 6c 65 20 61 66 74 | end of |file aft|
|00003b10| 65 72 20 72 65 61 64 69 | 6e 67 20 61 74 20 6c 65 |er readi|ng at le|
|00003b20| 61 73 74 20 6f 6e 65 20 | 63 68 61 72 61 63 74 65 |ast one |characte|
|00003b30| 72 2c 20 74 68 65 20 65 | 6f 66 20 69 73 20 74 72 |r, the e|of is tr|
|00003b40| 65 61 74 65 64 20 2a 2f | 0a 20 20 2f 2a 20 61 73 |eated */|. /* as|
|00003b50| 20 69 66 20 69 74 20 77 | 65 72 65 20 61 20 6e 65 | if it w|ere a ne|
|00003b60| 77 6c 69 6e 65 2e 20 20 | 20 52 65 74 75 72 6e 73 |wline. | Returns|
|00003b70| 20 54 4f 4f 5f 4d 41 4e | 59 5f 43 48 41 52 53 20 | TOO_MAN|Y_CHARS |
|00003b80| 69 66 20 6d 6f 72 65 20 | 74 68 61 6e 20 2a 2f 0a |if more |than */.|
|00003b90| 20 20 2f 2a 20 62 75 66 | 6c 65 6e 20 2d 20 31 20 | /* buf|len - 1 |
|00003ba0| 63 68 61 72 61 63 74 65 | 72 73 20 61 72 65 20 72 |characte|rs are r|
|00003bb0| 65 61 64 20 62 65 66 6f | 72 65 20 65 6e 63 6f 75 |ead befo|re encou|
|00003bc0| 6e 74 65 72 69 6e 67 20 | 61 20 6e 65 77 6c 69 6e |ntering |a newlin|
|00003bd0| 65 2e 20 2a 2f 20 20 20 | 20 20 20 20 20 0a 20 20 |e. */ | . |
|00003be0| 2f 2a 20 49 6e 20 74 68 | 69 73 20 63 61 73 65 20 |/* In th|is case |
|00003bf0| 65 78 61 63 74 6c 79 20 | 62 75 66 6c 65 6e 20 2d |exactly |buflen -|
|00003c00| 20 31 20 63 68 61 72 61 | 63 74 65 72 73 20 61 72 | 1 chara|cters ar|
|00003c10| 65 20 72 65 61 64 2e 20 | 2a 2f 0a 20 20 2f 2a 20 |e read. |*/. /* |
|00003c20| 54 68 65 20 6c 61 73 74 | 20 63 68 61 72 61 63 74 |The last| charact|
|00003c30| 65 72 20 72 65 61 64 20 | 69 73 20 61 6c 77 61 79 |er read |is alway|
|00003c40| 73 20 66 6f 6c 6c 77 65 | 64 20 62 79 20 61 20 27 |s follwe|d by a '|
|00003c50| 5c 30 27 2e 20 2a 2f 0a | 20 20 2f 2a 20 69 66 20 |\0'. */.| /* if |
|00003c60| 73 75 63 63 65 73 73 66 | 75 6c 20 67 65 74 6c 69 |successf|ul getli|
|00003c70| 6e 65 20 72 65 74 75 72 | 6e 73 20 74 68 65 20 6e |ne retur|ns the n|
|00003c80| 75 6d 62 65 72 20 6f 66 | 20 63 68 61 72 61 63 74 |umber of| charact|
|00003c90| 65 72 73 20 72 65 61 64 | 20 65 78 63 6c 75 73 69 |ers read| exclusi|
|00003ca0| 76 65 20 2a 2f 0a 20 20 | 2f 2a 20 6f 66 20 61 20 |ve */. |/* of a |
|00003cb0| 74 65 72 6d 69 6e 61 74 | 69 6e 67 20 6e 65 77 6c |terminat|ing newl|
|00003cc0| 69 6e 65 20 6f 72 20 65 | 6f 66 2e 20 2a 2f 0a 0a |ine or e|of. */..|
|00003cd0| 0a 65 78 74 65 72 6e 20 | 69 6e 74 20 67 65 74 6c |.extern |int getl|
|00003ce0| 69 6e 65 73 28 29 3b 0a | 0a 20 20 2f 2a 20 46 49 |ines();.|. /* FI|
|00003cf0| 4c 45 20 2a 66 70 3b 20 | 69 6e 74 20 6e 3b 20 63 |LE *fp; |int n; c|
|00003d00| 68 61 72 20 2a 2a 2a 70 | 74 72 5f 6c 69 6e 65 73 |har ***p|tr_lines|
|00003d10| 3b 20 63 68 61 72 20 2a | 6c 69 6e 65 62 75 66 3b |; char *|linebuf;|
|00003d20| 20 69 6e 74 20 6d 61 78 | 6c 69 6e 65 6c 65 6e 3b | int max|linelen;|
|00003d30| 20 2a 2f 0a 20 20 2f 2a | 20 53 65 65 20 64 6f 63 | */. /*| See doc|
|00003d40| 75 6d 65 6e 74 61 74 69 | 6f 6e 20 66 6f 72 20 67 |umentati|on for g|
|00003d50| 65 74 66 69 6c 65 20 62 | 65 6c 6f 77 20 2a 2f 0a |etfile b|elow */.|
|00003d60| 20 20 2f 2a 20 49 66 20 | 63 61 6c 6c 65 64 2c 20 | /* If |called, |
|00003d70| 27 6e 27 20 6d 75 73 74 | 20 68 61 76 65 20 61 20 |'n' must| have a |
|00003d80| 76 61 6c 75 65 20 30 2e | 20 2a 2f 0a 0a 65 78 74 |value 0.| */..ext|
|00003d90| 65 72 6e 20 69 6e 74 20 | 67 65 74 66 69 6c 65 28 |ern int |getfile(|
|00003da0| 29 3b 0a 0a 20 20 2f 2a | 20 63 68 61 72 20 2a 66 |);.. /*| char *f|
|00003db0| 69 6c 65 6e 61 6d 65 3b | 20 63 68 61 72 20 2a 2a |ilename;| char **|
|00003dc0| 2a 70 74 72 5f 6c 69 6e | 65 73 3b 20 63 68 61 72 |*ptr_lin|es; char|
|00003dd0| 20 2a 6c 69 6e 65 62 75 | 66 3b 20 69 6e 74 20 6d | *linebu|f; int m|
|00003de0| 61 78 6c 69 6e 65 6c 65 | 6e 3b 20 2a 2f 0a 0a 20 |axlinele|n; */.. |
|00003df0| 20 2f 2a 20 72 65 61 64 | 20 69 6e 20 61 20 66 69 | /* read| in a fi|
|00003e00| 6c 65 20 61 73 20 61 6e | 20 61 72 72 61 79 20 6f |le as an| array o|
|00003e10| 66 20 63 68 61 72 61 63 | 74 65 72 20 73 74 72 69 |f charac|ter stri|
|00003e20| 6e 67 73 20 2a 2f 0a 20 | 20 2f 2a 20 27 6d 61 78 |ngs */. | /* 'max|
|00003e30| 6c 69 6e 65 6c 65 6e 2b | 31 27 20 69 73 20 74 68 |linelen+|1' is th|
|00003e40| 65 20 6d 61 78 69 6d 75 | 6d 20 6c 65 6e 67 74 68 |e maximu|m length|
|00003e50| 20 61 20 6c 69 6e 65 20 | 6f 66 20 74 68 65 20 66 | a line |of the f|
|00003e60| 69 6c 65 20 69 73 20 61 | 6c 6c 6f 77 65 64 20 2a |ile is a|llowed *|
|00003e70| 2f 0a 20 20 2f 2a 20 74 | 6f 20 62 65 2e 20 20 27 |/. /* t|o be. '|
|00003e80| 6c 69 6e 65 62 75 66 27 | 20 6d 75 73 74 20 62 65 |linebuf'| must be|
|00003e90| 20 61 74 20 6c 65 61 73 | 74 20 27 6d 61 78 6c 69 | at leas|t 'maxli|
|00003ea0| 6e 65 6c 65 6e 2b 31 27 | 20 63 68 61 72 61 63 74 |nelen+1'| charact|
|00003eb0| 65 72 73 20 6c 6f 6e 67 | 2e 20 2a 2f 0a 20 20 2f |ers long|. */. /|
|00003ec0| 2a 20 52 65 74 75 72 6e | 73 20 74 68 65 20 6e 75 |* Return|s the nu|
|00003ed0| 6d 62 65 72 20 6f 66 20 | 6c 69 6e 65 73 20 69 6e |mber of |lines in|
|00003ee0| 20 74 68 65 20 66 69 6c | 65 20 28 61 6e 64 20 74 | the fil|e (and t|
|00003ef0| 68 65 72 65 66 6f 72 65 | 20 74 68 65 20 6e 75 6d |herefore| the num|
|00003f00| 62 65 72 20 2a 2f 0a 20 | 20 2f 2a 20 6f 66 20 65 |ber */. | /* of e|
|00003f10| 6e 74 72 69 65 73 20 69 | 6e 20 2a 70 74 72 5f 6c |ntries i|n *ptr_l|
|00003f20| 69 6e 65 73 29 20 69 66 | 20 73 75 63 63 65 73 73 |ines) if| success|
|00003f30| 66 75 6c 2e 20 20 52 65 | 74 75 72 6e 73 20 49 4f |ful. Re|turns IO|
|00003f40| 45 52 52 4f 52 20 69 66 | 20 69 74 20 2a 2f 0a 20 |ERROR if| it */. |
|00003f50| 20 2f 2a 20 63 6f 75 6c | 64 20 6e 6f 74 20 6f 70 | /* coul|d not op|
|00003f60| 65 6e 20 74 68 65 20 66 | 69 6c 65 20 74 6f 20 72 |en the f|ile to r|
|00003f70| 65 61 64 20 66 72 6f 6d | 2e 20 52 65 74 75 72 6e |ead from|. Return|
|00003f80| 73 20 54 4f 4f 5f 4d 41 | 4e 59 5f 43 48 41 52 53 |s TOO_MA|NY_CHARS|
|00003f90| 20 69 66 20 2a 2f 0a 20 | 20 2f 2a 20 69 74 20 65 | if */. | /* it e|
|00003fa0| 6e 63 6f 75 6e 74 65 72 | 73 20 61 20 6c 69 6e 65 |ncounter|s a line|
|00003fb0| 20 6c 6f 6e 67 65 72 20 | 74 68 61 6e 20 27 6d 61 | longer |than 'ma|
|00003fc0| 78 6c 69 6e 65 6c 65 6e | 27 20 63 68 61 72 61 63 |xlinelen|' charac|
|00003fd0| 74 65 72 73 2e 20 20 0a | 0a 20 20 2f 2a 20 53 70 |ters. .|. /* Sp|
|00003fe0| 61 63 65 20 66 6f 72 20 | 65 61 63 68 20 6c 69 6e |ace for |each lin|
|00003ff0| 65 20 69 73 20 6d 61 6c | 6c 6f 63 27 65 64 20 61 |e is mal|loc'ed a|
|00004000| 73 20 69 74 20 69 73 20 | 72 65 61 64 20 69 6e 20 |s it is |read in |
|00004010| 61 6e 64 20 74 68 65 20 | 74 65 78 74 20 66 6f 72 |and the |text for|
|00004020| 20 2a 2f 0a 20 20 2f 2a | 20 74 68 65 20 6a 74 68 | */. /*| the jth|
|00004030| 20 6c 69 6e 65 20 69 73 | 20 73 74 6f 72 65 64 20 | line is| stored |
|00004040| 69 6e 20 28 2a 70 74 72 | 5f 6c 69 6e 65 73 29 5b |in (*ptr|_lines)[|
|00004050| 6a 5d 20 2a 2f 0a 0a 20 | 20 2f 2a 20 4f 6e 6c 79 |j] */.. | /* Only|
|00004060| 20 77 6f 72 6b 73 20 66 | 6f 72 20 66 61 69 72 6c | works f|or fairl|
|00004070| 79 20 73 6d 61 6c 6c 20 | 66 69 6c 65 73 20 61 73 |y small |files as|
|00004080| 20 69 74 20 72 65 63 75 | 72 73 65 73 20 69 74 73 | it recu|rses its|
|00004090| 20 77 61 79 20 74 68 72 | 6f 75 67 68 20 74 68 65 | way thr|ough the|
|000040a0| 20 2a 2f 0a 20 20 2f 2a | 20 66 69 6c 65 20 61 6e | */. /*| file an|
|000040b0| 64 20 64 6f 65 73 20 61 | 20 6c 6f 74 20 6f 66 20 |d does a| lot of |
|000040c0| 6d 61 6c 6c 6f 63 2d 69 | 6e 67 2e 20 20 55 73 65 |malloc-i|ng. Use|
|000040d0| 20 72 65 61 64 5f 66 69 | 6c 65 5f 69 6e 74 6f 5f | read_fi|le_into_|
|000040e0| 62 75 66 66 65 72 20 6f | 72 20 2a 2f 0a 20 20 2f |buffer o|r */. /|
|000040f0| 2a 20 6e 67 65 74 66 69 | 6c 65 20 66 6f 72 20 6c |* ngetfi|le for l|
|00004100| 61 72 67 65 20 66 69 6c | 65 73 2e 20 2a 2f 0a 0a |arge fil|es. */..|
|00004110| 65 78 74 65 72 6e 20 69 | 6e 74 20 6e 67 65 74 6c |extern i|nt ngetl|
|00004120| 69 6e 65 73 28 29 3b 0a | 0a 20 2f 2a 20 46 49 4c |ines();.|. /* FIL|
|00004130| 45 20 2a 66 70 3b 20 69 | 6e 74 20 6e 3b 20 63 68 |E *fp; i|nt n; ch|
|00004140| 61 72 20 2a 2a 2a 70 74 | 72 5f 6c 69 6e 65 73 3b |ar ***pt|r_lines;|
|00004150| 20 63 68 61 72 20 2a 6c | 69 6e 65 62 75 66 3b 20 | char *l|inebuf; |
|00004160| 69 6e 74 20 6d 61 78 6c | 69 6e 65 6c 65 6e 3b 20 |int maxl|inelen; |
|00004170| 2a 2f 0a 20 2f 2a 20 53 | 61 6d 65 20 61 73 20 67 |*/. /* S|ame as g|
|00004180| 65 74 6c 69 6e 65 73 2c | 20 65 78 63 65 70 74 20 |etlines,| except |
|00004190| 61 74 20 6d 6f 73 74 20 | 27 6e 27 20 6c 69 6e 65 |at most |'n' line|
|000041a0| 73 20 77 69 6c 6c 20 62 | 65 20 72 65 61 64 2e 20 |s will b|e read. |
|000041b0| 20 52 65 74 75 72 6e 73 | 20 2a 2f 0a 20 2f 2a 20 | Returns| */. /* |
|000041c0| 54 4f 4f 5f 4d 41 4e 59 | 5f 4c 49 4e 45 53 20 69 |TOO_MANY|_LINES i|
|000041d0| 66 20 6d 6f 72 65 20 74 | 68 61 6e 20 27 6e 27 20 |f more t|han 'n' |
|000041e0| 6c 69 6e 65 73 20 61 72 | 65 20 70 72 65 73 65 6e |lines ar|e presen|
|000041f0| 74 2e 20 2a 2f 0a 0a 65 | 78 74 65 72 6e 20 69 6e |t. */..e|xtern in|
|00004200| 74 20 6e 67 65 74 66 69 | 6c 65 28 29 3b 0a 0a 20 |t ngetfi|le();.. |
|00004210| 2f 2a 20 69 6e 74 20 6e | 3b 20 63 68 61 72 20 2a |/* int n|; char *|
|00004220| 66 69 6c 65 6e 61 6d 65 | 3b 20 63 68 61 72 20 2a |filename|; char *|
|00004230| 2a 2a 70 74 72 5f 6c 69 | 6e 65 73 3b 20 63 68 61 |**ptr_li|nes; cha|
|00004240| 72 20 2a 6c 69 6e 65 62 | 75 66 3b 20 69 6e 74 20 |r *lineb|uf; int |
|00004250| 6d 61 78 6c 69 6e 65 6c | 65 6e 3b 20 2a 2f 0a 20 |maxlinel|en; */. |
|00004260| 2f 2a 20 53 65 65 20 6e | 67 65 74 6c 69 6e 65 73 |/* See n|getlines|
|00004270| 20 61 62 6f 76 65 2e 20 | 2a 2f 0a 0a 65 78 74 65 | above. |*/..exte|
|00004280| 72 6e 20 69 6e 74 20 72 | 65 61 64 5f 66 69 6c 65 |rn int r|ead_file|
|00004290| 5f 69 6e 74 6f 5f 62 75 | 66 66 65 72 28 29 3b 0a |_into_bu|ffer();.|
|000042a0| 0a 20 20 2f 2a 20 63 68 | 61 72 20 2a 66 69 6c 65 |. /* ch|ar *file|
|000042b0| 6e 61 6d 65 3b 20 0a 20 | 20 20 20 20 63 68 61 72 |name; . | char|
|000042c0| 20 2a 2a 2a 70 74 72 5f | 6c 69 6e 65 73 3b 0a 20 | ***ptr_|lines;. |
|000042d0| 20 20 20 20 69 6e 74 20 | 6d 61 78 6c 69 6e 65 73 | int |maxlines|
|000042e0| 3b 0a 20 20 20 20 20 63 | 68 61 72 20 2a 62 75 66 |;. c|har *buf|
|000042f0| 66 65 72 3b 0a 20 20 20 | 20 20 69 6e 74 20 62 75 |fer;. | int bu|
|00004300| 66 6c 65 6e 3b 0a 20 20 | 20 20 20 63 68 61 72 20 |flen;. | char |
|00004310| 2a 6c 69 6e 65 62 75 66 | 66 65 72 3b 0a 20 20 20 |*linebuf|fer;. |
|00004320| 20 20 69 6e 74 20 6c 69 | 6e 65 62 75 66 6c 65 6e | int li|nebuflen|
|00004330| 3b 0a 20 20 2a 2f 0a 0a | 20 20 2f 2a 20 2a 70 74 |;. */..| /* *pt|
|00004340| 72 5f 6c 69 6e 65 73 20 | 73 68 6f 75 6c 64 20 62 |r_lines |should b|
|00004350| 65 20 61 6e 20 61 72 72 | 61 79 20 6f 66 20 63 68 |e an arr|ay of ch|
|00004360| 61 72 61 63 74 65 72 20 | 73 74 72 69 6e 67 20 70 |aracter |string p|
|00004370| 6f 69 6e 74 65 72 73 20 | 6d 61 78 6c 69 6e 65 73 |ointers |maxlines|
|00004380| 20 2a 2f 0a 20 20 2f 2a | 20 62 69 67 2e 20 20 62 | */. /*| big. b|
|00004390| 75 66 66 65 72 20 73 68 | 6f 75 6c 64 20 62 65 20 |uffer sh|ould be |
|000043a0| 61 6e 20 61 72 72 61 79 | 20 6f 66 20 63 68 61 72 |an array| of char|
|000043b0| 61 63 74 65 72 73 20 62 | 75 66 6c 65 6e 20 6c 6f |acters b|uflen lo|
|000043c0| 6e 67 2e 20 20 54 68 65 | 20 72 6f 75 74 69 6e 65 |ng. The| routine|
|000043d0| 20 2a 2f 0a 20 20 2f 2a | 20 72 65 61 64 73 20 6c | */. /*| reads l|
|000043e0| 69 6e 65 73 20 75 73 69 | 6e 67 20 67 65 74 6c 69 |ines usi|ng getli|
|000043f0| 6e 65 20 61 6e 64 20 73 | 74 6f 72 65 73 20 74 68 |ne and s|tores th|
|00004400| 65 6d 20 69 6e 74 6f 20 | 62 75 66 66 65 72 2c 20 |em into |buffer, |
|00004410| 74 65 72 6d 69 6e 61 74 | 69 6e 67 20 65 61 63 68 |terminat|ing each|
|00004420| 20 2a 2f 0a 20 20 2f 2a | 20 77 69 74 68 20 61 20 | */. /*| with a |
|00004430| 6e 75 6c 6c 2e 20 20 41 | 20 70 6f 69 6e 74 65 72 |null. A| pointer|
|00004440| 20 74 6f 20 74 68 65 20 | 6e 74 68 20 6c 69 6e 65 | to the |nth line|
|00004450| 20 72 65 61 64 20 69 73 | 20 73 74 6f 72 65 64 20 | read is| stored |
|00004460| 69 6e 20 2a 70 74 72 5f | 6c 69 6e 65 73 5b 6e 5d |in *ptr_|lines[n]|
|00004470| 20 2a 2f 0a 20 20 2f 2a | 20 52 65 74 75 72 6e 73 | */. /*| Returns|
|00004480| 20 49 4f 45 52 52 4f 52 | 20 69 66 20 69 74 20 63 | IOERROR| if it c|
|00004490| 61 6e 6e 6f 74 20 6f 70 | 65 6e 20 74 68 65 20 66 |annot op|en the f|
|000044a0| 69 6c 65 20 66 6f 72 20 | 72 65 61 64 69 6e 67 2c |ile for |reading,|
|000044b0| 20 54 4f 4f 5f 4d 41 4e | 59 5f 4c 49 4e 45 53 20 | TOO_MAN|Y_LINES |
|000044c0| 2a 2f 0a 20 20 2f 2a 20 | 69 66 20 6d 6f 72 65 20 |*/. /* |if more |
|000044d0| 74 68 61 6e 20 6d 61 78 | 6c 69 6e 65 73 20 77 65 |than max|lines we|
|000044e0| 72 65 20 72 65 61 64 20 | 69 6e 2c 20 54 4f 4f 5f |re read |in, TOO_|
|000044f0| 4d 41 4e 59 5f 43 48 41 | 52 53 20 69 66 20 62 75 |MANY_CHA|RS if bu|
|00004500| 66 66 65 72 20 69 73 20 | 2a 2f 0a 20 20 2f 2a 20 |ffer is |*/. /* |
|00004510| 66 69 6c 6c 65 64 20 62 | 65 66 6f 72 65 20 65 6e |filled b|efore en|
|00004520| 64 20 6f 66 20 66 69 6c | 65 20 69 73 20 72 65 61 |d of fil|e is rea|
|00004530| 63 68 65 64 2c 20 61 6e | 64 20 4c 49 4e 45 5f 54 |ched, an|d LINE_T|
|00004540| 4f 4f 5f 4c 4f 4e 47 20 | 69 73 20 61 6e 79 20 6c |OO_LONG |is any l|
|00004550| 69 6e 65 20 69 73 20 2a | 2f 0a 20 20 2f 2a 20 6c |ine is *|/. /* l|
|00004560| 6f 6e 67 65 72 20 74 68 | 61 6e 20 6c 69 6e 65 62 |onger th|an lineb|
|00004570| 75 66 6c 65 6e 2e 20 20 | 52 65 74 75 72 6e 73 20 |uflen. |Returns |
|00004580| 6e 75 6d 62 65 72 20 6f | 66 20 6c 69 6e 65 73 20 |number o|f lines |
|00004590| 72 65 61 64 20 69 6e 20 | 69 66 20 73 75 63 63 65 |read in |if succe|
|000045a0| 73 73 66 75 6c 2e 20 2a | 2f 0a 0a 65 78 74 65 72 |ssful. *|/..exter|
|000045b0| 6e 20 63 68 61 72 20 2a | 65 66 6f 70 65 6e 28 29 |n char *|efopen()|
|000045c0| 3b 20 20 0a 0a 20 20 2f | 2a 20 63 68 61 72 20 2a |; .. /|* char *|
|000045d0| 66 69 6c 65 6e 61 6d 65 | 3b 20 63 68 61 72 20 2a |filename|; char *|
|000045e0| 6d 6f 64 65 20 2a 2f 0a | 0a 20 20 2f 2a 20 41 63 |mode */.|. /* Ac|
|000045f0| 74 75 61 6c 6c 79 20 72 | 65 74 75 72 6e 73 20 61 |tually r|eturns a|
|00004600| 20 28 46 49 4c 45 20 2a | 29 2c 20 73 6f 20 6f 6e | (FILE *|), so on|
|00004610| 65 20 6d 75 73 74 20 63 | 61 73 74 20 74 68 65 20 |e must c|ast the |
|00004620| 72 65 74 75 72 6e 20 76 | 61 6c 75 65 20 74 6f 20 |return v|alue to |
|00004630| 74 68 69 73 20 2a 2f 0a | 20 20 2f 2a 20 74 79 70 |this */.| /* typ|
|00004640| 65 2e 20 20 49 74 20 64 | 6f 65 73 6e 27 74 20 72 |e. It d|oesn't r|
|00004650| 65 74 75 72 6e 20 61 20 | 28 46 49 4c 45 20 2a 29 |eturn a |(FILE *)|
|00004660| 20 65 78 70 6c 69 63 69 | 74 6c 79 20 62 65 63 61 | explici|tly beca|
|00004670| 75 73 65 20 74 68 65 6e | 20 74 6f 20 69 6e 63 6c |use then| to incl|
|00004680| 75 64 65 20 2a 2f 0a 20 | 20 2f 2a 20 74 68 69 73 |ude */. | /* this|
|00004690| 20 66 69 6c 65 20 6f 6e | 65 20 77 6f 75 6c 64 20 | file on|e would |
|000046a0| 68 61 76 65 20 74 6f 20 | 69 6e 63 6c 75 64 65 20 |have to |include |
|000046b0| 3c 73 74 64 69 6f 2e 68 | 3e 20 65 78 70 6c 69 63 |<stdio.h|> explic|
|000046c0| 69 74 6c 79 20 62 65 66 | 6f 72 65 20 69 74 2e 20 |itly bef|ore it. |
|000046d0| 2a 2f 0a 20 20 2f 2a 20 | 54 68 65 20 72 6f 75 74 |*/. /* |The rout|
|000046e0| 69 6e 65 20 73 69 6d 70 | 6c 79 20 63 61 6c 6c 73 |ine simp|ly calls|
|000046f0| 20 66 6f 70 65 6e 20 77 | 69 74 68 20 74 68 65 20 | fopen w|ith the |
|00004700| 73 61 6d 65 20 61 72 67 | 75 6d 65 6e 74 73 2c 20 |same arg|uments, |
|00004710| 62 75 74 20 70 72 69 6e | 74 73 20 61 20 2a 2f 0a |but prin|ts a */.|
|00004720| 20 20 2f 2a 20 72 65 61 | 73 6f 6e 61 62 6c 65 20 | /* rea|sonable |
|00004730| 65 72 72 6f 72 20 6d 65 | 73 73 61 67 65 20 61 6e |error me|ssage an|
|00004740| 64 20 63 61 6c 6c 73 20 | 65 78 69 74 20 69 66 20 |d calls |exit if |
|00004750| 74 68 65 20 63 61 6c 6c | 20 74 6f 20 66 6f 70 65 |the call| to fope|
|00004760| 6e 20 66 61 69 6c 73 2e | 20 2a 2f 0a 0a 0a 42 6f |n fails.| */...Bo|
|00004770| 6f 6c 20 63 68 65 63 6b | 5f 73 74 72 69 6e 67 28 |ol check|_string(|
|00004780| 29 3b 0a 0a 20 20 2f 2a | 20 63 68 61 72 20 2a 73 |);.. /*| char *s|
|00004790| 74 72 3b 20 6c 6f 6e 67 | 20 6d 69 6e 6c 65 6e 3b |tr; long| minlen;|
|000047a0| 20 6c 6f 6e 67 20 6d 61 | 78 6c 65 6e 3b 20 2a 2f | long ma|xlen; */|
|000047b0| 0a 0a 20 20 2f 2a 20 52 | 65 74 75 72 6e 73 20 54 |.. /* R|eturns T|
|000047c0| 20 69 66 20 73 74 72 20 | 69 73 20 6e 6f 74 20 30 | if str |is not 0|
|000047d0| 20 61 6e 64 20 68 61 73 | 20 61 20 6c 65 6e 67 74 | and has| a lengt|
|000047e0| 68 20 62 65 74 77 65 65 | 6e 20 6d 69 6e 6c 65 6e |h betwee|n minlen|
|000047f0| 20 61 6e 64 20 6d 61 78 | 6c 65 6e 20 2a 2f 0a 20 | and max|len */. |
|00004800| 20 2f 2a 20 69 6e 63 6c | 75 73 69 76 65 64 2c 20 | /* incl|usived, |
|00004810| 6f 74 68 65 72 77 69 73 | 65 20 72 65 74 75 72 6e |otherwis|e return|
|00004820| 73 20 46 2e 20 2a 2f 0a | 0a 0a 23 69 66 6e 64 65 |s F. */.|..#ifnde|
|00004830| 66 20 63 68 65 63 6b 5f | 69 6e 74 0a 23 64 65 66 |f check_|int.#def|
|00004840| 69 6e 65 20 63 68 65 63 | 6b 5f 69 6e 74 28 69 2c |ine chec|k_int(i,|
|00004850| 6d 69 6e 76 61 6c 2c 6d | 61 78 76 61 6c 29 20 28 |minval,m|axval) (|
|00004860| 28 69 29 20 3e 3d 20 28 | 6d 69 6e 76 61 6c 29 20 |(i) >= (|minval) |
|00004870| 26 26 20 28 69 29 20 3c | 3d 20 28 6d 61 78 76 61 |&& (i) <|= (maxva|
|00004880| 6c 29 29 0a 23 65 6e 64 | 69 66 0a 53 48 41 52 5f |l)).#end|if.SHAR_|
|00004890| 45 4f 46 0a 69 66 20 74 | 65 73 74 20 31 30 38 31 |EOF.if t|est 1081|
|000048a0| 34 20 2d 6e 65 20 22 60 | 77 63 20 2d 63 20 3c 20 |4 -ne "`|wc -c < |
|000048b0| 27 63 74 6f 6f 6c 73 2e | 68 27 60 22 0a 74 68 65 |'ctools.|h'`".the|
|000048c0| 6e 0a 09 65 63 68 6f 20 | 73 68 61 72 3a 20 65 72 |n..echo |shar: er|
|000048d0| 72 6f 72 20 74 72 61 6e | 73 6d 69 74 74 69 6e 67 |ror tran|smitting|
|000048e0| 20 22 27 63 74 6f 6f 6c | 73 2e 68 27 22 20 27 28 | "'ctool|s.h'" '(|
|000048f0| 73 68 6f 75 6c 64 20 68 | 61 76 65 20 62 65 65 6e |should h|ave been|
|00004900| 20 31 30 38 31 34 20 63 | 68 61 72 61 63 74 65 72 | 10814 c|haracter|
|00004910| 73 29 27 0a 66 69 0a 66 | 69 0a 65 63 68 6f 20 73 |s)'.fi.f|i.echo s|
|00004920| 68 61 72 3a 20 65 78 74 | 72 61 63 74 69 6e 67 20 |har: ext|racting |
|00004930| 22 27 74 65 78 63 68 61 | 72 73 2e 68 27 22 20 27 |"'texcha|rs.h'" '|
|00004940| 28 31 39 38 20 63 68 61 | 72 61 63 74 65 72 73 29 |(198 cha|racters)|
|00004950| 27 0a 69 66 20 74 65 73 | 74 20 2d 66 20 27 74 65 |'.if tes|t -f 'te|
|00004960| 78 63 68 61 72 73 2e 68 | 27 0a 74 68 65 6e 0a 09 |xchars.h|'.then..|
|00004970| 65 63 68 6f 20 73 68 61 | 72 3a 20 77 69 6c 6c 20 |echo sha|r: will |
|00004980| 6e 6f 74 20 6f 76 65 72 | 2d 77 72 69 74 65 20 65 |not over|-write e|
|00004990| 78 69 73 74 69 6e 67 20 | 66 69 6c 65 20 22 27 74 |xisting |file "'t|
|000049a0| 65 78 63 68 61 72 73 2e | 68 27 22 0a 65 6c 73 65 |exchars.|h'".else|
|000049b0| 0a 63 61 74 20 3c 3c 20 | 5c 53 48 41 52 5f 45 4f |.cat << |\SHAR_EO|
|000049c0| 46 20 3e 20 27 74 65 78 | 63 68 61 72 73 2e 68 27 |F > 'tex|chars.h'|
|000049d0| 0a 65 78 74 65 72 6e 20 | 69 6e 69 74 5f 6c 65 67 |.extern |init_leg|
|000049e0| 61 6c 5f 63 68 61 72 73 | 28 29 3b 0a 0a 65 78 74 |al_chars|();..ext|
|000049f0| 65 72 6e 20 63 68 61 72 | 20 4c 67 6c 5f 43 68 61 |ern char| Lgl_Cha|
|00004a00| 72 73 5b 5d 3b 0a 65 78 | 74 65 72 6e 20 63 68 61 |rs[];.ex|tern cha|
|00004a10| 72 20 4c 67 6c 5f 53 69 | 6e 67 6c 65 5f 43 68 61 |r Lgl_Si|ngle_Cha|
|00004a20| 72 5f 43 6f 6d 6d 61 6e | 64 73 5b 5d 3b 0a 0a 23 |r_Comman|ds[];..#|
|00004a30| 64 65 66 69 6e 65 20 4c | 47 4c 5f 43 48 41 52 28 |define L|GL_CHAR(|
|00004a40| 78 29 20 28 4c 67 6c 5f | 43 68 61 72 73 5b 28 78 |x) (Lgl_|Chars[(x|
|00004a50| 29 5d 29 0a 23 64 65 66 | 69 6e 65 20 4c 47 4c 5f |)]).#def|ine LGL_|
|00004a60| 53 49 4e 47 4c 45 5f 43 | 4f 4d 4d 41 4e 44 5f 43 |SINGLE_C|OMMAND_C|
|00004a70| 48 41 52 28 78 29 20 28 | 4c 67 6c 5f 53 69 6e 67 |HAR(x) (|Lgl_Sing|
|00004a80| 6c 65 5f 43 68 61 72 5f | 43 6f 6d 6d 61 6e 64 73 |le_Char_|Commands|
|00004a90| 5b 28 78 29 5d 29 0a 53 | 48 41 52 5f 45 4f 46 0a |[(x)]).S|HAR_EOF.|
|00004aa0| 69 66 20 74 65 73 74 20 | 31 39 38 20 2d 6e 65 20 |if test |198 -ne |
|00004ab0| 22 60 77 63 20 2d 63 20 | 3c 20 27 74 65 78 63 68 |"`wc -c |< 'texch|
|00004ac0| 61 72 73 2e 68 27 60 22 | 0a 74 68 65 6e 0a 09 65 |ars.h'`"|.then..e|
|00004ad0| 63 68 6f 20 73 68 61 72 | 3a 20 65 72 72 6f 72 20 |cho shar|: error |
|00004ae0| 74 72 61 6e 73 6d 69 74 | 74 69 6e 67 20 22 27 74 |transmit|ting "'t|
|00004af0| 65 78 63 68 61 72 73 2e | 68 27 22 20 27 28 73 68 |exchars.|h'" '(sh|
|00004b00| 6f 75 6c 64 20 68 61 76 | 65 20 62 65 65 6e 20 31 |ould hav|e been 1|
|00004b10| 39 38 20 63 68 61 72 61 | 63 74 65 72 73 29 27 0a |98 chara|cters)'.|
|00004b20| 66 69 0a 66 69 0a 65 63 | 68 6f 20 73 68 61 72 3a |fi.fi.ec|ho shar:|
|00004b30| 20 65 78 74 72 61 63 74 | 69 6e 67 20 22 27 74 65 | extract|ing "'te|
|00004b40| 78 63 68 6b 2e 68 27 22 | 20 27 28 31 34 38 39 20 |xchk.h'"| '(1489 |
|00004b50| 63 68 61 72 61 63 74 65 | 72 73 29 27 0a 69 66 20 |characte|rs)'.if |
|00004b60| 74 65 73 74 20 2d 66 20 | 27 74 65 78 63 68 6b 2e |test -f |'texchk.|
|00004b70| 68 27 0a 74 68 65 6e 0a | 09 65 63 68 6f 20 73 68 |h'.then.|.echo sh|
|00004b80| 61 72 3a 20 77 69 6c 6c | 20 6e 6f 74 20 6f 76 65 |ar: will| not ove|
|00004b90| 72 2d 77 72 69 74 65 20 | 65 78 69 73 74 69 6e 67 |r-write |existing|
|00004ba0| 20 66 69 6c 65 20 22 27 | 74 65 78 63 68 6b 2e 68 | file "'|texchk.h|
|00004bb0| 27 22 0a 65 6c 73 65 0a | 63 61 74 20 3c 3c 20 5c |'".else.|cat << \|
|00004bc0| 53 48 41 52 5f 45 4f 46 | 20 3e 20 27 74 65 78 63 |SHAR_EOF| > 'texc|
|00004bd0| 68 6b 2e 68 27 0a 2f 2a | 20 74 68 65 73 65 20 61 |hk.h'./*| these a|
|00004be0| 72 65 20 74 68 65 20 74 | 79 70 65 73 20 6f 66 20 |re the t|ypes of |
|00004bf0| 74 6f 6b 65 6e 73 20 77 | 65 20 6c 6f 6f 6b 20 66 |tokens w|e look f|
|00004c00| 6f 72 20 69 6e 20 74 68 | 65 20 69 6e 70 75 74 20 |or in th|e input |
|00004c10| 74 65 78 74 20 2a 2f 0a | 0a 74 79 70 65 64 65 66 |text */.|.typedef|
|00004c20| 20 65 6e 75 6d 20 7b 20 | 0a 20 20 20 20 20 20 20 | enum { |. |
|00004c30| 20 0a 20 20 20 20 20 20 | 20 20 45 53 43 41 50 45 | . | ESCAPE|
|00004c40| 5f 42 45 47 49 4e 2c 20 | 45 53 43 41 50 45 5f 45 |_BEGIN, |ESCAPE_E|
|00004c50| 4e 44 2c 20 45 53 43 41 | 50 45 5f 41 4e 59 2c 0a |ND, ESCA|PE_ANY,.|
|00004c60| 20 20 20 20 20 20 20 20 | 4c 45 46 54 5f 53 51 55 | |LEFT_SQU|
|00004c70| 41 52 45 5f 42 52 41 43 | 4b 45 54 2c 20 52 49 47 |ARE_BRAC|KET, RIG|
|00004c80| 48 54 5f 53 51 55 41 52 | 45 5f 42 52 41 43 4b 45 |HT_SQUAR|E_BRACKE|
|00004c90| 54 2c 0a 20 20 20 20 20 | 20 20 20 4c 45 46 54 5f |T,. | LEFT_|
|00004ca0| 43 55 52 4c 59 5f 42 52 | 41 43 4b 45 54 2c 20 52 |CURLY_BR|ACKET, R|
|00004cb0| 49 47 48 54 5f 43 55 52 | 4c 59 5f 42 52 41 43 4b |IGHT_CUR|LY_BRACK|
|00004cc0| 45 54 2c 0a 20 20 20 20 | 20 20 20 20 4d 41 54 48 |ET,. | MATH|
|00004cd0| 2c 20 44 4f 55 42 4c 45 | 5f 4d 41 54 48 2c 20 45 |, DOUBLE|_MATH, E|
|00004ce0| 53 43 41 50 45 5f 53 49 | 4e 47 4c 45 5f 43 48 41 |SCAPE_SI|NGLE_CHA|
|00004cf0| 52 0a 0a 20 20 20 20 7d | 20 65 6e 76 74 79 70 65 |R.. }| envtype|
|00004d00| 3b 0a 0a 2f 2a 20 73 6f | 6d 65 20 6f 66 20 74 68 |;../* so|me of th|
|00004d10| 65 20 69 6e 70 75 74 20 | 74 6f 6b 65 6e 73 20 63 |e input |tokens c|
|00004d20| 61 75 73 65 20 74 68 65 | 20 4c 61 54 65 58 20 65 |ause the| LaTeX e|
|00004d30| 6e 76 69 72 6f 6e 6d 65 | 6e 74 20 74 6f 20 62 65 |nvironme|nt to be|
|00004d40| 20 27 70 75 73 68 65 64 | 27 20 2a 2f 0a 2f 2a 20 | 'pushed|' */./* |
|00004d50| 66 6f 6c 6c 6f 77 69 6e | 67 20 69 73 20 74 68 65 |followin|g is the|
|00004d60| 20 64 65 66 69 6e 69 74 | 69 6f 6e 20 6f 66 20 74 | definit|ion of t|
|00004d70| 68 65 20 73 74 61 63 6b | 20 6f 6e 20 77 68 69 63 |he stack| on whic|
|00004d80| 68 20 74 68 65 73 65 20 | 74 6f 6b 65 6e 73 20 61 |h these |tokens a|
|00004d90| 72 65 20 73 74 6f 72 65 | 64 20 2a 2f 0a 20 20 20 |re store|d */. |
|00004da0| 20 0a 74 79 70 65 64 65 | 66 20 73 74 72 75 63 74 | .typede|f struct|
|00004db0| 20 7b 0a 20 20 20 65 6e | 76 74 79 70 65 20 65 74 | {. en|vtype et|
|00004dc0| 79 70 65 3b 0a 20 20 20 | 63 68 61 72 20 2a 6b 65 |ype;. |char *ke|
|00004dd0| 79 77 6f 72 64 3b 0a 20 | 20 20 69 6e 74 20 6c 69 |yword;. | int li|
|00004de0| 6e 65 6e 75 6d 3b 0a 20 | 7d 20 53 74 61 63 6b 5f |nenum;. |} Stack_|
|00004df0| 45 6e 74 72 79 2c 20 2a | 50 74 72 5f 53 74 61 63 |Entry, *|Ptr_Stac|
|00004e00| 6b 5f 45 6e 74 72 79 3b | 0a 0a 23 64 65 66 69 6e |k_Entry;|..#defin|
|00004e10| 65 20 4d 41 58 5f 45 4e | 54 52 49 45 53 20 31 30 |e MAX_EN|TRIES 10|
|00004e20| 30 30 30 0a 23 64 65 66 | 69 6e 65 20 4d 41 58 5f |000.#def|ine MAX_|
|00004e30| 4b 45 59 57 4f 52 44 5f | 4c 45 4e 47 54 48 20 31 |KEYWORD_|LENGTH 1|
|00004e40| 30 30 0a 20 0a 65 78 74 | 65 72 6e 20 53 74 61 63 |00. .ext|ern Stac|
|00004e50| 6b 5f 45 6e 74 72 79 20 | 4c 65 78 5f 53 74 61 63 |k_Entry |Lex_Stac|
|00004e60| 6b 5b 5d 3b 0a 65 78 74 | 65 72 6e 20 69 6e 74 20 |k[];.ext|ern int |
|00004e70| 4c 65 78 5f 54 4f 53 3b | 0a 0a 23 64 65 66 69 6e |Lex_TOS;|..#defin|
|00004e80| 65 20 53 74 61 63 6b 5f | 45 6d 70 74 79 20 28 4c |e Stack_|Empty (L|
|00004e90| 65 78 5f 54 4f 53 20 3c | 20 30 29 0a 0a 23 64 65 |ex_TOS <| 0)..#de|
|00004ea0| 66 69 6e 65 20 4c 43 42 | 20 27 7b 27 0a 23 64 65 |fine LCB| '{'.#de|
|00004eb0| 66 69 6e 65 20 52 43 42 | 20 27 7d 27 0a 23 64 65 |fine RCB| '}'.#de|
|00004ec0| 66 69 6e 65 20 4c 53 42 | 20 27 5b 27 0a 23 64 65 |fine LSB| '['.#de|
|00004ed0| 66 69 6e 65 20 52 53 42 | 20 27 5d 27 0a 23 64 65 |fine RSB| ']'.#de|
|00004ee0| 66 69 6e 65 20 4d 41 54 | 48 5f 43 48 41 52 20 27 |fine MAT|H_CHAR '|
|00004ef0| 24 27 0a 23 64 65 66 69 | 6e 65 20 45 53 43 41 50 |$'.#defi|ne ESCAP|
|00004f00| 45 20 27 5c 5c 27 0a 23 | 64 65 66 69 6e 65 20 43 |E '\\'.#|define C|
|00004f10| 4f 4d 4d 45 4e 54 20 27 | 25 27 0a 0a 23 64 65 66 |OMMENT '|%'..#def|
|00004f20| 69 6e 65 20 45 4e 44 53 | 54 52 49 4e 47 20 22 65 |ine ENDS|TRING "e|
|00004f30| 6e 64 22 0a 23 64 65 66 | 69 6e 65 20 42 45 47 49 |nd".#def|ine BEGI|
|00004f40| 4e 53 54 52 49 4e 47 20 | 22 62 65 67 69 6e 22 0a |NSTRING |"begin".|
|00004f50| 0a 2f 2a 20 74 68 65 73 | 65 20 61 72 65 20 74 68 |./* thes|e are th|
|00004f60| 65 20 70 6f 73 73 69 62 | 6c 65 20 61 63 74 69 6f |e possib|le actio|
|00004f70| 6e 73 20 77 65 20 63 61 | 6e 20 74 61 6b 65 20 77 |ns we ca|n take w|
|00004f80| 68 65 6e 20 77 65 20 73 | 65 65 20 61 20 74 6f 6b |hen we s|ee a tok|
|00004f90| 65 6e 2e 20 2a 2f 0a 2f | 2a 20 74 68 65 20 27 43 |en. */./|* the 'C|
|00004fa0| 48 45 43 4b 27 20 61 63 | 74 69 6f 6e 20 68 61 73 |HECK' ac|tion has|
|00004fb0| 20 6e 6f 74 20 62 65 65 | 6e 20 69 6d 70 6c 65 6d | not bee|n implem|
|00004fc0| 65 6e 74 65 64 2e 20 2a | 2f 0a 0a 74 79 70 65 64 |ented. *|/..typed|
|00004fd0| 65 66 20 65 6e 75 6d 20 | 7b 50 4f 50 2c 50 55 53 |ef enum |{POP,PUS|
|00004fe0| 48 2c 43 48 45 43 4b 5f | 53 49 4e 47 4c 45 2c 44 |H,CHECK_|SINGLE,D|
|00004ff0| 4f 4c 4c 41 52 2c 44 4f | 4c 4c 41 52 5f 44 4f 4c |OLLAR,DO|LLAR_DOL|
|00005000| 4c 41 52 2c 43 48 45 43 | 4b 7d 20 41 63 74 69 6f |LAR,CHEC|K} Actio|
|00005010| 6e 73 3b 0a 0a 2f 2a 20 | 77 65 20 6b 65 65 70 20 |ns;../* |we keep |
|00005020| 74 72 61 63 6b 20 6f 66 | 20 77 68 65 72 65 20 77 |track of| where w|
|00005030| 65 20 61 72 65 20 69 6e | 20 74 68 65 20 74 65 78 |e are in| the tex|
|00005040| 74 20 73 6f 20 77 65 20 | 63 61 6e 20 70 72 69 6e |t so we |can prin|
|00005050| 74 20 6f 75 74 20 6e 69 | 63 65 20 2a 2f 0a 2f 2a |t out ni|ce */./*|
|00005060| 20 65 72 72 6f 72 20 6d | 65 73 73 61 67 65 73 20 | error m|essages |
|00005070| 2a 2f 0a 0a 65 78 74 65 | 72 6e 20 6c 6f 6e 67 20 |*/..exte|rn long |
|00005080| 43 75 72 72 65 6e 74 5f | 4c 69 6e 65 2c 20 43 75 |Current_|Line, Cu|
|00005090| 72 72 65 6e 74 5f 43 68 | 61 72 3b 0a 65 78 74 65 |rrent_Ch|ar;.exte|
|000050a0| 72 6e 20 63 68 61 72 20 | 4c 69 6e 65 5f 42 75 66 |rn char |Line_Buf|
|000050b0| 66 65 72 5b 5d 3b 0a 23 | 64 65 66 69 6e 65 20 4d |fer[];.#|define M|
|000050c0| 41 58 4c 4c 20 31 30 32 | 34 0a 0a 65 78 74 65 72 |AXLL 102|4..exter|
|000050d0| 6e 20 49 6e 64 65 6e 74 | 5f 4c 65 76 65 6c 3b 20 |n Indent|_Level; |
|000050e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000050f0| 20 20 20 2f 2a 20 66 6f | 72 20 76 65 72 62 6f 73 | /* fo|r verbos|
|00005100| 65 20 70 72 65 74 74 79 | 20 70 72 69 6e 74 20 2a |e pretty| print *|
|00005110| 2f 0a 0a 65 78 74 65 72 | 6e 20 46 49 4c 45 20 2a |/..exter|n FILE *|
|00005120| 66 70 3b 0a 0a 2f 2a 20 | 74 68 69 73 20 69 73 20 |fp;../* |this is |
|00005130| 4c 61 54 65 58 27 73 20 | 64 65 66 69 6e 69 74 69 |LaTeX's |definiti|
|00005140| 6f 6e 20 6f 66 20 77 68 | 69 74 65 73 70 61 63 65 |on of wh|itespace|
|00005150| 20 2a 2f 0a 0a 23 64 65 | 66 69 6e 65 20 49 53 57 | */..#de|fine ISW|
|00005160| 48 49 54 45 28 78 29 20 | 28 28 78 29 20 3d 3d 20 |HITE(x) |((x) == |
|00005170| 27 20 27 20 7c 7c 20 28 | 78 29 20 3d 3d 20 27 5c |' ' || (|x) == '\|
|00005180| 74 27 29 0a 0a 23 64 65 | 66 69 6e 65 20 53 50 41 |t')..#de|fine SPA|
|00005190| 43 45 53 5f 50 45 52 5f | 49 4e 44 45 4e 54 5f 4c |CES_PER_|INDENT_L|
|000051a0| 45 56 45 4c 20 32 0a 53 | 48 41 52 5f 45 4f 46 0a |EVEL 2.S|HAR_EOF.|
|000051b0| 69 66 20 74 65 73 74 20 | 31 34 38 39 20 2d 6e 65 |if test |1489 -ne|
|000051c0| 20 22 60 77 63 20 2d 63 | 20 3c 20 27 74 65 78 63 | "`wc -c| < 'texc|
|000051d0| 68 6b 2e 68 27 60 22 0a | 74 68 65 6e 0a 09 65 63 |hk.h'`".|then..ec|
|000051e0| 68 6f 20 73 68 61 72 3a | 20 65 72 72 6f 72 20 74 |ho shar:| error t|
|000051f0| 72 61 6e 73 6d 69 74 74 | 69 6e 67 20 22 27 74 65 |ransmitt|ing "'te|
|00005200| 78 63 68 6b 2e 68 27 22 | 20 27 28 73 68 6f 75 6c |xchk.h'"| '(shoul|
|00005210| 64 20 68 61 76 65 20 62 | 65 65 6e 20 31 34 38 39 |d have b|een 1489|
|00005220| 20 63 68 61 72 61 63 74 | 65 72 73 29 27 0a 66 69 | charact|ers)'.fi|
|00005230| 0a 66 69 0a 65 63 68 6f | 20 73 68 61 72 3a 20 65 |.fi.echo| shar: e|
|00005240| 78 74 72 61 63 74 69 6e | 67 20 22 27 74 65 78 63 |xtractin|g "'texc|
|00005250| 68 6b 2e 63 27 22 20 27 | 28 31 36 37 31 32 20 63 |hk.c'" '|(16712 c|
|00005260| 68 61 72 61 63 74 65 72 | 73 29 27 0a 69 66 20 74 |haracter|s)'.if t|
|00005270| 65 73 74 20 2d 66 20 27 | 74 65 78 63 68 6b 2e 63 |est -f '|texchk.c|
|00005280| 27 0a 74 68 65 6e 0a 09 | 65 63 68 6f 20 73 68 61 |'.then..|echo sha|
|00005290| 72 3a 20 77 69 6c 6c 20 | 6e 6f 74 20 6f 76 65 72 |r: will |not over|
|000052a0| 2d 77 72 69 74 65 20 65 | 78 69 73 74 69 6e 67 20 |-write e|xisting |
|000052b0| 66 69 6c 65 20 22 27 74 | 65 78 63 68 6b 2e 63 27 |file "'t|exchk.c'|
|000052c0| 22 0a 65 6c 73 65 0a 63 | 61 74 20 3c 3c 20 5c 53 |".else.c|at << \S|
|000052d0| 48 41 52 5f 45 4f 46 20 | 3e 20 27 74 65 78 63 68 |HAR_EOF |> 'texch|
|000052e0| 6b 2e 63 27 0a 2f 2a 20 | 54 65 78 63 68 6b 20 2d |k.c'./* |Texchk -|
|000052f0| 2d 20 61 20 4c 61 54 65 | 58 20 73 79 6e 74 61 78 |- a LaTe|X syntax|
|00005300| 20 61 6e 64 20 73 70 65 | 6c 6c 69 6e 67 20 63 68 | and spe|lling ch|
|00005310| 65 63 6b 65 72 2e 0a 20 | 20 20 57 72 69 74 74 65 |ecker.. | Writte|
|00005320| 6e 20 62 79 20 4a 50 20 | 4d 61 73 73 61 72 2c 20 |n by JP |Massar, |
|00005330| 54 68 69 6e 6b 69 6e 67 | 20 4d 61 63 68 69 6e 65 |Thinking| Machine|
|00005340| 73 20 43 6f 72 70 6f 72 | 61 74 69 6f 6e 2c 20 43 |s Corpor|ation, C|
|00005350| 61 6d 62 72 69 64 67 65 | 2c 20 4d 41 0a 20 20 20 |ambridge|, MA. |
|00005360| 54 68 69 73 20 63 6f 64 | 65 20 69 73 20 68 65 72 |This cod|e is her|
|00005370| 65 62 79 20 72 65 6c 65 | 61 73 65 64 20 69 6e 74 |eby rele|ased int|
|00005380| 6f 20 74 68 65 20 70 75 | 62 6c 69 63 20 64 6f 6d |o the pu|blic dom|
|00005390| 61 69 6e 2c 20 66 6f 72 | 20 62 65 74 74 65 72 20 |ain, for| better |
|000053a0| 6f 72 20 77 6f 72 73 65 | 2e 0a 2a 2f 0a 0a 23 69 |or worse|..*/..#i|
|000053b0| 6e 63 6c 75 64 65 20 3c | 73 74 64 69 6f 2e 68 3e |nclude <|stdio.h>|
|000053c0| 0a 23 69 6e 63 6c 75 64 | 65 20 3c 63 74 79 70 65 |.#includ|e <ctype|
|000053d0| 2e 68 3e 0a 0a 2f 2a 20 | 69 66 20 79 6f 75 72 20 |.h>../* |if your |
|000053e0| 73 79 73 74 65 6d 20 64 | 6f 65 73 6e 27 74 20 68 |system d|oesn't h|
|000053f0| 61 76 65 20 65 69 74 68 | 65 72 20 73 74 72 69 6e |ave eith|er strin|
|00005400| 67 2e 68 20 6f 72 20 73 | 74 72 69 6e 67 73 2e 68 |g.h or s|trings.h|
|00005410| 20 79 6f 75 20 2a 2f 0a | 2f 2a 20 6d 61 79 20 68 | you */.|/* may h|
|00005420| 61 76 65 20 74 6f 20 64 | 65 63 6c 61 72 65 20 74 |ave to d|eclare t|
|00005430| 68 65 20 73 74 72 69 6e | 67 20 66 75 6e 63 74 69 |he strin|g functi|
|00005440| 6f 6e 73 20 79 6f 75 72 | 73 65 6c 66 20 2a 2f 0a |ons your|self */.|
|00005450| 23 69 66 64 65 66 20 42 | 53 44 34 32 0a 23 69 6e |#ifdef B|SD42.#in|
|00005460| 63 6c 75 64 65 20 3c 73 | 74 72 69 6e 67 73 2e 68 |clude <s|trings.h|
|00005470| 3e 0a 23 65 6c 73 65 0a | 23 69 6e 63 6c 75 64 65 |>.#else.|#include|
|00005480| 20 3c 73 74 72 69 6e 67 | 2e 68 3e 0a 23 65 6e 64 | <string|.h>.#end|
|00005490| 69 66 0a 0a 23 69 66 64 | 65 66 20 54 4d 43 0a 23 |if..#ifd|ef TMC.#|
|000054a0| 69 6e 63 6c 75 64 65 20 | 3c 63 74 6f 6f 6c 73 2e |include |<ctools.|
|000054b0| 68 3e 0a 23 65 6c 73 65 | 0a 23 69 6e 63 6c 75 64 |h>.#else|.#includ|
|000054c0| 65 20 22 63 74 6f 6f 6c | 73 2e 68 22 0a 23 65 6e |e "ctool|s.h".#en|
|000054d0| 64 69 66 0a 0a 23 69 6e | 63 6c 75 64 65 20 22 74 |dif..#in|clude "t|
|000054e0| 65 78 63 68 6b 2e 68 22 | 0a 23 69 6e 63 6c 75 64 |exchk.h"|.#includ|
|000054f0| 65 20 22 63 6d 64 73 2e | 68 22 0a 23 69 6e 63 6c |e "cmds.|h".#incl|
|00005500| 75 64 65 20 22 74 65 78 | 63 68 61 72 73 2e 68 22 |ude "tex|chars.h"|
|00005510| 0a 0a 42 6f 6f 6c 20 56 | 65 72 62 6f 73 65 5f 4d |..Bool V|erbose_M|
|00005520| 6f 64 65 20 3d 20 46 3b | 20 20 20 20 20 20 20 20 |ode = F;| |
|00005530| 20 20 20 20 20 20 20 20 | 20 20 2f 2a 20 2d 76 20 | | /* -v |
|00005540| 6f 70 74 69 6f 6e 20 2a | 2f 0a 42 6f 6f 6c 20 43 |option *|/.Bool C|
|00005550| 68 65 63 6b 5f 4d 6f 64 | 65 20 3d 20 46 3b 20 20 |heck_Mod|e = F; |
|00005560| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005570| 20 20 2f 2a 20 2d 63 20 | 6f 70 74 69 6f 6e 20 2a | /* -c |option *|
|00005580| 2f 0a 0a 69 6e 74 20 49 | 6e 64 65 6e 74 5f 4c 65 |/..int I|ndent_Le|
|00005590| 76 65 6c 20 3d 20 30 3b | 20 20 20 20 20 20 20 20 |vel = 0;| |
|000055a0| 20 20 20 20 20 20 20 20 | 20 20 20 2f 2a 20 66 6f | | /* fo|
|000055b0| 72 20 76 65 72 62 6f 73 | 65 20 6f 75 74 70 75 74 |r verbos|e output|
|000055c0| 20 6d 6f 64 65 20 2a 2f | 0a 0a 53 74 61 63 6b 5f | mode */|..Stack_|
|000055d0| 45 6e 74 72 79 20 4c 65 | 78 5f 53 74 61 63 6b 5b |Entry Le|x_Stack[|
|000055e0| 4d 41 58 5f 45 4e 54 52 | 49 45 53 5d 3b 20 20 20 |MAX_ENTR|IES]; |
|000055f0| 20 20 2f 2a 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 | /* env|ironment|
|00005600| 20 73 74 61 63 6b 20 2a | 2f 0a 69 6e 74 20 4c 65 | stack *|/.int Le|
|00005610| 78 5f 54 4f 53 20 3d 20 | 2d 31 3b 0a 0a 46 49 4c |x_TOS = |-1;..FIL|
|00005620| 45 20 2a 66 70 3b 20 20 | 20 20 20 20 20 20 20 20 |E *fp; | |
|00005630| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005640| 20 20 20 20 20 2f 2a 20 | 66 69 6c 65 20 62 65 69 | /* |file bei|
|00005650| 6e 67 20 70 72 6f 63 65 | 73 73 65 64 20 2a 2f 0a |ng proce|ssed */.|
|00005660| 42 6f 6f 6c 20 41 6c 72 | 65 61 64 79 5f 41 74 5f |Bool Alr|eady_At_|
|00005670| 45 6f 66 20 3d 20 46 3b | 0a 0a 6c 6f 6e 67 20 43 |Eof = F;|..long C|
|00005680| 75 72 72 65 6e 74 5f 4c | 69 6e 65 20 3d 20 30 3b |urrent_L|ine = 0;|
|00005690| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000056a0| 20 20 2f 2a 20 77 68 65 | 72 65 20 77 65 20 61 72 | /* whe|re we ar|
|000056b0| 65 20 69 6e 20 69 6e 70 | 75 74 20 74 65 78 74 20 |e in inp|ut text |
|000056c0| 2a 2f 0a 6c 6f 6e 67 20 | 43 75 72 72 65 6e 74 5f |*/.long |Current_|
|000056d0| 43 68 61 72 20 3d 20 30 | 3b 20 20 20 20 20 20 20 |Char = 0|; |
|000056e0| 20 20 20 20 20 20 20 20 | 20 20 20 2f 2a 20 77 68 | | /* wh|
|000056f0| 65 72 65 20 77 65 20 61 | 72 65 20 69 6e 20 69 6e |ere we a|re in in|
|00005700| 70 75 74 20 74 65 78 74 | 20 2a 2f 0a 6c 6f 6e 67 |put text| */.long|
|00005710| 20 4c 69 6e 65 5f 4c 65 | 6e 67 74 68 20 3d 20 30 | Line_Le|ngth = 0|
|00005720| 3b 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |; | |
|00005730| 20 20 20 20 2f 2a 20 63 | 75 72 72 65 6e 74 20 6c | /* c|urrent l|
|00005740| 69 6e 65 20 6c 65 6e 67 | 74 68 20 2a 2f 0a 63 68 |ine leng|th */.ch|
|00005750| 61 72 20 4c 69 6e 65 5f | 42 75 66 66 65 72 5b 4d |ar Line_|Buffer[M|
|00005760| 41 58 4c 4c 5d 3b 20 20 | 20 20 20 20 20 20 20 20 |AXLL]; | |
|00005770| 20 20 20 20 20 20 2f 2a | 20 62 75 66 66 65 72 20 | /*| buffer |
|00005780| 66 6f 72 20 69 6e 70 75 | 74 20 74 65 78 74 20 2a |for inpu|t text *|
|00005790| 2f 0a 0a 42 6f 6f 6c 20 | 49 6e 5f 4d 61 74 68 5f |/..Bool |In_Math_|
|000057a0| 4d 6f 64 65 20 3d 20 46 | 3b 0a 69 6e 74 20 4d 61 |Mode = F|;.int Ma|
|000057b0| 74 68 5f 4d 6f 64 65 5f | 44 65 70 74 68 20 3d 20 |th_Mode_|Depth = |
|000057c0| 30 3b 0a 0a 63 68 61 72 | 20 4b 65 79 77 6f 72 64 |0;..char| Keyword|
|000057d0| 5f 42 75 66 66 65 72 5b | 4d 41 58 5f 4b 45 59 57 |_Buffer[|MAX_KEYW|
|000057e0| 4f 52 44 5f 4c 45 4e 47 | 54 48 5d 3b 0a 0a 0a 6e |ORD_LENG|TH];...n|
|000057f0| 65 77 5f 66 69 6c 65 20 | 28 29 0a 7b 0a 20 20 43 |ew_file |().{. C|
|00005800| 75 72 72 65 6e 74 5f 4c | 69 6e 65 20 3d 20 30 3b |urrent_L|ine = 0;|
|00005810| 0a 20 20 43 75 72 72 65 | 6e 74 5f 43 68 61 72 20 |. Curre|nt_Char |
|00005820| 3d 20 30 3b 0a 20 20 4c | 69 6e 65 5f 4c 65 6e 67 |= 0;. L|ine_Leng|
|00005830| 74 68 20 3d 20 30 3b 0a | 20 20 49 6e 5f 4d 61 74 |th = 0;.| In_Mat|
|00005840| 68 5f 4d 6f 64 65 20 3d | 20 46 3b 0a 20 20 4d 61 |h_Mode =| F;. Ma|
|00005850| 74 68 5f 4d 6f 64 65 5f | 44 65 70 74 68 20 3d 20 |th_Mode_|Depth = |
|00005860| 30 3b 0a 20 20 49 6e 64 | 65 6e 74 5f 4c 65 76 65 |0;. Ind|ent_Leve|
|00005870| 6c 20 3d 20 30 3b 0a 7d | 20 20 0a 20 20 20 20 20 |l = 0;.}| . |
|00005880| 20 20 20 0a 64 6f 5f 69 | 6e 64 65 6e 74 20 28 6c | .do_i|ndent (l|
|00005890| 65 76 65 6c 29 20 69 6e | 74 20 6c 65 76 65 6c 3b |evel) in|t level;|
|000058a0| 0a 7b 0a 20 20 69 6e 74 | 20 6a 2c 69 3b 0a 20 20 |.{. int| j,i;. |
|000058b0| 66 6f 72 20 28 6a 20 3d | 20 30 3b 20 6a 20 3c 20 |for (j =| 0; j < |
|000058c0| 6c 65 76 65 6c 3b 20 6a | 2b 2b 29 0a 20 20 20 20 |level; j|++). |
|000058d0| 20 20 66 6f 72 20 28 69 | 20 3d 20 30 3b 20 69 20 | for (i| = 0; i |
|000058e0| 3c 20 53 50 41 43 45 53 | 5f 50 45 52 5f 49 4e 44 |< SPACES|_PER_IND|
|000058f0| 45 4e 54 5f 4c 45 56 45 | 4c 3b 20 69 2b 2b 29 20 |ENT_LEVE|L; i++) |
|00005900| 70 75 74 63 28 27 20 27 | 2c 73 74 64 65 72 72 29 |putc(' '|,stderr)|
|00005910| 3b 0a 7d 0a 0a 0a 6c 65 | 78 5f 70 75 73 68 20 28 |;.}...le|x_push (|
|00005920| 65 74 79 70 65 2c 6b 65 | 79 77 6f 72 64 2c 6c 69 |etype,ke|yword,li|
|00005930| 6e 65 6e 75 6d 29 20 65 | 6e 76 74 79 70 65 20 65 |nenum) e|nvtype e|
|00005940| 74 79 70 65 3b 20 63 68 | 61 72 20 2a 6b 65 79 77 |type; ch|ar *keyw|
|00005950| 6f 72 64 3b 20 6c 6f 6e | 67 20 6c 69 6e 65 6e 75 |ord; lon|g linenu|
|00005960| 6d 3b 0a 0a 2f 2a 20 70 | 75 73 68 20 61 6e 20 65 |m;../* p|ush an e|
|00005970| 6e 76 69 72 6f 6e 6d 65 | 6e 74 20 6f 6e 74 6f 20 |nvironme|nt onto |
|00005980| 74 68 65 20 73 74 61 63 | 6b 20 2a 2f 0a 0a 7b 0a |the stac|k */..{.|
|00005990| 20 20 69 66 20 28 2b 2b | 4c 65 78 5f 54 4f 53 20 | if (++|Lex_TOS |
|000059a0| 3e 3d 20 4d 41 58 5f 45 | 4e 54 52 49 45 53 29 20 |>= MAX_E|NTRIES) |
|000059b0| 7b 0a 20 20 20 20 20 66 | 70 72 69 6e 74 66 28 73 |{. f|printf(s|
|000059c0| 74 64 65 72 72 2c 22 53 | 74 61 63 6b 20 6f 76 65 |tderr,"S|tack ove|
|000059d0| 72 66 6c 6f 77 2e 2e 2e | 50 72 6f 63 65 73 73 20 |rflow...|Process |
|000059e0| 74 65 72 6d 69 6e 61 74 | 69 6e 67 2e 5c 6e 22 29 |terminat|ing.\n")|
|000059f0| 3b 0a 20 20 20 20 20 74 | 65 78 69 74 28 29 3b 0a |;. t|exit();.|
|00005a00| 20 20 7d 0a 20 20 4c 65 | 78 5f 53 74 61 63 6b 5b | }. Le|x_Stack[|
|00005a10| 4c 65 78 5f 54 4f 53 5d | 2e 65 74 79 70 65 20 3d |Lex_TOS]|.etype =|
|00005a20| 20 65 74 79 70 65 3b 0a | 20 20 4c 65 78 5f 53 74 | etype;.| Lex_St|
|00005a30| 61 63 6b 5b 4c 65 78 5f | 54 4f 53 5d 2e 6b 65 79 |ack[Lex_|TOS].key|
|00005a40| 77 6f 72 64 20 3d 20 6b | 65 79 77 6f 72 64 3b 0a |word = k|eyword;.|
|00005a50| 20 20 4c 65 78 5f 53 74 | 61 63 6b 5b 4c 65 78 5f | Lex_St|ack[Lex_|
|00005a60| 54 4f 53 5d 2e 6c 69 6e | 65 6e 75 6d 20 3d 20 6c |TOS].lin|enum = l|
|00005a70| 69 6e 65 6e 75 6d 3b 0a | 7d 0a 0a 0a 6c 65 78 5f |inenum;.|}...lex_|
|00005a80| 70 6f 70 20 28 70 74 72 | 5f 65 74 79 70 65 2c 70 |pop (ptr|_etype,p|
|00005a90| 74 72 5f 6b 65 79 77 6f | 72 64 2c 70 74 72 5f 6c |tr_keywo|rd,ptr_l|
|00005aa0| 69 6e 65 6e 75 6d 29 0a | 0a 2f 2a 20 70 6f 70 20 |inenum).|./* pop |
|00005ab0| 61 6e 20 65 6e 76 69 72 | 6f 6e 6d 65 6e 74 20 61 |an envir|onment a|
|00005ac0| 6e 64 20 72 65 74 75 72 | 6e 20 69 74 73 20 63 6f |nd retur|n its co|
|00005ad0| 6d 70 6f 6e 65 6e 74 73 | 20 2a 2f 0a 0a 20 20 65 |mponents| */.. e|
|00005ae0| 6e 76 74 79 70 65 20 2a | 70 74 72 5f 65 74 79 70 |nvtype *|ptr_etyp|
|00005af0| 65 3b 0a 20 20 63 68 61 | 72 20 2a 2a 70 74 72 5f |e;. cha|r **ptr_|
|00005b00| 6b 65 79 77 6f 72 64 3b | 0a 20 20 6c 6f 6e 67 20 |keyword;|. long |
|00005b10| 2a 70 74 72 5f 6c 69 6e | 65 6e 75 6d 3b 0a 0a 7b |*ptr_lin|enum;..{|
|00005b20| 0a 20 20 69 66 20 28 4c | 65 78 5f 54 4f 53 20 3c |. if (L|ex_TOS <|
|00005b30| 20 30 29 20 7b 0a 20 20 | 20 20 20 66 70 72 69 6e | 0) {. | fprin|
|00005b40| 74 66 28 73 74 64 65 72 | 72 2c 22 53 74 61 63 6b |tf(stder|r,"Stack|
|00005b50| 20 75 6e 64 65 72 66 6c | 6f 77 2e 2e 2e 50 72 6f | underfl|ow...Pro|
|00005b60| 63 65 73 73 20 74 65 72 | 6d 69 6e 61 74 69 6e 67 |cess ter|minating|
|00005b70| 5c 6e 22 29 3b 0a 20 20 | 20 20 20 74 65 78 69 74 |\n");. | texit|
|00005b80| 28 29 3b 0a 20 20 7d 0a | 20 20 2a 70 74 72 5f 65 |();. }.| *ptr_e|
|00005b90| 74 79 70 65 20 3d 20 4c | 65 78 5f 53 74 61 63 6b |type = L|ex_Stack|
|00005ba0| 5b 4c 65 78 5f 54 4f 53 | 5d 2e 65 74 79 70 65 3b |[Lex_TOS|].etype;|
|00005bb0| 0a 20 20 2a 70 74 72 5f | 6b 65 79 77 6f 72 64 20 |. *ptr_|keyword |
|00005bc0| 3d 20 4c 65 78 5f 53 74 | 61 63 6b 5b 4c 65 78 5f |= Lex_St|ack[Lex_|
|00005bd0| 54 4f 53 5d 2e 6b 65 79 | 77 6f 72 64 3b 0a 20 20 |TOS].key|word;. |
|00005be0| 2a 70 74 72 5f 6c 69 6e | 65 6e 75 6d 20 3d 20 4c |*ptr_lin|enum = L|
|00005bf0| 65 78 5f 53 74 61 63 6b | 5b 4c 65 78 5f 54 4f 53 |ex_Stack|[Lex_TOS|
|00005c00| 5d 2e 6c 69 6e 65 6e 75 | 6d 3b 0a 20 20 4c 65 78 |].linenu|m;. Lex|
|00005c10| 5f 54 4f 53 2d 2d 3b 0a | 7d 0a 0a 0a 63 75 72 73 |_TOS--;.|}...curs|
|00005c20| 74 61 63 6b 20 28 70 74 | 72 5f 65 74 79 70 65 2c |tack (pt|r_etype,|
|00005c30| 70 74 72 5f 6b 65 79 77 | 6f 72 64 2c 70 74 72 5f |ptr_keyw|ord,ptr_|
|00005c40| 6c 69 6e 65 6e 75 6d 29 | 0a 0a 20 20 2f 2a 20 67 |linenum)|.. /* g|
|00005c50| 65 74 20 74 68 65 20 63 | 6f 6d 70 6f 6e 65 6e 74 |et the c|omponent|
|00005c60| 73 20 6f 66 20 74 68 65 | 20 63 75 72 72 65 6e 74 |s of the| current|
|00005c70| 20 73 74 61 63 6b 20 65 | 6e 74 72 79 2c 20 62 75 | stack e|ntry, bu|
|00005c80| 74 20 6c 65 61 76 65 20 | 74 68 65 20 65 6e 74 72 |t leave |the entr|
|00005c90| 79 20 2a 2f 0a 20 20 2f | 2a 20 6f 6e 20 74 68 65 |y */. /|* on the|
|00005ca0| 20 73 74 61 63 6b 2e 20 | 2a 2f 0a 0a 20 20 65 6e | stack. |*/.. en|
|00005cb0| 76 74 79 70 65 20 2a 70 | 74 72 5f 65 74 79 70 65 |vtype *p|tr_etype|
|00005cc0| 3b 0a 20 20 63 68 61 72 | 20 2a 2a 70 74 72 5f 6b |;. char| **ptr_k|
|00005cd0| 65 79 77 6f 72 64 3b 0a | 20 20 6c 6f 6e 67 20 2a |eyword;.| long *|
|00005ce0| 70 74 72 5f 6c 69 6e 65 | 6e 75 6d 3b 0a 0a 7b 0a |ptr_line|num;..{.|
|00005cf0| 20 20 69 66 20 28 53 74 | 61 63 6b 5f 45 6d 70 74 | if (St|ack_Empt|
|00005d00| 79 29 20 7b 0a 20 20 20 | 20 20 66 70 72 69 6e 74 |y) {. | fprint|
|00005d10| 66 28 73 74 64 65 72 72 | 2c 22 46 61 74 61 6c 20 |f(stderr|,"Fatal |
|00005d20| 65 72 72 6f 72 2c 20 62 | 61 64 20 63 61 6c 6c 20 |error, b|ad call |
|00005d30| 74 6f 20 63 75 72 73 74 | 61 63 6b 5c 6e 22 29 3b |to curst|ack\n");|
|00005d40| 0a 20 20 20 20 20 74 65 | 78 69 74 28 29 3b 0a 20 |. te|xit();. |
|00005d50| 20 7d 0a 20 20 6c 65 78 | 5f 70 6f 70 28 70 74 72 | }. lex|_pop(ptr|
|00005d60| 5f 65 74 79 70 65 2c 70 | 74 72 5f 6b 65 79 77 6f |_etype,p|tr_keywo|
|00005d70| 72 64 2c 70 74 72 5f 6c | 69 6e 65 6e 75 6d 29 3b |rd,ptr_l|inenum);|
|00005d80| 0a 20 20 6c 65 78 5f 70 | 75 73 68 28 2a 70 74 72 |. lex_p|ush(*ptr|
|00005d90| 5f 65 74 79 70 65 2c 2a | 70 74 72 5f 6b 65 79 77 |_etype,*|ptr_keyw|
|00005da0| 6f 72 64 2c 2a 70 74 72 | 5f 6c 69 6e 65 6e 75 6d |ord,*ptr|_linenum|
|00005db0| 29 3b 0a 7d 0a 0a 0a 63 | 68 61 72 20 2a 63 6f 70 |);.}...c|har *cop|
|00005dc0| 79 5f 6b 65 79 77 6f 72 | 64 20 28 73 74 61 72 74 |y_keywor|d (start|
|00005dd0| 74 6f 6b 65 6e 2c 65 6e | 64 74 6f 6b 65 6e 29 20 |token,en|dtoken) |
|00005de0| 69 6e 74 20 73 74 61 72 | 74 74 6f 6b 65 6e 2c 65 |int star|ttoken,e|
|00005df0| 6e 64 74 6f 6b 65 6e 3b | 0a 0a 2f 2a 20 67 72 61 |ndtoken;|../* gra|
|00005e00| 62 20 61 20 6b 65 79 77 | 6f 72 64 20 66 72 6f 6d |b a keyw|ord from|
|00005e10| 20 74 68 65 20 4c 69 6e | 65 5f 42 75 66 66 65 72 | the Lin|e_Buffer|
|00005e20| 20 61 6e 64 20 63 6f 70 | 79 20 69 74 20 69 6e 74 | and cop|y it int|
|00005e30| 6f 20 61 20 73 74 61 74 | 69 63 20 62 75 66 66 65 |o a stat|ic buffe|
|00005e40| 72 20 2a 2f 0a 0a 7b 0a | 20 20 69 6e 74 20 6c 65 |r */..{.| int le|
|00005e50| 6e 3b 0a 20 20 69 66 20 | 28 4d 41 58 5f 4b 45 59 |n;. if |(MAX_KEY|
|00005e60| 57 4f 52 44 5f 4c 45 4e | 47 54 48 20 3c 3d 20 28 |WORD_LEN|GTH <= (|
|00005e70| 6c 65 6e 20 3d 20 28 65 | 6e 64 74 6f 6b 65 6e 20 |len = (e|ndtoken |
|00005e80| 2d 20 73 74 61 72 74 74 | 6f 6b 65 6e 29 20 2b 20 |- startt|oken) + |
|00005e90| 31 29 29 20 7b 0a 20 20 | 20 20 20 6b 65 79 77 6f |1)) {. | keywo|
|00005ea0| 72 64 5f 6c 65 6e 67 74 | 68 5f 65 72 72 6f 72 28 |rd_lengt|h_error(|
|00005eb0| 29 3b 0a 20 20 20 20 20 | 74 65 78 69 74 28 29 3b |);. |texit();|
|00005ec0| 0a 20 20 7d 0a 20 20 73 | 74 72 6e 63 70 79 28 4b |. }. s|trncpy(K|
|00005ed0| 65 79 77 6f 72 64 5f 42 | 75 66 66 65 72 2c 4c 69 |eyword_B|uffer,Li|
|00005ee0| 6e 65 5f 42 75 66 66 65 | 72 20 2b 20 73 74 61 72 |ne_Buffe|r + star|
|00005ef0| 74 74 6f 6b 65 6e 2c 6c | 65 6e 29 3b 0a 20 20 4b |ttoken,l|en);. K|
|00005f00| 65 79 77 6f 72 64 5f 42 | 75 66 66 65 72 5b 6c 65 |eyword_B|uffer[le|
|00005f10| 6e 5d 20 3d 20 27 5c 30 | 27 3b 0a 20 20 72 65 74 |n] = '\0|';. ret|
|00005f20| 75 72 6e 28 4b 65 79 77 | 6f 72 64 5f 42 75 66 66 |urn(Keyw|ord_Buff|
|00005f30| 65 72 29 3b 0a 7d 0a 0a | 0a 64 6f 5f 70 6f 70 20 |er);.}..|.do_pop |
|00005f40| 28 65 74 79 70 65 2c 6b | 65 79 77 6f 72 64 29 20 |(etype,k|eyword) |
|00005f50| 65 6e 76 74 79 70 65 20 | 65 74 79 70 65 3b 20 63 |envtype |etype; c|
|00005f60| 68 61 72 20 2a 6b 65 79 | 77 6f 72 64 3b 0a 0a 2f |har *key|word;../|
|00005f70| 2a 20 6d 61 6b 65 20 73 | 75 72 65 20 74 68 61 74 |* make s|ure that|
|00005f80| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 65 6e 76 | the cur|rent env|
|00005f90| 69 72 6f 6e 6d 65 6e 74 | 20 69 73 20 74 68 65 20 |ironment| is the |
|00005fa0| 6d 61 74 63 68 69 6e 67 | 20 62 65 67 69 6e 2d 65 |matching| begin-e|
|00005fb0| 6e 76 69 72 6f 6e 6d 65 | 6e 74 20 2a 2f 0a 2f 2a |nvironme|nt */./*|
|00005fc0| 20 66 6f 72 20 74 68 65 | 20 65 6e 64 2d 65 6e 76 | for the| end-env|
|00005fd0| 69 72 6f 6e 6d 65 6e 74 | 20 74 68 61 74 20 77 65 |ironment| that we|
|00005fe0| 20 68 61 76 65 20 6a 75 | 73 74 20 64 69 73 63 6f | have ju|st disco|
|00005ff0| 76 65 72 65 64 2e 20 20 | 49 66 20 73 6f 2c 20 70 |vered. |If so, p|
|00006000| 6f 70 20 74 68 65 20 2a | 2f 0a 2f 2a 20 65 6e 76 |op the *|/./* env|
|00006010| 69 72 6f 6e 6d 65 6e 74 | 20 6f 66 66 20 74 68 65 |ironment| off the|
|00006020| 20 73 74 61 63 6b 2e 20 | 20 20 49 66 20 6e 6f 74 | stack. | If not|
|00006030| 20 69 74 73 20 61 6e 20 | 65 72 72 6f 72 2e 20 2a | its an |error. *|
|00006040| 2f 0a 0a 7b 0a 20 20 20 | 20 20 20 20 20 0a 20 20 |/..{. | . |
|00006050| 65 6e 76 74 79 70 65 20 | 6f 6c 64 65 74 79 70 65 |envtype |oldetype|
|00006060| 3b 0a 20 20 63 68 61 72 | 20 2a 6f 6c 64 6b 65 79 |;. char| *oldkey|
|00006070| 77 6f 72 64 3b 0a 20 20 | 6c 6f 6e 67 20 6f 6c 64 |word;. |long old|
|00006080| 6c 69 6e 65 6e 75 6d 3b | 0a 20 20 63 68 61 72 20 |linenum;|. char |
|00006090| 2a 73 2c 20 2a 65 3b 0a | 20 20 20 20 20 20 20 20 |*s, *e;.| |
|000060a0| 0a 20 20 6c 65 78 5f 70 | 6f 70 28 26 6f 6c 64 65 |. lex_p|op(&olde|
|000060b0| 74 79 70 65 2c 26 6f 6c | 64 6b 65 79 77 6f 72 64 |type,&ol|dkeyword|
|000060c0| 2c 26 6f 6c 64 6c 69 6e | 65 6e 75 6d 29 3b 0a 20 |,&oldlin|enum);. |
|000060d0| 20 20 20 20 20 20 20 0a | 20 20 73 77 69 74 63 68 | .| switch|
|000060e0| 20 28 65 74 79 70 65 29 | 20 7b 0a 20 20 20 20 20 | (etype)| {. |
|000060f0| 0a 20 20 20 20 63 61 73 | 65 20 45 53 43 41 50 45 |. cas|e ESCAPE|
|00006100| 5f 45 4e 44 20 3a 0a 20 | 20 20 20 20 20 73 20 3d |_END :. | s =|
|00006110| 20 22 5c 5c 62 65 67 69 | 6e 22 3b 0a 20 20 20 20 | "\\begi|n";. |
|00006120| 20 20 65 20 3d 20 22 5c | 5c 65 6e 64 22 3b 0a 20 | e = "\|\end";. |
|00006130| 20 20 20 20 20 69 66 20 | 28 6f 6c 64 65 74 79 70 | if |(oldetyp|
|00006140| 65 20 21 3d 20 45 53 43 | 41 50 45 5f 42 45 47 49 |e != ESC|APE_BEGI|
|00006150| 4e 29 20 67 6f 74 6f 20 | 6e 65 73 74 65 72 72 6f |N) goto |nesterro|
|00006160| 72 3b 0a 20 20 20 20 20 | 20 69 66 20 28 30 20 21 |r;. | if (0 !|
|00006170| 3d 20 73 74 72 63 6d 70 | 28 6f 6c 64 6b 65 79 77 |= strcmp|(oldkeyw|
|00006180| 6f 72 64 2c 6b 65 79 77 | 6f 72 64 29 29 20 67 6f |ord,keyw|ord)) go|
|00006190| 74 6f 20 6e 65 73 74 65 | 72 72 6f 72 3b 0a 20 20 |to neste|rror;. |
|000061a0| 20 20 20 20 62 72 65 61 | 6b 3b 0a 0a 20 20 20 20 | brea|k;.. |
|000061b0| 63 61 73 65 20 52 49 47 | 48 54 5f 53 51 55 41 52 |case RIG|HT_SQUAR|
|000061c0| 45 5f 42 52 41 43 4b 45 | 54 20 3a 0a 20 20 20 20 |E_BRACKE|T :. |
|000061d0| 20 20 73 20 3d 20 22 5b | 22 3b 0a 20 20 20 20 20 | s = "[|";. |
|000061e0| 20 65 20 3d 20 22 5d 22 | 3b 0a 20 20 20 20 20 20 | e = "]"|;. |
|000061f0| 69 66 20 28 6f 6c 64 65 | 74 79 70 65 20 21 3d 20 |if (olde|type != |
|00006200| 4c 45 46 54 5f 53 51 55 | 41 52 45 5f 42 52 41 43 |LEFT_SQU|ARE_BRAC|
|00006210| 4b 45 54 29 20 67 6f 74 | 6f 20 6e 65 73 74 65 72 |KET) got|o nester|
|00006220| 72 6f 72 3b 0a 20 20 20 | 20 20 20 62 72 65 61 6b |ror;. | break|
|00006230| 3b 0a 0a 20 20 20 20 63 | 61 73 65 20 52 49 47 48 |;.. c|ase RIGH|
|00006240| 54 5f 43 55 52 4c 59 5f | 42 52 41 43 4b 45 54 20 |T_CURLY_|BRACKET |
|00006250| 3a 0a 20 20 20 20 20 20 | 73 20 3d 20 22 7b 22 3b |:. |s = "{";|
|00006260| 0a 20 20 20 20 20 20 65 | 20 3d 20 22 7d 22 3b 0a |. e| = "}";.|
|00006270| 20 20 20 20 20 20 69 66 | 20 28 6f 6c 64 65 74 79 | if| (oldety|
|00006280| 70 65 20 21 3d 20 4c 45 | 46 54 5f 43 55 52 4c 59 |pe != LE|FT_CURLY|
|00006290| 5f 42 52 41 43 4b 45 54 | 29 20 67 6f 74 6f 20 6e |_BRACKET|) goto n|
|000062a0| 65 73 74 65 72 72 6f 72 | 3b 0a 20 20 20 20 20 20 |esterror|;. |
|000062b0| 62 72 65 61 6b 3b 0a 0a | 20 20 20 20 63 61 73 65 |break;..| case|
|000062c0| 20 4d 41 54 48 20 3a 0a | 20 20 20 20 20 20 73 20 | MATH :.| s |
|000062d0| 3d 20 22 42 65 67 69 6e | 20 4d 61 74 68 20 4d 6f |= "Begin| Math Mo|
|000062e0| 64 65 22 3b 0a 20 20 20 | 20 20 20 65 20 3d 20 22 |de";. | e = "|
|000062f0| 45 6e 64 20 4d 61 74 68 | 20 4d 6f 64 65 22 3b 0a |End Math| Mode";.|
|00006300| 20 20 20 20 20 20 69 66 | 20 28 6f 6c 64 65 74 79 | if| (oldety|
|00006310| 70 65 20 21 3d 20 65 74 | 79 70 65 29 20 67 6f 74 |pe != et|ype) got|
|00006320| 6f 20 6e 65 73 74 65 72 | 72 6f 72 3b 0a 20 20 20 |o nester|ror;. |
|00006330| 20 20 20 62 72 65 61 6b | 3b 0a 20 20 20 20 20 20 | break|;. |
|00006340| 0a 20 20 20 20 63 61 73 | 65 20 44 4f 55 42 4c 45 |. cas|e DOUBLE|
|00006350| 5f 4d 41 54 48 20 3a 0a | 20 20 20 20 20 20 73 20 |_MATH :.| s |
|00006360| 3d 20 22 42 65 67 69 6e | 20 44 69 73 70 6c 61 79 |= "Begin| Display|
|00006370| 20 4d 61 74 68 20 4d 6f | 64 65 22 3b 0a 20 20 20 | Math Mo|de";. |
|00006380| 20 20 20 65 20 3d 20 22 | 45 6e 64 20 44 69 73 70 | e = "|End Disp|
|00006390| 6c 61 79 20 4d 61 74 68 | 20 4d 6f 64 65 22 3b 0a |lay Math| Mode";.|
|000063a0| 20 20 20 20 20 20 69 66 | 20 28 6f 6c 64 65 74 79 | if| (oldety|
|000063b0| 70 65 20 21 3d 20 65 74 | 79 70 65 29 20 67 6f 74 |pe != et|ype) got|
|000063c0| 6f 20 6e 65 73 74 65 72 | 72 6f 72 3b 0a 20 20 20 |o nester|ror;. |
|000063d0| 20 20 20 62 72 65 61 6b | 3b 0a 0a 20 20 7d 0a 0a | break|;.. }..|
|000063e0| 20 20 72 65 74 75 72 6e | 28 30 29 3b 0a 0a 20 20 | return|(0);.. |
|000063f0| 6e 65 73 74 65 72 72 6f | 72 3a 0a 0a 20 20 6e 65 |nesterro|r:.. ne|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.