home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / unix_c / sysadmin / agetty.tar < prev    next >
Tape Archive  |  1990-02-02  |  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: agetty.tar

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Tape Archive (archive/tar) magic Supported
100% file tar archive default
99% file tar archive (V7), file agetty/, mode 755 , uid 1524 , gid 13 , size 0 , seconds 4550162707 default
98% file data default
100% TrID Sybase iAnywhere database files default (weak)
100% siegfried x-fmt/265 Tape Archive Format default
100% lsar Tar default
100% gt2 TAR Archiv gefunden (Auflistung ist deaktiviert) default
100% disktype Pre-POSIX tar archive default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 61 67 65 74 74 79 2f 00 | 00 00 00 00 00 00 00 00 |agetty/.|........|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000050| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000060| 00 00 00 00 20 20 20 37 | 35 35 20 00 20 20 31 35 |.... 7|55 . 15|
|00000070| 32 34 20 00 20 20 20 20 | 31 33 20 00 20 20 20 20 |24 . |13 . |
|00000080| 20 20 20 20 20 20 30 20 | 20 34 35 35 30 31 36 32 | 0 | 4550162|
|00000090| 37 30 37 20 20 20 35 33 | 34 33 00 20 00 00 00 00 |707 53|43. ....|
|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| 61 67 65 74 74 79 2f 53 | 68 61 72 46 69 6c 65 2e |agetty/S|harFile.|
|00000210| 48 65 61 64 65 72 73 00 | 00 00 00 00 00 00 00 00 |Headers.|........|
|00000220| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000260| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 31 35 |.... 6|44 . 15|
|00000270| 32 34 20 00 20 20 20 20 | 31 33 20 00 20 20 20 20 |24 . |13 . |
|00000280| 20 20 20 31 30 33 37 20 | 20 34 35 35 30 31 36 32 | 1037 | 4550162|
|00000290| 37 30 37 20 20 31 30 34 | 32 33 00 20 00 00 00 00 |707 104|23. ....|
|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 61 67 65 74 | 74 79 2e 73 68 61 72 20 |=== aget|ty.shar |
|00000410| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000420| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 0a 46 72 6f 6d 20 73 |========|=.From s|
|00000430| 70 61 72 6b 79 66 73 21 | 61 6d 65 73 21 74 68 69 |parkyfs!|ames!thi|
|00000440| 6e 6b 21 73 61 6d 73 75 | 6e 67 21 63 73 2e 75 74 |nk!samsu|ng!cs.ut|
|00000450| 65 78 61 73 2e 65 64 75 | 21 75 75 6e 65 74 21 61 |exas.edu|!uunet!a|
|00000460| 6c 6c 62 65 72 79 20 46 | 72 69 20 44 65 63 20 31 |llbery F|ri Dec 1|
|00000470| 35 20 30 39 3a 32 38 3a | 33 37 20 50 53 54 20 31 |5 09:28:|37 PST 1|
|00000480| 39 38 39 0a 0a 50 6f 73 | 74 69 6e 67 2d 6e 75 6d |989..Pos|ting-num|
|00000490| 62 65 72 3a 20 56 6f 6c | 75 6d 65 20 39 2c 20 49 |ber: Vol|ume 9, I|
|000004a0| 73 73 75 65 20 36 35 0a | 53 75 62 6d 69 74 74 65 |ssue 65.|Submitte|
|000004b0| 64 2d 62 79 3a 20 77 69 | 65 74 73 65 40 77 7a 76 |d-by: wi|etse@wzv|
|000004c0| 2e 77 69 6e 2e 74 75 65 | 2e 6e 6c 20 28 57 69 65 |.win.tue|.nl (Wie|
|000004d0| 74 73 65 20 5a 2e 20 56 | 65 6e 65 6d 61 29 0a 41 |tse Z. V|enema).A|
|000004e0| 72 63 68 69 76 65 2d 6e | 61 6d 65 3a 20 61 67 65 |rchive-n|ame: age|
|000004f0| 74 74 79 0a 0a 54 68 69 | 73 20 69 73 20 61 20 53 |tty..Thi|s is a S|
|00000500| 59 53 56 20 67 65 74 74 | 79 20 72 65 70 6c 61 63 |YSV gett|y replac|
|00000510| 65 6d 65 6e 74 20 74 68 | 61 74 20 61 64 61 70 74 |ement th|at adapt|
|00000520| 73 20 69 74 73 65 6c 66 | 20 74 6f 20 70 61 72 69 |s itself| to pari|
|00000530| 74 79 20 62 69 74 73 20 | 61 6e 64 0a 74 6f 20 65 |ty bits |and.to e|
|00000540| 72 61 73 65 2c 20 6b 69 | 6c 6c 20 61 6e 64 20 65 |rase, ki|ll and e|
|00000550| 6e 64 2d 6f 66 2d 6c 69 | 6e 65 20 63 68 61 72 61 |nd-of-li|ne chara|
|00000560| 63 74 65 72 73 20 77 68 | 65 6e 20 61 20 75 73 65 |cters wh|en a use|
|00000570| 72 20 65 6e 74 65 72 73 | 20 68 65 72 20 6c 6f 67 |r enters| her log|
|00000580| 69 6e 0a 6e 61 6d 65 2e | 20 20 49 74 20 68 61 73 |in.name.| It has|
|00000590| 20 61 6e 20 6f 70 74 69 | 6f 6e 61 6c 20 66 61 63 | an opti|onal fac|
|000005a0| 69 6c 69 74 79 20 64 6f | 20 64 65 74 65 63 74 20 |ility do| detect |
|000005b0| 74 68 65 20 62 61 75 64 | 20 72 61 74 65 20 6f 66 |the baud| rate of|
|000005c0| 20 69 6e 63 6f 6d 69 6e | 67 0a 63 61 6c 6c 73 20 | incomin|g.calls |
|000005d0| 66 72 6f 6d 20 74 68 65 | 20 73 74 61 74 75 73 20 |from the| status |
|000005e0| 6d 65 73 73 61 67 65 73 | 20 70 72 6f 64 75 63 65 |messages| produce|
|000005f0| 64 20 62 79 20 73 6f 6d | 65 20 6d 75 6c 74 69 2d |d by som|e multi-|
|00000600| 73 70 65 65 64 20 48 61 | 79 65 73 28 74 6d 29 0a |speed Ha|yes(tm).|
|00000610| 6d 6f 64 65 6d 20 63 6c | 6f 6e 65 73 2e 0a 0a 00 |modem cl|ones....|
|00000620| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000630| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000640| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000650| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000660| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000670| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000680| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000690| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000006f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000700| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000710| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000720| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000730| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000740| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000750| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000760| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000770| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000780| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000790| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000007f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000800| 61 67 65 74 74 79 2f 52 | 45 41 44 4d 45 00 00 00 |agetty/R|EADME...|
|00000810| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000820| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000830| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000840| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000850| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000860| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 31 35 |.... 6|44 . 15|
|00000870| 32 34 20 00 20 20 20 20 | 31 33 20 00 20 20 20 20 |24 . |13 . |
|00000880| 20 20 20 20 37 35 32 20 | 20 34 35 35 30 31 36 32 | 752 | 4550162|
|00000890| 37 30 34 20 20 20 36 32 | 37 31 00 20 00 00 00 00 |704 62|71. ....|
|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| 40 28 23 29 20 52 45 41 | 44 4d 45 20 31 2e 31 20 |@(#) REA|DME 1.1 |
|00000a10| 31 31 2f 32 36 2f 38 39 | 20 32 32 3a 30 34 3a 35 |11/26/89| 22:04:5|
|00000a20| 39 0a 0a 54 68 69 73 20 | 69 73 20 61 20 53 59 53 |9..This |is a SYS|
|00000a30| 56 20 67 65 74 74 79 20 | 72 65 70 6c 61 63 65 6d |V getty |replacem|
|00000a40| 65 6e 74 20 74 68 61 74 | 20 61 64 61 70 74 73 20 |ent that| adapts |
|00000a50| 69 74 73 65 6c 66 20 74 | 6f 20 70 61 72 69 74 79 |itself t|o parity|
|00000a60| 20 62 69 74 73 2c 20 61 | 6e 64 0a 74 6f 20 65 72 | bits, a|nd.to er|
|00000a70| 61 73 65 2c 20 6b 69 6c | 6c 20 61 6e 64 20 65 6e |ase, kil|l and en|
|00000a80| 64 2d 6f 66 2d 6c 69 6e | 65 20 63 68 61 72 61 63 |d-of-lin|e charac|
|00000a90| 74 65 72 73 20 66 6f 75 | 6e 64 20 69 6e 20 69 74 |ters fou|nd in it|
|00000aa0| 73 20 69 6e 70 75 74 2e | 20 20 49 74 20 61 6c 73 |s input.| It als|
|00000ab0| 6f 0a 68 61 73 20 61 6e | 20 6f 70 74 69 6f 6e 61 |o.has an| optiona|
|00000ac0| 6c 20 66 61 63 69 6c 69 | 74 79 20 64 6f 20 64 65 |l facili|ty do de|
|00000ad0| 74 65 63 74 20 74 68 65 | 20 62 61 75 64 20 72 61 |tect the| baud ra|
|00000ae0| 74 65 20 6f 66 20 69 6e | 63 6f 6d 69 6e 67 20 63 |te of in|coming c|
|00000af0| 61 6c 6c 73 20 66 72 6f | 6d 0a 74 68 65 20 73 74 |alls fro|m.the st|
|00000b00| 61 74 75 73 20 6d 65 73 | 73 61 67 65 73 20 70 72 |atus mes|sages pr|
|00000b10| 6f 64 75 63 65 64 20 62 | 79 20 73 6f 6d 65 20 6d |oduced b|y some m|
|00000b20| 75 6c 74 69 2d 73 70 65 | 65 64 20 48 61 79 65 73 |ulti-spe|ed Hayes|
|00000b30| 20 6d 6f 64 65 6d 20 63 | 6c 6f 6e 65 73 2e 0a 54 | modem c|lones..T|
|00000b40| 68 69 73 20 70 72 6f 67 | 72 61 6d 20 69 73 20 61 |his prog|ram is a|
|00000b50| 6e 20 61 64 61 70 74 65 | 64 20 76 65 72 73 69 6f |n adapte|d versio|
|00000b60| 6e 20 6f 66 20 61 20 67 | 65 74 74 79 20 49 20 6f |n of a g|etty I o|
|00000b70| 6e 63 65 20 77 72 6f 74 | 65 20 66 6f 72 20 61 20 |nce wrot|e for a |
|00000b80| 56 37 20 55 4e 49 58 0a | 69 6d 70 6c 65 6d 65 6e |V7 UNIX.|implemen|
|00000b90| 74 61 74 69 6f 6e 3b 20 | 69 74 20 64 6f 65 73 20 |tation; |it does |
|00000ba0| 6e 6f 74 20 75 73 65 20 | 74 68 65 20 2f 65 74 63 |not use |the /etc|
|00000bb0| 2f 67 65 74 74 79 64 65 | 66 73 20 66 69 6c 65 2e |/gettyde|fs file.|
|00000bc0| 0a 0a 09 09 57 69 65 74 | 73 65 20 56 65 6e 65 6d |....Wiet|se Venem|
|00000bd0| 61 20 28 77 69 65 74 73 | 65 40 77 7a 76 2e 77 69 |a (wiets|e@wzv.wi|
|00000be0| 6e 2e 74 75 65 2e 6e 6c | 29 0a 72 6f 64 75 63 65 |n.tue.nl|).roduce|
|00000bf0| 64 20 62 79 20 73 6f 6d | 65 20 6d 75 6c 74 69 2d |d by som|e multi-|
|00000c00| 61 67 65 74 74 79 2f 61 | 67 65 74 74 79 2e 63 00 |agetty/a|getty.c.|
|00000c10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c60| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 31 35 |.... 6|44 . 15|
|00000c70| 32 34 20 00 20 20 20 20 | 31 33 20 00 20 20 20 20 |24 . |13 . |
|00000c80| 20 20 34 37 34 34 35 20 | 20 34 35 35 30 31 36 32 | 47445 | 4550162|
|00000c90| 37 30 36 20 20 20 37 31 | 32 36 00 20 00 00 00 00 |706 71|26. ....|
|00000ca0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000cb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000cc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000cd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ce0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000cf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000d90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000da0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000db0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000dc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000dd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000de0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000df0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e00| 2f 2a 2b 2b 0a 2f 2a 20 | 4e 41 4d 45 0a 2f 2a 09 |/*++./* |NAME./*.|
|00000e10| 61 67 65 74 74 79 20 38 | 0a 2f 2a 20 53 55 4d 4d |agetty 8|./* SUMM|
|00000e20| 41 52 59 0a 2f 2a 09 61 | 6c 74 65 72 6e 61 74 69 |ARY./*.a|lternati|
|00000e30| 76 65 20 53 79 73 74 65 | 6d 2d 56 20 67 65 74 74 |ve Syste|m-V gett|
|00000e40| 79 0a 2f 2a 20 53 59 4e | 4f 50 53 49 53 0a 2f 2a |y./* SYN|OPSIS./*|
|00000e50| 09 61 67 65 74 74 79 20 | 5b 2d 61 20 61 6c 74 65 |.agetty |[-a alte|
|00000e60| 72 6e 61 74 65 5f 72 61 | 74 65 73 5d 20 5b 2d 68 |rnate_ra|tes] [-h|
|00000e70| 5d 20 5b 2d 6d 5d 20 5b | 2d 74 20 74 69 6d 65 6f |] [-m] [|-t timeo|
|00000e80| 75 74 5d 20 70 6f 72 74 | 20 62 61 75 64 5f 72 61 |ut] port| baud_ra|
|00000e90| 74 65 0a 2f 2a 20 44 45 | 53 43 52 49 50 54 49 4f |te./* DE|SCRIPTIO|
|00000ea0| 4e 0a 2f 2a 09 5c 66 49 | 61 67 65 74 74 79 5c 66 |N./*.\fI|agetty\f|
|00000eb0| 52 20 6f 70 65 6e 73 20 | 61 20 74 74 79 20 70 6f |R opens |a tty po|
|00000ec0| 72 74 2c 20 70 72 6f 6d | 70 74 73 20 66 6f 72 20 |rt, prom|pts for |
|00000ed0| 61 20 6c 6f 67 69 6e 20 | 6e 61 6d 65 20 61 6e 64 |a login |name and|
|00000ee0| 20 69 6e 76 6f 6b 65 73 | 20 74 68 65 0a 2f 2a 09 | invokes| the./*.|
|00000ef0| 2f 62 69 6e 2f 6c 6f 67 | 69 6e 20 63 6f 6d 6d 61 |/bin/log|in comma|
|00000f00| 6e 64 2e 20 49 74 20 69 | 73 20 6e 6f 72 6d 61 6c |nd. It i|s normal|
|00000f10| 6c 79 20 69 6e 76 6f 6b | 65 64 20 62 79 20 5c 66 |ly invok|ed by \f|
|00000f20| 49 69 6e 69 74 28 38 29 | 5c 66 52 2e 0a 2f 2a 0a |Iinit(8)|\fR../*.|
|00000f30| 2f 2a 09 5c 66 49 61 67 | 65 74 74 79 5c 66 52 20 |/*.\fIag|etty\fR |
|00000f40| 68 61 73 20 73 6f 6d 65 | 20 75 73 65 66 75 6c 20 |has some| useful |
|00000f50| 66 65 61 74 75 72 65 73 | 20 6e 6f 74 20 70 72 65 |features| not pre|
|00000f60| 73 65 6e 74 20 69 6e 20 | 74 68 65 20 53 79 73 74 |sent in |the Syst|
|00000f70| 65 6d 0a 2f 2a 09 56 20 | 52 65 6c 65 61 73 65 20 |em./*.V |Release |
|00000f80| 32 20 67 65 74 74 79 20 | 63 6f 6d 6d 61 6e 64 3a |2 getty |command:|
|00000f90| 0a 2f 2a 20 2e 49 50 20 | 6f 0a 2f 2a 09 41 64 61 |./* .IP |o./*.Ada|
|00000fa0| 70 74 73 20 74 68 65 20 | 74 74 79 20 73 65 74 74 |pts the |tty sett|
|00000fb0| 69 6e 67 73 20 74 6f 20 | 70 61 72 69 74 79 20 62 |ings to |parity b|
|00000fc0| 69 74 73 20 61 6e 64 20 | 74 6f 20 0a 2f 2a 09 65 |its and |to ./*.e|
|00000fd0| 72 61 73 65 2c 20 6b 69 | 6c 6c 20 61 6e 64 20 65 |rase, ki|ll and e|
|00000fe0| 6e 64 2d 6f 66 2d 6c 69 | 6e 65 20 63 68 61 72 61 |nd-of-li|ne chara|
|00000ff0| 63 74 65 72 73 20 66 6f | 75 6e 64 20 69 6e 20 69 |cters fo|und in i|
|00001000| 74 73 20 69 6e 70 75 74 | 2e 20 54 68 65 0a 2f 2a |ts input|. The./*|
|00001010| 09 70 72 6f 67 72 61 6d | 20 75 6e 64 65 72 73 74 |.program| underst|
|00001020| 61 6e 64 73 20 37 2d 62 | 69 74 20 63 68 61 72 61 |ands 7-b|it chara|
|00001030| 63 74 65 72 73 20 77 69 | 74 68 20 65 76 65 6e 2c |cters wi|th even,|
|00001040| 20 6f 64 64 2c 20 6e 6f | 6e 65 20 6f 72 20 73 70 | odd, no|ne or sp|
|00001050| 61 63 65 0a 2f 2a 09 70 | 61 72 69 74 79 2c 20 61 |ace./*.p|arity, a|
|00001060| 6e 64 20 38 2d 62 69 74 | 20 63 68 61 72 61 63 74 |nd 8-bit| charact|
|00001070| 65 72 73 20 77 69 74 68 | 20 6e 6f 20 70 61 72 69 |ers with| no pari|
|00001080| 74 79 2e 20 54 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |ty. The |followin|
|00001090| 67 20 73 70 65 63 69 61 | 6c 0a 2f 2a 09 63 68 61 |g specia|l./*.cha|
|000010a0| 72 61 63 74 65 72 73 20 | 61 72 65 20 72 65 63 6f |racters |are reco|
|000010b0| 67 6e 69 7a 65 64 3a 20 | 40 20 61 6e 64 20 43 6f |gnized: |@ and Co|
|000010c0| 6e 74 72 6f 6c 2d 55 20 | 28 6b 69 6c 6c 29 3b 20 |ntrol-U |(kill); |
|000010d0| 23 2c 20 44 45 4c 20 61 | 6e 64 20 0a 2f 2a 09 62 |#, DEL a|nd ./*.b|
|000010e0| 61 63 6b 73 70 61 63 65 | 20 28 65 72 61 73 65 29 |ackspace| (erase)|
|000010f0| 3b 20 63 61 72 72 69 61 | 67 65 2d 72 65 74 75 72 |; carria|ge-retur|
|00001100| 6e 20 61 6e 64 20 6c 69 | 6e 65 66 65 65 64 20 28 |n and li|nefeed (|
|00001110| 65 6e 64 20 6f 66 20 6c | 69 6e 65 29 2e 0a 2f 2a |end of l|ine)../*|
|00001120| 20 2e 49 50 20 6f 0a 2f | 2a 09 4f 70 74 69 6f 6e | .IP o./|*.Option|
|00001130| 61 6c 6c 79 20 72 65 63 | 6f 67 6e 69 7a 65 73 20 |ally rec|ognizes |
|00001140| 74 68 65 20 62 61 75 64 | 20 72 61 74 65 20 6f 66 |the baud| rate of|
|00001150| 20 69 6e 63 6f 6d 69 6e | 67 0a 2f 2a 09 63 61 6c | incomin|g./*.cal|
|00001160| 6c 73 20 66 72 6f 6d 20 | 74 68 65 20 73 74 61 74 |ls from |the stat|
|00001170| 75 73 20 6d 65 73 73 61 | 67 65 73 20 70 72 6f 64 |us messa|ges prod|
|00001180| 75 63 65 64 20 62 79 20 | 73 6f 6d 65 20 6d 75 6c |uced by |some mul|
|00001190| 74 69 2d 73 70 65 65 64 | 20 48 61 79 65 73 20 28 |ti-speed| Hayes (|
|000011a0| 74 6d 29 0a 2f 2a 09 6d | 6f 64 65 6d 20 63 6c 6f |tm)./*.m|odem clo|
|000011b0| 6e 65 73 2e 0a 2f 2a 20 | 2e 50 50 0a 2f 2a 09 54 |nes../* |.PP./*.T|
|000011c0| 68 69 73 20 70 72 6f 67 | 72 61 6d 20 64 6f 65 73 |his prog|ram does|
|000011d0| 20 6e 6f 74 20 75 73 65 | 20 74 68 65 20 5c 66 49 | not use| the \fI|
|000011e0| 2f 65 74 63 2f 67 65 74 | 74 79 64 65 66 73 5c 66 |/etc/get|tydefs\f|
|000011f0| 52 20 66 69 6c 65 2e 20 | 45 78 63 65 70 74 20 66 |R file. |Except f|
|00001200| 6f 72 20 0a 2f 2a 09 64 | 69 66 66 65 72 65 6e 63 |or ./*.d|ifferenc|
|00001210| 65 73 20 64 65 73 63 72 | 69 62 65 64 20 68 65 72 |es descr|ibed her|
|00001220| 65 20 74 68 65 20 70 72 | 6f 67 72 61 6d 20 61 70 |e the pr|ogram ap|
|00001230| 70 65 61 72 73 20 74 6f | 20 6f 70 65 72 61 74 65 |pears to| operate|
|00001240| 20 73 69 6d 69 6c 61 72 | 0a 2f 2a 09 74 6f 20 74 | similar|./*.to t|
|00001250| 68 65 20 53 79 73 74 65 | 6d 2d 56 20 52 65 6c 65 |he Syste|m-V Rele|
|00001260| 61 73 65 20 32 20 5c 66 | 49 67 65 74 74 79 5c 66 |ase 2 \f|Igetty\f|
|00001270| 52 20 70 72 6f 67 72 61 | 6d 2e 0a 2f 2a 0a 2f 2a |R progra|m../*./*|
|00001280| 09 4f 70 74 69 6f 6e 73 | 3a 0a 2f 2a 20 2e 54 50 |.Options|:./* .TP|
|00001290| 0a 2f 2a 20 2d 61 20 61 | 6c 74 65 72 6e 61 74 65 |./* -a a|lternate|
|000012a0| 5f 72 61 74 65 73 0a 2f | 2a 09 49 6e 69 74 69 61 |_rates./|*.Initia|
|000012b0| 6c 6c 79 20 74 68 65 20 | 70 72 6f 67 72 61 6d 20 |lly the |program |
|000012c0| 77 69 6c 6c 20 75 73 65 | 20 74 68 65 20 5c 66 49 |will use| the \fI|
|000012d0| 62 61 75 64 5f 72 61 74 | 65 5c 66 52 20 61 73 20 |baud_rat|e\fR as |
|000012e0| 73 70 65 63 69 66 69 65 | 64 2e 0a 2f 2a 09 55 70 |specifie|d../*.Up|
|000012f0| 6f 6e 20 72 65 63 65 69 | 70 74 20 6f 66 20 73 75 |on recei|pt of su|
|00001300| 63 63 65 73 73 69 76 65 | 20 42 52 45 41 4b 20 63 |ccessive| BREAK c|
|00001310| 68 61 72 61 63 74 65 72 | 73 20 74 68 65 20 70 72 |haracter|s the pr|
|00001320| 6f 67 72 61 6d 20 77 69 | 6c 6c 20 73 74 65 70 0a |ogram wi|ll step.|
|00001330| 2f 2a 09 74 68 72 6f 75 | 67 68 20 74 68 65 20 5c |/*.throu|gh the \|
|00001340| 66 49 61 6c 74 65 72 6e | 61 74 65 5f 72 61 74 65 |fIaltern|ate_rate|
|00001350| 73 5c 66 52 2c 20 77 68 | 69 63 68 20 73 68 6f 75 |s\fR, wh|ich shou|
|00001360| 6c 64 20 62 65 20 73 70 | 65 63 69 66 69 65 64 20 |ld be sp|ecified |
|00001370| 61 73 20 61 0a 2f 2a 09 | 63 6f 6d 6d 61 2d 73 65 |as a./*.|comma-se|
|00001380| 70 61 72 61 74 65 64 20 | 6c 69 73 74 20 28 70 72 |parated |list (pr|
|00001390| 65 66 65 72 61 62 6c 79 | 20 69 6e 20 64 65 63 72 |eferably| in decr|
|000013a0| 65 61 73 69 6e 67 20 6f | 72 64 65 72 29 2e 20 41 |easing o|rder). A|
|000013b0| 66 74 65 72 20 61 6c 6c | 0a 2f 2a 09 5c 66 49 61 |fter all|./*.\fIa|
|000013c0| 6c 74 65 72 6e 61 74 65 | 5f 72 61 74 65 73 5c 66 |lternate|_rates\f|
|000013d0| 52 20 68 61 76 65 20 62 | 65 65 6e 20 74 72 69 65 |R have b|een trie|
|000013e0| 64 2c 20 5c 66 49 61 67 | 65 74 74 79 5c 66 52 20 |d, \fIag|etty\fR |
|000013f0| 77 69 6c 6c 20 74 72 79 | 20 74 68 65 0a 2f 2a 09 |will try| the./*.|
|00001400| 73 70 65 65 64 20 73 70 | 65 63 69 66 69 65 64 20 |speed sp|ecified |
|00001410| 77 69 74 68 20 74 68 65 | 20 5c 66 49 62 61 75 64 |with the| \fIbaud|
|00001420| 5f 72 61 74 65 5c 66 52 | 20 61 72 67 75 6d 65 6e |_rate\fR| argumen|
|00001430| 74 20 61 6e 64 20 73 6f | 20 6f 6e 2e 0a 2f 2a 20 |t and so| on../* |
|00001440| 2e 54 50 0a 2f 2a 20 2d | 68 0a 2f 2a 09 44 6f 20 |.TP./* -|h./*.Do |
|00001450| 6e 6f 74 20 68 61 6e 67 | 20 75 70 20 74 68 65 20 |not hang| up the |
|00001460| 6c 69 6e 65 2e 20 4e 6f | 72 6d 61 6c 6c 79 2c 20 |line. No|rmally, |
|00001470| 5c 66 49 61 67 65 74 74 | 79 5c 66 52 20 77 69 6c |\fIagett|y\fR wil|
|00001480| 6c 20 6c 6f 77 65 72 0a | 2f 2a 09 44 54 52 20 66 |l lower.|/*.DTR f|
|00001490| 6f 72 20 74 77 6f 20 73 | 65 63 6f 6e 64 73 20 74 |or two s|econds t|
|000014a0| 6f 20 66 6f 72 63 65 20 | 61 20 6d 6f 64 65 6d 20 |o force |a modem |
|000014b0| 74 6f 20 68 61 6e 67 20 | 75 70 20 28 69 66 20 74 |to hang |up (if t|
|000014c0| 68 65 20 68 61 6e 67 75 | 70 0a 2f 2a 09 66 65 61 |he hangu|p./*.fea|
|000014d0| 74 75 72 65 20 68 61 73 | 20 62 65 65 6e 20 63 6f |ture has| been co|
|000014e0| 6d 70 69 6c 65 64 20 69 | 6e 74 6f 20 74 68 65 20 |mpiled i|nto the |
|000014f0| 70 72 6f 67 72 61 6d 29 | 2e 0a 2f 2a 20 2e 54 50 |program)|../* .TP|
|00001500| 0a 2f 2a 20 2d 6d 0a 2f | 2a 09 54 72 79 20 74 6f |./* -m./|*.Try to|
|00001510| 20 65 78 74 72 61 63 74 | 20 74 68 65 20 62 61 75 | extract| the bau|
|00001520| 64 20 72 61 74 65 20 6f | 66 20 69 6e 63 6f 6d 69 |d rate o|f incomi|
|00001530| 6e 67 20 63 61 6c 6c 73 | 20 66 72 6f 6d 20 74 68 |ng calls| from th|
|00001540| 65 20 73 74 61 74 75 73 | 20 6d 65 73 73 61 67 65 |e status| message|
|00001550| 0a 2f 2a 09 70 72 6f 64 | 75 63 65 64 20 62 79 20 |./*.prod|uced by |
|00001560| 73 6f 6d 65 20 48 61 79 | 65 73 20 28 74 6d 29 20 |some Hay|es (tm) |
|00001570| 6d 75 6c 74 69 2d 73 70 | 65 65 64 20 6d 6f 64 65 |multi-sp|eed mode|
|00001580| 6d 20 63 6c 6f 6e 65 73 | 2e 20 54 68 65 73 65 20 |m clones|. These |
|00001590| 75 73 75 61 6c 6c 79 0a | 2f 2a 09 70 72 6f 64 75 |usually.|/*.produ|
|000015a0| 63 65 20 61 20 73 74 61 | 74 75 73 20 6d 65 73 73 |ce a sta|tus mess|
|000015b0| 61 67 65 20 6f 66 20 74 | 68 65 20 66 6f 72 6d 3a |age of t|he form:|
|000015c0| 20 22 3c 6a 75 6e 6b 3e | 3c 73 70 65 65 64 3e 3c | "<junk>|<speed><|
|000015d0| 6a 75 6e 6b 3e 22 2e 0a | 2f 2a 09 49 66 20 6e 6f |junk>"..|/*.If no|
|000015e0| 20 5c 66 49 73 70 65 65 | 64 5c 66 52 20 69 73 20 | \fIspee|d\fR is |
|000015f0| 66 6f 75 6e 64 20 77 69 | 74 68 69 6e 20 6f 6e 65 |found wi|thin one|
|00001600| 20 73 65 63 6f 6e 64 2c | 20 74 68 65 20 5c 66 49 | second,| the \fI|
|00001610| 62 61 75 64 5f 72 61 74 | 65 5c 66 52 20 61 73 0a |baud_rat|e\fR as.|
|00001620| 2f 2a 09 73 70 65 63 69 | 66 69 65 64 20 6f 6e 20 |/*.speci|fied on |
|00001630| 74 68 65 20 63 6f 6d 6d | 61 6e 64 20 6c 69 6e 65 |the comm|and line|
|00001640| 20 77 69 6c 6c 20 62 65 | 20 75 73 65 64 2e 20 53 | will be| used. S|
|00001650| 69 6e 63 65 20 74 68 69 | 73 20 66 65 61 74 75 72 |ince thi|s featur|
|00001660| 65 20 77 69 6c 6c 0a 2f | 2a 09 77 6f 72 6b 20 6f |e will./|*.work o|
|00001670| 6e 6c 79 20 6f 6e 20 6c | 69 67 68 74 6c 79 2d 6c |nly on l|ightly-l|
|00001680| 6f 61 64 65 64 20 73 79 | 73 74 65 6d 73 2c 20 79 |oaded sy|stems, y|
|00001690| 6f 75 20 77 69 6c 6c 20 | 70 72 6f 62 61 62 6c 79 |ou will |probably|
|000016a0| 20 77 61 6e 74 20 74 6f | 20 75 73 65 20 74 68 69 | want to| use thi|
|000016b0| 73 0a 2f 2a 09 66 65 61 | 74 75 72 65 20 69 6e 20 |s./*.fea|ture in |
|000016c0| 63 6f 6d 62 69 6e 61 74 | 69 6f 6e 20 77 69 74 68 |combinat|ion with|
|000016d0| 20 74 68 65 20 5c 66 49 | 2d 61 5c 66 52 20 6f 70 | the \fI|-a\fR op|
|000016e0| 74 69 6f 6e 2e 0a 2f 2a | 20 2e 54 50 0a 2f 2a 20 |tion../*| .TP./* |
|000016f0| 2d 74 20 74 69 6d 65 6f | 75 74 0a 2f 2a 09 43 61 |-t timeo|ut./*.Ca|
|00001700| 75 73 65 73 20 74 68 65 | 20 70 72 6f 67 72 61 6d |uses the| program|
|00001710| 20 74 6f 20 74 65 72 6d | 69 6e 61 74 65 20 69 66 | to term|inate if|
|00001720| 20 6e 6f 20 75 73 65 72 | 20 6e 61 6d 65 20 63 6f | no user| name co|
|00001730| 75 6c 64 20 62 65 20 72 | 65 61 64 0a 2f 2a 09 77 |uld be r|ead./*.w|
|00001740| 69 74 68 69 6e 20 5c 66 | 49 74 69 6d 65 6f 75 74 |ithin \f|Itimeout|
|00001750| 5c 66 52 20 73 65 63 6f | 6e 64 73 2e 20 54 68 69 |\fR seco|nds. Thi|
|00001760| 73 20 69 73 20 75 73 65 | 66 75 6c 20 6f 6e 6c 79 |s is use|ful only|
|00001770| 20 66 6f 72 20 64 69 61 | 6c 2d 69 6e 20 6c 69 6e | for dia|l-in lin|
|00001780| 65 73 2e 0a 2f 2a 20 45 | 58 41 4d 50 4c 45 53 0a |es../* E|XAMPLES.|
|00001790| 2f 2a 09 46 6f 72 20 68 | 61 72 64 2d 77 69 72 65 |/*.For h|ard-wire|
|000017a0| 64 20 6c 69 6e 65 73 3a | 0a 2f 2a 20 2e 74 69 20 |d lines:|./* .ti |
|000017b0| 2b 35 0a 2f 2a 09 09 2f | 65 74 63 2f 61 67 65 74 |+5./*../|etc/aget|
|000017c0| 74 79 20 74 74 79 4d 30 | 20 39 36 30 30 0a 2f 2a |ty ttyM0| 9600./*|
|000017d0| 0a 2f 2a 09 46 6f 72 20 | 64 69 61 6c 2d 69 6e 20 |./*.For |dial-in |
|000017e0| 6c 69 6e 65 73 20 77 69 | 74 68 20 61 20 33 30 30 |lines wi|th a 300|
|000017f0| 2f 31 32 30 30 2f 32 34 | 30 30 20 62 61 75 64 20 |/1200/24|00 baud |
|00001800| 48 61 79 65 73 20 63 6c | 6f 6e 65 3a 0a 2f 2a 20 |Hayes cl|one:./* |
|00001810| 2e 74 69 20 2b 35 0a 2f | 2a 09 09 2f 65 74 63 2f |.ti +5./|*../etc/|
|00001820| 61 67 65 74 74 79 20 2d | 74 36 30 20 2d 6d 20 2d |agetty -|t60 -m -|
|00001830| 61 31 32 30 30 2c 33 30 | 30 20 74 74 79 4d 31 20 |a1200,30|0 ttyM1 |
|00001840| 32 34 30 30 0a 2f 2a 20 | 46 49 4c 45 53 0a 2f 2a |2400./* |FILES./*|
|00001850| 09 2f 65 74 63 2f 75 74 | 6d 70 2c 20 74 68 65 20 |./etc/ut|mp, the |
|00001860| 73 79 73 74 65 6d 20 6c | 6f 67 20 66 69 6c 65 2e |system l|og file.|
|00001870| 0a 2f 2a 20 42 55 47 53 | 0a 2f 2a 09 54 68 65 20 |./* BUGS|./*.The |
|00001880| 62 61 75 64 2d 72 61 74 | 65 20 64 65 74 65 63 74 |baud-rat|e detect|
|00001890| 69 6f 6e 20 63 6f 64 65 | 20 28 74 68 65 20 5c 66 |ion code| (the \f|
|000018a0| 49 2d 6d 5c 66 52 20 6f | 70 74 69 6f 6e 29 20 6f |I-m\fR o|ption) o|
|000018b0| 6e 6c 79 20 77 6f 72 6b | 73 20 69 66 0a 2f 2a 09 |nly work|s if./*.|
|000018c0| 5c 66 49 61 67 65 74 74 | 79 5c 66 52 20 69 73 20 |\fIagett|y\fR is |
|000018d0| 73 63 68 65 64 75 6c 65 | 64 20 73 6f 6f 6e 20 65 |schedule|d soon e|
|000018e0| 6e 6f 75 67 68 20 61 66 | 74 65 72 20 63 6f 6d 70 |nough af|ter comp|
|000018f0| 6c 65 74 69 6f 6e 20 6f | 66 20 61 20 64 69 61 6c |letion o|f a dial|
|00001900| 2d 69 6e 20 0a 2f 2a 09 | 63 61 6c 6c 20 28 77 69 |-in ./*.|call (wi|
|00001910| 74 68 69 6e 20 33 30 20 | 6d 73 20 77 69 74 68 20 |thin 30 |ms with |
|00001920| 6d 6f 64 65 6d 73 20 74 | 68 61 74 20 74 61 6c 6b |modems t|hat talk|
|00001930| 20 61 74 20 32 34 30 30 | 20 62 61 75 64 29 2e 20 | at 2400| baud). |
|00001940| 46 6f 72 20 72 6f 62 75 | 73 74 6e 65 73 73 2c 0a |For robu|stness,.|
|00001950| 2f 2a 09 61 6c 77 61 79 | 73 20 75 73 65 20 74 68 |/*.alway|s use th|
|00001960| 65 20 5c 66 49 2d 6d 5c | 66 52 20 6f 70 74 69 6f |e \fI-m\|fR optio|
|00001970| 6e 20 69 6e 20 63 6f 6d | 62 69 6e 61 74 69 6f 6e |n in com|bination|
|00001980| 20 77 69 74 68 20 74 68 | 65 20 5c 66 49 2d 61 5c | with th|e \fI-a\|
|00001990| 66 52 20 6f 70 74 69 6f | 6e 2e 0a 2f 2a 0a 2f 2a |fR optio|n../*./*|
|000019a0| 09 54 68 65 20 6c 6f 67 | 69 6e 20 70 72 6f 6d 70 |.The log|in promp|
|000019b0| 74 20 69 73 20 61 6c 77 | 61 79 73 20 6f 75 74 70 |t is alw|ays outp|
|000019c0| 75 74 20 77 69 74 68 20 | 73 70 61 63 65 20 70 61 |ut with |space pa|
|000019d0| 72 69 74 79 2e 0a 2f 2a | 20 44 49 41 47 4e 4f 53 |rity../*| DIAGNOS|
|000019e0| 54 49 43 53 0a 2f 2a 09 | 41 6c 6c 20 64 69 61 67 |TICS./*.|All diag|
|000019f0| 6e 6f 73 74 69 63 73 20 | 61 72 65 20 77 72 69 74 |nostics |are writ|
|00001a00| 74 65 6e 20 74 6f 20 74 | 68 65 20 63 6f 6e 73 6f |ten to t|he conso|
|00001a10| 6c 65 2e 0a 2f 2a 0a 2f | 2a 09 49 6e 20 70 61 72 |le../*./|*.In par|
|00001a20| 74 69 63 75 6c 61 72 2c | 20 5c 66 49 61 67 65 74 |ticular,| \fIaget|
|00001a30| 74 79 5c 66 52 20 77 69 | 6c 6c 20 64 65 74 65 63 |ty\fR wi|ll detec|
|00001a40| 74 20 69 66 20 69 74 20 | 69 73 20 61 73 6b 65 64 |t if it |is asked|
|00001a50| 20 74 6f 20 6f 70 65 6e | 0a 2f 2a 09 73 6f 6d 65 | to open|./*.some|
|00001a60| 74 69 6e 67 20 74 68 61 | 74 20 69 73 20 6e 6f 74 |ting tha|t is not|
|00001a70| 20 61 20 74 65 72 6d 69 | 6e 61 6c 2e 0a 2f 2a 20 | a termi|nal../* |
|00001a80| 41 55 54 48 4f 52 28 53 | 29 0a 2f 2a 09 57 2e 5a |AUTHOR(S|)./*.W.Z|
|00001a90| 2e 20 56 65 6e 65 6d 61 | 20 0a 2f 2a 09 77 69 65 |. Venema| ./*.wie|
|00001aa0| 74 73 65 40 77 7a 76 2e | 77 69 6e 2e 74 75 65 2e |tse@wzv.|win.tue.|
|00001ab0| 6e 6c 0a 2f 2a 09 45 69 | 6e 64 68 6f 76 65 6e 20 |nl./*.Ei|ndhoven |
|00001ac0| 55 6e 69 76 65 72 73 69 | 74 79 20 6f 66 20 54 65 |Universi|ty of Te|
|00001ad0| 63 68 6e 6f 6c 6f 67 79 | 0a 2f 2a 09 44 65 70 61 |chnology|./*.Depa|
|00001ae0| 72 74 6d 65 6e 74 20 6f | 66 20 4d 61 74 68 65 6d |rtment o|f Mathem|
|00001af0| 61 74 69 63 73 20 61 6e | 64 20 43 6f 6d 70 75 74 |atics an|d Comput|
|00001b00| 65 72 20 53 63 69 65 6e | 63 65 0a 2f 2a 09 44 65 |er Scien|ce./*.De|
|00001b10| 6e 20 44 6f 6c 65 63 68 | 20 32 2c 20 50 2e 4f 2e |n Dolech| 2, P.O.|
|00001b20| 20 42 6f 78 20 35 31 33 | 2c 20 35 36 30 30 20 4d | Box 513|, 5600 M|
|00001b30| 42 20 45 69 6e 64 68 6f | 76 65 6e 2c 20 54 68 65 |B Eindho|ven, The|
|00001b40| 20 4e 65 74 68 65 72 6c | 61 6e 64 73 0a 2f 2a 20 | Netherl|ands./* |
|00001b50| 43 52 45 41 54 49 4f 4e | 20 44 41 54 45 0a 2f 2a |CREATION| DATE./*|
|00001b60| 09 53 61 74 20 4e 6f 76 | 20 32 35 20 32 32 3a 35 |.Sat Nov| 25 22:5|
|00001b70| 31 3a 30 35 20 4d 45 54 | 20 31 39 38 39 0a 2f 2a |1:05 MET| 1989./*|
|00001b80| 20 4c 41 53 54 20 4d 4f | 44 49 46 49 43 41 54 49 | LAST MO|DIFICATI|
|00001b90| 4f 4e 0a 2f 2a 09 38 39 | 2f 31 32 2f 31 31 20 32 |ON./*.89|/12/11 2|
|00001ba0| 33 3a 30 32 3a 35 35 0a | 2f 2a 20 56 45 52 53 49 |3:02:55.|/* VERSI|
|00001bb0| 4f 4e 2f 52 45 4c 45 41 | 53 45 0a 2f 2a 09 31 2e |ON/RELEA|SE./*.1.|
|00001bc0| 32 30 0a 2f 2a 2d 2d 2a | 2f 0a 0a 23 69 66 6e 64 |20./*--*|/..#ifnd|
|00001bd0| 65 66 20 6c 69 6e 74 0a | 73 74 61 74 69 63 20 63 |ef lint.|static c|
|00001be0| 68 61 72 20 73 63 63 73 | 69 64 5b 5d 20 3d 20 22 |har sccs|id[] = "|
|00001bf0| 40 28 23 29 20 61 67 65 | 74 74 79 2e 63 20 31 2e |@(#) age|tty.c 1.|
|00001c00| 32 30 20 31 32 2f 31 31 | 2f 38 39 20 32 33 3a 30 |20 12/11|/89 23:0|
|00001c10| 32 3a 35 35 22 3b 0a 23 | 65 6e 64 69 66 0a 0a 23 |2:55";.#|endif..#|
|00001c20| 69 6e 63 6c 75 64 65 20 | 3c 73 74 64 69 6f 2e 68 |include |<stdio.h|
|00001c30| 3e 0a 23 69 6e 63 6c 75 | 64 65 20 3c 74 65 72 6d |>.#inclu|de <term|
|00001c40| 69 6f 2e 68 3e 0a 23 69 | 6e 63 6c 75 64 65 20 3c |io.h>.#i|nclude <|
|00001c50| 73 69 67 6e 61 6c 2e 68 | 3e 0a 23 69 6e 63 6c 75 |signal.h|>.#inclu|
|00001c60| 64 65 20 3c 73 79 73 2f | 74 79 70 65 73 2e 68 3e |de <sys/|types.h>|
|00001c70| 0a 23 69 6e 63 6c 75 64 | 65 20 3c 73 79 73 2f 73 |.#includ|e <sys/s|
|00001c80| 74 61 74 2e 68 3e 0a 23 | 69 6e 63 6c 75 64 65 20 |tat.h>.#|include |
|00001c90| 3c 76 61 72 61 72 67 73 | 2e 68 3e 0a 23 69 6e 63 |<varargs|.h>.#inc|
|00001ca0| 6c 75 64 65 20 3c 63 74 | 79 70 65 2e 68 3e 0a 23 |lude <ct|ype.h>.#|
|00001cb0| 69 6e 63 6c 75 64 65 20 | 3c 75 74 6d 70 2e 68 3e |include |<utmp.h>|
|00001cc0| 0a 0a 20 2f 2a 0a 20 20 | 2a 20 54 68 69 6e 67 73 |.. /*. |* Things|
|00001cd0| 20 79 6f 75 20 6d 61 79 | 20 77 61 6e 74 20 74 6f | you may| want to|
|00001ce0| 20 6d 6f 64 69 66 79 2e | 20 48 41 4e 47 55 50 20 | modify.| HANGUP |
|00001cf0| 73 68 6f 75 6c 64 20 62 | 65 20 64 65 66 69 6e 65 |should b|e define|
|00001d00| 64 20 6f 6e 6c 79 20 69 | 66 20 79 6f 75 72 20 74 |d only i|f your t|
|00001d10| 74 79 0a 20 20 2a 20 64 | 72 69 76 65 72 20 69 73 |ty. * d|river is|
|00001d20| 20 6e 6f 74 20 63 61 70 | 61 62 6c 65 20 6f 66 20 | not cap|able of |
|00001d30| 68 61 6e 67 69 6e 67 20 | 75 70 20 74 68 65 20 6d |hanging |up the m|
|00001d40| 6f 64 65 6d 20 28 62 79 | 20 62 72 69 65 66 6c 79 |odem (by| briefly|
|00001d50| 20 64 72 6f 70 70 69 6e | 67 20 44 54 52 29 2e 0a | droppin|g DTR)..|
|00001d60| 20 20 2a 20 49 66 20 48 | 41 4e 47 55 50 20 69 73 | * If H|ANGUP is|
|00001d70| 20 64 65 66 69 6e 65 64 | 20 79 6f 75 20 70 72 6f | defined| you pro|
|00001d80| 62 61 62 6c 79 20 63 61 | 6e 6e 6f 74 20 75 73 65 |bably ca|nnot use|
|00001d90| 20 74 68 65 20 61 75 74 | 6f 2d 62 61 75 64 20 61 | the aut|o-baud a|
|00001da0| 6e 64 20 74 69 6d 65 2d | 6f 75 74 0a 20 20 2a 20 |nd time-|out. * |
|00001db0| 66 65 61 74 75 72 65 73 | 2e 0a 20 20 2a 2f 0a 0a |features|.. */..|
|00001dc0| 23 64 65 66 69 6e 65 20 | 4c 4f 47 49 4e 20 22 5c |#define |LOGIN "\|
|00001dd0| 72 5c 6e 6c 6f 67 69 6e | 3a 20 22 09 09 2f 2a 20 |r\nlogin|: "../* |
|00001de0| 6c 6f 67 69 6e 20 70 72 | 6f 6d 70 74 20 2a 2f 0a |login pr|ompt */.|
|00001df0| 0a 2f 2a 20 23 64 65 66 | 69 6e 65 20 48 41 4e 47 |./* #def|ine HANG|
|00001e00| 55 50 09 09 09 2f 2a 20 | 65 6e 61 62 6c 65 20 68 |UP.../* |enable h|
|00001e10| 61 6e 67 75 70 20 63 6f | 64 65 20 2a 2f 0a 0a 2f |angup co|de */../|
|00001e20| 2a 20 53 6f 6d 65 20 73 | 68 6f 72 74 68 61 6e 64 |* Some s|horthand|
|00001e30| 73 20 66 6f 72 20 63 6f | 6e 74 72 6f 6c 20 63 68 |s for co|ntrol ch|
|00001e40| 61 72 61 63 74 65 72 73 | 20 2a 2f 0a 0a 23 64 65 |aracters| */..#de|
|00001e50| 66 69 6e 65 20 43 54 4c | 28 78 29 09 09 28 78 20 |fine CTL|(x)..(x |
|00001e60| 5e 20 30 31 30 30 29 09 | 2f 2a 20 63 6f 6e 74 72 |^ 0100).|/* contr|
|00001e70| 6f 6c 6c 69 66 79 20 2a | 2f 0a 23 64 65 66 69 6e |ollify *|/.#defin|
|00001e80| 65 09 43 52 09 09 43 54 | 4c 28 27 4d 27 29 09 2f |e.CR..CT|L('M')./|
|00001e90| 2a 20 63 61 72 72 69 61 | 67 65 20 72 65 74 75 72 |* carria|ge retur|
|00001ea0| 6e 20 2a 2f 0a 23 64 65 | 66 69 6e 65 09 4e 4c 09 |n */.#de|fine.NL.|
|00001eb0| 09 43 54 4c 28 27 4a 27 | 29 09 2f 2a 20 6c 69 6e |.CTL('J'|)./* lin|
|00001ec0| 65 66 65 65 64 20 2a 2f | 0a 23 64 65 66 69 6e 65 |efeed */|.#define|
|00001ed0| 09 42 53 09 09 43 54 4c | 28 27 48 27 29 09 2f 2a |.BS..CTL|('H')./*|
|00001ee0| 20 62 61 63 6b 73 70 61 | 63 65 20 2a 2f 0a 23 64 | backspa|ce */.#d|
|00001ef0| 65 66 69 6e 65 09 44 45 | 4c 09 09 43 54 4c 28 27 |efine.DE|L..CTL('|
|00001f00| 3f 27 29 09 2f 2a 20 64 | 65 6c 65 74 65 20 2a 2f |?')./* d|elete */|
|00001f10| 0a 0a 2f 2a 20 44 65 66 | 61 75 6c 74 20 76 61 6c |../* Def|ault val|
|00001f20| 75 65 73 20 6f 66 20 73 | 70 65 63 69 61 6c 20 63 |ues of s|pecial c|
|00001f30| 68 61 72 61 63 74 65 72 | 73 3b 20 79 6f 75 20 6d |haracter|s; you m|
|00001f40| 61 79 20 77 61 6e 74 20 | 74 6f 20 63 68 61 6e 67 |ay want |to chang|
|00001f50| 65 20 74 68 69 73 20 2a | 2f 0a 0a 23 64 65 66 69 |e this *|/..#defi|
|00001f60| 6e 65 20 44 45 46 5f 49 | 4e 54 52 09 43 54 4c 28 |ne DEF_I|NTR.CTL(|
|00001f70| 27 43 27 29 09 2f 2a 20 | 64 65 66 61 75 6c 74 20 |'C')./* |default |
|00001f80| 69 6e 74 65 72 72 75 70 | 74 20 63 68 61 72 61 63 |interrup|t charac|
|00001f90| 74 65 72 20 2a 2f 0a 23 | 64 65 66 69 6e 65 20 44 |ter */.#|define D|
|00001fa0| 45 46 5f 51 55 49 54 09 | 43 54 4c 28 27 5c 5c 27 |EF_QUIT.|CTL('\\'|
|00001fb0| 29 09 2f 2a 20 64 65 66 | 61 75 6c 74 20 71 75 69 |)./* def|ault qui|
|00001fc0| 74 20 63 68 61 72 61 63 | 74 65 72 20 2a 2f 0a 23 |t charac|ter */.#|
|00001fd0| 64 65 66 69 6e 65 20 44 | 45 46 5f 4b 49 4c 4c 09 |define D|EF_KILL.|
|00001fe0| 43 54 4c 28 27 55 27 29 | 09 2f 2a 20 64 65 66 61 |CTL('U')|./* defa|
|00001ff0| 75 6c 74 20 6b 69 6c 6c | 20 63 68 61 72 61 63 74 |ult kill| charact|
|00002000| 65 72 20 2a 2f 0a 23 64 | 65 66 69 6e 65 20 44 45 |er */.#d|efine DE|
|00002010| 46 5f 45 4f 46 09 09 43 | 54 4c 28 27 44 27 29 09 |F_EOF..C|TL('D').|
|00002020| 2f 2a 20 64 65 66 61 75 | 6c 74 20 45 4f 46 20 63 |/* defau|lt EOF c|
|00002030| 68 61 72 61 63 74 65 72 | 20 2a 2f 0a 23 64 65 66 |haracter| */.#def|
|00002040| 69 6e 65 20 44 45 46 5f | 53 57 49 54 43 48 09 43 |ine DEF_|SWITCH.C|
|00002050| 54 4c 28 27 5e 27 29 09 | 2f 2a 20 64 65 66 61 75 |TL('^').|/* defau|
|00002060| 6c 74 20 73 77 69 74 63 | 68 20 63 68 61 72 61 63 |lt switc|h charac|
|00002070| 74 65 72 20 2a 2f 0a 23 | 64 65 66 69 6e 65 20 44 |ter */.#|define D|
|00002080| 45 46 5f 45 52 41 53 45 | 09 42 53 09 09 2f 2a 20 |EF_ERASE|.BS../* |
|00002090| 64 65 66 61 75 6c 74 20 | 65 72 61 73 65 20 63 68 |default |erase ch|
|000020a0| 61 72 61 63 74 65 72 20 | 2a 2f 0a 23 64 65 66 69 |aracter |*/.#defi|
|000020b0| 6e 65 20 44 45 46 5f 45 | 4f 4c 09 09 30 0a 0a 2f |ne DEF_E|OL..0../|
|000020c0| 2a 20 53 74 6f 72 61 67 | 65 20 66 6f 72 20 63 6f |* Storag|e for co|
|000020d0| 6d 6d 61 6e 64 2d 6c 69 | 6e 65 20 6f 70 74 69 6f |mmand-li|ne optio|
|000020e0| 6e 73 20 2a 2f 0a 0a 23 | 64 65 66 69 6e 65 09 4d |ns */..#|define.M|
|000020f0| 41 58 53 50 45 45 44 09 | 31 30 0a 0a 73 74 72 75 |AXSPEED.|10..stru|
|00002100| 63 74 20 6f 70 74 69 6f | 6e 73 20 7b 0a 20 20 20 |ct optio|ns {. |
|00002110| 20 69 6e 74 20 20 20 20 | 20 61 75 74 6f 62 61 75 | int | autobau|
|00002120| 64 3b 09 09 09 2f 2a 20 | 70 72 6f 63 65 73 73 20 |d;.../* |process |
|00002130| 6d 6f 64 65 6d 20 73 74 | 61 74 75 73 20 6d 65 73 |modem st|atus mes|
|00002140| 73 61 67 65 73 20 2a 2f | 0a 20 20 20 20 69 6e 74 |sages */|. int|
|00002150| 20 20 20 20 20 74 69 6d | 65 6f 75 74 3b 09 09 09 | tim|eout;...|
|00002160| 2f 2a 20 74 69 6d 65 6f | 75 74 20 70 65 72 69 6f |/* timeo|ut perio|
|00002170| 64 20 2a 2f 0a 20 20 20 | 20 69 6e 74 20 20 20 20 |d */. | int |
|00002180| 20 68 61 6e 67 75 70 3b | 09 09 09 2f 2a 20 68 61 | hangup;|.../* ha|
|00002190| 6e 67 20 75 70 20 74 74 | 79 20 2a 2f 0a 20 20 20 |ng up tt|y */. |
|000021a0| 20 69 6e 74 20 20 20 20 | 20 6e 75 6d 73 70 65 65 | int | numspee|
|000021b0| 64 3b 09 09 09 2f 2a 20 | 6e 75 6d 62 65 72 20 6f |d;.../* |number o|
|000021c0| 66 20 62 61 75 64 20 72 | 61 74 65 73 20 74 6f 20 |f baud r|ates to |
|000021d0| 74 72 79 20 2a 2f 0a 20 | 20 20 20 69 6e 74 20 20 |try */. | int |
|000021e0| 20 20 20 63 75 72 73 70 | 65 65 64 3b 09 09 09 2f | cursp|eed;.../|
|000021f0| 2a 20 63 75 72 72 65 6e | 74 20 73 70 65 65 64 20 |* curren|t speed |
|00002200| 2a 2f 0a 20 20 20 20 69 | 6e 74 20 20 20 20 20 73 |*/. i|nt s|
|00002210| 70 65 65 64 73 5b 4d 41 | 58 53 50 45 45 44 5d 3b |peeds[MA|XSPEED];|
|00002220| 09 09 2f 2a 20 62 61 75 | 64 20 72 61 74 65 73 20 |../* bau|d rates |
|00002230| 74 6f 20 62 65 20 74 72 | 69 65 64 20 2a 2f 0a 20 |to be tr|ied */. |
|00002240| 20 20 20 63 68 61 72 20 | 20 20 2a 74 74 79 3b 09 | char | *tty;.|
|00002250| 09 09 2f 2a 20 6e 61 6d | 65 20 6f 66 20 74 74 79 |../* nam|e of tty|
|00002260| 20 2a 2f 0a 7d 3b 0a 0a | 2f 2a 20 53 74 6f 72 61 | */.};..|/* Stora|
|00002270| 67 65 20 66 6f 72 20 74 | 68 69 6e 67 73 20 64 65 |ge for t|hings de|
|00002280| 74 65 63 74 65 64 20 77 | 68 69 6c 65 20 74 68 65 |tected w|hile the|
|00002290| 20 6c 6f 67 69 6e 20 6e | 61 6d 65 20 77 61 73 20 | login n|ame was |
|000022a0| 72 65 61 64 20 2a 2f 0a | 0a 73 74 72 75 63 74 20 |read */.|.struct |
|000022b0| 63 68 61 72 64 61 74 61 | 20 7b 0a 20 20 20 20 69 |chardata| {. i|
|000022c0| 6e 74 20 20 20 20 20 65 | 72 61 73 65 3b 09 09 09 |nt e|rase;...|
|000022d0| 2f 2a 20 65 72 61 73 65 | 20 63 68 61 72 61 63 74 |/* erase| charact|
|000022e0| 65 72 20 2a 2f 0a 20 20 | 20 20 69 6e 74 20 20 20 |er */. | int |
|000022f0| 20 20 6b 69 6c 6c 3b 09 | 09 09 2f 2a 20 6b 69 6c | kill;.|../* kil|
|00002300| 6c 20 63 68 61 72 61 63 | 74 65 72 20 2a 2f 0a 20 |l charac|ter */. |
|00002310| 20 20 20 69 6e 74 20 20 | 20 20 20 65 6f 6c 3b 09 | int | eol;.|
|00002320| 09 09 2f 2a 20 65 6e 64 | 2d 6f 66 2d 6c 69 6e 65 |../* end|-of-line|
|00002330| 20 63 68 61 72 61 63 74 | 65 72 20 2a 2f 0a 20 20 | charact|er */. |
|00002340| 20 20 69 6e 74 20 20 20 | 20 20 70 61 72 69 74 79 | int | parity|
|00002350| 3b 09 09 09 2f 2a 20 77 | 68 61 74 20 70 61 72 69 |;.../* w|hat pari|
|00002360| 74 79 20 64 69 64 20 77 | 65 20 73 65 65 20 2a 2f |ty did w|e see */|
|00002370| 0a 20 20 20 20 69 6e 74 | 20 20 20 20 20 63 61 70 |. int| cap|
|00002380| 73 6c 6f 63 6b 3b 09 09 | 09 2f 2a 20 75 70 70 65 |slock;..|./* uppe|
|00002390| 72 20 63 61 73 65 20 77 | 69 74 68 6f 75 74 20 6c |r case w|ithout l|
|000023a0| 6f 77 65 72 20 63 61 73 | 65 20 2a 2f 0a 7d 3b 0a |ower cas|e */.};.|
|000023b0| 0a 2f 2a 20 54 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |./* The |followin|
|000023c0| 67 20 69 73 20 75 73 65 | 64 20 66 6f 72 20 75 6e |g is use|d for un|
|000023d0| 64 65 72 73 74 61 6e 64 | 61 62 6c 65 20 64 69 61 |derstand|able dia|
|000023e0| 67 6e 6f 73 74 69 63 73 | 20 2a 2f 0a 0a 65 78 74 |gnostics| */..ext|
|000023f0| 65 72 6e 20 69 6e 74 20 | 65 72 72 6e 6f 3b 0a 65 |ern int |errno;.e|
|00002400| 78 74 65 72 6e 20 63 68 | 61 72 20 2a 73 79 73 5f |xtern ch|ar *sys_|
|00002410| 65 72 72 6c 69 73 74 5b | 5d 3b 0a 73 74 61 74 69 |errlist[|];.stati|
|00002420| 63 20 63 68 61 72 20 2a | 70 72 6f 67 6e 61 6d 65 |c char *|progname|
|00002430| 3b 0a 65 78 74 65 72 6e | 20 63 68 61 72 20 2a 73 |;.extern| char *s|
|00002440| 74 72 63 70 79 28 29 3b | 0a 65 78 74 65 72 6e 20 |trcpy();|.extern |
|00002450| 63 68 61 72 20 2a 73 74 | 72 63 61 74 28 29 3b 0a |char *st|rcat();.|
|00002460| 0a 2f 2a 20 2e 2e 2e 20 | 2a 2f 0a 0a 6d 61 69 6e |./* ... |*/..main|
|00002470| 28 61 72 67 63 2c 20 61 | 72 67 76 29 0a 69 6e 74 |(argc, a|rgv).int|
|00002480| 20 20 20 20 20 61 72 67 | 63 3b 0a 63 68 61 72 20 | arg|c;.char |
|00002490| 20 2a 2a 61 72 67 76 3b | 0a 7b 0a 20 20 20 20 63 | **argv;|.{. c|
|000024a0| 68 61 72 20 20 20 2a 6c | 6f 67 6e 61 6d 65 3b 09 |har *l|ogname;.|
|000024b0| 09 09 2f 2a 20 6c 6f 67 | 69 6e 20 6e 61 6d 65 2c |../* log|in name,|
|000024c0| 20 67 69 76 65 6e 20 74 | 6f 20 2f 62 69 6e 2f 6c | given t|o /bin/l|
|000024d0| 6f 67 69 6e 20 2a 2f 0a | 20 20 20 20 63 68 61 72 |ogin */.| char|
|000024e0| 20 20 20 2a 67 65 74 5f | 6c 6f 67 6e 61 6d 65 28 | *get_|logname(|
|000024f0| 29 3b 0a 20 20 20 20 73 | 74 72 75 63 74 20 63 68 |);. s|truct ch|
|00002500| 61 72 64 61 74 61 20 63 | 68 61 72 64 61 74 61 3b |ardata c|hardata;|
|00002510| 09 09 2f 2a 20 73 65 74 | 20 62 79 20 67 65 74 5f |../* set| by get_|
|00002520| 6c 6f 67 6e 61 6d 65 28 | 29 20 2a 2f 0a 20 20 20 |logname(|) */. |
|00002530| 20 73 74 72 75 63 74 20 | 74 65 72 6d 69 6f 20 74 | struct |termio t|
|00002540| 65 72 6d 69 6f 3b 09 09 | 2f 2a 20 74 65 72 6d 69 |ermio;..|/* termi|
|00002550| 6e 61 6c 20 6d 6f 64 65 | 20 62 69 74 73 20 2a 2f |nal mode| bits */|
|00002560| 0a 20 20 20 20 73 74 61 | 74 69 63 20 73 74 72 75 |. sta|tic stru|
|00002570| 63 74 20 6f 70 74 69 6f | 6e 73 20 6f 70 74 69 6f |ct optio|ns optio|
|00002580| 6e 73 20 3d 20 7b 0a 09 | 30 2c 09 09 09 09 2f 2a |ns = {..|0,..../*|
|00002590| 20 6e 6f 20 6d 6f 64 65 | 6d 20 73 74 61 74 75 73 | no mode|m status|
|000025a0| 20 6d 65 73 73 61 67 65 | 20 70 72 6f 63 65 73 73 | message| process|
|000025b0| 69 6e 67 20 2a 2f 0a 09 | 30 2c 09 09 09 09 2f 2a |ing */..|0,..../*|
|000025c0| 20 6e 6f 20 74 69 6d 65 | 6f 75 74 20 2a 2f 0a 09 | no time|out */..|
|000025d0| 31 2c 09 09 09 09 2f 2a | 20 64 6f 20 68 61 6e 67 |1,..../*| do hang|
|000025e0| 75 70 20 2a 2f 0a 09 31 | 2c 09 09 09 09 2f 2a 20 |up */..1|,..../* |
|000025f0| 6e 6f 20 62 61 75 64 2d | 72 61 74 65 20 63 79 63 |no baud-|rate cyc|
|00002600| 6c 69 6e 67 20 2a 2f 0a | 09 30 2c 09 09 09 09 2f |ling */.|.0,..../|
|00002610| 2a 20 75 73 65 20 62 61 | 75 64 2d 72 61 74 65 20 |* use ba|ud-rate |
|00002620| 61 72 67 75 6d 65 6e 74 | 20 61 73 20 73 70 65 65 |argument| as spee|
|00002630| 64 20 2a 2f 0a 20 20 20 | 20 7d 3b 0a 0a 20 20 20 |d */. | };.. |
|00002640| 20 70 72 6f 67 6e 61 6d | 65 20 3d 20 61 72 67 76 | prognam|e = argv|
|00002650| 5b 30 5d 3b 0a 0a 20 20 | 20 20 2f 2a 20 50 61 72 |[0];.. | /* Par|
|00002660| 73 65 20 63 6f 6d 6d 61 | 6e 64 2d 6c 69 6e 65 20 |se comma|nd-line |
|00002670| 61 72 67 75 6d 65 6e 74 | 73 20 2a 2f 0a 0a 20 20 |argument|s */.. |
|00002680| 20 20 70 61 72 73 65 5f | 61 72 67 73 28 61 72 67 | parse_|args(arg|
|00002690| 63 2c 20 61 72 67 76 2c | 20 26 6f 70 74 69 6f 6e |c, argv,| &option|
|000026a0| 73 29 3b 0a 0a 20 20 20 | 20 2f 2a 20 55 70 64 61 |s);.. | /* Upda|
|000026b0| 74 65 20 74 68 65 20 75 | 74 6d 70 20 66 69 6c 65 |te the u|tmp file|
|000026c0| 20 2a 2f 0a 0a 20 20 20 | 20 75 70 64 61 74 65 5f | */.. | update_|
|000026d0| 75 74 6d 70 28 6f 70 74 | 69 6f 6e 73 2e 74 74 79 |utmp(opt|ions.tty|
|000026e0| 29 3b 0a 0a 20 20 20 20 | 2f 2a 20 4f 70 65 6e 20 |);.. |/* Open |
|000026f0| 74 68 65 20 74 74 79 20 | 61 73 20 73 74 61 6e 64 |the tty |as stand|
|00002700| 61 72 64 20 7b 20 69 6e | 70 75 74 2c 20 6f 75 74 |ard { in|put, out|
|00002710| 70 75 74 2c 20 65 72 72 | 6f 72 20 7d 20 2a 2f 0a |put, err|or } */.|
|00002720| 0a 20 20 20 20 6f 70 65 | 6e 5f 74 74 79 28 6f 70 |. ope|n_tty(op|
|00002730| 74 69 6f 6e 73 2e 74 74 | 79 2c 20 26 74 65 72 6d |tions.tt|y, &term|
|00002740| 69 6f 29 3b 0a 0a 20 20 | 20 20 2f 2a 20 4f 70 74 |io);.. | /* Opt|
|00002750| 69 6f 6e 61 6c 6c 79 20 | 68 61 6e 67 20 75 70 20 |ionally |hang up |
|00002760| 74 68 65 20 74 74 79 20 | 2a 2f 0a 0a 20 20 20 20 |the tty |*/.. |
|00002770| 69 66 20 28 6f 70 74 69 | 6f 6e 73 2e 68 61 6e 67 |if (opti|ons.hang|
|00002780| 75 70 29 0a 09 68 61 6e | 67 75 70 5f 74 74 79 28 |up)..han|gup_tty(|
|00002790| 26 74 65 72 6d 69 6f 29 | 3b 0a 0a 20 20 20 20 2f |&termio)|;.. /|
|000027a0| 2a 20 49 6e 69 74 69 61 | 6c 69 7a 65 20 74 68 65 |* Initia|lize the|
|000027b0| 20 74 65 72 6d 69 6f 20 | 73 65 74 74 69 6e 67 73 | termio |settings|
|000027c0| 20 28 72 61 77 20 6d 6f | 64 65 2c 20 65 69 67 68 | (raw mo|de, eigh|
|000027d0| 74 2d 62 69 74 2c 20 62 | 6c 6f 63 6b 69 6e 67 20 |t-bit, b|locking |
|000027e0| 69 2f 6f 29 20 2a 2f 0a | 0a 20 20 20 20 74 65 72 |i/o) */.|. ter|
|000027f0| 6d 69 6f 5f 69 6e 69 74 | 28 26 74 65 72 6d 69 6f |mio_init|(&termio|
|00002800| 2c 20 6f 70 74 69 6f 6e | 73 2e 73 70 65 65 64 73 |, option|s.speeds|
|00002810| 5b 30 5d 29 3b 0a 0a 20 | 20 20 20 2f 2a 20 4f 70 |[0]);.. | /* Op|
|00002820| 74 69 6f 6e 61 6c 6c 79 | 20 64 65 74 65 63 74 20 |tionally| detect |
|00002830| 74 68 65 20 62 61 75 64 | 20 72 61 74 65 20 66 72 |the baud| rate fr|
|00002840| 6f 6d 20 74 68 65 20 6d | 6f 64 65 6d 20 73 74 61 |om the m|odem sta|
|00002850| 74 75 73 20 6d 65 73 73 | 61 67 65 20 2a 2f 0a 0a |tus mess|age */..|
|00002860| 20 20 20 20 69 66 20 28 | 6f 70 74 69 6f 6e 73 2e | if (|options.|
|00002870| 61 75 74 6f 62 61 75 64 | 29 0a 09 61 75 74 6f 5f |autobaud|)..auto_|
|00002880| 62 61 75 64 28 26 74 65 | 72 6d 69 6f 29 3b 0a 0a |baud(&te|rmio);..|
|00002890| 20 20 20 20 2f 2a 20 57 | 69 74 68 20 64 69 61 6c | /* W|ith dial|
|000028a0| 2d 69 6e 20 6c 69 6e 65 | 73 2c 20 62 72 69 65 66 |-in line|s, brief|
|000028b0| 6c 79 20 70 61 75 73 65 | 20 74 6f 20 61 6c 6c 6f |ly pause| to allo|
|000028c0| 77 20 6d 6f 64 65 6d 73 | 20 65 74 63 2e 20 74 6f |w modems| etc. to|
|000028d0| 20 73 65 74 74 6c 65 20 | 2a 2f 0a 0a 20 20 20 20 | settle |*/.. |
|000028e0| 69 66 20 28 6f 70 74 69 | 6f 6e 73 2e 74 69 6d 65 |if (opti|ons.time|
|000028f0| 6f 75 74 29 0a 09 28 76 | 6f 69 64 29 20 73 6c 65 |out)..(v|oid) sle|
|00002900| 65 70 28 31 29 3b 0a 0a | 20 20 20 20 2f 2a 20 4f |ep(1);..| /* O|
|00002910| 70 74 69 6f 6e 61 6c 20 | 74 69 6d 65 2d 6f 75 74 |ptional |time-out|
|00002920| 20 66 65 61 74 75 72 65 | 20 2a 2f 0a 0a 20 20 20 | feature| */.. |
|00002930| 20 69 66 20 28 6f 70 74 | 69 6f 6e 73 2e 74 69 6d | if (opt|ions.tim|
|00002940| 65 6f 75 74 29 0a 09 28 | 76 6f 69 64 29 20 61 6c |eout)..(|void) al|
|00002950| 61 72 6d 28 28 75 6e 73 | 69 67 6e 65 64 29 20 6f |arm((uns|igned) o|
|00002960| 70 74 69 6f 6e 73 2e 74 | 69 6d 65 6f 75 74 29 3b |ptions.t|imeout);|
|00002970| 0a 0a 20 20 20 20 2f 2a | 20 52 65 61 64 20 74 68 |.. /*| Read th|
|00002980| 65 20 6c 6f 67 69 6e 20 | 6e 61 6d 65 20 2a 2f 0a |e login |name */.|
|00002990| 0a 20 20 20 20 77 68 69 | 6c 65 20 28 28 6c 6f 67 |. whi|le ((log|
|000029a0| 6e 61 6d 65 20 3d 20 67 | 65 74 5f 6c 6f 67 6e 61 |name = g|et_logna|
|000029b0| 6d 65 28 26 6f 70 74 69 | 6f 6e 73 2c 20 26 63 68 |me(&opti|ons, &ch|
|000029c0| 61 72 64 61 74 61 29 29 | 20 3d 3d 20 30 29 0a 09 |ardata))| == 0)..|
|000029d0| 6e 65 78 74 5f 73 70 65 | 65 64 28 26 74 65 72 6d |next_spe|ed(&term|
|000029e0| 69 6f 2c 20 26 6f 70 74 | 69 6f 6e 73 29 3b 0a 0a |io, &opt|ions);..|
|000029f0| 20 20 20 20 2f 2a 20 44 | 69 73 61 62 6c 65 20 74 | /* D|isable t|
|00002a00| 69 6d 65 2d 6f 75 74 20 | 66 65 61 74 75 72 65 20 |ime-out |feature |
|00002a10| 2a 2f 0a 0a 20 20 20 20 | 69 66 20 28 6f 70 74 69 |*/.. |if (opti|
|00002a20| 6f 6e 73 2e 74 69 6d 65 | 6f 75 74 29 0a 09 28 76 |ons.time|out)..(v|
|00002a30| 6f 69 64 29 20 61 6c 61 | 72 6d 28 30 29 3b 0a 0a |oid) ala|rm(0);..|
|00002a40| 20 20 20 20 2f 2a 20 46 | 69 6e 61 6c 69 7a 65 20 | /* F|inalize |
|00002a50| 74 68 65 20 74 65 72 6d | 69 6f 20 73 65 74 74 69 |the term|io setti|
|00002a60| 6e 67 73 20 2a 2f 0a 0a | 20 20 20 20 74 65 72 6d |ngs */..| term|
|00002a70| 69 6f 5f 66 69 6e 61 6c | 28 26 74 65 72 6d 69 6f |io_final|(&termio|
|00002a80| 2c 20 26 63 68 61 72 64 | 61 74 61 29 3b 0a 0a 20 |, &chard|ata);.. |
|00002a90| 20 20 20 2f 2a 20 4e 6f | 77 20 74 68 65 20 6e 65 | /* No|w the ne|
|00002aa0| 77 6c 69 6e 65 20 73 68 | 6f 75 6c 64 20 62 65 20 |wline sh|ould be |
|00002ab0| 70 72 6f 70 65 72 6c 79 | 20 6f 75 74 70 75 74 20 |properly| output |
|00002ac0| 2a 2f 0a 0a 20 20 20 20 | 28 76 6f 69 64 29 20 77 |*/.. |(void) w|
|00002ad0| 72 69 74 65 28 31 2c 20 | 22 5c 6e 22 2c 20 31 29 |rite(1, |"\n", 1)|
|00002ae0| 3b 0a 0a 20 20 20 20 2f | 2a 20 4c 65 74 20 2f 62 |;.. /|* Let /b|
|00002af0| 69 6e 2f 6c 6f 67 69 6e | 20 74 61 6b 65 20 63 61 |in/login| take ca|
|00002b00| 72 65 20 6f 66 20 70 61 | 73 73 77 6f 72 64 20 76 |re of pa|ssword v|
|00002b10| 61 6c 69 64 61 74 69 6f | 6e 20 2a 2f 0a 0a 20 20 |alidatio|n */.. |
|00002b20| 20 20 65 78 65 63 6c 28 | 22 2f 62 69 6e 2f 6c 6f | execl(|"/bin/lo|
|00002b30| 67 69 6e 22 2c 20 22 6c | 6f 67 69 6e 22 2c 20 6c |gin", "l|ogin", l|
|00002b40| 6f 67 6e 61 6d 65 2c 20 | 28 63 68 61 72 20 2a 29 |ogname, |(char *)|
|00002b50| 20 30 29 3b 0a 20 20 20 | 20 65 72 72 6f 72 28 22 | 0);. | error("|
|00002b60| 25 73 3a 20 63 61 6e 27 | 74 20 65 78 65 63 20 2f |%s: can'|t exec /|
|00002b70| 62 69 6e 2f 6c 6f 67 69 | 6e 22 2c 20 6f 70 74 69 |bin/logi|n", opti|
|00002b80| 6f 6e 73 2e 74 74 79 29 | 3b 0a 20 20 20 20 2f 2a |ons.tty)|;. /*|
|00002b90| 20 4e 4f 54 52 45 41 43 | 48 45 44 20 2a 2f 0a 7d | NOTREAC|HED */.}|
|00002ba0| 0a 0a 2f 2a 20 70 61 72 | 73 65 2d 61 72 67 73 20 |../* par|se-args |
|00002bb0| 2d 20 70 61 72 73 65 20 | 63 6f 6d 6d 61 6e 64 2d |- parse |command-|
|00002bc0| 6c 69 6e 65 20 61 72 67 | 75 6d 65 6e 74 73 20 2a |line arg|uments *|
|00002bd0| 2f 0a 0a 70 61 72 73 65 | 5f 61 72 67 73 28 61 72 |/..parse|_args(ar|
|00002be0| 67 63 2c 20 61 72 67 76 | 2c 20 6f 70 29 0a 69 6e |gc, argv|, op).in|
|00002bf0| 74 20 20 20 20 20 61 72 | 67 63 3b 0a 63 68 61 72 |t ar|gc;.char|
|00002c00| 20 20 2a 2a 61 72 67 76 | 3b 0a 73 74 72 75 63 74 | **argv|;.struct|
|00002c10| 20 6f 70 74 69 6f 6e 73 | 20 2a 6f 70 3b 0a 7b 0a | options| *op;.{.|
|00002c20| 20 20 20 20 65 78 74 65 | 72 6e 20 63 68 61 72 20 | exte|rn char |
|00002c30| 2a 6f 70 74 61 72 67 3b | 09 09 2f 2a 20 67 65 74 |*optarg;|../* get|
|00002c40| 6f 70 74 20 2a 2f 0a 20 | 20 20 20 65 78 74 65 72 |opt */. | exter|
|00002c50| 6e 20 69 6e 74 20 6f 70 | 74 69 6e 64 3b 09 09 09 |n int op|tind;...|
|00002c60| 2f 2a 20 67 65 74 6f 70 | 74 20 2a 2f 0a 20 20 20 |/* getop|t */. |
|00002c70| 20 69 6e 74 20 20 20 20 | 20 63 3b 0a 0a 20 20 20 | int | c;.. |
|00002c80| 20 77 68 69 6c 65 20 28 | 28 63 20 3d 20 67 65 74 | while (|(c = get|
|00002c90| 6f 70 74 28 61 72 67 63 | 2c 20 61 72 67 76 2c 20 |opt(argc|, argv, |
|00002ca0| 22 61 3a 68 6d 74 3a 22 | 29 29 20 21 3d 20 45 4f |"a:hmt:"|)) != EO|
|00002cb0| 46 29 20 7b 0a 09 73 77 | 69 74 63 68 20 28 63 29 |F) {..sw|itch (c)|
|00002cc0| 20 7b 0a 09 63 61 73 65 | 20 27 61 27 3a 09 09 09 | {..case| 'a':...|
|00002cd0| 09 2f 2a 20 65 6e 61 62 | 6c 65 20 61 75 74 6f 2d |./* enab|le auto-|
|00002ce0| 62 61 75 64 20 66 65 61 | 74 75 72 65 20 2a 2f 0a |baud fea|ture */.|
|00002cf0| 09 20 20 20 20 70 61 72 | 73 65 5f 73 70 65 65 64 |. par|se_speed|
|00002d00| 73 28 6f 70 2c 20 6f 70 | 74 61 72 67 29 3b 0a 09 |s(op, op|targ);..|
|00002d10| 20 20 20 20 62 72 65 61 | 6b 3b 0a 09 63 61 73 65 | brea|k;..case|
|00002d20| 20 27 68 27 3a 09 09 09 | 09 2f 2a 20 64 6f 20 6e | 'h':...|./* do n|
|00002d30| 6f 74 20 68 61 6e 67 75 | 70 20 74 68 65 20 74 74 |ot hangu|p the tt|
|00002d40| 79 20 2a 2f 0a 09 20 20 | 20 20 6f 70 2d 3e 68 61 |y */.. | op->ha|
|00002d50| 6e 67 75 70 20 3d 20 30 | 3b 0a 09 20 20 20 20 62 |ngup = 0|;.. b|
|00002d60| 72 65 61 6b 3b 0a 09 63 | 61 73 65 20 27 6d 27 3a |reak;..c|ase 'm':|
|00002d70| 09 09 09 09 2f 2a 20 70 | 61 72 73 65 20 6d 6f 64 |..../* p|arse mod|
|00002d80| 65 6d 20 73 74 61 74 75 | 73 20 6d 65 73 73 61 67 |em statu|s messag|
|00002d90| 65 20 2a 2f 0a 09 20 20 | 20 20 6f 70 2d 3e 61 75 |e */.. | op->au|
|00002da0| 74 6f 62 61 75 64 20 3d | 20 31 3b 0a 09 20 20 20 |tobaud =| 1;.. |
|00002db0| 20 62 72 65 61 6b 3b 0a | 09 63 61 73 65 20 27 74 | break;.|.case 't|
|00002dc0| 27 3a 09 09 09 09 2f 2a | 20 74 69 6d 65 20 6f 75 |':..../*| time ou|
|00002dd0| 74 20 2a 2f 0a 09 20 20 | 20 20 69 66 20 28 28 6f |t */.. | if ((o|
|00002de0| 70 2d 3e 74 69 6d 65 6f | 75 74 20 3d 20 61 74 6f |p->timeo|ut = ato|
|00002df0| 69 28 6f 70 74 61 72 67 | 29 29 20 3c 3d 20 30 29 |i(optarg|)) <= 0)|
|00002e00| 0a 09 09 65 72 72 6f 72 | 28 22 62 61 64 20 74 69 |...error|("bad ti|
|00002e10| 6d 65 6f 75 74 20 76 61 | 6c 75 65 3a 20 25 73 22 |meout va|lue: %s"|
|00002e20| 2c 20 6f 70 74 61 72 67 | 29 3b 0a 09 20 20 20 20 |, optarg|);.. |
|00002e30| 62 72 65 61 6b 3b 0a 09 | 63 61 73 65 20 27 3f 27 |break;..|case '?'|
|00002e40| 3a 0a 09 20 20 20 20 75 | 73 61 67 65 28 29 3b 0a |:.. u|sage();.|
|00002e50| 09 7d 0a 20 20 20 20 7d | 0a 20 20 20 20 69 66 20 |.}. }|. if |
|00002e60| 28 61 72 67 63 20 21 3d | 20 6f 70 74 69 6e 64 20 |(argc !=| optind |
|00002e70| 2b 20 32 29 09 09 09 2f | 2a 20 63 68 65 63 6b 20 |+ 2).../|* check |
|00002e80| 70 61 72 61 6d 65 74 65 | 72 20 63 6f 75 6e 74 20 |paramete|r count |
|00002e90| 2a 2f 0a 09 75 73 61 67 | 65 28 29 3b 0a 20 20 20 |*/..usag|e();. |
|00002ea0| 20 6f 70 2d 3e 74 74 79 | 20 3d 20 61 72 67 76 5b | op->tty| = argv[|
|00002eb0| 6f 70 74 69 6e 64 2b 2b | 5d 3b 09 09 09 2f 2a 20 |optind++|];.../* |
|00002ec0| 74 74 79 20 6e 61 6d 65 | 20 2a 2f 0a 20 20 20 20 |tty name| */. |
|00002ed0| 69 66 20 28 28 6f 70 2d | 3e 73 70 65 65 64 73 5b |if ((op-|>speeds[|
|00002ee0| 30 5d 20 3d 20 62 63 6f | 64 65 28 61 72 67 76 5b |0] = bco|de(argv[|
|00002ef0| 6f 70 74 69 6e 64 5d 29 | 29 20 3c 3d 20 30 29 09 |optind])|) <= 0).|
|00002f00| 2f 2a 20 62 61 75 64 20 | 72 61 74 65 20 2a 2f 0a |/* baud |rate */.|
|00002f10| 09 65 72 72 6f 72 28 22 | 62 61 64 20 73 70 65 65 |.error("|bad spee|
|00002f20| 64 3a 20 25 73 22 2c 20 | 61 72 67 76 5b 6f 70 74 |d: %s", |argv[opt|
|00002f30| 69 6e 64 5d 29 3b 0a 7d | 0a 0a 2f 2a 20 70 61 72 |ind]);.}|../* par|
|00002f40| 73 65 5f 73 70 65 65 64 | 73 20 2d 20 70 61 72 73 |se_speed|s - pars|
|00002f50| 65 20 61 6c 74 65 72 6e | 61 74 65 20 62 61 75 64 |e altern|ate baud|
|00002f60| 20 72 61 74 65 73 20 2a | 2f 0a 0a 70 61 72 73 65 | rates *|/..parse|
|00002f70| 5f 73 70 65 65 64 73 28 | 6f 70 2c 20 61 72 67 29 |_speeds(|op, arg)|
|00002f80| 0a 73 74 72 75 63 74 20 | 6f 70 74 69 6f 6e 73 20 |.struct |options |
|00002f90| 2a 6f 70 3b 0a 63 68 61 | 72 20 20 20 2a 61 72 67 |*op;.cha|r *arg|
|00002fa0| 3b 0a 7b 0a 20 20 20 20 | 63 68 61 72 20 20 20 2a |;.{. |char *|
|00002fb0| 73 74 72 74 6f 6b 28 29 | 3b 0a 20 20 20 20 63 68 |strtok()|;. ch|
|00002fc0| 61 72 20 20 20 2a 63 70 | 3b 0a 0a 20 20 20 20 66 |ar *cp|;.. f|
|00002fd0| 6f 72 20 28 63 70 20 3d | 20 73 74 72 74 6f 6b 28 |or (cp =| strtok(|
|00002fe0| 61 72 67 2c 20 22 2c 22 | 29 3b 20 63 70 20 21 3d |arg, ","|); cp !=|
|00002ff0| 20 30 3b 20 63 70 20 3d | 20 73 74 72 74 6f 6b 28 | 0; cp =| strtok(|
|00003000| 28 63 68 61 72 20 2a 29 | 20 30 2c 20 22 2c 22 29 |(char *)| 0, ",")|
|00003010| 29 20 7b 0a 09 69 66 20 | 28 28 6f 70 2d 3e 73 70 |) {..if |((op->sp|
|00003020| 65 65 64 73 5b 6f 70 2d | 3e 6e 75 6d 73 70 65 65 |eeds[op-|>numspee|
|00003030| 64 2b 2b 5d 20 3d 20 62 | 63 6f 64 65 28 63 70 29 |d++] = b|code(cp)|
|00003040| 29 20 3c 3d 20 30 29 0a | 09 20 20 20 20 65 72 72 |) <= 0).|. err|
|00003050| 6f 72 28 22 62 61 64 20 | 73 70 65 65 64 3a 20 25 |or("bad |speed: %|
|00003060| 73 22 2c 20 63 70 29 3b | 0a 09 69 66 20 28 6f 70 |s", cp);|..if (op|
|00003070| 2d 3e 6e 75 6d 73 70 65 | 65 64 20 3e 20 4d 41 58 |->numspe|ed > MAX|
|00003080| 53 50 45 45 44 29 0a 09 | 20 20 20 20 65 72 72 6f |SPEED)..| erro|
|00003090| 72 28 22 74 6f 6f 20 6d | 61 6e 79 20 61 6c 74 65 |r("too m|any alte|
|000030a0| 72 6e 61 74 65 20 73 70 | 65 65 64 73 22 29 3b 0a |rnate sp|eeds");.|
|000030b0| 20 20 20 20 7d 0a 7d 0a | 0a 2f 2a 20 75 70 64 61 | }.}.|./* upda|
|000030c0| 74 65 5f 75 74 6d 70 20 | 2d 20 75 70 64 61 74 65 |te_utmp |- update|
|000030d0| 20 6f 75 72 20 75 74 6d | 70 20 65 6e 74 72 79 20 | our utm|p entry |
|000030e0| 2a 2f 0a 0a 75 70 64 61 | 74 65 5f 75 74 6d 70 28 |*/..upda|te_utmp(|
|000030f0| 6c 69 6e 65 29 0a 63 68 | 61 72 20 20 20 2a 6c 69 |line).ch|ar *li|
|00003100| 6e 65 3b 0a 7b 0a 20 20 | 20 20 73 74 72 75 63 74 |ne;.{. | struct|
|00003110| 20 75 74 6d 70 20 75 74 | 3b 0a 20 20 20 20 6c 6f | utmp ut|;. lo|
|00003120| 6e 67 20 20 20 20 75 74 | 5f 73 69 7a 65 20 3d 20 |ng ut|_size = |
|00003130| 73 69 7a 65 6f 66 28 75 | 74 29 3b 09 2f 2a 20 61 |sizeof(u|t);./* a|
|00003140| 76 6f 69 64 20 6e 6f 6e | 73 65 6e 73 65 20 2a 2f |void non|sense */|
|00003150| 0a 20 20 20 20 69 6e 74 | 20 20 20 20 20 75 74 5f |. int| ut_|
|00003160| 66 64 3b 0a 20 20 20 20 | 69 6e 74 20 20 20 20 20 |fd;. |int |
|00003170| 6d 79 70 69 64 20 3d 20 | 67 65 74 70 69 64 28 29 |mypid = |getpid()|
|00003180| 3b 0a 20 20 20 20 6c 6f | 6e 67 20 20 20 20 74 69 |;. lo|ng ti|
|00003190| 6d 65 28 29 3b 0a 20 20 | 20 20 6c 6f 6e 67 20 20 |me();. | long |
|000031a0| 20 20 6c 73 65 65 6b 28 | 29 3b 0a 0a 20 20 20 20 | lseek(|);.. |
|000031b0| 2f 2a 0a 20 20 20 20 20 | 2a 20 54 68 65 20 75 74 |/*. |* The ut|
|000031c0| 6d 70 20 66 69 6c 65 20 | 68 6f 6c 64 73 20 6d 69 |mp file |holds mi|
|000031d0| 73 63 65 6c 6c 61 6e 65 | 6f 75 73 20 69 6e 66 6f |scellane|ous info|
|000031e0| 72 6d 61 74 69 6f 6e 20 | 61 62 6f 75 74 20 74 68 |rmation |about th|
|000031f0| 69 6e 67 73 20 73 74 61 | 72 74 65 64 20 62 79 0a |ings sta|rted by.|
|00003200| 20 20 20 20 20 2a 20 2f | 65 74 63 2f 69 6e 69 74 | * /|etc/init|
|00003210| 20 61 6e 64 20 6f 74 68 | 65 72 20 73 79 73 74 65 | and oth|er syste|
|00003220| 6d 2d 72 65 6c 61 74 65 | 64 20 65 76 65 6e 74 73 |m-relate|d events|
|00003230| 2e 20 4f 75 72 20 70 75 | 72 70 6f 73 65 20 69 73 |. Our pu|rpose is|
|00003240| 20 74 6f 20 75 70 64 61 | 74 65 0a 20 20 20 20 20 | to upda|te. |
|00003250| 2a 20 74 68 65 20 75 74 | 6d 70 20 65 6e 74 72 79 |* the ut|mp entry|
|00003260| 20 66 6f 72 20 74 68 65 | 20 63 75 72 72 65 6e 74 | for the| current|
|00003270| 20 70 72 6f 63 65 73 73 | 2c 20 69 6e 20 70 61 72 | process|, in par|
|00003280| 74 69 63 75 6c 61 72 20 | 74 68 65 20 70 72 6f 63 |ticular |the proc|
|00003290| 65 73 73 20 74 79 70 65 | 0a 20 20 20 20 20 2a 20 |ess type|. * |
|000032a0| 61 6e 64 20 74 68 65 20 | 74 74 79 20 6c 69 6e 65 |and the |tty line|
|000032b0| 20 77 65 20 61 72 65 20 | 6c 69 73 74 65 6e 69 6e | we are |listenin|
|000032c0| 67 20 74 6f 2e 20 52 65 | 74 75 72 6e 20 73 75 63 |g to. Re|turn suc|
|000032d0| 63 65 73 73 66 75 6c 6c | 79 20 6f 6e 6c 79 20 69 |cessfull|y only i|
|000032e0| 66 20 74 68 65 0a 20 20 | 20 20 20 2a 20 75 74 6d |f the. | * utm|
|000032f0| 70 20 66 69 6c 65 20 63 | 61 6e 20 62 65 20 6f 70 |p file c|an be op|
|00003300| 65 6e 65 64 20 66 6f 72 | 20 75 70 64 61 74 65 2c |ened for| update,|
|00003310| 20 61 6e 64 20 69 66 20 | 77 65 20 61 72 65 20 61 | and if |we are a|
|00003320| 62 6c 65 20 74 6f 20 66 | 69 6e 64 20 6f 75 72 0a |ble to f|ind our.|
|00003330| 20 20 20 20 20 2a 20 65 | 6e 74 72 79 20 69 6e 20 | * e|ntry in |
|00003340| 74 68 65 20 75 74 6d 70 | 20 66 69 6c 65 2e 0a 20 |the utmp| file.. |
|00003350| 20 20 20 20 2a 2f 0a 0a | 20 20 20 20 69 66 20 28 | */..| if (|
|00003360| 28 75 74 5f 66 64 20 3d | 20 6f 70 65 6e 28 55 54 |(ut_fd =| open(UT|
|00003370| 4d 50 5f 46 49 4c 45 2c | 20 32 29 29 20 3c 20 30 |MP_FILE,| 2)) < 0|
|00003380| 29 20 7b 0a 09 65 72 72 | 6f 72 28 22 25 73 3a 20 |) {..err|or("%s: |
|00003390| 6f 70 65 6e 20 66 6f 72 | 20 75 70 64 61 74 65 22 |open for| update"|
|000033a0| 2c 20 55 54 4d 50 5f 46 | 49 4c 45 29 3b 0a 20 20 |, UTMP_F|ILE);. |
|000033b0| 20 20 7d 20 65 6c 73 65 | 20 7b 0a 09 77 68 69 6c | } else| {..whil|
|000033c0| 65 20 28 72 65 61 64 28 | 75 74 5f 66 64 2c 20 28 |e (read(|ut_fd, (|
|000033d0| 63 68 61 72 20 2a 29 20 | 26 75 74 2c 20 73 69 7a |char *) |&ut, siz|
|000033e0| 65 6f 66 28 75 74 29 29 | 20 3d 3d 20 73 69 7a 65 |eof(ut))| == size|
|000033f0| 6f 66 28 75 74 29 29 20 | 7b 0a 09 20 20 20 20 69 |of(ut)) |{.. i|
|00003400| 66 20 28 75 74 2e 75 74 | 5f 74 79 70 65 20 3d 3d |f (ut.ut|_type ==|
|00003410| 20 49 4e 49 54 5f 50 52 | 4f 43 45 53 53 20 26 26 | INIT_PR|OCESS &&|
|00003420| 20 75 74 2e 75 74 5f 70 | 69 64 20 3d 3d 20 6d 79 | ut.ut_p|id == my|
|00003430| 70 69 64 29 20 7b 0a 09 | 09 75 74 2e 75 74 5f 74 |pid) {..|.ut.ut_t|
|00003440| 79 70 65 20 3d 20 4c 4f | 47 49 4e 5f 50 52 4f 43 |ype = LO|GIN_PROC|
|00003450| 45 53 53 3b 0a 09 09 75 | 74 2e 75 74 5f 74 69 6d |ESS;...u|t.ut_tim|
|00003460| 65 20 3d 20 74 69 6d 65 | 28 28 6c 6f 6e 67 20 2a |e = time|((long *|
|00003470| 29 20 30 29 3b 0a 09 09 | 28 76 6f 69 64 29 20 73 |) 0);...|(void) s|
|00003480| 74 72 6e 63 70 79 28 75 | 74 2e 75 74 5f 6e 61 6d |trncpy(u|t.ut_nam|
|00003490| 65 2c 20 22 4c 4f 47 49 | 4e 22 2c 20 73 69 7a 65 |e, "LOGI|N", size|
|000034a0| 6f 66 28 75 74 2e 75 74 | 5f 6e 61 6d 65 29 29 3b |of(ut.ut|_name));|
|000034b0| 0a 09 09 28 76 6f 69 64 | 29 20 73 74 72 6e 63 70 |...(void|) strncp|
|000034c0| 79 28 75 74 2e 75 74 5f | 6c 69 6e 65 2c 20 6c 69 |y(ut.ut_|line, li|
|000034d0| 6e 65 2c 20 73 69 7a 65 | 6f 66 28 75 74 2e 75 74 |ne, size|of(ut.ut|
|000034e0| 5f 6c 69 6e 65 29 29 3b | 0a 09 09 28 76 6f 69 64 |_line));|...(void|
|000034f0| 29 20 6c 73 65 65 6b 28 | 75 74 5f 66 64 2c 20 2d |) lseek(|ut_fd, -|
|00003500| 75 74 5f 73 69 7a 65 2c | 20 31 29 3b 0a 09 09 28 |ut_size,| 1);...(|
|00003510| 76 6f 69 64 29 20 77 72 | 69 74 65 28 75 74 5f 66 |void) wr|ite(ut_f|
|00003520| 64 2c 20 28 63 68 61 72 | 20 2a 29 20 26 75 74 2c |d, (char| *) &ut,|
|00003530| 20 73 69 7a 65 6f 66 28 | 75 74 29 29 3b 0a 09 09 | sizeof(|ut));...|
|00003540| 28 76 6f 69 64 29 20 63 | 6c 6f 73 65 28 75 74 5f |(void) c|lose(ut_|
|00003550| 66 64 29 3b 0a 09 09 72 | 65 74 75 72 6e 3b 0a 09 |fd);...r|eturn;..|
|00003560| 20 20 20 20 7d 0a 09 7d | 0a 09 65 72 72 6f 72 28 | }..}|..error(|
|00003570| 22 6e 6f 20 75 74 6d 70 | 20 65 6e 74 72 79 20 66 |"no utmp| entry f|
|00003580| 6f 75 6e 64 20 66 6f 72 | 20 70 72 6f 63 65 73 73 |ound for| process|
|00003590| 20 69 64 20 25 75 22 2c | 20 6d 79 70 69 64 29 3b | id %u",| mypid);|
|000035a0| 0a 20 20 20 20 7d 0a 7d | 0a 0a 2f 2a 20 6f 70 65 |. }.}|../* ope|
|000035b0| 6e 5f 74 74 79 20 2d 20 | 6f 70 65 6e 20 74 74 79 |n_tty - |open tty|
|000035c0| 20 61 73 20 73 74 61 6e | 64 61 72 64 20 7b 20 69 | as stan|dard { i|
|000035d0| 6e 70 75 74 2c 20 6f 75 | 74 70 75 74 2c 20 65 72 |nput, ou|tput, er|
|000035e0| 72 6f 72 20 7d 20 2a 2f | 0a 0a 6f 70 65 6e 5f 74 |ror } */|..open_t|
|000035f0| 74 79 28 74 74 79 2c 20 | 74 70 29 0a 63 68 61 72 |ty(tty, |tp).char|
|00003600| 20 20 20 2a 74 74 79 3b | 0a 73 74 72 75 63 74 20 | *tty;|.struct |
|00003610| 74 65 72 6d 69 6f 20 2a | 74 70 3b 0a 7b 0a 20 20 |termio *|tp;.{. |
|00003620| 20 20 73 74 72 75 63 74 | 20 73 74 61 74 20 73 74 | struct| stat st|
|00003630| 3b 0a 0a 20 20 20 20 2f | 2a 20 43 6c 6f 73 65 20 |;.. /|* Close |
|00003640| 73 74 61 6e 64 61 72 64 | 20 7b 20 69 6e 70 75 74 |standard| { input|
|00003650| 2c 20 6f 75 74 70 75 74 | 2c 20 65 72 72 6f 72 20 |, output|, error |
|00003660| 7d 20 66 69 6c 65 73 2c | 20 6a 75 73 74 20 69 6e |} files,| just in|
|00003670| 20 63 61 73 65 20 2a 2f | 0a 0a 20 20 20 20 28 76 | case */|.. (v|
|00003680| 6f 69 64 29 20 63 6c 6f | 73 65 28 30 29 3b 0a 20 |oid) clo|se(0);. |
|00003690| 20 20 20 28 76 6f 69 64 | 29 20 63 6c 6f 73 65 28 | (void|) close(|
|000036a0| 31 29 3b 0a 20 20 20 20 | 28 76 6f 69 64 29 20 63 |1);. |(void) c|
|000036b0| 6c 6f 73 65 28 32 29 3b | 0a 20 20 20 20 65 72 72 |lose(2);|. err|
|000036c0| 6e 6f 20 3d 20 30 3b 09 | 09 09 09 09 2f 2a 20 69 |no = 0;.|..../* i|
|000036d0| 67 6e 6f 72 65 20 61 62 | 6f 76 65 20 65 72 72 6f |gnore ab|ove erro|
|000036e0| 72 73 20 2a 2f 0a 0a 20 | 20 20 20 2f 2a 20 4d 61 |rs */.. | /* Ma|
|000036f0| 6b 65 20 73 75 72 65 20 | 77 65 20 61 72 65 20 67 |ke sure |we are g|
|00003700| 69 76 65 6e 20 61 20 63 | 68 61 72 61 63 74 65 72 |iven a c|haracter|
|00003710| 20 64 65 76 69 63 65 20 | 2a 2f 0a 0a 20 20 20 20 | device |*/.. |
|00003720| 69 66 20 28 63 68 64 69 | 72 28 22 2f 64 65 76 22 |if (chdi|r("/dev"|
|00003730| 29 29 0a 09 65 72 72 6f | 72 28 22 2f 64 65 76 3a |))..erro|r("/dev:|
|00003740| 20 63 68 64 69 72 28 29 | 20 66 61 69 6c 65 64 22 | chdir()| failed"|
|00003750| 29 3b 0a 20 20 20 20 69 | 66 20 28 73 74 61 74 28 |);. i|f (stat(|
|00003760| 74 74 79 2c 20 26 73 74 | 29 20 3c 20 30 29 0a 09 |tty, &st|) < 0)..|
|00003770| 65 72 72 6f 72 28 22 2f | 64 65 76 2f 25 73 3a 20 |error("/|dev/%s: |
|00003780| 73 74 61 74 28 29 20 66 | 61 69 6c 65 64 22 2c 20 |stat() f|ailed", |
|00003790| 74 74 79 29 3b 0a 20 20 | 20 20 69 66 20 28 28 73 |tty);. | if ((s|
|000037a0| 74 2e 73 74 5f 6d 6f 64 | 65 20 26 20 53 5f 49 46 |t.st_mod|e & S_IF|
|000037b0| 4d 54 29 20 21 3d 20 53 | 5f 49 46 43 48 52 29 0a |MT) != S|_IFCHR).|
|000037c0| 09 65 72 72 6f 72 28 22 | 6e 6f 74 20 61 20 63 68 |.error("|not a ch|
|000037d0| 61 72 61 63 74 65 72 20 | 64 65 76 69 63 65 3a 20 |aracter |device: |
|000037e0| 2f 64 65 76 2f 25 73 22 | 2c 20 74 74 79 29 3b 0a |/dev/%s"|, tty);.|
|000037f0| 0a 20 20 20 20 2f 2a 20 | 53 65 74 20 75 70 20 6e |. /* |Set up n|
|00003800| 65 77 20 73 74 61 6e 64 | 61 72 64 20 69 6e 70 75 |ew stand|ard inpu|
|00003810| 74 2c 20 6f 75 74 70 75 | 74 20 61 6e 64 20 65 72 |t, outpu|t and er|
|00003820| 72 6f 72 20 66 69 6c 65 | 73 20 2a 2f 0a 0a 20 20 |ror file|s */.. |
|00003830| 20 20 69 66 20 28 6f 70 | 65 6e 28 74 74 79 2c 20 | if (op|en(tty, |
|00003840| 32 29 20 21 3d 20 30 29 | 09 09 09 2f 2a 20 73 65 |2) != 0)|.../* se|
|00003850| 74 20 75 70 20 73 74 64 | 20 69 6e 70 75 74 20 2a |t up std| input *|
|00003860| 2f 0a 09 65 72 72 6f 72 | 28 22 2f 64 65 76 2f 25 |/..error|("/dev/%|
|00003870| 73 3a 20 63 61 6e 6e 6f | 74 20 6f 70 65 6e 20 61 |s: canno|t open a|
|00003880| 73 20 73 74 61 6e 64 61 | 72 64 20 69 6e 70 75 74 |s standa|rd input|
|00003890| 22 2c 20 74 74 79 29 3b | 0a 20 20 20 20 69 66 20 |", tty);|. if |
|000038a0| 28 64 75 70 28 30 29 20 | 21 3d 20 31 20 7c 7c 20 |(dup(0) |!= 1 || |
|000038b0| 64 75 70 28 30 29 20 21 | 3d 20 32 29 09 09 2f 2a |dup(0) !|= 2)../*|
|000038c0| 20 73 65 74 20 75 70 20 | 73 74 64 20 6f 75 74 20 | set up |std out |
|000038d0| 61 6e 64 20 73 74 64 20 | 65 72 72 20 2a 2f 0a 09 |and std |err */..|
|000038e0| 65 72 72 6f 72 28 22 25 | 73 3a 20 64 75 70 20 70 |error("%|s: dup p|
|000038f0| 72 6f 62 6c 65 6d 22 2c | 20 74 74 79 29 3b 09 09 |roblem",| tty);..|
|00003900| 2f 2a 20 77 65 20 68 61 | 76 65 20 61 20 70 72 6f |/* we ha|ve a pro|
|00003910| 62 6c 65 6d 20 2a 2f 0a | 20 20 20 20 69 66 20 28 |blem */.| if (|
|00003920| 69 6f 63 74 6c 28 30 2c | 20 54 43 47 45 54 41 2c |ioctl(0,| TCGETA,|
|00003930| 20 74 70 29 20 3c 20 30 | 29 09 09 2f 2a 20 72 65 | tp) < 0|)../* re|
|00003940| 61 64 20 74 74 79 20 73 | 74 61 74 75 73 20 62 69 |ad tty s|tatus bi|
|00003950| 74 73 20 2a 2f 0a 09 65 | 72 72 6f 72 28 22 25 73 |ts */..e|rror("%s|
|00003960| 3a 20 69 6f 63 74 6c 20 | 66 61 69 6c 65 64 22 2c |: ioctl |failed",|
|00003970| 20 74 74 79 29 3b 09 09 | 2f 2a 20 74 68 69 73 20 | tty);..|/* this |
|00003980| 69 73 20 6e 6f 74 20 61 | 20 74 65 72 6d 69 6e 61 |is not a| termina|
|00003990| 6c 20 2a 2f 0a 0a 20 20 | 20 20 2f 2a 20 49 74 20 |l */.. | /* It |
|000039a0| 73 65 65 6d 73 20 74 6f | 20 62 65 20 61 20 74 65 |seems to| be a te|
|000039b0| 72 6d 69 6e 61 6c 3b 20 | 73 65 74 20 70 72 6f 70 |rminal; |set prop|
|000039c0| 65 72 20 70 72 6f 74 65 | 63 74 69 6f 6e 73 20 61 |er prote|ctions a|
|000039d0| 6e 64 20 6f 77 6e 65 72 | 73 68 69 70 20 2a 2f 0a |nd owner|ship */.|
|000039e0| 0a 20 20 20 20 28 76 6f | 69 64 29 20 63 68 6f 77 |. (vo|id) chow|
|000039f0| 6e 28 74 74 79 2c 20 30 | 2c 20 30 29 3b 09 09 09 |n(tty, 0|, 0);...|
|00003a00| 2f 2a 20 72 6f 6f 74 2c | 20 73 79 73 20 2a 2f 0a |/* root,| sys */.|
|00003a10| 20 20 20 20 28 76 6f 69 | 64 29 20 63 68 6d 6f 64 | (voi|d) chmod|
|00003a20| 28 74 74 79 2c 20 30 36 | 32 32 29 3b 09 09 09 2f |(tty, 06|22);.../|
|00003a30| 2a 20 63 72 77 2d 2d 77 | 2d 2d 77 2d 20 2a 2f 0a |* crw--w|--w- */.|
|00003a40| 20 20 20 20 65 72 72 6e | 6f 20 3d 20 30 3b 09 09 | errn|o = 0;..|
|00003a50| 09 09 09 2f 2a 20 69 67 | 6e 6f 72 65 20 61 62 6f |.../* ig|nore abo|
|00003a60| 76 65 20 65 72 72 6f 72 | 73 20 2a 2f 0a 7d 0a 0a |ve error|s */.}..|
|00003a70| 2f 2a 20 68 61 6e 67 75 | 70 5f 74 74 79 20 2d 20 |/* hangu|p_tty - |
|00003a80| 68 61 6e 67 20 75 70 20 | 62 79 20 66 6f 72 63 69 |hang up |by forci|
|00003a90| 6e 67 20 44 54 52 20 64 | 6f 77 6e 20 66 6f 72 20 |ng DTR d|own for |
|00003aa0| 61 74 20 6c 65 61 73 74 | 20 32 20 73 65 63 6f 6e |at least| 2 secon|
|00003ab0| 64 73 20 2a 2f 0a 0a 68 | 61 6e 67 75 70 5f 74 74 |ds */..h|angup_tt|
|00003ac0| 79 28 74 70 29 0a 73 74 | 72 75 63 74 20 74 65 72 |y(tp).st|ruct ter|
|00003ad0| 6d 69 6f 20 2a 74 70 3b | 0a 7b 0a 23 69 66 64 65 |mio *tp;|.{.#ifde|
|00003ae0| 66 09 48 41 4e 47 55 50 | 0a 20 20 20 20 28 76 6f |f.HANGUP|. (vo|
|00003af0| 69 64 29 20 73 69 67 6e | 61 6c 28 53 49 47 48 55 |id) sign|al(SIGHU|
|00003b00| 50 2c 20 53 49 47 5f 49 | 47 4e 29 3b 0a 20 20 20 |P, SIG_I|GN);. |
|00003b10| 20 74 70 2d 3e 63 5f 63 | 66 6c 61 67 20 26 3d 20 | tp->c_c|flag &= |
|00003b20| 7e 43 42 41 55 44 3b 0a | 20 20 20 20 74 70 2d 3e |~CBAUD;.| tp->|
|00003b30| 63 5f 63 66 6c 61 67 20 | 7c 3d 20 42 30 3b 0a 20 |c_cflag ||= B0;. |
|00003b40| 20 20 20 28 76 6f 69 64 | 29 20 69 6f 63 74 6c 28 | (void|) ioctl(|
|00003b50| 30 2c 20 54 43 53 45 54 | 41 2c 20 74 70 29 3b 0a |0, TCSET|A, tp);.|
|00003b60| 20 20 20 20 28 76 6f 69 | 64 29 20 73 69 67 6e 61 | (voi|d) signa|
|00003b70| 6c 28 53 49 47 48 55 50 | 2c 20 53 49 47 5f 44 46 |l(SIGHUP|, SIG_DF|
|00003b80| 4c 29 3b 0a 20 20 20 20 | 28 76 6f 69 64 29 20 73 |L);. |(void) s|
|00003b90| 6c 65 65 70 28 32 29 3b | 0a 23 65 6e 64 69 66 0a |leep(2);|.#endif.|
|00003ba0| 7d 0a 0a 2f 2a 20 74 65 | 72 6d 69 6f 5f 69 6e 69 |}../* te|rmio_ini|
|00003bb0| 74 20 2d 20 69 6e 69 74 | 69 61 6c 69 7a 65 20 74 |t - init|ialize t|
|00003bc0| 65 72 6d 69 6f 20 73 65 | 74 74 69 6e 67 73 20 2a |ermio se|ttings *|
|00003bd0| 2f 0a 0a 74 65 72 6d 69 | 6f 5f 69 6e 69 74 28 74 |/..termi|o_init(t|
|00003be0| 70 2c 20 73 70 65 65 64 | 29 0a 73 74 72 75 63 74 |p, speed|).struct|
|00003bf0| 20 74 65 72 6d 69 6f 20 | 2a 74 70 3b 0a 69 6e 74 | termio |*tp;.int|
|00003c00| 20 73 70 65 65 64 3b 0a | 7b 0a 0a 20 20 20 20 2f | speed;.|{.. /|
|00003c10| 2a 0a 20 20 20 20 20 2a | 20 49 6e 69 74 69 61 6c |*. *| Initial|
|00003c20| 20 74 65 72 6d 69 6f 20 | 73 65 74 74 69 6e 67 73 | termio |settings|
|00003c30| 3a 20 38 2d 62 69 74 20 | 63 68 61 72 61 63 74 65 |: 8-bit |characte|
|00003c40| 72 73 2c 20 72 61 77 2d | 6d 6f 64 65 2c 20 62 6c |rs, raw-|mode, bl|
|00003c50| 6f 63 6b 69 6e 67 20 69 | 2f 6f 2e 0a 20 20 20 20 |ocking i|/o.. |
|00003c60| 20 2a 20 53 70 65 63 69 | 61 6c 20 63 68 61 72 61 | * Speci|al chara|
|00003c70| 63 74 65 72 73 20 61 72 | 65 20 73 65 74 20 61 66 |cters ar|e set af|
|00003c80| 74 65 72 20 77 65 20 68 | 61 76 65 20 72 65 61 64 |ter we h|ave read|
|00003c90| 20 74 68 65 20 6c 6f 67 | 69 6e 20 6e 61 6d 65 3b | the log|in name;|
|00003ca0| 20 61 6c 6c 0a 20 20 20 | 20 20 2a 20 72 65 61 64 | all. | * read|
|00003cb0| 73 20 77 69 6c 6c 20 62 | 65 20 64 6f 6e 65 20 69 |s will b|e done i|
|00003cc0| 6e 20 72 61 77 20 6d 6f | 64 65 20 61 6e 79 77 61 |n raw mo|de anywa|
|00003cd0| 79 2e 0a 20 20 20 20 20 | 2a 2f 0a 0a 20 20 20 20 |y.. |*/.. |
|00003ce0| 74 70 2d 3e 63 5f 63 66 | 6c 61 67 20 3d 20 43 53 |tp->c_cf|lag = CS|
|00003cf0| 38 20 7c 20 48 55 50 43 | 4c 20 7c 20 43 52 45 41 |8 | HUPC|L | CREA|
|00003d00| 44 20 7c 20 73 70 65 65 | 64 3b 0a 20 20 20 20 74 |D | spee|d;. t|
|00003d10| 70 2d 3e 63 5f 69 66 6c | 61 67 20 3d 20 74 70 2d |p->c_ifl|ag = tp-|
|00003d20| 3e 63 5f 6c 66 6c 61 67 | 20 3d 20 74 70 2d 3e 63 |>c_lflag| = tp->c|
|00003d30| 5f 6f 66 6c 61 67 20 3d | 20 74 70 2d 3e 63 5f 6c |_oflag =| tp->c_l|
|00003d40| 69 6e 65 20 3d 20 30 3b | 0a 20 20 20 20 74 70 2d |ine = 0;|. tp-|
|00003d50| 3e 63 5f 63 63 5b 56 4d | 49 4e 5d 20 3d 20 31 3b |>c_cc[VM|IN] = 1;|
|00003d60| 0a 20 20 20 20 74 70 2d | 3e 63 5f 63 63 5b 56 54 |. tp-|>c_cc[VT|
|00003d70| 49 4d 45 5d 20 3d 20 30 | 3b 0a 20 20 20 20 28 76 |IME] = 0|;. (v|
|00003d80| 6f 69 64 29 20 69 6f 63 | 74 6c 28 30 2c 20 54 43 |oid) ioc|tl(0, TC|
|00003d90| 53 45 54 41 2c 20 74 70 | 29 3b 0a 7d 0a 0a 2f 2a |SETA, tp|);.}../*|
|00003da0| 20 61 75 74 6f 5f 62 61 | 75 64 20 2d 20 65 78 74 | auto_ba|ud - ext|
|00003db0| 72 61 63 74 20 62 61 75 | 64 20 72 61 74 65 20 66 |ract bau|d rate f|
|00003dc0| 72 6f 6d 20 6d 6f 64 65 | 6d 20 73 74 61 74 75 73 |rom mode|m status|
|00003dd0| 20 6d 65 73 73 61 67 65 | 20 2a 2f 0a 0a 61 75 74 | message| */..aut|
|00003de0| 6f 5f 62 61 75 64 28 74 | 70 29 0a 73 74 72 75 63 |o_baud(t|p).struc|
|00003df0| 74 20 74 65 72 6d 69 6f | 20 2a 74 70 3b 0a 7b 0a |t termio| *tp;.{.|
|00003e00| 20 20 20 20 69 6e 74 20 | 20 20 20 20 73 70 65 65 | int | spee|
|00003e10| 64 3b 0a 20 20 20 20 69 | 6e 74 20 20 20 20 20 76 |d;. i|nt v|
|00003e20| 6d 69 6e 3b 0a 20 20 20 | 20 69 6e 74 20 20 20 20 |min;. | int |
|00003e30| 20 69 66 6c 61 67 3b 0a | 20 20 20 20 63 68 61 72 | iflag;.| char|
|00003e40| 20 20 20 20 62 75 66 5b | 42 55 46 53 49 5a 5d 3b | buf[|BUFSIZ];|
|00003e50| 0a 20 20 20 20 63 68 61 | 72 20 20 20 2a 62 70 3b |. cha|r *bp;|
|00003e60| 0a 20 20 20 20 69 6e 74 | 20 20 20 20 20 6e 72 65 |. int| nre|
|00003e70| 61 64 3b 0a 0a 20 20 20 | 20 2f 2a 0a 20 20 20 20 |ad;.. | /*. |
|00003e80| 20 2a 20 54 68 69 73 20 | 77 6f 72 6b 73 20 6f 6e | * This |works on|
|00003e90| 6c 79 20 69 66 20 74 68 | 65 20 6d 6f 64 65 6d 20 |ly if th|e modem |
|00003ea0| 70 72 6f 64 75 63 65 73 | 20 69 74 73 20 73 74 61 |produces| its sta|
|00003eb0| 74 75 73 20 63 6f 64 65 | 20 41 46 54 45 52 20 72 |tus code| AFTER r|
|00003ec0| 61 69 73 69 6e 67 0a 20 | 20 20 20 20 2a 20 74 68 |aising. | * th|
|00003ed0| 65 20 44 43 44 20 6c 69 | 6e 65 2c 20 61 6e 64 20 |e DCD li|ne, and |
|00003ee0| 69 66 20 74 68 65 20 63 | 6f 6d 70 75 74 65 72 20 |if the c|omputer |
|00003ef0| 69 73 20 66 61 73 74 20 | 65 6e 6f 75 67 68 20 74 |is fast |enough t|
|00003f00| 6f 20 73 65 74 20 74 68 | 65 20 70 72 6f 70 65 72 |o set th|e proper|
|00003f10| 0a 20 20 20 20 20 2a 20 | 62 61 75 64 20 72 61 74 |. * |baud rat|
|00003f20| 65 20 62 65 66 6f 72 65 | 20 74 68 65 20 6d 65 73 |e before| the mes|
|00003f30| 73 61 67 65 20 68 61 73 | 20 67 6f 6e 65 20 62 79 |sage has| gone by|
|00003f40| 2e 20 57 65 20 65 78 70 | 65 63 74 20 61 20 6d 65 |. We exp|ect a me|
|00003f50| 73 73 61 67 65 20 6f 66 | 20 74 68 65 0a 20 20 20 |ssage of| the. |
|00003f60| 20 20 2a 20 66 6f 6c 6c | 6f 77 69 6e 67 20 66 6f | * foll|owing fo|
|00003f70| 72 6d 61 74 3a 0a 20 20 | 20 20 20 2a 20 0a 20 20 |rmat:. | * . |
|00003f80| 20 20 20 2a 20 3c 6a 75 | 6e 6b 3e 3c 6e 75 6d 62 | * <ju|nk><numb|
|00003f90| 65 72 3e 3c 6a 75 6e 6b | 3e 0a 20 20 20 20 20 2a |er><junk|>. *|
|00003fa0| 20 0a 20 20 20 20 20 2a | 20 54 68 65 20 6e 75 6d | . *| The num|
|00003fb0| 62 65 72 20 69 73 20 69 | 6e 74 65 72 70 72 65 74 |ber is i|nterpret|
|00003fc0| 65 64 20 61 73 20 74 68 | 65 20 62 61 75 64 20 72 |ed as th|e baud r|
|00003fd0| 61 74 65 20 6f 66 20 74 | 68 65 20 69 6e 63 6f 6d |ate of t|he incom|
|00003fe0| 69 6e 67 20 63 61 6c 6c | 2e 20 49 66 20 74 68 65 |ing call|. If the|
|00003ff0| 0a 20 20 20 20 20 2a 20 | 6d 6f 64 65 6d 20 64 6f |. * |modem do|
|00004000| 65 73 20 6e 6f 74 20 74 | 65 6c 6c 20 75 73 20 74 |es not t|ell us t|
|00004010| 68 65 20 62 61 75 64 20 | 72 61 74 65 20 77 69 74 |he baud |rate wit|
|00004020| 68 69 6e 20 6f 6e 65 20 | 73 65 63 6f 6e 64 20 77 |hin one |second w|
|00004030| 65 20 77 69 6c 6c 20 6b | 65 65 70 0a 20 20 20 20 |e will k|eep. |
|00004040| 20 2a 20 75 73 69 6e 67 | 20 74 68 65 20 63 75 72 | * using| the cur|
|00004050| 72 65 6e 74 20 62 61 75 | 64 20 72 61 74 65 2e 20 |rent bau|d rate. |
|00004060| 49 74 20 69 73 20 61 64 | 76 69 73 61 62 6c 65 20 |It is ad|visable |
|00004070| 74 6f 20 65 6e 61 62 6c | 65 20 62 61 75 64 2d 72 |to enabl|e baud-r|
|00004080| 61 74 65 0a 20 20 20 20 | 20 2a 20 63 79 63 6c 69 |ate. | * cycli|
|00004090| 6e 67 20 28 2d 61 20 6f | 70 74 69 6f 6e 29 20 69 |ng (-a o|ption) i|
|000040a0| 66 20 74 68 65 20 70 72 | 6f 63 65 73 73 69 6e 67 |f the pr|ocessing|
|000040b0| 20 6f 66 20 6d 6f 64 65 | 6d 20 73 74 61 74 75 73 | of mode|m status|
|000040c0| 20 6d 65 73 73 61 67 65 | 73 20 69 73 0a 20 20 20 | message|s is. |
|000040d0| 20 20 2a 20 65 6e 61 62 | 6c 65 64 2e 0a 20 20 20 | * enab|led.. |
|000040e0| 20 20 2a 2f 0a 0a 20 20 | 20 20 2f 2a 20 55 73 65 | */.. | /* Use|
|000040f0| 20 37 2d 62 69 74 20 63 | 68 61 72 61 63 74 65 72 | 7-bit c|haracter|
|00004100| 73 2c 20 64 6f 6e 27 74 | 20 62 6c 6f 63 6b 20 69 |s, don't| block i|
|00004110| 66 20 69 6e 70 75 74 20 | 71 75 65 75 65 20 69 73 |f input |queue is|
|00004120| 20 65 6d 70 74 79 20 2a | 2f 0a 0a 20 20 20 20 69 | empty *|/.. i|
|00004130| 66 6c 61 67 20 3d 20 74 | 70 2d 3e 63 5f 69 66 6c |flag = t|p->c_ifl|
|00004140| 61 67 3b 0a 20 20 20 20 | 74 70 2d 3e 63 5f 69 66 |ag;. |tp->c_if|
|00004150| 6c 61 67 20 7c 3d 20 49 | 53 54 52 49 50 3b 09 09 |lag |= I|STRIP;..|
|00004160| 09 2f 2a 20 65 6e 61 62 | 6c 65 20 38 74 68 2d 62 |./* enab|le 8th-b|
|00004170| 69 74 20 73 74 72 69 70 | 70 69 6e 67 20 2a 2f 0a |it strip|ping */.|
|00004180| 20 20 20 20 76 6d 69 6e | 20 3d 20 74 70 2d 3e 63 | vmin| = tp->c|
|00004190| 5f 63 63 5b 56 4d 49 4e | 5d 3b 0a 20 20 20 20 74 |_cc[VMIN|];. t|
|000041a0| 70 2d 3e 63 5f 63 63 5b | 56 4d 49 4e 5d 20 3d 20 |p->c_cc[|VMIN] = |
|000041b0| 30 3b 09 09 09 09 2f 2a | 20 64 6f 6e 27 74 20 62 |0;..../*| don't b|
|000041c0| 6c 6f 63 6b 20 69 66 20 | 71 75 65 75 65 20 65 6d |lock if |queue em|
|000041d0| 70 74 79 20 2a 2f 0a 20 | 20 20 20 28 76 6f 69 64 |pty */. | (void|
|000041e0| 29 20 69 6f 63 74 6c 28 | 30 2c 20 54 43 53 45 54 |) ioctl(|0, TCSET|
|000041f0| 41 2c 20 74 70 29 3b 0a | 0a 20 20 20 20 2f 2a 0a |A, tp);.|. /*.|
|00004200| 20 20 20 20 20 2a 20 57 | 61 69 74 20 66 6f 72 20 | * W|ait for |
|00004210| 61 20 77 68 69 6c 65 2c | 20 74 68 65 6e 20 72 65 |a while,| then re|
|00004220| 61 64 20 65 76 65 72 79 | 74 68 69 6e 67 20 74 68 |ad every|thing th|
|00004230| 65 20 6d 6f 64 65 6d 20 | 68 61 73 20 73 61 69 64 |e modem |has said|
|00004240| 20 73 6f 20 66 61 72 20 | 61 6e 64 0a 20 20 20 20 | so far |and. |
|00004250| 20 2a 20 74 72 79 20 74 | 6f 20 65 78 74 72 61 63 | * try t|o extrac|
|00004260| 74 20 74 68 65 20 73 70 | 65 65 64 20 6f 66 20 74 |t the sp|eed of t|
|00004270| 68 65 20 64 69 61 6c 2d | 69 6e 20 63 61 6c 6c 2e |he dial-|in call.|
|00004280| 0a 20 20 20 20 20 2a 2f | 0a 0a 20 20 20 20 28 76 |. */|.. (v|
|00004290| 6f 69 64 29 20 73 6c 65 | 65 70 28 31 29 3b 0a 20 |oid) sle|ep(1);. |
|000042a0| 20 20 20 69 66 20 28 28 | 6e 72 65 61 64 20 3d 20 | if ((|nread = |
|000042b0| 72 65 61 64 28 30 2c 20 | 62 75 66 2c 20 73 69 7a |read(0, |buf, siz|
|000042c0| 65 6f 66 28 62 75 66 29 | 20 2d 20 31 29 29 20 3e |eof(buf)| - 1)) >|
|000042d0| 20 30 29 20 7b 0a 09 62 | 75 66 5b 6e 72 65 61 64 | 0) {..b|uf[nread|
|000042e0| 5d 20 3d 20 27 5c 30 27 | 3b 0a 09 66 6f 72 20 28 |] = '\0'|;..for (|
|000042f0| 62 70 20 3d 20 62 75 66 | 3b 20 62 70 20 3c 20 62 |bp = buf|; bp < b|
|00004300| 75 66 20 2b 20 6e 72 65 | 61 64 3b 20 62 70 2b 2b |uf + nre|ad; bp++|
|00004310| 29 20 7b 0a 09 20 20 20 | 20 69 66 20 28 69 73 61 |) {.. | if (isa|
|00004320| 73 63 69 69 28 2a 62 70 | 29 20 26 26 20 69 73 64 |scii(*bp|) && isd|
|00004330| 69 67 69 74 28 2a 62 70 | 29 29 20 7b 0a 09 09 69 |igit(*bp|)) {...i|
|00004340| 66 20 28 73 70 65 65 64 | 20 3d 20 62 63 6f 64 65 |f (speed| = bcode|
|00004350| 28 62 70 29 29 20 7b 0a | 09 09 20 20 20 20 74 70 |(bp)) {.|.. tp|
|00004360| 2d 3e 63 5f 63 66 6c 61 | 67 20 26 3d 20 7e 43 42 |->c_cfla|g &= ~CB|
|00004370| 41 55 44 3b 0a 09 09 20 | 20 20 20 74 70 2d 3e 63 |AUD;... | tp->c|
|00004380| 5f 63 66 6c 61 67 20 7c | 3d 20 73 70 65 65 64 3b |_cflag ||= speed;|
|00004390| 0a 09 09 7d 0a 09 09 62 | 72 65 61 6b 3b 0a 09 20 |...}...b|reak;.. |
|000043a0| 20 20 20 7d 0a 09 7d 0a | 20 20 20 20 7d 0a 20 20 | }..}.| }. |
|000043b0| 20 20 2f 2a 20 52 65 73 | 74 6f 72 65 20 73 65 74 | /* Res|tore set|
|000043c0| 74 69 6e 67 73 20 2a 2f | 0a 0a 20 20 20 20 74 70 |tings */|.. tp|
|000043d0| 2d 3e 63 5f 69 66 6c 61 | 67 20 3d 20 69 66 6c 61 |->c_ifla|g = ifla|
|000043e0| 67 3b 0a 20 20 20 20 74 | 70 2d 3e 63 5f 63 63 5b |g;. t|p->c_cc[|
|000043f0| 56 4d 49 4e 5d 20 3d 20 | 76 6d 69 6e 3b 0a 20 20 |VMIN] = |vmin;. |
|00004400| 20 20 28 76 6f 69 64 29 | 20 69 6f 63 74 6c 28 30 | (void)| ioctl(0|
|00004410| 2c 20 54 43 53 45 54 41 | 2c 20 74 70 29 3b 0a 7d |, TCSETA|, tp);.}|
|00004420| 0a 0a 2f 2a 20 6e 65 78 | 74 5f 73 70 65 65 64 20 |../* nex|t_speed |
|00004430| 2d 20 73 65 6c 65 63 74 | 20 6e 65 78 74 20 62 61 |- select| next ba|
|00004440| 75 64 20 72 61 74 65 20 | 2a 2f 0a 0a 6e 65 78 74 |ud rate |*/..next|
|00004450| 5f 73 70 65 65 64 28 74 | 70 2c 20 6f 70 29 0a 73 |_speed(t|p, op).s|
|00004460| 74 72 75 63 74 20 74 65 | 72 6d 69 6f 20 2a 74 70 |truct te|rmio *tp|
|00004470| 3b 0a 73 74 72 75 63 74 | 20 6f 70 74 69 6f 6e 73 |;.struct| options|
|00004480| 20 2a 6f 70 3b 0a 7b 0a | 20 20 20 20 6f 70 2d 3e | *op;.{.| op->|
|00004490| 63 75 72 73 70 65 65 64 | 20 3d 20 28 6f 70 2d 3e |curspeed| = (op->|
|000044a0| 63 75 72 73 70 65 65 64 | 20 2b 20 31 29 20 25 20 |curspeed| + 1) % |
|000044b0| 6f 70 2d 3e 6e 75 6d 73 | 70 65 65 64 3b 0a 20 20 |op->nums|peed;. |
|000044c0| 20 20 74 70 2d 3e 63 5f | 63 66 6c 61 67 20 26 3d | tp->c_|cflag &=|
|000044d0| 20 7e 43 42 41 55 44 3b | 0a 20 20 20 20 74 70 2d | ~CBAUD;|. tp-|
|000044e0| 3e 63 5f 63 66 6c 61 67 | 20 7c 3d 20 6f 70 2d 3e |>c_cflag| |= op->|
|000044f0| 73 70 65 65 64 73 5b 6f | 70 2d 3e 63 75 72 73 70 |speeds[o|p->cursp|
|00004500| 65 65 64 5d 3b 0a 20 20 | 20 20 28 76 6f 69 64 29 |eed];. | (void)|
|00004510| 20 69 6f 63 74 6c 28 30 | 2c 20 54 43 53 45 54 41 | ioctl(0|, TCSETA|
|00004520| 2c 20 74 70 29 3b 0a 7d | 0a 0a 2f 2a 20 67 65 74 |, tp);.}|../* get|
|00004530| 5f 6c 6f 67 6e 61 6d 65 | 20 2d 20 67 65 74 20 75 |_logname| - get u|
|00004540| 73 65 72 20 6e 61 6d 65 | 2c 20 65 73 74 61 62 6c |ser name|, establ|
|00004550| 69 73 68 20 70 61 72 69 | 74 79 2c 20 73 70 65 65 |ish pari|ty, spee|
|00004560| 64 2c 20 65 72 61 73 65 | 2c 20 6b 69 6c 6c 2c 20 |d, erase|, kill, |
|00004570| 65 6f 6c 20 2a 2f 0a 0a | 63 68 61 72 20 20 20 2a |eol */..|char *|
|00004580| 67 65 74 5f 6c 6f 67 6e | 61 6d 65 28 6f 70 2c 20 |get_logn|ame(op, |
|00004590| 63 70 29 0a 73 74 72 75 | 63 74 20 6f 70 74 69 6f |cp).stru|ct optio|
|000045a0| 6e 73 20 2a 6f 70 3b 0a | 73 74 72 75 63 74 20 63 |ns *op;.|struct c|
|000045b0| 68 61 72 64 61 74 61 20 | 2a 63 70 3b 0a 7b 0a 20 |hardata |*cp;.{. |
|000045c0| 20 20 20 63 68 61 72 20 | 20 20 20 6c 6f 67 6e 61 | char | logna|
|000045d0| 6d 65 5b 42 55 46 53 49 | 5a 5d 3b 0a 20 20 20 20 |me[BUFSI|Z];. |
|000045e0| 63 68 61 72 20 20 20 2a | 62 70 3b 0a 20 20 20 20 |char *|bp;. |
|000045f0| 63 68 61 72 20 20 20 20 | 63 3b 09 09 09 09 2f 2a |char |c;..../*|
|00004600| 20 69 6e 70 75 74 20 63 | 68 61 72 61 63 74 65 72 | input c|haracter|
|00004610| 2c 20 66 75 6c 6c 20 65 | 69 67 68 74 20 62 69 74 |, full e|ight bit|
|00004620| 73 20 2a 2f 0a 20 20 20 | 20 63 68 61 72 20 20 20 |s */. | char |
|00004630| 20 61 73 63 76 61 6c 3b | 09 09 09 2f 2a 20 6c 6f | ascval;|.../* lo|
|00004640| 77 20 37 20 62 69 74 73 | 20 6f 66 20 69 6e 70 75 |w 7 bits| of inpu|
|00004650| 74 20 63 68 61 72 61 63 | 74 65 72 20 2a 2f 0a 20 |t charac|ter */. |
|00004660| 20 20 20 69 6e 74 20 20 | 20 20 20 62 69 74 73 3b | int | bits;|
|00004670| 09 09 09 2f 2a 20 23 20 | 6f 66 20 22 31 22 20 62 |.../* # |of "1" b|
|00004680| 69 74 73 20 70 65 72 20 | 63 68 61 72 61 63 74 65 |its per |characte|
|00004690| 72 20 2a 2f 0a 20 20 20 | 20 69 6e 74 20 20 20 20 |r */. | int |
|000046a0| 20 6d 61 73 6b 3b 09 09 | 09 2f 2a 20 6d 61 73 6b | mask;..|./* mask|
|000046b0| 20 77 69 74 68 20 31 20 | 62 69 74 20 75 70 20 2a | with 1 |bit up *|
|000046c0| 2f 0a 20 20 20 20 73 74 | 61 74 69 63 20 63 68 61 |/. st|atic cha|
|000046d0| 72 20 2a 65 72 61 73 65 | 5b 5d 20 3d 20 7b 09 09 |r *erase|[] = {..|
|000046e0| 2f 2a 20 62 61 63 6b 73 | 70 61 63 65 2d 73 70 61 |/* backs|pace-spa|
|000046f0| 63 65 2d 62 61 63 6b 73 | 70 61 63 65 20 2a 2f 0a |ce-backs|pace */.|
|00004700| 09 22 5c 30 31 30 5c 30 | 34 30 5c 30 31 30 22 2c |."\010\0|40\010",|
|00004710| 09 09 09 2f 2a 20 73 70 | 61 63 65 20 70 61 72 69 |.../* sp|ace pari|
|00004720| 74 79 20 2a 2f 0a 09 22 | 5c 30 31 30 5c 30 34 30 |ty */.."|\010\040|
|00004730| 5c 30 31 30 22 2c 09 09 | 09 2f 2a 20 6f 64 64 20 |\010",..|./* odd |
|00004740| 70 61 72 69 74 79 20 2a | 2f 0a 09 22 5c 32 31 30 |parity *|/.."\210|
|00004750| 5c 32 34 30 5c 32 31 30 | 22 2c 09 09 09 2f 2a 20 |\240\210|",.../* |
|00004760| 65 76 65 6e 20 70 61 72 | 69 74 79 20 2a 2f 0a 09 |even par|ity */..|
|00004770| 22 5c 32 31 30 5c 32 34 | 30 5c 32 31 30 22 2c 09 |"\210\24|0\210",.|
|00004780| 09 09 2f 2a 20 6e 6f 20 | 70 61 72 69 74 79 20 2a |../* no |parity *|
|00004790| 2f 0a 20 20 20 20 7d 3b | 0a 0a 20 20 20 20 2f 2a |/. };|.. /*|
|000047a0| 20 49 6e 69 74 69 61 6c | 69 7a 65 20 6b 69 6c 6c | Initial|ize kill|
|000047b0| 2c 20 65 72 61 73 65 2c | 20 70 61 72 69 74 79 20 |, erase,| parity |
|000047c0| 65 74 63 65 74 65 72 61 | 20 28 61 6c 73 6f 20 61 |etcetera| (also a|
|000047d0| 66 74 65 72 20 73 77 69 | 74 63 68 69 6e 67 20 73 |fter swi|tching s|
|000047e0| 70 65 65 64 73 29 20 2a | 2f 0a 0a 20 20 20 20 63 |peeds) *|/.. c|
|000047f0| 70 2d 3e 6b 69 6c 6c 20 | 3d 20 44 45 46 5f 4b 49 |p->kill |= DEF_KI|
|00004800| 4c 4c 3b 0a 20 20 20 20 | 63 70 2d 3e 65 72 61 73 |LL;. |cp->eras|
|00004810| 65 20 3d 20 44 45 46 5f | 45 52 41 53 45 3b 0a 20 |e = DEF_|ERASE;. |
|00004820| 20 20 20 63 70 2d 3e 70 | 61 72 69 74 79 20 3d 20 | cp->p|arity = |
|00004830| 30 3b 0a 0a 20 20 20 20 | 2f 2a 20 46 6c 75 73 68 |0;.. |/* Flush|
|00004840| 20 61 6e 79 20 70 65 6e | 64 69 6e 67 20 69 6e 70 | any pen|ding inp|
|00004850| 75 74 20 2a 2f 0a 0a 20 | 20 20 20 69 6f 63 74 6c |ut */.. | ioctl|
|00004860| 28 30 2c 20 54 43 46 4c | 53 48 2c 20 28 73 74 72 |(0, TCFL|SH, (str|
|00004870| 75 63 74 20 74 65 72 6d | 69 6f 20 2a 29 20 30 29 |uct term|io *) 0)|
|00004880| 3b 0a 0a 20 20 20 20 2f | 2a 20 52 65 61 64 20 61 |;.. /|* Read a|
|00004890| 20 6c 6f 67 69 6e 20 6e | 61 6d 65 20 2a 2f 0a 0a | login n|ame */..|
|000048a0| 20 20 20 20 66 6f 72 20 | 28 2a 6c 6f 67 6e 61 6d | for |(*lognam|
|000048b0| 65 20 3d 20 30 3b 20 2a | 6c 6f 67 6e 61 6d 65 20 |e = 0; *|logname |
|000048c0| 3d 3d 20 30 3b 20 2f 2a | 20 76 6f 69 64 20 2a 2f |== 0; /*| void */|
|000048d0| 20 29 20 7b 0a 0a 09 2f | 2a 20 57 72 69 74 65 20 | ) {.../|* Write |
|000048e0| 74 68 65 20 70 72 6f 6d | 70 74 2c 20 77 69 74 68 |the prom|pt, with|
|000048f0| 20 22 70 61 72 69 74 79 | 22 20 62 69 74 20 3d 3d | "parity|" bit ==|
|00004900| 20 30 20 2a 2f 0a 0a 09 | 28 76 6f 69 64 29 20 77 | 0 */...|(void) w|
|00004910| 72 69 74 65 28 31 2c 20 | 4c 4f 47 49 4e 2c 20 73 |rite(1, |LOGIN, s|
|00004920| 69 7a 65 6f 66 28 4c 4f | 47 49 4e 29 20 2d 20 31 |izeof(LO|GIN) - 1|
|00004930| 29 3b 0a 0a 09 2f 2a 20 | 52 65 61 64 20 6e 61 6d |);.../* |Read nam|
|00004940| 65 2c 20 77 61 74 63 68 | 20 66 6f 72 20 62 72 65 |e, watch| for bre|
|00004950| 61 6b 2c 20 70 61 72 69 | 74 79 2c 20 65 72 61 73 |ak, pari|ty, eras|
|00004960| 65 2c 20 6b 69 6c 6c 2c | 20 65 6e 64 2d 6f 66 2d |e, kill,| end-of-|
|00004970| 6c 69 6e 65 20 2a 2f 0a | 0a 09 66 6f 72 20 28 62 |line */.|..for (b|
|00004980| 70 20 3d 20 6c 6f 67 6e | 61 6d 65 2c 20 63 70 2d |p = logn|ame, cp-|
|00004990| 3e 65 6f 6c 20 3d 20 30 | 3b 20 63 70 2d 3e 65 6f |>eol = 0|; cp->eo|
|000049a0| 6c 20 3d 3d 20 30 3b 20 | 2f 2a 20 76 6f 69 64 20 |l == 0; |/* void |
|000049b0| 2a 2f 20 29 20 7b 0a 09 | 20 20 20 20 69 66 20 28 |*/ ) {..| if (|
|000049c0| 72 65 61 64 28 30 2c 20 | 26 63 2c 20 31 29 20 3c |read(0, |&c, 1) <|
|000049d0| 20 31 29 0a 09 09 65 72 | 72 6f 72 28 22 25 73 3a | 1)...er|ror("%s:|
|000049e0| 20 72 65 61 64 20 65 72 | 72 6f 72 22 2c 20 6f 70 | read er|ror", op|
|000049f0| 2d 3e 74 74 79 29 3b 0a | 0a 09 20 20 20 20 2f 2a |->tty);.|.. /*|
|00004a00| 20 44 6f 20 42 52 45 41 | 4b 20 68 61 6e 64 6c 69 | Do BREA|K handli|
|00004a10| 6e 67 20 65 6c 73 65 77 | 68 65 72 65 20 2a 2f 0a |ng elsew|here */.|
|00004a20| 0a 09 20 20 20 20 69 66 | 20 28 28 63 20 3d 3d 20 |.. if| ((c == |
|00004a30| 30 29 20 26 26 20 6f 70 | 2d 3e 6e 75 6d 73 70 65 |0) && op|->numspe|
|00004a40| 65 64 20 3e 20 31 29 0a | 09 09 72 65 74 75 72 6e |ed > 1).|..return|
|00004a50| 20 28 30 29 3b 0a 0a 09 | 20 20 20 20 2f 2a 20 44 | (0);...| /* D|
|00004a60| 6f 20 70 61 72 69 74 79 | 20 62 69 74 20 68 61 6e |o parity| bit han|
|00004a70| 64 6c 69 6e 67 20 2a 2f | 0a 0a 09 20 20 20 20 69 |dling */|... i|
|00004a80| 66 20 28 63 20 21 3d 20 | 28 61 73 63 76 61 6c 20 |f (c != |(ascval |
|00004a90| 3d 20 28 63 20 26 20 30 | 31 37 37 29 29 29 20 7b |= (c & 0|177))) {|
|00004aa0| 09 2f 2a 20 22 70 61 72 | 69 74 79 22 20 62 69 74 |./* "par|ity" bit|
|00004ab0| 20 6f 6e 20 3f 20 2a 2f | 0a 09 09 66 6f 72 20 28 | on ? */|...for (|
|00004ac0| 62 69 74 73 20 3d 20 31 | 2c 20 6d 61 73 6b 20 3d |bits = 1|, mask =|
|00004ad0| 20 31 3b 20 6d 61 73 6b | 20 26 20 30 31 37 37 3b | 1; mask| & 0177;|
|00004ae0| 20 6d 61 73 6b 20 3c 3c | 3d 20 31 29 0a 09 09 20 | mask <<|= 1)... |
|00004af0| 20 20 20 69 66 20 28 6d | 61 73 6b 20 26 20 61 73 | if (m|ask & as|
|00004b00| 63 76 61 6c 29 0a 09 09 | 09 62 69 74 73 2b 2b 3b |cval)...|.bits++;|
|00004b10| 09 09 09 2f 2a 20 63 6f | 75 6e 74 20 22 31 22 20 |.../* co|unt "1" |
|00004b20| 62 69 74 73 20 2a 2f 0a | 09 09 63 70 2d 3e 70 61 |bits */.|..cp->pa|
|00004b30| 72 69 74 79 20 7c 3d 20 | 28 28 62 69 74 73 20 26 |rity |= |((bits &|
|00004b40| 20 31 29 20 3f 20 31 20 | 3a 20 32 29 3b 0a 09 20 | 1) ? 1 |: 2);.. |
|00004b50| 20 20 20 7d 0a 09 20 20 | 20 20 2f 2a 20 44 6f 20 | }.. | /* Do |
|00004b60| 65 72 61 73 65 2c 20 6b | 69 6c 6c 20 61 6e 64 20 |erase, k|ill and |
|00004b70| 65 6e 64 2d 6f 66 2d 6c | 69 6e 65 20 70 72 6f 63 |end-of-l|ine proc|
|00004b80| 65 73 73 69 6e 67 20 2a | 2f 0a 0a 09 20 20 20 20 |essing *|/... |
|00004b90| 73 77 69 74 63 68 20 28 | 61 73 63 76 61 6c 29 20 |switch (|ascval) |
|00004ba0| 7b 0a 09 20 20 20 20 63 | 61 73 65 20 43 52 3a 0a |{.. c|ase CR:.|
|00004bb0| 09 20 20 20 20 63 61 73 | 65 20 4e 4c 3a 0a 09 09 |. cas|e NL:...|
|00004bc0| 2a 62 70 20 3d 20 30 3b | 09 09 09 2f 2a 20 74 65 |*bp = 0;|.../* te|
|00004bd0| 72 6d 69 6e 61 74 65 20 | 6c 6f 67 6e 61 6d 65 20 |rminate |logname |
|00004be0| 2a 2f 0a 09 09 63 70 2d | 3e 65 6f 6c 20 3d 20 61 |*/...cp-|>eol = a|
|00004bf0| 73 63 76 61 6c 3b 09 09 | 2f 2a 20 73 65 6e 64 20 |scval;..|/* send |
|00004c00| 65 6e 64 2d 6f 66 2d 6c | 69 6e 65 20 63 68 61 72 |end-of-l|ine char|
|00004c10| 20 2a 2f 0a 09 09 62 72 | 65 61 6b 3b 0a 09 20 20 | */...br|eak;.. |
|00004c20| 20 20 63 61 73 65 20 42 | 53 3a 0a 09 20 20 20 20 | case B|S:.. |
|00004c30| 63 61 73 65 20 44 45 4c | 3a 0a 09 20 20 20 20 63 |case DEL|:.. c|
|00004c40| 61 73 65 20 27 23 27 3a | 0a 09 09 63 70 2d 3e 65 |ase '#':|...cp->e|
|00004c50| 72 61 73 65 20 3d 20 61 | 73 63 76 61 6c 3b 09 09 |rase = a|scval;..|
|00004c60| 2f 2a 20 73 65 74 20 65 | 72 61 73 65 20 63 68 61 |/* set e|rase cha|
|00004c70| 72 61 63 74 65 72 20 2a | 2f 0a 09 09 69 66 20 28 |racter *|/...if (|
|00004c80| 62 70 20 3e 20 6c 6f 67 | 6e 61 6d 65 29 20 7b 0a |bp > log|name) {.|
|00004c90| 09 09 20 20 20 20 28 76 | 6f 69 64 29 20 77 72 69 |.. (v|oid) wri|
|00004ca0| 74 65 28 31 2c 20 65 72 | 61 73 65 5b 63 70 2d 3e |te(1, er|ase[cp->|
|00004cb0| 70 61 72 69 74 79 5d 2c | 20 33 29 3b 0a 09 09 20 |parity],| 3);... |
|00004cc0| 20 20 20 62 70 2d 2d 3b | 0a 09 09 7d 0a 09 09 62 | bp--;|...}...b|
|00004cd0| 72 65 61 6b 3b 0a 09 20 | 20 20 20 63 61 73 65 20 |reak;.. | case |
|00004ce0| 43 54 4c 28 27 55 27 29 | 3a 0a 09 20 20 20 20 63 |CTL('U')|:.. c|
|00004cf0| 61 73 65 20 27 40 27 3a | 0a 09 09 63 70 2d 3e 6b |ase '@':|...cp->k|
|00004d00| 69 6c 6c 20 3d 20 61 73 | 63 76 61 6c 3b 09 09 2f |ill = as|cval;../|
|00004d10| 2a 20 73 65 74 20 6b 69 | 6c 6c 20 63 68 61 72 61 |* set ki|ll chara|
|00004d20| 63 74 65 72 20 2a 2f 0a | 09 09 77 68 69 6c 65 20 |cter */.|..while |
|00004d30| 28 62 70 20 3e 20 6c 6f | 67 6e 61 6d 65 29 20 7b |(bp > lo|gname) {|
|00004d40| 0a 09 09 20 20 20 20 28 | 76 6f 69 64 29 20 77 72 |... (|void) wr|
|00004d50| 69 74 65 28 31 2c 20 65 | 72 61 73 65 5b 63 70 2d |ite(1, e|rase[cp-|
|00004d60| 3e 70 61 72 69 74 79 5d | 2c 20 33 29 3b 0a 09 09 |>parity]|, 3);...|
|00004d70| 20 20 20 20 62 70 2d 2d | 3b 0a 09 09 7d 0a 09 09 | bp--|;...}...|
|00004d80| 62 72 65 61 6b 3b 0a 09 | 20 20 20 20 63 61 73 65 |break;..| case|
|00004d90| 20 43 54 4c 28 27 44 27 | 29 3a 0a 09 09 65 78 69 | CTL('D'|):...exi|
|00004da0| 74 28 30 29 3b 0a 09 20 | 20 20 20 64 65 66 61 75 |t(0);.. | defau|
|00004db0| 6c 74 3a 0a 09 09 69 66 | 20 28 21 69 73 61 73 63 |lt:...if| (!isasc|
|00004dc0| 69 69 28 61 73 63 76 61 | 6c 29 20 7c 7c 20 21 69 |ii(ascva|l) || !i|
|00004dd0| 73 70 72 69 6e 74 28 61 | 73 63 76 61 6c 29 29 20 |sprint(a|scval)) |
|00004de0| 7b 0a 09 09 20 20 20 20 | 20 2f 2a 20 69 67 6e 6f |{... | /* igno|
|00004df0| 72 65 20 67 61 72 62 61 | 67 65 20 63 68 61 72 61 |re garba|ge chara|
|00004e00| 63 74 65 72 73 20 2a 2f | 20 3b 0a 09 09 7d 20 65 |cters */| ;...} e|
|00004e10| 6c 73 65 20 69 66 20 28 | 62 70 20 2d 20 6c 6f 67 |lse if (|bp - log|
|00004e20| 6e 61 6d 65 20 3e 3d 20 | 73 69 7a 65 6f 66 28 6c |name >= |sizeof(l|
|00004e30| 6f 67 6e 61 6d 65 29 20 | 2d 20 31 29 20 7b 0a 09 |ogname) |- 1) {..|
|00004e40| 09 20 20 20 20 65 72 72 | 6f 72 28 22 25 73 3a 20 |. err|or("%s: |
|00004e50| 69 6e 70 75 74 20 6f 76 | 65 72 72 75 6e 22 2c 20 |input ov|errun", |
|00004e60| 6f 70 2d 3e 74 74 79 29 | 3b 0a 09 09 7d 20 65 6c |op->tty)|;...} el|
|00004e70| 73 65 20 7b 0a 09 09 20 | 20 20 20 28 76 6f 69 64 |se {... | (void|
|00004e80| 29 20 77 72 69 74 65 28 | 31 2c 20 26 63 2c 20 31 |) write(|1, &c, 1|
|00004e90| 29 3b 09 2f 2a 20 65 63 | 68 6f 20 74 68 65 20 63 |);./* ec|ho the c|
|00004ea0| 68 61 72 61 63 74 65 72 | 20 2a 2f 0a 09 09 20 20 |haracter| */... |
|00004eb0| 20 20 2a 62 70 2b 2b 20 | 3d 20 61 73 63 76 61 6c | *bp++ |= ascval|
|00004ec0| 3b 09 09 2f 2a 20 61 6e | 64 20 73 74 6f 72 65 20 |;../* an|d store |
|00004ed0| 69 74 20 2a 2f 0a 09 09 | 7d 0a 09 09 62 72 65 61 |it */...|}...brea|
|00004ee0| 6b 3b 0a 09 20 20 20 20 | 7d 0a 09 7d 0a 20 20 20 |k;.. |}..}. |
|00004ef0| 20 7d 0a 20 20 20 20 63 | 70 2d 3e 63 61 70 73 6c | }. c|p->capsl|
|00004f00| 6f 63 6b 20 3d 20 63 61 | 70 73 5f 6c 6f 63 6b 28 |ock = ca|ps_lock(|
|00004f10| 6c 6f 67 6e 61 6d 65 29 | 3b 09 09 2f 2a 20 75 70 |logname)|;../* up|
|00004f20| 70 65 72 20 63 61 73 65 | 20 77 2f 6f 20 6c 6f 77 |per case| w/o low|
|00004f30| 65 72 20 63 61 73 65 3f | 20 2a 2f 0a 20 20 20 20 |er case?| */. |
|00004f40| 72 65 74 75 72 6e 20 28 | 6c 6f 67 6e 61 6d 65 29 |return (|logname)|
|00004f50| 3b 0a 7d 0a 0a 2f 2a 20 | 74 65 72 6d 69 6f 5f 66 |;.}../* |termio_f|
|00004f60| 69 6e 61 6c 20 2d 20 73 | 65 74 20 74 68 65 20 66 |inal - s|et the f|
|00004f70| 69 6e 61 6c 20 74 74 79 | 20 6d 6f 64 65 20 62 69 |inal tty| mode bi|
|00004f80| 74 73 20 2a 2f 0a 0a 74 | 65 72 6d 69 6f 5f 66 69 |ts */..t|ermio_fi|
|00004f90| 6e 61 6c 28 74 70 2c 20 | 63 70 29 0a 73 74 72 75 |nal(tp, |cp).stru|
|00004fa0| 63 74 20 74 65 72 6d 69 | 6f 20 2a 74 70 3b 0a 73 |ct termi|o *tp;.s|
|00004fb0| 74 72 75 63 74 20 63 68 | 61 72 64 61 74 61 20 2a |truct ch|ardata *|
|00004fc0| 63 70 3b 0a 7b 0a 20 20 | 20 20 2f 2a 20 47 65 6e |cp;.{. | /* Gen|
|00004fd0| 65 72 61 6c 20 74 65 72 | 6d 69 6e 61 6c 2d 69 6e |eral ter|minal-in|
|00004fe0| 64 65 70 65 6e 64 65 6e | 74 20 73 74 75 66 66 20 |dependen|t stuff |
|00004ff0| 2a 2f 0a 0a 20 20 20 20 | 74 70 2d 3e 63 5f 69 66 |*/.. |tp->c_if|
|00005000| 6c 61 67 20 7c 3d 20 49 | 58 4f 4e 20 7c 20 49 58 |lag |= I|XON | IX|
|00005010| 4f 46 46 3b 09 09 2f 2a | 20 32 2d 77 61 79 20 66 |OFF;../*| 2-way f|
|00005020| 6c 6f 77 20 63 6f 6e 74 | 72 6f 6c 20 2a 2f 0a 20 |low cont|rol */. |
|00005030| 20 20 20 74 70 2d 3e 63 | 5f 6c 66 6c 61 67 20 7c | tp->c|_lflag ||
|00005040| 3d 20 49 43 41 4e 4f 4e | 20 7c 20 49 53 49 47 20 |= ICANON| | ISIG |
|00005050| 7c 20 45 43 48 4f 20 7c | 20 45 43 48 4f 45 20 7c || ECHO || ECHOE ||
|00005060| 20 45 43 48 4f 4b 3b 0a | 20 20 20 20 74 70 2d 3e | ECHOK;.| tp->|
|00005070| 63 5f 6f 66 6c 61 67 20 | 7c 3d 20 4f 50 4f 53 54 |c_oflag ||= OPOST|
|00005080| 3b 0a 20 20 20 20 74 70 | 2d 3e 63 5f 63 63 5b 56 |;. tp|->c_cc[V|
|00005090| 45 4f 46 5d 20 3d 20 44 | 45 46 5f 45 4f 46 3b 0a |EOF] = D|EF_EOF;.|
|000050a0| 20 20 20 20 74 70 2d 3e | 63 5f 63 63 5b 56 45 4f | tp->|c_cc[VEO|
|000050b0| 4c 5d 20 3d 20 44 45 46 | 5f 45 4f 4c 3b 0a 20 20 |L] = DEF|_EOL;. |
|000050c0| 20 20 74 70 2d 3e 63 5f | 63 63 5b 56 49 4e 54 52 | tp->c_|cc[VINTR|
|000050d0| 5d 20 3d 20 44 45 46 5f | 49 4e 54 52 3b 0a 20 20 |] = DEF_|INTR;. |
|000050e0| 20 20 74 70 2d 3e 63 5f | 63 63 5b 56 51 55 49 54 | tp->c_|cc[VQUIT|
|000050f0| 5d 20 3d 20 44 45 46 5f | 51 55 49 54 3b 0a 20 20 |] = DEF_|QUIT;. |
|00005100| 20 20 74 70 2d 3e 63 5f | 63 63 5b 56 4b 49 4c 4c | tp->c_|cc[VKILL|
|00005110| 5d 20 3d 20 44 45 46 5f | 4b 49 4c 4c 3b 0a 20 20 |] = DEF_|KILL;. |
|00005120| 20 20 74 70 2d 3e 63 5f | 63 63 5b 56 45 52 41 53 | tp->c_|cc[VERAS|
|00005130| 45 5d 20 3d 20 44 45 46 | 5f 45 52 41 53 45 3b 0a |E] = DEF|_ERASE;.|
|00005140| 20 20 20 20 74 70 2d 3e | 63 5f 63 63 5b 56 53 57 | tp->|c_cc[VSW|
|00005150| 54 43 48 5d 20 3d 20 44 | 45 46 5f 53 57 49 54 43 |TCH] = D|EF_SWITC|
|00005160| 48 3b 0a 0a 20 20 20 20 | 2f 2a 20 41 63 63 6f 75 |H;.. |/* Accou|
|00005170| 6e 74 20 66 6f 72 20 73 | 70 65 63 69 61 6c 20 63 |nt for s|pecial c|
|00005180| 68 61 72 61 63 74 65 72 | 73 20 73 65 65 6e 20 69 |haracter|s seen i|
|00005190| 6e 20 69 6e 70 75 74 20 | 2a 2f 0a 0a 20 20 20 20 |n input |*/.. |
|000051a0| 69 66 20 28 63 70 2d 3e | 65 6f 6c 20 3d 3d 20 43 |if (cp->|eol == C|
|000051b0| 52 29 20 7b 0a 09 74 70 | 2d 3e 63 5f 69 66 6c 61 |R) {..tp|->c_ifla|
|000051c0| 67 20 7c 3d 20 49 43 52 | 4e 4c 3b 09 09 09 2f 2a |g |= ICR|NL;.../*|
|000051d0| 20 6d 61 70 20 43 52 20 | 69 6e 20 69 6e 70 75 74 | map CR |in input|
|000051e0| 20 74 6f 20 4e 4c 20 2a | 2f 0a 09 74 70 2d 3e 63 | to NL *|/..tp->c|
|000051f0| 5f 6f 66 6c 61 67 20 7c | 3d 20 4f 4e 4c 43 52 3b |_oflag ||= ONLCR;|
|00005200| 09 09 09 2f 2a 20 6d 61 | 70 20 4e 4c 20 69 6e 20 |.../* ma|p NL in |
|00005210| 6f 75 74 70 75 74 20 74 | 6f 20 43 52 2d 4e 4c 20 |output t|o CR-NL |
|00005220| 2a 2f 0a 20 20 20 20 7d | 0a 20 20 20 20 74 70 2d |*/. }|. tp-|
|00005230| 3e 63 5f 63 63 5b 56 45 | 52 41 53 45 5d 20 3d 20 |>c_cc[VE|RASE] = |
|00005240| 63 70 2d 3e 65 72 61 73 | 65 3b 09 09 2f 2a 20 73 |cp->eras|e;../* s|
|00005250| 65 74 20 65 72 61 73 65 | 20 63 68 61 72 61 63 74 |et erase| charact|
|00005260| 65 72 20 2a 2f 0a 20 20 | 20 20 74 70 2d 3e 63 5f |er */. | tp->c_|
|00005270| 63 63 5b 56 4b 49 4c 4c | 5d 20 3d 20 63 70 2d 3e |cc[VKILL|] = cp->|
|00005280| 6b 69 6c 6c 3b 09 09 09 | 2f 2a 20 73 65 74 20 6b |kill;...|/* set k|
|00005290| 69 6c 6c 20 63 68 61 72 | 61 63 74 65 72 20 2a 2f |ill char|acter */|
|000052a0| 0a 0a 20 20 20 20 2f 2a | 20 41 63 63 6f 75 6e 74 |.. /*| Account|
|000052b0| 20 66 6f 72 20 74 68 65 | 20 70 72 65 73 65 6e 63 | for the| presenc|
|000052c0| 65 20 6f 72 20 61 62 73 | 65 6e 63 65 20 6f 66 20 |e or abs|ence of |
|000052d0| 70 61 72 69 74 79 20 62 | 69 74 73 20 69 6e 20 69 |parity b|its in i|
|000052e0| 6e 70 75 74 20 2a 2f 0a | 0a 20 20 20 20 73 77 69 |nput */.|. swi|
|000052f0| 74 63 68 20 28 63 70 2d | 3e 70 61 72 69 74 79 29 |tch (cp-|>parity)|
|00005300| 20 7b 0a 20 20 20 20 63 | 61 73 65 20 30 3a 09 09 | {. c|ase 0:..|
|00005310| 09 09 09 2f 2a 20 73 70 | 61 63 65 20 28 61 6c 77 |.../* sp|ace (alw|
|00005320| 61 79 73 20 30 29 20 70 | 61 72 69 74 79 20 2a 2f |ays 0) p|arity */|
|00005330| 0a 09 62 72 65 61 6b 3b | 0a 20 20 20 20 63 61 73 |..break;|. cas|
|00005340| 65 20 31 3a 09 09 09 09 | 09 2f 2a 20 6f 64 64 20 |e 1:....|./* odd |
|00005350| 70 61 72 69 74 79 20 2a | 2f 0a 09 74 70 2d 3e 63 |parity *|/..tp->c|
|00005360| 5f 63 66 6c 61 67 20 7c | 3d 20 50 41 52 4f 44 44 |_cflag ||= PARODD|
|00005370| 3b 0a 09 2f 2a 20 46 41 | 4c 4c 54 48 52 4f 55 47 |;../* FA|LLTHROUG|
|00005380| 48 20 2a 2f 0a 20 20 20 | 20 63 61 73 65 20 32 3a |H */. | case 2:|
|00005390| 09 09 09 09 09 2f 2a 20 | 65 76 65 6e 20 70 61 72 |...../* |even par|
|000053a0| 69 74 79 20 2a 2f 0a 09 | 74 70 2d 3e 63 5f 63 66 |ity */..|tp->c_cf|
|000053b0| 6c 61 67 20 7c 3d 20 50 | 41 52 45 4e 42 3b 0a 09 |lag |= P|ARENB;..|
|000053c0| 74 70 2d 3e 63 5f 69 66 | 6c 61 67 20 7c 3d 20 49 |tp->c_if|lag |= I|
|000053d0| 4e 50 43 4b 20 7c 20 49 | 53 54 52 49 50 3b 0a 09 |NPCK | I|STRIP;..|
|000053e0| 2f 2a 20 46 41 4c 4c 54 | 48 52 4f 55 47 48 20 2a |/* FALLT|HROUGH *|
|000053f0| 2f 0a 20 20 20 20 63 61 | 73 65 20 28 31 20 7c 20 |/. ca|se (1 | |
|00005400| 32 29 3a 09 09 09 09 2f | 2a 20 6e 6f 20 70 61 72 |2):..../|* no par|
|00005410| 69 74 79 20 62 69 74 20 | 2a 2f 0a 09 74 70 2d 3e |ity bit |*/..tp->|
|00005420| 63 5f 63 66 6c 61 67 20 | 26 3d 20 7e 43 53 49 5a |c_cflag |&= ~CSIZ|
|00005430| 45 3b 0a 09 74 70 2d 3e | 63 5f 63 66 6c 61 67 20 |E;..tp->|c_cflag |
|00005440| 7c 3d 20 43 53 37 3b 0a | 09 62 72 65 61 6b 3b 0a ||= CS7;.|.break;.|
|00005450| 20 20 20 20 7d 0a 20 20 | 20 20 2f 2a 20 41 63 63 | }. | /* Acc|
|00005460| 6f 75 6e 74 20 66 6f 72 | 20 75 70 70 65 72 20 63 |ount for| upper c|
|00005470| 61 73 65 20 77 69 74 68 | 6f 75 74 20 6c 6f 77 65 |ase with|out lowe|
|00005480| 72 20 63 61 73 65 20 2a | 2f 0a 0a 20 20 20 20 69 |r case *|/.. i|
|00005490| 66 20 28 63 70 2d 3e 63 | 61 70 73 6c 6f 63 6b 29 |f (cp->c|apslock)|
|000054a0| 20 7b 0a 09 74 70 2d 3e | 63 5f 69 66 6c 61 67 20 | {..tp->|c_iflag |
|000054b0| 7c 3d 20 49 55 43 4c 43 | 3b 0a 09 74 70 2d 3e 63 ||= IUCLC|;..tp->c|
|000054c0| 5f 6c 66 6c 61 67 20 7c | 3d 20 58 43 41 53 45 3b |_lflag ||= XCASE;|
|000054d0| 0a 09 74 70 2d 3e 63 5f | 6f 66 6c 61 67 20 7c 3d |..tp->c_|oflag |=|
|000054e0| 20 4f 4c 43 55 43 3b 0a | 20 20 20 20 7d 0a 0a 20 | OLCUC;.| }.. |
|000054f0| 20 20 20 2f 2a 20 46 69 | 6e 61 6c 6c 79 2c 20 6d | /* Fi|nally, m|
|00005500| 61 6b 65 20 74 68 65 20 | 6e 65 77 20 73 65 74 74 |ake the |new sett|
|00005510| 69 6e 67 73 20 65 66 66 | 65 63 74 69 76 65 20 2a |ings eff|ective *|
|00005520| 2f 0a 0a 20 20 20 20 28 | 76 6f 69 64 29 20 69 6f |/.. (|void) io|
|00005530| 63 74 6c 28 30 2c 20 54 | 43 53 45 54 41 2c 20 74 |ctl(0, T|CSETA, t|
|00005540| 70 29 3b 0a 7d 0a 0a 2f | 2a 20 63 61 70 73 5f 6c |p);.}../|* caps_l|
|00005550| 6f 63 6b 20 2d 20 73 74 | 72 69 6e 67 20 63 6f 6e |ock - st|ring con|
|00005560| 74 61 69 6e 73 20 75 70 | 70 65 72 20 63 61 73 65 |tains up|per case|
|00005570| 20 77 69 74 68 6f 75 74 | 20 6c 6f 77 65 72 20 63 | without| lower c|
|00005580| 61 73 65 20 2a 2f 0a 0a | 63 61 70 73 5f 6c 6f 63 |ase */..|caps_loc|
|00005590| 6b 28 73 29 0a 63 68 61 | 72 20 20 20 2a 73 3b 0a |k(s).cha|r *s;.|
|000055a0| 7b 0a 20 20 20 20 69 6e | 74 20 20 20 20 20 68 61 |{. in|t ha|
|000055b0| 73 63 61 70 73 3b 0a 0a | 20 20 20 20 66 6f 72 20 |scaps;..| for |
|000055c0| 28 68 61 73 63 61 70 73 | 20 3d 20 30 3b 20 2a 73 |(hascaps| = 0; *s|
|000055d0| 3b 20 73 2b 2b 29 20 7b | 0a 09 69 66 20 28 69 73 |; s++) {|..if (is|
|000055e0| 6c 6f 77 65 72 28 2a 73 | 29 29 0a 09 20 20 20 20 |lower(*s|)).. |
|000055f0| 72 65 74 75 72 6e 20 28 | 30 29 3b 0a 09 69 66 20 |return (|0);..if |
|00005600| 28 68 61 73 63 61 70 73 | 20 3d 3d 20 30 29 0a 09 |(hascaps| == 0)..|
|00005610| 20 20 20 20 68 61 73 63 | 61 70 73 20 3d 20 69 73 | hasc|aps = is|
|00005620| 75 70 70 65 72 28 2a 73 | 29 3b 0a 20 20 20 20 7d |upper(*s|);. }|
|00005630| 0a 20 20 20 20 72 65 74 | 75 72 6e 20 28 68 61 73 |. ret|urn (has|
|00005640| 63 61 70 73 29 3b 0a 7d | 0a 0a 2f 2a 20 62 63 6f |caps);.}|../* bco|
|00005650| 64 65 20 2d 20 63 6f 6e | 76 65 72 74 20 73 70 65 |de - con|vert spe|
|00005660| 65 64 20 73 74 72 69 6e | 67 20 74 6f 20 73 70 65 |ed strin|g to spe|
|00005670| 65 64 20 63 6f 64 65 3b | 20 72 65 74 75 72 6e 20 |ed code;| return |
|00005680| 30 20 6f 6e 20 66 61 69 | 6c 75 72 65 20 2a 2f 0a |0 on fai|lure */.|
|00005690| 0a 62 63 6f 64 65 28 73 | 29 0a 63 68 61 72 20 20 |.bcode(s|).char |
|000056a0| 20 2a 73 3b 0a 7b 0a 20 | 20 20 20 73 74 72 75 63 | *s;.{. | struc|
|000056b0| 74 20 53 70 65 65 64 74 | 61 62 20 7b 0a 09 69 6e |t Speedt|ab {..in|
|000056c0| 74 20 20 20 20 20 73 70 | 65 65 64 3b 0a 09 69 6e |t sp|eed;..in|
|000056d0| 74 20 20 20 20 20 63 6f | 64 65 3b 0a 20 20 20 20 |t co|de;. |
|000056e0| 7d 3b 0a 20 20 20 20 73 | 74 61 74 69 63 20 73 74 |};. s|tatic st|
|000056f0| 72 75 63 74 20 53 70 65 | 65 64 74 61 62 20 73 70 |ruct Spe|edtab sp|
|00005700| 65 65 64 74 61 62 5b 5d | 20 3d 20 7b 0a 09 35 30 |eedtab[]| = {..50|
|00005710| 2c 20 42 35 30 2c 0a 09 | 37 35 2c 20 42 37 35 2c |, B50,..|75, B75,|
|00005720| 0a 09 31 31 30 2c 20 42 | 31 31 30 2c 0a 09 31 33 |..110, B|110,..13|
|00005730| 34 2c 20 42 31 33 34 2c | 0a 09 31 35 30 2c 20 42 |4, B134,|..150, B|
|00005740| 31 35 30 2c 0a 09 32 30 | 30 2c 20 42 32 30 30 2c |150,..20|0, B200,|
|00005750| 0a 09 33 30 30 2c 20 42 | 33 30 30 2c 0a 09 36 30 |..300, B|300,..60|
|00005760| 30 2c 20 42 36 30 30 2c | 0a 09 31 32 30 30 2c 20 |0, B600,|..1200, |
|00005770| 42 31 32 30 30 2c 0a 09 | 31 38 30 30 2c 20 42 31 |B1200,..|1800, B1|
|00005780| 38 30 30 2c 0a 09 32 34 | 30 30 2c 20 42 32 34 30 |800,..24|00, B240|
|00005790| 30 2c 0a 09 34 38 30 30 | 2c 20 42 34 38 30 30 2c |0,..4800|, B4800,|
|000057a0| 0a 09 39 36 30 30 2c 20 | 42 39 36 30 30 2c 0a 09 |..9600, |B9600,..|
|000057b0| 31 39 32 30 30 2c 20 45 | 58 54 41 2c 0a 09 30 2c |19200, E|XTA,..0,|
|000057c0| 20 30 2c 0a 20 20 20 20 | 7d 3b 0a 20 20 20 20 73 | 0,. |};. s|
|000057d0| 74 72 75 63 74 20 53 70 | 65 65 64 74 61 62 20 2a |truct Sp|eedtab *|
|000057e0| 73 70 3b 0a 20 20 20 20 | 69 6e 74 20 20 20 20 20 |sp;. |int |
|000057f0| 73 70 65 65 64 20 3d 20 | 61 74 6f 69 28 73 29 3b |speed = |atoi(s);|
|00005800| 0a 0a 20 20 20 20 66 6f | 72 20 28 73 70 20 3d 20 |.. fo|r (sp = |
|00005810| 73 70 65 65 64 74 61 62 | 3b 20 73 70 2d 3e 73 70 |speedtab|; sp->sp|
|00005820| 65 65 64 3b 20 73 70 2b | 2b 29 0a 09 69 66 20 28 |eed; sp+|+)..if (|
|00005830| 73 70 2d 3e 73 70 65 65 | 64 20 3d 3d 20 73 70 65 |sp->spee|d == spe|
|00005840| 65 64 29 0a 09 20 20 20 | 20 72 65 74 75 72 6e 20 |ed).. | return |
|00005850| 28 73 70 2d 3e 63 6f 64 | 65 29 3b 0a 20 20 20 20 |(sp->cod|e);. |
|00005860| 72 65 74 75 72 6e 20 28 | 30 29 3b 0a 7d 0a 0a 2f |return (|0);.}../|
|00005870| 2a 20 75 73 61 67 65 20 | 2d 20 65 78 70 6c 61 69 |* usage |- explai|
|00005880| 6e 20 2a 2f 0a 0a 75 73 | 61 67 65 28 29 0a 7b 0a |n */..us|age().{.|
|00005890| 20 20 20 20 65 72 72 6f | 72 28 22 75 73 61 67 65 | erro|r("usage|
|000058a0| 3a 20 25 73 20 5b 2d 61 | 20 61 6c 74 65 72 6e 61 |: %s [-a| alterna|
|000058b0| 74 65 5f 72 61 74 65 73 | 5d 20 5b 2d 68 5d 20 5b |te_rates|] [-h] [|
|000058c0| 2d 6d 5d 20 5b 2d 74 20 | 74 69 6d 65 6f 75 74 5d |-m] [-t |timeout]|
|000058d0| 20 6c 69 6e 65 20 62 61 | 75 64 5f 72 61 74 65 22 | line ba|ud_rate"|
|000058e0| 2c 0a 09 20 20 70 72 6f | 67 6e 61 6d 65 29 3b 0a |,.. pro|gname);.|
|000058f0| 7d 0a 0a 2f 2a 20 65 72 | 72 6f 72 20 2d 20 72 65 |}../* er|ror - re|
|00005900| 70 6f 72 74 20 65 72 72 | 6f 72 73 20 74 6f 20 74 |port err|ors to t|
|00005910| 68 65 20 63 6f 6e 73 6f | 6c 65 3b 20 6f 6e 6c 79 |he conso|le; only|
|00005920| 20 75 6e 64 65 72 73 74 | 61 6e 64 73 20 25 73 20 | underst|ands %s |
|00005930| 2a 2f 0a 0a 23 64 65 66 | 69 6e 65 09 73 74 72 32 |*/..#def|ine.str2|
|00005940| 63 70 79 28 62 2c 73 31 | 2c 73 32 29 09 73 74 72 |cpy(b,s1|,s2).str|
|00005950| 63 61 74 28 73 74 72 63 | 70 79 28 62 2c 73 31 29 |cat(strc|py(b,s1)|
|00005960| 2c 73 32 29 0a 0a 2f 2a | 20 56 41 52 41 52 47 53 |,s2)../*| VARARGS|
|00005970| 20 2a 2f 0a 0a 65 72 72 | 6f 72 28 76 61 5f 61 6c | */..err|or(va_al|
|00005980| 69 73 74 29 0a 76 61 5f | 64 63 6c 0a 7b 0a 20 20 |ist).va_|dcl.{. |
|00005990| 20 20 76 61 5f 6c 69 73 | 74 20 61 70 3b 0a 20 20 | va_lis|t ap;. |
|000059a0| 20 20 63 68 61 72 20 20 | 20 2a 66 6d 74 3b 0a 20 | char | *fmt;. |
|000059b0| 20 20 20 69 6e 74 20 20 | 20 20 20 66 64 3b 0a 20 | int | fd;. |
|000059c0| 20 20 20 69 6e 74 20 20 | 20 20 20 65 72 72 20 3d | int | err =|
|000059d0| 20 65 72 72 6e 6f 3b 0a | 20 20 20 20 63 68 61 72 | errno;.| char|
|000059e0| 20 20 20 20 62 75 66 5b | 42 55 46 53 49 5a 5d 3b | buf[|BUFSIZ];|
|000059f0| 0a 20 20 20 20 63 68 61 | 72 20 20 20 2a 62 70 3b |. cha|r *bp;|
|00005a00| 0a 0a 20 20 20 20 69 66 | 20 28 28 66 64 20 3d 20 |.. if| ((fd = |
|00005a10| 6f 70 65 6e 28 22 2f 64 | 65 76 2f 63 6f 6e 73 6f |open("/d|ev/conso|
|00005a20| 6c 65 22 2c 20 31 29 29 | 20 3e 3d 20 30 29 20 7b |le", 1))| >= 0) {|
|00005a30| 0a 09 28 76 6f 69 64 29 | 20 73 74 72 32 63 70 79 |..(void)| str2cpy|
|00005a40| 28 62 75 66 2c 20 70 72 | 6f 67 6e 61 6d 65 2c 20 |(buf, pr|ogname, |
|00005a50| 22 3a 20 22 29 3b 0a 09 | 62 70 20 3d 20 62 75 66 |": ");..|bp = buf|
|00005a60| 20 2b 20 73 74 72 6c 65 | 6e 28 62 75 66 29 3b 0a | + strle|n(buf);.|
|00005a70| 0a 09 2f 2a 0a 09 20 2a | 20 25 73 20 65 78 70 61 |../*.. *| %s expa|
|00005a80| 6e 73 69 6f 6e 20 69 73 | 20 64 6f 6e 65 20 62 79 |nsion is| done by|
|00005a90| 20 68 61 6e 64 2e 20 54 | 68 65 20 70 72 6f 67 72 | hand. T|he progr|
|00005aa0| 61 6d 20 77 6f 75 6c 64 | 20 62 65 63 6f 6d 65 20 |am would| become |
|00005ab0| 74 68 72 65 65 20 74 69 | 6d 65 73 0a 09 20 2a 20 |three ti|mes.. * |
|00005ac0| 61 73 20 62 69 67 20 69 | 66 20 77 65 20 77 6f 75 |as big i|f we wou|
|00005ad0| 6c 64 20 75 73 65 20 74 | 68 65 20 73 74 64 69 6f |ld use t|he stdio|
|00005ae0| 20 6c 69 62 72 61 72 79 | 2e 2e 2e 0a 09 20 2a 2f | library|..... */|
|00005af0| 0a 0a 09 76 61 5f 73 74 | 61 72 74 28 61 70 29 3b |...va_st|art(ap);|
|00005b00| 0a 09 66 6d 74 20 3d 20 | 76 61 5f 61 72 67 28 61 |..fmt = |va_arg(a|
|00005b10| 70 2c 20 63 68 61 72 20 | 2a 29 3b 0a 09 77 68 69 |p, char |*);..whi|
|00005b20| 6c 65 20 28 2a 66 6d 74 | 29 20 7b 0a 09 20 20 20 |le (*fmt|) {.. |
|00005b30| 20 69 66 20 28 73 74 72 | 6e 63 6d 70 28 66 6d 74 | if (str|ncmp(fmt|
|00005b40| 2c 20 22 25 73 22 2c 20 | 32 29 20 3d 3d 20 30 29 |, "%s", |2) == 0)|
|00005b50| 20 7b 0a 09 09 28 76 6f | 69 64 29 20 73 74 72 63 | {...(vo|id) strc|
|00005b60| 61 74 28 62 70 2c 20 76 | 61 5f 61 72 67 28 61 70 |at(bp, v|a_arg(ap|
|00005b70| 2c 20 63 68 61 72 20 2a | 29 29 3b 0a 09 09 62 70 |, char *|));...bp|
|00005b80| 20 2b 3d 20 73 74 72 6c | 65 6e 28 62 70 29 3b 0a | += strl|en(bp);.|
|00005b90| 09 09 66 6d 74 20 2b 3d | 20 32 3b 0a 09 20 20 20 |..fmt +=| 2;.. |
|00005ba0| 20 7d 20 65 6c 73 65 20 | 7b 0a 09 09 2a 62 70 2b | } else |{...*bp+|
|00005bb0| 2b 20 3d 20 2a 66 6d 74 | 2b 2b 3b 0a 09 20 20 20 |+ = *fmt|++;.. |
|00005bc0| 20 7d 0a 09 7d 0a 09 2a | 62 70 20 3d 20 30 3b 0a | }..}..*|bp = 0;.|
|00005bd0| 09 76 61 5f 65 6e 64 28 | 61 70 29 3b 0a 0a 09 2f |.va_end(|ap);.../|
|00005be0| 2a 20 41 64 64 20 73 79 | 73 74 65 6d 20 65 72 72 |* Add sy|stem err|
|00005bf0| 6f 72 20 6d 65 73 73 61 | 67 65 20 69 66 20 65 72 |or messa|ge if er|
|00005c00| 72 6e 6f 20 77 61 73 20 | 73 65 74 20 2a 2f 0a 0a |rno was |set */..|
|00005c10| 09 69 66 20 28 65 72 72 | 29 0a 09 20 20 20 20 28 |.if (err|).. (|
|00005c20| 76 6f 69 64 29 20 73 74 | 72 32 63 70 79 28 62 70 |void) st|r2cpy(bp|
|00005c30| 2c 20 22 3a 20 22 2c 20 | 73 79 73 5f 65 72 72 6c |, ": ", |sys_errl|
|00005c40| 69 73 74 5b 65 72 72 6e | 6f 5d 29 3b 0a 0a 09 2f |ist[errn|o]);.../|
|00005c50| 2a 20 54 65 72 6d 69 6e | 61 74 65 20 77 69 74 68 |* Termin|ate with|
|00005c60| 20 43 52 2d 4c 46 20 73 | 69 6e 63 65 20 74 68 65 | CR-LF s|ince the|
|00005c70| 20 63 6f 6e 73 6f 6c 65 | 20 6d 6f 64 65 20 69 73 | console| mode is|
|00005c80| 20 75 6e 6b 6e 6f 77 6e | 20 2a 2f 0a 0a 09 28 76 | unknown| */...(v|
|00005c90| 6f 69 64 29 20 73 74 72 | 63 61 74 28 62 70 2c 20 |oid) str|cat(bp, |
|00005ca0| 22 5c 72 5c 6e 22 29 3b | 0a 09 28 76 6f 69 64 29 |"\r\n");|..(void)|
|00005cb0| 20 77 72 69 74 65 28 66 | 64 2c 20 62 75 66 2c 20 | write(f|d, buf, |
|00005cc0| 73 74 72 6c 65 6e 28 62 | 75 66 29 29 3b 0a 09 28 |strlen(b|uf));..(|
|00005cd0| 76 6f 69 64 29 20 63 6c | 6f 73 65 28 66 64 29 3b |void) cl|ose(fd);|
|00005ce0| 0a 20 20 20 20 7d 0a 20 | 20 20 20 28 76 6f 69 64 |. }. | (void|
|00005cf0| 29 20 73 6c 65 65 70 28 | 35 29 3b 09 09 09 09 2f |) sleep(|5);..../|
|00005d00| 2a 20 62 65 20 6b 69 6e | 64 20 74 6f 20 69 6e 69 |* be kin|d to ini|
|00005d10| 74 20 2a 2f 0a 20 20 20 | 20 65 78 69 74 28 31 29 |t */. | exit(1)|
|00005d20| 3b 0a 7d 0a 0a 6c 61 67 | 20 3d 20 74 70 2d 3e 63 |;.}..lag| = tp->c|
|00005d30| 5f 6f 66 6c 61 67 20 3d | 20 74 70 2d 3e 63 5f 6c |_oflag =| tp->c_l|
|00005d40| 69 6e 65 20 3d 20 30 3b | 0a 20 20 20 20 74 70 2d |ine = 0;|. tp-|
|00005d50| 3e 63 5f 63 63 5b 56 4d | 49 4e 5d 20 3d 20 31 3b |>c_cc[VM|IN] = 1;|
|00005d60| 0a 20 20 20 20 74 70 2d | 3e 63 5f 63 63 5b 56 54 |. tp-|>c_cc[VT|
|00005d70| 49 4d 45 5d 20 3d 20 30 | 3b 0a 20 20 20 20 28 76 |IME] = 0|;. (v|
|00005d80| 6f 69 64 29 20 69 6f 63 | 74 6c 28 30 2c 20 54 43 |oid) ioc|tl(0, TC|
|00005d90| 53 45 54 41 2c 20 74 70 | 29 3b 0a 7d 0a 0a 2f 2a |SETA, tp|);.}../*|
|00005da0| 20 61 75 74 6f 5f 62 61 | 75 64 20 2d 20 65 78 74 | auto_ba|ud - ext|
|00005db0| 72 61 63 74 20 62 61 75 | 64 20 72 61 74 65 20 66 |ract bau|d rate f|
|00005dc0| 72 6f 6d 20 6d 6f 64 65 | 6d 20 73 74 61 74 75 73 |rom mode|m status|
|00005dd0| 20 6d 65 73 73 61 67 65 | 20 2a 2f 0a 0a 61 75 74 | message| */..aut|
|00005de0| 6f 5f 62 61 75 64 28 74 | 70 29 0a 73 74 72 75 63 |o_baud(t|p).struc|
|00005df0| 74 20 74 65 72 6d 69 6f | 20 2a 74 70 3b 0a 7b 0a |t termio| *tp;.{.|
|00005e00| 61 67 65 74 74 79 2f 61 | 67 65 74 74 79 2e 38 00 |agetty/a|getty.8.|
|00005e10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005e20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005e30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005e40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005e50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005e60| 00 00 00 00 20 20 20 36 | 34 34 20 00 20 20 31 35 |.... 6|44 . 15|
|00005e70| 32 34 20 00 20 20 20 20 | 31 33 20 00 20 20 20 20 |24 . |13 . |
|00005e80| 20 20 20 36 34 37 34 20 | 20 34 35 35 30 31 36 32 | 6474 | 4550162|
|00005e90| 37 30 36 20 20 20 37 30 | 33 30 00 20 00 00 00 00 |706 70|30. ....|
|00005ea0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005eb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005ec0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005ed0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005ee0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005ef0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005f00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005f10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005f20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005f30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005f40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005f50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005f60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005f70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005f80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005f90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005fa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005fb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005fc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005fd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005ff0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006000| 2e 54 48 20 41 47 45 54 | 54 59 20 38 20 0a 2e 61 |.TH AGET|TY 8 ..a|
|00006010| 64 0a 2e 66 69 0a 2e 53 | 48 20 4e 41 4d 45 0a 61 |d..fi..S|H NAME.a|
|00006020| 67 65 74 74 79 0a 5c 2d | 0a 61 6c 74 65 72 6e 61 |getty.\-|.alterna|
|00006030| 74 69 76 65 20 53 79 73 | 74 65 6d 2d 56 20 67 65 |tive Sys|tem-V ge|
|00006040| 74 74 79 0a 2e 53 48 20 | 53 59 4e 4f 50 53 49 53 |tty..SH |SYNOPSIS|
|00006050| 0a 2e 6e 61 0a 2e 6e 66 | 0a 61 67 65 74 74 79 20 |..na..nf|.agetty |
|00006060| 5b 2d 61 20 61 6c 74 65 | 72 6e 61 74 65 5f 72 61 |[-a alte|rnate_ra|
|00006070| 74 65 73 5d 20 5b 2d 68 | 5d 20 5b 2d 6d 5d 20 5b |tes] [-h|] [-m] [|
|00006080| 2d 74 20 74 69 6d 65 6f | 75 74 5d 20 70 6f 72 74 |-t timeo|ut] port|
|00006090| 20 62 61 75 64 5f 72 61 | 74 65 0a 2e 53 48 20 44 | baud_ra|te..SH D|
|000060a0| 45 53 43 52 49 50 54 49 | 4f 4e 0a 2e 61 64 0a 2e |ESCRIPTI|ON..ad..|
|000060b0| 66 69 0a 5c 66 49 61 67 | 65 74 74 79 5c 66 52 20 |fi.\fIag|etty\fR |
|000060c0| 6f 70 65 6e 73 20 61 20 | 74 74 79 20 70 6f 72 74 |opens a |tty port|
|000060d0| 2c 20 70 72 6f 6d 70 74 | 73 20 66 6f 72 20 61 20 |, prompt|s for a |
|000060e0| 6c 6f 67 69 6e 20 6e 61 | 6d 65 20 61 6e 64 20 69 |login na|me and i|
|000060f0| 6e 76 6f 6b 65 73 20 74 | 68 65 0a 2f 62 69 6e 2f |nvokes t|he./bin/|
|00006100| 6c 6f 67 69 6e 20 63 6f | 6d 6d 61 6e 64 2e 20 49 |login co|mmand. I|
|00006110| 74 20 69 73 20 6e 6f 72 | 6d 61 6c 6c 79 20 69 6e |t is nor|mally in|
|00006120| 76 6f 6b 65 64 20 62 79 | 20 5c 66 49 69 6e 69 74 |voked by| \fIinit|
|00006130| 28 38 29 5c 66 52 2e 0a | 0a 5c 66 49 61 67 65 74 |(8)\fR..|.\fIaget|
|00006140| 74 79 5c 66 52 20 68 61 | 73 20 73 6f 6d 65 20 75 |ty\fR ha|s some u|
|00006150| 73 65 66 75 6c 20 66 65 | 61 74 75 72 65 73 20 6e |seful fe|atures n|
|00006160| 6f 74 20 70 72 65 73 65 | 6e 74 20 69 6e 20 74 68 |ot prese|nt in th|
|00006170| 65 20 53 79 73 74 65 6d | 0a 56 20 52 65 6c 65 61 |e System|.V Relea|
|00006180| 73 65 20 32 20 67 65 74 | 74 79 20 63 6f 6d 6d 61 |se 2 get|ty comma|
|00006190| 6e 64 3a 0a 2e 49 50 20 | 6f 0a 41 64 61 70 74 73 |nd:..IP |o.Adapts|
|000061a0| 20 74 68 65 20 74 74 79 | 20 73 65 74 74 69 6e 67 | the tty| setting|
|000061b0| 73 20 74 6f 20 70 61 72 | 69 74 79 20 62 69 74 73 |s to par|ity bits|
|000061c0| 20 61 6e 64 20 74 6f 0a | 65 72 61 73 65 2c 20 6b | and to.|erase, k|
|000061d0| 69 6c 6c 20 61 6e 64 20 | 65 6e 64 2d 6f 66 2d 6c |ill and |end-of-l|
|000061e0| 69 6e 65 20 63 68 61 72 | 61 63 74 65 72 73 20 66 |ine char|acters f|
|000061f0| 6f 75 6e 64 20 69 6e 20 | 69 74 73 20 69 6e 70 75 |ound in |its inpu|
|00006200| 74 2e 20 54 68 65 0a 70 | 72 6f 67 72 61 6d 20 75 |t. The.p|rogram u|
|00006210| 6e 64 65 72 73 74 61 6e | 64 73 20 37 2d 62 69 74 |nderstan|ds 7-bit|
|00006220| 20 63 68 61 72 61 63 74 | 65 72 73 20 77 69 74 68 | charact|ers with|
|00006230| 20 65 76 65 6e 2c 20 6f | 64 64 2c 20 6e 6f 6e 65 | even, o|dd, none|
|00006240| 20 6f 72 20 73 70 61 63 | 65 0a 70 61 72 69 74 79 | or spac|e.parity|
|00006250| 2c 20 61 6e 64 20 38 2d | 62 69 74 20 63 68 61 72 |, and 8-|bit char|
|00006260| 61 63 74 65 72 73 20 77 | 69 74 68 20 6e 6f 20 70 |acters w|ith no p|
|00006270| 61 72 69 74 79 2e 20 54 | 68 65 20 66 6f 6c 6c 6f |arity. T|he follo|
|00006280| 77 69 6e 67 20 73 70 65 | 63 69 61 6c 0a 63 68 61 |wing spe|cial.cha|
|00006290| 72 61 63 74 65 72 73 20 | 61 72 65 20 72 65 63 6f |racters |are reco|
|000062a0| 67 6e 69 7a 65 64 3a 20 | 40 20 61 6e 64 20 43 6f |gnized: |@ and Co|
|000062b0| 6e 74 72 6f 6c 2d 55 20 | 28 6b 69 6c 6c 29 3b 20 |ntrol-U |(kill); |
|000062c0| 23 2c 20 44 45 4c 20 61 | 6e 64 0a 62 61 63 6b 73 |#, DEL a|nd.backs|
|000062d0| 70 61 63 65 20 28 65 72 | 61 73 65 29 3b 20 63 61 |pace (er|ase); ca|
|000062e0| 72 72 69 61 67 65 2d 72 | 65 74 75 72 6e 20 61 6e |rriage-r|eturn an|
|000062f0| 64 20 6c 69 6e 65 66 65 | 65 64 20 28 65 6e 64 20 |d linefe|ed (end |
|00006300| 6f 66 20 6c 69 6e 65 29 | 2e 0a 2e 49 50 20 6f 0a |of line)|...IP o.|
|00006310| 4f 70 74 69 6f 6e 61 6c | 6c 79 20 72 65 63 6f 67 |Optional|ly recog|
|00006320| 6e 69 7a 65 73 20 74 68 | 65 20 62 61 75 64 20 72 |nizes th|e baud r|
|00006330| 61 74 65 20 6f 66 20 69 | 6e 63 6f 6d 69 6e 67 0a |ate of i|ncoming.|
|00006340| 63 61 6c 6c 73 20 66 72 | 6f 6d 20 74 68 65 20 73 |calls fr|om the s|
|00006350| 74 61 74 75 73 20 6d 65 | 73 73 61 67 65 73 20 70 |tatus me|ssages p|
|00006360| 72 6f 64 75 63 65 64 20 | 62 79 20 73 6f 6d 65 20 |roduced |by some |
|00006370| 6d 75 6c 74 69 2d 73 70 | 65 65 64 20 48 61 79 65 |multi-sp|eed Haye|
|00006380| 73 20 28 74 6d 29 0a 6d | 6f 64 65 6d 20 63 6c 6f |s (tm).m|odem clo|
|00006390| 6e 65 73 2e 0a 2e 50 50 | 0a 54 68 69 73 20 70 72 |nes...PP|.This pr|
|000063a0| 6f 67 72 61 6d 20 64 6f | 65 73 20 6e 6f 74 20 75 |ogram do|es not u|
|000063b0| 73 65 20 74 68 65 20 5c | 66 49 2f 65 74 63 2f 67 |se the \|fI/etc/g|
|000063c0| 65 74 74 79 64 65 66 73 | 5c 66 52 20 66 69 6c 65 |ettydefs|\fR file|
|000063d0| 2e 20 45 78 63 65 70 74 | 20 66 6f 72 0a 64 69 66 |. Except| for.dif|
|000063e0| 66 65 72 65 6e 63 65 73 | 20 64 65 73 63 72 69 62 |ferences| describ|
|000063f0| 65 64 20 68 65 72 65 20 | 74 68 65 20 70 72 6f 67 |ed here |the prog|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.