home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / unix_c / textproc / uniqbib.tar < prev    next >
Tape Archive  |  1989-03-04  |  32.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: uniqbib.tar

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Tape Archive (archive/tar) magic Supported
100% file tar archive default
99% file tar archive (V7), file uniqbib/, mode 755 , uid 243 , gid 12 , size 0 , seconds 4404071466 default
98% file data default
100% lsar Tar default
100% gt2 TAR Archiv gefunden (Auflistung ist deaktiviert) default
100% disktype Pre-POSIX tar archive default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 75 6e 69 71 62 69 62 2f | 00 00 00 00 00 00 00 00 |uniqbib/|........|
|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 37 31 | 0 | 4404071|
|00000090| 34 36 36 20 20 20 35 34 | 35 32 00 20 00 00 00 00 |466 54|52. ....|
|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| 75 6e 69 71 62 69 62 2f | 53 68 61 72 46 69 6c 65 |uniqbib/|SharFile|
|00000210| 2e 48 65 61 64 65 72 73 | 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 31 36 30 35 20 | 20 34 34 30 34 30 37 31 | 1605 | 4404071|
|00000290| 34 37 30 20 20 31 30 35 | 32 36 00 20 00 00 00 00 |470 105|26. ....|
|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 75 6e 69 71 | 62 69 62 2e 73 68 61 72 |=== uniq|bib.shar|
|00000410| 20 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 3d 0a 46 72 6f 6d 20 |========|==.From |
|00000430| 72 69 61 63 73 21 65 6f | 73 21 61 6d 65 73 21 6d |riacs!eo|s!ames!m|
|00000440| 61 69 6c 72 75 73 21 62 | 62 6e 21 62 62 6e 2e 63 |ailrus!b|bn!bbn.c|
|00000450| 6f 6d 21 72 73 61 6c 7a | 20 53 61 74 20 4e 6f 76 |om!rsalz| Sat Nov|
|00000460| 20 20 35 20 31 33 3a 32 | 35 3a 32 32 20 50 53 54 | 5 13:2|5:22 PST|
|00000470| 20 31 39 38 38 0a 0a 53 | 75 62 6d 69 74 74 65 64 | 1988..S|ubmitted|
|00000480| 2d 62 79 3a 20 42 72 61 | 69 6e 20 69 6e 20 4e 65 |-by: Bra|in in Ne|
|00000490| 75 74 72 61 6c 20 3c 62 | 69 6e 40 72 68 65 73 75 |utral <b|in@rhesu|
|000004a0| 73 2e 70 72 69 6d 61 74 | 65 2e 77 69 73 63 2e 65 |s.primat|e.wisc.e|
|000004b0| 64 75 3e 0a 50 6f 73 74 | 69 6e 67 2d 6e 75 6d 62 |du>.Post|ing-numb|
|000004c0| 65 72 3a 20 56 6f 6c 75 | 6d 65 20 31 36 2c 20 49 |er: Volu|me 16, I|
|000004d0| 73 73 75 65 20 35 32 0a | 41 72 63 68 69 76 65 2d |ssue 52.|Archive-|
|000004e0| 6e 61 6d 65 3a 20 75 6e | 69 71 62 69 62 0a 0a 55 |name: un|iqbib..U|
|000004f0| 6e 69 71 62 69 62 20 69 | 73 20 75 73 65 64 20 69 |niqbib i|s used i|
|00000500| 6e 20 63 6f 6e 6a 75 6e | 63 74 69 6f 6e 20 77 69 |n conjun|ction wi|
|00000510| 74 68 20 74 68 65 20 73 | 75 69 74 65 20 6f 66 20 |th the s|uite of |
|00000520| 70 72 6f 67 72 61 6d 73 | 20 63 6f 6d 70 72 69 73 |programs| compris|
|00000530| 69 6e 67 20 74 68 65 0a | 72 65 66 65 72 20 73 79 |ing the.|refer sy|
|00000540| 73 74 65 6d 2e 20 20 4f | 6e 65 20 70 72 6f 62 6c |stem. O|ne probl|
|00000550| 65 6d 20 77 69 74 68 20 | 74 68 69 73 20 73 79 73 |em with |this sys|
|00000560| 74 65 6d 20 69 73 20 74 | 68 61 74 20 74 68 65 72 |tem is t|hat ther|
|00000570| 65 20 69 73 20 6e 6f 20 | 70 72 6f 76 69 73 69 6f |e is no |provisio|
|00000580| 6e 0a 66 6f 72 20 72 65 | 6d 6f 76 61 6c 20 6f 66 |n.for re|moval of|
|00000590| 20 64 75 70 6c 69 63 61 | 74 65 73 20 66 72 6f 6d | duplica|tes from|
|000005a0| 20 62 69 62 6c 69 6f 67 | 72 61 70 68 69 63 20 64 | bibliog|raphic d|
|000005b0| 61 74 61 62 61 73 65 73 | 2e 20 20 28 44 75 70 6c |atabases|. (Dupl|
|000005c0| 69 63 61 74 65 73 20 6d | 61 79 0a 6f 63 63 75 72 |icates m|ay.occur|
|000005d0| 2c 20 66 6f 72 20 69 6e | 73 74 61 6e 63 65 2c 20 |, for in|stance, |
|000005e0| 69 66 20 74 68 65 20 6f | 75 74 70 75 74 20 66 72 |if the o|utput fr|
|000005f0| 6f 6d 20 74 77 6f 20 6f | 72 20 6d 6f 72 65 20 6c |om two o|r more l|
|00000600| 6f 6f 6b 62 69 62 20 71 | 75 65 72 69 65 73 20 69 |ookbib q|ueries i|
|00000610| 73 0a 63 6f 6d 62 69 6e | 65 64 2c 20 77 68 65 72 |s.combin|ed, wher|
|00000620| 65 20 65 6e 74 72 69 65 | 73 20 73 61 74 69 73 66 |e entrie|s satisf|
|00000630| 79 20 74 68 65 20 6b 65 | 79 77 6f 72 64 73 20 6f |y the ke|ywords o|
|00000640| 66 20 6d 6f 72 65 20 74 | 68 61 6e 20 6f 6e 65 20 |f more t|han one |
|00000650| 73 65 61 72 63 68 2e 29 | 0a 55 6e 69 71 62 69 62 |search.)|.Uniqbib|
|00000660| 20 69 73 20 75 73 65 64 | 20 74 6f 20 72 65 6d 6f | is used| to remo|
|00000670| 76 65 20 73 75 63 68 20 | 64 75 70 6c 69 63 61 74 |ve such |duplicat|
|00000680| 65 73 2e 20 20 49 74 20 | 72 65 61 64 73 20 69 74 |es. It |reads it|
|00000690| 73 20 69 6e 70 75 74 20 | 61 6e 64 20 77 72 69 74 |s input |and writ|
|000006a0| 65 73 0a 61 6c 6c 20 74 | 68 65 20 75 6e 69 71 75 |es.all t|he uniqu|
|000006b0| 65 20 65 6e 74 72 69 65 | 73 20 74 68 65 72 65 69 |e entrie|s therei|
|000006c0| 6e 20 74 6f 20 74 68 65 | 20 73 74 61 6e 64 61 72 |n to the| standar|
|000006d0| 64 20 6f 75 74 70 75 74 | 2e 20 20 54 68 65 20 65 |d output|. The e|
|000006e0| 6e 74 72 69 65 73 20 69 | 6e 20 74 68 65 0a 69 6e |ntries i|n the.in|
|000006f0| 70 75 74 20 64 6f 20 6e | 6f 74 20 68 61 76 65 20 |put do n|ot have |
|00000700| 74 6f 20 62 65 20 73 6f | 72 74 65 64 20 28 69 2e |to be so|rted (i.|
|00000710| 65 2e 2c 20 79 6f 75 20 | 64 6f 20 6e 6f 74 20 68 |e., you |do not h|
|00000720| 61 76 65 20 74 6f 20 72 | 75 6e 20 73 6f 72 74 62 |ave to r|un sortb|
|00000730| 69 62 0a 66 69 72 73 74 | 29 2c 20 6e 6f 72 20 64 |ib.first|), nor d|
|00000740| 6f 20 74 68 65 20 65 6e | 74 72 69 65 73 20 70 72 |o the en|tries pr|
|00000750| 6f 64 75 63 65 64 20 62 | 79 20 75 6e 69 71 62 69 |oduced b|y uniqbi|
|00000760| 62 20 63 6f 6d 65 20 6f | 75 74 20 69 6e 20 61 6e |b come o|ut in an|
|00000770| 79 20 70 61 72 74 69 63 | 75 6c 61 72 0a 6f 72 64 |y partic|ular.ord|
|00000780| 65 72 2e 0a 0a 00 00 00 | 00 00 00 00 00 00 00 00 |er......|........|
|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| 75 6e 69 71 62 69 62 2f | 75 6e 69 71 62 69 62 2e |uniqbib/|uniqbib.|
|00000810| 63 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |c.......|........|
|00000820| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000830| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000840| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000850| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000860| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00000870| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00000880| 20 20 31 36 34 31 32 20 | 20 34 34 30 34 30 37 31 | 16412 | 4404071|
|00000890| 34 33 35 20 20 20 37 33 | 35 34 00 20 00 00 00 00 |435 73|54. ....|
|000008a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000900| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000910| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000920| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000930| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000940| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000980| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000990| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a00| 2f 2a 0a 09 75 6e 69 71 | 62 69 62 20 2d 20 75 6e |/*..uniq|bib - un|
|00000a10| 69 71 20 61 20 62 69 62 | 6c 69 6f 67 72 61 70 68 |iq a bib|liograph|
|00000a20| 69 63 20 64 61 74 61 62 | 61 73 65 20 74 6f 20 65 |ic datab|ase to e|
|00000a30| 6c 69 6d 69 6e 61 74 65 | 20 64 75 70 6c 69 63 61 |liminate| duplica|
|00000a40| 74 65 73 2e 0a 0a 09 73 | 79 6e 74 61 78 3a 20 75 |tes....s|yntax: u|
|00000a50| 6e 69 71 62 69 62 20 5b | 20 2d 76 20 5d 20 5b 20 |niqbib [| -v ] [ |
|00000a60| 66 69 6c 65 20 5d 0a 0a | 09 2d 76 20 6d 65 61 6e |file ]..|.-v mean|
|00000a70| 73 20 76 65 72 62 6f 73 | 65 3a 20 70 72 69 6e 74 |s verbos|e: print|
|00000a80| 73 20 66 65 65 64 62 61 | 63 6b 2e 0a 0a 09 4f 6e |s feedba|ck....On|
|00000a90| 6c 79 20 6f 6e 65 20 66 | 69 6c 65 20 6d 61 79 20 |ly one f|ile may |
|00000aa0| 62 65 20 65 78 70 6c 69 | 63 69 74 6c 79 20 6e 61 |be expli|citly na|
|00000ab0| 6d 65 64 20 28 75 73 65 | 20 63 61 74 20 66 31 20 |med (use| cat f1 |
|00000ac0| 66 32 20 2e 2e 2e 20 7c | 20 75 6e 69 71 62 69 62 |f2 ... || uniqbib|
|00000ad0| 0a 09 66 6f 72 20 3e 20 | 31 20 66 69 6c 65 29 2e |..for > |1 file).|
|00000ae0| 0a 0a 09 53 74 72 61 74 | 65 67 79 3a 0a 09 52 65 |...Strat|egy:..Re|
|00000af0| 61 64 20 69 6e 70 75 74 | 20 66 69 6c 65 2c 20 77 |ad input| file, w|
|00000b00| 72 69 74 69 6e 67 20 66 | 69 6c 65 20 70 6f 73 69 |riting f|ile posi|
|00000b10| 74 69 6f 6e 20 61 6e 64 | 20 73 75 6d 6d 61 72 79 |tion and| summary|
|00000b20| 20 69 6e 66 6f 72 6d 61 | 74 69 6f 6e 0a 09 66 6f | informa|tion..fo|
|00000b30| 72 20 65 61 63 68 20 65 | 6e 74 72 79 2e 20 20 53 |r each e|ntry. S|
|00000b40| 6f 72 74 20 6f 6e 20 73 | 75 6d 6d 61 72 79 20 69 |ort on s|ummary i|
|00000b50| 6e 66 6f 2e 20 20 46 6f | 72 20 65 61 63 68 20 73 |nfo. Fo|r each s|
|00000b60| 65 74 20 6f 66 20 65 6e | 74 72 69 65 73 0a 09 68 |et of en|tries..h|
|00000b70| 61 76 69 6e 67 20 69 64 | 65 6e 74 69 63 61 6c 20 |aving id|entical |
|00000b80| 73 75 6d 6d 61 72 79 20 | 69 6e 66 6f 72 6d 61 74 |summary |informat|
|00000b90| 69 6f 6e 2c 20 63 6f 6d | 70 61 72 65 20 64 69 72 |ion, com|pare dir|
|00000ba0| 65 63 74 6c 79 2c 20 61 | 6e 64 20 77 72 69 74 65 |ectly, a|nd write|
|00000bb0| 0a 09 6f 75 74 20 74 68 | 6f 73 65 20 74 68 61 74 |..out th|ose that|
|00000bc0| 20 61 72 65 20 64 69 66 | 66 65 72 65 6e 74 2e 20 | are dif|ferent. |
|00000bd0| 20 28 46 6f 72 20 74 68 | 6f 73 65 20 65 6e 74 72 | (For th|ose entr|
|00000be0| 69 65 73 20 74 68 61 74 | 20 68 61 76 65 20 75 6e |ies that| have un|
|00000bf0| 69 71 75 65 0a 09 73 75 | 6d 6d 61 72 79 20 69 6e |ique..su|mmary in|
|00000c00| 66 6f 2c 20 74 68 65 20 | 65 6e 74 72 79 20 69 73 |fo, the |entry is|
|00000c10| 20 75 6e 69 71 75 65 2c | 20 6f 66 20 63 6f 75 72 | unique,| of cour|
|00000c20| 73 65 2e 29 0a 0a 09 54 | 68 65 20 73 75 6d 6d 61 |se.)...T|he summa|
|00000c30| 72 79 20 69 6e 66 6f 72 | 6d 61 74 69 6f 6e 20 69 |ry infor|mation i|
|00000c40| 73 20 74 72 69 76 69 61 | 6c 3a 20 20 74 68 65 20 |s trivia|l: the |
|00000c50| 73 75 6d 20 6f 66 20 74 | 68 65 20 63 68 61 72 61 |sum of t|he chara|
|00000c60| 63 74 65 72 73 20 69 6e | 0a 09 74 68 65 20 74 65 |cters in|..the te|
|00000c70| 78 74 20 6f 66 20 74 68 | 65 20 65 6e 74 72 79 2e |xt of th|e entry.|
|00000c80| 20 20 54 68 69 73 20 69 | 73 20 69 6e 76 61 72 69 | This i|s invari|
|00000c90| 61 6e 74 20 77 69 74 68 | 20 72 65 73 70 65 63 74 |ant with| respect|
|00000ca0| 20 74 6f 20 6f 72 64 65 | 72 20 6f 66 0a 09 66 69 | to orde|r of..fi|
|00000cb0| 65 6c 64 73 20 28 72 65 | 63 6f 72 64 73 20 74 68 |elds (re|cords th|
|00000cc0| 61 74 20 61 72 65 20 69 | 64 65 6e 74 69 63 61 6c |at are i|dentical|
|00000cd0| 20 65 78 63 65 70 74 20 | 66 6f 72 20 6f 72 64 65 | except |for orde|
|00000ce0| 72 20 6f 66 20 66 69 65 | 6c 64 73 20 67 65 74 0a |r of fie|lds get.|
|00000cf0| 09 69 64 65 6e 74 69 63 | 61 6c 20 63 68 65 63 6b |.identic|al check|
|00000d00| 73 75 6d 73 20 74 68 69 | 73 20 77 61 79 29 2e 0a |sums thi|s way)..|
|00000d10| 0a 09 37 20 41 70 72 69 | 6c 20 31 39 38 38 09 50 |..7 Apri|l 1988.P|
|00000d20| 61 75 6c 20 44 75 42 6f | 69 73 09 64 75 62 6f 69 |aul DuBo|is.duboi|
|00000d30| 73 40 72 68 65 73 75 73 | 2e 70 72 69 6d 61 74 65 |s@rhesus|.primate|
|00000d40| 2e 77 69 73 63 2e 65 64 | 75 0a 0a 09 43 68 61 6e |.wisc.ed|u...Chan|
|00000d50| 67 65 20 48 69 73 74 6f | 72 79 3a 0a 0a 09 30 38 |ge Histo|ry:...08|
|00000d60| 2f 31 30 2f 38 38 20 46 | 69 78 65 64 20 66 61 69 |/10/88 F|ixed fai|
|00000d70| 6c 75 72 65 20 74 6f 20 | 63 68 65 63 6b 20 66 6f |lure to |check fo|
|00000d80| 72 20 63 69 74 61 74 69 | 6f 6e 73 20 74 68 61 74 |r citati|ons that|
|00000d90| 20 61 72 65 20 74 6f 6f | 20 6c 6f 6e 67 2e 0a 09 | are too| long...|
|00000da0| 09 41 64 64 65 64 20 2d | 76 20 66 6c 61 67 2e 20 |.Added -|v flag. |
|00000db0| 20 50 75 74 20 62 65 74 | 74 65 72 20 65 72 72 6f | Put bet|ter erro|
|00000dc0| 72 20 6d 65 73 73 61 67 | 65 73 20 69 6e 20 42 45 |r messag|es in BE|
|00000dd0| 52 65 61 64 0a 09 09 28 | 70 72 69 6e 74 73 20 74 |Read...(|prints t|
|00000de0| 65 78 74 20 6f 66 20 63 | 69 74 61 74 69 6f 6e 20 |ext of c|itation |
|00000df0| 73 65 65 6e 20 73 6f 20 | 66 61 72 2c 20 69 6e 70 |seen so |far, inp|
|00000e00| 75 74 20 6c 69 6e 65 20 | 6e 75 6d 62 65 72 0a 09 |ut line |number..|
|00000e10| 09 77 68 65 72 65 20 65 | 72 72 6f 72 20 6f 63 63 |.where e|rror occ|
|00000e20| 75 72 72 65 64 29 2e 20 | 20 52 65 6d 6f 76 65 64 |urred). | Removed|
|00000e30| 20 69 6e 61 62 69 6c 69 | 74 79 20 74 6f 20 75 6e | inabili|ty to un|
|00000e40| 69 71 20 66 72 6f 6d 0a | 09 09 61 20 70 69 70 65 |iq from.|..a pipe|
|00000e50| 20 6f 72 20 72 65 64 69 | 72 65 63 74 65 64 20 69 | or redi|rected i|
|00000e60| 6e 70 75 74 20 28 63 69 | 74 61 74 69 6f 6e 73 20 |nput (ci|tations |
|00000e70| 61 72 65 20 63 6f 70 69 | 65 64 20 74 6f 0a 09 09 |are copi|ed to...|
|00000e80| 68 6f 6c 64 69 6e 67 20 | 66 69 6c 65 20 64 75 72 |holding |file dur|
|00000e90| 69 6e 67 20 72 65 61 64 | 69 6e 67 20 70 68 61 73 |ing read|ing phas|
|00000ea0| 65 20 31 29 2e 0a 2a 2f | 0a 0a 23 20 69 6e 63 6c |e 1)..*/|..# incl|
|00000eb0| 75 64 65 09 3c 73 74 64 | 69 6f 2e 68 3e 0a 23 20 |ude.<std|io.h>.# |
|00000ec0| 69 6e 63 6c 75 64 65 09 | 3c 73 69 67 6e 61 6c 2e |include.|<signal.|
|00000ed0| 68 3e 0a 23 20 69 6e 63 | 6c 75 64 65 09 22 62 69 |h>.# inc|lude."bi|
|00000ee0| 62 69 6e 66 6f 2e 68 22 | 0a 0a 0a 69 6e 74 09 63 |binfo.h"|...int.c|
|00000ef0| 6f 75 6e 74 20 3d 20 30 | 3b 0a 69 6e 74 09 76 65 |ount = 0|;.int.ve|
|00000f00| 72 62 6f 73 65 20 3d 20 | 30 3b 0a 0a 69 6e 74 09 |rbose = |0;..int.|
|00000f10| 63 6c 65 61 6e 75 70 20 | 28 29 3b 0a 69 6e 74 09 |cleanup |();.int.|
|00000f20| 6f 6e 69 6e 74 72 20 28 | 29 3b 0a 0a 63 68 61 72 |onintr (|);..char|
|00000f30| 09 6b 65 79 46 69 6c 65 | 5b 42 55 46 53 49 5a 5d |.keyFile|[BUFSIZ]|
|00000f40| 3b 0a 63 68 61 72 09 68 | 6f 6c 64 46 69 6c 65 5b |;.char.h|oldFile[|
|00000f50| 42 55 46 53 49 5a 5d 3b | 0a 0a 0a 6d 61 69 6e 20 |BUFSIZ];|...main |
|00000f60| 28 61 72 67 63 2c 20 61 | 72 67 76 29 0a 69 6e 74 |(argc, a|rgv).int|
|00000f70| 09 61 72 67 63 3b 0a 63 | 68 61 72 09 2a 2a 61 72 |.argc;.c|har.**ar|
|00000f80| 67 76 3b 0a 7b 0a 42 69 | 62 45 6e 74 09 2a 62 65 |gv;.{.Bi|bEnt.*be|
|00000f90| 3b 0a 42 69 62 46 6c 64 | 09 2a 62 66 3b 0a 46 49 |;.BibFld|.*bf;.FI|
|00000fa0| 4c 45 09 2a 6b 66 2c 20 | 2a 68 66 3b 0a 63 68 61 |LE.*kf, |*hf;.cha|
|00000fb0| 72 09 62 75 66 5b 42 55 | 46 53 49 5a 5d 3b 0a 63 |r.buf[BU|FSIZ];.c|
|00000fc0| 68 61 72 09 2a 63 70 3b | 0a 6c 6f 6e 67 09 73 75 |har.*cp;|.long.su|
|00000fd0| 6d 3b 0a 69 6e 74 09 6c | 65 6e 3b 0a 69 6e 74 09 |m;.int.l|en;.int.|
|00000fe0| 72 65 73 75 6c 74 3b 0a | 69 6e 74 09 65 6d 70 74 |result;.|int.empt|
|00000ff0| 79 20 3d 20 31 3b 0a 69 | 6e 74 09 75 73 65 48 6f |y = 1;.i|nt.useHo|
|00001000| 6c 64 20 3d 20 30 3b 0a | 6c 6f 6e 67 09 68 6f 6c |ld = 0;.|long.hol|
|00001010| 64 50 6f 73 20 3d 20 30 | 3b 0a 0a 2f 2a 0a 09 41 |dPos = 0|;../*..A|
|00001020| 72 72 61 6e 67 65 20 66 | 6f 72 20 63 6c 65 61 6e |rrange f|or clean|
|00001030| 75 70 20 6f 66 20 74 65 | 6d 70 20 66 69 6c 65 73 |up of te|mp files|
|00001040| 20 69 6e 0a 09 74 68 65 | 20 65 76 65 6e 74 20 6f | in..the| event o|
|00001050| 66 20 61 62 6e 6f 72 6d | 61 6c 20 74 65 72 6d 69 |f abnorm|al termi|
|00001060| 6e 61 74 69 6f 6e 2e 0a | 2a 2f 0a 0a 09 73 65 74 |nation..|*/...set|
|00001070| 70 61 6e 69 63 68 6f 6f | 6b 20 28 63 6c 65 61 6e |panichoo|k (clean|
|00001080| 75 70 29 3b 0a 09 73 69 | 67 6e 61 6c 20 28 53 49 |up);..si|gnal (SI|
|00001090| 47 49 4e 54 2c 20 6f 6e | 69 6e 74 72 29 3b 0a 09 |GINT, on|intr);..|
|000010a0| 73 69 67 6e 61 6c 20 28 | 53 49 47 48 55 50 2c 20 |signal (|SIGHUP, |
|000010b0| 6f 6e 69 6e 74 72 29 3b | 0a 09 73 69 67 6e 61 6c |onintr);|..signal|
|000010c0| 20 28 53 49 47 51 55 49 | 54 2c 20 6f 6e 69 6e 74 | (SIGQUI|T, onint|
|000010d0| 72 29 3b 0a 09 73 69 67 | 6e 61 6c 20 28 53 49 47 |r);..sig|nal (SIG|
|000010e0| 54 45 52 4d 2c 20 6f 6e | 69 6e 74 72 29 3b 0a 0a |TERM, on|intr);..|
|000010f0| 2f 2a 0a 09 50 72 6f 63 | 65 73 73 20 61 72 67 75 |/*..Proc|ess argu|
|00001100| 6d 65 6e 74 73 20 61 6e | 64 20 73 65 74 20 75 70 |ments an|d set up|
|00001110| 20 66 69 6c 65 73 2e 20 | 20 49 66 20 61 20 66 69 | files. | If a fi|
|00001120| 6c 65 20 69 73 20 6e 61 | 6d 65 64 2c 20 75 73 65 |le is na|med, use|
|00001130| 0a 09 74 68 61 74 20 66 | 6f 72 20 69 6e 70 75 74 |..that f|or input|
|00001140| 2c 20 65 6c 73 65 20 72 | 65 61 64 20 77 68 61 74 |, else r|ead what|
|00001150| 65 76 65 72 27 73 20 6f | 6e 20 73 74 64 69 6e 20 |ever's o|n stdin |
|00001160| 61 6e 64 20 61 72 72 61 | 6e 67 65 20 74 6f 0a 09 |and arra|nge to..|
|00001170| 68 6f 6c 64 20 61 20 63 | 6f 70 79 20 69 6e 20 61 |hold a c|opy in a|
|00001180| 20 73 65 65 6b 61 62 6c | 65 20 74 65 6d 70 20 66 | seekabl|e temp f|
|00001190| 69 6c 65 2e 0a 2a 2f 0a | 0a 09 2d 2d 61 72 67 63 |ile..*/.|..--argc|
|000011a0| 3b 0a 09 2b 2b 61 72 67 | 76 3b 0a 09 69 66 20 28 |;..++arg|v;..if (|
|000011b0| 61 72 67 63 20 3e 20 30 | 20 26 26 20 73 74 72 63 |argc > 0| && strc|
|000011c0| 6d 70 20 28 2a 61 72 67 | 76 2c 20 22 2d 76 22 29 |mp (*arg|v, "-v")|
|000011d0| 20 3d 3d 20 30 29 0a 09 | 7b 0a 09 09 2b 2b 76 65 | == 0)..|{...++ve|
|000011e0| 72 62 6f 73 65 3b 0a 09 | 09 2d 2d 61 72 67 63 3b |rbose;..|.--argc;|
|000011f0| 0a 09 09 2b 2b 61 72 67 | 76 3b 0a 09 7d 0a 09 69 |...++arg|v;..}..i|
|00001200| 66 20 28 61 72 67 63 20 | 3d 3d 20 30 29 09 09 2f |f (argc |== 0)../|
|00001210| 2a 20 72 65 61 64 69 6e | 67 20 66 72 6f 6d 20 70 |* readin|g from p|
|00001220| 69 70 65 20 6f 72 20 72 | 65 64 69 72 65 63 74 69 |ipe or r|edirecti|
|00001230| 6f 6e 20 2a 2f 0a 09 7b | 0a 09 09 73 70 72 69 6e |on */..{|...sprin|
|00001240| 74 66 20 28 68 6f 6c 64 | 46 69 6c 65 2c 20 22 2f |tf (hold|File, "/|
|00001250| 74 6d 70 2f 75 62 68 25 | 30 35 64 22 2c 20 67 65 |tmp/ubh%|05d", ge|
|00001260| 74 70 69 64 20 28 29 29 | 3b 0a 09 09 69 66 20 28 |tpid ())|;...if (|
|00001270| 28 68 66 20 3d 20 66 6f | 70 65 6e 20 28 68 6f 6c |(hf = fo|pen (hol|
|00001280| 64 46 69 6c 65 2c 20 22 | 77 22 29 29 20 3d 3d 20 |dFile, "|w")) == |
|00001290| 4e 55 4c 4c 29 0a 09 09 | 09 70 61 6e 69 63 20 28 |NULL)...|.panic (|
|000012a0| 22 43 61 6e 27 74 20 6f | 70 65 6e 20 74 65 6d 70 |"Can't o|pen temp|
|000012b0| 6f 72 61 72 79 20 68 6f | 6c 64 20 66 69 6c 65 22 |orary ho|ld file"|
|000012c0| 29 3b 0a 09 09 2b 2b 75 | 73 65 48 6f 6c 64 3b 0a |);...++u|seHold;.|
|000012d0| 09 7d 0a 09 65 6c 73 65 | 20 69 66 20 28 61 72 67 |.}..else| if (arg|
|000012e0| 63 20 3d 3d 20 31 29 0a | 09 7b 0a 09 09 69 66 20 |c == 1).|.{...if |
|000012f0| 28 66 72 65 6f 70 65 6e | 20 28 61 72 67 76 5b 30 |(freopen| (argv[0|
|00001300| 5d 2c 20 22 72 22 2c 20 | 73 74 64 69 6e 29 20 3d |], "r", |stdin) =|
|00001310| 3d 20 4e 55 4c 4c 29 0a | 09 09 09 70 61 6e 69 63 |= NULL).|...panic|
|00001320| 20 28 22 43 61 6e 27 74 | 20 6f 70 65 6e 3a 20 25 | ("Can't| open: %|
|00001330| 73 22 2c 20 61 72 67 76 | 5b 30 5d 29 3b 0a 09 7d |s", argv|[0]);..}|
|00001340| 0a 09 65 6c 73 65 0a 09 | 09 70 61 6e 69 63 20 28 |..else..|.panic (|
|00001350| 22 55 73 61 67 65 3a 20 | 75 6e 69 71 62 69 62 20 |"Usage: |uniqbib |
|00001360| 5b 2d 76 5d 20 66 69 6c | 65 22 29 3b 0a 0a 09 73 |[-v] fil|e");...s|
|00001370| 70 72 69 6e 74 66 20 28 | 6b 65 79 46 69 6c 65 2c |printf (|keyFile,|
|00001380| 20 22 2f 74 6d 70 2f 75 | 62 25 30 35 64 22 2c 20 | "/tmp/u|b%05d", |
|00001390| 67 65 74 70 69 64 20 28 | 29 29 3b 0a 09 69 66 20 |getpid (|));..if |
|000013a0| 28 28 6b 66 20 3d 20 66 | 6f 70 65 6e 20 28 6b 65 |((kf = f|open (ke|
|000013b0| 79 46 69 6c 65 2c 20 22 | 77 22 29 29 20 3d 3d 20 |yFile, "|w")) == |
|000013c0| 4e 55 4c 4c 29 0a 09 09 | 70 61 6e 69 63 20 28 22 |NULL)...|panic ("|
|000013d0| 43 61 6e 27 74 20 6f 70 | 65 6e 20 74 65 6d 70 6f |Can't op|en tempo|
|000013e0| 72 61 72 79 20 6b 65 79 | 20 66 69 6c 65 2e 22 29 |rary key| file.")|
|000013f0| 3b 0a 0a 2f 2a 0a 09 52 | 65 61 64 79 20 74 6f 20 |;../*..R|eady to |
|00001400| 6d 61 6b 65 20 66 69 72 | 73 74 20 70 61 73 73 20 |make fir|st pass |
|00001410| 74 68 72 6f 75 67 68 20 | 69 6e 70 75 74 2e 20 20 |through |input. |
|00001420| 52 65 61 64 20 65 61 63 | 68 20 63 69 74 61 74 69 |Read eac|h citati|
|00001430| 6f 6e 2c 0a 09 63 6f 6d | 70 75 74 65 20 74 68 65 |on,..com|pute the|
|00001440| 20 6b 65 79 20 61 6e 64 | 20 77 72 69 74 65 20 6f | key and| write o|
|00001450| 75 74 20 74 68 65 20 6b | 65 79 20 61 6e 64 20 66 |ut the k|ey and f|
|00001460| 69 6c 65 20 70 6f 73 69 | 74 69 6f 6e 20 6f 66 20 |ile posi|tion of |
|00001470| 74 68 65 0a 09 63 69 74 | 61 74 69 6f 6e 20 74 6f |the..cit|ation to|
|00001480| 20 74 68 65 20 6b 65 79 | 20 66 69 6c 65 2e 20 20 | the key| file. |
|00001490| 49 66 20 72 65 61 64 69 | 6e 67 20 61 20 70 69 70 |If readi|ng a pip|
|000014a0| 65 20 6f 72 20 72 65 64 | 69 72 65 63 74 65 64 20 |e or red|irected |
|000014b0| 69 6e 70 75 74 0a 09 77 | 72 69 74 65 20 6f 75 74 |input..w|rite out|
|000014c0| 20 74 68 65 20 63 69 74 | 61 74 69 6f 6e 20 74 6f | the cit|ation to|
|000014d0| 20 61 20 68 6f 6c 64 69 | 6e 67 20 66 69 6c 65 20 | a holdi|ng file |
|000014e0| 73 6f 20 63 61 6e 20 72 | 65 2d 72 65 61 64 20 69 |so can r|e-read i|
|000014f0| 74 2e 20 20 49 6e 0a 09 | 74 68 61 74 20 63 61 73 |t. In..|that cas|
|00001500| 65 2c 20 74 68 65 20 66 | 69 6c 65 20 70 6f 73 69 |e, the f|ile posi|
|00001510| 74 69 6f 6e 20 6d 75 73 | 74 20 62 65 20 66 69 78 |tion mus|t be fix|
|00001520| 65 64 2c 20 73 69 6e 63 | 65 20 74 68 65 20 70 6f |ed, sinc|e the po|
|00001530| 73 69 74 69 6f 6e 0a 09 | 69 6e 20 74 68 65 20 68 |sition..|in the h|
|00001540| 6f 6c 64 69 6e 67 20 66 | 69 6c 65 20 6d 61 79 20 |olding f|ile may |
|00001550| 77 65 6c 6c 20 62 65 20 | 64 69 66 66 65 72 65 6e |well be |differen|
|00001560| 74 20 28 65 2e 67 2e 2c | 20 69 66 20 74 68 65 72 |t (e.g.,| if ther|
|00001570| 65 20 61 72 65 0a 09 6d | 75 6c 74 69 70 6c 65 20 |e are..m|ultiple |
|00001580| 62 6c 61 6e 6b 20 6c 69 | 6e 65 73 20 62 65 74 77 |blank li|nes betw|
|00001590| 65 65 6e 20 63 69 74 61 | 74 69 6f 6e 73 20 69 6e |een cita|tions in|
|000015a0| 20 74 68 65 20 6f 72 69 | 67 69 6e 61 6c 20 69 6e | the ori|ginal in|
|000015b0| 70 75 74 29 2e 0a 2a 2f | 0a 0a 09 69 66 20 28 28 |put)..*/|...if ((|
|000015c0| 62 65 20 3d 20 42 45 41 | 6c 6c 6f 63 20 28 29 29 |be = BEA|lloc ())|
|000015d0| 20 3d 3d 20 4e 55 4c 4c | 29 0a 09 09 70 61 6e 69 | == NULL|)...pani|
|000015e0| 63 20 28 22 4f 75 74 20 | 6f 66 20 6d 65 6d 6f 72 |c ("Out |of memor|
|000015f0| 79 2e 22 29 3b 0a 09 69 | 66 20 28 76 65 72 62 6f |y.");..i|f (verbo|
|00001600| 73 65 29 0a 09 09 66 70 | 72 69 6e 74 66 20 28 73 |se)...fp|rintf (s|
|00001610| 74 64 65 72 72 2c 20 22 | 52 65 61 64 69 6e 67 20 |tderr, "|Reading |
|00001620| 63 69 74 61 74 69 6f 6e | 73 5c 6e 22 29 3b 0a 09 |citation|s\n");..|
|00001630| 77 68 69 6c 65 20 28 28 | 72 65 73 75 6c 74 20 3d |while ((|result =|
|00001640| 20 42 45 52 65 61 64 20 | 28 73 74 64 69 6e 2c 20 | BERead |(stdin, |
|00001650| 62 65 29 29 20 3e 20 30 | 29 0a 09 7b 0a 09 09 2b |be)) > 0|)..{...+|
|00001660| 2b 63 6f 75 6e 74 3b 0a | 09 09 69 66 20 28 76 65 |+count;.|..if (ve|
|00001670| 72 62 6f 73 65 29 0a 09 | 09 09 66 70 72 69 6e 74 |rbose)..|..fprint|
|00001680| 66 20 28 73 74 64 65 72 | 72 2c 20 22 2e 22 29 3b |f (stder|r, ".");|
|00001690| 0a 09 09 65 6d 70 74 79 | 20 3d 20 30 3b 0a 09 09 |...empty| = 0;...|
|000016a0| 73 75 6d 20 3d 20 30 3b | 0a 09 09 63 70 20 3d 20 |sum = 0;|...cp = |
|000016b0| 42 45 54 65 78 74 20 28 | 62 65 29 3b 0a 09 09 6c |BEText (|be);...l|
|000016c0| 65 6e 20 3d 20 42 45 4c | 65 6e 20 28 62 65 29 3b |en = BEL|en (be);|
|000016d0| 0a 09 09 69 66 20 28 75 | 73 65 48 6f 6c 64 29 0a |...if (u|seHold).|
|000016e0| 09 09 7b 0a 09 09 09 42 | 45 57 72 69 74 65 20 28 |..{....B|EWrite (|
|000016f0| 68 66 2c 20 62 65 29 3b | 0a 09 09 09 42 45 46 69 |hf, be);|....BEFi|
|00001700| 6c 50 6f 73 20 28 62 65 | 29 20 3d 20 68 6f 6c 64 |lPos (be|) = hold|
|00001710| 50 6f 73 3b 0a 09 09 09 | 68 6f 6c 64 50 6f 73 20 |Pos;....|holdPos |
|00001720| 2b 3d 20 6c 65 6e 20 2b | 20 31 3b 09 2f 2a 20 2b |+= len +| 1;./* +|
|00001730| 31 20 66 6f 72 20 70 72 | 65 63 65 64 69 6e 67 20 |1 for pr|eceding |
|00001740| 6e 65 77 6c 69 6e 65 20 | 2a 2f 0a 09 09 7d 0a 09 |newline |*/...}..|
|00001750| 09 77 68 69 6c 65 20 28 | 6c 65 6e 2d 2d 20 3e 20 |.while (|len-- > |
|00001760| 30 29 0a 09 09 09 73 75 | 6d 20 2b 3d 20 2a 63 70 |0)....su|m += *cp|
|00001770| 2b 2b 3b 0a 09 09 66 70 | 72 69 6e 74 66 20 28 6b |++;...fp|rintf (k|
|00001780| 66 2c 20 22 25 44 20 25 | 44 5c 6e 22 2c 20 73 75 |f, "%D %|D\n", su|
|00001790| 6d 2c 20 42 45 46 69 6c | 50 6f 73 20 28 62 65 29 |m, BEFil|Pos (be)|
|000017a0| 29 3b 0a 09 7d 0a 09 66 | 63 6c 6f 73 65 20 28 6b |);..}..f|close (k|
|000017b0| 66 29 3b 0a 09 69 66 20 | 28 75 73 65 48 6f 6c 64 |f);..if |(useHold|
|000017c0| 29 09 2f 2a 20 69 66 20 | 75 73 69 6e 67 20 68 6f |)./* if |using ho|
|000017d0| 6c 64 20 66 69 6c 65 2c | 20 63 6c 6f 73 65 20 61 |ld file,| close a|
|000017e0| 6e 64 20 61 74 74 61 63 | 68 20 74 6f 20 73 74 64 |nd attac|h to std|
|000017f0| 69 6e 20 2a 2f 0a 09 7b | 0a 09 09 66 63 6c 6f 73 |in */..{|...fclos|
|00001800| 65 20 28 68 66 29 3b 0a | 09 09 69 66 20 28 66 72 |e (hf);.|..if (fr|
|00001810| 65 6f 70 65 6e 20 28 68 | 6f 6c 64 46 69 6c 65 2c |eopen (h|oldFile,|
|00001820| 20 22 72 22 2c 20 73 74 | 64 69 6e 29 20 3d 3d 20 | "r", st|din) == |
|00001830| 4e 55 4c 4c 29 0a 09 09 | 09 70 61 6e 69 63 20 28 |NULL)...|.panic (|
|00001840| 22 43 61 6e 27 74 20 72 | 65 6f 70 65 6e 20 68 6f |"Can't r|eopen ho|
|00001850| 6c 64 20 66 69 6c 65 2e | 22 29 3b 0a 09 7d 0a 09 |ld file.|");..}..|
|00001860| 69 66 20 28 72 65 73 75 | 6c 74 20 3c 20 30 20 7c |if (resu|lt < 0 ||
|00001870| 7c 20 65 6d 70 74 79 29 | 0a 09 7b 0a 09 09 63 6c || empty)|..{...cl|
|00001880| 65 61 6e 75 70 20 28 29 | 3b 0a 09 09 65 78 69 74 |eanup ()|;...exit|
|00001890| 20 28 30 29 3b 0a 09 7d | 0a 09 69 66 20 28 76 65 | (0);..}|..if (ve|
|000018a0| 72 62 6f 73 65 29 0a 09 | 09 66 70 72 69 6e 74 66 |rbose)..|.fprintf|
|000018b0| 20 28 73 74 64 65 72 72 | 2c 20 22 5c 6e 50 61 73 | (stderr|, "\nPas|
|000018c0| 73 20 31 20 64 6f 6e 65 | 20 28 25 64 20 63 69 74 |s 1 done| (%d cit|
|000018d0| 61 74 69 6f 6e 73 29 5c | 6e 22 2c 20 63 6f 75 6e |ations)\|n", coun|
|000018e0| 74 29 3b 0a 0a 2f 2a 0a | 09 50 61 73 73 20 74 77 |t);../*.|.Pass tw|
|000018f0| 6f 2e 20 20 53 6f 72 74 | 20 74 68 65 20 6b 65 79 |o. Sort| the key|
|00001900| 73 20 73 6f 20 64 75 70 | 6c 69 63 61 74 65 73 20 |s so dup|licates |
|00001910| 77 69 6c 6c 20 63 6c 75 | 73 74 65 72 2c 20 61 6e |will clu|ster, an|
|00001920| 64 20 75 6e 69 71 0a 09 | 74 68 65 6d 2e 0a 2a 2f |d uniq..|them..*/|
|00001930| 0a 0a 09 69 66 20 28 76 | 65 72 62 6f 73 65 29 0a |...if (v|erbose).|
|00001940| 09 09 66 70 72 69 6e 74 | 66 20 28 73 74 64 65 72 |..fprint|f (stder|
|00001950| 72 2c 20 22 53 6f 72 74 | 69 6e 67 20 6b 65 79 73 |r, "Sort|ing keys|
|00001960| 5c 6e 22 29 3b 0a 09 73 | 70 72 69 6e 74 66 20 28 |\n");..s|printf (|
|00001970| 62 75 66 2c 20 22 65 78 | 65 63 20 73 6f 72 74 20 |buf, "ex|ec sort |
|00001980| 2d 6f 20 25 73 20 25 73 | 22 2c 20 6b 65 79 46 69 |-o %s %s|", keyFi|
|00001990| 6c 65 2c 20 6b 65 79 46 | 69 6c 65 29 3b 0a 09 73 |le, keyF|ile);..s|
|000019a0| 79 73 74 65 6d 20 28 62 | 75 66 29 3b 0a 09 69 66 |ystem (b|uf);..if|
|000019b0| 20 28 76 65 72 62 6f 73 | 65 29 0a 09 09 66 70 72 | (verbos|e)...fpr|
|000019c0| 69 6e 74 66 20 28 73 74 | 64 65 72 72 2c 20 22 53 |intf (st|derr, "S|
|000019d0| 6f 72 74 20 64 6f 6e 65 | 5c 6e 22 29 3b 0a 09 69 |ort done|\n");..i|
|000019e0| 66 20 28 28 6b 66 20 3d | 20 66 6f 70 65 6e 20 28 |f ((kf =| fopen (|
|000019f0| 6b 65 79 46 69 6c 65 2c | 20 22 72 22 29 29 20 3d |keyFile,| "r")) =|
|00001a00| 3d 20 4e 55 4c 4c 29 0a | 09 09 70 61 6e 69 63 20 |= NULL).|..panic |
|00001a10| 28 22 43 61 6e 27 74 20 | 72 65 6f 70 65 6e 20 6b |("Can't |reopen k|
|00001a20| 65 79 20 66 69 6c 65 2e | 22 29 3b 0a 09 55 6e 69 |ey file.|");..Uni|
|00001a30| 71 42 69 62 20 28 6b 66 | 29 3b 0a 09 66 63 6c 6f |qBib (kf|);..fclo|
|00001a40| 73 65 20 28 6b 66 29 3b | 0a 09 69 66 20 28 76 65 |se (kf);|..if (ve|
|00001a50| 72 62 6f 73 65 29 0a 09 | 09 66 70 72 69 6e 74 66 |rbose)..|.fprintf|
|00001a60| 20 28 73 74 64 65 72 72 | 2c 20 22 5c 6e 44 6f 6e | (stderr|, "\nDon|
|00001a70| 65 5c 6e 22 29 3b 0a 09 | 63 6c 65 61 6e 75 70 20 |e\n");..|cleanup |
|00001a80| 28 29 3b 0a 09 65 78 69 | 74 20 28 30 29 3b 0a 7d |();..exi|t (0);.}|
|00001a90| 0a 0a 0a 0a 2f 2a 0a 09 | 54 68 65 20 75 67 6c 79 |..../*..|The ugly|
|00001aa0| 20 68 65 61 72 74 20 6f | 66 20 74 68 65 20 70 72 | heart o|f the pr|
|00001ab0| 6f 67 72 61 6d 2e 0a 0a | 09 52 65 61 64 20 63 68 |ogram...|.Read ch|
|00001ac0| 65 63 6b 73 75 6d 2f 66 | 69 6c 65 2d 70 6f 73 69 |ecksum/f|ile-posi|
|00001ad0| 74 69 6f 6e 20 70 61 69 | 72 73 20 66 72 6f 6d 20 |tion pai|rs from |
|00001ae0| 66 2e 20 20 49 74 27 73 | 20 73 6f 72 74 65 64 20 |f. It's| sorted |
|00001af0| 6f 6e 20 63 68 65 63 6b | 73 75 6d 2c 0a 09 73 6f |on check|sum,..so|
|00001b00| 20 74 68 61 74 20 61 6c | 6c 20 67 72 6f 75 70 73 | that al|l groups|
|00001b10| 20 6f 66 20 69 64 65 6e | 74 69 63 61 6c 20 63 68 | of iden|tical ch|
|00001b20| 65 63 6b 73 75 6d 73 20 | 77 69 6c 6c 20 63 6c 75 |ecksums |will clu|
|00001b30| 73 74 65 72 2e 20 20 54 | 68 65 0a 09 62 69 62 20 |ster. T|he..bib |
|00001b40| 65 6e 74 72 69 65 73 20 | 77 69 74 68 69 6e 20 65 |entries |within e|
|00001b50| 61 63 68 20 63 6c 75 73 | 74 65 72 20 6d 61 79 20 |ach clus|ter may |
|00001b60| 6f 72 20 2a 6d 61 79 20 | 6e 6f 74 2a 20 62 65 20 |or *may |not* be |
|00001b70| 63 6f 6e 74 65 6e 74 2d | 69 64 65 6e 74 69 63 61 |content-|identica|
|00001b80| 6c 2c 0a 09 73 6f 20 74 | 68 65 20 61 6c 67 6f 72 |l,..so t|he algor|
|00001b90| 69 74 68 6d 20 68 61 6e | 67 73 20 6f 6e 74 6f 20 |ithm han|gs onto |
|00001ba0| 65 61 63 68 20 65 6e 74 | 72 79 20 75 6e 74 69 6c |each ent|ry until|
|00001bb0| 20 69 74 20 65 69 74 68 | 65 72 20 6b 6e 6f 77 73 | it eith|er knows|
|00001bc0| 20 69 74 27 73 0a 09 75 | 6e 69 71 75 65 20 6f 72 | it's..u|nique or|
|00001bd0| 20 74 68 61 74 20 69 74 | 27 73 20 61 20 64 75 70 | that it|'s a dup|
|00001be0| 2c 20 61 73 20 66 6f 6c | 6c 6f 77 73 3a 0a 0a 09 |, as fol|lows:...|
|00001bf0| 46 69 72 73 74 20 72 65 | 61 64 20 6f 6e 65 20 6c |First re|ad one l|
|00001c00| 69 6e 65 20 61 6e 64 20 | 68 6f 6c 64 20 6f 6e 74 |ine and |hold ont|
|00001c10| 6f 20 69 74 20 66 6f 72 | 20 61 20 72 65 66 65 72 |o it for| a refer|
|00001c20| 65 6e 63 65 2e 20 20 54 | 68 65 6e 20 72 65 61 64 |ence. T|hen read|
|00001c30| 20 72 65 73 74 0a 09 6f | 66 20 6c 69 6e 65 73 2e | rest..o|f lines.|
|00001c40| 20 20 49 66 20 63 68 65 | 63 6b 73 75 6d 20 69 73 | If che|cksum is|
|00001c50| 20 64 69 66 66 65 72 65 | 6e 74 2c 20 66 6c 75 73 | differe|nt, flus|
|00001c60| 68 20 74 68 65 20 72 65 | 66 65 72 65 6e 63 65 20 |h the re|ference |
|00001c70| 61 6e 64 20 72 65 73 74 | 61 72 74 0a 09 77 69 74 |and rest|art..wit|
|00001c80| 68 20 74 68 65 20 6e 65 | 78 74 20 6c 69 6e 65 20 |h the ne|xt line |
|00001c90| 61 66 74 65 72 20 74 68 | 65 20 72 65 66 65 72 65 |after th|e refere|
|00001ca0| 6e 63 65 20 61 73 20 74 | 68 65 20 6e 65 77 20 72 |nce as t|he new r|
|00001cb0| 65 66 65 72 65 6e 63 65 | 2e 20 20 49 66 20 74 68 |eference|. If th|
|00001cc0| 65 0a 09 63 68 65 63 6b | 73 75 6d 20 69 73 20 74 |e..check|sum is t|
|00001cd0| 68 65 20 73 61 6d 65 2c | 20 74 68 65 6e 20 64 6f |he same,| then do|
|00001ce0| 20 61 20 64 69 72 65 63 | 74 20 63 6f 6d 70 61 72 | a direc|t compar|
|00001cf0| 65 20 6f 66 20 74 68 65 | 20 62 69 62 20 65 6e 74 |e of the| bib ent|
|00001d00| 72 69 65 73 0a 09 74 68 | 65 6d 73 65 6c 76 65 73 |ries..th|emselves|
|00001d10| 2e 20 20 49 66 20 74 68 | 65 79 27 72 65 20 74 68 |. If th|ey're th|
|00001d20| 65 20 73 61 6d 65 2c 20 | 73 6b 69 70 20 74 68 65 |e same, |skip the|
|00001d30| 20 72 65 66 65 72 65 6e | 63 65 20 61 6e 64 20 72 | referen|ce and r|
|00001d40| 65 73 74 61 72 74 20 77 | 69 74 68 0a 09 74 68 65 |estart w|ith..the|
|00001d50| 20 6e 65 78 74 20 6c 69 | 6e 65 20 61 66 74 65 72 | next li|ne after|
|00001d60| 20 74 68 65 20 72 65 66 | 65 72 65 6e 63 65 20 61 | the ref|erence a|
|00001d70| 73 20 74 68 65 20 6e 65 | 77 20 72 65 66 65 72 65 |s the ne|w refere|
|00001d80| 6e 63 65 2e 20 20 49 66 | 20 74 68 65 79 20 61 72 |nce. If| they ar|
|00001d90| 65 0a 09 64 69 66 66 65 | 72 65 6e 74 2c 20 6a 75 |e..diffe|rent, ju|
|00001da0| 73 74 20 6b 65 65 70 20 | 72 65 61 64 69 6e 67 2e |st keep |reading.|
|00001db0| 20 20 28 45 76 65 6e 74 | 75 61 6c 6c 79 20 6f 6e | (Event|ually on|
|00001dc0| 65 20 77 69 6c 6c 20 62 | 65 20 66 6f 75 6e 64 20 |e will b|e found |
|00001dd0| 74 68 61 74 27 73 0a 09 | 65 69 74 68 65 72 20 61 |that's..|either a|
|00001de0| 20 64 69 66 66 65 72 65 | 6e 74 20 63 68 65 63 6b | differe|nt check|
|00001df0| 73 75 6d 20 6f 72 20 69 | 64 65 6e 74 69 63 61 6c |sum or i|dentical|
|00001e00| 2c 20 6f 72 20 45 4f 46 | 20 77 69 6c 6c 20 62 65 |, or EOF| will be|
|00001e10| 20 72 65 61 63 68 65 64 | 2c 20 73 6f 0a 09 74 68 | reached|, so..th|
|00001e20| 65 20 72 65 66 65 72 65 | 6e 63 65 20 63 61 6e 20 |e refere|nce can |
|00001e30| 62 65 20 65 69 74 68 65 | 72 20 66 6c 75 73 68 65 |be eithe|r flushe|
|00001e40| 64 20 6f 72 20 73 6b 69 | 70 70 65 64 2e 29 0a 0a |d or ski|pped.)..|
|00001e50| 09 57 68 65 6e 20 72 65 | 73 74 61 72 74 69 6e 67 |.When re|starting|
|00001e60| 20 73 6f 20 74 68 61 74 | 20 74 68 65 20 72 65 66 | so that| the ref|
|00001e70| 65 72 65 6e 63 65 20 69 | 73 20 62 6f 75 6e 63 65 |erence i|s bounce|
|00001e80| 64 20 74 6f 20 74 68 65 | 20 6e 65 78 74 0a 09 6c |d to the| next..l|
|00001e90| 69 6e 65 20 69 6e 20 74 | 68 65 20 73 75 6d 6d 61 |ine in t|he summa|
|00001ea0| 72 79 20 66 69 6c 65 2c | 20 63 68 65 63 6b 20 66 |ry file,| check f|
|00001eb0| 69 72 73 74 20 77 68 65 | 74 68 65 72 20 74 68 65 |irst whe|ther the|
|00001ec0| 20 63 6f 6d 70 61 72 69 | 73 6f 6e 0a 09 69 73 20 | compari|son..is |
|00001ed0| 74 68 61 74 20 6c 69 6e | 65 2e 20 20 49 66 20 73 |that lin|e. If s|
|00001ee0| 6f 2c 20 64 6f 6e 27 74 | 20 62 6f 74 68 65 72 20 |o, don't| bother |
|00001ef0| 74 6f 20 72 65 72 65 61 | 64 20 74 68 61 74 20 6c |to rerea|d that l|
|00001f00| 69 6e 65 20 6f 72 20 74 | 6f 0a 09 66 65 74 63 68 |ine or t|o..fetch|
|00001f10| 20 74 68 65 20 62 69 62 | 6c 69 6f 67 72 61 70 68 | the bib|liograph|
|00001f20| 69 63 20 65 6e 74 72 79 | 20 69 74 73 65 6c 66 2e |ic entry| itself.|
|00001f30| 20 20 53 69 6e 63 65 20 | 65 78 63 65 70 74 20 69 | Since |except i|
|00001f40| 6e 20 70 65 72 76 65 72 | 73 65 0a 09 63 61 73 65 |n perver|se..case|
|00001f50| 73 20 74 68 65 20 63 6f | 6d 70 61 72 69 73 6f 6e |s the co|mparison|
|00001f60| 20 61 6c 6d 6f 73 74 20 | 61 6c 77 61 79 73 20 62 | almost |always b|
|00001f70| 65 63 6f 6d 65 73 20 74 | 68 65 20 6e 65 78 74 20 |ecomes t|he next |
|00001f80| 72 65 66 65 72 65 6e 63 | 65 2c 20 74 68 69 73 0a |referenc|e, this.|
|00001f90| 09 69 73 20 61 20 62 69 | 67 20 77 69 6e 2e 0a 0a |.is a bi|g win...|
|00001fa0| 2a 2f 0a 0a 55 6e 69 71 | 42 69 62 20 28 66 29 0a |*/..Uniq|Bib (f).|
|00001fb0| 46 49 4c 45 09 2a 66 3b | 0a 7b 0a 6c 6f 6e 67 09 |FILE.*f;|.{.long.|
|00001fc0| 72 65 66 50 6f 73 2c 20 | 63 6f 6d 50 6f 73 3b 09 |refPos, |comPos;.|
|00001fd0| 09 2f 2a 20 72 65 66 65 | 72 65 6e 63 65 20 61 6e |./* refe|rence an|
|00001fe0| 64 20 63 6f 6d 70 61 72 | 69 73 6f 6e 20 73 65 65 |d compar|ison see|
|00001ff0| 6b 20 70 6f 73 69 74 69 | 6f 6e 73 20 2a 2f 0a 6c |k positi|ons */.l|
|00002000| 6f 6e 67 09 72 65 66 43 | 6b 53 75 6d 2c 20 63 6f |ong.refC|kSum, co|
|00002010| 6d 43 6b 53 75 6d 3b 09 | 2f 2a 20 72 65 66 65 72 |mCkSum;.|/* refer|
|00002020| 65 6e 63 65 20 61 6e 64 | 20 63 6f 6d 70 61 72 69 |ence and| compari|
|00002030| 73 6f 6e 20 63 68 65 63 | 6b 73 75 6d 73 20 2a 2f |son chec|ksums */|
|00002040| 0a 69 6e 74 09 67 65 74 | 4e 65 78 74 52 65 66 20 |.int.get|NextRef |
|00002050| 3d 20 31 3b 09 09 2f 2a | 20 6e 6f 6e 2d 7a 65 72 |= 1;../*| non-zer|
|00002060| 6f 20 69 66 20 6e 65 65 | 64 20 74 6f 20 72 65 61 |o if nee|d to rea|
|00002070| 64 20 72 65 66 20 73 75 | 6d 2c 20 70 6f 73 20 2a |d ref su|m, pos *|
|00002080| 2f 0a 6c 6f 6e 67 09 72 | 65 66 4f 66 66 20 3d 20 |/.long.r|efOff = |
|00002090| 30 2c 20 63 6f 6d 4f 66 | 66 3b 09 2f 2a 20 6f 66 |0, comOf|f;./* of|
|000020a0| 66 73 65 74 20 6f 66 20 | 6c 69 6e 65 20 61 66 74 |fset of |line aft|
|000020b0| 65 72 20 72 65 66 65 72 | 65 6e 63 65 2c 20 63 6f |er refer|ence, co|
|000020c0| 6d 70 61 72 69 73 6f 6e | 20 2a 2f 0a 69 6e 74 09 |mparison| */.int.|
|000020d0| 6e 43 6f 6d 70 61 72 65 | 73 20 3d 20 30 3b 09 09 |nCompare|s = 0;..|
|000020e0| 2f 2a 20 6e 75 6d 62 65 | 72 20 6f 66 20 63 6f 6d |/* numbe|r of com|
|000020f0| 70 61 72 69 73 6f 6e 73 | 20 6d 61 64 65 20 77 69 |parisons| made wi|
|00002100| 74 68 20 72 65 66 20 2a | 2f 0a 42 69 62 45 6e 74 |th ref *|/.BibEnt|
|00002110| 09 62 31 2c 20 2a 62 65 | 52 65 66 20 3d 20 26 62 |.b1, *be|Ref = &b|
|00002120| 31 3b 0a 42 69 62 45 6e | 74 09 62 32 2c 20 2a 62 |1;.BibEn|t.b2, *b|
|00002130| 65 43 6f 6d 20 3d 20 26 | 62 32 3b 0a 42 69 62 45 |eCom = &|b2;.BibE|
|00002140| 6e 74 09 2a 62 65 54 6d | 70 3b 0a 69 6e 74 09 6e |nt.*beTm|p;.int.n|
|00002150| 6f 6e 64 75 70 73 20 3d | 20 30 3b 0a 0a 09 69 66 |ondups =| 0;...if|
|00002160| 20 28 76 65 72 62 6f 73 | 65 29 0a 09 09 66 70 72 | (verbos|e)...fpr|
|00002170| 69 6e 74 66 20 28 73 74 | 64 65 72 72 2c 20 22 43 |intf (st|derr, "C|
|00002180| 6f 6d 70 61 72 69 6e 67 | 20 6b 65 79 73 5c 6e 22 |omparing| keys\n"|
|00002190| 29 3b 0a 09 66 6f 72 20 | 28 3b 3b 29 0a 09 7b 0a |);..for |(;;)..{.|
|000021a0| 09 09 69 66 20 28 76 65 | 72 62 6f 73 65 29 0a 09 |..if (ve|rbose)..|
|000021b0| 09 09 66 70 72 69 6e 74 | 66 20 28 73 74 64 65 72 |..fprint|f (stder|
|000021c0| 72 2c 20 22 2e 22 29 3b | 0a 09 09 69 66 20 28 67 |r, ".");|...if (g|
|000021d0| 65 74 4e 65 78 74 52 65 | 66 29 0a 09 09 7b 0a 09 |etNextRe|f)...{..|
|000021e0| 09 09 67 65 74 4e 65 78 | 74 52 65 66 20 3d 20 30 |..getNex|tRef = 0|
|000021f0| 3b 0a 09 09 09 69 66 20 | 28 6e 43 6f 6d 70 61 72 |;....if |(nCompar|
|00002200| 65 73 20 3d 3d 20 31 29 | 09 2f 2a 20 6d 61 6b 65 |es == 1)|./* make|
|00002210| 20 63 6f 6d 70 61 72 69 | 73 6f 6e 20 6e 65 78 74 | compari|son next|
|00002220| 20 72 65 66 20 2a 2f 0a | 09 09 09 7b 0a 09 09 09 | ref */.|...{....|
|00002230| 09 72 65 66 43 6b 53 75 | 6d 20 3d 20 63 6f 6d 43 |.refCkSu|m = comC|
|00002240| 6b 53 75 6d 3b 0a 09 09 | 09 09 72 65 66 50 6f 73 |kSum;...|..refPos|
|00002250| 20 3d 20 63 6f 6d 50 6f | 73 3b 0a 09 09 09 09 72 | = comPo|s;.....r|
|00002260| 65 66 4f 66 66 20 3d 20 | 63 6f 6d 4f 66 66 3b 0a |efOff = |comOff;.|
|00002270| 09 09 09 09 62 65 54 6d | 70 20 3d 20 62 65 52 65 |....beTm|p = beRe|
|00002280| 66 3b 0a 09 09 09 09 62 | 65 52 65 66 20 3d 20 62 |f;.....b|eRef = b|
|00002290| 65 43 6f 6d 3b 0a 09 09 | 09 09 62 65 43 6f 6d 20 |eCom;...|..beCom |
|000022a0| 3d 20 62 65 54 6d 70 3b | 0a 09 09 09 7d 0a 09 09 |= beTmp;|....}...|
|000022b0| 09 65 6c 73 65 09 2f 2a | 20 73 65 65 6b 20 74 6f |.else./*| seek to|
|000022c0| 20 63 6f 72 72 65 63 74 | 20 73 70 6f 74 2c 20 72 | correct| spot, r|
|000022d0| 65 61 64 20 73 75 6d 6d | 61 72 79 20 2a 2f 0a 09 |ead summ|ary */..|
|000022e0| 09 09 7b 09 2f 2a 20 69 | 6e 66 6f 20 61 6e 64 20 |..{./* i|nfo and |
|000022f0| 65 6e 74 72 79 20 66 72 | 6f 6d 20 62 69 62 20 66 |entry fr|om bib f|
|00002300| 69 6c 65 20 2a 2f 0a 09 | 09 09 09 66 73 65 65 6b |ile */..|...fseek|
|00002310| 20 28 66 2c 20 72 65 66 | 4f 66 66 2c 20 30 29 3b | (f, ref|Off, 0);|
|00002320| 0a 09 09 09 09 69 66 20 | 28 66 73 63 61 6e 66 20 |.....if |(fscanf |
|00002330| 28 66 2c 20 22 25 44 20 | 25 44 5c 6e 22 2c 20 26 |(f, "%D |%D\n", &|
|00002340| 72 65 66 43 6b 53 75 6d | 2c 20 26 72 65 66 50 6f |refCkSum|, &refPo|
|00002350| 73 29 0a 09 09 09 09 09 | 09 21 3d 20 32 29 0a 09 |s)......|.!= 2)..|
|00002360| 09 09 09 09 62 72 65 61 | 6b 3b 09 2f 2a 20 6e 6f |....brea|k;./* no|
|00002370| 20 6d 6f 72 65 20 72 65 | 66 73 20 69 6e 20 66 69 | more re|fs in fi|
|00002380| 6c 65 20 2a 2f 0a 09 09 | 09 09 72 65 66 4f 66 66 |le */...|..refOff|
|00002390| 20 3d 20 66 74 65 6c 6c | 20 28 66 29 3b 0a 09 09 | = ftell| (f);...|
|000023a0| 09 09 66 73 65 65 6b 20 | 28 73 74 64 69 6e 2c 20 |..fseek |(stdin, |
|000023b0| 72 65 66 50 6f 73 2c 20 | 30 29 3b 0a 09 09 09 09 |refPos, |0);.....|
|000023c0| 69 66 20 28 21 42 45 52 | 65 61 64 20 28 73 74 64 |if (!BER|ead (std|
|000023d0| 69 6e 2c 20 62 65 52 65 | 66 29 29 0a 09 09 09 09 |in, beRe|f)).....|
|000023e0| 09 70 61 6e 69 63 20 28 | 22 43 61 6e 27 74 20 72 |.panic (|"Can't r|
|000023f0| 65 61 64 20 72 65 66 65 | 72 65 6e 63 65 20 65 6e |ead refe|rence en|
|00002400| 74 72 79 2e 22 29 3b 0a | 09 09 09 7d 0a 09 09 09 |try.");.|...}....|
|00002410| 6e 43 6f 6d 70 61 72 65 | 73 20 3d 20 30 3b 0a 09 |nCompare|s = 0;..|
|00002420| 09 7d 0a 09 09 69 66 20 | 28 66 73 63 61 6e 66 20 |.}...if |(fscanf |
|00002430| 28 66 2c 20 22 25 44 20 | 25 44 5c 6e 22 2c 20 26 |(f, "%D |%D\n", &|
|00002440| 63 6f 6d 43 6b 53 75 6d | 2c 20 26 63 6f 6d 50 6f |comCkSum|, &comPo|
|00002450| 73 29 20 21 3d 20 32 29 | 0a 09 09 7b 0a 09 09 09 |s) != 2)|...{....|
|00002460| 42 45 57 72 69 74 65 20 | 28 73 74 64 6f 75 74 2c |BEWrite |(stdout,|
|00002470| 20 62 65 52 65 66 29 3b | 09 2f 2a 20 66 6c 75 73 | beRef);|./* flus|
|00002480| 68 20 72 65 66 65 72 65 | 6e 63 65 20 2a 2f 0a 09 |h refere|nce */..|
|00002490| 09 09 2b 2b 6e 6f 6e 64 | 75 70 73 3b 0a 09 09 09 |..++nond|ups;....|
|000024a0| 2b 2b 67 65 74 4e 65 78 | 74 52 65 66 3b 0a 09 09 |++getNex|tRef;...|
|000024b0| 09 63 6f 6e 74 69 6e 75 | 65 3b 0a 09 09 7d 0a 09 |.continu|e;...}..|
|000024c0| 09 63 6f 6d 4f 66 66 20 | 3d 20 66 74 65 6c 6c 20 |.comOff |= ftell |
|000024d0| 28 66 29 3b 0a 09 09 66 | 73 65 65 6b 20 28 73 74 |(f);...f|seek (st|
|000024e0| 64 69 6e 2c 20 63 6f 6d | 50 6f 73 2c 20 30 29 3b |din, com|Pos, 0);|
|000024f0| 0a 09 09 69 66 20 28 21 | 42 45 52 65 61 64 20 28 |...if (!|BERead (|
|00002500| 73 74 64 69 6e 2c 20 62 | 65 43 6f 6d 29 29 0a 09 |stdin, b|eCom))..|
|00002510| 09 09 70 61 6e 69 63 20 | 28 22 43 61 6e 27 74 20 |..panic |("Can't |
|00002520| 72 65 61 64 20 63 6f 6d | 70 61 72 69 73 6f 6e 20 |read com|parison |
|00002530| 65 6e 74 72 79 2e 22 29 | 3b 0a 09 09 2b 2b 6e 43 |entry.")|;...++nC|
|00002540| 6f 6d 70 61 72 65 73 3b | 0a 09 09 69 66 20 28 72 |ompares;|...if (r|
|00002550| 65 66 43 6b 53 75 6d 20 | 21 3d 20 63 6f 6d 43 6b |efCkSum |!= comCk|
|00002560| 53 75 6d 29 09 09 2f 2a | 20 64 69 66 66 65 72 65 |Sum)../*| differe|
|00002570| 6e 74 20 2d 20 66 6c 75 | 73 68 20 2a 2f 0a 09 09 |nt - flu|sh */...|
|00002580| 7b 0a 09 09 09 42 45 57 | 72 69 74 65 20 28 73 74 |{....BEW|rite (st|
|00002590| 64 6f 75 74 2c 20 62 65 | 52 65 66 29 3b 09 2f 2a |dout, be|Ref);./*|
|000025a0| 20 63 75 72 72 65 6e 74 | 20 72 65 66 65 72 65 6e | current| referen|
|000025b0| 63 65 20 2a 2f 0a 09 09 | 09 2b 2b 6e 6f 6e 64 75 |ce */...|.++nondu|
|000025c0| 70 73 3b 0a 09 09 7d 0a | 09 09 65 6c 73 65 20 69 |ps;...}.|..else i|
|000025d0| 66 20 28 42 45 43 6d 70 | 20 28 62 65 52 65 66 2c |f (BECmp| (beRef,|
|000025e0| 20 62 65 43 6f 6d 29 29 | 09 09 2f 2a 20 63 6f 6d | beCom))|../* com|
|000025f0| 70 61 72 65 20 64 69 72 | 65 63 74 6c 79 2c 20 2a |pare dir|ectly, *|
|00002600| 2f 0a 09 09 09 63 6f 6e | 74 69 6e 75 65 3b 09 09 |/....con|tinue;..|
|00002610| 09 2f 2a 20 73 6b 69 70 | 20 72 65 66 20 69 66 20 |./* skip| ref if |
|00002620| 64 69 66 66 20 2a 2f 0a | 09 09 2b 2b 67 65 74 4e |diff */.|..++getN|
|00002630| 65 78 74 52 65 66 3b 0a | 09 7d 0a 09 66 70 72 69 |extRef;.|.}..fpri|
|00002640| 6e 74 66 20 28 73 74 64 | 65 72 72 2c 20 22 25 64 |ntf (std|err, "%d|
|00002650| 20 63 69 74 61 74 69 6f | 6e 73 20 28 25 64 20 2b | citatio|ns (%d +|
|00002660| 20 25 64 20 64 75 70 6c | 69 63 61 74 65 73 29 5c | %d dupl|icates)\|
|00002670| 6e 22 2c 0a 09 09 09 63 | 6f 75 6e 74 2c 20 6e 6f |n",....c|ount, no|
|00002680| 6e 64 75 70 73 2c 20 63 | 6f 75 6e 74 2d 6e 6f 6e |ndups, c|ount-non|
|00002690| 64 75 70 73 29 3b 0a 7d | 0a 0a 0a 63 6c 65 61 6e |dups);.}|...clean|
|000026a0| 75 70 20 28 29 0a 7b 0a | 09 28 76 6f 69 64 29 20 |up ().{.|.(void) |
|000026b0| 75 6e 6c 69 6e 6b 20 28 | 6b 65 79 46 69 6c 65 29 |unlink (|keyFile)|
|000026c0| 3b 0a 09 28 76 6f 69 64 | 29 20 75 6e 6c 69 6e 6b |;..(void|) unlink|
|000026d0| 20 28 68 6f 6c 64 46 69 | 6c 65 29 3b 0a 7d 0a 0a | (holdFi|le);.}..|
|000026e0| 6f 6e 69 6e 74 72 20 28 | 29 20 7b 20 70 61 6e 69 |onintr (|) { pani|
|000026f0| 63 20 28 22 5c 6e 49 6e | 74 65 72 72 75 70 74 65 |c ("\nIn|terrupte|
|00002700| 64 2e 2e 2e 22 29 3b 20 | 7d 0a 73 65 74 20 75 70 |d..."); |}.set up|
|00002710| 20 66 69 6c 65 73 2e 20 | 20 49 66 20 61 20 66 69 | files. | If a fi|
|00002720| 6c 65 20 69 73 20 6e 61 | 6d 65 64 2c 20 75 73 65 |le is na|med, use|
|00002730| 0a 09 74 68 61 74 20 66 | 6f 72 20 69 6e 70 75 74 |..that f|or input|
|00002740| 2c 20 65 6c 73 65 20 72 | 65 61 64 20 77 68 61 74 |, else r|ead what|
|00002750| 65 76 65 72 27 73 20 6f | 6e 20 73 74 64 69 6e 20 |ever's o|n stdin |
|00002760| 61 6e 64 20 61 72 72 61 | 6e 67 65 20 74 6f 0a 09 |and arra|nge to..|
|00002770| 68 6f 6c 64 20 61 20 63 | 6f 70 79 20 69 6e 20 61 |hold a c|opy in a|
|00002780| 20 73 65 65 6b 61 62 6c | 65 20 74 65 6d 70 20 66 | seekabl|e temp f|
|00002790| 69 6c 65 2e 0a 2a 2f 0a | 0a 09 2d 2d 61 72 67 63 |ile..*/.|..--argc|
|000027a0| 3b 0a 09 2b 2b 61 72 67 | 76 3b 0a 09 69 66 20 28 |;..++arg|v;..if (|
|000027b0| 61 72 67 63 20 3e 20 30 | 20 26 26 20 73 74 72 63 |argc > 0| && strc|
|000027c0| 6d 70 20 28 2a 61 72 67 | 76 2c 20 22 2d 76 22 29 |mp (*arg|v, "-v")|
|000027d0| 20 3d 3d 20 30 29 0a 09 | 7b 0a 09 09 2b 2b 76 65 | == 0)..|{...++ve|
|000027e0| 72 62 6f 73 65 3b 0a 09 | 09 2d 2d 61 72 67 63 3b |rbose;..|.--argc;|
|000027f0| 0a 09 09 2b 2b 61 72 67 | 76 3b 0a 09 7d 0a 09 69 |...++arg|v;..}..i|
|00002800| 75 6e 69 71 62 69 62 2f | 62 69 62 69 6e 66 6f 2e |uniqbib/|bibinfo.|
|00002810| 68 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |h.......|........|
|00002820| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002830| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002840| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002850| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002860| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00002870| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00002880| 20 20 20 35 30 34 34 20 | 20 34 34 30 34 30 37 31 | 5044 | 4404071|
|00002890| 34 34 30 20 20 20 37 33 | 31 33 00 20 00 00 00 00 |440 73|13. ....|
|000028a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000028b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000028c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000028d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000028e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000028f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002900| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002910| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002920| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002930| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002940| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002980| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002990| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000029a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000029b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000029c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000029d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000029e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000029f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002a00| 2f 2a 0a 09 62 69 62 69 | 6e 66 6f 2e 68 20 2d 20 |/*..bibi|nfo.h - |
|00002a10| 63 6f 6e 73 74 61 6e 74 | 73 2c 20 74 79 70 65 73 |constant|s, types|
|00002a20| 20 61 6e 64 20 76 61 72 | 69 61 62 6c 65 73 20 74 | and var|iables t|
|00002a30| 6f 20 73 75 70 70 6f 72 | 74 20 6f 70 65 72 61 74 |o suppor|t operat|
|00002a40| 69 6f 6e 73 0a 09 6f 6e | 20 62 69 62 6c 69 6f 67 |ions..on| bibliog|
|00002a50| 72 61 70 68 79 20 65 6e | 74 72 69 65 73 2e 0a 0a |raphy en|tries...|
|00002a60| 09 54 68 65 20 42 69 62 | 45 6e 74 20 74 79 70 65 |.The Bib|Ent type|
|00002a70| 20 69 73 20 74 68 65 20 | 62 61 73 69 63 20 75 6e | is the |basic un|
|00002a80| 69 74 20 6f 66 20 62 69 | 62 6c 69 6f 67 72 61 70 |it of bi|bliograp|
|00002a90| 68 69 63 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 2e |hic info|rmation.|
|00002aa0| 0a 09 49 74 20 63 6f 6e | 74 61 69 6e 73 20 61 20 |..It con|tains a |
|00002ab0| 62 75 66 66 65 72 20 68 | 6f 6c 64 69 6e 67 20 74 |buffer h|olding t|
|00002ac0| 68 65 20 74 65 78 74 20 | 6f 66 20 74 68 65 20 65 |he text |of the e|
|00002ad0| 6e 74 72 79 20 28 75 6e | 6d 6f 64 69 66 69 65 64 |ntry (un|modified|
|00002ae0| 29 2c 0a 09 61 6e 64 20 | 73 74 72 75 63 74 75 72 |),..and |structur|
|00002af0| 65 73 20 77 68 69 63 68 | 20 61 72 65 20 73 65 74 |es which| are set|
|00002b00| 20 75 70 20 77 68 65 6e | 20 74 68 65 20 65 6e 74 | up when| the ent|
|00002b10| 72 79 20 69 73 20 72 65 | 61 64 20 69 6e 20 66 72 |ry is re|ad in fr|
|00002b20| 6f 6d 0a 09 61 20 66 69 | 6c 65 2e 20 20 54 68 65 |om..a fi|le. The|
|00002b30| 73 65 20 73 74 72 75 63 | 74 75 72 65 73 20 61 6c |se struc|tures al|
|00002b40| 6c 6f 77 20 65 61 73 79 | 20 61 63 63 65 73 73 20 |low easy| access |
|00002b50| 74 6f 20 74 68 65 20 76 | 61 72 69 6f 75 73 20 66 |to the v|arious f|
|00002b60| 69 65 6c 64 73 0a 09 6f | 66 20 74 68 65 20 65 6e |ields..o|f the en|
|00002b70| 74 72 79 2e 20 20 54 68 | 65 79 20 61 6c 73 6f 20 |try. Th|ey also |
|00002b80| 61 6c 6c 6f 77 20 71 75 | 69 63 6b 20 63 68 65 63 |allow qu|ick chec|
|00002b90| 6b 73 20 61 73 20 74 6f | 20 77 68 65 74 68 65 72 |ks as to| whether|
|00002ba0| 20 61 20 66 69 65 6c 64 | 0a 09 69 73 20 70 72 65 | a field|..is pre|
|00002bb0| 73 65 6e 74 20 69 6e 20 | 74 68 65 20 65 6e 74 72 |sent in |the entr|
|00002bc0| 79 2c 20 68 6f 77 20 6d | 61 6e 79 20 61 75 74 68 |y, how m|any auth|
|00002bd0| 6f 72 73 20 74 68 65 72 | 65 20 61 72 65 2c 20 61 |ors ther|e are, a|
|00002be0| 6e 64 20 73 6f 20 66 6f | 72 74 68 2e 0a 0a 09 4d |nd so fo|rth....M|
|00002bf0| 61 63 72 6f 73 20 61 6e | 64 20 66 75 6e 63 74 69 |acros an|d functi|
|00002c00| 6f 6e 73 20 61 72 65 20 | 75 73 65 64 20 74 6f 20 |ons are |used to |
|00002c10| 61 63 63 65 73 73 20 70 | 61 72 74 73 20 6f 66 20 |access p|arts of |
|00002c20| 72 65 63 6f 72 64 73 2e | 20 20 54 68 69 73 0a 09 |records.| This..|
|00002c30| 61 6c 6c 6f 77 73 20 74 | 68 65 20 75 6e 64 65 72 |allows t|he under|
|00002c40| 6c 79 69 6e 67 20 69 6d | 70 6c 65 6d 65 6e 74 61 |lying im|plementa|
|00002c50| 74 69 6f 6e 20 74 6f 20 | 63 68 61 6e 67 65 20 77 |tion to |change w|
|00002c60| 68 69 6c 65 20 70 72 65 | 73 65 72 76 69 6e 67 0a |hile pre|serving.|
|00002c70| 09 74 68 65 20 70 72 6f | 67 72 61 6d 6d 69 6e 67 |.the pro|gramming|
|00002c80| 20 69 6e 74 65 72 66 61 | 63 65 2e 20 20 43 75 72 | interfa|ce. Cur|
|00002c90| 72 65 6e 74 6c 79 20 74 | 68 65 20 69 6d 70 6c 65 |rently t|he imple|
|00002ca0| 6d 65 6e 74 61 74 69 6f | 6e 20 69 73 0a 09 61 73 |mentatio|n is..as|
|00002cb0| 20 66 6f 6c 6c 6f 77 73 | 3a 0a 0a 09 4c 69 6e 65 | follows|:...Line|
|00002cc0| 73 20 6f 66 20 61 20 62 | 69 62 6c 69 6f 67 72 61 |s of a b|ibliogra|
|00002cd0| 70 68 79 20 65 6e 74 72 | 79 20 61 72 65 20 72 65 |phy entr|y are re|
|00002ce0| 61 64 20 6f 6e 65 20 61 | 66 74 65 72 20 74 68 65 |ad one a|fter the|
|00002cf0| 20 6f 74 68 65 72 0a 09 | 69 6e 74 6f 20 61 20 62 | other..|into a b|
|00002d00| 75 66 66 65 72 2e 20 20 | 41 73 20 65 61 63 68 20 |uffer. |As each |
|00002d10| 69 73 20 72 65 61 64 2c | 20 74 68 65 20 6c 69 6e |is read,| the lin|
|00002d20| 65 73 20 61 72 65 20 63 | 61 74 65 67 6f 72 69 7a |es are c|ategoriz|
|00002d30| 65 64 20 61 6e 64 0a 09 | 69 6e 66 6f 72 6d 61 74 |ed and..|informat|
|00002d40| 69 6f 6e 20 73 65 74 20 | 75 70 20 74 6f 20 61 6c |ion set |up to al|
|00002d50| 6c 6f 77 20 65 61 63 68 | 20 66 69 65 6c 64 20 74 |low each| field t|
|00002d60| 6f 20 62 65 20 61 63 63 | 65 73 73 65 64 20 65 61 |o be acc|essed ea|
|00002d70| 73 69 6c 79 2e 0a 09 46 | 6f 72 20 65 61 63 68 20 |sily...F|or each |
|00002d80| 66 69 65 6c 64 20 28 65 | 78 63 65 70 74 20 61 75 |field (e|xcept au|
|00002d90| 74 68 6f 72 73 29 2c 20 | 6f 6e 65 20 42 69 62 46 |thors), |one BibF|
|00002da0| 6c 64 20 73 74 72 75 63 | 74 20 69 73 20 73 65 74 |ld struc|t is set|
|00002db0| 20 75 70 2e 0a 09 62 66 | 53 74 61 72 74 20 69 73 | up...bf|Start is|
|00002dc0| 20 74 68 65 20 6f 66 66 | 73 65 74 20 69 6e 74 6f | the off|set into|
|00002dd0| 20 74 68 65 20 74 65 78 | 74 20 62 75 66 66 65 72 | the tex|t buffer|
|00002de0| 20 6f 66 20 74 68 65 20 | 62 65 67 69 6e 6e 69 6e | of the |beginnin|
|00002df0| 67 20 6f 66 20 74 68 65 | 0a 09 66 69 65 6c 64 20 |g of the|..field |
|00002e00| 28 73 74 61 72 74 73 20 | 61 74 20 74 68 65 20 25 |(starts |at the %|
|00002e10| 20 69 74 73 65 6c 66 29 | 2c 20 61 6e 64 20 62 66 | itself)|, and bf|
|00002e20| 4c 65 6e 20 69 73 20 74 | 68 65 20 6c 65 6e 67 74 |Len is t|he lengt|
|00002e30| 68 20 6f 66 20 74 68 65 | 0a 09 66 69 65 6c 64 20 |h of the|..field |
|00002e40| 28 69 6e 63 6c 75 64 65 | 73 20 6c 65 6e 67 74 68 |(include|s length|
|00002e50| 20 6f 66 20 61 6c 6c 20 | 63 6f 6e 74 69 6e 75 61 | of all |continua|
|00002e60| 74 69 6f 6e 20 6c 69 6e | 65 73 29 2e 20 20 41 75 |tion lin|es). Au|
|00002e70| 74 68 6f 72 73 20 61 72 | 65 0a 09 61 6e 6f 6d 61 |thors ar|e..anoma|
|00002e80| 6c 6f 75 73 2c 20 73 69 | 6e 63 65 20 74 68 65 72 |lous, si|nce ther|
|00002e90| 65 20 6d 61 79 20 62 65 | 20 6d 61 6e 79 20 6f 66 |e may be| many of|
|00002ea0| 20 74 68 65 6d 3b 20 42 | 69 62 46 6c 64 27 73 20 | them; B|ibFld's |
|00002eb0| 66 6f 72 20 74 68 65 73 | 65 20 61 72 65 0a 09 73 |for thes|e are..s|
|00002ec0| 74 6f 72 65 64 20 61 74 | 20 74 68 65 20 65 6e 64 |tored at| the end|
|00002ed0| 20 6f 66 20 74 68 65 20 | 72 65 67 75 6c 61 72 20 | of the |regular |
|00002ee0| 66 69 65 6c 64 20 61 72 | 72 61 79 2c 20 61 6e 64 |field ar|ray, and|
|00002ef0| 20 74 68 65 72 65 20 69 | 73 20 61 20 63 6f 75 6e | there i|s a coun|
|00002f00| 74 0a 09 76 61 72 69 61 | 62 6c 65 2e 0a 2a 2f 0a |t..varia|ble..*/.|
|00002f10| 0a 23 20 69 66 6e 64 65 | 66 09 4e 55 4c 4c 0a 23 |.# ifnde|f.NULL.#|
|00002f20| 20 64 65 66 69 6e 65 09 | 4e 55 4c 4c 09 28 30 29 | define.|NULL.(0)|
|00002f30| 0a 23 20 65 6e 64 69 66 | 0a 0a 0a 23 20 64 65 66 |.# endif|...# def|
|00002f40| 69 6e 65 09 62 65 4d 61 | 78 42 75 66 09 31 30 32 |ine.beMa|xBuf.102|
|00002f50| 34 09 2f 2a 20 6d 61 78 | 20 73 69 7a 65 20 6f 66 |4./* max| size of|
|00002f60| 20 65 6e 74 72 79 27 73 | 20 74 65 78 74 20 2a 2f | entry's| text */|
|00002f70| 0a 23 20 64 65 66 69 6e | 65 09 62 65 4d 61 78 41 |.# defin|e.beMaxA|
|00002f80| 75 74 68 09 32 30 09 2f | 2a 20 6d 61 78 20 61 75 |uth.20./|* max au|
|00002f90| 74 68 6f 72 73 20 61 6c | 6c 6f 77 65 64 20 2a 2f |thors al|lowed */|
|00002fa0| 0a 0a 0a 74 79 70 65 64 | 65 66 20 73 74 72 75 63 |...typed|ef struc|
|00002fb0| 74 0a 7b 0a 09 69 6e 74 | 09 62 66 53 74 61 72 74 |t.{..int|.bfStart|
|00002fc0| 3b 09 2f 2a 20 69 6e 64 | 65 78 20 6f 66 20 73 74 |;./* ind|ex of st|
|00002fd0| 61 72 74 20 6f 66 20 62 | 69 62 20 66 69 65 6c 64 |art of b|ib field|
|00002fe0| 20 74 65 78 74 20 2a 2f | 0a 09 69 6e 74 09 62 66 | text */|..int.bf|
|00002ff0| 4c 65 6e 3b 09 09 2f 2a | 20 6c 65 6e 67 74 68 20 |Len;../*| length |
|00003000| 6f 66 20 62 69 62 20 66 | 69 65 6c 64 20 74 65 78 |of bib f|ield tex|
|00003010| 74 20 2a 2f 0a 7d 20 42 | 69 62 46 6c 64 3b 0a 0a |t */.} B|ibFld;..|
|00003020| 0a 74 79 70 65 64 65 66 | 20 73 74 72 75 63 74 0a |.typedef| struct.|
|00003030| 7b 0a 09 69 6e 74 09 62 | 65 54 65 78 74 4c 65 6e |{..int.b|eTextLen|
|00003040| 3b 09 09 2f 2a 20 6c 65 | 6e 67 74 68 20 6f 66 20 |;../* le|ngth of |
|00003050| 65 6e 74 72 79 20 74 65 | 78 74 20 2a 2f 0a 09 63 |entry te|xt */..c|
|00003060| 68 61 72 09 62 65 54 65 | 78 74 5b 62 65 4d 61 78 |har.beTe|xt[beMax|
|00003070| 42 75 66 5d 3b 09 2f 2a | 20 65 6e 74 72 79 20 74 |Buf];./*| entry t|
|00003080| 65 78 74 20 2a 2f 0a 09 | 42 69 62 46 6c 64 09 62 |ext */..|BibFld.b|
|00003090| 65 46 6c 64 5b 32 36 2b | 62 65 4d 61 78 41 75 74 |eFld[26+|beMaxAut|
|000030a0| 68 5d 3b 09 2f 2a 20 66 | 69 65 6c 64 20 69 6e 66 |h];./* f|ield inf|
|000030b0| 6f 72 6d 61 74 69 6f 6e | 20 2a 2f 0a 09 69 6e 74 |ormation| */..int|
|000030c0| 09 62 65 41 75 74 68 43 | 6e 74 3b 09 09 2f 2a 20 |.beAuthC|nt;../* |
|000030d0| 6e 75 6d 62 65 72 20 6f | 66 20 61 75 74 68 6f 72 |number o|f author|
|000030e0| 73 20 2a 2f 0a 09 6c 6f | 6e 67 09 62 65 46 69 6c |s */..lo|ng.beFil|
|000030f0| 50 6f 73 3b 09 09 2f 2a | 20 73 74 61 72 74 69 6e |Pos;../*| startin|
|00003100| 67 20 70 6f 73 69 74 69 | 6f 6e 20 69 6e 20 66 69 |g positi|on in fi|
|00003110| 6c 65 20 2a 2f 0a 7d 20 | 42 69 62 45 6e 74 3b 0a |le */.} |BibEnt;.|
|00003120| 0a 0a 2f 2a 0a 09 4d 61 | 63 72 6f 73 20 66 6f 72 |../*..Ma|cros for|
|00003130| 20 61 63 63 65 73 73 69 | 6e 67 20 76 61 72 69 6f | accessi|ng vario|
|00003140| 75 73 20 70 69 65 63 65 | 73 20 6f 66 20 74 68 65 |us piece|s of the|
|00003150| 20 62 69 62 6c 69 6f 67 | 72 61 70 68 69 63 0a 09 | bibliog|raphic..|
|00003160| 65 6e 74 72 79 2e 20 20 | 4d 6f 73 74 20 6f 66 20 |entry. |Most of |
|00003170| 74 68 65 73 65 20 63 61 | 6e 20 62 65 20 75 73 65 |these ca|n be use|
|00003180| 64 20 61 73 20 6c 76 61 | 6c 75 65 73 2e 20 20 41 |d as lva|lues. A|
|00003190| 72 67 75 6d 65 6e 74 73 | 0a 09 73 68 6f 75 6c 64 |rguments|..should|
|000031a0| 20 62 65 20 61 73 20 66 | 6f 6c 6c 6f 77 73 3a 0a | be as f|ollows:.|
|000031b0| 0a 09 42 69 62 45 6e 74 | 09 2a 62 65 0a 09 42 69 |..BibEnt|.*be..Bi|
|000031c0| 62 46 6c 64 09 2a 62 66 | 0a 09 63 68 61 72 09 66 |bFld.*bf|..char.f|
|000031d0| 09 28 27 42 27 2e 2e 27 | 5a 27 29 0a 09 69 6e 74 |.('B'..'|Z')..int|
|000031e0| 09 6e 09 28 30 2e 2e 42 | 45 41 75 74 68 43 6e 74 |.n.(0..B|EAuthCnt|
|000031f0| 28 62 65 29 2d 31 29 0a | 0a 2a 2f 0a 0a 23 20 64 |(be)-1).|.*/..# d|
|00003200| 65 66 69 6e 65 09 42 45 | 54 65 78 74 28 62 65 29 |efine.BE|Text(be)|
|00003210| 09 09 28 62 65 2d 3e 62 | 65 54 65 78 74 29 0a 23 |..(be->b|eText).#|
|00003220| 20 64 65 66 69 6e 65 09 | 42 45 4c 65 6e 28 62 65 | define.|BELen(be|
|00003230| 29 09 09 28 62 65 2d 3e | 62 65 54 65 78 74 4c 65 |)..(be->|beTextLe|
|00003240| 6e 29 0a 23 20 64 65 66 | 69 6e 65 09 42 45 46 69 |n).# def|ine.BEFi|
|00003250| 6c 50 6f 73 28 62 65 29 | 09 09 28 62 65 2d 3e 62 |lPos(be)|..(be->b|
|00003260| 65 46 69 6c 50 6f 73 29 | 0a 0a 23 20 64 65 66 69 |eFilPos)|..# defi|
|00003270| 6e 65 09 42 45 48 61 76 | 65 46 6c 64 28 62 65 2c |ne.BEHav|eFld(be,|
|00003280| 66 29 09 09 28 42 45 46 | 6c 64 4c 65 6e 28 62 65 |f)..(BEF|ldLen(be|
|00003290| 2c 66 29 20 21 3d 20 30 | 29 0a 23 20 64 65 66 69 |,f) != 0|).# defi|
|000032a0| 6e 65 09 42 45 46 6c 64 | 50 74 72 28 62 65 2c 66 |ne.BEFld|Ptr(be,f|
|000032b0| 29 09 09 28 26 28 62 65 | 2d 3e 62 65 46 6c 64 5b |)..(&(be|->beFld[|
|000032c0| 28 66 29 2d 27 41 27 5d | 29 29 0a 0a 23 20 64 65 |(f)-'A']|))..# de|
|000032d0| 66 69 6e 65 09 42 45 46 | 6c 64 53 74 61 72 74 28 |fine.BEF|ldStart(|
|000032e0| 62 66 29 09 09 28 62 66 | 2d 3e 62 66 53 74 61 72 |bf)..(bf|->bfStar|
|000032f0| 74 29 0a 23 20 64 65 66 | 69 6e 65 09 42 45 46 6c |t).# def|ine.BEFl|
|00003300| 64 4c 65 6e 28 62 66 29 | 09 09 28 62 66 2d 3e 62 |dLen(bf)|..(bf->b|
|00003310| 66 4c 65 6e 29 0a 23 20 | 64 65 66 69 6e 65 09 42 |fLen).# |define.B|
|00003320| 45 46 6c 64 54 65 78 74 | 28 62 65 2c 62 66 29 09 |EFldText|(be,bf).|
|00003330| 28 26 28 42 45 54 65 78 | 74 28 62 65 29 5b 42 45 |(&(BETex|t(be)[BE|
|00003340| 46 6c 64 53 74 61 72 74 | 28 62 66 29 5d 29 29 0a |FldStart|(bf)])).|
|00003350| 0a 23 20 64 65 66 69 6e | 65 09 42 45 41 75 74 68 |.# defin|e.BEAuth|
|00003360| 50 74 72 28 62 65 2c 6e | 29 09 09 28 42 45 46 6c |Ptr(be,n|)..(BEFl|
|00003370| 64 50 74 72 28 62 65 2c | 27 5a 27 2b 6e 2b 31 29 |dPtr(be,|'Z'+n+1)|
|00003380| 29 0a 23 20 64 65 66 69 | 6e 65 09 42 45 41 75 74 |).# defi|ne.BEAut|
|00003390| 68 4c 65 6e 28 62 65 2c | 6e 29 09 09 28 42 45 46 |hLen(be,|n)..(BEF|
|000033a0| 6c 64 4c 65 6e 28 62 65 | 2c 27 5a 27 2b 6e 2b 31 |ldLen(be|,'Z'+n+1|
|000033b0| 29 29 0a 23 20 64 65 66 | 69 6e 65 09 42 45 41 75 |)).# def|ine.BEAu|
|000033c0| 74 68 54 65 78 74 28 62 | 65 2c 6e 29 09 28 42 45 |thText(b|e,n).(BE|
|000033d0| 46 6c 64 54 65 78 74 28 | 62 65 2c 27 5a 27 2b 6e |FldText(|be,'Z'+n|
|000033e0| 2b 31 29 29 0a 0a 23 20 | 64 65 66 69 6e 65 09 42 |+1))..# |define.B|
|000033f0| 45 41 75 74 68 43 6e 74 | 28 62 65 29 09 09 28 62 |EAuthCnt|(be)..(b|
|00003400| 65 2d 3e 62 65 41 75 74 | 68 43 6e 74 29 0a 0a 0a |e->beAut|hCnt)...|
|00003410| 42 69 62 45 6e 74 20 2a | 42 45 41 6c 6c 6f 63 20 |BibEnt *|BEAlloc |
|00003420| 28 29 3b 0a 20 65 61 63 | 68 20 63 69 74 61 74 69 |();. eac|h citati|
|00003430| 6f 6e 2c 0a 09 63 6f 6d | 70 75 74 65 20 74 68 65 |on,..com|pute the|
|00003440| 20 6b 65 79 20 61 6e 64 | 20 77 72 69 74 65 20 6f | key and| write o|
|00003450| 75 74 20 74 68 65 20 6b | 65 79 20 61 6e 64 20 66 |ut the k|ey and f|
|00003460| 69 6c 65 20 70 6f 73 69 | 74 69 6f 6e 20 6f 66 20 |ile posi|tion of |
|00003470| 74 68 65 0a 09 63 69 74 | 61 74 69 6f 6e 20 74 6f |the..cit|ation to|
|00003480| 20 74 68 65 20 6b 65 79 | 20 66 69 6c 65 2e 20 20 | the key| file. |
|00003490| 49 66 20 72 65 61 64 69 | 6e 67 20 61 20 70 69 70 |If readi|ng a pip|
|000034a0| 65 20 6f 72 20 72 65 64 | 69 72 65 63 74 65 64 20 |e or red|irected |
|000034b0| 69 6e 70 75 74 0a 09 77 | 72 69 74 65 20 6f 75 74 |input..w|rite out|
|000034c0| 20 74 68 65 20 63 69 74 | 61 74 69 6f 6e 20 74 6f | the cit|ation to|
|000034d0| 20 61 20 68 6f 6c 64 69 | 6e 67 20 66 69 6c 65 20 | a holdi|ng file |
|000034e0| 73 6f 20 63 61 6e 20 72 | 65 2d 72 65 61 64 20 69 |so can r|e-read i|
|000034f0| 74 2e 20 20 49 6e 0a 09 | 74 68 61 74 20 63 61 73 |t. In..|that cas|
|00003500| 65 2c 20 74 68 65 20 66 | 69 6c 65 20 70 6f 73 69 |e, the f|ile posi|
|00003510| 74 69 6f 6e 20 6d 75 73 | 74 20 62 65 20 66 69 78 |tion mus|t be fix|
|00003520| 65 64 2c 20 73 69 6e 63 | 65 20 74 68 65 20 70 6f |ed, sinc|e the po|
|00003530| 73 69 74 69 6f 6e 0a 09 | 69 6e 20 74 68 65 20 68 |sition..|in the h|
|00003540| 6f 6c 64 69 6e 67 20 66 | 69 6c 65 20 6d 61 79 20 |olding f|ile may |
|00003550| 77 65 6c 6c 20 62 65 20 | 64 69 66 66 65 72 65 6e |well be |differen|
|00003560| 74 20 28 65 2e 67 2e 2c | 20 69 66 20 74 68 65 72 |t (e.g.,| if ther|
|00003570| 65 20 61 72 65 0a 09 6d | 75 6c 74 69 70 6c 65 20 |e are..m|ultiple |
|00003580| 62 6c 61 6e 6b 20 6c 69 | 6e 65 73 20 62 65 74 77 |blank li|nes betw|
|00003590| 65 65 6e 20 63 69 74 61 | 74 69 6f 6e 73 20 69 6e |een cita|tions in|
|000035a0| 20 74 68 65 20 6f 72 69 | 67 69 6e 61 6c 20 69 6e | the ori|ginal in|
|000035b0| 70 75 74 29 2e 0a 2a 2f | 0a 0a 09 69 66 20 28 28 |put)..*/|...if ((|
|000035c0| 62 65 20 3d 20 42 45 41 | 6c 6c 6f 63 20 28 29 29 |be = BEA|lloc ())|
|000035d0| 20 3d 3d 20 4e 55 4c 4c | 29 0a 09 09 70 61 6e 69 | == NULL|)...pani|
|000035e0| 63 20 28 22 4f 75 74 20 | 6f 66 20 6d 65 6d 6f 72 |c ("Out |of memor|
|000035f0| 79 2e 22 29 3b 0a 09 69 | 66 20 28 76 65 72 62 6f |y.");..i|f (verbo|
|00003600| 75 6e 69 71 62 69 62 2f | 42 69 62 41 6c 6c 6f 63 |uniqbib/|BibAlloc|
|00003610| 2e 63 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.c......|........|
|00003620| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003630| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003640| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003650| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003660| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00003670| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00003680| 20 20 20 20 33 31 35 20 | 20 34 34 30 34 30 37 31 | 315 | 4404071|
|00003690| 34 34 32 20 20 20 37 33 | 32 33 00 20 00 00 00 00 |442 73|23. ....|
|000036a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000036b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000036c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000036d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000036e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000036f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003700| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003710| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003720| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003730| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003740| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003750| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003760| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003770| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003780| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003790| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000037a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000037b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000037c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000037d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000037e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000037f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003800| 2f 2a 0a 09 42 69 62 45 | 6e 74 20 73 74 72 75 63 |/*..BibE|nt struc|
|00003810| 74 75 72 65 20 61 6c 6c | 6f 63 61 74 69 6f 6e 20 |ture all|ocation |
|00003820| 61 6e 64 20 64 69 73 70 | 6f 73 61 6c 0a 2a 2f 0a |and disp|osal.*/.|
|00003830| 0a 23 20 69 6e 63 6c 75 | 64 65 09 22 62 69 62 69 |.# inclu|de."bibi|
|00003840| 6e 66 6f 2e 68 22 0a 0a | 42 69 62 45 6e 74 20 2a |nfo.h"..|BibEnt *|
|00003850| 42 45 41 6c 6c 6f 63 20 | 28 29 0a 7b 0a 63 68 61 |BEAlloc |().{.cha|
|00003860| 72 09 2a 63 61 6c 6c 6f | 63 20 28 29 3b 0a 0a 09 |r.*callo|c ();...|
|00003870| 72 65 74 75 72 6e 20 28 | 28 42 69 62 45 6e 74 20 |return (|(BibEnt |
|00003880| 2a 29 20 63 61 6c 6c 6f | 63 20 28 31 2c 20 73 69 |*) callo|c (1, si|
|00003890| 7a 65 6f 66 20 28 42 69 | 62 45 6e 74 29 29 29 3b |zeof (Bi|bEnt)));|
|000038a0| 0a 7d 0a 0a 0a 42 45 46 | 72 65 65 20 28 62 70 29 |.}...BEF|ree (bp)|
|000038b0| 0a 42 69 62 45 6e 74 09 | 2a 62 70 3b 0a 7b 0a 09 |.BibEnt.|*bp;.{..|
|000038c0| 66 72 65 65 20 28 62 70 | 29 3b 0a 7d 0a 00 00 00 |free (bp|);.}....|
|000038d0| 14 08 00 00 14 00 08 00 | 4d 61 6b 65 66 69 6c 65 |........|Makefile|
|000038e0| 00 00 00 00 15 08 00 00 | 10 00 04 00 62 61 64 31 |........|....bad1|
|000038f0| 00 00 00 00 17 08 00 00 | 10 00 04 00 62 61 64 32 |........|....bad2|
|00003900| 00 00 00 00 19 08 00 00 | fc 00 04 00 62 61 64 33 |........|....bad3|
|00003910| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003920| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003930| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003940| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003980| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003990| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000039f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003a00| 75 6e 69 71 62 69 62 2f | 42 69 62 43 6d 70 2e 63 |uniqbib/|BibCmp.c|
|00003a10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003a20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003a30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003a40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003a50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003a60| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00003a70| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00003a80| 20 20 20 33 31 32 37 20 | 20 34 34 30 34 30 37 31 | 3127 | 4404071|
|00003a90| 34 34 34 20 20 20 37 30 | 33 36 00 20 00 00 00 00 |444 70|36. ....|
|00003aa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003ab0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003ac0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003ad0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003ae0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003af0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003b90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003ba0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003bb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003bc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003bd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003be0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003bf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003c00| 2f 2a 0a 09 43 6f 6d 70 | 61 72 65 20 74 77 6f 20 |/*..Comp|are two |
|00003c10| 62 69 62 6c 69 6f 67 72 | 61 70 68 69 63 20 65 6e |bibliogr|aphic en|
|00003c20| 74 72 69 65 73 20 66 6f | 72 20 65 71 75 61 6c 69 |tries fo|r equali|
|00003c30| 74 79 2e 20 20 54 68 65 | 79 20 64 6f 0a 09 6e 6f |ty. The|y do..no|
|00003c40| 74 20 6e 65 65 64 20 74 | 6f 20 68 61 76 65 20 74 |t need t|o have t|
|00003c50| 68 65 20 66 69 65 6c 64 | 73 20 69 6e 20 74 68 65 |he field|s in the|
|00003c60| 20 73 61 6d 65 20 6f 72 | 64 65 72 20 28 65 78 63 | same or|der (exc|
|00003c70| 65 70 74 20 74 68 61 74 | 0a 09 61 75 74 68 6f 72 |ept that|..author|
|00003c80| 73 20 6d 75 73 74 20 62 | 65 20 69 6e 20 74 68 65 |s must b|e in the|
|00003c90| 20 73 61 6d 65 20 6f 72 | 64 65 72 29 2c 20 6a 75 | same or|der), ju|
|00003ca0| 73 74 20 74 68 65 20 73 | 61 6d 65 20 66 69 65 6c |st the s|ame fiel|
|00003cb0| 64 73 0a 09 70 72 65 73 | 65 6e 74 2c 20 61 6e 64 |ds..pres|ent, and|
|00003cc0| 20 74 68 65 20 73 61 6d | 65 20 69 6e 66 6f 72 6d | the sam|e inform|
|00003cd0| 61 74 69 6f 6e 20 69 6e | 20 63 6f 72 72 65 73 70 |ation in| corresp|
|00003ce0| 6f 6e 64 69 6e 67 20 66 | 69 65 6c 64 73 2e 0a 0a |onding f|ields...|
|00003cf0| 09 52 65 74 75 72 6e 73 | 3a 0a 0a 09 30 09 62 31 |.Returns|:...0.b1|
|00003d00| 20 3d 20 62 32 0a 09 21 | 30 09 62 31 20 21 3d 20 | = b2..!|0.b1 != |
|00003d10| 62 32 0a 0a 09 54 68 69 | 73 20 73 68 6f 75 6c 64 |b2...Thi|s should|
|00003d20| 20 62 65 20 65 78 74 65 | 6e 64 65 64 20 74 6f 20 | be exte|nded to |
|00003d30| 61 6c 6c 6f 77 20 63 6f | 6d 70 61 72 69 73 6f 6e |allow co|mparison|
|00003d40| 20 74 6f 20 72 65 74 75 | 72 6e 20 6f 72 64 65 72 | to retu|rn order|
|00003d50| 69 6e 67 0a 09 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |ing..inf|ormation|
|00003d60| 20 62 79 20 70 61 73 73 | 69 6e 67 20 69 6e 20 73 | by pass|ing in s|
|00003d70| 6f 72 74 20 6f 72 64 65 | 72 69 6e 67 20 69 6e 66 |ort orde|ring inf|
|00003d80| 6f 72 6d 61 74 69 6f 6e | 2e 0a 0a 09 46 69 72 73 |ormation|....Firs|
|00003d90| 74 20 63 6f 6d 70 61 72 | 65 20 74 68 65 20 6e 75 |t compar|e the nu|
|00003da0| 6d 62 65 72 20 6f 66 20 | 61 75 74 68 6f 72 73 2e |mber of |authors.|
|00003db0| 0a 09 49 66 20 65 71 75 | 61 6c 2c 20 63 6f 6d 70 |..If equ|al, comp|
|00003dc0| 61 72 65 20 74 68 65 20 | 61 75 74 68 6f 72 73 20 |are the |authors |
|00003dd0| 62 79 20 6c 65 6e 67 74 | 68 20 61 6e 64 20 74 65 |by lengt|h and te|
|00003de0| 78 74 2e 0a 09 49 66 20 | 65 71 75 61 6c 2c 20 73 |xt...If |equal, s|
|00003df0| 65 65 20 69 66 20 74 68 | 65 20 73 61 6d 65 20 66 |ee if th|e same f|
|00003e00| 69 65 6c 64 73 20 61 72 | 65 20 70 72 65 73 65 6e |ields ar|e presen|
|00003e10| 74 20 61 6e 64 20 68 61 | 76 65 20 74 68 65 20 73 |t and ha|ve the s|
|00003e20| 61 6d 65 20 6c 65 6e 67 | 74 68 0a 09 61 6e 64 20 |ame leng|th..and |
|00003e30| 74 68 65 20 73 61 6d 65 | 20 74 65 78 74 2e 0a 09 |the same| text...|
|00003e40| 49 66 20 65 71 75 61 6c | 2c 20 74 68 65 79 27 72 |If equal|, they'r|
|00003e50| 65 20 65 71 75 61 6c 2e | 0a 09 4f 74 68 65 72 77 |e equal.|..Otherw|
|00003e60| 69 73 65 2c 20 6e 6f 74 | 2e 0a 2a 2f 0a 0a 23 20 |ise, not|..*/..# |
|00003e70| 69 6e 63 6c 75 64 65 09 | 3c 73 74 64 69 6f 2e 68 |include.|<stdio.h|
|00003e80| 3e 0a 23 20 69 6e 63 6c | 75 64 65 09 22 62 69 62 |>.# incl|ude."bib|
|00003e90| 69 6e 66 6f 2e 68 22 0a | 0a 23 20 75 6e 64 65 66 |info.h".|.# undef|
|00003ea0| 09 44 45 42 55 47 0a 23 | 20 69 66 64 65 66 09 09 |.DEBUG.#| ifdef..|
|00003eb0| 44 45 42 55 47 0a 23 20 | 64 65 66 69 6e 65 09 52 |DEBUG.# |define.R|
|00003ec0| 45 54 55 52 4e 28 78 2c | 79 29 09 72 65 74 75 72 |ETURN(x,|y).retur|
|00003ed0| 6e 20 28 70 72 69 6e 74 | 66 20 28 22 25 73 5c 6e |n (print|f ("%s\n|
|00003ee0| 22 2c 20 78 29 20 3f 20 | 79 20 3a 20 79 29 0a 23 |", x) ? |y : y).#|
|00003ef0| 20 65 6c 73 65 0a 23 20 | 64 65 66 69 6e 65 09 52 | else.# |define.R|
|00003f00| 45 54 55 52 4e 28 78 2c | 79 29 09 72 65 74 75 72 |ETURN(x,|y).retur|
|00003f10| 6e 20 28 79 29 0a 23 20 | 65 6e 64 69 66 0a 0a 42 |n (y).# |endif..B|
|00003f20| 45 43 6d 70 20 28 62 31 | 2c 20 62 32 29 0a 42 69 |ECmp (b1|, b2).Bi|
|00003f30| 62 45 6e 74 09 2a 62 31 | 2c 20 2a 62 32 3b 0a 7b |bEnt.*b1|, *b2;.{|
|00003f40| 0a 69 6e 74 09 69 2c 20 | 6c 65 6e 2c 20 6e 3b 0a |.int.i, |len, n;.|
|00003f50| 42 69 62 46 6c 64 09 2a | 62 66 70 31 2c 20 2a 62 |BibFld.*|bfp1, *b|
|00003f60| 66 70 32 3b 0a 0a 09 69 | 66 20 28 28 6e 20 3d 20 |fp2;...i|f ((n = |
|00003f70| 42 45 41 75 74 68 43 6e | 74 20 28 62 31 29 29 20 |BEAuthCn|t (b1)) |
|00003f80| 21 3d 20 42 45 41 75 74 | 68 43 6e 74 20 28 62 32 |!= BEAut|hCnt (b2|
|00003f90| 29 29 0a 09 09 52 45 54 | 55 52 4e 20 28 22 61 75 |))...RET|URN ("au|
|00003fa0| 74 68 6f 72 20 63 6f 75 | 6e 74 22 2c 20 31 29 3b |thor cou|nt", 1);|
|00003fb0| 0a 09 66 6f 72 20 28 69 | 20 3d 20 30 3b 20 69 20 |..for (i| = 0; i |
|00003fc0| 3c 20 6e 3b 20 69 2b 2b | 29 0a 09 7b 0a 09 09 62 |< n; i++|)..{...b|
|00003fd0| 66 70 31 20 3d 20 42 45 | 41 75 74 68 50 74 72 20 |fp1 = BE|AuthPtr |
|00003fe0| 28 62 31 2c 20 69 29 3b | 0a 09 09 62 66 70 32 20 |(b1, i);|...bfp2 |
|00003ff0| 3d 20 42 45 41 75 74 68 | 50 74 72 20 28 62 32 2c |= BEAuth|Ptr (b2,|
|00004000| 20 69 29 3b 0a 09 09 69 | 66 20 28 28 6c 65 6e 20 | i);...i|f ((len |
|00004010| 3d 20 42 45 46 6c 64 4c | 65 6e 20 28 62 66 70 31 |= BEFldL|en (bfp1|
|00004020| 29 29 20 21 3d 20 42 45 | 46 6c 64 4c 65 6e 20 28 |)) != BE|FldLen (|
|00004030| 62 66 70 32 29 29 0a 09 | 09 09 52 45 54 55 52 4e |bfp2))..|..RETURN|
|00004040| 20 28 22 61 75 74 68 6f | 72 20 6c 65 6e 67 74 68 | ("autho|r length|
|00004050| 22 2c 20 31 29 3b 0a 09 | 09 69 66 20 28 73 74 72 |", 1);..|.if (str|
|00004060| 6e 63 6d 70 20 28 42 45 | 46 6c 64 54 65 78 74 20 |ncmp (BE|FldText |
|00004070| 28 62 31 2c 20 62 66 70 | 31 29 2c 20 42 45 46 6c |(b1, bfp|1), BEFl|
|00004080| 64 54 65 78 74 20 28 62 | 32 2c 20 62 66 70 32 29 |dText (b|2, bfp2)|
|00004090| 2c 20 6c 65 6e 29 29 0a | 09 09 09 52 45 54 55 52 |, len)).|...RETUR|
|000040a0| 4e 20 28 22 61 75 74 68 | 6f 72 20 74 65 78 74 22 |N ("auth|or text"|
|000040b0| 2c 20 31 29 3b 0a 09 7d | 0a 09 66 6f 72 20 28 69 |, 1);..}|..for (i|
|000040c0| 20 3d 20 27 42 27 3b 20 | 69 20 3c 3d 20 27 5a 27 | = 'B'; |i <= 'Z'|
|000040d0| 3b 20 69 2b 2b 29 0a 09 | 7b 0a 2f 2a 0a 09 44 6f |; i++)..|{./*..Do|
|000040e0| 6e 27 74 20 68 61 76 65 | 20 74 6f 20 63 68 65 63 |n't have| to chec|
|000040f0| 6b 20 77 68 65 74 68 65 | 72 20 66 69 65 6c 64 73 |k whethe|r fields|
|00004100| 20 61 72 65 20 70 72 65 | 73 65 6e 74 20 6f 72 20 | are pre|sent or |
|00004110| 6e 6f 74 2c 20 73 69 6e | 63 65 0a 09 6d 69 73 73 |not, sin|ce..miss|
|00004120| 69 6e 67 20 6f 6e 65 73 | 20 68 61 76 65 20 6c 65 |ing ones| have le|
|00004130| 6e 67 74 68 20 7a 65 72 | 6f 20 61 6e 64 20 77 69 |ngth zer|o and wi|
|00004140| 6c 6c 20 63 6f 6d 70 61 | 72 65 20 70 72 6f 70 65 |ll compa|re prope|
|00004150| 72 6c 79 2e 0a 2a 2f 0a | 09 09 62 66 70 31 20 3d |rly..*/.|..bfp1 =|
|00004160| 20 42 45 46 6c 64 50 74 | 72 20 28 62 31 2c 20 69 | BEFldPt|r (b1, i|
|00004170| 29 3b 0a 09 09 62 66 70 | 32 20 3d 20 42 45 46 6c |);...bfp|2 = BEFl|
|00004180| 64 50 74 72 20 28 62 32 | 2c 20 69 29 3b 0a 09 09 |dPtr (b2|, i);...|
|00004190| 69 66 20 28 28 6c 65 6e | 20 3d 20 42 45 46 6c 64 |if ((len| = BEFld|
|000041a0| 4c 65 6e 20 28 62 66 70 | 31 29 29 20 21 3d 20 42 |Len (bfp|1)) != B|
|000041b0| 45 46 6c 64 4c 65 6e 20 | 28 62 66 70 32 29 29 0a |EFldLen |(bfp2)).|
|000041c0| 09 09 09 52 45 54 55 52 | 4e 20 28 22 66 69 65 6c |...RETUR|N ("fiel|
|000041d0| 64 20 6c 65 6e 67 74 68 | 22 2c 20 31 29 3b 0a 09 |d length|", 1);..|
|000041e0| 09 69 66 20 28 73 74 72 | 6e 63 6d 70 20 28 42 45 |.if (str|ncmp (BE|
|000041f0| 46 6c 64 54 65 78 74 20 | 28 62 31 2c 20 62 66 70 |FldText |(b1, bfp|
|00004200| 31 29 2c 20 42 45 46 6c | 64 54 65 78 74 20 28 62 |1), BEFl|dText (b|
|00004210| 32 2c 20 62 66 70 32 29 | 2c 20 6c 65 6e 29 29 0a |2, bfp2)|, len)).|
|00004220| 09 09 09 52 45 54 55 52 | 4e 20 28 22 66 69 65 6c |...RETUR|N ("fiel|
|00004230| 64 20 74 65 78 74 22 2c | 20 31 29 3b 0a 09 7d 0a |d text",| 1);..}.|
|00004240| 09 52 45 54 55 52 4e 20 | 28 22 73 61 6d 65 22 2c |.RETURN |("same",|
|00004250| 20 30 29 3b 0a 7d 0a 2e | 0a 09 4f 74 68 65 72 77 | 0);.}..|..Otherw|
|00004260| 69 73 65 2c 20 6e 6f 74 | 2e 0a 2a 2f 0a 0a 23 20 |ise, not|..*/..# |
|00004270| 69 6e 63 6c 75 64 65 09 | 3c 73 74 64 69 6f 2e 68 |include.|<stdio.h|
|00004280| 3e 0a 23 20 69 6e 63 6c | 75 64 65 09 22 62 69 62 |>.# incl|ude."bib|
|00004290| 69 6e 66 6f 2e 68 22 0a | 0a 23 20 75 6e 64 65 66 |info.h".|.# undef|
|000042a0| 09 44 45 42 55 47 0a 23 | 20 69 66 64 65 66 09 09 |.DEBUG.#| ifdef..|
|000042b0| 44 45 42 55 47 0a 23 20 | 64 65 66 69 6e 65 09 52 |DEBUG.# |define.R|
|000042c0| 45 54 55 52 4e 28 78 2c | 79 29 09 72 65 74 75 72 |ETURN(x,|y).retur|
|000042d0| 6e 20 28 70 72 69 6e 74 | 66 20 28 22 25 73 5c 6e |n (print|f ("%s\n|
|000042e0| 22 2c 20 78 29 20 3f 20 | 79 20 3a 20 79 29 0a 23 |", x) ? |y : y).#|
|000042f0| 20 65 6c 73 65 0a 23 20 | 64 65 66 69 6e 65 09 52 | else.# |define.R|
|00004300| 45 54 55 52 4e 28 78 2c | 79 29 09 72 65 74 75 72 |ETURN(x,|y).retur|
|00004310| 6e 20 28 79 29 0a 23 20 | 65 6e 64 69 66 0a 0a 42 |n (y).# |endif..B|
|00004320| 45 43 6d 70 20 28 62 31 | 2c 20 62 32 29 0a 42 69 |ECmp (b1|, b2).Bi|
|00004330| 62 45 6e 74 09 2a 62 31 | 2c 20 2a 62 32 3b 0a 7b |bEnt.*b1|, *b2;.{|
|00004340| 0a 69 6e 74 09 69 2c 20 | 6c 65 6e 2c 20 6e 3b 0a |.int.i, |len, n;.|
|00004350| 42 69 62 46 6c 64 09 2a | 62 66 70 31 2c 20 2a 62 |BibFld.*|bfp1, *b|
|00004360| 66 70 32 3b 0a 0a 09 69 | 66 20 28 28 6e 20 3d 20 |fp2;...i|f ((n = |
|00004370| 42 45 41 75 74 68 43 6e | 74 20 28 62 31 29 29 20 |BEAuthCn|t (b1)) |
|00004380| 21 3d 20 42 45 41 75 74 | 68 43 6e 74 20 28 62 32 |!= BEAut|hCnt (b2|
|00004390| 29 29 0a 09 09 52 45 54 | 55 52 4e 20 28 22 61 75 |))...RET|URN ("au|
|000043a0| 74 68 6f 72 20 63 6f 75 | 6e 74 22 2c 20 31 29 3b |thor cou|nt", 1);|
|000043b0| 0a 09 66 6f 72 20 28 69 | 20 3d 20 30 3b 20 69 20 |..for (i| = 0; i |
|000043c0| 3c 20 6e 3b 20 69 2b 2b | 29 0a 09 7b 0a 09 09 62 |< n; i++|)..{...b|
|000043d0| 66 70 31 20 3d 20 42 45 | 41 75 74 68 50 74 72 20 |fp1 = BE|AuthPtr |
|000043e0| 28 62 31 2c 20 69 29 3b | 0a 09 09 62 66 70 32 20 |(b1, i);|...bfp2 |
|000043f0| 3d 20 42 45 41 75 74 68 | 50 74 72 20 28 62 32 2c |= BEAuth|Ptr (b2,|
|00004400| 75 6e 69 71 62 69 62 2f | 42 69 62 52 65 61 64 2e |uniqbib/|BibRead.|
|00004410| 63 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |c.......|........|
|00004420| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004430| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004440| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004450| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004460| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00004470| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00004480| 20 20 20 35 32 31 35 20 | 20 34 34 30 34 30 37 31 | 5215 | 4404071|
|00004490| 34 34 37 20 20 20 37 31 | 37 35 00 20 00 00 00 00 |447 71|75. ....|
|000044a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000044b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000044c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000044d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000044e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000044f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004500| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004510| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004520| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004530| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004580| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004590| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000045a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000045b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000045c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000045d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000045e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000045f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004600| 2f 2a 0a 09 52 65 61 64 | 20 61 20 62 69 62 6c 69 |/*..Read| a bibli|
|00004610| 6f 67 72 61 70 68 69 63 | 20 65 6e 74 72 79 20 66 |ographic| entry f|
|00004620| 72 6f 6d 20 61 20 66 69 | 6c 65 2e 0a 0a 09 52 65 |rom a fi|le....Re|
|00004630| 61 64 20 75 6e 74 69 6c | 20 68 61 76 65 20 61 20 |ad until| have a |
|00004640| 6e 6f 6e 2d 62 6c 61 6e | 6b 20 6c 69 6e 65 2c 20 |non-blan|k line, |
|00004650| 74 68 65 6e 20 72 65 61 | 64 20 75 6e 74 69 6c 20 |then rea|d until |
|00004660| 61 20 62 6c 61 6e 6b 20 | 6c 69 6e 65 20 6f 72 0a |a blank |line or.|
|00004670| 09 45 4f 46 2e 20 20 52 | 65 74 75 72 6e 20 6e 75 |.EOF. R|eturn nu|
|00004680| 6d 62 65 72 20 6f 66 20 | 6c 69 6e 65 73 20 69 6e |mber of |lines in|
|00004690| 20 63 69 74 61 74 69 6f | 6e 2e 20 20 28 5a 65 72 | citatio|n. (Zer|
|000046a0| 6f 20 6d 65 61 6e 73 20 | 45 4f 46 2c 20 2d 31 20 |o means |EOF, -1 |
|000046b0| 65 72 72 6f 72 29 2e 0a | 0a 09 45 72 72 6f 72 20 |error)..|..Error |
|000046c0| 61 72 65 20 72 65 74 75 | 72 6e 65 64 20 66 6f 72 |are retu|rned for|
|000046d0| 20 76 61 72 69 6f 75 73 | 20 63 6f 6e 64 69 74 69 | various| conditi|
|000046e0| 6f 6e 73 3a 0a 0a 09 74 | 65 78 74 20 6f 66 20 63 |ons:...t|ext of c|
|000046f0| 69 74 61 74 69 6f 6e 20 | 74 6f 6f 20 6c 6f 6e 67 |itation |too long|
|00004700| 0a 09 6d 6f 72 65 20 74 | 68 61 6e 20 62 65 4d 61 |..more t|han beMa|
|00004710| 78 41 75 74 68 20 61 75 | 74 68 6f 72 73 0a 09 66 |xAuth au|thors..f|
|00004720| 69 72 73 74 20 6c 69 6e | 65 20 64 6f 65 73 20 6e |irst lin|e does n|
|00004730| 6f 74 20 62 65 67 69 6e | 20 77 69 74 68 20 25 0a |ot begin| with %.|
|00004740| 09 25 20 6c 69 6e 65 73 | 20 77 69 74 68 20 6e 6f |.% lines| with no|
|00004750| 6e 2d 63 61 70 69 74 61 | 6c 20 6c 65 74 74 65 72 |n-capita|l letter|
|00004760| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 25 0a 2a 2f 0a | followi|ng %.*/.|
|00004770| 0a 23 20 69 6e 63 6c 75 | 64 65 09 3c 73 74 64 69 |.# inclu|de.<stdi|
|00004780| 6f 2e 68 3e 0a 23 20 69 | 6e 63 6c 75 64 65 09 3c |o.h>.# i|nclude.<|
|00004790| 63 74 79 70 65 2e 68 3e | 0a 23 20 69 6e 63 6c 75 |ctype.h>|.# inclu|
|000047a0| 64 65 09 3c 76 61 72 61 | 72 67 73 2e 68 3e 0a 23 |de.<vara|rgs.h>.#|
|000047b0| 20 69 6e 63 6c 75 64 65 | 09 22 62 69 62 69 6e 66 | include|."bibinf|
|000047c0| 6f 2e 68 22 0a 0a 0a 73 | 74 61 74 69 63 09 6c 6f |o.h"...s|tatic.lo|
|000047d0| 6e 67 09 6c 69 6e 65 20 | 3d 20 30 3b 0a 73 74 61 |ng.line |= 0;.sta|
|000047e0| 74 69 63 09 6c 6f 6e 67 | 09 63 69 74 61 74 69 6f |tic.long|.citatio|
|000047f0| 6e 20 3d 20 30 3b 0a 0a | 0a 42 45 52 65 61 64 20 |n = 0;..|.BERead |
|00004800| 28 66 2c 20 62 69 29 0a | 46 49 4c 45 09 2a 66 3b |(f, bi).|FILE.*f;|
|00004810| 0a 42 69 62 45 6e 74 09 | 2a 62 69 3b 0a 7b 0a 42 |.BibEnt.|*bi;.{.B|
|00004820| 69 62 46 6c 64 09 2a 62 | 66 20 3d 20 4e 55 4c 4c |ibFld.*b|f = NULL|
|00004830| 3b 0a 63 68 61 72 09 2a | 62 70 20 3d 20 42 45 54 |;.char.*|bp = BET|
|00004840| 65 78 74 20 28 62 69 29 | 3b 0a 69 6e 74 09 6c 65 |ext (bi)|;.int.le|
|00004850| 66 74 20 3d 20 73 69 7a | 65 6f 66 20 28 42 45 54 |ft = siz|eof (BET|
|00004860| 65 78 74 20 28 62 69 29 | 29 3b 0a 69 6e 74 09 72 |ext (bi)|);.int.r|
|00004870| 65 61 64 20 3d 20 31 3b | 0a 69 6e 74 09 6e 4c 69 |ead = 1;|.int.nLi|
|00004880| 6e 65 73 20 3d 20 30 3b | 0a 69 6e 74 09 69 2c 20 |nes = 0;|.int.i, |
|00004890| 6c 65 6e 3b 0a 69 6e 74 | 09 63 3b 0a 0a 2f 2a 0a |len;.int|.c;../*.|
|000048a0| 09 49 6e 69 74 69 61 6c | 69 7a 65 20 65 6e 74 72 |.Initial|ize entr|
|000048b0| 79 20 74 6f 20 22 6e 6f | 74 68 69 6e 67 22 0a 2a |y to "no|thing".*|
|000048c0| 2f 0a 0a 09 42 45 4c 65 | 6e 20 28 62 69 29 20 3d |/...BELe|n (bi) =|
|000048d0| 20 30 3b 09 09 09 2f 2a | 20 6e 6f 20 74 65 78 74 | 0;.../*| no text|
|000048e0| 20 2a 2f 0a 09 42 45 41 | 75 74 68 43 6e 74 20 28 | */..BEA|uthCnt (|
|000048f0| 62 69 29 20 3d 20 30 3b | 09 09 09 2f 2a 20 6e 6f |bi) = 0;|.../* no|
|00004900| 20 61 75 74 68 6f 72 73 | 20 2a 2f 0a 09 66 6f 72 | authors| */..for|
|00004910| 20 28 69 20 3d 20 27 41 | 27 3b 20 69 20 3c 3d 20 | (i = 'A|'; i <= |
|00004920| 27 5a 27 3b 20 69 2b 2b | 29 09 09 2f 2a 20 6e 6f |'Z'; i++|)../* no|
|00004930| 20 6f 74 68 65 72 20 66 | 69 65 6c 64 73 2c 20 65 | other f|ields, e|
|00004940| 69 74 68 65 72 20 2a 2f | 0a 09 09 42 45 46 6c 64 |ither */|...BEFld|
|00004950| 4c 65 6e 20 28 42 45 46 | 6c 64 50 74 72 20 28 62 |Len (BEF|ldPtr (b|
|00004960| 69 2c 20 69 29 29 20 3d | 20 30 3b 0a 0a 09 2b 2b |i, i)) =| 0;...++|
|00004970| 63 69 74 61 74 69 6f 6e | 3b 0a 0a 09 77 68 69 6c |citation|;...whil|
|00004980| 65 20 28 72 65 61 64 29 | 0a 09 7b 0a 09 09 2b 2b |e (read)|..{...++|
|00004990| 6c 69 6e 65 3b 0a 09 09 | 69 66 20 28 28 63 20 3d |line;...|if ((c =|
|000049a0| 20 67 65 74 63 20 28 66 | 29 29 20 3d 3d 20 45 4f | getc (f|)) == EO|
|000049b0| 46 29 0a 09 09 09 62 72 | 65 61 6b 3b 0a 09 09 69 |F)....br|eak;...i|
|000049c0| 66 20 28 63 20 3d 3d 20 | 27 5c 6e 27 29 09 09 09 |f (c == |'\n')...|
|000049d0| 2f 2a 20 62 6c 61 6e 6b | 20 6c 69 6e 65 20 2a 2f |/* blank| line */|
|000049e0| 0a 09 09 7b 0a 09 09 09 | 72 65 61 64 20 3d 20 28 |...{....|read = (|
|000049f0| 6e 4c 69 6e 65 73 20 3d | 3d 20 30 29 3b 09 2f 2a |nLines =|= 0);./*|
|00004a00| 20 69 66 20 68 61 76 65 | 6e 27 74 20 73 65 65 6e | if have|n't seen|
|00004a10| 20 72 65 66 2c 20 6b 65 | 65 70 20 2a 2f 0a 09 09 | ref, ke|ep */...|
|00004a20| 09 63 6f 6e 74 69 6e 75 | 65 3b 09 09 2f 2a 20 72 |.continu|e;../* r|
|00004a30| 65 61 64 69 6e 67 2c 20 | 65 6c 73 65 20 73 6b 69 |eading, |else ski|
|00004a40| 70 20 6c 69 6e 65 20 2a | 2f 0a 09 09 7d 0a 09 09 |p line *|/...}...|
|00004a50| 69 66 20 28 2b 2b 6e 4c | 69 6e 65 73 20 3d 3d 20 |if (++nL|ines == |
|00004a60| 31 29 09 09 2f 2a 20 73 | 65 74 20 70 6f 73 20 6f |1)../* s|et pos o|
|00004a70| 6e 20 66 69 72 73 74 20 | 6c 69 6e 65 20 2a 2f 0a |n first |line */.|
|00004a80| 09 09 7b 0a 09 09 09 42 | 45 46 69 6c 50 6f 73 20 |..{....B|EFilPos |
|00004a90| 28 62 69 29 20 3d 20 66 | 74 65 6c 6c 20 28 66 29 |(bi) = f|tell (f)|
|00004aa0| 20 2d 20 31 3b 0a 09 09 | 09 69 66 20 28 63 20 21 | - 1;...|.if (c !|
|00004ab0| 3d 20 27 25 27 29 09 09 | 2f 2a 20 6d 61 6b 65 20 |= '%')..|/* make |
|00004ac0| 73 75 72 65 20 6e 6f 74 | 20 63 6f 6e 74 2e 20 6c |sure not| cont. l|
|00004ad0| 69 6e 65 20 2a 2f 0a 09 | 09 09 7b 0a 09 09 09 09 |ine */..|..{.....|
|00004ae0| 42 52 45 72 72 6f 72 20 | 28 62 69 2c 20 22 46 69 |BRError |(bi, "Fi|
|00004af0| 72 73 74 20 6c 69 6e 65 | 20 69 6e 20 63 69 74 61 |rst line| in cita|
|00004b00| 74 69 6f 6e 20 64 6f 65 | 73 20 6e 6f 74 20 62 65 |tion doe|s not be|
|00004b10| 67 69 6e 20 77 69 74 68 | 20 27 25 25 27 3a 5c 6e |gin with| '%%':\n|
|00004b20| 25 73 5c 6e 22 2c 20 62 | 70 29 3b 0a 09 09 09 09 |%s\n", b|p);.....|
|00004b30| 72 65 74 75 72 6e 20 28 | 2d 31 29 3b 0a 09 09 09 |return (|-1);....|
|00004b40| 7d 0a 09 09 7d 0a 09 09 | 66 6f 72 20 28 6c 65 6e |}...}...|for (len|
|00004b50| 20 3d 20 30 3b 20 6c 65 | 66 74 2d 2d 20 3e 20 30 | = 0; le|ft-- > 0|
|00004b60| 3b 20 29 09 2f 2a 20 72 | 65 61 64 20 6c 69 6e 65 |; )./* r|ead line|
|00004b70| 20 69 6e 74 6f 20 62 75 | 66 66 65 72 20 2a 2f 0a | into bu|ffer */.|
|00004b80| 09 09 7b 0a 09 09 09 62 | 70 5b 6c 65 6e 2b 2b 5d |..{....b|p[len++]|
|00004b90| 20 3d 20 63 3b 0a 09 09 | 09 69 66 20 28 63 20 3d | = c;...|.if (c =|
|00004ba0| 3d 20 27 5c 6e 27 29 09 | 09 2f 2a 20 68 61 76 65 |= '\n').|./* have|
|00004bb0| 20 66 75 6c 6c 20 6c 69 | 6e 65 20 6e 6f 77 20 2a | full li|ne now *|
|00004bc0| 2f 0a 09 09 09 09 62 72 | 65 61 6b 3b 0a 09 09 09 |/.....br|eak;....|
|00004bd0| 69 66 20 28 28 63 20 3d | 20 67 65 74 63 20 28 66 |if ((c =| getc (f|
|00004be0| 29 29 20 3d 3d 20 45 4f | 46 29 0a 09 09 09 7b 0a |)) == EO|F)....{.|
|00004bf0| 09 09 09 09 72 65 61 64 | 20 3d 20 30 3b 09 2f 2a |....read| = 0;./*|
|00004c00| 20 64 6f 6e 65 20 72 65 | 61 64 69 6e 67 20 2a 2f | done re|ading */|
|00004c10| 0a 09 09 09 09 62 72 65 | 61 6b 3b 0a 09 09 09 7d |.....bre|ak;....}|
|00004c20| 0a 09 09 7d 0a 09 09 42 | 45 4c 65 6e 20 28 62 69 |...}...B|ELen (bi|
|00004c30| 29 20 2b 3d 20 6c 65 6e | 3b 0a 09 09 69 66 20 28 |) += len|;...if (|
|00004c40| 6c 65 66 74 20 3c 20 30 | 29 0a 09 09 7b 0a 09 09 |left < 0|)...{...|
|00004c50| 09 42 52 45 72 72 6f 72 | 20 28 62 69 2c 20 22 43 |.BRError| (bi, "C|
|00004c60| 69 74 61 74 69 6f 6e 20 | 74 6f 6f 20 6c 6f 6e 67 |itation |too long|
|00004c70| 2c 20 65 78 63 65 65 64 | 73 20 25 64 20 63 68 61 |, exceed|s %d cha|
|00004c80| 72 61 63 74 65 72 73 5c | 6e 22 2c 20 73 69 7a 65 |racters\|n", size|
|00004c90| 6f 66 20 28 42 45 54 65 | 78 74 20 28 62 69 29 29 |of (BETe|xt (bi))|
|00004ca0| 29 3b 0a 09 09 09 72 65 | 74 75 72 6e 20 28 2d 31 |);....re|turn (-1|
|00004cb0| 29 3b 0a 09 09 7d 0a 09 | 09 69 66 20 28 2a 62 70 |);...}..|.if (*bp|
|00004cc0| 20 3d 3d 20 27 25 27 29 | 09 09 09 2f 2a 20 73 74 | == '%')|.../* st|
|00004cd0| 61 72 74 20 6f 66 20 6e | 65 77 20 66 69 65 6c 64 |art of n|ew field|
|00004ce0| 20 2a 2f 0a 09 09 7b 0a | 09 09 09 69 66 20 28 21 | */...{.|...if (!|
|00004cf0| 69 73 75 70 70 65 72 20 | 28 62 70 5b 31 5d 29 29 |isupper |(bp[1]))|
|00004d00| 0a 09 09 09 7b 0a 09 09 | 09 09 42 52 45 72 72 6f |....{...|..BRErro|
|00004d10| 72 20 28 62 69 2c 20 22 | 42 61 64 20 6b 65 79 20 |r (bi, "|Bad key |
|00004d20| 6c 69 6e 65 5c 6e 22 29 | 3b 0a 09 09 09 09 72 65 |line\n")|;.....re|
|00004d30| 74 75 72 6e 20 28 2d 31 | 29 3b 0a 09 09 09 7d 0a |turn (-1|);....}.|
|00004d40| 09 09 09 2f 2a 62 70 20 | 2b 3d 20 33 3b 09 2f 2a |.../*bp |+= 3;./*|
|00004d50| 20 73 6b 69 70 20 74 6f | 20 62 65 67 69 6e 6e 69 | skip to| beginni|
|00004d60| 6e 67 20 6f 66 20 74 65 | 78 74 20 2a 2f 0a 09 09 |ng of te|xt */...|
|00004d70| 09 2f 2a 6c 65 6e 20 2d | 3d 20 33 3b 09 2f 2a 20 |./*len -|= 3;./* |
|00004d80| 61 64 6a 75 73 74 20 6c | 65 6e 67 74 68 20 6f 66 |adjust l|ength of|
|00004d90| 20 72 65 73 74 20 6f 66 | 20 6c 69 6e 65 20 2a 2f | rest of| line */|
|00004da0| 0a 09 09 09 69 66 20 28 | 62 70 5b 31 5d 20 21 3d |....if (|bp[1] !=|
|00004db0| 20 27 41 27 29 0a 09 09 | 09 09 62 66 20 3d 20 42 | 'A')...|..bf = B|
|00004dc0| 45 46 6c 64 50 74 72 20 | 28 62 69 2c 20 62 70 5b |EFldPtr |(bi, bp[|
|00004dd0| 31 5d 29 3b 0a 09 09 09 | 65 6c 73 65 20 69 66 20 |1]);....|else if |
|00004de0| 28 42 45 41 75 74 68 43 | 6e 74 20 28 62 69 29 20 |(BEAuthC|nt (bi) |
|00004df0| 3e 3d 20 62 65 4d 61 78 | 41 75 74 68 29 0a 09 09 |>= beMax|Auth)...|
|00004e00| 09 7b 0a 09 09 09 09 42 | 52 45 72 72 6f 72 20 28 |.{.....B|RError (|
|00004e10| 62 69 2c 20 22 54 6f 6f | 20 6d 61 6e 79 20 61 75 |bi, "Too| many au|
|00004e20| 74 68 6f 72 73 2c 20 6f | 6e 6c 79 20 25 64 20 61 |thors, o|nly %d a|
|00004e30| 6c 6c 6f 77 65 64 2e 5c | 6e 22 2c 20 62 65 4d 61 |llowed.\|n", beMa|
|00004e40| 78 41 75 74 68 29 3b 0a | 09 09 09 09 72 65 74 75 |xAuth);.|....retu|
|00004e50| 72 6e 20 28 2d 31 29 3b | 0a 09 09 09 7d 0a 09 09 |rn (-1);|....}...|
|00004e60| 09 65 6c 73 65 0a 09 09 | 09 09 62 66 20 3d 20 42 |.else...|..bf = B|
|00004e70| 45 41 75 74 68 50 74 72 | 20 28 62 69 2c 20 42 45 |EAuthPtr| (bi, BE|
|00004e80| 41 75 74 68 43 6e 74 20 | 28 62 69 29 2b 2b 29 3b |AuthCnt |(bi)++);|
|00004e90| 0a 0a 09 09 09 42 45 46 | 6c 64 53 74 61 72 74 20 |.....BEF|ldStart |
|00004ea0| 28 62 66 29 20 3d 20 62 | 70 20 2d 20 42 45 54 65 |(bf) = b|p - BETe|
|00004eb0| 78 74 20 28 62 69 29 3b | 0a 09 09 09 42 45 46 6c |xt (bi);|....BEFl|
|00004ec0| 64 4c 65 6e 20 28 62 66 | 29 20 3d 20 30 3b 0a 09 |dLen (bf|) = 0;..|
|00004ed0| 09 7d 0a 09 09 42 45 46 | 6c 64 4c 65 6e 20 28 62 |.}...BEF|ldLen (b|
|00004ee0| 66 29 20 2b 3d 20 6c 65 | 6e 3b 0a 09 09 62 70 20 |f) += le|n;...bp |
|00004ef0| 2b 3d 20 6c 65 6e 3b 0a | 09 7d 0a 0a 09 72 65 74 |+= len;.|.}...ret|
|00004f00| 75 72 6e 20 28 6e 4c 69 | 6e 65 73 29 3b 0a 7d 0a |urn (nLi|nes);.}.|
|00004f10| 0a 0a 0a 73 74 61 74 69 | 63 20 42 52 45 72 72 6f |...stati|c BRErro|
|00004f20| 72 20 28 76 61 5f 61 6c | 69 73 74 29 0a 76 61 5f |r (va_al|ist).va_|
|00004f30| 64 63 6c 0a 7b 0a 76 61 | 5f 6c 69 73 74 09 61 72 |dcl.{.va|_list.ar|
|00004f40| 67 73 3b 0a 42 69 62 45 | 6e 74 09 2a 62 69 3b 0a |gs;.BibE|nt.*bi;.|
|00004f50| 63 68 61 72 09 2a 66 6d | 74 3b 0a 0a 09 76 61 5f |char.*fm|t;...va_|
|00004f60| 73 74 61 72 74 20 28 61 | 72 67 73 29 3b 0a 09 62 |start (a|rgs);..b|
|00004f70| 69 20 3d 20 76 61 5f 61 | 72 67 20 28 61 72 67 73 |i = va_a|rg (args|
|00004f80| 2c 20 42 69 62 45 6e 74 | 20 2a 29 3b 0a 09 66 6d |, BibEnt| *);..fm|
|00004f90| 74 20 3d 20 76 61 5f 61 | 72 67 20 28 61 72 67 73 |t = va_a|rg (args|
|00004fa0| 2c 20 63 68 61 72 20 2a | 29 3b 0a 09 66 70 72 69 |, char *|);..fpri|
|00004fb0| 6e 74 66 20 28 73 74 64 | 65 72 72 2c 20 22 45 72 |ntf (std|err, "Er|
|00004fc0| 72 6f 72 20 61 74 20 6c | 69 6e 65 20 25 44 20 28 |ror at l|ine %D (|
|00004fd0| 69 6e 20 63 69 74 61 74 | 69 6f 6e 20 25 44 29 5c |in citat|ion %D)\|
|00004fe0| 6e 22 2c 20 6c 69 6e 65 | 2c 20 63 69 74 61 74 69 |n", line|, citati|
|00004ff0| 6f 6e 29 3b 0a 09 76 66 | 70 72 69 6e 74 66 20 28 |on);..vf|printf (|
|00005000| 73 74 64 65 72 72 2c 20 | 66 6d 74 2c 20 61 72 67 |stderr, |fmt, arg|
|00005010| 73 29 3b 0a 09 69 66 20 | 28 42 45 4c 65 6e 20 28 |s);..if |(BELen (|
|00005020| 62 69 29 20 3e 20 30 29 | 0a 09 7b 0a 09 09 66 70 |bi) > 0)|..{...fp|
|00005030| 72 69 6e 74 66 20 28 73 | 74 64 65 72 72 2c 20 22 |rintf (s|tderr, "|
|00005040| 54 65 78 74 20 6f 66 20 | 65 6e 74 72 79 20 75 70 |Text of |entry up|
|00005050| 20 74 6f 20 65 72 72 6f | 72 3a 5c 6e 22 29 3b 0a | to erro|r:\n");.|
|00005060| 09 09 42 45 57 72 69 74 | 65 20 28 73 74 64 65 72 |..BEWrit|e (stder|
|00005070| 72 2c 20 62 69 29 3b 0a | 09 7d 0a 09 76 61 5f 65 |r, bi);.|.}..va_e|
|00005080| 6e 64 20 28 61 72 67 73 | 29 3b 0a 7d 0a 2e 20 20 |nd (args|);.}.. |
|00005090| 49 66 20 72 65 61 64 69 | 6e 67 20 61 20 70 69 70 |If readi|ng a pip|
|000050a0| 65 20 6f 72 20 72 65 64 | 69 72 65 63 74 65 64 20 |e or red|irected |
|000050b0| 69 6e 70 75 74 0a 09 77 | 72 69 74 65 20 6f 75 74 |input..w|rite out|
|000050c0| 20 74 68 65 20 63 69 74 | 61 74 69 6f 6e 20 74 6f | the cit|ation to|
|000050d0| 20 61 20 68 6f 6c 64 69 | 6e 67 20 66 69 6c 65 20 | a holdi|ng file |
|000050e0| 73 6f 20 63 61 6e 20 72 | 65 2d 72 65 61 64 20 69 |so can r|e-read i|
|000050f0| 74 2e 20 20 49 6e 0a 09 | 74 68 61 74 20 63 61 73 |t. In..|that cas|
|00005100| 65 2c 20 74 68 65 20 66 | 69 6c 65 20 70 6f 73 69 |e, the f|ile posi|
|00005110| 74 69 6f 6e 20 6d 75 73 | 74 20 62 65 20 66 69 78 |tion mus|t be fix|
|00005120| 65 64 2c 20 73 69 6e 63 | 65 20 74 68 65 20 70 6f |ed, sinc|e the po|
|00005130| 73 69 74 69 6f 6e 0a 09 | 69 6e 20 74 68 65 20 68 |sition..|in the h|
|00005140| 6f 6c 64 69 6e 67 20 66 | 69 6c 65 20 6d 61 79 20 |olding f|ile may |
|00005150| 77 65 6c 6c 20 62 65 20 | 64 69 66 66 65 72 65 6e |well be |differen|
|00005160| 74 20 28 65 2e 67 2e 2c | 20 69 66 20 74 68 65 72 |t (e.g.,| if ther|
|00005170| 65 20 61 72 65 0a 09 6d | 75 6c 74 69 70 6c 65 20 |e are..m|ultiple |
|00005180| 62 6c 61 6e 6b 20 6c 69 | 6e 65 73 20 62 65 74 77 |blank li|nes betw|
|00005190| 65 65 6e 20 63 69 74 61 | 74 69 6f 6e 73 20 69 6e |een cita|tions in|
|000051a0| 20 74 68 65 20 6f 72 69 | 67 69 6e 61 6c 20 69 6e | the ori|ginal in|
|000051b0| 70 75 74 29 2e 0a 2a 2f | 0a 0a 09 69 66 20 28 28 |put)..*/|...if ((|
|000051c0| 62 65 20 3d 20 42 45 41 | 6c 6c 6f 63 20 28 29 29 |be = BEA|lloc ())|
|000051d0| 20 3d 3d 20 4e 55 4c 4c | 29 0a 09 09 70 61 6e 69 | == NULL|)...pani|
|000051e0| 63 20 28 22 4f 75 74 20 | 6f 66 20 6d 65 6d 6f 72 |c ("Out |of memor|
|000051f0| 79 2e 22 29 3b 0a 09 69 | 66 20 28 76 65 72 62 6f |y.");..i|f (verbo|
|00005200| 75 6e 69 71 62 69 62 2f | 42 69 62 57 72 69 74 65 |uniqbib/|BibWrite|
|00005210| 2e 63 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.c......|........|
|00005220| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005260| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00005270| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00005280| 20 20 20 20 34 31 31 20 | 20 34 34 30 34 30 37 31 | 411 | 4404071|
|00005290| 34 35 31 20 20 20 37 33 | 36 30 00 20 00 00 00 00 |451 73|60. ....|
|000052a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000052b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000052c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000052d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000052e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000052f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005300| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005310| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005320| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005330| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005340| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005380| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005390| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000053a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000053b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000053c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000053d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000053e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000053f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005400| 2f 2a 0a 09 57 72 69 74 | 65 20 61 20 62 69 62 6c |/*..Writ|e a bibl|
|00005410| 69 6f 67 72 61 70 68 69 | 63 20 65 6e 74 72 79 20 |iographi|c entry |
|00005420| 74 6f 20 61 20 66 69 6c | 65 2e 20 20 54 68 69 73 |to a fil|e. This|
|00005430| 20 69 73 20 73 69 6d 70 | 6c 65 3b 20 6a 75 73 74 | is simp|le; just|
|00005440| 0a 09 77 72 69 74 65 20 | 61 20 6e 65 77 6c 69 6e |..write |a newlin|
|00005450| 65 20 66 6f 6c 6c 6f 77 | 65 64 20 62 79 20 74 68 |e follow|ed by th|
|00005460| 65 20 74 65 78 74 20 6f | 66 20 74 68 65 20 65 6e |e text o|f the en|
|00005470| 74 72 79 2e 0a 2a 2f 0a | 0a 23 20 69 6e 63 6c 75 |try..*/.|.# inclu|
|00005480| 64 65 09 3c 73 74 64 69 | 6f 2e 68 3e 0a 23 20 69 |de.<stdi|o.h>.# i|
|00005490| 6e 63 6c 75 64 65 09 22 | 62 69 62 69 6e 66 6f 2e |nclude."|bibinfo.|
|000054a0| 68 22 0a 0a 0a 42 45 57 | 72 69 74 65 20 28 66 2c |h"...BEW|rite (f,|
|000054b0| 20 62 65 29 0a 46 49 4c | 45 09 2a 66 3b 0a 42 69 | be).FIL|E.*f;.Bi|
|000054c0| 62 45 6e 74 09 2a 62 65 | 3b 0a 7b 0a 09 66 70 75 |bEnt.*be|;.{..fpu|
|000054d0| 74 63 20 28 27 5c 6e 27 | 2c 20 66 29 3b 0a 09 66 |tc ('\n'|, f);..f|
|000054e0| 77 72 69 74 65 20 28 42 | 45 54 65 78 74 20 28 62 |write (B|EText (b|
|000054f0| 65 29 2c 20 31 2c 20 42 | 45 4c 65 6e 20 28 62 65 |e), 1, B|ELen (be|
|00005500| 29 2c 20 66 29 3b 0a 7d | 0a 00 04 00 62 61 64 33 |), f);.}|....bad3|
|00005510| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005520| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005530| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005580| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005590| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000055a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000055b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000055c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000055d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000055e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000055f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005600| 75 6e 69 71 62 69 62 2f | 70 61 6e 69 63 2e 63 00 |uniqbib/|panic.c.|
|00005610| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005620| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005630| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005640| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005650| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005660| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00005670| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00005680| 20 20 20 31 32 33 36 20 | 20 34 34 30 34 30 37 31 | 1236 | 4404071|
|00005690| 34 35 33 20 20 20 36 37 | 37 33 00 20 00 00 00 00 |453 67|73. ....|
|000056a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000056b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000056c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000056d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000056e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000056f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005700| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005710| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005720| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005730| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005740| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005750| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005760| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005770| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005780| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005790| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000057a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000057b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000057c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000057d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000057e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000057f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005800| 2f 2a 0a 09 70 61 6e 69 | 63 20 2d 20 70 72 69 6e |/*..pani|c - prin|
|00005810| 74 20 6d 65 73 73 61 67 | 65 20 61 6e 64 20 64 69 |t messag|e and di|
|00005820| 65 20 77 69 74 68 20 73 | 74 61 74 75 73 20 31 2e |e with s|tatus 1.|
|00005830| 20 20 55 73 65 73 20 76 | 70 72 69 6e 74 66 0a 09 | Uses v|printf..|
|00005840| 73 6f 20 74 68 61 74 20 | 70 61 6e 69 63 20 63 61 |so that |panic ca|
|00005850| 6e 20 74 61 6b 65 20 76 | 61 72 69 61 62 6c 65 20 |n take v|ariable |
|00005860| 61 72 67 75 6d 65 6e 74 | 20 6c 69 73 74 73 2e 0a |argument| lists..|
|00005870| 0a 09 73 65 74 70 61 6e | 69 63 68 6f 6f 6b 20 2d |..setpan|ichook -|
|00005880| 20 69 6e 73 74 61 6c 6c | 20 66 75 6e 63 74 69 6f | install| functio|
|00005890| 6e 20 74 6f 20 62 65 20 | 63 61 6c 6c 65 64 20 77 |n to be |called w|
|000058a0| 69 74 68 20 6e 6f 20 61 | 72 67 75 6d 65 6e 74 73 |ith no a|rguments|
|000058b0| 0a 09 61 66 74 65 72 20 | 70 72 69 6e 74 69 6e 67 |..after |printing|
|000058c0| 20 70 61 6e 69 63 20 6d | 65 73 73 61 67 65 20 61 | panic m|essage a|
|000058d0| 6e 64 20 62 65 66 6f 72 | 65 20 65 78 69 74 69 6e |nd befor|e exitin|
|000058e0| 67 2e 20 20 43 61 6e 20 | 62 65 20 75 73 65 64 0a |g. Can |be used.|
|000058f0| 09 66 6f 72 20 61 64 64 | 69 74 69 6f 6e 61 6c 20 |.for add|itional |
|00005900| 63 6c 65 61 6e 75 70 2c | 20 6c 69 6b 65 20 72 65 |cleanup,| like re|
|00005910| 6d 6f 76 69 6e 67 20 74 | 65 6d 70 20 66 69 6c 65 |moving t|emp file|
|00005920| 73 2c 20 65 74 63 2e 0a | 2a 2f 0a 0a 23 20 69 6e |s, etc..|*/..# in|
|00005930| 63 6c 75 64 65 09 3c 73 | 74 64 69 6f 2e 68 3e 0a |clude.<s|tdio.h>.|
|00005940| 23 20 69 6e 63 6c 75 64 | 65 09 3c 76 61 72 61 72 |# includ|e.<varar|
|00005950| 67 73 2e 68 3e 0a 0a 0a | 73 74 61 74 69 63 09 69 |gs.h>...|static.i|
|00005960| 6e 74 09 28 2a 70 61 6e | 69 63 68 6f 6f 6b 29 20 |nt.(*pan|ichook) |
|00005970| 28 29 20 3d 20 4e 55 4c | 4c 3b 0a 0a 76 6f 69 64 |() = NUL|L;..void|
|00005980| 20 73 65 74 70 61 6e 69 | 63 68 6f 6f 6b 20 28 70 | setpani|chook (p|
|00005990| 29 0a 69 6e 74 09 28 2a | 70 29 20 28 29 3b 0a 7b |).int.(*|p) ();.{|
|000059a0| 0a 09 70 61 6e 69 63 68 | 6f 6f 6b 20 3d 20 70 3b |..panich|ook = p;|
|000059b0| 0a 7d 0a 0a 0a 76 6f 69 | 64 0a 70 61 6e 69 63 20 |.}...voi|d.panic |
|000059c0| 28 76 61 5f 61 6c 69 73 | 74 29 0a 76 61 5f 64 63 |(va_alis|t).va_dc|
|000059d0| 6c 0a 7b 0a 76 61 5f 6c | 69 73 74 09 61 72 67 73 |l.{.va_l|ist.args|
|000059e0| 3b 0a 63 68 61 72 09 2a | 66 6d 74 3b 0a 0a 09 76 |;.char.*|fmt;...v|
|000059f0| 61 5f 73 74 61 72 74 20 | 28 61 72 67 73 29 3b 0a |a_start |(args);.|
|00005a00| 09 66 6d 74 20 3d 20 76 | 61 5f 61 72 67 20 28 61 |.fmt = v|a_arg (a|
|00005a10| 72 67 73 2c 20 63 68 61 | 72 20 2a 29 3b 0a 09 76 |rgs, cha|r *);..v|
|00005a20| 66 70 72 69 6e 74 66 20 | 28 73 74 64 65 72 72 2c |fprintf |(stderr,|
|00005a30| 20 66 6d 74 2c 20 61 72 | 67 73 29 3b 0a 09 76 61 | fmt, ar|gs);..va|
|00005a40| 5f 65 6e 64 20 28 61 72 | 67 73 29 3b 0a 09 66 70 |_end (ar|gs);..fp|
|00005a50| 72 69 6e 74 66 20 28 73 | 74 64 65 72 72 2c 20 22 |rintf (s|tderr, "|
|00005a60| 5c 6e 22 29 3b 0a 09 69 | 66 20 28 70 61 6e 69 63 |\n");..i|f (panic|
|00005a70| 68 6f 6f 6b 20 21 3d 20 | 4e 55 4c 4c 29 0a 09 09 |hook != |NULL)...|
|00005a80| 28 2a 70 61 6e 69 63 68 | 6f 6f 6b 29 20 28 29 3b |(*panich|ook) ();|
|00005a90| 0a 09 65 78 69 74 20 28 | 31 29 3b 0a 7d 0a 2a 0a |..exit (|1);.}.*.|
|00005aa0| 09 49 6e 69 74 69 61 6c | 69 7a 65 20 65 6e 74 72 |.Initial|ize entr|
|00005ab0| 79 20 74 6f 20 22 6e 6f | 74 68 69 6e 67 22 0a 2a |y to "no|thing".*|
|00005ac0| 2f 0a 0a 09 42 45 4c 65 | 6e 20 28 62 69 29 20 3d |/...BELe|n (bi) =|
|00005ad0| 20 30 3b 09 09 09 2f 2a | 20 6e 6f 20 74 65 78 74 | 0;.../*| no text|
|00005ae0| 20 2a 2f 0a 09 42 45 41 | 75 74 68 43 6e 74 20 28 | */..BEA|uthCnt (|
|00005af0| 62 69 29 20 3d 20 30 3b | 09 09 09 2f 2a 20 6e 6f |bi) = 0;|.../* no|
|00005b00| 20 61 75 74 68 6f 72 73 | 20 2a 2f 0a 09 66 6f 72 | authors| */..for|
|00005b10| 20 28 69 20 3d 20 27 41 | 27 3b 20 69 20 3c 3d 20 | (i = 'A|'; i <= |
|00005b20| 27 5a 27 3b 20 69 2b 2b | 29 09 09 2f 2a 20 6e 6f |'Z'; i++|)../* no|
|00005b30| 20 6f 74 68 65 72 20 66 | 69 65 6c 64 73 2c 20 65 | other f|ields, e|
|00005b40| 69 74 68 65 72 20 2a 2f | 0a 09 09 42 45 46 6c 64 |ither */|...BEFld|
|00005b50| 4c 65 6e 20 28 42 45 46 | 6c 64 50 74 72 20 28 62 |Len (BEF|ldPtr (b|
|00005b60| 69 2c 20 69 29 29 20 3d | 20 30 3b 0a 0a 09 2b 2b |i, i)) =| 0;...++|
|00005b70| 63 69 74 61 74 69 6f 6e | 3b 0a 0a 09 77 68 69 6c |citation|;...whil|
|00005b80| 65 20 28 72 65 61 64 29 | 0a 09 7b 0a 09 09 2b 2b |e (read)|..{...++|
|00005b90| 6c 69 6e 65 3b 0a 09 09 | 69 66 20 28 28 63 20 3d |line;...|if ((c =|
|00005ba0| 20 67 65 74 63 20 28 66 | 29 29 20 3d 3d 20 45 4f | getc (f|)) == EO|
|00005bb0| 46 29 0a 09 09 09 62 72 | 65 61 6b 3b 0a 09 09 69 |F)....br|eak;...i|
|00005bc0| 66 20 28 63 20 3d 3d 20 | 27 5c 6e 27 29 09 09 09 |f (c == |'\n')...|
|00005bd0| 2f 2a 20 62 6c 61 6e 6b | 20 6c 69 6e 65 20 2a 2f |/* blank| line */|
|00005be0| 0a 09 09 7b 0a 09 09 09 | 72 65 61 64 20 3d 20 28 |...{....|read = (|
|00005bf0| 6e 4c 69 6e 65 73 20 3d | 3d 20 30 29 3b 09 2f 2a |nLines =|= 0);./*|
|00005c00| 75 6e 69 71 62 69 62 2f | 75 6e 69 71 62 69 62 2e |uniqbib/|uniqbib.|
|00005c10| 31 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |1.......|........|
|00005c20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005c30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005c40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005c50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005c60| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 20 32 |.... 6|44 . 2|
|00005c70| 34 33 20 00 20 20 20 20 | 31 32 20 00 20 20 20 20 |43 . |12 . |
|00005c80| 20 20 20 34 37 32 36 20 | 20 34 34 30 34 30 37 31 | 4726 | 4404071|
|00005c90| 34 35 36 20 20 20 37 32 | 36 32 00 20 00 00 00 00 |456 72|62. ....|
|00005ca0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005cb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005cc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005cd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005ce0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005cf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005d00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005d10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005d20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005d30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005d40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005d50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005d60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005d70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005d80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005d90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005da0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005db0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005dc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005dd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005de0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005df0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005e00| 2e 5c 22 20 78 72 6f 66 | 66 20 2d 6d 61 6e 2e 6e |.\" xrof|f -man.n|
|00005e10| 65 77 20 25 20 7c 20 6c | 70 72 0a 2e 54 48 20 75 |ew % | l|pr..TH u|
|00005e20| 6e 69 71 62 69 62 20 31 | 0a 2e 55 43 20 34 0a 2e |niqbib 1|..UC 4..|
|00005e30| 53 48 20 4e 41 4d 45 0a | 75 6e 69 71 62 69 62 20 |SH NAME.|uniqbib |
|00005e40| 5c 2d 20 72 65 6d 6f 76 | 65 20 64 75 70 6c 69 63 |\- remov|e duplic|
|00005e50| 61 74 65 73 20 66 72 6f | 6d 20 62 69 62 6c 69 6f |ates fro|m biblio|
|00005e60| 67 72 61 70 68 69 63 20 | 64 61 74 61 62 61 73 65 |graphic |database|
|00005e70| 0a 2e 53 48 20 53 59 4e | 54 41 58 0a 2e 42 20 75 |..SH SYN|TAX..B u|
|00005e80| 6e 69 71 62 69 62 0a 5b | 0a 2e 42 20 5c 2d 76 0a |niqbib.[|..B \-v.|
|00005e90| 5d 20 5b 0a 2e 49 20 66 | 69 6c 65 0a 5d 0a 2e 53 |] [..I f|ile.]..S|
|00005ea0| 48 20 44 45 53 43 52 49 | 50 54 49 4f 4e 0a 2e 49 |H DESCRI|PTION..I|
|00005eb0| 20 55 6e 69 71 62 69 62 | 0a 69 73 20 75 73 65 64 | Uniqbib|.is used|
|00005ec0| 20 69 6e 20 63 6f 6e 6a | 75 6e 63 74 69 6f 6e 20 | in conj|unction |
|00005ed0| 77 69 74 68 20 74 68 65 | 20 73 75 69 74 65 20 6f |with the| suite o|
|00005ee0| 66 20 70 72 6f 67 72 61 | 6d 73 20 63 6f 6d 70 72 |f progra|ms compr|
|00005ef0| 69 73 69 6e 67 20 74 68 | 65 0a 2e 49 20 72 65 66 |ising th|e..I ref|
|00005f00| 65 72 0a 73 79 73 74 65 | 6d 2e 0a 4f 6e 65 20 70 |er.syste|m..One p|
|00005f10| 72 6f 62 6c 65 6d 20 77 | 69 74 68 20 74 68 69 73 |roblem w|ith this|
|00005f20| 20 73 79 73 74 65 6d 20 | 69 73 20 74 68 61 74 20 | system |is that |
|00005f30| 74 68 65 72 65 20 69 73 | 20 6e 6f 20 70 72 6f 76 |there is| no prov|
|00005f40| 69 73 69 6f 6e 20 66 6f | 72 20 72 65 6d 6f 76 61 |ision fo|r remova|
|00005f50| 6c 0a 6f 66 20 64 75 70 | 6c 69 63 61 74 65 73 20 |l.of dup|licates |
|00005f60| 66 72 6f 6d 20 62 69 62 | 6c 69 6f 67 72 61 70 68 |from bib|liograph|
|00005f70| 69 63 20 64 61 74 61 62 | 61 73 65 73 2e 0a 28 44 |ic datab|ases..(D|
|00005f80| 75 70 6c 69 63 61 74 65 | 73 20 6d 61 79 20 6f 63 |uplicate|s may oc|
|00005f90| 63 75 72 2c 20 66 6f 72 | 20 69 6e 73 74 61 6e 63 |cur, for| instanc|
|00005fa0| 65 2c 20 69 66 20 74 68 | 65 20 6f 75 74 70 75 74 |e, if th|e output|
|00005fb0| 20 66 72 6f 6d 20 74 77 | 6f 20 6f 72 20 6d 6f 72 | from tw|o or mor|
|00005fc0| 65 0a 2e 49 20 6c 6f 6f | 6b 62 69 62 0a 71 75 65 |e..I loo|kbib.que|
|00005fd0| 72 69 65 73 20 69 73 20 | 63 6f 6d 62 69 6e 65 64 |ries is |combined|
|00005fe0| 2c 20 77 68 65 72 65 20 | 65 6e 74 72 69 65 73 0a |, where |entries.|
|00005ff0| 73 61 74 69 73 66 79 20 | 74 68 65 20 6b 65 79 77 |satisfy |the keyw|
|00006000| 6f 72 64 73 20 6f 66 20 | 6d 6f 72 65 20 74 68 61 |ords of |more tha|
|00006010| 6e 20 6f 6e 65 20 73 65 | 61 72 63 68 2e 29 0a 2e |n one se|arch.)..|
|00006020| 49 20 55 6e 69 71 62 69 | 62 0a 69 73 20 75 73 65 |I Uniqbi|b.is use|
|00006030| 64 20 74 6f 20 72 65 6d | 6f 76 65 20 73 75 63 68 |d to rem|ove such|
|00006040| 20 64 75 70 6c 69 63 61 | 74 65 73 2e 0a 49 74 20 | duplica|tes..It |
|00006050| 72 65 61 64 73 20 69 74 | 73 20 69 6e 70 75 74 20 |reads it|s input |
|00006060| 61 6e 64 20 77 72 69 74 | 65 73 20 61 6c 6c 20 74 |and writ|es all t|
|00006070| 68 65 20 75 6e 69 71 75 | 65 20 65 6e 74 72 69 65 |he uniqu|e entrie|
|00006080| 73 20 74 68 65 72 65 69 | 6e 20 74 6f 20 74 68 65 |s therei|n to the|
|00006090| 0a 73 74 61 6e 64 61 72 | 64 20 6f 75 74 70 75 74 |.standar|d output|
|000060a0| 2e 0a 54 68 65 20 65 6e | 74 72 69 65 73 20 69 6e |..The en|tries in|
|000060b0| 20 74 68 65 20 69 6e 70 | 75 74 20 64 6f 20 6e 6f | the inp|ut do no|
|000060c0| 74 20 68 61 76 65 20 74 | 6f 20 62 65 20 73 6f 72 |t have t|o be sor|
|000060d0| 74 65 64 20 28 69 2e 65 | 2e 2c 20 79 6f 75 20 64 |ted (i.e|., you d|
|000060e0| 6f 20 6e 6f 74 20 68 61 | 76 65 20 74 6f 0a 72 75 |o not ha|ve to.ru|
|000060f0| 6e 0a 2e 49 20 73 6f 72 | 74 62 69 62 0a 66 69 72 |n..I sor|tbib.fir|
|00006100| 73 74 29 2c 20 6e 6f 72 | 20 64 6f 20 74 68 65 20 |st), nor| do the |
|00006110| 65 6e 74 72 69 65 73 20 | 70 72 6f 64 75 63 65 64 |entries |produced|
|00006120| 20 62 79 0a 2e 49 20 75 | 6e 69 71 62 69 62 0a 63 | by..I u|niqbib.c|
|00006130| 6f 6d 65 20 6f 75 74 20 | 69 6e 20 61 6e 79 20 70 |ome out |in any p|
|00006140| 61 72 74 69 63 75 6c 61 | 72 20 6f 72 64 65 72 2e |articula|r order.|
|00006150| 0a 2e 50 50 0a 49 66 20 | 61 20 66 69 6c 65 20 69 |..PP.If |a file i|
|00006160| 73 20 6e 61 6d 65 64 2c | 0a 2e 49 20 75 6e 69 71 |s named,|..I uniq|
|00006170| 62 69 62 0a 72 65 61 64 | 73 20 69 74 3b 20 6f 74 |bib.read|s it; ot|
|00006180| 68 65 72 77 69 73 65 20 | 69 74 20 72 65 61 64 73 |herwise |it reads|
|00006190| 20 69 74 73 20 73 74 61 | 6e 64 61 72 64 20 69 6e | its sta|ndard in|
|000061a0| 70 75 74 2e 0a 54 68 69 | 73 20 6d 65 61 6e 73 20 |put..Thi|s means |
|000061b0| 74 68 61 74 0a 2e 49 20 | 75 6e 69 71 62 69 62 0a |that..I |uniqbib.|
|000061c0| 63 61 6e 20 62 65 20 75 | 73 65 64 20 69 6e 20 70 |can be u|sed in p|
|000061d0| 69 70 65 6c 69 6e 65 73 | 2e 0a 49 66 20 6d 6f 72 |ipelines|..If mor|
|000061e0| 65 20 74 68 61 6e 20 6f | 6e 65 20 66 69 6c 65 20 |e than o|ne file |
|000061f0| 69 73 20 74 6f 20 62 65 | 20 70 72 6f 63 65 73 73 |is to be| process|
|00006200| 65 64 2c 20 75 73 65 0a | 2e 50 50 0a 2e 6e 66 0a |ed, use.|.PP..nf.|
|00006210| 2e 69 6e 20 2b 2e 35 69 | 0a 63 61 74 20 69 6e 70 |.in +.5i|.cat inp|
|00006220| 75 74 31 20 69 6e 70 75 | 74 32 20 2e 2e 2e 20 69 |ut1 inpu|t2 ... i|
|00006230| 6e 70 75 74 5c 66 32 6e | 5c 66 31 20 7c 20 75 6e |nput\f2n|\f1 | un|
|00006240| 69 71 62 69 62 20 3e 20 | 6f 75 74 70 75 74 0a 2e |iqbib > |output..|
|00006250| 69 6e 20 2d 2e 35 69 0a | 2e 66 69 0a 2e 50 50 0a |in -.5i.|.fi..PP.|
|00006260| 45 6e 74 72 69 65 73 20 | 61 72 65 20 63 6f 6e 73 |Entries |are cons|
|00006270| 69 64 65 72 65 64 20 64 | 75 70 6c 69 63 61 74 65 |idered d|uplicate|
|00006280| 73 20 69 66 0a 28 69 29 | 20 74 68 65 79 20 63 6f |s if.(i)| they co|
|00006290| 6e 74 61 69 6e 20 74 68 | 65 20 73 61 6d 65 20 61 |ntain th|e same a|
|000062a0| 75 74 68 6f 72 73 2c 20 | 69 6e 20 74 68 65 20 73 |uthors, |in the s|
|000062b0| 61 6d 65 20 6f 72 64 65 | 72 3b 20 61 6e 64 20 28 |ame orde|r; and (|
|000062c0| 69 69 29 0a 74 68 65 79 | 20 63 6f 6e 74 61 69 6e |ii).they| contain|
|000062d0| 20 74 68 65 20 73 61 6d | 65 20 6e 6f 6e 2d 61 75 | the sam|e non-au|
|000062e0| 74 68 6f 72 20 66 69 65 | 6c 64 73 2c 20 61 6e 64 |thor fie|lds, and|
|000062f0| 20 74 68 65 20 63 6f 6e | 74 65 6e 74 20 6f 66 20 | the con|tent of |
|00006300| 63 6f 72 72 65 73 70 6f | 6e 64 69 6e 67 0a 66 69 |correspo|nding.fi|
|00006310| 65 6c 64 73 20 69 73 20 | 69 64 65 6e 74 69 63 61 |elds is |identica|
|00006320| 6c 2e 0a 2e 50 50 0a 46 | 69 65 6c 64 73 20 28 65 |l...PP.F|ields (e|
|00006330| 78 63 65 70 74 20 66 6f | 72 20 61 75 74 68 6f 72 |xcept fo|r author|
|00006340| 73 29 20 64 6f 0a 2e 49 | 20 6e 6f 74 0a 68 61 76 |s) do..I| not.hav|
|00006350| 65 20 74 6f 20 61 70 70 | 65 61 72 20 69 6e 20 74 |e to app|ear in t|
|00006360| 68 65 20 73 61 6d 65 20 | 6f 72 64 65 72 20 66 6f |he same |order fo|
|00006370| 72 20 74 77 6f 20 65 6e | 74 72 69 65 73 20 74 6f |r two en|tries to|
|00006380| 20 62 65 20 63 6f 6e 73 | 69 64 65 72 65 64 20 69 | be cons|idered i|
|00006390| 64 65 6e 74 69 63 61 6c | 2e 0a 46 6f 72 20 65 78 |dentical|..For ex|
|000063a0| 61 6d 70 6c 65 2c 20 74 | 68 65 20 66 6f 6c 6c 6f |ample, t|he follo|
|000063b0| 77 69 6e 67 20 74 77 6f | 20 65 6e 74 72 69 65 73 |wing two| entries|
|000063c0| 20 61 72 65 20 74 68 65 | 20 73 61 6d 65 20 61 73 | are the| same as|
|000063d0| 20 66 61 72 20 61 73 0a | 2e 49 20 75 6e 69 71 62 | far as.|.I uniqb|
|000063e0| 69 62 0a 69 73 20 63 6f | 6e 63 65 72 6e 65 64 2c |ib.is co|ncerned,|
|000063f0| 20 62 65 63 61 75 73 65 | 20 77 69 74 68 69 6e 20 | because| within |
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.