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: Tape Archive
(archive/tar).
You can browse this item here: which.tar
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| Tape Archive (archive/tar)
| magic
| Supported |
100%
| file
| tar archive
| default
| |
99%
| file
| tar archive (V7), file which/, mode 755 , uid 1524 , gid 13 , size 0 , seconds 4572525367
| default
| |
98%
| file
| data
| default
| |
100%
| TrID
| Sybase iAnywhere database files
| default (weak)
| |
100%
| lsar
| Tar
| default
| |
100%
| gt2
| TAR Archiv gefunden (Auflistung ist deaktiviert)
| default
| |
100%
| disktype
| Pre-POSIX tar archive
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 77 68 69 63 68 2f 00 00 | 00 00 00 00 00 00 00 00 |which/..|........|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000050| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000060| 00 00 00 00 20 20 20 37 | 35 35 20 00 20 20 31 35 |.... 7|55 . 15|
|00000070| 32 34 20 00 20 20 20 20 | 31 33 20 00 20 20 20 20 |24 . |13 . |
|00000080| 20 20 20 20 20 20 30 20 | 20 34 35 37 32 35 32 35 | 0 | 4572525|
|00000090| 33 36 37 20 20 20 35 31 | 36 31 00 20 00 00 00 00 |367 51|61. ....|
|000000a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000100| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000110| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000120| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000180| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000190| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000200| 77 68 69 63 68 2f 53 68 | 61 72 46 69 6c 65 2e 48 |which/Sh|arFile.H|
|00000210| 65 61 64 65 72 73 00 00 | 00 00 00 00 00 00 00 00 |eaders..|........|
|00000220| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000260| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 31 35 |.... 6|44 . 15|
|00000270| 32 34 20 00 20 20 20 20 | 31 33 20 00 20 20 20 20 |24 . |13 . |
|00000280| 20 20 20 31 34 34 30 20 | 20 34 35 37 32 35 32 35 | 1440 | 4572525|
|00000290| 33 36 37 20 20 31 30 32 | 33 37 00 20 00 00 00 00 |367 102|37. ....|
|000002a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000002f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000300| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000310| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000320| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000330| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000380| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000390| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000400| 3d 3d 3d 20 77 68 69 63 | 68 2e 73 68 61 72 20 3d |=== whic|h.shar =|
|00000410| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000420| 3d 3d 3d 3d 3d 3d 3d 3d | 0a 46 72 6f 6d 20 73 70 |========|.From sp|
|00000430| 61 72 6b 79 66 73 21 61 | 6d 65 73 21 75 61 6b 61 |arkyfs!a|mes!uaka|
|00000440| 72 69 2e 70 72 69 6d 61 | 74 65 2e 77 69 73 63 2e |ri.prima|te.wisc.|
|00000450| 65 64 75 21 61 70 6c 63 | 65 6e 21 75 75 6e 65 74 |edu!aplc|en!uunet|
|00000460| 21 61 6c 6c 62 65 72 79 | 20 57 65 64 20 46 65 62 |!allbery| Wed Feb|
|00000470| 20 31 34 20 30 38 3a 30 | 37 3a 34 38 20 50 53 54 | 14 08:0|7:48 PST|
|00000480| 20 31 39 39 30 0a 0a 50 | 6f 73 74 69 6e 67 2d 6e | 1990..P|osting-n|
|00000490| 75 6d 62 65 72 3a 20 56 | 6f 6c 75 6d 65 20 31 30 |umber: V|olume 10|
|000004a0| 2c 20 49 73 73 75 65 20 | 36 34 0a 53 75 62 6d 69 |, Issue |64.Submi|
|000004b0| 74 74 65 64 2d 62 79 3a | 20 6d 61 61 72 74 40 63 |tted-by:| maart@c|
|000004c0| 73 2e 76 75 2e 6e 6c 20 | 28 4d 61 61 72 74 65 6e |s.vu.nl |(Maarten|
|000004d0| 20 4c 69 74 6d 61 61 74 | 68 29 0a 41 72 63 68 69 | Litmaat|h).Archi|
|000004e0| 76 65 2d 6e 61 6d 65 3a | 20 77 68 69 63 68 34 0a |ve-name:| which4.|
|000004f0| 0a 44 65 61 72 20 6d 6f | 64 65 72 61 74 6f 72 2c |.Dear mo|derator,|
|00000500| 0a 62 65 6c 6f 77 20 69 | 73 20 74 68 65 20 6c 61 |.below i|s the la|
|00000510| 74 65 73 74 20 76 65 72 | 73 69 6f 6e 20 6f 66 20 |test ver|sion of |
|00000520| 77 68 69 63 68 32 2e 63 | 2c 20 74 68 65 20 66 61 |which2.c|, the fa|
|00000530| 73 74 20 66 6f 72 6d 20 | 6f 66 20 74 68 65 20 77 |st form |of the w|
|00000540| 68 69 63 68 28 31 29 0a | 63 6f 6d 6d 61 6e 64 2e |hich(1).|command.|
|00000550| 20 20 42 65 73 69 64 65 | 73 20 61 6c 69 61 73 65 | Beside|s aliase|
|00000560| 73 20 61 6e 64 20 65 78 | 65 63 75 74 61 62 6c 65 |s and ex|ecutable|
|00000570| 73 2c 20 73 68 65 6c 6c | 20 66 75 6e 63 74 69 6f |s, shell| functio|
|00000580| 6e 73 20 61 72 65 20 6e | 6f 77 0a 72 65 63 6f 67 |ns are n|ow.recog|
|00000590| 6e 69 7a 65 64 20 74 6f | 6f 2e 20 20 46 75 72 74 |nized to|o. Furt|
|000005a0| 68 65 72 6d 6f 72 65 20 | 74 68 65 20 6f 75 74 70 |hermore |the outp|
|000005b0| 75 74 20 77 69 6c 6c 20 | 62 65 20 63 6f 72 72 65 |ut will |be corre|
|000005c0| 63 74 20 65 76 65 6e 20 | 69 66 20 74 68 65 0a 65 |ct even |if the.e|
|000005d0| 66 66 65 63 74 69 76 65 | 20 75 69 64 20 28 67 69 |ffective| uid (gi|
|000005e0| 64 29 20 6f 66 20 74 68 | 65 20 69 6e 76 6f 6b 65 |d) of th|e invoke|
|000005f0| 72 20 64 6f 65 73 6e 27 | 74 20 65 71 75 61 6c 20 |r doesn'|t equal |
|00000600| 74 68 65 20 72 65 61 6c | 20 75 69 64 20 28 67 69 |the real| uid (gi|
|00000610| 64 29 2e 0a 0a 41 6e 20 | 75 70 64 61 74 65 64 20 |d)...An |updated |
|00000620| 6d 61 6e 75 61 6c 20 69 | 73 20 69 6e 63 6c 75 64 |manual i|s includ|
|00000630| 65 64 2e 0a 0a 49 20 73 | 75 67 67 65 73 74 20 74 |ed...I s|uggest t|
|00000640| 68 65 20 70 72 65 76 69 | 6f 75 73 20 32 20 76 65 |he previ|ous 2 ve|
|00000650| 72 73 69 6f 6e 73 20 28 | 76 30 34 69 30 31 30 2c |rsions (|v04i010,|
|00000660| 20 76 30 35 69 30 31 36 | 29 20 74 6f 20 62 65 20 | v05i016|) to be |
|00000670| 64 65 6c 65 74 65 64 20 | 66 72 6f 6d 0a 74 68 65 |deleted |from.the|
|00000680| 20 61 72 63 68 69 76 65 | 73 2c 20 6f 72 20 74 6f | archive|s, or to|
|00000690| 20 62 65 20 72 65 70 6c | 61 63 65 64 20 77 69 74 | be repl|aced wit|
|000006a0| 68 20 70 6f 69 6e 74 65 | 72 73 20 74 6f 20 77 68 |h pointe|rs to wh|
|000006b0| 69 63 68 34 2e 0a 0a 54 | 68 61 6e 6b 73 20 66 6f |ich4...T|hanks fo|
|000006c0| 72 20 79 6f 75 72 20 74 | 69 6d 65 2c 0a 09 09 09 |r your t|ime,....|
|000006d0| 09 4d 61 61 72 74 65 6e | 20 4c 69 74 6d 61 61 74 |.Maarten| Litmaat|
|000006e0| 68 20 40 20 56 55 20 41 | 6d 73 74 65 72 64 61 6d |h @ VU A|msterdam|
|000006f0| 3a 0a 09 09 09 09 6d 61 | 61 72 74 40 63 73 2e 76 |:.....ma|art@cs.v|
|00000700| 75 2e 6e 6c 2c 20 75 75 | 6e 65 74 21 6d 63 73 75 |u.nl, uu|net!mcsu|
|00000710| 6e 21 62 6f 74 74 65 72 | 21 6d 61 61 72 74 0a 0a |n!botter|!maart..|
|00000720| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000730| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000740| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000750| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000760| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000770| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000780| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000790| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000800| 77 68 69 63 68 2f 77 68 | 69 63 68 2e 31 00 00 00 |which/wh|ich.1...|
|00000810| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000820| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000830| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000840| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000850| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000860| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 31 35 |.... 6|44 . 15|
|00000870| 32 34 20 00 20 20 20 20 | 31 33 20 00 20 20 20 20 |24 . |13 . |
|00000880| 20 20 20 34 32 33 35 20 | 20 34 35 37 32 35 32 35 | 4235 | 4572525|
|00000890| 33 36 35 20 20 20 36 34 | 33 34 00 20 00 00 00 00 |365 64|34. ....|
|000008a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000900| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000910| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000920| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000930| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000940| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000980| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000990| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a00| 2e 54 48 20 57 48 49 43 | 48 20 31 20 53 65 70 5c |.TH WHIC|H 1 Sep\|
|00000a10| 20 32 31 5c 20 31 39 38 | 39 0a 2e 53 48 20 4e 41 | 21\ 198|9..SH NA|
|00000a20| 4d 45 0a 77 68 69 63 68 | 20 5c 2d 20 67 69 76 65 |ME.which| \- give|
|00000a30| 20 61 6c 69 61 73 2c 20 | 66 75 6e 63 74 69 6f 6e | alias, |function|
|00000a40| 20 6f 72 20 70 61 74 68 | 20 65 78 70 61 6e 73 69 | or path| expansi|
|00000a50| 6f 6e 20 6f 66 20 63 6f | 6d 6d 61 6e 64 0a 2e 53 |on of co|mmand..S|
|00000a60| 48 20 53 59 4e 4f 50 53 | 49 53 0a 2e 42 20 77 68 |H SYNOPS|IS..B wh|
|00000a70| 69 63 68 0a 5b 0a 2e 42 | 20 5c 2d 69 0a 5d 20 5b |ich.[..B| \-i.] [|
|00000a80| 0a 2e 42 20 5c 2d 61 0a | 5d 20 5b 0a 2e 42 20 5c |..B \-a.|] [..B \|
|00000a90| 2d 5c 2d 0a 5d 20 5b 0a | 2e 49 20 63 6f 6d 6d 61 |-\-.] [.|.I comma|
|00000aa0| 6e 64 0a 5d 0a 2e 53 48 | 20 44 45 53 43 52 49 50 |nd.]..SH| DESCRIP|
|00000ab0| 54 49 4f 4e 0a 2e 49 20 | 57 68 69 63 68 0a 70 72 |TION..I |Which.pr|
|00000ac0| 6f 76 69 64 65 73 20 74 | 68 65 20 75 73 65 72 20 |ovides t|he user |
|00000ad0| 77 69 74 68 20 74 68 65 | 20 66 75 6c 6c 20 65 78 |with the| full ex|
|00000ae0| 70 61 6e 73 69 6f 6e 20 | 6f 66 20 74 68 65 0a 2e |pansion |of the..|
|00000af0| 49 20 63 6f 6d 6d 61 6e | 64 0a 61 72 67 75 6d 65 |I comman|d.argume|
|00000b00| 6e 74 2c 20 62 65 20 69 | 74 20 65 69 74 68 65 72 |nt, be i|t either|
|00000b10| 20 61 6e 20 5c 66 49 61 | 6c 69 61 73 5c 66 52 2c | an \fIa|lias\fR,|
|00000b20| 20 61 20 5c 66 49 73 68 | 65 6c 6c 20 66 75 6e 63 | a \fIsh|ell func|
|00000b30| 74 69 6f 6e 5c 66 52 0a | 6f 72 20 61 6e 20 65 78 |tion\fR.|or an ex|
|00000b40| 65 63 75 74 61 62 6c 65 | 20 66 69 6c 65 20 28 64 |ecutable| file (d|
|00000b50| 65 66 61 75 6c 74 29 2e | 20 54 6f 20 65 6e 61 62 |efault).| To enab|
|00000b60| 6c 65 20 73 65 61 72 63 | 68 20 66 6f 72 0a 2e 49 |le searc|h for..I|
|00000b70| 20 61 6c 69 61 73 65 73 | 0a 61 6e 64 20 5c 66 49 | aliases|.and \fI|
|00000b80| 73 68 65 6c 6c 20 66 75 | 6e 63 74 69 6f 6e 73 5c |shell fu|nctions\|
|00000b90| 66 52 0a 74 68 65 20 75 | 73 65 72 20 73 68 6f 75 |fR.the u|ser shou|
|00000ba0| 6c 64 20 73 75 70 70 6c | 79 20 74 68 65 20 60 5c |ld suppl|y the `\|
|00000bb0| 66 49 5c 2d 69 5c 66 52 | 27 0a 28 3d 20 69 6e 74 |fI\-i\fR|'.(= int|
|00000bc0| 65 72 61 63 74 69 76 65 | 29 20 66 6c 61 67 2e 20 |eractive|) flag. |
|00000bd0| 49 6e 20 74 68 61 74 20 | 63 61 73 65 0a 2e 49 20 |In that |case..I |
|00000be0| 77 68 69 63 68 0a 65 78 | 70 65 63 74 73 20 61 73 |which.ex|pects as|
|00000bf0| 20 73 74 61 6e 64 61 72 | 64 20 69 6e 70 75 74 20 | standar|d input |
|00000c00| 74 68 65 20 65 78 70 61 | 6e 73 69 6f 6e 20 6f 66 |the expa|nsion of|
|00000c10| 20 74 68 65 20 5c 66 49 | 61 6c 69 61 73 5c 66 52 | the \fI|alias\fR|
|00000c20| 0a 6f 72 20 5c 66 49 73 | 68 65 6c 6c 20 66 75 6e |.or \fIs|hell fun|
|00000c30| 63 74 69 6f 6e 5c 66 52 | 2e 0a 49 66 20 74 68 65 |ction\fR|..If the|
|00000c40| 20 73 74 61 6e 64 61 72 | 64 20 69 6e 70 75 74 20 | standar|d input |
|00000c50| 69 73 20 65 6d 70 74 79 | 20 6f 72 20 74 68 65 20 |is empty| or the |
|00000c60| 60 5c 66 49 5c 2d 69 5c | 66 52 27 20 66 6c 61 67 |`\fI\-i\|fR' flag|
|00000c70| 20 68 61 73 20 6e 6f 74 | 20 62 65 65 6e 0a 67 69 | has not| been.gi|
|00000c80| 76 65 6e 2c 20 5c 66 49 | 77 68 69 63 68 5c 66 52 |ven, \fI|which\fR|
|00000c90| 20 77 69 6c 6c 20 74 72 | 79 20 74 6f 20 6c 6f 63 | will tr|y to loc|
|00000ca0| 61 74 65 20 5c 66 49 63 | 6f 6d 6d 61 6e 64 5c 66 |ate \fIc|ommand\f|
|00000cb0| 52 0a 69 6e 20 74 68 65 | 20 75 73 65 72 27 73 20 |R.in the| user's |
|00000cc0| 5c 66 49 50 41 54 48 5c | 66 52 2e 0a 54 68 65 20 |\fIPATH\|fR..The |
|00000cd0| 69 6e 74 65 72 61 63 74 | 69 76 65 20 6d 6f 64 65 |interact|ive mode|
|00000ce0| 20 69 73 20 65 61 73 69 | 6c 79 20 75 73 65 64 20 | is easi|ly used |
|00000cf0| 62 79 20 73 65 74 74 69 | 6e 67 20 61 6e 0a 2e 49 |by setti|ng an..I|
|00000d00| 20 61 6c 69 61 73 0a 6c | 69 6b 65 20 74 68 65 20 | alias.l|ike the |
|00000d10| 66 6f 6c 6c 6f 77 69 6e | 67 3a 0a 2e 66 74 20 42 |followin|g:..ft B|
|00000d20| 0a 2e 6e 66 0a 0a 09 61 | 6c 69 61 73 09 77 68 69 |..nf...a|lias.whi|
|00000d30| 63 68 09 61 6c 69 61 73 | 20 21 5c 5c 24 20 5c 5c |ch.alias| !\\$ \\|
|00000d40| 7c 20 2f 75 73 72 2f 6c | 6f 63 61 6c 2f 62 69 6e || /usr/l|ocal/bin|
|00000d50| 2f 77 68 69 63 68 20 5c | 2d 69 20 21 5c 5c 2a 0a |/which \|-i !\\*.|
|00000d60| 0a 2e 66 69 0a 2e 66 74 | 20 52 0a 69 6e 20 5c 66 |..fi..ft| R.in \f|
|00000d70| 49 63 73 68 5c 66 52 2c | 20 6f 72 0a 2e 66 74 20 |Icsh\fR,| or..ft |
|00000d80| 42 0a 2e 6e 66 0a 0a 09 | 61 6c 69 61 73 09 77 68 |B..nf...|alias.wh|
|00000d90| 69 63 68 09 65 76 61 6c | 20 61 6c 69 61 73 20 27 |ich.eval| alias '|
|00000da0| 5c 5c 22 5c 5c 24 24 23 | 5c 5c 22 20 7c 27 20 5c |\\"\\$$#|\\" |' \|
|00000db0| 5c 0a 09 09 09 2f 75 73 | 72 2f 6c 6f 63 61 6c 2f |\..../us|r/local/|
|00000dc0| 62 69 6e 2f 77 68 69 63 | 68 20 5c 2d 69 20 27 24 |bin/whic|h \-i '$|
|00000dd0| 7b 31 2b 22 24 40 22 7d | 27 0a 0a 2e 66 69 0a 2e |{1+"$@"}|'...fi..|
|00000de0| 66 74 20 52 0a 69 6e 20 | 73 68 65 6c 6c 73 20 77 |ft R.in |shells w|
|00000df0| 68 69 63 68 20 61 72 65 | 20 73 75 70 65 72 73 65 |hich are| superse|
|00000e00| 74 73 20 6f 66 0a 2e 49 | 20 73 68 0a 61 6e 64 20 |ts of..I| sh.and |
|00000e10| 77 68 69 63 68 20 6b 6e | 6f 77 20 5c 66 49 61 6c |which kn|ow \fIal|
|00000e20| 69 61 73 65 73 5c 66 52 | 2e 20 49 66 20 79 6f 75 |iases\fR|. If you|
|00000e30| 72 20 73 68 65 6c 6c 20 | 68 61 73 20 5c 66 49 73 |r shell |has \fIs|
|00000e40| 68 65 6c 6c 20 66 75 6e | 63 74 69 6f 6e 73 5c 66 |hell fun|ctions\f|
|00000e50| 52 2c 20 79 6f 75 0a 63 | 61 6e 20 75 73 65 20 74 |R, you.c|an use t|
|00000e60| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 66 75 6e |he follo|wing fun|
|00000e70| 63 74 69 6f 6e 3a 0a 2e | 66 74 20 42 0a 2e 6e 66 |ction:..|ft B..nf|
|00000e80| 0a 0a 09 77 68 69 63 68 | 28 29 0a 09 7b 0a 09 09 |...which|()..{...|
|00000e90| 65 76 61 6c 20 6c 61 73 | 74 3d 5c 5c 22 5c 5c 24 |eval las|t=\\"\\$|
|00000ea0| 24 23 5c 5c 22 0a 09 09 | 73 65 74 20 7c 20 73 65 |$#\\"...|set | se|
|00000eb0| 64 20 5c 2d 6e 20 22 2f | 5e 24 6c 61 73 74 28 29 |d \-n "/|^$last()|
|00000ec0| 7b 24 2f 2c 2f 5e 7d 24 | 2f 70 22 20 7c 0a 09 09 |{$/,/^}$|/p" |...|
|00000ed0| 09 2f 75 73 72 2f 6c 6f | 63 61 6c 2f 62 69 6e 2f |./usr/lo|cal/bin/|
|00000ee0| 77 68 69 63 68 20 5c 2d | 69 20 24 7b 31 2b 22 24 |which \-|i ${1+"$|
|00000ef0| 40 22 7d 0a 09 7d 0a 0a | 2e 66 69 0a 2e 66 74 20 |@"}..}..|.fi..ft |
|00000f00| 52 0a 49 66 20 74 68 65 | 20 60 5c 66 49 5c 2d 61 |R.If the| `\fI\-a|
|00000f10| 5c 66 52 27 20 28 3d 20 | 61 6c 6c 29 20 66 6c 61 |\fR' (= |all) fla|
|00000f20| 67 20 69 73 20 67 69 76 | 65 6e 2c 0a 2e 49 20 77 |g is giv|en,..I w|
|00000f30| 68 69 63 68 0a 77 69 6c | 6c 20 6e 6f 74 20 73 74 |hich.wil|l not st|
|00000f40| 6f 70 20 61 66 74 65 72 | 20 74 68 65 20 66 69 72 |op after| the fir|
|00000f50| 73 74 20 60 6d 61 74 63 | 68 27 2c 20 62 75 74 20 |st `matc|h', but |
|00000f60| 73 65 61 72 63 68 20 66 | 6f 72 20 61 6c 6c 20 6f |search f|or all o|
|00000f70| 63 63 75 72 72 65 6e 63 | 65 73 20 6f 66 0a 2e 49 |ccurrenc|es of..I|
|00000f80| 20 63 6f 6d 6d 61 6e 64 | 0a 69 6e 20 74 68 65 20 | command|.in the |
|00000f90| 75 73 65 72 27 73 0a 2e | 49 20 50 41 54 48 2e 0a |user's..|I PATH..|
|00000fa0| 54 68 65 20 60 5c 66 49 | 5c 2d 5c 2d 5c 66 52 27 |The `\fI|\-\-\fR'|
|00000fb0| 0a 66 6c 61 67 20 63 61 | 6e 20 62 65 20 75 73 65 |.flag ca|n be use|
|00000fc0| 64 20 74 6f 20 65 6e 64 | 20 74 68 65 20 6c 69 73 |d to end| the lis|
|00000fd0| 74 20 6f 66 20 6f 70 74 | 69 6f 6e 73 3a 20 74 68 |t of opt|ions: th|
|00000fe0| 65 20 6e 65 78 74 20 61 | 72 67 75 6d 65 6e 74 20 |e next a|rgument |
|00000ff0| 28 69 66 20 70 72 65 73 | 65 6e 74 29 0a 77 69 6c |(if pres|ent).wil|
|00001000| 6c 20 62 65 20 74 61 6b | 65 6e 20 61 73 20 5c 66 |l be tak|en as \f|
|00001010| 49 63 6f 6d 6d 61 6e 64 | 5c 66 52 2c 20 65 76 65 |Icommand|\fR, eve|
|00001020| 6e 20 69 66 20 69 74 20 | 73 74 61 72 74 73 20 77 |n if it |starts w|
|00001030| 69 74 68 20 61 20 60 5c | 2d 27 2e 0a 5c 66 49 57 |ith a `\|-'..\fIW|
|00001040| 68 69 63 68 20 5b 5c 2d | 69 5d 20 5b 5c 2d 61 5d |hich [\-|i] [\-a]|
|00001050| 20 5b 5c 2d 5c 2d 5d 5c | 66 52 0a 77 69 74 68 6f | [\-\-]\|fR.witho|
|00001060| 75 74 20 66 75 72 74 68 | 65 72 20 61 72 67 75 6d |ut furth|er argum|
|00001070| 65 6e 74 73 20 70 72 69 | 6e 74 73 20 74 68 65 20 |ents pri|nts the |
|00001080| 75 73 65 72 27 73 0a 2e | 49 20 50 41 54 48 0a 62 |user's..|I PATH.b|
|00001090| 72 6f 6b 65 6e 20 75 70 | 20 69 6e 74 6f 20 69 74 |roken up| into it|
|000010a0| 73 20 63 6f 6d 70 6f 6e | 65 6e 74 73 2c 0a 6f 6e |s compon|ents,.on|
|000010b0| 65 20 70 65 72 20 6c 69 | 6e 65 2e 0a 2e 50 50 0a |e per li|ne...PP.|
|000010c0| 54 68 69 73 20 6e 65 77 | 20 76 65 72 73 69 6f 6e |This new| version|
|000010d0| 20 6f 66 20 74 68 65 0a | 2e 49 20 77 68 69 63 68 | of the.|.I which|
|000010e0| 0a 63 6f 6d 6d 61 6e 64 | 20 69 73 20 6e 6f 74 20 |.command| is not |
|000010f0| 61 0a 2e 49 20 63 73 68 | 0a 73 63 72 69 70 74 2e |a..I csh|.script.|
|00001100| 0a 42 65 69 6e 67 20 61 | 6e 20 65 78 65 63 75 74 |.Being a|n execut|
|00001110| 61 62 6c 65 20 69 74 20 | 69 73 20 6d 75 63 68 20 |able it |is much |
|00001120| 66 61 73 74 65 72 2c 20 | 61 6e 64 20 6e 6f 74 20 |faster, |and not |
|00001130| 73 6f 75 72 63 69 6e 67 | 20 0a 2e 49 20 2e 63 73 |sourcing| ..I .cs|
|00001140| 68 72 63 0a 69 74 20 67 | 69 76 65 73 20 61 20 74 |hrc.it g|ives a t|
|00001150| 72 75 65 20 70 69 63 74 | 75 72 65 20 6f 66 20 6f |rue pict|ure of o|
|00001160| 6e 65 27 73 0a 2e 49 20 | 61 6c 69 61 73 65 73 2e |ne's..I |aliases.|
|00001170| 0a 2e 53 48 20 45 58 41 | 4d 50 4c 45 0a 2e 66 74 |..SH EXA|MPLE..ft|
|00001180| 20 42 0a 2e 6e 66 0a 25 | 20 61 6c 69 61 73 0a 77 | B..nf.%| alias.w|
|00001190| 68 69 63 68 09 61 6c 69 | 61 73 20 21 24 20 7c 20 |hich.ali|as !$ | |
|000011a0| 2f 75 73 72 2f 6c 6f 63 | 61 6c 2f 62 69 6e 2f 77 |/usr/loc|al/bin/w|
|000011b0| 68 69 63 68 20 5c 2d 69 | 20 21 2a 0a 25 20 77 68 |hich \-i| !*.% wh|
|000011c0| 69 63 68 20 77 68 69 63 | 68 0a 77 68 69 63 68 09 |ich whic|h.which.|
|000011d0| 61 6c 69 61 73 20 21 24 | 20 7c 20 2f 75 73 72 2f |alias !$| | /usr/|
|000011e0| 6c 6f 63 61 6c 2f 62 69 | 6e 2f 77 68 69 63 68 20 |local/bi|n/which |
|000011f0| 5c 2d 69 20 21 2a 0a 25 | 20 77 68 69 63 68 20 5c |\-i !*.%| which \|
|00001200| 2d 61 20 77 68 69 63 68 | 0a 77 68 69 63 68 09 61 |-a which|.which.a|
|00001210| 6c 69 61 73 20 21 24 20 | 7c 20 2f 75 73 72 2f 6c |lias !$ || /usr/l|
|00001220| 6f 63 61 6c 2f 62 69 6e | 2f 77 68 69 63 68 20 5c |ocal/bin|/which \|
|00001230| 2d 69 20 21 2a 0a 2f 75 | 73 72 2f 6c 6f 63 61 6c |-i !*./u|sr/local|
|00001240| 2f 62 69 6e 2f 77 68 69 | 63 68 0a 2f 75 73 72 2f |/bin/whi|ch./usr/|
|00001250| 75 63 62 2f 77 68 69 63 | 68 0a 25 0a 2e 66 69 0a |ucb/whic|h.%..fi.|
|00001260| 2e 66 74 20 52 0a 2e 53 | 48 20 41 55 54 48 4f 52 |.ft R..S|H AUTHOR|
|00001270| 0a 4d 61 61 72 74 65 6e | 20 4c 69 74 6d 61 61 74 |.Maarten| Litmaat|
|00001280| 68 20 40 20 56 55 20 49 | 6e 66 6f 72 6d 61 74 69 |h @ VU I|nformati|
|00001290| 6b 61 20 41 6d 73 74 65 | 72 64 61 6d 0a 00 00 00 |ka Amste|rdam....|
|000012a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000012b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000012c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000012d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000012e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000012f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001300| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001310| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001320| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001330| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001380| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001390| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000013f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001400| 77 68 69 63 68 2f 4d 61 | 6b 65 66 69 6c 65 00 00 |which/Ma|kefile..|
|00001410| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001420| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001430| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001440| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001450| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001460| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 31 35 |.... 6|44 . 15|
|00001470| 32 34 20 00 20 20 20 20 | 31 33 20 00 20 20 20 20 |24 . |13 . |
|00001480| 20 20 20 20 32 35 31 20 | 20 34 35 37 32 35 32 35 | 251 | 4572525|
|00001490| 33 36 36 20 20 20 36 36 | 36 33 00 20 00 00 00 00 |366 66|63. ....|
|000014a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000014b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000014c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000014d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000014e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000014f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001500| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001510| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001520| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001530| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001580| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001590| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000015a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000015b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000015c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000015d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000015e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000015f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001600| 23 20 4d 61 6b 65 66 69 | 6c 65 20 66 6f 72 20 2f |# Makefi|le for /|
|00001610| 75 73 72 2f 6c 6f 63 61 | 6c 2f 62 69 6e 2f 77 68 |usr/loca|l/bin/wh|
|00001620| 69 63 68 0a 0a 77 68 69 | 63 68 3a 09 09 77 68 69 |ich..whi|ch:..whi|
|00001630| 63 68 34 2e 63 0a 09 09 | 63 63 20 2d 4f 20 77 68 |ch4.c...|cc -O wh|
|00001640| 69 63 68 34 2e 63 20 2d | 6f 20 77 68 69 63 68 0a |ich4.c -|o which.|
|00001650| 0a 69 6e 73 74 61 6c 6c | 3a 09 77 68 69 63 68 0a |.install|:.which.|
|00001660| 09 09 2f 62 69 6e 2f 6d | 76 20 2d 66 20 77 68 69 |../bin/m|v -f whi|
|00001670| 63 68 20 2f 75 73 72 2f | 6c 6f 63 61 6c 2f 62 69 |ch /usr/|local/bi|
|00001680| 6e 0a 0a 64 6f 63 3a 0a | 09 09 6e 72 6f 66 66 20 |n..doc:.|..nroff |
|00001690| 2d 6d 61 6e 20 77 68 69 | 63 68 2e 31 20 3e 20 77 |-man whi|ch.1 > w|
|000016a0| 68 69 63 68 2e 6d 61 6e | 0a 44 45 53 43 52 49 50 |hich.man|.DESCRIP|
|000016b0| 54 49 4f 4e 0a 2e 49 20 | 57 68 69 63 68 0a 70 72 |TION..I |Which.pr|
|000016c0| 6f 76 69 64 65 73 20 74 | 68 65 20 75 73 65 72 20 |ovides t|he user |
|000016d0| 77 69 74 68 20 74 68 65 | 20 66 75 6c 6c 20 65 78 |with the| full ex|
|000016e0| 70 61 6e 73 69 6f 6e 20 | 6f 66 20 74 68 65 0a 2e |pansion |of the..|
|000016f0| 49 20 63 6f 6d 6d 61 6e | 64 0a 61 72 67 75 6d 65 |I comman|d.argume|
|00001700| 6e 74 2c 20 62 65 20 69 | 74 20 65 69 74 68 65 72 |nt, be i|t either|
|00001710| 20 61 6e 20 5c 66 49 61 | 6c 69 61 73 5c 66 52 2c | an \fIa|lias\fR,|
|00001720| 20 61 20 5c 66 49 73 68 | 65 6c 6c 20 66 75 6e 63 | a \fIsh|ell func|
|00001730| 74 69 6f 6e 5c 66 52 0a | 6f 72 20 61 6e 20 65 78 |tion\fR.|or an ex|
|00001740| 65 63 75 74 61 62 6c 65 | 20 66 69 6c 65 20 28 64 |ecutable| file (d|
|00001750| 65 66 61 75 6c 74 29 2e | 20 54 6f 20 65 6e 61 62 |efault).| To enab|
|00001760| 6c 65 20 73 65 61 72 63 | 68 20 66 6f 72 0a 2e 49 |le searc|h for..I|
|00001770| 20 61 6c 69 61 73 65 73 | 0a 61 6e 64 20 5c 66 49 | aliases|.and \fI|
|00001780| 73 68 65 6c 6c 20 66 75 | 6e 63 74 69 6f 6e 73 5c |shell fu|nctions\|
|00001790| 66 52 0a 74 68 65 20 75 | 73 65 72 20 73 68 6f 75 |fR.the u|ser shou|
|000017a0| 6c 64 20 73 75 70 70 6c | 79 20 74 68 65 20 60 5c |ld suppl|y the `\|
|000017b0| 66 49 5c 2d 69 5c 66 52 | 27 0a 28 3d 20 69 6e 74 |fI\-i\fR|'.(= int|
|000017c0| 65 72 61 63 74 69 76 65 | 29 20 66 6c 61 67 2e 20 |eractive|) flag. |
|000017d0| 49 6e 20 74 68 61 74 20 | 63 61 73 65 0a 2e 49 20 |In that |case..I |
|000017e0| 77 68 69 63 68 0a 65 78 | 70 65 63 74 73 20 61 73 |which.ex|pects as|
|000017f0| 20 73 74 61 6e 64 61 72 | 64 20 69 6e 70 75 74 20 | standar|d input |
|00001800| 77 68 69 63 68 2f 77 68 | 69 63 68 34 2e 63 00 00 |which/wh|ich4.c..|
|00001810| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001820| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001830| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001840| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001850| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001860| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 31 35 |.... 6|44 . 15|
|00001870| 32 34 20 00 20 20 20 20 | 31 33 20 00 20 20 20 20 |24 . |13 . |
|00001880| 20 20 20 37 35 30 33 20 | 20 34 35 37 32 35 32 35 | 7503 | 4572525|
|00001890| 33 36 37 20 20 20 36 36 | 30 35 00 20 00 00 00 00 |367 66|05. ....|
|000018a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000018b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000018c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000018d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000018e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000018f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001900| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001910| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001920| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001930| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001940| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001980| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001990| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000019a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000019b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000019c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000019d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000019e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000019f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001a00| 2f 2a 0a 20 2a 20 77 68 | 69 63 68 20 5b 2d 69 5d |/*. * wh|ich [-i]|
|00001a10| 20 5b 2d 61 5d 20 5b 2d | 2d 5d 20 5b 3c 63 6f 6d | [-a] [-|-] [<com|
|00001a20| 6d 61 6e 64 3e 5d 0a 20 | 2a 20 61 6c 69 61 73 20 |mand>]. |* alias |
|00001a30| 77 68 69 63 68 20 61 6c | 69 61 73 20 21 5c 24 20 |which al|ias !\$ |
|00001a40| 5c 7c 20 2f 75 73 72 2f | 6c 6f 63 61 6c 2f 62 69 |\| /usr/|local/bi|
|00001a50| 6e 2f 77 68 69 63 68 20 | 2d 69 20 21 5c 2a 0a 20 |n/which |-i !\*. |
|00001a60| 2a 20 61 6c 69 61 73 20 | 77 68 69 63 68 20 27 65 |* alias |which 'e|
|00001a70| 76 61 6c 20 61 6c 69 61 | 73 20 5c 24 24 23 20 7c |val alia|s \$$# ||
|00001a80| 20 2f 75 73 72 2f 6c 6f | 63 61 6c 2f 62 69 6e 2f | /usr/lo|cal/bin/|
|00001a90| 77 68 69 63 68 20 2d 69 | 20 24 7b 31 2b 22 24 40 |which -i| ${1+"$@|
|00001aa0| 22 7d 27 0a 20 2a 20 77 | 68 69 63 68 28 29 0a 20 |"}'. * w|hich(). |
|00001ab0| 2a 20 7b 0a 20 2a 09 65 | 76 61 6c 20 6c 61 73 74 |* {. *.e|val last|
|00001ac0| 3d 5c 22 5c 24 24 23 5c | 22 0a 20 2a 09 73 65 74 |=\"\$$#\|". *.set|
|00001ad0| 20 7c 20 73 65 64 20 2d | 6e 20 22 2f 5e 24 6c 61 | | sed -|n "/^$la|
|00001ae0| 73 74 28 29 7b 24 2f 2c | 2f 5e 7d 24 2f 70 22 20 |st(){$/,|/^}$/p" |
|00001af0| 7c 0a 20 2a 09 09 2f 75 | 73 72 2f 6c 6f 63 61 6c ||. *../u|sr/local|
|00001b00| 2f 62 69 6e 2f 77 68 69 | 63 68 20 2d 69 20 24 7b |/bin/whi|ch -i ${|
|00001b10| 31 2b 22 24 40 22 7d 0a | 20 2a 20 7d 0a 20 2a 0a |1+"$@"}.| * }. *.|
|00001b20| 20 2a 20 61 75 74 68 6f | 72 3a 20 4d 61 61 72 74 | * autho|r: Maart|
|00001b30| 65 6e 20 4c 69 74 6d 61 | 61 74 68 20 40 20 56 55 |en Litma|ath @ VU|
|00001b40| 20 55 6e 69 76 65 72 73 | 69 74 79 20 41 6d 73 74 | Univers|ity Amst|
|00001b50| 65 72 64 61 6d 20 28 6d | 61 61 72 74 40 63 73 2e |erdam (m|aart@cs.|
|00001b60| 76 75 2e 6e 6c 29 0a 20 | 2a 20 66 69 72 73 74 20 |vu.nl). |* first |
|00001b70| 63 68 61 6e 67 65 3a 0a | 20 2a 09 45 6d 69 6c 65 |change:.| *.Emile|
|00001b80| 20 4c 65 42 6c 61 6e 63 | 20 28 6c 65 62 6c 61 6e | LeBlanc| (leblan|
|00001b90| 63 25 6d 61 74 68 2e 42 | 65 72 6b 65 6c 65 79 2e |c%math.B|erkeley.|
|00001ba0| 45 44 55 40 75 63 62 76 | 61 78 2e 62 65 72 6b 65 |EDU@ucbv|ax.berke|
|00001bb0| 6c 65 79 2e 65 64 75 29 | 20 6e 6f 74 65 73 0a 20 |ley.edu)| notes. |
|00001bc0| 2a 09 74 68 65 20 61 63 | 63 65 73 73 28 29 20 73 |*.the ac|cess() s|
|00001bd0| 79 73 74 65 6d 20 63 61 | 6c 6c 20 63 6f 6e 73 69 |ystem ca|ll consi|
|00001be0| 64 65 72 69 6e 67 20 65 | 76 65 72 79 74 68 69 6e |dering e|verythin|
|00001bf0| 67 20 65 78 65 63 75 74 | 61 62 6c 65 20 66 6f 72 |g execut|able for|
|00001c00| 0a 20 2a 09 72 6f 6f 74 | 20 28 21 29 2c 20 73 6f |. *.root| (!), so|
|00001c10| 20 77 65 20 67 69 76 65 | 20 72 6f 6f 74 20 61 20 | we give| root a |
|00001c20| 73 70 65 63 69 61 6c 20 | 74 72 65 61 74 6d 65 6e |special |treatmen|
|00001c30| 74 0a 20 2a 09 27 77 68 | 69 63 68 27 2c 20 27 77 |t. *.'wh|ich', 'w|
|00001c40| 68 69 63 68 20 2d 69 27 | 20 61 6e 64 20 27 77 68 |hich -i'| and 'wh|
|00001c50| 69 63 68 20 2d 61 27 20 | 77 69 74 68 20 6e 6f 20 |ich -a' |with no |
|00001c60| 66 75 72 74 68 65 72 20 | 61 72 67 75 6d 65 6e 74 |further |argument|
|00001c70| 73 20 6e 6f 77 0a 20 2a | 09 72 65 74 75 72 6e 20 |s now. *|.return |
|00001c80| 74 68 65 20 50 41 54 48 | 20 65 6e 76 69 72 6f 6e |the PATH| environ|
|00001c90| 6d 65 6e 74 20 76 61 72 | 69 61 62 6c 65 2c 20 73 |ment var|iable, s|
|00001ca0| 70 6c 69 74 20 75 70 20 | 69 6e 74 6f 20 69 74 73 |plit up |into its|
|00001cb0| 20 63 6f 6d 70 6f 6e 65 | 6e 74 73 0a 20 2a 09 74 | compone|nts. *.t|
|00001cc0| 68 65 20 61 6c 69 61 73 | 65 73 20 64 65 66 69 6e |he alias|es defin|
|00001cd0| 65 64 20 61 62 6f 76 65 | 20 61 72 65 20 73 6c 69 |ed above| are sli|
|00001ce0| 67 68 74 6c 79 20 64 69 | 66 66 65 72 65 6e 74 20 |ghtly di|fferent |
|00001cf0| 66 72 6f 6d 20 74 68 65 | 20 70 72 65 76 69 6f 75 |from the| previou|
|00001d00| 73 0a 20 2a 09 76 65 72 | 73 69 6f 6e 20 2d 20 6e |s. *.ver|sion - n|
|00001d10| 6f 77 20 69 74 27 73 20 | 74 68 65 20 73 68 65 6c |ow it's |the shel|
|00001d20| 6c 20 77 68 6f 27 73 20 | 64 6f 69 6e 67 20 74 68 |l who's |doing th|
|00001d30| 65 20 61 6c 69 61 73 20 | 63 68 65 63 6b 69 6e 67 |e alias |checking|
|00001d40| 0a 20 2a 20 73 65 63 6f | 6e 64 20 63 68 61 6e 67 |. * seco|nd chang|
|00001d50| 65 3a 0a 20 2a 09 61 64 | 64 65 64 20 73 75 70 70 |e:. *.ad|ded supp|
|00001d60| 6f 72 74 20 66 6f 72 20 | 73 68 65 6c 6c 20 66 75 |ort for |shell fu|
|00001d70| 6e 63 74 69 6f 6e 73 20 | 61 6e 64 20 6d 75 6c 74 |nctions |and mult|
|00001d80| 69 6c 69 6e 65 20 61 6c | 69 61 73 65 73 2c 20 61 |iline al|iases, a|
|00001d90| 64 64 65 64 20 74 68 65 | 0a 20 2a 09 60 2d 2d 27 |dded the|. *.`--'|
|00001da0| 20 6f 70 74 69 6f 6e 2c | 20 63 68 61 6e 67 65 64 | option,| changed|
|00001db0| 20 74 68 65 20 73 6f 75 | 72 63 65 20 73 74 79 6c | the sou|rce styl|
|00001dc0| 65 0a 20 2a 20 74 68 69 | 72 64 20 63 68 61 6e 67 |e. * thi|rd chang|
|00001dd0| 65 3a 0a 20 2a 09 74 6f | 20 68 65 6c 6c 20 77 69 |e:. *.to| hell wi|
|00001de0| 74 68 20 61 63 63 65 73 | 73 28 29 21 0a 20 2a 09 |th acces|s()!. *.|
|00001df0| 6e 6f 77 20 73 74 61 74 | 28 29 20 69 73 20 75 73 |now stat|() is us|
|00001e00| 65 64 20 74 6f 20 67 69 | 76 65 20 74 68 65 20 72 |ed to gi|ve the r|
|00001e10| 69 67 68 74 20 61 6e 73 | 77 65 72 20 65 76 65 6e |ight ans|wer even|
|00001e20| 20 69 66 20 74 68 65 20 | 65 66 66 65 63 74 69 76 | if the |effectiv|
|00001e30| 65 0a 20 2a 09 75 69 64 | 20 28 67 69 64 29 20 64 |e. *.uid| (gid) d|
|00001e40| 69 66 66 65 72 73 20 66 | 72 6f 6d 20 74 68 65 20 |iffers f|rom the |
|00001e50| 72 65 61 6c 20 75 69 64 | 20 28 67 69 64 29 0a 20 |real uid| (gid). |
|00001e60| 2a 09 77 65 20 63 61 6e | 27 74 20 75 73 65 20 73 |*.we can|'t use s|
|00001e70| 65 74 75 69 64 28 67 65 | 74 65 75 69 64 28 29 29 |etuid(ge|teuid())|
|00001e80| 2c 20 62 65 63 61 75 73 | 65 20 74 68 61 74 27 73 |, becaus|e that's|
|00001e90| 20 6e 6f 6e 70 6f 72 74 | 61 62 6c 65 20 3a 2d 28 | nonport|able :-(|
|00001ea0| 0a 20 2a 2f 0a 0a 23 69 | 6e 63 6c 75 64 65 09 3c |. */..#i|nclude.<|
|00001eb0| 73 79 73 2f 74 79 70 65 | 73 2e 68 3e 0a 23 69 6e |sys/type|s.h>.#in|
|00001ec0| 63 6c 75 64 65 09 3c 73 | 79 73 2f 73 74 61 74 2e |clude.<s|ys/stat.|
|00001ed0| 68 3e 0a 23 69 6e 63 6c | 75 64 65 09 3c 73 74 64 |h>.#incl|ude.<std|
|00001ee0| 69 6f 2e 68 3e 0a 0a 23 | 64 65 66 69 6e 65 09 09 |io.h>..#|define..|
|00001ef0| 42 55 46 5f 53 49 5a 45 | 09 35 31 32 0a 23 64 65 |BUF_SIZE|.512.#de|
|00001f00| 66 69 6e 65 09 09 4d 5f | 55 53 52 09 09 30 37 30 |fine..M_|USR..070|
|00001f10| 30 0a 23 64 65 66 69 6e | 65 09 09 4d 5f 47 52 50 |0.#defin|e..M_GRP|
|00001f20| 09 09 30 30 37 30 0a 23 | 64 65 66 69 6e 65 09 09 |..0070.#|define..|
|00001f30| 4d 5f 4f 54 48 09 09 30 | 30 30 37 0a 23 64 65 66 |M_OTH..0|007.#def|
|00001f40| 69 6e 65 09 09 58 5f 41 | 4c 4c 09 09 30 31 31 31 |ine..X_A|LL..0111|
|00001f50| 0a 23 64 65 66 69 6e 65 | 09 09 52 5f 41 4c 4c 09 |.#define|..R_ALL.|
|00001f60| 09 30 34 34 34 0a 0a 63 | 68 61 72 09 56 65 72 73 |.0444..c|har.Vers|
|00001f70| 69 6f 6e 5b 5d 20 3d 0a | 09 22 40 28 23 29 77 68 |ion[] =.|."@(#)wh|
|00001f80| 69 63 68 20 34 2e 30 20 | 39 30 2f 30 31 2f 32 34 |ich 4.0 |90/01/24|
|00001f90| 20 4d 61 61 72 74 65 6e | 20 4c 69 74 6d 61 61 74 | Maarten| Litmaat|
|00001fa0| 68 20 40 20 56 55 20 49 | 6e 66 6f 72 6d 61 74 69 |h @ VU I|nformati|
|00001fb0| 6b 61 20 41 6d 73 74 65 | 72 64 61 6d 22 3b 0a 63 |ka Amste|rdam";.c|
|00001fc0| 68 61 72 09 2a 50 72 6f | 67 3b 0a 0a 0a 76 6f 69 |har.*Pro|g;...voi|
|00001fd0| 64 09 75 73 61 67 65 28 | 29 0a 7b 0a 09 66 70 72 |d.usage(|).{..fpr|
|00001fe0| 69 6e 74 66 28 73 74 64 | 65 72 72 2c 20 22 55 73 |intf(std|err, "Us|
|00001ff0| 61 67 65 3a 20 25 73 20 | 5b 2d 69 5d 20 5b 2d 61 |age: %s |[-i] [-a|
|00002000| 5d 20 5b 2d 2d 5d 20 5b | 3c 63 6f 6d 6d 61 6e 64 |] [--] [|<command|
|00002010| 3e 5d 5c 6e 22 2c 20 50 | 72 6f 67 29 3b 0a 09 65 |>]\n", P|rog);..e|
|00002020| 78 69 74 28 31 29 3b 0a | 7d 0a 0a 0a 6d 61 69 6e |xit(1);.|}...main|
|00002030| 28 61 72 67 63 2c 20 61 | 72 67 76 29 20 0a 69 6e |(argc, a|rgv) .in|
|00002040| 74 09 61 72 67 63 3b 0a | 72 65 67 69 73 74 65 72 |t.argc;.|register|
|00002050| 20 63 68 61 72 09 2a 2a | 61 72 67 76 3b 0a 7b 0a | char.**|argv;.{.|
|00002060| 09 72 65 67 69 73 74 65 | 72 20 63 68 61 72 09 2a |.registe|r char.*|
|00002070| 70 61 74 68 2c 20 2a 73 | 3b 0a 09 63 68 61 72 09 |path, *s|;..char.|
|00002080| 2a 73 61 76 65 2c 20 2a | 73 74 72 63 70 79 28 29 |*save, *|strcpy()|
|00002090| 2c 20 2a 67 65 74 65 6e | 76 28 29 2c 20 2a 66 67 |, *geten|v(), *fg|
|000020a0| 65 74 73 28 29 2c 20 62 | 75 66 5b 42 55 46 5f 53 |ets(), b|uf[BUF_S|
|000020b0| 49 5a 45 5d 3b 0a 09 69 | 6e 74 09 61 6c 6c 20 3d |IZE];..i|nt.all =|
|000020c0| 20 30 2c 20 69 6e 74 65 | 72 20 3d 20 30 2c 20 73 | 0, inte|r = 0, s|
|000020d0| 74 6f 70 20 3d 20 30 2c | 20 66 6f 75 6e 64 20 3d |top = 0,| found =|
|000020e0| 20 30 2c 20 75 69 64 2c | 20 67 69 64 2c 20 6d 61 | 0, uid,| gid, ma|
|000020f0| 73 6b 2c 0a 09 09 78 6d | 61 73 6b 2c 20 72 6d 61 |sk,...xm|ask, rma|
|00002100| 73 6b 3b 0a 09 73 74 72 | 75 63 74 09 73 74 61 74 |sk;..str|uct.stat|
|00002110| 09 73 74 3b 0a 09 76 6f | 69 64 09 75 73 61 67 65 |.st;..vo|id.usage|
|00002120| 28 29 2c 20 63 6f 6e 76 | 65 72 74 28 29 3b 0a 0a |(), conv|ert();..|
|00002130| 0a 09 50 72 6f 67 20 3d | 20 2a 61 72 67 76 2b 2b |..Prog =| *argv++|
|00002140| 3b 0a 09 2d 2d 61 72 67 | 63 3b 0a 0a 09 77 68 69 |;..--arg|c;...whi|
|00002150| 6c 65 20 28 21 73 74 6f | 70 20 26 26 20 28 73 20 |le (!sto|p && (s |
|00002160| 3d 20 2a 61 72 67 76 29 | 20 26 26 20 28 2a 73 20 |= *argv)| && (*s |
|00002170| 3d 3d 20 27 2d 27 29 29 | 20 7b 0a 09 09 2b 2b 61 |== '-'))| {...++a|
|00002180| 72 67 76 3b 0a 09 09 2d | 2d 61 72 67 63 3b 0a 09 |rgv;...-|-argc;..|
|00002190| 09 2b 2b 73 3b 0a 09 09 | 77 68 69 6c 65 20 28 2a |.++s;...|while (*|
|000021a0| 73 29 0a 09 09 09 73 77 | 69 74 63 68 20 28 2a 73 |s)....sw|itch (*s|
|000021b0| 2b 2b 29 20 7b 0a 09 09 | 09 63 61 73 65 20 27 61 |++) {...|.case 'a|
|000021c0| 27 3a 0a 09 09 09 09 61 | 6c 6c 20 3d 20 31 3b 0a |':.....a|ll = 1;.|
|000021d0| 09 09 09 09 62 72 65 61 | 6b 3b 0a 09 09 09 63 61 |....brea|k;....ca|
|000021e0| 73 65 20 27 69 27 3a 0a | 09 09 09 09 69 6e 74 65 |se 'i':.|....inte|
|000021f0| 72 20 3d 20 31 3b 0a 09 | 09 09 09 62 72 65 61 6b |r = 1;..|...break|
|00002200| 3b 0a 09 09 09 63 61 73 | 65 20 27 2d 27 3a 0a 09 |;....cas|e '-':..|
|00002210| 09 09 09 73 74 6f 70 20 | 3d 20 31 3b 0a 09 09 09 |...stop |= 1;....|
|00002220| 09 62 72 65 61 6b 3b 0a | 09 09 09 64 65 66 61 75 |.break;.|...defau|
|00002230| 6c 74 3a 0a 09 09 09 09 | 75 73 61 67 65 28 29 3b |lt:.....|usage();|
|00002240| 0a 09 09 09 7d 0a 09 7d | 0a 0a 09 69 66 20 28 61 |....}..}|...if (a|
|00002250| 72 67 63 20 3e 20 31 29 | 0a 09 09 75 73 61 67 65 |rgc > 1)|...usage|
|00002260| 28 29 3b 0a 0a 09 69 66 | 20 28 69 6e 74 65 72 20 |();...if| (inter |
|00002270| 26 26 20 2a 61 72 67 76 | 29 20 7b 0a 09 09 77 68 |&& *argv|) {...wh|
|00002280| 69 6c 65 20 28 66 67 65 | 74 73 28 62 75 66 2c 20 |ile (fge|ts(buf, |
|00002290| 73 69 7a 65 6f 66 20 62 | 75 66 2c 20 73 74 64 69 |sizeof b|uf, stdi|
|000022a0| 6e 29 29 20 7b 0a 09 09 | 09 69 66 20 28 21 66 6f |n)) {...|.if (!fo|
|000022b0| 75 6e 64 29 20 7b 0a 09 | 09 09 09 70 72 69 6e 74 |und) {..|...print|
|000022c0| 66 28 22 25 73 22 2c 20 | 2a 61 72 67 76 29 3b 0a |f("%s", |*argv);.|
|000022d0| 09 09 09 09 66 6f 75 6e | 64 20 3d 20 31 3b 0a 09 |....foun|d = 1;..|
|000022e0| 09 09 7d 0a 09 09 09 70 | 72 69 6e 74 66 28 22 5c |..}....p|rintf("\|
|000022f0| 74 25 73 22 2c 20 62 75 | 66 29 3b 0a 09 09 7d 0a |t%s", bu|f);...}.|
|00002300| 09 09 69 66 20 28 66 6f | 75 6e 64 20 26 26 20 21 |..if (fo|und && !|
|00002310| 61 6c 6c 29 0a 09 09 09 | 65 78 69 74 28 30 29 3b |all)....|exit(0);|
|00002320| 0a 09 7d 0a 0a 09 69 66 | 20 28 21 28 73 61 76 65 |..}...if| (!(save|
|00002330| 20 3d 20 70 61 74 68 20 | 3d 20 67 65 74 65 6e 76 | = path |= getenv|
|00002340| 28 22 50 41 54 48 22 29 | 29 29 20 7b 0a 09 09 66 |("PATH")|)) {...f|
|00002350| 70 72 69 6e 74 66 28 73 | 74 64 65 72 72 2c 20 22 |printf(s|tderr, "|
|00002360| 25 73 3a 20 6e 6f 20 50 | 41 54 48 20 69 6e 20 65 |%s: no P|ATH in e|
|00002370| 6e 76 69 72 6f 6e 6d 65 | 6e 74 21 5c 6e 22 2c 20 |nvironme|nt!\n", |
|00002380| 50 72 6f 67 29 3b 0a 09 | 09 65 78 69 74 28 31 29 |Prog);..|.exit(1)|
|00002390| 3b 0a 09 7d 0a 0a 09 69 | 66 20 28 21 2a 70 61 74 |;..}...i|f (!*pat|
|000023a0| 68 29 0a 09 09 73 61 76 | 65 20 3d 20 70 61 74 68 |h)...sav|e = path|
|000023b0| 20 3d 20 22 2e 22 3b 0a | 0a 09 69 66 20 28 21 2a | = ".";.|..if (!*|
|000023c0| 61 72 67 76 29 20 7b 0a | 09 09 63 6f 6e 76 65 72 |argv) {.|..conver|
|000023d0| 74 28 70 61 74 68 2c 20 | 62 75 66 29 3b 0a 09 09 |t(path, |buf);...|
|000023e0| 70 75 74 73 28 62 75 66 | 29 3b 0a 09 09 65 78 69 |puts(buf|);...exi|
|000023f0| 74 28 30 29 3b 0a 09 7d | 0a 0a 09 75 69 64 20 3d |t(0);..}|...uid =|
|00002400| 20 67 65 74 65 75 69 64 | 28 29 3b 0a 09 67 69 64 | geteuid|();..gid|
|00002410| 20 3d 20 67 65 74 65 67 | 69 64 28 29 3b 0a 09 69 | = geteg|id();..i|
|00002420| 66 20 28 75 69 64 20 3d | 3d 20 30 29 20 7b 0a 09 |f (uid =|= 0) {..|
|00002430| 09 78 6d 61 73 6b 20 3d | 20 58 5f 41 4c 4c 3b 0a |.xmask =| X_ALL;.|
|00002440| 09 09 72 6d 61 73 6b 20 | 3d 20 52 5f 41 4c 4c 3b |..rmask |= R_ALL;|
|00002450| 0a 09 7d 0a 0a 09 77 68 | 69 6c 65 20 28 2a 70 61 |..}...wh|ile (*pa|
|00002460| 74 68 29 20 7b 0a 09 09 | 73 20 3d 20 62 75 66 3b |th) {...|s = buf;|
|00002470| 0a 09 09 77 68 69 6c 65 | 20 28 28 2a 73 2b 2b 20 |...while| ((*s++ |
|00002480| 3d 20 2a 70 61 74 68 29 | 20 26 26 20 2a 70 61 74 |= *path)| && *pat|
|00002490| 68 2b 2b 20 21 3d 20 27 | 3a 27 29 0a 09 09 09 3b |h++ != '|:')....;|
|000024a0| 0a 09 09 69 66 20 28 2a | 62 75 66 20 3d 3d 20 27 |...if (*|buf == '|
|000024b0| 3a 27 29 20 7b 0a 09 09 | 09 2f 2a 0a 09 09 09 20 |:') {...|./*.... |
|000024c0| 2a 20 74 6f 20 64 65 61 | 6c 20 77 69 74 68 20 74 |* to dea|l with t|
|000024d0| 68 65 20 64 75 62 69 6f | 75 73 20 63 6f 6e 76 65 |he dubio|us conve|
|000024e0| 6e 74 69 6f 6e 20 74 68 | 61 74 20 61 0a 09 09 09 |ntion th|at a....|
|000024f0| 20 2a 20 73 70 75 72 69 | 6f 75 73 20 63 6f 6c 6f | * spuri|ous colo|
|00002500| 6e 20 69 73 20 65 71 75 | 69 76 61 6c 65 6e 74 20 |n is equ|ivalent |
|00002510| 74 6f 20 61 20 64 6f 74 | 2e 2e 2e 0a 09 09 09 20 |to a dot|....... |
|00002520| 2a 2f 0a 09 09 09 2a 62 | 75 66 20 3d 20 27 2e 27 |*/....*b|uf = '.'|
|00002530| 3b 0a 09 09 09 2b 2b 73 | 3b 0a 09 09 7d 0a 09 09 |;....++s|;...}...|
|00002540| 28 76 6f 69 64 29 20 73 | 74 72 63 70 79 28 73 2c |(void) s|trcpy(s,|
|00002550| 20 2a 61 72 67 76 29 3b | 0a 09 09 2a 2d 2d 73 20 | *argv);|...*--s |
|00002560| 3d 20 27 2f 27 3b 0a 0a | 09 09 69 66 20 28 73 74 |= '/';..|..if (st|
|00002570| 61 74 28 62 75 66 2c 20 | 26 73 74 29 20 21 3d 20 |at(buf, |&st) != |
|00002580| 30 20 7c 7c 20 28 73 74 | 2e 73 74 5f 6d 6f 64 65 |0 || (st|.st_mode|
|00002590| 20 26 20 53 5f 49 46 4d | 54 29 20 21 3d 20 53 5f | & S_IFM|T) != S_|
|000025a0| 49 46 52 45 47 29 0a 09 | 09 09 63 6f 6e 74 69 6e |IFREG)..|..contin|
|000025b0| 75 65 3b 0a 0a 09 09 2f | 2a 20 66 69 6c 65 20 65 |ue;..../|* file e|
|000025c0| 78 69 73 74 73 20 61 6e | 64 20 69 73 20 72 65 67 |xists an|d is reg|
|000025d0| 75 6c 61 72 20 2a 2f 0a | 0a 09 09 69 66 20 28 75 |ular */.|...if (u|
|000025e0| 69 64 20 21 3d 20 30 29 | 20 7b 0a 09 09 09 6d 61 |id != 0)| {....ma|
|000025f0| 73 6b 20 3d 20 73 74 2e | 73 74 5f 75 69 64 20 3d |sk = st.|st_uid =|
|00002600| 3d 20 75 69 64 20 3f 20 | 4d 5f 55 53 52 20 3a 0a |= uid ? |M_USR :.|
|00002610| 09 09 09 09 73 74 2e 73 | 74 5f 67 69 64 20 3d 3d |....st.s|t_gid ==|
|00002620| 20 67 69 64 20 3f 20 4d | 5f 47 52 50 20 3a 20 4d | gid ? M|_GRP : M|
|00002630| 5f 4f 54 48 3b 0a 09 09 | 09 78 6d 61 73 6b 20 3d |_OTH;...|.xmask =|
|00002640| 20 58 5f 41 4c 4c 20 26 | 20 6d 61 73 6b 3b 0a 09 | X_ALL &| mask;..|
|00002650| 09 09 72 6d 61 73 6b 20 | 3d 20 52 5f 41 4c 4c 20 |..rmask |= R_ALL |
|00002660| 26 20 6d 61 73 6b 3b 0a | 09 09 7d 0a 0a 09 09 69 |& mask;.|..}....i|
|00002670| 66 20 28 21 28 73 74 2e | 73 74 5f 6d 6f 64 65 20 |f (!(st.|st_mode |
|00002680| 26 20 78 6d 61 73 6b 29 | 29 0a 09 09 09 63 6f 6e |& xmask)|)....con|
|00002690| 74 69 6e 75 65 3b 0a 0a | 09 09 2f 2a 20 66 69 6c |tinue;..|../* fil|
|000026a0| 65 20 69 73 20 65 78 65 | 63 75 74 61 62 6c 65 20 |e is exe|cutable |
|000026b0| 2a 2f 0a 0a 09 09 2a 73 | 20 3d 20 30 3b 0a 09 09 |*/....*s| = 0;...|
|000026c0| 69 66 20 28 73 74 61 74 | 28 62 75 66 2c 20 26 73 |if (stat|(buf, &s|
|000026d0| 74 29 20 21 3d 20 30 29 | 20 7b 0a 09 09 09 70 65 |t) != 0)| {....pe|
|000026e0| 72 72 6f 72 28 62 75 66 | 29 3b 0a 09 09 09 63 6f |rror(buf|);....co|
|000026f0| 6e 74 69 6e 75 65 3b 0a | 09 09 7d 0a 0a 09 09 69 |ntinue;.|..}....i|
|00002700| 66 20 28 21 28 73 74 2e | 73 74 5f 6d 6f 64 65 20 |f (!(st.|st_mode |
|00002710| 26 20 72 6d 61 73 6b 29 | 29 20 7b 0a 09 09 09 66 |& rmask)|) {....f|
|00002720| 70 72 69 6e 74 66 28 73 | 74 64 65 72 72 2c 0a 09 |printf(s|tderr,..|
|00002730| 09 09 09 22 25 73 3a 20 | 25 73 20 66 6f 75 6e 64 |..."%s: |%s found|
|00002740| 20 69 6e 20 75 6e 72 65 | 61 64 61 62 6c 65 20 64 | in unre|adable d|
|00002750| 69 72 65 63 74 6f 72 79 | 20 25 73 21 5c 6e 22 2c |irectory| %s!\n",|
|00002760| 0a 09 09 09 09 50 72 6f | 67 2c 20 2a 61 72 67 76 |.....Pro|g, *argv|
|00002770| 2c 20 62 75 66 29 3b 0a | 09 09 09 66 6f 75 6e 64 |, buf);.|...found|
|00002780| 20 3d 20 31 3b 0a 09 09 | 09 63 6f 6e 74 69 6e 75 | = 1;...|.continu|
|00002790| 65 3b 0a 09 09 7d 0a 0a | 09 09 2f 2a 20 64 69 72 |e;...}..|../* dir|
|000027a0| 65 63 74 6f 72 79 20 69 | 73 20 72 65 61 64 61 62 |ectory i|s readab|
|000027b0| 6c 65 20 2a 2f 0a 0a 09 | 09 2a 73 20 3d 20 27 2f |le */...|.*s = '/|
|000027c0| 27 3b 0a 09 09 70 75 74 | 73 28 62 75 66 29 3b 0a |';...put|s(buf);.|
|000027d0| 09 09 69 66 20 28 21 61 | 6c 6c 29 0a 09 09 09 65 |..if (!a|ll)....e|
|000027e0| 78 69 74 28 30 29 3b 0a | 09 09 66 6f 75 6e 64 20 |xit(0);.|..found |
|000027f0| 3d 20 31 3b 0a 09 7d 0a | 0a 09 69 66 20 28 66 6f |= 1;..}.|..if (fo|
|00002800| 75 6e 64 29 0a 09 09 65 | 78 69 74 28 30 29 3b 0a |und)...e|xit(0);.|
|00002810| 0a 09 63 6f 6e 76 65 72 | 74 28 73 61 76 65 2c 20 |..conver|t(save, |
|00002820| 62 75 66 29 3b 0a 09 66 | 70 72 69 6e 74 66 28 73 |buf);..f|printf(s|
|00002830| 74 64 65 72 72 2c 20 22 | 25 73 20 6e 6f 74 20 66 |tderr, "|%s not f|
|00002840| 6f 75 6e 64 20 69 6e 5c | 6e 25 73 5c 6e 22 2c 20 |ound in\|n%s\n", |
|00002850| 2a 61 72 67 76 2c 20 62 | 75 66 29 3b 0a 09 65 78 |*argv, b|uf);..ex|
|00002860| 69 74 28 31 29 3b 0a 7d | 0a 0a 0a 76 6f 69 64 09 |it(1);.}|...void.|
|00002870| 63 6f 6e 76 65 72 74 28 | 70 61 74 68 2c 20 62 75 |convert(|path, bu|
|00002880| 66 29 0a 72 65 67 69 73 | 74 65 72 20 63 68 61 72 |f).regis|ter char|
|00002890| 09 2a 70 61 74 68 2c 20 | 2a 62 75 66 3b 0a 7b 0a |.*path, |*buf;.{.|
|000028a0| 09 66 6f 72 20 28 3b 3b | 29 20 7b 0a 09 09 77 68 |.for (;;|) {...wh|
|000028b0| 69 6c 65 20 28 28 2a 62 | 75 66 2b 2b 20 3d 20 2a |ile ((*b|uf++ = *|
|000028c0| 70 61 74 68 29 20 26 26 | 20 2a 70 61 74 68 2b 2b |path) &&| *path++|
|000028d0| 20 21 3d 20 27 3a 27 29 | 0a 09 09 09 3b 0a 09 09 | != ':')|....;...|
|000028e0| 69 66 20 28 21 2a 70 61 | 74 68 29 0a 09 09 09 62 |if (!*pa|th)....b|
|000028f0| 72 65 61 6b 3b 0a 09 09 | 2a 62 75 66 2b 2b 20 3d |reak;...|*buf++ =|
|00002900| 20 27 5c 6e 27 3b 0a 09 | 7d 0a 09 2a 62 75 66 20 | '\n';..|}..*buf |
|00002910| 3d 20 27 5c 30 27 3b 09 | 09 2f 2a 20 74 6f 20 63 |= '\0';.|./* to c|
|00002920| 6f 70 65 20 77 69 74 68 | 20 61 20 50 41 54 48 20 |ope with| a PATH |
|00002930| 65 6e 64 69 6e 67 20 69 | 6e 20 27 3a 27 20 2a 2f |ending i|n ':' */|
|00002940| 0a 7d 0a 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.}......|........|
|00002950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002980| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002990| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000029a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000029b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000029c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000029d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000029e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000029f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002aa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ab0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ac0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ad0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ae0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002af0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002b90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ba0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002bb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002bc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002bd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002be0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002bf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ca0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002cb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002cc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002cd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ce0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002cf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002da0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002db0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002dc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002dd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002de0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002df0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e00| 74 73 20 6f 66 0a 2e 49 | 20 73 68 0a 61 6e 64 20 |ts of..I| sh.and |
|00002e10| 77 68 69 63 68 20 6b 6e | 6f 77 20 5c 66 49 61 6c |which kn|ow \fIal|
|00002e20| 69 61 73 65 73 5c 66 52 | 2e 20 49 66 20 79 6f 75 |iases\fR|. If you|
|00002e30| 72 20 73 68 65 6c 6c 20 | 68 61 73 20 5c 66 49 73 |r shell |has \fIs|
|00002e40| 68 65 6c 6c 20 66 75 6e | 63 74 69 6f 6e 73 5c 66 |hell fun|ctions\f|
|00002e50| 52 2c 20 79 6f 75 0a 63 | 61 6e 20 75 73 65 20 74 |R, you.c|an use t|
|00002e60| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 66 75 6e |he follo|wing fun|
|00002e70| 63 74 69 6f 6e 3a 0a 2e | 66 74 20 42 0a 2e 6e 66 |ction:..|ft B..nf|
|00002e80| 0a 0a 09 77 68 69 63 68 | 28 29 0a 09 7b 0a 09 09 |...which|()..{...|
|00002e90| 65 76 61 6c 20 6c 61 73 | 74 3d 5c 5c 22 5c 5c 24 |eval las|t=\\"\\$|
|00002ea0| 24 23 5c 5c 22 0a 09 09 | 73 65 74 20 7c 20 73 65 |$#\\"...|set | se|
|00002eb0| 64 20 5c 2d 6e 20 22 2f | 5e 24 6c 61 73 74 28 29 |d \-n "/|^$last()|
|00002ec0| 7b 24 2f 2c 2f 5e 7d 24 | 2f 70 22 20 7c 0a 09 09 |{$/,/^}$|/p" |...|
|00002ed0| 09 2f 75 73 72 2f 6c 6f | 63 61 6c 2f 62 69 6e 2f |./usr/lo|cal/bin/|
|00002ee0| 77 68 69 63 68 20 5c 2d | 69 20 24 7b 31 2b 22 24 |which \-|i ${1+"$|
|00002ef0| 40 22 7d 0a 09 7d 0a 0a | 2e 66 69 0a 2e 66 74 20 |@"}..}..|.fi..ft |
|00002f00| 52 0a 49 66 20 74 68 65 | 20 60 5c 66 49 5c 2d 61 |R.If the| `\fI\-a|
|00002f10| 5c 66 52 27 20 28 3d 20 | 61 6c 6c 29 20 66 6c 61 |\fR' (= |all) fla|
|00002f20| 67 20 69 73 20 67 69 76 | 65 6e 2c 0a 2e 49 20 77 |g is giv|en,..I w|
|00002f30| 68 69 63 68 0a 77 69 6c | 6c 20 6e 6f 74 20 73 74 |hich.wil|l not st|
|00002f40| 6f 70 20 61 66 74 65 72 | 20 74 68 65 20 66 69 72 |op after| the fir|
|00002f50| 73 74 20 60 6d 61 74 63 | 68 27 2c 20 62 75 74 20 |st `matc|h', but |
|00002f60| 73 65 61 72 63 68 20 66 | 6f 72 20 61 6c 6c 20 6f |search f|or all o|
|00002f70| 63 63 75 72 72 65 6e 63 | 65 73 20 6f 66 0a 2e 49 |ccurrenc|es of..I|
|00002f80| 20 63 6f 6d 6d 61 6e 64 | 0a 69 6e 20 74 68 65 20 | command|.in the |
|00002f90| 75 73 65 72 27 73 0a 2e | 49 20 50 41 54 48 2e 0a |user's..|I PATH..|
|00002fa0| 54 68 65 20 60 5c 66 49 | 5c 2d 5c 2d 5c 66 52 27 |The `\fI|\-\-\fR'|
|00002fb0| 0a 66 6c 61 67 20 63 61 | 6e 20 62 65 20 75 73 65 |.flag ca|n be use|
|00002fc0| 64 20 74 6f 20 65 6e 64 | 20 74 68 65 20 6c 69 73 |d to end| the lis|
|00002fd0| 74 20 6f 66 20 6f 70 74 | 69 6f 6e 73 3a 20 74 68 |t of opt|ions: th|
|00002fe0| 65 20 6e 65 78 74 20 61 | 72 67 75 6d 65 6e 74 20 |e next a|rgument |
|00002ff0| 28 69 66 20 70 72 65 73 | 65 6e 74 29 0a 77 69 6c |(if pres|ent).wil|
|00003000| 6c 20 62 65 20 74 61 6b | 65 6e 20 61 73 20 5c 66 |l be tak|en as \f|
|00003010| 49 63 6f 6d 6d 61 6e 64 | 5c 66 52 2c 20 65 76 65 |Icommand|\fR, eve|
|00003020| 6e 20 69 66 20 69 74 20 | 73 74 61 72 74 73 20 77 |n if it |starts w|
|00003030| 69 74 68 20 61 20 60 5c | 2d 27 2e 0a 5c 66 49 57 |ith a `\|-'..\fIW|
|00003040| 68 69 63 68 20 5b 5c 2d | 69 5d 20 5b 5c 2d 61 5d |hich [\-|i] [\-a]|
|00003050| 20 5b 5c 2d 5c 2d 5d 5c | 66 52 0a 77 69 74 68 6f | [\-\-]\|fR.witho|
|00003060| 75 74 20 66 75 72 74 68 | 65 72 20 61 72 67 75 6d |ut furth|er argum|
|00003070| 65 6e 74 73 20 70 72 69 | 6e 74 73 20 74 68 65 20 |ents pri|nts the |
|00003080| 75 73 65 72 27 73 0a 2e | 49 20 50 41 54 48 0a 62 |user's..|I PATH.b|
|00003090| 72 6f 6b 65 6e 20 75 70 | 20 69 6e 74 6f 20 69 74 |roken up| into it|
|000030a0| 73 20 63 6f 6d 70 6f 6e | 65 6e 74 73 2c 0a 6f 6e |s compon|ents,.on|
|000030b0| 65 20 70 65 72 20 6c 69 | 6e 65 2e 0a 2e 50 50 0a |e per li|ne...PP.|
|000030c0| 54 68 69 73 20 6e 65 77 | 20 76 65 72 73 69 6f 6e |This new| version|
|000030d0| 20 6f 66 20 74 68 65 0a | 2e 49 20 77 68 69 63 68 | of the.|.I which|
|000030e0| 0a 63 6f 6d 6d 61 6e 64 | 20 69 73 20 6e 6f 74 20 |.command| is not |
|000030f0| 61 0a 2e 49 20 63 73 68 | 0a 73 63 72 69 70 74 2e |a..I csh|.script.|
|00003100| 0a 42 65 69 6e 67 20 61 | 6e 20 65 78 65 63 75 74 |.Being a|n execut|
|00003110| 61 62 6c 65 20 69 74 20 | 69 73 20 6d 75 63 68 20 |able it |is much |
|00003120| 66 61 73 74 65 72 2c 20 | 61 6e 64 20 6e 6f 74 20 |faster, |and not |
|00003130| 73 6f 75 72 63 69 6e 67 | 20 0a 2e 49 20 2e 63 73 |sourcing| ..I .cs|
|00003140| 68 72 63 0a 69 74 20 67 | 69 76 65 73 20 61 20 74 |hrc.it g|ives a t|
|00003150| 72 75 65 20 70 69 63 74 | 75 72 65 20 6f 66 20 6f |rue pict|ure of o|
|00003160| 6e 65 27 73 0a 2e 49 20 | 61 6c 69 61 73 65 73 2e |ne's..I |aliases.|
|00003170| 0a 2e 53 48 20 45 58 41 | 4d 50 4c 45 0a 2e 66 74 |..SH EXA|MPLE..ft|
|00003180| 20 42 0a 2e 6e 66 0a 25 | 20 61 6c 69 61 73 0a 77 | B..nf.%| alias.w|
|00003190| 68 69 63 68 09 61 6c 69 | 61 73 20 21 24 20 7c 20 |hich.ali|as !$ | |
|000031a0| 2f 75 73 72 2f 6c 6f 63 | 61 6c 2f 62 69 6e 2f 77 |/usr/loc|al/bin/w|
|000031b0| 68 69 63 68 20 5c 2d 69 | 20 21 2a 0a 25 20 77 68 |hich \-i| !*.% wh|
|000031c0| 69 63 68 20 77 68 69 63 | 68 0a 77 68 69 63 68 09 |ich whic|h.which.|
|000031d0| 61 6c 69 61 73 20 21 24 | 20 7c 20 2f 75 73 72 2f |alias !$| | /usr/|
|000031e0| 6c 6f 63 61 6c 2f 62 69 | 6e 2f 77 68 69 63 68 20 |local/bi|n/which |
|000031f0| 5c 2d 69 20 21 2a 0a 25 | 20 77 68 69 63 68 20 5c |\-i !*.%| which \|
|00003200| 2d 61 20 77 68 69 63 68 | 0a 77 68 69 63 68 09 61 |-a which|.which.a|
|00003210| 6c 69 61 73 20 21 24 20 | 7c 20 2f 75 73 72 2f 6c |lias !$ || /usr/l|
|00003220| 6f 63 61 6c 2f 62 69 6e | 2f 77 68 69 63 68 20 5c |ocal/bin|/which \|
|00003230| 2d 69 20 21 2a 0a 2f 75 | 73 72 2f 6c 6f 63 61 6c |-i !*./u|sr/local|
|00003240| 2f 62 69 6e 2f 77 68 69 | 63 68 0a 2f 75 73 72 2f |/bin/whi|ch./usr/|
|00003250| 75 63 62 2f 77 68 69 63 | 68 0a 25 0a 2e 66 69 0a |ucb/whic|h.%..fi.|
|00003260| 2e 66 74 20 52 0a 2e 53 | 48 20 41 55 54 48 4f 52 |.ft R..S|H AUTHOR|
|00003270| 0a 4d 61 61 72 74 65 6e | 20 4c 69 74 6d 61 61 74 |.Maarten| Litmaat|
|00003280| 68 20 40 20 56 55 20 49 | 6e 66 6f 72 6d 61 74 69 |h @ VU I|nformati|
|00003290| 6b 61 20 41 6d 73 74 65 | 72 64 61 6d 0a 00 00 00 |ka Amste|rdam....|
|000032a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000032b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000032c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000032d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000032e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000032f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003300| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003310| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003320| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003330| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003380| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003390| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000033f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003400| 77 68 69 63 68 2f 4d 61 | 6b 65 66 69 6c 65 00 00 |which/Ma|kefile..|
|00003410| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003420| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003430| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003440| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003450| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003460| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 31 35 |.... 6|44 . 15|
|00003470| 32 34 20 00 20 20 20 20 | 31 33 20 00 20 20 20 20 |24 . |13 . |
|00003480| 20 20 20 20 32 35 31 20 | 20 34 35 37 32 35 32 35 | 251 | 4572525|
|00003490| 33 36 36 20 20 20 36 36 | 36 33 00 20 00 00 00 00 |366 66|63. ....|
|000034a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000034b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000034c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000034d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000034e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000034f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003500| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003510| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003520| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003530| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003580| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003590| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000035f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003600| 23 20 4d 61 6b 65 66 69 | 6c 65 20 66 6f 72 20 2f |# Makefi|le for /|
|00003610| 75 73 72 2f 6c 6f 63 61 | 6c 2f 62 69 6e 2f 77 68 |usr/loca|l/bin/wh|
|00003620| 69 63 68 0a 0a 77 68 69 | 63 68 3a 09 09 77 68 69 |ich..whi|ch:..whi|
|00003630| 63 68 34 2e 63 0a 09 09 | 63 63 20 2d 4f 20 77 68 |ch4.c...|cc -O wh|
|00003640| 69 63 68 34 2e 63 20 2d | 6f 20 77 68 69 63 68 0a |ich4.c -|o which.|
|00003650| 0a 69 6e 73 74 61 6c 6c | 3a 09 77 68 69 63 68 0a |.install|:.which.|
|00003660| 09 09 2f 62 69 6e 2f 6d | 76 20 2d 66 20 77 68 69 |../bin/m|v -f whi|
|00003670| 63 68 20 2f 75 73 72 2f | 6c 6f 63 61 6c 2f 62 69 |ch /usr/|local/bi|
|00003680| 6e 0a 0a 64 6f 63 3a 0a | 09 09 6e 72 6f 66 66 20 |n..doc:.|..nroff |
|00003690| 2d 6d 61 6e 20 77 68 69 | 63 68 2e 31 20 3e 20 77 |-man whi|ch.1 > w|
|000036a0| 68 69 63 68 2e 6d 61 6e | 0a 44 45 53 43 52 49 50 |hich.man|.DESCRIP|
|000036b0| 54 49 4f 4e 0a 2e 49 20 | 57 68 69 63 68 0a 70 72 |TION..I |Which.pr|
|000036c0| 6f 76 69 64 65 73 20 74 | 68 65 20 75 73 65 72 20 |ovides t|he user |
|000036d0| 77 69 74 68 20 74 68 65 | 20 66 75 6c 6c 20 65 78 |with the| full ex|
|000036e0| 70 61 6e 73 69 6f 6e 20 | 6f 66 20 74 68 65 0a 2e |pansion |of the..|
|000036f0| 49 20 63 6f 6d 6d 61 6e | 64 0a 61 72 67 75 6d 65 |I comman|d.argume|
|00003700| 6e 74 2c 20 62 65 20 69 | 74 20 65 69 74 68 65 72 |nt, be i|t either|
|00003710| 20 61 6e 20 5c 66 49 61 | 6c 69 61 73 5c 66 52 2c | an \fIa|lias\fR,|
|00003720| 20 61 20 5c 66 49 73 68 | 65 6c 6c 20 66 75 6e 63 | a \fIsh|ell func|
|00003730| 74 69 6f 6e 5c 66 52 0a | 6f 72 20 61 6e 20 65 78 |tion\fR.|or an ex|
|00003740| 65 63 75 74 61 62 6c 65 | 20 66 69 6c 65 20 28 64 |ecutable| file (d|
|00003750| 65 66 61 75 6c 74 29 2e | 20 54 6f 20 65 6e 61 62 |efault).| To enab|
|00003760| 6c 65 20 73 65 61 72 63 | 68 20 66 6f 72 0a 2e 49 |le searc|h for..I|
|00003770| 20 61 6c 69 61 73 65 73 | 0a 61 6e 64 20 5c 66 49 | aliases|.and \fI|
|00003780| 73 68 65 6c 6c 20 66 75 | 6e 63 74 69 6f 6e 73 5c |shell fu|nctions\|
|00003790| 66 52 0a 74 68 65 20 75 | 73 65 72 20 73 68 6f 75 |fR.the u|ser shou|
|000037a0| 6c 64 20 73 75 70 70 6c | 79 20 74 68 65 20 60 5c |ld suppl|y the `\|
|000037b0| 66 49 5c 2d 69 5c 66 52 | 27 0a 28 3d 20 69 6e 74 |fI\-i\fR|'.(= int|
|000037c0| 65 72 61 63 74 69 76 65 | 29 20 66 6c 61 67 2e 20 |eractive|) flag. |
|000037d0| 49 6e 20 74 68 61 74 20 | 63 61 73 65 0a 2e 49 20 |In that |case..I |
|000037e0| 77 68 69 63 68 0a 65 78 | 70 65 63 74 73 20 61 73 |which.ex|pects as|
|000037f0| 20 73 74 61 6e 64 61 72 | 64 20 69 6e 70 75 74 20 | standar|d input |
|00003800| 77 68 69 63 68 2f 77 68 | 69 63 68 34 2e 63 00 00 |which/wh|ich4.c..|
|00003810| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003820| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003830| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003840| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003850| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003860| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 31 35 |.... 6|44 . 15|
|00003870| 32 34 20 00 20 20 20 20 | 31 33 20 00 20 20 20 20 |24 . |13 . |
|00003880| 20 20 20 37 35 30 33 20 | 20 34 35 37 32 35 32 35 | 7503 | 4572525|
|00003890| 33 36 37 20 20 20 36 36 | 30 35 00 20 00 00 00 00 |367 66|05. ....|
|000038a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000038b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000038c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000038d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000038e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000038f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003900| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003910| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003920| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003930| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003940| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003980| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003990| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003a00| 2f 2a 0a 20 2a 20 77 68 | 69 63 68 20 5b 2d 69 5d |/*. * wh|ich [-i]|
|00003a10| 20 5b 2d 61 5d 20 5b 2d | 2d 5d 20 5b 3c 63 6f 6d | [-a] [-|-] [<com|
|00003a20| 6d 61 6e 64 3e 5d 0a 20 | 2a 20 61 6c 69 61 73 20 |mand>]. |* alias |
|00003a30| 77 68 69 63 68 20 61 6c | 69 61 73 20 21 5c 24 20 |which al|ias !\$ |
|00003a40| 5c 7c 20 2f 75 73 72 2f | 6c 6f 63 61 6c 2f 62 69 |\| /usr/|local/bi|
|00003a50| 6e 2f 77 68 69 63 68 20 | 2d 69 20 21 5c 2a 0a 20 |n/which |-i !\*. |
|00003a60| 2a 20 61 6c 69 61 73 20 | 77 68 69 63 68 20 27 65 |* alias |which 'e|
|00003a70| 76 61 6c 20 61 6c 69 61 | 73 20 5c 24 24 23 20 7c |val alia|s \$$# ||
|00003a80| 20 2f 75 73 72 2f 6c 6f | 63 61 6c 2f 62 69 6e 2f | /usr/lo|cal/bin/|
|00003a90| 77 68 69 63 68 20 2d 69 | 20 24 7b 31 2b 22 24 40 |which -i| ${1+"$@|
|00003aa0| 22 7d 27 0a 20 2a 20 77 | 68 69 63 68 28 29 0a 20 |"}'. * w|hich(). |
|00003ab0| 2a 20 7b 0a 20 2a 09 65 | 76 61 6c 20 6c 61 73 74 |* {. *.e|val last|
|00003ac0| 3d 5c 22 5c 24 24 23 5c | 22 0a 20 2a 09 73 65 74 |=\"\$$#\|". *.set|
|00003ad0| 20 7c 20 73 65 64 20 2d | 6e 20 22 2f 5e 24 6c 61 | | sed -|n "/^$la|
|00003ae0| 73 74 28 29 7b 24 2f 2c | 2f 5e 7d 24 2f 70 22 20 |st(){$/,|/^}$/p" |
|00003af0| 7c 0a 20 2a 09 09 2f 75 | 73 72 2f 6c 6f 63 61 6c ||. *../u|sr/local|
|00003b00| 2f 62 69 6e 2f 77 68 69 | 63 68 20 2d 69 20 24 7b |/bin/whi|ch -i ${|
|00003b10| 31 2b 22 24 40 22 7d 0a | 20 2a 20 7d 0a 20 2a 0a |1+"$@"}.| * }. *.|
|00003b20| 20 2a 20 61 75 74 68 6f | 72 3a 20 4d 61 61 72 74 | * autho|r: Maart|
|00003b30| 65 6e 20 4c 69 74 6d 61 | 61 74 68 20 40 20 56 55 |en Litma|ath @ VU|
|00003b40| 20 55 6e 69 76 65 72 73 | 69 74 79 20 41 6d 73 74 | Univers|ity Amst|
|00003b50| 65 72 64 61 6d 20 28 6d | 61 61 72 74 40 63 73 2e |erdam (m|aart@cs.|
|00003b60| 76 75 2e 6e 6c 29 0a 20 | 2a 20 66 69 72 73 74 20 |vu.nl). |* first |
|00003b70| 63 68 61 6e 67 65 3a 0a | 20 2a 09 45 6d 69 6c 65 |change:.| *.Emile|
|00003b80| 20 4c 65 42 6c 61 6e 63 | 20 28 6c 65 62 6c 61 6e | LeBlanc| (leblan|
|00003b90| 63 25 6d 61 74 68 2e 42 | 65 72 6b 65 6c 65 79 2e |c%math.B|erkeley.|
|00003ba0| 45 44 55 40 75 63 62 76 | 61 78 2e 62 65 72 6b 65 |EDU@ucbv|ax.berke|
|00003bb0| 6c 65 79 2e 65 64 75 29 | 20 6e 6f 74 65 73 0a 20 |ley.edu)| notes. |
|00003bc0| 2a 09 74 68 65 20 61 63 | 63 65 73 73 28 29 20 73 |*.the ac|cess() s|
|00003bd0| 79 73 74 65 6d 20 63 61 | 6c 6c 20 63 6f 6e 73 69 |ystem ca|ll consi|
|00003be0| 64 65 72 69 6e 67 20 65 | 76 65 72 79 74 68 69 6e |dering e|verythin|
|00003bf0| 67 20 65 78 65 63 75 74 | 61 62 6c 65 20 66 6f 72 |g execut|able for|
|00003c00| 0a 20 2a 09 72 6f 6f 74 | 20 28 21 29 2c 20 73 6f |. *.root| (!), so|
|00003c10| 20 77 65 20 67 69 76 65 | 20 72 6f 6f 74 20 61 20 | we give| root a |
|00003c20| 73 70 65 63 69 61 6c 20 | 74 72 65 61 74 6d 65 6e |special |treatmen|
|00003c30| 74 0a 20 2a 09 27 77 68 | 69 63 68 27 2c 20 27 77 |t. *.'wh|ich', 'w|
|00003c40| 68 69 63 68 20 2d 69 27 | 20 61 6e 64 20 27 77 68 |hich -i'| and 'wh|
|00003c50| 69 63 68 20 2d 61 27 20 | 77 69 74 68 20 6e 6f 20 |ich -a' |with no |
|00003c60| 66 75 72 74 68 65 72 20 | 61 72 67 75 6d 65 6e 74 |further |argument|
|00003c70| 73 20 6e 6f 77 0a 20 2a | 09 72 65 74 75 72 6e 20 |s now. *|.return |
|00003c80| 74 68 65 20 50 41 54 48 | 20 65 6e 76 69 72 6f 6e |the PATH| environ|
|00003c90| 6d 65 6e 74 20 76 61 72 | 69 61 62 6c 65 2c 20 73 |ment var|iable, s|
|00003ca0| 70 6c 69 74 20 75 70 20 | 69 6e 74 6f 20 69 74 73 |plit up |into its|
|00003cb0| 20 63 6f 6d 70 6f 6e 65 | 6e 74 73 0a 20 2a 09 74 | compone|nts. *.t|
|00003cc0| 68 65 20 61 6c 69 61 73 | 65 73 20 64 65 66 69 6e |he alias|es defin|
|00003cd0| 65 64 20 61 62 6f 76 65 | 20 61 72 65 20 73 6c 69 |ed above| are sli|
|00003ce0| 67 68 74 6c 79 20 64 69 | 66 66 65 72 65 6e 74 20 |ghtly di|fferent |
|00003cf0| 66 72 6f 6d 20 74 68 65 | 20 70 72 65 76 69 6f 75 |from the| previou|
|00003d00| 73 0a 20 2a 09 76 65 72 | 73 69 6f 6e 20 2d 20 6e |s. *.ver|sion - n|
|00003d10| 6f 77 20 69 74 27 73 20 | 74 68 65 20 73 68 65 6c |ow it's |the shel|
|00003d20| 6c 20 77 68 6f 27 73 20 | 64 6f 69 6e 67 20 74 68 |l who's |doing th|
|00003d30| 65 20 61 6c 69 61 73 20 | 63 68 65 63 6b 69 6e 67 |e alias |checking|
|00003d40| 0a 20 2a 20 73 65 63 6f | 6e 64 20 63 68 61 6e 67 |. * seco|nd chang|
|00003d50| 65 3a 0a 20 2a 09 61 64 | 64 65 64 20 73 75 70 70 |e:. *.ad|ded supp|
|00003d60| 6f 72 74 20 66 6f 72 20 | 73 68 65 6c 6c 20 66 75 |ort for |shell fu|
|00003d70| 6e 63 74 69 6f 6e 73 20 | 61 6e 64 20 6d 75 6c 74 |nctions |and mult|
|00003d80| 69 6c 69 6e 65 20 61 6c | 69 61 73 65 73 2c 20 61 |iline al|iases, a|
|00003d90| 64 64 65 64 20 74 68 65 | 0a 20 2a 09 60 2d 2d 27 |dded the|. *.`--'|
|00003da0| 20 6f 70 74 69 6f 6e 2c | 20 63 68 61 6e 67 65 64 | option,| changed|
|00003db0| 20 74 68 65 20 73 6f 75 | 72 63 65 20 73 74 79 6c | the sou|rce styl|
|00003dc0| 65 0a 20 2a 20 74 68 69 | 72 64 20 63 68 61 6e 67 |e. * thi|rd chang|
|00003dd0| 65 3a 0a 20 2a 09 74 6f | 20 68 65 6c 6c 20 77 69 |e:. *.to| hell wi|
|00003de0| 74 68 20 61 63 63 65 73 | 73 28 29 21 0a 20 2a 09 |th acces|s()!. *.|
|00003df0| 6e 6f 77 20 73 74 61 74 | 28 29 20 69 73 20 75 73 |now stat|() is us|
|00003e00| 65 64 20 74 6f 20 67 69 | 76 65 20 74 68 65 20 72 |ed to gi|ve the r|
|00003e10| 69 67 68 74 20 61 6e 73 | 77 65 72 20 65 76 65 6e |ight ans|wer even|
|00003e20| 20 69 66 20 74 68 65 20 | 65 66 66 65 63 74 69 76 | if the |effectiv|
|00003e30| 65 0a 20 2a 09 75 69 64 | 20 28 67 69 64 29 20 64 |e. *.uid| (gid) d|
|00003e40| 69 66 66 65 72 73 20 66 | 72 6f 6d 20 74 68 65 20 |iffers f|rom the |
|00003e50| 72 65 61 6c 20 75 69 64 | 20 28 67 69 64 29 0a 20 |real uid| (gid). |
|00003e60| 2a 09 77 65 20 63 61 6e | 27 74 20 75 73 65 20 73 |*.we can|'t use s|
|00003e70| 65 74 75 69 64 28 67 65 | 74 65 75 69 64 28 29 29 |etuid(ge|teuid())|
|00003e80| 2c 20 62 65 63 61 75 73 | 65 20 74 68 61 74 27 73 |, becaus|e that's|
|00003e90| 20 6e 6f 6e 70 6f 72 74 | 61 62 6c 65 20 3a 2d 28 | nonport|able :-(|
|00003ea0| 0a 20 2a 2f 0a 0a 23 69 | 6e 63 6c 75 64 65 09 3c |. */..#i|nclude.<|
|00003eb0| 73 79 73 2f 74 79 70 65 | 73 2e 68 3e 0a 23 69 6e |sys/type|s.h>.#in|
|00003ec0| 63 6c 75 64 65 09 3c 73 | 79 73 2f 73 74 61 74 2e |clude.<s|ys/stat.|
|00003ed0| 68 3e 0a 23 69 6e 63 6c | 75 64 65 09 3c 73 74 64 |h>.#incl|ude.<std|
|00003ee0| 69 6f 2e 68 3e 0a 0a 23 | 64 65 66 69 6e 65 09 09 |io.h>..#|define..|
|00003ef0| 42 55 46 5f 53 49 5a 45 | 09 35 31 32 0a 23 64 65 |BUF_SIZE|.512.#de|
|00003f00| 66 69 6e 65 09 09 4d 5f | 55 53 52 09 09 30 37 30 |fine..M_|USR..070|
|00003f10| 30 0a 23 64 65 66 69 6e | 65 09 09 4d 5f 47 52 50 |0.#defin|e..M_GRP|
|00003f20| 09 09 30 30 37 30 0a 23 | 64 65 66 69 6e 65 09 09 |..0070.#|define..|
|00003f30| 4d 5f 4f 54 48 09 09 30 | 30 30 37 0a 23 64 65 66 |M_OTH..0|007.#def|
|00003f40| 69 6e 65 09 09 58 5f 41 | 4c 4c 09 09 30 31 31 31 |ine..X_A|LL..0111|
|00003f50| 0a 23 64 65 66 69 6e 65 | 09 09 52 5f 41 4c 4c 09 |.#define|..R_ALL.|
|00003f60| 09 30 34 34 34 0a 0a 63 | 68 61 72 09 56 65 72 73 |.0444..c|har.Vers|
|00003f70| 69 6f 6e 5b 5d 20 3d 0a | 09 22 40 28 23 29 77 68 |ion[] =.|."@(#)wh|
|00003f80| 69 63 68 20 34 2e 30 20 | 39 30 2f 30 31 2f 32 34 |ich 4.0 |90/01/24|
|00003f90| 20 4d 61 61 72 74 65 6e | 20 4c 69 74 6d 61 61 74 | Maarten| Litmaat|
|00003fa0| 68 20 40 20 56 55 20 49 | 6e 66 6f 72 6d 61 74 69 |h @ VU I|nformati|
|00003fb0| 6b 61 20 41 6d 73 74 65 | 72 64 61 6d 22 3b 0a 63 |ka Amste|rdam";.c|
|00003fc0| 68 61 72 09 2a 50 72 6f | 67 3b 0a 0a 0a 76 6f 69 |har.*Pro|g;...voi|
|00003fd0| 64 09 75 73 61 67 65 28 | 29 0a 7b 0a 09 66 70 72 |d.usage(|).{..fpr|
|00003fe0| 69 6e 74 66 28 73 74 64 | 65 72 72 2c 20 22 55 73 |intf(std|err, "Us|
|00003ff0| 61 67 65 3a 20 25 73 20 | 5b 2d 69 5d 20 5b 2d 61 |age: %s |[-i] [-a|
+--------+-------------------------+-------------------------+--------+--------+