home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / unix / volume06 / ditrev < prev    next >
SHell self-extracting ARchive  |  1988-09-11  |  11.0 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

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

You can browse this item here: ditrev

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert SHell self-extracting ARchive (archive/shar) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% 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| 53 75 62 6a 65 63 74 3a | 20 76 30 36 69 30 34 32 |Subject:| v06i042|
|00000010| 3a 20 20 50 61 67 65 20 | 72 65 76 65 72 73 65 72 |: Page |reverser|
|00000020| 20 66 6f 72 20 64 69 74 | 72 6f 66 66 20 28 64 69 | for dit|roff (di|
|00000030| 74 72 65 76 29 0a 4e 65 | 77 73 67 72 6f 75 70 73 |trev).Ne|wsgroups|
|00000040| 3a 20 6d 6f 64 2e 73 6f | 75 72 63 65 73 0a 41 70 |: mod.so|urces.Ap|
|00000050| 70 72 6f 76 65 64 3a 20 | 72 73 40 6d 69 72 72 6f |proved: |rs@mirro|
|00000060| 72 2e 55 55 43 50 0a 0a | 53 75 62 6d 69 74 74 65 |r.UUCP..|Submitte|
|00000070| 64 20 62 79 3a 20 63 63 | 61 21 63 61 69 70 21 75 |d by: cc|a!caip!u|
|00000080| 77 2d 62 65 61 76 65 72 | 21 75 77 2d 77 61 6c 6c |w-beaver|!uw-wall|
|00000090| 79 21 73 63 68 77 61 72 | 74 7a 20 28 4d 69 63 68 |y!schwar|tz (Mich|
|000000a0| 61 65 6c 20 46 2e 20 53 | 63 68 77 61 72 74 7a 29 |ael F. S|chwartz)|
|000000b0| 0a 4d 6f 64 2e 73 6f 75 | 72 63 65 73 3a 20 56 6f |.Mod.sou|rces: Vo|
|000000c0| 6c 75 6d 65 20 36 2c 20 | 49 73 73 75 65 20 34 32 |lume 6, |Issue 42|
|000000d0| 0a 41 72 63 68 69 76 65 | 2d 6e 61 6d 65 3a 20 64 |.Archive|-name: d|
|000000e0| 69 74 72 65 76 0a 0a 44 | 6f 63 75 6d 65 6e 74 73 |itrev..D|ocuments|
|000000f0| 20 67 65 6e 65 72 61 74 | 65 64 20 62 79 20 64 69 | generat|ed by di|
|00000100| 74 72 6f 66 66 28 31 29 | 20 63 6f 6d 65 20 6f 75 |troff(1)| come ou|
|00000110| 74 20 77 69 74 68 20 70 | 61 67 65 20 31 20 6f 6e |t with p|age 1 on|
|00000120| 20 74 68 65 20 62 6f 74 | 74 6f 6d 20 61 6e 64 20 | the bot|tom and |
|00000130| 74 68 65 0a 6c 61 73 74 | 20 70 61 67 65 20 6f 6e |the.last| page on|
|00000140| 20 74 6f 70 20 77 68 65 | 6e 20 79 6f 75 20 70 72 | top whe|n you pr|
|00000150| 69 6e 74 20 74 68 65 6d | 2e 20 20 49 20 67 6f 74 |int them|. I got|
|00000160| 20 74 69 72 65 64 20 6f | 66 20 68 61 76 69 6e 67 | tired o|f having|
|00000170| 20 74 6f 20 6d 61 6e 75 | 61 6c 6c 79 0a 72 65 76 | to manu|ally.rev|
|00000180| 65 72 73 65 20 74 68 65 | 20 70 61 67 65 73 2c 20 |erse the| pages, |
|00000190| 73 6f 20 49 20 68 61 63 | 6b 65 64 20 75 70 20 61 |so I hac|ked up a|
|000001a0| 20 66 69 6c 74 65 72 20 | 74 68 61 74 20 72 65 76 | filter |that rev|
|000001b0| 65 72 73 65 73 20 74 68 | 65 20 70 61 67 65 73 20 |erses th|e pages |
|000001c0| 66 6f 72 20 79 6f 75 2e | 0a 49 74 27 73 20 73 69 |for you.|.It's si|
|000001d0| 6d 70 6c 65 20 74 6f 20 | 75 73 65 2c 20 61 6e 64 |mple to |use, and|
|000001e0| 20 72 75 6e 73 20 70 72 | 65 74 74 79 20 66 61 73 | runs pr|etty fas|
|000001f0| 74 3a 0a 0a 09 64 69 74 | 72 65 76 20 5b 66 69 6c |t:...dit|rev [fil|
|00000200| 65 5d 0a 0a 6f 75 74 70 | 75 74 73 20 74 6f 20 73 |e]..outp|uts to s|
|00000210| 74 64 6f 75 74 20 61 6e | 20 69 6d 61 67 65 20 6c |tdout an| image l|
|00000220| 69 6b 65 20 74 68 65 20 | 69 6e 70 75 74 2c 20 65 |ike the |input, e|
|00000230| 78 63 65 70 74 20 61 6c | 6c 20 74 68 65 20 70 61 |xcept al|l the pa|
|00000240| 67 65 73 20 61 72 65 20 | 72 65 76 65 72 73 65 64 |ges are |reversed|
|00000250| 2e 0a 53 6f 2c 20 74 6f | 20 75 73 65 20 74 68 69 |..So, to| use thi|
|00000260| 73 2c 20 75 73 65 20 73 | 6f 6d 65 74 68 69 6e 67 |s, use s|omething|
|00000270| 20 6c 69 6b 65 20 74 68 | 65 20 66 6f 6c 6c 6f 77 | like th|e follow|
|00000280| 69 6e 67 20 63 6f 6d 6d | 61 6e 64 3a 0a 0a 20 20 |ing comm|and:.. |
|00000290| 20 20 20 20 20 74 72 6f | 66 66 20 69 6e 70 75 74 | tro|ff input|
|000002a0| 66 69 6c 65 20 2d 74 20 | 7c 20 64 69 74 72 65 76 |file -t || ditrev|
|000002b0| 20 7c 20 6c 70 72 20 2d | 6e 0a 0a 28 77 68 65 72 | | lpr -|n..(wher|
|000002c0| 65 20 74 68 65 20 2f 75 | 73 72 2f 6c 6f 63 61 6c |e the /u|sr/local|
|000002d0| 2f 64 69 74 72 6f 66 66 | 20 69 73 20 62 65 66 6f |/ditroff| is befo|
|000002e0| 72 65 20 74 68 65 20 2f | 62 69 6e 2f 74 72 6f 66 |re the /|bin/trof|
|000002f0| 66 20 76 65 72 73 69 6f | 6e 20 69 6e 20 79 6f 75 |f versio|n in you|
|00000300| 72 20 73 65 61 72 63 68 | 0a 70 61 74 68 29 2e 0a |r search|.path)..|
|00000310| 0a 4e 6f 74 65 3a 20 54 | 68 65 72 65 20 69 73 20 |.Note: T|here is |
|00000320| 61 6e 6f 74 68 65 72 20 | 70 72 6f 67 72 61 6d 20 |another |program |
|00000330| 63 61 6c 6c 65 64 20 70 | 73 72 65 76 20 74 68 61 |called p|srev tha|
|00000340| 74 20 72 65 76 65 72 73 | 65 73 20 50 6f 73 74 53 |t revers|es PostS|
|00000350| 63 72 69 70 74 20 66 69 | 6c 65 20 70 61 67 65 73 |cript fi|le pages|
|00000360| 0a 28 6d 79 20 66 69 6c | 74 65 72 20 72 65 76 65 |.(my fil|ter reve|
|00000370| 72 73 65 73 20 64 69 74 | 72 6f 66 66 20 70 61 67 |rses dit|roff pag|
|00000380| 65 73 3b 20 64 69 74 72 | 6f 66 66 20 6f 75 74 70 |es; ditr|off outp|
|00000390| 75 74 20 69 73 20 74 72 | 61 6e 73 6c 61 74 65 64 |ut is tr|anslated|
|000003a0| 20 74 6f 20 50 6f 73 74 | 53 63 72 69 70 74 0a 62 | to Post|Script.b|
|000003b0| 65 66 6f 72 65 20 62 65 | 69 6e 67 20 70 72 69 6e |efore be|ing prin|
|000003c0| 74 65 64 20 6f 6e 20 6c | 61 73 65 72 77 72 69 74 |ted on l|aserwrit|
|000003d0| 65 72 73 29 2e 20 20 4d | 6f 72 65 20 61 62 6f 75 |ers). M|ore abou|
|000003e0| 74 20 74 68 65 20 64 69 | 66 66 65 72 65 6e 63 65 |t the di|fference|
|000003f0| 73 20 62 65 74 77 65 65 | 6e 0a 74 68 65 73 65 20 |s betwee|n.these |
|00000400| 70 72 6f 67 72 61 6d 73 | 20 69 73 20 64 65 73 63 |programs| is desc|
|00000410| 72 69 62 65 64 20 69 6e | 20 74 68 65 20 6d 61 6e |ribed in| the man|
|00000420| 20 70 61 67 65 2e 0a 0a | 20 2d 20 4d 69 6b 65 20 | page...| - Mike |
|00000430| 53 63 68 77 61 72 74 7a | 0a 20 20 20 55 6e 69 76 |Schwartz|. Univ|
|00000440| 65 72 73 69 74 79 20 6f | 66 20 57 61 73 68 69 6e |ersity o|f Washin|
|00000450| 67 74 6f 6e 20 43 6f 6d | 70 75 74 65 72 20 53 63 |gton Com|puter Sc|
|00000460| 69 65 6e 63 65 20 44 65 | 70 61 72 74 6d 65 6e 74 |ience De|partment|
|00000470| 0a 20 20 20 69 68 6e 70 | 34 21 75 77 2d 62 65 61 |. ihnp|4!uw-bea|
|00000480| 76 65 72 21 73 63 68 77 | 61 72 74 7a 20 20 28 55 |ver!schw|artz (U|
|00000490| 53 45 4e 45 54 29 0a 20 | 20 20 73 63 68 77 61 72 |SENET). | schwar|
|000004a0| 74 7a 40 77 61 6c 6c 79 | 2e 61 72 70 61 20 20 28 |tz@wally|.arpa (|
|000004b0| 41 52 50 41 4e 45 54 29 | 0a 20 20 20 73 63 68 77 |ARPANET)|. schw|
|000004c0| 61 72 74 7a 25 77 61 6c | 6c 79 2e 61 72 70 61 40 |artz%wal|ly.arpa@|
|000004d0| 63 73 6e 65 74 2d 72 65 | 6c 61 79 2e 61 72 70 61 |csnet-re|lay.arpa|
|000004e0| 20 20 28 43 53 4e 45 54 | 29 0a 0a 23 21 20 2f 62 | (CSNET|)..#! /b|
|000004f0| 69 6e 2f 73 68 0a 23 20 | 54 68 69 73 20 69 73 20 |in/sh.# |This is |
|00000500| 61 20 73 68 65 6c 6c 20 | 61 72 63 68 69 76 65 2c |a shell |archive,|
|00000510| 20 6d 65 61 6e 69 6e 67 | 3a 0a 23 20 31 2e 20 52 | meaning|:.# 1. R|
|00000520| 65 6d 6f 76 65 20 65 76 | 65 72 79 74 68 69 6e 67 |emove ev|erything|
|00000530| 20 61 62 6f 76 65 20 74 | 68 65 20 23 21 20 2f 62 | above t|he #! /b|
|00000540| 69 6e 2f 73 68 20 6c 69 | 6e 65 2e 0a 23 20 32 2e |in/sh li|ne..# 2.|
|00000550| 20 53 61 76 65 20 74 68 | 65 20 72 65 73 75 6c 74 | Save th|e result|
|00000560| 69 6e 67 20 74 65 78 74 | 20 69 6e 20 61 20 66 69 |ing text| in a fi|
|00000570| 6c 65 2e 0a 23 20 33 2e | 20 45 78 65 63 75 74 65 |le..# 3.| Execute|
|00000580| 20 74 68 65 20 66 69 6c | 65 20 77 69 74 68 20 2f | the fil|e with /|
|00000590| 62 69 6e 2f 73 68 20 28 | 6e 6f 74 20 63 73 68 29 |bin/sh (|not csh)|
|000005a0| 20 74 6f 20 63 72 65 61 | 74 65 3a 0a 23 09 64 69 | to crea|te:.#.di|
|000005b0| 74 72 65 76 2e 31 0a 23 | 09 64 69 74 72 65 76 2e |trev.1.#|.ditrev.|
|000005c0| 63 0a 23 09 6d 61 6b 65 | 66 69 6c 65 0a 23 20 54 |c.#.make|file.# T|
|000005d0| 68 69 73 20 61 72 63 68 | 69 76 65 20 63 72 65 61 |his arch|ive crea|
|000005e0| 74 65 64 3a 20 46 72 69 | 20 4a 75 6e 20 32 37 20 |ted: Fri| Jun 27 |
|000005f0| 31 35 3a 34 37 3a 35 39 | 20 31 39 38 36 0a 65 78 |15:47:59| 1986.ex|
|00000600| 70 6f 72 74 20 50 41 54 | 48 3b 20 50 41 54 48 3d |port PAT|H; PATH=|
|00000610| 2f 62 69 6e 3a 2f 75 73 | 72 2f 62 69 6e 3a 24 50 |/bin:/us|r/bin:$P|
|00000620| 41 54 48 0a 65 63 68 6f | 20 73 68 61 72 3a 20 22 |ATH.echo| shar: "|
|00000630| 65 78 74 72 61 63 74 69 | 6e 67 20 27 64 69 74 72 |extracti|ng 'ditr|
|00000640| 65 76 2e 31 27 22 20 27 | 28 32 37 36 32 20 63 68 |ev.1'" '|(2762 ch|
|00000650| 61 72 61 63 74 65 72 73 | 29 27 0a 69 66 20 74 65 |aracters|)'.if te|
|00000660| 73 74 20 2d 66 20 27 64 | 69 74 72 65 76 2e 31 27 |st -f 'd|itrev.1'|
|00000670| 0a 74 68 65 6e 0a 09 65 | 63 68 6f 20 73 68 61 72 |.then..e|cho shar|
|00000680| 3a 20 22 77 69 6c 6c 20 | 6e 6f 74 20 6f 76 65 72 |: "will |not over|
|00000690| 2d 77 72 69 74 65 20 65 | 78 69 73 74 69 6e 67 20 |-write e|xisting |
|000006a0| 66 69 6c 65 20 27 64 69 | 74 72 65 76 2e 31 27 22 |file 'di|trev.1'"|
|000006b0| 0a 65 6c 73 65 0a 73 65 | 64 20 27 73 2f 5e 09 58 |.else.se|d 's/^.X|
|000006c0| 2f 2f 27 20 3c 3c 20 5c | 53 48 41 52 5f 45 4f 46 |//' << \|SHAR_EOF|
|000006d0| 20 3e 20 27 64 69 74 72 | 65 76 2e 31 27 0a 09 58 | > 'ditr|ev.1'..X|
|000006e0| 2e 54 48 20 44 49 54 52 | 45 56 20 31 20 6c 6f 63 |.TH DITR|EV 1 loc|
|000006f0| 61 6c 0a 09 58 2e 53 48 | 20 4e 41 4d 45 0a 09 58 |al..X.SH| NAME..X|
|00000700| 64 69 74 72 65 76 20 5c | 2d 20 72 65 76 65 72 73 |ditrev \|- revers|
|00000710| 65 20 64 69 74 72 6f 66 | 66 28 31 29 20 70 61 67 |e ditrof|f(1) pag|
|00000720| 65 73 0a 09 58 2e 53 48 | 20 53 59 4e 4f 50 53 49 |es..X.SH| SYNOPSI|
|00000730| 53 0a 09 58 2e 42 20 64 | 69 74 72 65 76 0a 09 58 |S..X.B d|itrev..X|
|00000740| 5b 66 69 6c 65 5d 0a 09 | 58 2e 53 48 20 44 45 53 |[file]..|X.SH DES|
|00000750| 43 52 49 50 54 49 4f 4e | 0a 09 58 2e 49 20 44 69 |CRIPTION|..X.I Di|
|00000760| 74 72 65 76 0a 09 58 72 | 65 76 65 72 73 65 73 20 |trev..Xr|everses |
|00000770| 74 68 65 20 70 61 67 65 | 73 20 69 6e 20 61 20 64 |the page|s in a d|
|00000780| 69 74 72 6f 66 66 0a 09 | 58 66 69 6c 65 20 28 6f |itroff..|Xfile (o|
|00000790| 72 20 73 74 64 69 6e 2c | 20 69 66 20 6e 6f 20 66 |r stdin,| if no f|
|000007a0| 69 6c 65 20 69 73 0a 09 | 58 73 70 65 63 69 66 69 |ile is..|Xspecifi|
|000007b0| 65 64 29 20 61 6e 64 20 | 6f 75 74 70 75 74 73 20 |ed) and |outputs |
|000007c0| 74 6f 20 73 74 64 6f 75 | 74 2e 20 54 68 69 73 20 |to stdou|t. This |
|000007d0| 69 73 20 75 73 65 66 75 | 6c 20 77 68 65 6e 20 73 |is usefu|l when s|
|000007e0| 65 6e 64 69 6e 67 20 74 | 79 70 65 73 65 74 0a 09 |ending t|ypeset..|
|000007f0| 58 64 69 74 72 6f 66 66 | 20 6f 75 74 70 75 74 20 |Xditroff| output |
|00000800| 74 6f 20 61 20 6c 61 73 | 65 72 20 70 72 69 6e 74 |to a las|er print|
|00000810| 65 72 3a 0a 09 58 64 69 | 74 72 6f 66 66 20 6f 75 |er:..Xdi|troff ou|
|00000820| 74 70 75 74 73 20 74 68 | 65 20 70 61 67 65 73 20 |tputs th|e pages |
|00000830| 69 6e 20 61 6e 20 6f 72 | 64 65 72 20 74 68 61 74 |in an or|der that|
|00000840| 2c 20 77 69 74 68 6f 75 | 74 20 74 68 69 73 20 66 |, withou|t this f|
|00000850| 69 6c 74 65 72 2c 20 66 | 6f 72 63 65 73 0a 09 58 |ilter, f|orces..X|
|00000860| 79 6f 75 20 74 6f 20 6d | 61 6e 75 61 6c 6c 79 20 |you to m|anually |
|00000870| 72 65 76 65 72 73 65 20 | 74 68 65 6d 20 61 6c 6c |reverse |them all|
|00000880| 2e 0a 09 58 2e 50 50 0a | 09 58 54 6f 20 75 73 65 |...X.PP.|.XTo use|
|00000890| 20 74 68 69 73 20 66 69 | 6c 74 65 72 2c 20 79 6f | this fi|lter, yo|
|000008a0| 75 20 77 6f 75 6c 64 20 | 75 73 65 20 73 6f 6d 65 |u would |use some|
|000008b0| 74 68 69 6e 67 20 6c 69 | 6b 65 20 74 68 65 20 66 |thing li|ke the f|
|000008c0| 6f 6c 6c 6f 77 69 6e 67 | 20 63 6f 6d 6d 61 6e 64 |ollowing| command|
|000008d0| 3a 0a 09 58 2e 52 53 0a | 09 58 74 72 6f 66 66 20 |:..X.RS.|.Xtroff |
|000008e0| 66 69 6c 65 20 2d 74 20 | 2d 50 70 73 20 7c 20 64 |file -t |-Pps | d|
|000008f0| 69 74 72 65 76 20 7c 20 | 6c 70 72 20 2d 6e 20 2d |itrev | |lpr -n -|
|00000900| 50 70 73 0a 09 58 2e 52 | 45 0a 09 58 28 77 68 65 |Pps..X.R|E..X(whe|
|00000910| 72 65 20 2f 75 73 72 2f | 6c 6f 63 61 6c 2f 64 69 |re /usr/|local/di|
|00000920| 74 72 6f 66 66 20 69 73 | 20 61 68 65 61 64 20 6f |troff is| ahead o|
|00000930| 66 20 2f 75 73 72 2f 62 | 69 6e 20 69 6e 20 79 6f |f /usr/b|in in yo|
|00000940| 75 72 20 73 65 61 72 63 | 68 20 70 61 74 68 29 2e |ur searc|h path).|
|00000950| 0a 09 58 2e 53 48 20 43 | 4f 4d 50 41 52 49 53 4f |..X.SH C|OMPARISO|
|00000960| 4e 20 57 49 54 48 20 50 | 53 52 45 56 0a 09 58 54 |N WITH P|SREV..XT|
|00000970| 68 65 72 65 20 69 73 20 | 61 6e 6f 74 68 65 72 20 |here is |another |
|00000980| 70 72 6f 67 72 61 6d 20 | 63 61 6c 6c 65 64 20 70 |program |called p|
|00000990| 73 72 65 76 0a 09 58 74 | 68 61 74 20 72 65 76 65 |srev..Xt|hat reve|
|000009a0| 72 73 65 73 20 74 68 65 | 20 70 61 67 65 73 20 6f |rses the| pages o|
|000009b0| 66 20 50 6f 73 74 53 63 | 72 69 70 74 0a 09 58 66 |f PostSc|ript..Xf|
|000009c0| 69 6c 65 73 2e 20 20 53 | 69 6e 63 65 20 6d 61 6e |iles. S|ince man|
|000009d0| 79 20 6c 61 73 65 72 20 | 70 72 69 6e 74 65 72 73 |y laser |printers|
|000009e0| 20 28 65 2e 67 2e 2c 20 | 74 68 65 20 4d 61 63 49 | (e.g., |the MacI|
|000009f0| 6e 74 6f 73 68 20 4c 61 | 73 65 72 57 72 69 74 65 |ntosh La|serWrite|
|00000a00| 72 29 20 75 73 65 0a 09 | 58 50 6f 73 74 53 63 72 |r) use..|XPostScr|
|00000a10| 69 70 74 2c 20 6f 6e 65 | 20 63 6f 75 6c 64 20 64 |ipt, one| could d|
|00000a20| 6f 0a 09 58 2e 52 53 0a | 09 58 74 72 6f 66 66 20 |o..X.RS.|.Xtroff |
|00000a30| 66 69 6c 65 20 2d 74 20 | 2d 50 70 73 20 7c 20 64 |file -t |-Pps | d|
|00000a40| 70 73 20 7c 20 70 73 72 | 65 76 20 7c 20 6c 70 72 |ps | psr|ev | lpr|
|00000a50| 20 2d 50 70 73 0a 09 58 | 2e 52 45 0a 09 58 28 64 | -Pps..X|.RE..X(d|
|00000a60| 70 73 20 74 72 61 6e 73 | 6c 61 74 65 73 20 62 65 |ps trans|lates be|
|00000a70| 74 77 65 65 6e 20 64 69 | 74 72 6f 66 66 20 66 6f |tween di|troff fo|
|00000a80| 72 6d 61 74 20 61 6e 64 | 20 50 6f 73 74 53 63 72 |rmat and| PostScr|
|00000a90| 69 70 74 29 2e 20 20 41 | 6c 74 68 6f 75 67 68 20 |ipt). A|lthough |
|00000aa0| 49 20 64 69 64 6e 27 74 | 20 6b 6e 6f 77 0a 09 58 |I didn't| know..X|
|00000ab0| 6f 66 20 74 68 65 20 65 | 78 69 73 74 65 6e 63 65 |of the e|xistence|
|00000ac0| 20 6f 66 20 70 73 72 65 | 76 20 77 68 65 6e 20 49 | of psre|v when I|
|00000ad0| 20 77 72 6f 74 65 0a 09 | 58 2e 49 20 64 69 74 72 | wrote..|X.I ditr|
|00000ae0| 65 76 2c 0a 09 58 69 74 | 20 74 75 72 6e 73 20 6f |ev,..Xit| turns o|
|00000af0| 75 74 20 74 68 61 74 20 | 74 68 65 72 65 20 61 72 |ut that |there ar|
|00000b00| 65 20 73 65 76 65 72 61 | 6c 20 61 64 76 61 6e 74 |e severa|l advant|
|00000b10| 61 67 65 73 20 6f 66 0a | 09 58 2e 49 20 64 69 74 |ages of.|.X.I dit|
|00000b20| 72 65 76 0a 09 58 6f 76 | 65 72 20 70 73 72 65 76 |rev..Xov|er psrev|
|00000b30| 3a 0a 09 58 2e 49 50 20 | 31 2e 0a 09 58 2e 49 20 |:..X.IP |1...X.I |
|00000b40| 44 69 74 72 65 76 0a 09 | 58 69 73 20 6d 6f 72 65 |Ditrev..|Xis more|
|00000b50| 20 67 65 6e 65 72 61 6c | 20 2d 20 69 74 20 77 6f | general| - it wo|
|00000b60| 72 6b 73 20 6e 6f 20 6d | 61 74 74 65 72 20 77 68 |rks no m|atter wh|
|00000b70| 61 74 20 69 6d 61 67 65 | 20 66 6f 72 6d 61 74 20 |at image| format |
|00000b80| 74 68 65 20 70 72 69 6e | 74 65 72 20 61 63 63 65 |the prin|ter acce|
|00000b90| 70 74 73 2e 0a 09 58 54 | 68 75 73 2c 0a 09 58 2e |pts...XT|hus,..X.|
|00000ba0| 49 20 64 69 74 72 65 76 | 0a 09 58 63 61 6e 20 62 |I ditrev|..Xcan b|
|00000bb0| 65 20 75 73 65 64 20 66 | 6f 72 20 61 6e 79 20 70 |e used f|or any p|
|00000bc0| 72 69 6e 74 65 72 2c 20 | 61 6e 64 20 74 68 65 20 |rinter, |and the |
|00000bd0| 75 73 65 72 20 64 6f 65 | 73 6e 27 74 20 68 61 76 |user doe|sn't hav|
|00000be0| 65 20 74 6f 20 6b 6e 6f | 77 20 77 68 61 74 20 66 |e to kno|w what f|
|00000bf0| 6f 72 6d 61 74 0a 09 58 | 74 68 65 20 70 72 69 6e |ormat..X|the prin|
|00000c00| 74 65 72 20 65 78 70 65 | 63 74 73 2e 20 20 0a 09 |ter expe|cts. ..|
|00000c10| 58 2e 49 50 0a 09 58 4f | 6e 20 74 68 65 20 6f 74 |X.IP..XO|n the ot|
|00000c20| 68 65 72 20 68 61 6e 64 | 2c 20 70 73 72 65 76 20 |her hand|, psrev |
|00000c30| 77 6f 72 6b 73 20 6e 6f | 20 6d 61 74 74 65 72 20 |works no| matter |
|00000c40| 77 68 61 74 0a 09 58 74 | 65 78 74 20 66 6f 72 6d |what..Xt|ext form|
|00000c50| 61 74 74 65 72 20 67 65 | 6e 65 72 61 74 65 64 20 |atter ge|nerated |
|00000c60| 74 68 65 20 66 69 6c 65 | 2c 20 61 73 20 6c 6f 6e |the file|, as lon|
|00000c70| 67 20 61 73 20 74 68 65 | 20 70 72 69 6e 74 65 72 |g as the| printer|
|00000c80| 20 61 63 63 65 70 74 73 | 0a 09 58 50 6f 73 74 53 | accepts|..XPostS|
|00000c90| 63 72 69 70 74 2e 20 20 | 42 75 74 2c 20 73 69 6e |cript. |But, sin|
|00000ca0| 63 65 20 6d 6f 73 74 20 | 74 65 78 74 20 70 72 6f |ce most |text pro|
|00000cb0| 63 65 73 73 6f 72 73 20 | 28 53 63 72 69 62 65 20 |cessors |(Scribe |
|00000cc0| 61 6e 64 20 74 65 78 28 | 31 4c 29 20 69 6e 0a 09 |and tex(|1L) in..|
|00000cd0| 58 70 61 72 74 69 63 75 | 6c 61 72 29 20 6f 75 74 |Xparticu|lar) out|
|00000ce0| 70 75 74 20 74 68 65 20 | 70 61 67 65 73 20 69 6e |put the |pages in|
|00000cf0| 20 74 68 65 20 63 6f 72 | 72 65 63 74 20 6f 72 64 | the cor|rect ord|
|00000d00| 65 72 2c 20 74 68 69 73 | 20 70 72 6f 62 61 62 6c |er, this| probabl|
|00000d10| 79 0a 09 58 69 73 6e 27 | 74 20 74 6f 6f 20 75 73 |y..Xisn'|t too us|
|00000d20| 65 66 75 6c 2e 0a 09 58 | 2e 49 50 20 32 2e 0a 09 |eful...X|.IP 2...|
|00000d30| 58 2e 49 20 44 69 74 72 | 65 76 0a 09 58 72 75 6e |X.I Ditr|ev..Xrun|
|00000d40| 73 20 66 61 73 74 65 72 | 20 74 68 61 6e 20 70 73 |s faster| than ps|
|00000d50| 72 65 76 2e 0a 09 58 2e | 49 50 20 33 2e 0a 09 58 |rev...X.|IP 3...X|
|00000d60| 4e 65 69 74 68 65 72 20 | 64 70 73 20 6e 6f 72 20 |Neither |dps nor |
|00000d70| 70 73 72 65 76 20 73 65 | 65 6d 20 74 6f 20 68 61 |psrev se|em to ha|
|00000d80| 76 65 20 6d 61 6e 20 70 | 61 67 65 73 2e 0a 09 58 |ve man p|ages...X|
|00000d90| 2e 49 50 20 34 2e 0a 09 | 58 44 70 73 20 69 73 20 |.IP 4...|XDps is |
|00000da0| 6f 66 74 65 6e 20 6f 6e | 6c 79 20 61 76 61 69 6c |often on|ly avail|
|00000db0| 61 62 6c 65 20 6f 6e 20 | 74 68 65 20 6d 61 63 68 |able on |the mach|
|00000dc0| 69 6e 65 0a 09 58 77 68 | 69 63 68 20 64 72 69 76 |ine..Xwh|ich driv|
|00000dd0| 65 73 20 74 68 65 20 70 | 72 69 6e 74 65 72 2c 20 |es the p|rinter, |
|00000de0| 73 6f 20 79 6f 75 20 77 | 6f 75 6c 64 20 61 63 74 |so you w|ould act|
|00000df0| 75 61 6c 6c 79 20 68 61 | 76 65 20 74 6f 20 64 6f |ually ha|ve to do|
|00000e00| 0a 09 58 2e 52 53 0a 09 | 58 2e 52 53 0a 09 58 74 |..X.RS..|X.RS..Xt|
|00000e10| 72 6f 66 66 20 66 69 6c | 65 20 2d 74 20 2d 50 70 |roff fil|e -t -Pp|
|00000e20| 73 20 7c 20 72 73 68 20 | 27 64 70 73 20 7c 20 70 |s | rsh |'dps | p|
|00000e30| 73 72 65 76 20 7c 20 6c | 70 72 20 2d 50 70 73 27 |srev | l|pr -Pps'|
|00000e40| 0a 09 58 2e 52 45 0a 09 | 58 54 68 69 73 20 63 61 |..X.RE..|XThis ca|
|00000e50| 6e 20 62 65 63 6f 6d 65 | 20 6d 6f 72 65 20 63 6f |n become| more co|
|00000e60| 6d 70 6c 69 63 61 74 65 | 64 20 61 6e 64 20 69 6e |mplicate|d and in|
|00000e70| 73 74 61 6c 6c 61 74 69 | 6f 6e 20 64 65 70 65 6e |stallati|on depen|
|00000e80| 64 65 6e 74 0a 09 58 69 | 66 20 74 68 65 73 65 20 |dent..Xi|f these |
|00000e90| 6f 74 68 65 72 20 66 69 | 6c 74 65 72 73 20 61 72 |other fi|lters ar|
|00000ea0| 65 6e 27 74 0a 09 58 69 | 6e 20 79 6f 75 72 20 73 |en't..Xi|n your s|
|00000eb0| 65 61 72 63 68 20 70 61 | 74 68 20 6f 6e 20 74 68 |earch pa|th on th|
|00000ec0| 65 20 72 65 6d 6f 74 65 | 20 6d 61 63 68 69 6e 65 |e remote| machine|
|00000ed0| 2e 0a 09 58 2e 52 45 0a | 09 58 2e 53 48 20 41 55 |...X.RE.|.X.SH AU|
|00000ee0| 54 48 4f 52 0a 09 58 4d | 69 6b 65 20 53 63 68 77 |THOR..XM|ike Schw|
|00000ef0| 61 72 74 7a 2c 20 55 6e | 69 76 65 72 73 69 74 79 |artz, Un|iversity|
|00000f00| 20 6f 66 20 57 61 73 68 | 69 6e 67 74 6f 6e 20 43 | of Wash|ington C|
|00000f10| 6f 6d 70 75 74 65 72 20 | 53 63 69 65 6e 63 65 20 |omputer |Science |
|00000f20| 44 65 70 61 72 74 6d 65 | 6e 74 2e 0a 09 58 2e 63 |Departme|nt...X.c|
|00000f30| 65 20 33 0a 09 58 69 68 | 6e 70 34 21 75 77 2d 62 |e 3..Xih|np4!uw-b|
|00000f40| 65 61 76 65 72 21 73 63 | 68 77 61 72 74 7a 20 20 |eaver!sc|hwartz |
|00000f50| 28 55 53 45 4e 45 54 29 | 0a 09 58 73 63 68 77 61 |(USENET)|..Xschwa|
|00000f60| 72 74 7a 40 77 61 6c 6c | 79 2e 61 72 70 61 20 20 |rtz@wall|y.arpa |
|00000f70| 28 41 52 50 41 4e 45 54 | 29 0a 09 58 73 63 68 77 |(ARPANET|)..Xschw|
|00000f80| 61 72 74 7a 25 77 61 6c | 6c 79 2e 61 72 70 61 40 |artz%wal|ly.arpa@|
|00000f90| 63 73 6e 65 74 2d 72 65 | 6c 61 79 2e 61 72 70 61 |csnet-re|lay.arpa|
|00000fa0| 20 20 28 43 53 4e 45 54 | 29 0a 09 58 2e 53 48 20 | (CSNET|)..X.SH |
|00000fb0| 42 55 47 53 0a 09 58 2e | 49 50 20 31 2e 0a 09 58 |BUGS..X.|IP 1...X|
|00000fc0| 54 68 65 20 74 72 61 6e | 73 66 6f 72 6d 61 74 69 |The tran|sformati|
|00000fd0| 6f 6e 20 70 65 72 66 6f | 72 6d 65 64 20 69 73 20 |on perfo|rmed is |
|00000fe0| 76 65 72 79 20 73 69 6d | 70 6c 65 3b 20 49 20 64 |very sim|ple; I d|
|00000ff0| 69 73 63 6f 76 65 72 65 | 64 20 69 74 20 62 79 20 |iscovere|d it by |
|00001000| 6c 6f 6f 6b 69 6e 67 20 | 61 74 20 74 68 65 0a 09 |looking |at the..|
|00001010| 58 6f 75 74 70 75 74 20 | 6f 66 20 64 69 74 72 6f |Xoutput |of ditro|
|00001020| 66 66 20 61 6e 64 20 74 | 68 65 20 73 6f 75 72 63 |ff and t|he sourc|
|00001030| 65 20 6f 66 20 64 73 75 | 6e 28 31 29 2e 20 20 54 |e of dsu|n(1). T|
|00001040| 68 75 73 2c 20 61 6c 74 | 68 6f 75 67 68 20 74 68 |hus, alt|hough th|
|00001050| 69 73 20 66 69 6c 74 65 | 72 0a 09 58 73 65 65 6d |is filte|r..Xseem|
|00001060| 73 20 74 6f 20 77 6f 72 | 6b 2c 20 49 20 6d 61 79 |s to wor|k, I may|
|00001070| 20 68 61 76 65 20 6d 61 | 64 65 20 73 6f 6d 65 20 | have ma|de some |
|00001080| 6f 76 65 72 73 69 6d 70 | 6c 69 66 69 63 61 74 69 |oversimp|lificati|
|00001090| 6f 6e 73 2e 0a 09 58 2e | 49 50 20 32 2e 0a 09 58 |ons...X.|IP 2...X|
|000010a0| 49 6e 70 75 74 20 69 73 | 20 72 65 61 64 20 69 6e |Input is| read in|
|000010b0| 74 6f 20 64 79 6e 61 6d | 69 63 61 6c 6c 79 20 61 |to dynam|ically a|
|000010c0| 6c 6c 6f 63 61 74 65 64 | 20 62 75 66 66 65 72 73 |llocated| buffers|
|000010d0| 2c 20 61 6e 64 20 68 65 | 6e 63 65 2c 20 66 6f 72 |, and he|nce, for|
|000010e0| 20 61 20 6c 61 72 67 65 | 20 69 6e 70 75 74 0a 09 | a large| input..|
|000010f0| 58 66 69 6c 65 2c 20 61 | 6c 6f 74 20 6f 66 20 6d |Xfile, a|lot of m|
|00001100| 65 6d 6f 72 79 20 69 73 | 20 75 73 65 64 20 28 62 |emory is| used (b|
|00001110| 75 74 20 6e 6f 20 6d 6f | 72 65 20 74 68 61 6e 20 |ut no mo|re than |
|00001120| 6e 65 63 65 73 73 61 72 | 79 2c 20 69 66 20 63 6f |necessar|y, if co|
|00001130| 6d 70 69 6c 65 64 20 77 | 69 74 68 0a 09 58 2d 44 |mpiled w|ith..X-D|
|00001140| 52 45 41 4c 4c 4f 43 29 | 2e 20 20 54 68 69 73 20 |REALLOC)|. This |
|00001150| 63 6f 75 6c 64 20 68 61 | 76 65 20 62 65 65 6e 20 |could ha|ve been |
|00001160| 61 76 6f 69 64 65 64 20 | 62 79 20 64 69 73 61 6c |avoided |by disal|
|00001170| 6c 6f 77 69 6e 67 20 69 | 6e 70 75 74 20 66 72 6f |lowing i|nput fro|
|00001180| 6d 20 73 74 64 69 6e 20 | 61 6e 64 0a 09 58 75 73 |m stdin |and..Xus|
|00001190| 69 6e 67 20 66 73 65 65 | 6b 28 33 29 20 74 6f 20 |ing fsee|k(3) to |
|000011a0| 6d 6f 76 65 20 74 68 72 | 6f 75 67 68 20 74 68 65 |move thr|ough the|
|000011b0| 20 66 69 6c 65 2e 20 49 | 20 64 69 64 6e 27 74 20 | file. I| didn't |
|000011c0| 64 6f 20 74 68 69 73 20 | 62 65 63 61 75 73 65 20 |do this |because |
|000011d0| 49 20 77 61 6e 74 65 64 | 20 74 6f 0a 09 58 61 6c |I wanted| to..Xal|
|000011e0| 6c 6f 77 20 69 6e 70 75 | 74 20 74 6f 20 63 6f 6d |low inpu|t to com|
|000011f0| 65 20 66 72 6f 6d 20 73 | 74 64 69 6e 2e 0a 09 58 |e from s|tdin...X|
|00001200| 2e 53 48 20 53 45 45 20 | 41 4c 53 4f 0a 09 58 74 |.SH SEE |ALSO..Xt|
|00001210| 72 6f 66 66 28 31 29 2c | 20 64 69 74 72 6f 66 66 |roff(1),| ditroff|
|00001220| 28 31 29 2c 20 64 73 75 | 6e 28 31 29 2c 20 6c 70 |(1), dsu|n(1), lp|
|00001230| 72 28 31 29 2c 20 74 65 | 78 28 31 4c 29 2c 20 70 |r(1), te|x(1L), p|
|00001240| 72 69 6e 74 63 61 70 28 | 35 29 2e 0a 53 48 41 52 |rintcap(|5)..SHAR|
|00001250| 5f 45 4f 46 0a 69 66 20 | 74 65 73 74 20 32 37 36 |_EOF.if |test 276|
|00001260| 32 20 2d 6e 65 20 22 60 | 77 63 20 2d 63 20 3c 20 |2 -ne "`|wc -c < |
|00001270| 27 64 69 74 72 65 76 2e | 31 27 60 22 0a 74 68 65 |'ditrev.|1'`".the|
|00001280| 6e 0a 09 65 63 68 6f 20 | 73 68 61 72 3a 20 22 65 |n..echo |shar: "e|
|00001290| 72 72 6f 72 20 74 72 61 | 6e 73 6d 69 74 74 69 6e |rror tra|nsmittin|
|000012a0| 67 20 27 64 69 74 72 65 | 76 2e 31 27 22 20 27 28 |g 'ditre|v.1'" '(|
|000012b0| 73 68 6f 75 6c 64 20 68 | 61 76 65 20 62 65 65 6e |should h|ave been|
|000012c0| 20 32 37 36 32 20 63 68 | 61 72 61 63 74 65 72 73 | 2762 ch|aracters|
|000012d0| 29 27 0a 66 69 0a 66 69 | 0a 65 63 68 6f 20 73 68 |)'.fi.fi|.echo sh|
|000012e0| 61 72 3a 20 22 65 78 74 | 72 61 63 74 69 6e 67 20 |ar: "ext|racting |
|000012f0| 27 64 69 74 72 65 76 2e | 63 27 22 20 27 28 35 31 |'ditrev.|c'" '(51|
|00001300| 39 38 20 63 68 61 72 61 | 63 74 65 72 73 29 27 0a |98 chara|cters)'.|
|00001310| 69 66 20 74 65 73 74 20 | 2d 66 20 27 64 69 74 72 |if test |-f 'ditr|
|00001320| 65 76 2e 63 27 0a 74 68 | 65 6e 0a 09 65 63 68 6f |ev.c'.th|en..echo|
|00001330| 20 73 68 61 72 3a 20 22 | 77 69 6c 6c 20 6e 6f 74 | shar: "|will not|
|00001340| 20 6f 76 65 72 2d 77 72 | 69 74 65 20 65 78 69 73 | over-wr|ite exis|
|00001350| 74 69 6e 67 20 66 69 6c | 65 20 27 64 69 74 72 65 |ting fil|e 'ditre|
|00001360| 76 2e 63 27 22 0a 65 6c | 73 65 0a 73 65 64 20 27 |v.c'".el|se.sed '|
|00001370| 73 2f 5e 09 58 2f 2f 27 | 20 3c 3c 20 5c 53 48 41 |s/^.X//'| << \SHA|
|00001380| 52 5f 45 4f 46 20 3e 20 | 27 64 69 74 72 65 76 2e |R_EOF > |'ditrev.|
|00001390| 63 27 0a 09 58 2f 2a 20 | 50 72 6f 67 72 61 6d 20 |c'..X/* |Program |
|000013a0| 74 6f 20 72 65 76 65 72 | 73 65 20 70 61 67 65 73 |to rever|se pages|
|000013b0| 20 66 72 6f 6d 20 69 6e | 70 75 74 20 61 6e 64 20 | from in|put and |
|000013c0| 70 72 69 6e 74 20 6f 6e | 20 73 74 64 6f 75 74 2c |print on| stdout,|
|000013d0| 20 66 6f 72 20 64 69 74 | 72 6f 66 66 28 31 29 0a | for dit|roff(1).|
|000013e0| 09 58 20 2a 20 69 6e 70 | 75 74 2e 20 20 54 68 69 |.X * inp|ut. Thi|
|000013f0| 73 20 69 73 20 75 73 65 | 66 75 6c 20 77 68 65 6e |s is use|ful when|
|00001400| 20 73 65 6e 64 69 6e 67 | 20 74 79 70 65 73 65 74 | sending| typeset|
|00001410| 20 64 69 74 72 6f 66 66 | 20 6f 75 74 70 75 74 20 | ditroff| output |
|00001420| 74 6f 20 61 20 6c 61 73 | 65 72 0a 09 58 20 2a 20 |to a las|er..X * |
|00001430| 70 72 69 6e 74 65 72 3a | 20 20 64 69 74 72 6f 66 |printer:| ditrof|
|00001440| 66 20 6f 75 74 70 75 74 | 73 20 74 68 65 20 70 61 |f output|s the pa|
|00001450| 67 65 73 20 69 6e 20 61 | 6e 20 6f 72 64 65 72 20 |ges in a|n order |
|00001460| 74 68 61 74 2c 20 77 69 | 74 68 6f 75 74 20 74 68 |that, wi|thout th|
|00001470| 69 73 20 66 69 6c 74 65 | 72 2c 0a 09 58 20 2a 20 |is filte|r,..X * |
|00001480| 66 6f 72 63 65 73 20 79 | 6f 75 20 74 6f 20 6d 61 |forces y|ou to ma|
|00001490| 6e 75 61 6c 6c 79 20 72 | 65 76 65 72 73 65 20 74 |nually r|everse t|
|000014a0| 68 65 6d 20 61 6c 6c 2e | 0a 09 58 20 2a 0a 09 58 |hem all.|..X *..X|
|000014b0| 20 2a 20 54 68 65 20 74 | 72 61 6e 73 66 6f 72 6d | * The t|ransform|
|000014c0| 61 74 69 6f 6e 20 69 73 | 20 73 69 6d 70 6c 65 3a |ation is| simple:|
|000014d0| 20 42 65 6c 6f 77 20 69 | 73 20 73 6f 6d 65 20 73 | Below i|s some s|
|000014e0| 61 6d 70 6c 65 20 69 6e | 70 75 74 2e 20 54 68 65 |ample in|put. The|
|000014f0| 20 58 27 73 20 62 65 6c | 6f 77 0a 09 58 20 2a 20 | X's bel|ow..X * |
|00001500| 72 65 70 72 65 73 65 6e | 74 20 61 6e 79 20 63 68 |represen|t any ch|
|00001510| 61 72 61 63 74 65 72 20 | 6f 74 68 65 72 20 74 68 |aracter |other th|
|00001520| 61 6e 20 22 70 22 3b 20 | 22 70 22 20 64 65 6c 69 |an "p"; |"p" deli|
|00001530| 6d 69 74 73 20 70 61 67 | 65 73 2c 20 61 6e 64 20 |mits pag|es, and |
|00001540| 22 78 20 74 72 61 69 6c | 65 72 22 0a 09 58 20 2a |"x trail|er"..X *|
|00001550| 20 64 65 6c 69 6d 69 74 | 73 20 74 68 65 20 65 6e | delimit|s the en|
|00001560| 64 20 6f 66 20 74 68 65 | 20 6c 61 73 74 20 70 61 |d of the| last pa|
|00001570| 67 65 2e 20 20 41 6c 73 | 6f 2c 20 61 6c 6c 20 6c |ge. Als|o, all l|
|00001580| 69 6e 65 73 20 73 74 61 | 72 74 20 69 6e 20 63 6f |ines sta|rt in co|
|00001590| 6c 75 6d 6e 20 31 2e 0a | 09 58 20 2a 09 58 73 74 |lumn 1..|.X *.Xst|
|000015a0| 61 72 74 69 6e 67 73 74 | 75 66 66 0a 09 58 20 2a |artingst|uff..X *|
|000015b0| 09 70 31 0a 09 58 20 2a | 09 58 70 61 67 65 31 73 |.p1..X *|.Xpage1s|
|000015c0| 74 75 66 66 0a 09 58 20 | 2a 09 70 32 0a 09 58 20 |tuff..X |*.p2..X |
|000015d0| 2a 09 58 70 61 67 65 32 | 73 74 75 66 66 0a 09 58 |*.Xpage2|stuff..X|
|000015e0| 20 2a 09 78 20 74 72 61 | 69 6c 65 72 0a 09 58 20 | *.x tra|iler..X |
|000015f0| 2a 09 58 66 69 6e 61 6c | 73 74 75 66 66 0a 09 58 |*.Xfinal|stuff..X|
|00001600| 20 2a 0a 09 58 20 2a 20 | 54 68 69 73 20 69 6e 70 | *..X * |This inp|
|00001610| 75 74 2c 20 77 68 65 6e | 20 72 75 6e 20 74 68 72 |ut, when| run thr|
|00001620| 6f 75 67 68 20 74 68 69 | 73 20 66 69 6c 74 65 72 |ough thi|s filter|
|00001630| 2c 20 77 69 6c 6c 20 70 | 72 6f 64 75 63 65 20 74 |, will p|roduce t|
|00001640| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 6f 75 74 |he follo|wing out|
|00001650| 70 75 74 3a 0a 09 58 20 | 2a 09 58 73 74 61 72 74 |put:..X |*.Xstart|
|00001660| 69 6e 67 73 74 75 66 66 | 0a 09 58 20 2a 09 70 32 |ingstuff|..X *.p2|
|00001670| 0a 09 58 20 2a 09 58 70 | 61 67 65 32 73 74 75 66 |..X *.Xp|age2stuf|
|00001680| 66 0a 09 58 20 2a 09 70 | 31 0a 09 58 20 2a 09 58 |f..X *.p|1..X *.X|
|00001690| 70 61 67 65 31 73 74 75 | 66 66 0a 09 58 20 2a 09 |page1stu|ff..X *.|
|000016a0| 78 20 74 72 61 69 6c 65 | 72 0a 09 58 20 2a 09 58 |x traile|r..X *.X|
|000016b0| 66 69 6e 61 6c 73 74 75 | 66 66 0a 09 58 20 2a 0a |finalstu|ff..X *.|
|000016c0| 09 58 20 2a 20 42 79 20 | 4d 69 6b 65 20 53 63 68 |.X * By |Mike Sch|
|000016d0| 77 61 72 74 7a 2c 20 36 | 2d 32 34 2d 38 36 2e 0a |wartz, 6|-24-86..|
|000016e0| 09 58 20 2a 09 69 68 6e | 70 34 21 75 77 2d 62 65 |.X *.ihn|p4!uw-be|
|000016f0| 61 76 65 72 21 73 63 68 | 77 61 72 74 7a 20 20 28 |aver!sch|wartz (|
|00001700| 55 53 45 4e 45 54 29 0a | 09 58 20 2a 09 73 63 68 |USENET).|.X *.sch|
|00001710| 77 61 72 74 7a 40 77 61 | 6c 6c 79 2e 61 72 70 61 |wartz@wa|lly.arpa|
|00001720| 20 20 28 41 52 50 41 4e | 45 54 29 0a 09 58 20 2a | (ARPAN|ET)..X *|
|00001730| 09 73 63 68 77 61 72 74 | 7a 25 77 61 6c 6c 79 2e |.schwart|z%wally.|
|00001740| 61 72 70 61 40 63 73 6e | 65 74 2d 72 65 6c 61 79 |arpa@csn|et-relay|
|00001750| 2e 61 72 70 61 20 20 28 | 43 53 4e 45 54 29 0a 09 |.arpa (|CSNET)..|
|00001760| 58 20 2a 2f 0a 09 58 0a | 09 58 0a 09 58 23 69 6e |X */..X.|.X..X#in|
|00001770| 63 6c 75 64 65 20 3c 73 | 74 64 69 6f 2e 68 3e 0a |clude <s|tdio.h>.|
|00001780| 09 58 0a 09 58 23 64 65 | 66 69 6e 65 20 50 41 47 |.X..X#de|fine PAG|
|00001790| 45 42 55 46 53 49 5a 45 | 20 33 30 30 30 30 20 20 |EBUFSIZE| 30000 |
|000017a0| 20 20 2f 2a 20 4e 75 6d | 62 65 72 20 6f 66 20 62 | /* Num|ber of b|
|000017b0| 79 74 65 73 20 69 6e 69 | 74 69 61 6c 6c 79 20 61 |ytes ini|tially a|
|000017c0| 6c 6c 6f 63 61 74 65 64 | 20 66 6f 72 20 65 61 63 |llocated| for eac|
|000017d0| 68 0a 09 58 09 09 09 09 | 70 6f 73 74 73 63 72 69 |h..X....|postscri|
|000017e0| 70 74 20 70 61 67 65 2e | 20 20 49 20 65 6d 70 69 |pt page.| I empi|
|000017f0| 72 69 63 61 6c 6c 79 20 | 64 65 74 65 72 6d 69 6e |rically |determin|
|00001800| 65 64 20 74 68 61 74 0a | 09 58 09 09 09 09 74 68 |ed that.|.X....th|
|00001810| 69 73 20 69 73 20 70 6c | 65 6e 74 79 20 6d 6f 72 |is is pl|enty mor|
|00001820| 65 20 74 68 61 6e 20 65 | 76 65 72 20 73 65 65 6d |e than e|ver seem|
|00001830| 73 20 74 6f 20 62 65 0a | 09 58 09 09 09 09 6e 65 |s to be.|.X....ne|
|00001840| 65 64 65 64 20 28 6d 61 | 78 20 77 61 73 20 61 62 |eded (ma|x was ab|
|00001850| 6f 75 74 20 31 38 6b 29 | 2e 20 20 49 66 20 63 6f |out 18k)|. If co|
|00001860| 6d 70 69 6c 65 64 20 77 | 69 74 68 0a 09 58 09 09 |mpiled w|ith..X..|
|00001870| 09 09 2d 44 52 45 41 4c | 4c 4f 43 2c 20 74 68 65 |..-DREAL|LOC, the|
|00001880| 72 65 20 69 73 20 6e 6f | 20 77 61 73 74 65 20 69 |re is no| waste i|
|00001890| 6e 76 6f 6c 76 65 64 2c | 20 73 69 6e 63 65 0a 09 |nvolved,| since..|
|000018a0| 58 09 09 09 09 74 68 65 | 20 62 75 66 66 65 72 73 |X....the| buffers|
|000018b0| 20 61 72 65 20 72 65 61 | 6c 6c 6f 63 27 64 20 61 | are rea|lloc'd a|
|000018c0| 66 74 65 72 20 74 68 65 | 69 72 20 73 69 7a 65 20 |fter the|ir size |
|000018d0| 69 73 0a 09 58 09 09 09 | 09 64 65 74 65 72 6d 69 |is..X...|.determi|
|000018e0| 6e 65 64 2e 20 20 54 68 | 65 72 65 20 73 65 65 6d |ned. Th|ere seem|
|000018f0| 73 20 74 6f 20 62 65 20 | 73 69 6d 69 6c 61 72 20 |s to be |similar |
|00001900| 74 69 6d 65 20 61 6e 64 | 0a 09 58 09 09 09 09 43 |time and|..X....C|
|00001910| 50 55 20 75 73 61 67 65 | 20 63 68 61 72 61 63 74 |PU usage| charact|
|00001920| 65 72 69 73 74 69 63 73 | 20 77 69 74 68 20 6f 72 |eristics| with or|
|00001930| 20 77 69 74 68 6f 75 74 | 0a 09 58 09 09 09 09 2d | without|..X....-|
|00001940| 44 52 45 41 4c 4c 4f 43 | 2c 20 62 75 74 20 74 68 |DREALLOC|, but th|
|00001950| 65 20 73 70 61 63 65 20 | 75 73 65 64 20 69 73 20 |e space |used is |
|00001960| 63 6f 6e 73 69 64 65 72 | 61 62 6c 79 0a 09 58 09 |consider|ably..X.|
|00001970| 09 09 09 6c 65 73 73 20 | 77 69 74 68 20 2d 44 52 |...less |with -DR|
|00001980| 45 41 4c 4c 4f 43 3a 20 | 61 20 33 32 30 6b 20 69 |EALLOC: |a 320k i|
|00001990| 6e 70 75 74 20 66 69 6c | 65 20 63 61 75 73 65 64 |nput fil|e caused|
|000019a0| 0a 09 58 09 09 09 09 74 | 68 65 20 64 79 6e 61 6d |..X....t|he dynam|
|000019b0| 69 63 20 73 69 7a 65 20 | 74 6f 20 67 72 6f 77 20 |ic size |to grow |
|000019c0| 74 6f 20 61 62 6f 75 74 | 20 35 30 30 6b 20 77 69 |to about| 500k wi|
|000019d0| 74 68 0a 09 58 09 09 09 | 09 2d 44 52 45 41 4c 4c |th..X...|.-DREALL|
|000019e0| 4f 43 2c 20 61 6e 64 20 | 74 6f 20 61 62 6f 75 74 |OC, and |to about|
|000019f0| 20 31 32 30 30 6b 20 77 | 69 74 68 6f 75 74 20 69 | 1200k w|ithout i|
|00001a00| 74 2e 20 20 2a 2f 0a 09 | 58 0a 09 58 23 64 65 66 |t. */..|X..X#def|
|00001a10| 69 6e 65 20 4d 41 58 50 | 41 47 45 53 20 35 30 30 |ine MAXP|AGES 500|
|00001a20| 20 20 20 20 20 20 20 20 | 20 2f 2a 20 4d 61 78 20 | | /* Max |
|00001a30| 6e 75 6d 62 65 72 20 6f | 66 20 70 61 67 65 73 20 |number o|f pages |
|00001a40| 69 6e 20 74 68 65 20 64 | 6f 63 75 6d 65 6e 74 20 |in the d|ocument |
|00001a50| 2a 2f 0a 09 58 0a 09 58 | 23 64 65 66 69 6e 65 20 |*/..X..X|#define |
|00001a60| 50 61 67 65 44 65 6c 69 | 6d 28 43 68 61 72 29 20 |PageDeli|m(Char) |
|00001a70| 28 43 68 61 72 20 3d 3d | 20 27 70 27 29 0a 09 58 |(Char ==| 'p')..X|
|00001a80| 23 64 65 66 69 6e 65 20 | 45 6e 64 4f 66 41 6c 6c |#define |EndOfAll|
|00001a90| 50 61 67 65 73 44 65 6c | 69 6d 53 74 72 69 6e 67 |PagesDel|imString|
|00001aa0| 20 22 78 20 74 72 61 69 | 6c 65 72 22 0a 09 58 23 | "x trai|ler"..X#|
|00001ab0| 64 65 66 69 6e 65 20 45 | 6e 64 4f 66 41 6c 6c 50 |define E|ndOfAllP|
|00001ac0| 61 67 65 73 28 4c 69 6e | 65 29 20 28 73 74 72 6e |ages(Lin|e) (strn|
|00001ad0| 63 6d 70 28 4c 69 6e 65 | 2c 20 45 6e 64 4f 66 41 |cmp(Line|, EndOfA|
|00001ae0| 6c 6c 50 61 67 65 73 44 | 65 6c 69 6d 53 74 72 69 |llPagesD|elimStri|
|00001af0| 6e 67 2c 20 39 29 20 3d | 3d 20 30 29 0a 09 58 0a |ng, 9) =|= 0)..X.|
|00001b00| 09 58 69 6e 74 20 50 61 | 67 65 49 6e 64 65 78 20 |.Xint Pa|geIndex |
|00001b10| 3d 20 30 3b 0a 09 58 0a | 09 58 6d 61 69 6e 28 61 |= 0;..X.|.Xmain(a|
|00001b20| 72 67 63 2c 20 61 72 67 | 76 29 0a 09 58 69 6e 74 |rgc, arg|v)..Xint|
|00001b30| 20 61 72 67 63 3b 0a 09 | 58 63 68 61 72 20 2a 2a | argc;..|Xchar **|
|00001b40| 61 72 67 76 3b 0a 09 58 | 7b 0a 09 58 09 46 49 4c |argv;..X|{..X.FIL|
|00001b50| 45 20 2a 49 6e 70 75 74 | 46 69 6c 65 20 3d 20 73 |E *Input|File = s|
|00001b60| 74 64 69 6e 3b 0a 09 58 | 09 63 68 61 72 20 2a 49 |tdin;..X|.char *I|
|00001b70| 6e 70 75 74 42 75 66 50 | 74 72 3b 0a 09 58 09 69 |nputBufP|tr;..X.i|
|00001b80| 6e 74 20 43 68 61 72 49 | 6e 64 65 78 20 3d 20 30 |nt CharI|ndex = 0|
|00001b90| 3b 0a 09 58 09 63 68 61 | 72 20 2a 50 61 67 65 42 |;..X.cha|r *PageB|
|00001ba0| 75 66 5b 4d 41 58 50 41 | 47 45 53 5d 3b 0a 09 58 |uf[MAXPA|GES];..X|
|00001bb0| 09 63 68 61 72 20 2a 66 | 67 65 74 73 28 29 2c 20 |.char *f|gets(), |
|00001bc0| 2a 6d 61 6c 6c 6f 63 28 | 29 2c 20 2a 72 65 61 6c |*malloc(|), *real|
|00001bd0| 6c 6f 63 28 29 3b 0a 09 | 58 0a 09 58 09 69 66 20 |loc();..|X..X.if |
|00001be0| 28 61 72 67 63 20 3e 20 | 32 29 20 7b 0a 09 58 09 |(argc > |2) {..X.|
|00001bf0| 09 66 70 75 74 73 28 22 | 55 73 61 67 65 3a 20 64 |.fputs("|Usage: d|
|00001c00| 69 74 72 65 76 20 5b 66 | 69 6c 65 5d 5c 6e 22 2c |itrev [f|ile]\n",|
|00001c10| 20 73 74 64 65 72 72 29 | 3b 0a 09 58 09 09 65 78 | stderr)|;..X..ex|
|00001c20| 69 74 28 31 29 3b 0a 09 | 58 09 7d 0a 09 58 0a 09 |it(1);..|X.}..X..|
|00001c30| 58 09 69 66 20 28 61 72 | 67 63 20 3d 3d 20 32 29 |X.if (ar|gc == 2)|
|00001c40| 20 7b 0a 09 58 09 09 49 | 6e 70 75 74 46 69 6c 65 | {..X..I|nputFile|
|00001c50| 20 3d 20 66 6f 70 65 6e | 28 61 72 67 76 5b 31 5d | = fopen|(argv[1]|
|00001c60| 2c 20 22 72 22 29 3b 0a | 09 58 09 09 69 66 20 28 |, "r");.|.X..if (|
|00001c70| 49 6e 70 75 74 46 69 6c | 65 20 3d 3d 20 4e 55 4c |InputFil|e == NUL|
|00001c80| 4c 29 20 7b 0a 09 58 09 | 09 09 70 65 72 72 6f 72 |L) {..X.|..perror|
|00001c90| 28 22 64 69 74 72 65 76 | 3a 20 66 6f 70 65 6e 22 |("ditrev|: fopen"|
|00001ca0| 29 3b 0a 09 58 09 09 09 | 65 78 69 74 28 31 29 3b |);..X...|exit(1);|
|00001cb0| 0a 09 58 09 09 7d 0a 09 | 58 09 7d 0a 09 58 0a 09 |..X..}..|X.}..X..|
|00001cc0| 58 09 50 61 67 65 42 75 | 66 5b 50 61 67 65 49 6e |X.PageBu|f[PageIn|
|00001cd0| 64 65 78 5d 20 3d 20 6d | 61 6c 6c 6f 63 28 50 41 |dex] = m|alloc(PA|
|00001ce0| 47 45 42 55 46 53 49 5a | 45 29 3b 0a 09 58 09 69 |GEBUFSIZ|E);..X.i|
|00001cf0| 66 20 28 50 61 67 65 42 | 75 66 5b 50 61 67 65 49 |f (PageB|uf[PageI|
|00001d00| 6e 64 65 78 5d 20 3d 3d | 20 4e 55 4c 4c 29 0a 09 |ndex] ==| NULL)..|
|00001d10| 58 09 09 41 62 6f 72 74 | 28 22 6d 61 6c 6c 6f 63 |X..Abort|("malloc|
|00001d20| 20 72 65 74 75 72 6e 65 | 64 20 6e 6f 20 73 74 6f | returne|d no sto|
|00001d30| 72 61 67 65 22 29 3b 0a | 09 58 0a 09 58 09 2f 2a |rage");.|.X..X./*|
|00001d40| 20 43 6f 70 79 20 70 72 | 65 6c 69 6d 69 6e 61 72 | Copy pr|eliminar|
|00001d50| 79 20 73 74 75 66 66 20 | 28 62 65 66 6f 72 65 20 |y stuff |(before |
|00001d60| 66 69 72 73 74 20 70 61 | 67 65 29 20 66 72 6f 6d |first pa|ge) from|
|00001d70| 20 69 6e 70 75 74 20 74 | 6f 20 6f 75 74 70 75 74 | input t|o output|
|00001d80| 20 2a 2f 0a 09 58 09 64 | 6f 20 7b 0a 09 58 09 09 | */..X.d|o {..X..|
|00001d90| 49 6e 70 75 74 42 75 66 | 50 74 72 20 3d 20 66 67 |InputBuf|Ptr = fg|
|00001da0| 65 74 73 28 26 50 61 67 | 65 42 75 66 5b 50 61 67 |ets(&Pag|eBuf[Pag|
|00001db0| 65 49 6e 64 65 78 5d 5b | 43 68 61 72 49 6e 64 65 |eIndex][|CharInde|
|00001dc0| 78 5d 2c 0a 09 58 09 09 | 09 09 20 20 20 20 50 41 |x],..X..|.. PA|
|00001dd0| 47 45 42 55 46 53 49 5a | 45 2c 20 49 6e 70 75 74 |GEBUFSIZ|E, Input|
|00001de0| 46 69 6c 65 29 3b 0a 09 | 58 09 09 69 66 20 28 49 |File);..|X..if (I|
|00001df0| 6e 70 75 74 42 75 66 50 | 74 72 20 3d 3d 20 4e 55 |nputBufP|tr == NU|
|00001e00| 4c 4c 29 20 20 2f 2a 20 | 45 4f 46 20 2a 2f 0a 09 |LL) /* |EOF */..|
|00001e10| 58 09 09 09 41 62 6f 72 | 74 28 22 49 6e 76 61 6c |X...Abor|t("Inval|
|00001e20| 69 64 20 69 6e 70 75 74 | 20 66 6f 72 6d 61 74 22 |id input| format"|
|00001e30| 29 3b 0a 09 58 09 09 69 | 66 20 28 50 61 67 65 44 |);..X..i|f (PageD|
|00001e40| 65 6c 69 6d 28 2a 49 6e | 70 75 74 42 75 66 50 74 |elim(*In|putBufPt|
|00001e50| 72 29 29 0a 09 58 09 09 | 09 62 72 65 61 6b 3b 0a |r))..X..|.break;.|
|00001e60| 09 58 09 09 66 70 75 74 | 73 28 49 6e 70 75 74 42 |.X..fput|s(InputB|
|00001e70| 75 66 50 74 72 2c 20 73 | 74 64 6f 75 74 29 3b 0a |ufPtr, s|tdout);.|
|00001e80| 09 58 09 7d 20 77 68 69 | 6c 65 28 31 29 3b 0a 09 |.X.} whi|le(1);..|
|00001e90| 58 0a 09 58 0a 09 58 09 | 2f 2a 20 4e 6f 77 20 72 |X..X..X.|/* Now r|
|00001ea0| 65 61 64 20 61 6e 64 20 | 73 74 6f 72 65 20 61 77 |ead and |store aw|
|00001eb0| 61 79 20 61 6c 6c 20 70 | 61 67 65 73 20 75 6e 74 |ay all p|ages unt|
|00001ec0| 69 6c 20 68 69 74 20 45 | 6e 64 4f 66 41 6c 6c 50 |il hit E|ndOfAllP|
|00001ed0| 61 67 65 73 20 2a 2f 0a | 09 58 09 64 6f 20 7b 0a |ages */.|.X.do {.|
|00001ee0| 09 58 09 09 49 6e 70 75 | 74 42 75 66 50 74 72 20 |.X..Inpu|tBufPtr |
|00001ef0| 3d 20 66 67 65 74 73 28 | 26 50 61 67 65 42 75 66 |= fgets(|&PageBuf|
|00001f00| 5b 50 61 67 65 49 6e 64 | 65 78 5d 5b 43 68 61 72 |[PageInd|ex][Char|
|00001f10| 49 6e 64 65 78 5d 2c 0a | 09 58 09 09 09 09 20 20 |Index],.|.X.... |
|00001f20| 20 20 50 41 47 45 42 55 | 46 53 49 5a 45 2c 20 49 | PAGEBU|FSIZE, I|
|00001f30| 6e 70 75 74 46 69 6c 65 | 29 3b 0a 09 58 09 09 69 |nputFile|);..X..i|
|00001f40| 66 20 28 49 6e 70 75 74 | 42 75 66 50 74 72 20 3d |f (Input|BufPtr =|
|00001f50| 3d 20 4e 55 4c 4c 29 20 | 20 2f 2a 20 45 4f 46 20 |= NULL) | /* EOF |
|00001f60| 2a 2f 0a 09 58 09 09 09 | 41 62 6f 72 74 28 22 49 |*/..X...|Abort("I|
|00001f70| 6e 76 61 6c 69 64 20 69 | 6e 70 75 74 20 66 6f 72 |nvalid i|nput for|
|00001f80| 6d 61 74 22 29 3b 0a 09 | 58 09 09 69 66 20 28 45 |mat");..|X..if (E|
|00001f90| 6e 64 4f 66 41 6c 6c 50 | 61 67 65 73 28 49 6e 70 |ndOfAllP|ages(Inp|
|00001fa0| 75 74 42 75 66 50 74 72 | 29 29 20 7b 0a 09 58 09 |utBufPtr|)) {..X.|
|00001fb0| 09 09 2f 2a 20 50 75 74 | 20 61 20 70 61 67 65 20 |../* Put| a page |
|00001fc0| 64 65 6c 69 6d 65 74 65 | 72 20 69 6e 74 6f 20 74 |delimete|r into t|
|00001fd0| 68 65 20 65 6e 64 20 6f | 66 20 74 68 69 73 20 70 |he end o|f this p|
|00001fe0| 61 67 65 20 73 6f 0a 09 | 58 09 09 09 20 20 20 77 |age so..|X... w|
|00001ff0| 65 20 63 61 6e 20 66 69 | 6e 64 20 74 68 65 20 65 |e can fi|nd the e|
|00002000| 6e 64 20 77 68 65 6e 20 | 77 65 20 61 72 65 20 70 |nd when |we are p|
|00002010| 72 69 6e 74 69 6e 67 20 | 65 76 65 72 79 74 68 69 |rinting |everythi|
|00002020| 6e 67 0a 09 58 09 09 09 | 20 20 20 6f 75 74 20 2a |ng..X...| out *|
|00002030| 2f 0a 09 58 09 09 09 2a | 49 6e 70 75 74 42 75 66 |/..X...*|InputBuf|
|00002040| 50 74 72 20 3d 20 27 70 | 27 3b 0a 09 58 09 09 09 |Ptr = 'p|';..X...|
|00002050| 62 72 65 61 6b 3b 0a 09 | 58 09 09 7d 0a 09 58 09 |break;..|X..}..X.|
|00002060| 09 43 68 61 72 49 6e 64 | 65 78 20 2b 3d 20 73 74 |.CharInd|ex += st|
|00002070| 72 6c 65 6e 28 49 6e 70 | 75 74 42 75 66 50 74 72 |rlen(Inp|utBufPtr|
|00002080| 29 20 2b 20 31 3b 0a 09 | 58 09 09 2f 2a 20 2b 31 |) + 1;..|X../* +1|
|00002090| 20 73 6f 20 77 65 20 64 | 6f 6e 27 74 20 77 72 69 | so we d|on't wri|
|000020a0| 74 65 20 6f 76 65 72 20 | 74 68 65 20 6e 75 6c 6c |te over |the null|
|000020b0| 20 74 65 72 6d 69 6e 61 | 74 6f 72 20 2a 2f 0a 09 | termina|tor */..|
|000020c0| 58 09 09 69 66 20 28 43 | 68 61 72 49 6e 64 65 78 |X..if (C|harIndex|
|000020d0| 20 3e 3d 20 50 41 47 45 | 42 55 46 53 49 5a 45 29 | >= PAGE|BUFSIZE)|
|000020e0| 20 7b 0a 09 58 09 09 09 | 41 62 6f 72 74 28 22 50 | {..X...|Abort("P|
|000020f0| 61 67 65 20 73 69 7a 65 | 20 62 65 69 6e 67 20 6d |age size| being m|
|00002100| 61 6c 6c 6f 63 27 64 20 | 69 73 20 74 6f 6f 20 73 |alloc'd |is too s|
|00002110| 6d 61 6c 6c 20 28 72 65 | 63 6f 6d 70 69 6c 65 20 |mall (re|compile |
|00002120| 77 69 74 68 20 6c 61 72 | 67 65 72 20 50 41 47 45 |with lar|ger PAGE|
|00002130| 42 55 46 53 49 5a 45 29 | 22 29 3b 0a 09 58 09 09 |BUFSIZE)|");..X..|
|00002140| 7d 0a 09 58 09 09 69 66 | 20 28 50 61 67 65 44 65 |}..X..if| (PageDe|
|00002150| 6c 69 6d 28 2a 49 6e 70 | 75 74 42 75 66 50 74 72 |lim(*Inp|utBufPtr|
|00002160| 29 29 20 7b 0a 09 58 23 | 69 66 64 65 66 20 52 45 |)) {..X#|ifdef RE|
|00002170| 41 4c 4c 4f 43 0a 09 58 | 09 09 09 2f 2a 20 4e 6f |ALLOC..X|.../* No|
|00002180| 77 20 74 68 61 74 20 77 | 65 20 6b 6e 6f 77 20 68 |w that w|e know h|
|00002190| 6f 77 20 62 69 67 20 74 | 68 69 73 20 70 61 67 65 |ow big t|his page|
|000021a0| 20 69 73 2c 20 72 65 61 | 6c 6c 6f 63 20 74 68 65 | is, rea|lloc the|
|000021b0| 0a 09 58 09 09 09 20 20 | 20 6f 6c 64 20 70 61 67 |..X... | old pag|
|000021c0| 65 20 62 75 66 66 65 72 | 20 73 6f 20 77 65 20 64 |e buffer| so we d|
|000021d0| 6f 6e 27 74 20 77 61 73 | 74 65 20 75 6e 75 73 65 |on't was|te unuse|
|000021e0| 64 20 73 70 61 63 65 20 | 2a 2f 0a 09 58 09 09 09 |d space |*/..X...|
|000021f0| 50 61 67 65 42 75 66 5b | 50 61 67 65 49 6e 64 65 |PageBuf[|PageInde|
|00002200| 78 5d 20 3d 20 72 65 61 | 6c 6c 6f 63 28 50 61 67 |x] = rea|lloc(Pag|
|00002210| 65 42 75 66 5b 50 61 67 | 65 49 6e 64 65 78 5d 2c |eBuf[Pag|eIndex],|
|00002220| 0a 09 58 09 09 09 09 09 | 09 20 20 20 20 20 43 68 |..X.....|. Ch|
|00002230| 61 72 49 6e 64 65 78 29 | 3b 0a 09 58 09 09 09 69 |arIndex)|;..X...i|
|00002240| 66 20 28 50 61 67 65 42 | 75 66 5b 50 61 67 65 49 |f (PageB|uf[PageI|
|00002250| 6e 64 65 78 5d 20 3d 3d | 20 4e 55 4c 4c 29 0a 09 |ndex] ==| NULL)..|
|00002260| 58 09 09 09 09 41 62 6f | 72 74 28 22 72 65 61 6c |X....Abo|rt("real|
|00002270| 6c 6f 63 20 72 65 74 75 | 72 6e 65 64 20 6e 6f 20 |loc retu|rned no |
|00002280| 73 74 6f 72 61 67 65 22 | 29 3b 0a 09 58 23 65 6e |storage"|);..X#en|
|00002290| 64 69 66 20 52 45 41 4c | 4c 4f 43 0a 09 58 09 09 |dif REAL|LOC..X..|
|000022a0| 09 2f 2a 20 28 4c 65 61 | 76 65 20 74 68 65 20 70 |./* (Lea|ve the p|
|000022b0| 61 67 65 20 64 65 6c 69 | 6d 65 74 65 72 20 69 6e |age deli|meter in|
|000022c0| 20 70 6c 61 63 65 20 73 | 6f 20 77 65 20 63 61 6e | place s|o we can|
|000022d0| 20 66 69 6e 64 0a 09 58 | 09 09 09 20 20 20 74 68 | find..X|... th|
|000022e0| 65 20 65 6e 64 20 6f 66 | 20 74 68 65 20 6f 6c 64 |e end of| the old|
|000022f0| 20 70 61 67 65 20 77 68 | 65 6e 20 77 65 20 61 72 | page wh|en we ar|
|00002300| 65 20 70 72 69 6e 74 69 | 6e 67 0a 09 58 09 09 09 |e printi|ng..X...|
|00002310| 20 20 20 65 76 65 72 79 | 74 68 69 6e 67 20 6f 75 | every|thing ou|
|00002320| 74 29 2e 20 20 41 64 76 | 61 6e 63 65 20 50 61 67 |t). Adv|ance Pag|
|00002330| 65 49 6e 64 65 78 2c 20 | 72 65 73 65 74 0a 09 58 |eIndex, |reset..X|
|00002340| 09 09 09 20 20 20 43 68 | 61 72 49 6e 64 65 78 2c |... Ch|arIndex,|
|00002350| 20 61 6e 64 20 6d 61 6c | 6c 6f 63 20 6d 6f 72 65 | and mal|loc more|
|00002360| 20 73 74 6f 72 61 67 65 | 2c 20 73 6f 20 77 65 20 | storage|, so we |
|00002370| 63 61 6e 20 73 74 61 72 | 74 0a 09 58 09 09 09 20 |can star|t..X... |
|00002380| 20 20 72 65 61 64 69 6e | 67 20 69 6e 20 74 68 65 | readin|g in the|
|00002390| 20 6e 65 78 74 20 70 61 | 67 65 20 2a 2f 0a 09 58 | next pa|ge */..X|
|000023a0| 09 09 09 50 61 67 65 49 | 6e 64 65 78 2b 2b 3b 0a |...PageI|ndex++;.|
|000023b0| 09 58 09 09 09 50 61 67 | 65 42 75 66 5b 50 61 67 |.X...Pag|eBuf[Pag|
|000023c0| 65 49 6e 64 65 78 5d 20 | 3d 20 6d 61 6c 6c 6f 63 |eIndex] |= malloc|
|000023d0| 28 50 41 47 45 42 55 46 | 53 49 5a 45 29 3b 0a 09 |(PAGEBUF|SIZE);..|
|000023e0| 58 09 09 09 69 66 20 28 | 50 61 67 65 42 75 66 5b |X...if (|PageBuf[|
|000023f0| 50 61 67 65 49 6e 64 65 | 78 5d 20 3d 3d 20 4e 55 |PageInde|x] == NU|
|00002400| 4c 4c 29 0a 09 58 09 09 | 09 09 41 62 6f 72 74 28 |LL)..X..|..Abort(|
|00002410| 22 6d 61 6c 6c 6f 63 20 | 72 65 74 75 72 6e 65 64 |"malloc |returned|
|00002420| 20 6e 6f 20 73 74 6f 72 | 61 67 65 22 29 3b 0a 09 | no stor|age");..|
|00002430| 58 09 09 09 43 68 61 72 | 49 6e 64 65 78 20 3d 20 |X...Char|Index = |
|00002440| 30 3b 0a 09 58 09 09 7d | 0a 09 58 09 7d 20 77 68 |0;..X..}|..X.} wh|
|00002450| 69 6c 65 28 31 29 3b 0a | 09 58 0a 09 58 0a 09 58 |ile(1);.|.X..X..X|
|00002460| 09 2f 2a 20 4e 6f 77 20 | 70 72 69 6e 74 20 6f 75 |./* Now |print ou|
|00002470| 74 20 74 68 65 20 62 75 | 66 66 65 72 65 64 20 75 |t the bu|ffered u|
|00002480| 70 20 70 61 67 65 73 20 | 69 6e 20 72 65 76 65 72 |p pages |in rever|
|00002490| 73 65 20 6f 72 64 65 72 | 20 2a 2f 0a 09 58 0a 09 |se order| */..X..|
|000024a0| 58 09 66 6f 72 20 28 50 | 61 67 65 49 6e 64 65 78 |X.for (P|ageIndex|
|000024b0| 20 3d 20 50 61 67 65 49 | 6e 64 65 78 3b 20 50 61 | = PageI|ndex; Pa|
|000024c0| 67 65 49 6e 64 65 78 20 | 3e 3d 20 30 3b 20 50 61 |geIndex |>= 0; Pa|
|000024d0| 67 65 49 6e 64 65 78 2d | 2d 29 20 7b 0a 09 58 09 |geIndex-|-) {..X.|
|000024e0| 09 43 68 61 72 49 6e 64 | 65 78 20 3d 20 30 3b 0a |.CharInd|ex = 0;.|
|000024f0| 09 58 09 09 2f 2a 20 4f | 75 74 70 75 74 20 74 68 |.X../* O|utput th|
|00002500| 65 20 70 61 67 65 20 64 | 65 6c 69 6d 65 74 65 72 |e page d|elimeter|
|00002510| 20 72 65 63 6f 72 64 20 | 65 78 70 65 63 74 65 64 | record |expected|
|00002520| 20 62 79 20 74 68 65 20 | 64 72 69 76 65 72 73 20 | by the |drivers |
|00002530| 2a 2f 0a 09 58 09 09 70 | 72 69 6e 74 66 28 22 70 |*/..X..p|rintf("p|
|00002540| 25 64 5c 6e 22 2c 20 50 | 61 67 65 49 6e 64 65 78 |%d\n", P|ageIndex|
|00002550| 20 2b 20 31 29 3b 0a 09 | 58 09 09 64 6f 20 7b 0a | + 1);..|X..do {.|
|00002560| 09 58 09 09 09 69 66 20 | 28 50 61 67 65 44 65 6c |.X...if |(PageDel|
|00002570| 69 6d 28 50 61 67 65 42 | 75 66 5b 50 61 67 65 49 |im(PageB|uf[PageI|
|00002580| 6e 64 65 78 5d 5b 43 68 | 61 72 49 6e 64 65 78 5d |ndex][Ch|arIndex]|
|00002590| 29 29 0a 09 58 09 09 09 | 09 62 72 65 61 6b 3b 0a |))..X...|.break;.|
|000025a0| 09 58 09 09 09 66 70 75 | 74 73 28 26 50 61 67 65 |.X...fpu|ts(&Page|
|000025b0| 42 75 66 5b 50 61 67 65 | 49 6e 64 65 78 5d 5b 43 |Buf[Page|Index][C|
|000025c0| 68 61 72 49 6e 64 65 78 | 5d 2c 20 73 74 64 6f 75 |harIndex|], stdou|
|000025d0| 74 29 3b 0a 09 58 09 09 | 09 43 68 61 72 49 6e 64 |t);..X..|.CharInd|
|000025e0| 65 78 20 2b 3d 20 73 74 | 72 6c 65 6e 28 26 50 61 |ex += st|rlen(&Pa|
|000025f0| 67 65 42 75 66 5b 50 61 | 67 65 49 6e 64 65 78 5d |geBuf[Pa|geIndex]|
|00002600| 5b 43 68 61 72 49 6e 64 | 65 78 5d 29 20 2b 20 31 |[CharInd|ex]) + 1|
|00002610| 3b 0a 09 58 09 09 09 2f | 2a 20 2b 31 20 74 6f 20 |;..X.../|* +1 to |
|00002620| 73 6b 69 70 20 74 68 65 | 20 6e 75 6c 6c 20 74 65 |skip the| null te|
|00002630| 72 6d 69 6e 61 74 6f 72 | 20 2a 2f 0a 09 58 09 09 |rminator| */..X..|
|00002640| 7d 20 77 68 69 6c 65 28 | 31 29 3b 0a 09 58 09 7d |} while(|1);..X.}|
|00002650| 0a 09 58 0a 09 58 09 2f | 2a 20 4e 6f 77 20 70 72 |..X..X./|* Now pr|
|00002660| 69 6e 74 20 6f 75 74 20 | 74 68 65 20 66 69 6e 61 |int out |the fina|
|00002670| 6c 20 6c 69 6e 65 73 2c | 20 73 74 61 72 74 69 6e |l lines,| startin|
|00002680| 67 20 77 69 74 68 20 74 | 68 65 20 65 6e 64 2d 70 |g with t|he end-p|
|00002690| 61 67 65 73 0a 09 58 09 | 20 20 20 64 65 6c 69 6d |ages..X.| delim|
|000026a0| 65 74 65 72 20 6c 69 6e | 65 20 2a 2f 0a 09 58 09 |eter lin|e */..X.|
|000026b0| 70 75 74 73 28 45 6e 64 | 4f 66 41 6c 6c 50 61 67 |puts(End|OfAllPag|
|000026c0| 65 73 44 65 6c 69 6d 53 | 74 72 69 6e 67 29 3b 0a |esDelimS|tring);.|
|000026d0| 09 58 09 50 61 67 65 49 | 6e 64 65 78 20 3d 20 30 |.X.PageI|ndex = 0|
|000026e0| 3b 0a 09 58 09 43 68 61 | 72 49 6e 64 65 78 20 3d |;..X.Cha|rIndex =|
|000026f0| 20 30 3b 0a 09 58 23 69 | 66 64 65 66 20 52 45 41 | 0;..X#i|fdef REA|
|00002700| 4c 4c 4f 43 0a 09 58 09 | 2f 2a 20 43 75 72 72 65 |LLOC..X.|/* Curre|
|00002710| 6e 74 20 50 61 67 65 42 | 75 66 20 6d 61 79 20 68 |nt PageB|uf may h|
|00002720| 61 76 65 20 62 65 65 6e | 20 63 68 6f 70 70 65 64 |ave been| chopped|
|00002730| 20 6f 66 66 20 74 6f 6f | 20 73 68 6f 72 74 20 66 | off too| short f|
|00002740| 6f 72 20 66 69 6e 61 6c | 0a 09 58 09 20 20 20 73 |or final|..X. s|
|00002750| 74 75 66 66 20 2a 2f 0a | 09 58 09 50 61 67 65 42 |tuff */.|.X.PageB|
|00002760| 75 66 5b 50 61 67 65 49 | 6e 64 65 78 5d 20 3d 20 |uf[PageI|ndex] = |
|00002770| 72 65 61 6c 6c 6f 63 28 | 50 61 67 65 42 75 66 5b |realloc(|PageBuf[|
|00002780| 50 61 67 65 49 6e 64 65 | 78 5d 2c 20 50 41 47 45 |PageInde|x], PAGE|
|00002790| 42 55 46 53 49 5a 45 29 | 3b 0a 09 58 09 69 66 20 |BUFSIZE)|;..X.if |
|000027a0| 28 50 61 67 65 42 75 66 | 5b 50 61 67 65 49 6e 64 |(PageBuf|[PageInd|
|000027b0| 65 78 5d 20 3d 3d 20 4e | 55 4c 4c 29 0a 09 58 09 |ex] == N|ULL)..X.|
|000027c0| 09 41 62 6f 72 74 28 22 | 72 65 61 6c 6c 6f 63 20 |.Abort("|realloc |
|000027d0| 72 65 74 75 72 6e 65 64 | 20 6e 6f 20 73 74 6f 72 |returned| no stor|
|000027e0| 61 67 65 22 29 3b 0a 09 | 58 23 65 6e 64 69 66 20 |age");..|X#endif |
|000027f0| 52 45 41 4c 4c 4f 43 0a | 09 58 09 64 6f 20 7b 0a |REALLOC.|.X.do {.|
|00002800| 09 58 09 09 49 6e 70 75 | 74 42 75 66 50 74 72 20 |.X..Inpu|tBufPtr |
|00002810| 3d 20 66 67 65 74 73 28 | 26 50 61 67 65 42 75 66 |= fgets(|&PageBuf|
|00002820| 5b 50 61 67 65 49 6e 64 | 65 78 5d 5b 43 68 61 72 |[PageInd|ex][Char|
|00002830| 49 6e 64 65 78 5d 2c 0a | 09 58 09 09 09 09 20 20 |Index],.|.X.... |
|00002840| 20 20 50 41 47 45 42 55 | 46 53 49 5a 45 2c 20 49 | PAGEBU|FSIZE, I|
|00002850| 6e 70 75 74 46 69 6c 65 | 29 3b 0a 09 58 09 09 69 |nputFile|);..X..i|
|00002860| 66 20 28 49 6e 70 75 74 | 42 75 66 50 74 72 20 3d |f (Input|BufPtr =|
|00002870| 3d 20 4e 55 4c 4c 29 20 | 20 20 2f 2a 20 45 4f 46 |= NULL) | /* EOF|
|00002880| 20 2a 2f 0a 09 58 09 09 | 09 65 78 69 74 28 30 29 | */..X..|.exit(0)|
|00002890| 3b 0a 09 58 09 09 66 70 | 75 74 73 28 49 6e 70 75 |;..X..fp|uts(Inpu|
|000028a0| 74 42 75 66 50 74 72 2c | 20 73 74 64 6f 75 74 29 |tBufPtr,| stdout)|
|000028b0| 3b 0a 09 58 09 7d 20 77 | 68 69 6c 65 28 31 29 3b |;..X.} w|hile(1);|
|000028c0| 0a 09 58 7d 0a 09 58 0a | 09 58 41 62 6f 72 74 28 |..X}..X.|.XAbort(|
|000028d0| 4d 65 73 73 61 67 65 29 | 0a 09 58 63 68 61 72 20 |Message)|..Xchar |
|000028e0| 2a 4d 65 73 73 61 67 65 | 3b 0a 09 58 7b 0a 09 58 |*Message|;..X{..X|
|000028f0| 09 09 66 70 72 69 6e 74 | 66 28 73 74 64 65 72 72 |..fprint|f(stderr|
|00002900| 2c 20 22 64 69 74 72 65 | 76 3a 20 25 73 20 61 74 |, "ditre|v: %s at|
|00002910| 20 70 61 67 65 20 25 64 | 5c 6e 22 2c 20 4d 65 73 | page %d|\n", Mes|
|00002920| 73 61 67 65 2c 20 50 61 | 67 65 49 6e 64 65 78 29 |sage, Pa|geIndex)|
|00002930| 3b 0a 09 58 09 09 65 78 | 69 74 28 31 29 3b 0a 09 |;..X..ex|it(1);..|
|00002940| 58 7d 0a 53 48 41 52 5f | 45 4f 46 0a 69 66 20 74 |X}.SHAR_|EOF.if t|
|00002950| 65 73 74 20 35 31 39 38 | 20 2d 6e 65 20 22 60 77 |est 5198| -ne "`w|
|00002960| 63 20 2d 63 20 3c 20 27 | 64 69 74 72 65 76 2e 63 |c -c < '|ditrev.c|
|00002970| 27 60 22 0a 74 68 65 6e | 0a 09 65 63 68 6f 20 73 |'`".then|..echo s|
|00002980| 68 61 72 3a 20 22 65 72 | 72 6f 72 20 74 72 61 6e |har: "er|ror tran|
|00002990| 73 6d 69 74 74 69 6e 67 | 20 27 64 69 74 72 65 76 |smitting| 'ditrev|
|000029a0| 2e 63 27 22 20 27 28 73 | 68 6f 75 6c 64 20 68 61 |.c'" '(s|hould ha|
|000029b0| 76 65 20 62 65 65 6e 20 | 35 31 39 38 20 63 68 61 |ve been |5198 cha|
|000029c0| 72 61 63 74 65 72 73 29 | 27 0a 66 69 0a 66 69 0a |racters)|'.fi.fi.|
|000029d0| 65 63 68 6f 20 73 68 61 | 72 3a 20 22 65 78 74 72 |echo sha|r: "extr|
|000029e0| 61 63 74 69 6e 67 20 27 | 6d 61 6b 65 66 69 6c 65 |acting '|makefile|
|000029f0| 27 22 20 27 28 31 34 36 | 20 63 68 61 72 61 63 74 |'" '(146| charact|
|00002a00| 65 72 73 29 27 0a 69 66 | 20 74 65 73 74 20 2d 66 |ers)'.if| test -f|
|00002a10| 20 27 6d 61 6b 65 66 69 | 6c 65 27 0a 74 68 65 6e | 'makefi|le'.then|
|00002a20| 0a 09 65 63 68 6f 20 73 | 68 61 72 3a 20 22 77 69 |..echo s|har: "wi|
|00002a30| 6c 6c 20 6e 6f 74 20 6f | 76 65 72 2d 77 72 69 74 |ll not o|ver-writ|
|00002a40| 65 20 65 78 69 73 74 69 | 6e 67 20 66 69 6c 65 20 |e existi|ng file |
|00002a50| 27 6d 61 6b 65 66 69 6c | 65 27 22 0a 65 6c 73 65 |'makefil|e'".else|
|00002a60| 0a 73 65 64 20 27 73 2f | 5e 09 58 2f 2f 27 20 3c |.sed 's/|^.X//' <|
|00002a70| 3c 20 5c 53 48 41 52 5f | 45 4f 46 20 3e 20 27 6d |< \SHAR_|EOF > 'm|
|00002a80| 61 6b 65 66 69 6c 65 27 | 0a 09 58 23 20 75 73 65 |akefile'|..X# use|
|00002a90| 20 2d 44 52 45 41 4c 4c | 4f 43 20 69 66 20 79 6f | -DREALL|OC if yo|
|00002aa0| 75 20 77 61 6e 74 20 74 | 68 69 73 20 70 72 6f 67 |u want t|his prog|
|00002ab0| 72 61 6d 20 74 6f 20 75 | 73 65 20 72 65 61 6c 6c |ram to u|se reall|
|00002ac0| 6f 63 28 31 29 0a 09 58 | 43 46 4c 41 47 53 20 3d |oc(1)..X|CFLAGS =|
|00002ad0| 20 2d 4f 20 2d 44 52 45 | 41 4c 4c 4f 43 0a 09 58 | -O -DRE|ALLOC..X|
|00002ae0| 0a 09 58 64 69 74 72 65 | 76 3a 09 64 69 74 72 65 |..Xditre|v:.ditre|
|00002af0| 76 2e 63 0a 09 58 09 63 | 63 20 24 7b 43 46 4c 41 |v.c..X.c|c ${CFLA|
|00002b00| 47 53 7d 20 2d 6f 20 64 | 69 74 72 65 76 20 64 69 |GS} -o d|itrev di|
|00002b10| 74 72 65 76 2e 63 0a 09 | 58 09 73 74 72 69 70 20 |trev.c..|X.strip |
|00002b20| 64 69 74 72 65 76 0a 53 | 48 41 52 5f 45 4f 46 0a |ditrev.S|HAR_EOF.|
|00002b30| 69 66 20 74 65 73 74 20 | 31 34 36 20 2d 6e 65 20 |if test |146 -ne |
|00002b40| 22 60 77 63 20 2d 63 20 | 3c 20 27 6d 61 6b 65 66 |"`wc -c |< 'makef|
|00002b50| 69 6c 65 27 60 22 0a 74 | 68 65 6e 0a 09 65 63 68 |ile'`".t|hen..ech|
|00002b60| 6f 20 73 68 61 72 3a 20 | 22 65 72 72 6f 72 20 74 |o shar: |"error t|
|00002b70| 72 61 6e 73 6d 69 74 74 | 69 6e 67 20 27 6d 61 6b |ransmitt|ing 'mak|
|00002b80| 65 66 69 6c 65 27 22 20 | 27 28 73 68 6f 75 6c 64 |efile'" |'(should|
|00002b90| 20 68 61 76 65 20 62 65 | 65 6e 20 31 34 36 20 63 | have be|en 146 c|
|00002ba0| 68 61 72 61 63 74 65 72 | 73 29 27 0a 66 69 0a 66 |haracter|s)'.fi.f|
|00002bb0| 69 0a 65 78 69 74 20 30 | 0a 23 09 45 6e 64 20 6f |i.exit 0|.#.End o|
|00002bc0| 66 20 73 68 65 6c 6c 20 | 61 72 63 68 69 76 65 0a |f shell |archive.|
+--------+-------------------------+-------------------------+--------+--------+