home *** CD-ROM | disk | FTP | other *** search
view JSON data
|
view as text
|
open on a Mac
|
open on a PC
This file was processed as: SHell self-extracting ARchive
(archive/shar).
You can browse this item here: getline
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| Newsgroup Content (archive/news)
| magic
| Supported |
100%
| dexvert
| SHell self-extracting ARchive (archive/shar)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| news text
| default
| |
99%
| file
| C source, ASCII text
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| dexmagic
| PrintFox/Pagefox WEAK
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/329 Shell Archive Format
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
| |
100%
| xdgMime
| message/news
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 78 61 | 6e 74 68 21 6d 63 6e 63 |Path: xa|nth!mcnc|
|00000010| 21 67 61 74 65 63 68 21 | 62 6c 6f 6f 6d 2d 62 65 |!gatech!|bloom-be|
|00000020| 61 63 6f 6e 21 74 75 74 | 2e 63 69 73 2e 6f 68 69 |acon!tut|.cis.ohi|
|00000030| 6f 2d 73 74 61 74 65 2e | 65 64 75 21 68 75 73 63 |o-state.|edu!husc|
|00000040| 36 21 6e 65 63 6e 74 63 | 21 6e 63 6f 61 73 74 21 |6!necntc|!ncoast!|
|00000050| 61 6c 6c 62 65 72 79 0a | 46 72 6f 6d 3a 20 64 61 |allbery.|From: da|
|00000060| 76 65 62 40 67 65 61 63 | 2e 55 55 43 50 20 28 44 |veb@geac|.UUCP (D|
|00000070| 61 76 69 64 20 43 6f 6c | 6c 69 65 72 2d 42 72 6f |avid Col|lier-Bro|
|00000080| 77 6e 29 0a 4e 65 77 73 | 67 72 6f 75 70 73 3a 20 |wn).News|groups: |
|00000090| 63 6f 6d 70 2e 73 6f 75 | 72 63 65 73 2e 6d 69 73 |comp.sou|rces.mis|
|000000a0| 63 0a 53 75 62 6a 65 63 | 74 3a 20 76 30 33 69 30 |c.Subjec|t: v03i0|
|000000b0| 31 38 3a 20 67 65 74 6c | 69 6e 65 20 2d 2d 20 67 |18: getl|ine -- g|
|000000c0| 65 74 20 61 20 6c 6f 6e | 67 20 6c 69 6e 65 0a 53 |et a lon|g line.S|
|000000d0| 75 6d 6d 61 72 79 3a 20 | 61 6e 20 66 67 65 74 73 |ummary: |an fgets|
|000000e0| 20 77 69 74 68 20 61 6e | 20 65 78 70 61 6e 64 69 | with an| expandi|
|000000f0| 6e 67 20 63 61 63 68 65 | 0a 4b 65 79 77 6f 72 64 |ng cache|.Keyword|
|00000100| 73 3a 20 66 67 65 74 73 | 20 67 65 74 6c 69 6e 65 |s: fgets| getline|
|00000110| 20 63 61 63 68 65 0a 4d | 65 73 73 61 67 65 2d 49 | cache.M|essage-I|
|00000120| 44 3a 20 3c 32 37 35 31 | 40 67 65 61 63 2e 55 55 |D: <2751|@geac.UU|
|00000130| 43 50 3e 0a 44 61 74 65 | 3a 20 31 36 20 4d 61 79 |CP>.Date|: 16 May|
|00000140| 20 38 38 20 31 35 3a 32 | 33 3a 31 32 20 47 4d 54 | 88 15:2|3:12 GMT|
|00000150| 0a 53 65 6e 64 65 72 3a | 20 61 6c 6c 62 65 72 79 |.Sender:| allbery|
|00000160| 40 6e 63 6f 61 73 74 2e | 55 55 43 50 0a 52 65 70 |@ncoast.|UUCP.Rep|
|00000170| 6c 79 2d 54 6f 3a 20 64 | 61 76 65 62 40 67 65 61 |ly-To: d|aveb@gea|
|00000180| 63 2e 55 55 43 50 20 28 | 44 61 76 69 64 20 43 6f |c.UUCP (|David Co|
|00000190| 6c 6c 69 65 72 2d 42 72 | 6f 77 6e 29 0a 4f 72 67 |llier-Br|own).Org|
|000001a0| 61 6e 69 7a 61 74 69 6f | 6e 3a 20 47 65 61 63 0a |anizatio|n: Geac.|
|000001b0| 4c 69 6e 65 73 3a 20 32 | 30 37 0a 41 70 70 72 6f |Lines: 2|07.Appro|
|000001c0| 76 65 64 3a 20 61 6c 6c | 62 65 72 79 40 6e 63 6f |ved: all|bery@nco|
|000001d0| 61 73 74 2e 55 55 43 50 | 0a 0a 63 6f 6d 70 2e 73 |ast.UUCP|..comp.s|
|000001e0| 6f 75 72 63 65 73 2e 6d | 69 73 63 3a 20 56 6f 6c |ources.m|isc: Vol|
|000001f0| 75 6d 65 20 33 2c 20 49 | 73 73 75 65 20 31 38 0a |ume 3, I|ssue 18.|
|00000200| 53 75 62 6d 69 74 74 65 | 64 2d 42 79 3a 20 22 44 |Submitte|d-By: "D|
|00000210| 61 76 69 64 20 43 6f 6c | 6c 69 65 72 2d 42 72 6f |avid Col|lier-Bro|
|00000220| 77 6e 22 20 3c 64 61 76 | 65 62 40 67 65 61 63 2e |wn" <dav|eb@geac.|
|00000230| 55 55 43 50 3e 0a 41 72 | 63 68 69 76 65 2d 4e 61 |UUCP>.Ar|chive-Na|
|00000240| 6d 65 3a 20 67 65 74 6c | 69 6e 65 0a 0a 20 54 68 |me: getl|ine.. Th|
|00000250| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 69 73 20 61 |e follow|ing is a|
|00000260| 20 66 75 6e 63 74 69 6f | 6e 20 74 6f 20 67 65 74 | functio|n to get|
|00000270| 20 61 20 6c 6f 6e 67 20 | 28 70 6f 73 73 69 62 6c | a long |(possibl|
|00000280| 79 20 61 72 62 69 74 72 | 61 72 69 6c 79 0a 6c 6f |y arbitr|arily.lo|
|00000290| 6e 67 29 20 6c 69 6e 65 | 20 66 72 6f 6d 20 61 20 |ng) line| from a |
|000002a0| 73 74 72 65 61 6d 2e 20 | 20 49 27 76 65 20 77 72 |stream. | I've wr|
|000002b0| 69 74 74 65 6e 20 69 74 | 20 74 77 69 63 65 2c 20 |itten it| twice, |
|000002c0| 73 6f 20 49 20 67 75 65 | 73 73 20 69 74 20 6d 61 |so I gue|ss it ma|
|000002d0| 79 0a 62 65 20 75 73 65 | 66 75 6c 20 74 6f 20 6f |y.be use|ful to o|
|000002e0| 74 68 65 72 73 2e 0a 20 | 20 54 65 73 74 65 64 20 |thers.. | Tested |
|000002f0| 4f 4e 4c 59 20 6f 6e 20 | 61 20 56 61 78 2d 55 6c |ONLY on |a Vax-Ul|
|00000300| 74 72 69 78 20 6d 61 63 | 68 69 6e 65 2c 20 73 6f |trix mac|hine, so|
|00000310| 20 62 65 77 61 72 65 20 | 6f 66 20 6d 61 63 68 69 | beware |of machi|
|00000320| 6e 65 0a 64 65 70 65 6e | 64 65 6e 63 69 65 73 20 |ne.depen|dencies |
|00000330| 74 68 61 74 20 67 6f 74 | 20 62 79 20 6d 79 20 6a |that got| by my j|
|00000340| 61 75 6e 64 69 63 65 64 | 20 65 79 65 2e 0a 0a 23 |aundiced| eye...#|
|00000350| 21 20 2f 62 69 6e 2f 73 | 68 0a 23 20 54 68 69 73 |! /bin/s|h.# This|
|00000360| 20 69 73 20 61 20 73 68 | 65 6c 6c 20 61 72 63 68 | is a sh|ell arch|
|00000370| 69 76 65 2e 20 20 52 65 | 6d 6f 76 65 20 61 6e 79 |ive. Re|move any|
|00000380| 74 68 69 6e 67 20 62 65 | 66 6f 72 65 20 74 68 69 |thing be|fore thi|
|00000390| 73 20 6c 69 6e 65 2c 20 | 74 68 65 6e 20 75 6e 70 |s line, |then unp|
|000003a0| 61 63 6b 0a 23 20 69 74 | 20 62 79 20 73 61 76 69 |ack.# it| by savi|
|000003b0| 6e 67 20 69 74 20 69 6e | 74 6f 20 61 20 66 69 6c |ng it in|to a fil|
|000003c0| 65 20 61 6e 64 20 74 79 | 70 69 6e 67 20 22 73 68 |e and ty|ping "sh|
|000003d0| 20 66 69 6c 65 22 2e 20 | 20 54 6f 20 6f 76 65 72 | file". | To over|
|000003e0| 77 72 69 74 65 20 65 78 | 69 73 74 69 6e 67 0a 23 |write ex|isting.#|
|000003f0| 20 66 69 6c 65 73 2c 20 | 74 79 70 65 20 22 73 68 | files, |type "sh|
|00000400| 20 66 69 6c 65 20 2d 63 | 22 2e 20 20 59 6f 75 20 | file -c|". You |
|00000410| 63 61 6e 20 61 6c 73 6f | 20 66 65 65 64 20 74 68 |can also| feed th|
|00000420| 69 73 20 61 73 20 73 74 | 61 6e 64 61 72 64 20 69 |is as st|andard i|
|00000430| 6e 70 75 74 20 76 69 61 | 0a 23 20 75 6e 73 68 61 |nput via|.# unsha|
|00000440| 72 2c 20 6f 72 20 62 79 | 20 74 79 70 69 6e 67 20 |r, or by| typing |
|00000450| 22 73 68 20 3c 66 69 6c | 65 22 2c 20 65 2e 67 2e |"sh <fil|e", e.g.|
|00000460| 2e 20 20 49 66 20 74 68 | 69 73 20 61 72 63 68 69 |. If th|is archi|
|00000470| 76 65 20 69 73 20 63 6f | 6d 70 6c 65 74 65 2c 20 |ve is co|mplete, |
|00000480| 79 6f 75 0a 23 20 77 69 | 6c 6c 20 73 65 65 20 74 |you.# wi|ll see t|
|00000490| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 6d 65 73 |he follo|wing mes|
|000004a0| 73 61 67 65 20 61 74 20 | 74 68 65 20 65 6e 64 3a |sage at |the end:|
|000004b0| 0a 23 09 09 22 45 6e 64 | 20 6f 66 20 73 68 65 6c |.#.."End| of shel|
|000004c0| 6c 20 61 72 63 68 69 76 | 65 2e 22 0a 23 20 43 6f |l archiv|e.".# Co|
|000004d0| 6e 74 65 6e 74 73 3a 20 | 20 67 65 74 6c 69 6e 65 |ntents: | getline|
|000004e0| 2e 63 20 4d 61 6b 65 66 | 69 6c 65 20 67 65 74 6c |.c Makef|ile getl|
|000004f0| 69 6e 65 2e 31 0a 23 20 | 57 72 61 70 70 65 64 20 |ine.1.# |Wrapped |
|00000500| 62 79 20 64 61 76 65 62 | 40 67 65 61 63 20 6f 6e |by daveb|@geac on|
|00000510| 20 4d 6f 6e 20 4d 61 79 | 20 31 36 20 31 31 3a 30 | Mon May| 16 11:0|
|00000520| 30 3a 34 39 20 31 39 38 | 38 0a 50 41 54 48 3d 2f |0:49 198|8.PATH=/|
|00000530| 62 69 6e 3a 2f 75 73 72 | 2f 62 69 6e 3a 2f 75 73 |bin:/usr|/bin:/us|
|00000540| 72 2f 75 63 62 20 3b 20 | 65 78 70 6f 72 74 20 50 |r/ucb ; |export P|
|00000550| 41 54 48 0a 69 66 20 74 | 65 73 74 20 2d 66 20 67 |ATH.if t|est -f g|
|00000560| 65 74 6c 69 6e 65 2e 63 | 20 2d 61 20 22 24 7b 31 |etline.c| -a "${1|
|00000570| 7d 22 20 21 3d 20 22 2d | 63 22 20 3b 20 74 68 65 |}" != "-|c" ; the|
|00000580| 6e 20 0a 20 20 65 63 68 | 6f 20 73 68 61 72 3a 20 |n . ech|o shar: |
|00000590| 57 69 6c 6c 20 6e 6f 74 | 20 6f 76 65 72 2d 77 72 |Will not| over-wr|
|000005a0| 69 74 65 20 65 78 69 73 | 74 69 6e 67 20 66 69 6c |ite exis|ting fil|
|000005b0| 65 20 5c 22 67 65 74 6c | 69 6e 65 2e 63 5c 22 0a |e \"getl|ine.c\".|
|000005c0| 65 6c 73 65 0a 65 63 68 | 6f 20 73 68 61 72 3a 20 |else.ech|o shar: |
|000005d0| 45 78 74 72 61 63 74 69 | 6e 67 20 5c 22 67 65 74 |Extracti|ng \"get|
|000005e0| 6c 69 6e 65 2e 63 5c 22 | 20 5c 28 31 37 37 37 20 |line.c\"| \(1777 |
|000005f0| 63 68 61 72 61 63 74 65 | 72 73 5c 29 0a 73 65 64 |characte|rs\).sed|
|00000600| 20 22 73 2f 5e 58 2f 2f | 22 20 3e 67 65 74 6c 69 | "s/^X//|" >getli|
|00000610| 6e 65 2e 63 20 3c 3c 27 | 45 4e 44 5f 4f 46 5f 67 |ne.c <<'|END_OF_g|
|00000620| 65 74 6c 69 6e 65 2e 63 | 27 0a 58 2f 2a 0a 58 20 |etline.c|'.X/*.X |
|00000630| 2a 20 67 65 74 6c 69 6e | 65 2e 63 20 2d 2d 20 67 |* getlin|e.c -- g|
|00000640| 65 74 20 61 20 6c 69 6e | 65 20 69 6e 74 6f 20 61 |et a lin|e into a|
|00000650| 20 76 61 72 69 61 62 6c | 65 2d 73 69 7a 65 20 63 | variabl|e-size c|
|00000660| 61 63 68 65 2e 20 4f 74 | 68 65 72 77 69 73 65 20 |ache. Ot|herwise |
|00000670| 74 68 65 0a 58 20 2a 09 | 62 65 68 61 76 69 6f 72 |the.X *.|behavior|
|00000680| 20 69 73 20 69 64 65 6e | 74 69 63 61 6c 20 74 6f | is iden|tical to|
|00000690| 20 66 67 65 74 73 2e 0a | 58 20 2a 2f 0a 58 23 69 | fgets..|X */.X#i|
|000006a0| 6e 63 6c 75 64 65 20 3c | 73 74 64 69 6f 2e 68 3e |nclude <|stdio.h>|
|000006b0| 0a 58 0a 58 23 64 65 66 | 69 6e 65 20 42 41 44 45 |.X.X#def|ine BADE|
|000006c0| 58 49 54 20 33 09 2f 2a | 20 4e 6f 6e 7a 65 72 6f |XIT 3./*| Nonzero|
|000006d0| 20 69 73 20 73 75 66 66 | 69 63 65 6e 74 2e 20 33 | is suff|icent. 3|
|000006e0| 20 69 6d 70 6c 69 65 73 | 20 62 61 64 6e 65 73 73 | implies| badness|
|000006f0| 2e 20 2a 2f 0a 58 23 64 | 65 66 69 6e 65 20 49 4e |. */.X#d|efine IN|
|00000700| 49 54 49 41 4c 5f 43 48 | 55 4e 4b 20 36 30 20 20 |ITIAL_CH|UNK 60 |
|00000710| 2f 2a 20 50 75 72 65 6c | 79 20 61 20 68 65 75 72 |/* Purel|y a heur|
|00000720| 69 73 74 69 63 20 76 61 | 6c 75 65 2e 20 2a 2f 0a |istic va|lue. */.|
|00000730| 58 23 64 65 66 69 6e 65 | 20 43 48 55 4e 4b 53 49 |X#define| CHUNKSI|
|00000740| 5a 45 20 31 30 0a 58 0a | 58 2f 2a 20 0a 58 20 2a |ZE 10.X.|X/* .X *|
|00000750| 20 67 65 74 6c 69 6e 65 | 20 2d 2d 20 61 63 74 75 | getline| -- actu|
|00000760| 61 6c 6c 79 20 67 65 74 | 20 74 68 65 20 6c 69 6e |ally get| the lin|
|00000770| 65 2e 20 42 65 68 61 76 | 65 73 20 61 73 20 65 78 |e. Behav|es as ex|
|00000780| 70 65 63 74 65 64 20 6f | 6e 20 61 6e 20 65 6f 66 |pected o|n an eof|
|00000790| 0a 58 20 2a 09 61 74 20 | 74 68 65 20 62 65 67 69 |.X *.at |the begi|
|000007a0| 6e 6e 69 6e 67 20 6f 66 | 20 61 20 6c 69 6e 65 20 |nning of| a line |
|000007b0| 6f 72 20 61 74 20 65 6e | 64 20 6f 66 20 66 69 6c |or at en|d of fil|
|000007c0| 65 2e 20 20 44 65 70 65 | 6e 64 61 6e 74 20 6f 6e |e. Depe|ndant on|
|000007d0| 0a 58 20 2a 09 74 68 65 | 20 62 65 68 61 76 69 6f |.X *.the| behavio|
|000007e0| 72 20 6f 66 20 66 67 65 | 74 73 20 61 73 20 74 6f |r of fge|ts as to|
|000007f0| 20 77 68 61 74 20 68 61 | 70 70 65 6e 73 20 77 68 | what ha|ppens wh|
|00000800| 65 6e 20 61 6e 20 45 4f | 46 20 69 73 20 65 6e 74 |en an EO|F is ent|
|00000810| 65 72 65 64 20 0a 58 20 | 2a 09 66 72 6f 6d 20 61 |ered .X |*.from a|
|00000820| 20 74 65 72 6d 69 6e 61 | 6c 20 69 6e 20 74 68 65 | termina|l in the|
|00000830| 20 6d 69 64 64 6c 65 20 | 6f 66 20 61 20 6c 69 6e | middle |of a lin|
|00000840| 65 2e 20 20 55 6e 64 65 | 72 20 55 6c 74 72 69 78 |e. Unde|r Ultrix|
|00000850| 2f 42 65 72 6b 6c 65 79 | 0a 58 20 2a 09 54 54 59 |/Berkley|.X *.TTY|
|00000860| 20 68 61 6e 64 6c 69 6e | 67 2c 20 74 68 65 20 5e | handlin|g, the ^|
|00000870| 44 20 73 65 65 6d 73 20 | 74 6f 20 64 69 73 61 70 |D seems |to disap|
|00000880| 70 65 61 72 2e 2e 2e 20 | 0a 58 20 2a 2f 20 0a 58 |pear... |.X */ .X|
|00000890| 20 63 68 61 72 20 2a 0a | 58 67 65 74 6c 69 6e 65 | char *.|Xgetline|
|000008a0| 28 66 70 29 20 46 49 4c | 45 20 2a 66 70 3b 20 7b |(fp) FIL|E *fp; {|
|000008b0| 0a 58 09 65 78 74 65 72 | 6e 20 63 68 61 72 20 2a |.X.exter|n char *|
|000008c0| 72 65 61 6c 6c 6f 63 28 | 29 2c 20 2a 6d 61 6c 6c |realloc(|), *mall|
|000008d0| 6f 63 28 29 3b 0a 58 09 | 65 78 74 65 72 6e 20 63 |oc();.X.|extern c|
|000008e0| 68 61 72 20 2a 6c 61 73 | 74 43 68 61 72 61 63 74 |har *las|tCharact|
|000008f0| 65 72 28 29 3b 0a 58 09 | 65 78 74 65 72 6e 20 76 |er();.X.|extern v|
|00000900| 6f 69 64 20 65 78 69 74 | 28 29 3b 0a 58 09 73 74 |oid exit|();.X.st|
|00000910| 61 74 69 63 20 63 68 61 | 72 20 2a 63 61 63 68 65 |atic cha|r *cache|
|00000920| 20 3d 20 4e 55 4c 4c 3b | 0a 58 09 73 74 61 74 69 | = NULL;|.X.stati|
|00000930| 63 20 69 6e 74 20 63 61 | 63 68 65 53 69 7a 65 20 |c int ca|cheSize |
|00000940| 3d 20 30 3b 0a 58 0a 58 | 09 69 66 20 28 63 61 63 |= 0;.X.X|.if (cac|
|00000950| 68 65 20 3d 3d 20 4e 55 | 4c 4c 29 20 7b 0a 58 09 |he == NU|LL) {.X.|
|00000960| 09 2f 2a 20 49 74 73 20 | 74 68 65 20 66 69 72 73 |./* Its |the firs|
|00000970| 74 20 74 69 6d 65 2e 2e | 2e 20 2a 2f 0a 58 09 09 |t time..|. */.X..|
|00000980| 69 66 20 28 28 63 61 63 | 68 65 3d 20 6d 61 6c 6c |if ((cac|he= mall|
|00000990| 6f 63 28 49 4e 49 54 49 | 41 4c 5f 43 48 55 4e 4b |oc(INITI|AL_CHUNK|
|000009a0| 29 29 20 3d 3d 20 4e 55 | 4c 4c 29 20 7b 0a 58 09 |)) == NU|LL) {.X.|
|000009b0| 09 09 28 76 6f 69 64 29 | 20 66 70 72 69 6e 74 66 |..(void)| fprintf|
|000009c0| 28 73 74 64 65 72 72 2c | 22 67 65 74 6c 69 6e 65 |(stderr,|"getline|
|000009d0| 20 72 61 6e 20 6f 75 74 | 20 6f 66 20 73 70 61 63 | ran out| of spac|
|000009e0| 65 20 28 63 61 6e 27 74 | 20 68 61 70 70 65 6e 29 |e (can't| happen)|
|000009f0| 5c 6e 22 29 3b 0a 58 09 | 09 09 65 78 69 74 28 42 |\n");.X.|..exit(B|
|00000a00| 41 44 45 58 49 54 29 3b | 0a 58 09 09 7d 0a 58 09 |ADEXIT);|.X..}.X.|
|00000a10| 09 63 61 63 68 65 53 69 | 7a 65 20 3d 20 49 4e 49 |.cacheSi|ze = INI|
|00000a20| 54 49 41 4c 5f 43 48 55 | 4e 4b 3b 0a 58 09 7d 0a |TIAL_CHU|NK;.X.}.|
|00000a30| 58 0a 58 09 2f 2a 20 46 | 6f 72 20 61 6c 6c 20 63 |X.X./* F|or all c|
|00000a40| 61 73 65 73 2e 2e 2e 20 | 2a 2f 0a 58 09 69 66 20 |ases... |*/.X.if |
|00000a50| 28 66 67 65 74 73 28 63 | 61 63 68 65 2c 63 61 63 |(fgets(c|ache,cac|
|00000a60| 68 65 53 69 7a 65 2c 66 | 70 29 20 3d 3d 20 4e 55 |heSize,f|p) == NU|
|00000a70| 4c 4c 29 20 7b 0a 58 09 | 09 2f 2a 20 57 65 20 68 |LL) {.X.|./* We h|
|00000a80| 69 74 20 61 6e 20 65 6f | 66 20 69 6e 20 74 68 65 |it an eo|f in the|
|00000a90| 20 6c 61 73 74 20 6c 69 | 6e 65 2e 20 2a 2f 0a 58 | last li|ne. */.X|
|00000aa0| 09 09 72 65 74 75 72 6e | 20 4e 55 4c 4c 3b 0a 58 |..return| NULL;.X|
|00000ab0| 09 7d 0a 58 09 77 68 69 | 6c 65 20 28 2a 6c 61 73 |.}.X.whi|le (*las|
|00000ac0| 74 43 68 61 72 61 63 74 | 65 72 28 63 61 63 68 65 |tCharact|er(cache|
|00000ad0| 29 20 21 3d 20 27 5c 6e | 27 29 20 7b 0a 58 09 09 |) != '\n|') {.X..|
|00000ae0| 2f 2a 20 57 65 20 68 61 | 76 65 20 74 6f 20 72 65 |/* We ha|ve to re|
|00000af0| 61 64 20 73 6f 6d 65 20 | 6d 6f 72 65 2e 2e 2e 20 |ad some |more... |
|00000b00| 2a 2f 0a 58 09 09 69 66 | 20 28 28 63 61 63 68 65 |*/.X..if| ((cache|
|00000b10| 3d 20 72 65 61 6c 6c 6f | 63 28 63 61 63 68 65 2c |= reallo|c(cache,|
|00000b20| 28 75 6e 73 69 67 6e 65 | 64 29 63 61 63 68 65 53 |(unsigne|d)cacheS|
|00000b30| 69 7a 65 2b 43 48 55 4e | 4b 53 49 5a 45 29 29 20 |ize+CHUN|KSIZE)) |
|00000b40| 3d 3d 20 4e 55 4c 4c 29 | 20 7b 0a 58 09 09 09 28 |== NULL)| {.X...(|
|00000b50| 76 6f 69 64 29 20 66 70 | 72 69 6e 74 66 28 73 74 |void) fp|rintf(st|
|00000b60| 64 65 72 72 2c 22 67 65 | 74 6c 69 6e 65 20 72 61 |derr,"ge|tline ra|
|00000b70| 6e 20 6f 75 74 20 6f 66 | 20 73 70 61 63 65 3a 20 |n out of| space: |
|00000b80| 6c 69 6e 65 20 6c 6f 6e | 67 65 72 20 74 68 61 6e |line lon|ger than|
|00000b90| 20 61 76 61 69 6c 61 62 | 6c 65 20 6d 65 6d 6f 72 | availab|le memor|
|00000ba0| 79 5c 6e 22 29 3b 0a 58 | 09 09 09 65 78 69 74 28 |y\n");.X|...exit(|
|00000bb0| 42 41 44 45 58 49 54 29 | 3b 0a 58 09 09 7d 0a 58 |BADEXIT)|;.X..}.X|
|00000bc0| 09 09 69 66 20 28 66 67 | 65 74 73 28 26 63 61 63 |..if (fg|ets(&cac|
|00000bd0| 68 65 5b 63 61 63 68 65 | 53 69 7a 65 2d 31 5d 2c |he[cache|Size-1],|
|00000be0| 43 48 55 4e 4b 53 49 5a | 45 2b 31 2c 66 70 29 20 |CHUNKSIZ|E+1,fp) |
|00000bf0| 3d 3d 20 4e 55 4c 4c 29 | 20 7b 0a 58 09 09 09 63 |== NULL)| {.X...c|
|00000c00| 61 63 68 65 53 69 7a 65 | 20 2b 3d 20 43 48 55 4e |acheSize| += CHUN|
|00000c10| 4b 53 49 5a 45 3b 0a 58 | 09 09 09 72 65 74 75 72 |KSIZE;.X|...retur|
|00000c20| 6e 20 63 61 63 68 65 3b | 0a 58 09 09 7d 0a 58 09 |n cache;|.X..}.X.|
|00000c30| 09 65 6c 73 65 20 7b 0a | 58 09 09 09 63 61 63 68 |.else {.|X...cach|
|00000c40| 65 53 69 7a 65 20 2b 3d | 20 43 48 55 4e 4b 53 49 |eSize +=| CHUNKSI|
|00000c50| 5a 45 3b 0a 58 09 09 7d | 0a 58 09 7d 0a 58 09 2f |ZE;.X..}|.X.}.X./|
|00000c60| 2a 20 57 65 27 76 65 20 | 67 6f 74 20 61 20 6c 69 |* We've |got a li|
|00000c70| 6e 65 20 65 6e 64 69 6e | 67 20 69 6e 20 5c 6e 2e |ne endin|g in \n.|
|00000c80| 2e 2e 20 2a 2f 0a 58 09 | 72 65 74 75 72 6e 20 63 |.. */.X.|return c|
|00000c90| 61 63 68 65 3b 0a 58 7d | 0a 58 0a 58 0a 58 20 73 |ache;.X}|.X.X.X s|
|00000ca0| 74 61 74 69 63 20 63 68 | 61 72 20 2a 0a 58 6c 61 |tatic ch|ar *.Xla|
|00000cb0| 73 74 43 68 61 72 61 63 | 74 65 72 28 70 29 20 63 |stCharac|ter(p) c|
|00000cc0| 68 61 72 20 2a 70 3b 20 | 7b 0a 58 09 77 68 69 6c |har *p; |{.X.whil|
|00000cd0| 65 20 28 70 5b 31 5d 20 | 21 3d 20 27 5c 30 27 29 |e (p[1] |!= '\0')|
|00000ce0| 0a 58 09 09 70 2b 2b 3b | 0a 58 09 72 65 74 75 72 |.X..p++;|.X.retur|
|00000cf0| 6e 20 70 3b 0a 58 20 7d | 0a 58 0a 58 23 69 66 64 |n p;.X }|.X.X#ifd|
|00000d00| 65 66 20 54 45 53 54 0a | 58 6d 61 69 6e 28 29 20 |ef TEST.|Xmain() |
|00000d10| 7b 0a 58 09 63 68 61 72 | 09 2a 70 3b 0a 58 0a 58 |{.X.char|.*p;.X.X|
|00000d20| 09 77 68 69 6c 65 20 28 | 28 70 3d 67 65 74 6c 69 |.while (|(p=getli|
|00000d30| 6e 65 28 73 74 64 69 6e | 29 29 20 21 3d 20 4e 55 |ne(stdin|)) != NU|
|00000d40| 4c 4c 29 0a 58 09 09 66 | 70 75 74 73 28 70 2c 73 |LL).X..f|puts(p,s|
|00000d50| 74 64 6f 75 74 29 3b 0a | 58 7d 0a 58 23 65 6e 64 |tdout);.|X}.X#end|
|00000d60| 69 66 0a 58 0a 45 4e 44 | 5f 4f 46 5f 67 65 74 6c |if.X.END|_OF_getl|
|00000d70| 69 6e 65 2e 63 0a 69 66 | 20 74 65 73 74 20 31 37 |ine.c.if| test 17|
|00000d80| 37 37 20 2d 6e 65 20 60 | 77 63 20 2d 63 20 3c 67 |77 -ne `|wc -c <g|
|00000d90| 65 74 6c 69 6e 65 2e 63 | 60 3b 20 74 68 65 6e 0a |etline.c|`; then.|
|00000da0| 20 20 20 20 65 63 68 6f | 20 73 68 61 72 3a 20 5c | echo| shar: \|
|00000db0| 22 67 65 74 6c 69 6e 65 | 2e 63 5c 22 20 75 6e 70 |"getline|.c\" unp|
|00000dc0| 61 63 6b 65 64 20 77 69 | 74 68 20 77 72 6f 6e 67 |acked wi|th wrong|
|00000dd0| 20 73 69 7a 65 21 0a 66 | 69 0a 23 20 65 6e 64 20 | size!.f|i.# end |
|00000de0| 6f 66 20 6f 76 65 72 77 | 72 69 74 69 6e 67 20 63 |of overw|riting c|
|00000df0| 68 65 63 6b 0a 66 69 0a | 69 66 20 74 65 73 74 20 |heck.fi.|if test |
|00000e00| 2d 66 20 4d 61 6b 65 66 | 69 6c 65 20 2d 61 20 22 |-f Makef|ile -a "|
|00000e10| 24 7b 31 7d 22 20 21 3d | 20 22 2d 63 22 20 3b 20 |${1}" !=| "-c" ; |
|00000e20| 74 68 65 6e 20 0a 20 20 | 65 63 68 6f 20 73 68 61 |then . |echo sha|
|00000e30| 72 3a 20 57 69 6c 6c 20 | 6e 6f 74 20 6f 76 65 72 |r: Will |not over|
|00000e40| 2d 77 72 69 74 65 20 65 | 78 69 73 74 69 6e 67 20 |-write e|xisting |
|00000e50| 66 69 6c 65 20 5c 22 4d | 61 6b 65 66 69 6c 65 5c |file \"M|akefile\|
|00000e60| 22 0a 65 6c 73 65 0a 65 | 63 68 6f 20 73 68 61 72 |".else.e|cho shar|
|00000e70| 3a 20 45 78 74 72 61 63 | 74 69 6e 67 20 5c 22 4d |: Extrac|ting \"M|
|00000e80| 61 6b 65 66 69 6c 65 5c | 22 20 5c 28 38 36 34 20 |akefile\|" \(864 |
|00000e90| 63 68 61 72 61 63 74 65 | 72 73 5c 29 0a 73 65 64 |characte|rs\).sed|
|00000ea0| 20 22 73 2f 5e 58 2f 2f | 22 20 3e 4d 61 6b 65 66 | "s/^X//|" >Makef|
|00000eb0| 69 6c 65 20 3c 3c 27 45 | 4e 44 5f 4f 46 5f 4d 61 |ile <<'E|ND_OF_Ma|
|00000ec0| 6b 65 66 69 6c 65 27 0a | 58 23 20 0a 58 23 20 67 |kefile'.|X# .X# g|
|00000ed0| 65 74 6c 69 6e 65 20 2d | 2d 20 61 20 67 65 74 6c |etline -|- a getl|
|00000ee0| 69 6e 65 20 74 6f 20 67 | 6f 20 77 69 74 68 20 66 |ine to g|o with f|
|00000ef0| 67 65 74 73 0a 58 23 20 | 0a 58 23 20 42 49 4e 44 |gets.X# |.X# BIND|
|00000f00| 49 52 20 69 73 20 77 68 | 65 72 65 20 74 6f 20 70 |IR is wh|ere to p|
|00000f10| 75 74 20 74 68 65 20 65 | 78 65 63 75 74 61 62 6c |ut the e|xecutabl|
|00000f20| 65 2e 0a 58 23 20 4d 41 | 4e 44 49 52 20 69 73 20 |e..X# MA|NDIR is |
|00000f30| 77 68 65 72 65 20 74 68 | 65 20 6d 61 6e 75 61 6c |where th|e manual|
|00000f40| 20 70 61 67 65 73 20 67 | 6f 2c 20 61 6e 64 20 4d | pages g|o, and M|
|00000f50| 41 4e 45 58 54 20 69 73 | 20 74 68 65 20 65 78 74 |ANEXT is| the ext|
|00000f60| 65 6e 73 69 6f 6e 2e 0a | 58 23 20 66 6f 72 20 74 |ension..|X# for t|
|00000f70| 68 65 20 6d 61 6e 20 70 | 61 67 65 73 2c 20 65 2e |he man p|ages, e.|
|00000f80| 67 2e 2c 20 67 65 74 6c | 69 6e 65 2e 31 20 6f 72 |g., getl|ine.1 or|
|00000f90| 20 67 65 74 6c 69 6e 65 | 2e 6c 20 6f 72 20 67 65 | getline|.l or ge|
|00000fa0| 74 6c 69 6e 65 2e 6d 2e | 0a 58 0a 58 42 49 4e 44 |tline.m.|.X.XBIND|
|00000fb0| 49 52 20 3d 20 2f 75 73 | 72 2f 6c 6f 63 61 6c 20 |IR = /us|r/local |
|00000fc0| 20 20 2d 2d 20 77 61 74 | 63 68 20 6f 75 74 21 0a | -- wat|ch out!.|
|00000fd0| 58 4d 41 4e 44 49 52 20 | 3d 20 2f 75 73 72 2f 6d |XMANDIR |= /usr/m|
|00000fe0| 61 6e 2f 6d 61 6e 6c 0a | 58 4d 41 4e 45 58 54 20 |an/manl.|XMANEXT |
|00000ff0| 3d 20 6c 0a 58 0a 58 23 | 20 54 68 65 73 65 20 73 |= l.X.X#| These s|
|00001000| 68 6f 75 6c 64 20 61 6c | 6c 20 6a 75 73 74 20 62 |hould al|l just b|
|00001010| 65 20 72 69 67 68 74 20 | 69 66 20 74 68 65 20 61 |e right |if the a|
|00001020| 62 6f 76 65 20 6f 6e 65 | 73 20 61 72 65 2e 0a 58 |bove one|s are..X|
|00001030| 44 49 52 4e 41 4d 45 20 | 3d 20 24 28 42 49 4e 44 |DIRNAME |= $(BIND|
|00001040| 49 52 29 2f 67 65 74 6c | 69 6e 65 0a 58 44 49 52 |IR)/getl|ine.XDIR|
|00001050| 4e 41 4d 45 5f 4d 20 3d | 20 24 28 4d 41 4e 44 49 |NAME_M =| $(MANDI|
|00001060| 52 29 2f 67 65 74 6c 69 | 6e 65 2e 24 28 4d 41 4e |R)/getli|ne.$(MAN|
|00001070| 45 58 54 29 0a 58 4c 44 | 46 4c 41 47 53 20 3d 0a |EXT).XLD|FLAGS =.|
|00001080| 58 43 46 4c 41 47 53 20 | 3d 20 2d 67 20 2d 44 54 |XCFLAGS |= -g -DT|
|00001090| 45 53 54 0a 58 0a 58 67 | 65 74 6c 69 6e 65 3a 20 |EST.X.Xg|etline: |
|000010a0| 67 65 74 6c 69 6e 65 2e | 63 0a 58 09 24 28 43 43 |getline.|c.X.$(CC|
|000010b0| 29 20 24 28 43 46 4c 41 | 47 53 29 20 24 28 4c 44 |) $(CFLA|GS) $(LD|
|000010c0| 46 4c 41 47 53 29 20 2d | 6f 20 67 65 74 6c 69 6e |FLAGS) -|o getlin|
|000010d0| 65 20 67 65 74 6c 69 6e | 65 2e 63 0a 58 09 40 2d |e getlin|e.c.X.@-|
|000010e0| 73 69 7a 65 20 67 65 74 | 6c 69 6e 65 0a 58 0a 58 |size get|line.X.X|
|000010f0| 69 6e 73 74 61 6c 6c 3a | 20 24 28 44 49 52 4e 41 |install:| $(DIRNA|
|00001100| 4d 45 5f 4d 29 0a 58 0a | 58 24 28 44 49 52 4e 41 |ME_M).X.|X$(DIRNA|
|00001110| 4d 45 29 3a 20 67 65 74 | 6c 69 6e 65 2e 63 0a 58 |ME): get|line.c.X|
|00001120| 09 24 28 43 43 29 20 24 | 28 4c 44 46 4c 41 47 53 |.$(CC) $|(LDFLAGS|
|00001130| 29 20 2d 6f 20 67 65 74 | 6c 69 6e 65 20 67 65 74 |) -o get|line get|
|00001140| 6c 69 6e 65 2e 63 0a 58 | 09 69 6e 73 74 61 6c 6c |line.c.X|.install|
|00001150| 20 2d 63 20 2d 6d 20 37 | 35 35 20 67 65 74 6c 69 | -c -m 7|55 getli|
|00001160| 6e 65 20 24 28 44 49 52 | 4e 41 4d 45 29 0a 58 0a |ne $(DIR|NAME).X.|
|00001170| 58 24 28 44 49 52 4e 41 | 4d 45 5f 4d 29 3a 20 67 |X$(DIRNA|ME_M): g|
|00001180| 65 74 6c 69 6e 65 2e 31 | 0a 58 09 63 70 20 67 65 |etline.1|.X.cp ge|
|00001190| 74 6c 69 6e 65 2e 31 20 | 24 28 44 49 52 4e 41 4d |tline.1 |$(DIRNAM|
|000011a0| 45 5f 4d 29 0a 58 09 63 | 68 6d 6f 64 20 36 34 34 |E_M).X.c|hmod 644|
|000011b0| 20 24 28 44 49 52 4e 41 | 4d 45 5f 4d 29 0a 58 0a | $(DIRNA|ME_M).X.|
|000011c0| 58 0a 58 0a 58 6c 69 6e | 74 3a 0a 58 09 6c 69 6e |X.X.Xlin|t:.X.lin|
|000011d0| 74 20 67 65 74 6c 69 6e | 65 2e 63 0a 58 74 61 67 |t getlin|e.c.Xtag|
|000011e0| 73 3a 0a 58 09 63 74 61 | 67 73 20 2d 77 20 67 65 |s:.X.cta|gs -w ge|
|000011f0| 74 6c 69 6e 65 2e 63 0a | 58 67 65 74 6c 69 6e 65 |tline.c.|Xgetline|
|00001200| 2e 73 68 61 72 3a 0a 58 | 09 73 68 61 72 20 67 65 |.shar:.X|.shar ge|
|00001210| 74 6c 69 6e 65 2e 63 20 | 4d 61 6b 65 66 69 6c 65 |tline.c |Makefile|
|00001220| 20 67 65 74 6c 69 6e 65 | 2e 31 20 3e 20 67 65 74 | getline|.1 > get|
|00001230| 6c 69 6e 65 2e 73 68 61 | 72 0a 58 63 6c 65 61 6e |line.sha|r.Xclean|
|00001240| 3a 0a 58 09 72 6d 20 2d | 66 20 61 2e 6f 75 74 20 |:.X.rm -|f a.out |
|00001250| 63 6f 72 65 20 2a 2e 6f | 20 67 65 74 6c 69 6e 65 |core *.o| getline|
|00001260| 0a 45 4e 44 5f 4f 46 5f | 4d 61 6b 65 66 69 6c 65 |.END_OF_|Makefile|
|00001270| 0a 69 66 20 74 65 73 74 | 20 38 36 34 20 2d 6e 65 |.if test| 864 -ne|
|00001280| 20 60 77 63 20 2d 63 20 | 3c 4d 61 6b 65 66 69 6c | `wc -c |<Makefil|
|00001290| 65 60 3b 20 74 68 65 6e | 0a 20 20 20 20 65 63 68 |e`; then|. ech|
|000012a0| 6f 20 73 68 61 72 3a 20 | 5c 22 4d 61 6b 65 66 69 |o shar: |\"Makefi|
|000012b0| 6c 65 5c 22 20 75 6e 70 | 61 63 6b 65 64 20 77 69 |le\" unp|acked wi|
|000012c0| 74 68 20 77 72 6f 6e 67 | 20 73 69 7a 65 21 0a 66 |th wrong| size!.f|
|000012d0| 69 0a 23 20 65 6e 64 20 | 6f 66 20 6f 76 65 72 77 |i.# end |of overw|
|000012e0| 72 69 74 69 6e 67 20 63 | 68 65 63 6b 0a 66 69 0a |riting c|heck.fi.|
|000012f0| 69 66 20 74 65 73 74 20 | 2d 66 20 67 65 74 6c 69 |if test |-f getli|
|00001300| 6e 65 2e 31 20 2d 61 20 | 22 24 7b 31 7d 22 20 21 |ne.1 -a |"${1}" !|
|00001310| 3d 20 22 2d 63 22 20 3b | 20 74 68 65 6e 20 0a 20 |= "-c" ;| then . |
|00001320| 20 65 63 68 6f 20 73 68 | 61 72 3a 20 57 69 6c 6c | echo sh|ar: Will|
|00001330| 20 6e 6f 74 20 6f 76 65 | 72 2d 77 72 69 74 65 20 | not ove|r-write |
|00001340| 65 78 69 73 74 69 6e 67 | 20 66 69 6c 65 20 5c 22 |existing| file \"|
|00001350| 67 65 74 6c 69 6e 65 2e | 31 5c 22 0a 65 6c 73 65 |getline.|1\".else|
|00001360| 0a 65 63 68 6f 20 73 68 | 61 72 3a 20 45 78 74 72 |.echo sh|ar: Extr|
|00001370| 61 63 74 69 6e 67 20 5c | 22 67 65 74 6c 69 6e 65 |acting \|"getline|
|00001380| 2e 31 5c 22 20 5c 28 38 | 37 33 20 63 68 61 72 61 |.1\" \(8|73 chara|
|00001390| 63 74 65 72 73 5c 29 0a | 73 65 64 20 22 73 2f 5e |cters\).|sed "s/^|
|000013a0| 58 2f 2f 22 20 3e 67 65 | 74 6c 69 6e 65 2e 31 20 |X//" >ge|tline.1 |
|000013b0| 3c 3c 27 45 4e 44 5f 4f | 46 5f 67 65 74 6c 69 6e |<<'END_O|F_getlin|
|000013c0| 65 2e 31 27 0a 58 2e 54 | 48 20 67 65 74 6c 69 6e |e.1'.X.T|H getlin|
|000013d0| 65 20 31 2c 6c 6f 63 61 | 6c 0a 58 2e 53 48 20 4e |e 1,loca|l.X.SH N|
|000013e0| 41 4d 45 0a 58 67 65 74 | 6c 69 6e 65 20 5c 2d 20 |AME.Xget|line \- |
|000013f0| 67 65 74 20 61 20 6c 69 | 6e 65 20 6f 66 20 6e 65 |get a li|ne of ne|
|00001400| 61 72 2d 61 72 62 69 74 | 72 61 72 79 20 6c 65 6e |ar-arbit|rary len|
|00001410| 67 74 68 20 66 72 6f 6d | 20 61 20 73 74 72 65 61 |gth from| a strea|
|00001420| 6d 2e 0a 58 2e 53 48 20 | 53 59 4e 54 41 58 0a 58 |m..X.SH |SYNTAX.X|
|00001430| 2e 6e 66 0a 58 23 69 6e | 63 6c 75 64 65 20 3c 73 |.nf.X#in|clude <s|
|00001440| 74 64 69 6f 2e 68 3e 0a | 58 0a 58 63 68 61 72 20 |tdio.h>.|X.Xchar |
|00001450| 2a 67 65 74 6c 69 6e 65 | 28 73 74 72 65 61 6d 29 |*getline|(stream)|
|00001460| 0a 58 46 49 4c 45 20 2a | 73 74 72 65 61 6d 3b 0a |.XFILE *|stream;.|
|00001470| 58 2e 66 69 0a 58 0a 58 | 2e 53 48 20 44 45 53 43 |X.fi.X.X|.SH DESC|
|00001480| 52 49 50 54 49 4f 4e 0a | 58 54 68 65 20 0a 58 2e |RIPTION.|XThe .X.|
|00001490| 42 20 67 65 74 6c 69 6e | 65 20 0a 58 72 6f 75 74 |B getlin|e .Xrout|
|000014a0| 69 6e 65 20 72 65 61 64 | 73 20 75 70 20 74 6f 20 |ine read|s up to |
|000014b0| 61 20 6e 65 77 6c 69 6e | 65 20 63 68 61 72 61 63 |a newlin|e charac|
|000014c0| 74 65 72 20 66 72 6f 6d | 20 74 68 65 20 73 74 72 |ter from| the str|
|000014d0| 65 61 6d 0a 58 69 6e 74 | 6f 20 61 6e 20 69 6e 74 |eam.Xint|o an int|
|000014e0| 65 72 6e 61 6c 20 63 61 | 63 68 65 20 6f 66 20 61 |ernal ca|che of a|
|000014f0| 72 62 69 74 72 61 72 79 | 20 73 69 7a 65 2e 20 20 |rbitrary| size. |
|00001500| 54 68 65 20 6c 61 73 74 | 20 63 68 61 72 61 63 74 |The last| charact|
|00001510| 65 72 20 72 65 61 64 0a | 58 69 73 20 66 6f 6c 6c |er read.|Xis foll|
|00001520| 6f 77 65 64 20 62 79 20 | 61 20 6e 75 6c 6c 20 63 |owed by |a null c|
|00001530| 68 61 72 61 63 74 65 72 | 2e 20 20 54 68 65 20 67 |haracter|. The g|
|00001540| 65 74 6c 69 6e 65 20 72 | 6f 75 74 69 6e 65 20 72 |etline r|outine r|
|00001550| 65 74 75 72 6e 73 0a 58 | 69 74 73 20 66 69 72 73 |eturns.X|its firs|
|00001560| 74 20 61 72 67 75 6d 65 | 6e 74 20 6f 72 20 4e 55 |t argume|nt or NU|
|00001570| 4c 4c 20 6f 6e 20 65 6e | 64 20 6f 66 20 66 69 6c |LL on en|d of fil|
|00001580| 65 20 6f 72 20 65 72 72 | 6f 72 2e 0a 58 0a 58 2e |e or err|or..X.X.|
|00001590| 53 48 20 44 49 41 47 4e | 4f 53 54 49 43 53 0a 58 |SH DIAGN|OSTICS.X|
|000015a0| 49 66 20 61 20 6c 69 6e | 65 20 6c 6f 6e 67 65 72 |If a lin|e longer|
|000015b0| 20 74 68 61 6e 20 61 76 | 61 69 6c 61 62 6c 65 20 | than av|ailable |
|000015c0| 6d 65 6d 6f 72 79 20 69 | 73 20 72 65 61 64 2c 20 |memory i|s read, |
|000015d0| 74 68 65 20 70 72 6f 67 | 72 61 6d 20 65 78 69 74 |the prog|ram exit|
|000015e0| 73 0a 58 77 69 74 68 20 | 61 20 6d 65 73 73 61 67 |s.Xwith |a messag|
|000015f0| 65 2e 20 20 54 68 69 73 | 20 69 73 20 65 78 70 65 |e. This| is expe|
|00001600| 63 74 65 64 20 74 6f 20 | 62 65 20 61 20 72 61 72 |cted to |be a rar|
|00001610| 65 20 65 76 65 6e 74 2e | 0a 58 0a 58 2e 53 48 20 |e event.|.X.X.SH |
|00001620| 22 53 45 45 20 41 4c 53 | 4f 22 0a 58 66 65 72 72 |"SEE ALS|O".Xferr|
|00001630| 6f 72 28 33 73 29 2c 20 | 66 72 65 61 64 28 33 73 |or(3s), |fread(3s|
|00001640| 29 2c 20 67 65 74 63 28 | 33 73 29 2c 20 70 75 74 |), getc(|3s), put|
|00001650| 73 28 33 73 29 2c 20 73 | 63 61 6e 66 28 33 73 29 |s(3s), s|canf(3s)|
|00001660| 2c 20 66 67 65 74 73 28 | 33 29 2e 0a 58 0a 58 2e |, fgets(|3)..X.X.|
|00001670| 53 48 20 42 55 47 53 0a | 58 53 74 72 69 63 74 6c |SH BUGS.|XStrictl|
|00001680| 79 20 64 65 70 65 6e 64 | 61 6e 74 20 6f 6e 20 74 |y depend|ant on t|
|00001690| 68 65 20 62 65 68 61 76 | 69 6f 72 20 6f 66 20 66 |he behav|ior of f|
|000016a0| 67 65 74 73 3a 20 74 72 | 65 61 74 73 20 61 20 5e |gets: tr|eats a ^|
|000016b0| 44 20 28 65 6f 66 29 20 | 69 6e 0a 58 6d 69 64 2d |D (eof) |in.Xmid-|
|000016c0| 73 74 72 65 61 6d 20 66 | 72 6f 6d 20 61 20 74 65 |stream f|rom a te|
|000016d0| 72 6d 69 6e 61 6c 20 61 | 73 20 64 6f 65 73 20 66 |rminal a|s does f|
|000016e0| 67 65 74 73 20 28 69 65 | 2c 20 69 74 20 64 69 73 |gets (ie|, it dis|
|000016f0| 61 70 70 65 61 72 73 20 | 73 69 6c 65 6e 74 6c 79 |appears |silently|
|00001700| 0a 58 75 6e 64 65 72 20 | 55 6c 74 72 69 78 2f 42 |.Xunder |Ultrix/B|
|00001710| 65 72 7a 65 72 6b 6c 65 | 79 29 0a 58 2e 50 50 0a |erzerkle|y).X.PP.|
|00001720| 58 57 72 69 74 74 65 6e | 20 62 79 20 44 61 76 65 |XWritten| by Dave|
|00001730| 20 28 69 6e 73 74 61 6b | 6c 75 64 67 65 29 20 43 | (instak|ludge) C|
|00001740| 6f 6c 6c 69 65 72 2d 42 | 72 6f 77 6e 2e 0a 45 4e |ollier-B|rown..EN|
|00001750| 44 5f 4f 46 5f 67 65 74 | 6c 69 6e 65 2e 31 0a 69 |D_OF_get|line.1.i|
|00001760| 66 20 74 65 73 74 20 38 | 37 33 20 2d 6e 65 20 60 |f test 8|73 -ne `|
|00001770| 77 63 20 2d 63 20 3c 67 | 65 74 6c 69 6e 65 2e 31 |wc -c <g|etline.1|
|00001780| 60 3b 20 74 68 65 6e 0a | 20 20 20 20 65 63 68 6f |`; then.| echo|
|00001790| 20 73 68 61 72 3a 20 5c | 22 67 65 74 6c 69 6e 65 | shar: \|"getline|
|000017a0| 2e 31 5c 22 20 75 6e 70 | 61 63 6b 65 64 20 77 69 |.1\" unp|acked wi|
|000017b0| 74 68 20 77 72 6f 6e 67 | 20 73 69 7a 65 21 0a 66 |th wrong| size!.f|
|000017c0| 69 0a 23 20 65 6e 64 20 | 6f 66 20 6f 76 65 72 77 |i.# end |of overw|
|000017d0| 72 69 74 69 6e 67 20 63 | 68 65 63 6b 0a 66 69 0a |riting c|heck.fi.|
|000017e0| 65 63 68 6f 20 73 68 61 | 72 3a 20 45 6e 64 20 6f |echo sha|r: End o|
|000017f0| 66 20 73 68 65 6c 6c 20 | 61 72 63 68 69 76 65 2e |f shell |archive.|
|00001800| 0a 65 78 69 74 20 30 0a | 2d 2d 20 0a 20 44 61 76 |.exit 0.|-- . Dav|
|00001810| 69 64 20 43 6f 6c 6c 69 | 65 72 2d 42 72 6f 77 6e |id Colli|er-Brown|
|00001820| 2e 20 20 7b 6d 6e 65 74 | 6f 72 20 79 75 6e 65 78 |. {mnet|or yunex|
|00001830| 75 73 20 75 74 67 70 75 | 7d 21 67 65 61 63 21 64 |us utgpu|}!geac!d|
|00001840| 61 76 65 62 0a 20 47 65 | 61 63 20 43 6f 6d 70 75 |aveb. Ge|ac Compu|
|00001850| 74 65 72 73 20 4c 74 64 | 2e 2c 20 20 7c 20 22 48 |ters Ltd|., | "H|
|00001860| 69 73 20 4d 61 6a 65 73 | 74 79 20 6d 61 64 65 20 |is Majes|ty made |
|00001870| 79 6f 75 20 61 20 6d 61 | 6a 6f 72 20 0a 20 33 35 |you a ma|jor . 35|
|00001880| 30 20 53 74 65 65 6c 63 | 61 73 65 20 52 6f 61 64 |0 Steelc|ase Road|
|00001890| 2c 20 20 20 7c 20 20 62 | 65 63 61 75 73 65 20 68 |, | b|ecause h|
|000018a0| 65 20 62 65 6c 69 65 76 | 65 64 20 79 6f 75 20 77 |e believ|ed you w|
|000018b0| 6f 75 6c 64 20 0a 20 4d | 61 72 6b 68 61 6d 2c 20 |ould . M|arkham, |
|000018c0| 4f 6e 74 61 72 69 6f 2e | 20 20 20 20 20 7c 20 20 |Ontario.| | |
|000018d0| 6b 6e 6f 77 20 77 68 65 | 6e 20 6e 6f 74 20 74 6f |know whe|n not to|
|000018e0| 20 6f 62 65 79 20 68 69 | 73 20 6f 72 64 65 72 73 | obey hi|s orders|
|000018f0| 22 0a | |". | |
+--------+-------------------------+-------------------------+--------+--------+