home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / unix / volume04 / archx < prev    next >
SHell self-extracting ARchive  |  1988-09-11  |  18.4 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 C source text default
98% file C source, ASCII text default
100% TrID E-Mail message (Var. 2) 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 67 65 | 6e 72 61 64 21 64 65 63 |From: ge|nrad!dec|
|00000010| 76 61 78 21 64 65 63 77 | 72 6c 21 64 65 63 2d 72 |vax!decw|rl!dec-r|
|00000020| 68 65 61 21 64 65 63 2d | 70 61 75 70 65 72 21 6d |hea!dec-|pauper!m|
|00000030| 69 6e 6f 77 20 20 28 4d | 61 72 74 69 6e 20 4d 69 |inow (M|artin Mi|
|00000040| 6e 6f 77 29 0a 53 75 62 | 6a 65 63 74 3a 20 61 72 |now).Sub|ject: ar|
|00000050| 63 68 78 3a 20 73 75 67 | 67 65 73 74 65 64 20 72 |chx: sug|gested r|
|00000060| 65 70 6c 61 63 65 6d 65 | 6e 74 20 66 6f 72 20 73 |eplaceme|nt for s|
|00000070| 68 61 72 0a 4e 65 77 73 | 67 72 6f 75 70 73 3a 20 |har.News|groups: |
|00000080| 6d 6f 64 2e 73 6f 75 72 | 63 65 73 0a 41 70 70 72 |mod.sour|ces.Appr|
|00000090| 6f 76 65 64 3a 20 6a 70 | 6e 40 70 61 6e 64 61 2e |oved: jp|n@panda.|
|000000a0| 55 55 43 50 0a 0a 4d 6f | 64 2e 73 6f 75 72 63 65 |UUCP..Mo|d.source|
|000000b0| 73 3a 20 20 56 6f 6c 75 | 6d 65 20 34 2c 20 49 73 |s: Volu|me 4, Is|
|000000c0| 73 75 65 20 38 30 0a 53 | 75 62 6d 69 74 74 65 64 |sue 80.S|ubmitted|
|000000d0| 20 62 79 3a 20 64 65 63 | 76 61 78 21 64 65 63 77 | by: dec|vax!decw|
|000000e0| 72 6c 21 64 65 63 2d 72 | 68 65 61 21 64 65 63 2d |rl!dec-r|hea!dec-|
|000000f0| 70 61 75 70 65 72 21 6d | 69 6e 6f 77 20 20 28 4d |pauper!m|inow (M|
|00000100| 61 72 74 69 6e 20 4d 69 | 6e 6f 77 29 0a 0a 5b 0a |artin Mi|now)..[.|
|00000110| 20 20 54 68 69 73 20 69 | 73 20 6f 6e 65 20 6f 66 | This i|s one of|
|00000120| 20 74 77 6f 20 73 75 62 | 6d 69 73 73 69 6f 6e 73 | two sub|missions|
|00000130| 20 6f 66 20 70 72 6f 67 | 72 61 6d 73 20 74 68 61 | of prog|rams tha|
|00000140| 74 20 70 72 6f 76 69 64 | 65 20 61 6c 74 65 72 6e |t provid|e altern|
|00000150| 61 74 69 76 65 73 20 74 | 6f 0a 20 20 22 73 68 61 |atives t|o. "sha|
|00000160| 72 22 20 61 73 20 61 20 | 73 6f 75 72 63 65 20 61 |r" as a |source a|
|00000170| 72 63 68 69 76 65 20 66 | 6f 72 6d 61 74 2e 20 20 |rchive f|ormat. |
|00000180| 54 68 69 73 20 64 6f 65 | 73 20 6e 6f 74 20 69 6d |This doe|s not im|
|00000190| 70 6c 79 20 6d 79 20 73 | 75 70 70 6f 72 74 20 6f |ply my s|upport o|
|000001a0| 66 0a 20 20 6f 6e 65 20 | 66 6f 72 6d 61 74 20 6f |f. one |format o|
|000001b0| 76 65 72 20 61 6e 6f 74 | 68 65 72 2e 20 20 4f 68 |ver anot|her. Oh|
|000001c0| 2c 20 49 20 61 6d 20 64 | 69 73 74 72 69 62 75 74 |, I am d|istribut|
|000001d0| 69 6e 67 20 74 68 65 73 | 65 20 69 6e 20 22 73 68 |ing thes|e in "sh|
|000001e0| 61 72 22 20 66 6f 72 6d | 61 74 0a 20 20 74 6f 20 |ar" form|at. to |
|000001f0| 61 76 6f 69 64 20 74 68 | 65 20 63 68 69 63 6b 65 |avoid th|e chicke|
|00000200| 6e 2d 6f 72 2d 65 67 67 | 20 70 72 6f 62 6c 65 6d |n-or-egg| problem|
|00000210| 2e 0a 09 2d 20 4a 6f 68 | 6e 20 4e 65 6c 73 6f 6e |...- Joh|n Nelson|
|00000220| 20 2d 20 6d 6f 64 65 72 | 61 74 6f 72 2c 20 6d 6f | - moder|ator, mo|
|00000230| 64 2e 73 6f 75 72 63 65 | 73 0a 5d 0a 23 21 20 2f |d.source|s.].#! /|
|00000240| 62 69 6e 2f 73 68 0a 23 | 20 54 68 69 73 20 69 73 |bin/sh.#| This is|
|00000250| 20 61 20 73 68 65 6c 6c | 20 61 72 63 68 69 76 65 | a shell| archive|
|00000260| 2c 20 6d 65 61 6e 69 6e | 67 3a 0a 23 20 31 2e 20 |, meanin|g:.# 1. |
|00000270| 52 65 6d 6f 76 65 20 65 | 76 65 72 79 74 68 69 6e |Remove e|verythin|
|00000280| 67 20 61 62 6f 76 65 20 | 74 68 65 20 23 21 20 2f |g above |the #! /|
|00000290| 62 69 6e 2f 73 68 20 6c | 69 6e 65 2e 0a 23 20 32 |bin/sh l|ine..# 2|
|000002a0| 2e 20 53 61 76 65 20 74 | 68 65 20 72 65 73 75 6c |. Save t|he resul|
|000002b0| 74 69 6e 67 20 74 65 78 | 74 20 69 6e 20 61 20 66 |ting tex|t in a f|
|000002c0| 69 6c 65 2e 0a 23 20 33 | 2e 20 45 78 65 63 75 74 |ile..# 3|. Execut|
|000002d0| 65 20 74 68 65 20 66 69 | 6c 65 20 77 69 74 68 20 |e the fi|le with |
|000002e0| 2f 62 69 6e 2f 73 68 20 | 28 6e 6f 74 20 63 73 68 |/bin/sh |(not csh|
|000002f0| 29 20 74 6f 20 63 72 65 | 61 74 65 20 74 68 65 20 |) to cre|ate the |
|00000300| 66 69 6c 65 73 3a 0a 23 | 09 72 65 61 64 6d 65 2e |files:.#|.readme.|
|00000310| 74 78 74 0a 23 09 61 72 | 63 68 63 2e 63 0a 23 09 |txt.#.ar|chc.c.#.|
|00000320| 61 72 63 68 78 2e 63 0a | 23 20 54 68 69 73 20 61 |archx.c.|# This a|
|00000330| 72 63 68 69 76 65 20 63 | 72 65 61 74 65 64 3a 20 |rchive c|reated: |
|00000340| 54 68 75 20 4d 61 79 20 | 20 31 20 30 38 3a 33 33 |Thu May | 1 08:33|
|00000350| 3a 33 31 20 31 39 38 36 | 0a 65 78 70 6f 72 74 20 |:31 1986|.export |
|00000360| 50 41 54 48 3b 20 50 41 | 54 48 3d 2f 62 69 6e 3a |PATH; PA|TH=/bin:|
|00000370| 24 50 41 54 48 0a 65 63 | 68 6f 20 73 68 61 72 3a |$PATH.ec|ho shar:|
|00000380| 20 65 78 74 72 61 63 74 | 69 6e 67 20 22 27 72 65 | extract|ing "'re|
|00000390| 61 64 6d 65 2e 74 78 74 | 27 22 20 27 28 31 34 32 |adme.txt|'" '(142|
|000003a0| 30 20 63 68 61 72 61 63 | 74 65 72 73 29 27 0a 69 |0 charac|ters)'.i|
|000003b0| 66 20 74 65 73 74 20 2d | 66 20 27 72 65 61 64 6d |f test -|f 'readm|
|000003c0| 65 2e 74 78 74 27 0a 74 | 68 65 6e 0a 09 65 63 68 |e.txt'.t|hen..ech|
|000003d0| 6f 20 73 68 61 72 3a 20 | 77 69 6c 6c 20 6e 6f 74 |o shar: |will not|
|000003e0| 20 6f 76 65 72 2d 77 72 | 69 74 65 20 65 78 69 73 | over-wr|ite exis|
|000003f0| 74 69 6e 67 20 66 69 6c | 65 20 22 27 72 65 61 64 |ting fil|e "'read|
|00000400| 6d 65 2e 74 78 74 27 22 | 0a 65 6c 73 65 0a 63 61 |me.txt'"|.else.ca|
|00000410| 74 20 3c 3c 20 5c 53 48 | 41 52 5f 45 4f 46 20 3e |t << \SH|AR_EOF >|
|00000420| 20 27 72 65 61 64 6d 65 | 2e 74 78 74 27 0a 54 68 | 'readme|.txt'.Th|
|00000430| 69 73 20 69 73 20 61 20 | 73 75 67 67 65 73 74 65 |is is a |suggeste|
|00000440| 64 20 72 65 70 6c 61 63 | 65 6d 65 6e 74 20 66 6f |d replac|ement fo|
|00000450| 72 20 73 68 61 72 2e 20 | 20 49 74 20 69 73 20 62 |r shar. | It is b|
|00000460| 61 73 65 64 20 6f 6e 0a | 74 68 65 20 61 72 63 68 |ased on.|the arch|
|00000470| 69 76 65 20 70 72 6f 67 | 72 61 6d 20 69 6e 20 4b |ive prog|ram in K|
|00000480| 65 72 6e 69 67 68 61 6e | 20 61 6e 64 20 50 6c 61 |ernighan| and Pla|
|00000490| 75 67 65 72 27 73 20 53 | 6f 66 74 77 61 72 65 20 |uger's S|oftware |
|000004a0| 54 6f 6f 6c 73 2c 0a 62 | 75 74 20 68 61 73 20 62 |Tools,.b|ut has b|
|000004b0| 65 65 6e 20 68 65 61 76 | 69 6c 79 20 73 69 6d 70 |een heav|ily simp|
|000004c0| 6c 69 66 69 65 64 2e 0a | 0a 49 74 20 68 61 73 20 |lified..|.It has |
|000004d0| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 61 64 |the foll|owing ad|
|000004e0| 76 61 6e 74 61 67 65 73 | 20 6f 76 65 72 20 73 68 |vantages| over sh|
|000004f0| 61 72 3a 0a 0a 31 2e 20 | 69 74 20 69 73 20 6e 6f |ar:..1. |it is no|
|00000500| 74 20 74 69 65 64 20 74 | 6f 20 55 6e 69 78 20 2d |t tied t|o Unix -|
|00000510| 2d 20 74 68 75 73 20 56 | 4d 53 20 75 73 65 72 73 |- thus V|MS users|
|00000520| 20 63 61 6e 20 75 6e 70 | 61 63 6b 20 66 69 6c 65 | can unp|ack file|
|00000530| 73 20 77 69 74 68 6f 75 | 74 0a 20 20 20 65 78 63 |s withou|t. exc|
|00000540| 65 73 73 69 76 65 20 65 | 66 66 6f 72 74 2e 20 20 |essive e|ffort. |
|00000550| 41 72 63 68 63 20 61 6e | 64 20 61 72 63 68 78 20 |Archc an|d archx |
|00000560| 73 68 6f 75 6c 64 20 72 | 75 6e 20 77 69 74 68 6f |should r|un witho|
|00000570| 75 74 20 63 68 61 6e 67 | 65 20 6f 6e 0a 20 20 20 |ut chang|e on. |
|00000580| 61 6c 6c 20 55 6e 69 78 | 20 61 6e 64 20 55 6e 69 |all Unix| and Uni|
|00000590| 78 20 6c 6f 6f 6b 61 6c | 69 6b 65 20 73 79 73 74 |x lookal|ike syst|
|000005a0| 65 6d 73 2c 20 61 73 20 | 77 65 6c 6c 20 61 73 20 |ems, as |well as |
|000005b0| 6f 6e 20 56 4d 53 20 28 | 56 61 78 43 29 0a 20 20 |on VMS (|VaxC). |
|000005c0| 20 61 6e 64 20 61 6c 6c | 20 50 44 50 2d 31 31 20 | and all| PDP-11 |
|000005d0| 44 65 63 75 73 20 43 20 | 73 79 73 74 65 6d 73 2e |Decus C |systems.|
|000005e0| 20 20 49 74 20 68 61 73 | 20 62 65 65 6e 20 69 6e | It has| been in|
|000005f0| 20 75 73 65 20 66 6f 72 | 20 6f 76 65 72 20 36 0a | use for| over 6.|
|00000600| 20 20 20 79 65 61 72 73 | 2e 0a 0a 32 2e 20 69 74 | years|...2. it|
|00000610| 20 64 6f 65 73 20 6e 6f | 74 20 65 78 65 63 75 74 | does no|t execut|
|00000620| 65 20 74 68 65 20 64 69 | 73 74 72 69 62 75 74 65 |e the di|stribute|
|00000630| 64 20 69 6d 61 67 65 2c | 20 62 75 74 20 69 6e 74 |d image,| but int|
|00000640| 65 72 70 72 65 74 73 20 | 69 74 2e 20 20 54 68 69 |erprets |it. Thi|
|00000650| 73 0a 20 20 20 6d 65 61 | 6e 73 20 74 68 61 74 20 |s. mea|ns that |
|00000660| 74 72 6f 6a 61 6e 20 68 | 6f 72 73 65 73 20 63 61 |trojan h|orses ca|
|00000670| 6e 6e 6f 74 20 62 65 20 | 63 6f 6e 63 65 61 6c 65 |nnot be |conceale|
|00000680| 64 20 69 6e 20 64 69 73 | 74 72 69 62 75 74 69 6f |d in dis|tributio|
|00000690| 6e 73 2e 0a 0a 33 20 20 | 54 68 65 20 64 69 73 74 |ns...3 |The dist|
|000006a0| 72 69 62 75 74 69 6f 6e | 20 66 69 6c 65 20 63 61 |ribution| file ca|
|000006b0| 6e 20 62 65 20 65 64 69 | 74 65 64 20 77 69 74 68 |n be edi|ted with|
|000006c0| 6f 75 74 20 64 61 6d 61 | 67 69 6e 67 20 74 68 65 |out dama|ging the|
|000006d0| 20 61 72 63 68 69 76 65 | 2e 0a 20 20 20 28 41 6c | archive|.. (Al|
|000006e0| 73 6f 2c 20 65 6d 62 65 | 64 64 65 64 20 61 72 63 |so, embe|dded arc|
|000006f0| 68 69 76 65 73 20 63 61 | 6e 20 62 65 20 68 61 6e |hives ca|n be han|
|00000700| 64 6c 65 64 29 2e 0a 0a | 49 74 20 68 61 73 20 74 |dled)...|It has t|
|00000710| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 64 69 73 |he follo|wing dis|
|00000720| 61 64 76 61 6e 74 61 67 | 65 73 3a 0a 0a 31 2e 20 |advantag|es:..1. |
|00000730| 49 74 20 69 73 20 6e 6f | 74 20 61 73 20 66 6c 65 |It is no|t as fle|
|00000740| 78 69 62 6c 65 20 61 73 | 20 73 68 61 72 20 2d 2d |xible as| shar --|
|00000750| 20 69 74 20 63 61 6e 6e | 6f 74 20 63 72 65 61 74 | it cann|ot creat|
|00000760| 65 20 64 69 72 65 63 74 | 6f 72 69 65 73 20 6f 72 |e direct|ories or|
|00000770| 0a 20 20 20 61 63 63 65 | 73 73 20 61 6e 79 20 6f |. acce|ss any o|
|00000780| 74 68 65 72 20 55 6e 69 | 78 20 73 79 73 74 65 6d |ther Uni|x system|
|00000790| 20 73 65 72 76 69 63 65 | 73 2e 0a 0a 32 2e 20 54 | service|s...2. T|
|000007a0| 68 65 72 65 20 69 73 20 | 6e 6f 20 63 68 65 63 6b |here is |no check|
|000007b0| 73 75 6d 20 63 61 70 61 | 62 69 6c 69 74 79 20 28 |sum capa|bility (|
|000007c0| 69 74 20 61 70 70 65 61 | 72 73 20 69 6d 70 6f 73 |it appea|rs impos|
|000007d0| 73 69 62 6c 65 20 74 6f | 20 69 6d 70 6c 65 6d 65 |sible to| impleme|
|000007e0| 6e 74 0a 20 20 20 63 68 | 65 63 6b 73 75 6d 6d 69 |nt. ch|ecksummi|
|000007f0| 6e 67 20 69 6e 20 61 20 | 73 79 73 74 65 6d 2d 69 |ng in a |system-i|
|00000800| 6e 64 65 70 65 6e 64 65 | 6e 74 20 6d 61 6e 6e 65 |ndepende|nt manne|
|00000810| 72 29 2e 0a 0a 54 6f 20 | 75 73 65 2c 20 73 61 76 |r)...To |use, sav|
|00000820| 65 20 74 68 69 73 20 6d | 65 73 73 61 67 65 2e 20 |e this m|essage. |
|00000830| 20 54 68 65 6e 2c 20 75 | 73 65 20 79 6f 75 72 20 | Then, u|se your |
|00000840| 66 61 76 6f 72 69 74 65 | 20 65 64 69 74 6f 72 20 |favorite| editor |
|00000850| 74 6f 20 65 78 74 72 61 | 63 74 0a 61 72 63 68 78 |to extra|ct.archx|
|00000860| 2e 63 20 28 64 65 6c 69 | 6d 69 74 65 64 20 62 79 |.c (deli|mited by|
|00000870| 20 6c 69 6e 65 73 20 62 | 65 67 69 6e 6e 69 6e 67 | lines b|eginning|
|00000880| 20 77 69 74 68 20 22 2d | 68 2d 22 20 69 6e 20 63 | with "-|h-" in c|
|00000890| 6f 6c 75 6d 6e 20 31 29 | 2e 20 20 54 68 65 6e 0a |olumn 1)|. Then.|
|000008a0| 63 6f 6d 70 69 6c 65 20 | 61 72 63 68 78 20 61 6e |compile |archx an|
|000008b0| 64 20 72 75 6e 20 69 74 | 20 75 73 69 6e 67 20 74 |d run it| using t|
|000008c0| 68 65 20 63 6f 6d 6d 61 | 6e 64 3a 0a 09 61 72 63 |he comma|nd:..arc|
|000008d0| 68 78 20 3c 74 68 69 73 | 5f 66 69 6c 65 3e 0a 49 |hx <this|_file>.I|
|000008e0| 74 20 73 68 6f 75 6c 64 | 20 70 72 6f 64 75 63 65 |t should| produce|
|000008f0| 20 72 65 61 64 6d 65 2e | 74 78 74 2c 20 61 72 63 | readme.|txt, arc|
|00000900| 68 78 2e 63 2c 20 61 6e | 64 20 61 72 63 68 63 2e |hx.c, an|d archc.|
|00000910| 63 2e 0a 4d 61 6e 75 61 | 6c 20 70 61 67 65 73 20 |c..Manua|l pages |
|00000920| 63 61 6e 20 62 65 20 70 | 72 6f 64 75 63 65 64 20 |can be p|roduced |
|00000930| 62 79 20 65 78 74 72 61 | 63 74 69 6e 67 20 74 68 |by extra|cting th|
|00000940| 65 20 74 65 78 74 20 64 | 65 6c 69 6d 69 74 65 64 |e text d|elimited|
|00000950| 20 62 79 0a 09 23 69 66 | 64 65 66 20 44 4f 43 55 | by..#if|def DOCU|
|00000960| 4d 45 4e 54 41 54 49 4f | 4e 0a 09 2e 2e 2e 0a 09 |MENTATIO|N.......|
|00000970| 23 65 6e 64 69 66 0a 0a | 50 6c 65 61 73 65 20 72 |#endif..|Please r|
|00000980| 65 70 6f 72 74 20 70 72 | 6f 62 6c 65 6d 73 20 74 |eport pr|oblems t|
|00000990| 6f 20 74 68 65 20 61 75 | 74 68 6f 72 3a 0a 0a 4d |o the au|thor:..M|
|000009a0| 61 72 74 69 6e 20 4d 69 | 6e 6f 77 0a 64 65 63 76 |artin Mi|now.decv|
|000009b0| 61 78 21 6d 69 6e 6f 77 | 0a 0a 53 48 41 52 5f 45 |ax!minow|..SHAR_E|
|000009c0| 4f 46 0a 69 66 20 74 65 | 73 74 20 31 34 32 30 20 |OF.if te|st 1420 |
|000009d0| 2d 6e 65 20 22 60 77 63 | 20 2d 63 20 3c 20 27 72 |-ne "`wc| -c < 'r|
|000009e0| 65 61 64 6d 65 2e 74 78 | 74 27 60 22 0a 74 68 65 |eadme.tx|t'`".the|
|000009f0| 6e 0a 09 65 63 68 6f 20 | 73 68 61 72 3a 20 65 72 |n..echo |shar: er|
|00000a00| 72 6f 72 20 74 72 61 6e | 73 6d 69 74 74 69 6e 67 |ror tran|smitting|
|00000a10| 20 22 27 72 65 61 64 6d | 65 2e 74 78 74 27 22 20 | "'readm|e.txt'" |
|00000a20| 27 28 73 68 6f 75 6c 64 | 20 68 61 76 65 20 62 65 |'(should| have be|
|00000a30| 65 6e 20 31 34 32 30 20 | 63 68 61 72 61 63 74 65 |en 1420 |characte|
|00000a40| 72 73 29 27 0a 66 69 0a | 66 69 0a 65 63 68 6f 20 |rs)'.fi.|fi.echo |
|00000a50| 73 68 61 72 3a 20 65 78 | 74 72 61 63 74 69 6e 67 |shar: ex|tracting|
|00000a60| 20 22 27 61 72 63 68 63 | 2e 63 27 22 20 27 28 37 | "'archc|.c'" '(7|
|00000a70| 37 35 39 20 63 68 61 72 | 61 63 74 65 72 73 29 27 |759 char|acters)'|
|00000a80| 0a 69 66 20 74 65 73 74 | 20 2d 66 20 27 61 72 63 |.if test| -f 'arc|
|00000a90| 68 63 2e 63 27 0a 74 68 | 65 6e 0a 09 65 63 68 6f |hc.c'.th|en..echo|
|00000aa0| 20 73 68 61 72 3a 20 77 | 69 6c 6c 20 6e 6f 74 20 | shar: w|ill not |
|00000ab0| 6f 76 65 72 2d 77 72 69 | 74 65 20 65 78 69 73 74 |over-wri|te exist|
|00000ac0| 69 6e 67 20 66 69 6c 65 | 20 22 27 61 72 63 68 63 |ing file| "'archc|
|00000ad0| 2e 63 27 22 0a 65 6c 73 | 65 0a 63 61 74 20 3c 3c |.c'".els|e.cat <<|
|00000ae0| 20 5c 53 48 41 52 5f 45 | 4f 46 20 3e 20 27 61 72 | \SHAR_E|OF > 'ar|
|00000af0| 63 68 63 2e 63 27 0a 2f | 2a 0a 20 2a 09 09 09 41 |chc.c'./|*. *...A|
|00000b00| 20 52 20 43 20 48 20 49 | 20 56 20 45 0a 20 2a 0a | R C H I| V E. *.|
|00000b10| 20 2a 20 43 72 65 61 74 | 65 20 61 6e 20 61 72 63 | * Creat|e an arc|
|00000b20| 68 69 76 65 0a 20 2a 0a | 20 2a 2f 0a 0a 2f 2a 29 |hive. *.| */../*)|
|00000b30| 42 55 49 4c 44 09 24 28 | 54 4b 42 4f 50 54 49 4f |BUILD.$(|TKBOPTIO|
|00000b40| 4e 53 29 20 3d 20 7b 0a | 09 09 09 54 41 53 4b 09 |NS) = {.|...TASK.|
|00000b50| 3d 20 2e 2e 2e 41 52 43 | 0a 09 09 7d 0a 2a 2f 0a |= ...ARC|...}.*/.|
|00000b60| 0a 23 69 66 64 65 66 09 | 44 4f 43 55 4d 45 4e 54 |.#ifdef.|DOCUMENT|
|00000b70| 41 54 49 4f 4e 0a 0a 74 | 69 74 6c 65 09 61 72 63 |ATION..t|itle.arc|
|00000b80| 68 63 09 74 65 78 74 20 | 66 69 6c 65 20 61 72 63 |hc.text |file arc|
|00000b90| 68 69 76 65 20 63 72 65 | 61 74 69 6f 6e 0a 69 6e |hive cre|ation.in|
|00000ba0| 64 65 78 09 09 74 65 78 | 74 20 66 69 6c 65 20 61 |dex..tex|t file a|
|00000bb0| 72 63 68 69 76 65 20 63 | 72 65 61 74 69 6f 6e 0a |rchive c|reation.|
|00000bc0| 0a 73 79 6e 6f 70 73 69 | 73 0a 0a 09 61 72 63 68 |.synopsi|s...arch|
|00000bd0| 63 20 66 69 6c 65 5b 73 | 5d 20 3e 61 72 63 68 69 |c file[s|] >archi|
|00000be0| 76 65 0a 0a 64 65 73 63 | 72 69 70 74 69 6f 6e 0a |ve..desc|ription.|
|00000bf0| 0a 09 41 72 63 68 63 20 | 6d 61 6e 61 67 65 73 20 |..Archc |manages |
|00000c00| 61 72 63 68 69 76 65 73 | 20 28 6c 69 62 72 61 72 |archives| (librar|
|00000c10| 69 65 73 29 20 6f 66 20 | 73 6f 75 72 63 65 20 66 |ies) of |source f|
|00000c20| 69 6c 65 73 2c 20 61 6c | 6c 6f 77 69 6e 67 0a 09 |iles, al|lowing..|
|00000c30| 61 20 6c 61 72 67 65 20 | 6e 75 6d 62 65 72 20 6f |a large |number o|
|00000c40| 66 20 73 6d 61 6c 6c 20 | 66 69 6c 65 73 20 74 6f |f small |files to|
|00000c50| 20 62 65 20 73 74 6f 72 | 65 64 20 77 69 74 68 6f | be stor|ed witho|
|00000c60| 75 74 20 75 73 69 6e 67 | 0a 09 65 78 63 65 73 73 |ut using|..excess|
|00000c70| 69 76 65 20 73 79 73 74 | 65 6d 20 72 65 73 6f 75 |ive syst|em resou|
|00000c80| 72 63 65 73 2e 20 20 49 | 74 20 63 6f 70 69 65 73 |rces. I|t copies|
|00000c90| 20 74 68 65 20 73 65 74 | 20 6f 66 20 6e 61 6d 65 | the set| of name|
|00000ca0| 64 0a 09 66 69 6c 65 73 | 20 74 6f 20 73 74 61 6e |d..files| to stan|
|00000cb0| 64 61 72 64 20 6f 75 74 | 70 75 74 20 69 6e 20 61 |dard out|put in a|
|00000cc0| 72 63 68 69 76 65 20 66 | 6f 72 6d 61 74 2e 0a 0a |rchive f|ormat...|
|00000cd0| 09 54 68 65 20 61 72 63 | 68 78 20 70 72 6f 67 72 |.The arc|hx progr|
|00000ce0| 61 6d 20 77 69 6c 6c 20 | 72 65 63 72 65 61 74 65 |am will |recreate|
|00000cf0| 20 74 68 65 20 66 69 6c | 65 73 20 66 72 6f 6d 20 | the fil|es from |
|00000d00| 61 6e 20 61 72 63 68 69 | 76 65 2e 0a 0a 09 4e 6f |an archi|ve....No|
|00000d10| 74 65 3a 20 74 68 65 72 | 65 20 61 72 65 20 6e 6f |te: ther|e are no|
|00000d20| 20 63 68 65 63 6b 73 20 | 61 67 61 69 6e 73 74 20 | checks |against |
|00000d30| 74 68 65 20 73 61 6d 65 | 20 66 69 6c 65 20 61 70 |the same| file ap|
|00000d40| 70 65 61 72 69 6e 67 0a | 09 74 77 69 63 65 20 69 |pearing.|.twice i|
|00000d50| 6e 20 61 6e 20 61 72 63 | 68 69 76 65 2e 0a 0a 61 |n an arc|hive...a|
|00000d60| 72 63 68 69 76 65 20 66 | 69 6c 65 20 66 6f 72 6d |rchive f|ile form|
|00000d70| 61 74 0a 0a 09 41 72 63 | 68 69 76 65 20 66 69 6c |at...Arc|hive fil|
|00000d80| 65 73 20 61 72 65 20 73 | 74 61 6e 64 61 72 64 20 |es are s|tandard |
|00000d90| 74 65 78 74 20 66 69 6c | 65 73 2e 20 20 45 61 63 |text fil|es. Eac|
|00000da0| 68 20 61 72 63 68 69 76 | 65 20 65 6c 65 6d 65 6e |h archiv|e elemen|
|00000db0| 74 20 69 73 0a 09 70 72 | 65 63 65 65 64 65 64 20 |t is..pr|eceeded |
|00000dc0| 62 79 20 61 20 6c 69 6e | 65 20 6f 66 20 74 68 65 |by a lin|e of the|
|00000dd0| 20 66 6f 72 6d 61 74 3a | 0a 09 2e 73 2e 6e 66 0a | format:|...s.nf.|
|00000de0| 09 2d 68 2d 09 66 69 6c | 65 2e 6e 61 6d 65 09 64 |.-h-.fil|e.name.d|
|00000df0| 61 74 65 09 74 72 75 65 | 5f 70 61 74 68 5f 6e 61 |ate.true|_path_na|
|00000e00| 6d 65 0a 09 2e 73 2e 66 | 0a 09 4e 6f 74 65 20 74 |me...s.f|..Note t|
|00000e10| 68 61 74 20 74 68 65 72 | 65 20 69 73 20 6e 6f 20 |hat ther|e is no |
|00000e20| 6c 69 6e 65 20 6f 72 20 | 62 79 74 65 20 63 6f 75 |line or |byte cou|
|00000e30| 6e 74 2e 20 20 54 6f 20 | 70 72 65 76 65 6e 74 20 |nt. To |prevent |
|00000e40| 70 72 6f 62 6c 65 6d 73 | 2c 0a 09 61 20 27 2d 27 |problems|,..a '-'|
|00000e50| 20 61 74 20 74 68 65 20 | 62 65 67 69 6e 6e 69 6e | at the |beginnin|
|00000e60| 67 20 6f 66 20 61 20 72 | 65 63 6f 72 64 20 77 69 |g of a r|ecord wi|
|00000e70| 74 68 69 6e 20 61 20 75 | 73 65 72 20 66 69 6c 65 |thin a u|ser file|
|00000e80| 20 6f 72 20 65 6d 62 65 | 64 64 65 64 0a 09 61 72 | or embe|dded..ar|
|00000e90| 63 68 69 76 65 20 77 69 | 6c 6c 20 62 65 20 22 71 |chive wi|ll be "q|
|00000ea0| 75 6f 74 65 64 22 20 62 | 79 20 64 6f 75 62 6c 69 |uoted" b|y doubli|
|00000eb0| 6e 67 20 69 74 2e 20 20 | 54 68 65 20 64 61 74 65 |ng it. |The date|
|00000ec0| 20 61 6e 64 20 74 72 75 | 65 20 66 69 6c 65 6e 61 | and tru|e filena|
|00000ed0| 6d 65 0a 09 66 69 65 6c | 64 73 20 61 72 65 20 69 |me..fiel|ds are i|
|00000ee0| 67 6e 6f 72 65 64 2e 20 | 20 4f 6e 20 44 65 63 20 |gnored. | On Dec |
|00000ef0| 6f 70 65 72 61 74 69 6e | 67 20 73 79 73 74 65 6d |operatin|g system|
|00000f00| 73 2c 20 66 69 6c 65 2e | 6e 61 6d 65 20 69 73 0a |s, file.|name is.|
|00000f10| 09 66 6f 72 63 65 64 20 | 74 6f 20 6c 6f 77 65 72 |.forced |to lower|
|00000f20| 63 61 73 65 2e 20 20 43 | 65 72 74 61 69 6e 20 62 |case. C|ertain b|
|00000f30| 79 74 65 73 20 61 74 20 | 74 68 65 20 62 65 67 69 |ytes at |the begi|
|00000f40| 6e 6e 69 6e 67 20 6f 66 | 20 61 20 72 65 63 6f 72 |nning of| a recor|
|00000f50| 64 20 61 72 65 0a 09 61 | 6c 73 6f 20 70 72 65 66 |d are..a|lso pref|
|00000f60| 69 78 65 64 20 62 79 20 | 27 2d 27 20 74 6f 20 70 |ixed by |'-' to p|
|00000f70| 72 65 76 65 6e 74 20 6d | 61 69 6c 65 72 73 20 66 |revent m|ailers f|
|00000f80| 72 6f 6d 20 74 72 65 61 | 74 69 6e 67 20 74 68 65 |rom trea|ting the|
|00000f90| 6d 0a 09 61 73 20 63 6f | 6d 6d 61 6e 64 73 2e 0a |m..as co|mmands..|
|00000fa0| 0a 64 69 61 67 6e 6f 73 | 74 69 63 73 0a 0a 09 44 |.diagnos|tics...D|
|00000fb0| 69 61 67 6e 6f 73 74 69 | 63 20 6d 65 73 73 61 67 |iagnosti|c messag|
|00000fc0| 65 73 20 73 68 6f 75 6c | 64 20 62 65 20 73 65 6c |es shoul|d be sel|
|00000fd0| 66 2d 65 78 70 6c 61 6e | 61 74 6f 72 79 0a 0a 61 |f-explan|atory..a|
|00000fe0| 75 74 68 6f 72 0a 0a 09 | 4d 61 72 74 69 6e 20 4d |uthor...|Martin M|
|00000ff0| 69 6e 6f 77 0a 0a 23 65 | 6e 64 69 66 0a 0a 23 69 |inow..#e|ndif..#i|
|00001000| 6e 63 6c 75 64 65 09 3c | 73 74 64 69 6f 2e 68 3e |nclude.<|stdio.h>|
|00001010| 0a 23 69 6e 63 6c 75 64 | 65 09 3c 63 74 79 70 65 |.#includ|e.<ctype|
|00001020| 2e 68 3e 0a 23 69 66 64 | 65 66 20 76 6d 73 0a 23 |.h>.#ifd|ef vms.#|
|00001030| 69 6e 63 6c 75 64 65 09 | 09 3c 73 73 64 65 66 2e |include.|.<ssdef.|
|00001040| 68 3e 0a 23 69 6e 63 6c | 75 64 65 09 09 3c 73 74 |h>.#incl|ude..<st|
|00001050| 73 64 65 66 2e 68 3e 0a | 23 64 65 66 69 6e 65 09 |sdef.h>.|#define.|
|00001060| 49 4f 5f 53 55 43 43 45 | 53 53 09 28 53 53 24 5f |IO_SUCCE|SS.(SS$_|
|00001070| 4e 4f 52 4d 41 4c 20 7c | 20 53 54 53 24 4d 5f 49 |NORMAL || STS$M_I|
|00001080| 4e 48 49 42 5f 4d 53 47 | 29 0a 23 64 65 66 69 6e |NHIB_MSG|).#defin|
|00001090| 65 09 49 4f 5f 45 52 52 | 4f 52 09 53 53 24 5f 41 |e.IO_ERR|OR.SS$_A|
|000010a0| 42 4f 52 54 0a 23 65 6e | 64 69 66 0a 2f 2a 0a 20 |BORT.#en|dif./*. |
|000010b0| 2a 20 4e 6f 74 65 3a 20 | 49 4f 5f 53 55 43 43 45 |* Note: |IO_SUCCE|
|000010c0| 53 53 20 61 6e 64 20 49 | 4f 5f 45 52 52 4f 52 20 |SS and I|O_ERROR |
|000010d0| 61 72 65 20 64 65 66 69 | 6e 65 64 20 69 6e 20 74 |are defi|ned in t|
|000010e0| 68 65 20 44 65 63 75 73 | 20 43 20 73 74 64 69 6f |he Decus| C stdio|
|000010f0| 2e 68 20 66 69 6c 65 0a | 20 2a 2f 0a 23 69 66 6e |.h file.| */.#ifn|
|00001100| 64 65 66 09 49 4f 5f 53 | 55 43 43 45 53 53 0a 23 |def.IO_S|UCCESS.#|
|00001110| 64 65 66 69 6e 65 09 49 | 4f 5f 53 55 43 43 45 53 |define.I|O_SUCCES|
|00001120| 53 09 30 0a 23 65 6e 64 | 69 66 0a 23 69 66 6e 64 |S.0.#end|if.#ifnd|
|00001130| 65 66 09 49 4f 5f 45 52 | 52 4f 52 0a 23 64 65 66 |ef.IO_ER|ROR.#def|
|00001140| 69 6e 65 09 49 4f 5f 45 | 52 52 4f 52 09 31 0a 23 |ine.IO_E|RROR.1.#|
|00001150| 65 6e 64 69 66 0a 23 64 | 65 66 69 6e 65 20 45 4f |endif.#d|efine EO|
|00001160| 53 09 09 30 0a 23 64 65 | 66 69 6e 65 09 46 41 4c |S..0.#de|fine.FAL|
|00001170| 53 45 09 09 30 0a 23 64 | 65 66 69 6e 65 09 54 52 |SE..0.#d|efine.TR|
|00001180| 55 45 09 09 31 0a 0a 63 | 68 61 72 09 09 74 65 78 |UE..1..c|har..tex|
|00001190| 74 5b 35 31 33 5d 3b 09 | 09 2f 2a 20 57 6f 72 6b |t[513];.|./* Work|
|000011a0| 69 6e 67 20 74 65 78 74 | 09 09 09 2a 2f 0a 63 68 |ing text|...*/.ch|
|000011b0| 61 72 09 09 6e 61 6d 65 | 5b 38 31 5d 3b 09 09 2f |ar..name|[81];../|
|000011c0| 2a 20 43 75 72 72 65 6e | 74 20 61 72 63 68 69 76 |* Curren|t archiv|
|000011d0| 65 20 6d 65 6d 62 65 72 | 20 6e 61 6d 65 09 2a 2f |e member| name.*/|
|000011e0| 0a 63 68 61 72 09 09 70 | 61 74 68 6e 61 6d 65 5b |.char..p|athname[|
|000011f0| 38 31 5d 3b 09 09 2f 2a | 20 4f 75 74 70 75 74 20 |81];../*| Output |
|00001200| 66 6f 72 20 61 72 67 65 | 74 6e 61 6d 65 28 29 09 |for arge|tname().|
|00001210| 2a 2f 0a 63 68 61 72 09 | 09 2a 74 69 6d 65 74 65 |*/.char.|.*timete|
|00001220| 78 74 3b 09 09 2f 2a 20 | 54 69 6d 65 20 6f 66 20 |xt;../* |Time of |
|00001230| 64 61 79 20 74 65 78 74 | 09 09 2a 2f 0a 69 6e 74 |day text|..*/.int|
|00001240| 09 09 76 65 72 62 6f 73 | 65 09 09 3d 20 54 52 55 |..verbos|e..= TRU|
|00001250| 45 3b 20 2f 2a 20 54 52 | 55 45 20 66 6f 72 20 76 |E; /* TR|UE for v|
|00001260| 65 72 62 6f 73 69 74 79 | 09 09 2a 2f 0a 46 49 4c |erbosity|..*/.FIL|
|00001270| 45 09 09 2a 69 6e 66 64 | 3b 09 09 09 2f 2a 20 49 |E..*infd|;.../* I|
|00001280| 6e 70 75 74 20 66 69 6c | 65 09 09 09 2a 2f 0a 0a |nput fil|e...*/..|
|00001290| 6d 61 69 6e 28 61 72 67 | 63 2c 20 61 72 67 76 29 |main(arg|c, argv)|
|000012a0| 0a 69 6e 74 09 09 61 72 | 67 63 3b 09 09 09 2f 2a |.int..ar|gc;.../*|
|000012b0| 20 41 72 67 20 63 6f 75 | 6e 74 09 09 09 2a 2f 0a | Arg cou|nt...*/.|
|000012c0| 63 68 61 72 09 09 2a 61 | 72 67 76 5b 5d 3b 09 09 |char..*a|rgv[];..|
|000012d0| 2f 2a 20 41 72 67 20 76 | 65 63 74 6f 72 09 09 09 |/* Arg v|ector...|
|000012e0| 2a 2f 0a 7b 0a 09 72 65 | 67 69 73 74 65 72 20 69 |*/.{..re|gister i|
|000012f0| 6e 74 09 09 69 3b 09 2f | 2a 20 52 61 6e 64 6f 6d |nt..i;./|* Random|
|00001300| 20 63 6f 75 6e 74 65 72 | 09 09 2a 2f 0a 09 72 65 | counter|..*/..re|
|00001310| 67 69 73 74 65 72 20 63 | 68 61 72 09 09 2a 66 6e |gister c|har..*fn|
|00001320| 3b 09 2f 2a 20 46 69 6c | 65 20 6e 61 6d 65 20 70 |;./* Fil|e name p|
|00001330| 6f 69 6e 74 65 72 09 09 | 2a 2f 0a 09 72 65 67 69 |ointer..|*/..regi|
|00001340| 73 74 65 72 20 63 68 61 | 72 09 09 2a 61 72 67 70 |ster cha|r..*argp|
|00001350| 3b 09 2f 2a 20 41 72 67 | 20 70 6f 69 6e 74 65 72 |;./* Arg| pointer|
|00001360| 09 09 09 2a 2f 0a 09 69 | 6e 74 09 09 09 6e 66 69 |...*/..i|nt...nfi|
|00001370| 6c 65 73 3b 0a 09 65 78 | 74 65 72 6e 20 63 68 61 |les;..ex|tern cha|
|00001380| 72 09 09 2a 63 74 69 6d | 65 28 29 3b 0a 09 65 78 |r..*ctim|e();..ex|
|00001390| 74 65 72 6e 20 6c 6f 6e | 67 09 09 74 69 6d 65 28 |tern lon|g..time(|
|000013a0| 29 3b 0a 09 6c 6f 6e 67 | 09 09 09 74 69 6d 76 61 |);..long|...timva|
|000013b0| 6c 3b 0a 0a 09 74 69 6d | 65 28 26 74 69 6d 76 61 |l;...tim|e(&timva|
|000013c0| 6c 29 3b 0a 09 74 69 6d | 65 74 65 78 74 20 3d 20 |l);..tim|etext = |
|000013d0| 63 74 69 6d 65 28 26 74 | 69 6d 76 61 6c 29 3b 0a |ctime(&t|imval);.|
|000013e0| 09 74 69 6d 65 74 65 78 | 74 5b 32 34 5d 20 3d 20 |.timetex|t[24] = |
|000013f0| 45 4f 53 3b 0a 23 69 66 | 64 65 66 20 76 6d 73 0a |EOS;.#if|def vms.|
|00001400| 09 61 72 67 63 20 3d 20 | 67 65 74 72 65 64 69 72 |.argc = |getredir|
|00001410| 65 63 74 69 6f 6e 28 61 | 72 67 63 2c 20 61 72 67 |ection(a|rgc, arg|
|00001420| 76 29 3b 0a 23 65 6e 64 | 69 66 0a 09 69 66 20 28 |v);.#end|if..if (|
|00001430| 61 72 67 63 20 3c 3d 20 | 31 29 0a 09 20 20 20 20 |argc <= |1).. |
|00001440| 66 70 72 69 6e 74 66 28 | 73 74 64 65 72 72 2c 20 |fprintf(|stderr, |
|00001450| 22 4e 6f 20 66 69 6c 65 | 73 20 74 6f 20 61 72 63 |"No file|s to arc|
|00001460| 68 69 76 65 3f 5c 6e 22 | 29 3b 0a 23 69 66 64 65 |hive?\n"|);.#ifde|
|00001470| 66 09 75 6e 69 78 0a 09 | 66 6f 72 20 28 69 20 3d |f.unix..|for (i =|
|00001480| 20 31 3b 20 69 20 3c 20 | 61 72 67 63 3b 20 69 2b | 1; i < |argc; i+|
|00001490| 2b 29 20 7b 0a 09 20 20 | 20 20 69 66 20 28 28 69 |+) {.. | if ((i|
|000014a0| 6e 66 64 20 3d 20 66 6f | 70 65 6e 28 61 72 67 76 |nfd = fo|pen(argv|
|000014b0| 5b 69 5d 2c 20 22 72 22 | 29 29 20 3d 3d 20 4e 55 |[i], "r"|)) == NU|
|000014c0| 4c 4c 29 0a 09 09 70 65 | 72 72 6f 72 28 61 72 67 |LL)...pe|rror(arg|
|000014d0| 76 5b 69 5d 29 3b 0a 09 | 20 20 20 20 65 6c 73 65 |v[i]);..| else|
|000014e0| 20 7b 0a 09 09 73 74 72 | 63 70 79 28 70 61 74 68 | {...str|cpy(path|
|000014f0| 6e 61 6d 65 2c 20 61 72 | 67 76 5b 69 5d 29 3b 0a |name, ar|gv[i]);.|
|00001500| 09 09 69 6d 70 6f 72 74 | 28 29 3b 0a 09 09 66 63 |..import|();...fc|
|00001510| 6c 6f 73 65 28 69 6e 66 | 64 29 3b 0a 09 20 20 20 |lose(inf|d);.. |
|00001520| 20 7d 0a 09 7d 0a 23 65 | 6c 73 65 0a 09 2f 2a 0a | }..}.#e|lse../*.|
|00001530| 09 20 2a 20 44 65 63 75 | 73 20 43 20 73 75 70 70 |. * Decu|s C supp|
|00001540| 6f 72 74 73 20 66 77 69 | 6c 64 2f 66 6e 65 78 74 |orts fwi|ld/fnext|
|00001550| 20 66 6f 72 20 65 78 70 | 6c 69 63 69 74 20 70 72 | for exp|licit pr|
|00001560| 6f 63 65 73 73 69 6e 67 | 0a 09 20 2a 20 6f 66 20 |ocessing|.. * of |
|00001570| 77 69 6c 64 2d 63 61 72 | 64 20 66 69 6c 65 6e 61 |wild-car|d filena|
|00001580| 6d 65 73 2e 0a 09 20 2a | 2f 0a 09 66 6f 72 20 28 |mes... *|/..for (|
|00001590| 69 20 3d 20 31 3b 20 69 | 20 3c 20 61 72 67 63 3b |i = 1; i| < argc;|
|000015a0| 20 69 2b 2b 29 20 7b 0a | 09 20 20 20 20 69 66 20 | i++) {.|. if |
|000015b0| 28 28 69 6e 66 64 20 3d | 20 66 77 69 6c 64 28 61 |((infd =| fwild(a|
|000015c0| 72 67 76 5b 69 5d 2c 20 | 22 72 22 29 29 20 3d 3d |rgv[i], |"r")) ==|
|000015d0| 20 4e 55 4c 4c 29 0a 09 | 09 70 65 72 72 6f 72 28 | NULL)..|.perror(|
|000015e0| 61 72 67 76 5b 69 5d 29 | 3b 0a 09 20 20 20 20 65 |argv[i])|;.. e|
|000015f0| 6c 73 65 20 7b 0a 09 09 | 66 6f 72 20 28 6e 66 69 |lse {...|for (nfi|
|00001600| 6c 65 73 20 3d 20 30 3b | 20 66 6e 65 78 74 28 69 |les = 0;| fnext(i|
|00001610| 6e 66 64 29 20 21 3d 20 | 4e 55 4c 4c 3b 20 6e 66 |nfd) != |NULL; nf|
|00001620| 69 6c 65 73 2b 2b 29 20 | 7b 0a 09 09 20 20 20 20 |iles++) |{... |
|00001630| 66 67 65 74 6e 61 6d 65 | 28 69 6e 66 64 2c 20 70 |fgetname|(infd, p|
|00001640| 61 74 68 6e 61 6d 65 29 | 3b 0a 09 09 20 20 20 20 |athname)|;... |
|00001650| 69 6d 70 6f 72 74 28 29 | 3b 0a 09 09 7d 0a 09 09 |import()|;...}...|
|00001660| 66 63 6c 6f 73 65 28 69 | 6e 66 64 29 3b 0a 09 09 |fclose(i|nfd);...|
|00001670| 69 66 20 28 6e 66 69 6c | 65 73 20 3d 3d 20 30 29 |if (nfil|es == 0)|
|00001680| 0a 09 09 20 20 20 20 66 | 70 72 69 6e 74 66 28 73 |... f|printf(s|
|00001690| 74 64 65 72 72 2c 20 22 | 4e 6f 20 66 69 6c 65 73 |tderr, "|No files|
|000016a0| 20 6d 61 74 63 68 20 5c | 22 25 73 5c 22 5c 6e 22 | match \|"%s\"\n"|
|000016b0| 2c 20 61 72 67 76 5b 69 | 5d 29 3b 0a 09 20 20 20 |, argv[i|]);.. |
|000016c0| 20 7d 0a 09 7d 0a 23 65 | 6e 64 69 66 0a 7d 0a 0a | }..}.#e|ndif.}..|
|000016d0| 69 6d 70 6f 72 74 28 29 | 0a 2f 2a 0a 20 2a 20 41 |import()|./*. * A|
|000016e0| 64 64 20 74 68 65 20 66 | 69 6c 65 20 6f 70 65 6e |dd the f|ile open|
|000016f0| 20 6f 6e 20 69 6e 66 64 | 20 28 77 69 74 68 20 66 | on infd| (with f|
|00001700| 69 6c 65 20 6e 61 6d 65 | 20 69 6e 20 70 61 74 68 |ile name| in path|
|00001710| 6e 61 6d 65 29 20 74 6f | 0a 20 2a 20 74 68 65 20 |name) to|. * the |
|00001720| 61 72 63 68 69 76 65 2e | 0a 20 2a 2f 0a 7b 0a 09 |archive.|. */.{..|
|00001730| 75 6e 73 69 67 6e 65 64 | 20 69 6e 74 09 6e 72 65 |unsigned| int.nre|
|00001740| 63 6f 72 64 73 3b 0a 0a | 09 66 69 78 6e 61 6d 65 |cords;..|.fixname|
|00001750| 28 29 3b 0a 09 6e 72 65 | 63 6f 72 64 73 20 3d 20 |();..nre|cords = |
|00001760| 30 3b 0a 09 70 72 69 6e | 74 66 28 22 2d 68 2d 20 |0;..prin|tf("-h- |
|00001770| 25 73 5c 74 25 73 5c 74 | 25 73 5c 6e 22 2c 20 6e |%s\t%s\t|%s\n", n|
|00001780| 61 6d 65 2c 20 74 69 6d | 65 74 65 78 74 2c 20 70 |ame, tim|etext, p|
|00001790| 61 74 68 6e 61 6d 65 29 | 3b 0a 09 77 68 69 6c 65 |athname)|;..while|
|000017a0| 20 28 66 67 65 74 73 28 | 74 65 78 74 2c 20 73 69 | (fgets(|text, si|
|000017b0| 7a 65 6f 66 20 74 65 78 | 74 2c 20 69 6e 66 64 29 |zeof tex|t, infd)|
|000017c0| 20 21 3d 20 4e 55 4c 4c | 29 20 7b 0a 09 20 20 20 | != NULL|) {.. |
|000017d0| 20 73 77 69 74 63 68 20 | 28 74 65 78 74 5b 30 5d | switch |(text[0]|
|000017e0| 29 20 7b 0a 09 20 20 20 | 20 63 61 73 65 20 27 2d |) {.. | case '-|
|000017f0| 27 3a 0a 09 20 20 20 20 | 63 61 73 65 20 27 2e 27 |':.. |case '.'|
|00001800| 3a 0a 09 20 20 20 20 63 | 61 73 65 20 27 7e 27 3a |:.. c|ase '~':|
|00001810| 0a 09 09 70 75 74 63 68 | 61 72 28 27 2d 27 29 3b |...putch|ar('-');|
|00001820| 09 09 09 09 2f 2a 20 51 | 75 6f 74 65 09 2a 2f 0a |..../* Q|uote.*/.|
|00001830| 09 20 20 20 20 7d 0a 09 | 20 20 20 20 66 70 75 74 |. }..| fput|
|00001840| 73 28 74 65 78 74 2c 20 | 73 74 64 6f 75 74 29 3b |s(text, |stdout);|
|00001850| 0a 09 20 20 20 20 6e 72 | 65 63 6f 72 64 73 2b 2b |.. nr|ecords++|
|00001860| 3b 0a 09 7d 0a 09 69 66 | 20 28 66 65 72 72 6f 72 |;..}..if| (ferror|
|00001870| 28 69 6e 66 64 29 29 20 | 7b 0a 09 20 20 20 20 70 |(infd)) |{.. p|
|00001880| 65 72 72 6f 72 28 6e 61 | 6d 65 29 3b 0a 09 20 20 |error(na|me);.. |
|00001890| 20 20 66 70 72 69 6e 74 | 66 28 73 74 64 65 72 72 | fprint|f(stderr|
|000018a0| 2c 20 22 45 72 72 6f 72 | 20 77 68 65 6e 20 69 6d |, "Error| when im|
|000018b0| 70 6f 72 74 69 6e 67 20 | 61 20 66 69 6c 65 5c 6e |porting |a file\n|
|000018c0| 22 29 3b 0a 09 7d 0a 09 | 69 66 20 28 76 65 72 62 |");..}..|if (verb|
|000018d0| 6f 73 65 29 20 7b 0a 09 | 20 20 20 20 66 70 72 69 |ose) {..| fpri|
|000018e0| 6e 74 66 28 73 74 64 65 | 72 72 2c 20 22 25 75 20 |ntf(stde|rr, "%u |
|000018f0| 72 65 63 6f 72 64 73 20 | 72 65 61 64 20 66 72 6f |records |read fro|
|00001900| 6d 20 25 73 5c 6e 22 2c | 0a 09 09 6e 72 65 63 6f |m %s\n",|...nreco|
|00001910| 72 64 73 2c 20 70 61 74 | 68 6e 61 6d 65 29 3b 0a |rds, pat|hname);.|
|00001920| 09 7d 0a 7d 0a 0a 66 69 | 78 6e 61 6d 65 28 29 0a |.}.}..fi|xname().|
|00001930| 2f 2a 0a 20 2a 20 47 65 | 74 20 66 69 6c 65 20 6e |/*. * Ge|t file n|
|00001940| 61 6d 65 20 28 69 6e 20 | 70 61 74 68 6e 61 6d 65 |ame (in |pathname|
|00001950| 29 2c 20 73 74 72 69 70 | 70 69 6e 67 20 6f 66 66 |), strip|ping off|
|00001960| 20 64 65 76 69 63 65 3a | 5b 64 69 72 65 63 74 6f | device:|[directo|
|00001970| 72 79 5d 0a 20 2a 20 61 | 6e 64 20 3b 76 65 72 73 |ry]. * a|nd ;vers|
|00001980| 69 6f 6e 2e 20 20 54 68 | 65 20 61 72 63 68 69 76 |ion. Th|e archiv|
|00001990| 65 20 6e 61 6d 65 20 28 | 22 66 69 6c 65 2e 65 78 |e name (|"file.ex|
|000019a0| 74 22 29 20 69 73 20 77 | 72 69 74 74 65 6e 20 74 |t") is w|ritten t|
|000019b0| 6f 20 6e 61 6d 65 5b 5d | 2e 0a 20 2a 20 4f 6e 20 |o name[]|.. * On |
|000019c0| 61 20 64 65 63 20 6f 70 | 65 72 61 74 69 6e 67 20 |a dec op|erating |
|000019d0| 73 79 73 74 65 6d 2c 20 | 6e 61 6d 65 20 69 73 20 |system, |name is |
|000019e0| 66 6f 72 63 65 64 20 74 | 6f 20 6c 6f 77 65 72 63 |forced t|o lowerc|
|000019f0| 61 73 65 2e 0a 20 2a 2f | 0a 7b 0a 09 72 65 67 69 |ase.. */|.{..regi|
|00001a00| 73 74 65 72 20 63 68 61 | 72 09 2a 74 70 3b 0a 09 |ster cha|r.*tp;..|
|00001a10| 72 65 67 69 73 74 65 72 | 20 63 68 61 72 09 2a 69 |register| char.*i|
|00001a20| 70 3b 0a 09 63 68 61 72 | 09 09 62 72 61 63 6b 65 |p;..char|..bracke|
|00001a30| 74 3b 0a 09 65 78 74 65 | 72 6e 20 63 68 61 72 09 |t;..exte|rn char.|
|00001a40| 2a 73 74 72 72 63 68 72 | 28 29 3b 0a 0a 23 69 66 |*strrchr|();..#if|
|00001a50| 64 65 66 09 75 6e 69 78 | 0a 09 2f 2a 0a 09 20 2a |def.unix|../*.. *|
|00001a60| 20 6e 61 6d 65 20 69 73 | 20 61 66 74 65 72 20 61 | name is| after a|
|00001a70| 6c 6c 20 64 69 72 65 63 | 74 6f 72 79 20 69 6e 66 |ll direc|tory inf|
|00001a80| 6f 72 6d 61 74 69 6f 6e | 0a 09 20 2a 2f 0a 09 69 |ormation|.. */..i|
|00001a90| 66 20 28 28 74 70 20 3d | 20 73 74 72 72 63 68 72 |f ((tp =| strrchr|
|00001aa0| 28 70 61 74 68 6e 61 6d | 65 2c 20 27 2f 27 29 29 |(pathnam|e, '/'))|
|00001ab0| 20 21 3d 20 4e 55 4c 4c | 29 0a 09 20 20 20 20 74 | != NULL|).. t|
|00001ac0| 70 2b 2b 3b 0a 09 65 6c | 73 65 0a 09 20 20 20 20 |p++;..el|se.. |
|00001ad0| 74 70 20 3d 20 70 61 74 | 68 6e 61 6d 65 3b 0a 09 |tp = pat|hname;..|
|00001ae0| 73 74 72 63 70 79 28 6e | 61 6d 65 2c 20 74 70 29 |strcpy(n|ame, tp)|
|00001af0| 3b 0a 23 65 6c 73 65 0a | 09 73 74 72 63 70 79 28 |;.#else.|.strcpy(|
|00001b00| 6e 61 6d 65 2c 20 70 61 | 74 68 6e 61 6d 65 29 3b |name, pa|thname);|
|00001b10| 0a 09 69 66 20 28 28 74 | 70 20 3d 20 73 74 72 72 |..if ((t|p = strr|
|00001b20| 63 68 72 28 6e 61 6d 65 | 2c 20 27 3b 27 29 29 20 |chr(name|, ';')) |
|00001b30| 21 3d 20 4e 55 4c 4c 29 | 0a 09 09 2a 74 70 20 3d |!= NULL)|...*tp =|
|00001b40| 20 45 4f 53 3b 0a 09 77 | 68 69 6c 65 20 28 28 74 | EOS;..w|hile ((t|
|00001b50| 70 20 3d 20 73 74 72 63 | 68 72 28 6e 61 6d 65 2c |p = strc|hr(name,|
|00001b60| 20 27 3a 27 29 29 20 21 | 3d 20 4e 55 4c 4c 29 0a | ':')) !|= NULL).|
|00001b70| 09 09 73 74 72 63 70 79 | 28 6e 61 6d 65 2c 20 74 |..strcpy|(name, t|
|00001b80| 70 20 2b 20 31 29 3b 0a | 09 73 77 69 74 63 68 20 |p + 1);.|.switch |
|00001b90| 28 6e 61 6d 65 5b 30 5d | 29 20 7b 0a 09 63 61 73 |(name[0]|) {..cas|
|00001ba0| 65 20 27 5b 27 3a 09 62 | 72 61 63 6b 65 74 20 3d |e '[':.b|racket =|
|00001bb0| 20 27 5d 27 3b 0a 09 09 | 09 62 72 65 61 6b 3b 0a | ']';...|.break;.|
|00001bc0| 09 63 61 73 65 20 27 3c | 27 3a 09 62 72 61 63 6b |.case '<|':.brack|
|00001bd0| 65 74 20 3d 20 27 3e 27 | 3b 0a 09 09 09 62 72 65 |et = '>'|;....bre|
|00001be0| 61 6b 3b 0a 09 63 61 73 | 65 20 27 28 27 3a 09 62 |ak;..cas|e '(':.b|
|00001bf0| 72 61 63 6b 65 74 20 3d | 20 27 29 27 3b 0a 09 09 |racket =| ')';...|
|00001c00| 09 62 72 65 61 6b 3b 0a | 09 64 65 66 61 75 6c 74 |.break;.|.default|
|00001c10| 3a 09 62 72 61 63 6b 65 | 74 20 3d 20 45 4f 53 3b |:.bracke|t = EOS;|
|00001c20| 0a 09 09 09 62 72 65 61 | 6b 3b 0a 09 7d 0a 09 69 |....brea|k;..}..i|
|00001c30| 66 20 28 62 72 61 63 6b | 65 74 20 21 3d 20 45 4f |f (brack|et != EO|
|00001c40| 53 29 20 7b 0a 09 20 20 | 20 20 69 66 20 28 28 74 |S) {.. | if ((t|
|00001c50| 70 20 3d 20 73 74 72 63 | 68 72 28 6e 61 6d 65 2c |p = strc|hr(name,|
|00001c60| 20 62 72 61 63 6b 65 74 | 29 29 20 3d 3d 20 4e 55 | bracket|)) == NU|
|00001c70| 4c 4c 29 20 7b 0a 09 09 | 66 70 72 69 6e 74 66 28 |LL) {...|fprintf(|
|00001c80| 73 74 64 65 72 72 2c 20 | 22 3f 20 49 6c 6c 65 67 |stderr, |"? Illeg|
|00001c90| 61 6c 20 66 69 6c 65 20 | 6e 61 6d 65 20 5c 22 25 |al file |name \"%|
|00001ca0| 73 5c 22 5c 6e 22 2c 0a | 09 09 20 20 20 20 70 61 |s\"\n",.|.. pa|
|00001cb0| 74 68 6e 61 6d 65 29 3b | 0a 09 20 20 20 20 7d 0a |thname);|.. }.|
|00001cc0| 09 20 20 20 20 65 6c 73 | 65 20 7b 0a 09 09 73 74 |. els|e {...st|
|00001cd0| 72 63 70 79 28 6e 61 6d | 65 2c 20 74 70 20 2b 20 |rcpy(nam|e, tp + |
|00001ce0| 31 29 3b 0a 09 20 20 20 | 20 7d 0a 09 7d 0a 09 66 |1);.. | }..}..f|
|00001cf0| 6f 72 20 28 74 70 20 3d | 20 6e 61 6d 65 3b 20 2a |or (tp =| name; *|
|00001d00| 74 70 20 21 3d 20 45 4f | 53 3b 20 74 70 2b 2b 29 |tp != EO|S; tp++)|
|00001d10| 20 7b 0a 09 20 20 20 20 | 69 66 20 28 69 73 75 70 | {.. |if (isup|
|00001d20| 70 65 72 28 2a 74 70 29 | 29 0a 09 09 2a 74 70 20 |per(*tp)|)...*tp |
|00001d30| 3d 20 74 6f 6c 6f 77 65 | 72 28 2a 74 70 29 3b 0a |= tolowe|r(*tp);.|
|00001d40| 09 7d 0a 23 65 6e 64 69 | 66 0a 7d 0a 0a 23 69 66 |.}.#endi|f.}..#if|
|00001d50| 64 65 66 09 75 6e 69 78 | 0a 63 68 61 72 20 2a 0a |def.unix|.char *.|
|00001d60| 73 74 72 72 63 68 72 28 | 73 74 6e 67 2c 20 63 68 |strrchr(|stng, ch|
|00001d70| 72 29 0a 72 65 67 69 73 | 74 65 72 20 63 68 61 72 |r).regis|ter char|
|00001d80| 09 2a 73 74 6e 67 3b 0a | 72 65 67 69 73 74 65 72 |.*stng;.|register|
|00001d90| 20 63 68 61 72 09 63 68 | 72 3b 0a 2f 2a 0a 20 2a | char.ch|r;./*. *|
|00001da0| 20 52 65 74 75 72 6e 20 | 72 69 67 68 74 6d 6f 73 | Return |rightmos|
|00001db0| 74 20 69 6e 73 74 61 6e | 63 65 20 6f 66 20 63 68 |t instan|ce of ch|
|00001dc0| 72 20 69 6e 20 73 74 6e | 67 2e 0a 20 2a 20 54 68 |r in stn|g.. * Th|
|00001dd0| 69 73 20 68 61 73 20 74 | 68 65 20 77 72 6f 6e 67 |is has t|he wrong|
|00001de0| 20 6e 61 6d 65 20 6f 6e | 20 73 6f 6d 65 20 55 6e | name on| some Un|
|00001df0| 69 78 20 73 79 73 74 65 | 6d 73 2e 0a 20 2a 2f 0a |ix syste|ms.. */.|
|00001e00| 7b 0a 09 72 65 67 69 73 | 74 65 72 20 63 68 61 72 |{..regis|ter char|
|00001e10| 09 2a 72 65 73 75 6c 74 | 3b 0a 0a 09 72 65 73 75 |.*result|;...resu|
|00001e20| 6c 74 20 3d 20 4e 55 4c | 4c 3b 0a 0a 09 64 6f 20 |lt = NUL|L;...do |
|00001e30| 7b 0a 09 20 20 20 20 69 | 66 20 28 2a 73 74 6e 67 |{.. i|f (*stng|
|00001e40| 20 3d 3d 20 63 68 72 29 | 0a 09 09 72 65 73 75 6c | == chr)|...resul|
|00001e50| 74 20 3d 20 73 74 6e 67 | 3b 0a 09 7d 20 77 68 69 |t = stng|;..} whi|
|00001e60| 6c 65 20 28 2a 73 74 6e | 67 2b 2b 20 21 3d 20 45 |le (*stn|g++ != E|
|00001e70| 4f 53 29 3b 0a 09 72 65 | 74 75 72 6e 20 28 72 65 |OS);..re|turn (re|
|00001e80| 73 75 6c 74 29 3b 0a 7d | 0a 23 65 6e 64 69 66 0a |sult);.}|.#endif.|
|00001e90| 0c 0a 2f 2a 0a 20 2a 20 | 67 65 74 72 65 64 69 72 |../*. * |getredir|
|00001ea0| 65 63 74 69 6f 6e 28 29 | 20 69 73 20 69 6e 74 65 |ection()| is inte|
|00001eb0| 6e 64 65 64 20 74 6f 20 | 61 69 64 20 69 6e 20 70 |nded to |aid in p|
|00001ec0| 6f 72 74 69 6e 67 20 43 | 20 70 72 6f 67 72 61 6d |orting C| program|
|00001ed0| 73 0a 20 2a 20 74 6f 20 | 56 4d 53 20 28 56 61 78 |s. * to |VMS (Vax|
|00001ee0| 2d 31 31 20 43 29 20 77 | 68 69 63 68 20 64 6f 65 |-11 C) w|hich doe|
|00001ef0| 73 20 6e 6f 74 20 73 75 | 70 70 6f 72 74 20 27 3e |s not su|pport '>|
|00001f00| 27 20 61 6e 64 20 27 3c | 27 0a 20 2a 20 49 2f 4f |' and '<|'. * I/O|
|00001f10| 20 72 65 64 69 72 65 63 | 74 69 6f 6e 2e 20 20 57 | redirec|tion. W|
|00001f20| 69 74 68 20 73 75 69 74 | 61 62 6c 65 20 6d 6f 64 |ith suit|able mod|
|00001f30| 69 66 69 63 61 74 69 6f | 6e 2c 20 69 74 20 6d 61 |ificatio|n, it ma|
|00001f40| 79 0a 20 2a 20 75 73 65 | 66 75 6c 20 66 6f 72 20 |y. * use|ful for |
|00001f50| 6f 74 68 65 72 20 70 6f | 72 74 61 62 69 6c 69 74 |other po|rtabilit|
|00001f60| 79 20 70 72 6f 62 6c 65 | 6d 73 20 61 73 20 77 65 |y proble|ms as we|
|00001f70| 6c 6c 2e 0a 20 2a 2f 0a | 0a 73 74 61 74 69 63 20 |ll.. */.|.static |
|00001f80| 69 6e 74 0a 67 65 74 72 | 65 64 69 72 65 63 74 69 |int.getr|edirecti|
|00001f90| 6f 6e 28 61 72 67 63 2c | 20 61 72 67 76 29 0a 69 |on(argc,| argv).i|
|00001fa0| 6e 74 09 09 61 72 67 63 | 3b 0a 63 68 61 72 09 09 |nt..argc|;.char..|
|00001fb0| 2a 2a 61 72 67 76 3b 0a | 2f 2a 0a 20 2a 20 50 72 |**argv;.|/*. * Pr|
|00001fc0| 6f 63 65 73 73 20 76 6d | 73 20 72 65 64 69 72 65 |ocess vm|s redire|
|00001fd0| 63 74 69 6f 6e 20 61 72 | 67 27 73 2e 20 20 45 78 |ction ar|g's. Ex|
|00001fe0| 69 74 20 69 66 20 61 6e | 79 20 65 72 72 6f 72 20 |it if an|y error |
|00001ff0| 69 73 20 73 65 65 6e 2e | 0a 20 2a 20 49 66 20 67 |is seen.|. * If g|
|00002000| 65 74 72 65 64 69 72 65 | 63 74 69 6f 6e 28 29 20 |etredire|ction() |
|00002010| 70 72 6f 63 65 73 73 65 | 73 20 61 6e 20 61 72 67 |processe|s an arg|
|00002020| 75 6d 65 6e 74 2c 20 69 | 74 20 69 73 20 65 72 61 |ument, i|t is era|
|00002030| 73 65 64 0a 20 2a 20 66 | 72 6f 6d 20 74 68 65 20 |sed. * f|rom the |
|00002040| 76 65 63 74 6f 72 2e 20 | 20 67 65 74 72 65 64 69 |vector. | getredi|
|00002050| 72 65 63 74 69 6f 6e 28 | 29 20 72 65 74 75 72 6e |rection(|) return|
|00002060| 73 20 61 20 6e 65 77 20 | 61 72 67 63 20 76 61 6c |s a new |argc val|
|00002070| 75 65 2e 0a 20 2a 0a 20 | 2a 20 57 61 72 6e 69 6e |ue.. *. |* Warnin|
|00002080| 67 3a 20 64 6f 20 6e 6f | 74 20 74 72 79 20 74 6f |g: do no|t try to|
|00002090| 20 73 69 6d 70 6c 69 66 | 79 20 74 68 65 20 63 6f | simplif|y the co|
|000020a0| 64 65 20 66 6f 72 20 76 | 6d 73 2e 20 20 54 68 65 |de for v|ms. The|
|000020b0| 20 63 6f 64 65 0a 20 2a | 20 70 72 65 73 75 70 70 | code. *| presupp|
|000020c0| 6f 73 65 73 20 74 68 61 | 74 20 67 65 74 72 65 64 |oses tha|t getred|
|000020d0| 69 72 65 63 74 69 6f 6e | 28 29 20 69 73 20 63 61 |irection|() is ca|
|000020e0| 6c 6c 65 64 20 62 65 66 | 6f 72 65 20 61 6e 79 20 |lled bef|ore any |
|000020f0| 64 61 74 61 20 69 73 0a | 20 2a 20 72 65 61 64 20 |data is.| * read |
|00002100| 66 72 6f 6d 20 73 74 64 | 69 6e 20 6f 72 20 77 72 |from std|in or wr|
|00002110| 69 74 74 65 6e 20 74 6f | 20 73 74 64 6f 75 74 2e |itten to| stdout.|
|00002120| 0a 20 2a 0a 20 2a 20 4e | 6f 72 6d 61 6c 20 75 73 |. *. * N|ormal us|
|00002130| 61 67 65 20 69 73 20 61 | 73 20 66 6f 6c 6c 6f 77 |age is a|s follow|
|00002140| 73 3a 0a 20 2a 0a 20 2a | 09 6d 61 69 6e 28 61 72 |s:. *. *|.main(ar|
|00002150| 67 63 2c 20 61 72 67 76 | 29 0a 20 2a 09 69 6e 74 |gc, argv|). *.int|
|00002160| 09 09 61 72 67 63 3b 0a | 20 2a 09 63 68 61 72 09 |..argc;.| *.char.|
|00002170| 09 2a 61 72 67 76 5b 5d | 3b 0a 20 2a 09 7b 0a 20 |.*argv[]|;. *.{. |
|00002180| 2a 09 09 61 72 67 63 20 | 3d 20 67 65 74 72 65 64 |*..argc |= getred|
|00002190| 69 72 65 63 74 69 6f 6e | 28 61 72 67 63 2c 20 61 |irection|(argc, a|
|000021a0| 72 67 76 29 3b 0a 20 2a | 09 7d 0a 20 2a 2f 0a 7b |rgv);. *|.}. */.{|
|000021b0| 0a 23 69 66 64 65 66 09 | 76 6d 73 0a 09 72 65 67 |.#ifdef.|vms..reg|
|000021c0| 69 73 74 65 72 20 63 68 | 61 72 09 09 2a 61 70 3b |ister ch|ar..*ap;|
|000021d0| 09 2f 2a 20 41 72 67 75 | 6d 65 6e 74 20 70 6f 69 |./* Argu|ment poi|
|000021e0| 6e 74 65 72 09 2a 2f 0a | 09 69 6e 74 09 09 09 69 |nter.*/.|.int...i|
|000021f0| 3b 09 2f 2a 20 61 72 67 | 76 5b 5d 20 69 6e 64 65 |;./* arg|v[] inde|
|00002200| 78 09 09 2a 2f 0a 09 69 | 6e 74 09 09 09 6a 3b 09 |x..*/..i|nt...j;.|
|00002210| 2f 2a 20 4f 75 74 70 75 | 74 20 69 6e 64 65 78 09 |/* Outpu|t index.|
|00002220| 09 2a 2f 0a 09 69 6e 74 | 09 09 09 66 69 6c 65 3b |.*/..int|...file;|
|00002230| 09 2f 2a 20 46 69 6c 65 | 5f 64 65 73 63 72 69 70 |./* File|_descrip|
|00002240| 74 6f 72 20 09 2a 2f 0a | 0a 09 66 6f 72 20 28 6a |tor .*/.|..for (j|
|00002250| 20 3d 20 69 20 3d 20 31 | 3b 20 69 20 3c 20 61 72 | = i = 1|; i < ar|
|00002260| 67 63 3b 20 69 2b 2b 29 | 20 7b 20 20 20 2f 2a 20 |gc; i++)| { /* |
|00002270| 44 6f 20 61 6c 6c 20 61 | 72 67 75 6d 65 6e 74 73 |Do all a|rguments|
|00002280| 09 2a 2f 0a 09 20 20 20 | 20 73 77 69 74 63 68 20 |.*/.. | switch |
|00002290| 28 2a 28 61 70 20 3d 20 | 61 72 67 76 5b 69 5d 29 |(*(ap = |argv[i])|
|000022a0| 29 20 7b 0a 09 20 20 20 | 20 63 61 73 65 20 27 3c |) {.. | case '<|
|000022b0| 27 3a 09 09 09 2f 2a 20 | 3c 66 69 6c 65 09 09 2a |':.../* |<file..*|
|000022c0| 2f 0a 09 09 69 66 20 28 | 66 72 65 6f 70 65 6e 28 |/...if (|freopen(|
|000022d0| 2b 2b 61 70 2c 20 22 72 | 22 2c 20 73 74 64 69 6e |++ap, "r|", stdin|
|000022e0| 29 20 3d 3d 20 4e 55 4c | 4c 29 20 7b 0a 09 09 20 |) == NUL|L) {... |
|000022f0| 20 20 20 70 65 72 72 6f | 72 28 61 70 29 3b 09 09 | perro|r(ap);..|
|00002300| 2f 2a 20 43 61 6e 27 74 | 20 66 69 6e 64 20 66 69 |/* Can't| find fi|
|00002310| 6c 65 09 2a 2f 0a 09 09 | 20 20 20 20 65 78 69 74 |le.*/...| exit|
|00002320| 28 49 4f 5f 45 52 52 4f | 52 29 3b 09 2f 2a 20 49 |(IO_ERRO|R);./* I|
|00002330| 73 20 61 20 66 61 74 61 | 6c 20 65 72 72 6f 72 09 |s a fata|l error.|
|00002340| 2a 2f 0a 09 09 7d 0a 0a | 09 20 20 20 20 63 61 73 |*/...}..|. cas|
|00002350| 65 20 27 3e 27 3a 09 09 | 09 2f 2a 20 3e 66 69 6c |e '>':..|./* >fil|
|00002360| 65 20 6f 72 20 3e 3e 66 | 69 6c 65 09 2a 2f 0a 09 |e or >>f|ile.*/..|
|00002370| 09 69 66 20 28 2a 2b 2b | 61 70 20 3d 3d 20 27 3e |.if (*++|ap == '>|
|00002380| 27 29 20 7b 09 2f 2a 20 | 3e 3e 66 69 6c 65 09 09 |') {./* |>>file..|
|00002390| 2a 2f 0a 09 09 20 20 20 | 20 2f 2a 0a 09 09 20 20 |*/... | /*... |
|000023a0| 20 20 20 2a 20 49 66 20 | 74 68 65 20 66 69 6c 65 | * If |the file|
|000023b0| 20 65 78 69 73 74 73 2c | 20 61 6e 64 20 69 73 20 | exists,| and is |
|000023c0| 77 72 69 74 61 62 6c 65 | 20 62 79 20 75 73 2c 0a |writable| by us,.|
|000023d0| 09 09 20 20 20 20 20 2a | 20 63 61 6c 6c 20 66 72 |.. *| call fr|
|000023e0| 65 6f 70 65 6e 20 74 6f | 20 61 70 70 65 6e 64 20 |eopen to| append |
|000023f0| 74 6f 20 74 68 65 20 66 | 69 6c 65 20 28 75 73 69 |to the f|ile (usi|
|00002400| 6e 67 20 74 68 65 0a 09 | 09 20 20 20 20 20 2a 20 |ng the..|. * |
|00002410| 66 69 6c 65 27 73 20 63 | 75 72 72 65 6e 74 20 61 |file's c|urrent a|
|00002420| 74 74 72 69 62 75 74 65 | 73 29 2e 20 20 4f 74 68 |ttribute|s). Oth|
|00002430| 65 72 77 69 73 65 2c 20 | 63 72 65 61 74 65 0a 09 |erwise, |create..|
|00002440| 09 20 20 20 20 20 2a 20 | 61 20 6e 65 77 20 66 69 |. * |a new fi|
|00002450| 6c 65 20 77 69 74 68 20 | 22 76 61 6e 69 6c 6c 61 |le with |"vanilla|
|00002460| 22 20 61 74 74 72 69 62 | 75 74 65 73 20 61 73 20 |" attrib|utes as |
|00002470| 69 66 0a 09 09 20 20 20 | 20 20 2a 20 74 68 65 20 |if... | * the |
|00002480| 61 72 67 75 6d 65 6e 74 | 20 77 61 73 20 67 69 76 |argument| was giv|
|00002490| 65 6e 20 61 73 20 22 3e | 66 69 6c 65 6e 61 6d 65 |en as ">|filename|
|000024a0| 22 2e 0a 09 09 20 20 20 | 20 20 2a 20 61 63 63 65 |".... | * acce|
|000024b0| 73 73 28 6e 61 6d 65 2c | 20 32 29 20 69 73 20 54 |ss(name,| 2) is T|
|000024c0| 52 55 45 20 69 66 20 77 | 65 20 63 61 6e 20 77 72 |RUE if w|e can wr|
|000024d0| 69 74 65 20 6f 6e 0a 09 | 09 20 20 20 20 20 2a 20 |ite on..|. * |
|000024e0| 74 68 65 20 73 70 65 63 | 69 66 69 65 64 20 66 69 |the spec|ified fi|
|000024f0| 6c 65 2e 0a 09 09 20 20 | 20 20 20 2a 2f 0a 09 09 |le.... | */...|
|00002500| 20 20 20 20 69 66 20 28 | 61 63 63 65 73 73 28 2b | if (|access(+|
|00002510| 2b 61 70 2c 20 32 29 20 | 3d 3d 20 30 29 20 7b 0a |+ap, 2) |== 0) {.|
|00002520| 09 09 09 69 66 20 28 66 | 72 65 6f 70 65 6e 28 61 |...if (f|reopen(a|
|00002530| 70 2c 20 22 61 22 2c 20 | 73 74 64 6f 75 74 29 20 |p, "a", |stdout) |
|00002540| 21 3d 20 4e 55 4c 4c 29 | 0a 09 09 09 20 20 20 20 |!= NULL)|.... |
|00002550| 62 72 65 61 6b 3b 09 2f | 2a 20 45 78 69 74 20 63 |break;./|* Exit c|
|00002560| 61 73 65 20 73 74 61 74 | 65 6d 65 6e 74 09 2a 2f |ase stat|ement.*/|
|00002570| 0a 09 09 09 70 65 72 72 | 6f 72 28 61 70 29 3b 09 |....perr|or(ap);.|
|00002580| 2f 2a 20 45 72 72 6f 72 | 2c 20 63 61 6e 27 74 20 |/* Error|, can't |
|00002590| 61 70 70 65 6e 64 09 2a | 2f 0a 09 09 09 65 78 69 |append.*|/....exi|
|000025a0| 74 28 49 4f 5f 45 52 52 | 4f 52 29 3b 09 2f 2a 20 |t(IO_ERR|OR);./* |
|000025b0| 41 66 74 65 72 20 61 63 | 63 65 73 73 20 74 65 73 |After ac|cess tes|
|000025c0| 74 09 2a 2f 0a 09 09 20 | 20 20 20 7d 09 09 09 2f |t.*/... | }.../|
|000025d0| 2a 20 49 66 20 66 69 6c | 65 20 61 63 63 65 73 73 |* If fil|e access|
|000025e0| 61 62 6c 65 09 2a 2f 0a | 09 09 7d 0a 09 09 2f 2a |able.*/.|..}.../*|
|000025f0| 0a 09 09 20 2a 20 4f 6e | 20 76 6d 73 2c 20 77 65 |... * On| vms, we|
|00002600| 20 77 61 6e 74 20 74 6f | 20 63 72 65 61 74 65 20 | want to| create |
|00002610| 74 68 65 20 66 69 6c 65 | 20 75 73 69 6e 67 20 22 |the file| using "|
|00002620| 73 74 61 6e 64 61 72 64 | 22 0a 09 09 20 2a 20 72 |standard|"... * r|
|00002630| 65 63 6f 72 64 20 61 74 | 74 72 69 62 75 74 65 73 |ecord at|tributes|
|00002640| 2e 20 20 63 72 65 61 74 | 65 28 2e 2e 2e 29 20 63 |. creat|e(...) c|
|00002650| 72 65 61 74 65 73 20 74 | 68 65 20 66 69 6c 65 0a |reates t|he file.|
|00002660| 09 09 20 2a 20 75 73 69 | 6e 67 20 74 68 65 20 63 |.. * usi|ng the c|
|00002670| 61 6c 6c 65 72 27 73 20 | 64 65 66 61 75 6c 74 20 |aller's |default |
|00002680| 70 72 6f 74 65 63 74 69 | 6f 6e 20 6d 61 73 6b 20 |protecti|on mask |
|00002690| 61 6e 64 0a 09 09 20 2a | 20 22 76 61 72 69 61 62 |and... *| "variab|
|000026a0| 6c 65 20 6c 65 6e 67 74 | 68 2c 20 69 6d 70 6c 69 |le lengt|h, impli|
|000026b0| 65 64 20 63 61 72 72 69 | 61 67 65 20 72 65 74 75 |ed carri|age retu|
|000026c0| 72 6e 22 0a 09 09 20 2a | 20 61 74 74 72 69 62 75 |rn"... *| attribu|
|000026d0| 74 65 73 2e 20 64 75 70 | 32 28 29 20 61 73 73 6f |tes. dup|2() asso|
|000026e0| 63 69 61 74 65 73 20 74 | 68 65 20 66 69 6c 65 20 |ciates t|he file |
|000026f0| 77 69 74 68 20 73 74 64 | 6f 75 74 2e 0a 09 09 20 |with std|out.... |
|00002700| 2a 2f 0a 09 09 69 66 20 | 28 28 66 69 6c 65 20 3d |*/...if |((file =|
|00002710| 20 63 72 65 61 74 28 61 | 70 2c 20 30 2c 20 22 72 | creat(a|p, 0, "r|
|00002720| 61 74 3d 63 72 22 2c 20 | 22 72 66 6d 3d 76 61 72 |at=cr", |"rfm=var|
|00002730| 22 29 29 20 3d 3d 20 2d | 31 0a 09 09 20 7c 7c 20 |")) == -|1... || |
|00002740| 64 75 70 32 28 66 69 6c | 65 2c 20 66 69 6c 65 6e |dup2(fil|e, filen|
|00002750| 6f 28 73 74 64 6f 75 74 | 29 29 20 3d 3d 20 2d 31 |o(stdout|)) == -1|
|00002760| 29 20 7b 0a 09 09 20 20 | 20 20 70 65 72 72 6f 72 |) {... | perror|
|00002770| 28 61 70 29 3b 09 09 2f | 2a 20 43 61 6e 27 74 20 |(ap);../|* Can't |
|00002780| 63 72 65 61 74 65 20 66 | 69 6c 65 09 2a 2f 0a 09 |create f|ile.*/..|
|00002790| 09 20 20 20 20 65 78 69 | 74 28 49 4f 5f 45 52 52 |. exi|t(IO_ERR|
|000027a0| 4f 52 29 3b 09 2f 2a 20 | 69 73 20 61 20 66 61 74 |OR);./* |is a fat|
|000027b0| 61 6c 20 65 72 72 6f 72 | 09 2a 2f 0a 09 09 7d 09 |al error|.*/...}.|
|000027c0| 09 09 2f 2a 20 49 66 20 | 27 3e 27 20 63 72 65 61 |../* If |'>' crea|
|000027d0| 74 69 6f 6e 09 2a 2f 0a | 09 09 62 72 65 61 6b 3b |tion.*/.|..break;|
|000027e0| 09 09 09 2f 2a 20 45 78 | 69 74 20 63 61 73 65 20 |.../* Ex|it case |
|000027f0| 74 65 73 74 09 2a 2f 0a | 0a 09 20 20 20 20 64 65 |test.*/.|.. de|
|00002800| 66 61 75 6c 74 3a 0a 09 | 09 61 72 67 76 5b 6a 2b |fault:..|.argv[j+|
|00002810| 2b 5d 20 3d 20 61 70 3b | 09 09 2f 2a 20 4e 6f 74 |+] = ap;|../* Not|
|00002820| 20 61 20 72 65 64 69 72 | 65 63 74 6f 72 09 2a 2f | a redir|ector.*/|
|00002830| 0a 09 09 62 72 65 61 6b | 3b 09 09 09 2f 2a 20 45 |...break|;.../* E|
|00002840| 78 69 74 20 63 61 73 65 | 20 74 65 73 74 09 2a 2f |xit case| test.*/|
|00002850| 0a 09 20 20 20 20 7d 0a | 09 7d 09 09 09 09 2f 2a |.. }.|.}..../*|
|00002860| 20 46 6f 72 20 61 6c 6c | 20 61 72 67 75 6d 65 6e | For all| argumen|
|00002870| 74 73 09 2a 2f 0a 09 72 | 65 74 75 72 6e 20 28 6a |ts.*/..r|eturn (j|
|00002880| 29 3b 0a 23 65 6c 73 65 | 0a 09 2f 2a 0a 09 20 2a |);.#else|../*.. *|
|00002890| 20 4e 6f 74 65 3a 20 61 | 72 67 76 5b 5d 20 69 73 | Note: a|rgv[] is|
|000028a0| 20 72 65 66 65 72 65 6e | 63 65 64 20 74 6f 20 66 | referen|ced to f|
|000028b0| 6f 6f 6c 20 74 68 65 20 | 44 65 63 75 73 20 43 0a |ool the |Decus C.|
|000028c0| 09 20 2a 20 73 79 6e 74 | 61 78 20 61 6e 61 6c 79 |. * synt|ax analy|
|000028d0| 73 65 72 2c 20 73 75 70 | 72 65 73 73 69 6e 67 20 |ser, sup|ressing |
|000028e0| 61 6e 20 75 6e 6e 65 65 | 64 65 64 20 77 61 72 6e |an unnee|ded warn|
|000028f0| 69 6e 67 0a 09 20 2a 20 | 6d 65 73 73 61 67 65 2e |ing.. * |message.|
|00002900| 0a 09 20 2a 2f 0a 09 72 | 65 74 75 72 6e 20 28 61 |.. */..r|eturn (a|
|00002910| 72 67 76 5b 30 5d 2c 20 | 61 72 67 63 29 3b 09 09 |rgv[0], |argc);..|
|00002920| 2f 2a 20 4a 75 73 74 20 | 72 65 74 75 72 6e 20 61 |/* Just |return a|
|00002930| 73 20 73 65 65 6e 09 2a | 2f 0a 23 65 6e 64 69 66 |s seen.*|/.#endif|
|00002940| 0a 7d 0a 0a 0a 0a 53 48 | 41 52 5f 45 4f 46 0a 69 |.}....SH|AR_EOF.i|
|00002950| 66 20 74 65 73 74 20 37 | 37 35 39 20 2d 6e 65 20 |f test 7|759 -ne |
|00002960| 22 60 77 63 20 2d 63 20 | 3c 20 27 61 72 63 68 63 |"`wc -c |< 'archc|
|00002970| 2e 63 27 60 22 0a 74 68 | 65 6e 0a 09 65 63 68 6f |.c'`".th|en..echo|
|00002980| 20 73 68 61 72 3a 20 65 | 72 72 6f 72 20 74 72 61 | shar: e|rror tra|
|00002990| 6e 73 6d 69 74 74 69 6e | 67 20 22 27 61 72 63 68 |nsmittin|g "'arch|
|000029a0| 63 2e 63 27 22 20 27 28 | 73 68 6f 75 6c 64 20 68 |c.c'" '(|should h|
|000029b0| 61 76 65 20 62 65 65 6e | 20 37 37 35 39 20 63 68 |ave been| 7759 ch|
|000029c0| 61 72 61 63 74 65 72 73 | 29 27 0a 66 69 0a 66 69 |aracters|)'.fi.fi|
|000029d0| 0a 65 63 68 6f 20 73 68 | 61 72 3a 20 65 78 74 72 |.echo sh|ar: extr|
|000029e0| 61 63 74 69 6e 67 20 22 | 27 61 72 63 68 78 2e 63 |acting "|'archx.c|
|000029f0| 27 22 20 27 28 37 38 33 | 37 20 63 68 61 72 61 63 |'" '(783|7 charac|
|00002a00| 74 65 72 73 29 27 0a 69 | 66 20 74 65 73 74 20 2d |ters)'.i|f test -|
|00002a10| 66 20 27 61 72 63 68 78 | 2e 63 27 0a 74 68 65 6e |f 'archx|.c'.then|
|00002a20| 0a 09 65 63 68 6f 20 73 | 68 61 72 3a 20 77 69 6c |..echo s|har: wil|
|00002a30| 6c 20 6e 6f 74 20 6f 76 | 65 72 2d 77 72 69 74 65 |l not ov|er-write|
|00002a40| 20 65 78 69 73 74 69 6e | 67 20 66 69 6c 65 20 22 | existin|g file "|
|00002a50| 27 61 72 63 68 78 2e 63 | 27 22 0a 65 6c 73 65 0a |'archx.c|'".else.|
|00002a60| 63 61 74 20 3c 3c 20 5c | 53 48 41 52 5f 45 4f 46 |cat << \|SHAR_EOF|
|00002a70| 20 3e 20 27 61 72 63 68 | 78 2e 63 27 0a 2f 2a 0a | > 'arch|x.c'./*.|
|00002a80| 20 2a 09 09 09 41 20 52 | 20 43 20 48 20 58 0a 20 | *...A R| C H X. |
|00002a90| 2a 0a 20 2a 20 41 72 63 | 68 69 76 65 20 65 78 74 |*. * Arc|hive ext|
|00002aa0| 72 61 63 74 69 6f 6e 0a | 20 2a 0a 20 2a 2f 0a 0a |raction.| *. */..|
|00002ab0| 2f 2a 0a 20 2a 20 4e 6f | 74 65 3a 20 74 68 65 20 |/*. * No|te: the |
|00002ac0| 29 42 55 49 4c 44 20 63 | 6f 6d 6d 65 6e 74 20 69 |)BUILD c|omment i|
|00002ad0| 73 20 65 78 74 72 61 63 | 74 65 64 20 62 79 20 61 |s extrac|ted by a|
|00002ae0| 20 44 65 63 75 73 20 43 | 20 74 6f 6f 6c 20 74 6f | Decus C| tool to|
|00002af0| 20 63 6f 6e 73 74 72 75 | 63 74 0a 20 2a 20 73 79 | constru|ct. * sy|
|00002b00| 73 74 65 6d 2d 64 65 70 | 65 6e 64 65 6e 74 20 63 |stem-dep|endent c|
|00002b10| 6f 6d 70 69 6c 65 72 20 | 63 6f 6d 6d 61 6e 64 20 |ompiler |command |
|00002b20| 6c 69 6e 65 73 2e 0a 20 | 2a 0a 20 2a 20 54 65 78 |lines.. |*. * Tex|
|00002b30| 74 20 69 6e 73 69 64 65 | 20 23 69 66 64 65 66 20 |t inside| #ifdef |
|00002b40| 44 4f 43 55 4d 45 4e 54 | 41 54 49 4f 4e 20 69 73 |DOCUMENT|ATION is|
|00002b50| 20 63 6f 6e 76 65 72 74 | 65 64 20 74 6f 20 72 75 | convert|ed to ru|
|00002b60| 6e 6f 66 66 20 62 79 20 | 61 0a 20 2a 20 44 65 63 |noff by |a. * Dec|
|00002b70| 75 73 20 43 20 74 6f 6f | 6c 2e 0a 20 2a 2f 0a 0a |us C too|l.. */..|
|00002b80| 2f 2a 29 42 55 49 4c 44 | 09 24 28 54 4b 42 4f 50 |/*)BUILD|.$(TKBOP|
|00002b90| 54 49 4f 4e 53 29 20 3d | 20 7b 0a 09 09 09 54 41 |TIONS) =| {....TA|
|00002ba0| 53 4b 09 3d 20 2e 2e 2e | 41 52 58 0a 09 09 7d 0a |SK.= ...|ARX...}.|
|00002bb0| 2a 2f 0a 0a 23 69 66 64 | 65 66 09 44 4f 43 55 4d |*/..#ifd|ef.DOCUM|
|00002bc0| 45 4e 54 41 54 49 4f 4e | 0a 0a 74 69 74 6c 65 09 |ENTATION|..title.|
|00002bd0| 61 72 63 68 78 09 74 65 | 78 74 20 66 69 6c 65 20 |archx.te|xt file |
|00002be0| 61 72 63 68 69 76 65 72 | 20 65 78 74 72 61 63 74 |archiver| extract|
|00002bf0| 69 6f 6e 0a 69 6e 64 65 | 78 09 09 74 65 78 74 20 |ion.inde|x..text |
|00002c00| 66 69 6c 65 20 61 72 63 | 68 69 76 65 72 20 65 78 |file arc|hiver ex|
|00002c10| 74 72 61 63 74 69 6f 6e | 0a 0a 73 79 6e 6f 70 73 |traction|..synops|
|00002c20| 69 73 0a 0a 09 61 72 63 | 68 78 20 61 72 63 68 69 |is...arc|hx archi|
|00002c30| 76 65 5f 66 69 6c 65 73 | 0a 0a 64 65 73 63 72 69 |ve_files|..descri|
|00002c40| 70 74 69 6f 6e 0a 0a 09 | 41 72 63 68 78 20 6d 61 |ption...|Archx ma|
|00002c50| 6e 61 67 65 73 20 61 72 | 63 68 69 76 65 73 20 28 |nages ar|chives (|
|00002c60| 6c 69 62 72 61 72 69 65 | 73 29 20 6f 66 20 73 6f |librarie|s) of so|
|00002c70| 75 72 63 65 20 66 69 6c | 65 73 2c 20 61 6c 6c 6f |urce fil|es, allo|
|00002c80| 77 69 6e 67 0a 09 61 20 | 6c 61 72 67 65 20 6e 75 |wing..a |large nu|
|00002c90| 6d 62 65 72 20 6f 66 20 | 73 6d 61 6c 6c 20 66 69 |mber of |small fi|
|00002ca0| 6c 65 73 20 74 6f 20 62 | 65 20 73 74 6f 72 65 64 |les to b|e stored|
|00002cb0| 20 77 69 74 68 6f 75 74 | 20 75 73 69 6e 67 0a 09 | without| using..|
|00002cc0| 65 78 63 65 73 73 69 76 | 65 20 73 79 73 74 65 6d |excessiv|e system|
|00002cd0| 20 72 65 73 6f 75 72 63 | 65 73 2e 20 20 41 72 63 | resourc|es. Arc|
|00002ce0| 68 78 20 65 78 74 72 61 | 63 74 73 20 61 6c 6c 20 |hx extra|cts all |
|00002cf0| 66 69 6c 65 73 20 66 72 | 6f 6d 0a 09 61 6e 20 61 |files fr|om..an a|
|00002d00| 72 63 68 69 76 65 2e 0a | 0a 09 49 66 20 6e 6f 20 |rchive..|..If no |
|00002d10| 61 72 63 68 69 76 65 5f | 6e 61 6d 65 20 66 69 6c |archive_|name fil|
|00002d20| 65 20 69 73 20 67 69 76 | 65 6e 2c 20 74 68 65 20 |e is giv|en, the |
|00002d30| 73 74 61 6e 64 61 72 64 | 20 69 6e 70 75 74 20 69 |standard| input i|
|00002d40| 73 20 72 65 61 64 2e 0a | 09 41 72 63 68 69 76 65 |s read..|.Archive|
|00002d50| 20 68 65 61 64 65 72 20 | 72 65 63 6f 72 64 73 20 | header |records |
|00002d60| 61 72 65 20 65 63 68 6f | 65 64 20 74 6f 20 74 68 |are echo|ed to th|
|00002d70| 65 20 73 74 61 6e 64 61 | 72 64 20 6f 75 74 70 75 |e standa|rd outpu|
|00002d80| 74 2e 0a 0a 61 72 63 68 | 69 76 65 20 66 69 6c 65 |t...arch|ive file|
|00002d90| 20 66 6f 72 6d 61 74 0a | 0a 09 41 72 63 68 69 76 | format.|..Archiv|
|00002da0| 65 20 66 69 6c 65 73 20 | 61 72 65 20 73 74 61 6e |e files |are stan|
|00002db0| 64 61 72 64 20 74 65 78 | 74 20 66 69 6c 65 73 2e |dard tex|t files.|
|00002dc0| 20 20 45 61 63 68 20 61 | 72 63 68 69 76 65 20 65 | Each a|rchive e|
|00002dd0| 6c 65 6d 65 6e 74 20 69 | 73 0a 09 70 72 65 63 65 |lement i|s..prece|
|00002de0| 65 64 65 64 20 62 79 20 | 61 20 6c 69 6e 65 20 6f |eded by |a line o|
|00002df0| 66 20 74 68 65 20 66 6f | 72 6d 61 74 3a 0a 09 2e |f the fo|rmat:...|
|00002e00| 73 2e 6e 66 0a 09 2d 68 | 2d 09 66 69 6c 65 2e 6e |s.nf..-h|-.file.n|
|00002e10| 61 6d 65 09 64 61 74 65 | 09 74 72 75 65 5f 6e 61 |ame.date|.true_na|
|00002e20| 6d 65 0a 09 2e 73 2e 66 | 0a 09 4e 6f 74 65 20 74 |me...s.f|..Note t|
|00002e30| 68 61 74 20 74 68 65 72 | 65 20 69 73 20 6e 6f 20 |hat ther|e is no |
|00002e40| 6c 69 6e 65 20 6f 72 20 | 62 79 74 65 20 63 6f 75 |line or |byte cou|
|00002e50| 6e 74 2e 20 20 54 6f 20 | 70 72 65 76 65 6e 74 20 |nt. To |prevent |
|00002e60| 70 72 6f 62 6c 65 6d 73 | 2c 0a 09 61 20 27 2d 27 |problems|,..a '-'|
|00002e70| 20 61 74 20 74 68 65 20 | 62 65 67 69 6e 6e 69 6e | at the |beginnin|
|00002e80| 67 20 6f 66 20 61 20 72 | 65 63 6f 72 64 20 77 69 |g of a r|ecord wi|
|00002e90| 74 68 69 6e 20 61 20 75 | 73 65 72 20 66 69 6c 65 |thin a u|ser file|
|00002ea0| 20 6f 72 20 65 6d 62 65 | 64 64 65 64 0a 09 61 72 | or embe|dded..ar|
|00002eb0| 63 68 69 76 65 20 77 69 | 6c 6c 20 62 65 20 22 71 |chive wi|ll be "q|
|00002ec0| 75 6f 74 65 64 22 20 62 | 79 20 64 6f 75 62 6c 69 |uoted" b|y doubli|
|00002ed0| 6e 67 20 69 74 2e 20 20 | 54 68 65 20 64 61 74 65 |ng it. |The date|
|00002ee0| 20 61 6e 64 20 74 72 75 | 65 20 66 69 6c 65 6e 61 | and tru|e filena|
|00002ef0| 6d 65 0a 09 66 69 65 6c | 64 73 20 61 72 65 20 69 |me..fiel|ds are i|
|00002f00| 67 6e 6f 72 65 64 2e 20 | 20 4f 6e 20 73 6f 6d 65 |gnored. | On some|
|00002f10| 20 6f 70 65 72 61 74 69 | 6e 67 20 73 79 73 74 65 | operati|ng syste|
|00002f20| 6d 73 2c 20 66 69 6c 65 | 2e 6e 61 6d 65 20 69 73 |ms, file|.name is|
|00002f30| 0a 09 66 6f 72 63 65 64 | 20 74 6f 20 6c 6f 77 65 |..forced| to lowe|
|00002f40| 72 63 61 73 65 2e 20 20 | 54 68 65 20 61 72 63 68 |rcase. |The arch|
|00002f50| 69 76 65 20 62 75 69 6c | 64 65 72 20 28 61 72 63 |ive buil|der (arc|
|00002f60| 68 63 29 20 6d 61 79 20 | 70 72 65 66 69 78 0a 09 |hc) may |prefix..|
|00002f70| 6f 74 68 65 72 20 63 68 | 61 72 61 63 74 65 72 73 |other ch|aracters|
|00002f80| 20 62 79 20 27 2d 27 2e | 0a 0a 09 49 66 20 74 68 | by '-'.|...If th|
|00002f90| 65 20 66 69 72 73 74 20 | 6e 6f 6e 2d 62 6c 61 6e |e first |non-blan|
|00002fa0| 6b 20 6c 69 6e 65 20 6f | 66 20 61 6e 20 69 6e 70 |k line o|f an inp|
|00002fb0| 75 74 20 66 69 6c 65 20 | 64 6f 65 73 20 6e 6f 74 |ut file |does not|
|00002fc0| 0a 09 62 65 67 69 6e 20 | 77 69 74 68 20 22 2d 68 |..begin |with "-h|
|00002fd0| 22 2c 20 74 68 65 20 74 | 65 78 74 20 77 69 6c 6c |", the t|ext will|
|00002fe0| 20 62 65 20 61 70 70 65 | 6e 64 65 64 20 74 6f 20 | be appe|nded to |
|00002ff0| 22 61 72 63 68 78 2e 74 | 6d 70 22 0a 09 54 68 69 |"archx.t|mp"..Thi|
|00003000| 73 20 69 73 20 6e 65 65 | 64 65 64 20 69 66 20 61 |s is nee|ded if a|
|00003010| 72 63 68 69 76 65 73 20 | 61 72 65 20 64 69 73 74 |rchives |are dist|
|00003020| 72 69 62 75 74 65 64 20 | 62 79 20 6d 61 69 6c 0a |ributed |by mail.|
|00003030| 09 61 6e 64 20 61 72 72 | 69 76 65 20 77 69 74 68 |.and arr|ive with|
|00003040| 20 69 6e 69 74 69 61 6c | 20 72 6f 75 74 69 6e 67 | initial| routing|
|00003050| 20 61 6e 64 20 73 75 62 | 6a 65 63 74 20 69 6e 66 | and sub|ject inf|
|00003060| 6f 72 6d 61 74 69 6f 6e | 2e 0a 0a 64 69 61 67 6e |ormation|...diagn|
|00003070| 6f 73 74 69 63 73 0a 0a | 09 44 69 61 67 6e 6f 73 |ostics..|.Diagnos|
|00003080| 74 69 63 20 6d 65 73 73 | 61 67 65 73 20 73 68 6f |tic mess|ages sho|
|00003090| 75 6c 64 20 62 65 20 73 | 65 6c 66 2d 65 78 70 6c |uld be s|elf-expl|
|000030a0| 61 6e 61 74 6f 72 79 0a | 0a 61 75 74 68 6f 72 0a |anatory.|.author.|
|000030b0| 0a 09 4d 61 72 74 69 6e | 20 4d 69 6e 6f 77 0a 0a |..Martin| Minow..|
|000030c0| 62 75 67 73 0a 0a 23 65 | 6e 64 69 66 0a 0c 0a 23 |bugs..#e|ndif...#|
|000030d0| 69 6e 63 6c 75 64 65 09 | 3c 73 74 64 69 6f 2e 68 |include.|<stdio.h|
|000030e0| 3e 0a 23 69 6e 63 6c 75 | 64 65 09 3c 63 74 79 70 |>.#inclu|de.<ctyp|
|000030f0| 65 2e 68 3e 0a 23 69 66 | 64 65 66 20 76 6d 73 0a |e.h>.#if|def vms.|
|00003100| 23 69 6e 63 6c 75 64 65 | 09 09 3c 73 73 64 65 66 |#include|..<ssdef|
|00003110| 2e 68 3e 0a 23 69 6e 63 | 6c 75 64 65 09 09 3c 73 |.h>.#inc|lude..<s|
|00003120| 74 73 64 65 66 2e 68 3e | 0a 23 64 65 66 69 6e 65 |tsdef.h>|.#define|
|00003130| 09 49 4f 5f 53 55 43 43 | 45 53 53 09 28 53 53 24 |.IO_SUCC|ESS.(SS$|
|00003140| 5f 4e 4f 52 4d 41 4c 20 | 7c 20 53 54 53 24 4d 5f |_NORMAL || STS$M_|
|00003150| 49 4e 48 49 42 5f 4d 53 | 47 29 0a 23 64 65 66 69 |INHIB_MS|G).#defi|
|00003160| 6e 65 09 49 4f 5f 45 52 | 52 4f 52 09 53 53 24 5f |ne.IO_ER|ROR.SS$_|
|00003170| 41 42 4f 52 54 0a 23 65 | 6e 64 69 66 0a 2f 2a 0a |ABORT.#e|ndif./*.|
|00003180| 20 2a 20 4e 6f 74 65 3a | 20 49 4f 5f 53 55 43 43 | * Note:| IO_SUCC|
|00003190| 45 53 53 20 61 6e 64 20 | 49 4f 5f 45 52 52 4f 52 |ESS and |IO_ERROR|
|000031a0| 20 61 72 65 20 64 65 66 | 69 6e 65 64 20 69 6e 20 | are def|ined in |
|000031b0| 74 68 65 20 44 65 63 75 | 73 20 43 20 73 74 64 69 |the Decu|s C stdi|
|000031c0| 6f 2e 68 20 66 69 6c 65 | 0a 20 2a 2f 0a 23 69 66 |o.h file|. */.#if|
|000031d0| 6e 64 65 66 09 49 4f 5f | 53 55 43 43 45 53 53 0a |ndef.IO_|SUCCESS.|
|000031e0| 23 64 65 66 69 6e 65 09 | 49 4f 5f 53 55 43 43 45 |#define.|IO_SUCCE|
|000031f0| 53 53 09 30 0a 23 65 6e | 64 69 66 0a 23 69 66 6e |SS.0.#en|dif.#ifn|
|00003200| 64 65 66 09 49 4f 5f 45 | 52 52 4f 52 0a 23 64 65 |def.IO_E|RROR.#de|
|00003210| 66 69 6e 65 09 49 4f 5f | 45 52 52 4f 52 09 31 0a |fine.IO_|ERROR.1.|
|00003220| 23 65 6e 64 69 66 0a 0a | 23 64 65 66 69 6e 65 20 |#endif..|#define |
|00003230| 45 4f 53 09 09 30 0a 23 | 64 65 66 69 6e 65 09 46 |EOS..0.#|define.F|
|00003240| 41 4c 53 45 09 09 30 0a | 23 64 65 66 69 6e 65 09 |ALSE..0.|#define.|
|00003250| 54 52 55 45 09 09 31 0a | 0a 2f 2a 0a 20 2a 20 54 |TRUE..1.|./*. * T|
|00003260| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 73 74 61 |he follo|wing sta|
|00003270| 74 75 73 20 63 6f 64 65 | 73 20 61 72 65 20 72 65 |tus code|s are re|
|00003280| 74 75 72 6e 65 64 20 62 | 79 20 67 65 74 68 64 72 |turned b|y gethdr|
|00003290| 28 29 0a 20 2a 2f 0a 23 | 64 65 66 69 6e 65 20 44 |(). */.#|define D|
|000032a0| 4f 4e 45 09 30 0a 23 64 | 65 66 69 6e 65 09 47 4f |ONE.0.#d|efine.GO|
|000032b0| 54 43 48 41 09 31 0a 23 | 64 65 66 69 6e 65 09 4e |TCHA.1.#|define.N|
|000032c0| 4f 47 4f 4f 44 09 32 0a | 0a 63 68 61 72 09 09 74 |OGOOD.2.|.char..t|
|000032d0| 65 78 74 5b 35 31 33 5d | 3b 09 09 2f 2a 20 57 6f |ext[513]|;../* Wo|
|000032e0| 72 6b 69 6e 67 20 74 65 | 78 74 20 6c 69 6e 65 09 |rking te|xt line.|
|000032f0| 09 2a 2f 0a 63 68 61 72 | 09 09 6e 61 6d 65 5b 38 |.*/.char|..name[8|
|00003300| 31 5d 3b 09 09 2f 2a 20 | 43 75 72 72 65 6e 74 20 |1];../* |Current |
|00003310| 61 72 63 68 69 76 65 20 | 6d 65 6d 62 65 72 20 6e |archive |member n|
|00003320| 61 6d 65 09 2a 2f 0a 63 | 68 61 72 09 09 66 69 6c |ame.*/.c|har..fil|
|00003330| 65 6e 61 6d 65 5b 38 31 | 5d 3b 09 09 2f 2a 20 57 |ename[81|];../* W|
|00003340| 6f 72 6b 69 6e 67 20 66 | 69 6c 65 20 6e 61 6d 65 |orking f|ile name|
|00003350| 09 09 2a 2f 0a 63 68 61 | 72 09 09 61 72 66 69 6c |..*/.cha|r..arfil|
|00003360| 65 6e 61 6d 65 5b 38 31 | 5d 3b 09 09 2f 2a 20 41 |ename[81|];../* A|
|00003370| 72 63 68 69 76 65 20 66 | 69 6c 65 20 6e 61 6d 65 |rchive f|ile name|
|00003380| 09 09 2a 2f 0a 63 68 61 | 72 09 09 66 75 6c 6c 6e |..*/.cha|r..fulln|
|00003390| 61 6d 65 5b 38 31 5d 3b | 09 09 2f 2a 20 4f 75 74 |ame[81];|../* Out|
|000033a0| 70 75 74 20 66 6f 72 20 | 61 72 67 65 74 6e 61 6d |put for |argetnam|
|000033b0| 65 28 29 09 2a 2f 0a 69 | 6e 74 09 09 76 65 72 62 |e().*/.i|nt..verb|
|000033c0| 6f 73 65 09 09 3d 20 54 | 52 55 45 3b 09 2f 2a 20 |ose..= T|RUE;./* |
|000033d0| 54 52 55 45 20 66 6f 72 | 20 76 65 72 62 6f 73 69 |TRUE for| verbosi|
|000033e0| 74 79 09 09 2a 2f 0a 69 | 6e 74 09 09 66 69 72 73 |ty..*/.i|nt..firs|
|000033f0| 74 5f 61 72 63 68 69 76 | 65 3b 09 09 2f 2a 20 46 |t_archiv|e;../* F|
|00003400| 6f 72 20 6d 61 69 6c 20 | 68 65 61 64 65 72 20 73 |or mail |header s|
|00003410| 6b 69 70 70 69 6e 67 09 | 2a 2f 0a 0c 0a 6d 61 69 |kipping.|*/...mai|
|00003420| 6e 28 61 72 67 63 2c 20 | 61 72 67 76 29 0a 69 6e |n(argc, |argv).in|
|00003430| 74 09 09 61 72 67 63 3b | 09 09 09 2f 2a 20 41 72 |t..argc;|.../* Ar|
|00003440| 67 20 63 6f 75 6e 74 09 | 09 09 2a 2f 0a 63 68 61 |g count.|..*/.cha|
|00003450| 72 09 09 2a 61 72 67 76 | 5b 5d 3b 09 09 2f 2a 20 |r..*argv|[];../* |
|00003460| 41 72 67 20 76 65 63 74 | 6f 72 09 09 09 2a 2f 0a |Arg vect|or...*/.|
|00003470| 7b 0a 09 72 65 67 69 73 | 74 65 72 20 69 6e 74 09 |{..regis|ter int.|
|00003480| 09 69 3b 09 2f 2a 20 52 | 61 6e 64 6f 6d 20 63 6f |.i;./* R|andom co|
|00003490| 75 6e 74 65 72 09 09 2a | 2f 0a 09 69 6e 74 09 09 |unter..*|/..int..|
|000034a0| 09 73 74 61 74 75 73 3b | 09 2f 2a 20 45 78 69 74 |.status;|./* Exit|
|000034b0| 20 73 74 61 74 75 73 09 | 09 09 2a 2f 0a 0a 23 69 | status.|..*/..#i|
|000034c0| 66 64 65 66 09 76 6d 73 | 0a 09 61 72 67 63 20 3d |fdef.vms|..argc =|
|000034d0| 20 67 65 74 72 65 64 69 | 72 65 63 74 69 6f 6e 28 | getredi|rection(|
|000034e0| 61 72 67 63 2c 20 61 72 | 67 76 29 3b 0a 23 65 6e |argc, ar|gv);.#en|
|000034f0| 64 69 66 0a 09 73 74 61 | 74 75 73 20 3d 20 49 4f |dif..sta|tus = IO|
|00003500| 5f 53 55 43 43 45 53 53 | 3b 0a 09 69 66 20 28 61 |_SUCCESS|;..if (a|
|00003510| 72 67 63 20 3d 3d 20 31 | 29 0a 09 20 20 20 20 70 |rgc == 1|).. p|
|00003520| 72 6f 63 65 73 73 28 29 | 3b 0a 09 65 6c 73 65 20 |rocess()|;..else |
|00003530| 7b 0a 09 20 20 20 20 66 | 6f 72 20 28 69 20 3d 20 |{.. f|or (i = |
|00003540| 31 3b 20 69 20 3c 20 61 | 72 67 63 3b 20 69 2b 2b |1; i < a|rgc; i++|
|00003550| 29 20 7b 0a 09 09 69 66 | 20 28 66 72 65 6f 70 65 |) {...if| (freope|
|00003560| 6e 28 61 72 67 76 5b 69 | 5d 2c 20 22 72 22 2c 20 |n(argv[i|], "r", |
|00003570| 73 74 64 69 6e 29 20 21 | 3d 20 4e 55 4c 4c 29 0a |stdin) !|= NULL).|
|00003580| 09 09 20 20 20 20 70 72 | 6f 63 65 73 73 28 29 3b |.. pr|ocess();|
|00003590| 0a 09 09 65 6c 73 65 20 | 7b 0a 09 09 20 20 20 20 |...else |{... |
|000035a0| 70 65 72 72 6f 72 28 61 | 72 67 76 5b 69 5d 29 3b |perror(a|rgv[i]);|
|000035b0| 0a 09 09 20 20 20 20 73 | 74 61 74 75 73 20 3d 20 |... s|tatus = |
|000035c0| 49 4f 5f 45 52 52 4f 52 | 3b 0a 09 09 7d 0a 09 20 |IO_ERROR|;...}.. |
|000035d0| 20 20 20 7d 0a 09 7d 0a | 09 65 78 69 74 28 73 74 | }..}.|.exit(st|
|000035e0| 61 74 75 73 29 3b 0a 7d | 0a 0a 70 72 6f 63 65 73 |atus);.}|..proces|
|000035f0| 73 28 29 0a 2f 2a 0a 20 | 2a 20 50 72 6f 63 65 73 |s()./*. |* Proces|
|00003600| 73 20 61 72 63 68 69 76 | 65 20 6f 70 65 6e 20 6f |s archiv|e open o|
|00003610| 6e 20 73 74 64 69 6e 0a | 20 2a 2f 0a 7b 0a 09 72 |n stdin.| */.{..r|
|00003620| 65 67 69 73 74 65 72 20 | 63 68 61 72 09 09 2a 66 |egister |char..*f|
|00003630| 6e 3b 09 2f 2a 20 46 69 | 6c 65 20 6e 61 6d 65 20 |n;./* Fi|le name |
|00003640| 70 6f 69 6e 74 65 72 09 | 09 2a 2f 0a 09 72 65 67 |pointer.|.*/..reg|
|00003650| 69 73 74 65 72 20 46 49 | 4c 45 09 09 2a 6f 75 74 |ister FI|LE..*out|
|00003660| 66 64 3b 0a 09 72 65 67 | 69 73 74 65 72 20 69 6e |fd;..reg|ister in|
|00003670| 74 09 09 69 3b 0a 0a 09 | 74 65 78 74 5b 30 5d 20 |t..i;...|text[0] |
|00003680| 3d 20 45 4f 53 3b 0a 09 | 77 68 69 6c 65 20 28 28 |= EOS;..|while ((|
|00003690| 69 20 3d 20 67 65 74 68 | 64 72 28 29 29 20 21 3d |i = geth|dr()) !=|
|000036a0| 20 44 4f 4e 45 29 20 7b | 0a 09 20 20 20 20 73 77 | DONE) {|.. sw|
|000036b0| 69 74 63 68 20 28 69 29 | 20 7b 0a 09 20 20 20 20 |itch (i)| {.. |
|000036c0| 63 61 73 65 20 47 4f 54 | 43 48 41 3a 0a 09 09 69 |case GOT|CHA:...i|
|000036d0| 66 20 28 28 6f 75 74 66 | 64 20 3d 20 66 6f 70 65 |f ((outf|d = fope|
|000036e0| 6e 28 6e 61 6d 65 2c 20 | 22 77 22 29 29 20 3d 3d |n(name, |"w")) ==|
|000036f0| 20 4e 55 4c 4c 29 20 7b | 0a 09 09 20 20 20 20 70 | NULL) {|... p|
|00003700| 65 72 72 6f 72 28 6e 61 | 6d 65 29 3b 0a 09 09 20 |error(na|me);... |
|00003710| 20 20 20 66 70 72 69 6e | 74 66 28 73 74 64 65 72 | fprin|tf(stder|
|00003720| 72 2c 20 22 43 61 6e 27 | 74 20 63 72 65 61 74 65 |r, "Can'|t create|
|00003730| 20 5c 22 25 73 5c 22 5c | 6e 22 2c 20 6e 61 6d 65 | \"%s\"\|n", name|
|00003740| 29 3b 0a 09 09 20 20 20 | 20 61 72 73 6b 69 70 28 |);... | arskip(|
|00003750| 29 3b 0a 09 09 20 20 20 | 20 63 6f 6e 74 69 6e 75 |);... | continu|
|00003760| 65 3b 0a 09 09 7d 0a 09 | 09 62 72 65 61 6b 3b 0a |e;...}..|.break;.|
|00003770| 0a 09 20 20 20 20 63 61 | 73 65 20 4e 4f 47 4f 4f |.. ca|se NOGOO|
|00003780| 44 3a 0a 09 09 66 70 72 | 69 6e 74 66 28 73 74 64 |D:...fpr|intf(std|
|00003790| 65 72 72 2c 20 22 4d 69 | 73 73 69 6e 67 20 2d 68 |err, "Mi|ssing -h|
|000037a0| 2d 2c 20 77 72 69 74 69 | 6e 67 20 74 6f 20 61 72 |-, writi|ng to ar|
|000037b0| 63 68 78 2e 74 6d 70 5c | 6e 22 29 3b 0a 09 09 66 |chx.tmp\|n");...f|
|000037c0| 70 72 69 6e 74 66 28 73 | 74 64 65 72 72 2c 20 22 |printf(s|tderr, "|
|000037d0| 43 75 72 72 65 6e 74 20 | 74 65 78 74 20 6c 69 6e |Current |text lin|
|000037e0| 65 3a 20 25 73 22 2c 20 | 74 65 78 74 29 3b 0a 09 |e: %s", |text);..|
|000037f0| 09 73 74 72 63 70 79 28 | 6e 61 6d 65 2c 20 22 61 |.strcpy(|name, "a|
|00003800| 72 63 68 78 2e 74 6d 70 | 22 29 3b 0a 09 09 69 66 |rchx.tmp|");...if|
|00003810| 20 28 28 6f 75 74 66 64 | 20 3d 20 66 6f 70 65 6e | ((outfd| = fopen|
|00003820| 28 6e 61 6d 65 2c 20 22 | 61 22 29 29 20 3d 3d 20 |(name, "|a")) == |
|00003830| 4e 55 4c 4c 29 20 7b 0a | 09 09 20 20 20 20 70 65 |NULL) {.|.. pe|
|00003840| 72 72 6f 72 28 6e 61 6d | 65 29 3b 0a 09 09 20 20 |rror(nam|e);... |
|00003850| 20 20 66 70 72 69 6e 74 | 66 28 73 74 64 65 72 72 | fprint|f(stderr|
|00003860| 2c 20 22 43 61 6e 6e 6f | 74 20 61 70 70 65 6e 64 |, "Canno|t append|
|00003870| 20 74 6f 20 25 73 5c 6e | 22 2c 20 6e 61 6d 65 29 | to %s\n|", name)|
|00003880| 3b 0a 09 09 20 20 20 20 | 61 72 73 6b 69 70 28 29 |;... |arskip()|
|00003890| 3b 0a 09 09 20 20 20 20 | 63 6f 6e 74 69 6e 75 65 |;... |continue|
|000038a0| 3b 0a 09 09 7d 0a 09 09 | 62 72 65 61 6b 3b 0a 09 |;...}...|break;..|
|000038b0| 20 20 20 20 7d 0a 09 20 | 20 20 20 61 72 65 78 70 | }.. | arexp|
|000038c0| 6f 72 74 28 6f 75 74 66 | 64 29 3b 0a 09 20 20 20 |ort(outf|d);.. |
|000038d0| 20 66 63 6c 6f 73 65 28 | 6f 75 74 66 64 29 3b 0a | fclose(|outfd);.|
|000038e0| 09 7d 0a 7d 0a 0c 0a 69 | 6e 74 0a 67 65 74 68 64 |.}.}...i|nt.gethd|
|000038f0| 72 28 29 0a 2f 2a 0a 20 | 2a 20 49 66 20 74 65 78 |r()./*. |* If tex|
|00003900| 74 20 69 73 20 6e 75 6c | 6c 2c 20 72 65 61 64 20 |t is nul|l, read |
|00003910| 61 20 72 65 63 6f 72 64 | 2c 20 72 65 74 75 72 6e |a record|, return|
|00003920| 69 6e 67 20 74 6f 20 73 | 69 67 6e 61 6c 20 69 6e |ing to s|ignal in|
|00003930| 70 75 74 20 73 74 61 74 | 65 3a 0a 20 2a 09 44 4f |put stat|e:. *.DO|
|00003940| 4e 45 09 45 6f 66 20 72 | 65 61 64 0a 20 2a 09 4e |NE.Eof r|ead. *.N|
|00003950| 4f 47 4f 4f 44 09 2d 68 | 2d 20 77 61 73 6e 27 74 |OGOOD.-h|- wasn't|
|00003960| 20 66 69 72 73 74 20 6e | 6f 6e 2d 62 6c 61 6e 6b | first n|on-blank|
|00003970| 20 6c 69 6e 65 2e 20 20 | 4c 69 6e 65 20 69 73 20 | line. |Line is |
|00003980| 69 6e 20 74 65 78 74 5b | 5d 0a 20 2a 09 47 4f 54 |in text[|]. *.GOT|
|00003990| 43 48 41 09 2d 68 2d 20 | 66 6f 75 6e 64 2c 20 70 |CHA.-h- |found, p|
|000039a0| 61 72 73 65 64 20 69 6e | 74 6f 20 6e 61 6d 65 2e |arsed in|to name.|
|000039b0| 0a 20 2a 2f 0a 7b 0a 09 | 72 65 67 69 73 74 65 72 |. */.{..|register|
|000039c0| 20 63 68 61 72 09 2a 74 | 70 3b 0a 09 72 65 67 69 | char.*t|p;..regi|
|000039d0| 73 74 65 72 20 63 68 61 | 72 09 2a 6e 70 3b 0a 0a |ster cha|r.*np;..|
|000039e0| 61 67 61 69 6e 3a 09 69 | 66 20 28 74 65 78 74 5b |again:.i|f (text[|
|000039f0| 30 5d 20 3d 3d 20 45 4f | 53 0a 09 20 26 26 20 66 |0] == EO|S.. && f|
|00003a00| 67 65 74 73 28 74 65 78 | 74 2c 20 73 69 7a 65 6f |gets(tex|t, sizeo|
|00003a10| 66 20 74 65 78 74 2c 20 | 73 74 64 69 6e 29 20 3d |f text, |stdin) =|
|00003a20| 3d 20 4e 55 4c 4c 29 0a | 09 20 20 20 20 72 65 74 |= NULL).|. ret|
|00003a30| 75 72 6e 20 28 44 4f 4e | 45 29 3b 0a 09 69 66 20 |urn (DON|E);..if |
|00003a40| 28 74 65 78 74 5b 30 5d | 20 3d 3d 20 27 5c 6e 27 |(text[0]| == '\n'|
|00003a50| 20 26 26 20 74 65 78 74 | 5b 31 5d 20 3d 3d 20 45 | && text|[1] == E|
|00003a60| 4f 53 29 20 7b 0a 09 20 | 20 20 20 74 65 78 74 5b |OS) {.. | text[|
|00003a70| 30 5d 20 3d 20 45 4f 53 | 3b 0a 09 20 20 20 20 67 |0] = EOS|;.. g|
|00003a80| 6f 74 6f 20 61 67 61 69 | 6e 3b 0a 09 7d 0a 09 69 |oto agai|n;..}..i|
|00003a90| 66 20 28 74 65 78 74 5b | 30 5d 20 21 3d 20 27 2d |f (text[|0] != '-|
|00003aa0| 27 0a 09 20 7c 7c 20 74 | 65 78 74 5b 31 5d 20 21 |'.. || t|ext[1] !|
|00003ab0| 3d 20 27 68 27 0a 09 20 | 7c 7c 20 74 65 78 74 5b |= 'h'.. ||| text[|
|00003ac0| 32 5d 20 21 3d 20 27 2d | 27 29 0a 09 20 20 20 20 |2] != '-|').. |
|00003ad0| 72 65 74 75 72 6e 20 28 | 4e 4f 47 4f 4f 44 29 3b |return (|NOGOOD);|
|00003ae0| 0a 09 66 6f 72 20 28 74 | 70 20 3d 20 26 74 65 78 |..for (t|p = &tex|
|00003af0| 74 5b 33 5d 3b 20 69 73 | 73 70 61 63 65 28 2a 74 |t[3]; is|space(*t|
|00003b00| 70 29 3b 20 74 70 2b 2b | 29 0a 09 20 20 20 20 3b |p); tp++|).. ;|
|00003b10| 0a 09 66 6f 72 20 28 6e | 70 20 3d 20 6e 61 6d 65 |..for (n|p = name|
|00003b20| 3b 20 21 69 73 73 70 61 | 63 65 28 2a 74 70 29 3b |; !isspa|ce(*tp);|
|00003b30| 20 2a 6e 70 2b 2b 20 3d | 20 2a 74 70 2b 2b 29 0a | *np++ =| *tp++).|
|00003b40| 09 20 20 20 20 3b 0a 09 | 2a 6e 70 20 3d 20 45 4f |. ;..|*np = EO|
|00003b50| 53 3b 0a 09 72 65 74 75 | 72 6e 20 28 47 4f 54 43 |S;..retu|rn (GOTC|
|00003b60| 48 41 29 3b 0a 7d 0a 0c | 0a 61 72 73 6b 69 70 28 |HA);.}..|.arskip(|
|00003b70| 29 0a 2f 2a 0a 20 2a 20 | 53 6b 69 70 20 74 6f 20 |)./*. * |Skip to |
|00003b80| 6e 65 78 74 20 68 65 61 | 64 65 72 0a 20 2a 2f 0a |next hea|der. */.|
|00003b90| 7b 0a 09 77 68 69 6c 65 | 20 28 66 67 65 74 73 28 |{..while| (fgets(|
|00003ba0| 74 65 78 74 2c 20 73 69 | 7a 65 6f 66 20 74 65 78 |text, si|zeof tex|
|00003bb0| 74 2c 20 73 74 64 69 6e | 29 20 21 3d 20 4e 55 4c |t, stdin|) != NUL|
|00003bc0| 4c 29 20 7b 0a 09 20 20 | 20 20 69 66 20 28 74 65 |L) {.. | if (te|
|00003bd0| 78 74 5b 30 5d 20 3d 3d | 20 27 2d 27 20 26 26 20 |xt[0] ==| '-' && |
|00003be0| 74 65 78 74 5b 31 5d 20 | 3d 3d 20 27 68 27 20 26 |text[1] |== 'h' &|
|00003bf0| 26 20 74 65 78 74 5b 32 | 5d 20 3d 3d 20 27 2d 27 |& text[2|] == '-'|
|00003c00| 29 0a 09 09 72 65 74 75 | 72 6e 3b 0a 09 7d 0a 09 |)...retu|rn;..}..|
|00003c10| 74 65 78 74 5b 30 5d 20 | 3d 20 45 4f 53 3b 09 09 |text[0] |= EOS;..|
|00003c20| 09 09 2f 2a 20 45 4f 46 | 20 73 69 67 6e 61 6c 09 |../* EOF| signal.|
|00003c30| 09 2a 2f 0a 7d 0a 0c 0a | 61 72 65 78 70 6f 72 74 |.*/.}...|arexport|
|00003c40| 28 6f 75 74 66 64 29 0a | 72 65 67 69 73 74 65 72 |(outfd).|register|
|00003c50| 20 46 49 4c 45 09 2a 6f | 75 74 66 64 3b 0a 2f 2a | FILE.*o|utfd;./*|
|00003c60| 0a 20 2a 20 52 65 61 64 | 20 73 65 63 72 65 74 20 |. * Read| secret |
|00003c70| 61 72 63 68 69 76 65 20 | 66 6f 72 6d 61 74 2c 20 |archive |format, |
|00003c80| 77 72 69 74 69 6e 67 20 | 61 72 63 68 69 76 65 64 |writing |archived|
|00003c90| 20 64 61 74 61 20 74 6f | 20 6f 75 74 66 64 2e 0a | data to| outfd..|
|00003ca0| 20 2a 20 43 6c 65 61 6e | 20 6f 75 74 20 65 78 74 | * Clean| out ext|
|00003cb0| 72 61 6e 65 6f 75 73 20 | 3c 63 72 3e 2c 3c 6c 66 |raneous |<cr>,<lf|
|00003cc0| 3e 27 73 0a 20 2a 2f 0a | 7b 0a 09 72 65 67 69 73 |>'s. */.|{..regis|
|00003cd0| 74 65 72 20 63 68 61 72 | 09 2a 74 70 3b 0a 09 75 |ter char|.*tp;..u|
|00003ce0| 6e 73 69 67 6e 65 64 20 | 69 6e 74 09 6e 72 65 63 |nsigned |int.nrec|
|00003cf0| 6f 72 64 73 3b 0a 0a 09 | 70 72 69 6e 74 66 28 22 |ords;...|printf("|
|00003d00| 43 72 65 61 74 69 6e 67 | 20 5c 22 25 73 5c 22 2c |Creating| \"%s\",|
|00003d10| 20 22 2c 20 6e 61 6d 65 | 29 3b 0a 09 6e 72 65 63 | ", name|);..nrec|
|00003d20| 6f 72 64 73 20 3d 20 30 | 3b 0a 09 77 68 69 6c 65 |ords = 0|;..while|
|00003d30| 20 28 66 67 65 74 73 28 | 74 65 78 74 2c 20 73 69 | (fgets(|text, si|
|00003d40| 7a 65 6f 66 20 74 65 78 | 74 2c 20 73 74 64 69 6e |zeof tex|t, stdin|
|00003d50| 29 20 21 3d 20 4e 55 4c | 4c 29 20 7b 0a 09 20 20 |) != NUL|L) {.. |
|00003d60| 20 20 74 70 20 3d 20 26 | 74 65 78 74 5b 73 74 72 | tp = &|text[str|
|00003d70| 6c 65 6e 28 74 65 78 74 | 29 5d 3b 0a 09 20 20 20 |len(text|)];.. |
|00003d80| 20 69 66 20 28 74 70 20 | 3e 20 26 74 65 78 74 5b | if (tp |> &text[|
|00003d90| 31 5d 20 26 26 20 2a 2d | 2d 74 70 20 3d 3d 20 27 |1] && *-|-tp == '|
|00003da0| 5c 6e 27 20 26 26 20 2a | 2d 2d 74 70 20 3d 3d 20 |\n' && *|--tp == |
|00003db0| 27 5c 72 27 29 20 7b 0a | 09 09 2a 74 70 2b 2b 20 |'\r') {.|..*tp++ |
|00003dc0| 3d 20 27 5c 6e 27 3b 0a | 09 09 2a 74 70 20 3d 20 |= '\n';.|..*tp = |
|00003dd0| 45 4f 53 3b 0a 09 20 20 | 20 20 7d 0a 09 20 20 20 |EOS;.. | }.. |
|00003de0| 20 69 66 20 28 74 65 78 | 74 5b 30 5d 20 3d 3d 20 | if (tex|t[0] == |
|00003df0| 27 2d 27 29 20 7b 0a 09 | 09 69 66 20 28 74 65 78 |'-') {..|.if (tex|
|00003e00| 74 5b 31 5d 20 3d 3d 20 | 27 68 27 29 0a 09 09 20 |t[1] == |'h')... |
|00003e10| 20 20 20 67 6f 74 6f 20 | 67 6f 74 63 68 61 3b 0a | goto |gotcha;.|
|00003e20| 09 09 66 70 75 74 73 28 | 74 65 78 74 2b 31 2c 20 |..fputs(|text+1, |
|00003e30| 6f 75 74 66 64 29 3b 0a | 09 20 20 20 20 7d 0a 09 |outfd);.|. }..|
|00003e40| 20 20 20 20 65 6c 73 65 | 20 7b 0a 09 09 66 70 75 | else| {...fpu|
|00003e50| 74 73 28 74 65 78 74 2c | 20 6f 75 74 66 64 29 3b |ts(text,| outfd);|
|00003e60| 0a 09 20 20 20 20 7d 0a | 09 20 20 20 20 6e 72 65 |.. }.|. nre|
|00003e70| 63 6f 72 64 73 2b 2b 3b | 0a 09 7d 0a 09 74 65 78 |cords++;|..}..tex|
|00003e80| 74 5b 30 5d 20 3d 20 45 | 4f 53 3b 0a 67 6f 74 63 |t[0] = E|OS;.gotc|
|00003e90| 68 61 3a 09 70 72 69 6e | 74 66 28 22 25 75 20 72 |ha:.prin|tf("%u r|
|00003ea0| 65 63 6f 72 64 73 5c 6e | 22 2c 20 6e 72 65 63 6f |ecords\n|", nreco|
|00003eb0| 72 64 73 29 3b 0a 09 69 | 66 20 28 66 65 72 72 6f |rds);..i|f (ferro|
|00003ec0| 72 28 73 74 64 69 6e 29 | 20 7c 7c 20 66 65 72 72 |r(stdin)| || ferr|
|00003ed0| 6f 72 28 6f 75 74 66 64 | 29 29 0a 09 20 20 20 20 |or(outfd|)).. |
|00003ee0| 70 72 69 6e 74 66 28 22 | 43 72 65 61 74 69 6f 6e |printf("|Creation|
|00003ef0| 20 6f 66 20 5c 22 25 73 | 5c 22 20 63 6f 6d 70 6c | of \"%s|\" compl|
|00003f00| 65 74 65 64 20 77 69 74 | 68 20 65 72 72 6f 72 5c |eted wit|h error\|
|00003f10| 6e 22 2c 20 6e 61 6d 65 | 29 3b 0a 7d 0a 0c 0a 2f |n", name|);.}.../|
|00003f20| 2a 0a 20 2a 20 67 65 74 | 72 65 64 69 72 65 63 74 |*. * get|redirect|
|00003f30| 69 6f 6e 28 29 20 69 73 | 20 69 6e 74 65 6e 64 65 |ion() is| intende|
|00003f40| 64 20 74 6f 20 61 69 64 | 20 69 6e 20 70 6f 72 74 |d to aid| in port|
|00003f50| 69 6e 67 20 43 20 70 72 | 6f 67 72 61 6d 73 0a 20 |ing C pr|ograms. |
|00003f60| 2a 20 74 6f 20 56 4d 53 | 20 28 56 61 78 2d 31 31 |* to VMS| (Vax-11|
|00003f70| 20 43 29 20 77 68 69 63 | 68 20 64 6f 65 73 20 6e | C) whic|h does n|
|00003f80| 6f 74 20 73 75 70 70 6f | 72 74 20 27 3e 27 20 61 |ot suppo|rt '>' a|
|00003f90| 6e 64 20 27 3c 27 0a 20 | 2a 20 49 2f 4f 20 72 65 |nd '<'. |* I/O re|
|00003fa0| 64 69 72 65 63 74 69 6f | 6e 2e 20 20 57 69 74 68 |directio|n. With|
|00003fb0| 20 73 75 69 74 61 62 6c | 65 20 6d 6f 64 69 66 69 | suitabl|e modifi|
|00003fc0| 63 61 74 69 6f 6e 2c 20 | 69 74 20 6d 61 79 0a 20 |cation, |it may. |
|00003fd0| 2a 20 75 73 65 66 75 6c | 20 66 6f 72 20 6f 74 68 |* useful| for oth|
|00003fe0| 65 72 20 70 6f 72 74 61 | 62 69 6c 69 74 79 20 70 |er porta|bility p|
|00003ff0| 72 6f 62 6c 65 6d 73 20 | 61 73 20 77 65 6c 6c 2e |roblems |as well.|
|00004000| 0a 20 2a 2f 0a 0a 23 69 | 66 64 65 66 09 76 6d 73 |. */..#i|fdef.vms|
|00004010| 0a 73 74 61 74 69 63 20 | 69 6e 74 0a 67 65 74 72 |.static |int.getr|
|00004020| 65 64 69 72 65 63 74 69 | 6f 6e 28 61 72 67 63 2c |edirecti|on(argc,|
|00004030| 20 61 72 67 76 29 0a 69 | 6e 74 09 09 61 72 67 63 | argv).i|nt..argc|
|00004040| 3b 0a 63 68 61 72 09 09 | 2a 2a 61 72 67 76 3b 0a |;.char..|**argv;.|
|00004050| 2f 2a 0a 20 2a 20 50 72 | 6f 63 65 73 73 20 76 6d |/*. * Pr|ocess vm|
|00004060| 73 20 72 65 64 69 72 65 | 63 74 69 6f 6e 20 61 72 |s redire|ction ar|
|00004070| 67 27 73 2e 20 20 45 78 | 69 74 20 69 66 20 61 6e |g's. Ex|it if an|
|00004080| 79 20 65 72 72 6f 72 20 | 69 73 20 73 65 65 6e 2e |y error |is seen.|
|00004090| 0a 20 2a 20 49 66 20 67 | 65 74 72 65 64 69 72 65 |. * If g|etredire|
|000040a0| 63 74 69 6f 6e 28 29 20 | 70 72 6f 63 65 73 73 65 |ction() |processe|
|000040b0| 73 20 61 6e 20 61 72 67 | 75 6d 65 6e 74 2c 20 69 |s an arg|ument, i|
|000040c0| 74 20 69 73 20 65 72 61 | 73 65 64 0a 20 2a 20 66 |t is era|sed. * f|
|000040d0| 72 6f 6d 20 74 68 65 20 | 76 65 63 74 6f 72 2e 20 |rom the |vector. |
|000040e0| 20 67 65 74 72 65 64 69 | 72 65 63 74 69 6f 6e 28 | getredi|rection(|
|000040f0| 29 20 72 65 74 75 72 6e | 73 20 61 20 6e 65 77 20 |) return|s a new |
|00004100| 61 72 67 63 20 76 61 6c | 75 65 2e 0a 20 2a 0a 20 |argc val|ue.. *. |
|00004110| 2a 20 57 61 72 6e 69 6e | 67 3a 20 64 6f 20 6e 6f |* Warnin|g: do no|
|00004120| 74 20 74 72 79 20 74 6f | 20 73 69 6d 70 6c 69 66 |t try to| simplif|
|00004130| 79 20 74 68 65 20 63 6f | 64 65 20 66 6f 72 20 76 |y the co|de for v|
|00004140| 6d 73 2e 20 20 54 68 65 | 20 63 6f 64 65 0a 20 2a |ms. The| code. *|
|00004150| 20 70 72 65 73 75 70 70 | 6f 73 65 73 20 74 68 61 | presupp|oses tha|
|00004160| 74 20 67 65 74 72 65 64 | 69 72 65 63 74 69 6f 6e |t getred|irection|
|00004170| 28 29 20 69 73 20 63 61 | 6c 6c 65 64 20 62 65 66 |() is ca|lled bef|
|00004180| 6f 72 65 20 61 6e 79 20 | 64 61 74 61 20 69 73 0a |ore any |data is.|
|00004190| 20 2a 20 72 65 61 64 20 | 66 72 6f 6d 20 73 74 64 | * read |from std|
|000041a0| 69 6e 20 6f 72 20 77 72 | 69 74 74 65 6e 20 74 6f |in or wr|itten to|
|000041b0| 20 73 74 64 6f 75 74 2e | 0a 20 2a 0a 20 2a 20 4e | stdout.|. *. * N|
|000041c0| 6f 72 6d 61 6c 20 75 73 | 61 67 65 20 69 73 20 61 |ormal us|age is a|
|000041d0| 73 20 66 6f 6c 6c 6f 77 | 73 3a 0a 20 2a 0a 20 2a |s follow|s:. *. *|
|000041e0| 09 6d 61 69 6e 28 61 72 | 67 63 2c 20 61 72 67 76 |.main(ar|gc, argv|
|000041f0| 29 0a 20 2a 09 69 6e 74 | 09 09 61 72 67 63 3b 0a |). *.int|..argc;.|
|00004200| 20 2a 09 63 68 61 72 09 | 09 2a 61 72 67 76 5b 5d | *.char.|.*argv[]|
|00004210| 3b 0a 20 2a 09 7b 0a 20 | 2a 09 09 61 72 67 63 20 |;. *.{. |*..argc |
|00004220| 3d 20 67 65 74 72 65 64 | 69 72 65 63 74 69 6f 6e |= getred|irection|
|00004230| 28 61 72 67 63 2c 20 61 | 72 67 76 29 3b 0a 20 2a |(argc, a|rgv);. *|
|00004240| 09 7d 0a 20 2a 2f 0a 7b | 0a 09 72 65 67 69 73 74 |.}. */.{|..regist|
|00004250| 65 72 20 63 68 61 72 09 | 09 2a 61 70 3b 09 2f 2a |er char.|.*ap;./*|
|00004260| 20 41 72 67 75 6d 65 6e | 74 20 70 6f 69 6e 74 65 | Argumen|t pointe|
|00004270| 72 09 2a 2f 0a 09 69 6e | 74 09 09 09 69 3b 09 2f |r.*/..in|t...i;./|
|00004280| 2a 20 61 72 67 76 5b 5d | 20 69 6e 64 65 78 09 09 |* argv[]| index..|
|00004290| 2a 2f 0a 09 69 6e 74 09 | 09 09 6a 3b 09 2f 2a 20 |*/..int.|..j;./* |
|000042a0| 4f 75 74 70 75 74 20 69 | 6e 64 65 78 09 09 2a 2f |Output i|ndex..*/|
|000042b0| 0a 09 69 6e 74 09 09 09 | 66 69 6c 65 3b 09 2f 2a |..int...|file;./*|
|000042c0| 20 46 69 6c 65 5f 64 65 | 73 63 72 69 70 74 6f 72 | File_de|scriptor|
|000042d0| 20 09 2a 2f 0a 0a 09 66 | 6f 72 20 28 6a 20 3d 20 | .*/...f|or (j = |
|000042e0| 69 20 3d 20 31 3b 20 69 | 20 3c 20 61 72 67 63 3b |i = 1; i| < argc;|
|000042f0| 20 69 2b 2b 29 20 7b 20 | 20 20 2f 2a 20 44 6f 20 | i++) { | /* Do |
|00004300| 61 6c 6c 20 61 72 67 75 | 6d 65 6e 74 73 09 2a 2f |all argu|ments.*/|
|00004310| 0a 09 20 20 20 20 73 77 | 69 74 63 68 20 28 2a 28 |.. sw|itch (*(|
|00004320| 61 70 20 3d 20 61 72 67 | 76 5b 69 5d 29 29 20 7b |ap = arg|v[i])) {|
|00004330| 0a 09 20 20 20 20 63 61 | 73 65 20 27 3c 27 3a 09 |.. ca|se '<':.|
|00004340| 09 09 2f 2a 20 3c 66 69 | 6c 65 09 09 2a 2f 0a 09 |../* <fi|le..*/..|
|00004350| 09 69 66 20 28 66 72 65 | 6f 70 65 6e 28 2b 2b 61 |.if (fre|open(++a|
|00004360| 70 2c 20 22 72 22 2c 20 | 73 74 64 69 6e 29 20 3d |p, "r", |stdin) =|
|00004370| 3d 20 4e 55 4c 4c 29 20 | 7b 0a 09 09 20 20 20 20 |= NULL) |{... |
|00004380| 70 65 72 72 6f 72 28 61 | 70 29 3b 09 09 2f 2a 20 |perror(a|p);../* |
|00004390| 43 61 6e 27 74 20 66 69 | 6e 64 20 66 69 6c 65 09 |Can't fi|nd file.|
|000043a0| 2a 2f 0a 09 09 20 20 20 | 20 65 78 69 74 28 49 4f |*/... | exit(IO|
|000043b0| 5f 45 52 52 4f 52 29 3b | 09 2f 2a 20 49 73 20 61 |_ERROR);|./* Is a|
|000043c0| 20 66 61 74 61 6c 20 65 | 72 72 6f 72 09 2a 2f 0a | fatal e|rror.*/.|
|000043d0| 09 09 7d 0a 0a 09 20 20 | 20 20 63 61 73 65 20 27 |..}... | case '|
|000043e0| 3e 27 3a 09 09 09 2f 2a | 20 3e 66 69 6c 65 20 6f |>':.../*| >file o|
|000043f0| 72 20 3e 3e 66 69 6c 65 | 09 2a 2f 0a 09 09 69 66 |r >>file|.*/...if|
|00004400| 20 28 2a 2b 2b 61 70 20 | 3d 3d 20 27 3e 27 29 20 | (*++ap |== '>') |
|00004410| 7b 09 2f 2a 20 3e 3e 66 | 69 6c 65 09 09 2a 2f 0a |{./* >>f|ile..*/.|
|00004420| 09 09 20 20 20 20 2f 2a | 0a 09 09 20 20 20 20 20 |.. /*|... |
|00004430| 2a 20 49 66 20 74 68 65 | 20 66 69 6c 65 20 65 78 |* If the| file ex|
|00004440| 69 73 74 73 2c 20 61 6e | 64 20 69 73 20 77 72 69 |ists, an|d is wri|
|00004450| 74 61 62 6c 65 20 62 79 | 20 75 73 2c 0a 09 09 20 |table by| us,... |
|00004460| 20 20 20 20 2a 20 63 61 | 6c 6c 20 66 72 65 6f 70 | * ca|ll freop|
|00004470| 65 6e 20 74 6f 20 61 70 | 70 65 6e 64 20 74 6f 20 |en to ap|pend to |
|00004480| 74 68 65 20 66 69 6c 65 | 20 28 75 73 69 6e 67 20 |the file| (using |
|00004490| 74 68 65 0a 09 09 20 20 | 20 20 20 2a 20 66 69 6c |the... | * fil|
|000044a0| 65 27 73 20 63 75 72 72 | 65 6e 74 20 61 74 74 72 |e's curr|ent attr|
|000044b0| 69 62 75 74 65 73 29 2e | 20 20 4f 74 68 65 72 77 |ibutes).| Otherw|
|000044c0| 69 73 65 2c 20 63 72 65 | 61 74 65 0a 09 09 20 20 |ise, cre|ate... |
|000044d0| 20 20 20 2a 20 61 20 6e | 65 77 20 66 69 6c 65 20 | * a n|ew file |
|000044e0| 77 69 74 68 20 22 76 61 | 6e 69 6c 6c 61 22 20 61 |with "va|nilla" a|
|000044f0| 74 74 72 69 62 75 74 65 | 73 20 61 73 20 69 66 0a |ttribute|s as if.|
|00004500| 09 09 20 20 20 20 20 2a | 20 74 68 65 20 61 72 67 |.. *| the arg|
|00004510| 75 6d 65 6e 74 20 77 61 | 73 20 67 69 76 65 6e 20 |ument wa|s given |
|00004520| 61 73 20 22 3e 66 69 6c | 65 6e 61 6d 65 22 2e 0a |as ">fil|ename"..|
|00004530| 09 09 20 20 20 20 20 2a | 20 61 63 63 65 73 73 28 |.. *| access(|
|00004540| 6e 61 6d 65 2c 20 32 29 | 20 69 73 20 54 52 55 45 |name, 2)| is TRUE|
|00004550| 20 69 66 20 77 65 20 63 | 61 6e 20 77 72 69 74 65 | if we c|an write|
|00004560| 20 6f 6e 0a 09 09 20 20 | 20 20 20 2a 20 74 68 65 | on... | * the|
|00004570| 20 73 70 65 63 69 66 69 | 65 64 20 66 69 6c 65 2e | specifi|ed file.|
|00004580| 0a 09 09 20 20 20 20 20 | 2a 2f 0a 09 09 20 20 20 |... |*/... |
|00004590| 20 69 66 20 28 61 63 63 | 65 73 73 28 2b 2b 61 70 | if (acc|ess(++ap|
|000045a0| 2c 20 32 29 20 3d 3d 20 | 30 29 20 7b 0a 09 09 09 |, 2) == |0) {....|
|000045b0| 69 66 20 28 66 72 65 6f | 70 65 6e 28 61 70 2c 20 |if (freo|pen(ap, |
|000045c0| 22 61 22 2c 20 73 74 64 | 6f 75 74 29 20 21 3d 20 |"a", std|out) != |
|000045d0| 4e 55 4c 4c 29 0a 09 09 | 09 20 20 20 20 62 72 65 |NULL)...|. bre|
|000045e0| 61 6b 3b 09 2f 2a 20 45 | 78 69 74 20 63 61 73 65 |ak;./* E|xit case|
|000045f0| 20 73 74 61 74 65 6d 65 | 6e 74 09 2a 2f 0a 09 09 | stateme|nt.*/...|
|00004600| 09 70 65 72 72 6f 72 28 | 61 70 29 3b 09 2f 2a 20 |.perror(|ap);./* |
|00004610| 45 72 72 6f 72 2c 20 63 | 61 6e 27 74 20 61 70 70 |Error, c|an't app|
|00004620| 65 6e 64 09 2a 2f 0a 09 | 09 09 65 78 69 74 28 49 |end.*/..|..exit(I|
|00004630| 4f 5f 45 52 52 4f 52 29 | 3b 09 2f 2a 20 41 66 74 |O_ERROR)|;./* Aft|
|00004640| 65 72 20 61 63 63 65 73 | 73 20 74 65 73 74 09 2a |er acces|s test.*|
|00004650| 2f 0a 09 09 20 20 20 20 | 7d 09 09 09 2f 2a 20 49 |/... |}.../* I|
|00004660| 66 20 66 69 6c 65 20 61 | 63 63 65 73 73 61 62 6c |f file a|ccessabl|
|00004670| 65 09 2a 2f 0a 09 09 7d | 0a 09 09 2f 2a 0a 09 09 |e.*/...}|.../*...|
|00004680| 20 2a 20 4f 6e 20 76 6d | 73 2c 20 77 65 20 77 61 | * On vm|s, we wa|
|00004690| 6e 74 20 74 6f 20 63 72 | 65 61 74 65 20 74 68 65 |nt to cr|eate the|
|000046a0| 20 66 69 6c 65 20 75 73 | 69 6e 67 20 22 73 74 61 | file us|ing "sta|
|000046b0| 6e 64 61 72 64 22 0a 09 | 09 20 2a 20 72 65 63 6f |ndard"..|. * reco|
|000046c0| 72 64 20 61 74 74 72 69 | 62 75 74 65 73 2e 20 20 |rd attri|butes. |
|000046d0| 63 72 65 61 74 65 28 2e | 2e 2e 29 20 63 72 65 61 |create(.|..) crea|
|000046e0| 74 65 73 20 74 68 65 20 | 66 69 6c 65 0a 09 09 20 |tes the |file... |
|000046f0| 2a 20 75 73 69 6e 67 20 | 74 68 65 20 63 61 6c 6c |* using |the call|
|00004700| 65 72 27 73 20 64 65 66 | 61 75 6c 74 20 70 72 6f |er's def|ault pro|
|00004710| 74 65 63 74 69 6f 6e 20 | 6d 61 73 6b 20 61 6e 64 |tection |mask and|
|00004720| 0a 09 09 20 2a 20 22 76 | 61 72 69 61 62 6c 65 20 |... * "v|ariable |
|00004730| 6c 65 6e 67 74 68 2c 20 | 69 6d 70 6c 69 65 64 20 |length, |implied |
|00004740| 63 61 72 72 69 61 67 65 | 20 72 65 74 75 72 6e 22 |carriage| return"|
|00004750| 0a 09 09 20 2a 20 61 74 | 74 72 69 62 75 74 65 73 |... * at|tributes|
|00004760| 2e 20 64 75 70 32 28 29 | 20 61 73 73 6f 63 69 61 |. dup2()| associa|
|00004770| 74 65 73 20 74 68 65 20 | 66 69 6c 65 20 77 69 74 |tes the |file wit|
|00004780| 68 20 73 74 64 6f 75 74 | 2e 0a 09 09 20 2a 2f 0a |h stdout|.... */.|
|00004790| 09 09 69 66 20 28 28 66 | 69 6c 65 20 3d 20 63 72 |..if ((f|ile = cr|
|000047a0| 65 61 74 28 61 70 2c 20 | 30 2c 20 22 72 61 74 3d |eat(ap, |0, "rat=|
|000047b0| 63 72 22 2c 20 22 72 66 | 6d 3d 76 61 72 22 29 29 |cr", "rf|m=var"))|
|000047c0| 20 3d 3d 20 2d 31 0a 09 | 09 20 7c 7c 20 64 75 70 | == -1..|. || dup|
|000047d0| 32 28 66 69 6c 65 2c 20 | 66 69 6c 65 6e 6f 28 73 |2(file, |fileno(s|
|000047e0| 74 64 6f 75 74 29 29 20 | 3d 3d 20 2d 31 29 20 7b |tdout)) |== -1) {|
|000047f0| 0a 09 09 20 20 20 20 70 | 65 72 72 6f 72 28 61 70 |... p|error(ap|
|00004800| 29 3b 09 09 2f 2a 20 43 | 61 6e 27 74 20 63 72 65 |);../* C|an't cre|
|00004810| 61 74 65 20 66 69 6c 65 | 09 2a 2f 0a 09 09 20 20 |ate file|.*/... |
|00004820| 20 20 65 78 69 74 28 49 | 4f 5f 45 52 52 4f 52 29 | exit(I|O_ERROR)|
|00004830| 3b 09 2f 2a 20 69 73 20 | 61 20 66 61 74 61 6c 20 |;./* is |a fatal |
|00004840| 65 72 72 6f 72 09 2a 2f | 0a 09 09 7d 09 09 09 2f |error.*/|...}.../|
|00004850| 2a 20 49 66 20 27 3e 27 | 20 63 72 65 61 74 69 6f |* If '>'| creatio|
|00004860| 6e 09 2a 2f 0a 09 09 62 | 72 65 61 6b 3b 09 09 09 |n.*/...b|reak;...|
|00004870| 2f 2a 20 45 78 69 74 20 | 63 61 73 65 20 74 65 73 |/* Exit |case tes|
|00004880| 74 09 2a 2f 0a 0a 09 20 | 20 20 20 64 65 66 61 75 |t.*/... | defau|
|00004890| 6c 74 3a 0a 09 09 61 72 | 67 76 5b 6a 2b 2b 5d 20 |lt:...ar|gv[j++] |
|000048a0| 3d 20 61 70 3b 09 09 2f | 2a 20 4e 6f 74 20 61 20 |= ap;../|* Not a |
|000048b0| 72 65 64 69 72 65 63 74 | 6f 72 09 2a 2f 0a 09 09 |redirect|or.*/...|
|000048c0| 62 72 65 61 6b 3b 09 09 | 09 2f 2a 20 45 78 69 74 |break;..|./* Exit|
|000048d0| 20 63 61 73 65 20 74 65 | 73 74 09 2a 2f 0a 09 20 | case te|st.*/.. |
|000048e0| 20 20 20 7d 0a 09 7d 09 | 09 09 09 2f 2a 20 46 6f | }..}.|.../* Fo|
|000048f0| 72 20 61 6c 6c 20 61 72 | 67 75 6d 65 6e 74 73 09 |r all ar|guments.|
|00004900| 2a 2f 0a 09 72 65 74 75 | 72 6e 20 28 6a 29 3b 0a |*/..retu|rn (j);.|
|00004910| 7d 0a 23 65 6e 64 69 66 | 0a 0a 53 48 41 52 5f 45 |}.#endif|..SHAR_E|
|00004920| 4f 46 0a 69 66 20 74 65 | 73 74 20 37 38 33 37 20 |OF.if te|st 7837 |
|00004930| 2d 6e 65 20 22 60 77 63 | 20 2d 63 20 3c 20 27 61 |-ne "`wc| -c < 'a|
|00004940| 72 63 68 78 2e 63 27 60 | 22 0a 74 68 65 6e 0a 09 |rchx.c'`|".then..|
|00004950| 65 63 68 6f 20 73 68 61 | 72 3a 20 65 72 72 6f 72 |echo sha|r: error|
|00004960| 20 74 72 61 6e 73 6d 69 | 74 74 69 6e 67 20 22 27 | transmi|tting "'|
|00004970| 61 72 63 68 78 2e 63 27 | 22 20 27 28 73 68 6f 75 |archx.c'|" '(shou|
|00004980| 6c 64 20 68 61 76 65 20 | 62 65 65 6e 20 37 38 33 |ld have |been 783|
|00004990| 37 20 63 68 61 72 61 63 | 74 65 72 73 29 27 0a 66 |7 charac|ters)'.f|
|000049a0| 69 0a 66 69 0a 65 78 69 | 74 20 30 0a 23 09 45 6e |i.fi.exi|t 0.#.En|
|000049b0| 64 20 6f 66 20 73 68 65 | 6c 6c 20 61 72 63 68 69 |d of she|ll archi|
|000049c0| 76 65 0a | |ve. | |
+--------+-------------------------+-------------------------+--------+--------+