home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / unix_c / sysadmin / dbgrep.tar < prev    next >
Tape Archive  |  1989-03-04  |  24.0 KB

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: dbgrep.tar

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Tape Archive (archive/tar) magic Supported
100% file tar archive default
99% file tar archive (V7), file dbgrep/, mode 755 , uid 243 , gid 12 , size 0 , seconds 4404054352 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| 64 62 67 72 65 70 2f 00 | 00 00 00 00 00 00 00 00 |dbgrep/.|........|
|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 20 32 |.... 7|55 . 2|
|00000070| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00000080| 20 20 20 20 20 20 30 20 | 20 34 34 30 34 30 35 34 | 0 | 4404054|
|00000090| 33 35 32 20 20 20 35 32 | 35 37 00 20 00 00 00 00 |352 52|57. ....|
|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| 64 62 67 72 65 70 2f 53 | 68 61 72 46 69 6c 65 2e |dbgrep/S|harFile.|
|00000210| 48 65 61 64 65 72 73 00 | 00 00 00 00 00 00 00 00 |Headers.|........|
|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 20 32 |.... 6|44 . 2|
|00000270| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00000280| 20 20 20 20 20 35 32 20 | 20 34 34 30 34 30 35 34 | 52 | 4404054|
|00000290| 33 35 34 20 20 31 30 32 | 37 35 00 20 00 00 00 00 |354 102|75. ....|
|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 64 62 67 72 | 65 70 2e 73 68 61 72 20 |=== dbgr|ep.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 | 3d 0a 65 61 64 65 72 73 |========|=.eaders|
|00000430| 00 00 00 00 1b 90 01 00 | 14 00 08 00 4d 61 6b 65 |........|....Make|
|00000440| 66 69 6c 65 00 00 00 00 | 1c 90 01 00 14 00 08 00 |file....|........|
|00000450| 64 62 67 72 65 70 2e 38 | 00 00 00 00 1d 90 01 00 |dbgrep.8|........|
|00000460| a4 01 08 00 64 62 67 72 | 65 70 2e 63 00 00 00 00 |....dbgr|ep.c....|
|00000470| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000480| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000490| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000500| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000510| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000520| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000530| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000580| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000590| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000600| 64 62 67 72 65 70 2f 4d | 61 6b 65 66 69 6c 65 00 |dbgrep/M|akefile.|
|00000610| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000620| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000630| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000640| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000650| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000660| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00000670| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00000680| 20 20 20 20 34 37 31 20 | 20 34 34 30 34 30 35 34 | 471 | 4404054|
|00000690| 33 34 34 20 20 20 36 37 | 36 37 00 20 00 00 00 00 |344 67|67. ....|
|000006a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000700| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000710| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|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| 23 0a 23 20 4d 61 6b 65 | 66 69 6c 65 20 66 6f 72 |#.# Make|file for|
|00000810| 20 64 62 67 72 65 70 2e | 0a 23 0a 23 20 44 61 76 | dbgrep.|.#.# Dav|
|00000820| 69 64 20 41 2e 20 43 75 | 72 72 79 0a 23 20 50 75 |id A. Cu|rry.# Pu|
|00000830| 72 64 75 65 20 55 6e 69 | 76 65 72 73 69 74 79 0a |rdue Uni|versity.|
|00000840| 23 20 45 6e 67 69 6e 65 | 65 72 69 6e 67 20 43 6f |# Engine|ering Co|
|00000850| 6d 70 75 74 65 72 20 4e | 65 74 77 6f 72 6b 0a 23 |mputer N|etwork.#|
|00000860| 20 64 61 76 79 40 69 6e | 74 72 65 70 69 64 2e 65 | davy@in|trepid.e|
|00000870| 63 6e 2e 70 75 72 64 75 | 65 2e 65 64 75 0a 23 20 |cn.purdu|e.edu.# |
|00000880| 4d 61 79 2c 20 31 39 38 | 38 0a 23 0a 43 46 4c 41 |May, 198|8.#.CFLA|
|00000890| 47 53 3d 09 2d 4f 0a 42 | 49 4e 44 49 52 3d 09 2f |GS=.-O.B|INDIR=./|
|000008a0| 75 73 72 2f 6c 6f 63 61 | 6c 0a 0a 64 62 67 72 65 |usr/loca|l..dbgre|
|000008b0| 70 3a 20 64 62 67 72 65 | 70 2e 63 0a 09 24 28 43 |p: dbgre|p.c..$(C|
|000008c0| 43 29 20 24 28 43 46 4c | 41 47 53 29 20 2d 6f 20 |C) $(CFL|AGS) -o |
|000008d0| 64 62 67 72 65 70 20 64 | 62 67 72 65 70 2e 63 0a |dbgrep d|bgrep.c.|
|000008e0| 0a 69 6e 73 74 61 6c 6c | 3a 20 64 62 67 72 65 70 |.install|: dbgrep|
|000008f0| 0a 09 69 6e 73 74 61 6c | 6c 20 2d 63 20 2d 73 20 |..instal|l -c -s |
|00000900| 64 62 67 72 65 70 20 24 | 28 42 49 4e 44 49 52 29 |dbgrep $|(BINDIR)|
|00000910| 2f 64 62 67 72 65 70 0a | 0a 63 6c 65 61 6e 3a 0a |/dbgrep.|.clean:.|
|00000920| 09 72 6d 20 2d 66 20 64 | 62 67 72 65 70 20 61 2e |.rm -f d|bgrep a.|
|00000930| 6f 75 74 20 63 6f 72 65 | 0a 00 00 00 00 00 00 00 |out core|........|
|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| 64 62 67 72 65 70 2f 64 | 62 67 72 65 70 2e 38 00 |dbgrep/d|bgrep.8.|
|00000a10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a60| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00000a70| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00000a80| 20 20 20 34 35 33 30 20 | 20 34 34 30 34 30 35 34 | 4530 | 4404054|
|00000a90| 33 34 35 20 20 20 36 37 | 30 34 00 20 00 00 00 00 |345 67|04. ....|
|00000aa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ab0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ac0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ad0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ae0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000af0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000b90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ba0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000be0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000bf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c00| 2e 54 48 20 44 42 47 52 | 45 50 20 38 20 22 37 20 |.TH DBGR|EP 8 "7 |
|00000c10| 4d 61 79 20 31 39 38 38 | 22 20 45 43 4e 0a 2e 53 |May 1988|" ECN..S|
|00000c20| 48 20 4e 41 4d 45 0a 64 | 62 67 72 65 70 20 5c 2d |H NAME.d|bgrep \-|
|00000c30| 20 73 65 61 72 63 68 20 | 72 61 77 20 64 69 73 6b | search |raw disk|
|00000c40| 20 62 6c 6f 63 6b 73 20 | 66 6f 72 20 61 20 70 61 | blocks |for a pa|
|00000c50| 74 74 65 72 6e 0a 2e 53 | 48 20 53 59 4e 4f 50 53 |ttern..S|H SYNOPS|
|00000c60| 49 53 0a 2e 42 20 64 62 | 67 72 65 70 0a 5b 0a 2e |IS..B db|grep.[..|
|00000c70| 42 20 5c 2d 65 0a 5d 20 | 5b 0a 2e 42 20 5c 2d 69 |B \-e.] |[..B \-i|
|00000c80| 0a 5d 20 5b 0a 2e 42 20 | 5c 2d 70 0a 5d 0a 2e 49 |.] [..B |\-p.]..I|
|00000c90| 20 70 61 74 74 65 72 6e | 0a 2e 49 20 66 69 6c 73 | pattern|..I fils|
|00000ca0| 79 73 0a 2e 53 48 20 44 | 45 53 43 52 49 54 50 49 |ys..SH D|ESCRITPI|
|00000cb0| 4f 4e 0a 2e 50 50 0a 2e | 42 20 64 62 67 72 65 70 |ON..PP..|B dbgrep|
|00000cc0| 0a 72 65 61 64 73 20 74 | 68 65 20 64 69 73 6b 20 |.reads t|he disk |
|00000cd0| 62 6c 6f 63 6b 73 20 61 | 73 73 6f 63 69 61 74 65 |blocks a|ssociate|
|00000ce0| 64 20 77 69 74 68 20 74 | 68 65 20 72 61 77 20 64 |d with t|he raw d|
|00000cf0| 69 73 6b 20 70 61 72 74 | 69 74 69 6f 6e 20 6d 6f |isk part|ition mo|
|00000d00| 75 6e 74 65 64 20 61 73 | 0a 74 68 65 20 66 69 6c |unted as|.the fil|
|00000d10| 65 20 73 79 73 74 65 6d | 0a 2e 49 20 66 69 6c 73 |e system|..I fils|
|00000d20| 79 73 0a 73 65 61 72 63 | 68 69 6e 67 20 66 6f 72 |ys.searc|hing for|
|00000d30| 20 6f 63 63 75 72 65 6e | 63 65 73 20 6f 66 0a 2e | occuren|ces of..|
|00000d40| 49 52 20 70 61 74 74 65 | 72 6e 20 2e 0a 46 6f 72 |IR patte|rn ..For|
|00000d50| 20 65 61 63 68 20 66 69 | 6c 65 20 77 68 6f 73 65 | each fi|le whose|
|00000d60| 20 64 69 73 6b 20 62 6c | 6f 63 6b 73 20 63 6f 6e | disk bl|ocks con|
|00000d70| 74 61 69 6e 0a 2e 49 52 | 20 70 61 74 74 65 72 6e |tain..IR| pattern|
|00000d80| 20 2c 0a 61 20 6c 69 6e | 65 20 73 69 6d 69 6c 61 | ,.a lin|e simila|
|00000d90| 72 20 74 6f 20 74 68 61 | 74 20 70 72 69 6e 74 65 |r to tha|t printe|
|00000da0| 64 20 62 79 0a 2e 42 20 | 22 6c 73 20 5c 2d 6c 22 |d by..B |"ls \-l"|
|00000db0| 0a 69 73 20 70 72 69 6e | 74 65 64 20 6f 6e 20 74 |.is prin|ted on t|
|00000dc0| 68 65 20 73 74 61 6e 64 | 61 72 64 20 6f 75 74 70 |he stand|ard outp|
|00000dd0| 75 74 2e 0a 4f 6e 6c 79 | 20 64 69 73 6b 20 62 6c |ut..Only| disk bl|
|00000de0| 6f 63 6b 73 20 61 6c 6c | 6f 63 61 74 65 64 20 74 |ocks all|ocated t|
|00000df0| 6f 20 72 65 67 75 6c 61 | 72 20 66 69 6c 65 73 20 |o regula|r files |
|00000e00| 28 74 79 70 65 20 5c 66 | 42 5c 73 2d 31 49 46 52 |(type \f|B\s-1IFR|
|00000e10| 45 47 5c 73 30 5c 66 50 | 29 20 61 72 65 0a 73 65 |EG\s0\fP|) are.se|
|00000e20| 61 72 63 68 65 64 2e 0a | 2e 50 50 0a 2e 49 20 66 |arched..|.PP..I f|
|00000e30| 69 6c 73 79 73 0a 6d 61 | 79 20 62 65 20 65 69 74 |ilsys.ma|y be eit|
|00000e40| 68 65 72 20 74 68 65 20 | 6e 61 6d 65 20 6f 66 20 |her the |name of |
|00000e50| 74 68 65 20 64 69 73 6b | 20 70 61 72 74 69 74 69 |the disk| partiti|
|00000e60| 6f 6e 20 28 65 69 74 68 | 65 72 20 74 68 65 20 72 |on (eith|er the r|
|00000e70| 61 77 20 6f 72 20 62 6c | 6f 63 6b 0a 64 65 76 69 |aw or bl|ock.devi|
|00000e80| 63 65 20 6e 61 6d 65 20 | 6d 61 79 20 62 65 20 75 |ce name |may be u|
|00000e90| 73 65 64 29 2c 0a 6f 72 | 20 74 68 65 20 6e 61 6d |sed),.or| the nam|
|00000ea0| 65 20 6f 66 20 74 68 65 | 20 6d 6f 75 6e 74 20 70 |e of the| mount p|
|00000eb0| 6f 69 6e 74 20 66 6f 72 | 20 74 68 65 20 70 61 72 |oint for| the par|
|00000ec0| 74 69 74 69 6f 6e 20 61 | 73 20 67 69 76 65 6e 20 |tition a|s given |
|00000ed0| 69 6e 0a 2e 49 52 20 2f | 65 74 63 2f 66 73 74 61 |in..IR /|etc/fsta|
|00000ee0| 62 20 2e 0a 2e 49 20 70 | 61 74 74 65 72 6e 0a 6d |b ...I p|attern.m|
|00000ef0| 61 79 20 62 65 20 61 6e | 79 20 73 74 72 69 6e 67 |ay be an|y string|
|00000f00| 20 6f 66 20 63 68 61 72 | 61 63 74 65 72 73 20 65 | of char|acters e|
|00000f10| 78 63 65 70 74 20 74 68 | 65 20 6e 75 6c 6c 20 63 |xcept th|e null c|
|00000f20| 68 61 72 61 63 74 65 72 | 3b 0a 6e 65 77 6c 69 6e |haracter|;.newlin|
|00000f30| 65 20 63 68 61 72 61 63 | 74 65 72 73 20 6d 61 79 |e charac|ters may|
|00000f40| 20 62 65 20 69 6d 62 65 | 64 64 65 64 20 69 6e 20 | be imbe|dded in |
|00000f50| 74 68 65 20 70 61 74 74 | 65 72 6e 2e 0a 52 65 67 |the patt|ern..Reg|
|00000f60| 75 6c 61 72 20 65 78 70 | 72 65 73 73 69 6f 6e 73 |ular exp|ressions|
|00000f70| 20 61 72 65 20 6e 6f 74 | 20 73 75 70 70 6f 72 74 | are not| support|
|00000f80| 65 64 3b 0a 74 68 65 20 | 70 61 74 74 65 72 6e 20 |ed;.the |pattern |
|00000f90| 69 73 20 6d 61 74 63 68 | 65 64 20 65 78 61 63 74 |is match|ed exact|
|00000fa0| 6c 79 20 61 73 20 67 69 | 76 65 6e 2e 0a 2e 50 50 |ly as gi|ven...PP|
|00000fb0| 0a 54 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 6f |.The fol|lowing o|
|00000fc0| 70 74 69 6f 6e 73 20 61 | 72 65 20 73 75 70 70 6f |ptions a|re suppo|
|00000fd0| 72 74 65 64 3a 0a 2e 49 | 50 20 5c 66 42 5c 2d 65 |rted:..I|P \fB\-e|
|00000fe0| 5c 66 50 0a 54 68 69 73 | 20 6f 70 74 69 6f 6e 20 |\fP.This| option |
|00000ff0| 73 68 6f 75 6c 64 20 62 | 65 20 75 73 65 64 20 74 |should b|e used t|
|00001000| 6f 20 70 72 65 63 65 64 | 65 20 74 68 65 0a 2e 49 |o preced|e the..I|
|00001010| 20 70 61 74 74 65 72 6e | 0a 61 72 67 75 6d 65 6e | pattern|.argumen|
|00001020| 74 20 77 68 65 6e 20 74 | 68 65 20 66 69 72 73 74 |t when t|he first|
|00001030| 20 63 68 61 72 61 63 74 | 65 72 20 6f 66 20 74 68 | charact|er of th|
|00001040| 65 20 70 61 74 74 65 72 | 6e 20 69 73 20 60 60 2d |e patter|n is ``-|
|00001050| 27 27 2e 0a 2e 49 50 20 | 5c 66 42 5c 2d 69 5c 66 |''...IP |\fB\-i\f|
|00001060| 50 0a 49 67 6e 6f 72 65 | 20 63 61 73 65 20 69 6e |P.Ignore| case in|
|00001070| 20 74 68 65 20 70 61 74 | 74 65 72 6e 20 6d 61 74 | the pat|tern mat|
|00001080| 63 68 69 6e 67 2e 0a 2e | 49 50 20 5c 66 42 5c 2d |ching...|IP \fB\-|
|00001090| 70 5c 66 50 0a 4e 6f 72 | 6d 61 6c 6c 79 0a 2e 42 |p\fP.Nor|mally..B|
|000010a0| 20 64 62 67 72 65 70 0a | 77 69 6c 6c 20 70 72 69 | dbgrep.|will pri|
|000010b0| 6e 74 20 74 68 65 20 70 | 61 74 68 20 6e 61 6d 65 |nt the p|ath name|
|000010c0| 20 6f 66 20 65 61 63 68 | 20 66 69 6c 65 20 63 6f | of each| file co|
|000010d0| 6e 74 61 69 6e 69 6e 67 | 20 74 68 65 20 70 61 74 |ntaining| the pat|
|000010e0| 74 65 72 6e 2c 0a 74 68 | 69 73 20 6f 70 74 69 6f |tern,.th|is optio|
|000010f0| 6e 20 69 6e 68 69 62 69 | 74 73 20 74 68 61 74 20 |n inhibi|ts that |
|00001100| 62 65 68 61 76 69 6f 72 | 2e 0a 2e 50 50 0a 46 6f |behavior|...PP.Fo|
|00001110| 72 20 65 61 63 68 20 66 | 69 6c 65 20 66 6f 75 6e |r each f|ile foun|
|00001120| 64 20 74 6f 20 63 6f 6e | 74 61 69 6e 20 74 68 65 |d to con|tain the|
|00001130| 20 70 61 74 74 65 72 6e | 2c 0a 74 68 65 20 66 6f | pattern|,.the fo|
|00001140| 6c 6c 6f 77 69 6e 67 20 | 69 6e 66 6f 72 6d 61 74 |llowing |informat|
|00001150| 69 6f 6e 20 69 73 20 70 | 72 69 6e 74 65 64 2c 0a |ion is p|rinted,.|
|00001160| 69 6e 20 61 20 66 6f 72 | 6d 61 74 20 73 69 6d 69 |in a for|mat simi|
|00001170| 6c 61 72 20 74 6f 20 74 | 68 61 74 20 6f 66 0a 2e |lar to t|hat of..|
|00001180| 42 52 20 6c 73 20 28 31 | 29 3a 0a 74 68 65 20 69 |BR ls (1|):.the i|
|00001190| 6e 6f 64 65 20 6e 75 6d | 62 65 72 2c 0a 74 68 65 |node num|ber,.the|
|000011a0| 20 6e 75 6d 62 65 72 20 | 6f 66 20 6b 69 6c 6f 62 | number |of kilob|
|000011b0| 79 74 65 73 20 6f 66 20 | 64 69 73 6b 20 73 70 61 |ytes of |disk spa|
|000011c0| 63 65 20 62 65 69 6e 67 | 20 75 73 65 64 20 62 79 |ce being| used by|
|000011d0| 20 74 68 65 20 66 69 6c | 65 2c 0a 74 68 65 20 70 | the fil|e,.the p|
|000011e0| 65 72 6d 69 73 73 69 6f | 6e 73 20 6f 6e 20 74 68 |ermissio|ns on th|
|000011f0| 65 20 66 69 6c 65 2c 0a | 74 68 65 20 6e 75 6d 62 |e file,.|the numb|
|00001200| 65 72 20 6f 66 20 6c 69 | 6e 6b 73 20 74 6f 20 74 |er of li|nks to t|
|00001210| 68 65 20 66 69 6c 65 2c | 0a 61 6e 64 20 6f 77 6e |he file,|.and own|
|00001220| 65 72 20 61 6e 64 20 67 | 72 6f 75 70 20 6f 66 20 |er and g|roup of |
|00001230| 74 68 65 20 66 69 6c 65 | 2c 0a 74 68 65 20 6e 75 |the file|,.the nu|
|00001240| 6d 62 65 72 20 6f 66 20 | 62 79 74 65 73 20 69 6e |mber of |bytes in|
|00001250| 20 74 68 65 20 66 69 6c | 65 2c 0a 74 68 65 20 6c | the fil|e,.the l|
|00001260| 61 73 74 20 6d 6f 64 69 | 66 69 63 61 74 69 6f 6e |ast modi|fication|
|00001270| 20 74 69 6d 65 20 6f 66 | 20 74 68 65 20 66 69 6c | time of| the fil|
|00001280| 65 2c 0a 61 6e 64 20 28 | 75 6e 6c 65 73 73 20 74 |e,.and (|unless t|
|00001290| 68 65 0a 2e 42 20 5c 2d | 70 0a 6f 70 74 69 6f 6e |he..B \-|p.option|
|000012a0| 20 77 61 73 20 67 69 76 | 65 6e 29 20 74 68 65 20 | was giv|en) the |
|000012b0| 70 61 74 68 20 6e 61 6d | 65 20 6f 66 20 74 68 65 |path nam|e of the|
|000012c0| 20 66 69 6c 65 2e 0a 2e | 53 48 20 53 45 45 20 41 | file...|SH SEE A|
|000012d0| 4c 53 4f 0a 2e 42 52 20 | 66 69 6e 64 20 28 31 29 |LSO..BR |find (1)|
|000012e0| 2c 0a 2e 42 52 20 67 72 | 65 70 20 28 31 29 0a 2e |,..BR gr|ep (1)..|
|000012f0| 53 48 20 42 55 47 53 0a | 2e 50 50 0a 44 75 65 20 |SH BUGS.|.PP.Due |
|00001300| 74 6f 20 74 68 65 20 6e | 6f 6e 2d 63 6f 6e 73 74 |to the n|on-const|
|00001310| 61 6e 74 20 73 74 61 74 | 65 20 6f 66 20 74 68 65 |ant stat|e of the|
|00001320| 20 69 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 6f 6e 20 | informa|tion on |
|00001330| 74 68 65 20 64 69 73 6b | 2c 0a 2e 42 20 64 62 67 |the disk|,..B dbg|
|00001340| 72 65 70 0a 73 6f 6d 65 | 74 69 6d 65 73 20 63 61 |rep.some|times ca|
|00001350| 6e 6e 6f 74 20 64 65 63 | 69 70 68 65 72 20 74 68 |nnot dec|ipher th|
|00001360| 65 20 70 61 74 68 20 6e | 61 6d 65 20 6f 66 20 61 |e path n|ame of a|
|00001370| 20 66 69 6c 65 2e 0a 57 | 68 65 6e 20 74 68 69 73 | file..W|hen this|
|00001380| 20 68 61 70 70 65 6e 73 | 2c 0a 74 68 65 20 73 74 | happens|,.the st|
|00001390| 72 69 6e 67 20 60 60 5b | 75 6e 61 62 6c 65 20 74 |ring ``[|unable t|
|000013a0| 6f 20 64 65 74 65 72 6d | 69 6e 65 20 66 69 6c 65 |o determ|ine file|
|000013b0| 20 6e 61 6d 65 5d 27 27 | 0a 69 73 20 70 72 69 6e | name]''|.is prin|
|000013c0| 74 65 64 20 69 6e 73 74 | 65 61 64 2e 0a 2e 50 50 |ted inst|ead...PP|
|000013d0| 0a 54 68 65 20 64 69 73 | 6b 20 62 6c 6f 63 6b 73 |.The dis|k blocks|
|000013e0| 20 73 65 61 72 63 68 65 | 64 20 66 6f 72 20 65 61 | searche|d for ea|
|000013f0| 63 68 20 66 69 6c 65 20 | 61 72 65 20 74 68 6f 73 |ch file |are thos|
|00001400| 65 20 61 73 73 6f 63 69 | 61 74 65 64 20 77 69 74 |e associ|ated wit|
|00001410| 68 20 74 68 65 20 66 69 | 6c 65 0a 61 74 20 74 68 |h the fi|le.at th|
|00001420| 65 20 74 69 6d 65 0a 2e | 42 20 64 62 67 72 65 70 |e time..|B dbgrep|
|00001430| 0a 69 73 20 69 6e 76 6f | 6b 65 64 3b 0a 69 66 20 |.is invo|ked;.if |
|00001440| 6d 6f 72 65 20 64 69 73 | 6b 20 62 6c 6f 63 6b 73 |more dis|k blocks|
|00001450| 20 62 65 63 6f 6d 65 20 | 75 73 65 64 20 62 79 20 | become |used by |
|00001460| 74 68 65 20 66 69 6c 65 | 20 64 75 72 69 6e 67 20 |the file| during |
|00001470| 65 78 65 63 75 74 69 6f | 6e 2c 0a 6f 72 20 69 66 |executio|n,.or if|
|00001480| 20 64 69 73 6b 20 62 6c | 6f 63 6b 73 20 61 72 65 | disk bl|ocks are|
|00001490| 20 66 72 65 65 64 20 28 | 6f 72 20 74 68 65 20 66 | freed (|or the f|
|000014a0| 69 6c 65 20 69 73 20 72 | 65 6d 6f 76 65 64 29 20 |ile is r|emoved) |
|000014b0| 64 75 72 69 6e 67 20 65 | 78 65 63 75 74 69 6f 6e |during e|xecution|
|000014c0| 2c 0a 2e 42 20 64 62 67 | 72 65 70 0a 6d 61 79 20 |,..B dbg|rep.may |
|000014d0| 72 65 70 6f 72 74 20 69 | 6e 61 63 63 75 72 61 74 |report i|naccurat|
|000014e0| 65 20 69 6e 66 6f 72 6d | 61 74 69 6f 6e 2e 0a 2e |e inform|ation...|
|000014f0| 53 48 20 41 55 54 48 4f | 52 0a 44 61 76 69 64 20 |SH AUTHO|R.David |
|00001500| 41 2e 20 43 75 72 72 79 | 2c 0a 50 75 72 64 75 65 |A. Curry|,.Purdue|
|00001510| 20 55 6e 69 76 65 72 73 | 69 74 79 2c 0a 45 6e 67 | Univers|ity,.Eng|
|00001520| 69 6e 65 65 72 69 6e 67 | 20 43 6f 6d 70 75 74 65 |ineering| Compute|
|00001530| 72 20 4e 65 74 77 6f 72 | 6b 2c 0a 64 61 76 79 40 |r Networ|k,.davy@|
|00001540| 69 6e 74 72 65 70 69 64 | 2e 65 63 6e 2e 70 75 72 |intrepid|.ecn.pur|
|00001550| 64 75 65 2e 65 64 75 0a | 00 00 00 00 00 00 00 00 |due.edu.|........|
|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| 64 62 67 72 65 70 2f 64 | 62 67 72 65 70 2e 63 00 |dbgrep/d|bgrep.c.|
|00001610| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001620| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001630| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001640| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001650| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001660| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00001670| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00001680| 20 20 33 37 32 33 30 20 | 20 34 34 30 34 30 35 34 | 37230 | 4404054|
|00001690| 33 35 33 20 20 20 37 30 | 30 31 00 20 00 00 00 00 |353 70|01. ....|
|000016a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000016b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000016c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000016d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000016e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000016f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001700| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001710| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001720| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001730| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001740| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001750| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001760| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001770| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001780| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001790| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000017a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000017b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000017c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000017d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000017e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000017f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001800| 2f 2a 0a 20 2a 20 64 62 | 67 72 65 70 20 2d 20 64 |/*. * db|grep - d|
|00001810| 69 73 6b 20 62 6c 6f 63 | 6b 20 67 72 65 70 0a 20 |isk bloc|k grep. |
|00001820| 2a 0a 20 2a 20 54 68 69 | 73 20 70 72 6f 67 72 61 |*. * Thi|s progra|
|00001830| 6d 20 73 65 61 72 63 68 | 65 73 20 66 6f 72 20 61 |m search|es for a|
|00001840| 20 70 61 74 74 65 72 6e | 20 6d 75 63 68 20 6c 69 | pattern| much li|
|00001850| 6b 65 20 22 67 72 65 70 | 22 20 28 72 65 67 75 6c |ke "grep|" (regul|
|00001860| 61 72 20 65 78 70 72 65 | 73 73 69 6f 6e 73 0a 20 |ar expre|ssions. |
|00001870| 2a 20 61 72 65 20 6e 6f | 74 20 73 75 70 70 6f 72 |* are no|t suppor|
|00001880| 74 65 64 29 20 62 79 20 | 72 65 61 64 69 6e 67 20 |ted) by |reading |
|00001890| 74 68 65 20 72 61 77 20 | 66 69 6c 65 20 73 79 73 |the raw |file sys|
|000018a0| 74 65 6d 20 64 69 73 6b | 20 62 6c 6f 63 6b 73 2e |tem disk| blocks.|
|000018b0| 20 20 57 68 65 6e 20 69 | 74 0a 20 2a 20 66 69 6e | When i|t. * fin|
|000018c0| 64 73 20 74 68 65 20 70 | 61 74 74 65 72 6e 20 69 |ds the p|attern i|
|000018d0| 74 20 70 72 69 6e 74 73 | 20 6f 75 74 20 61 20 6c |t prints| out a l|
|000018e0| 69 6e 65 20 73 69 6d 69 | 6c 61 72 20 74 6f 20 22 |ine simi|lar to "|
|000018f0| 6c 73 22 20 77 68 69 63 | 68 20 64 65 73 63 72 69 |ls" whic|h descri|
|00001900| 62 65 73 0a 20 2a 20 74 | 68 65 20 66 69 6c 65 2e |bes. * t|he file.|
|00001910| 0a 20 2a 0a 20 2a 20 44 | 61 76 69 64 20 41 2e 20 |. *. * D|avid A. |
|00001920| 43 75 72 72 79 0a 20 2a | 20 50 75 72 64 75 65 20 |Curry. *| Purdue |
|00001930| 55 6e 69 76 65 72 73 69 | 74 79 0a 20 2a 20 45 6e |Universi|ty. * En|
|00001940| 67 69 6e 65 65 72 69 6e | 67 20 43 6f 6d 70 75 74 |gineerin|g Comput|
|00001950| 65 72 20 4e 65 74 6f 77 | 72 6b 0a 20 2a 20 64 61 |er Netow|rk. * da|
|00001960| 76 79 40 69 6e 74 72 65 | 70 69 64 2e 65 63 6e 2e |vy@intre|pid.ecn.|
|00001970| 70 75 72 64 75 65 2e 65 | 64 75 0a 20 2a 20 4d 61 |purdue.e|du. * Ma|
|00001980| 79 2c 20 31 39 38 38 0a | 20 2a 2f 0a 23 69 66 20 |y, 1988.| */.#if |
|00001990| 73 75 6e 20 7c 7c 20 47 | 4f 55 4c 44 5f 50 4e 20 |sun || G|OULD_PN |
|000019a0| 7c 7c 20 47 4f 55 4c 44 | 5f 4e 50 31 0a 23 64 65 ||| GOULD|_NP1.#de|
|000019b0| 66 69 6e 65 20 4e 46 53 | 09 31 0a 23 65 6e 64 69 |fine NFS|.1.#endi|
|000019c0| 66 0a 0a 23 69 6e 63 6c | 75 64 65 20 3c 73 79 73 |f..#incl|ude <sys|
|000019d0| 2f 70 61 72 61 6d 2e 68 | 3e 0a 23 69 6e 63 6c 75 |/param.h|>.#inclu|
|000019e0| 64 65 20 3c 73 79 73 2f | 74 69 6d 65 2e 68 3e 0a |de <sys/|time.h>.|
|000019f0| 23 69 6e 63 6c 75 64 65 | 20 3c 73 79 73 2f 73 74 |#include| <sys/st|
|00001a00| 61 74 2e 68 3e 0a 0a 23 | 69 66 64 65 66 20 4e 46 |at.h>..#|ifdef NF|
|00001a10| 53 0a 23 69 6e 63 6c 75 | 64 65 20 3c 73 79 73 2f |S.#inclu|de <sys/|
|00001a20| 76 6e 6f 64 65 2e 68 3e | 0a 23 69 6e 63 6c 75 64 |vnode.h>|.#includ|
|00001a30| 65 20 3c 75 66 73 2f 69 | 6e 6f 64 65 2e 68 3e 0a |e <ufs/i|node.h>.|
|00001a40| 23 69 6e 63 6c 75 64 65 | 20 3c 73 79 73 2f 66 69 |#include| <sys/fi|
|00001a50| 6c 65 2e 68 3e 0a 23 69 | 6e 63 6c 75 64 65 20 3c |le.h>.#i|nclude <|
|00001a60| 73 79 73 2f 64 69 72 2e | 68 3e 0a 23 69 6e 63 6c |sys/dir.|h>.#incl|
|00001a70| 75 64 65 20 3c 75 66 73 | 2f 66 73 2e 68 3e 0a 23 |ude <ufs|/fs.h>.#|
|00001a80| 65 6c 73 65 0a 23 69 6e | 63 6c 75 64 65 20 3c 73 |else.#in|clude <s|
|00001a90| 79 73 2f 69 6e 6f 64 65 | 2e 68 3e 0a 23 69 6e 63 |ys/inode|.h>.#inc|
|00001aa0| 6c 75 64 65 20 3c 73 79 | 73 2f 66 69 6c 65 2e 68 |lude <sy|s/file.h|
|00001ab0| 3e 0a 23 69 6e 63 6c 75 | 64 65 20 3c 73 79 73 2f |>.#inclu|de <sys/|
|00001ac0| 64 69 72 2e 68 3e 0a 23 | 69 6e 63 6c 75 64 65 20 |dir.h>.#|include |
|00001ad0| 3c 73 79 73 2f 66 73 2e | 68 3e 0a 23 65 6e 64 69 |<sys/fs.|h>.#endi|
|00001ae0| 66 0a 0a 23 69 6e 63 6c | 75 64 65 20 3c 66 73 74 |f..#incl|ude <fst|
|00001af0| 61 62 2e 68 3e 0a 23 69 | 6e 63 6c 75 64 65 20 3c |ab.h>.#i|nclude <|
|00001b00| 63 74 79 70 65 2e 68 3e | 0a 23 69 6e 63 6c 75 64 |ctype.h>|.#includ|
|00001b10| 65 20 3c 73 74 64 69 6f | 2e 68 3e 0a 23 69 6e 63 |e <stdio|.h>.#inc|
|00001b20| 6c 75 64 65 20 3c 70 77 | 64 2e 68 3e 0a 23 69 6e |lude <pw|d.h>.#in|
|00001b30| 63 6c 75 64 65 20 3c 67 | 72 70 2e 68 3e 0a 0a 23 |clude <g|rp.h>..#|
|00001b40| 64 65 66 69 6e 65 20 73 | 62 6c 6f 63 6b 09 09 73 |define s|block..s|
|00001b50| 62 5f 75 6e 2e 75 5f 73 | 62 6c 6f 63 6b 0a 0a 2f |b_un.u_s|block../|
|00001b60| 2a 0a 20 2a 20 54 68 65 | 20 73 75 70 65 72 62 6c |*. * The| superbl|
|00001b70| 6f 63 6b 20 73 74 72 75 | 63 74 75 72 65 2e 0a 20 |ock stru|cture.. |
|00001b80| 2a 2f 0a 75 6e 69 6f 6e | 20 73 75 70 65 72 62 6c |*/.union| superbl|
|00001b90| 6f 63 6b 20 7b 0a 09 73 | 74 72 75 63 74 09 66 73 |ock {..s|truct.fs|
|00001ba0| 20 75 5f 73 62 6c 6f 63 | 6b 3b 0a 09 63 68 61 72 | u_sbloc|k;..char|
|00001bb0| 09 64 75 6d 6d 79 5b 53 | 42 53 49 5a 45 5d 3b 0a |.dummy[S|BSIZE];.|
|00001bc0| 7d 20 73 62 5f 75 6e 3b | 0a 0a 2f 2a 0a 20 2a 20 |} sb_un;|../*. * |
|00001bd0| 41 20 70 61 74 68 6e 61 | 6d 65 20 63 6f 6d 70 6f |A pathna|me compo|
|00001be0| 6e 65 6e 74 20 28 66 6f | 72 20 2d 70 20 6f 70 74 |nent (fo|r -p opt|
|00001bf0| 69 6f 6e 29 2e 0a 20 2a | 2f 0a 73 74 72 75 63 74 |ion).. *|/.struct|
|00001c00| 20 70 61 74 68 63 6f 6d | 70 20 7b 0a 09 63 68 61 | pathcom|p {..cha|
|00001c10| 72 09 2a 70 63 5f 6e 61 | 6d 65 3b 0a 09 73 74 72 |r.*pc_na|me;..str|
|00001c20| 75 63 74 09 70 61 74 68 | 63 6f 6d 70 20 2a 70 63 |uct.path|comp *pc|
|00001c30| 5f 70 61 72 65 6e 74 3b | 0a 7d 3b 0a 0a 69 6e 74 |_parent;|.};..int|
|00001c40| 09 6e 66 69 6c 65 73 3b | 09 09 09 2f 2a 20 6e 75 |.nfiles;|.../* nu|
|00001c50| 6d 62 65 72 20 6f 66 20 | 66 69 6c 65 73 20 69 6e |mber of |files in|
|00001c60| 20 74 68 65 20 66 69 6c | 65 20 73 79 73 74 65 6d | the fil|e system|
|00001c70| 73 09 2a 2f 0a 69 6e 74 | 20 09 66 69 6c 65 64 65 |s.*/.int| .filede|
|00001c80| 73 3b 09 09 2f 2a 20 66 | 69 6c 65 20 64 65 73 63 |s;../* f|ile desc|
|00001c90| 72 69 70 74 6f 72 20 6f | 66 20 74 68 65 20 72 61 |riptor o|f the ra|
|00001ca0| 77 20 64 69 73 6b 20 64 | 65 76 09 2a 2f 0a 73 74 |w disk d|ev.*/.st|
|00001cb0| 72 75 63 74 09 64 69 6e | 6f 64 65 20 2a 64 69 6e |ruct.din|ode *din|
|00001cc0| 6f 64 65 3b 09 09 2f 2a | 20 74 61 62 6c 65 20 6f |ode;../*| table o|
|00001cd0| 66 20 6f 6e 2d 64 69 73 | 6b 20 69 6e 6f 64 65 20 |f on-dis|k inode |
|00001ce0| 73 74 72 75 63 74 75 72 | 65 73 09 2a 2f 0a 0a 64 |structur|es.*/..d|
|00001cf0| 65 76 5f 74 09 66 73 5f | 64 65 76 3b 09 09 09 2f |ev_t.fs_|dev;.../|
|00001d00| 2a 20 64 65 76 69 63 65 | 20 6e 75 6d 62 65 72 20 |* device| number |
|00001d10| 28 6d 61 6a 6f 72 2f 6d | 69 6e 6f 72 29 20 6f 66 |(major/m|inor) of|
|00001d20| 20 64 69 73 6b 09 2a 2f | 0a 63 68 61 72 09 2a 66 | disk.*/|.char.*f|
|00001d30| 73 5f 63 64 65 76 3b 09 | 09 2f 2a 20 63 68 61 72 |s_cdev;.|./* char|
|00001d40| 61 63 74 65 72 20 64 65 | 76 69 63 65 20 6e 61 6d |acter de|vice nam|
|00001d50| 65 20 6f 66 20 74 68 65 | 20 64 69 73 6b 09 2a 2f |e of the| disk.*/|
|00001d60| 0a 63 68 61 72 09 2a 66 | 69 6c 73 79 73 20 3d 20 |.char.*f|ilsys = |
|00001d70| 4e 55 4c 4c 3b 09 09 2f | 2a 20 6e 61 6d 65 20 6f |NULL;../|* name o|
|00001d80| 66 20 74 68 65 20 66 69 | 6c 65 20 73 79 73 74 65 |f the fi|le syste|
|00001d90| 6d 20 77 65 27 72 65 20 | 64 6f 69 6e 67 09 2a 2f |m we're |doing.*/|
|00001da0| 0a 0a 63 68 61 72 09 2a | 64 69 72 62 75 66 3b 09 |..char.*|dirbuf;.|
|00001db0| 09 2f 2a 20 63 6f 6e 74 | 65 6e 74 73 20 6f 66 20 |./* cont|ents of |
|00001dc0| 64 69 72 65 63 74 6f 72 | 79 20 28 66 6f 72 20 2d |director|y (for -|
|00001dd0| 70 20 6f 70 74 69 6f 6e | 29 2a 2f 0a 63 68 61 72 |p option|)*/.char|
|00001de0| 09 2a 70 61 74 68 70 74 | 72 20 3d 20 4e 55 4c 4c |.*pathpt|r = NULL|
|00001df0| 3b 09 2f 2a 20 70 6f 69 | 6e 74 65 72 20 74 6f 20 |;./* poi|nter to |
|00001e00| 66 72 6f 6e 74 20 6f 66 | 20 70 61 74 68 6e 61 6d |front of| pathnam|
|00001e10| 65 09 09 2a 2f 0a 73 74 | 72 75 63 74 09 70 61 74 |e..*/.st|ruct.pat|
|00001e20| 68 63 6f 6d 70 20 2a 70 | 61 74 68 6c 69 73 74 3b |hcomp *p|athlist;|
|00001e30| 09 2f 2a 20 6c 69 73 74 | 20 6f 66 20 70 61 74 68 |./* list| of path|
|00001e40| 6e 61 6d 65 20 63 6f 6d | 70 6f 6e 65 6e 74 73 09 |name com|ponents.|
|00001e50| 09 2a 2f 0a 63 68 61 72 | 09 70 61 74 68 62 75 66 |.*/.char|.pathbuf|
|00001e60| 5b 4d 41 58 50 41 54 48 | 4c 45 4e 5d 3b 09 2f 2a |[MAXPATH|LEN];./*|
|00001e70| 20 61 72 65 61 20 66 6f | 72 20 63 6f 6e 73 74 72 | area fo|r constr|
|00001e80| 75 63 74 69 6e 67 20 70 | 61 74 68 6e 61 6d 65 73 |ucting p|athnames|
|00001e90| 09 2a 2f 0a 0a 69 6e 74 | 09 69 66 6c 61 67 20 3d |.*/..int|.iflag =|
|00001ea0| 20 30 3b 09 09 2f 2a 20 | 2d 69 20 2d 20 69 67 6e | 0;../* |-i - ign|
|00001eb0| 6f 72 65 20 63 61 73 65 | 20 69 6e 20 70 61 74 74 |ore case| in patt|
|00001ec0| 65 72 6e 20 6d 61 74 63 | 68 69 6e 67 09 2a 2f 0a |ern matc|hing.*/.|
|00001ed0| 69 6e 74 09 70 66 6c 61 | 67 20 3d 20 31 3b 09 09 |int.pfla|g = 1;..|
|00001ee0| 2f 2a 20 2d 70 20 2d 20 | 70 72 69 6e 74 20 66 69 |/* -p - |print fi|
|00001ef0| 6c 65 20 70 61 74 68 6e | 61 6d 65 73 20 6f 6e 20 |le pathn|ames on |
|00001f00| 6d 61 74 63 68 09 2a 2f | 0a 0a 69 6e 74 09 2a 66 |match.*/|..int.*f|
|00001f10| 6c 69 6e 6b 3b 09 09 09 | 2f 2a 20 66 61 69 6c 75 |link;...|/* failu|
|00001f20| 72 65 20 6c 69 6e 6b 73 | 20 66 6f 72 20 74 68 65 |re links| for the|
|00001f30| 20 70 61 74 74 65 72 6e | 20 6d 61 74 63 68 09 2a | pattern| match.*|
|00001f40| 2f 0a 69 6e 74 09 70 61 | 74 6c 65 6e 3b 09 09 09 |/.int.pa|tlen;...|
|00001f50| 2f 2a 20 6c 65 6e 67 74 | 68 20 6f 66 20 74 68 65 |/* lengt|h of the|
|00001f60| 20 70 61 74 74 65 72 6e | 20 74 6f 20 62 65 20 6d | pattern| to be m|
|00001f70| 61 74 63 68 65 64 09 2a | 2f 0a 69 6e 74 09 70 61 |atched.*|/.int.pa|
|00001f80| 74 70 6f 73 3b 09 09 09 | 2f 2a 20 70 6f 73 69 74 |tpos;...|/* posit|
|00001f90| 69 6f 6e 20 69 6e 20 70 | 61 74 74 65 72 6e 20 64 |ion in p|attern d|
|00001fa0| 75 72 69 6e 67 20 6d 61 | 74 63 68 09 2a 2f 0a 63 |uring ma|tch.*/.c|
|00001fb0| 68 61 72 09 2a 70 61 74 | 74 65 72 6e 20 3d 20 4e |har.*pat|tern = N|
|00001fc0| 55 4c 4c 3b 09 2f 2a 20 | 74 68 65 20 70 61 74 74 |ULL;./* |the patt|
|00001fd0| 65 72 6e 20 77 65 20 61 | 72 65 20 6c 6f 6f 6b 69 |ern we a|re looki|
|00001fe0| 6e 67 20 66 6f 72 09 2a | 2f 0a 0a 63 68 61 72 09 |ng for.*|/..char.|
|00001ff0| 2a 70 6e 61 6d 65 3b 09 | 09 09 2f 2a 20 70 72 6f |*pname;.|../* pro|
|00002000| 67 72 61 6d 20 6e 61 6d | 65 20 28 61 72 67 76 5b |gram nam|e (argv[|
|00002010| 30 5d 29 09 09 2a 2f 0a | 0a 63 68 61 72 09 2a 6d |0])..*/.|.char.*m|
|00002020| 61 6c 6c 6f 63 28 29 3b | 0a 0a 6d 61 69 6e 28 61 |alloc();|..main(a|
|00002030| 72 67 63 2c 20 61 72 67 | 76 29 0a 69 6e 74 20 61 |rgc, arg|v).int a|
|00002040| 72 67 63 3b 0a 63 68 61 | 72 20 2a 2a 61 72 67 76 |rgc;.cha|r **argv|
|00002050| 3b 0a 7b 0a 09 72 65 67 | 69 73 74 65 72 20 69 6e |;.{..reg|ister in|
|00002060| 6f 5f 74 20 69 6e 6f 3b | 0a 09 72 65 67 69 73 74 |o_t ino;|..regist|
|00002070| 65 72 20 73 74 72 75 63 | 74 20 64 69 6e 6f 64 65 |er struc|t dinode|
|00002080| 20 2a 64 70 3b 0a 0a 09 | 70 6e 61 6d 65 20 3d 20 | *dp;...|pname = |
|00002090| 2a 61 72 67 76 3b 0a 0a | 09 2f 2a 0a 09 20 2a 20 |*argv;..|./*.. * |
|000020a0| 50 72 6f 63 65 73 73 20 | 61 72 67 75 6d 65 6e 74 |Process |argument|
|000020b0| 73 2e 0a 09 20 2a 2f 0a | 09 77 68 69 6c 65 20 28 |s... */.|.while (|
|000020c0| 2d 2d 61 72 67 63 29 20 | 7b 0a 09 09 2f 2a 0a 09 |--argc) |{.../*..|
|000020d0| 09 20 2a 20 49 66 20 69 | 74 27 73 20 6e 6f 74 20 |. * If i|t's not |
|000020e0| 61 20 66 6c 61 67 2c 20 | 74 68 65 6e 20 69 74 27 |a flag, |then it'|
|000020f0| 73 20 65 69 74 68 65 72 | 20 74 68 65 20 70 61 74 |s either| the pat|
|00002100| 74 65 72 6e 20 28 66 69 | 72 73 74 29 0a 09 09 20 |tern (fi|rst)... |
|00002110| 2a 20 6f 72 20 74 68 65 | 20 66 69 6c 65 20 73 79 |* or the| file sy|
|00002120| 73 74 65 6d 20 6e 61 6d | 65 2e 0a 09 09 20 2a 2f |stem nam|e.... */|
|00002130| 0a 09 09 69 66 20 28 2a | 2a 2b 2b 61 72 67 76 20 |...if (*|*++argv |
|00002140| 21 3d 20 27 2d 27 29 20 | 7b 0a 09 09 09 69 66 20 |!= '-') |{....if |
|00002150| 28 70 61 74 74 65 72 6e | 29 0a 09 09 09 09 66 69 |(pattern|).....fi|
|00002160| 6c 73 79 73 20 3d 20 2a | 61 72 67 76 3b 0a 09 09 |lsys = *|argv;...|
|00002170| 09 65 6c 73 65 0a 09 09 | 09 09 70 61 74 74 65 72 |.else...|..patter|
|00002180| 6e 20 3d 20 2a 61 72 67 | 76 3b 0a 0a 09 09 09 63 |n = *arg|v;.....c|
|00002190| 6f 6e 74 69 6e 75 65 3b | 0a 09 09 7d 0a 0a 09 09 |ontinue;|...}....|
|000021a0| 2f 2a 0a 09 09 20 2a 20 | 4f 70 74 69 6f 6e 2e 0a |/*... * |Option..|
|000021b0| 09 09 20 2a 2f 0a 09 09 | 73 77 69 74 63 68 20 28 |.. */...|switch (|
|000021c0| 2a 2b 2b 2a 61 72 67 76 | 29 20 7b 0a 09 09 63 61 |*++*argv|) {...ca|
|000021d0| 73 65 20 27 65 27 3a 09 | 09 2f 2a 20 65 78 70 72 |se 'e':.|./* expr|
|000021e0| 65 73 73 69 6f 6e 20 66 | 6f 6c 6c 6f 77 73 09 09 |ession f|ollows..|
|000021f0| 2a 2f 0a 09 09 09 69 66 | 20 28 2d 2d 61 72 67 63 |*/....if| (--argc|
|00002200| 20 3c 3d 20 30 29 0a 09 | 09 09 09 75 73 61 67 65 | <= 0)..|...usage|
|00002210| 28 29 3b 0a 0a 09 09 09 | 70 61 74 74 65 72 6e 20 |();.....|pattern |
|00002220| 3d 20 2a 2b 2b 61 72 67 | 76 3b 0a 09 09 09 62 72 |= *++arg|v;....br|
|00002230| 65 61 6b 3b 0a 09 09 63 | 61 73 65 20 27 69 27 3a |eak;...c|ase 'i':|
|00002240| 09 09 2f 2a 20 69 67 6e | 6f 72 65 20 63 61 73 65 |../* ign|ore case|
|00002250| 20 69 6e 20 6d 61 74 63 | 68 65 73 09 2a 2f 0a 09 | in matc|hes.*/..|
|00002260| 09 09 69 66 6c 61 67 20 | 3d 20 31 3b 0a 09 09 09 |..iflag |= 1;....|
|00002270| 62 72 65 61 6b 3b 0a 09 | 09 63 61 73 65 20 27 70 |break;..|.case 'p|
|00002280| 27 3a 09 09 2f 2a 20 70 | 72 69 6e 74 20 70 61 74 |':../* p|rint pat|
|00002290| 68 6e 61 6d 65 73 20 6f | 66 20 66 69 6c 65 73 09 |hnames o|f files.|
|000022a0| 2a 2f 0a 09 09 09 70 66 | 6c 61 67 20 3d 20 30 3b |*/....pf|lag = 0;|
|000022b0| 0a 09 09 09 62 72 65 61 | 6b 3b 0a 09 09 64 65 66 |....brea|k;...def|
|000022c0| 61 75 6c 74 3a 0a 09 09 | 09 75 73 61 67 65 28 29 |ault:...|.usage()|
|000022d0| 3b 0a 09 09 7d 0a 09 7d | 0a 0a 09 2f 2a 0a 09 20 |;...}..}|.../*.. |
|000022e0| 2a 20 47 6f 74 74 61 20 | 68 61 76 65 20 62 6f 74 |* Gotta |have bot|
|000022f0| 68 20 70 61 74 74 65 72 | 6e 20 61 6e 64 20 66 69 |h patter|n and fi|
|00002300| 6c 65 20 73 79 73 74 65 | 6d 2e 0a 09 20 2a 2f 0a |le syste|m... */.|
|00002310| 09 69 66 20 28 21 70 61 | 74 74 65 72 6e 20 7c 7c |.if (!pa|ttern |||
|00002320| 20 21 66 69 6c 73 79 73 | 29 0a 09 09 75 73 61 67 | !filsys|)...usag|
|00002330| 65 28 29 3b 0a 0a 09 2f | 2a 0a 09 20 2a 20 43 6f |e();.../|*.. * Co|
|00002340| 6d 70 69 6c 65 20 74 68 | 65 20 66 61 69 6c 75 72 |mpile th|e failur|
|00002350| 65 20 6c 69 6e 6b 73 20 | 66 6f 72 20 74 68 65 20 |e links |for the |
|00002360| 70 61 74 74 65 72 6e 20 | 6d 61 74 63 68 2e 0a 09 |pattern |match...|
|00002370| 20 2a 2f 0a 09 63 6f 6d | 70 69 6c 65 28 70 61 74 | */..com|pile(pat|
|00002380| 74 65 72 6e 29 3b 0a 0a | 09 2f 2a 0a 09 20 2a 20 |tern);..|./*.. * |
|00002390| 47 65 74 20 74 68 65 20 | 66 69 6c 65 20 73 79 73 |Get the |file sys|
|000023a0| 74 65 6d 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 20 |tem info|rmation |
|000023b0| 61 6e 64 20 74 68 65 20 | 69 6e 66 6f 72 6d 61 74 |and the |informat|
|000023c0| 69 6f 6e 20 77 65 0a 09 | 20 2a 20 6e 65 65 64 20 |ion we..| * need |
|000023d0| 6f 66 66 20 64 69 73 6b | 2e 0a 09 20 2a 2f 0a 09 |off disk|... */..|
|000023e0| 67 65 74 66 73 69 6e 66 | 6f 28 66 69 6c 73 79 73 |getfsinf|o(filsys|
|000023f0| 29 3b 0a 09 67 65 74 64 | 69 6e 66 6f 28 29 3b 0a |);..getd|info();.|
|00002400| 0a 09 2f 2a 0a 09 20 2a | 20 49 66 20 77 65 27 72 |../*.. *| If we'r|
|00002410| 65 20 64 6f 69 6e 67 20 | 70 61 74 68 6e 61 6d 65 |e doing |pathname|
|00002420| 73 2c 20 67 65 74 20 74 | 68 65 20 70 61 74 68 6e |s, get t|he pathn|
|00002430| 61 6d 65 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 2e |ame info|rmation.|
|00002440| 0a 09 20 2a 2f 0a 09 69 | 66 20 28 70 66 6c 61 67 |.. */..i|f (pflag|
|00002450| 29 0a 09 09 67 65 74 70 | 69 6e 66 6f 28 29 3b 0a |)...getp|info();.|
|00002460| 0a 09 2f 2a 0a 09 20 2a | 20 46 6f 72 20 65 61 63 |../*.. *| For eac|
|00002470| 68 20 69 6e 6f 64 65 20 | 6f 6e 20 74 68 65 20 66 |h inode |on the f|
|00002480| 69 6c 65 20 73 79 73 74 | 65 6d 2e 2e 2e 0a 09 20 |ile syst|em..... |
|00002490| 2a 2f 0a 09 66 6f 72 20 | 28 69 6e 6f 20 3d 20 52 |*/..for |(ino = R|
|000024a0| 4f 4f 54 49 4e 4f 3b 20 | 69 6e 6f 20 3c 20 6e 66 |OOTINO; |ino < nf|
|000024b0| 69 6c 65 73 3b 20 69 6e | 6f 2b 2b 29 20 7b 0a 09 |iles; in|o++) {..|
|000024c0| 09 64 70 20 3d 20 26 64 | 69 6e 6f 64 65 5b 69 6e |.dp = &d|inode[in|
|000024d0| 6f 5d 3b 0a 0a 09 09 2f | 2a 0a 09 09 20 2a 20 57 |o];..../|*... * W|
|000024e0| 65 27 72 65 20 6e 6f 74 | 20 69 6e 74 65 72 65 73 |e're not| interes|
|000024f0| 74 65 64 20 69 6e 20 61 | 6e 79 74 68 69 6e 67 20 |ted in a|nything |
|00002500| 62 75 74 0a 09 09 20 2a | 20 72 65 67 75 6c 61 72 |but... *| regular|
|00002510| 20 66 69 6c 65 73 2e 0a | 09 09 20 2a 2f 0a 09 09 | files..|.. */...|
|00002520| 69 66 20 28 28 64 70 2d | 3e 64 69 5f 6d 6f 64 65 |if ((dp-|>di_mode|
|00002530| 20 26 20 49 46 4d 54 29 | 20 21 3d 20 49 46 52 45 | & IFMT)| != IFRE|
|00002540| 47 29 0a 09 09 09 63 6f | 6e 74 69 6e 75 65 3b 0a |G)....co|ntinue;.|
|00002550| 0a 09 09 2f 2a 0a 09 09 | 20 2a 20 4e 6f 6e 2d 65 |.../*...| * Non-e|
|00002560| 78 69 73 74 65 6e 74 20 | 66 69 6c 65 2e 0a 09 09 |xistent |file....|
|00002570| 20 2a 2f 0a 09 09 69 66 | 20 28 64 70 2d 3e 64 69 | */...if| (dp->di|
|00002580| 5f 6e 6c 69 6e 6b 20 3d | 3d 20 30 29 0a 09 09 09 |_nlink =|= 0)....|
|00002590| 63 6f 6e 74 69 6e 75 65 | 3b 0a 0a 09 09 2f 2a 0a |continue|;..../*.|
|000025a0| 09 09 20 2a 20 52 65 73 | 65 74 20 74 68 65 20 70 |.. * Res|et the p|
|000025b0| 61 74 74 65 72 6e 20 6d | 61 74 63 68 65 72 2e 0a |attern m|atcher..|
|000025c0| 09 09 20 2a 2f 0a 09 09 | 72 65 73 65 74 70 61 74 |.. */...|resetpat|
|000025d0| 70 6f 73 28 29 3b 0a 0a | 09 09 2f 2a 0a 09 09 20 |pos();..|../*... |
|000025e0| 2a 20 53 74 61 72 74 20 | 62 79 20 73 65 61 72 63 |* Start |by searc|
|000025f0| 68 69 6e 67 20 74 68 65 | 20 64 69 72 65 63 74 20 |hing the| direct |
|00002600| 62 6c 6f 63 6b 73 2e 0a | 09 09 20 2a 2f 0a 09 09 |blocks..|.. */...|
|00002610| 69 66 20 28 73 65 61 72 | 63 68 5f 64 69 72 65 63 |if (sear|ch_direc|
|00002620| 74 28 64 70 2c 20 69 6e | 6f 29 29 0a 09 09 09 70 |t(dp, in|o))....p|
|00002630| 72 69 6e 74 6f 75 74 28 | 64 70 2c 20 69 6e 6f 29 |rintout(|dp, ino)|
|00002640| 3b 0a 09 7d 0a 0a 09 65 | 78 69 74 28 30 29 3b 0a |;..}...e|xit(0);.|
|00002650| 7d 0a 0a 2f 2a 0a 20 2a | 20 67 65 74 66 73 69 6e |}../*. *| getfsin|
|00002660| 66 6f 20 2d 20 67 65 74 | 20 69 6e 66 6f 72 6d 61 |fo - get| informa|
|00002670| 74 69 6f 6e 20 61 62 6f | 75 74 20 74 68 65 20 66 |tion abo|ut the f|
|00002680| 69 6c 65 20 73 79 73 74 | 65 6d 20 62 79 20 66 69 |ile syst|em by fi|
|00002690| 67 75 72 69 6e 67 20 6f | 75 74 20 74 68 65 0a 20 |guring o|ut the. |
|000026a0| 2a 09 20 20 20 20 20 20 | 20 6e 61 6d 65 20 6f 66 |*. | name of|
|000026b0| 20 74 68 65 20 72 61 77 | 20 64 65 76 69 63 65 20 | the raw| device |
|000026c0| 77 68 65 74 68 65 72 20 | 74 68 65 79 20 67 61 76 |whether |they gav|
|000026d0| 65 20 75 73 20 74 68 61 | 74 2c 20 74 68 65 0a 20 |e us tha|t, the. |
|000026e0| 2a 09 20 20 20 20 20 20 | 20 62 6c 6f 63 6b 20 64 |*. | block d|
|000026f0| 65 76 69 63 65 2c 20 6f | 72 20 74 68 65 20 6d 6f |evice, o|r the mo|
|00002700| 75 6e 74 20 70 6f 69 6e | 74 2e 0a 20 2a 2f 0a 67 |unt poin|t.. */.g|
|00002710| 65 74 66 73 69 6e 66 6f | 28 66 73 79 73 29 0a 63 |etfsinfo|(fsys).c|
|00002720| 68 61 72 20 2a 66 73 79 | 73 3b 0a 7b 0a 09 63 68 |har *fsy|s;.{..ch|
|00002730| 61 72 20 2a 72 61 77 64 | 65 76 28 29 3b 0a 09 73 |ar *rawd|ev();..s|
|00002740| 74 72 75 63 74 20 73 74 | 61 74 20 73 62 3b 0a 09 |truct st|at sb;..|
|00002750| 73 74 72 75 63 74 20 66 | 73 74 61 62 20 2a 66 73 |struct f|stab *fs|
|00002760| 3b 0a 0a 09 69 66 20 28 | 73 74 61 74 28 66 73 79 |;...if (|stat(fsy|
|00002770| 73 2c 20 26 73 62 29 20 | 3c 20 30 29 20 7b 0a 09 |s, &sb) |< 0) {..|
|00002780| 09 66 70 72 69 6e 74 66 | 28 73 74 64 65 72 72 2c |.fprintf|(stderr,|
|00002790| 20 22 25 73 3a 20 22 2c | 20 70 6e 61 6d 65 29 3b | "%s: ",| pname);|
|000027a0| 0a 09 09 70 65 72 72 6f | 72 28 66 73 79 73 29 3b |...perro|r(fsys);|
|000027b0| 0a 09 09 65 78 69 74 28 | 31 29 3b 0a 09 7d 0a 0a |...exit(|1);..}..|
|000027c0| 09 2f 2a 0a 09 20 2a 20 | 53 65 65 20 77 68 61 74 |./*.. * |See what|
|000027d0| 20 74 68 65 79 20 67 61 | 76 65 20 75 73 2e 0a 09 | they ga|ve us...|
|000027e0| 20 2a 2f 0a 09 73 77 69 | 74 63 68 20 28 73 62 2e | */..swi|tch (sb.|
|000027f0| 73 74 5f 6d 6f 64 65 20 | 26 20 53 5f 49 46 4d 54 |st_mode |& S_IFMT|
|00002800| 29 20 7b 0a 09 63 61 73 | 65 20 53 5f 49 46 43 48 |) {..cas|e S_IFCH|
|00002810| 52 3a 09 09 09 2f 2a 20 | 63 68 61 72 61 63 74 65 |R:.../* |characte|
|00002820| 72 20 64 65 76 69 63 65 | 09 09 2a 2f 0a 09 09 66 |r device|..*/...f|
|00002830| 73 5f 63 64 65 76 20 3d | 20 66 73 79 73 3b 0a 09 |s_cdev =| fsys;..|
|00002840| 09 62 72 65 61 6b 3b 0a | 09 63 61 73 65 20 53 5f |.break;.|.case S_|
|00002850| 49 46 42 4c 4b 3a 09 09 | 09 2f 2a 20 62 6c 6f 63 |IFBLK:..|./* bloc|
|00002860| 6b 20 64 65 76 69 63 65 | 09 09 09 2a 2f 0a 09 09 |k device|...*/...|
|00002870| 66 73 5f 63 64 65 76 20 | 3d 20 72 61 77 64 65 76 |fs_cdev |= rawdev|
|00002880| 28 66 73 79 73 29 3b 0a | 09 09 62 72 65 61 6b 3b |(fsys);.|..break;|
|00002890| 0a 09 63 61 73 65 20 53 | 5f 49 46 44 49 52 3a 09 |..case S|_IFDIR:.|
|000028a0| 09 09 2f 2a 20 6d 6f 75 | 6e 74 20 70 6f 69 6e 74 |../* mou|nt point|
|000028b0| 09 09 09 2a 2f 0a 09 63 | 61 73 65 20 53 5f 49 46 |...*/..c|ase S_IF|
|000028c0| 52 45 47 3a 0a 09 09 69 | 66 20 28 28 66 73 20 3d |REG:...i|f ((fs =|
|000028d0| 20 67 65 74 66 73 66 69 | 6c 65 28 66 73 79 73 29 | getfsfi|le(fsys)|
|000028e0| 29 20 3d 3d 20 4e 55 4c | 4c 29 20 7b 0a 09 09 09 |) == NUL|L) {....|
|000028f0| 66 70 72 69 6e 74 66 28 | 73 74 64 65 72 72 2c 20 |fprintf(|stderr, |
|00002900| 22 25 73 3a 20 25 73 3a | 20 6e 6f 74 20 61 20 6d |"%s: %s:| not a m|
|00002910| 6f 75 6e 74 65 64 20 66 | 69 6c 65 73 79 73 74 65 |ounted f|ilesyste|
|00002920| 6d 2e 5c 6e 22 2c 20 70 | 6e 61 6d 65 2c 20 66 73 |m.\n", p|name, fs|
|00002930| 79 73 29 3b 0a 09 09 09 | 65 78 69 74 28 31 29 3b |ys);....|exit(1);|
|00002940| 0a 09 09 7d 0a 0a 09 09 | 66 73 5f 63 64 65 76 20 |...}....|fs_cdev |
|00002950| 3d 20 72 61 77 64 65 76 | 28 66 73 2d 3e 66 73 5f |= rawdev|(fs->fs_|
|00002960| 73 70 65 63 29 3b 0a 09 | 09 62 72 65 61 6b 3b 0a |spec);..|.break;.|
|00002970| 09 64 65 66 61 75 6c 74 | 3a 0a 09 09 66 70 72 69 |.default|:...fpri|
|00002980| 6e 74 66 28 73 74 64 65 | 72 72 2c 20 22 25 73 3a |ntf(stde|rr, "%s:|
|00002990| 20 25 73 3a 20 6e 6f 74 | 20 61 20 6d 6f 75 6e 74 | %s: not| a mount|
|000029a0| 65 64 20 66 69 6c 65 73 | 79 73 74 65 6d 2e 5c 6e |ed files|ystem.\n|
|000029b0| 22 2c 20 70 6e 61 6d 65 | 2c 20 66 73 79 73 29 3b |", pname|, fsys);|
|000029c0| 0a 09 09 65 78 69 74 28 | 31 29 3b 0a 09 7d 0a 0a |...exit(|1);..}..|
|000029d0| 09 69 66 20 28 73 74 61 | 74 28 66 73 5f 63 64 65 |.if (sta|t(fs_cde|
|000029e0| 76 2c 20 26 73 62 29 20 | 3c 20 30 29 20 7b 0a 09 |v, &sb) |< 0) {..|
|000029f0| 09 66 70 72 69 6e 74 66 | 28 73 74 64 65 72 72 2c |.fprintf|(stderr,|
|00002a00| 20 22 25 73 3a 20 22 2c | 20 70 6e 61 6d 65 29 3b | "%s: ",| pname);|
|00002a10| 0a 09 09 70 65 72 72 6f | 72 28 66 73 5f 63 64 65 |...perro|r(fs_cde|
|00002a20| 76 29 3b 0a 09 09 65 78 | 69 74 28 31 29 3b 0a 09 |v);...ex|it(1);..|
|00002a30| 7d 0a 0a 09 66 73 5f 64 | 65 76 20 3d 20 73 62 2e |}...fs_d|ev = sb.|
|00002a40| 73 74 5f 64 65 76 3b 0a | 7d 0a 0a 2f 2a 0a 20 2a |st_dev;.|}../*. *|
|00002a50| 20 67 65 74 64 69 6e 66 | 6f 20 2d 20 67 65 74 20 | getdinf|o - get |
|00002a60| 74 68 65 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 20 |the info|rmation |
|00002a70| 61 62 6f 75 74 20 74 68 | 65 20 66 69 6c 65 20 73 |about th|e file s|
|00002a80| 79 73 74 65 6d 20 6f 66 | 66 20 74 68 65 20 64 69 |ystem of|f the di|
|00002a90| 73 6b 2e 0a 20 2a 2f 0a | 67 65 74 64 69 6e 66 6f |sk.. */.|getdinfo|
|00002aa0| 28 29 0a 7b 0a 09 72 65 | 67 69 73 74 65 72 20 69 |().{..re|gister i|
|00002ab0| 6e 6f 5f 74 20 69 6e 6f | 3b 0a 09 72 65 67 69 73 |no_t ino|;..regis|
|00002ac0| 74 65 72 20 64 61 64 64 | 72 5f 74 20 69 62 6c 6b |ter dadd|r_t iblk|
|00002ad0| 3b 0a 0a 09 2f 2a 0a 09 | 20 2a 20 4f 70 65 6e 20 |;.../*..| * Open |
|00002ae0| 74 68 65 20 63 68 61 72 | 61 63 74 65 72 20 64 65 |the char|acter de|
|00002af0| 76 69 63 65 2e 0a 09 20 | 2a 2f 0a 09 69 66 20 28 |vice... |*/..if (|
|00002b00| 28 66 69 6c 65 64 65 73 | 20 3d 20 6f 70 65 6e 28 |(filedes| = open(|
|00002b10| 66 73 5f 63 64 65 76 2c | 20 4f 5f 52 44 4f 4e 4c |fs_cdev,| O_RDONL|
|00002b20| 59 29 29 20 3c 20 30 29 | 20 7b 0a 09 09 66 70 72 |Y)) < 0)| {...fpr|
|00002b30| 69 6e 74 66 28 73 74 64 | 65 72 72 2c 20 22 25 73 |intf(std|err, "%s|
|00002b40| 3a 20 22 2c 20 70 6e 61 | 6d 65 29 3b 0a 09 09 70 |: ", pna|me);...p|
|00002b50| 65 72 72 6f 72 28 66 73 | 5f 63 64 65 76 29 3b 0a |error(fs|_cdev);.|
|00002b60| 09 09 65 78 69 74 28 31 | 29 3b 0a 09 7d 0a 0a 09 |..exit(1|);..}...|
|00002b70| 2f 2a 0a 09 20 2a 20 55 | 70 64 61 74 65 20 77 68 |/*.. * U|pdate wh|
|00002b80| 61 74 27 73 20 6f 6e 20 | 74 68 65 20 64 69 73 6b |at's on |the disk|
|00002b90| 2e 0a 09 20 2a 2f 0a 09 | 73 79 6e 63 28 29 3b 0a |... */..|sync();.|
|00002ba0| 0a 09 2f 2a 0a 09 20 2a | 20 52 65 61 64 20 74 68 |../*.. *| Read th|
|00002bb0| 65 20 73 75 70 65 72 20 | 62 6c 6f 63 6b 2e 0a 09 |e super |block...|
|00002bc0| 20 2a 2f 0a 09 62 72 65 | 61 64 28 53 42 4c 4f 43 | */..bre|ad(SBLOC|
|00002bd0| 4b 2c 20 26 73 62 6c 6f | 63 6b 2c 20 53 42 53 49 |K, &sblo|ck, SBSI|
|00002be0| 5a 45 29 3b 0a 0a 09 2f | 2a 0a 09 20 2a 20 43 6f |ZE);.../|*.. * Co|
|00002bf0| 70 79 20 74 68 65 20 6e | 61 6d 65 20 6f 66 20 74 |py the n|ame of t|
|00002c00| 68 65 20 6c 61 73 74 20 | 6d 6f 75 6e 74 20 70 6f |he last |mount po|
|00002c10| 69 6e 74 2c 20 61 6e 64 | 0a 09 20 2a 20 67 65 74 |int, and|.. * get|
|00002c20| 20 74 68 65 20 6e 75 6d | 62 65 72 20 6f 66 20 66 | the num|ber of f|
|00002c30| 69 6c 65 73 20 6f 6e 20 | 74 68 65 20 66 69 6c 65 |iles on |the file|
|00002c40| 20 73 79 73 74 65 6d 2e | 0a 09 20 2a 2f 0a 09 66 | system.|.. */..f|
|00002c50| 69 6c 73 79 73 20 3d 20 | 73 62 6c 6f 63 6b 2e 66 |ilsys = |sblock.f|
|00002c60| 73 5f 66 73 6d 6e 74 3b | 0a 09 6e 66 69 6c 65 73 |s_fsmnt;|..nfiles|
|00002c70| 20 3d 20 73 62 6c 6f 63 | 6b 2e 66 73 5f 69 70 67 | = sbloc|k.fs_ipg|
|00002c80| 20 2a 20 73 62 6c 6f 63 | 6b 2e 66 73 5f 6e 63 67 | * sbloc|k.fs_ncg|
|00002c90| 3b 0a 0a 09 2f 2a 0a 09 | 20 2a 20 41 6c 6c 6f 63 |;.../*..| * Alloc|
|00002ca0| 61 74 65 20 73 70 61 63 | 65 20 66 6f 72 20 74 68 |ate spac|e for th|
|00002cb0| 65 20 69 6e 6f 64 65 73 | 2e 0a 09 20 2a 2f 0a 09 |e inodes|... */..|
|00002cc0| 69 66 20 28 28 64 69 6e | 6f 64 65 20 3d 20 28 73 |if ((din|ode = (s|
|00002cd0| 74 72 75 63 74 20 64 69 | 6e 6f 64 65 20 2a 29 20 |truct di|node *) |
|00002ce0| 6d 61 6c 6c 6f 63 28 6e | 66 69 6c 65 73 20 2a 20 |malloc(n|files * |
|00002cf0| 73 69 7a 65 6f 66 28 73 | 74 72 75 63 74 20 64 69 |sizeof(s|truct di|
|00002d00| 6e 6f 64 65 29 29 29 20 | 3d 3d 20 4e 55 4c 4c 29 |node))) |== NULL)|
|00002d10| 20 7b 0a 09 09 66 70 72 | 69 6e 74 66 28 73 74 64 | {...fpr|intf(std|
|00002d20| 65 72 72 2c 20 22 25 73 | 3a 20 6f 75 74 20 6f 66 |err, "%s|: out of|
|00002d30| 20 6d 65 6d 6f 72 79 2e | 5c 6e 22 2c 20 70 6e 61 | memory.|\n", pna|
|00002d40| 6d 65 29 3b 0a 09 09 65 | 78 69 74 28 31 29 3b 0a |me);...e|xit(1);.|
|00002d50| 09 7d 0a 0a 09 2f 2a 0a | 09 20 2a 20 52 65 61 64 |.}.../*.|. * Read|
|00002d60| 20 69 6e 20 65 61 63 68 | 20 69 6e 6f 64 65 20 66 | in each| inode f|
|00002d70| 72 6f 6d 20 64 69 73 6b | 2e 0a 09 20 2a 2f 0a 09 |rom disk|... */..|
|00002d80| 66 6f 72 20 28 69 6e 6f | 20 3d 20 30 3b 20 69 6e |for (ino| = 0; in|
|00002d90| 6f 20 3c 20 6e 66 69 6c | 65 73 3b 20 69 6e 6f 20 |o < nfil|es; ino |
|00002da0| 2b 3d 20 49 4e 4f 50 42 | 28 26 73 62 6c 6f 63 6b |+= INOPB|(&sblock|
|00002db0| 29 29 20 7b 0a 09 09 69 | 62 6c 6b 20 3d 20 66 73 |)) {...i|blk = fs|
|00002dc0| 62 74 6f 64 62 28 26 73 | 62 6c 6f 63 6b 2c 20 69 |btodb(&s|block, i|
|00002dd0| 74 6f 64 28 26 73 62 6c | 6f 63 6b 2c 20 69 6e 6f |tod(&sbl|ock, ino|
|00002de0| 29 29 3b 0a 09 09 62 72 | 65 61 64 28 69 62 6c 6b |));...br|ead(iblk|
|00002df0| 2c 20 26 64 69 6e 6f 64 | 65 5b 69 6e 6f 5d 2c 20 |, &dinod|e[ino], |
|00002e00| 73 62 6c 6f 63 6b 2e 66 | 73 5f 62 73 69 7a 65 29 |sblock.f|s_bsize)|
|00002e10| 3b 0a 09 7d 0a 7d 0a 0a | 2f 2a 0a 20 2a 20 67 65 |;..}.}..|/*. * ge|
|00002e20| 74 70 69 6e 66 6f 20 2d | 20 67 65 74 20 74 68 65 |tpinfo -| get the|
|00002e30| 20 70 61 74 68 20 6e 61 | 6d 65 20 69 6e 66 6f 72 | path na|me infor|
|00002e40| 6d 61 74 69 6f 6e 20 62 | 79 20 72 65 61 64 69 6e |mation b|y readin|
|00002e50| 67 20 74 68 65 20 64 69 | 72 65 63 74 6f 72 79 20 |g the di|rectory |
|00002e60| 62 6c 6f 63 6b 73 0a 20 | 2a 09 20 20 20 20 20 20 |blocks. |*. |
|00002e70| 6f 66 66 20 74 68 65 20 | 64 69 73 6b 2e 0a 20 2a |off the |disk.. *|
|00002e80| 2f 0a 67 65 74 70 69 6e | 66 6f 28 29 0a 7b 0a 09 |/.getpin|fo().{..|
|00002e90| 72 65 67 69 73 74 65 72 | 20 69 6e 6f 5f 74 20 69 |register| ino_t i|
|00002ea0| 6e 6f 3b 0a 0a 09 2f 2a | 0a 09 20 2a 20 57 65 20 |no;.../*|.. * We |
|00002eb0| 6e 65 65 64 20 6f 6e 65 | 20 70 61 74 68 20 63 6f |need one| path co|
|00002ec0| 6d 70 6f 6e 65 6e 74 20 | 66 6f 72 20 65 61 63 68 |mponent |for each|
|00002ed0| 20 66 69 6c 65 2e 0a 09 | 20 2a 2f 0a 09 69 66 20 | file...| */..if |
|00002ee0| 28 28 70 61 74 68 6c 69 | 73 74 20 3d 20 28 73 74 |((pathli|st = (st|
|00002ef0| 72 75 63 74 20 70 61 74 | 68 63 6f 6d 70 20 2a 29 |ruct pat|hcomp *)|
|00002f00| 20 6d 61 6c 6c 6f 63 28 | 6e 66 69 6c 65 73 20 2a | malloc(|nfiles *|
|00002f10| 20 73 69 7a 65 6f 66 28 | 73 74 72 75 63 74 20 70 | sizeof(|struct p|
|00002f20| 61 74 68 63 6f 6d 70 29 | 29 29 20 3d 3d 20 4e 55 |athcomp)|)) == NU|
|00002f30| 4c 4c 29 20 7b 0a 09 09 | 66 70 72 69 6e 74 66 28 |LL) {...|fprintf(|
|00002f40| 73 74 64 65 72 72 2c 20 | 22 25 73 3a 20 6e 6f 74 |stderr, |"%s: not|
|00002f50| 20 65 6e 6f 75 67 68 20 | 6d 65 6d 6f 72 79 20 74 | enough |memory t|
|00002f60| 6f 20 63 6f 6e 73 74 72 | 75 63 74 20 70 61 74 68 |o constr|uct path|
|00002f70| 20 6c 69 73 74 2e 5c 6e | 22 2c 20 70 6e 61 6d 65 | list.\n|", pname|
|00002f80| 29 3b 0a 09 09 70 66 6c | 61 67 20 3d 20 30 3b 0a |);...pfl|ag = 0;.|
|00002f90| 09 09 72 65 74 75 72 6e | 3b 0a 09 7d 0a 0a 09 2f |..return|;..}.../|
|00002fa0| 2a 0a 09 20 2a 20 57 65 | 20 6e 65 65 64 20 72 6f |*.. * We| need ro|
|00002fb0| 6f 6d 20 66 6f 72 20 61 | 20 64 69 73 6b 20 62 6c |om for a| disk bl|
|00002fc0| 6f 63 6b 20 77 6f 72 74 | 68 20 6f 66 20 64 69 72 |ock wort|h of dir|
|00002fd0| 65 63 74 6f 72 79 20 69 | 6e 66 6f 72 6d 61 74 69 |ectory i|nformati|
|00002fe0| 6f 6e 2e 0a 09 20 2a 2f | 0a 09 69 66 20 28 28 64 |on... */|..if ((d|
|00002ff0| 69 72 62 75 66 20 3d 20 | 28 63 68 61 72 20 2a 29 |irbuf = |(char *)|
|00003000| 20 6d 61 6c 6c 6f 63 28 | 73 62 6c 6f 63 6b 2e 66 | malloc(|sblock.f|
|00003010| 73 5f 62 73 69 7a 65 29 | 29 20 3d 3d 20 4e 55 4c |s_bsize)|) == NUL|
|00003020| 4c 29 20 7b 0a 09 09 66 | 70 72 69 6e 74 66 28 73 |L) {...f|printf(s|
|00003030| 74 64 65 72 72 2c 20 22 | 25 73 3a 20 6e 6f 74 20 |tderr, "|%s: not |
|00003040| 65 6e 6f 75 67 68 20 6d | 65 6d 6f 72 79 20 74 6f |enough m|emory to|
|00003050| 20 63 6f 6e 73 74 72 75 | 63 74 20 70 61 74 68 20 | constru|ct path |
|00003060| 6c 69 73 74 2e 5c 6e 22 | 2c 20 70 6e 61 6d 65 29 |list.\n"|, pname)|
|00003070| 3b 0a 09 09 70 66 6c 61 | 67 20 3d 20 30 3b 0a 09 |;...pfla|g = 0;..|
|00003080| 09 72 65 74 75 72 6e 3b | 0a 09 7d 0a 0a 09 2f 2a |.return;|..}.../*|
|00003090| 0a 09 20 2a 20 53 74 61 | 72 74 20 74 68 65 20 70 |.. * Sta|rt the p|
|000030a0| 61 74 68 2e 0a 09 20 2a | 2f 0a 09 70 61 74 68 6c |ath... *|/..pathl|
|000030b0| 69 73 74 5b 52 4f 4f 54 | 49 4e 4f 5d 2e 70 63 5f |ist[ROOT|INO].pc_|
|000030c0| 6e 61 6d 65 20 3d 20 66 | 69 6c 73 79 73 3b 0a 09 |name = f|ilsys;..|
|000030d0| 70 61 74 68 6c 69 73 74 | 5b 52 4f 4f 54 49 4e 4f |pathlist|[ROOTINO|
|000030e0| 5d 2e 70 63 5f 70 61 72 | 65 6e 74 20 3d 20 26 70 |].pc_par|ent = &p|
|000030f0| 61 74 68 6c 69 73 74 5b | 52 4f 4f 54 49 4e 4f 5d |athlist[|ROOTINO]|
|00003100| 3b 0a 0a 09 2f 2a 0a 09 | 20 2a 20 46 6f 72 20 65 |;.../*..| * For e|
|00003110| 61 63 68 20 64 69 72 65 | 63 74 6f 72 79 2c 20 72 |ach dire|ctory, r|
|00003120| 65 61 64 20 69 6e 20 74 | 68 65 20 64 69 72 65 63 |ead in t|he direc|
|00003130| 74 6f 72 79 20 62 6c 6f | 63 6b 73 2e 0a 09 20 2a |tory blo|cks... *|
|00003140| 2f 0a 09 66 6f 72 20 28 | 69 6e 6f 20 3d 20 52 4f |/..for (|ino = RO|
|00003150| 4f 54 49 4e 4f 3b 20 28 | 69 6e 6f 20 3c 20 6e 66 |OTINO; (|ino < nf|
|00003160| 69 6c 65 73 29 20 26 26 | 20 28 70 66 6c 61 67 20 |iles) &&| (pflag |
|00003170| 21 3d 20 30 29 3b 20 69 | 6e 6f 2b 2b 29 20 7b 0a |!= 0); i|no++) {.|
|00003180| 09 09 69 66 20 28 28 64 | 69 6e 6f 64 65 5b 69 6e |..if ((d|inode[in|
|00003190| 6f 5d 2e 64 69 5f 6d 6f | 64 65 20 26 20 49 46 4d |o].di_mo|de & IFM|
|000031a0| 54 29 20 21 3d 20 49 46 | 44 49 52 29 0a 09 09 09 |T) != IF|DIR)....|
|000031b0| 63 6f 6e 74 69 6e 75 65 | 3b 0a 0a 09 09 72 65 61 |continue|;....rea|
|000031c0| 64 64 69 72 62 6c 6b 73 | 28 69 6e 6f 2c 20 26 64 |ddirblks|(ino, &d|
|000031d0| 69 6e 6f 64 65 5b 69 6e | 6f 5d 29 3b 0a 09 7d 0a |inode[in|o]);..}.|
|000031e0| 7d 0a 0a 2f 2a 0a 20 2a | 20 73 65 61 72 63 68 5f |}../*. *| search_|
|000031f0| 64 69 72 65 63 74 20 2d | 20 73 65 61 72 63 68 20 |direct -| search |
|00003200| 74 68 65 20 64 69 72 65 | 63 74 20 62 6c 6f 63 6b |the dire|ct block|
|00003210| 73 20 6f 66 20 74 68 65 | 20 66 69 6c 65 20 66 6f |s of the| file fo|
|00003220| 72 20 74 68 65 20 70 61 | 74 74 65 72 6e 2e 0a 20 |r the pa|ttern.. |
|00003230| 2a 2f 0a 73 65 61 72 63 | 68 5f 64 69 72 65 63 74 |*/.searc|h_direct|
|00003240| 28 64 70 2c 20 69 6e 6f | 29 0a 73 74 72 75 63 74 |(dp, ino|).struct|
|00003250| 20 64 69 6e 6f 64 65 20 | 2a 64 70 3b 0a 69 6e 6f | dinode |*dp;.ino|
|00003260| 5f 74 20 69 6e 6f 3b 0a | 7b 0a 09 69 6e 74 20 63 |_t ino;.|{..int c|
|00003270| 6f 75 6e 74 3b 0a 09 63 | 68 61 72 20 2a 70 61 74 |ount;..c|har *pat|
|00003280| 68 6e 61 6d 65 28 29 3b | 0a 09 72 65 67 69 73 74 |hname();|..regist|
|00003290| 65 72 20 69 6e 74 20 69 | 2c 20 6e 3b 0a 09 63 68 |er int i|, n;..ch|
|000032a0| 61 72 20 64 62 6c 6f 63 | 6b 5b 4d 41 58 42 53 49 |ar dbloc|k[MAXBSI|
|000032b0| 5a 45 5d 3b 0a 0a 09 63 | 6f 75 6e 74 20 3d 20 64 |ZE];...c|ount = d|
|000032c0| 70 2d 3e 64 69 5f 73 69 | 7a 65 3b 0a 0a 09 2f 2a |p->di_si|ze;.../*|
|000032d0| 0a 09 20 2a 20 46 6f 72 | 20 65 61 63 68 20 64 69 |.. * For| each di|
|000032e0| 72 65 63 74 20 62 6c 6f | 63 6b 20 69 6e 20 74 68 |rect blo|ck in th|
|000032f0| 65 20 66 69 6c 65 2e 2e | 2e 0a 09 20 2a 2f 0a 09 |e file..|... */..|
|00003300| 66 6f 72 20 28 69 3d 30 | 3b 20 28 69 20 3c 20 4e |for (i=0|; (i < N|
|00003310| 44 41 44 44 52 29 20 26 | 26 20 28 63 6f 75 6e 74 |DADDR) &|& (count|
|00003320| 20 3e 20 30 29 3b 20 69 | 2b 2b 29 20 7b 0a 09 09 | > 0); i|++) {...|
|00003330| 2f 2a 0a 09 09 20 2a 20 | 52 65 61 64 20 69 6e 20 |/*... * |Read in |
|00003340| 74 68 65 20 62 6c 6f 63 | 6b 20 66 72 6f 6d 20 64 |the bloc|k from d|
|00003350| 69 73 6b 2e 0a 09 09 20 | 2a 2f 0a 09 09 62 72 65 |isk.... |*/...bre|
|00003360| 61 64 28 66 73 62 74 6f | 64 62 28 26 73 62 6c 6f |ad(fsbto|db(&sblo|
|00003370| 63 6b 2c 20 64 70 2d 3e | 64 69 5f 64 62 5b 69 5d |ck, dp->|di_db[i]|
|00003380| 29 2c 20 64 62 6c 6f 63 | 6b 2c 20 6e 20 3d 20 6d |), dbloc|k, n = m|
|00003390| 69 6e 28 63 6f 75 6e 74 | 2c 20 73 62 6c 6f 63 6b |in(count|, sblock|
|000033a0| 2e 66 73 5f 62 73 69 7a | 65 29 29 3b 0a 09 09 63 |.fs_bsiz|e));...c|
|000033b0| 6f 75 6e 74 20 2d 3d 20 | 6e 3b 0a 0a 09 09 69 66 |ount -= |n;....if|
|000033c0| 20 28 73 65 61 72 63 68 | 28 70 61 74 74 65 72 6e | (search|(pattern|
|000033d0| 2c 20 64 62 6c 6f 63 6b | 2c 20 6e 29 29 0a 09 09 |, dblock|, n))...|
|000033e0| 09 72 65 74 75 72 6e 28 | 31 29 3b 0a 09 7d 0a 0a |.return(|1);..}..|
|000033f0| 09 2f 2a 0a 09 20 2a 20 | 4e 6f 74 20 69 6e 20 74 |./*.. * |Not in t|
|00003400| 68 65 20 64 69 72 65 63 | 74 20 62 6c 6f 63 6b 73 |he direc|t blocks|
|00003410| 3b 20 73 74 61 72 74 20 | 73 65 61 72 63 68 69 6e |; start |searchin|
|00003420| 67 20 74 68 65 0a 09 20 | 2a 20 69 6e 64 69 72 65 |g the.. |* indire|
|00003430| 63 74 20 62 6c 6f 63 6b | 73 2e 0a 09 20 2a 2f 0a |ct block|s... */.|
|00003440| 09 66 6f 72 20 28 69 3d | 30 3b 20 28 69 20 3c 20 |.for (i=|0; (i < |
|00003450| 4e 49 41 44 44 52 29 20 | 26 26 20 28 63 6f 75 6e |NIADDR) |&& (coun|
|00003460| 74 20 3e 20 30 29 3b 20 | 69 2b 2b 29 20 7b 0a 09 |t > 0); |i++) {..|
|00003470| 09 69 66 20 28 73 65 61 | 72 63 68 5f 69 6e 64 69 |.if (sea|rch_indi|
|00003480| 72 65 63 74 28 64 70 2d | 3e 64 69 5f 69 62 5b 69 |rect(dp-|>di_ib[i|
|00003490| 5d 2c 20 69 2c 20 26 63 | 6f 75 6e 74 29 29 0a 09 |], i, &c|ount))..|
|000034a0| 09 09 72 65 74 75 72 6e | 28 31 29 3b 0a 09 7d 0a |..return|(1);..}.|
|000034b0| 0a 09 2f 2a 0a 09 20 2a | 20 50 61 74 74 65 72 6e |../*.. *| Pattern|
|000034c0| 20 6e 6f 74 20 66 6f 75 | 6e 64 2e 0a 09 20 2a 2f | not fou|nd... */|
|000034d0| 0a 09 72 65 74 75 72 6e | 28 30 29 3b 0a 7d 0a 0a |..return|(0);.}..|
|000034e0| 2f 2a 0a 20 2a 20 73 65 | 61 72 63 68 5f 69 6e 64 |/*. * se|arch_ind|
|000034f0| 69 72 65 63 74 20 2d 20 | 73 65 61 72 63 68 20 74 |irect - |search t|
|00003500| 68 65 20 69 6e 64 69 72 | 65 63 74 20 62 6c 6f 63 |he indir|ect bloc|
|00003510| 6b 73 20 6f 66 20 74 68 | 65 20 66 69 6c 65 20 66 |ks of th|e file f|
|00003520| 6f 72 20 74 68 65 20 70 | 61 74 74 65 72 6e 2e 0a |or the p|attern..|
|00003530| 20 2a 09 09 20 20 20 20 | 20 4c 65 76 65 6c 20 3d | *.. | Level =|
|00003540| 20 30 20 69 6e 64 69 63 | 61 74 65 73 20 73 69 6e | 0 indic|ates sin|
|00003550| 67 6c 79 20 69 6e 64 69 | 72 65 63 74 20 62 6c 6f |gly indi|rect blo|
|00003560| 63 6b 73 2c 20 6c 65 76 | 65 6c 20 3d 20 31 0a 20 |cks, lev|el = 1. |
|00003570| 2a 09 09 20 20 20 20 20 | 69 6e 64 69 63 61 74 65 |*.. |indicate|
|00003580| 73 20 64 6f 75 62 6c 79 | 20 69 6e 64 72 65 63 74 |s doubly| indrect|
|00003590| 20 62 6c 6f 63 6b 73 2c | 20 61 6e 64 20 73 6f 20 | blocks,| and so |
|000035a0| 6f 6e 2e 0a 20 2a 2f 0a | 73 65 61 72 63 68 5f 69 |on.. */.|search_i|
|000035b0| 6e 64 69 72 65 63 74 28 | 62 6c 6b 6e 6f 2c 20 6c |ndirect(|blkno, l|
|000035c0| 65 76 65 6c 2c 20 63 6f | 75 6e 74 29 0a 69 6e 6f |evel, co|unt).ino|
|000035d0| 5f 74 20 62 6c 6b 6e 6f | 3b 0a 69 6e 74 20 2a 63 |_t blkno|;.int *c|
|000035e0| 6f 75 6e 74 3b 0a 69 6e | 74 20 6c 65 76 65 6c 3b |ount;.in|t level;|
|000035f0| 0a 7b 0a 09 72 65 67 69 | 73 74 65 72 20 69 6e 74 |.{..regi|ster int|
|00003600| 20 69 2c 20 6e 3b 0a 09 | 63 68 61 72 20 64 62 6c | i, n;..|char dbl|
|00003610| 6f 63 6b 5b 4d 41 58 42 | 53 49 5a 45 5d 3b 0a 09 |ock[MAXB|SIZE];..|
|00003620| 64 61 64 64 72 5f 74 20 | 69 64 62 6c 6b 5b 4d 41 |daddr_t |idblk[MA|
|00003630| 58 42 53 49 5a 45 20 2f | 20 73 69 7a 65 6f 66 28 |XBSIZE /| sizeof(|
|00003640| 64 61 64 64 72 5f 74 29 | 5d 3b 0a 0a 09 2f 2a 0a |daddr_t)|];.../*.|
|00003650| 09 20 2a 20 52 65 61 64 | 20 69 6e 20 74 68 65 20 |. * Read| in the |
|00003660| 62 6c 6f 63 6b 20 66 72 | 6f 6d 20 64 69 73 6b 2e |block fr|om disk.|
|00003670| 0a 09 20 2a 2f 0a 09 69 | 66 20 28 62 6c 6b 6e 6f |.. */..i|f (blkno|
|00003680| 29 0a 09 09 62 72 65 61 | 64 28 66 73 62 74 6f 64 |)...brea|d(fsbtod|
|00003690| 62 28 26 73 62 6c 6f 63 | 6b 2c 20 62 6c 6b 6e 6f |b(&sbloc|k, blkno|
|000036a0| 29 2c 20 69 64 62 6c 6b | 2c 20 73 62 6c 6f 63 6b |), idblk|, sblock|
|000036b0| 2e 66 73 5f 62 73 69 7a | 65 29 3b 0a 09 65 6c 73 |.fs_bsiz|e);..els|
|000036c0| 65 0a 09 09 62 7a 65 72 | 6f 28 69 64 62 6c 6b 2c |e...bzer|o(idblk,|
|000036d0| 20 73 62 6c 6f 63 6b 2e | 66 73 5f 62 73 69 7a 65 | sblock.|fs_bsize|
|000036e0| 29 3b 0a 0a 09 2f 2a 0a | 09 20 2a 20 49 66 20 6c |);.../*.|. * If l|
|000036f0| 65 76 65 6c 20 69 73 20 | 7a 65 72 6f 2c 20 74 68 |evel is |zero, th|
|00003700| 65 6e 20 74 68 69 73 20 | 62 6c 6f 63 6b 20 63 6f |en this |block co|
|00003710| 6e 74 61 69 6e 73 20 64 | 69 73 6b 20 62 6c 6f 63 |ntains d|isk bloc|
|00003720| 6b 0a 09 20 2a 20 61 64 | 64 72 65 73 73 65 73 2e |k.. * ad|dresses.|
|00003730| 0a 09 20 2a 2f 0a 09 69 | 66 20 28 6c 65 76 65 6c |.. */..i|f (level|
|00003740| 20 3c 3d 20 30 29 20 7b | 0a 09 09 2f 2a 0a 09 09 | <= 0) {|.../*...|
|00003750| 20 2a 20 46 6f 72 20 65 | 61 63 68 20 64 69 73 6b | * For e|ach disk|
|00003760| 20 62 6c 6f 63 6b 2e 2e | 2e 0a 09 09 20 2a 2f 0a | block..|.... */.|
|00003770| 09 09 66 6f 72 20 28 69 | 3d 30 3b 20 28 69 20 3c |..for (i|=0; (i <|
|00003780| 20 4e 49 4e 44 49 52 28 | 26 73 62 6c 6f 63 6b 29 | NINDIR(|&sblock)|
|00003790| 29 20 26 26 20 28 2a 63 | 6f 75 6e 74 20 3e 20 30 |) && (*c|ount > 0|
|000037a0| 29 3b 20 69 2b 2b 29 20 | 7b 0a 09 09 09 2f 2a 0a |); i++) |{..../*.|
|000037b0| 09 09 09 20 2a 20 52 65 | 61 64 20 69 6e 20 74 68 |... * Re|ad in th|
|000037c0| 65 20 62 6c 6f 63 6b 20 | 66 72 6f 6d 20 64 69 73 |e block |from dis|
|000037d0| 6b 2e 0a 09 09 09 20 2a | 2f 0a 09 09 09 62 72 65 |k..... *|/....bre|
|000037e0| 61 64 28 66 73 62 74 6f | 64 62 28 26 73 62 6c 6f |ad(fsbto|db(&sblo|
|000037f0| 63 6b 2c 20 69 64 62 6c | 6b 5b 69 5d 29 2c 20 64 |ck, idbl|k[i]), d|
|00003800| 62 6c 6f 63 6b 2c 20 6e | 20 3d 20 6d 69 6e 28 2a |block, n| = min(*|
|00003810| 63 6f 75 6e 74 2c 20 73 | 62 6c 6f 63 6b 2e 66 73 |count, s|block.fs|
|00003820| 5f 62 73 69 7a 65 29 29 | 3b 0a 09 09 09 2a 63 6f |_bsize))|;....*co|
|00003830| 75 6e 74 20 2d 3d 20 6e | 3b 0a 0a 09 09 09 2f 2a |unt -= n|;...../*|
|00003840| 0a 09 09 09 20 2a 20 53 | 65 61 72 63 68 20 66 6f |.... * S|earch fo|
|00003850| 72 20 74 68 65 20 70 61 | 74 74 65 72 6e 2e 0a 09 |r the pa|ttern...|
|00003860| 09 09 20 2a 2f 0a 09 09 | 09 69 66 20 28 73 65 61 |.. */...|.if (sea|
|00003870| 72 63 68 28 70 61 74 74 | 65 72 6e 2c 20 64 62 6c |rch(patt|ern, dbl|
|00003880| 6f 63 6b 2c 20 6e 29 29 | 0a 09 09 09 09 72 65 74 |ock, n))|.....ret|
|00003890| 75 72 6e 28 31 29 3b 0a | 09 09 7d 0a 0a 09 09 2f |urn(1);.|..}..../|
|000038a0| 2a 0a 09 09 20 2a 20 4e | 6f 74 20 66 6f 75 6e 64 |*... * N|ot found|
|000038b0| 20 28 62 75 74 20 6e 6f | 74 65 20 74 68 69 73 20 | (but no|te this |
|000038c0| 70 72 6f 63 65 64 75 72 | 65 20 69 73 20 72 65 63 |procedur|e is rec|
|000038d0| 75 72 73 69 76 65 2c 0a | 09 09 20 2a 20 73 6f 20 |ursive,.|.. * so |
|000038e0| 74 68 69 73 20 7a 65 72 | 6f 20 6d 61 79 20 6e 6f |this zer|o may no|
|000038f0| 74 20 67 6f 20 61 6c 6c | 20 74 68 65 20 77 61 79 |t go all| the way|
|00003900| 20 62 61 63 6b 29 2e 0a | 09 09 20 2a 2f 0a 09 09 | back)..|.. */...|
|00003910| 72 65 74 75 72 6e 28 30 | 29 3b 0a 09 7d 0a 0a 09 |return(0|);..}...|
|00003920| 6c 65 76 65 6c 2d 2d 3b | 0a 0a 09 2f 2a 0a 09 20 |level--;|.../*.. |
|00003930| 2a 20 48 61 6e 64 6c 65 | 20 74 68 65 20 6e 65 78 |* Handle| the nex|
|00003940| 74 20 6c 65 76 65 6c 20 | 6f 66 20 69 6e 64 72 65 |t level |of indre|
|00003950| 63 74 69 6f 6e 2e 0a 09 | 20 2a 2f 0a 09 66 6f 72 |ction...| */..for|
|00003960| 20 28 69 3d 30 3b 20 69 | 20 3c 20 4e 49 4e 44 49 | (i=0; i| < NINDI|
|00003970| 52 28 26 73 62 6c 6f 63 | 6b 29 3b 20 69 2b 2b 29 |R(&sbloc|k); i++)|
|00003980| 20 7b 0a 09 09 69 66 20 | 28 73 65 61 72 63 68 5f | {...if |(search_|
|00003990| 69 6e 64 69 72 65 63 74 | 28 69 64 62 6c 6b 5b 69 |indirect|(idblk[i|
|000039a0| 5d 2c 20 6c 65 76 65 6c | 2c 20 63 6f 75 6e 74 29 |], level|, count)|
|000039b0| 29 0a 09 09 09 72 65 74 | 75 72 6e 28 31 29 3b 0a |)....ret|urn(1);.|
|000039c0| 09 7d 0a 0a 09 2f 2a 0a | 09 20 2a 20 4e 6f 74 20 |.}.../*.|. * Not |
|000039d0| 66 6f 75 6e 64 2c 20 61 | 6e 64 20 77 65 27 76 65 |found, a|nd we've|
|000039e0| 20 72 65 61 64 20 74 68 | 65 20 77 68 6f 6c 65 20 | read th|e whole |
|000039f0| 66 69 6c 65 2e 0a 09 20 | 2a 2f 0a 09 72 65 74 75 |file... |*/..retu|
|00003a00| 72 6e 28 30 29 3b 0a 7d | 0a 0a 2f 2a 0a 20 2a 20 |rn(0);.}|../*. * |
|00003a10| 73 65 61 72 63 68 20 2d | 20 73 65 61 72 63 68 20 |search -| search |
|00003a20| 66 6f 72 20 70 61 74 20 | 69 6e 20 62 75 66 2e 20 |for pat |in buf. |
|00003a30| 20 42 75 66 20 63 6f 6e | 74 61 69 6e 73 20 63 6f | Buf con|tains co|
|00003a40| 75 6e 74 20 62 79 74 65 | 73 2e 20 20 57 65 20 75 |unt byte|s. We u|
|00003a50| 73 65 20 74 68 65 0a 20 | 2a 09 20 20 20 20 4b 6e |se the. |*. Kn|
|00003a60| 75 74 68 2d 4d 6f 79 65 | 72 2d 50 72 61 74 74 20 |uth-Moye|r-Pratt |
|00003a70| 61 6c 67 6f 72 69 74 68 | 6d 20 61 73 20 64 65 73 |algorith|m as des|
|00003a80| 63 72 69 62 65 64 20 69 | 6e 20 22 43 6f 6d 70 75 |cribed i|n "Compu|
|00003a90| 74 65 72 20 41 6c 67 6f | 72 69 74 68 6d 73 22 2c |ter Algo|rithms",|
|00003aa0| 0a 20 2a 09 20 20 20 20 | 53 61 72 61 20 42 61 61 |. *. |Sara Baa|
|00003ab0| 73 65 2c 20 70 70 2e 20 | 31 37 35 2d 31 38 33 2e |se, pp. |175-183.|
|00003ac0| 0a 20 2a 2f 0a 73 65 61 | 72 63 68 28 70 61 74 2c |. */.sea|rch(pat,|
|00003ad0| 20 62 6c 6f 63 6b 2c 20 | 63 6f 75 6e 74 29 0a 63 | block, |count).c|
|00003ae0| 68 61 72 20 2a 70 61 74 | 2c 20 2a 62 6c 6f 63 6b |har *pat|, *block|
|00003af0| 3b 0a 69 6e 74 20 63 6f | 75 6e 74 3b 0a 7b 0a 09 |;.int co|unt;.{..|
|00003b00| 72 65 67 69 73 74 65 72 | 20 63 68 61 72 20 63 3b |register| char c;|
|00003b10| 0a 09 72 65 67 69 73 74 | 65 72 20 63 68 61 72 20 |..regist|er char |
|00003b20| 2a 70 2c 20 2a 65 6e 64 | 62 6c 6f 63 6b 3b 0a 0a |*p, *end|block;..|
|00003b30| 09 70 20 3d 20 62 6c 6f | 63 6b 3b 0a 09 65 6e 64 |.p = blo|ck;..end|
|00003b40| 62 6c 6f 63 6b 20 3d 20 | 26 62 6c 6f 63 6b 5b 63 |block = |&block[c|
|00003b50| 6f 75 6e 74 5d 3b 0a 0a | 09 77 68 69 6c 65 20 28 |ount];..|.while (|
|00003b60| 70 20 3c 20 65 6e 64 62 | 6c 6f 63 6b 29 20 7b 0a |p < endb|lock) {.|
|00003b70| 09 09 77 68 69 6c 65 20 | 28 70 61 74 70 6f 73 20 |..while |(patpos |
|00003b80| 21 3d 20 2d 31 29 20 7b | 0a 09 09 09 69 66 20 28 |!= -1) {|....if (|
|00003b90| 69 66 6c 61 67 29 0a 09 | 09 09 09 63 20 3d 20 69 |iflag)..|...c = i|
|00003ba0| 73 75 70 70 65 72 28 2a | 70 29 20 3f 20 74 6f 6c |supper(*|p) ? tol|
|00003bb0| 6f 77 65 72 28 2a 70 29 | 20 3a 20 2a 70 3b 0a 09 |ower(*p)| : *p;..|
|00003bc0| 09 09 65 6c 73 65 0a 09 | 09 09 09 63 20 3d 20 2a |..else..|...c = *|
|00003bd0| 70 3b 0a 0a 09 09 09 69 | 66 20 28 63 20 3d 3d 20 |p;.....i|f (c == |
|00003be0| 70 61 74 5b 70 61 74 70 | 6f 73 5d 29 0a 09 09 09 |pat[patp|os])....|
|00003bf0| 09 62 72 65 61 6b 3b 0a | 0a 09 09 09 70 61 74 70 |.break;.|....patp|
|00003c00| 6f 73 20 3d 20 66 6c 69 | 6e 6b 5b 70 61 74 70 6f |os = fli|nk[patpo|
|00003c10| 73 5d 3b 0a 09 09 7d 0a | 0a 09 09 2f 2a 0a 09 09 |s];...}.|.../*...|
|00003c20| 20 2a 20 46 6f 75 6e 64 | 20 69 74 2e 0a 09 09 20 | * Found| it.... |
|00003c30| 2a 2f 0a 09 09 69 66 20 | 28 70 61 74 70 6f 73 20 |*/...if |(patpos |
|00003c40| 3d 3d 20 28 70 61 74 6c | 65 6e 20 2d 20 31 29 29 |== (patl|en - 1))|
|00003c50| 0a 09 09 09 72 65 74 75 | 72 6e 28 31 29 3b 0a 0a |....retu|rn(1);..|
|00003c60| 09 09 70 61 74 70 6f 73 | 2b 2b 3b 0a 09 09 70 2b |..patpos|++;...p+|
|00003c70| 2b 3b 0a 09 7d 0a 0a 09 | 72 65 74 75 72 6e 28 30 |+;..}...|return(0|
|00003c80| 29 3b 0a 7d 0a 09 0a 2f | 2a 0a 20 2a 20 70 61 74 |);.}.../|*. * pat|
|00003c90| 68 6e 61 6d 65 20 2d 20 | 70 72 69 6e 74 20 6f 75 |hname - |print ou|
|00003ca0| 74 20 74 68 65 20 70 61 | 74 68 20 6e 61 6d 65 20 |t the pa|th name |
|00003cb0| 6f 66 20 74 68 65 20 67 | 69 76 65 6e 20 69 6e 6f |of the g|iven ino|
|00003cc0| 64 65 2e 0a 20 2a 2f 0a | 63 68 61 72 20 2a 70 61 |de.. */.|char *pa|
|00003cd0| 74 68 6e 61 6d 65 28 64 | 70 2c 20 69 6e 6f 29 0a |thname(d|p, ino).|
|00003ce0| 73 74 72 75 63 74 20 64 | 69 6e 6f 64 65 20 2a 64 |struct d|inode *d|
|00003cf0| 70 3b 0a 69 6e 6f 5f 74 | 20 69 6e 6f 3b 0a 7b 0a |p;.ino_t| ino;.{.|
|00003d00| 09 72 65 67 69 73 74 65 | 72 20 63 68 61 72 20 2a |.registe|r char *|
|00003d10| 73 3b 0a 09 72 65 67 69 | 73 74 65 72 20 73 74 72 |s;..regi|ster str|
|00003d20| 75 63 74 20 70 61 74 68 | 63 6f 6d 70 20 2a 70 63 |uct path|comp *pc|
|00003d30| 3b 0a 09 63 68 61 72 20 | 2a 65 72 72 20 3d 20 22 |;..char |*err = "|
|00003d40| 5b 75 6e 61 62 6c 65 20 | 74 6f 20 64 65 74 65 72 |[unable |to deter|
|00003d50| 6d 69 6e 65 20 66 69 6c | 65 20 6e 61 6d 65 5d 22 |mine fil|e name]"|
|00003d60| 3b 0a 0a 09 70 63 20 3d | 20 26 70 61 74 68 6c 69 |;...pc =| &pathli|
|00003d70| 73 74 5b 69 6e 6f 5d 3b | 0a 09 70 61 74 68 62 75 |st[ino];|..pathbu|
|00003d80| 66 5b 4d 41 58 4e 41 4d | 4c 45 4e 2d 31 5d 20 3d |f[MAXNAM|LEN-1] =|
|00003d90| 20 4e 55 4c 4c 3b 0a 09 | 70 61 74 68 70 74 72 20 | NULL;..|pathptr |
|00003da0| 3d 20 26 70 61 74 68 62 | 75 66 5b 4d 41 58 4e 41 |= &pathb|uf[MAXNA|
|00003db0| 4d 4c 45 4e 2d 31 5d 3b | 0a 0a 09 2f 2a 0a 09 20 |MLEN-1];|.../*.. |
|00003dc0| 2a 20 46 69 6c 65 20 68 | 61 73 20 62 65 65 6e 20 |* File h|as been |
|00003dd0| 72 65 6d 6f 76 65 64 2e | 0a 09 20 2a 2f 0a 09 69 |removed.|.. */..i|
|00003de0| 66 20 28 28 64 70 2d 3e | 64 69 5f 6e 6c 69 6e 6b |f ((dp->|di_nlink|
|00003df0| 20 3d 3d 20 30 29 20 7c | 7c 20 28 70 63 2d 3e 70 | == 0) ||| (pc->p|
|00003e00| 63 5f 6e 61 6d 65 20 3d | 3d 20 4e 55 4c 4c 29 20 |c_name =|= NULL) |
|00003e10| 7c 7c 20 28 70 63 2d 3e | 70 63 5f 70 61 72 65 6e ||| (pc->|pc_paren|
|00003e20| 74 20 3d 3d 20 4e 55 4c | 4c 29 29 0a 09 09 72 65 |t == NUL|L))...re|
|00003e30| 74 75 72 6e 28 65 72 72 | 29 3b 0a 0a 09 2f 2a 0a |turn(err|);.../*.|
|00003e40| 09 20 2a 20 57 65 20 62 | 75 69 6c 64 20 74 68 65 |. * We b|uild the|
|00003e50| 20 70 61 74 68 20 6e 61 | 6d 65 20 69 6e 20 72 65 | path na|me in re|
|00003e60| 76 65 72 73 65 20 62 79 | 20 66 6f 6c 6c 6f 77 69 |verse by| followi|
|00003e70| 6e 67 20 74 68 65 0a 09 | 20 2a 20 70 61 72 65 6e |ng the..| * paren|
|00003e80| 74 20 6c 69 6e 6b 73 20 | 74 6f 20 74 68 65 20 72 |t links |to the r|
|00003e90| 6f 6f 74 2e 0a 09 20 2a | 2f 0a 09 77 68 69 6c 65 |oot... *|/..while|
|00003ea0| 20 28 70 63 20 21 3d 20 | 70 63 2d 3e 70 63 5f 70 | (pc != |pc->pc_p|
|00003eb0| 61 72 65 6e 74 29 20 7b | 0a 09 09 69 66 20 28 70 |arent) {|...if (p|
|00003ec0| 63 2d 3e 70 63 5f 6e 61 | 6d 65 20 3d 3d 20 4e 55 |c->pc_na|me == NU|
|00003ed0| 4c 4c 29 0a 09 09 09 72 | 65 74 75 72 6e 28 65 72 |LL)....r|eturn(er|
|00003ee0| 72 29 3b 0a 0a 09 09 73 | 20 3d 20 26 28 70 63 2d |r);....s| = &(pc-|
|00003ef0| 3e 70 63 5f 6e 61 6d 65 | 5b 73 74 72 6c 65 6e 28 |>pc_name|[strlen(|
|00003f00| 70 63 2d 3e 70 63 5f 6e | 61 6d 65 29 2d 31 5d 29 |pc->pc_n|ame)-1])|
|00003f10| 3b 0a 0a 09 09 77 68 69 | 6c 65 20 28 73 20 3e 3d |;....whi|le (s >=|
|00003f20| 20 70 63 2d 3e 70 63 5f | 6e 61 6d 65 29 0a 09 09 | pc->pc_|name)...|
|00003f30| 09 2a 70 61 74 68 70 74 | 72 2d 2d 20 3d 20 2a 73 |.*pathpt|r-- = *s|
|00003f40| 2d 2d 3b 0a 0a 09 09 2a | 70 61 74 68 70 74 72 2d |--;....*|pathptr-|
|00003f50| 2d 20 3d 20 27 2f 27 3b | 0a 0a 09 09 69 66 20 28 |- = '/';|....if (|
|00003f60| 28 70 63 20 3d 20 70 63 | 2d 3e 70 63 5f 70 61 72 |(pc = pc|->pc_par|
|00003f70| 65 6e 74 29 20 3d 3d 20 | 4e 55 4c 4c 29 0a 09 09 |ent) == |NULL)...|
|00003f80| 09 72 65 74 75 72 6e 28 | 70 61 74 68 70 74 72 29 |.return(|pathptr)|
|00003f90| 3b 0a 09 7d 0a 0a 09 69 | 66 20 28 70 63 2d 3e 70 |;..}...i|f (pc->p|
|00003fa0| 63 5f 6e 61 6d 65 20 3d | 3d 20 4e 55 4c 4c 29 0a |c_name =|= NULL).|
|00003fb0| 09 09 72 65 74 75 72 6e | 28 65 72 72 29 3b 0a 0a |..return|(err);..|
|00003fc0| 09 73 20 3d 20 26 28 70 | 63 2d 3e 70 63 5f 6e 61 |.s = &(p|c->pc_na|
|00003fd0| 6d 65 5b 73 74 72 6c 65 | 6e 28 70 63 2d 3e 70 63 |me[strle|n(pc->pc|
|00003fe0| 5f 6e 61 6d 65 29 2d 31 | 5d 29 3b 0a 0a 09 77 68 |_name)-1|]);...wh|
|00003ff0| 69 6c 65 20 28 73 20 3e | 20 70 63 2d 3e 70 63 5f |ile (s >| pc->pc_|
|00004000| 6e 61 6d 65 29 0a 09 09 | 2a 70 61 74 68 70 74 72 |name)...|*pathptr|
|00004010| 2d 2d 20 3d 20 2a 73 2d | 2d 3b 0a 0a 09 69 66 20 |-- = *s-|-;...if |
|00004020| 28 2a 2b 2b 70 61 74 68 | 70 74 72 20 21 3d 20 27 |(*++path|ptr != '|
|00004030| 2f 27 29 0a 09 09 2a 2d | 2d 70 61 74 68 70 74 72 |/')...*-|-pathptr|
|00004040| 20 3d 20 27 2f 27 3b 0a | 0a 09 72 65 74 75 72 6e | = '/';.|..return|
|00004050| 28 70 61 74 68 70 74 72 | 29 3b 0a 7d 0a 0a 2f 2a |(pathptr|);.}../*|
|00004060| 0a 20 2a 20 70 72 69 6e | 74 6f 75 74 20 2d 20 70 |. * prin|tout - p|
|00004070| 72 69 6e 74 20 74 68 65 | 20 69 6e 66 6f 72 6d 61 |rint the| informa|
|00004080| 74 69 6f 6e 20 61 62 6f | 75 74 20 74 68 65 20 66 |tion abo|ut the f|
|00004090| 69 6c 65 20 69 6e 20 61 | 20 6d 61 6e 6e 65 72 20 |ile in a| manner |
|000040a0| 73 69 6d 69 6c 61 72 20 | 74 6f 20 6c 73 2e 0a 20 |similar |to ls.. |
|000040b0| 2a 2f 0a 70 72 69 6e 74 | 6f 75 74 28 64 70 2c 20 |*/.print|out(dp, |
|000040c0| 69 6e 6f 29 0a 73 74 72 | 75 63 74 20 64 69 6e 6f |ino).str|uct dino|
|000040d0| 64 65 20 2a 64 70 3b 0a | 69 6e 6f 5f 74 20 69 6e |de *dp;.|ino_t in|
|000040e0| 6f 3b 0a 7b 0a 09 63 68 | 61 72 20 2a 63 70 3b 0a |o;.{..ch|ar *cp;.|
|000040f0| 09 73 74 72 75 63 74 20 | 67 72 6f 75 70 20 2a 67 |.struct |group *g|
|00004100| 72 3b 0a 09 73 74 72 75 | 63 74 20 70 61 73 73 77 |r;..stru|ct passw|
|00004110| 64 20 2a 70 77 3b 0a 09 | 63 68 61 72 20 70 62 75 |d *pw;..|char pbu|
|00004120| 66 5b 31 36 5d 2c 20 67 | 62 75 66 5b 31 36 5d 3b |f[16], g|buf[16];|
|00004130| 0a 09 73 74 72 75 63 74 | 20 67 72 6f 75 70 20 2a |..struct| group *|
|00004140| 67 65 74 67 72 67 69 64 | 28 29 3b 0a 09 73 74 72 |getgrgid|();..str|
|00004150| 75 63 74 20 70 61 73 73 | 77 64 20 2a 67 65 74 70 |uct pass|wd *getp|
|00004160| 77 75 69 64 28 29 3b 0a | 09 63 68 61 72 20 2a 63 |wuid();.|.char *c|
|00004170| 74 69 6d 65 28 29 2c 20 | 2a 66 6d 74 6d 6f 64 65 |time(), |*fmtmode|
|00004180| 28 29 2c 20 2a 70 61 74 | 68 6e 61 6d 65 28 29 3b |(), *pat|hname();|
|00004190| 0a 09 74 69 6d 65 5f 74 | 20 6e 6f 77 2c 20 73 69 |..time_t| now, si|
|000041a0| 78 6d 6f 6e 74 68 73 61 | 67 6f 2c 20 6f 6e 65 68 |xmonthsa|go, oneh|
|000041b0| 6f 75 72 66 72 6f 6d 6e | 6f 77 3b 0a 0a 09 2f 2a |ourfromn|ow;.../*|
|000041c0| 0a 09 20 2a 20 4c 6f 6f | 6b 20 75 70 20 74 68 65 |.. * Loo|k up the|
|000041d0| 20 6f 77 6e 65 72 20 6f | 66 20 74 68 65 20 66 69 | owner o|f the fi|
|000041e0| 6c 65 2e 0a 09 20 2a 2f | 0a 09 69 66 20 28 28 70 |le... */|..if ((p|
|000041f0| 77 20 3d 20 67 65 74 70 | 77 75 69 64 28 64 70 2d |w = getp|wuid(dp-|
|00004200| 3e 64 69 5f 75 69 64 29 | 29 20 3d 3d 20 4e 55 4c |>di_uid)|) == NUL|
|00004210| 4c 29 0a 09 09 73 70 72 | 69 6e 74 66 28 70 62 75 |L)...spr|intf(pbu|
|00004220| 66 2c 20 22 25 64 22 2c | 20 64 70 2d 3e 64 69 5f |f, "%d",| dp->di_|
|00004230| 75 69 64 29 3b 0a 09 65 | 6c 73 65 0a 09 09 73 70 |uid);..e|lse...sp|
|00004240| 72 69 6e 74 66 28 70 62 | 75 66 2c 20 22 25 73 22 |rintf(pb|uf, "%s"|
|00004250| 2c 20 70 77 2d 3e 70 77 | 5f 6e 61 6d 65 29 3b 0a |, pw->pw|_name);.|
|00004260| 0a 09 2f 2a 0a 09 20 2a | 20 4c 6f 6f 6b 20 75 70 |../*.. *| Look up|
|00004270| 20 74 68 65 20 67 72 6f | 75 70 20 6f 66 20 74 68 | the gro|up of th|
|00004280| 65 20 66 69 6c 65 2e 0a | 09 20 2a 2f 0a 09 69 66 |e file..|. */..if|
|00004290| 20 28 28 67 72 20 3d 20 | 67 65 74 67 72 67 69 64 | ((gr = |getgrgid|
|000042a0| 28 64 70 2d 3e 64 69 5f | 67 69 64 29 29 20 3d 3d |(dp->di_|gid)) ==|
|000042b0| 20 4e 55 4c 4c 29 0a 09 | 09 73 70 72 69 6e 74 66 | NULL)..|.sprintf|
|000042c0| 28 67 62 75 66 2c 20 22 | 25 64 22 2c 20 64 70 2d |(gbuf, "|%d", dp-|
|000042d0| 3e 64 69 5f 67 69 64 29 | 3b 0a 09 65 6c 73 65 0a |>di_gid)|;..else.|
|000042e0| 09 09 73 70 72 69 6e 74 | 66 28 67 62 75 66 2c 20 |..sprint|f(gbuf, |
|000042f0| 22 25 73 22 2c 20 67 72 | 2d 3e 67 72 5f 6e 61 6d |"%s", gr|->gr_nam|
|00004300| 65 29 3b 0a 0a 09 70 72 | 69 6e 74 66 28 22 25 36 |e);...pr|intf("%6|
|00004310| 64 25 35 64 20 22 2c 20 | 69 6e 6f 2c 20 6b 62 79 |d%5d ", |ino, kby|
|00004320| 74 65 73 28 64 62 74 6f | 62 28 64 70 2d 3e 64 69 |tes(dbto|b(dp->di|
|00004330| 5f 62 6c 6f 63 6b 73 29 | 29 29 3b 0a 09 70 72 69 |_blocks)|));..pri|
|00004340| 6e 74 66 28 22 2d 25 73 | 25 33 64 22 2c 20 66 6d |ntf("-%s|%3d", fm|
|00004350| 74 6d 6f 64 65 28 64 70 | 2d 3e 64 69 5f 6d 6f 64 |tmode(dp|->di_mod|
|00004360| 65 29 2c 20 64 70 2d 3e | 64 69 5f 6e 6c 69 6e 6b |e), dp->|di_nlink|
|00004370| 29 3b 0a 09 70 72 69 6e | 74 66 28 22 25 39 73 2f |);..prin|tf("%9s/|
|00004380| 25 2d 39 73 25 38 64 22 | 2c 20 70 62 75 66 2c 20 |%-9s%8d"|, pbuf, |
|00004390| 67 62 75 66 2c 20 64 70 | 2d 3e 64 69 5f 73 69 7a |gbuf, dp|->di_siz|
|000043a0| 65 29 3b 0a 0a 09 74 69 | 6d 65 28 26 6e 6f 77 29 |e);...ti|me(&now)|
|000043b0| 3b 0a 09 63 70 20 3d 20 | 63 74 69 6d 65 28 26 64 |;..cp = |ctime(&d|
|000043c0| 70 2d 3e 64 69 5f 6d 74 | 69 6d 65 29 3b 0a 09 6f |p->di_mt|ime);..o|
|000043d0| 6e 65 68 6f 75 72 66 72 | 6f 6d 6e 6f 77 20 3d 20 |nehourfr|omnow = |
|000043e0| 6e 6f 77 20 2b 20 36 30 | 4c 2a 36 30 4c 3b 0a 09 |now + 60|L*60L;..|
|000043f0| 73 69 78 6d 6f 6e 74 68 | 73 61 67 6f 20 3d 20 6e |sixmonth|sago = n|
|00004400| 6f 77 20 2d 20 36 4c 2a | 33 30 4c 2a 32 34 4c 2a |ow - 6L*|30L*24L*|
|00004410| 36 30 4c 2a 36 30 4c 3b | 0a 0a 09 69 66 20 28 28 |60L*60L;|...if ((|
|00004420| 64 70 2d 3e 64 69 5f 6d | 74 69 6d 65 20 3c 20 73 |dp->di_m|time < s|
|00004430| 69 78 6d 6f 6e 74 68 73 | 61 67 6f 29 20 7c 7c 20 |ixmonths|ago) || |
|00004440| 28 64 70 2d 3e 64 69 5f | 6d 74 69 6d 65 20 3e 20 |(dp->di_|mtime > |
|00004450| 6f 6e 65 68 6f 75 72 66 | 72 6f 6d 6e 6f 77 29 29 |onehourf|romnow))|
|00004460| 0a 09 09 70 72 69 6e 74 | 66 28 22 20 25 2d 37 2e |...print|f(" %-7.|
|00004470| 37 73 20 25 2d 34 2e 34 | 73 22 2c 20 63 70 2b 34 |7s %-4.4|s", cp+4|
|00004480| 2c 20 63 70 2b 32 30 29 | 3b 0a 09 65 6c 73 65 0a |, cp+20)|;..else.|
|00004490| 09 09 70 72 69 6e 74 66 | 28 22 20 25 2d 31 32 2e |..printf|(" %-12.|
|000044a0| 31 32 73 22 2c 20 63 70 | 2b 34 29 3b 0a 0a 09 69 |12s", cp|+4);...i|
|000044b0| 66 20 28 70 66 6c 61 67 | 29 0a 09 09 70 72 69 6e |f (pflag|)...prin|
|000044c0| 74 66 28 22 20 25 73 22 | 2c 20 70 61 74 68 6e 61 |tf(" %s"|, pathna|
|000044d0| 6d 65 28 64 70 2c 20 69 | 6e 6f 29 29 3b 0a 0a 09 |me(dp, i|no));...|
|000044e0| 70 75 74 63 68 61 72 28 | 27 5c 6e 27 29 3b 0a 7d |putchar(|'\n');.}|
|000044f0| 0a 0a 2f 2a 0a 20 2a 20 | 63 6f 6d 70 69 6c 65 20 |../*. * |compile |
|00004500| 2d 20 63 6f 6d 70 69 6c | 65 20 74 68 65 20 66 61 |- compil|e the fa|
|00004510| 69 6c 75 72 65 20 6c 69 | 6e 6b 73 20 66 6f 72 20 |ilure li|nks for |
|00004520| 74 68 65 20 70 61 74 74 | 65 72 6e 2e 20 20 57 65 |the patt|ern. We|
|00004530| 20 75 73 65 20 74 68 65 | 0a 20 2a 09 20 20 20 20 | use the|. *. |
|00004540| 20 4b 6e 75 74 68 2d 4d | 6f 79 65 72 2d 50 72 61 | Knuth-M|oyer-Pra|
|00004550| 74 74 20 61 6c 67 6f 72 | 69 74 68 6d 20 61 73 20 |tt algor|ithm as |
|00004560| 64 65 73 63 72 69 62 65 | 64 20 69 6e 20 22 43 6f |describe|d in "Co|
|00004570| 6d 70 75 74 65 72 0a 20 | 2a 09 20 20 20 20 20 41 |mputer. |*. A|
|00004580| 6c 67 6f 72 69 74 68 6d | 73 22 2c 20 53 61 72 61 |lgorithm|s", Sara|
|00004590| 20 42 61 61 73 65 2c 20 | 70 70 2e 20 31 37 35 2d | Baase, |pp. 175-|
|000045a0| 31 38 33 2e 0a 20 2a 2f | 0a 63 6f 6d 70 69 6c 65 |183.. */|.compile|
|000045b0| 28 70 61 74 29 0a 63 68 | 61 72 20 2a 70 61 74 3b |(pat).ch|ar *pat;|
|000045c0| 0a 7b 0a 09 72 65 67 69 | 73 74 65 72 20 69 6e 74 |.{..regi|ster int|
|000045d0| 20 69 2c 20 6a 3b 0a 0a | 09 70 61 74 6c 65 6e 20 | i, j;..|.patlen |
|000045e0| 3d 20 73 74 72 6c 65 6e | 28 70 61 74 29 3b 0a 0a |= strlen|(pat);..|
|000045f0| 09 2f 2a 0a 09 20 2a 20 | 49 66 20 69 67 6e 6f 72 |./*.. * |If ignor|
|00004600| 69 6e 67 20 63 61 73 65 | 2c 20 6a 75 73 74 20 63 |ing case|, just c|
|00004610| 6f 6e 76 65 72 74 20 74 | 6f 20 6c 6f 77 65 72 20 |onvert t|o lower |
|00004620| 63 61 73 65 2e 0a 09 20 | 2a 2f 0a 09 69 66 20 28 |case... |*/..if (|
|00004630| 69 66 6c 61 67 29 20 7b | 0a 09 09 66 6f 72 20 28 |iflag) {|...for (|
|00004640| 69 3d 30 3b 20 69 20 3c | 20 70 61 74 6c 65 6e 3b |i=0; i <| patlen;|
|00004650| 20 69 2b 2b 29 0a 09 09 | 09 70 61 74 5b 69 5d 20 | i++)...|.pat[i] |
|00004660| 3d 20 69 73 75 70 70 65 | 72 28 70 61 74 5b 69 5d |= isuppe|r(pat[i]|
|00004670| 29 20 3f 20 74 6f 6c 6f | 77 65 72 28 70 61 74 5b |) ? tolo|wer(pat[|
|00004680| 69 5d 29 20 3a 20 70 61 | 74 5b 69 5d 3b 0a 09 7d |i]) : pa|t[i];..}|
|00004690| 0a 0a 09 69 66 20 28 28 | 66 6c 69 6e 6b 20 3d 20 |...if ((|flink = |
|000046a0| 28 69 6e 74 20 2a 29 20 | 6d 61 6c 6c 6f 63 28 70 |(int *) |malloc(p|
|000046b0| 61 74 6c 65 6e 20 2a 20 | 73 69 7a 65 6f 66 28 69 |atlen * |sizeof(i|
|000046c0| 6e 74 29 29 29 20 3d 3d | 20 4e 55 4c 4c 29 20 7b |nt))) ==| NULL) {|
|000046d0| 0a 09 09 66 70 72 69 6e | 74 66 28 73 74 64 65 72 |...fprin|tf(stder|
|000046e0| 72 2c 20 22 25 73 3a 20 | 6f 75 74 20 6f 66 20 6d |r, "%s: |out of m|
|000046f0| 65 6d 6f 72 79 2e 5c 6e | 22 2c 20 70 6e 61 6d 65 |emory.\n|", pname|
|00004700| 29 3b 0a 09 09 65 78 69 | 74 28 31 29 3b 0a 09 7d |);...exi|t(1);..}|
|00004710| 0a 0a 09 66 6c 69 6e 6b | 5b 30 5d 20 3d 20 2d 31 |...flink|[0] = -1|
|00004720| 3b 0a 09 69 20 3d 20 31 | 3b 0a 0a 09 77 68 69 6c |;..i = 1|;...whil|
|00004730| 65 20 28 69 20 3c 3d 20 | 70 61 74 6c 65 6e 29 20 |e (i <= |patlen) |
|00004740| 7b 0a 09 09 6a 20 3d 20 | 66 6c 69 6e 6b 5b 69 2d |{...j = |flink[i-|
|00004750| 31 5d 3b 0a 0a 09 09 77 | 68 69 6c 65 20 28 28 6a |1];....w|hile ((j|
|00004760| 20 21 3d 20 2d 31 29 20 | 26 26 20 28 70 61 74 5b | != -1) |&& (pat[|
|00004770| 6a 5d 20 21 3d 20 70 61 | 74 5b 69 2d 31 5d 29 29 |j] != pa|t[i-1]))|
|00004780| 0a 09 09 09 6a 20 3d 20 | 66 6c 69 6e 6b 5b 6a 5d |....j = |flink[j]|
|00004790| 3b 0a 0a 09 09 66 6c 69 | 6e 6b 5b 69 2b 2b 5d 20 |;....fli|nk[i++] |
|000047a0| 3d 20 6a 20 2b 20 31 3b | 0a 09 7d 0a 7d 0a 0a 2f |= j + 1;|..}.}../|
|000047b0| 2a 0a 20 2a 20 72 65 61 | 64 64 69 72 62 6c 6b 73 |*. * rea|ddirblks|
|000047c0| 20 2d 20 72 65 61 64 20 | 69 6e 20 64 69 72 65 63 | - read |in direc|
|000047d0| 74 6f 72 79 20 62 6c 6f | 63 6b 73 20 66 6f 72 20 |tory blo|cks for |
|000047e0| 74 68 65 20 67 69 76 65 | 6e 20 69 6e 6f 64 65 2e |the give|n inode.|
|000047f0| 0a 20 2a 2f 0a 72 65 61 | 64 64 69 72 62 6c 6b 73 |. */.rea|ddirblks|
|00004800| 28 69 6e 6f 2c 20 64 70 | 29 0a 73 74 72 75 63 74 |(ino, dp|).struct|
|00004810| 20 64 69 6e 6f 64 65 20 | 2a 64 70 3b 0a 69 6e 6f | dinode |*dp;.ino|
|00004820| 5f 74 20 69 6e 6f 3b 0a | 7b 0a 09 69 6e 74 20 6e |_t ino;.|{..int n|
|00004830| 2c 20 63 6f 75 6e 74 3b | 0a 09 63 68 61 72 20 2a |, count;|..char *|
|00004840| 73 61 76 65 73 74 72 28 | 29 3b 0a 09 72 65 67 69 |savestr(|);..regi|
|00004850| 73 74 65 72 20 69 6e 74 | 20 69 2c 20 6c 65 6e 3b |ster int| i, len;|
|00004860| 0a 09 72 65 67 69 73 74 | 65 72 20 73 74 72 75 63 |..regist|er struc|
|00004870| 74 20 64 69 72 65 63 74 | 20 2a 64 69 72 70 3b 0a |t direct| *dirp;.|
|00004880| 0a 09 63 6f 75 6e 74 20 | 3d 20 64 70 2d 3e 64 69 |..count |= dp->di|
|00004890| 5f 73 69 7a 65 3b 0a 0a | 09 2f 2a 0a 09 20 2a 20 |_size;..|./*.. * |
|000048a0| 57 65 20 6f 6e 6c 79 20 | 68 61 6e 64 6c 65 20 64 |We only |handle d|
|000048b0| 69 72 65 63 74 20 62 6c | 6f 63 6b 73 20 69 6e 20 |irect bl|ocks in |
|000048c0| 64 69 72 65 63 74 6f 72 | 69 65 73 3b 20 68 6f 70 |director|ies; hop|
|000048d0| 65 66 75 6c 6c 79 0a 09 | 20 2a 20 74 68 65 72 65 |efully..| * there|
|000048e0| 27 73 20 6e 6f 20 64 69 | 72 65 63 74 6f 72 69 65 |'s no di|rectorie|
|000048f0| 73 20 6c 61 72 67 65 72 | 20 74 68 61 6e 20 39 36 |s larger| than 96|
|00004900| 6b 20 28 66 6f 72 20 61 | 20 38 6b 0a 09 20 2a 20 |k (for a| 8k.. * |
|00004910| 66 69 6c 65 20 73 79 73 | 74 65 6d 29 2e 0a 09 20 |file sys|tem)... |
|00004920| 2a 2f 0a 09 66 6f 72 20 | 28 69 3d 30 3b 20 28 69 |*/..for |(i=0; (i|
|00004930| 20 3c 20 4e 44 41 44 44 | 52 29 20 26 26 20 28 63 | < NDADD|R) && (c|
|00004940| 6f 75 6e 74 20 3e 20 30 | 29 3b 20 69 2b 2b 29 20 |ount > 0|); i++) |
|00004950| 7b 0a 09 09 2f 2a 0a 09 | 09 20 2a 20 52 65 61 64 |{.../*..|. * Read|
|00004960| 20 74 68 65 20 62 6c 6f | 63 6b 2e 0a 09 09 20 2a | the blo|ck.... *|
|00004970| 2f 0a 09 09 62 72 65 61 | 64 28 66 73 62 74 6f 64 |/...brea|d(fsbtod|
|00004980| 62 28 26 73 62 6c 6f 63 | 6b 2c 20 64 70 2d 3e 64 |b(&sbloc|k, dp->d|
|00004990| 69 5f 64 62 5b 69 5d 29 | 2c 20 64 69 72 62 75 66 |i_db[i])|, dirbuf|
|000049a0| 2c 20 6e 20 3d 20 6d 69 | 6e 28 63 6f 75 6e 74 2c |, n = mi|n(count,|
|000049b0| 20 73 62 6c 6f 63 6b 2e | 66 73 5f 62 73 69 7a 65 | sblock.|fs_bsize|
|000049c0| 29 29 3b 0a 09 09 64 69 | 72 70 20 3d 20 28 73 74 |));...di|rp = (st|
|000049d0| 72 75 63 74 20 64 69 72 | 65 63 74 20 2a 29 20 64 |ruct dir|ect *) d|
|000049e0| 69 72 62 75 66 3b 0a 09 | 09 63 6f 75 6e 74 20 2d |irbuf;..|.count -|
|000049f0| 3d 20 6e 3b 0a 0a 09 09 | 2f 2a 0a 09 09 20 2a 20 |= n;....|/*... * |
|00004a00| 50 75 6c 6c 20 64 69 72 | 65 63 74 6f 72 79 20 65 |Pull dir|ectory e|
|00004a10| 6e 74 72 69 65 73 20 66 | 72 6f 6d 20 74 68 65 20 |ntries f|rom the |
|00004a20| 64 69 72 65 63 74 6f 72 | 79 2e 0a 09 09 20 2a 2f |director|y.... */|
|00004a30| 0a 09 09 77 68 69 6c 65 | 20 28 6e 20 3e 20 30 29 |...while| (n > 0)|
|00004a40| 20 7b 0a 09 09 09 69 66 | 20 28 64 69 72 70 2d 3e | {....if| (dirp->|
|00004a50| 64 5f 72 65 63 6c 65 6e | 20 3c 3d 20 30 29 0a 09 |d_reclen| <= 0)..|
|00004a60| 09 09 09 62 72 65 61 6b | 3b 0a 0a 09 09 09 2f 2a |...break|;...../*|
|00004a70| 0a 09 09 09 20 2a 20 53 | 61 76 65 20 74 68 65 20 |.... * S|ave the |
|00004a80| 70 61 74 68 20 6e 61 6d | 65 20 63 6f 6d 70 6f 6e |path nam|e compon|
|00004a90| 65 6e 74 2e 0a 09 09 09 | 20 2a 2f 0a 09 09 09 69 |ent.....| */....i|
|00004aa0| 66 20 28 64 69 72 70 2d | 3e 64 5f 69 6e 6f 20 3e |f (dirp-|>d_ino >|
|00004ab0| 3d 20 52 4f 4f 54 49 4e | 4f 29 20 7b 0a 09 09 09 |= ROOTIN|O) {....|
|00004ac0| 09 69 66 20 28 28 73 74 | 72 6e 63 6d 70 28 64 69 |.if ((st|rncmp(di|
|00004ad0| 72 70 2d 3e 64 5f 6e 61 | 6d 65 2c 20 22 2e 22 2c |rp->d_na|me, ".",|
|00004ae0| 20 64 69 72 70 2d 3e 64 | 5f 6e 61 6d 6c 65 6e 29 | dirp->d|_namlen)|
|00004af0| 20 21 3d 20 30 29 20 26 | 26 20 28 73 74 72 6e 63 | != 0) &|& (strnc|
|00004b00| 6d 70 28 64 69 72 70 2d | 3e 64 5f 6e 61 6d 65 2c |mp(dirp-|>d_name,|
|00004b10| 20 22 2e 2e 22 2c 20 64 | 69 72 70 2d 3e 64 5f 6e | "..", d|irp->d_n|
|00004b20| 61 6d 6c 65 6e 29 20 21 | 3d 20 30 29 29 20 7b 0a |amlen) !|= 0)) {.|
|00004b30| 09 09 09 09 09 70 61 74 | 68 6c 69 73 74 5b 64 69 |.....pat|hlist[di|
|00004b40| 72 70 2d 3e 64 5f 69 6e | 6f 5d 2e 70 63 5f 6e 61 |rp->d_in|o].pc_na|
|00004b50| 6d 65 20 3d 20 73 61 76 | 65 73 74 72 28 64 69 72 |me = sav|estr(dir|
|00004b60| 70 2d 3e 64 5f 6e 61 6d | 65 2c 20 64 69 72 70 2d |p->d_nam|e, dirp-|
|00004b70| 3e 64 5f 6e 61 6d 6c 65 | 6e 29 3b 0a 09 09 09 09 |>d_namle|n);.....|
|00004b80| 09 70 61 74 68 6c 69 73 | 74 5b 64 69 72 70 2d 3e |.pathlis|t[dirp->|
|00004b90| 64 5f 69 6e 6f 5d 2e 70 | 63 5f 70 61 72 65 6e 74 |d_ino].p|c_parent|
|00004ba0| 20 3d 20 26 70 61 74 68 | 6c 69 73 74 5b 69 6e 6f | = &path|list[ino|
|00004bb0| 5d 3b 0a 09 09 09 09 7d | 0a 09 09 09 7d 0a 0a 09 |];.....}|....}...|
|00004bc0| 09 09 64 69 72 70 20 3d | 20 28 73 74 72 75 63 74 |..dirp =| (struct|
|00004bd0| 20 64 69 72 65 63 74 20 | 2a 29 20 28 28 69 6e 74 | direct |*) ((int|
|00004be0| 29 20 64 69 72 70 20 2b | 20 64 69 72 70 2d 3e 64 |) dirp +| dirp->d|
|00004bf0| 5f 72 65 63 6c 65 6e 29 | 3b 0a 09 09 09 6e 20 2d |_reclen)|;....n -|
|00004c00| 3d 20 64 69 72 70 2d 3e | 64 5f 72 65 63 6c 65 6e |= dirp->|d_reclen|
|00004c10| 3b 0a 09 09 7d 0a 09 7d | 0a 0a 09 2f 2a 0a 09 20 |;...}..}|.../*.. |
|00004c20| 2a 20 54 68 69 73 20 64 | 69 72 65 63 74 6f 72 79 |* This d|irectory|
|00004c30| 20 68 61 64 20 69 6e 64 | 69 72 65 63 74 20 62 6c | had ind|irect bl|
|00004c40| 6f 63 6b 73 2e 0a 09 20 | 2a 2f 0a 09 69 66 20 28 |ocks... |*/..if (|
|00004c50| 63 6f 75 6e 74 29 20 7b | 0a 09 09 66 70 72 69 6e |count) {|...fprin|
|00004c60| 74 66 28 73 74 64 65 72 | 72 2c 20 22 25 73 3a 20 |tf(stder|r, "%s: |
|00004c70| 64 69 72 65 63 74 6f 72 | 79 20 74 6f 6f 20 62 69 |director|y too bi|
|00004c80| 67 2c 20 63 61 6e 27 74 | 20 64 6f 20 70 61 74 68 |g, can't| do path|
|00004c90| 20 6c 69 73 74 2e 5c 6e | 22 2c 20 70 6e 61 6d 65 | list.\n|", pname|
|00004ca0| 29 3b 0a 09 09 70 66 6c | 61 67 20 3d 20 30 3b 0a |);...pfl|ag = 0;.|
|00004cb0| 09 7d 0a 7d 0a 0a 2f 2a | 0a 20 2a 20 62 72 65 61 |.}.}../*|. * brea|
|00004cc0| 64 20 2d 20 72 65 61 64 | 20 63 6e 74 20 62 79 74 |d - read| cnt byt|
|00004cd0| 65 73 20 6f 66 20 64 69 | 73 6b 20 62 6c 6f 63 6b |es of di|sk block|
|00004ce0| 20 62 6e 6f 20 69 6e 74 | 6f 20 62 75 66 2e 0a 20 | bno int|o buf.. |
|00004cf0| 2a 2f 0a 62 72 65 61 64 | 28 62 6e 6f 2c 20 62 75 |*/.bread|(bno, bu|
|00004d00| 66 2c 20 63 6e 74 29 0a | 64 61 64 64 72 5f 74 20 |f, cnt).|daddr_t |
|00004d10| 62 6e 6f 3b 0a 63 68 61 | 72 20 2a 62 75 66 3b 0a |bno;.cha|r *buf;.|
|00004d20| 69 6e 74 20 63 6e 74 3b | 0a 7b 0a 09 69 6e 74 20 |int cnt;|.{..int |
|00004d30| 6e 3b 0a 0a 09 28 76 6f | 69 64 29 20 6c 73 65 65 |n;...(vo|id) lsee|
|00004d40| 6b 28 66 69 6c 65 64 65 | 73 2c 20 28 6c 6f 6e 67 |k(filede|s, (long|
|00004d50| 29 20 64 74 6f 62 28 62 | 6e 6f 29 2c 20 4c 5f 53 |) dtob(b|no), L_S|
|00004d60| 45 54 29 3b 0a 0a 23 69 | 66 64 65 66 20 73 75 6e |ET);..#i|fdef sun|
|00004d70| 0a 09 2f 2a 0a 09 20 2a | 20 53 75 6e 20 68 61 73 |../*.. *| Sun has|
|00004d80| 20 61 20 62 6f 74 63 68 | 20 69 6e 20 77 68 69 63 | a botch| in whic|
|00004d90| 68 20 61 20 72 65 61 64 | 20 63 61 6e 20 72 65 74 |h a read| can ret|
|00004da0| 75 72 6e 20 4d 4f 52 45 | 0a 09 20 2a 20 74 68 61 |urn MORE|.. * tha|
|00004db0| 6e 20 63 6e 74 3b 20 69 | 74 20 72 65 74 75 72 6e |n cnt; i|t return|
|00004dc0| 73 20 75 6e 69 74 73 20 | 6f 66 20 44 45 56 5f 42 |s units |of DEV_B|
|00004dd0| 53 49 5a 45 2e 0a 09 20 | 2a 2f 0a 09 63 6e 74 20 |SIZE... |*/..cnt |
|00004de0| 3d 20 72 6f 75 6e 64 75 | 70 28 63 6e 74 2c 20 44 |= roundu|p(cnt, D|
|00004df0| 45 56 5f 42 53 49 5a 45 | 29 3b 0a 23 65 6e 64 69 |EV_BSIZE|);.#endi|
|00004e00| 66 0a 0a 09 69 66 20 28 | 28 6e 20 3d 20 72 65 61 |f...if (|(n = rea|
|00004e10| 64 28 66 69 6c 65 64 65 | 73 2c 20 62 75 66 2c 20 |d(filede|s, buf, |
|00004e20| 63 6e 74 29 29 20 21 3d | 20 63 6e 74 29 20 7b 0a |cnt)) !=| cnt) {.|
|00004e30| 09 09 66 70 72 69 6e 74 | 66 28 73 74 64 65 72 72 |..fprint|f(stderr|
|00004e40| 2c 20 22 25 73 3a 20 22 | 2c 20 70 6e 61 6d 65 29 |, "%s: "|, pname)|
|00004e50| 3b 0a 0a 09 09 69 66 20 | 28 6e 20 3e 3d 20 30 29 |;....if |(n >= 0)|
|00004e60| 0a 09 09 09 66 70 72 69 | 6e 74 66 28 73 74 64 65 |....fpri|ntf(stde|
|00004e70| 72 72 2c 20 22 72 65 61 | 64 20 65 72 72 6f 72 20 |rr, "rea|d error |
|00004e80| 6f 6e 20 25 73 20 2d 20 | 61 73 6b 65 64 20 66 6f |on %s - |asked fo|
|00004e90| 72 20 25 64 2c 20 67 6f | 74 20 25 64 2e 5c 6e 22 |r %d, go|t %d.\n"|
|00004ea0| 2c 20 66 73 5f 63 64 65 | 76 2c 20 63 6e 74 2c 20 |, fs_cde|v, cnt, |
|00004eb0| 6e 29 3b 0a 09 09 65 6c | 73 65 0a 09 09 09 70 65 |n);...el|se....pe|
|00004ec0| 72 72 6f 72 28 66 73 5f | 63 64 65 76 29 3b 0a 0a |rror(fs_|cdev);..|
|00004ed0| 09 09 65 78 69 74 28 31 | 29 3b 0a 09 7d 0a 7d 0a |..exit(1|);..}.}.|
|00004ee0| 0a 69 6e 74 09 6d 31 5b | 5d 20 3d 20 7b 20 31 2c |.int.m1[|] = { 1,|
|00004ef0| 20 53 5f 49 52 45 41 44 | 3e 3e 30 2c 20 27 72 27 | S_IREAD|>>0, 'r'|
|00004f00| 2c 20 27 2d 27 20 7d 3b | 0a 69 6e 74 09 6d 32 5b |, '-' };|.int.m2[|
|00004f10| 5d 20 3d 20 7b 20 31 2c | 20 53 5f 49 57 52 49 54 |] = { 1,| S_IWRIT|
|00004f20| 45 3e 3e 30 2c 20 27 77 | 27 2c 20 27 2d 27 20 7d |E>>0, 'w|', '-' }|
|00004f30| 3b 0a 69 6e 74 09 6d 33 | 5b 5d 20 3d 20 7b 20 33 |;.int.m3|[] = { 3|
|00004f40| 2c 20 53 5f 49 53 55 49 | 44 7c 28 53 5f 49 45 58 |, S_ISUI|D|(S_IEX|
|00004f50| 45 43 3e 3e 30 29 2c 20 | 27 73 27 2c 20 53 5f 49 |EC>>0), |'s', S_I|
|00004f60| 45 58 45 43 3e 3e 30 2c | 20 27 78 27 2c 20 53 5f |EXEC>>0,| 'x', S_|
|00004f70| 49 53 55 49 44 2c 20 27 | 53 27 2c 20 27 2d 27 20 |ISUID, '|S', '-' |
|00004f80| 7d 3b 0a 69 6e 74 09 6d | 34 5b 5d 20 3d 20 7b 20 |};.int.m|4[] = { |
|00004f90| 31 2c 20 53 5f 49 52 45 | 41 44 3e 3e 33 2c 20 27 |1, S_IRE|AD>>3, '|
|00004fa0| 72 27 2c 20 27 2d 27 20 | 7d 3b 0a 69 6e 74 09 6d |r', '-' |};.int.m|
|00004fb0| 35 5b 5d 20 3d 20 7b 20 | 31 2c 20 53 5f 49 57 52 |5[] = { |1, S_IWR|
|00004fc0| 49 54 45 3e 3e 33 2c 20 | 27 77 27 2c 20 27 2d 27 |ITE>>3, |'w', '-'|
|00004fd0| 20 7d 3b 0a 69 6e 74 09 | 6d 36 5b 5d 20 3d 20 7b | };.int.|m6[] = {|
|00004fe0| 20 33 2c 20 53 5f 49 53 | 47 49 44 7c 28 53 5f 49 | 3, S_IS|GID|(S_I|
|00004ff0| 45 58 45 43 3e 3e 33 29 | 2c 20 27 73 27 2c 20 53 |EXEC>>3)|, 's', S|
|00005000| 5f 49 45 58 45 43 3e 3e | 33 2c 20 27 78 27 2c 20 |_IEXEC>>|3, 'x', |
|00005010| 53 5f 49 53 47 49 44 2c | 20 27 53 27 2c 20 27 2d |S_ISGID,| 'S', '-|
|00005020| 27 20 7d 3b 0a 69 6e 74 | 09 6d 37 5b 5d 20 3d 20 |' };.int|.m7[] = |
|00005030| 7b 20 31 2c 20 53 5f 49 | 52 45 41 44 3e 3e 36 2c |{ 1, S_I|READ>>6,|
|00005040| 20 27 72 27 2c 20 27 2d | 27 20 7d 3b 0a 69 6e 74 | 'r', '-|' };.int|
|00005050| 09 6d 38 5b 5d 20 3d 20 | 7b 20 31 2c 20 53 5f 49 |.m8[] = |{ 1, S_I|
|00005060| 57 52 49 54 45 3e 3e 36 | 2c 20 27 77 27 2c 20 27 |WRITE>>6|, 'w', '|
|00005070| 2d 27 20 7d 3b 0a 69 6e | 74 09 6d 39 5b 5d 20 3d |-' };.in|t.m9[] =|
|00005080| 20 7b 20 32 2c 20 53 5f | 49 53 56 54 58 2c 20 27 | { 2, S_|ISVTX, '|
|00005090| 74 27 2c 20 53 5f 49 45 | 58 45 43 3e 3e 36 2c 20 |t', S_IE|XEC>>6, |
|000050a0| 27 78 27 2c 20 27 2d 27 | 20 7d 3b 0a 0a 69 6e 74 |'x', '-'| };..int|
|000050b0| 09 2a 6d 5b 5d 20 3d 20 | 7b 20 6d 31 2c 20 6d 32 |.*m[] = |{ m1, m2|
|000050c0| 2c 20 6d 33 2c 20 6d 34 | 2c 20 6d 35 2c 20 6d 36 |, m3, m4|, m5, m6|
|000050d0| 2c 20 6d 37 2c 20 6d 38 | 2c 20 6d 39 7d 3b 0a 0a |, m7, m8|, m9};..|
|000050e0| 2f 2a 0a 20 2a 20 66 6d | 74 6d 6f 64 65 20 2d 20 |/*. * fm|tmode - |
|000050f0| 66 6f 72 6d 61 74 20 74 | 68 65 20 6d 6f 64 65 2e |format t|he mode.|
|00005100| 20 20 52 69 70 70 65 64 | 20 6f 66 66 20 66 72 6f | Ripped| off fro|
|00005110| 6d 20 6c 73 2e 0a 20 2a | 2f 0a 63 68 61 72 20 2a |m ls.. *|/.char *|
|00005120| 66 6d 74 6d 6f 64 65 28 | 66 6c 61 67 73 29 0a 69 |fmtmode(|flags).i|
|00005130| 6e 74 20 66 6c 61 67 73 | 3b 0a 7b 0a 09 72 65 67 |nt flags|;.{..reg|
|00005140| 69 73 74 65 72 20 69 6e | 74 20 2a 2a 6d 70 3b 0a |ister in|t **mp;.|
|00005150| 09 72 65 67 69 73 74 65 | 72 20 63 68 61 72 20 2a |.registe|r char *|
|00005160| 6c 70 3b 0a 09 73 74 61 | 74 69 63 20 63 68 61 72 |lp;..sta|tic char|
|00005170| 20 62 75 66 5b 31 36 5d | 3b 0a 0a 09 6c 70 20 3d | buf[16]|;...lp =|
|00005180| 20 62 75 66 3b 0a 0a 09 | 66 6f 72 20 28 6d 70 20 | buf;...|for (mp |
|00005190| 3d 20 26 6d 5b 30 5d 3b | 20 6d 70 20 3c 20 26 6d |= &m[0];| mp < &m|
|000051a0| 5b 73 69 7a 65 6f 66 28 | 6d 29 2f 73 69 7a 65 6f |[sizeof(|m)/sizeo|
|000051b0| 66 28 6d 5b 30 5d 29 5d | 3b 20 29 20 7b 0a 09 09 |f(m[0])]|; ) {...|
|000051c0| 72 65 67 69 73 74 65 72 | 20 69 6e 74 20 2a 70 61 |register| int *pa|
|000051d0| 69 72 70 20 3d 20 2a 6d | 70 2b 2b 3b 0a 09 09 72 |irp = *m|p++;...r|
|000051e0| 65 67 69 73 74 65 72 20 | 69 6e 74 20 6e 20 3d 20 |egister |int n = |
|000051f0| 2a 70 61 69 72 70 2b 2b | 3b 0a 0a 09 09 77 68 69 |*pairp++|;....whi|
|00005200| 6c 65 20 28 6e 2d 2d 20 | 3e 20 30 29 20 7b 0a 09 |le (n-- |> 0) {..|
|00005210| 09 09 69 66 20 28 28 66 | 6c 61 67 73 20 26 20 2a |..if ((f|lags & *|
|00005220| 70 61 69 72 70 29 20 3d | 3d 20 2a 70 61 69 72 70 |pairp) =|= *pairp|
|00005230| 29 20 7b 0a 09 09 09 09 | 70 61 69 72 70 2b 2b 3b |) {.....|pairp++;|
|00005240| 0a 09 09 09 09 62 72 65 | 61 6b 3b 0a 09 09 09 7d |.....bre|ak;....}|
|00005250| 0a 09 09 09 65 6c 73 65 | 20 7b 0a 09 09 09 09 70 |....else| {.....p|
|00005260| 61 69 72 70 20 2b 3d 20 | 32 3b 0a 09 09 09 7d 0a |airp += |2;....}.|
|00005270| 09 09 7d 09 09 09 0a 0a | 09 09 2a 6c 70 2b 2b 20 |..}.....|..*lp++ |
|00005280| 3d 20 2a 70 61 69 72 70 | 3b 0a 09 7d 0a 0a 09 2a |= *pairp|;..}...*|
|00005290| 6c 70 20 3d 20 27 5c 30 | 27 3b 0a 09 72 65 74 75 |lp = '\0|';..retu|
|000052a0| 72 6e 28 62 75 66 29 3b | 0a 7d 0a 0a 2f 2a 0a 20 |rn(buf);|.}../*. |
|000052b0| 2a 20 72 61 77 64 65 76 | 20 2d 20 63 72 65 61 74 |* rawdev| - creat|
|000052c0| 65 20 61 20 72 61 77 20 | 28 63 68 61 72 61 63 74 |e a raw |(charact|
|000052d0| 65 72 29 20 64 65 76 69 | 63 65 20 6e 61 6d 65 20 |er) devi|ce name |
|000052e0| 66 72 6f 6d 20 61 20 63 | 6f 6f 6b 65 64 20 28 62 |from a c|ooked (b|
|000052f0| 6c 6f 63 6b 29 20 6e 61 | 6d 65 2e 0a 20 2a 2f 0a |lock) na|me.. */.|
|00005300| 63 68 61 72 20 2a 72 61 | 77 64 65 76 28 73 29 0a |char *ra|wdev(s).|
|00005310| 72 65 67 69 73 74 65 72 | 20 63 68 61 72 20 2a 73 |register| char *s|
|00005320| 3b 0a 7b 0a 09 63 68 61 | 72 20 2a 72 69 6e 64 65 |;.{..cha|r *rinde|
|00005330| 78 28 29 3b 0a 09 72 65 | 67 69 73 74 65 72 20 63 |x();..re|gister c|
|00005340| 68 61 72 20 2a 70 2c 20 | 2a 71 3b 0a 09 73 74 61 |har *p, |*q;..sta|
|00005350| 74 69 63 20 63 68 61 72 | 20 62 75 66 5b 4d 41 58 |tic char| buf[MAX|
|00005360| 4e 41 4d 4c 45 4e 5d 3b | 0a 0a 09 71 20 3d 20 62 |NAMLEN];|...q = b|
|00005370| 75 66 3b 0a 0a 09 69 66 | 20 28 28 70 20 3d 20 72 |uf;...if| ((p = r|
|00005380| 69 6e 64 65 78 28 73 2c | 20 27 2f 27 29 29 20 21 |index(s,| '/')) !|
|00005390| 3d 20 4e 55 4c 4c 29 20 | 7b 0a 09 09 77 68 69 6c |= NULL) |{...whil|
|000053a0| 65 20 28 73 20 3c 3d 20 | 70 29 0a 09 09 09 2a 71 |e (s <= |p)....*q|
|000053b0| 2b 2b 20 3d 20 2a 73 2b | 2b 3b 0a 09 7d 0a 0a 09 |++ = *s+|+;..}...|
|000053c0| 2a 71 2b 2b 20 3d 20 27 | 72 27 3b 0a 0a 09 77 68 |*q++ = '|r';...wh|
|000053d0| 69 6c 65 20 28 2a 71 2b | 2b 20 3d 20 2a 73 2b 2b |ile (*q+|+ = *s++|
|000053e0| 29 0a 09 09 3b 0a 0a 09 | 2a 71 20 3d 20 4e 55 4c |)...;...|*q = NUL|
|000053f0| 4c 3b 0a 09 72 65 74 75 | 72 6e 28 62 75 66 29 3b |L;..retu|rn(buf);|
|00005400| 0a 7d 0a 0a 2f 2a 0a 20 | 2a 20 73 61 76 65 73 74 |.}../*. |* savest|
|00005410| 72 20 2d 20 73 61 76 65 | 20 61 20 73 74 72 69 6e |r - save| a strin|
|00005420| 67 20 69 6e 20 61 6c 6c | 6f 63 61 74 65 64 20 6d |g in all|ocated m|
|00005430| 65 6d 6f 72 79 2e 0a 20 | 2a 2f 0a 63 68 61 72 20 |emory.. |*/.char |
|00005440| 2a 73 61 76 65 73 74 72 | 28 73 2c 20 6e 29 0a 72 |*savestr|(s, n).r|
|00005450| 65 67 69 73 74 65 72 20 | 63 68 61 72 20 2a 73 3b |egister |char *s;|
|00005460| 0a 72 65 67 69 73 74 65 | 72 20 69 6e 74 20 6e 3b |.registe|r int n;|
|00005470| 0a 7b 0a 09 72 65 67 69 | 73 74 65 72 20 63 68 61 |.{..regi|ster cha|
|00005480| 72 20 2a 74 3b 0a 0a 09 | 69 66 20 28 28 74 20 3d |r *t;...|if ((t =|
|00005490| 20 28 63 68 61 72 20 2a | 29 20 6d 61 6c 6c 6f 63 | (char *|) malloc|
|000054a0| 28 6e 20 2b 20 31 29 29 | 20 3d 3d 20 4e 55 4c 4c |(n + 1))| == NULL|
|000054b0| 29 20 7b 0a 09 09 66 70 | 72 69 6e 74 66 28 73 74 |) {...fp|rintf(st|
|000054c0| 64 65 72 72 2c 20 22 25 | 73 3a 20 6f 75 74 20 6f |derr, "%|s: out o|
|000054d0| 66 20 6d 65 6d 6f 72 79 | 2e 5c 6e 22 2c 20 70 6e |f memory|.\n", pn|
|000054e0| 61 6d 65 29 3b 0a 09 09 | 65 78 69 74 28 31 29 3b |ame);...|exit(1);|
|000054f0| 0a 09 7d 0a 0a 09 73 74 | 72 63 70 79 28 74 2c 20 |..}...st|rcpy(t, |
|00005500| 73 29 3b 0a 09 74 5b 6e | 5d 20 3d 20 4e 55 4c 4c |s);..t[n|] = NULL|
|00005510| 3b 0a 0a 09 72 65 74 75 | 72 6e 28 74 29 3b 0a 7d |;...retu|rn(t);.}|
|00005520| 0a 0a 2f 2a 0a 20 2a 20 | 72 65 73 65 74 70 61 74 |../*. * |resetpat|
|00005530| 70 6f 73 20 2d 20 72 65 | 73 65 74 20 70 61 74 74 |pos - re|set patt|
|00005540| 65 72 6e 20 70 6f 73 69 | 74 69 6f 6e 20 74 6f 20 |ern posi|tion to |
|00005550| 73 74 61 72 74 20 6f 66 | 20 70 61 74 74 65 72 6e |start of| pattern|
|00005560| 2e 0a 20 2a 2f 0a 72 65 | 73 65 74 70 61 74 70 6f |.. */.re|setpatpo|
|00005570| 73 28 29 0a 7b 0a 09 70 | 61 74 70 6f 73 20 3d 20 |s().{..p|atpos = |
|00005580| 30 3b 0a 7d 0a 0a 2f 2a | 0a 20 2a 20 6b 62 79 74 |0;.}../*|. * kbyt|
|00005590| 65 73 20 2d 20 72 65 74 | 75 72 6e 20 6b 69 6c 6f |es - ret|urn kilo|
|000055a0| 62 79 74 65 73 20 66 72 | 6f 6d 20 62 79 74 65 73 |bytes fr|om bytes|
|000055b0| 2e 0a 20 2a 2f 0a 6b 62 | 79 74 65 73 28 6e 29 0a |.. */.kb|ytes(n).|
|000055c0| 69 6e 74 20 6e 3b 0a 7b | 0a 09 72 65 74 75 72 6e |int n;.{|..return|
|000055d0| 28 28 6e 20 2b 20 31 30 | 32 33 29 20 2f 20 31 30 |((n + 10|23) / 10|
|000055e0| 32 34 29 3b 0a 7d 0a 0a | 2f 2a 0a 20 2a 20 6d 69 |24);.}..|/*. * mi|
|000055f0| 6e 20 2d 20 6d 69 6e 69 | 6d 75 6d 20 66 75 6e 63 |n - mini|mum func|
|00005600| 74 69 6f 6e 2e 0a 20 2a | 2f 0a 6d 69 6e 28 78 2c |tion.. *|/.min(x,|
|00005610| 20 79 29 0a 69 6e 74 20 | 78 2c 20 79 3b 0a 7b 0a | y).int |x, y;.{.|
|00005620| 09 72 65 74 75 72 6e 28 | 78 20 3c 20 79 20 3f 20 |.return(|x < y ? |
|00005630| 78 20 3a 20 79 29 3b 0a | 7d 0a 0a 75 73 61 67 65 |x : y);.|}..usage|
|00005640| 28 29 0a 7b 0a 09 66 70 | 72 69 6e 74 66 28 73 74 |().{..fp|rintf(st|
|00005650| 64 65 72 72 2c 20 22 55 | 73 61 67 65 3a 20 25 73 |derr, "U|sage: %s|
|00005660| 20 5b 2d 65 5d 20 5b 2d | 69 5d 20 5b 2d 70 5d 20 | [-e] [-|i] [-p] |
|00005670| 65 78 70 72 20 66 69 6c | 65 73 79 73 74 65 6d 5c |expr fil|esystem\|
|00005680| 6e 22 2c 20 70 6e 61 6d | 65 29 3b 0a 09 65 78 69 |n", pnam|e);..exi|
|00005690| 74 28 31 29 3b 0a 7d 0a | 6b 2c 20 62 6c 6b 6e 6f |t(1);.}.|k, blkno|
|000056a0| 29 2c 20 69 64 62 6c 6b | 2c 20 73 62 6c 6f 63 6b |), idblk|, sblock|
|000056b0| 2e 66 73 5f 62 73 69 7a | 65 29 3b 0a 09 65 6c 73 |.fs_bsiz|e);..els|
|000056c0| 65 0a 09 09 62 7a 65 72 | 6f 28 69 64 62 6c 6b 2c |e...bzer|o(idblk,|
|000056d0| 20 73 62 6c 6f 63 6b 2e | 66 73 5f 62 73 69 7a 65 | sblock.|fs_bsize|
|000056e0| 29 3b 0a 0a 09 2f 2a 0a | 09 20 2a 20 49 66 20 6c |);.../*.|. * If l|
|000056f0| 65 76 65 6c 20 69 73 20 | 7a 65 72 6f 2c 20 74 68 |evel is |zero, th|
|00005700| 65 6e 20 74 68 69 73 20 | 62 6c 6f 63 6b 20 63 6f |en this |block co|
|00005710| 6e 74 61 69 6e 73 20 64 | 69 73 6b 20 62 6c 6f 63 |ntains d|isk bloc|
|00005720| 6b 0a 09 20 2a 20 61 64 | 64 72 65 73 73 65 73 2e |k.. * ad|dresses.|
|00005730| 0a 09 20 2a 2f 0a 09 69 | 66 20 28 6c 65 76 65 6c |.. */..i|f (level|
|00005740| 20 3c 3d 20 30 29 20 7b | 0a 09 09 2f 2a 0a 09 09 | <= 0) {|.../*...|
|00005750| 20 2a 20 46 6f 72 20 65 | 61 63 68 20 64 69 73 6b | * For e|ach disk|
|00005760| 20 62 6c 6f 63 6b 2e 2e | 2e 0a 09 09 20 2a 2f 0a | block..|.... */.|
|00005770| 09 09 66 6f 72 20 28 69 | 3d 30 3b 20 28 69 20 3c |..for (i|=0; (i <|
|00005780| 20 4e 49 4e 44 49 52 28 | 26 73 62 6c 6f 63 6b 29 | NINDIR(|&sblock)|
|00005790| 29 20 26 26 20 28 2a 63 | 6f 75 6e 74 20 3e 20 30 |) && (*c|ount > 0|
|000057a0| 29 3b 20 69 2b 2b 29 20 | 7b 0a 09 09 09 2f 2a 0a |); i++) |{..../*.|
|000057b0| 09 09 09 20 2a 20 52 65 | 61 64 20 69 6e 20 74 68 |... * Re|ad in th|
|000057c0| 65 20 62 6c 6f 63 6b 20 | 66 72 6f 6d 20 64 69 73 |e block |from dis|
|000057d0| 6b 2e 0a 09 09 09 20 2a | 2f 0a 09 09 09 62 72 65 |k..... *|/....bre|
|000057e0| 61 64 28 66 73 62 74 6f | 64 62 28 26 73 62 6c 6f |ad(fsbto|db(&sblo|
|000057f0| 63 6b 2c 20 69 64 62 6c | 6b 5b 69 5d 29 2c 20 64 |ck, idbl|k[i]), d|
|00005800| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005810| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005820| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005830| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005840| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005850| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005860| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005870| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005880| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005890| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000058a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000058b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000058c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000058d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000058e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000058f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005900| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005910| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005920| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005930| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005940| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005980| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005990| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000059a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000059b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000059c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000059d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000059e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000059f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005a00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005a10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005a20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005a30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005a40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005a50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005a60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005a70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005a80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005a90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005aa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005ab0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005ac0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005ad0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005ae0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005af0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005b00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005b10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005b20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005b30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005b40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005b50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005b60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005b70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005b80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005b90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005ba0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005bb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005bc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005bd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005be0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005bf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005c00| 20 70 61 74 68 63 6f 6d | 70 20 7b 0a 09 63 68 61 | pathcom|p {..cha|
|00005c10| 72 09 2a 70 63 5f 6e 61 | 6d 65 3b 0a 09 73 74 72 |r.*pc_na|me;..str|
|00005c20| 75 63 74 09 70 61 74 68 | 63 6f 6d 70 20 2a 70 63 |uct.path|comp *pc|
|00005c30| 5f 70 61 72 65 6e 74 3b | 0a 7d 3b 0a 0a 69 6e 74 |_parent;|.};..int|
|00005c40| 09 6e 66 69 6c 65 73 3b | 09 09 09 2f 2a 20 6e 75 |.nfiles;|.../* nu|
|00005c50| 6d 62 65 72 20 6f 66 20 | 66 69 6c 65 73 20 69 6e |mber of |files in|
|00005c60| 20 74 68 65 20 66 69 6c | 65 20 73 79 73 74 65 6d | the fil|e system|
|00005c70| 73 09 2a 2f 0a 69 6e 74 | 20 09 66 69 6c 65 64 65 |s.*/.int| .filede|
|00005c80| 73 3b 09 09 2f 2a 20 66 | 69 6c 65 20 64 65 73 63 |s;../* f|ile desc|
|00005c90| 72 69 70 74 6f 72 20 6f | 66 20 74 68 65 20 72 61 |riptor o|f the ra|
|00005ca0| 77 20 64 69 73 6b 20 64 | 65 76 09 2a 2f 0a 73 74 |w disk d|ev.*/.st|
|00005cb0| 72 75 63 74 09 64 69 6e | 6f 64 65 20 2a 64 69 6e |ruct.din|ode *din|
|00005cc0| 6f 64 65 3b 09 09 2f 2a | 20 74 61 62 6c 65 20 6f |ode;../*| table o|
|00005cd0| 66 20 6f 6e 2d 64 69 73 | 6b 20 69 6e 6f 64 65 20 |f on-dis|k inode |
|00005ce0| 73 74 72 75 63 74 75 72 | 65 73 09 2a 2f 0a 0a 64 |structur|es.*/..d|
|00005cf0| 65 76 5f 74 09 66 73 5f | 64 65 76 3b 09 09 09 2f |ev_t.fs_|dev;.../|
|00005d00| 2a 20 64 65 76 69 63 65 | 20 6e 75 6d 62 65 72 20 |* device| number |
|00005d10| 28 6d 61 6a 6f 72 2f 6d | 69 6e 6f 72 29 20 6f 66 |(major/m|inor) of|
|00005d20| 20 64 69 73 6b 09 2a 2f | 0a 63 68 61 72 09 2a 66 | disk.*/|.char.*f|
|00005d30| 73 5f 63 64 65 76 3b 09 | 09 2f 2a 20 63 68 61 72 |s_cdev;.|./* char|
|00005d40| 61 63 74 65 72 20 64 65 | 76 69 63 65 20 6e 61 6d |acter de|vice nam|
|00005d50| 65 20 6f 66 20 74 68 65 | 20 64 69 73 6b 09 2a 2f |e of the| disk.*/|
|00005d60| 0a 63 68 61 72 09 2a 66 | 69 6c 73 79 73 20 3d 20 |.char.*f|ilsys = |
|00005d70| 4e 55 4c 4c 3b 09 09 2f | 2a 20 6e 61 6d 65 20 6f |NULL;../|* name o|
|00005d80| 66 20 74 68 65 20 66 69 | 6c 65 20 73 79 73 74 65 |f the fi|le syste|
|00005d90| 6d 20 77 65 27 72 65 20 | 64 6f 69 6e 67 09 2a 2f |m we're |doing.*/|
|00005da0| 0a 0a 63 68 61 72 09 2a | 64 69 72 62 75 66 3b 09 |..char.*|dirbuf;.|
|00005db0| 09 2f 2a 20 63 6f 6e 74 | 65 6e 74 73 20 6f 66 20 |./* cont|ents of |
|00005dc0| 64 69 72 65 63 74 6f 72 | 79 20 28 66 6f 72 20 2d |director|y (for -|
|00005dd0| 70 20 6f 70 74 69 6f 6e | 29 2a 2f 0a 63 68 61 72 |p option|)*/.char|
|00005de0| 09 2a 70 61 74 68 70 74 | 72 20 3d 20 4e 55 4c 4c |.*pathpt|r = NULL|
|00005df0| 3b 09 2f 2a 20 70 6f 69 | 6e 74 65 72 20 74 6f 20 |;./* poi|nter to |
|00005e00| 66 72 6f 6e 74 20 6f 66 | 20 70 61 74 68 6e 61 6d |front of| pathnam|
|00005e10| 65 09 09 2a 2f 0a 73 74 | 72 75 63 74 09 70 61 74 |e..*/.st|ruct.pat|
|00005e20| 68 63 6f 6d 70 20 2a 70 | 61 74 68 6c 69 73 74 3b |hcomp *p|athlist;|
|00005e30| 09 2f 2a 20 6c 69 73 74 | 20 6f 66 20 70 61 74 68 |./* list| of path|
|00005e40| 6e 61 6d 65 20 63 6f 6d | 70 6f 6e 65 6e 74 73 09 |name com|ponents.|
|00005e50| 09 2a 2f 0a 63 68 61 72 | 09 70 61 74 68 62 75 66 |.*/.char|.pathbuf|
|00005e60| 5b 4d 41 58 50 41 54 48 | 4c 45 4e 5d 3b 09 2f 2a |[MAXPATH|LEN];./*|
|00005e70| 20 61 72 65 61 20 66 6f | 72 20 63 6f 6e 73 74 72 | area fo|r constr|
|00005e80| 75 63 74 69 6e 67 20 70 | 61 74 68 6e 61 6d 65 73 |ucting p|athnames|
|00005e90| 09 2a 2f 0a 0a 69 6e 74 | 09 69 66 6c 61 67 20 3d |.*/..int|.iflag =|
|00005ea0| 20 30 3b 09 09 2f 2a 20 | 2d 69 20 2d 20 69 67 6e | 0;../* |-i - ign|
|00005eb0| 6f 72 65 20 63 61 73 65 | 20 69 6e 20 70 61 74 74 |ore case| in patt|
|00005ec0| 65 72 6e 20 6d 61 74 63 | 68 69 6e 67 09 2a 2f 0a |ern matc|hing.*/.|
|00005ed0| 69 6e 74 09 70 66 6c 61 | 67 20 3d 20 31 3b 09 09 |int.pfla|g = 1;..|
|00005ee0| 2f 2a 20 2d 70 20 2d 20 | 70 72 69 6e 74 20 66 69 |/* -p - |print fi|
|00005ef0| 6c 65 20 70 61 74 68 6e | 61 6d 65 73 20 6f 6e 20 |le pathn|ames on |
|00005f00| 6d 61 74 63 68 09 2a 2f | 0a 0a 69 6e 74 09 2a 66 |match.*/|..int.*f|
|00005f10| 6c 69 6e 6b 3b 09 09 09 | 2f 2a 20 66 61 69 6c 75 |link;...|/* failu|
|00005f20| 72 65 20 6c 69 6e 6b 73 | 20 66 6f 72 20 74 68 65 |re links| for the|
|00005f30| 20 70 61 74 74 65 72 6e | 20 6d 61 74 63 68 09 2a | pattern| match.*|
|00005f40| 2f 0a 69 6e 74 09 70 61 | 74 6c 65 6e 3b 09 09 09 |/.int.pa|tlen;...|
|00005f50| 2f 2a 20 6c 65 6e 67 74 | 68 20 6f 66 20 74 68 65 |/* lengt|h of the|
|00005f60| 20 70 61 74 74 65 72 6e | 20 74 6f 20 62 65 20 6d | pattern| to be m|
|00005f70| 61 74 63 68 65 64 09 2a | 2f 0a 69 6e 74 09 70 61 |atched.*|/.int.pa|
|00005f80| 74 70 6f 73 3b 09 09 09 | 2f 2a 20 70 6f 73 69 74 |tpos;...|/* posit|
|00005f90| 69 6f 6e 20 69 6e 20 70 | 61 74 74 65 72 6e 20 64 |ion in p|attern d|
|00005fa0| 75 72 69 6e 67 20 6d 61 | 74 63 68 09 2a 2f 0a 63 |uring ma|tch.*/.c|
|00005fb0| 68 61 72 09 2a 70 61 74 | 74 65 72 6e 20 3d 20 4e |har.*pat|tern = N|
|00005fc0| 55 4c 4c 3b 09 2f 2a 20 | 74 68 65 20 70 61 74 74 |ULL;./* |the patt|
|00005fd0| 65 72 6e 20 77 65 20 61 | 72 65 20 6c 6f 6f 6b 69 |ern we a|re looki|
|00005fe0| 6e 67 20 66 6f 72 09 2a | 2f 0a 0a 63 68 61 72 09 |ng for.*|/..char.|
|00005ff0| 2a 70 6e 61 6d 65 3b 09 | 09 09 2f 2a 20 70 72 6f |*pname;.|../* pro|
+--------+-------------------------+-------------------------+--------+--------+