home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: SHell self-extracting ARchive
(archive/shar).
You can browse this item here: 2048
Confidence | Program | Detection | Match Type | Support
|
---|
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 62 6f | 74 68 6e 65 72 40 73 65 |From: bo|thner@se|
|00000010| 76 65 6e 6c 61 79 65 72 | 2e 63 73 2e 77 69 73 63 |venlayer|.cs.wisc|
|00000020| 2e 65 64 75 20 28 50 65 | 72 20 42 6f 74 68 6e 65 |.edu (Pe|r Bothne|
|00000030| 72 29 0a 4e 65 77 73 67 | 72 6f 75 70 73 3a 20 61 |r).Newsg|roups: a|
|00000040| 6c 74 2e 73 6f 75 72 63 | 65 73 0a 53 75 62 6a 65 |lt.sourc|es.Subje|
|00000050| 63 74 3a 20 41 6e 6f 74 | 68 65 72 20 64 69 72 65 |ct: Anot|her dire|
|00000060| 63 74 6f 72 79 20 74 72 | 65 65 20 73 68 61 64 6f |ctory tr|ee shado|
|00000070| 77 65 72 0a 4d 65 73 73 | 61 67 65 2d 49 44 3a 20 |wer.Mess|age-ID: |
|00000080| 3c 31 31 37 30 37 40 73 | 70 6f 6f 6c 2e 63 73 2e |<11707@s|pool.cs.|
|00000090| 77 69 73 63 2e 65 64 75 | 3e 0a 44 61 74 65 3a 20 |wisc.edu|>.Date: |
|000000a0| 31 32 20 4e 6f 76 20 39 | 30 20 32 32 3a 31 37 3a |12 Nov 9|0 22:17:|
|000000b0| 30 31 20 47 4d 54 0a 0a | 54 68 65 20 6d 6b 73 68 |01 GMT..|The mksh|
|000000c0| 61 64 6f 77 20 70 72 6f | 67 72 61 6d 73 20 6d 61 |adow pro|grams ma|
|000000d0| 6b 65 73 20 61 20 22 73 | 68 61 64 6f 77 20 74 72 |kes a "s|hadow tr|
|000000e0| 65 65 22 20 6f 66 20 61 | 20 64 69 72 65 63 74 6f |ee" of a| directo|
|000000f0| 72 79 20 74 72 65 65 2e | 0a 49 74 20 6c 6f 67 69 |ry tree.|.It logi|
|00000100| 63 61 6c 6c 79 20 63 6f | 70 69 65 73 20 61 6c 6c |cally co|pies all|
|00000110| 20 6f 66 20 74 68 65 20 | 22 4d 41 53 54 45 52 22 | of the |"MASTER"|
|00000120| 20 64 69 72 65 63 74 6f | 72 79 20 69 6e 74 6f 20 | directo|ry into |
|00000130| 22 2e 22 2e 0a 48 6f 77 | 65 76 65 72 2c 20 6f 72 |"."..How|ever, or|
|00000140| 64 69 6e 61 72 79 20 66 | 69 6c 65 73 2c 20 61 6e |dinary f|iles, an|
|00000150| 64 20 52 43 53 20 64 69 | 72 65 63 74 6f 72 69 65 |d RCS di|rectorie|
|00000160| 73 20 61 72 65 20 22 63 | 6f 70 69 65 64 22 0a 62 |s are "c|opied".b|
|00000170| 79 20 63 72 65 61 74 69 | 6e 67 20 61 20 73 79 62 |y creati|ng a syb|
|00000180| 6f 6c 69 63 20 6c 69 6e | 6b 20 74 6f 20 74 68 65 |olic lin|k to the|
|00000190| 20 63 6f 72 72 65 73 70 | 6f 6e 64 69 6e 67 20 66 | corresp|onding f|
|000001a0| 69 6c 65 20 69 6e 20 4d | 41 53 54 45 52 2e 0a 0a |ile in M|ASTER...|
|000001b0| 49 20 73 61 77 20 74 68 | 65 20 70 6f 73 74 69 6e |I saw th|e postin|
|000001c0| 67 20 66 6f 72 20 22 6c | 6b 74 72 65 65 22 20 72 |g for "l|ktree" r|
|000001d0| 69 67 68 74 20 61 66 74 | 65 72 20 49 27 76 65 20 |ight aft|er I've |
|000001e0| 73 70 65 6e 74 20 61 0a | 64 61 79 20 77 6f 72 6b |spent a.|day work|
|000001f0| 69 6e 67 20 6f 6e 20 74 | 68 65 20 66 6f 6c 6c 6f |ing on t|he follo|
|00000200| 77 69 6e 67 20 70 72 6f | 67 72 61 6d 2e 20 42 75 |wing pro|gram. Bu|
|00000210| 74 20 77 65 6e 74 20 61 | 68 65 61 64 0a 77 6f 72 |t went a|head.wor|
|00000220| 6b 69 6e 67 20 6f 6e 20 | 6d 6b 73 68 61 64 6f 77 |king on |mkshadow|
|00000230| 2c 20 77 68 69 63 68 20 | 68 61 73 20 6f 6e 65 20 |, which |has one |
|00000240| 6d 61 6a 6f 72 20 77 69 | 6e 20 6f 76 65 72 20 6c |major wi|n over l|
|00000250| 6b 74 72 65 65 3a 0a 49 | 74 20 64 6f 65 73 20 61 |ktree:.I|t does a|
|00000260| 6c 6c 20 74 68 65 20 73 | 79 73 74 65 6d 20 63 61 |ll the s|ystem ca|
|00000270| 6c 6c 73 20 69 74 73 65 | 6c 66 2c 20 77 68 65 72 |lls itse|lf, wher|
|00000280| 65 61 73 20 6c 6b 74 72 | 65 65 20 65 6d 69 74 73 |eas lktr|ee emits|
|00000290| 0a 73 68 65 6c 6c 20 63 | 6f 6d 6d 61 6e 64 73 20 |.shell c|ommands |
|000002a0| 74 6f 20 61 20 74 65 6d | 70 6f 72 61 72 79 20 66 |to a tem|porary f|
|000002b0| 69 6c 65 2c 20 77 68 69 | 63 68 20 69 74 20 74 68 |ile, whi|ch it th|
|000002c0| 65 6e 20 72 75 6e 73 20 | 77 69 74 68 20 73 68 2e |en runs |with sh.|
|000002d0| 0a 54 68 69 73 20 6d 61 | 6b 65 73 20 6d 6b 73 68 |.This ma|kes mksh|
|000002e0| 61 64 6f 77 20 76 65 72 | 79 20 66 61 73 74 2c 20 |adow ver|y fast, |
|000002f0| 61 6e 64 20 49 20 73 75 | 73 70 65 63 74 20 6d 6f |and I su|spect mo|
|00000300| 72 65 20 72 6f 62 75 73 | 74 0a 28 65 72 72 6f 72 |re robus|t.(error|
|00000310| 73 20 61 72 65 20 72 65 | 70 6f 72 74 65 64 20 62 |s are re|ported b|
|00000320| 79 20 6d 6b 73 68 61 64 | 6f 77 2c 20 6e 6f 74 20 |y mkshad|ow, not |
|00000330| 74 68 65 20 73 68 65 6c | 6c 29 2e 0a 0a 42 75 67 |the shel|l)...Bug|
|00000340| 73 2c 20 63 6f 6d 6d 65 | 6e 74 73 2c 20 73 75 67 |s, comme|nts, sug|
|00000350| 67 65 73 74 69 6f 6e 73 | 20 74 6f 20 6d 65 2e 0a |gestions| to me..|
|00000360| 0a 09 2d 2d 50 65 72 20 | 42 6f 74 68 6e 65 72 0a |..--Per |Bothner.|
|00000370| 62 6f 74 68 6e 65 72 40 | 63 73 2e 77 69 73 63 2e |bothner@|cs.wisc.|
|00000380| 65 64 75 20 43 6f 6d 70 | 75 74 65 72 20 53 63 69 |edu Comp|uter Sci|
|00000390| 65 6e 63 65 73 20 44 65 | 70 74 2c 20 55 2e 20 6f |ences De|pt, U. o|
|000003a0| 66 20 57 69 73 63 6f 6e | 73 69 6e 2d 4d 61 64 69 |f Wiscon|sin-Madi|
|000003b0| 73 6f 6e 0a 0a 23 21 2f | 62 69 6e 2f 73 68 0a 23 |son..#!/|bin/sh.#|
|000003c0| 20 54 68 69 73 20 69 73 | 20 61 20 73 68 65 6c 6c | This is| a shell|
|000003d0| 20 61 72 63 68 69 76 65 | 2c 20 6d 65 61 6e 69 6e | archive|, meanin|
|000003e0| 67 3a 0a 23 20 31 2e 20 | 52 65 6d 6f 76 65 20 65 |g:.# 1. |Remove e|
|000003f0| 76 65 72 79 74 68 69 6e | 67 20 61 62 6f 76 65 20 |verythin|g above |
|00000400| 74 68 65 20 23 21 2f 62 | 69 6e 2f 73 68 20 6c 69 |the #!/b|in/sh li|
|00000410| 6e 65 2e 0a 23 20 32 2e | 20 53 61 76 65 20 74 68 |ne..# 2.| Save th|
|00000420| 65 20 72 65 73 75 6c 74 | 69 6e 67 20 74 65 78 74 |e result|ing text|
|00000430| 20 69 6e 20 61 20 66 69 | 6c 65 2e 0a 23 20 33 2e | in a fi|le..# 3.|
|00000440| 20 45 78 65 63 75 74 65 | 20 74 68 65 20 66 69 6c | Execute| the fil|
|00000450| 65 20 77 69 74 68 20 2f | 62 69 6e 2f 73 68 20 28 |e with /|bin/sh (|
|00000460| 6e 6f 74 20 63 73 68 29 | 20 74 6f 20 63 72 65 61 |not csh)| to crea|
|00000470| 74 65 20 74 68 65 20 66 | 69 6c 65 73 3a 0a 23 09 |te the f|iles:.#.|
|00000480| 52 45 41 44 4d 45 0a 23 | 09 4d 61 6b 65 66 69 6c |README.#|.Makefil|
|00000490| 65 0a 23 09 6d 6b 73 68 | 61 64 6f 77 2e 63 0a 23 |e.#.mksh|adow.c.#|
|000004a0| 09 73 61 76 65 64 69 72 | 2e 63 0a 23 09 77 69 6c |.savedir|.c.#.wil|
|000004b0| 64 6d 61 74 2e 63 0a 23 | 09 43 4f 50 59 49 4e 47 |dmat.c.#|.COPYING|
|000004c0| 0a 23 20 54 68 69 73 20 | 61 72 63 68 69 76 65 20 |.# This |archive |
|000004d0| 63 72 65 61 74 65 64 3a | 20 4d 6f 6e 20 4e 6f 76 |created:| Mon Nov|
|000004e0| 20 31 32 20 31 35 3a 35 | 30 3a 32 32 20 31 39 39 | 12 15:5|0:22 199|
|000004f0| 30 0a 65 78 70 6f 72 74 | 20 50 41 54 48 3b 20 50 |0.export| PATH; P|
|00000500| 41 54 48 3d 2f 62 69 6e | 3a 24 50 41 54 48 0a 69 |ATH=/bin|:$PATH.i|
|00000510| 66 20 74 65 73 74 20 2d | 66 20 27 52 45 41 44 4d |f test -|f 'READM|
|00000520| 45 27 0a 74 68 65 6e 0a | 09 65 63 68 6f 20 73 68 |E'.then.|.echo sh|
|00000530| 61 72 3a 20 6f 76 65 72 | 2d 77 72 69 74 69 6e 67 |ar: over|-writing|
|00000540| 20 65 78 69 73 74 69 6e | 67 20 66 69 6c 65 20 22 | existin|g file "|
|00000550| 27 52 45 41 44 4d 45 27 | 22 0a 66 69 0a 63 61 74 |'README'|".fi.cat|
|00000560| 20 3c 3c 20 5c 53 48 41 | 52 5f 45 4f 46 20 3e 20 | << \SHA|R_EOF > |
|00000570| 27 52 45 41 44 4d 45 27 | 0a 54 68 65 20 6d 6b 73 |'README'|.The mks|
|00000580| 68 61 64 6f 77 20 70 72 | 6f 67 72 61 6d 73 20 6d |hadow pr|ograms m|
|00000590| 61 6b 65 73 20 61 20 22 | 73 68 61 64 6f 77 20 74 |akes a "|shadow t|
|000005a0| 72 65 65 22 20 6f 66 20 | 61 20 64 69 72 65 63 74 |ree" of |a direct|
|000005b0| 6f 72 79 20 74 72 65 65 | 2e 0a 49 74 20 6c 6f 67 |ory tree|..It log|
|000005c0| 69 63 61 6c 6c 79 20 63 | 6f 70 69 65 73 20 61 6c |ically c|opies al|
|000005d0| 6c 20 6f 66 20 74 68 65 | 20 22 4d 41 53 54 45 52 |l of the| "MASTER|
|000005e0| 22 20 64 69 72 65 63 74 | 6f 72 79 20 69 6e 74 6f |" direct|ory into|
|000005f0| 20 22 2e 22 2e 0a 48 6f | 77 65 76 65 72 2c 20 6f | "."..Ho|wever, o|
|00000600| 72 64 69 6e 61 72 79 20 | 66 69 6c 65 73 2c 20 61 |rdinary |files, a|
|00000610| 6e 64 20 52 43 53 20 64 | 69 72 65 63 74 6f 72 69 |nd RCS d|irectori|
|00000620| 65 73 20 61 72 65 20 22 | 63 6f 70 69 65 64 22 0a |es are "|copied".|
|00000630| 62 79 20 63 72 65 61 74 | 69 6e 67 20 61 20 73 79 |by creat|ing a sy|
|00000640| 62 6f 6c 69 63 20 6c 69 | 6e 6b 20 74 6f 20 74 68 |bolic li|nk to th|
|00000650| 65 20 63 6f 72 72 65 73 | 70 6f 6e 64 69 6e 67 20 |e corres|ponding |
|00000660| 66 69 6c 65 20 69 6e 20 | 4d 41 53 54 45 52 2e 0a |file in |MASTER..|
|00000670| 0a 54 68 65 20 77 69 6c | 64 6d 61 74 2e 63 20 66 |.The wil|dmat.c f|
|00000680| 69 6c 65 20 69 73 20 66 | 72 6f 6d 20 47 4e 55 20 |ile is f|rom GNU |
|00000690| 74 61 72 2d 31 2e 30 39 | 2e 0a 54 68 65 20 73 61 |tar-1.09|..The sa|
|000006a0| 76 65 64 69 72 2e 63 20 | 66 69 6c 65 20 69 73 20 |vedir.c |file is |
|000006b0| 66 72 6f 6d 20 47 4e 55 | 20 66 69 6e 64 2e 0a 48 |from GNU| find..H|
|000006c0| 65 6e 63 65 2c 20 74 68 | 65 20 47 4e 55 20 6c 69 |ence, th|e GNU li|
|000006d0| 63 65 6e 73 65 20 61 70 | 70 6c 69 65 73 2e 0a 0a |cense ap|plies...|
|000006e0| 20 2a 20 55 73 61 67 65 | 3a 20 6d 6b 73 68 61 64 | * Usage|: mkshad|
|000006f0| 6f 77 20 5b 2d 58 20 65 | 78 63 6c 75 64 65 5f 66 |ow [-X e|xclude_f|
|00000700| 69 6c 65 5d 20 5b 2d 78 | 20 65 78 63 6c 75 64 65 |ile] [-x| exclude|
|00000710| 5f 70 61 74 74 65 72 6e | 5d 20 2e 2e 2e 20 4d 41 |_pattern|] ... MA|
|00000720| 53 54 45 52 0a 20 2a 20 | 4d 61 6b 65 73 20 74 68 |STER. * |Makes th|
|00000730| 65 20 63 75 72 72 65 6e | 74 20 64 69 72 65 63 74 |e curren|t direct|
|00000740| 6f 72 79 20 62 65 20 61 | 20 22 73 68 61 64 6f 77 |ory be a| "shadow|
|00000750| 20 63 6f 70 79 22 20 6f | 66 20 4d 41 53 54 45 52 | copy" o|f MASTER|
|00000760| 2e 0a 20 2a 20 53 6f 72 | 74 20 6f 66 20 6c 69 6b |.. * Sor|t of lik|
|00000770| 65 20 61 20 72 65 63 75 | 72 73 69 76 65 20 63 6f |e a recu|rsive co|
|00000780| 70 79 20 6f 66 20 4d 41 | 53 54 45 52 20 74 6f 20 |py of MA|STER to |
|00000790| 2e 0a 20 2a 20 48 6f 77 | 65 76 65 72 2c 20 73 79 |.. * How|ever, sy|
|000007a0| 6d 62 6f 6c 69 63 20 6c | 69 6e 6b 73 20 61 72 65 |mbolic l|inks are|
|000007b0| 20 75 73 65 64 20 69 6e | 73 74 65 61 64 20 6f 66 | used in|stead of|
|000007c0| 20 61 63 74 75 61 6c 6c | 79 0a 20 2a 20 63 6f 70 | actuall|y. * cop|
|000007d0| 79 69 6e 67 20 28 6e 6f | 6e 2d 64 69 72 65 63 74 |ying (no|n-direct|
|000007e0| 6f 72 79 29 20 66 69 6c | 65 73 2e 0a 20 2a 20 41 |ory) fil|es.. * A|
|000007f0| 6c 73 6f 2c 20 64 69 72 | 65 63 74 6f 72 69 65 73 |lso, dir|ectories|
|00000800| 20 6e 61 6d 65 64 20 52 | 43 53 20 61 72 65 20 73 | named R|CS are s|
|00000810| 68 61 72 65 64 20 28 77 | 69 74 68 20 61 20 73 79 |hared (w|ith a sy|
|00000820| 6d 62 6f 6c 69 63 20 6c | 69 6e 6b 29 2e 0a 20 2a |mbolic l|ink).. *|
|00000830| 20 57 61 72 6e 69 6e 67 | 20 6d 65 73 73 61 67 65 | Warning| message|
|00000840| 73 20 61 72 65 20 70 72 | 69 6e 74 65 64 20 66 6f |s are pr|inted fo|
|00000850| 72 20 66 69 6c 65 73 20 | 28 61 6e 64 20 64 69 72 |r files |(and dir|
|00000860| 65 63 74 6f 72 69 65 73 | 29 20 69 6e 20 2e 0a 20 |ectories|) in .. |
|00000870| 2a 20 74 68 61 74 20 64 | 6f 6e 27 74 20 6d 61 74 |* that d|on't mat|
|00000880| 63 68 20 61 20 63 6f 72 | 72 65 73 70 6f 6e 64 69 |ch a cor|respondi|
|00000890| 6e 67 20 66 69 6c 65 20 | 69 6e 20 4d 41 53 54 45 |ng file |in MASTE|
|000008a0| 52 20 28 74 68 6f 75 67 | 68 0a 20 2a 20 73 79 6d |R (thoug|h. * sym|
|000008b0| 62 6f 6c 69 63 20 6c 69 | 6e 6b 73 20 61 72 65 20 |bolic li|nks are |
|000008c0| 73 69 6c 65 6e 74 6c 79 | 20 72 65 6d 6f 76 65 64 |silently| removed|
|000008d0| 29 2e 0a 20 2a 20 41 6c | 73 6f 2c 20 61 20 77 61 |).. * Al|so, a wa|
|000008e0| 72 6e 69 6e 67 20 6d 65 | 73 73 61 67 65 20 69 73 |rning me|ssage is|
|000008f0| 20 70 72 69 6e 74 65 64 | 20 66 6f 72 20 6e 6f 6e | printed| for non|
|00000900| 2d 64 69 72 65 63 74 6f | 72 79 20 66 69 6c 65 73 |-directo|ry files|
|00000910| 0a 20 2a 20 75 6e 64 65 | 72 20 2e 20 74 68 61 74 |. * unde|r . that|
|00000920| 20 61 72 65 20 20 6e 6f | 74 20 73 79 6d 62 6f 6c | are no|t symbol|
|00000930| 69 63 20 6c 69 6e 6b 73 | 2e 0a 20 2a 0a 20 2a 20 |ic links|.. *. * |
|00000940| 46 69 6c 65 73 20 61 6e | 64 20 64 69 72 65 63 74 |Files an|d direct|
|00000950| 6f 72 69 65 73 20 63 61 | 6e 20 62 65 20 65 78 63 |ories ca|n be exc|
|00000960| 6c 75 64 65 64 20 66 72 | 6f 6d 20 74 68 65 20 73 |luded fr|om the s|
|00000970| 68 61 72 69 6e 67 0a 20 | 2a 20 77 69 74 68 20 74 |haring. |* with t|
|00000980| 68 65 20 2d 58 20 61 6e | 64 20 2d 78 20 66 6c 61 |he -X an|d -x fla|
|00000990| 67 73 2e 20 54 68 65 20 | 66 6c 61 67 20 60 2d 78 |gs. The |flag `-x|
|000009a0| 20 70 61 74 74 65 72 6e | 27 20 28 6f 72 20 60 2d | pattern|' (or `-|
|000009b0| 78 70 61 74 74 65 72 6e | 27 29 0a 20 2a 20 6d 65 |xpattern|'). * me|
|000009c0| 61 6e 73 20 74 68 61 74 | 20 6d 6b 73 68 61 64 6f |ans that| mkshado|
|000009d0| 77 20 73 68 6f 75 6c 64 | 20 69 67 6e 6f 72 65 20 |w should| ignore |
|000009e0| 61 6e 79 20 66 69 6c 65 | 20 77 68 6f 73 65 20 6e |any file| whose n|
|000009f0| 61 6d 65 20 6d 61 74 63 | 68 65 73 0a 20 2a 20 74 |ame matc|hes. * t|
|00000a00| 68 65 20 70 61 74 74 65 | 72 6e 2e 20 54 68 65 20 |he patte|rn. The |
|00000a10| 70 61 74 74 65 72 6e 20 | 69 73 20 61 20 22 67 6c |pattern |is a "gl|
|00000a20| 6f 62 62 69 6e 67 22 20 | 70 61 74 74 65 72 6e 2c |obbing" |pattern,|
|00000a30| 20 69 2e 65 2e 20 74 68 | 65 0a 20 2a 20 63 68 61 | i.e. th|e. * cha|
|00000a40| 72 61 63 74 65 72 73 20 | 2a 3f 5b 5e 2d 5d 20 61 |racters |*?[^-] a|
|00000a50| 72 65 20 69 6e 74 65 72 | 70 72 65 74 65 64 20 61 |re inter|preted a|
|00000a60| 73 20 62 79 20 74 68 65 | 20 73 68 65 6c 6c 2e 0a |s by the| shell..|
|00000a70| 20 2a 20 49 66 20 74 68 | 65 20 70 61 74 74 65 72 | * If th|e patter|
|00000a80| 6e 20 63 6f 6e 74 61 69 | 6e 73 20 61 20 27 2f 27 |n contai|ns a '/'|
|00000a90| 20 69 73 20 69 73 20 6d | 61 74 63 68 65 64 20 61 | is is m|atched a|
|00000aa0| 67 61 69 6e 73 74 20 74 | 68 65 20 63 6f 6d 70 6c |gainst t|he compl|
|00000ab0| 65 74 65 0a 20 2a 20 63 | 75 72 72 65 6e 74 20 70 |ete. * c|urrent p|
|00000ac0| 61 74 68 20 28 72 65 6c | 61 74 69 76 65 20 74 6f |ath (rel|ative to|
|00000ad0| 20 27 2e 27 29 3b 20 6f | 74 68 65 72 77 69 73 65 | '.'); o|therwise|
|00000ae0| 2c 20 69 74 20 69 73 20 | 6d 61 74 63 68 65 64 0a |, it is |matched.|
|00000af0| 20 2a 20 61 67 61 69 6e | 73 74 20 74 68 65 20 6c | * again|st the l|
|00000b00| 61 73 74 20 63 6f 6d 70 | 6f 6e 65 6e 74 20 6f 66 |ast comp|onent of|
|00000b10| 20 74 68 65 20 70 61 74 | 68 2e 0a 20 2a 20 41 20 | the pat|h.. * A |
|00000b20| 60 2d 58 20 66 69 6c 65 | 6e 61 6d 65 27 20 66 6c |`-X file|name' fl|
|00000b30| 61 67 20 6d 65 61 6e 73 | 20 74 6f 20 72 65 61 64 |ag means| to read|
|00000b40| 20 61 20 73 65 74 20 6f | 66 20 65 78 63 6c 75 73 | a set o|f exclus|
|00000b50| 69 6f 6e 20 70 61 74 74 | 65 72 6e 73 0a 20 2a 20 |ion patt|erns. * |
|00000b60| 66 72 6f 6d 20 74 68 65 | 20 6e 61 6d 65 64 20 66 |from the| named f|
|00000b70| 69 6c 65 2c 20 6f 6e 65 | 20 70 61 74 74 65 72 6e |ile, one| pattern|
|00000b80| 20 74 6f 20 61 20 6c 69 | 6e 65 2e 0a 20 2a 0a 20 | to a li|ne.. *. |
|00000b90| 2a 20 41 75 74 68 6f 72 | 3a 20 50 65 72 20 42 6f |* Author|: Per Bo|
|00000ba0| 74 68 6e 65 72 2e 20 62 | 6f 74 68 6e 65 72 40 63 |thner. b|othner@c|
|00000bb0| 73 2e 77 69 73 63 2e 65 | 64 75 2e 20 4e 6f 76 65 |s.wisc.e|du. Nove|
|00000bc0| 6d 62 65 72 20 31 39 39 | 30 2e 0a 53 48 41 52 5f |mber 199|0..SHAR_|
|00000bd0| 45 4f 46 0a 69 66 20 74 | 65 73 74 20 2d 66 20 27 |EOF.if t|est -f '|
|00000be0| 4d 61 6b 65 66 69 6c 65 | 27 0a 74 68 65 6e 0a 09 |Makefile|'.then..|
|00000bf0| 65 63 68 6f 20 73 68 61 | 72 3a 20 6f 76 65 72 2d |echo sha|r: over-|
|00000c00| 77 72 69 74 69 6e 67 20 | 65 78 69 73 74 69 6e 67 |writing |existing|
|00000c10| 20 66 69 6c 65 20 22 27 | 4d 61 6b 65 66 69 6c 65 | file "'|Makefile|
|00000c20| 27 22 0a 66 69 0a 63 61 | 74 20 3c 3c 20 5c 53 48 |'".fi.ca|t << \SH|
|00000c30| 41 52 5f 45 4f 46 20 3e | 20 27 4d 61 6b 65 66 69 |AR_EOF >| 'Makefi|
|00000c40| 6c 65 27 0a 6d 6b 73 68 | 61 64 6f 77 3a 20 6d 6b |le'.mksh|adow: mk|
|00000c50| 73 68 61 64 6f 77 2e 6f | 20 73 61 76 65 64 69 72 |shadow.o| savedir|
|00000c60| 2e 6f 20 77 69 6c 64 6d | 61 74 2e 6f 0a 09 24 28 |.o wildm|at.o..$(|
|00000c70| 43 43 29 20 2d 6f 20 6d | 6b 73 68 61 64 6f 77 20 |CC) -o m|kshadow |
|00000c80| 6d 6b 73 68 61 64 6f 77 | 2e 6f 20 73 61 76 65 64 |mkshadow|.o saved|
|00000c90| 69 72 2e 6f 20 77 69 6c | 64 6d 61 74 2e 6f 0a 53 |ir.o wil|dmat.o.S|
|00000ca0| 48 41 52 5f 45 4f 46 0a | 69 66 20 74 65 73 74 20 |HAR_EOF.|if test |
|00000cb0| 2d 66 20 27 6d 6b 73 68 | 61 64 6f 77 2e 63 27 0a |-f 'mksh|adow.c'.|
|00000cc0| 74 68 65 6e 0a 09 65 63 | 68 6f 20 73 68 61 72 3a |then..ec|ho shar:|
|00000cd0| 20 6f 76 65 72 2d 77 72 | 69 74 69 6e 67 20 65 78 | over-wr|iting ex|
|00000ce0| 69 73 74 69 6e 67 20 66 | 69 6c 65 20 22 27 6d 6b |isting f|ile "'mk|
|00000cf0| 73 68 61 64 6f 77 2e 63 | 27 22 0a 66 69 0a 63 61 |shadow.c|'".fi.ca|
|00000d00| 74 20 3c 3c 20 5c 53 48 | 41 52 5f 45 4f 46 20 3e |t << \SH|AR_EOF >|
|00000d10| 20 27 6d 6b 73 68 61 64 | 6f 77 2e 63 27 0a 2f 2a | 'mkshad|ow.c'./*|
|00000d20| 0a 20 2a 20 55 73 61 67 | 65 3a 20 6d 6b 73 68 61 |. * Usag|e: mksha|
|00000d30| 64 6f 77 20 5b 2d 58 20 | 65 78 63 6c 75 64 65 5f |dow [-X |exclude_|
|00000d40| 66 69 6c 65 5d 20 5b 2d | 78 20 65 78 63 6c 75 64 |file] [-|x exclud|
|00000d50| 65 5f 70 61 74 74 65 72 | 6e 5d 20 2e 2e 2e 20 4d |e_patter|n] ... M|
|00000d60| 41 53 54 45 52 0a 20 2a | 20 4d 61 6b 65 73 20 74 |ASTER. *| Makes t|
|00000d70| 68 65 20 63 75 72 72 65 | 6e 74 20 64 69 72 65 63 |he curre|nt direc|
|00000d80| 74 6f 72 79 20 62 65 20 | 61 20 22 73 68 61 64 6f |tory be |a "shado|
|00000d90| 77 20 63 6f 70 79 22 20 | 6f 66 20 4d 41 53 54 45 |w copy" |of MASTE|
|00000da0| 52 2e 0a 20 2a 20 53 6f | 72 74 20 6f 66 20 6c 69 |R.. * So|rt of li|
|00000db0| 6b 65 20 61 20 72 65 63 | 75 72 73 69 76 65 20 63 |ke a rec|ursive c|
|00000dc0| 6f 70 79 20 6f 66 20 4d | 41 53 54 45 52 20 74 6f |opy of M|ASTER to|
|00000dd0| 20 2e 0a 20 2a 20 48 6f | 77 65 76 65 72 2c 20 73 | .. * Ho|wever, s|
|00000de0| 79 6d 62 6f 6c 69 63 20 | 6c 69 6e 6b 73 20 61 72 |ymbolic |links ar|
|00000df0| 65 20 75 73 65 64 20 69 | 6e 73 74 65 61 64 20 6f |e used i|nstead o|
|00000e00| 66 20 61 63 74 75 61 6c | 6c 79 0a 20 2a 20 63 6f |f actual|ly. * co|
|00000e10| 70 79 69 6e 67 20 28 6e | 6f 6e 2d 64 69 72 65 63 |pying (n|on-direc|
|00000e20| 74 6f 72 79 29 20 66 69 | 6c 65 73 2e 0a 20 2a 20 |tory) fi|les.. * |
|00000e30| 41 6c 73 6f 2c 20 64 69 | 72 65 63 74 6f 72 69 65 |Also, di|rectorie|
|00000e40| 73 20 6e 61 6d 65 64 20 | 52 43 53 20 61 72 65 20 |s named |RCS are |
|00000e50| 73 68 61 72 65 64 20 28 | 77 69 74 68 20 61 20 73 |shared (|with a s|
|00000e60| 79 6d 62 6f 6c 69 63 20 | 6c 69 6e 6b 29 2e 0a 20 |ymbolic |link).. |
|00000e70| 2a 20 57 61 72 6e 69 6e | 67 20 6d 65 73 73 61 67 |* Warnin|g messag|
|00000e80| 65 73 20 61 72 65 20 70 | 72 69 6e 74 65 64 20 66 |es are p|rinted f|
|00000e90| 6f 72 20 66 69 6c 65 73 | 20 28 61 6e 64 20 64 69 |or files| (and di|
|00000ea0| 72 65 63 74 6f 72 69 65 | 73 29 20 69 6e 20 2e 0a |rectorie|s) in ..|
|00000eb0| 20 2a 20 74 68 61 74 20 | 64 6f 6e 27 74 20 6d 61 | * that |don't ma|
|00000ec0| 74 63 68 20 61 20 63 6f | 72 72 65 73 70 6f 6e 64 |tch a co|rrespond|
|00000ed0| 69 6e 67 20 66 69 6c 65 | 20 69 6e 20 4d 41 53 54 |ing file| in MAST|
|00000ee0| 45 52 20 28 74 68 6f 75 | 67 68 0a 20 2a 20 73 79 |ER (thou|gh. * sy|
|00000ef0| 6d 62 6f 6c 69 63 20 6c | 69 6e 6b 73 20 61 72 65 |mbolic l|inks are|
|00000f00| 20 73 69 6c 65 6e 74 6c | 79 20 72 65 6d 6f 76 65 | silentl|y remove|
|00000f10| 64 29 2e 0a 20 2a 20 41 | 6c 73 6f 2c 20 61 20 77 |d).. * A|lso, a w|
|00000f20| 61 72 6e 69 6e 67 20 6d | 65 73 73 61 67 65 20 69 |arning m|essage i|
|00000f30| 73 20 70 72 69 6e 74 65 | 64 20 66 6f 72 20 6e 6f |s printe|d for no|
|00000f40| 6e 2d 64 69 72 65 63 74 | 6f 72 79 20 66 69 6c 65 |n-direct|ory file|
|00000f50| 73 0a 20 2a 20 75 6e 64 | 65 72 20 2e 20 74 68 61 |s. * und|er . tha|
|00000f60| 74 20 61 72 65 20 20 6e | 6f 74 20 73 79 6d 62 6f |t are n|ot symbo|
|00000f70| 6c 69 63 20 6c 69 6e 6b | 73 2e 0a 20 2a 0a 20 2a |lic link|s.. *. *|
|00000f80| 20 46 69 6c 65 73 20 61 | 6e 64 20 64 69 72 65 63 | Files a|nd direc|
|00000f90| 74 6f 72 69 65 73 20 63 | 61 6e 20 62 65 20 65 78 |tories c|an be ex|
|00000fa0| 63 6c 75 64 65 64 20 66 | 72 6f 6d 20 74 68 65 20 |cluded f|rom the |
|00000fb0| 73 68 61 72 69 6e 67 0a | 20 2a 20 77 69 74 68 20 |sharing.| * with |
|00000fc0| 74 68 65 20 2d 58 20 61 | 6e 64 20 2d 78 20 66 6c |the -X a|nd -x fl|
|00000fd0| 61 67 73 2e 20 54 68 65 | 20 66 6c 61 67 20 60 2d |ags. The| flag `-|
|00000fe0| 78 20 70 61 74 74 65 72 | 6e 27 20 28 6f 72 20 60 |x patter|n' (or `|
|00000ff0| 2d 78 70 61 74 74 65 72 | 6e 27 29 0a 20 2a 20 6d |-xpatter|n'). * m|
|00001000| 65 61 6e 73 20 74 68 61 | 74 20 6d 6b 73 68 61 64 |eans tha|t mkshad|
|00001010| 6f 77 20 73 68 6f 75 6c | 64 20 69 67 6e 6f 72 65 |ow shoul|d ignore|
|00001020| 20 61 6e 79 20 66 69 6c | 65 20 77 68 6f 73 65 20 | any fil|e whose |
|00001030| 6e 61 6d 65 20 6d 61 74 | 63 68 65 73 0a 20 2a 20 |name mat|ches. * |
|00001040| 74 68 65 20 70 61 74 74 | 65 72 6e 2e 20 54 68 65 |the patt|ern. The|
|00001050| 20 70 61 74 74 65 72 6e | 20 69 73 20 61 20 22 67 | pattern| is a "g|
|00001060| 6c 6f 62 62 69 6e 67 22 | 20 70 61 74 74 65 72 6e |lobbing"| pattern|
|00001070| 2c 20 69 2e 65 2e 20 74 | 68 65 0a 20 2a 20 63 68 |, i.e. t|he. * ch|
|00001080| 61 72 61 63 74 65 72 73 | 20 2a 3f 5b 5e 2d 5d 20 |aracters| *?[^-] |
|00001090| 61 72 65 20 69 6e 74 65 | 72 70 72 65 74 65 64 20 |are inte|rpreted |
|000010a0| 61 73 20 62 79 20 74 68 | 65 20 73 68 65 6c 6c 2e |as by th|e shell.|
|000010b0| 0a 20 2a 20 49 66 20 74 | 68 65 20 70 61 74 74 65 |. * If t|he patte|
|000010c0| 72 6e 20 63 6f 6e 74 61 | 69 6e 73 20 61 20 27 2f |rn conta|ins a '/|
|000010d0| 27 20 69 73 20 69 73 20 | 6d 61 74 63 68 65 64 20 |' is is |matched |
|000010e0| 61 67 61 69 6e 73 74 20 | 74 68 65 20 63 6f 6d 70 |against |the comp|
|000010f0| 6c 65 74 65 0a 20 2a 20 | 63 75 72 72 65 6e 74 20 |lete. * |current |
|00001100| 70 61 74 68 20 28 72 65 | 6c 61 74 69 76 65 20 74 |path (re|lative t|
|00001110| 6f 20 27 2e 27 29 3b 20 | 6f 74 68 65 72 77 69 73 |o '.'); |otherwis|
|00001120| 65 2c 20 69 74 20 69 73 | 20 6d 61 74 63 68 65 64 |e, it is| matched|
|00001130| 0a 20 2a 20 61 67 61 69 | 6e 73 74 20 74 68 65 20 |. * agai|nst the |
|00001140| 6c 61 73 74 20 63 6f 6d | 70 6f 6e 65 6e 74 20 6f |last com|ponent o|
|00001150| 66 20 74 68 65 20 70 61 | 74 68 2e 0a 20 2a 20 41 |f the pa|th.. * A|
|00001160| 20 60 2d 58 20 66 69 6c | 65 6e 61 6d 65 27 20 66 | `-X fil|ename' f|
|00001170| 6c 61 67 20 6d 65 61 6e | 73 20 74 6f 20 72 65 61 |lag mean|s to rea|
|00001180| 64 20 61 20 73 65 74 20 | 6f 66 20 65 78 63 6c 75 |d a set |of exclu|
|00001190| 73 69 6f 6e 20 70 61 74 | 74 65 72 6e 73 0a 20 2a |sion pat|terns. *|
|000011a0| 20 66 72 6f 6d 20 74 68 | 65 20 6e 61 6d 65 64 20 | from th|e named |
|000011b0| 66 69 6c 65 2c 20 6f 6e | 65 20 70 61 74 74 65 72 |file, on|e patter|
|000011c0| 6e 20 74 6f 20 61 20 6c | 69 6e 65 2e 0a 20 2a 0a |n to a l|ine.. *.|
|000011d0| 20 2a 20 41 75 74 68 6f | 72 3a 20 50 65 72 20 42 | * Autho|r: Per B|
|000011e0| 6f 74 68 6e 65 72 2e 20 | 62 6f 74 68 6e 65 72 40 |othner. |bothner@|
|000011f0| 63 73 2e 77 69 73 63 2e | 65 64 75 2e 20 4e 6f 76 |cs.wisc.|edu. Nov|
|00001200| 65 6d 62 65 72 20 31 39 | 39 30 2e 0a 20 2a 2f 0a |ember 19|90.. */.|
|00001210| 0a 2f 2a 20 57 69 6c 64 | 63 61 72 64 20 6d 61 74 |./* Wild|card mat|
|00001220| 63 68 69 6e 67 20 72 6f | 75 74 69 6e 65 73 2e 0a |ching ro|utines..|
|00001230| 20 20 20 43 6f 70 79 72 | 69 67 68 74 20 28 43 29 | Copyr|ight (C)|
|00001240| 20 31 39 39 30 20 50 65 | 72 20 42 6f 74 68 6e 65 | 1990 Pe|r Bothne|
|00001250| 72 2e 0a 0a 54 68 69 73 | 20 66 69 6c 65 20 69 73 |r...This| file is|
|00001260| 20 70 61 72 74 20 6f 66 | 20 6d 6b 73 68 61 64 6f | part of| mkshado|
|00001270| 77 2e 0a 0a 6d 6b 73 68 | 61 64 6f 77 20 69 73 20 |w...mksh|adow is |
|00001280| 66 72 65 65 20 73 6f 66 | 74 77 61 72 65 3b 20 79 |free sof|tware; y|
|00001290| 6f 75 20 63 61 6e 20 72 | 65 64 69 73 74 72 69 62 |ou can r|edistrib|
|000012a0| 75 74 65 20 69 74 20 61 | 6e 64 2f 6f 72 20 6d 6f |ute it a|nd/or mo|
|000012b0| 64 69 66 79 0a 69 74 20 | 75 6e 64 65 72 20 74 68 |dify.it |under th|
|000012c0| 65 20 74 65 72 6d 73 20 | 6f 66 20 74 68 65 20 47 |e terms |of the G|
|000012d0| 4e 55 20 47 65 6e 65 72 | 61 6c 20 50 75 62 6c 69 |NU Gener|al Publi|
|000012e0| 63 20 4c 69 63 65 6e 73 | 65 20 61 73 20 70 75 62 |c Licens|e as pub|
|000012f0| 6c 69 73 68 65 64 20 62 | 79 0a 74 68 65 20 46 72 |lished b|y.the Fr|
|00001300| 65 65 20 53 6f 66 74 77 | 61 72 65 20 46 6f 75 6e |ee Softw|are Foun|
|00001310| 64 61 74 69 6f 6e 3b 20 | 65 69 74 68 65 72 20 76 |dation; |either v|
|00001320| 65 72 73 69 6f 6e 20 31 | 2c 20 6f 72 20 28 61 74 |ersion 1|, or (at|
|00001330| 20 79 6f 75 72 20 6f 70 | 74 69 6f 6e 29 0a 61 6e | your op|tion).an|
|00001340| 79 20 6c 61 74 65 72 20 | 76 65 72 73 69 6f 6e 2e |y later |version.|
|00001350| 0a 0a 47 4e 55 20 54 61 | 72 20 69 73 20 64 69 73 |..GNU Ta|r is dis|
|00001360| 74 72 69 62 75 74 65 64 | 20 69 6e 20 74 68 65 20 |tributed| in the |
|00001370| 68 6f 70 65 20 74 68 61 | 74 20 69 74 20 77 69 6c |hope tha|t it wil|
|00001380| 6c 20 62 65 20 75 73 65 | 66 75 6c 2c 0a 62 75 74 |l be use|ful,.but|
|00001390| 20 57 49 54 48 4f 55 54 | 20 41 4e 59 20 57 41 52 | WITHOUT| ANY WAR|
|000013a0| 52 41 4e 54 59 3b 20 77 | 69 74 68 6f 75 74 20 65 |RANTY; w|ithout e|
|000013b0| 76 65 6e 20 74 68 65 20 | 69 6d 70 6c 69 65 64 20 |ven the |implied |
|000013c0| 77 61 72 72 61 6e 74 79 | 20 6f 66 0a 4d 45 52 43 |warranty| of.MERC|
|000013d0| 48 41 4e 54 41 42 49 4c | 49 54 59 20 6f 72 20 46 |HANTABIL|ITY or F|
|000013e0| 49 54 4e 45 53 53 20 46 | 4f 52 20 41 20 50 41 52 |ITNESS F|OR A PAR|
|000013f0| 54 49 43 55 4c 41 52 20 | 50 55 52 50 4f 53 45 2e |TICULAR |PURPOSE.|
|00001400| 20 20 53 65 65 20 74 68 | 65 0a 47 4e 55 20 47 65 | See th|e.GNU Ge|
|00001410| 6e 65 72 61 6c 20 50 75 | 62 6c 69 63 20 4c 69 63 |neral Pu|blic Lic|
|00001420| 65 6e 73 65 20 66 6f 72 | 20 6d 6f 72 65 20 64 65 |ense for| more de|
|00001430| 74 61 69 6c 73 2e 0a 0a | 59 6f 75 20 73 68 6f 75 |tails...|You shou|
|00001440| 6c 64 20 68 61 76 65 20 | 72 65 63 65 69 76 65 64 |ld have |received|
|00001450| 20 61 20 63 6f 70 79 20 | 6f 66 20 74 68 65 20 47 | a copy |of the G|
|00001460| 4e 55 20 47 65 6e 65 72 | 61 6c 20 50 75 62 6c 69 |NU Gener|al Publi|
|00001470| 63 20 4c 69 63 65 6e 73 | 65 0a 61 6c 6f 6e 67 20 |c Licens|e.along |
|00001480| 77 69 74 68 20 47 4e 55 | 20 54 61 72 3b 20 73 65 |with GNU| Tar; se|
|00001490| 65 20 74 68 65 20 66 69 | 6c 65 20 43 4f 50 59 49 |e the fi|le COPYI|
|000014a0| 4e 47 2e 20 20 49 66 20 | 6e 6f 74 2c 20 77 72 69 |NG. If |not, wri|
|000014b0| 74 65 20 74 6f 0a 74 68 | 65 20 46 72 65 65 20 53 |te to.th|e Free S|
|000014c0| 6f 66 74 77 61 72 65 20 | 46 6f 75 6e 64 61 74 69 |oftware |Foundati|
|000014d0| 6f 6e 2c 20 36 37 35 20 | 4d 61 73 73 20 41 76 65 |on, 675 |Mass Ave|
|000014e0| 2c 20 43 61 6d 62 72 69 | 64 67 65 2c 20 4d 41 20 |, Cambri|dge, MA |
|000014f0| 30 32 31 33 39 2c 20 55 | 53 41 2e 20 20 2a 2f 0a |02139, U|SA. */.|
|00001500| 0a 23 69 6e 63 6c 75 64 | 65 20 3c 73 79 73 2f 70 |.#includ|e <sys/p|
|00001510| 61 72 61 6d 2e 68 3e 0a | 23 69 6e 63 6c 75 64 65 |aram.h>.|#include|
|00001520| 20 3c 73 79 73 2f 74 79 | 70 65 73 2e 68 3e 0a 23 | <sys/ty|pes.h>.#|
|00001530| 69 6e 63 6c 75 64 65 20 | 3c 73 74 64 69 6f 2e 68 |include |<stdio.h|
|00001540| 3e 0a 23 69 66 6e 64 65 | 66 20 55 53 47 0a 23 69 |>.#ifnde|f USG.#i|
|00001550| 6e 63 6c 75 64 65 20 3c | 73 74 72 69 6e 67 73 2e |nclude <|strings.|
|00001560| 68 3e 0a 23 65 6c 73 65 | 0a 23 69 6e 63 6c 75 64 |h>.#else|.#includ|
|00001570| 65 20 3c 73 74 72 69 6e | 67 2e 68 3e 0a 23 64 65 |e <strin|g.h>.#de|
|00001580| 66 69 6e 65 20 69 6e 64 | 65 78 20 73 74 72 63 68 |fine ind|ex strch|
|00001590| 72 0a 23 64 65 66 69 6e | 65 20 72 69 6e 64 65 78 |r.#defin|e rindex|
|000015a0| 20 73 74 72 72 63 68 72 | 0a 23 65 6e 64 69 66 0a | strrchr|.#endif.|
|000015b0| 23 69 6e 63 6c 75 64 65 | 20 3c 73 79 73 2f 73 74 |#include| <sys/st|
|000015c0| 61 74 2e 68 3e 0a 23 69 | 66 6e 64 65 66 20 53 5f |at.h>.#i|fndef S_|
|000015d0| 49 46 4c 4e 4b 0a 23 64 | 65 66 69 6e 65 20 6c 73 |IFLNK.#d|efine ls|
|000015e0| 74 61 74 20 73 74 61 74 | 0a 23 65 6e 64 69 66 0a |tat stat|.#endif.|
|000015f0| 23 69 66 6e 64 65 66 20 | 4d 41 58 50 41 54 48 4c |#ifndef |MAXPATHL|
|00001600| 45 4e 0a 23 64 65 66 69 | 6e 65 20 4d 41 58 50 41 |EN.#defi|ne MAXPA|
|00001610| 54 48 4c 45 4e 20 31 30 | 32 34 0a 23 65 6e 64 69 |THLEN 10|24.#endi|
|00001620| 66 0a 23 69 6e 63 6c 75 | 64 65 20 22 65 72 72 6e |f.#inclu|de "errn|
|00001630| 6f 2e 68 22 0a 23 69 66 | 6e 64 65 66 20 65 72 72 |o.h".#if|ndef err|
|00001640| 6e 6f 0a 65 78 74 65 72 | 6e 20 69 6e 74 20 65 72 |no.exter|n int er|
|00001650| 72 6e 6f 3b 0a 23 65 6e | 64 69 66 0a 0a 65 78 74 |rno;.#en|dif..ext|
|00001660| 65 72 6e 20 63 68 61 72 | 20 2a 20 73 61 76 65 64 |ern char| * saved|
|00001670| 69 72 28 29 3b 0a 0a 66 | 61 74 61 6c 28 6d 73 67 |ir();..f|atal(msg|
|00001680| 29 0a 20 20 20 20 20 63 | 68 61 72 20 2a 6d 73 67 |). c|har *msg|
|00001690| 3b 0a 7b 0a 20 20 20 20 | 69 66 20 28 65 72 72 6e |;.{. |if (errn|
|000016a0| 6f 29 20 70 65 72 72 6f | 72 28 6d 73 67 20 3f 20 |o) perro|r(msg ? |
|000016b0| 6d 73 67 20 3a 20 22 22 | 29 3b 0a 20 20 20 20 65 |msg : ""|);. e|
|000016c0| 6c 73 65 20 69 66 20 28 | 6d 73 67 29 20 66 70 72 |lse if (|msg) fpr|
|000016d0| 69 6e 74 66 28 73 74 64 | 65 72 72 2c 20 22 6d 6b |intf(std|err, "mk|
|000016e0| 73 68 61 64 6f 77 3a 20 | 25 73 5c 6e 22 2c 20 6d |shadow: |%s\n", m|
|000016f0| 73 67 29 3b 0a 20 20 20 | 20 65 78 69 74 28 2d 31 |sg);. | exit(-1|
|00001700| 29 3b 0a 7d 0a 0a 63 68 | 61 72 20 6d 61 73 74 65 |);.}..ch|ar maste|
|00001710| 72 5f 62 75 66 66 65 72 | 5b 4d 41 58 50 41 54 48 |r_buffer|[MAXPATH|
|00001720| 4c 45 4e 5d 3b 0a 63 68 | 61 72 20 63 75 72 72 65 |LEN];.ch|ar curre|
|00001730| 6e 74 5f 62 75 66 66 65 | 72 5b 4d 41 58 50 41 54 |nt_buffe|r[MAXPAT|
|00001740| 48 4c 45 4e 5d 3b 0a 0a | 76 6f 69 64 20 62 61 64 |HLEN];..|void bad|
|00001750| 5f 61 72 67 73 28 6d 73 | 67 29 0a 7b 0a 20 20 20 |_args(ms|g).{. |
|00001760| 20 69 66 20 28 6d 73 67 | 29 20 66 70 72 69 6e 74 | if (msg|) fprint|
|00001770| 66 28 73 74 64 65 72 72 | 2c 20 22 25 73 5c 6e 22 |f(stderr|, "%s\n"|
|00001780| 2c 20 6d 73 67 29 3b 0a | 20 20 20 20 66 70 72 69 |, msg);.| fpri|
|00001790| 6e 74 66 28 73 74 64 65 | 72 72 2c 20 0a 20 20 20 |ntf(stde|rr, . |
|000017a0| 20 20 20 22 75 73 61 67 | 65 3a 20 6d 6b 73 68 61 | "usag|e: mksha|
|000017b0| 64 6f 77 20 5b 2d 58 20 | 65 78 63 6c 75 64 65 5f |dow [-X |exclude_|
|000017c0| 66 69 6c 65 5d 20 5b 2d | 78 20 65 78 63 6c 75 64 |file] [-|x exclud|
|000017d0| 65 5f 70 61 74 74 65 72 | 6e 5d 20 6d 61 73 74 65 |e_patter|n] maste|
|000017e0| 72 5f 73 72 63 5c 6e 22 | 29 3b 0a 20 20 20 20 65 |r_src\n"|);. e|
|000017f0| 78 69 74 28 2d 31 29 3b | 0a 7d 0a 0a 69 6e 74 20 |xit(-1);|.}..int |
|00001800| 65 78 63 6c 75 64 65 5f | 63 6f 75 6e 74 20 3d 20 |exclude_|count = |
|00001810| 30 3b 0a 63 68 61 72 20 | 2a 2a 65 78 63 6c 75 64 |0;.char |**exclud|
|00001820| 65 5f 70 61 74 74 65 72 | 6e 73 20 3d 20 4e 55 4c |e_patter|ns = NUL|
|00001830| 4c 3b 0a 69 6e 74 20 65 | 78 63 6c 75 64 65 5f 6c |L;.int e|xclude_l|
|00001840| 69 6d 69 74 20 3d 20 30 | 3b 0a 0a 76 6f 69 64 20 |imit = 0|;..void |
|00001850| 61 64 64 5f 65 78 63 6c | 75 64 65 28 70 61 74 74 |add_excl|ude(patt|
|00001860| 65 72 6e 29 0a 20 20 20 | 20 63 68 61 72 20 2a 70 |ern). | char *p|
|00001870| 61 74 74 65 72 6e 3b 0a | 7b 0a 20 20 20 20 69 66 |attern;.|{. if|
|00001880| 20 28 65 78 63 6c 75 64 | 65 5f 6c 69 6d 69 74 20 | (exclud|e_limit |
|00001890| 3d 3d 20 30 29 20 7b 0a | 09 65 78 63 6c 75 64 65 |== 0) {.|.exclude|
|000018a0| 5f 6c 69 6d 69 74 20 3d | 20 31 30 30 3b 0a 09 65 |_limit =| 100;..e|
|000018b0| 78 63 6c 75 64 65 5f 70 | 61 74 74 65 72 6e 73 20 |xclude_p|atterns |
|000018c0| 3d 20 28 63 68 61 72 2a | 2a 29 6d 61 6c 6c 6f 63 |= (char*|*)malloc|
|000018d0| 28 65 78 63 6c 75 64 65 | 5f 6c 69 6d 69 74 20 2a |(exclude|_limit *|
|000018e0| 20 73 69 7a 65 6f 66 28 | 63 68 61 72 2a 29 29 3b | sizeof(|char*));|
|000018f0| 0a 20 20 20 20 7d 20 65 | 6c 73 65 20 69 66 20 28 |. } e|lse if (|
|00001900| 65 78 63 6c 75 64 65 5f | 63 6f 75 6e 74 20 2b 20 |exclude_|count + |
|00001910| 31 20 3e 3d 20 65 78 63 | 6c 75 64 65 5f 6c 69 6d |1 >= exc|lude_lim|
|00001920| 69 74 29 20 7b 0a 09 65 | 78 63 6c 75 64 65 5f 6c |it) {..e|xclude_l|
|00001930| 69 6d 69 74 20 2b 3d 20 | 31 30 30 3b 0a 09 65 78 |imit += |100;..ex|
|00001940| 63 6c 75 64 65 5f 70 61 | 74 74 65 72 6e 73 20 3d |clude_pa|tterns =|
|00001950| 20 28 63 68 61 72 2a 2a | 29 72 65 61 6c 6c 6f 63 | (char**|)realloc|
|00001960| 28 65 78 63 6c 75 64 65 | 5f 70 61 74 74 65 72 6e |(exclude|_pattern|
|00001970| 73 2c 20 0a 09 09 09 09 | 09 20 20 20 65 78 63 6c |s, .....|. excl|
|00001980| 75 64 65 5f 6c 69 6d 69 | 74 20 2a 20 73 69 7a 65 |ude_limi|t * size|
|00001990| 6f 66 28 63 68 61 72 2a | 29 29 3b 0a 20 20 20 20 |of(char*|));. |
|000019a0| 7d 0a 20 20 20 20 65 78 | 63 6c 75 64 65 5f 70 61 |}. ex|clude_pa|
|000019b0| 74 74 65 72 6e 73 5b 65 | 78 63 6c 75 64 65 5f 63 |tterns[e|xclude_c|
|000019c0| 6f 75 6e 74 5d 20 3d 20 | 70 61 74 74 65 72 6e 3b |ount] = |pattern;|
|000019d0| 0a 20 20 20 20 65 78 63 | 6c 75 64 65 5f 63 6f 75 |. exc|lude_cou|
|000019e0| 6e 74 2b 2b 3b 0a 7d 0a | 0a 76 6f 69 64 20 61 64 |nt++;.}.|.void ad|
|000019f0| 64 5f 65 78 63 6c 75 64 | 65 5f 66 69 6c 65 28 6e |d_exclud|e_file(n|
|00001a00| 61 6d 65 29 0a 20 20 20 | 20 20 63 68 61 72 20 2a |ame). | char *|
|00001a10| 6e 61 6d 65 3b 0a 7b 0a | 20 20 20 20 63 68 61 72 |name;.{.| char|
|00001a20| 20 62 75 66 5b 4d 41 58 | 50 41 54 48 4c 45 4e 5d | buf[MAX|PATHLEN]|
|00001a30| 3b 0a 20 20 20 20 46 49 | 4c 45 20 2a 66 69 6c 65 |;. FI|LE *file|
|00001a40| 20 3d 20 66 6f 70 65 6e | 28 6e 61 6d 65 2c 20 22 | = fopen|(name, "|
|00001a50| 72 22 29 3b 0a 20 20 20 | 20 69 66 20 28 66 69 6c |r");. | if (fil|
|00001a60| 65 20 3d 3d 20 4e 55 4c | 4c 29 20 66 61 74 61 6c |e == NUL|L) fatal|
|00001a70| 28 22 66 61 69 6c 65 64 | 20 74 6f 20 66 69 6e 64 |("failed| to find|
|00001a80| 20 2d 58 20 28 65 78 63 | 6c 75 64 65 29 20 66 69 | -X (exc|lude) fi|
|00001a90| 6c 65 22 29 3b 0a 20 20 | 20 20 66 6f 72 20 28 3b |le");. | for (;|
|00001aa0| 3b 29 20 7b 0a 09 69 6e | 74 20 6c 65 6e 3b 0a 09 |;) {..in|t len;..|
|00001ab0| 63 68 61 72 20 2a 73 74 | 72 20 3d 20 66 67 65 74 |char *st|r = fget|
|00001ac0| 73 28 62 75 66 2c 20 4d | 41 58 50 41 54 48 4c 45 |s(buf, M|AXPATHLE|
|00001ad0| 4e 2c 20 66 69 6c 65 29 | 3b 0a 09 69 66 20 28 73 |N, file)|;..if (s|
|00001ae0| 74 72 20 3d 3d 20 4e 55 | 4c 4c 29 20 62 72 65 61 |tr == NU|LL) brea|
|00001af0| 6b 3b 0a 09 6c 65 6e 20 | 3d 20 73 74 72 6c 65 6e |k;..len |= strlen|
|00001b00| 28 73 74 72 29 3b 0a 09 | 69 66 20 28 6c 65 6e 20 |(str);..|if (len |
|00001b10| 26 26 20 73 74 72 5b 6c | 65 6e 2d 31 5d 20 3d 3d |&& str[l|en-1] ==|
|00001b20| 20 27 5c 6e 27 29 20 73 | 74 72 5b 2d 2d 6c 65 6e | '\n') s|tr[--len|
|00001b30| 5d 20 3d 20 30 3b 0a 09 | 69 66 20 28 21 6c 65 6e |] = 0;..|if (!len|
|00001b40| 29 20 63 6f 6e 74 69 6e | 75 65 3b 0a 09 73 74 72 |) contin|ue;..str|
|00001b50| 20 3d 20 28 63 68 61 72 | 2a 29 6d 61 6c 6c 6f 63 | = (char|*)malloc|
|00001b60| 28 6c 65 6e 2b 31 29 3b | 0a 09 73 74 72 63 70 79 |(len+1);|..strcpy|
|00001b70| 28 73 74 72 2c 20 62 75 | 66 29 3b 0a 09 61 64 64 |(str, bu|f);..add|
|00001b80| 5f 65 78 63 6c 75 64 65 | 28 73 74 72 29 3b 0a 20 |_exclude|(str);. |
|00001b90| 20 20 20 7d 0a 20 20 20 | 20 66 63 6c 6f 73 65 28 | }. | fclose(|
|00001ba0| 66 69 6c 65 29 3b 0a 7d | 0a 0a 6d 61 69 6e 28 61 |file);.}|..main(a|
|00001bb0| 72 67 63 2c 20 61 72 67 | 76 29 0a 20 20 20 20 20 |rgc, arg|v). |
|00001bc0| 63 68 61 72 20 2a 2a 61 | 72 67 76 3b 0a 7b 0a 20 |char **a|rgv;.{. |
|00001bd0| 20 20 20 63 68 61 72 20 | 2a 72 6f 6f 74 5f 6e 61 | char |*root_na|
|00001be0| 6d 65 20 3d 20 4e 55 4c | 4c 3b 0a 20 20 20 20 69 |me = NUL|L;. i|
|00001bf0| 6e 74 20 69 3b 0a 20 20 | 20 20 66 6f 72 20 28 69 |nt i;. | for (i|
|00001c00| 20 3d 20 31 3b 20 69 20 | 3c 20 61 72 67 63 3b 20 | = 1; i |< argc; |
|00001c10| 69 2b 2b 29 20 7b 0a 09 | 69 66 20 28 61 72 67 76 |i++) {..|if (argv|
|00001c20| 5b 69 5d 5b 30 5d 20 3d | 3d 20 27 2d 27 29 20 7b |[i][0] =|= '-') {|
|00001c30| 0a 09 20 20 20 20 73 77 | 69 74 63 68 28 61 72 67 |.. sw|itch(arg|
|00001c40| 76 5b 69 5d 5b 31 5d 29 | 20 7b 0a 09 20 20 20 20 |v[i][1])| {.. |
|00001c50| 20 20 63 61 73 65 20 27 | 58 27 3a 0a 09 09 69 66 | case '|X':...if|
|00001c60| 20 28 61 72 67 76 5b 69 | 5d 5b 32 5d 29 20 61 64 | (argv[i|][2]) ad|
|00001c70| 64 5f 65 78 63 6c 75 64 | 65 5f 66 69 6c 65 28 26 |d_exclud|e_file(&|
|00001c80| 61 72 67 76 5b 69 5d 5b | 32 5d 29 3b 0a 09 09 65 |argv[i][|2]);...e|
|00001c90| 6c 73 65 20 69 66 20 28 | 2b 2b 69 20 3e 3d 20 61 |lse if (|++i >= a|
|00001ca0| 72 67 63 29 20 62 61 64 | 5f 61 72 67 73 28 4e 55 |rgc) bad|_args(NU|
|00001cb0| 4c 4c 29 3b 0a 09 09 65 | 6c 73 65 20 61 64 64 5f |LL);...e|lse add_|
|00001cc0| 65 78 63 6c 75 64 65 5f | 66 69 6c 65 28 61 72 67 |exclude_|file(arg|
|00001cd0| 76 5b 69 5d 29 3b 0a 09 | 09 62 72 65 61 6b 3b 0a |v[i]);..|.break;.|
|00001ce0| 09 20 20 20 20 20 20 63 | 61 73 65 20 27 78 27 3a |. c|ase 'x':|
|00001cf0| 0a 09 09 69 66 20 28 61 | 72 67 76 5b 69 5d 5b 32 |...if (a|rgv[i][2|
|00001d00| 5d 29 20 61 64 64 5f 65 | 78 63 6c 75 64 65 28 26 |]) add_e|xclude(&|
|00001d10| 61 72 67 76 5b 69 5d 5b | 32 5d 29 3b 0a 09 09 65 |argv[i][|2]);...e|
|00001d20| 6c 73 65 20 69 66 20 28 | 2b 2b 69 20 3e 3d 20 61 |lse if (|++i >= a|
|00001d30| 72 67 63 29 20 62 61 64 | 5f 61 72 67 73 28 4e 55 |rgc) bad|_args(NU|
|00001d40| 4c 4c 29 3b 0a 09 09 65 | 6c 73 65 20 61 64 64 5f |LL);...e|lse add_|
|00001d50| 65 78 63 6c 75 64 65 28 | 61 72 67 76 5b 69 5d 29 |exclude(|argv[i])|
|00001d60| 3b 0a 09 09 62 72 65 61 | 6b 3b 0a 09 20 20 20 20 |;...brea|k;.. |
|00001d70| 20 20 64 65 66 61 75 6c | 74 3a 0a 09 09 62 61 64 | defaul|t:...bad|
|00001d80| 5f 61 72 67 73 28 4e 55 | 4c 4c 29 3b 0a 09 20 20 |_args(NU|LL);.. |
|00001d90| 20 20 7d 0a 09 7d 20 65 | 6c 73 65 20 69 66 20 28 | }..} e|lse if (|
|00001da0| 72 6f 6f 74 5f 6e 61 6d | 65 29 20 62 61 64 5f 61 |root_nam|e) bad_a|
|00001db0| 72 67 73 28 4e 55 4c 4c | 29 3b 0a 09 65 6c 73 65 |rgs(NULL|);..else|
|00001dc0| 20 72 6f 6f 74 5f 6e 61 | 6d 65 20 3d 20 61 72 67 | root_na|me = arg|
|00001dd0| 76 5b 69 5d 3b 0a 20 20 | 20 20 7d 0a 20 20 20 20 |v[i];. | }. |
|00001de0| 69 66 20 28 72 6f 6f 74 | 5f 6e 61 6d 65 20 3d 3d |if (root|_name ==|
|00001df0| 20 4e 55 4c 4c 29 20 62 | 61 64 5f 61 72 67 73 28 | NULL) b|ad_args(|
|00001e00| 4e 55 4c 4c 29 3b 0a 20 | 20 20 20 73 74 72 63 70 |NULL);. | strcp|
|00001e10| 79 28 63 75 72 72 65 6e | 74 5f 62 75 66 66 65 72 |y(curren|t_buffer|
|00001e20| 2c 20 22 2e 22 29 3b 0a | 20 20 20 20 73 74 72 63 |, ".");.| strc|
|00001e30| 70 79 28 6d 61 73 74 65 | 72 5f 62 75 66 66 65 72 |py(maste|r_buffer|
|00001e40| 2c 20 72 6f 6f 74 5f 6e | 61 6d 65 29 3b 0a 20 20 |, root_n|ame);. |
|00001e50| 20 20 44 6f 43 6f 70 79 | 28 6d 61 73 74 65 72 5f | DoCopy|(master_|
|00001e60| 62 75 66 66 65 72 2c 20 | 63 75 72 72 65 6e 74 5f |buffer, |current_|
|00001e70| 62 75 66 66 65 72 29 3b | 0a 20 20 20 20 72 65 74 |buffer);|. ret|
|00001e80| 75 72 6e 20 30 3b 0a 7d | 0a 0a 69 6e 74 20 63 6f |urn 0;.}|..int co|
|00001e90| 6d 70 61 72 65 5f 73 74 | 72 69 6e 67 73 28 70 74 |mpare_st|rings(pt|
|00001ea0| 72 31 2c 20 70 74 72 32 | 29 0a 20 20 20 20 20 63 |r1, ptr2|). c|
|00001eb0| 68 61 72 20 2a 2a 70 74 | 72 31 2c 20 2a 2a 70 74 |har **pt|r1, **pt|
|00001ec0| 72 32 3b 0a 7b 0a 20 20 | 20 20 72 65 74 75 72 6e |r2;.{. | return|
|00001ed0| 20 73 74 72 63 6d 70 28 | 2a 70 74 72 31 2c 20 2a | strcmp(|*ptr1, *|
|00001ee0| 70 74 72 32 29 3b 0a 7d | 0a 0a 2f 2a 20 47 65 74 |ptr2);.}|../* Get|
|00001ef0| 20 61 20 73 6f 72 74 65 | 64 20 4e 55 4c 4c 5f 74 | a sorte|d NULL_t|
|00001f00| 65 72 6d 69 6e 61 74 6f | 72 20 61 72 72 61 79 20 |erminato|r array |
|00001f10| 6f 66 20 28 63 68 61 72 | 2a 29 20 75 73 69 6e 67 |of (char|*) using|
|00001f20| 20 27 6e 61 6d 65 73 27 | 0a 20 2a 20 28 63 72 65 | 'names'|. * (cre|
|00001f30| 61 74 65 64 20 62 79 20 | 73 61 76 65 5f 64 69 72 |ated by |save_dir|
|00001f40| 29 20 61 73 20 64 61 74 | 61 2e 0a 20 2a 2f 0a 63 |) as dat|a.. */.c|
|00001f50| 68 61 72 20 2a 2a 20 67 | 65 74 5f 6e 61 6d 65 5f |har ** g|et_name_|
|00001f60| 70 6f 69 6e 74 65 72 73 | 28 6e 61 6d 65 73 29 0a |pointers|(names).|
|00001f70| 20 20 20 20 20 63 68 61 | 72 20 2a 6e 61 6d 65 73 | cha|r *names|
|00001f80| 3b 0a 7b 0a 20 20 20 20 | 69 6e 74 20 6e 5f 6e 61 |;.{. |int n_na|
|00001f90| 6d 65 73 20 3d 20 30 3b | 0a 20 20 20 20 69 6e 74 |mes = 0;|. int|
|00001fa0| 20 6e 61 6d 65 73 5f 62 | 75 66 5f 73 69 7a 65 20 | names_b|uf_size |
|00001fb0| 3d 20 36 34 3b 0a 20 20 | 20 20 63 68 61 72 20 2a |= 64;. | char *|
|00001fc0| 6e 61 6d 65 70 3b 0a 20 | 20 20 20 63 68 61 72 20 |namep;. | char |
|00001fd0| 2a 2a 20 70 6f 69 6e 74 | 65 72 73 20 3d 20 28 63 |** point|ers = (c|
|00001fe0| 68 61 72 2a 2a 29 6d 61 | 6c 6c 6f 63 28 6e 61 6d |har**)ma|lloc(nam|
|00001ff0| 65 73 5f 62 75 66 5f 73 | 69 7a 65 20 2a 20 73 69 |es_buf_s|ize * si|
|00002000| 7a 65 6f 66 28 63 68 61 | 72 2a 29 29 3b 0a 20 20 |zeof(cha|r*));. |
|00002010| 20 20 69 66 20 28 21 6e | 61 6d 65 73 20 7c 7c 20 | if (!n|ames || |
|00002020| 21 70 6f 69 6e 74 65 72 | 73 29 20 66 61 74 61 6c |!pointer|s) fatal|
|00002030| 28 22 76 69 72 74 75 61 | 6c 20 6d 65 6d 6f 72 79 |("virtua|l memory|
|00002040| 20 65 78 68 61 75 73 74 | 65 64 22 29 3b 0a 0a 20 | exhaust|ed");.. |
|00002050| 20 20 20 66 6f 72 20 28 | 6e 61 6d 65 70 20 3d 20 | for (|namep = |
|00002060| 6e 61 6d 65 73 3b 20 2a | 6e 61 6d 65 70 3b 20 6e |names; *|namep; n|
|00002070| 61 6d 65 70 20 2b 3d 20 | 73 74 72 6c 65 6e 28 6e |amep += |strlen(n|
|00002080| 61 6d 65 70 29 20 2b 20 | 31 29 20 7b 0a 09 69 66 |amep) + |1) {..if|
|00002090| 20 28 6e 5f 6e 61 6d 65 | 73 20 2b 20 31 20 3e 3d | (n_name|s + 1 >=|
|000020a0| 20 6e 61 6d 65 73 5f 62 | 75 66 5f 73 69 7a 65 29 | names_b|uf_size)|
|000020b0| 20 7b 0a 09 20 20 20 20 | 6e 61 6d 65 73 5f 62 75 | {.. |names_bu|
|000020c0| 66 5f 73 69 7a 65 20 2a | 3d 20 32 3b 0a 09 20 20 |f_size *|= 2;.. |
|000020d0| 20 20 70 6f 69 6e 74 65 | 72 73 20 3d 20 28 63 68 | pointe|rs = (ch|
|000020e0| 61 72 2a 2a 29 72 65 61 | 6c 6c 6f 63 28 70 6f 69 |ar**)rea|lloc(poi|
|000020f0| 6e 74 65 72 73 2c 0a 09 | 09 09 09 20 20 20 20 20 |nters,..|... |
|00002100| 20 20 6e 61 6d 65 73 5f | 62 75 66 5f 73 69 7a 65 | names_|buf_size|
|00002110| 20 2a 20 73 69 7a 65 6f | 66 28 63 68 61 72 2a 29 | * sizeo|f(char*)|
|00002120| 29 3b 0a 09 20 20 20 20 | 69 66 20 28 21 70 6f 69 |);.. |if (!poi|
|00002130| 6e 74 65 72 73 29 20 66 | 61 74 61 6c 28 22 76 69 |nters) f|atal("vi|
|00002140| 72 74 75 61 6c 20 6d 65 | 6d 6f 72 79 20 65 78 68 |rtual me|mory exh|
|00002150| 61 75 73 74 65 64 22 29 | 3b 0a 09 7d 0a 09 70 6f |austed")|;..}..po|
|00002160| 69 6e 74 65 72 73 5b 6e | 5f 6e 61 6d 65 73 2b 2b |inters[n|_names++|
|00002170| 5d 20 3d 20 6e 61 6d 65 | 70 3b 0a 20 20 20 20 7d |] = name|p;. }|
|00002180| 0a 20 20 20 20 70 6f 69 | 6e 74 65 72 73 5b 6e 5f |. poi|nters[n_|
|00002190| 6e 61 6d 65 73 5d 20 3d | 20 30 3b 0a 20 20 20 20 |names] =| 0;. |
|000021a0| 71 73 6f 72 74 28 70 6f | 69 6e 74 65 72 73 2c 20 |qsort(po|inters, |
|000021b0| 6e 5f 6e 61 6d 65 73 2c | 20 73 69 7a 65 6f 66 28 |n_names,| sizeof(|
|000021c0| 63 68 61 72 2a 29 2c 20 | 63 6f 6d 70 61 72 65 5f |char*), |compare_|
|000021d0| 73 74 72 69 6e 67 73 29 | 3b 0a 20 20 20 20 72 65 |strings)|;. re|
|000021e0| 74 75 72 6e 20 70 6f 69 | 6e 74 65 72 73 3b 0a 7d |turn poi|nters;.}|
|000021f0| 0a 0a 44 6f 43 6f 70 79 | 28 6d 61 73 74 65 72 2c |..DoCopy|(master,|
|00002200| 20 63 75 72 72 65 6e 74 | 29 0a 20 20 20 20 20 63 | current|). c|
|00002210| 68 61 72 20 2a 6d 61 73 | 74 65 72 3b 0a 20 20 20 |har *mas|ter;. |
|00002220| 20 20 63 68 61 72 20 2a | 63 75 72 72 65 6e 74 3b | char *|current;|
|00002230| 0a 7b 0a 20 20 20 20 73 | 74 72 75 63 74 20 73 74 |.{. s|truct st|
|00002240| 61 74 20 73 74 61 74 5f | 6d 61 73 74 65 72 2c 20 |at stat_|master, |
|00002250| 73 74 61 74 5f 63 75 72 | 72 65 6e 74 3b 0a 20 20 |stat_cur|rent;. |
|00002260| 20 20 63 68 61 72 20 2a | 2a 6d 61 73 74 65 72 5f | char *|*master_|
|00002270| 70 6f 69 6e 74 65 72 2c | 20 2a 2a 63 75 72 72 65 |pointer,| **curre|
|00002280| 6e 74 5f 70 6f 69 6e 74 | 65 72 3b 0a 20 20 20 20 |nt_point|er;. |
|00002290| 63 68 61 72 20 2a 2a 6d | 61 73 74 65 72 5f 6e 61 |char **m|aster_na|
|000022a0| 6d 65 73 2c 20 2a 2a 63 | 75 72 72 65 6e 74 5f 6e |mes, **c|urrent_n|
|000022b0| 61 6d 65 73 3b 0a 20 20 | 20 20 63 68 61 72 20 2a |ames;. | char *|
|000022c0| 6d 61 73 74 65 72 5f 65 | 6e 64 2c 20 2a 63 75 72 |master_e|nd, *cur|
|000022d0| 72 65 6e 74 5f 65 6e 64 | 3b 0a 20 20 20 20 63 68 |rent_end|;. ch|
|000022e0| 61 72 20 2a 6d 61 73 74 | 65 72 5f 6e 61 6d 65 5f |ar *mast|er_name_|
|000022f0| 62 75 66 2c 20 2a 63 75 | 72 72 65 6e 74 5f 6e 61 |buf, *cu|rrent_na|
|00002300| 6d 65 5f 62 75 66 3b 0a | 20 20 20 20 6d 61 73 74 |me_buf;.| mast|
|00002310| 65 72 5f 65 6e 64 20 3d | 20 6d 61 73 74 65 72 20 |er_end =| master |
|00002320| 2b 20 73 74 72 6c 65 6e | 28 6d 61 73 74 65 72 29 |+ strlen|(master)|
|00002330| 3b 0a 20 20 20 20 63 75 | 72 72 65 6e 74 5f 65 6e |;. cu|rrent_en|
|00002340| 64 20 3d 20 63 75 72 72 | 65 6e 74 20 2b 20 73 74 |d = curr|ent + st|
|00002350| 72 6c 65 6e 28 63 75 72 | 72 65 6e 74 29 3b 0a 0a |rlen(cur|rent);..|
|00002360| 20 20 20 20 2f 2a 20 47 | 65 74 20 72 69 64 20 6f | /* G|et rid o|
|00002370| 66 20 74 65 72 6d 69 6e | 61 6c 20 27 2f 27 20 2a |f termin|al '/' *|
|00002380| 2f 0a 20 20 20 20 69 66 | 20 28 6d 61 73 74 65 72 |/. if| (master|
|00002390| 5f 65 6e 64 5b 2d 31 5d | 20 3d 3d 20 27 2f 27 20 |_end[-1]| == '/' |
|000023a0| 26 26 20 6d 61 73 74 65 | 72 20 21 3d 20 6d 61 73 |&& maste|r != mas|
|000023b0| 74 65 72 5f 65 6e 64 20 | 2d 20 31 29 0a 09 2a 2d |ter_end |- 1)..*-|
|000023c0| 2d 6d 61 73 74 65 72 5f | 65 6e 64 20 3d 20 30 3b |-master_|end = 0;|
|000023d0| 0a 20 20 20 20 69 66 20 | 28 63 75 72 72 65 6e 74 |. if |(current|
|000023e0| 5f 65 6e 64 5b 2d 31 5d | 20 3d 3d 20 27 2f 27 20 |_end[-1]| == '/' |
|000023f0| 26 26 20 63 75 72 72 65 | 6e 74 20 21 3d 20 63 75 |&& curre|nt != cu|
|00002400| 72 72 65 6e 74 5f 65 6e | 64 20 2d 20 31 29 0a 09 |rrent_en|d - 1)..|
|00002410| 2a 2d 2d 63 75 72 72 65 | 6e 74 5f 65 6e 64 20 3d |*--curre|nt_end =|
|00002420| 20 30 3b 0a 0a 20 20 20 | 20 6d 61 73 74 65 72 5f | 0;.. | master_|
|00002430| 6e 61 6d 65 5f 62 75 66 | 20 3d 20 73 61 76 65 64 |name_buf| = saved|
|00002440| 69 72 28 6d 61 73 74 65 | 72 2c 20 35 30 30 29 3b |ir(maste|r, 500);|
|00002450| 0a 20 20 20 20 63 75 72 | 72 65 6e 74 5f 6e 61 6d |. cur|rent_nam|
|00002460| 65 5f 62 75 66 20 3d 20 | 73 61 76 65 64 69 72 28 |e_buf = |savedir(|
|00002470| 63 75 72 72 65 6e 74 2c | 20 35 30 30 29 3b 0a 0a |current,| 500);..|
|00002480| 20 20 20 20 6d 61 73 74 | 65 72 5f 6e 61 6d 65 73 | mast|er_names|
|00002490| 20 3d 20 67 65 74 5f 6e | 61 6d 65 5f 70 6f 69 6e | = get_n|ame_poin|
|000024a0| 74 65 72 73 28 6d 61 73 | 74 65 72 5f 6e 61 6d 65 |ters(mas|ter_name|
|000024b0| 5f 62 75 66 29 3b 0a 20 | 20 20 20 63 75 72 72 65 |_buf);. | curre|
|000024c0| 6e 74 5f 6e 61 6d 65 73 | 20 3d 20 67 65 74 5f 6e |nt_names| = get_n|
|000024d0| 61 6d 65 5f 70 6f 69 6e | 74 65 72 73 28 63 75 72 |ame_poin|ters(cur|
|000024e0| 72 65 6e 74 5f 6e 61 6d | 65 5f 62 75 66 29 3b 0a |rent_nam|e_buf);.|
|000024f0| 0a 20 20 20 20 6d 61 73 | 74 65 72 5f 70 6f 69 6e |. mas|ter_poin|
|00002500| 74 65 72 20 3d 20 6d 61 | 73 74 65 72 5f 6e 61 6d |ter = ma|ster_nam|
|00002510| 65 73 3b 0a 20 20 20 20 | 63 75 72 72 65 6e 74 5f |es;. |current_|
|00002520| 70 6f 69 6e 74 65 72 20 | 3d 20 63 75 72 72 65 6e |pointer |= curren|
|00002530| 74 5f 6e 61 6d 65 73 3b | 0a 20 20 20 20 66 6f 72 |t_names;|. for|
|00002540| 20 28 3b 3b 29 20 7b 0a | 09 69 6e 74 20 63 6d 70 | (;;) {.|.int cmp|
|00002550| 2c 20 69 70 61 74 3b 0a | 09 69 6e 74 20 69 6e 5f |, ipat;.|.int in_|
|00002560| 6d 61 73 74 65 72 2c 20 | 69 6e 5f 63 75 72 72 65 |master, |in_curre|
|00002570| 6e 74 3b 0a 09 63 68 61 | 72 20 2a 63 75 72 5f 6e |nt;..cha|r *cur_n|
|00002580| 61 6d 65 3b 0a 09 69 66 | 20 28 2a 6d 61 73 74 65 |ame;..if| (*maste|
|00002590| 72 5f 70 6f 69 6e 74 65 | 72 20 3d 3d 20 4e 55 4c |r_pointe|r == NUL|
|000025a0| 4c 20 26 26 20 2a 63 75 | 72 72 65 6e 74 5f 70 6f |L && *cu|rrent_po|
|000025b0| 69 6e 74 65 72 20 3d 3d | 20 4e 55 4c 4c 29 0a 09 |inter ==| NULL)..|
|000025c0| 20 20 20 20 62 72 65 61 | 6b 3b 0a 09 69 66 20 28 | brea|k;..if (|
|000025d0| 2a 6d 61 73 74 65 72 5f | 70 6f 69 6e 74 65 72 20 |*master_|pointer |
|000025e0| 3d 3d 20 4e 55 4c 4c 29 | 20 63 6d 70 20 3d 20 31 |== NULL)| cmp = 1|
|000025f0| 3b 0a 09 65 6c 73 65 20 | 69 66 20 28 2a 63 75 72 |;..else |if (*cur|
|00002600| 72 65 6e 74 5f 70 6f 69 | 6e 74 65 72 20 3d 3d 20 |rent_poi|nter == |
|00002610| 4e 55 4c 4c 29 20 63 6d | 70 20 3d 20 2d 31 3b 0a |NULL) cm|p = -1;.|
|00002620| 09 65 6c 73 65 20 63 6d | 70 20 3d 20 73 74 72 63 |.else cm|p = strc|
|00002630| 6d 70 28 2a 6d 61 73 74 | 65 72 5f 70 6f 69 6e 74 |mp(*mast|er_point|
|00002640| 65 72 2c 20 2a 63 75 72 | 72 65 6e 74 5f 70 6f 69 |er, *cur|rent_poi|
|00002650| 6e 74 65 72 29 3b 0a 09 | 69 66 20 28 63 6d 70 20 |nter);..|if (cmp |
|00002660| 3c 20 30 29 20 7b 20 2f | 2a 20 66 69 6c 65 20 6f |< 0) { /|* file o|
|00002670| 6e 6c 79 20 65 78 69 73 | 74 73 20 69 6e 20 6d 61 |nly exis|ts in ma|
|00002680| 73 74 65 72 20 64 69 72 | 65 63 74 6f 72 79 20 2a |ster dir|ectory *|
|00002690| 2f 0a 09 20 20 20 20 69 | 6e 5f 6d 61 73 74 65 72 |/.. i|n_master|
|000026a0| 20 3d 20 31 3b 20 69 6e | 5f 63 75 72 72 65 6e 74 | = 1; in|_current|
|000026b0| 20 3d 20 30 3b 0a 09 7d | 20 65 6c 73 65 20 69 66 | = 0;..}| else if|
|000026c0| 20 28 63 6d 70 20 3d 3d | 20 30 29 20 7b 20 2f 2a | (cmp ==| 0) { /*|
|000026d0| 20 66 69 6c 65 20 65 78 | 69 73 74 73 20 69 6e 20 | file ex|ists in |
|000026e0| 62 6f 74 68 20 64 69 72 | 65 63 74 6f 72 69 65 73 |both dir|ectories|
|000026f0| 20 2a 2f 0a 09 20 20 20 | 20 69 6e 5f 6d 61 73 74 | */.. | in_mast|
|00002700| 65 72 20 3d 20 31 3b 20 | 69 6e 5f 63 75 72 72 65 |er = 1; |in_curre|
|00002710| 6e 74 20 3d 20 31 3b 0a | 09 7d 20 65 6c 73 65 20 |nt = 1;.|.} else |
|00002720| 7b 20 2f 2a 20 66 69 6c | 65 20 6f 6e 6c 79 20 65 |{ /* fil|e only e|
|00002730| 78 69 73 74 73 20 69 6e | 20 63 75 72 72 65 6e 74 |xists in| current|
|00002740| 20 64 69 72 65 63 74 6f | 72 79 20 2a 2f 0a 09 20 | directo|ry */.. |
|00002750| 20 20 20 69 6e 5f 63 75 | 72 72 65 6e 74 20 3d 20 | in_cu|rrent = |
|00002760| 31 3b 20 69 6e 5f 6d 61 | 73 74 65 72 20 3d 20 30 |1; in_ma|ster = 0|
|00002770| 3b 0a 09 7d 0a 09 63 75 | 72 5f 6e 61 6d 65 20 3d |;..}..cu|r_name =|
|00002780| 20 69 6e 5f 6d 61 73 74 | 65 72 20 3f 20 2a 6d 61 | in_mast|er ? *ma|
|00002790| 73 74 65 72 5f 70 6f 69 | 6e 74 65 72 20 3a 20 2a |ster_poi|nter : *|
|000027a0| 63 75 72 72 65 6e 74 5f | 70 6f 69 6e 74 65 72 3b |current_|pointer;|
|000027b0| 0a 09 73 70 72 69 6e 74 | 66 28 6d 61 73 74 65 72 |..sprint|f(master|
|000027c0| 5f 65 6e 64 2c 20 22 2f | 25 73 22 2c 20 63 75 72 |_end, "/|%s", cur|
|000027d0| 5f 6e 61 6d 65 29 3b 0a | 09 73 70 72 69 6e 74 66 |_name);.|.sprintf|
|000027e0| 28 63 75 72 72 65 6e 74 | 5f 65 6e 64 2c 20 22 2f |(current|_end, "/|
|000027f0| 25 73 22 2c 20 63 75 72 | 5f 6e 61 6d 65 29 3b 0a |%s", cur|_name);.|
|00002800| 09 66 6f 72 20 28 69 70 | 61 74 20 3d 20 30 3b 20 |.for (ip|at = 0; |
|00002810| 69 70 61 74 20 3c 20 65 | 78 63 6c 75 64 65 5f 63 |ipat < e|xclude_c|
|00002820| 6f 75 6e 74 3b 20 69 70 | 61 74 2b 2b 29 20 7b 0a |ount; ip|at++) {.|
|00002830| 09 20 20 20 20 63 68 61 | 72 20 2a 70 61 74 20 3d |. cha|r *pat =|
|00002840| 20 65 78 63 6c 75 64 65 | 5f 70 61 74 74 65 72 6e | exclude|_pattern|
|00002850| 73 5b 69 70 61 74 5d 3b | 0a 09 20 20 20 20 63 68 |s[ipat];|.. ch|
|00002860| 61 72 20 2a 63 75 72 3b | 0a 09 20 20 20 20 69 66 |ar *cur;|.. if|
|00002870| 20 28 69 6e 64 65 78 28 | 70 61 74 2c 20 27 2f 27 | (index(|pat, '/'|
|00002880| 29 29 20 63 75 72 20 3d | 20 63 75 72 72 65 6e 74 |)) cur =| current|
|00002890| 20 2b 20 32 3b 20 2f 2a | 20 53 6b 69 70 20 69 6e | + 2; /*| Skip in|
|000028a0| 69 74 69 61 6c 20 22 2e | 2f 22 20 2a 2f 0a 09 20 |itial ".|/" */.. |
|000028b0| 20 20 20 65 6c 73 65 20 | 63 75 72 20 3d 20 63 75 | else |cur = cu|
|000028c0| 72 5f 6e 61 6d 65 3b 0a | 09 20 20 20 20 69 66 20 |r_name;.|. if |
|000028d0| 28 77 69 6c 64 6d 61 74 | 28 63 75 72 2c 20 70 61 |(wildmat|(cur, pa|
|000028e0| 74 29 29 20 67 6f 74 6f | 20 73 6b 69 70 3b 0a 09 |t)) goto| skip;..|
|000028f0| 7d 0a 09 69 66 20 28 69 | 6e 5f 6d 61 73 74 65 72 |}..if (i|n_master|
|00002900| 29 0a 09 20 20 20 20 69 | 66 20 28 6c 73 74 61 74 |).. i|f (lstat|
|00002910| 28 6d 61 73 74 65 72 2c | 20 26 73 74 61 74 5f 6d |(master,| &stat_m|
|00002920| 61 73 74 65 72 29 20 21 | 3d 20 30 29 20 66 61 74 |aster) !|= 0) fat|
|00002930| 61 6c 28 22 73 74 61 74 | 20 66 61 69 6c 65 64 22 |al("stat| failed"|
|00002940| 29 3b 0a 09 69 66 20 28 | 69 6e 5f 63 75 72 72 65 |);..if (|in_curre|
|00002950| 6e 74 29 0a 09 20 20 20 | 20 69 66 20 28 6c 73 74 |nt).. | if (lst|
|00002960| 61 74 28 63 75 72 72 65 | 6e 74 2c 20 26 73 74 61 |at(curre|nt, &sta|
|00002970| 74 5f 63 75 72 72 65 6e | 74 29 20 21 3d 20 30 29 |t_curren|t) != 0)|
|00002980| 20 66 61 74 61 6c 28 22 | 73 74 61 74 20 66 61 69 | fatal("|stat fai|
|00002990| 6c 65 64 22 29 3b 0a 09 | 69 66 20 28 69 6e 5f 63 |led");..|if (in_c|
|000029a0| 75 72 72 65 6e 74 20 26 | 26 20 21 69 6e 5f 6d 61 |urrent &|& !in_ma|
|000029b0| 73 74 65 72 29 20 7b 0a | 09 20 20 20 20 69 66 20 |ster) {.|. if |
|000029c0| 28 28 73 74 61 74 5f 63 | 75 72 72 65 6e 74 2e 73 |((stat_c|urrent.s|
|000029d0| 74 5f 6d 6f 64 65 20 26 | 20 53 5f 49 46 4d 54 29 |t_mode &| S_IFMT)|
|000029e0| 20 3d 3d 20 53 5f 49 46 | 4c 4e 4b 29 0a 09 09 69 | == S_IF|LNK)...i|
|000029f0| 66 20 28 75 6e 6c 69 6e | 6b 28 63 75 72 72 65 6e |f (unlin|k(curren|
|00002a00| 74 29 29 20 7b 0a 09 09 | 20 20 20 20 66 70 72 69 |t)) {...| fpri|
|00002a10| 6e 74 66 28 73 74 64 65 | 72 72 2c 20 22 46 61 69 |ntf(stde|rr, "Fai|
|00002a20| 6c 65 64 20 74 6f 20 72 | 65 6d 6f 76 65 20 73 79 |led to r|emove sy|
|00002a30| 6d 62 6f 6c 69 63 20 6c | 69 6e 6b 20 25 73 2e 5c |mbolic l|ink %s.\|
|00002a40| 6e 22 2c 0a 09 09 09 20 | 20 20 20 63 75 72 72 65 |n",.... | curre|
|00002a50| 6e 74 29 3b 0a 09 09 7d | 0a 09 09 65 6c 73 65 0a |nt);...}|...else.|
|00002a60| 09 09 20 20 20 20 66 70 | 72 69 6e 74 66 28 73 74 |.. fp|rintf(st|
|00002a70| 64 65 72 72 2c 20 22 52 | 65 6d 6f 76 65 64 20 73 |derr, "R|emoved s|
|00002a80| 79 6d 62 6f 6c 69 63 20 | 6c 69 6e 6b 20 25 73 2e |ymbolic |link %s.|
|00002a90| 5c 6e 22 2c 0a 09 09 09 | 20 20 20 20 63 75 72 72 |\n",....| curr|
|00002aa0| 65 6e 74 29 3b 0a 09 20 | 20 20 20 65 6c 73 65 20 |ent);.. | else |
|00002ab0| 7b 0a 09 09 66 70 72 69 | 6e 74 66 28 73 74 64 65 |{...fpri|ntf(stde|
|00002ac0| 72 72 2c 0a 09 09 09 22 | 54 68 65 20 66 69 6c 65 |rr,...."|The file|
|00002ad0| 20 25 73 20 64 6f 65 73 | 20 6e 6f 74 20 65 78 69 | %s does| not exi|
|00002ae0| 73 74 20 69 6e 20 74 68 | 65 20 6d 61 73 74 65 72 |st in th|e master|
|00002af0| 20 74 72 65 65 2e 5c 6e | 22 2c 0a 09 09 09 63 75 | tree.\n|",....cu|
|00002b00| 72 72 65 6e 74 29 3b 0a | 09 20 20 20 20 7d 0a 09 |rrent);.|. }..|
|00002b10| 7d 0a 09 65 6c 73 65 20 | 69 66 20 28 28 73 74 61 |}..else |if ((sta|
|00002b20| 74 5f 6d 61 73 74 65 72 | 2e 73 74 5f 6d 6f 64 65 |t_master|.st_mode|
|00002b30| 20 26 20 53 5f 49 46 4d | 54 29 20 3d 3d 20 53 5f | & S_IFM|T) == S_|
|00002b40| 49 46 44 49 52 0a 09 09 | 20 26 26 20 73 74 72 63 |IFDIR...| && strc|
|00002b50| 6d 70 28 63 75 72 5f 6e | 61 6d 65 2c 20 22 52 43 |mp(cur_n|ame, "RC|
|00002b60| 53 22 29 20 21 3d 20 30 | 29 20 7b 0a 09 20 20 20 |S") != 0|) {.. |
|00002b70| 20 69 66 20 28 21 69 6e | 5f 63 75 72 72 65 6e 74 | if (!in|_current|
|00002b80| 29 20 7b 0a 09 09 69 66 | 20 28 6d 6b 64 69 72 28 |) {...if| (mkdir(|
|00002b90| 63 75 72 72 65 6e 74 2c | 20 30 37 37 35 29 29 20 |current,| 0775)) |
|00002ba0| 66 61 74 61 6c 28 22 6d | 6b 64 69 72 20 66 61 69 |fatal("m|kdir fai|
|00002bb0| 6c 65 64 22 29 3b 0a 09 | 20 20 20 20 7d 0a 09 20 |led");..| }.. |
|00002bc0| 20 20 20 65 6c 73 65 20 | 69 66 20 28 73 74 61 74 | else |if (stat|
|00002bd0| 28 63 75 72 72 65 6e 74 | 2c 20 26 73 74 61 74 5f |(current|, &stat_|
|00002be0| 63 75 72 72 65 6e 74 29 | 29 20 66 61 74 61 6c 28 |current)|) fatal(|
|00002bf0| 22 73 74 61 74 20 66 61 | 69 6c 65 64 22 29 3b 0a |"stat fa|iled");.|
|00002c00| 09 20 20 20 20 69 66 20 | 28 21 69 6e 5f 63 75 72 |. if |(!in_cur|
|00002c10| 72 65 6e 74 20 7c 7c 20 | 73 74 61 74 5f 63 75 72 |rent || |stat_cur|
|00002c20| 72 65 6e 74 2e 73 74 5f | 64 65 76 20 21 3d 20 73 |rent.st_|dev != s|
|00002c30| 74 61 74 5f 6d 61 73 74 | 65 72 2e 73 74 5f 64 65 |tat_mast|er.st_de|
|00002c40| 76 0a 09 09 7c 7c 20 73 | 74 61 74 5f 63 75 72 72 |v...|| s|tat_curr|
|00002c50| 65 6e 74 2e 73 74 5f 69 | 6e 6f 20 21 3d 20 73 74 |ent.st_i|no != st|
|00002c60| 61 74 5f 6d 61 73 74 65 | 72 2e 73 74 5f 69 6e 6f |at_maste|r.st_ino|
|00002c70| 29 0a 09 09 44 6f 43 6f | 70 79 28 6d 61 73 74 65 |)...DoCo|py(maste|
|00002c80| 72 2c 20 63 75 72 72 65 | 6e 74 29 3b 0a 09 20 20 |r, curre|nt);.. |
|00002c90| 20 20 65 6c 73 65 0a 09 | 09 66 70 72 69 6e 74 66 | else..|.fprintf|
|00002ca0| 28 73 74 64 65 72 72 2c | 20 22 4c 69 6e 6b 20 25 |(stderr,| "Link %|
|00002cb0| 73 20 69 73 20 74 68 65 | 20 73 61 6d 65 20 61 73 |s is the| same as|
|00002cc0| 20 64 69 72 65 63 74 6f | 72 79 20 25 73 2e 5c 6e | directo|ry %s.\n|
|00002cd0| 22 2c 0a 09 09 09 63 75 | 72 72 65 6e 74 2c 20 6d |",....cu|rrent, m|
|00002ce0| 61 73 74 65 72 29 3b 0a | 09 7d 0a 09 65 6c 73 65 |aster);.|.}..else|
|00002cf0| 20 7b 0a 09 20 20 20 20 | 69 66 20 28 21 69 6e 5f | {.. |if (!in_|
|00002d00| 63 75 72 72 65 6e 74 29 | 20 7b 0a 09 09 69 66 20 |current)| {...if |
|00002d10| 28 73 79 6d 6c 69 6e 6b | 28 6d 61 73 74 65 72 2c |(symlink|(master,|
|00002d20| 20 63 75 72 72 65 6e 74 | 29 29 20 7b 0a 09 09 20 | current|)) {... |
|00002d30| 20 20 20 66 70 72 69 6e | 74 66 28 73 74 64 65 72 | fprin|tf(stder|
|00002d40| 72 2c 20 22 46 61 69 6c | 65 64 20 74 6f 20 63 72 |r, "Fail|ed to cr|
|00002d50| 65 61 74 65 20 73 79 6d | 62 6f 6c 69 63 20 6c 69 |eate sym|bolic li|
|00002d60| 6e 6b 20 25 73 2d 3e 25 | 73 5c 6e 22 2c 0a 09 09 |nk %s->%|s\n",...|
|00002d70| 09 20 20 20 20 63 75 72 | 72 65 6e 74 2c 20 6d 61 |. cur|rent, ma|
|00002d80| 73 74 65 72 29 3b 0a 09 | 09 20 20 20 20 65 78 69 |ster);..|. exi|
|00002d90| 74 20 28 2d 31 29 3b 0a | 09 09 7d 0a 09 20 20 20 |t (-1);.|..}.. |
|00002da0| 20 7d 20 65 6c 73 65 20 | 69 66 20 28 28 73 74 61 | } else |if ((sta|
|00002db0| 74 5f 63 75 72 72 65 6e | 74 2e 73 74 5f 6d 6f 64 |t_curren|t.st_mod|
|00002dc0| 65 20 26 20 53 5f 49 46 | 4d 54 29 20 21 3d 20 53 |e & S_IF|MT) != S|
|00002dd0| 5f 49 46 4c 4e 4b 29 20 | 7b 0a 09 09 66 70 72 69 |_IFLNK) |{...fpri|
|00002de0| 6e 74 66 28 73 74 64 65 | 72 72 2c 20 22 45 78 69 |ntf(stde|rr, "Exi|
|00002df0| 73 74 69 6e 67 20 66 69 | 6c 65 20 25 73 20 69 73 |sting fi|le %s is|
|00002e00| 20 6e 6f 74 20 61 20 73 | 79 6d 62 6f 6c 63 20 6c | not a s|ymbolc l|
|00002e10| 69 6e 6b 2e 5c 6e 22 2c | 0a 09 09 09 63 75 72 72 |ink.\n",|....curr|
|00002e20| 65 6e 74 29 3b 0a 09 20 | 20 20 20 7d 20 65 6c 73 |ent);.. | } els|
|00002e30| 65 20 7b 0a 09 09 69 66 | 20 28 73 74 61 74 28 63 |e {...if| (stat(c|
|00002e40| 75 72 72 65 6e 74 2c 20 | 26 73 74 61 74 5f 63 75 |urrent, |&stat_cu|
|00002e50| 72 72 65 6e 74 29 20 7c | 7c 20 73 74 61 74 28 6d |rrent) ||| stat(m|
|00002e60| 61 73 74 65 72 2c 20 26 | 73 74 61 74 5f 6d 61 73 |aster, &|stat_mas|
|00002e70| 74 65 72 29 29 0a 09 09 | 20 20 20 20 66 61 74 61 |ter))...| fata|
|00002e80| 6c 28 22 73 74 61 74 20 | 66 61 69 6c 65 64 22 29 |l("stat |failed")|
|00002e90| 3b 0a 09 09 69 66 20 28 | 73 74 61 74 5f 63 75 72 |;...if (|stat_cur|
|00002ea0| 72 65 6e 74 2e 73 74 5f | 64 65 76 20 21 3d 20 73 |rent.st_|dev != s|
|00002eb0| 74 61 74 5f 6d 61 73 74 | 65 72 2e 73 74 5f 64 65 |tat_mast|er.st_de|
|00002ec0| 76 0a 09 09 20 20 20 20 | 7c 7c 20 73 74 61 74 5f |v... ||| stat_|
|00002ed0| 63 75 72 72 65 6e 74 2e | 73 74 5f 69 6e 6f 20 21 |current.|st_ino !|
|00002ee0| 3d 20 73 74 61 74 5f 6d | 61 73 74 65 72 2e 73 74 |= stat_m|aster.st|
|00002ef0| 5f 69 6e 6f 29 20 7b 0a | 09 09 20 20 20 20 66 70 |_ino) {.|.. fp|
|00002f00| 72 69 6e 74 66 28 73 74 | 64 65 72 72 2c 20 22 46 |rintf(st|derr, "F|
|00002f10| 69 78 69 6e 67 20 69 6e | 63 6f 72 72 65 63 74 20 |ixing in|correct |
|00002f20| 73 79 6d 62 6f 6c 69 63 | 20 6c 69 6e 6b 20 25 73 |symbolic| link %s|
|00002f30| 2e 5c 6e 22 2c 0a 09 09 | 09 20 20 20 20 63 75 72 |.\n",...|. cur|
|00002f40| 72 65 6e 74 29 3b 0a 09 | 09 20 20 20 20 69 66 20 |rent);..|. if |
|00002f50| 28 75 6e 6c 69 6e 6b 28 | 63 75 72 72 65 6e 74 29 |(unlink(|current)|
|00002f60| 29 20 7b 0a 09 09 09 66 | 70 72 69 6e 74 66 28 73 |) {....f|printf(s|
|00002f70| 74 64 65 72 72 2c 20 22 | 46 61 69 6c 65 64 20 74 |tderr, "|Failed t|
|00002f80| 6f 20 72 65 6d 6f 76 65 | 20 73 79 6d 62 6f 6c 69 |o remove| symboli|
|00002f90| 63 20 6c 69 6e 6b 20 25 | 73 2e 5c 6e 22 2c 0a 09 |c link %|s.\n",..|
|00002fa0| 09 09 09 63 75 72 72 65 | 6e 74 29 3b 0a 09 09 20 |...curre|nt);... |
|00002fb0| 20 20 20 7d 0a 09 09 20 | 20 20 20 65 6c 73 65 20 | }... | else |
|00002fc0| 69 66 20 28 73 79 6d 6c | 69 6e 6b 28 6d 61 73 74 |if (syml|ink(mast|
|00002fd0| 65 72 2c 20 63 75 72 72 | 65 6e 74 29 29 20 7b 0a |er, curr|ent)) {.|
|00002fe0| 09 09 09 66 70 72 69 6e | 74 66 28 73 74 64 65 72 |...fprin|tf(stder|
|00002ff0| 72 2c 0a 09 09 09 09 22 | 46 61 69 6c 65 64 20 74 |r,....."|Failed t|
|00003000| 6f 20 63 72 65 61 74 65 | 20 73 79 6d 62 6f 6c 69 |o create| symboli|
|00003010| 63 20 6c 69 6e 6b 20 25 | 73 2d 3e 25 73 5c 6e 22 |c link %|s->%s\n"|
|00003020| 2c 0a 09 09 09 09 63 75 | 72 72 65 6e 74 2c 20 6d |,.....cu|rrent, m|
|00003030| 61 73 74 65 72 29 3b 0a | 09 09 09 65 78 69 74 20 |aster);.|...exit |
|00003040| 28 2d 31 29 3b 0a 09 09 | 20 20 20 20 7d 0a 09 09 |(-1);...| }...|
|00003050| 7d 0a 09 20 20 20 20 7d | 0a 09 7d 0a 20 20 20 20 |}.. }|..}. |
|00003060| 20 20 73 6b 69 70 3a 0a | 09 69 66 20 28 69 6e 5f | skip:.|.if (in_|
|00003070| 6d 61 73 74 65 72 29 20 | 6d 61 73 74 65 72 5f 70 |master) |master_p|
|00003080| 6f 69 6e 74 65 72 2b 2b | 3b 0a 09 69 66 20 28 69 |ointer++|;..if (i|
|00003090| 6e 5f 63 75 72 72 65 6e | 74 29 20 63 75 72 72 65 |n_curren|t) curre|
|000030a0| 6e 74 5f 70 6f 69 6e 74 | 65 72 2b 2b 3b 0a 20 20 |nt_point|er++;. |
|000030b0| 20 20 7d 0a 0a 20 20 20 | 20 66 72 65 65 28 6d 61 | }.. | free(ma|
|000030c0| 73 74 65 72 5f 6e 61 6d | 65 73 29 3b 20 66 72 65 |ster_nam|es); fre|
|000030d0| 65 28 63 75 72 72 65 6e | 74 5f 6e 61 6d 65 73 29 |e(curren|t_names)|
|000030e0| 3b 0a 20 20 20 20 66 72 | 65 65 28 6d 61 73 74 65 |;. fr|ee(maste|
|000030f0| 72 5f 6e 61 6d 65 5f 62 | 75 66 29 3b 20 66 72 65 |r_name_b|uf); fre|
|00003100| 65 28 63 75 72 72 65 6e | 74 5f 6e 61 6d 65 5f 62 |e(curren|t_name_b|
|00003110| 75 66 29 3b 0a 7d 0a 53 | 48 41 52 5f 45 4f 46 0a |uf);.}.S|HAR_EOF.|
|00003120| 69 66 20 74 65 73 74 20 | 2d 66 20 27 73 61 76 65 |if test |-f 'save|
|00003130| 64 69 72 2e 63 27 0a 74 | 68 65 6e 0a 09 65 63 68 |dir.c'.t|hen..ech|
|00003140| 6f 20 73 68 61 72 3a 20 | 6f 76 65 72 2d 77 72 69 |o shar: |over-wri|
|00003150| 74 69 6e 67 20 65 78 69 | 73 74 69 6e 67 20 66 69 |ting exi|sting fi|
|00003160| 6c 65 20 22 27 73 61 76 | 65 64 69 72 2e 63 27 22 |le "'sav|edir.c'"|
|00003170| 0a 66 69 0a 63 61 74 20 | 3c 3c 20 5c 53 48 41 52 |.fi.cat |<< \SHAR|
|00003180| 5f 45 4f 46 20 3e 20 27 | 73 61 76 65 64 69 72 2e |_EOF > '|savedir.|
|00003190| 63 27 0a 2f 2a 20 73 61 | 76 65 64 69 72 2e 63 20 |c'./* sa|vedir.c |
|000031a0| 2d 2d 20 73 61 76 65 20 | 74 68 65 20 6c 69 73 74 |-- save |the list|
|000031b0| 20 6f 66 20 66 69 6c 65 | 73 20 69 6e 20 61 20 64 | of file|s in a d|
|000031c0| 69 72 65 63 74 6f 72 79 | 20 69 6e 20 61 20 73 74 |irectory| in a st|
|000031d0| 72 69 6e 67 0a 20 20 20 | 43 6f 70 79 72 69 67 68 |ring. |Copyrigh|
|000031e0| 74 20 28 43 29 20 31 39 | 39 30 20 46 72 65 65 20 |t (C) 19|90 Free |
|000031f0| 53 6f 66 74 77 61 72 65 | 20 46 6f 75 6e 64 61 74 |Software| Foundat|
|00003200| 69 6f 6e 2c 20 49 6e 63 | 2e 0a 0a 20 20 20 54 68 |ion, Inc|... Th|
|00003210| 69 73 20 70 72 6f 67 72 | 61 6d 20 69 73 20 66 72 |is progr|am is fr|
|00003220| 65 65 20 73 6f 66 74 77 | 61 72 65 3b 20 79 6f 75 |ee softw|are; you|
|00003230| 20 63 61 6e 20 72 65 64 | 69 73 74 72 69 62 75 74 | can red|istribut|
|00003240| 65 20 69 74 20 61 6e 64 | 2f 6f 72 20 6d 6f 64 69 |e it and|/or modi|
|00003250| 66 79 0a 20 20 20 69 74 | 20 75 6e 64 65 72 20 74 |fy. it| under t|
|00003260| 68 65 20 74 65 72 6d 73 | 20 6f 66 20 74 68 65 20 |he terms| of the |
|00003270| 47 4e 55 20 47 65 6e 65 | 72 61 6c 20 50 75 62 6c |GNU Gene|ral Publ|
|00003280| 69 63 20 4c 69 63 65 6e | 73 65 20 61 73 20 70 75 |ic Licen|se as pu|
|00003290| 62 6c 69 73 68 65 64 20 | 62 79 0a 20 20 20 74 68 |blished |by. th|
|000032a0| 65 20 46 72 65 65 20 53 | 6f 66 74 77 61 72 65 20 |e Free S|oftware |
|000032b0| 46 6f 75 6e 64 61 74 69 | 6f 6e 3b 20 65 69 74 68 |Foundati|on; eith|
|000032c0| 65 72 20 76 65 72 73 69 | 6f 6e 20 31 2c 20 6f 72 |er versi|on 1, or|
|000032d0| 20 28 61 74 20 79 6f 75 | 72 20 6f 70 74 69 6f 6e | (at you|r option|
|000032e0| 29 0a 20 20 20 61 6e 79 | 20 6c 61 74 65 72 20 76 |). any| later v|
|000032f0| 65 72 73 69 6f 6e 2e 0a | 0a 20 20 20 54 68 69 73 |ersion..|. This|
|00003300| 20 70 72 6f 67 72 61 6d | 20 69 73 20 64 69 73 74 | program| is dist|
|00003310| 72 69 62 75 74 65 64 20 | 69 6e 20 74 68 65 20 68 |ributed |in the h|
|00003320| 6f 70 65 20 74 68 61 74 | 20 69 74 20 77 69 6c 6c |ope that| it will|
|00003330| 20 62 65 20 75 73 65 66 | 75 6c 2c 0a 20 20 20 62 | be usef|ul,. b|
|00003340| 75 74 20 57 49 54 48 4f | 55 54 20 41 4e 59 20 57 |ut WITHO|UT ANY W|
|00003350| 41 52 52 41 4e 54 59 3b | 20 77 69 74 68 6f 75 74 |ARRANTY;| without|
|00003360| 20 65 76 65 6e 20 74 68 | 65 20 69 6d 70 6c 69 65 | even th|e implie|
|00003370| 64 20 77 61 72 72 61 6e | 74 79 20 6f 66 0a 20 20 |d warran|ty of. |
|00003380| 20 4d 45 52 43 48 41 4e | 54 41 42 49 4c 49 54 59 | MERCHAN|TABILITY|
|00003390| 20 6f 72 20 46 49 54 4e | 45 53 53 20 46 4f 52 20 | or FITN|ESS FOR |
|000033a0| 41 20 50 41 52 54 49 43 | 55 4c 41 52 20 50 55 52 |A PARTIC|ULAR PUR|
|000033b0| 50 4f 53 45 2e 20 20 53 | 65 65 20 74 68 65 0a 20 |POSE. S|ee the. |
|000033c0| 20 20 47 4e 55 20 47 65 | 6e 65 72 61 6c 20 50 75 | GNU Ge|neral Pu|
|000033d0| 62 6c 69 63 20 4c 69 63 | 65 6e 73 65 20 66 6f 72 |blic Lic|ense for|
|000033e0| 20 6d 6f 72 65 20 64 65 | 74 61 69 6c 73 2e 0a 0a | more de|tails...|
|000033f0| 20 20 20 59 6f 75 20 73 | 68 6f 75 6c 64 20 68 61 | You s|hould ha|
|00003400| 76 65 20 72 65 63 65 69 | 76 65 64 20 61 20 63 6f |ve recei|ved a co|
|00003410| 70 79 20 6f 66 20 74 68 | 65 20 47 4e 55 20 47 65 |py of th|e GNU Ge|
|00003420| 6e 65 72 61 6c 20 50 75 | 62 6c 69 63 20 4c 69 63 |neral Pu|blic Lic|
|00003430| 65 6e 73 65 0a 20 20 20 | 61 6c 6f 6e 67 20 77 69 |ense. |along wi|
|00003440| 74 68 20 74 68 69 73 20 | 70 72 6f 67 72 61 6d 3b |th this |program;|
|00003450| 20 69 66 20 6e 6f 74 2c | 20 77 72 69 74 65 20 74 | if not,| write t|
|00003460| 6f 20 74 68 65 20 46 72 | 65 65 20 53 6f 66 74 77 |o the Fr|ee Softw|
|00003470| 61 72 65 0a 20 20 20 46 | 6f 75 6e 64 61 74 69 6f |are. F|oundatio|
|00003480| 6e 2c 20 49 6e 63 2e 2c | 20 36 37 35 20 4d 61 73 |n, Inc.,| 675 Mas|
|00003490| 73 20 41 76 65 2c 20 43 | 61 6d 62 72 69 64 67 65 |s Ave, C|ambridge|
|000034a0| 2c 20 4d 41 20 30 32 31 | 33 39 2c 20 55 53 41 2e |, MA 021|39, USA.|
|000034b0| 20 20 2a 2f 0a 0a 2f 2a | 20 57 72 69 74 74 65 6e | */../*| Written|
|000034c0| 20 62 79 20 44 61 76 69 | 64 20 4d 61 63 4b 65 6e | by Davi|d MacKen|
|000034d0| 7a 69 65 20 3c 64 6a 6d | 40 61 69 2e 6d 69 74 2e |zie <djm|@ai.mit.|
|000034e0| 65 64 75 3e 2e 20 2a 2f | 0a 0a 23 69 6e 63 6c 75 |edu>. */|..#inclu|
|000034f0| 64 65 20 3c 73 79 73 2f | 74 79 70 65 73 2e 68 3e |de <sys/|types.h>|
|00003500| 0a 23 69 66 64 65 66 20 | 44 49 52 45 4e 54 0a 23 |.#ifdef |DIRENT.#|
|00003510| 69 6e 63 6c 75 64 65 20 | 3c 64 69 72 65 6e 74 2e |include |<dirent.|
|00003520| 68 3e 0a 23 64 65 66 69 | 6e 65 20 64 69 72 65 63 |h>.#defi|ne direc|
|00003530| 74 20 64 69 72 65 6e 74 | 0a 23 64 65 66 69 6e 65 |t dirent|.#define|
|00003540| 20 4e 4c 45 4e 47 54 48 | 28 64 69 72 65 63 74 29 | NLENGTH|(direct)|
|00003550| 20 28 73 74 72 6c 65 6e | 28 28 64 69 72 65 63 74 | (strlen|((direct|
|00003560| 29 2d 3e 64 5f 6e 61 6d | 65 29 29 0a 23 65 6c 73 |)->d_nam|e)).#els|
|00003570| 65 0a 23 64 65 66 69 6e | 65 20 4e 4c 45 4e 47 54 |e.#defin|e NLENGT|
|00003580| 48 28 64 69 72 65 63 74 | 29 20 28 28 64 69 72 65 |H(direct|) ((dire|
|00003590| 63 74 29 2d 3e 64 5f 6e | 61 6d 6c 65 6e 29 0a 23 |ct)->d_n|amlen).#|
|000035a0| 69 66 64 65 66 20 55 53 | 47 0a 23 69 66 64 65 66 |ifdef US|G.#ifdef|
|000035b0| 20 53 59 53 4e 44 49 52 | 0a 23 69 6e 63 6c 75 64 | SYSNDIR|.#includ|
|000035c0| 65 20 3c 73 79 73 2f 6e | 64 69 72 2e 68 3e 0a 23 |e <sys/n|dir.h>.#|
|000035d0| 65 6c 73 65 0a 23 69 6e | 63 6c 75 64 65 20 3c 6e |else.#in|clude <n|
|000035e0| 64 69 72 2e 68 3e 0a 23 | 65 6e 64 69 66 0a 23 65 |dir.h>.#|endif.#e|
|000035f0| 6c 73 65 0a 23 69 6e 63 | 6c 75 64 65 20 3c 73 79 |lse.#inc|lude <sy|
|00003600| 73 2f 64 69 72 2e 68 3e | 0a 23 65 6e 64 69 66 0a |s/dir.h>|.#endif.|
|00003610| 23 65 6e 64 69 66 0a 0a | 23 69 66 64 65 66 20 53 |#endif..|#ifdef S|
|00003620| 54 44 43 5f 48 45 41 44 | 45 52 53 0a 23 69 6e 63 |TDC_HEAD|ERS.#inc|
|00003630| 6c 75 64 65 20 3c 73 74 | 64 6c 69 62 2e 68 3e 0a |lude <st|dlib.h>.|
|00003640| 23 69 6e 63 6c 75 64 65 | 20 3c 73 74 72 69 6e 67 |#include| <string|
|00003650| 2e 68 3e 0a 23 65 6c 73 | 65 0a 63 68 61 72 20 2a |.h>.#els|e.char *|
|00003660| 6d 61 6c 6c 6f 63 20 28 | 29 3b 0a 63 68 61 72 20 |malloc (|);.char |
|00003670| 2a 72 65 61 6c 6c 6f 63 | 20 28 29 3b 0a 69 6e 74 |*realloc| ();.int|
|00003680| 20 73 74 72 6c 65 6e 20 | 28 29 3b 0a 23 69 66 6e | strlen |();.#ifn|
|00003690| 64 65 66 20 4e 55 4c 4c | 0a 23 64 65 66 69 6e 65 |def NULL|.#define|
|000036a0| 20 4e 55 4c 4c 20 30 0a | 23 65 6e 64 69 66 0a 23 | NULL 0.|#endif.#|
|000036b0| 65 6e 64 69 66 0a 0a 63 | 68 61 72 20 2a 73 74 70 |endif..c|har *stp|
|000036c0| 63 70 79 20 28 29 3b 0a | 0a 2f 2a 20 52 65 74 75 |cpy ();.|./* Retu|
|000036d0| 72 6e 20 61 20 66 72 65 | 73 68 6c 79 20 61 6c 6c |rn a fre|shly all|
|000036e0| 6f 63 61 74 65 64 20 73 | 74 72 69 6e 67 20 63 6f |ocated s|tring co|
|000036f0| 6e 74 61 69 6e 69 6e 67 | 20 74 68 65 20 66 69 6c |ntaining| the fil|
|00003700| 65 6e 61 6d 65 73 0a 20 | 20 20 69 6e 20 64 69 72 |enames. | in dir|
|00003710| 65 63 74 6f 72 79 20 44 | 49 52 2c 20 73 65 70 61 |ectory D|IR, sepa|
|00003720| 72 61 74 65 64 20 62 79 | 20 27 5c 30 27 20 63 68 |rated by| '\0' ch|
|00003730| 61 72 61 63 74 65 72 73 | 3b 0a 20 20 20 74 68 65 |aracters|;. the|
|00003740| 20 65 6e 64 20 69 73 20 | 6d 61 72 6b 65 64 20 62 | end is |marked b|
|00003750| 79 20 74 77 6f 20 27 5c | 30 27 20 63 68 61 72 61 |y two '\|0' chara|
|00003760| 63 74 65 72 73 20 69 6e | 20 61 20 72 6f 77 2e 0a |cters in| a row..|
|00003770| 20 20 20 4e 41 4d 45 5f | 53 49 5a 45 20 69 73 20 | NAME_|SIZE is |
|00003780| 74 68 65 20 6e 75 6d 62 | 65 72 20 6f 66 20 62 79 |the numb|er of by|
|00003790| 74 65 73 20 74 6f 20 69 | 6e 69 74 69 61 6c 6c 79 |tes to i|nitially|
|000037a0| 20 61 6c 6c 6f 63 61 74 | 65 0a 20 20 20 66 6f 72 | allocat|e. for|
|000037b0| 20 74 68 65 20 73 74 72 | 69 6e 67 3b 20 69 74 20 | the str|ing; it |
|000037c0| 77 69 6c 6c 20 62 65 20 | 65 6e 6c 61 72 67 65 64 |will be |enlarged|
|000037d0| 20 61 73 20 6e 65 65 64 | 65 64 2e 0a 20 20 20 52 | as need|ed.. R|
|000037e0| 65 74 75 72 6e 20 4e 55 | 4c 4c 20 69 66 20 44 49 |eturn NU|LL if DI|
|000037f0| 52 20 63 61 6e 6e 6f 74 | 20 62 65 20 6f 70 65 6e |R cannot| be open|
|00003800| 65 64 20 6f 72 20 69 66 | 20 6f 75 74 20 6f 66 20 |ed or if| out of |
|00003810| 6d 65 6d 6f 72 79 2e 20 | 2a 2f 0a 0a 63 68 61 72 |memory. |*/..char|
|00003820| 20 2a 0a 73 61 76 65 64 | 69 72 20 28 64 69 72 2c | *.saved|ir (dir,|
|00003830| 20 6e 61 6d 65 5f 73 69 | 7a 65 29 0a 20 20 20 20 | name_si|ze). |
|00003840| 20 63 68 61 72 20 2a 64 | 69 72 3b 0a 20 20 20 20 | char *d|ir;. |
|00003850| 20 75 6e 73 69 67 6e 65 | 64 20 6e 61 6d 65 5f 73 | unsigne|d name_s|
|00003860| 69 7a 65 3b 0a 7b 0a 20 | 20 44 49 52 20 2a 64 69 |ize;.{. | DIR *di|
|00003870| 72 70 3b 0a 20 20 73 74 | 72 75 63 74 20 64 69 72 |rp;. st|ruct dir|
|00003880| 65 63 74 20 2a 64 70 3b | 0a 20 20 63 68 61 72 20 |ect *dp;|. char |
|00003890| 2a 6e 61 6d 65 5f 73 70 | 61 63 65 3b 0a 20 20 63 |*name_sp|ace;. c|
|000038a0| 68 61 72 20 2a 6e 61 6d | 65 70 3b 0a 0a 20 20 64 |har *nam|ep;.. d|
|000038b0| 69 72 70 20 3d 20 6f 70 | 65 6e 64 69 72 20 28 64 |irp = op|endir (d|
|000038c0| 69 72 29 3b 0a 20 20 69 | 66 20 28 64 69 72 70 20 |ir);. i|f (dirp |
|000038d0| 3d 3d 20 4e 55 4c 4c 29 | 0a 20 20 20 20 72 65 74 |== NULL)|. ret|
|000038e0| 75 72 6e 20 4e 55 4c 4c | 3b 0a 0a 20 20 6e 61 6d |urn NULL|;.. nam|
|000038f0| 65 5f 73 70 61 63 65 20 | 3d 20 28 63 68 61 72 20 |e_space |= (char |
|00003900| 2a 29 20 6d 61 6c 6c 6f | 63 20 28 6e 61 6d 65 5f |*) mallo|c (name_|
|00003910| 73 69 7a 65 29 3b 0a 20 | 20 69 66 20 28 6e 61 6d |size);. | if (nam|
|00003920| 65 5f 73 70 61 63 65 20 | 3d 3d 20 4e 55 4c 4c 29 |e_space |== NULL)|
|00003930| 0a 20 20 20 20 72 65 74 | 75 72 6e 20 4e 55 4c 4c |. ret|urn NULL|
|00003940| 3b 0a 20 20 6e 61 6d 65 | 70 20 3d 20 6e 61 6d 65 |;. name|p = name|
|00003950| 5f 73 70 61 63 65 3b 0a | 0a 20 20 77 68 69 6c 65 |_space;.|. while|
|00003960| 20 28 28 64 70 20 3d 20 | 72 65 61 64 64 69 72 20 | ((dp = |readdir |
|00003970| 28 64 69 72 70 29 29 20 | 21 3d 20 4e 55 4c 4c 29 |(dirp)) |!= NULL)|
|00003980| 0a 20 20 20 20 7b 0a 20 | 20 20 20 20 20 2f 2a 20 |. {. | /* |
|00003990| 53 6b 69 70 20 22 2e 22 | 20 61 6e 64 20 22 2e 2e |Skip "."| and "..|
|000039a0| 22 20 28 73 6f 6d 65 20 | 4e 46 53 20 66 69 6c 65 |" (some |NFS file|
|000039b0| 73 79 73 74 65 6d 73 27 | 20 64 69 72 65 63 74 6f |systems'| directo|
|000039c0| 72 69 65 73 20 6c 61 63 | 6b 20 74 68 65 6d 29 2e |ries lac|k them).|
|000039d0| 20 2a 2f 0a 20 20 20 20 | 20 20 69 66 20 28 64 70 | */. | if (dp|
|000039e0| 2d 3e 64 5f 6e 61 6d 65 | 5b 30 5d 20 21 3d 20 27 |->d_name|[0] != '|
|000039f0| 2e 27 0a 09 20 20 7c 7c | 20 28 64 70 2d 3e 64 5f |.'.. ||| (dp->d_|
|00003a00| 6e 61 6d 65 5b 31 5d 20 | 21 3d 20 27 5c 30 27 0a |name[1] |!= '\0'.|
|00003a10| 09 20 20 20 20 20 20 26 | 26 20 28 64 70 2d 3e 64 |. &|& (dp->d|
|00003a20| 5f 6e 61 6d 65 5b 31 5d | 20 21 3d 20 27 2e 27 20 |_name[1]| != '.' |
|00003a30| 7c 7c 20 64 70 2d 3e 64 | 5f 6e 61 6d 65 5b 32 5d ||| dp->d|_name[2]|
|00003a40| 20 21 3d 20 27 5c 30 27 | 29 29 29 0a 09 7b 0a 09 | != '\0'|)))..{..|
|00003a50| 20 20 75 6e 73 69 67 6e | 65 64 20 73 69 7a 65 5f | unsign|ed size_|
|00003a60| 6e 65 65 64 65 64 20 3d | 20 28 6e 61 6d 65 70 20 |needed =| (namep |
|00003a70| 2d 20 6e 61 6d 65 5f 73 | 70 61 63 65 29 20 2b 20 |- name_s|pace) + |
|00003a80| 4e 4c 45 4e 47 54 48 20 | 28 64 70 29 20 2b 20 32 |NLENGTH |(dp) + 2|
|00003a90| 3b 0a 0a 09 20 20 69 66 | 20 28 73 69 7a 65 5f 6e |;... if| (size_n|
|00003aa0| 65 65 64 65 64 20 3e 20 | 6e 61 6d 65 5f 73 69 7a |eeded > |name_siz|
|00003ab0| 65 29 0a 09 20 20 20 20 | 7b 0a 09 20 20 20 20 20 |e).. |{.. |
|00003ac0| 20 63 68 61 72 20 2a 6e | 65 77 5f 6e 61 6d 65 5f | char *n|ew_name_|
|00003ad0| 73 70 61 63 65 3b 0a 0a | 09 20 20 20 20 20 20 77 |space;..|. w|
|00003ae0| 68 69 6c 65 20 28 73 69 | 7a 65 5f 6e 65 65 64 65 |hile (si|ze_neede|
|00003af0| 64 20 3e 20 6e 61 6d 65 | 5f 73 69 7a 65 29 0a 09 |d > name|_size)..|
|00003b00| 09 6e 61 6d 65 5f 73 69 | 7a 65 20 2b 3d 20 31 30 |.name_si|ze += 10|
|00003b10| 32 34 3b 0a 0a 09 20 20 | 20 20 20 20 6e 65 77 5f |24;... | new_|
|00003b20| 6e 61 6d 65 5f 73 70 61 | 63 65 20 3d 20 72 65 61 |name_spa|ce = rea|
|00003b30| 6c 6c 6f 63 20 28 6e 61 | 6d 65 5f 73 70 61 63 65 |lloc (na|me_space|
|00003b40| 2c 20 6e 61 6d 65 5f 73 | 69 7a 65 29 3b 0a 09 20 |, name_s|ize);.. |
|00003b50| 20 20 20 20 20 69 66 20 | 28 6e 65 77 5f 6e 61 6d | if |(new_nam|
|00003b60| 65 5f 73 70 61 63 65 20 | 3d 3d 20 4e 55 4c 4c 29 |e_space |== NULL)|
|00003b70| 0a 09 09 7b 0a 09 09 20 | 20 63 6c 6f 73 65 64 69 |...{... | closedi|
|00003b80| 72 20 28 64 69 72 70 29 | 3b 0a 09 09 20 20 72 65 |r (dirp)|;... re|
|00003b90| 74 75 72 6e 20 4e 55 4c | 4c 3b 0a 09 09 7d 0a 09 |turn NUL|L;...}..|
|00003ba0| 20 20 20 20 20 20 6e 61 | 6d 65 70 20 2b 3d 20 6e | na|mep += n|
|00003bb0| 65 77 5f 6e 61 6d 65 5f | 73 70 61 63 65 20 2d 20 |ew_name_|space - |
|00003bc0| 6e 61 6d 65 5f 73 70 61 | 63 65 3b 0a 09 20 20 20 |name_spa|ce;.. |
|00003bd0| 20 20 20 6e 61 6d 65 5f | 73 70 61 63 65 20 3d 20 | name_|space = |
|00003be0| 6e 65 77 5f 6e 61 6d 65 | 5f 73 70 61 63 65 3b 0a |new_name|_space;.|
|00003bf0| 09 20 20 20 20 7d 0a 09 | 20 20 6e 61 6d 65 70 20 |. }..| namep |
|00003c00| 3d 20 73 74 70 63 70 79 | 20 28 6e 61 6d 65 70 2c |= stpcpy| (namep,|
|00003c10| 20 64 70 2d 3e 64 5f 6e | 61 6d 65 29 20 2b 20 31 | dp->d_n|ame) + 1|
|00003c20| 3b 0a 09 7d 0a 20 20 20 | 20 7d 0a 20 20 2a 6e 61 |;..}. | }. *na|
|00003c30| 6d 65 70 20 3d 20 27 5c | 30 27 3b 0a 20 20 63 6c |mep = '\|0';. cl|
|00003c40| 6f 73 65 64 69 72 20 28 | 64 69 72 70 29 3b 0a 20 |osedir (|dirp);. |
|00003c50| 20 72 65 74 75 72 6e 20 | 6e 61 6d 65 5f 73 70 61 | return |name_spa|
|00003c60| 63 65 3b 0a 7d 0a 0a 2f | 2a 20 43 6f 70 79 20 53 |ce;.}../|* Copy S|
|00003c70| 4f 55 52 43 45 20 69 6e | 74 6f 20 44 45 53 54 2c |OURCE in|to DEST,|
|00003c80| 20 73 74 6f 70 70 69 6e | 67 20 61 66 74 65 72 20 | stoppin|g after |
|00003c90| 63 6f 70 79 69 6e 67 20 | 74 68 65 20 66 69 72 73 |copying |the firs|
|00003ca0| 74 20 27 5c 30 27 2c 20 | 61 6e 64 0a 20 20 20 72 |t '\0', |and. r|
|00003cb0| 65 74 75 72 6e 20 61 20 | 70 6f 69 6e 74 65 72 20 |eturn a |pointer |
|00003cc0| 74 6f 20 74 68 65 20 27 | 5c 30 27 20 61 74 20 74 |to the '|\0' at t|
|00003cd0| 68 65 20 65 6e 64 20 6f | 66 20 44 45 53 54 3b 0a |he end o|f DEST;.|
|00003ce0| 20 20 20 69 6e 20 6f 74 | 68 65 72 20 77 6f 72 64 | in ot|her word|
|00003cf0| 73 2c 20 72 65 74 75 72 | 6e 20 44 45 53 54 20 2b |s, retur|n DEST +|
|00003d00| 20 73 74 72 6c 65 6e 20 | 28 53 4f 55 52 43 45 29 | strlen |(SOURCE)|
|00003d10| 2e 20 2a 2f 0a 0a 63 68 | 61 72 20 2a 0a 73 74 70 |. */..ch|ar *.stp|
|00003d20| 63 70 79 20 28 64 65 73 | 74 2c 20 73 6f 75 72 63 |cpy (des|t, sourc|
|00003d30| 65 29 0a 20 20 20 20 20 | 63 68 61 72 20 2a 64 65 |e). |char *de|
|00003d40| 73 74 3b 0a 20 20 20 20 | 20 63 68 61 72 20 2a 73 |st;. | char *s|
|00003d50| 6f 75 72 63 65 3b 0a 7b | 0a 20 20 77 68 69 6c 65 |ource;.{|. while|
|00003d60| 20 28 28 2a 64 65 73 74 | 2b 2b 20 3d 20 2a 73 6f | ((*dest|++ = *so|
|00003d70| 75 72 63 65 2b 2b 29 20 | 21 3d 20 27 5c 30 27 29 |urce++) |!= '\0')|
|00003d80| 0a 20 20 20 20 2f 2a 20 | 44 6f 20 6e 6f 74 68 69 |. /* |Do nothi|
|00003d90| 6e 67 2e 20 2a 2f 20 3b | 0a 20 20 72 65 74 75 72 |ng. */ ;|. retur|
|00003da0| 6e 20 64 65 73 74 20 2d | 20 31 3b 0a 7d 0a 53 48 |n dest -| 1;.}.SH|
|00003db0| 41 52 5f 45 4f 46 0a 69 | 66 20 74 65 73 74 20 2d |AR_EOF.i|f test -|
|00003dc0| 66 20 27 77 69 6c 64 6d | 61 74 2e 63 27 0a 74 68 |f 'wildm|at.c'.th|
|00003dd0| 65 6e 0a 09 65 63 68 6f | 20 73 68 61 72 3a 20 6f |en..echo| shar: o|
|00003de0| 76 65 72 2d 77 72 69 74 | 69 6e 67 20 65 78 69 73 |ver-writ|ing exis|
|00003df0| 74 69 6e 67 20 66 69 6c | 65 20 22 27 77 69 6c 64 |ting fil|e "'wild|
|00003e00| 6d 61 74 2e 63 27 22 0a | 66 69 0a 63 61 74 20 3c |mat.c'".|fi.cat <|
|00003e10| 3c 20 5c 53 48 41 52 5f | 45 4f 46 20 3e 20 27 77 |< \SHAR_|EOF > 'w|
|00003e20| 69 6c 64 6d 61 74 2e 63 | 27 0a 2f 2a 20 57 69 6c |ildmat.c|'./* Wil|
|00003e30| 64 63 61 72 64 20 6d 61 | 74 63 68 69 6e 67 20 72 |dcard ma|tching r|
|00003e40| 6f 75 74 69 6e 65 73 2e | 0a 20 20 20 43 6f 70 79 |outines.|. Copy|
|00003e50| 72 69 67 68 74 20 28 43 | 29 20 31 39 38 38 20 46 |right (C|) 1988 F|
|00003e60| 72 65 65 20 53 6f 66 74 | 77 61 72 65 20 46 6f 75 |ree Soft|ware Fou|
|00003e70| 6e 64 61 74 69 6f 6e 0a | 0a 54 68 69 73 20 66 69 |ndation.|.This fi|
|00003e80| 6c 65 20 69 73 20 70 61 | 72 74 20 6f 66 20 47 4e |le is pa|rt of GN|
|00003e90| 55 20 54 61 72 2e 0a 0a | 47 4e 55 20 54 61 72 20 |U Tar...|GNU Tar |
|00003ea0| 69 73 20 66 72 65 65 20 | 73 6f 66 74 77 61 72 65 |is free |software|
|00003eb0| 3b 20 79 6f 75 20 63 61 | 6e 20 72 65 64 69 73 74 |; you ca|n redist|
|00003ec0| 72 69 62 75 74 65 20 69 | 74 20 61 6e 64 2f 6f 72 |ribute i|t and/or|
|00003ed0| 20 6d 6f 64 69 66 79 0a | 69 74 20 75 6e 64 65 72 | modify.|it under|
|00003ee0| 20 74 68 65 20 74 65 72 | 6d 73 20 6f 66 20 74 68 | the ter|ms of th|
|00003ef0| 65 20 47 4e 55 20 47 65 | 6e 65 72 61 6c 20 50 75 |e GNU Ge|neral Pu|
|00003f00| 62 6c 69 63 20 4c 69 63 | 65 6e 73 65 20 61 73 20 |blic Lic|ense as |
|00003f10| 70 75 62 6c 69 73 68 65 | 64 20 62 79 0a 74 68 65 |publishe|d by.the|
|00003f20| 20 46 72 65 65 20 53 6f | 66 74 77 61 72 65 20 46 | Free So|ftware F|
|00003f30| 6f 75 6e 64 61 74 69 6f | 6e 3b 20 65 69 74 68 65 |oundatio|n; eithe|
|00003f40| 72 20 76 65 72 73 69 6f | 6e 20 31 2c 20 6f 72 20 |r versio|n 1, or |
|00003f50| 28 61 74 20 79 6f 75 72 | 20 6f 70 74 69 6f 6e 29 |(at your| option)|
|00003f60| 0a 61 6e 79 20 6c 61 74 | 65 72 20 76 65 72 73 69 |.any lat|er versi|
|00003f70| 6f 6e 2e 0a 0a 47 4e 55 | 20 54 61 72 20 69 73 20 |on...GNU| Tar is |
|00003f80| 64 69 73 74 72 69 62 75 | 74 65 64 20 69 6e 20 74 |distribu|ted in t|
|00003f90| 68 65 20 68 6f 70 65 20 | 74 68 61 74 20 69 74 20 |he hope |that it |
|00003fa0| 77 69 6c 6c 20 62 65 20 | 75 73 65 66 75 6c 2c 0a |will be |useful,.|
|00003fb0| 62 75 74 20 57 49 54 48 | 4f 55 54 20 41 4e 59 20 |but WITH|OUT ANY |
|00003fc0| 57 41 52 52 41 4e 54 59 | 3b 20 77 69 74 68 6f 75 |WARRANTY|; withou|
|00003fd0| 74 20 65 76 65 6e 20 74 | 68 65 20 69 6d 70 6c 69 |t even t|he impli|
|00003fe0| 65 64 20 77 61 72 72 61 | 6e 74 79 20 6f 66 0a 4d |ed warra|nty of.M|
|00003ff0| 45 52 43 48 41 4e 54 41 | 42 49 4c 49 54 59 20 6f |ERCHANTA|BILITY o|
|00004000| 72 20 46 49 54 4e 45 53 | 53 20 46 4f 52 20 41 20 |r FITNES|S FOR A |
|00004010| 50 41 52 54 49 43 55 4c | 41 52 20 50 55 52 50 4f |PARTICUL|AR PURPO|
|00004020| 53 45 2e 20 20 53 65 65 | 20 74 68 65 0a 47 4e 55 |SE. See| the.GNU|
|00004030| 20 47 65 6e 65 72 61 6c | 20 50 75 62 6c 69 63 20 | General| Public |
|00004040| 4c 69 63 65 6e 73 65 20 | 66 6f 72 20 6d 6f 72 65 |License |for more|
|00004050| 20 64 65 74 61 69 6c 73 | 2e 0a 0a 59 6f 75 20 73 | details|...You s|
|00004060| 68 6f 75 6c 64 20 68 61 | 76 65 20 72 65 63 65 69 |hould ha|ve recei|
|00004070| 76 65 64 20 61 20 63 6f | 70 79 20 6f 66 20 74 68 |ved a co|py of th|
|00004080| 65 20 47 4e 55 20 47 65 | 6e 65 72 61 6c 20 50 75 |e GNU Ge|neral Pu|
|00004090| 62 6c 69 63 20 4c 69 63 | 65 6e 73 65 0a 61 6c 6f |blic Lic|ense.alo|
|000040a0| 6e 67 20 77 69 74 68 20 | 47 4e 55 20 54 61 72 3b |ng with |GNU Tar;|
|000040b0| 20 73 65 65 20 74 68 65 | 20 66 69 6c 65 20 43 4f | see the| file CO|
|000040c0| 50 59 49 4e 47 2e 20 20 | 49 66 20 6e 6f 74 2c 20 |PYING. |If not, |
|000040d0| 77 72 69 74 65 20 74 6f | 0a 74 68 65 20 46 72 65 |write to|.the Fre|
|000040e0| 65 20 53 6f 66 74 77 61 | 72 65 20 46 6f 75 6e 64 |e Softwa|re Found|
|000040f0| 61 74 69 6f 6e 2c 20 36 | 37 35 20 4d 61 73 73 20 |ation, 6|75 Mass |
|00004100| 41 76 65 2c 20 43 61 6d | 62 72 69 64 67 65 2c 20 |Ave, Cam|bridge, |
|00004110| 4d 41 20 30 32 31 33 39 | 2c 20 55 53 41 2e 20 20 |MA 02139|, USA. |
|00004120| 2a 2f 0a 0a 2f 2a 0a 20 | 2a 20 40 28 23 29 77 69 |*/../*. |* @(#)wi|
|00004130| 6c 64 6d 61 74 2e 63 20 | 31 2e 33 20 38 37 2f 31 |ldmat.c |1.3 87/1|
|00004140| 31 2f 30 36 0a 20 2a 0a | 46 72 6f 6d 3a 20 72 73 |1/06. *.|From: rs|
|00004150| 40 6d 69 72 72 6f 72 2e | 54 4d 43 2e 43 4f 4d 20 |@mirror.|TMC.COM |
|00004160| 28 52 69 63 68 20 53 61 | 6c 7a 29 0a 4e 65 77 73 |(Rich Sa|lz).News|
|00004170| 67 72 6f 75 70 73 3a 20 | 6e 65 74 2e 73 6f 75 72 |groups: |net.sour|
|00004180| 63 65 73 0a 53 75 62 6a | 65 63 74 3a 20 53 6d 61 |ces.Subj|ect: Sma|
|00004190| 6c 6c 20 73 68 65 6c 6c | 2d 73 74 79 6c 65 20 70 |ll shell|-style p|
|000041a0| 61 74 74 65 72 6e 20 6d | 61 74 63 68 65 72 0a 4d |attern m|atcher.M|
|000041b0| 65 73 73 61 67 65 2d 49 | 44 3a 20 3c 35 39 36 40 |essage-I|D: <596@|
|000041c0| 6d 69 72 72 6f 72 2e 54 | 4d 43 2e 43 4f 4d 3e 0a |mirror.T|MC.COM>.|
|000041d0| 44 61 74 65 3a 20 32 37 | 20 4e 6f 76 20 38 36 20 |Date: 27| Nov 86 |
|000041e0| 30 30 3a 30 36 3a 34 30 | 20 47 4d 54 0a 0a 54 68 |00:06:40| GMT..Th|
|000041f0| 65 72 65 20 68 61 76 65 | 20 62 65 65 6e 20 73 65 |ere have| been se|
|00004200| 76 65 72 61 6c 20 72 65 | 67 75 6c 61 72 2d 65 78 |veral re|gular-ex|
|00004210| 70 72 65 73 73 69 6f 6e | 20 73 75 62 72 6f 75 74 |pression| subrout|
|00004220| 69 6e 65 73 20 61 6e 64 | 20 6f 6e 65 20 6f 72 20 |ines and| one or |
|00004230| 74 77 6f 0a 66 69 6c 65 | 6e 61 6d 65 2d 67 6c 6f |two.file|name-glo|
|00004240| 62 62 69 6e 67 20 72 6f | 75 74 69 6e 65 73 20 69 |bbing ro|utines i|
|00004250| 6e 20 6d 6f 64 2e 73 6f | 75 72 63 65 73 2e 20 20 |n mod.so|urces. |
|00004260| 54 68 65 79 20 68 61 6e | 64 6c 65 20 6c 6f 74 73 |They han|dle lots|
|00004270| 20 6f 66 0a 63 6f 6d 70 | 6c 69 63 61 74 65 64 20 | of.comp|licated |
|00004280| 70 61 74 74 65 72 6e 73 | 2e 20 20 54 68 69 73 20 |patterns|. This |
|00004290| 73 6d 61 6c 6c 20 70 69 | 65 63 65 20 6f 66 20 63 |small pi|ece of c|
|000042a0| 6f 64 65 20 68 61 6e 64 | 6c 65 73 20 74 68 65 20 |ode hand|les the |
|000042b0| 2a 3f 5b 5d 5c 0a 77 69 | 6c 64 63 61 72 64 20 63 |*?[]\.wi|ldcard c|
|000042c0| 68 61 72 61 63 74 65 72 | 73 20 74 68 65 20 77 61 |haracter|s the wa|
|000042d0| 79 20 74 68 65 20 73 74 | 61 6e 64 61 72 64 20 55 |y the st|andard U|
|000042e0| 6e 69 78 28 74 6d 29 20 | 73 68 65 6c 6c 73 20 64 |nix(tm) |shells d|
|000042f0| 6f 2c 20 77 69 74 68 20 | 74 68 65 0a 61 64 64 69 |o, with |the.addi|
|00004300| 74 69 6f 6e 20 74 68 61 | 74 20 22 5b 5e 2e 2e 2e |tion tha|t "[^...|
|00004310| 2e 2e 5d 22 20 69 73 20 | 61 6e 20 69 6e 76 65 72 |..]" is |an inver|
|00004320| 73 65 20 63 68 61 72 61 | 63 74 65 72 20 63 6c 61 |se chara|cter cla|
|00004330| 73 73 20 2d 2d 20 69 74 | 20 6d 61 74 63 68 65 73 |ss -- it| matches|
|00004340| 0a 61 6e 79 20 63 68 61 | 72 61 63 74 65 72 20 6e |.any cha|racter n|
|00004350| 6f 74 20 69 6e 20 74 68 | 65 20 72 61 6e 67 65 20 |ot in th|e range |
|00004360| 22 2e 2e 2e 2e 2e 22 2e | 20 20 52 65 61 64 20 74 |".....".| Read t|
|00004370| 68 65 20 63 6f 6d 6d 65 | 6e 74 73 20 66 6f 72 20 |he comme|nts for |
|00004380| 6d 6f 72 65 0a 69 6e 66 | 6f 2e 0a 0a 46 6f 72 20 |more.inf|o...For |
|00004390| 6d 79 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 2c 20 |my appli|cation, |
|000043a0| 49 20 68 61 64 20 66 69 | 72 73 74 20 72 69 70 70 |I had fi|rst ripp|
|000043b0| 65 64 20 6f 66 66 20 61 | 20 63 6f 70 79 20 6f 66 |ed off a| copy of|
|000043c0| 20 74 68 65 20 22 67 6c | 6f 62 22 20 72 6f 75 74 | the "gl|ob" rout|
|000043d0| 69 6e 65 0a 66 72 6f 6d | 20 77 69 74 68 69 6e 20 |ine.from| within |
|000043e0| 74 68 65 20 66 69 6e 64 | 20 73 6f 75 72 63 65 2c |the find| source,|
|000043f0| 20 62 75 74 20 74 68 61 | 74 20 63 6f 64 65 20 69 | but tha|t code i|
|00004400| 73 20 62 61 64 20 6e 65 | 77 73 3a 20 20 69 74 20 |s bad ne|ws: it |
|00004410| 72 65 63 75 72 73 65 73 | 0a 6f 6e 20 65 76 65 72 |recurses|.on ever|
|00004420| 79 20 63 68 61 72 61 63 | 74 65 72 20 69 6e 20 74 |y charac|ter in t|
|00004430| 68 65 20 70 61 74 74 65 | 72 6e 2e 20 20 49 27 6d |he patte|rn. I'm|
|00004440| 20 70 75 74 74 69 6e 67 | 20 74 68 69 73 20 72 65 | putting| this re|
|00004450| 70 6c 61 63 65 6d 65 6e | 74 20 69 6e 20 74 68 65 |placemen|t in the|
|00004460| 0a 70 75 62 6c 69 63 20 | 64 6f 6d 61 69 6e 2e 20 |.public |domain. |
|00004470| 20 49 74 27 73 20 73 6d | 61 6c 6c 2c 20 74 69 67 | It's sm|all, tig|
|00004480| 68 74 2c 20 61 6e 64 20 | 69 74 65 72 61 74 69 76 |ht, and |iterativ|
|00004490| 65 2e 20 20 43 6f 6d 70 | 69 6c 65 20 77 69 74 68 |e. Comp|ile with|
|000044a0| 20 2d 44 54 45 53 54 0a | 74 6f 20 67 65 74 20 61 | -DTEST.|to get a|
|000044b0| 20 74 65 73 74 20 64 72 | 69 76 65 72 2e 20 20 41 | test dr|iver. A|
|000044c0| 66 74 65 72 20 79 6f 75 | 27 72 65 20 63 6f 6e 76 |fter you|'re conv|
|000044d0| 69 6e 63 65 64 20 69 74 | 20 77 6f 72 6b 73 2c 20 |inced it| works, |
|000044e0| 69 6e 73 74 61 6c 6c 20 | 69 6e 0a 77 68 61 74 65 |install |in.whate|
|000044f0| 76 65 72 20 77 61 79 20 | 69 73 20 61 70 70 72 6f |ver way |is appro|
|00004500| 70 72 69 61 74 65 20 66 | 6f 72 20 79 6f 75 2e 0a |priate f|or you..|
|00004510| 0a 49 20 77 6f 75 6c 64 | 20 6c 69 6b 65 20 74 6f |.I would| like to|
|00004520| 20 68 65 61 72 20 6f 66 | 20 62 75 67 73 2c 20 62 | hear of| bugs, b|
|00004530| 75 74 20 61 6d 20 6e 6f | 74 20 69 6e 74 65 72 65 |ut am no|t intere|
|00004540| 73 74 65 64 20 69 6e 20 | 61 64 64 69 74 69 6f 6e |sted in |addition|
|00004550| 73 3b 20 69 66 20 49 0a | 77 65 72 65 2c 20 49 27 |s; if I.|were, I'|
|00004560| 64 20 75 73 65 20 74 68 | 65 20 63 6f 64 65 20 49 |d use th|e code I|
|00004570| 20 6d 65 6e 74 69 6f 6e | 65 64 20 61 62 6f 76 65 | mention|ed above|
|00004580| 2e 0a 2a 2f 0a 2f 2a 0a | 2a 2a 20 20 44 6f 20 73 |..*/./*.|** Do s|
|00004590| 68 65 6c 6c 2d 73 74 79 | 6c 65 20 70 61 74 74 65 |hell-sty|le patte|
|000045a0| 72 6e 20 6d 61 74 63 68 | 69 6e 67 20 66 6f 72 20 |rn match|ing for |
|000045b0| 3f 2c 20 5c 2c 20 5b 5d | 2c 20 61 6e 64 20 2a 20 |?, \, []|, and * |
|000045c0| 63 68 61 72 61 63 74 65 | 72 73 2e 0a 2a 2a 20 20 |characte|rs..** |
|000045d0| 4d 69 67 68 74 20 6e 6f | 74 20 62 65 20 72 6f 62 |Might no|t be rob|
|000045e0| 75 73 74 20 69 6e 20 66 | 61 63 65 20 6f 66 20 6d |ust in f|ace of m|
|000045f0| 61 6c 66 6f 72 6d 65 64 | 20 70 61 74 74 65 72 6e |alformed| pattern|
|00004600| 73 3b 20 65 2e 67 2e 2c | 20 22 66 6f 6f 5b 61 2d |s; e.g.,| "foo[a-|
|00004610| 22 0a 2a 2a 20 20 63 6f | 75 6c 64 20 63 61 75 73 |".** co|uld caus|
|00004620| 65 20 61 20 73 65 67 6d | 65 6e 74 61 74 69 6f 6e |e a segm|entation|
|00004630| 20 76 69 6f 6c 61 74 69 | 6f 6e 2e 0a 2a 2a 0a 2a | violati|on..**.*|
|00004640| 2a 20 20 57 72 69 74 74 | 65 6e 20 62 79 20 52 69 |* Writt|en by Ri|
|00004650| 63 68 20 24 61 6c 7a 2c | 20 6d 69 72 72 6f 72 21 |ch $alz,| mirror!|
|00004660| 72 73 2c 20 57 65 64 20 | 4e 6f 76 20 32 36 20 31 |rs, Wed |Nov 26 1|
|00004670| 39 3a 30 33 3a 31 37 20 | 45 53 54 20 31 39 38 36 |9:03:17 |EST 1986|
|00004680| 2e 0a 2a 2f 0a 0a 2f 2a | 0a 20 2a 20 4d 6f 64 69 |..*/../*|. * Modi|
|00004690| 66 69 65 64 20 36 4e 6f | 76 38 37 20 62 79 20 4a |fied 6No|v87 by J|
|000046a0| 6f 68 6e 20 47 69 6c 6d | 6f 72 65 20 28 68 6f 70 |ohn Gilm|ore (hop|
|000046b0| 74 6f 61 64 21 67 6e 75 | 29 20 74 6f 20 72 65 74 |toad!gnu|) to ret|
|000046c0| 75 72 6e 20 61 20 22 6d | 61 74 63 68 22 0a 20 2a |urn a "m|atch". *|
|000046d0| 20 69 66 20 74 68 65 20 | 70 61 74 74 65 72 6e 20 | if the |pattern |
|000046e0| 69 73 20 69 6d 6d 65 64 | 69 61 74 65 6c 79 20 66 |is immed|iately f|
|000046f0| 6f 6c 6c 6f 77 65 64 20 | 62 79 20 61 20 22 2f 22 |ollowed |by a "/"|
|00004700| 2c 20 61 73 20 77 65 6c | 6c 20 61 73 20 5c 30 2e |, as wel|l as \0.|
|00004710| 0a 20 2a 20 54 68 69 73 | 20 6d 61 74 63 68 65 73 |. * This| matches|
|00004720| 20 77 68 61 74 20 22 74 | 61 72 22 20 64 6f 65 73 | what "t|ar" does|
|00004730| 20 66 6f 72 20 6d 61 74 | 63 68 69 6e 67 20 77 68 | for mat|ching wh|
|00004740| 6f 6c 65 20 73 75 62 64 | 69 72 65 63 74 6f 72 69 |ole subd|irectori|
|00004750| 65 73 2e 0a 20 2a 0a 20 | 2a 20 54 68 65 20 22 2a |es.. *. |* The "*|
|00004760| 22 20 63 6f 64 65 20 63 | 6f 75 6c 64 20 62 65 20 |" code c|ould be |
|00004770| 73 70 65 64 20 75 70 20 | 62 79 20 6f 6e 6c 79 20 |sped up |by only |
|00004780| 72 65 63 75 72 73 69 6e | 67 20 6f 6e 65 20 6c 65 |recursin|g one le|
|00004790| 76 65 6c 20 69 6e 73 74 | 65 61 64 0a 20 2a 20 6f |vel inst|ead. * o|
|000047a0| 66 20 74 77 6f 20 66 6f | 72 20 65 61 63 68 20 74 |f two fo|r each t|
|000047b0| 72 69 61 6c 20 70 61 74 | 74 65 72 6e 2c 20 70 65 |rial pat|tern, pe|
|000047c0| 72 68 61 70 73 2c 20 61 | 6e 64 20 6e 6f 74 20 72 |rhaps, a|nd not r|
|000047d0| 65 63 75 72 73 69 6e 67 | 20 61 74 20 61 6c 6c 0a |ecursing| at all.|
|000047e0| 20 2a 20 69 66 20 61 20 | 6c 69 74 65 72 61 6c 20 | * if a |literal |
|000047f0| 6d 61 74 63 68 20 6f 66 | 20 74 68 65 20 6e 65 78 |match of| the nex|
|00004800| 74 20 32 20 63 68 61 72 | 73 20 77 6f 75 6c 64 20 |t 2 char|s would |
|00004810| 66 61 69 6c 2e 0a 20 2a | 2f 0a 23 64 65 66 69 6e |fail.. *|/.#defin|
|00004820| 65 20 54 52 55 45 09 09 | 31 0a 23 64 65 66 69 6e |e TRUE..|1.#defin|
|00004830| 65 20 46 41 4c 53 45 09 | 09 30 0a 0a 0a 73 74 61 |e FALSE.|.0...sta|
|00004840| 74 69 63 20 69 6e 74 0a | 53 74 61 72 28 73 2c 20 |tic int.|Star(s, |
|00004850| 70 29 0a 20 20 20 20 72 | 65 67 69 73 74 65 72 20 |p). r|egister |
|00004860| 63 68 61 72 09 2a 73 3b | 0a 20 20 20 20 72 65 67 |char.*s;|. reg|
|00004870| 69 73 74 65 72 20 63 68 | 61 72 09 2a 70 3b 0a 7b |ister ch|ar.*p;.{|
|00004880| 0a 20 20 20 20 77 68 69 | 6c 65 20 28 77 69 6c 64 |. whi|le (wild|
|00004890| 6d 61 74 28 73 2c 20 70 | 29 20 3d 3d 20 46 41 4c |mat(s, p|) == FAL|
|000048a0| 53 45 29 0a 09 69 66 20 | 28 2a 2b 2b 73 20 3d 3d |SE)..if |(*++s ==|
|000048b0| 20 27 5c 30 27 29 0a 09 | 20 20 20 20 72 65 74 75 | '\0')..| retu|
|000048c0| 72 6e 28 46 41 4c 53 45 | 29 3b 0a 20 20 20 20 72 |rn(FALSE|);. r|
|000048d0| 65 74 75 72 6e 28 54 52 | 55 45 29 3b 0a 7d 0a 0a |eturn(TR|UE);.}..|
|000048e0| 0a 69 6e 74 0a 77 69 6c | 64 6d 61 74 28 73 2c 20 |.int.wil|dmat(s, |
|000048f0| 70 29 0a 20 20 20 20 72 | 65 67 69 73 74 65 72 20 |p). r|egister |
|00004900| 63 68 61 72 09 2a 73 3b | 0a 20 20 20 20 72 65 67 |char.*s;|. reg|
|00004910| 69 73 74 65 72 20 63 68 | 61 72 09 2a 70 3b 0a 7b |ister ch|ar.*p;.{|
|00004920| 0a 20 20 20 20 72 65 67 | 69 73 74 65 72 20 69 6e |. reg|ister in|
|00004930| 74 20 09 20 6c 61 73 74 | 3b 0a 20 20 20 20 72 65 |t . last|;. re|
|00004940| 67 69 73 74 65 72 20 69 | 6e 74 20 09 20 6d 61 74 |gister i|nt . mat|
|00004950| 63 68 65 64 3b 0a 20 20 | 20 20 72 65 67 69 73 74 |ched;. | regist|
|00004960| 65 72 20 69 6e 74 20 09 | 20 72 65 76 65 72 73 65 |er int .| reverse|
|00004970| 3b 0a 0a 20 20 20 20 66 | 6f 72 20 28 20 3b 20 2a |;.. f|or ( ; *|
|00004980| 70 3b 20 73 2b 2b 2c 20 | 70 2b 2b 29 0a 09 73 77 |p; s++, |p++)..sw|
|00004990| 69 74 63 68 20 28 2a 70 | 29 20 7b 0a 09 20 20 20 |itch (*p|) {.. |
|000049a0| 20 63 61 73 65 20 27 5c | 5c 27 3a 0a 09 09 2f 2a | case '\|\':.../*|
|000049b0| 20 4c 69 74 65 72 61 6c | 20 6d 61 74 63 68 20 77 | Literal| match w|
|000049c0| 69 74 68 20 66 6f 6c 6c | 6f 77 69 6e 67 20 63 68 |ith foll|owing ch|
|000049d0| 61 72 61 63 74 65 72 3b | 20 66 61 6c 6c 20 74 68 |aracter;| fall th|
|000049e0| 72 6f 75 67 68 2e 20 2a | 2f 0a 09 09 70 2b 2b 3b |rough. *|/...p++;|
|000049f0| 0a 09 20 20 20 20 64 65 | 66 61 75 6c 74 3a 0a 09 |.. de|fault:..|
|00004a00| 09 69 66 20 28 2a 73 20 | 21 3d 20 2a 70 29 0a 09 |.if (*s |!= *p)..|
|00004a10| 09 20 20 20 20 72 65 74 | 75 72 6e 28 46 41 4c 53 |. ret|urn(FALS|
|00004a20| 45 29 3b 0a 09 09 63 6f | 6e 74 69 6e 75 65 3b 0a |E);...co|ntinue;.|
|00004a30| 09 20 20 20 20 63 61 73 | 65 20 27 3f 27 3a 0a 09 |. cas|e '?':..|
|00004a40| 09 2f 2a 20 4d 61 74 63 | 68 20 61 6e 79 74 68 69 |./* Matc|h anythi|
|00004a50| 6e 67 2e 20 2a 2f 0a 09 | 09 69 66 20 28 2a 73 20 |ng. */..|.if (*s |
|00004a60| 3d 3d 20 27 5c 30 27 29 | 0a 09 09 20 20 20 20 72 |== '\0')|... r|
|00004a70| 65 74 75 72 6e 28 46 41 | 4c 53 45 29 3b 0a 09 09 |eturn(FA|LSE);...|
|00004a80| 63 6f 6e 74 69 6e 75 65 | 3b 0a 09 20 20 20 20 63 |continue|;.. c|
|00004a90| 61 73 65 20 27 2a 27 3a | 0a 09 09 2f 2a 20 54 72 |ase '*':|.../* Tr|
|00004aa0| 61 69 6c 69 6e 67 20 73 | 74 61 72 20 6d 61 74 63 |ailing s|tar matc|
|00004ab0| 68 65 73 20 65 76 65 72 | 79 74 68 69 6e 67 2e 20 |hes ever|ything. |
|00004ac0| 2a 2f 0a 09 09 72 65 74 | 75 72 6e 28 2a 2b 2b 70 |*/...ret|urn(*++p|
|00004ad0| 20 3f 20 53 74 61 72 28 | 73 2c 20 70 29 20 3a 20 | ? Star(|s, p) : |
|00004ae0| 54 52 55 45 29 3b 0a 09 | 20 20 20 20 63 61 73 65 |TRUE);..| case|
|00004af0| 20 27 5b 27 3a 0a 09 09 | 2f 2a 20 5b 5e 2e 2e 2e | '[':...|/* [^...|
|00004b00| 2e 5d 20 6d 65 61 6e 73 | 20 69 6e 76 65 72 73 65 |.] means| inverse|
|00004b10| 20 63 68 61 72 61 63 74 | 65 72 20 63 6c 61 73 73 | charact|er class|
|00004b20| 2e 20 2a 2f 0a 09 09 69 | 66 20 28 72 65 76 65 72 |. */...i|f (rever|
|00004b30| 73 65 20 3d 20 70 5b 31 | 5d 20 3d 3d 20 27 5e 27 |se = p[1|] == '^'|
|00004b40| 29 0a 09 09 20 20 20 20 | 70 2b 2b 3b 0a 09 09 66 |)... |p++;...f|
|00004b50| 6f 72 20 28 6c 61 73 74 | 20 3d 20 30 34 30 30 2c |or (last| = 0400,|
|00004b60| 20 6d 61 74 63 68 65 64 | 20 3d 20 46 41 4c 53 45 | matched| = FALSE|
|00004b70| 3b 20 2a 2b 2b 70 20 26 | 26 20 2a 70 20 21 3d 20 |; *++p &|& *p != |
|00004b80| 27 5d 27 3b 20 6c 61 73 | 74 20 3d 20 2a 70 29 0a |']'; las|t = *p).|
|00004b90| 09 09 20 20 20 20 2f 2a | 20 54 68 69 73 20 6e 65 |.. /*| This ne|
|00004ba0| 78 74 20 6c 69 6e 65 20 | 72 65 71 75 69 72 65 73 |xt line |requires|
|00004bb0| 20 61 20 67 6f 6f 64 20 | 43 20 63 6f 6d 70 69 6c | a good |C compil|
|00004bc0| 65 72 2e 20 2a 2f 0a 09 | 09 20 20 20 20 69 66 20 |er. */..|. if |
|00004bd0| 28 2a 70 20 3d 3d 20 27 | 2d 27 20 3f 20 2a 73 20 |(*p == '|-' ? *s |
|00004be0| 3c 3d 20 2a 2b 2b 70 20 | 26 26 20 2a 73 20 3e 3d |<= *++p |&& *s >=|
|00004bf0| 20 6c 61 73 74 20 3a 20 | 2a 73 20 3d 3d 20 2a 70 | last : |*s == *p|
|00004c00| 29 0a 09 09 09 6d 61 74 | 63 68 65 64 20 3d 20 54 |)....mat|ched = T|
|00004c10| 52 55 45 3b 0a 09 09 69 | 66 20 28 6d 61 74 63 68 |RUE;...i|f (match|
|00004c20| 65 64 20 3d 3d 20 72 65 | 76 65 72 73 65 29 0a 09 |ed == re|verse)..|
|00004c30| 09 20 20 20 20 72 65 74 | 75 72 6e 28 46 41 4c 53 |. ret|urn(FALS|
|00004c40| 45 29 3b 0a 09 09 63 6f | 6e 74 69 6e 75 65 3b 0a |E);...co|ntinue;.|
|00004c50| 09 7d 0a 0a 20 20 20 20 | 2f 2a 20 46 6f 72 20 22 |.}.. |/* For "|
|00004c60| 74 61 72 22 20 75 73 65 | 2c 20 6d 61 74 63 68 65 |tar" use|, matche|
|00004c70| 73 20 74 68 61 74 20 65 | 6e 64 20 61 74 20 61 20 |s that e|nd at a |
|00004c80| 73 6c 61 73 68 20 61 6c | 73 6f 20 77 6f 72 6b 2e |slash al|so work.|
|00004c90| 20 2d 2d 68 6f 70 74 6f | 61 64 21 67 6e 75 20 2a | --hopto|ad!gnu *|
|00004ca0| 2f 0a 20 20 20 20 72 65 | 74 75 72 6e 28 2a 73 20 |/. re|turn(*s |
|00004cb0| 3d 3d 20 27 5c 30 27 20 | 7c 7c 20 2a 73 20 3d 3d |== '\0' ||| *s ==|
|00004cc0| 20 27 2f 27 29 3b 0a 7d | 0a 0a 0a 23 69 66 64 65 | '/');.}|...#ifde|
|00004cd0| 66 09 54 45 53 54 0a 23 | 69 6e 63 6c 75 64 65 20 |f.TEST.#|include |
|00004ce0| 3c 73 74 64 69 6f 2e 68 | 3e 0a 0a 65 78 74 65 72 |<stdio.h|>..exter|
|00004cf0| 6e 20 63 68 61 72 09 2a | 67 65 74 73 28 29 3b 0a |n char.*|gets();.|
|00004d00| 0a 0a 6d 61 69 6e 28 29 | 0a 7b 0a 20 20 20 20 63 |..main()|.{. c|
|00004d10| 68 61 72 09 20 70 61 74 | 74 65 72 6e 5b 38 30 5d |har. pat|tern[80]|
|00004d20| 3b 0a 20 20 20 20 63 68 | 61 72 09 20 74 65 78 74 |;. ch|ar. text|
|00004d30| 5b 38 30 5d 3b 0a 0a 20 | 20 20 20 77 68 69 6c 65 |[80];.. | while|
|00004d40| 20 28 54 52 55 45 29 20 | 7b 0a 09 70 72 69 6e 74 | (TRUE) |{..print|
|00004d50| 66 28 22 45 6e 74 65 72 | 20 70 61 74 74 65 72 6e |f("Enter| pattern|
|00004d60| 3a 20 20 22 29 3b 0a 09 | 69 66 20 28 67 65 74 73 |: ");..|if (gets|
|00004d70| 28 70 61 74 74 65 72 6e | 29 20 3d 3d 20 4e 55 4c |(pattern|) == NUL|
|00004d80| 4c 29 0a 09 20 20 20 20 | 62 72 65 61 6b 3b 0a 09 |L).. |break;..|
|00004d90| 77 68 69 6c 65 20 28 54 | 52 55 45 29 20 7b 0a 09 |while (T|RUE) {..|
|00004da0| 20 20 20 20 70 72 69 6e | 74 66 28 22 45 6e 74 65 | prin|tf("Ente|
|00004db0| 72 20 74 65 78 74 3a 20 | 20 22 29 3b 0a 09 20 20 |r text: | ");.. |
|00004dc0| 20 20 69 66 20 28 67 65 | 74 73 28 74 65 78 74 29 | if (ge|ts(text)|
|00004dd0| 20 3d 3d 20 4e 55 4c 4c | 29 0a 09 09 65 78 69 74 | == NULL|)...exit|
|00004de0| 28 30 29 3b 0a 09 20 20 | 20 20 69 66 20 28 74 65 |(0);.. | if (te|
|00004df0| 78 74 5b 30 5d 20 3d 3d | 20 27 5c 30 27 29 0a 09 |xt[0] ==| '\0')..|
|00004e00| 09 2f 2a 20 42 6c 61 6e | 6b 20 6c 69 6e 65 3b 20 |./* Blan|k line; |
|00004e10| 67 6f 20 62 61 63 6b 20 | 61 6e 64 20 67 65 74 20 |go back |and get |
|00004e20| 61 20 6e 65 77 20 70 61 | 74 74 65 72 6e 2e 20 2a |a new pa|ttern. *|
|00004e30| 2f 0a 09 09 62 72 65 61 | 6b 3b 0a 09 20 20 20 20 |/...brea|k;.. |
|00004e40| 70 72 69 6e 74 66 28 22 | 20 20 20 20 20 20 25 64 |printf("| %d|
|00004e50| 5c 6e 22 2c 20 77 69 6c | 64 6d 61 74 28 74 65 78 |\n", wil|dmat(tex|
|00004e60| 74 2c 20 70 61 74 74 65 | 72 6e 29 29 3b 0a 09 7d |t, patte|rn));..}|
|00004e70| 0a 20 20 20 20 7d 0a 20 | 20 20 20 65 78 69 74 28 |. }. | exit(|
|00004e80| 30 29 3b 0a 7d 0a 23 65 | 6e 64 69 66 09 2f 2a 20 |0);.}.#e|ndif./* |
|00004e90| 54 45 53 54 20 2a 2f 0a | 53 48 41 52 5f 45 4f 46 |TEST */.|SHAR_EOF|
|00004ea0| 0a 69 66 20 74 65 73 74 | 20 2d 66 20 27 43 4f 50 |.if test| -f 'COP|
|00004eb0| 59 49 4e 47 27 0a 74 68 | 65 6e 0a 09 65 63 68 6f |YING'.th|en..echo|
|00004ec0| 20 73 68 61 72 3a 20 6f | 76 65 72 2d 77 72 69 74 | shar: o|ver-writ|
|00004ed0| 69 6e 67 20 65 78 69 73 | 74 69 6e 67 20 66 69 6c |ing exis|ting fil|
|00004ee0| 65 20 22 27 43 4f 50 59 | 49 4e 47 27 22 0a 66 69 |e "'COPY|ING'".fi|
|00004ef0| 0a 63 61 74 20 3c 3c 20 | 5c 53 48 41 52 5f 45 4f |.cat << |\SHAR_EO|
|00004f00| 46 20 3e 20 27 43 4f 50 | 59 49 4e 47 27 0a 0a 09 |F > 'COP|YING'...|
|00004f10| 09 20 20 20 20 47 4e 55 | 20 47 45 4e 45 52 41 4c |. GNU| GENERAL|
|00004f20| 20 50 55 42 4c 49 43 20 | 4c 49 43 45 4e 53 45 0a | PUBLIC |LICENSE.|
|00004f30| 09 09 20 20 20 20 20 56 | 65 72 73 69 6f 6e 20 31 |.. V|ersion 1|
|00004f40| 2c 20 46 65 62 72 75 61 | 72 79 20 31 39 38 39 0a |, Februa|ry 1989.|
|00004f50| 0a 20 43 6f 70 79 72 69 | 67 68 74 20 28 43 29 20 |. Copyri|ght (C) |
|00004f60| 31 39 38 39 20 46 72 65 | 65 20 53 6f 66 74 77 61 |1989 Fre|e Softwa|
|00004f70| 72 65 20 46 6f 75 6e 64 | 61 74 69 6f 6e 2c 20 49 |re Found|ation, I|
|00004f80| 6e 63 2e 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |nc.. | |
|00004f90| 20 20 20 20 20 20 20 20 | 36 37 35 20 4d 61 73 73 | |675 Mass|
|00004fa0| 20 41 76 65 2c 20 43 61 | 6d 62 72 69 64 67 65 2c | Ave, Ca|mbridge,|
|00004fb0| 20 4d 41 20 30 32 31 33 | 39 2c 20 55 53 41 0a 20 | MA 0213|9, USA. |
|00004fc0| 45 76 65 72 79 6f 6e 65 | 20 69 73 20 70 65 72 6d |Everyone| is perm|
|00004fd0| 69 74 74 65 64 20 74 6f | 20 63 6f 70 79 20 61 6e |itted to| copy an|
|00004fe0| 64 20 64 69 73 74 72 69 | 62 75 74 65 20 76 65 72 |d distri|bute ver|
|00004ff0| 62 61 74 69 6d 20 63 6f | 70 69 65 73 0a 20 6f 66 |batim co|pies. of|
|00005000| 20 74 68 69 73 20 6c 69 | 63 65 6e 73 65 20 64 6f | this li|cense do|
|00005010| 63 75 6d 65 6e 74 2c 20 | 62 75 74 20 63 68 61 6e |cument, |but chan|
|00005020| 67 69 6e 67 20 69 74 20 | 69 73 20 6e 6f 74 20 61 |ging it |is not a|
|00005030| 6c 6c 6f 77 65 64 2e 0a | 0a 09 09 09 20 20 20 20 |llowed..|.... |
|00005040| 50 72 65 61 6d 62 6c 65 | 0a 0a 20 20 54 68 65 20 |Preamble|.. The |
|00005050| 6c 69 63 65 6e 73 65 20 | 61 67 72 65 65 6d 65 6e |license |agreemen|
|00005060| 74 73 20 6f 66 20 6d 6f | 73 74 20 73 6f 66 74 77 |ts of mo|st softw|
|00005070| 61 72 65 20 63 6f 6d 70 | 61 6e 69 65 73 20 74 72 |are comp|anies tr|
|00005080| 79 20 74 6f 20 6b 65 65 | 70 20 75 73 65 72 73 0a |y to kee|p users.|
|00005090| 61 74 20 74 68 65 20 6d | 65 72 63 79 20 6f 66 20 |at the m|ercy of |
|000050a0| 74 68 6f 73 65 20 63 6f | 6d 70 61 6e 69 65 73 2e |those co|mpanies.|
|000050b0| 20 20 42 79 20 63 6f 6e | 74 72 61 73 74 2c 20 6f | By con|trast, o|
|000050c0| 75 72 20 47 65 6e 65 72 | 61 6c 20 50 75 62 6c 69 |ur Gener|al Publi|
|000050d0| 63 0a 4c 69 63 65 6e 73 | 65 20 69 73 20 69 6e 74 |c.Licens|e is int|
|000050e0| 65 6e 64 65 64 20 74 6f | 20 67 75 61 72 61 6e 74 |ended to| guarant|
|000050f0| 65 65 20 79 6f 75 72 20 | 66 72 65 65 64 6f 6d 20 |ee your |freedom |
|00005100| 74 6f 20 73 68 61 72 65 | 20 61 6e 64 20 63 68 61 |to share| and cha|
|00005110| 6e 67 65 20 66 72 65 65 | 0a 73 6f 66 74 77 61 72 |nge free|.softwar|
|00005120| 65 2d 2d 74 6f 20 6d 61 | 6b 65 20 73 75 72 65 20 |e--to ma|ke sure |
|00005130| 74 68 65 20 73 6f 66 74 | 77 61 72 65 20 69 73 20 |the soft|ware is |
|00005140| 66 72 65 65 20 66 6f 72 | 20 61 6c 6c 20 69 74 73 |free for| all its|
|00005150| 20 75 73 65 72 73 2e 20 | 20 54 68 65 0a 47 65 6e | users. | The.Gen|
|00005160| 65 72 61 6c 20 50 75 62 | 6c 69 63 20 4c 69 63 65 |eral Pub|lic Lice|
|00005170| 6e 73 65 20 61 70 70 6c | 69 65 73 20 74 6f 20 74 |nse appl|ies to t|
|00005180| 68 65 20 46 72 65 65 20 | 53 6f 66 74 77 61 72 65 |he Free |Software|
|00005190| 20 46 6f 75 6e 64 61 74 | 69 6f 6e 27 73 0a 73 6f | Foundat|ion's.so|
|000051a0| 66 74 77 61 72 65 20 61 | 6e 64 20 74 6f 20 61 6e |ftware a|nd to an|
|000051b0| 79 20 6f 74 68 65 72 20 | 70 72 6f 67 72 61 6d 20 |y other |program |
|000051c0| 77 68 6f 73 65 20 61 75 | 74 68 6f 72 73 20 63 6f |whose au|thors co|
|000051d0| 6d 6d 69 74 20 74 6f 20 | 75 73 69 6e 67 20 69 74 |mmit to |using it|
|000051e0| 2e 0a 59 6f 75 20 63 61 | 6e 20 75 73 65 20 69 74 |..You ca|n use it|
|000051f0| 20 66 6f 72 20 79 6f 75 | 72 20 70 72 6f 67 72 61 | for you|r progra|
|00005200| 6d 73 2c 20 74 6f 6f 2e | 0a 0a 20 20 57 68 65 6e |ms, too.|.. When|
|00005210| 20 77 65 20 73 70 65 61 | 6b 20 6f 66 20 66 72 65 | we spea|k of fre|
|00005220| 65 20 73 6f 66 74 77 61 | 72 65 2c 20 77 65 20 61 |e softwa|re, we a|
|00005230| 72 65 20 72 65 66 65 72 | 72 69 6e 67 20 74 6f 20 |re refer|ring to |
|00005240| 66 72 65 65 64 6f 6d 2c | 20 6e 6f 74 0a 70 72 69 |freedom,| not.pri|
|00005250| 63 65 2e 20 20 53 70 65 | 63 69 66 69 63 61 6c 6c |ce. Spe|cificall|
|00005260| 79 2c 20 74 68 65 20 47 | 65 6e 65 72 61 6c 20 50 |y, the G|eneral P|
|00005270| 75 62 6c 69 63 20 4c 69 | 63 65 6e 73 65 20 69 73 |ublic Li|cense is|
|00005280| 20 64 65 73 69 67 6e 65 | 64 20 74 6f 20 6d 61 6b | designe|d to mak|
|00005290| 65 0a 73 75 72 65 20 74 | 68 61 74 20 79 6f 75 20 |e.sure t|hat you |
|000052a0| 68 61 76 65 20 74 68 65 | 20 66 72 65 65 64 6f 6d |have the| freedom|
|000052b0| 20 74 6f 20 67 69 76 65 | 20 61 77 61 79 20 6f 72 | to give| away or|
|000052c0| 20 73 65 6c 6c 20 63 6f | 70 69 65 73 20 6f 66 20 | sell co|pies of |
|000052d0| 66 72 65 65 0a 73 6f 66 | 74 77 61 72 65 2c 20 74 |free.sof|tware, t|
|000052e0| 68 61 74 20 79 6f 75 20 | 72 65 63 65 69 76 65 20 |hat you |receive |
|000052f0| 73 6f 75 72 63 65 20 63 | 6f 64 65 20 6f 72 20 63 |source c|ode or c|
|00005300| 61 6e 20 67 65 74 20 69 | 74 20 69 66 20 79 6f 75 |an get i|t if you|
|00005310| 20 77 61 6e 74 20 69 74 | 2c 0a 74 68 61 74 20 79 | want it|,.that y|
|00005320| 6f 75 20 63 61 6e 20 63 | 68 61 6e 67 65 20 74 68 |ou can c|hange th|
|00005330| 65 20 73 6f 66 74 77 61 | 72 65 20 6f 72 20 75 73 |e softwa|re or us|
|00005340| 65 20 70 69 65 63 65 73 | 20 6f 66 20 69 74 20 69 |e pieces| of it i|
|00005350| 6e 20 6e 65 77 20 66 72 | 65 65 0a 70 72 6f 67 72 |n new fr|ee.progr|
|00005360| 61 6d 73 3b 20 61 6e 64 | 20 74 68 61 74 20 79 6f |ams; and| that yo|
|00005370| 75 20 6b 6e 6f 77 20 79 | 6f 75 20 63 61 6e 20 64 |u know y|ou can d|
|00005380| 6f 20 74 68 65 73 65 20 | 74 68 69 6e 67 73 2e 0a |o these |things..|
|00005390| 0a 20 20 54 6f 20 70 72 | 6f 74 65 63 74 20 79 6f |. To pr|otect yo|
|000053a0| 75 72 20 72 69 67 68 74 | 73 2c 20 77 65 20 6e 65 |ur right|s, we ne|
|000053b0| 65 64 20 74 6f 20 6d 61 | 6b 65 20 72 65 73 74 72 |ed to ma|ke restr|
|000053c0| 69 63 74 69 6f 6e 73 20 | 74 68 61 74 20 66 6f 72 |ictions |that for|
|000053d0| 62 69 64 0a 61 6e 79 6f | 6e 65 20 74 6f 20 64 65 |bid.anyo|ne to de|
|000053e0| 6e 79 20 79 6f 75 20 74 | 68 65 73 65 20 72 69 67 |ny you t|hese rig|
|000053f0| 68 74 73 20 6f 72 20 74 | 6f 20 61 73 6b 20 79 6f |hts or t|o ask yo|
|00005400| 75 20 74 6f 20 73 75 72 | 72 65 6e 64 65 72 20 74 |u to sur|render t|
|00005410| 68 65 20 72 69 67 68 74 | 73 2e 0a 54 68 65 73 65 |he right|s..These|
|00005420| 20 72 65 73 74 72 69 63 | 74 69 6f 6e 73 20 74 72 | restric|tions tr|
|00005430| 61 6e 73 6c 61 74 65 20 | 74 6f 20 63 65 72 74 61 |anslate |to certa|
|00005440| 69 6e 20 72 65 73 70 6f | 6e 73 69 62 69 6c 69 74 |in respo|nsibilit|
|00005450| 69 65 73 20 66 6f 72 20 | 79 6f 75 20 69 66 20 79 |ies for |you if y|
|00005460| 6f 75 0a 64 69 73 74 72 | 69 62 75 74 65 20 63 6f |ou.distr|ibute co|
|00005470| 70 69 65 73 20 6f 66 20 | 74 68 65 20 73 6f 66 74 |pies of |the soft|
|00005480| 77 61 72 65 2c 20 6f 72 | 20 69 66 20 79 6f 75 20 |ware, or| if you |
|00005490| 6d 6f 64 69 66 79 20 69 | 74 2e 0a 0a 20 20 46 6f |modify i|t... Fo|
|000054a0| 72 20 65 78 61 6d 70 6c | 65 2c 20 69 66 20 79 6f |r exampl|e, if yo|
|000054b0| 75 20 64 69 73 74 72 69 | 62 75 74 65 20 63 6f 70 |u distri|bute cop|
|000054c0| 69 65 73 20 6f 66 20 61 | 20 73 75 63 68 20 61 20 |ies of a| such a |
|000054d0| 70 72 6f 67 72 61 6d 2c | 20 77 68 65 74 68 65 72 |program,| whether|
|000054e0| 0a 67 72 61 74 69 73 20 | 6f 72 20 66 6f 72 20 61 |.gratis |or for a|
|000054f0| 20 66 65 65 2c 20 79 6f | 75 20 6d 75 73 74 20 67 | fee, yo|u must g|
|00005500| 69 76 65 20 74 68 65 20 | 72 65 63 69 70 69 65 6e |ive the |recipien|
|00005510| 74 73 20 61 6c 6c 20 74 | 68 65 20 72 69 67 68 74 |ts all t|he right|
|00005520| 73 20 74 68 61 74 0a 79 | 6f 75 20 68 61 76 65 2e |s that.y|ou have.|
|00005530| 20 20 59 6f 75 20 6d 75 | 73 74 20 6d 61 6b 65 20 | You mu|st make |
|00005540| 73 75 72 65 20 74 68 61 | 74 20 74 68 65 79 2c 20 |sure tha|t they, |
|00005550| 74 6f 6f 2c 20 72 65 63 | 65 69 76 65 20 6f 72 20 |too, rec|eive or |
|00005560| 63 61 6e 20 67 65 74 20 | 74 68 65 0a 73 6f 75 72 |can get |the.sour|
|00005570| 63 65 20 63 6f 64 65 2e | 20 20 41 6e 64 20 79 6f |ce code.| And yo|
|00005580| 75 20 6d 75 73 74 20 74 | 65 6c 6c 20 74 68 65 6d |u must t|ell them|
|00005590| 20 74 68 65 69 72 20 72 | 69 67 68 74 73 2e 0a 0a | their r|ights...|
|000055a0| 20 20 57 65 20 70 72 6f | 74 65 63 74 20 79 6f 75 | We pro|tect you|
|000055b0| 72 20 72 69 67 68 74 73 | 20 77 69 74 68 20 74 77 |r rights| with tw|
|000055c0| 6f 20 73 74 65 70 73 3a | 20 28 31 29 20 63 6f 70 |o steps:| (1) cop|
|000055d0| 79 72 69 67 68 74 20 74 | 68 65 20 73 6f 66 74 77 |yright t|he softw|
|000055e0| 61 72 65 2c 20 61 6e 64 | 0a 28 32 29 20 6f 66 66 |are, and|.(2) off|
|000055f0| 65 72 20 79 6f 75 20 74 | 68 69 73 20 6c 69 63 65 |er you t|his lice|
|00005600| 6e 73 65 20 77 68 69 63 | 68 20 67 69 76 65 73 20 |nse whic|h gives |
|00005610| 79 6f 75 20 6c 65 67 61 | 6c 20 70 65 72 6d 69 73 |you lega|l permis|
|00005620| 73 69 6f 6e 20 74 6f 20 | 63 6f 70 79 2c 0a 64 69 |sion to |copy,.di|
|00005630| 73 74 72 69 62 75 74 65 | 20 61 6e 64 2f 6f 72 20 |stribute| and/or |
|00005640| 6d 6f 64 69 66 79 20 74 | 68 65 20 73 6f 66 74 77 |modify t|he softw|
|00005650| 61 72 65 2e 0a 0a 20 20 | 41 6c 73 6f 2c 20 66 6f |are... |Also, fo|
|00005660| 72 20 65 61 63 68 20 61 | 75 74 68 6f 72 27 73 20 |r each a|uthor's |
|00005670| 70 72 6f 74 65 63 74 69 | 6f 6e 20 61 6e 64 20 6f |protecti|on and o|
|00005680| 75 72 73 2c 20 77 65 20 | 77 61 6e 74 20 74 6f 20 |urs, we |want to |
|00005690| 6d 61 6b 65 20 63 65 72 | 74 61 69 6e 0a 74 68 61 |make cer|tain.tha|
|000056a0| 74 20 65 76 65 72 79 6f | 6e 65 20 75 6e 64 65 72 |t everyo|ne under|
|000056b0| 73 74 61 6e 64 73 20 74 | 68 61 74 20 74 68 65 72 |stands t|hat ther|
|000056c0| 65 20 69 73 20 6e 6f 20 | 77 61 72 72 61 6e 74 79 |e is no |warranty|
|000056d0| 20 66 6f 72 20 74 68 69 | 73 20 66 72 65 65 0a 73 | for thi|s free.s|
|000056e0| 6f 66 74 77 61 72 65 2e | 20 20 49 66 20 74 68 65 |oftware.| If the|
|000056f0| 20 73 6f 66 74 77 61 72 | 65 20 69 73 20 6d 6f 64 | softwar|e is mod|
|00005700| 69 66 69 65 64 20 62 79 | 20 73 6f 6d 65 6f 6e 65 |ified by| someone|
|00005710| 20 65 6c 73 65 20 61 6e | 64 20 70 61 73 73 65 64 | else an|d passed|
|00005720| 20 6f 6e 2c 20 77 65 0a | 77 61 6e 74 20 69 74 73 | on, we.|want its|
|00005730| 20 72 65 63 69 70 69 65 | 6e 74 73 20 74 6f 20 6b | recipie|nts to k|
|00005740| 6e 6f 77 20 74 68 61 74 | 20 77 68 61 74 20 74 68 |now that| what th|
|00005750| 65 79 20 68 61 76 65 20 | 69 73 20 6e 6f 74 20 74 |ey have |is not t|
|00005760| 68 65 20 6f 72 69 67 69 | 6e 61 6c 2c 20 73 6f 0a |he origi|nal, so.|
|00005770| 74 68 61 74 20 61 6e 79 | 20 70 72 6f 62 6c 65 6d |that any| problem|
|00005780| 73 20 69 6e 74 72 6f 64 | 75 63 65 64 20 62 79 20 |s introd|uced by |
|00005790| 6f 74 68 65 72 73 20 77 | 69 6c 6c 20 6e 6f 74 20 |others w|ill not |
|000057a0| 72 65 66 6c 65 63 74 20 | 6f 6e 20 74 68 65 20 6f |reflect |on the o|
|000057b0| 72 69 67 69 6e 61 6c 0a | 61 75 74 68 6f 72 73 27 |riginal.|authors'|
|000057c0| 20 72 65 70 75 74 61 74 | 69 6f 6e 73 2e 0a 0a 20 | reputat|ions... |
|000057d0| 20 54 68 65 20 70 72 65 | 63 69 73 65 20 74 65 72 | The pre|cise ter|
|000057e0| 6d 73 20 61 6e 64 20 63 | 6f 6e 64 69 74 69 6f 6e |ms and c|ondition|
|000057f0| 73 20 66 6f 72 20 63 6f | 70 79 69 6e 67 2c 20 64 |s for co|pying, d|
|00005800| 69 73 74 72 69 62 75 74 | 69 6f 6e 20 61 6e 64 0a |istribut|ion and.|
|00005810| 6d 6f 64 69 66 69 63 61 | 74 69 6f 6e 20 66 6f 6c |modifica|tion fol|
|00005820| 6c 6f 77 2e 0a 0c 0a 09 | 09 20 20 20 20 47 4e 55 |low.....|. GNU|
|00005830| 20 47 45 4e 45 52 41 4c | 20 50 55 42 4c 49 43 20 | GENERAL| PUBLIC |
|00005840| 4c 49 43 45 4e 53 45 0a | 20 20 20 54 45 52 4d 53 |LICENSE.| TERMS|
|00005850| 20 41 4e 44 20 43 4f 4e | 44 49 54 49 4f 4e 53 20 | AND CON|DITIONS |
|00005860| 46 4f 52 20 43 4f 50 59 | 49 4e 47 2c 20 44 49 53 |FOR COPY|ING, DIS|
|00005870| 54 52 49 42 55 54 49 4f | 4e 20 41 4e 44 20 4d 4f |TRIBUTIO|N AND MO|
|00005880| 44 49 46 49 43 41 54 49 | 4f 4e 0a 0a 20 20 30 2e |DIFICATI|ON.. 0.|
|00005890| 20 54 68 69 73 20 4c 69 | 63 65 6e 73 65 20 41 67 | This Li|cense Ag|
|000058a0| 72 65 65 6d 65 6e 74 20 | 61 70 70 6c 69 65 73 20 |reement |applies |
|000058b0| 74 6f 20 61 6e 79 20 70 | 72 6f 67 72 61 6d 20 6f |to any p|rogram o|
|000058c0| 72 20 6f 74 68 65 72 20 | 77 6f 72 6b 20 77 68 69 |r other |work whi|
|000058d0| 63 68 0a 63 6f 6e 74 61 | 69 6e 73 20 61 20 6e 6f |ch.conta|ins a no|
|000058e0| 74 69 63 65 20 70 6c 61 | 63 65 64 20 62 79 20 74 |tice pla|ced by t|
|000058f0| 68 65 20 63 6f 70 79 72 | 69 67 68 74 20 68 6f 6c |he copyr|ight hol|
|00005900| 64 65 72 20 73 61 79 69 | 6e 67 20 69 74 20 6d 61 |der sayi|ng it ma|
|00005910| 79 20 62 65 0a 64 69 73 | 74 72 69 62 75 74 65 64 |y be.dis|tributed|
|00005920| 20 75 6e 64 65 72 20 74 | 68 65 20 74 65 72 6d 73 | under t|he terms|
|00005930| 20 6f 66 20 74 68 69 73 | 20 47 65 6e 65 72 61 6c | of this| General|
|00005940| 20 50 75 62 6c 69 63 20 | 4c 69 63 65 6e 73 65 2e | Public |License.|
|00005950| 20 20 54 68 65 0a 22 50 | 72 6f 67 72 61 6d 22 2c | The."P|rogram",|
|00005960| 20 62 65 6c 6f 77 2c 20 | 72 65 66 65 72 73 20 74 | below, |refers t|
|00005970| 6f 20 61 6e 79 20 73 75 | 63 68 20 70 72 6f 67 72 |o any su|ch progr|
|00005980| 61 6d 20 6f 72 20 77 6f | 72 6b 2c 20 61 6e 64 20 |am or wo|rk, and |
|00005990| 61 20 22 77 6f 72 6b 20 | 62 61 73 65 64 0a 6f 6e |a "work |based.on|
|000059a0| 20 74 68 65 20 50 72 6f | 67 72 61 6d 22 20 6d 65 | the Pro|gram" me|
|000059b0| 61 6e 73 20 65 69 74 68 | 65 72 20 74 68 65 20 50 |ans eith|er the P|
|000059c0| 72 6f 67 72 61 6d 20 6f | 72 20 61 6e 79 20 77 6f |rogram o|r any wo|
|000059d0| 72 6b 20 63 6f 6e 74 61 | 69 6e 69 6e 67 20 74 68 |rk conta|ining th|
|000059e0| 65 0a 50 72 6f 67 72 61 | 6d 20 6f 72 20 61 20 70 |e.Progra|m or a p|
|000059f0| 6f 72 74 69 6f 6e 20 6f | 66 20 69 74 2c 20 65 69 |ortion o|f it, ei|
|00005a00| 74 68 65 72 20 76 65 72 | 62 61 74 69 6d 20 6f 72 |ther ver|batim or|
|00005a10| 20 77 69 74 68 20 6d 6f | 64 69 66 69 63 61 74 69 | with mo|dificati|
|00005a20| 6f 6e 73 2e 20 20 45 61 | 63 68 0a 6c 69 63 65 6e |ons. Ea|ch.licen|
|00005a30| 73 65 65 20 69 73 20 61 | 64 64 72 65 73 73 65 64 |see is a|ddressed|
|00005a40| 20 61 73 20 22 79 6f 75 | 22 2e 0a 0a 20 20 31 2e | as "you|"... 1.|
|00005a50| 20 59 6f 75 20 6d 61 79 | 20 63 6f 70 79 20 61 6e | You may| copy an|
|00005a60| 64 20 64 69 73 74 72 69 | 62 75 74 65 20 76 65 72 |d distri|bute ver|
|00005a70| 62 61 74 69 6d 20 63 6f | 70 69 65 73 20 6f 66 20 |batim co|pies of |
|00005a80| 74 68 65 20 50 72 6f 67 | 72 61 6d 27 73 20 73 6f |the Prog|ram's so|
|00005a90| 75 72 63 65 0a 63 6f 64 | 65 20 61 73 20 79 6f 75 |urce.cod|e as you|
|00005aa0| 20 72 65 63 65 69 76 65 | 20 69 74 2c 20 69 6e 20 | receive| it, in |
|00005ab0| 61 6e 79 20 6d 65 64 69 | 75 6d 2c 20 70 72 6f 76 |any medi|um, prov|
|00005ac0| 69 64 65 64 20 74 68 61 | 74 20 79 6f 75 20 63 6f |ided tha|t you co|
|00005ad0| 6e 73 70 69 63 75 6f 75 | 73 6c 79 20 61 6e 64 0a |nspicuou|sly and.|
|00005ae0| 61 70 70 72 6f 70 72 69 | 61 74 65 6c 79 20 70 75 |appropri|ately pu|
|00005af0| 62 6c 69 73 68 20 6f 6e | 20 65 61 63 68 20 63 6f |blish on| each co|
|00005b00| 70 79 20 61 6e 20 61 70 | 70 72 6f 70 72 69 61 74 |py an ap|propriat|
|00005b10| 65 20 63 6f 70 79 72 69 | 67 68 74 20 6e 6f 74 69 |e copyri|ght noti|
|00005b20| 63 65 20 61 6e 64 0a 64 | 69 73 63 6c 61 69 6d 65 |ce and.d|isclaime|
|00005b30| 72 20 6f 66 20 77 61 72 | 72 61 6e 74 79 3b 20 6b |r of war|ranty; k|
|00005b40| 65 65 70 20 69 6e 74 61 | 63 74 20 61 6c 6c 20 74 |eep inta|ct all t|
|00005b50| 68 65 20 6e 6f 74 69 63 | 65 73 20 74 68 61 74 20 |he notic|es that |
|00005b60| 72 65 66 65 72 20 74 6f | 20 74 68 69 73 0a 47 65 |refer to| this.Ge|
|00005b70| 6e 65 72 61 6c 20 50 75 | 62 6c 69 63 20 4c 69 63 |neral Pu|blic Lic|
|00005b80| 65 6e 73 65 20 61 6e 64 | 20 74 6f 20 74 68 65 20 |ense and| to the |
|00005b90| 61 62 73 65 6e 63 65 20 | 6f 66 20 61 6e 79 20 77 |absence |of any w|
|00005ba0| 61 72 72 61 6e 74 79 3b | 20 61 6e 64 20 67 69 76 |arranty;| and giv|
|00005bb0| 65 20 61 6e 79 0a 6f 74 | 68 65 72 20 72 65 63 69 |e any.ot|her reci|
|00005bc0| 70 69 65 6e 74 73 20 6f | 66 20 74 68 65 20 50 72 |pients o|f the Pr|
|00005bd0| 6f 67 72 61 6d 20 61 20 | 63 6f 70 79 20 6f 66 20 |ogram a |copy of |
|00005be0| 74 68 69 73 20 47 65 6e | 65 72 61 6c 20 50 75 62 |this Gen|eral Pub|
|00005bf0| 6c 69 63 20 4c 69 63 65 | 6e 73 65 0a 61 6c 6f 6e |lic Lice|nse.alon|
|00005c00| 67 20 77 69 74 68 20 74 | 68 65 20 50 72 6f 67 72 |g with t|he Progr|
|00005c10| 61 6d 2e 20 20 59 6f 75 | 20 6d 61 79 20 63 68 61 |am. You| may cha|
|00005c20| 72 67 65 20 61 20 66 65 | 65 20 66 6f 72 20 74 68 |rge a fe|e for th|
|00005c30| 65 20 70 68 79 73 69 63 | 61 6c 20 61 63 74 20 6f |e physic|al act o|
|00005c40| 66 0a 74 72 61 6e 73 66 | 65 72 72 69 6e 67 20 61 |f.transf|erring a|
|00005c50| 20 63 6f 70 79 2e 0a 0a | 20 20 32 2e 20 59 6f 75 | copy...| 2. You|
|00005c60| 20 6d 61 79 20 6d 6f 64 | 69 66 79 20 79 6f 75 72 | may mod|ify your|
|00005c70| 20 63 6f 70 79 20 6f 72 | 20 63 6f 70 69 65 73 20 | copy or| copies |
|00005c80| 6f 66 20 74 68 65 20 50 | 72 6f 67 72 61 6d 20 6f |of the P|rogram o|
|00005c90| 72 20 61 6e 79 20 70 6f | 72 74 69 6f 6e 20 6f 66 |r any po|rtion of|
|00005ca0| 0a 69 74 2c 20 61 6e 64 | 20 63 6f 70 79 20 61 6e |.it, and| copy an|
|00005cb0| 64 20 64 69 73 74 72 69 | 62 75 74 65 20 73 75 63 |d distri|bute suc|
|00005cc0| 68 20 6d 6f 64 69 66 69 | 63 61 74 69 6f 6e 73 20 |h modifi|cations |
|00005cd0| 75 6e 64 65 72 20 74 68 | 65 20 74 65 72 6d 73 20 |under th|e terms |
|00005ce0| 6f 66 20 50 61 72 61 67 | 72 61 70 68 0a 31 20 61 |of Parag|raph.1 a|
|00005cf0| 62 6f 76 65 2c 20 70 72 | 6f 76 69 64 65 64 20 74 |bove, pr|ovided t|
|00005d00| 68 61 74 20 79 6f 75 20 | 61 6c 73 6f 20 64 6f 20 |hat you |also do |
|00005d10| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 3a 0a 0a |the foll|owing:..|
|00005d20| 20 20 20 20 61 29 20 63 | 61 75 73 65 20 74 68 65 | a) c|ause the|
|00005d30| 20 6d 6f 64 69 66 69 65 | 64 20 66 69 6c 65 73 20 | modifie|d files |
|00005d40| 74 6f 20 63 61 72 72 79 | 20 70 72 6f 6d 69 6e 65 |to carry| promine|
|00005d50| 6e 74 20 6e 6f 74 69 63 | 65 73 20 73 74 61 74 69 |nt notic|es stati|
|00005d60| 6e 67 20 74 68 61 74 0a | 20 20 20 20 79 6f 75 20 |ng that.| you |
|00005d70| 63 68 61 6e 67 65 64 20 | 74 68 65 20 66 69 6c 65 |changed |the file|
|00005d80| 73 20 61 6e 64 20 74 68 | 65 20 64 61 74 65 20 6f |s and th|e date o|
|00005d90| 66 20 61 6e 79 20 63 68 | 61 6e 67 65 3b 20 61 6e |f any ch|ange; an|
|00005da0| 64 0a 0a 20 20 20 20 62 | 29 20 63 61 75 73 65 20 |d.. b|) cause |
|00005db0| 74 68 65 20 77 68 6f 6c | 65 20 6f 66 20 61 6e 79 |the whol|e of any|
|00005dc0| 20 77 6f 72 6b 20 74 68 | 61 74 20 79 6f 75 20 64 | work th|at you d|
|00005dd0| 69 73 74 72 69 62 75 74 | 65 20 6f 72 20 70 75 62 |istribut|e or pub|
|00005de0| 6c 69 73 68 2c 20 74 68 | 61 74 0a 20 20 20 20 69 |lish, th|at. i|
|00005df0| 6e 20 77 68 6f 6c 65 20 | 6f 72 20 69 6e 20 70 61 |n whole |or in pa|
|00005e00| 72 74 20 63 6f 6e 74 61 | 69 6e 73 20 74 68 65 20 |rt conta|ins the |
|00005e10| 50 72 6f 67 72 61 6d 20 | 6f 72 20 61 6e 79 20 70 |Program |or any p|
|00005e20| 61 72 74 20 74 68 65 72 | 65 6f 66 2c 20 65 69 74 |art ther|eof, eit|
|00005e30| 68 65 72 0a 20 20 20 20 | 77 69 74 68 20 6f 72 20 |her. |with or |
|00005e40| 77 69 74 68 6f 75 74 20 | 6d 6f 64 69 66 69 63 61 |without |modifica|
|00005e50| 74 69 6f 6e 73 2c 20 74 | 6f 20 62 65 20 6c 69 63 |tions, t|o be lic|
|00005e60| 65 6e 73 65 64 20 61 74 | 20 6e 6f 20 63 68 61 72 |ensed at| no char|
|00005e70| 67 65 20 74 6f 20 61 6c | 6c 0a 20 20 20 20 74 68 |ge to al|l. th|
|00005e80| 69 72 64 20 70 61 72 74 | 69 65 73 20 75 6e 64 65 |ird part|ies unde|
|00005e90| 72 20 74 68 65 20 74 65 | 72 6d 73 20 6f 66 20 74 |r the te|rms of t|
|00005ea0| 68 69 73 20 47 65 6e 65 | 72 61 6c 20 50 75 62 6c |his Gene|ral Publ|
|00005eb0| 69 63 20 4c 69 63 65 6e | 73 65 20 28 65 78 63 65 |ic Licen|se (exce|
|00005ec0| 70 74 0a 20 20 20 20 74 | 68 61 74 20 79 6f 75 20 |pt. t|hat you |
|00005ed0| 6d 61 79 20 63 68 6f 6f | 73 65 20 74 6f 20 67 72 |may choo|se to gr|
|00005ee0| 61 6e 74 20 77 61 72 72 | 61 6e 74 79 20 70 72 6f |ant warr|anty pro|
|00005ef0| 74 65 63 74 69 6f 6e 20 | 74 6f 20 73 6f 6d 65 20 |tection |to some |
|00005f00| 6f 72 20 61 6c 6c 0a 20 | 20 20 20 74 68 69 72 64 |or all. | third|
|00005f10| 20 70 61 72 74 69 65 73 | 2c 20 61 74 20 79 6f 75 | parties|, at you|
|00005f20| 72 20 6f 70 74 69 6f 6e | 29 2e 0a 0a 20 20 20 20 |r option|)... |
|00005f30| 63 29 20 49 66 20 74 68 | 65 20 6d 6f 64 69 66 69 |c) If th|e modifi|
|00005f40| 65 64 20 70 72 6f 67 72 | 61 6d 20 6e 6f 72 6d 61 |ed progr|am norma|
|00005f50| 6c 6c 79 20 72 65 61 64 | 73 20 63 6f 6d 6d 61 6e |lly read|s comman|
|00005f60| 64 73 20 69 6e 74 65 72 | 61 63 74 69 76 65 6c 79 |ds inter|actively|
|00005f70| 20 77 68 65 6e 0a 20 20 | 20 20 72 75 6e 2c 20 79 | when. | run, y|
|00005f80| 6f 75 20 6d 75 73 74 20 | 63 61 75 73 65 20 69 74 |ou must |cause it|
|00005f90| 2c 20 77 68 65 6e 20 73 | 74 61 72 74 65 64 20 72 |, when s|tarted r|
|00005fa0| 75 6e 6e 69 6e 67 20 66 | 6f 72 20 73 75 63 68 20 |unning f|or such |
|00005fb0| 69 6e 74 65 72 61 63 74 | 69 76 65 20 75 73 65 0a |interact|ive use.|
|00005fc0| 20 20 20 20 69 6e 20 74 | 68 65 20 73 69 6d 70 6c | in t|he simpl|
|00005fd0| 65 73 74 20 61 6e 64 20 | 6d 6f 73 74 20 75 73 75 |est and |most usu|
|00005fe0| 61 6c 20 77 61 79 2c 20 | 74 6f 20 70 72 69 6e 74 |al way, |to print|
|00005ff0| 20 6f 72 20 64 69 73 70 | 6c 61 79 20 61 6e 0a 20 | or disp|lay an. |
|00006000| 20 20 20 61 6e 6e 6f 75 | 6e 63 65 6d 65 6e 74 20 | annou|ncement |
|00006010| 69 6e 63 6c 75 64 69 6e | 67 20 61 6e 20 61 70 70 |includin|g an app|
|00006020| 72 6f 70 72 69 61 74 65 | 20 63 6f 70 79 72 69 67 |ropriate| copyrig|
|00006030| 68 74 20 6e 6f 74 69 63 | 65 20 61 6e 64 20 61 20 |ht notic|e and a |
|00006040| 6e 6f 74 69 63 65 0a 20 | 20 20 20 74 68 61 74 20 |notice. | that |
|00006050| 74 68 65 72 65 20 69 73 | 20 6e 6f 20 77 61 72 72 |there is| no warr|
|00006060| 61 6e 74 79 20 28 6f 72 | 20 65 6c 73 65 2c 20 73 |anty (or| else, s|
|00006070| 61 79 69 6e 67 20 74 68 | 61 74 20 79 6f 75 20 70 |aying th|at you p|
|00006080| 72 6f 76 69 64 65 20 61 | 0a 20 20 20 20 77 61 72 |rovide a|. war|
|00006090| 72 61 6e 74 79 29 20 61 | 6e 64 20 74 68 61 74 20 |ranty) a|nd that |
|000060a0| 75 73 65 72 73 20 6d 61 | 79 20 72 65 64 69 73 74 |users ma|y redist|
|000060b0| 72 69 62 75 74 65 20 74 | 68 65 20 70 72 6f 67 72 |ribute t|he progr|
|000060c0| 61 6d 20 75 6e 64 65 72 | 20 74 68 65 73 65 0a 20 |am under| these. |
|000060d0| 20 20 20 63 6f 6e 64 69 | 74 69 6f 6e 73 2c 20 61 | condi|tions, a|
|000060e0| 6e 64 20 74 65 6c 6c 69 | 6e 67 20 74 68 65 20 75 |nd telli|ng the u|
|000060f0| 73 65 72 20 68 6f 77 20 | 74 6f 20 76 69 65 77 20 |ser how |to view |
|00006100| 61 20 63 6f 70 79 20 6f | 66 20 74 68 69 73 20 47 |a copy o|f this G|
|00006110| 65 6e 65 72 61 6c 0a 20 | 20 20 20 50 75 62 6c 69 |eneral. | Publi|
|00006120| 63 20 4c 69 63 65 6e 73 | 65 2e 0a 0a 20 20 20 20 |c Licens|e... |
|00006130| 64 29 20 59 6f 75 20 6d | 61 79 20 63 68 61 72 67 |d) You m|ay charg|
|00006140| 65 20 61 20 66 65 65 20 | 66 6f 72 20 74 68 65 20 |e a fee |for the |
|00006150| 70 68 79 73 69 63 61 6c | 20 61 63 74 20 6f 66 20 |physical| act of |
|00006160| 74 72 61 6e 73 66 65 72 | 72 69 6e 67 20 61 0a 20 |transfer|ring a. |
|00006170| 20 20 20 63 6f 70 79 2c | 20 61 6e 64 20 79 6f 75 | copy,| and you|
|00006180| 20 6d 61 79 20 61 74 20 | 79 6f 75 72 20 6f 70 74 | may at |your opt|
|00006190| 69 6f 6e 20 6f 66 66 65 | 72 20 77 61 72 72 61 6e |ion offe|r warran|
|000061a0| 74 79 20 70 72 6f 74 65 | 63 74 69 6f 6e 20 69 6e |ty prote|ction in|
|000061b0| 0a 20 20 20 20 65 78 63 | 68 61 6e 67 65 20 66 6f |. exc|hange fo|
|000061c0| 72 20 61 20 66 65 65 2e | 0a 0a 4d 65 72 65 20 61 |r a fee.|..Mere a|
|000061d0| 67 67 72 65 67 61 74 69 | 6f 6e 20 6f 66 20 61 6e |ggregati|on of an|
|000061e0| 6f 74 68 65 72 20 69 6e | 64 65 70 65 6e 64 65 6e |other in|dependen|
|000061f0| 74 20 77 6f 72 6b 20 77 | 69 74 68 20 74 68 65 20 |t work w|ith the |
|00006200| 50 72 6f 67 72 61 6d 20 | 28 6f 72 20 69 74 73 0a |Program |(or its.|
|00006210| 64 65 72 69 76 61 74 69 | 76 65 29 20 6f 6e 20 61 |derivati|ve) on a|
|00006220| 20 76 6f 6c 75 6d 65 20 | 6f 66 20 61 20 73 74 6f | volume |of a sto|
|00006230| 72 61 67 65 20 6f 72 20 | 64 69 73 74 72 69 62 75 |rage or |distribu|
|00006240| 74 69 6f 6e 20 6d 65 64 | 69 75 6d 20 64 6f 65 73 |tion med|ium does|
|00006250| 20 6e 6f 74 20 62 72 69 | 6e 67 0a 74 68 65 20 6f | not bri|ng.the o|
|00006260| 74 68 65 72 20 77 6f 72 | 6b 20 75 6e 64 65 72 20 |ther wor|k under |
|00006270| 74 68 65 20 73 63 6f 70 | 65 20 6f 66 20 74 68 65 |the scop|e of the|
|00006280| 73 65 20 74 65 72 6d 73 | 2e 0a 0c 0a 20 20 33 2e |se terms|.... 3.|
|00006290| 20 59 6f 75 20 6d 61 79 | 20 63 6f 70 79 20 61 6e | You may| copy an|
|000062a0| 64 20 64 69 73 74 72 69 | 62 75 74 65 20 74 68 65 |d distri|bute the|
|000062b0| 20 50 72 6f 67 72 61 6d | 20 28 6f 72 20 61 20 70 | Program| (or a p|
|000062c0| 6f 72 74 69 6f 6e 20 6f | 72 20 64 65 72 69 76 61 |ortion o|r deriva|
|000062d0| 74 69 76 65 20 6f 66 0a | 69 74 2c 20 75 6e 64 65 |tive of.|it, unde|
|000062e0| 72 20 50 61 72 61 67 72 | 61 70 68 20 32 29 20 69 |r Paragr|aph 2) i|
|000062f0| 6e 20 6f 62 6a 65 63 74 | 20 63 6f 64 65 20 6f 72 |n object| code or|
|00006300| 20 65 78 65 63 75 74 61 | 62 6c 65 20 66 6f 72 6d | executa|ble form|
|00006310| 20 75 6e 64 65 72 20 74 | 68 65 20 74 65 72 6d 73 | under t|he terms|
|00006320| 20 6f 66 0a 50 61 72 61 | 67 72 61 70 68 73 20 31 | of.Para|graphs 1|
|00006330| 20 61 6e 64 20 32 20 61 | 62 6f 76 65 20 70 72 6f | and 2 a|bove pro|
|00006340| 76 69 64 65 64 20 74 68 | 61 74 20 79 6f 75 20 61 |vided th|at you a|
|00006350| 6c 73 6f 20 64 6f 20 6f | 6e 65 20 6f 66 20 74 68 |lso do o|ne of th|
|00006360| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 3a 0a 0a 20 20 |e follow|ing:.. |
|00006370| 20 20 61 29 20 61 63 63 | 6f 6d 70 61 6e 79 20 69 | a) acc|ompany i|
|00006380| 74 20 77 69 74 68 20 74 | 68 65 20 63 6f 6d 70 6c |t with t|he compl|
|00006390| 65 74 65 20 63 6f 72 72 | 65 73 70 6f 6e 64 69 6e |ete corr|espondin|
|000063a0| 67 20 6d 61 63 68 69 6e | 65 2d 72 65 61 64 61 62 |g machin|e-readab|
|000063b0| 6c 65 0a 20 20 20 20 73 | 6f 75 72 63 65 20 63 6f |le. s|ource co|
|000063c0| 64 65 2c 20 77 68 69 63 | 68 20 6d 75 73 74 20 62 |de, whic|h must b|
|000063d0| 65 20 64 69 73 74 72 69 | 62 75 74 65 64 20 75 6e |e distri|buted un|
|000063e0| 64 65 72 20 74 68 65 20 | 74 65 72 6d 73 20 6f 66 |der the |terms of|
|000063f0| 0a 20 20 20 20 50 61 72 | 61 67 72 61 70 68 73 20 |. Par|agraphs |
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.