home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / console / splitvt-.000 / splitvt-
Tape Archive  |  1995-01-10  |  180.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: splitvt-

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Tape Archive (archive/tar) magic Supported
100% file POSIX tar archive (GNU) default
99% file POSIX tar archive (GNU), directory splitvt-1.6.1/, mode 40755 , uid 625 , gid 30 , size 0 , seconds 5704605234, user slouken, group pdadmin default
98% file data default
62% TrID TAR - Tape ARchive (GNU) default
37% TrID TAR - Tape ARchive (directory) default
100% siegfried x-fmt/265 Tape Archive Format default
100% lsar Tar default
100% gt2 TAR Archiv gefunden (Auflistung ist deaktiviert) default
100% disktype GNU tar archive default
100% detectItEasy Archive: tar default
100% binwalkID POSIX tar archive (GNU), owner user name: "1.6.1/" default
100% xdgMime application/x-tar default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 73 70 6c 69 74 76 74 2d | 31 2e 36 2e 31 2f 00 00 |splitvt-|1.6.1/..|
|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 34 30 37 | 35 35 20 00 20 20 20 36 |.... 407|55 . 6|
|00000070| 32 35 20 00 20 20 20 20 | 33 30 20 00 20 20 20 20 |25 . |30 . |
|00000080| 20 20 20 20 20 20 30 20 | 20 35 37 30 34 36 30 35 | 0 | 5704605|
|00000090| 32 33 34 20 20 31 32 34 | 34 31 00 20 35 00 00 00 |234 124|41. 5...|
|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 75 73 74 61 72 20 20 | 00 73 6c 6f 75 6b 65 6e |.ustar |.slouken|
|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 70 64 61 64 6d 69 6e |........|.pdadmin|
|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| 73 70 6c 69 74 76 74 2d | 31 2e 36 2e 31 2f 43 6f |splitvt-|1.6.1/Co|
|00000210| 6e 66 69 67 75 72 65 00 | 00 00 00 00 00 00 00 00 |nfigure.|........|
|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 31 30 30 37 | 35 35 20 00 20 20 20 36 |....1007|55 . 6|
|00000270| 32 35 20 00 20 20 20 20 | 33 30 20 00 20 20 20 20 |25 . |30 . |
|00000280| 20 20 20 31 33 33 36 20 | 20 35 36 37 36 33 35 30 | 1336 | 5676350|
|00000290| 30 37 35 20 20 31 34 34 | 32 30 00 20 30 00 00 00 |075 144|20. 0...|
|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 75 73 74 61 72 20 20 | 00 73 6c 6f 75 6b 65 6e |.ustar |.slouken|
|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 70 64 61 64 6d 69 6e |........|.pdadmin|
|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| 0a 23 21 2f 62 69 6e 2f | 73 68 0a 23 20 20 53 63 |.#!/bin/|sh.# Sc|
|00000410| 72 69 70 74 20 74 6f 20 | 61 75 74 6f 2d 63 6f 6e |ript to |auto-con|
|00000420| 66 69 67 75 72 65 20 73 | 70 6c 69 74 76 74 2e 09 |figure s|plitvt..|
|00000430| 09 2d 53 61 6d 20 4c 61 | 6e 74 69 6e 67 61 0a 0a |.-Sam La|ntinga..|
|00000440| 51 55 49 45 54 3d 22 2d | 76 22 0a 43 46 4c 41 47 |QUIET="-|v".CFLAG|
|00000450| 53 3d 0a 4d 41 4b 45 3d | 22 65 63 68 6f 20 5c 22 |S=.MAKE=|"echo \"|
|00000460| 44 6f 6e 65 2e 20 20 54 | 79 70 65 20 27 6d 61 6b |Done. T|ype 'mak|
|00000470| 65 27 20 74 6f 20 62 75 | 69 6c 64 5c 22 22 20 0a |e' to bu|ild\"" .|
|00000480| 0a 65 63 68 6f 20 22 4d | 61 6b 69 6e 67 20 63 6f |.echo "M|aking co|
|00000490| 6e 66 69 67 75 72 61 74 | 69 6f 6e 2e 2e 2e 22 0a |nfigurat|ion...".|
|000004a0| 0a 77 68 69 6c 65 20 5b | 20 24 23 20 2d 67 74 20 |.while [| $# -gt |
|000004b0| 30 20 5d 0a 20 20 64 6f | 20 63 61 73 65 20 24 31 |0 ]. do| case $1|
|000004c0| 20 69 6e 0a 20 20 20 20 | 20 20 20 2d 64 29 20 43 | in. | -d) C|
|000004d0| 46 4c 41 47 53 3d 2d 44 | 44 45 42 55 47 0a 20 20 |FLAGS=-D|DEBUG. |
|000004e0| 20 20 20 20 20 20 20 20 | 20 65 63 68 6f 20 22 43 | | echo "C|
|000004f0| 6f 6e 66 69 67 75 72 69 | 6e 67 20 66 6f 72 20 64 |onfiguri|ng for d|
|00000500| 65 62 75 67 20 6d 6f 64 | 65 2e 22 0a 20 20 20 20 |ebug mod|e.". |
|00000510| 20 20 20 20 20 20 20 73 | 68 69 66 74 3b 3b 0a 20 | s|hift;;. |
|00000520| 20 20 20 20 20 20 2d 6d | 29 20 4d 41 4b 45 3d 22 | -m|) MAKE="|
|00000530| 65 63 68 6f 20 43 6f 6d | 70 69 6c 69 6e 67 20 6e |echo Com|piling n|
|00000540| 6f 77 2e 2e 2e 3b 20 6d | 61 6b 65 20 26 26 20 5c |ow...; m|ake && \|
|00000550| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00000560| 20 20 65 63 68 6f 20 43 | 6f 6d 70 69 6c 61 74 69 | echo C|ompilati|
|00000570| 6f 6e 20 73 75 63 63 65 | 73 73 66 75 6c 6c 79 20 |on succe|ssfully |
|00000580| 63 6f 6d 70 6c 65 74 65 | 64 2e 22 0a 20 20 20 20 |complete|d.". |
|00000590| 20 20 20 20 20 20 20 73 | 68 69 66 74 3b 3b 0a 20 | s|hift;;. |
|000005a0| 20 20 20 20 20 20 2d 71 | 29 20 51 55 49 45 54 3d | -q|) QUIET=|
|000005b0| 22 22 0a 20 20 20 20 20 | 20 20 20 20 20 20 73 68 |"". | sh|
|000005c0| 69 66 74 3b 3b 0a 20 20 | 20 20 20 20 20 20 2a 29 |ift;;. | *)|
|000005d0| 20 20 65 63 68 6f 20 22 | 55 73 61 67 65 3a 20 43 | echo "|Usage: C|
|000005e0| 6f 6e 66 69 67 75 72 65 | 20 5b 2d 71 5d 20 5b 2d |onfigure| [-q] [-|
|000005f0| 64 5d 20 5b 2d 6d 5d 22 | 0a 20 20 20 20 20 20 20 |d] [-m]"|. |
|00000600| 20 20 20 20 20 65 78 69 | 74 3b 3b 0a 20 20 20 20 | exi|t;;. |
|00000610| 20 65 73 61 63 0a 64 6f | 6e 65 0a 0a 63 63 20 24 | esac.do|ne..cc $|
|00000620| 43 46 4c 41 47 53 20 2d | 6f 20 63 6f 6e 66 69 67 |CFLAGS -|o config|
|00000630| 20 63 6f 6e 66 69 67 2e | 63 0a 69 66 20 5b 20 2d | config.|c.if [ -|
|00000640| 66 20 63 6f 6e 66 69 67 | 20 5d 3b 20 74 68 65 6e |f config| ]; then|
|00000650| 0a 09 69 66 20 2e 2f 63 | 6f 6e 66 69 67 20 24 51 |..if ./c|onfig $Q|
|00000660| 55 49 45 54 0a 09 20 20 | 74 68 65 6e 20 65 76 61 |UIET.. |then eva|
|00000670| 6c 20 24 4d 41 4b 45 0a | 09 66 69 0a 65 6c 73 65 |l $MAKE.|.fi.else|
|00000680| 0a 09 65 63 68 6f 20 22 | 43 61 6e 27 74 20 63 6f |..echo "|Can't co|
|00000690| 6d 70 69 6c 65 20 63 6f | 6e 66 69 67 75 72 61 74 |mpile co|nfigurat|
|000006a0| 69 6f 6e 2e 2e 2e 20 20 | 4d 61 6b 65 66 69 6c 65 |ion... |Makefile|
|000006b0| 20 4e 4f 54 20 63 72 65 | 61 74 65 64 2e 22 0a 09 | NOT cre|ated."..|
|000006c0| 65 78 69 74 20 31 0a 66 | 69 0a 72 6d 20 2d 66 20 |exit 1.f|i.rm -f |
|000006d0| 63 6f 6e 66 69 67 0a 65 | 78 69 74 20 30 0a 00 00 |config.e|xit 0...|
|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| 73 70 6c 69 74 76 74 2d | 31 2e 36 2e 31 2f 52 45 |splitvt-|1.6.1/RE|
|00000810| 41 44 4d 45 00 00 00 00 | 00 00 00 00 00 00 00 00 |ADME....|........|
|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 31 30 30 36 | 34 34 20 00 20 20 20 36 |....1006|44 . 6|
|00000870| 32 35 20 00 20 20 20 20 | 33 30 20 00 20 20 20 20 |25 . |30 . |
|00000880| 20 20 20 31 34 36 30 20 | 20 35 36 37 35 33 37 34 | 1460 | 5675374|
|00000890| 32 35 30 20 20 31 33 34 | 32 37 00 20 30 00 00 00 |250 134|27. 0...|
|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 75 73 74 61 72 20 20 | 00 73 6c 6f 75 6b 65 6e |.ustar |.slouken|
|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 70 64 61 64 6d 69 6e |........|.pdadmin|
|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| 0a 0a 09 57 65 6c 6c 2c | 20 74 68 69 73 20 70 72 |...Well,| this pr|
|00000a10| 6f 67 72 61 6d 20 6a 75 | 73 74 20 73 70 6c 69 74 |ogram ju|st split|
|00000a20| 73 20 79 6f 75 72 20 73 | 63 72 65 65 6e 20 69 6e |s your s|creen in|
|00000a30| 74 6f 20 74 77 6f 20 0a | 77 69 6e 64 6f 77 73 2c |to two .|windows,|
|00000a40| 20 65 61 63 68 20 72 75 | 6e 6e 69 6e 67 20 61 20 | each ru|nning a |
|00000a50| 73 68 65 6c 6c 2c 20 73 | 6f 20 79 6f 75 20 63 61 |shell, s|o you ca|
|00000a60| 6e 20 64 6f 20 74 77 6f | 20 74 68 69 6e 67 73 20 |n do two| things |
|00000a70| 61 74 20 6f 6e 63 65 2e | 0a 41 6c 6c 20 79 6f 75 |at once.|.All you|
|00000a80| 20 68 61 76 65 20 74 6f | 20 64 6f 20 69 73 20 75 | have to| do is u|
|00000a90| 6e 62 75 6e 64 6c 65 20 | 74 68 65 20 70 61 63 6b |nbundle |the pack|
|00000aa0| 61 67 65 20 61 6e 64 20 | 72 75 6e 20 74 68 65 20 |age and |run the |
|00000ab0| 27 43 6f 6e 66 69 67 75 | 72 65 27 20 0a 73 63 72 |'Configu|re' .scr|
|00000ac0| 69 70 74 20 74 68 61 74 | 20 69 73 20 69 6e 63 6c |ipt that| is incl|
|00000ad0| 75 64 65 64 2e 20 20 49 | 74 20 69 73 20 66 61 69 |uded. I|t is fai|
|00000ae0| 72 6c 79 20 73 69 6d 70 | 6c 65 2c 20 61 6e 64 20 |rly simp|le, and |
|00000af0| 73 68 6f 75 6c 64 20 72 | 75 6e 20 6f 6e 0a 61 6e |should r|un on.an|
|00000b00| 79 20 74 65 72 6d 69 6e | 61 6c 20 74 68 61 74 20 |y termin|al that |
|00000b10| 73 75 70 70 6f 72 74 73 | 20 68 61 72 64 77 61 72 |supports| hardwar|
|00000b20| 65 20 73 63 72 6f 6c 6c | 69 6e 67 20 72 65 67 69 |e scroll|ing regi|
|00000b30| 6f 6e 73 2e 20 20 41 74 | 20 74 68 65 20 0a 6d 6f |ons. At| the .mo|
|00000b40| 6d 65 6e 74 2c 20 6f 6e | 6c 79 20 76 74 31 30 30 |ment, on|ly vt100|
|00000b50| 20 63 6f 6d 70 61 74 69 | 62 6c 65 20 74 65 72 6d | compati|ble term|
|00000b60| 69 6e 61 6c 73 20 28 73 | 75 63 68 20 61 73 20 78 |inals (s|uch as x|
|00000b70| 74 65 72 6d 2c 20 64 65 | 63 74 65 72 6d 2c 0a 6c |term, de|cterm,.l|
|00000b80| 69 6e 75 78 20 63 6f 6e | 73 6f 6c 65 2c 20 65 74 |inux con|sole, et|
|00000b90| 63 29 20 77 69 6c 6c 20 | 72 75 6e 20 73 70 6c 69 |c) will |run spli|
|00000ba0| 74 76 74 2e 0a 0a 09 4d | 6f 72 65 20 64 6f 63 75 |tvt....M|ore docu|
|00000bb0| 6d 65 6e 74 61 74 69 6f | 6e 20 66 6f 72 20 74 68 |mentatio|n for th|
|00000bc0| 69 73 20 70 72 6f 67 72 | 61 6d 20 63 61 6e 20 62 |is progr|am can b|
|00000bd0| 65 20 66 6f 75 6e 64 20 | 69 6e 20 74 68 65 0a 66 |e found |in the.f|
|00000be0| 69 6c 65 20 22 73 70 6c | 69 74 76 74 2e 6d 61 6e |ile "spl|itvt.man|
|00000bf0| 22 2e 0a 0a 09 49 66 20 | 79 6f 75 20 68 61 76 65 |"....If |you have|
|00000c00| 20 74 72 6f 75 62 6c 65 | 20 63 6f 6d 70 69 6c 69 | trouble| compili|
|00000c10| 6e 67 20 6f 72 20 72 75 | 6e 6e 69 6e 67 20 73 70 |ng or ru|nning sp|
|00000c20| 6c 69 74 76 74 2c 20 72 | 65 6d 65 6d 62 65 72 0a |litvt, r|emember.|
|00000c30| 74 68 61 74 20 79 6f 75 | 20 6d 75 73 74 20 72 75 |that you| must ru|
|00000c40| 6e 20 69 74 20 77 69 74 | 68 69 6e 20 61 20 76 74 |n it wit|hin a vt|
|00000c50| 31 30 30 20 63 6f 6d 70 | 61 74 69 62 6c 65 20 74 |100 comp|atible t|
|00000c60| 65 72 6d 69 6e 61 6c 2c | 20 61 6e 64 20 63 68 65 |erminal,| and che|
|00000c70| 63 6b 0a 74 68 65 20 22 | 4e 4f 54 45 53 22 20 66 |ck.the "|NOTES" f|
|00000c80| 69 6c 65 20 69 6e 20 74 | 68 69 73 20 64 69 73 74 |ile in t|his dist|
|00000c90| 72 69 62 75 74 69 6f 6e | 20 66 6f 72 20 68 69 6e |ribution| for hin|
|00000ca0| 74 73 2e 0a 0a 45 6e 6a | 6f 79 21 0a 0a 09 2d 53 |ts...Enj|oy!...-S|
|00000cb0| 61 6d 20 4c 61 6e 74 69 | 6e 67 61 09 09 73 6c 6f |am Lanti|nga..slo|
|00000cc0| 75 6b 65 6e 40 63 73 2e | 75 63 64 61 76 69 73 2e |uken@cs.|ucdavis.|
|00000cd0| 65 64 75 0a 0a 0a 0a 54 | 68 65 20 69 64 65 61 20 |edu....T|he idea |
|00000ce0| 66 6f 72 20 74 68 69 73 | 20 70 72 6f 67 72 61 6d |for this| program|
|00000cf0| 20 63 61 6d 65 20 66 72 | 6f 6d 20 44 61 76 65 20 | came fr|om Dave |
|00000d00| 4c 6a 75 6e 67 20 28 64 | 78 6c 40 68 70 65 73 64 |Ljung (d|xl@hpesd|
|00000d10| 78 6c 2e 66 63 2e 68 70 | 2e 63 6f 6d 29 0a 0a 09 |xl.fc.hp|.com)...|
|00000d20| 54 68 61 6e 6b 73 20 44 | 61 76 65 2b 2b 21 0a 0a |Thanks D|ave++!..|
|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| 73 70 6c 69 74 76 74 2d | 31 2e 36 2e 31 2f 63 6f |splitvt-|1.6.1/co|
|00000e10| 6e 66 69 67 2e 63 00 00 | 00 00 00 00 00 00 00 00 |nfig.c..|........|
|00000e20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e60| 00 00 00 00 31 30 30 36 | 34 34 20 00 20 20 20 36 |....1006|44 . 6|
|00000e70| 32 35 20 00 20 20 20 20 | 33 30 20 00 20 20 20 20 |25 . |30 . |
|00000e80| 20 20 31 36 30 32 35 20 | 20 35 36 37 33 34 31 31 | 16025 | 5673411|
|00000e90| 33 32 30 20 20 31 34 31 | 36 37 00 20 30 00 00 00 |320 141|67. 0...|
|00000ea0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000eb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ec0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ed0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ee0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ef0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f00| 00 75 73 74 61 72 20 20 | 00 73 6c 6f 75 6b 65 6e |.ustar |.slouken|
|00000f10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f20| 00 00 00 00 00 00 00 00 | 00 70 64 61 64 6d 69 6e |........|.pdadmin|
|00000f30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000f90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000ff0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001000| 23 69 6e 63 6c 75 64 65 | 09 3c 73 79 73 2f 74 79 |#include|.<sys/ty|
|00001010| 70 65 73 2e 68 3e 0a 23 | 69 6e 63 6c 75 64 65 09 |pes.h>.#|include.|
|00001020| 3c 73 74 64 69 6f 2e 68 | 3e 0a 23 69 6e 63 6c 75 |<stdio.h|>.#inclu|
|00001030| 64 65 09 3c 73 79 73 2f | 73 74 61 74 2e 68 3e 0a |de.<sys/|stat.h>.|
|00001040| 23 69 6e 63 6c 75 64 65 | 09 3c 73 69 67 6e 61 6c |#include|.<signal|
|00001050| 2e 68 3e 0a 0a 2f 2a 23 | 64 65 66 69 6e 65 20 44 |.h>../*#|define D|
|00001060| 45 42 55 47 09 09 2f 2a | 20 50 72 6f 76 69 64 65 |EBUG../*| Provide|
|00001070| 73 20 65 78 74 72 61 20 | 64 65 62 75 67 67 69 6e |s extra |debuggin|
|00001080| 67 20 69 6e 66 6f 20 2a | 2f 0a 0a 23 64 65 66 69 |g info *|/..#defi|
|00001090| 6e 65 20 56 45 52 42 4f | 53 45 5f 50 52 49 4e 54 |ne VERBO|SE_PRINT|
|000010a0| 28 58 29 09 69 66 20 28 | 20 76 65 72 62 6f 73 65 |(X).if (| verbose|
|000010b0| 20 29 20 70 72 69 6e 74 | 66 28 58 29 0a 0a 23 64 | ) print|f(X)..#d|
|000010c0| 65 66 69 6e 65 20 46 5f | 4f 4b 09 30 0a 23 64 65 |efine F_|OK.0.#de|
|000010d0| 66 69 6e 65 20 58 5f 4f | 4b 09 31 0a 23 64 65 66 |fine X_O|K.1.#def|
|000010e0| 69 6e 65 20 57 5f 4f 4b | 09 32 0a 23 64 65 66 69 |ine W_OK|.2.#defi|
|000010f0| 6e 65 20 52 5f 4f 4b 09 | 34 0a 0a 69 6e 74 20 65 |ne R_OK.|4..int e|
|00001100| 78 69 73 74 73 28 64 69 | 72 2c 20 66 69 6c 65 29 |xists(di|r, file)|
|00001110| 0a 63 68 61 72 20 2a 64 | 69 72 3b 0a 63 68 61 72 |.char *d|ir;.char|
|00001120| 20 2a 66 69 6c 65 3b 0a | 7b 0a 09 73 74 72 75 63 | *file;.|{..struc|
|00001130| 74 20 73 74 61 74 20 73 | 74 61 74 62 75 66 3b 0a |t stat s|tatbuf;.|
|00001140| 09 63 68 61 72 20 62 75 | 66 66 65 72 5b 42 55 46 |.char bu|ffer[BUF|
|00001150| 53 49 5a 5d 3b 0a 0a 09 | 73 70 72 69 6e 74 66 28 |SIZ];...|sprintf(|
|00001160| 62 75 66 66 65 72 2c 20 | 22 25 73 2f 25 73 22 2c |buffer, |"%s/%s",|
|00001170| 20 64 69 72 2c 20 66 69 | 6c 65 29 3b 0a 09 69 66 | dir, fi|le);..if|
|00001180| 20 28 20 73 74 61 74 28 | 62 75 66 66 65 72 2c 20 | ( stat(|buffer, |
|00001190| 26 73 74 61 74 62 75 66 | 29 20 3d 3d 20 30 20 29 |&statbuf|) == 0 )|
|000011a0| 0a 09 09 72 65 74 75 72 | 6e 28 31 29 3b 0a 09 65 |...retur|n(1);..e|
|000011b0| 6c 73 65 0a 09 09 72 65 | 74 75 72 6e 28 30 29 3b |lse...re|turn(0);|
|000011c0| 0a 7d 0a 0a 0a 6d 61 69 | 6e 28 61 72 67 63 2c 20 |.}...mai|n(argc, |
|000011d0| 61 72 67 76 29 0a 69 6e | 74 20 61 72 67 63 3b 0a |argv).in|t argc;.|
|000011e0| 63 68 61 72 20 2a 61 72 | 67 76 5b 5d 3b 0a 7b 0a |char *ar|gv[];.{.|
|000011f0| 09 69 6e 74 20 20 69 72 | 69 78 3d 30 2c 20 73 6f |.int ir|ix=0, so|
|00001200| 6c 61 72 69 73 3d 30 2c | 20 76 65 72 62 6f 73 65 |laris=0,| verbose|
|00001210| 3d 30 2c 20 77 72 69 74 | 65 5f 75 74 6d 70 3b 0a |=0, writ|e_utmp;.|
|00001220| 09 63 68 61 72 20 63 66 | 6c 61 67 73 5b 42 55 46 |.char cf|lags[BUF|
|00001230| 53 49 5a 5d 2c 20 6c 64 | 66 6c 61 67 73 5b 42 55 |SIZ], ld|flags[BU|
|00001240| 46 53 49 5a 5d 3b 0a 09 | 63 68 61 72 20 6c 69 6e |FSIZ];..|char lin|
|00001250| 65 5b 42 55 46 53 49 5a | 5d 3b 0a 09 46 49 4c 45 |e[BUFSIZ|];..FILE|
|00001260| 20 2a 6d 61 6b 65 66 69 | 6c 65 3b 0a 0a 09 69 66 | *makefi|le;...if|
|00001270| 20 28 20 61 72 67 76 5b | 31 5d 20 26 26 20 73 74 | ( argv[|1] && st|
|00001280| 72 6e 63 6d 70 28 61 72 | 67 76 5b 31 5d 2c 20 22 |rncmp(ar|gv[1], "|
|00001290| 2d 76 22 2c 20 32 29 20 | 3d 3d 20 30 20 29 0a 09 |-v", 2) |== 0 )..|
|000012a0| 09 76 65 72 62 6f 73 65 | 3d 31 3b 0a 0a 09 69 66 |.verbose|=1;...if|
|000012b0| 20 28 20 65 78 69 73 74 | 73 28 22 2e 22 2c 20 22 | ( exist|s(".", "|
|000012c0| 4d 61 6b 65 66 69 6c 65 | 22 29 20 29 0a 09 7b 0a |Makefile|") )..{.|
|000012d0| 09 09 66 70 72 69 6e 74 | 66 28 73 74 64 65 72 72 |..fprint|f(stderr|
|000012e0| 2c 20 22 4d 61 6b 65 66 | 69 6c 65 20 61 6c 72 65 |, "Makef|ile alre|
|000012f0| 61 64 79 20 65 78 69 73 | 74 73 2e 20 20 43 6f 6e |ady exis|ts. Con|
|00001300| 74 69 6e 75 65 3f 20 20 | 5b 79 2f 6e 5d 20 22 29 |tinue? |[y/n] ")|
|00001310| 3b 0a 09 09 66 67 65 74 | 73 28 6c 69 6e 65 2c 20 |;...fget|s(line, |
|00001320| 42 55 46 53 49 5a 2d 31 | 2c 20 73 74 64 69 6e 29 |BUFSIZ-1|, stdin)|
|00001330| 3b 0a 09 09 69 66 20 28 | 20 6c 69 6e 65 5b 30 5d |;...if (| line[0]|
|00001340| 20 3d 3d 20 27 79 27 20 | 29 0a 09 09 09 70 72 69 | == 'y' |)....pri|
|00001350| 6e 74 66 28 22 43 6f 6e | 74 69 6e 75 69 6e 67 2e |ntf("Con|tinuing.|
|00001360| 2e 2e 5c 6e 22 29 3b 0a | 09 09 65 6c 73 65 0a 09 |..\n");.|..else..|
|00001370| 09 7b 0a 09 09 09 70 72 | 69 6e 74 66 28 22 43 6f |.{....pr|intf("Co|
|00001380| 6e 66 69 67 75 72 61 74 | 69 6f 6e 20 61 62 6f 72 |nfigurat|ion abor|
|00001390| 74 65 64 2e 20 45 78 69 | 74 69 6e 67 2e 5c 6e 22 |ted. Exi|ting.\n"|
|000013a0| 29 3b 0a 09 09 09 65 78 | 69 74 28 30 29 3b 0a 09 |);....ex|it(0);..|
|000013b0| 09 7d 0a 09 7d 0a 0a 09 | 69 66 20 28 20 28 6d 61 |.}..}...|if ( (ma|
|000013c0| 6b 65 66 69 6c 65 3d 66 | 6f 70 65 6e 28 22 4d 61 |kefile=f|open("Ma|
|000013d0| 6b 65 66 69 6c 65 22 2c | 20 22 77 22 29 29 20 3d |kefile",| "w")) =|
|000013e0| 3d 20 4e 55 4c 4c 20 29 | 0a 09 7b 0a 09 09 70 65 |= NULL )|..{...pe|
|000013f0| 72 72 6f 72 28 22 43 61 | 6e 27 74 20 63 72 65 61 |rror("Ca|n't crea|
|00001400| 74 65 20 4d 61 6b 65 66 | 69 6c 65 22 29 3b 0a 09 |te Makef|ile");..|
|00001410| 09 70 72 69 6e 74 66 28 | 22 43 6f 6e 66 69 67 75 |.printf(|"Configu|
|00001420| 72 61 74 69 6f 6e 20 61 | 62 6f 72 74 65 64 2e 20 |ration a|borted. |
|00001430| 45 78 69 74 69 6e 67 2e | 5c 6e 22 29 3b 0a 09 09 |Exiting.|\n");...|
|00001440| 65 78 69 74 28 32 29 3b | 0a 09 7d 0a 0a 23 69 66 |exit(2);|..}..#if|
|00001450| 64 65 66 20 44 45 42 55 | 47 0a 09 73 74 72 63 70 |def DEBU|G..strcp|
|00001460| 79 28 63 66 6c 61 67 73 | 2c 20 22 2d 67 20 2d 44 |y(cflags|, "-g -D|
|00001470| 44 45 42 55 47 22 29 3b | 0a 23 65 6c 73 65 0a 09 |DEBUG");|.#else..|
|00001480| 63 66 6c 61 67 73 5b 30 | 5d 3d 27 5c 30 27 3b 0a |cflags[0|]='\0';.|
|00001490| 23 65 6e 64 69 66 0a 09 | 6c 64 66 6c 61 67 73 5b |#endif..|ldflags[|
|000014a0| 30 5d 3d 27 5c 30 27 3b | 0a 0a 23 64 65 66 69 6e |0]='\0';|..#defin|
|000014b0| 65 20 49 4e 43 4c 55 44 | 45 20 22 2f 75 73 72 2f |e INCLUD|E "/usr/|
|000014c0| 69 6e 63 6c 75 64 65 2f | 22 0a 23 69 66 64 65 66 |include/|".#ifdef|
|000014d0| 20 6c 69 6e 75 78 0a 09 | 70 72 69 6e 74 66 28 22 | linux..|printf("|
|000014e0| 41 68 61 21 20 20 59 6f | 75 20 61 72 65 20 72 75 |Aha! Yo|u are ru|
|000014f0| 6e 6e 69 6e 67 20 4c 69 | 6e 75 78 21 5c 6e 22 29 |nning Li|nux!\n")|
|00001500| 3b 0a 09 70 72 69 6e 74 | 66 28 22 5c 74 43 6f 6e |;..print|f("\tCon|
|00001510| 67 72 61 74 75 6c 61 74 | 69 6f 6e 73 20 6f 6e 20 |gratulat|ions on |
|00001520| 74 68 65 20 63 68 6f 69 | 63 65 20 6f 66 20 61 20 |the choi|ce of a |
|00001530| 47 4e 55 20 67 65 6e 65 | 72 61 74 69 6f 6e 2e 5c |GNU gene|ration.\|
|00001540| 6e 22 29 3b 0a 0a 09 73 | 74 72 63 61 74 28 63 66 |n");...s|trcat(cf|
|00001550| 6c 61 67 73 2c 20 22 20 | 2d 4f 32 22 29 3b 0a 23 |lags, " |-O2");.#|
|00001560| 65 6c 73 65 0a 0a 23 69 | 66 64 65 66 20 4e 65 58 |else..#i|fdef NeX|
|00001570| 54 0a 09 70 72 69 6e 74 | 66 28 22 4e 65 58 54 53 |T..print|f("NeXTS|
|00001580| 74 65 70 21 20 20 49 27 | 6d 20 61 73 73 75 6d 69 |tep! I'|m assumi|
|00001590| 6e 67 20 33 2e 30 20 6f | 72 20 67 72 65 61 74 65 |ng 3.0 o|r greate|
|000015a0| 72 2e 2e 2e 5c 6e 22 29 | 3b 0a 09 73 74 72 63 61 |r...\n")|;..strca|
|000015b0| 74 28 63 66 6c 61 67 73 | 2c 20 22 20 2d 4f 32 22 |t(cflags|, " -O2"|
|000015c0| 29 3b 0a 23 75 6e 64 65 | 66 20 49 4e 43 4c 55 44 |);.#unde|f INCLUD|
|000015d0| 45 0a 23 64 65 66 69 6e | 65 20 49 4e 43 4c 55 44 |E.#defin|e INCLUD|
|000015e0| 45 20 22 2f 75 73 72 2f | 69 6e 63 6c 75 64 65 2f |E "/usr/|include/|
|000015f0| 62 73 64 2f 22 0a 23 65 | 6c 73 65 0a 09 2f 2a 20 |bsd/".#e|lse../* |
|00001600| 43 68 65 63 6b 20 66 6f | 72 20 48 50 2d 55 58 20 |Check fo|r HP-UX |
|00001610| 2a 2f 0a 09 69 66 20 28 | 20 65 78 69 73 74 73 28 |*/..if (| exists(|
|00001620| 22 2f 22 2c 20 22 68 70 | 2d 75 78 22 29 20 29 20 |"/", "hp|-ux") ) |
|00001630| 7b 0a 09 09 56 45 52 42 | 4f 53 45 5f 50 52 49 4e |{...VERB|OSE_PRIN|
|00001640| 54 28 22 5c 74 49 20 73 | 65 65 20 79 6f 75 20 61 |T("\tI s|ee you a|
|00001650| 72 65 20 72 75 6e 6e 69 | 6e 67 20 48 50 2d 55 58 |re runni|ng HP-UX|
|00001660| 2e 5c 6e 22 29 3b 0a 09 | 09 73 74 72 63 61 74 28 |.\n");..|.strcat(|
|00001670| 63 66 6c 61 67 73 2c 20 | 22 20 2d 44 48 50 5f 55 |cflags, |" -DHP_U|
|00001680| 58 22 29 3b 0a 09 7d 20 | 65 6c 73 65 20 69 66 20 |X");..} |else if |
|00001690| 28 20 65 78 69 73 74 73 | 28 22 2f 75 73 72 2f 6c |( exists|("/usr/l|
|000016a0| 69 62 22 2c 20 22 6c 69 | 62 73 6f 63 6b 65 74 2e |ib", "li|bsocket.|
|000016b0| 61 22 29 20 29 20 7b 20 | 20 20 2f 2a 20 53 6f 6c |a") ) { | /* Sol|
|000016c0| 61 72 69 73 20 32 2e 31 | 20 2a 2f 0a 09 09 73 74 |aris 2.1| */...st|
|000016d0| 72 63 61 74 28 6c 64 66 | 6c 61 67 73 2c 20 22 20 |rcat(ldf|lags, " |
|000016e0| 2d 6c 73 6f 63 6b 65 74 | 22 29 3b 0a 09 09 73 74 |-lsocket|");...st|
|000016f0| 72 63 61 74 28 63 66 6c | 61 67 73 2c 20 22 20 2d |rcat(cfl|ags, " -|
|00001700| 67 20 2d 44 53 4f 4c 41 | 52 49 53 22 29 3b 0a 09 |g -DSOLA|RIS");..|
|00001710| 09 73 6f 6c 61 72 69 73 | 3d 31 3b 0a 09 09 56 45 |.solaris|=1;...VE|
|00001720| 52 42 4f 53 45 5f 50 52 | 49 4e 54 28 22 5c 74 49 |RBOSE_PR|INT("\tI|
|00001730| 20 73 65 65 20 79 6f 75 | 20 61 72 65 20 72 75 6e | see you| are run|
|00001740| 6e 69 6e 67 20 53 6f 6c | 61 72 69 73 2e 5c 6e 22 |ning Sol|aris.\n"|
|00001750| 29 3b 0a 09 7d 0a 09 65 | 6c 73 65 0a 09 09 73 74 |);..}..e|lse...st|
|00001760| 72 63 61 74 28 63 66 6c | 61 67 73 2c 20 22 20 2d |rcat(cfl|ags, " -|
|00001770| 4f 22 29 3b 0a 0a 09 2f | 2a 20 43 68 65 63 6b 20 |O");.../|* Check |
|00001780| 66 6f 72 20 49 52 49 58 | 20 2a 2f 0a 09 69 66 20 |for IRIX| */..if |
|00001790| 28 20 67 72 65 70 28 22 | 2f 75 73 72 2f 69 6e 63 |( grep("|/usr/inc|
|000017a0| 6c 75 64 65 22 2c 20 22 | 75 6e 69 73 74 64 2e 68 |lude", "|unistd.h|
|000017b0| 22 2c 20 22 5f 67 65 74 | 70 74 79 22 29 20 29 0a |", "_get|pty") ).|
|000017c0| 09 7b 0a 09 09 73 74 72 | 63 61 74 28 63 66 6c 61 |.{...str|cat(cfla|
|000017d0| 67 73 2c 20 22 20 2d 44 | 49 52 49 58 22 29 3b 0a |gs, " -D|IRIX");.|
|000017e0| 09 09 69 72 69 78 3d 31 | 3b 0a 09 09 56 45 52 42 |..irix=1|;...VERB|
|000017f0| 4f 53 45 5f 50 52 49 4e | 54 28 22 5c 74 49 20 73 |OSE_PRIN|T("\tI s|
|00001800| 65 65 20 79 6f 75 20 61 | 72 65 20 72 75 6e 6e 69 |ee you a|re runni|
|00001810| 6e 67 20 49 52 49 58 2e | 5c 6e 22 29 3b 0a 09 7d |ng IRIX.|\n");..}|
|00001820| 0a 23 65 6e 64 69 66 20 | 2f 2a 20 4e 65 58 54 20 |.#endif |/* NeXT |
|00001830| 2a 2f 0a 23 65 6e 64 69 | 66 20 2f 2a 20 6c 69 6e |*/.#endi|f /* lin|
|00001840| 75 78 20 2a 2f 0a 0a 09 | 2f 2a 20 43 68 65 63 6b |ux */...|/* Check|
|00001850| 20 66 6f 72 20 74 68 65 | 20 74 65 72 6d 63 61 70 | for the| termcap|
|00001860| 20 6c 69 62 72 61 72 79 | 20 2a 2f 0a 09 69 66 20 | library| */..if |
|00001870| 28 20 65 78 69 73 74 73 | 28 22 2f 75 73 72 2f 6c |( exists|("/usr/l|
|00001880| 69 62 22 2c 20 22 6c 69 | 62 74 65 72 6d 63 61 70 |ib", "li|btermcap|
|00001890| 2e 61 22 29 20 29 20 7b | 0a 09 09 73 74 72 63 61 |.a") ) {|...strca|
|000018a0| 74 28 63 66 6c 61 67 73 | 2c 20 22 20 2d 44 54 45 |t(cflags|, " -DTE|
|000018b0| 52 4d 43 41 50 22 29 3b | 0a 09 09 73 74 72 63 61 |RMCAP");|...strca|
|000018c0| 74 28 6c 64 66 6c 61 67 | 73 2c 20 22 20 2d 6c 74 |t(ldflag|s, " -lt|
|000018d0| 65 72 6d 63 61 70 22 29 | 3b 0a 09 09 56 45 52 42 |ermcap")|;...VERB|
|000018e0| 4f 53 45 5f 50 52 49 4e | 54 28 22 5c 74 55 73 69 |OSE_PRIN|T("\tUsi|
|000018f0| 6e 67 20 74 68 65 20 74 | 65 72 6d 63 61 70 20 6c |ng the t|ermcap l|
|00001900| 69 62 72 61 72 79 20 66 | 6f 72 20 74 65 72 6d 69 |ibrary f|or termi|
|00001910| 6e 61 6c 20 73 75 70 70 | 6f 72 74 2e 5c 6e 22 29 |nal supp|ort.\n")|
|00001920| 3b 0a 09 7d 0a 0a 09 2f | 2a 20 43 68 65 63 6b 20 |;..}.../|* Check |
|00001930| 66 6f 72 20 74 68 65 20 | 75 74 5f 68 6f 73 74 20 |for the |ut_host |
|00001940| 66 69 65 6c 64 20 69 6e | 20 74 68 65 20 75 74 6d |field in| the utm|
|00001950| 70 20 66 69 6c 65 20 2a | 2f 0a 09 69 66 20 28 20 |p file *|/..if ( |
|00001960| 67 72 65 70 28 49 4e 43 | 4c 55 44 45 2c 20 22 75 |grep(INC|LUDE, "u|
|00001970| 74 6d 70 2e 68 22 2c 20 | 22 75 74 5f 68 6f 73 74 |tmp.h", |"ut_host|
|00001980| 22 29 20 29 20 7b 0a 09 | 09 73 74 72 63 61 74 28 |") ) {..|.strcat(|
|00001990| 63 66 6c 61 67 73 2c 20 | 22 20 2d 44 48 41 56 45 |cflags, |" -DHAVE|
|000019a0| 5f 55 54 48 4f 53 54 22 | 29 3b 0a 09 09 56 45 52 |_UTHOST"|);...VER|
|000019b0| 42 4f 53 45 5f 50 52 49 | 4e 54 28 22 5c 74 59 6f |BOSE_PRI|NT("\tYo|
|000019c0| 75 72 20 75 74 6d 70 20 | 66 69 6c 65 20 75 73 65 |ur utmp |file use|
|000019d0| 73 20 74 68 65 20 68 6f | 73 74 20 66 69 65 6c 64 |s the ho|st field|
|000019e0| 2e 5c 6e 22 29 3b 0a 09 | 7d 0a 0a 09 2f 2a 20 43 |.\n");..|}.../* C|
|000019f0| 68 65 63 6b 20 66 6f 72 | 20 74 65 72 6d 69 6f 2e |heck for| termio.|
|00001a00| 68 20 2a 2f 0a 09 69 66 | 20 28 20 65 78 69 73 74 |h */..if| ( exist|
|00001a10| 73 28 49 4e 43 4c 55 44 | 45 2c 20 22 74 65 72 6d |s(INCLUD|E, "term|
|00001a20| 69 6f 2e 68 22 29 20 29 | 20 7b 0a 09 09 73 74 72 |io.h") )| {...str|
|00001a30| 63 61 74 28 63 66 6c 61 | 67 73 2c 20 22 20 2d 44 |cat(cfla|gs, " -D|
|00001a40| 48 41 56 45 5f 54 45 52 | 4d 49 4f 5f 48 22 29 3b |HAVE_TER|MIO_H");|
|00001a50| 0a 09 09 56 45 52 42 4f | 53 45 5f 50 52 49 4e 54 |...VERBO|SE_PRINT|
|00001a60| 28 22 5c 74 49 20 77 69 | 6c 6c 20 75 73 65 20 74 |("\tI wi|ll use t|
|00001a70| 65 72 6d 69 6f 20 74 74 | 79 20 73 74 72 75 63 74 |ermio tt|y struct|
|00001a80| 75 72 65 73 2e 5c 6e 22 | 29 3b 0a 09 7d 20 65 6c |ures.\n"|);..} el|
|00001a90| 73 65 20 0a 09 09 56 45 | 52 42 4f 53 45 5f 50 52 |se ...VE|RBOSE_PR|
|00001aa0| 49 4e 54 28 22 5c 74 49 | 20 77 69 6c 6c 20 75 73 |INT("\tI| will us|
|00001ab0| 65 20 73 67 74 74 79 62 | 20 74 74 79 20 73 74 72 |e sgttyb| tty str|
|00001ac0| 75 63 74 75 72 65 73 2e | 5c 6e 22 29 3b 0a 0a 09 |uctures.|\n");...|
|00001ad0| 2f 2a 20 43 68 65 63 6b | 20 66 6f 72 20 75 6e 69 |/* Check| for uni|
|00001ae0| 73 74 64 2e 68 20 2a 2f | 0a 09 69 66 20 28 20 65 |std.h */|..if ( e|
|00001af0| 78 69 73 74 73 28 49 4e | 43 4c 55 44 45 2c 20 22 |xists(IN|CLUDE, "|
|00001b00| 75 6e 69 73 74 64 2e 68 | 22 29 20 29 0a 09 09 73 |unistd.h|") )...s|
|00001b10| 74 72 63 61 74 28 63 66 | 6c 61 67 73 2c 20 22 20 |trcat(cf|lags, " |
|00001b20| 2d 44 48 41 56 45 5f 55 | 4e 49 53 54 44 5f 48 22 |-DHAVE_U|NISTD_H"|
|00001b30| 29 3b 0a 0a 09 2f 2a 20 | 43 68 65 63 6b 20 66 6f |);.../* |Check fo|
|00001b40| 72 20 42 53 44 20 74 74 | 79 20 63 6f 6d 70 61 74 |r BSD tt|y compat|
|00001b50| 69 62 69 6c 69 74 79 2e | 20 28 48 50 2d 55 58 29 |ibility.| (HP-UX)|
|00001b60| 20 2a 2f 0a 09 2f 2a 20 | 43 68 65 63 6b 20 66 6f | */../* |Check fo|
|00001b70| 72 20 42 53 44 20 74 74 | 79 20 63 6f 6d 70 61 74 |r BSD tt|y compat|
|00001b80| 69 62 69 6c 69 74 79 2e | 20 28 48 50 2d 55 58 29 |ibility.| (HP-UX)|
|00001b90| 20 2a 2f 0a 09 69 66 20 | 28 20 65 78 69 73 74 73 | */..if |( exists|
|00001ba0| 28 49 4e 43 4c 55 44 45 | 2c 20 22 73 79 73 2f 62 |(INCLUDE|, "sys/b|
|00001bb0| 73 64 74 74 79 2e 68 22 | 29 20 29 20 7b 0a 09 09 |sdtty.h"|) ) {...|
|00001bc0| 73 74 72 63 61 74 28 63 | 66 6c 61 67 73 2c 20 22 |strcat(c|flags, "|
|00001bd0| 20 2d 44 48 41 56 45 5f | 42 53 44 54 54 59 5f 48 | -DHAVE_|BSDTTY_H|
|00001be0| 22 29 3b 0a 09 09 56 45 | 52 42 4f 53 45 5f 50 52 |");...VE|RBOSE_PR|
|00001bf0| 49 4e 54 28 22 5c 74 49 | 20 73 65 65 20 79 6f 75 |INT("\tI| see you|
|00001c00| 20 68 61 76 65 20 42 53 | 44 20 74 74 79 20 73 75 | have BS|D tty su|
|00001c10| 70 70 6f 72 74 2e 5c 6e | 22 29 3b 0a 09 7d 0a 0a |pport.\n|");..}..|
|00001c20| 09 2f 2a 20 43 68 65 63 | 6b 20 66 6f 72 20 69 6f |./* Chec|k for io|
|00001c30| 63 74 6c 20 63 6f 6d 70 | 61 74 69 62 69 6c 69 74 |ctl comp|atibilit|
|00001c40| 79 2e 20 20 28 46 72 65 | 65 42 53 44 29 20 2a 2f |y. (Fre|eBSD) */|
|00001c50| 0a 09 69 66 20 28 20 65 | 78 69 73 74 73 28 49 4e |..if ( e|xists(IN|
|00001c60| 43 4c 55 44 45 2c 20 22 | 73 79 73 2f 69 6f 63 74 |CLUDE, "|sys/ioct|
|00001c70| 6c 5f 63 6f 6d 70 61 74 | 2e 68 22 29 20 29 20 7b |l_compat|.h") ) {|
|00001c80| 0a 09 09 73 74 72 63 61 | 74 28 63 66 6c 61 67 73 |...strca|t(cflags|
|00001c90| 2c 20 22 20 2d 44 4e 45 | 45 44 5f 43 4f 4d 50 41 |, " -DNE|ED_COMPA|
|00001ca0| 54 5f 48 22 29 3b 0a 09 | 09 56 45 52 42 4f 53 45 |T_H");..|.VERBOSE|
|00001cb0| 5f 50 52 49 4e 54 28 0a | 09 09 09 22 5c 74 49 20 |_PRINT(.|..."\tI |
|00001cc0| 77 69 6c 6c 20 75 73 65 | 20 79 6f 75 72 20 69 6f |will use| your io|
|00001cd0| 63 74 6c 20 63 6f 6d 70 | 61 74 69 62 69 6c 69 74 |ctl comp|atibilit|
|00001ce0| 79 20 68 65 61 64 65 72 | 2e 5c 6e 22 29 3b 0a 09 |y header|.\n");..|
|00001cf0| 7d 0a 0a 09 2f 2a 20 43 | 68 65 63 6b 20 66 6f 72 |}.../* C|heck for|
|00001d00| 20 42 53 44 20 73 6f 63 | 6b 65 74 20 6c 69 62 72 | BSD soc|ket libr|
|00001d10| 61 72 79 20 68 65 61 64 | 65 72 20 28 41 54 26 54 |ary head|er (AT&T|
|00001d20| 29 20 2a 2f 0a 09 69 66 | 20 28 20 65 78 69 73 74 |) */..if| ( exist|
|00001d30| 73 28 49 4e 43 4c 55 44 | 45 2c 20 22 73 79 73 2f |s(INCLUD|E, "sys/|
|00001d40| 69 6e 65 74 2e 68 22 29 | 20 29 20 7b 0a 09 09 73 |inet.h")| ) {...s|
|00001d50| 74 72 63 61 74 28 63 66 | 6c 61 67 73 2c 20 22 20 |trcat(cf|lags, " |
|00001d60| 2d 44 4e 45 45 44 5f 49 | 4e 45 54 5f 48 22 29 3b |-DNEED_I|NET_H");|
|00001d70| 0a 09 09 56 45 52 42 4f | 53 45 5f 50 52 49 4e 54 |...VERBO|SE_PRINT|
|00001d80| 28 22 5c 74 49 20 77 69 | 6c 6c 20 75 73 65 20 79 |("\tI wi|ll use y|
|00001d90| 6f 75 72 20 69 6e 65 74 | 20 63 6f 6d 70 61 74 69 |our inet| compati|
|00001da0| 62 69 6c 69 74 79 20 68 | 65 61 64 65 72 2e 5c 6e |bility h|eader.\n|
|00001db0| 22 29 3b 0a 09 7d 0a 0a | 09 2f 2a 20 43 68 65 63 |");..}..|./* Chec|
|00001dc0| 6b 20 66 6f 72 20 42 53 | 44 20 73 6f 63 6b 65 74 |k for BS|D socket|
|00001dd0| 20 6c 69 62 72 61 72 79 | 20 68 65 61 64 65 72 20 | library| header |
|00001de0| 28 41 49 58 29 20 2a 2f | 0a 09 69 66 20 28 20 65 |(AIX) */|..if ( e|
|00001df0| 78 69 73 74 73 28 49 4e | 43 4c 55 44 45 2c 20 22 |xists(IN|CLUDE, "|
|00001e00| 73 79 73 2f 73 65 6c 65 | 63 74 2e 68 22 29 20 29 |sys/sele|ct.h") )|
|00001e10| 20 7b 0a 09 09 73 74 72 | 63 61 74 28 63 66 6c 61 | {...str|cat(cfla|
|00001e20| 67 73 2c 20 22 20 2d 44 | 4e 45 45 44 5f 53 45 4c |gs, " -D|NEED_SEL|
|00001e30| 45 43 54 5f 48 22 29 3b | 0a 09 09 56 45 52 42 4f |ECT_H");|...VERBO|
|00001e40| 53 45 5f 50 52 49 4e 54 | 28 22 5c 74 49 20 77 69 |SE_PRINT|("\tI wi|
|00001e50| 6c 6c 20 75 73 65 20 79 | 6f 75 72 20 73 6f 63 6b |ll use y|our sock|
|00001e60| 65 74 73 20 64 65 66 69 | 6e 69 74 69 6f 6e 20 68 |ets defi|nition h|
|00001e70| 65 61 64 65 72 2e 5c 6e | 22 29 3b 0a 09 7d 0a 0a |eader.\n|");..}..|
|00001e80| 09 2f 2a 20 43 68 65 63 | 6b 20 66 6f 72 20 77 61 |./* Chec|k for wa|
|00001e90| 69 74 34 28 29 20 28 54 | 68 69 73 20 61 6c 77 61 |it4() (T|his alwa|
|00001ea0| 79 73 20 73 65 65 6d 73 | 20 74 6f 20 62 65 20 74 |ys seems| to be t|
|00001eb0| 72 75 65 2e 29 20 2a 2f | 0a 09 69 66 20 28 20 67 |rue.) */|..if ( g|
|00001ec0| 72 65 70 28 49 4e 43 4c | 55 44 45 2c 20 22 73 79 |rep(INCL|UDE, "sy|
|00001ed0| 73 2f 77 61 69 74 2e 68 | 22 2c 20 22 77 61 69 74 |s/wait.h|", "wait|
|00001ee0| 34 22 29 20 29 20 7b 0a | 09 09 73 74 72 63 61 74 |4") ) {.|..strcat|
|00001ef0| 28 63 66 6c 61 67 73 2c | 20 22 20 2d 44 48 41 56 |(cflags,| " -DHAV|
|00001f00| 45 5f 57 41 49 54 34 22 | 29 3b 0a 09 09 56 45 52 |E_WAIT4"|);...VER|
|00001f10| 42 4f 53 45 5f 50 52 49 | 4e 54 28 22 5c 74 49 20 |BOSE_PRI|NT("\tI |
|00001f20| 77 69 6c 6c 20 75 73 65 | 20 77 61 69 74 34 28 29 |will use| wait4()|
|00001f30| 20 69 6e 73 74 65 61 64 | 20 6f 66 20 77 61 69 74 | instead| of wait|
|00001f40| 70 69 64 28 29 2e 5c 6e | 22 29 3b 0a 09 7d 0a 0a |pid().\n|");..}..|
|00001f50| 09 69 66 20 28 20 65 78 | 69 73 74 73 28 22 2f 75 |.if ( ex|ists("/u|
|00001f60| 73 72 2f 6c 69 62 22 2c | 20 22 6c 69 62 6e 65 74 |sr/lib",| "libnet|
|00001f70| 2e 61 22 29 20 29 09 2f | 2a 20 53 6f 63 6b 65 74 |.a") )./|* Socket|
|00001f80| 20 72 6f 75 74 69 6e 65 | 73 20 2a 2f 0a 09 09 73 | routine|s */...s|
|00001f90| 74 72 63 61 74 28 6c 64 | 66 6c 61 67 73 2c 20 22 |trcat(ld|flags, "|
|00001fa0| 20 2d 6c 6e 65 74 22 29 | 3b 0a 09 69 66 20 28 20 | -lnet")|;..if ( |
|00001fb0| 65 78 69 73 74 73 28 22 | 2f 75 73 72 2f 6c 69 62 |exists("|/usr/lib|
|00001fc0| 22 2c 20 22 6c 69 62 6e | 73 6c 2e 61 22 29 20 29 |", "libn|sl.a") )|
|00001fd0| 09 2f 2a 20 41 54 26 54 | 20 73 6f 63 6b 65 74 20 |./* AT&T| socket |
|00001fe0| 6c 69 62 72 61 72 79 20 | 2a 2f 0a 09 09 73 74 72 |library |*/...str|
|00001ff0| 63 61 74 28 6c 64 66 6c | 61 67 73 2c 20 22 20 2d |cat(ldfl|ags, " -|
|00002000| 6c 6e 73 6c 22 29 3b 0a | 09 69 66 20 28 20 65 78 |lnsl");.|.if ( ex|
|00002010| 69 73 74 73 28 22 2f 75 | 73 72 2f 6c 69 62 22 2c |ists("/u|sr/lib",|
|00002020| 20 22 6c 69 62 6e 73 6c | 5f 73 2e 61 22 29 20 29 | "libnsl|_s.a") )|
|00002030| 09 2f 2a 20 41 54 26 54 | 20 73 6f 63 6b 65 74 20 |./* AT&T| socket |
|00002040| 6c 69 62 72 61 72 79 20 | 2a 2f 0a 09 09 73 74 72 |library |*/...str|
|00002050| 63 61 74 28 6c 64 66 6c | 61 67 73 2c 20 22 20 2d |cat(ldfl|ags, " -|
|00002060| 6c 6e 73 6c 5f 73 22 29 | 3b 0a 09 69 66 20 28 20 |lnsl_s")|;..if ( |
|00002070| 65 78 69 73 74 73 28 22 | 2f 75 73 72 2f 6c 69 62 |exists("|/usr/lib|
|00002080| 22 2c 20 22 6c 69 62 73 | 75 6e 2e 61 22 29 20 29 |", "libs|un.a") )|
|00002090| 09 2f 2a 20 49 52 49 58 | 20 79 70 20 72 6f 75 74 |./* IRIX| yp rout|
|000020a0| 69 6e 65 73 20 2a 2f 0a | 09 09 73 74 72 63 61 74 |ines */.|..strcat|
|000020b0| 28 6c 64 66 6c 61 67 73 | 2c 20 22 20 2d 6c 73 75 |(ldflags|, " -lsu|
|000020c0| 6e 22 29 3b 0a 0a 09 2f | 2a 20 54 65 6c 6c 20 74 |n");.../|* Tell t|
|000020d0| 68 65 20 75 73 65 72 20 | 77 68 61 74 20 6b 69 6e |he user |what kin|
|000020e0| 64 20 6f 66 20 63 6f 6e | 66 69 67 75 72 61 74 69 |d of con|figurati|
|000020f0| 6f 6e 20 74 6f 20 64 6f | 20 2a 2f 0a 09 69 66 20 |on to do| */..if |
|00002100| 28 20 28 61 63 63 65 73 | 73 28 22 2f 65 74 63 2f |( (acces|s("/etc/|
|00002110| 75 74 6d 70 22 2c 20 28 | 52 5f 4f 4b 7c 57 5f 4f |utmp", (|R_OK|W_O|
|00002120| 4b 29 29 20 3d 3d 20 30 | 29 20 26 26 20 67 65 74 |K)) == 0|) && get|
|00002130| 75 69 64 28 29 20 29 0a | 09 09 77 72 69 74 65 5f |uid() ).|..write_|
|00002140| 75 74 6d 70 3d 31 3b 0a | 09 65 6c 73 65 0a 09 09 |utmp=1;.|.else...|
|00002150| 77 72 69 74 65 5f 75 74 | 6d 70 3d 30 3b 0a 0a 09 |write_ut|mp=0;...|
|00002160| 56 45 52 42 4f 53 45 5f | 50 52 49 4e 54 28 22 5c |VERBOSE_|PRINT("\|
|00002170| 6e 22 29 3b 0a 09 69 66 | 20 28 20 73 6f 6c 61 72 |n");..if| ( solar|
|00002180| 69 73 20 7c 7c 20 69 72 | 69 78 20 29 20 7b 0a 09 |is || ir|ix ) {..|
|00002190| 09 69 66 20 28 20 77 72 | 69 74 65 5f 75 74 6d 70 |.if ( wr|ite_utmp|
|000021a0| 20 29 20 7b 0a 09 09 09 | 56 45 52 42 4f 53 45 5f | ) {....|VERBOSE_|
|000021b0| 50 52 49 4e 54 28 0a 09 | 22 54 68 69 73 20 70 72 |PRINT(..|"This pr|
|000021c0| 6f 67 72 61 6d 20 64 6f | 65 73 6e 27 74 20 6e 65 |ogram do|esn't ne|
|000021d0| 65 64 20 74 6f 20 62 65 | 20 69 6e 73 74 61 6c 6c |ed to be| install|
|000021e0| 65 64 20 73 65 74 2d 75 | 69 64 20 72 6f 6f 74 2e |ed set-u|id root.|
|000021f0| 5c 6e 22 29 3b 0a 09 09 | 09 56 45 52 42 4f 53 45 |\n");...|.VERBOSE|
|00002200| 5f 50 52 49 4e 54 28 0a | 09 22 5c 6e 54 68 69 73 |_PRINT(.|."\nThis|
|00002210| 20 70 72 6f 67 72 61 6d | 20 77 69 6c 6c 20 70 75 | program| will pu|
|00002220| 74 20 65 6e 74 72 69 65 | 73 20 66 6f 72 20 69 74 |t entrie|s for it|
|00002230| 73 20 77 69 6e 64 6f 77 | 73 20 69 6e 20 2f 65 74 |s window|s in /et|
|00002240| 63 2f 75 74 6d 70 2e 5c | 6e 22 29 3b 0a 09 09 7d |c/utmp.\|n");...}|
|00002250| 20 65 6c 73 65 20 7b 0a | 09 09 09 56 45 52 42 4f | else {.|...VERBO|
|00002260| 53 45 5f 50 52 49 4e 54 | 28 0a 09 22 49 66 20 69 |SE_PRINT|(.."If i|
|00002270| 6e 73 74 61 6c 6c 65 64 | 20 73 65 74 2d 75 69 64 |nstalled| set-uid|
|00002280| 20 72 6f 6f 74 2c 20 74 | 68 69 73 20 70 72 6f 67 | root, t|his prog|
|00002290| 72 61 6d 20 77 69 6c 6c | 20 70 75 74 20 65 6e 74 |ram will| put ent|
|000022a0| 72 69 65 73 20 66 6f 72 | 20 69 74 73 20 77 69 6e |ries for| its win|
|000022b0| 64 6f 77 73 5c 6e 69 6e | 20 2f 65 74 63 2f 75 74 |dows\nin| /etc/ut|
|000022c0| 6d 70 2e 5c 6e 22 29 3b | 0a 09 09 7d 0a 09 7d 20 |mp.\n");|...}..} |
|000022d0| 65 6c 73 65 20 69 66 20 | 28 20 77 72 69 74 65 5f |else if |( write_|
|000022e0| 75 74 6d 70 20 29 20 7b | 0a 09 09 56 45 52 42 4f |utmp ) {|...VERBO|
|000022f0| 53 45 5f 50 52 49 4e 54 | 28 0a 09 22 54 68 69 73 |SE_PRINT|(.."This|
|00002300| 20 70 72 6f 67 72 61 6d | 20 77 69 6c 6c 20 70 75 | program| will pu|
|00002310| 74 20 65 6e 74 72 69 65 | 73 20 66 6f 72 20 69 74 |t entrie|s for it|
|00002320| 73 20 77 69 6e 64 6f 77 | 73 20 69 6e 20 2f 65 74 |s window|s in /et|
|00002330| 63 2f 75 74 6d 70 2e 5c | 6e 22 29 3b 0a 09 09 56 |c/utmp.\|n");...V|
|00002340| 45 52 42 4f 53 45 5f 50 | 52 49 4e 54 28 0a 09 22 |ERBOSE_P|RINT(.."|
|00002350| 5c 6e 49 66 20 69 6e 73 | 74 61 6c 6c 65 64 20 73 |\nIf ins|talled s|
|00002360| 65 74 2d 75 69 64 20 72 | 6f 6f 74 2c 20 74 68 69 |et-uid r|oot, thi|
|00002370| 73 20 70 72 6f 67 72 61 | 6d 20 77 69 6c 6c 20 63 |s progra|m will c|
|00002380| 68 61 6e 67 65 20 6f 77 | 6e 65 72 73 68 69 70 20 |hange ow|nership |
|00002390| 6f 66 20 74 68 65 5c 6e | 22 29 3b 0a 09 09 56 45 |of the\n|");...VE|
|000023a0| 52 42 4f 53 45 5f 50 52 | 49 4e 54 28 0a 09 22 74 |RBOSE_PR|INT(.."t|
|000023b0| 74 79 73 20 61 63 71 75 | 69 72 65 64 20 74 6f 20 |tys acqu|ired to |
|000023c0| 74 68 65 20 75 73 65 72 | 20 72 75 6e 6e 69 6e 67 |the user| running|
|000023d0| 20 74 68 69 73 20 70 72 | 6f 67 72 61 6d 2e 5c 6e | this pr|ogram.\n|
|000023e0| 22 29 3b 0a 09 7d 20 65 | 6c 73 65 20 7b 0a 09 09 |");..} e|lse {...|
|000023f0| 56 45 52 42 4f 53 45 5f | 50 52 49 4e 54 28 0a 09 |VERBOSE_|PRINT(..|
|00002400| 22 49 66 20 69 6e 73 74 | 61 6c 6c 65 64 20 73 65 |"If inst|alled se|
|00002410| 74 2d 75 69 64 20 72 6f | 6f 74 2c 20 74 68 69 73 |t-uid ro|ot, this|
|00002420| 20 70 72 6f 67 72 61 6d | 20 77 69 6c 6c 20 70 75 | program| will pu|
|00002430| 74 20 65 6e 74 72 69 65 | 73 20 66 6f 72 20 69 74 |t entrie|s for it|
|00002440| 73 20 77 69 6e 64 6f 77 | 73 5c 6e 22 29 3b 0a 09 |s window|s\n");..|
|00002450| 09 56 45 52 42 4f 53 45 | 5f 50 52 49 4e 54 28 0a |.VERBOSE|_PRINT(.|
|00002460| 09 22 69 6e 20 2f 65 74 | 63 2f 75 74 6d 70 2c 20 |."in /et|c/utmp, |
|00002470| 61 6e 64 20 77 69 6c 6c | 20 61 6c 73 6f 20 63 68 |and will| also ch|
|00002480| 61 6e 67 65 20 6f 77 6e | 65 72 73 68 69 70 20 6f |ange own|ership o|
|00002490| 66 20 74 68 65 20 74 74 | 79 73 20 69 74 20 61 63 |f the tt|ys it ac|
|000024a0| 71 75 69 72 65 73 20 74 | 6f 20 74 68 65 5c 6e 22 |quires t|o the\n"|
|000024b0| 29 3b 0a 09 09 56 45 52 | 42 4f 53 45 5f 50 52 49 |);...VER|BOSE_PRI|
|000024c0| 4e 54 28 0a 09 22 75 73 | 65 72 20 72 75 6e 6e 69 |NT(.."us|er runni|
|000024d0| 6e 67 20 74 68 69 73 20 | 70 72 6f 67 72 61 6d 2e |ng this |program.|
|000024e0| 5c 6e 22 29 3b 0a 09 7d | 0a 09 56 45 52 42 4f 53 |\n");..}|..VERBOS|
|000024f0| 45 5f 50 52 49 4e 54 28 | 22 5c 6e 22 29 3b 0a 0a |E_PRINT(|"\n");..|
|00002500| 0a 09 69 66 20 28 20 65 | 78 69 73 74 73 28 22 2f |..if ( e|xists("/|
|00002510| 62 69 6e 22 2c 20 22 63 | 73 68 22 29 20 29 0a 09 |bin", "c|sh") )..|
|00002520| 09 73 74 72 63 61 74 28 | 63 66 6c 61 67 73 2c 20 |.strcat(|cflags, |
|00002530| 22 20 2d 44 53 48 45 4c | 4c 3d 5c 5c 5c 22 2f 62 |" -DSHEL|L=\\\"/b|
|00002540| 69 6e 2f 63 73 68 5c 5c | 5c 22 22 29 3b 0a 09 65 |in/csh\\|\"");..e|
|00002550| 6c 73 65 0a 09 09 73 74 | 72 63 61 74 28 63 66 6c |lse...st|rcat(cfl|
|00002560| 61 67 73 2c 20 22 20 2d | 44 53 48 45 4c 4c 3d 5c |ags, " -|DSHELL=\|
|00002570| 5c 5c 22 2f 62 69 6e 2f | 73 68 5c 5c 5c 22 22 29 |\\"/bin/|sh\\\"")|
|00002580| 3b 0a 0a 09 66 70 72 69 | 6e 74 66 28 6d 61 6b 65 |;...fpri|ntf(make|
|00002590| 66 69 6c 65 2c 20 0a 22 | 23 20 54 68 69 73 20 4d |file, ."|# This M|
|000025a0| 61 6b 65 66 69 6c 65 20 | 68 61 73 20 62 65 65 6e |akefile |has been|
|000025b0| 20 67 65 6e 65 72 61 74 | 65 64 20 66 72 6f 6d 20 | generat|ed from |
|000025c0| 74 68 65 20 43 6f 6e 66 | 69 67 75 72 65 20 73 63 |the Conf|igure sc|
|000025d0| 72 69 70 74 2e 5c 6e 22 | 29 3b 0a 09 66 70 72 69 |ript.\n"|);..fpri|
|000025e0| 6e 74 66 28 6d 61 6b 65 | 66 69 6c 65 2c 20 0a 22 |ntf(make|file, ."|
|000025f0| 23 20 53 68 61 72 65 77 | 61 72 65 20 63 6f 70 79 |# Sharew|are copy|
|00002600| 72 69 67 68 74 20 31 39 | 39 33 2c 20 62 79 20 53 |right 19|93, by S|
|00002610| 61 6d 20 4c 61 6e 74 69 | 6e 67 61 5c 6e 5c 6e 22 |am Lanti|nga\n\n"|
|00002620| 29 3b 0a 23 69 66 64 65 | 66 20 6c 69 6e 75 78 0a |);.#ifde|f linux.|
|00002630| 09 66 70 72 69 6e 74 66 | 28 6d 61 6b 65 66 69 6c |.fprintf|(makefil|
|00002640| 65 2c 20 22 5c 6e 43 43 | 20 3d 20 67 63 63 5c 6e |e, "\nCC| = gcc\n|
|00002650| 22 29 3b 0a 23 65 6e 64 | 69 66 0a 09 66 63 6c 6f |");.#end|if..fclo|
|00002660| 73 65 28 6d 61 6b 65 66 | 69 6c 65 29 3b 0a 09 73 |se(makef|ile);..s|
|00002670| 79 73 74 65 6d 28 22 73 | 68 20 73 63 61 6e 70 74 |ystem("s|h scanpt|
|00002680| 79 20 3e 3e 4d 61 6b 65 | 66 69 6c 65 22 29 3b 0a |y >>Make|file");.|
|00002690| 09 69 66 20 28 20 28 6d | 61 6b 65 66 69 6c 65 3d |.if ( (m|akefile=|
|000026a0| 66 6f 70 65 6e 28 22 4d | 61 6b 65 66 69 6c 65 22 |fopen("M|akefile"|
|000026b0| 2c 20 22 61 22 29 29 20 | 3d 3d 20 4e 55 4c 4c 20 |, "a")) |== NULL |
|000026c0| 29 0a 09 7b 0a 09 09 70 | 65 72 72 6f 72 28 22 43 |)..{...p|error("C|
|000026d0| 61 6e 27 74 20 66 69 6e | 69 73 68 20 63 72 65 61 |an't fin|ish crea|
|000026e0| 74 69 6e 67 20 4d 61 6b | 65 66 69 6c 65 22 29 3b |ting Mak|efile");|
|000026f0| 0a 09 09 70 72 69 6e 74 | 66 28 22 43 6f 6e 66 69 |...print|f("Confi|
|00002700| 67 75 72 61 74 69 6f 6e | 20 61 62 6f 72 74 65 64 |guration| aborted|
|00002710| 2e 20 45 78 69 74 69 6e | 67 2e 5c 6e 22 29 3b 0a |. Exitin|g.\n");.|
|00002720| 09 09 65 78 69 74 28 32 | 29 3b 0a 09 7d 0a 09 66 |..exit(2|);..}..f|
|00002730| 70 72 69 6e 74 66 28 6d | 61 6b 65 66 69 6c 65 2c |printf(m|akefile,|
|00002740| 20 0a 09 09 22 50 54 59 | 4f 50 54 53 20 3d 20 2d | ..."PTY|OPTS = -|
|00002750| 44 50 54 59 43 48 41 52 | 3d 24 28 50 54 59 43 48 |DPTYCHAR|=$(PTYCH|
|00002760| 41 52 29 20 2d 44 48 45 | 58 44 49 47 49 54 3d 24 |AR) -DHE|XDIGIT=$|
|00002770| 28 48 45 58 44 49 47 49 | 54 29 5c 6e 22 29 3b 0a |(HEXDIGI|T)\n");.|
|00002780| 09 73 70 72 69 6e 74 66 | 28 6c 69 6e 65 2c 20 22 |.sprintf|(line, "|
|00002790| 5c 6e 43 46 4c 41 47 53 | 20 3d 20 25 73 20 24 28 |\nCFLAGS| = %s $(|
|000027a0| 50 54 59 4f 50 54 53 29 | 5c 6e 4c 49 42 53 20 3d |PTYOPTS)|\nLIBS =|
|000027b0| 20 25 73 5c 6e 22 2c 20 | 63 66 6c 61 67 73 2c 20 | %s\n", |cflags, |
|000027c0| 6c 64 66 6c 61 67 73 29 | 3b 0a 09 66 70 72 69 6e |ldflags)|;..fprin|
|000027d0| 74 66 28 6d 61 6b 65 66 | 69 6c 65 2c 20 22 25 73 |tf(makef|ile, "%s|
|000027e0| 22 2c 20 6c 69 6e 65 29 | 3b 0a 09 66 70 72 69 6e |", line)|;..fprin|
|000027f0| 74 66 28 6d 61 6b 65 66 | 69 6c 65 2c 20 22 4f 42 |tf(makef|ile, "OB|
|00002800| 4a 53 20 3d 20 73 70 6c | 69 74 76 74 2e 6f 20 6d |JS = spl|itvt.o m|
|00002810| 69 73 63 2e 6f 20 75 74 | 6d 70 2e 6f 20 76 74 31 |isc.o ut|mp.o vt1|
|00002820| 30 30 2e 6f 20 76 69 64 | 65 6f 6d 65 6d 2e 6f 20 |00.o vid|eomem.o |
|00002830| 74 65 72 6d 69 6e 61 6c | 2e 6f 20 76 74 74 65 73 |terminal|.o vttes|
|00002840| 74 2e 6f 20 76 74 6d 6f | 75 73 65 2e 6f 20 5c 5c |t.o vtmo|use.o \\|
|00002850| 5c 6e 22 29 3b 0a 09 66 | 70 72 69 6e 74 66 28 6d |\n");..f|printf(m|
|00002860| 61 6b 65 66 69 6c 65 2c | 20 22 20 20 20 20 20 20 |akefile,| " |
|00002870| 20 70 61 72 73 65 72 63 | 2e 6f 20 6c 6f 63 6b 2e | parserc|.o lock.|
|00002880| 6f 20 63 75 74 2d 70 61 | 73 74 65 2e 6f 5c 6e 5c |o cut-pa|ste.o\n\|
|00002890| 6e 22 29 3b 0a 09 66 70 | 72 69 6e 74 66 28 6d 61 |n");..fp|rintf(ma|
|000028a0| 6b 65 66 69 6c 65 2c 20 | 22 73 70 6c 69 74 76 74 |kefile, |"splitvt|
|000028b0| 3a 20 24 28 4f 42 4a 53 | 29 5c 6e 22 29 3b 0a 23 |: $(OBJS|)\n");.#|
|000028c0| 69 66 20 64 65 66 69 6e | 65 64 28 6c 69 6e 75 78 |if defin|ed(linux|
|000028d0| 29 20 26 26 20 21 64 65 | 66 69 6e 65 64 28 44 45 |) && !de|fined(DE|
|000028e0| 42 55 47 29 0a 09 66 70 | 72 69 6e 74 66 28 6d 61 |BUG)..fp|rintf(ma|
|000028f0| 6b 65 66 69 6c 65 2c 20 | 22 5c 74 24 28 43 43 29 |kefile, |"\t$(CC)|
|00002900| 20 2d 73 20 2d 6f 20 24 | 40 20 24 28 4f 42 4a 53 | -s -o $|@ $(OBJS|
|00002910| 29 20 24 28 4c 49 42 53 | 29 5c 6e 22 29 3b 0a 23 |) $(LIBS|)\n");.#|
|00002920| 65 6c 73 65 0a 09 66 70 | 72 69 6e 74 66 28 6d 61 |else..fp|rintf(ma|
|00002930| 6b 65 66 69 6c 65 2c 20 | 22 5c 74 24 28 43 43 29 |kefile, |"\t$(CC)|
|00002940| 20 2d 6f 20 24 40 20 24 | 28 4f 42 4a 53 29 20 24 | -o $@ $|(OBJS) $|
|00002950| 28 4c 49 42 53 29 5c 6e | 22 29 3b 0a 23 65 6e 64 |(LIBS)\n|");.#end|
|00002960| 69 66 0a 09 66 70 72 69 | 6e 74 66 28 6d 61 6b 65 |if..fpri|ntf(make|
|00002970| 66 69 6c 65 2c 20 22 5c | 6e 63 6c 65 61 6e 3a 20 |file, "\|nclean: |
|00002980| 5c 6e 5c 74 72 6d 20 2d | 66 20 2a 2e 6f 20 63 6f |\n\trm -|f *.o co|
|00002990| 72 65 20 5c 6e 22 29 3b | 0a 09 66 70 72 69 6e 74 |re \n");|..fprint|
|000029a0| 66 28 6d 61 6b 65 66 69 | 6c 65 2c 20 22 5c 6e 63 |f(makefi|le, "\nc|
|000029b0| 6c 6f 62 62 65 72 3a 20 | 63 6c 65 61 6e 5c 6e 5c |lobber: |clean\n\|
|000029c0| 74 72 6d 20 2d 66 20 73 | 70 6c 69 74 76 74 20 4d |trm -f s|plitvt M|
|000029d0| 61 6b 65 66 69 6c 65 5c | 6e 22 29 3b 0a 0a 09 66 |akefile\|n");...f|
|000029e0| 63 6c 6f 73 65 28 6d 61 | 6b 65 66 69 6c 65 29 3b |close(ma|kefile);|
|000029f0| 0a 09 65 78 69 74 28 30 | 29 3b 0a 7d 0a 0a 0a 2f |..exit(0|);.}.../|
|00002a00| 2a 20 59 65 65 73 68 2e | 20 20 49 20 68 61 76 65 |* Yeesh.| I have|
|00002a10| 20 74 6f 20 77 72 69 74 | 65 20 61 20 77 6f 72 64 | to writ|e a word|
|00002a20| 20 67 72 65 70 20 66 75 | 6e 63 74 69 6f 6e 2e 2e | grep fu|nction..|
|00002a30| 2e 2e 20 2a 2f 0a 0a 69 | 6e 74 20 67 72 65 70 28 |.. */..i|nt grep(|
|00002a40| 64 69 72 2c 20 66 69 6c | 65 2c 20 77 6f 72 64 29 |dir, fil|e, word)|
|00002a50| 0a 63 68 61 72 20 2a 64 | 69 72 3b 0a 63 68 61 72 |.char *d|ir;.char|
|00002a60| 20 2a 66 69 6c 65 3b 0a | 63 68 61 72 20 2a 77 6f | *file;.|char *wo|
|00002a70| 72 64 3b 0a 7b 0a 09 46 | 49 4c 45 20 2a 66 70 3b |rd;.{..F|ILE *fp;|
|00002a80| 0a 09 63 68 61 72 20 2a | 77 70 74 72 2c 20 2a 70 |..char *|wptr, *p|
|00002a90| 74 72 2c 20 62 75 66 66 | 65 72 5b 42 55 46 53 49 |tr, buff|er[BUFSI|
|00002aa0| 5a 5d 3b 0a 0a 09 73 70 | 72 69 6e 74 66 28 62 75 |Z];...sp|rintf(bu|
|00002ab0| 66 66 65 72 2c 20 22 25 | 73 2f 25 73 22 2c 20 64 |ffer, "%|s/%s", d|
|00002ac0| 69 72 2c 20 66 69 6c 65 | 29 3b 0a 09 69 66 20 28 |ir, file|);..if (|
|00002ad0| 20 28 66 70 3d 66 6f 70 | 65 6e 28 62 75 66 66 65 | (fp=fop|en(buffe|
|00002ae0| 72 2c 20 22 72 22 29 29 | 20 3d 3d 20 4e 55 4c 4c |r, "r"))| == NULL|
|00002af0| 20 29 0a 09 09 72 65 74 | 75 72 6e 28 30 29 3b 0a | )...ret|urn(0);.|
|00002b00| 09 70 74 72 3d 77 6f 72 | 64 3b 0a 0a 09 77 68 69 |.ptr=wor|d;...whi|
|00002b10| 6c 65 20 28 20 66 67 65 | 74 73 28 62 75 66 66 65 |le ( fge|ts(buffe|
|00002b20| 72 2c 20 42 55 46 53 49 | 5a 2d 31 2c 20 66 70 29 |r, BUFSI|Z-1, fp)|
|00002b30| 20 21 3d 20 4e 55 4c 4c | 20 29 20 7b 0a 09 09 66 | != NULL| ) {...f|
|00002b40| 6f 72 20 28 20 77 70 74 | 72 3d 62 75 66 66 65 72 |or ( wpt|r=buffer|
|00002b50| 3b 20 2a 77 70 74 72 3b | 20 2b 2b 77 70 74 72 29 |; *wptr;| ++wptr)|
|00002b60| 20 7b 0a 09 09 09 69 66 | 20 28 20 2a 77 70 74 72 | {....if| ( *wptr|
|00002b70| 20 3d 3d 20 2a 70 74 72 | 20 29 20 7b 0a 09 09 09 | == *ptr| ) {....|
|00002b80| 09 2b 2b 70 74 72 3b 0a | 09 09 09 09 69 66 20 28 |.++ptr;.|....if (|
|00002b90| 20 2a 70 74 72 20 3d 3d | 20 27 5c 30 27 20 29 20 | *ptr ==| '\0' ) |
|00002ba0| 7b 0a 09 09 09 09 09 28 | 76 6f 69 64 29 20 66 63 |{......(|void) fc|
|00002bb0| 6c 6f 73 65 28 66 70 29 | 3b 0a 09 09 09 09 09 72 |lose(fp)|;......r|
|00002bc0| 65 74 75 72 6e 28 31 29 | 3b 0a 09 09 09 09 7d 0a |eturn(1)|;.....}.|
|00002bd0| 09 09 09 7d 0a 09 09 09 | 65 6c 73 65 0a 09 09 09 |...}....|else....|
|00002be0| 09 70 74 72 3d 77 6f 72 | 64 3b 0a 09 09 7d 0a 09 |.ptr=wor|d;...}..|
|00002bf0| 7d 0a 09 28 76 6f 69 64 | 29 20 66 63 6c 6f 73 65 |}..(void|) fclose|
|00002c00| 28 66 70 29 3b 0a 09 72 | 65 74 75 72 6e 28 30 29 |(fp);..r|eturn(0)|
|00002c10| 3b 0a 7d 0a 0a 00 00 00 | 00 00 00 00 00 00 00 00 |;.}.....|........|
|00002c20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002c90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ca0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002cb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002cc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002cd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ce0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002cf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d00| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002d90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002da0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002db0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002dc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002dd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002de0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002df0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e00| 73 70 6c 69 74 76 74 2d | 31 2e 36 2e 31 2f 6d 69 |splitvt-|1.6.1/mi|
|00002e10| 73 63 2e 63 00 00 00 00 | 00 00 00 00 00 00 00 00 |sc.c....|........|
|00002e20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002e60| 00 00 00 00 31 30 30 36 | 34 34 20 00 20 20 20 36 |....1006|44 . 6|
|00002e70| 32 35 20 00 20 20 20 20 | 33 30 20 00 20 20 20 20 |25 . |30 . |
|00002e80| 20 20 33 35 30 31 35 20 | 20 35 37 30 34 31 35 31 | 35015 | 5704151|
|00002e90| 34 33 30 20 20 31 33 36 | 35 33 00 20 30 00 00 00 |430 136|53. 0...|
|00002ea0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002eb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ec0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ed0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ee0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ef0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f00| 00 75 73 74 61 72 20 20 | 00 73 6c 6f 75 6b 65 6e |.ustar |.slouken|
|00002f10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f20| 00 00 00 00 00 00 00 00 | 00 70 64 61 64 6d 69 6e |........|.pdadmin|
|00002f30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002f90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002fa0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002fb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002fc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002fd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002ff0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003000| 2f 2a 20 4d 69 73 63 65 | 6c 6c 61 6e 65 6f 75 73 |/* Misce|llaneous|
|00003010| 20 73 79 73 74 65 6d 20 | 64 65 70 65 6e 64 65 6e | system |dependen|
|00003020| 74 20 72 6f 75 74 69 6e | 65 73 20 66 6f 72 20 73 |t routin|es for s|
|00003030| 70 6c 69 74 73 68 20 2a | 2f 0a 0a 23 69 6e 63 6c |plitsh *|/..#incl|
|00003040| 75 64 65 09 3c 73 79 73 | 2f 74 79 70 65 73 2e 68 |ude.<sys|/types.h|
|00003050| 3e 0a 23 69 6e 63 6c 75 | 64 65 09 3c 73 79 73 2f |>.#inclu|de.<sys/|
|00003060| 73 74 61 74 2e 68 3e 0a | 23 69 6e 63 6c 75 64 65 |stat.h>.|#include|
|00003070| 09 3c 66 63 6e 74 6c 2e | 68 3e 0a 23 69 6e 63 6c |.<fcntl.|h>.#incl|
|00003080| 75 64 65 09 3c 73 74 64 | 69 6f 2e 68 3e 0a 23 69 |ude.<std|io.h>.#i|
|00003090| 6e 63 6c 75 64 65 09 3c | 73 69 67 6e 61 6c 2e 68 |nclude.<|signal.h|
|000030a0| 3e 0a 0a 0a 23 69 66 64 | 65 66 20 48 41 56 45 5f |>...#ifd|ef HAVE_|
|000030b0| 54 45 52 4d 49 4f 5f 48 | 0a 23 69 6e 63 6c 75 64 |TERMIO_H|.#includ|
|000030c0| 65 09 3c 74 65 72 6d 69 | 6f 2e 68 3e 0a 23 65 6c |e.<termi|o.h>.#el|
|000030d0| 73 65 0a 23 69 6e 63 6c | 75 64 65 09 3c 73 79 73 |se.#incl|ude.<sys|
|000030e0| 2f 69 6f 63 74 6c 2e 68 | 3e 0a 23 65 6e 64 69 66 |/ioctl.h|>.#endif|
|000030f0| 20 20 2f 2a 20 48 41 56 | 45 5f 54 45 52 4d 49 4f | /* HAV|E_TERMIO|
|00003100| 5f 48 20 2a 2f 0a 0a 23 | 69 66 64 65 66 20 48 41 |_H */..#|ifdef HA|
|00003110| 56 45 5f 42 53 44 54 54 | 59 5f 48 0a 23 69 6e 63 |VE_BSDTT|Y_H.#inc|
|00003120| 6c 75 64 65 09 3c 73 79 | 73 2f 62 73 64 74 74 79 |lude.<sy|s/bsdtty|
|00003130| 2e 68 3e 0a 23 69 66 6e | 64 65 66 20 54 49 4f 43 |.h>.#ifn|def TIOC|
|00003140| 4e 4f 54 54 59 0a 23 64 | 65 66 69 6e 65 20 54 49 |NOTTY.#d|efine TI|
|00003150| 4f 43 4e 4f 54 54 59 09 | 5f 49 4f 28 27 74 27 2c |OCNOTTY.|_IO('t',|
|00003160| 20 31 31 33 29 09 2f 2a | 20 48 50 2d 55 58 20 76 | 113)./*| HP-UX v|
|00003170| 6f 69 64 20 74 74 79 20 | 64 65 66 69 6e 69 74 69 |oid tty |definiti|
|00003180| 6f 6e 20 2a 2f 0a 23 65 | 6e 64 69 66 0a 23 65 6e |on */.#e|ndif.#en|
|00003190| 64 69 66 20 2f 2a 20 48 | 41 56 45 5f 42 53 44 54 |dif /* H|AVE_BSDT|
|000031a0| 54 59 5f 48 20 2a 2f 0a | 0a 23 69 66 64 65 66 20 |TY_H */.|.#ifdef |
|000031b0| 4e 45 45 44 5f 49 4e 45 | 54 5f 48 0a 2f 2a 23 64 |NEED_INE|T_H./*#d|
|000031c0| 65 66 69 6e 65 20 53 54 | 54 59 5f 48 41 43 4b 2a |efine ST|TY_HACK*|
|000031d0| 2f 0a 23 65 6e 64 69 66 | 0a 0a 2f 2a 0a 20 2a 20 |/.#endif|../*. * |
|000031e0| 49 6e 69 74 69 61 6c 69 | 7a 65 20 61 20 70 74 79 |Initiali|ze a pty|
|000031f0| 2c 20 66 6f 72 6b 20 61 | 20 63 6f 6d 6d 61 6e 64 |, fork a| command|
|00003200| 20 72 75 6e 6e 69 6e 67 | 20 75 6e 64 65 72 20 69 | running| under i|
|00003210| 74 2c 20 61 6e 64 20 74 | 68 65 6e 20 0a 20 2a 20 |t, and t|hen . * |
|00003220| 72 65 74 75 72 6e 20 74 | 68 65 20 6d 61 73 74 65 |return t|he maste|
|00003230| 72 20 66 69 6c 65 20 64 | 65 73 63 72 69 70 74 6f |r file d|escripto|
|00003240| 72 0a 20 2a 2f 0a 0a 65 | 78 74 65 72 6e 20 69 6e |r. */..e|xtern in|
|00003250| 74 20 57 55 5f 6c 69 6e | 65 73 2c 20 57 4c 5f 6c |t WU_lin|es, WL_l|
|00003260| 69 6e 65 73 2c 20 57 5f | 63 6f 6c 75 6d 6e 73 3b |ines, W_|columns;|
|00003270| 09 2f 2a 20 46 72 6f 6d | 20 76 74 31 30 30 2e 63 |./* From| vt100.c|
|00003280| 20 2a 2f 0a 0a 23 64 65 | 66 69 6e 65 20 55 50 50 | */..#de|fine UPP|
|00003290| 45 52 09 30 09 09 2f 2a | 20 55 70 70 65 72 20 77 |ER.0../*| Upper w|
|000032a0| 69 6e 64 6f 77 20 64 65 | 66 69 6e 69 74 69 6f 6e |indow de|finition|
|000032b0| 20 2a 2f 0a 23 64 65 66 | 69 6e 65 20 4c 4f 57 45 | */.#def|ine LOWE|
|000032c0| 52 09 31 09 09 2f 2a 20 | 4c 6f 77 65 72 20 77 69 |R.1../* |Lower wi|
|000032d0| 6e 64 6f 77 20 64 65 66 | 69 6e 69 74 69 6f 6e 20 |ndow def|inition |
|000032e0| 2a 2f 0a 0a 69 6e 74 20 | 70 74 79 5f 6f 70 65 6e |*/..int |pty_open|
|000032f0| 28 61 72 67 76 2c 20 63 | 68 69 6c 64 70 69 64 2c |(argv, c|hildpid,|
|00003300| 20 77 69 6e 29 0a 63 68 | 61 72 20 2a 61 72 67 76 | win).ch|ar *argv|
|00003310| 5b 5d 3b 0a 69 6e 74 20 | 2a 63 68 69 6c 64 70 69 |[];.int |*childpi|
|00003320| 64 3b 0a 69 6e 74 20 77 | 69 6e 3b 09 09 2f 2a 20 |d;.int w|in;../* |
|00003330| 30 20 66 6f 72 20 75 70 | 70 65 72 2c 20 31 20 66 |0 for up|per, 1 f|
|00003340| 6f 72 20 6c 6f 77 65 72 | 20 2a 2f 0a 7b 0a 0a 09 |or lower| */.{...|
|00003350| 76 6f 69 64 20 64 72 6f | 70 63 74 74 79 28 29 2c |void dro|pctty(),|
|00003360| 20 70 74 79 5f 73 65 74 | 77 69 6e 28 29 3b 0a 09 | pty_set|win();..|
|00003370| 69 6e 74 20 67 65 74 5f | 6d 61 73 74 65 72 5f 70 |int get_|master_p|
|00003380| 74 79 28 29 2c 20 67 65 | 74 5f 73 6c 61 76 65 5f |ty(), ge|t_slave_|
|00003390| 70 74 79 28 29 3b 0a 09 | 63 68 61 72 20 2a 67 65 |pty();..|char *ge|
|000033a0| 74 5f 74 74 79 6e 61 6d | 65 28 29 2c 20 2a 6d 79 |t_ttynam|e(), *my|
|000033b0| 70 75 74 65 6e 76 28 29 | 3b 0a 0a 09 63 68 61 72 |putenv()|;...char|
|000033c0| 20 4c 49 4e 45 53 5b 31 | 32 5d 2c 20 43 4f 4c 55 | LINES[1|2], COLU|
|000033d0| 4d 4e 53 5b 31 32 5d 2c | 20 53 50 4c 49 54 56 54 |MNS[12],| SPLITVT|
|000033e0| 5b 32 34 5d 3b 0a 09 69 | 6e 74 20 72 65 74 75 72 |[24];..i|nt retur|
|000033f0| 6e 66 64 2c 20 73 6c 61 | 76 65 5f 66 64 3b 0a 0a |nfd, sla|ve_fd;..|
|00003400| 09 2f 2a 20 47 65 74 20 | 74 68 65 20 6d 61 73 74 |./* Get |the mast|
|00003410| 65 72 20 70 74 79 20 66 | 69 6c 65 20 64 65 73 63 |er pty f|ile desc|
|00003420| 72 69 70 74 6f 72 20 2a | 2f 0a 09 69 66 20 28 20 |riptor *|/..if ( |
|00003430| 28 72 65 74 75 72 6e 66 | 64 3d 67 65 74 5f 6d 61 |(returnf|d=get_ma|
|00003440| 73 74 65 72 5f 70 74 79 | 28 29 29 20 3c 20 30 20 |ster_pty|()) < 0 |
|00003450| 29 0a 09 09 72 65 74 75 | 72 6e 28 2d 31 29 3b 0a |)...retu|rn(-1);.|
|00003460| 0a 09 2f 2a 20 46 6f 72 | 6b 20 61 6e 64 20 67 6f |../* For|k and go|
|00003470| 21 20 2a 2f 0a 09 69 66 | 20 28 20 28 28 2a 63 68 |! */..if| ( ((*ch|
|00003480| 69 6c 64 70 69 64 29 3d | 66 6f 72 6b 28 29 29 20 |ildpid)=|fork()) |
|00003490| 3c 20 30 20 29 0a 09 09 | 72 65 74 75 72 6e 28 2d |< 0 )...|return(-|
|000034a0| 31 29 3b 0a 09 65 6c 73 | 65 20 69 66 20 28 20 28 |1);..els|e if ( (|
|000034b0| 2a 63 68 69 6c 64 70 69 | 64 29 20 3d 3d 20 30 20 |*childpi|d) == 0 |
|000034c0| 29 0a 09 7b 0a 09 09 64 | 72 6f 70 63 74 74 79 28 |)..{...d|ropctty(|
|000034d0| 29 3b 09 2f 2a 20 4c 6f | 73 65 20 63 6f 6e 74 72 |);./* Lo|se contr|
|000034e0| 6f 6c 6c 69 6e 67 20 74 | 74 79 20 2a 2f 0a 0a 09 |olling t|ty */...|
|000034f0| 09 69 66 20 28 20 28 73 | 6c 61 76 65 5f 66 64 3d |.if ( (s|lave_fd=|
|00003500| 67 65 74 5f 73 6c 61 76 | 65 5f 70 74 79 28 29 29 |get_slav|e_pty())|
|00003510| 20 3c 20 30 20 29 0a 09 | 09 7b 0a 09 09 09 70 65 | < 0 )..|.{....pe|
|00003520| 72 72 6f 72 28 22 43 61 | 6e 27 74 20 6f 70 65 6e |rror("Ca|n't open|
|00003530| 20 73 6c 61 76 65 20 74 | 74 79 22 29 3b 0a 09 09 | slave t|ty");...|
|00003540| 09 65 78 69 74 28 31 32 | 38 29 3b 0a 09 09 7d 0a |.exit(12|8);...}.|
|00003550| 09 09 63 6c 6f 73 65 28 | 30 29 3b 20 63 6c 6f 73 |..close(|0); clos|
|00003560| 65 28 31 29 3b 20 63 6c | 6f 73 65 28 32 29 3b 0a |e(1); cl|ose(2);.|
|00003570| 09 09 64 75 70 28 73 6c | 61 76 65 5f 66 64 29 3b |..dup(sl|ave_fd);|
|00003580| 20 64 75 70 28 73 6c 61 | 76 65 5f 66 64 29 3b 20 | dup(sla|ve_fd); |
|00003590| 64 75 70 28 73 6c 61 76 | 65 5f 66 64 29 3b 0a 09 |dup(slav|e_fd);..|
|000035a0| 09 63 6c 6f 73 65 28 73 | 6c 61 76 65 5f 66 64 29 |.close(s|lave_fd)|
|000035b0| 3b 20 63 6c 6f 73 65 28 | 72 65 74 75 72 6e 66 64 |; close(|returnfd|
|000035c0| 29 3b 0a 0a 09 09 2f 2a | 20 52 65 61 74 74 61 74 |);..../*| Reattat|
|000035d0| 63 68 20 74 68 65 20 6e | 65 77 20 74 74 79 20 61 |ch the n|ew tty a|
|000035e0| 73 20 74 68 65 20 63 6f | 6e 74 72 6f 6c 6c 69 6e |s the co|ntrollin|
|000035f0| 67 20 74 65 72 6d 69 6e | 61 6c 20 2a 2f 0a 09 09 |g termin|al */...|
|00003600| 2f 2a 20 55 6e 64 65 72 | 20 6f 6c 64 20 55 4e 49 |/* Under| old UNI|
|00003610| 58 2c 20 6a 75 73 74 20 | 6f 70 65 6e 69 6e 67 20 |X, just |opening |
|00003620| 74 68 65 20 6e 65 77 20 | 74 74 79 20 61 66 74 65 |the new |tty afte|
|00003630| 72 0a 09 09 20 20 20 6c | 6f 73 69 6e 67 20 74 68 |r... l|osing th|
|00003640| 65 20 63 6f 6e 74 72 6f | 6c 6c 69 6e 67 20 74 74 |e contro|lling tt|
|00003650| 79 20 69 73 20 67 6f 6f | 64 20 65 6e 6f 75 67 68 |y is goo|d enough|
|00003660| 2e 0a 09 09 20 20 20 55 | 6e 64 65 72 20 6e 65 77 |.... U|nder new|
|00003670| 65 72 20 55 6e 69 63 65 | 73 2c 20 69 74 20 72 65 |er Unice|s, it re|
|00003680| 71 75 69 72 65 73 20 61 | 6e 20 69 6f 63 74 6c 28 |quires a|n ioctl(|
|00003690| 29 2e 20 20 2a 2f 0a 23 | 69 66 64 65 66 20 54 49 |). */.#|ifdef TI|
|000036a0| 4f 43 53 43 54 54 59 0a | 09 09 28 76 6f 69 64 29 |OCSCTTY.|..(void)|
|000036b0| 20 69 6f 63 74 6c 28 30 | 2c 20 54 49 4f 43 53 43 | ioctl(0|, TIOCSC|
|000036c0| 54 54 59 2c 20 30 29 3b | 0a 23 65 6e 64 69 66 0a |TTY, 0);|.#endif.|
|000036d0| 0a 09 09 2f 2a 20 53 65 | 74 20 74 68 65 20 6c 69 |.../* Se|t the li|
|000036e0| 6e 65 73 20 61 6e 64 20 | 63 6f 6c 75 6d 6e 73 20 |nes and |columns |
|000036f0| 6f 6e 20 74 68 65 20 6e | 65 77 20 74 74 79 20 2a |on the n|ew tty *|
|00003700| 2f 0a 23 69 66 64 65 66 | 20 54 49 4f 43 47 57 49 |/.#ifdef| TIOCGWI|
|00003710| 4e 53 5a 09 2f 2a 20 57 | 65 20 64 6f 6e 27 74 20 |NSZ./* W|e don't |
|00003720| 77 61 6e 74 20 74 6f 20 | 73 65 74 20 74 68 65 20 |want to |set the |
|00003730| 65 6e 76 69 72 6f 6e 6d | 65 6e 74 20 69 66 20 70 |environm|ent if p|
|00003740| 6f 73 73 69 62 6c 65 20 | 2a 2f 0a 09 09 70 74 79 |ossible |*/...pty|
|00003750| 5f 73 65 74 77 69 6e 28 | 30 2c 20 77 69 6e 29 3b |_setwin(|0, win);|
|00003760| 0a 23 65 6c 73 65 0a 09 | 09 69 66 20 28 20 77 69 |.#else..|.if ( wi|
|00003770| 6e 20 3d 3d 20 55 50 50 | 45 52 20 29 0a 09 09 09 |n == UPP|ER )....|
|00003780| 73 70 72 69 6e 74 66 28 | 4c 49 4e 45 53 2c 20 22 |sprintf(|LINES, "|
|00003790| 4c 49 4e 45 53 3d 25 64 | 22 2c 20 57 55 5f 6c 69 |LINES=%d|", WU_li|
|000037a0| 6e 65 73 29 3b 0a 09 09 | 65 6c 73 65 0a 09 09 09 |nes);...|else....|
|000037b0| 73 70 72 69 6e 74 66 28 | 4c 49 4e 45 53 2c 20 22 |sprintf(|LINES, "|
|000037c0| 4c 49 4e 45 53 3d 25 64 | 22 2c 20 57 4c 5f 6c 69 |LINES=%d|", WL_li|
|000037d0| 6e 65 73 29 3b 0a 09 09 | 6d 79 70 75 74 65 6e 76 |nes);...|myputenv|
|000037e0| 28 4c 49 4e 45 53 29 3b | 0a 09 09 73 70 72 69 6e |(LINES);|...sprin|
|000037f0| 74 66 28 43 4f 4c 55 4d | 4e 53 2c 20 22 43 4f 4c |tf(COLUM|NS, "COL|
|00003800| 55 4d 4e 53 3d 25 64 22 | 2c 20 57 5f 63 6f 6c 75 |UMNS=%d"|, W_colu|
|00003810| 6d 6e 73 29 3b 0a 09 09 | 6d 79 70 75 74 65 6e 76 |mns);...|myputenv|
|00003820| 28 43 4f 4c 55 4d 4e 53 | 29 3b 0a 23 65 6e 64 69 |(COLUMNS|);.#endi|
|00003830| 66 20 2f 2a 20 54 49 4f | 43 47 57 49 4e 53 5a 20 |f /* TIO|CGWINSZ |
|00003840| 2a 2f 0a 09 09 2f 2a 20 | 53 65 74 20 74 68 65 20 |*/.../* |Set the |
|00003850| 53 50 4c 49 54 56 54 20 | 65 6e 76 69 72 6f 6e 6d |SPLITVT |environm|
|00003860| 65 6e 74 20 76 61 72 69 | 61 62 6c 65 20 66 6f 72 |ent vari|able for|
|00003870| 20 73 68 65 6c 6c 20 73 | 63 72 69 70 74 73 20 2a | shell s|cripts *|
|00003880| 2f 0a 09 09 69 66 20 28 | 20 77 69 6e 20 3d 3d 20 |/...if (| win == |
|00003890| 55 50 50 45 52 20 29 0a | 09 09 09 73 70 72 69 6e |UPPER ).|...sprin|
|000038a0| 74 66 28 53 50 4c 49 54 | 56 54 2c 20 22 53 50 4c |tf(SPLIT|VT, "SPL|
|000038b0| 49 54 56 54 3d 75 70 70 | 65 72 22 29 3b 0a 09 09 |ITVT=upp|er");...|
|000038c0| 65 6c 73 65 0a 09 09 09 | 73 70 72 69 6e 74 66 28 |else....|sprintf(|
|000038d0| 53 50 4c 49 54 56 54 2c | 20 22 53 50 4c 49 54 56 |SPLITVT,| "SPLITV|
|000038e0| 54 3d 6c 6f 77 65 72 22 | 29 3b 0a 09 09 6d 79 70 |T=lower"|);...myp|
|000038f0| 75 74 65 6e 76 28 53 50 | 4c 49 54 56 54 29 3b 0a |utenv(SP|LITVT);.|
|00003900| 09 09 6d 79 70 75 74 65 | 6e 76 28 22 54 45 52 4d |..mypute|nv("TERM|
|00003910| 3d 76 74 31 30 30 22 29 | 3b 09 2f 2a 20 50 75 74 |=vt100")|;./* Put|
|00003920| 20 74 68 65 20 6e 65 77 | 20 54 45 52 4d 20 69 6e | the new| TERM in|
|00003930| 20 74 68 65 20 65 6e 76 | 2e 20 2a 2f 0a 0a 23 69 | the env|. */..#i|
|00003940| 66 64 65 66 20 53 49 47 | 54 53 54 50 0a 09 09 73 |fdef SIG|TSTP...s|
|00003950| 69 67 6e 61 6c 28 53 49 | 47 54 53 54 50 2c 20 53 |ignal(SI|GTSTP, S|
|00003960| 49 47 5f 49 47 4e 29 3b | 0a 23 65 6e 64 69 66 0a |IG_IGN);|.#endif.|
|00003970| 23 69 66 64 65 66 20 53 | 54 54 59 5f 48 41 43 4b |#ifdef S|TTY_HACK|
|00003980| 0a 09 09 73 79 73 74 65 | 6d 28 22 73 74 74 79 20 |...syste|m("stty |
|00003990| 73 61 6e 65 20 65 63 68 | 6f 20 65 63 68 6f 65 20 |sane ech|o echoe |
|000039a0| 69 6e 74 72 20 27 5e 43 | 27 20 65 72 61 73 65 20 |intr '^C|' erase |
|000039b0| 27 5e 48 27 22 29 3b 0a | 23 65 6c 73 65 0a 09 09 |'^H'");.|#else...|
|000039c0| 28 76 6f 69 64 29 20 74 | 74 79 5f 72 65 73 65 74 |(void) t|ty_reset|
|000039d0| 28 30 29 3b 0a 23 65 6e | 64 69 66 0a 09 09 2f 2a |(0);.#en|dif.../*|
|000039e0| 20 22 74 6f 75 63 68 22 | 20 74 68 65 20 74 74 79 | "touch"| the tty|
|000039f0| 20 73 6f 20 27 77 27 20 | 72 65 70 6f 72 74 73 20 | so 'w' |reports |
|00003a00| 70 72 6f 70 65 72 20 69 | 64 6c 65 20 74 69 6d 65 |proper i|dle time|
|00003a10| 73 20 2a 2f 0a 09 09 28 | 76 6f 69 64 29 20 75 74 |s */...(|void) ut|
|00003a20| 69 6d 65 28 67 65 74 5f | 74 74 79 6e 61 6d 65 28 |ime(get_|ttyname(|
|00003a30| 29 2c 20 4e 55 4c 4c 29 | 3b 0a 0a 09 09 2f 2a 20 |), NULL)|;..../* |
|00003a40| 53 65 74 20 6f 75 72 20 | 75 69 64 20 74 6f 20 6f |Set our |uid to o|
|00003a50| 75 72 20 72 65 61 6c 20 | 75 69 64 20 69 66 20 6e |ur real |uid if n|
|00003a60| 65 63 65 73 73 61 72 79 | 20 2a 2f 0a 09 09 28 76 |ecessary| */...(v|
|00003a70| 6f 69 64 29 20 73 65 74 | 75 69 64 28 67 65 74 75 |oid) set|uid(getu|
|00003a80| 69 64 28 29 29 3b 0a 09 | 09 09 0a 09 09 2f 2a 20 |id());..|...../* |
|00003a90| 52 75 6e 20 74 68 65 20 | 72 65 71 75 65 73 74 65 |Run the |requeste|
|00003aa0| 64 20 70 72 6f 67 72 61 | 6d 2c 20 77 69 74 68 20 |d progra|m, with |
|00003ab0| 70 6f 73 73 69 62 6c 65 | 20 6c 65 61 64 69 6e 67 |possible| leading|
|00003ac0| 20 64 61 73 68 2e 20 2a | 2f 0a 09 09 65 78 65 63 | dash. *|/...exec|
|00003ad0| 76 70 28 28 28 2a 61 72 | 67 76 5b 30 5d 20 3d 3d |vp(((*ar|gv[0] ==|
|00003ae0| 20 27 2d 27 29 20 3f 20 | 61 72 67 76 5b 30 5d 2b | '-') ? |argv[0]+|
|00003af0| 31 20 3a 20 61 72 67 76 | 5b 30 5d 29 2c 20 61 72 |1 : argv|[0]), ar|
|00003b00| 67 76 29 3b 0a 09 09 70 | 65 72 72 6f 72 28 61 72 |gv);...p|error(ar|
|00003b10| 67 76 5b 30 5d 29 3b 0a | 09 09 65 78 69 74 28 32 |gv[0]);.|..exit(2|
|00003b20| 35 35 29 3b 0a 09 7d 0a | 09 72 65 74 75 72 6e 28 |55);..}.|.return(|
|00003b30| 72 65 74 75 72 6e 66 64 | 29 3b 0a 7d 0a 0a 0a 0a |returnfd|);.}....|
|00003b40| 2f 2a 0a 20 2a 20 50 73 | 65 75 64 6f 2d 74 65 72 |/*. * Ps|eudo-ter|
|00003b50| 6d 69 6e 61 6c 20 72 6f | 75 74 69 6e 65 73 20 66 |minal ro|utines f|
|00003b60| 6f 72 20 55 6e 69 78 20 | 53 79 73 74 65 6d 20 56 |or Unix |System V|
|00003b70| 20 52 65 6c 65 61 73 65 | 20 33 2e 32 20 61 6e 64 | Release| 3.2 and|
|00003b80| 20 42 53 44 34 2e 32 2d | 33 0a 20 2a 2f 0a 0a 0a | BSD4.2-|3. */...|
|00003b90| 65 78 74 65 72 6e 20 69 | 6e 74 20 65 72 72 6e 6f |extern i|nt errno|
|00003ba0| 3b 0a 69 6e 74 20 6d 61 | 73 74 65 72 5f 66 64 3b |;.int ma|ster_fd;|
|00003bb0| 0a 0a 63 68 61 72 20 74 | 74 79 5f 6e 61 6d 65 5b |..char t|ty_name[|
|00003bc0| 36 34 5d 3d 7b 27 5c 30 | 27 7d 3b 0a 63 68 61 72 |64]={'\0|'};.char|
|00003bd0| 20 70 74 79 5f 6e 61 6d | 65 5b 36 34 5d 3d 7b 27 | pty_nam|e[64]={'|
|00003be0| 5c 30 27 7d 3b 0a 0a 63 | 68 61 72 20 2a 67 65 74 |\0'};..c|har *get|
|00003bf0| 5f 74 74 79 6e 61 6d 65 | 28 29 0a 7b 0a 09 69 66 |_ttyname|().{..if|
|00003c00| 20 28 20 74 74 79 5f 6e | 61 6d 65 5b 30 5d 20 29 | ( tty_n|ame[0] )|
|00003c10| 0a 09 09 72 65 74 75 72 | 6e 28 74 74 79 5f 6e 61 |...retur|n(tty_na|
|00003c20| 6d 65 29 3b 0a 09 72 65 | 74 75 72 6e 28 4e 55 4c |me);..re|turn(NUL|
|00003c30| 4c 29 3b 0a 7d 0a 0a 23 | 69 66 64 65 66 20 49 52 |L);.}..#|ifdef IR|
|00003c40| 49 58 09 2f 2a 20 49 52 | 49 58 20 53 79 73 74 65 |IX./* IR|IX Syste|
|00003c50| 6d 20 56 20 66 6f 72 20 | 53 47 49 20 6d 61 63 68 |m V for |SGI mach|
|00003c60| 69 6e 65 73 20 2a 2f 0a | 0a 65 78 74 65 72 6e 20 |ines */.|.extern |
|00003c70| 63 68 61 72 20 2a 5f 67 | 65 74 70 74 79 28 29 3b |char *_g|etpty();|
|00003c80| 0a 0a 69 6e 74 20 67 65 | 74 5f 6d 61 73 74 65 72 |..int ge|t_master|
|00003c90| 5f 70 74 79 28 29 0a 7b | 0a 0a 09 63 68 61 72 20 |_pty().{|...char |
|00003ca0| 09 2a 74 74 79 70 74 72 | 3b 0a 0a 09 69 66 20 28 |.*ttyptr|;...if (|
|00003cb0| 20 28 74 74 79 70 74 72 | 3d 5f 67 65 74 70 74 79 | (ttyptr|=_getpty|
|00003cc0| 28 26 6d 61 73 74 65 72 | 5f 66 64 2c 20 4f 5f 52 |(&master|_fd, O_R|
|00003cd0| 44 57 52 2c 20 30 36 30 | 30 2c 20 30 29 29 20 3d |DWR, 060|0, 0)) =|
|00003ce0| 3d 20 30 20 29 0a 09 09 | 72 65 74 75 72 6e 28 2d |= 0 )...|return(-|
|00003cf0| 31 29 3b 0a 09 65 6c 73 | 65 0a 09 09 73 74 72 63 |1);..els|e...strc|
|00003d00| 70 79 28 74 74 79 5f 6e | 61 6d 65 2c 20 74 74 79 |py(tty_n|ame, tty|
|00003d10| 70 74 72 29 3b 0a 0a 09 | 72 65 74 75 72 6e 28 6d |ptr);...|return(m|
|00003d20| 61 73 74 65 72 5f 66 64 | 29 3b 0a 7d 0a 0a 2f 2a |aster_fd|);.}../*|
|00003d30| 0a 20 2a 20 4f 70 65 6e | 20 74 68 65 20 73 6c 61 |. * Open| the sla|
|00003d40| 76 65 20 68 61 6c 66 20 | 6f 66 20 61 20 70 73 65 |ve half |of a pse|
|00003d50| 75 64 6f 2d 74 65 72 6d | 69 6e 61 6c 2e 0a 20 2a |udo-term|inal.. *|
|00003d60| 2f 0a 0a 69 6e 74 20 67 | 65 74 5f 73 6c 61 76 65 |/..int g|et_slave|
|00003d70| 5f 70 74 79 28 29 0a 7b | 0a 09 69 6e 74 09 73 6c |_pty().{|..int.sl|
|00003d80| 61 76 65 5f 66 64 3b 0a | 09 63 68 61 72 09 2a 73 |ave_fd;.|.char.*s|
|00003d90| 6c 61 76 65 6e 61 6d 65 | 3b 0a 0a 09 73 6c 61 76 |lavename|;...slav|
|00003da0| 65 6e 61 6d 65 3d 74 74 | 79 5f 6e 61 6d 65 3b 0a |ename=tt|y_name;.|
|00003db0| 0a 09 69 66 20 28 73 6c | 61 76 65 6e 61 6d 65 20 |..if (sl|avename |
|00003dc0| 3d 3d 20 4e 55 4c 4c 29 | 20 7b 0a 09 09 63 6c 6f |== NULL)| {...clo|
|00003dd0| 73 65 28 6d 61 73 74 65 | 72 5f 66 64 29 3b 0a 09 |se(maste|r_fd);..|
|00003de0| 09 72 65 74 75 72 6e 28 | 2d 31 29 3b 0a 09 7d 0a |.return(|-1);..}.|
|00003df0| 0a 09 69 66 20 28 20 28 | 73 6c 61 76 65 5f 66 64 |..if ( (|slave_fd|
|00003e00| 3d 6f 70 65 6e 28 73 6c | 61 76 65 6e 61 6d 65 2c |=open(sl|avename,|
|00003e10| 20 4f 5f 52 44 57 52 29 | 29 20 3c 20 30 20 29 09 | O_RDWR)|) < 0 ).|
|00003e20| 2f 2a 20 6f 70 65 6e 20 | 74 68 65 20 73 6c 61 76 |/* open |the slav|
|00003e30| 65 20 2a 2f 0a 09 7b 0a | 09 09 63 6c 6f 73 65 28 |e */..{.|..close(|
|00003e40| 6d 61 73 74 65 72 5f 66 | 64 29 3b 0a 09 09 72 65 |master_f|d);...re|
|00003e50| 74 75 72 6e 28 2d 31 29 | 3b 0a 09 7d 0a 0a 09 72 |turn(-1)|;..}...r|
|00003e60| 65 74 75 72 6e 28 73 6c | 61 76 65 5f 66 64 29 3b |eturn(sl|ave_fd);|
|00003e70| 0a 7d 0a 23 65 6c 73 65 | 20 2f 2a 20 21 20 49 52 |.}.#else| /* ! IR|
|00003e80| 49 58 20 2a 2f 0a 0a 0a | 23 69 66 64 65 66 20 53 |IX */...|#ifdef S|
|00003e90| 4f 4c 41 52 49 53 09 09 | 2f 2a 20 53 79 73 74 65 |OLARIS..|/* Syste|
|00003ea0| 6d 20 56 2e 34 20 70 74 | 79 20 72 6f 75 74 69 6e |m V.4 pt|y routin|
|00003eb0| 65 73 20 66 72 6f 6d 20 | 57 2e 20 52 69 63 68 61 |es from |W. Richa|
|00003ec0| 72 64 20 53 74 65 76 65 | 6e 73 20 2a 2f 0a 0a 23 |rd Steve|ns */..#|
|00003ed0| 69 6e 63 6c 75 64 65 20 | 3c 73 74 72 6f 70 74 73 |include |<stropts|
|00003ee0| 2e 68 3e 0a 0a 23 64 65 | 66 69 6e 65 20 44 45 56 |.h>..#de|fine DEV|
|00003ef0| 5f 43 4c 4f 4e 45 09 22 | 2f 64 65 76 2f 70 74 6d |_CLONE."|/dev/ptm|
|00003f00| 78 22 0a 0a 65 78 74 65 | 72 6e 20 63 68 61 72 20 |x"..exte|rn char |
|00003f10| 2a 70 74 73 6e 61 6d 65 | 28 29 3b 0a 0a 69 6e 74 |*ptsname|();..int|
|00003f20| 20 67 65 74 5f 6d 61 73 | 74 65 72 5f 70 74 79 28 | get_mas|ter_pty(|
|00003f30| 29 0a 7b 0a 0a 09 63 68 | 61 72 20 09 2a 74 74 79 |).{...ch|ar .*tty|
|00003f40| 70 74 72 3b 0a 0a 09 69 | 66 20 28 20 28 6d 61 73 |ptr;...i|f ( (mas|
|00003f50| 74 65 72 5f 66 64 3d 6f | 70 65 6e 28 44 45 56 5f |ter_fd=o|pen(DEV_|
|00003f60| 43 4c 4f 4e 45 2c 20 4f | 5f 52 44 57 52 29 29 20 |CLONE, O|_RDWR)) |
|00003f70| 3c 20 30 20 29 0a 09 09 | 72 65 74 75 72 6e 28 2d |< 0 )...|return(-|
|00003f80| 31 29 3b 0a 0a 09 69 66 | 20 28 20 67 72 61 6e 74 |1);...if| ( grant|
|00003f90| 70 74 28 6d 61 73 74 65 | 72 5f 66 64 29 20 3c 20 |pt(maste|r_fd) < |
|00003fa0| 30 20 29 09 2f 2a 20 67 | 72 61 6e 74 20 61 63 63 |0 )./* g|rant acc|
|00003fb0| 65 73 73 20 74 6f 20 73 | 6c 61 76 65 20 2a 2f 0a |ess to s|lave */.|
|00003fc0| 09 7b 0a 09 09 63 6c 6f | 73 65 28 6d 61 73 74 65 |.{...clo|se(maste|
|00003fd0| 72 5f 66 64 29 3b 0a 23 | 69 66 64 65 66 20 44 45 |r_fd);.#|ifdef DE|
|00003fe0| 42 55 47 0a 09 09 70 65 | 72 72 6f 72 28 22 67 72 |BUG...pe|rror("gr|
|00003ff0| 61 6e 74 70 74 28 29 22 | 29 3b 0a 23 65 6e 64 69 |antpt()"|);.#endi|
|00004000| 66 0a 09 09 72 65 74 75 | 72 6e 28 2d 31 29 3b 0a |f...retu|rn(-1);.|
|00004010| 09 7d 0a 0a 09 69 66 20 | 28 20 75 6e 6c 6f 63 6b |.}...if |( unlock|
|00004020| 70 74 28 6d 61 73 74 65 | 72 5f 66 64 29 20 3c 20 |pt(maste|r_fd) < |
|00004030| 30 20 29 09 2f 2a 20 63 | 6c 65 61 72 20 73 6c 61 |0 )./* c|lear sla|
|00004040| 76 65 27 73 20 6c 6f 63 | 6b 20 66 6c 61 67 20 2a |ve's loc|k flag *|
|00004050| 2f 0a 09 7b 0a 09 09 63 | 6c 6f 73 65 28 6d 61 73 |/..{...c|lose(mas|
|00004060| 74 65 72 5f 66 64 29 3b | 0a 09 09 72 65 74 75 72 |ter_fd);|...retur|
|00004070| 6e 28 2d 31 29 3b 0a 09 | 7d 0a 0a 09 69 66 20 28 |n(-1);..|}...if (|
|00004080| 20 28 74 74 79 70 74 72 | 3d 70 74 73 6e 61 6d 65 | (ttyptr|=ptsname|
|00004090| 28 6d 61 73 74 65 72 5f | 66 64 29 29 20 3d 3d 20 |(master_|fd)) == |
|000040a0| 4e 55 4c 4c 20 29 0a 09 | 7b 0a 09 09 63 6c 6f 73 |NULL )..|{...clos|
|000040b0| 65 28 6d 61 73 74 65 72 | 5f 66 64 29 3b 0a 09 09 |e(master|_fd);...|
|000040c0| 72 65 74 75 72 6e 28 2d | 31 29 3b 0a 09 7d 0a 09 |return(-|1);..}..|
|000040d0| 65 6c 73 65 0a 09 09 73 | 74 72 63 70 79 28 74 74 |else...s|trcpy(tt|
|000040e0| 79 5f 6e 61 6d 65 2c 20 | 74 74 79 70 74 72 29 3b |y_name, |ttyptr);|
|000040f0| 0a 0a 09 72 65 74 75 72 | 6e 28 6d 61 73 74 65 72 |...retur|n(master|
|00004100| 5f 66 64 29 3b 0a 7d 0a | 0a 2f 2a 0a 20 2a 20 4f |_fd);.}.|./*. * O|
|00004110| 70 65 6e 20 74 68 65 20 | 73 6c 61 76 65 20 68 61 |pen the |slave ha|
|00004120| 6c 66 20 6f 66 20 61 20 | 70 73 65 75 64 6f 2d 74 |lf of a |pseudo-t|
|00004130| 65 72 6d 69 6e 61 6c 2e | 0a 20 2a 2f 0a 0a 69 6e |erminal.|. */..in|
|00004140| 74 20 67 65 74 5f 73 6c | 61 76 65 5f 70 74 79 28 |t get_sl|ave_pty(|
|00004150| 29 0a 7b 0a 09 69 6e 74 | 09 73 6c 61 76 65 5f 66 |).{..int|.slave_f|
|00004160| 64 3b 0a 09 63 68 61 72 | 09 2a 73 6c 61 76 65 6e |d;..char|.*slaven|
|00004170| 61 6d 65 3b 0a 0a 09 73 | 6c 61 76 65 6e 61 6d 65 |ame;...s|lavename|
|00004180| 3d 74 74 79 5f 6e 61 6d | 65 3b 0a 0a 09 69 66 20 |=tty_nam|e;...if |
|00004190| 28 20 28 73 6c 61 76 65 | 5f 66 64 3d 6f 70 65 6e |( (slave|_fd=open|
|000041a0| 28 73 6c 61 76 65 6e 61 | 6d 65 2c 20 4f 5f 52 44 |(slavena|me, O_RD|
|000041b0| 57 52 29 29 20 3c 20 30 | 20 29 09 2f 2a 20 6f 70 |WR)) < 0| )./* op|
|000041c0| 65 6e 20 74 68 65 20 73 | 6c 61 76 65 20 2a 2f 0a |en the s|lave */.|
|000041d0| 09 7b 0a 09 09 63 6c 6f | 73 65 28 6d 61 73 74 65 |.{...clo|se(maste|
|000041e0| 72 5f 66 64 29 3b 0a 09 | 09 72 65 74 75 72 6e 28 |r_fd);..|.return(|
|000041f0| 2d 31 29 3b 0a 09 7d 0a | 0a 09 69 66 20 28 20 69 |-1);..}.|..if ( i|
|00004200| 6f 63 74 6c 28 73 6c 61 | 76 65 5f 66 64 2c 20 49 |octl(sla|ve_fd, I|
|00004210| 5f 50 55 53 48 2c 20 22 | 70 74 65 6d 22 29 20 3c |_PUSH, "|ptem") <|
|00004220| 20 30 20 29 0a 09 7b 0a | 09 09 63 6c 6f 73 65 28 | 0 )..{.|..close(|
|00004230| 6d 61 73 74 65 72 5f 66 | 64 29 3b 0a 09 09 63 6c |master_f|d);...cl|
|00004240| 6f 73 65 28 73 6c 61 76 | 65 5f 66 64 29 3b 0a 09 |ose(slav|e_fd);..|
|00004250| 09 72 65 74 75 72 6e 28 | 2d 31 29 3b 0a 09 7d 0a |.return(|-1);..}.|
|00004260| 0a 09 69 66 20 28 20 69 | 6f 63 74 6c 28 73 6c 61 |..if ( i|octl(sla|
|00004270| 76 65 5f 66 64 2c 20 49 | 5f 50 55 53 48 2c 20 22 |ve_fd, I|_PUSH, "|
|00004280| 6c 64 74 65 72 6d 22 29 | 20 3c 20 30 20 29 0a 09 |ldterm")| < 0 )..|
|00004290| 7b 0a 09 09 63 6c 6f 73 | 65 28 6d 61 73 74 65 72 |{...clos|e(master|
|000042a0| 5f 66 64 29 3b 0a 09 09 | 63 6c 6f 73 65 28 73 6c |_fd);...|close(sl|
|000042b0| 61 76 65 5f 66 64 29 3b | 0a 09 09 72 65 74 75 72 |ave_fd);|...retur|
|000042c0| 6e 28 2d 31 29 3b 0a 09 | 7d 0a 0a 09 69 66 20 28 |n(-1);..|}...if (|
|000042d0| 20 69 6f 63 74 6c 28 73 | 6c 61 76 65 5f 66 64 2c | ioctl(s|lave_fd,|
|000042e0| 20 49 5f 50 55 53 48 2c | 20 22 74 74 63 6f 6d 70 | I_PUSH,| "ttcomp|
|000042f0| 61 74 22 29 20 3c 20 30 | 20 29 0a 09 7b 0a 09 09 |at") < 0| )..{...|
|00004300| 63 6c 6f 73 65 28 6d 61 | 73 74 65 72 5f 66 64 29 |close(ma|ster_fd)|
|00004310| 3b 0a 09 09 63 6c 6f 73 | 65 28 73 6c 61 76 65 5f |;...clos|e(slave_|
|00004320| 66 64 29 3b 0a 09 09 72 | 65 74 75 72 6e 28 2d 31 |fd);...r|eturn(-1|
|00004330| 29 3b 0a 09 7d 0a 0a 09 | 72 65 74 75 72 6e 28 73 |);..}...|return(s|
|00004340| 6c 61 76 65 5f 66 64 29 | 3b 0a 7d 0a 0a 23 65 6c |lave_fd)|;.}..#el|
|00004350| 73 65 09 2f 2a 20 42 53 | 44 2c 20 53 75 6e 2f 4f |se./* BS|D, Sun/O|
|00004360| 53 2c 20 41 49 58 2c 20 | 55 4c 54 52 49 58 2c 20 |S, AIX, |ULTRIX, |
|00004370| 48 50 2d 55 58 2c 20 41 | 54 26 54 20 53 59 53 56 |HP-UX, A|T&T SYSV|
|00004380| 20 2a 2f 0a 0a 23 69 6e | 63 6c 75 64 65 09 3c 73 | */..#in|clude.<s|
|00004390| 65 74 6a 6d 70 2e 68 3e | 0a 0a 23 69 66 6e 64 65 |etjmp.h>|..#ifnde|
|000043a0| 66 20 58 5f 4f 4b 0a 23 | 64 65 66 69 6e 65 09 52 |f X_OK.#|define.R|
|000043b0| 5f 4f 4b 09 34 09 2f 2a | 20 54 65 73 74 20 66 6f |_OK.4./*| Test fo|
|000043c0| 72 20 52 65 61 64 20 70 | 65 72 6d 69 73 73 69 6f |r Read p|ermissio|
|000043d0| 6e 20 2a 2f 0a 23 64 65 | 66 69 6e 65 09 57 5f 4f |n */.#de|fine.W_O|
|000043e0| 4b 09 32 09 2f 2a 20 54 | 65 73 74 20 66 6f 72 20 |K.2./* T|est for |
|000043f0| 57 72 69 74 65 20 70 65 | 72 6d 69 73 73 69 6f 6e |Write pe|rmission|
|00004400| 20 2a 2f 0a 23 64 65 66 | 69 6e 65 09 58 5f 4f 4b | */.#def|ine.X_OK|
|00004410| 09 31 09 2f 2a 20 54 65 | 73 74 20 66 6f 72 20 65 |.1./* Te|st for e|
|00004420| 58 65 63 75 74 65 20 70 | 65 72 6d 69 73 73 69 6f |Xecute p|ermissio|
|00004430| 6e 20 2a 2f 0a 23 65 6e | 64 69 66 20 20 2f 2a 20 |n */.#en|dif /* |
|00004440| 58 5f 4f 4b 20 2a 2f 0a | 0a 6a 6d 70 5f 62 75 66 |X_OK */.|.jmp_buf|
|00004450| 20 6e 65 78 74 3b 0a 0a | 76 6f 69 64 20 74 72 79 | next;..|void try|
|00004460| 6e 65 78 74 28 29 0a 7b | 0a 09 6c 6f 6e 67 6a 6d |next().{|..longjm|
|00004470| 70 28 6e 65 78 74 2c 20 | 32 29 3b 0a 7d 0a 0a 0a |p(next, |2);.}...|
|00004480| 69 6e 74 20 67 65 74 5f | 6d 61 73 74 65 72 5f 70 |int get_|master_p|
|00004490| 74 79 28 29 0a 7b 0a 09 | 69 6e 74 20 69 2c 20 6d |ty().{..|int i, m|
|000044a0| 61 73 74 65 72 5f 66 64 | 3b 0a 09 63 68 61 72 20 |aster_fd|;..char |
|000044b0| 2a 70 74 72 3b 0a 09 73 | 74 72 75 63 74 20 73 74 |*ptr;..s|truct st|
|000044c0| 61 74 20 73 74 61 74 62 | 75 66 66 3b 0a 23 69 66 |at statb|uff;.#if|
|000044d0| 64 65 66 20 50 54 59 43 | 48 41 52 0a 09 73 74 61 |def PTYC|HAR..sta|
|000044e0| 74 69 63 20 63 68 61 72 | 20 70 74 79 63 68 61 72 |tic char| ptychar|
|000044f0| 5b 5d 3d 50 54 59 43 48 | 41 52 3b 09 09 09 2f 2a |[]=PTYCH|AR;.../*|
|00004500| 20 58 20 2a 2f 20 0a 09 | 73 74 61 74 69 63 20 63 | X */ ..|static c|
|00004510| 68 61 72 20 68 65 78 64 | 69 67 69 74 5b 5d 3d 48 |har hexd|igit[]=H|
|00004520| 45 58 44 49 47 49 54 3b | 09 09 2f 2a 20 59 20 2a |EXDIGIT;|../* Y *|
|00004530| 2f 0a 23 65 6c 73 65 0a | 09 73 74 61 74 69 63 20 |/.#else.|.static |
|00004540| 63 68 61 72 20 70 74 79 | 63 68 61 72 5b 5d 3d 22 |char pty|char[]="|
|00004550| 70 71 72 73 74 75 76 77 | 78 79 7a 50 51 52 53 54 |pqrstuvw|xyzPQRST|
|00004560| 22 3b 09 2f 2a 20 58 20 | 2a 2f 20 0a 09 73 74 61 |";./* X |*/ ..sta|
|00004570| 74 69 63 20 63 68 61 72 | 20 68 65 78 64 69 67 69 |tic char| hexdigi|
|00004580| 74 5b 5d 3d 22 30 31 32 | 33 34 35 36 37 38 39 61 |t[]="012|3456789a|
|00004590| 62 63 64 65 66 22 3b 09 | 2f 2a 20 59 20 2a 2f 0a |bcdef";.|/* Y */.|
|000045a0| 23 65 6e 64 69 66 0a 0a | 09 66 6f 72 20 28 70 74 |#endif..|.for (pt|
|000045b0| 72 3d 70 74 79 63 68 61 | 72 3b 20 2a 70 74 72 20 |r=ptycha|r; *ptr |
|000045c0| 21 3d 20 30 3b 20 70 74 | 72 2b 2b 29 0a 09 7b 0a |!= 0; pt|r++)..{.|
|000045d0| 09 09 73 74 72 63 70 79 | 28 70 74 79 5f 6e 61 6d |..strcpy|(pty_nam|
|000045e0| 65 2c 20 22 2f 64 65 76 | 2f 70 74 79 58 59 22 29 |e, "/dev|/ptyXY")|
|000045f0| 3b 0a 09 09 70 74 79 5f | 6e 61 6d 65 5b 38 5d 3d |;...pty_|name[8]=|
|00004600| 28 2a 70 74 72 29 3b 20 | 20 2f 2a 20 58 20 2a 2f |(*ptr); | /* X */|
|00004610| 0a 09 09 70 74 79 5f 6e | 61 6d 65 5b 39 5d 3d 27 |...pty_n|ame[9]='|
|00004620| 30 27 3b 20 20 20 2f 2a | 20 59 20 2a 2f 0a 0a 09 |0'; /*| Y */...|
|00004630| 09 69 66 20 28 20 73 74 | 61 74 28 70 74 79 5f 6e |.if ( st|at(pty_n|
|00004640| 61 6d 65 2c 20 26 73 74 | 61 74 62 75 66 66 29 20 |ame, &st|atbuff) |
|00004650| 3c 20 30 20 29 0a 09 09 | 09 62 72 65 61 6b 3b 0a |< 0 )...|.break;.|
|00004660| 23 69 66 64 65 66 20 4f | 4c 44 44 45 42 55 47 0a |#ifdef O|LDDEBUG.|
|00004670| 09 09 66 70 72 69 6e 74 | 66 28 73 74 64 65 72 72 |..fprint|f(stderr|
|00004680| 2c 20 22 73 74 61 74 74 | 65 64 2e 5c 6e 22 29 3b |, "statt|ed.\n");|
|00004690| 0a 23 65 6e 64 69 66 0a | 09 09 69 3d 28 2d 31 29 |.#endif.|..i=(-1)|
|000046a0| 3b 09 09 2f 2a 20 49 6e | 69 74 69 61 6c 69 7a 65 |;../* In|itialize|
|000046b0| 20 69 20 2a 2f 0a 0a 09 | 09 2f 2a 20 53 65 74 20 | i */...|./* Set |
|000046c0| 61 20 74 69 6d 65 20 6c | 69 6d 69 74 20 66 6f 72 |a time l|imit for|
|000046d0| 20 74 68 65 20 6f 70 65 | 6e 20 2a 2f 0a 09 09 69 | the ope|n */...i|
|000046e0| 66 20 28 20 73 65 74 6a | 6d 70 28 6e 65 78 74 29 |f ( setj|mp(next)|
|000046f0| 20 3d 3d 20 2d 31 20 29 | 0a 09 09 09 72 65 74 75 | == -1 )|....retu|
|00004700| 72 6e 28 2d 31 29 3b 0a | 09 09 73 69 67 6e 61 6c |rn(-1);.|..signal|
|00004710| 28 53 49 47 41 4c 52 4d | 2c 20 74 72 79 6e 65 78 |(SIGALRM|, trynex|
|00004720| 74 29 3b 0a 0a 09 09 66 | 6f 72 20 28 20 2b 2b 69 |t);....f|or ( ++i|
|00004730| 3b 20 68 65 78 64 69 67 | 69 74 5b 69 5d 3b 20 2b |; hexdig|it[i]; +|
|00004740| 2b 69 29 0a 09 09 7b 0a | 09 09 09 70 74 79 5f 6e |+i)...{.|...pty_n|
|00004750| 61 6d 65 5b 35 5d 3d 27 | 70 27 3b 0a 09 09 09 70 |ame[5]='|p';....p|
|00004760| 74 79 5f 6e 61 6d 65 5b | 39 5d 3d 68 65 78 64 69 |ty_name[|9]=hexdi|
|00004770| 67 69 74 5b 69 5d 3b 0a | 0a 09 09 09 61 6c 61 72 |git[i];.|....alar|
|00004780| 6d 28 32 29 3b 09 2f 2a | 20 53 65 74 20 61 6e 20 |m(2);./*| Set an |
|00004790| 6f 70 65 6e 20 74 69 6d | 65 6f 75 74 20 2a 2f 0a |open tim|eout */.|
|000047a0| 0a 09 09 09 69 66 20 28 | 20 28 6d 61 73 74 65 72 |....if (| (master|
|000047b0| 5f 66 64 3d 6f 70 65 6e | 28 70 74 79 5f 6e 61 6d |_fd=open|(pty_nam|
|000047c0| 65 2c 20 4f 5f 52 44 57 | 52 29 29 20 3e 3d 20 30 |e, O_RDW|R)) >= 0|
|000047d0| 20 29 0a 09 09 09 7b 0a | 09 09 09 09 61 6c 61 72 | )....{.|....alar|
|000047e0| 6d 28 30 29 3b 20 09 2f | 2a 20 52 65 73 65 74 20 |m(0); ./|* Reset |
|000047f0| 74 68 65 20 61 6c 61 72 | 6d 20 2a 2f 0a 0a 09 09 |the alar|m */....|
|00004800| 09 09 70 74 79 5f 6e 61 | 6d 65 5b 35 5d 3d 27 74 |..pty_na|me[5]='t|
|00004810| 27 3b 0a 09 09 09 09 73 | 70 72 69 6e 74 66 28 74 |';.....s|printf(t|
|00004820| 74 79 5f 6e 61 6d 65 2c | 20 22 25 73 22 2c 20 70 |ty_name,| "%s", p|
|00004830| 74 79 5f 6e 61 6d 65 29 | 3b 0a 23 69 66 64 65 66 |ty_name)|;.#ifdef|
|00004840| 20 4f 4c 44 44 45 42 55 | 47 0a 09 09 09 09 66 70 | OLDDEBU|G.....fp|
|00004850| 72 69 6e 74 66 28 73 74 | 64 65 72 72 2c 20 22 74 |rintf(st|derr, "t|
|00004860| 74 79 3a 20 25 73 5c 6e | 22 2c 20 74 74 79 5f 6e |ty: %s\n|", tty_n|
|00004870| 61 6d 65 29 3b 0a 23 65 | 6e 64 69 66 0a 09 09 09 |ame);.#e|ndif....|
|00004880| 09 69 66 20 28 20 61 63 | 63 65 73 73 28 74 74 79 |.if ( ac|cess(tty|
|00004890| 5f 6e 61 6d 65 2c 20 52 | 5f 4f 4b 7c 57 5f 4f 4b |_name, R|_OK|W_OK|
|000048a0| 29 20 3d 3d 20 30 20 29 | 20 7b 0a 09 09 09 09 09 |) == 0 )| {......|
|000048b0| 73 69 67 6e 61 6c 28 53 | 49 47 41 4c 52 4d 2c 20 |signal(S|IGALRM, |
|000048c0| 53 49 47 5f 44 46 4c 29 | 3b 0a 09 09 09 09 09 72 |SIG_DFL)|;......r|
|000048d0| 65 74 75 72 6e 20 28 6d | 61 73 74 65 72 5f 66 64 |eturn (m|aster_fd|
|000048e0| 29 3b 0a 09 09 09 09 7d | 20 65 6c 73 65 20 7b 0a |);.....}| else {.|
|000048f0| 09 09 09 09 09 70 74 79 | 5f 6e 61 6d 65 5b 35 5d |.....pty|_name[5]|
|00004900| 3d 27 70 27 3b 0a 09 09 | 09 09 09 28 76 6f 69 64 |='p';...|...(void|
|00004910| 29 20 63 6c 6f 73 65 28 | 6d 61 73 74 65 72 5f 66 |) close(|master_f|
|00004920| 64 29 3b 0a 09 09 09 09 | 7d 0a 09 09 09 7d 0a 09 |d);.....|}....}..|
|00004930| 09 09 2f 2a 20 72 65 73 | 65 74 20 74 68 65 20 61 |../* res|et the a|
|00004940| 6c 61 72 6d 20 2a 2f 0a | 09 09 09 61 6c 61 72 6d |larm */.|...alarm|
|00004950| 28 30 29 3b 0a 09 09 7d | 0a 09 7d 0a 09 72 65 74 |(0);...}|..}..ret|
|00004960| 75 72 6e 28 2d 31 29 3b | 0a 7d 0a 0a 0a 2f 2a 20 |urn(-1);|.}.../* |
|00004970| 4f 70 65 6e 20 74 68 65 | 20 73 6c 61 76 65 20 68 |Open the| slave h|
|00004980| 61 6c 66 20 6f 66 20 61 | 20 70 73 65 75 64 6f 2d |alf of a| pseudo-|
|00004990| 74 65 72 6d 69 6e 61 6c | 2e 20 2a 2f 0a 0a 69 6e |terminal|. */..in|
|000049a0| 74 20 67 65 74 5f 73 6c | 61 76 65 5f 70 74 79 28 |t get_sl|ave_pty(|
|000049b0| 29 0a 7b 0a 09 69 6e 74 | 20 73 6c 61 76 65 5f 66 |).{..int| slave_f|
|000049c0| 64 3b 0a 0a 09 69 66 20 | 28 20 28 73 6c 61 76 65 |d;...if |( (slave|
|000049d0| 5f 66 64 3d 6f 70 65 6e | 28 74 74 79 5f 6e 61 6d |_fd=open|(tty_nam|
|000049e0| 65 2c 20 4f 5f 52 44 57 | 52 29 29 20 3c 20 30 20 |e, O_RDW|R)) < 0 |
|000049f0| 29 0a 09 7b 0a 09 09 63 | 6c 6f 73 65 28 6d 61 73 |)..{...c|lose(mas|
|00004a00| 74 65 72 5f 66 64 29 3b | 0a 09 09 72 65 74 75 72 |ter_fd);|...retur|
|00004a10| 6e 28 2d 31 29 3b 0a 09 | 7d 0a 09 72 65 74 75 72 |n(-1);..|}..retur|
|00004a20| 6e 28 73 6c 61 76 65 5f | 66 64 29 3b 0a 7d 0a 0a |n(slave_|fd);.}..|
|00004a30| 23 65 6e 64 69 66 20 20 | 2f 2a 20 69 66 20 53 4f |#endif |/* if SO|
|00004a40| 4c 41 52 49 53 20 2a 2f | 0a 23 65 6e 64 69 66 20 |LARIS */|.#endif |
|00004a50| 20 2f 2a 20 69 66 20 49 | 52 49 58 20 2a 2f 0a 0a | /* if I|RIX */..|
|00004a60| 0a 2f 2a 20 54 68 65 73 | 65 20 61 72 65 20 74 68 |./* Thes|e are th|
|00004a70| 65 20 62 69 6e 61 72 79 | 20 64 61 74 61 20 66 75 |e binary| data fu|
|00004a80| 6e 63 74 69 6f 6e 73 20 | 74 68 61 74 20 49 20 61 |nctions |that I a|
|00004a90| 6d 20 75 73 69 6e 67 20 | 69 6e 73 74 65 61 64 20 |m using |instead |
|00004aa0| 6f 66 20 0a 20 20 20 62 | 63 6f 70 79 28 29 20 61 |of . b|copy() a|
|00004ab0| 6e 64 20 62 7a 65 72 6f | 28 29 2c 20 77 72 69 74 |nd bzero|(), writ|
|00004ac0| 74 65 6e 20 62 79 20 52 | 69 63 68 61 72 64 20 41 |ten by R|ichard A|
|00004ad0| 2e 20 4f 27 4b 65 65 66 | 65 2e 0a 20 20 20 20 20 |. O'Keef|e.. |
|00004ae0| 54 68 61 6e 6b 73 21 0a | 2a 2f 0a 0a 76 6f 69 64 |Thanks!.|*/..void|
|00004af0| 20 64 5f 63 6f 70 79 28 | 73 72 63 2c 20 64 73 74 | d_copy(|src, dst|
|00004b00| 2c 20 6c 65 6e 29 0a 20 | 20 20 20 72 65 67 69 73 |, len). | regis|
|00004b10| 74 65 72 20 63 68 61 72 | 20 2a 73 72 63 2c 20 2a |ter char| *src, *|
|00004b20| 64 73 74 3b 0a 20 20 20 | 20 72 65 67 69 73 74 65 |dst;. | registe|
|00004b30| 72 20 69 6e 74 20 6c 65 | 6e 3b 0a 20 20 20 20 7b |r int le|n;. {|
|00004b40| 0a 09 77 68 69 6c 65 20 | 28 2d 2d 6c 65 6e 20 3e |..while |(--len >|
|00004b50| 3d 20 30 29 20 2a 64 73 | 74 2b 2b 20 3d 20 2a 73 |= 0) *ds|t++ = *s|
|00004b60| 72 63 2b 2b 3b 0a 20 20 | 20 20 7d 0a 0a 76 6f 69 |rc++;. | }..voi|
|00004b70| 64 20 64 5f 7a 65 72 6f | 28 64 73 74 2c 20 6c 65 |d d_zero|(dst, le|
|00004b80| 6e 29 0a 20 20 20 20 72 | 65 67 69 73 74 65 72 20 |n). r|egister |
|00004b90| 63 68 61 72 20 2a 64 73 | 74 3b 0a 20 20 20 20 72 |char *ds|t;. r|
|00004ba0| 65 67 69 73 74 65 72 20 | 69 6e 74 20 6c 65 6e 3b |egister |int len;|
|00004bb0| 0a 20 20 20 20 7b 0a 09 | 77 68 69 6c 65 20 28 2d |. {..|while (-|
|00004bc0| 2d 6c 65 6e 20 3e 3d 20 | 30 29 20 2a 64 73 74 2b |-len >= |0) *dst+|
|00004bd0| 2b 20 3d 20 30 3b 0a 20 | 20 20 20 7d 0a 0a 0a 0a |+ = 0;. | }....|
|00004be0| 2f 2a 20 48 65 72 65 20 | 61 72 65 20 74 68 65 20 |/* Here |are the |
|00004bf0| 54 65 72 6d 69 6e 61 6c | 20 6d 61 6e 69 70 75 6c |Terminal| manipul|
|00004c00| 61 74 69 6f 6e 20 72 6f | 75 74 69 6e 65 73 2e 2e |ation ro|utines..|
|00004c10| 2e 20 20 2a 2f 0a 0a 0a | 2f 2a 20 43 6f 64 65 20 |. */...|/* Code |
|00004c20| 74 6f 20 64 69 73 61 73 | 73 6f 63 69 61 74 65 20 |to disas|sociate |
|00004c30| 66 72 6f 6d 20 6d 79 20 | 74 74 79 2e 20 59 61 79 |from my |tty. Yay|
|00004c40| 21 20 3a 29 20 2a 2f 0a | 0a 76 6f 69 64 20 64 72 |! :) */.|.void dr|
|00004c50| 6f 70 63 74 74 79 28 29 | 0a 7b 0a 09 69 6e 74 20 |opctty()|.{..int |
|00004c60| 66 64 3b 0a 0a 23 69 66 | 20 64 65 66 69 6e 65 64 |fd;..#if| defined|
|00004c70| 28 5f 50 4f 53 49 58 5f | 53 4f 55 52 43 45 29 20 |(_POSIX_|SOURCE) |
|00004c80| 7c 7c 20 64 65 66 69 6e | 65 64 28 53 4f 4c 41 52 ||| defin|ed(SOLAR|
|00004c90| 49 53 29 0a 09 73 65 74 | 73 69 64 28 29 3b 09 09 |IS)..set|sid();..|
|00004ca0| 2f 2a 20 54 68 65 20 50 | 4f 53 49 58 20 73 6f 6c |/* The P|OSIX sol|
|00004cb0| 75 74 69 6f 6e 20 69 73 | 20 73 69 6d 70 6c 65 2e |ution is| simple.|
|00004cc0| 20 3a 29 20 2a 2f 0a 23 | 65 6c 73 65 0a 23 69 66 | :) */.#|else.#if|
|00004cd0| 64 65 66 20 54 49 4f 43 | 4e 4f 54 54 59 20 20 2f |def TIOC|NOTTY /|
|00004ce0| 2a 20 57 65 20 77 61 6e | 74 20 74 6f 20 67 65 74 |* We wan|t to get|
|00004cf0| 20 48 50 2d 55 58 2c 20 | 42 53 44 2c 20 61 6e 64 | HP-UX, |BSD, and|
|00004d00| 20 53 75 6e 2f 4f 53 20 | 68 65 72 65 20 2a 2f 0a | Sun/OS |here */.|
|00004d10| 09 73 65 74 70 67 72 70 | 28 30 2c 20 30 29 3b 0a |.setpgrp|(0, 0);.|
|00004d20| 0a 23 69 66 6e 64 65 66 | 20 43 49 42 41 55 44 20 |.#ifndef| CIBAUD |
|00004d30| 20 20 2f 2a 20 53 75 6e | 2f 4f 53 20 64 6f 65 73 | /* Sun|/OS does|
|00004d40| 6e 27 74 20 6e 65 65 64 | 20 74 6f 20 64 6f 20 54 |n't need| to do T|
|00004d50| 49 4f 43 4e 4f 54 54 59 | 2e 20 20 2a 2f 0a 09 69 |IOCNOTTY|. */..i|
|00004d60| 66 20 28 20 28 66 64 3d | 6f 70 65 6e 28 22 2f 64 |f ( (fd=|open("/d|
|00004d70| 65 76 2f 74 74 79 22 2c | 20 4f 5f 52 44 57 52 29 |ev/tty",| O_RDWR)|
|00004d80| 29 20 3e 20 28 2d 31 29 | 20 29 20 0a 09 7b 0a 09 |) > (-1)| ) ..{..|
|00004d90| 09 69 66 20 28 69 6f 63 | 74 6c 28 66 64 2c 20 54 |.if (ioc|tl(fd, T|
|00004da0| 49 4f 43 4e 4f 54 54 59 | 2c 20 30 29 20 3c 20 30 |IOCNOTTY|, 0) < 0|
|00004db0| 29 0a 09 09 7b 0a 09 09 | 09 70 65 72 72 6f 72 28 |)...{...|.perror(|
|00004dc0| 22 69 6f 63 74 6c 20 54 | 49 4f 43 4e 4f 54 54 59 |"ioctl T|IOCNOTTY|
|00004dd0| 20 65 72 72 6f 72 22 29 | 3b 0a 09 09 09 66 70 72 | error")|;....fpr|
|00004de0| 69 6e 74 66 28 73 74 64 | 65 72 72 2c 20 22 5c 72 |intf(std|err, "\r|
|00004df0| 22 29 3b 0a 09 09 7d 0a | 09 09 63 6c 6f 73 65 28 |");...}.|..close(|
|00004e00| 66 64 29 3b 0a 09 7d 0a | 23 65 6e 64 69 66 20 2f |fd);..}.|#endif /|
|00004e10| 2a 20 43 49 42 41 55 44 | 20 2a 2f 0a 23 65 6c 73 |* CIBAUD| */.#els|
|00004e20| 65 20 2f 2a 20 20 53 59 | 53 56 20 09 2a 2f 0a 09 |e /* SY|SV .*/..|
|00004e30| 73 65 74 70 67 72 70 28 | 29 3b 0a 23 65 6e 64 69 |setpgrp(|);.#endi|
|00004e40| 66 20 2f 2a 20 54 49 4f | 43 4e 4f 54 54 59 20 2a |f /* TIO|CNOTTY *|
|00004e50| 2f 0a 23 65 6e 64 69 66 | 20 2f 2a 20 5f 50 4f 53 |/.#endif| /* _POS|
|00004e60| 49 58 5f 53 4f 55 52 43 | 45 20 2a 2f 0a 7d 0a 0a |IX_SOURC|E */.}..|
|00004e70| 0a 23 69 66 64 65 66 20 | 48 41 56 45 5f 54 45 52 |.#ifdef |HAVE_TER|
|00004e80| 4d 49 4f 5f 48 0a 0a 2f | 2a 20 47 65 74 20 74 68 |MIO_H../|* Get th|
|00004e90| 65 20 6d 6f 64 65 73 20 | 6f 66 20 74 68 65 20 63 |e modes |of the c|
|00004ea0| 6f 6e 74 72 6f 6c 6c 69 | 6e 67 20 74 74 79 20 61 |ontrolli|ng tty a|
|00004eb0| 6e 64 20 73 61 76 65 20 | 74 68 65 6d 2e 20 20 53 |nd save |them. S|
|00004ec0| 61 76 65 73 0a 20 20 20 | 74 74 79 6d 6f 64 65 73 |aves. |ttymodes|
|00004ed0| 20 69 6e 20 74 74 79 5f | 6d 6f 64 65 20 61 6e 64 | in tty_|mode and|
|00004ee0| 20 72 65 74 75 72 6e 73 | 20 2d 31 20 69 66 20 69 | returns| -1 if i|
|00004ef0| 6f 63 74 6c 20 66 61 69 | 6c 73 2e 20 2a 2f 0a 0a |octl fai|ls. */..|
|00004f00| 73 74 72 75 63 74 20 74 | 65 72 6d 69 6f 20 74 74 |struct t|ermio tt|
|00004f10| 79 5f 6d 6f 64 65 3b 20 | 20 2f 2a 20 53 61 76 65 |y_mode; | /* Save|
|00004f20| 20 74 74 79 20 6d 6f 64 | 65 20 68 65 72 65 20 2a | tty mod|e here *|
|00004f30| 2f 0a 73 74 61 74 69 63 | 20 69 6e 74 20 74 74 79 |/.static| int tty|
|00004f40| 5f 69 6e 69 74 3d 30 3b | 0a 0a 69 6e 74 20 74 74 |_init=0;|..int tt|
|00004f50| 79 5f 67 65 74 6d 6f 64 | 65 28 66 64 29 0a 69 6e |y_getmod|e(fd).in|
|00004f60| 74 20 66 64 3b 0a 7b 0a | 09 64 5f 7a 65 72 6f 28 |t fd;.{.|.d_zero(|
|00004f70| 28 63 68 61 72 20 2a 29 | 26 74 74 79 5f 6d 6f 64 |(char *)|&tty_mod|
|00004f80| 65 2c 20 73 69 7a 65 6f | 66 28 73 74 72 75 63 74 |e, sizeo|f(struct|
|00004f90| 20 74 65 72 6d 69 6f 29 | 29 3b 0a 09 74 74 79 5f | termio)|);..tty_|
|00004fa0| 69 6e 69 74 3d 31 3b 09 | 2f 2a 20 46 6c 61 67 3a |init=1;.|/* Flag:|
|00004fb0| 20 77 65 20 68 61 76 65 | 20 69 6e 69 74 69 61 6c | we have| initial|
|00004fc0| 69 7a 65 64 20 74 68 65 | 20 74 74 79 5f 6d 6f 64 |ized the| tty_mod|
|00004fd0| 65 20 73 74 72 75 63 74 | 20 2a 2f 0a 0a 09 69 66 |e struct| */...if|
|00004fe0| 20 28 20 21 20 69 73 61 | 74 74 79 28 66 64 29 20 | ( ! isa|tty(fd) |
|00004ff0| 29 0a 09 09 72 65 74 75 | 72 6e 28 30 29 3b 0a 0a |)...retu|rn(0);..|
|00005000| 23 69 66 64 65 66 20 4f | 4c 44 44 45 42 55 47 0a |#ifdef O|LDDEBUG.|
|00005010| 09 66 70 72 69 6e 74 66 | 28 73 74 64 65 72 72 2c |.fprintf|(stderr,|
|00005020| 20 22 47 65 74 74 69 6e | 67 20 74 74 79 20 6d 6f | "Gettin|g tty mo|
|00005030| 64 65 73 20 66 6f 72 20 | 74 74 79 5f 6d 6f 64 65 |des for |tty_mode|
|00005040| 2e 5c 72 5c 6e 22 29 3b | 0a 23 65 6e 64 69 66 0a |.\r\n");|.#endif.|
|00005050| 0a 09 69 66 20 28 69 6f | 63 74 6c 28 66 64 2c 20 |..if (io|ctl(fd, |
|00005060| 54 43 47 45 54 41 2c 20 | 28 63 68 61 72 20 2a 29 |TCGETA, |(char *)|
|00005070| 20 26 74 74 79 5f 6d 6f | 64 65 29 20 3c 20 30 29 | &tty_mo|de) < 0)|
|00005080| 0a 09 7b 0a 23 69 66 64 | 65 66 20 44 45 42 55 47 |..{.#ifd|ef DEBUG|
|00005090| 0a 09 09 70 65 72 72 6f | 72 28 22 74 74 79 5f 67 |...perro|r("tty_g|
|000050a0| 65 74 6d 6f 64 65 28 29 | 3a 20 69 6f 63 74 6c 20 |etmode()|: ioctl |
|000050b0| 65 72 72 6f 72 22 29 3b | 0a 23 65 6e 64 69 66 0a |error");|.#endif.|
|000050c0| 09 09 72 65 74 75 72 6e | 28 2d 31 29 3b 20 20 0a |..return|(-1); .|
|000050d0| 09 7d 0a 0a 09 72 65 74 | 75 72 6e 28 30 29 3b 0a |.}...ret|urn(0);.|
|000050e0| 7d 0a 0a 0a 2f 2a 20 53 | 65 74 20 61 20 74 74 79 |}.../* S|et a tty|
|000050f0| 20 74 6f 20 61 20 73 61 | 6e 65 20 6d 6f 64 65 20 | to a sa|ne mode |
|00005100| 2a 2f 0a 0a 69 6e 74 20 | 74 74 79 5f 73 61 6e 65 |*/..int |tty_sane|
|00005110| 28 66 64 29 0a 69 6e 74 | 20 66 64 3b 0a 7b 0a 09 |(fd).int| fd;.{..|
|00005120| 73 74 72 75 63 74 20 74 | 65 72 6d 69 6f 20 74 65 |struct t|ermio te|
|00005130| 6d 70 5f 6d 6f 64 65 3b | 0a 0a 09 69 66 20 28 20 |mp_mode;|...if ( |
|00005140| 21 20 69 73 61 74 74 79 | 28 66 64 29 20 29 0a 09 |! isatty|(fd) )..|
|00005150| 09 72 65 74 75 72 6e 28 | 30 29 3b 0a 0a 09 69 66 |.return(|0);...if|
|00005160| 20 28 20 21 20 74 74 79 | 5f 69 6e 69 74 20 29 0a | ( ! tty|_init ).|
|00005170| 09 7b 0a 09 09 69 66 20 | 28 69 6f 63 74 6c 28 66 |.{...if |(ioctl(f|
|00005180| 64 2c 20 54 43 47 45 54 | 41 2c 20 28 63 68 61 72 |d, TCGET|A, (char|
|00005190| 20 2a 29 20 26 74 74 79 | 5f 6d 6f 64 65 29 20 3c | *) &tty|_mode) <|
|000051a0| 20 30 29 0a 09 09 09 72 | 65 74 75 72 6e 28 2d 31 | 0)....r|eturn(-1|
|000051b0| 29 3b 20 20 0a 09 7d 0a | 0a 23 69 66 64 65 66 20 |); ..}.|.#ifdef |
|000051c0| 53 45 56 45 4e 5f 42 49 | 54 0a 09 74 65 6d 70 5f |SEVEN_BI|T..temp_|
|000051d0| 6d 6f 64 65 2e 63 5f 69 | 66 6c 61 67 3d 28 74 74 |mode.c_i|flag=(tt|
|000051e0| 79 5f 6d 6f 64 65 2e 63 | 5f 69 66 6c 61 67 7c 28 |y_mode.c|_iflag|(|
|000051f0| 42 52 4b 49 4e 54 7c 49 | 47 4e 50 41 52 7c 49 53 |BRKINT|I|GNPAR|IS|
|00005200| 54 52 49 50 7c 49 43 52 | 4e 4c 7c 49 58 4f 4e 29 |TRIP|ICR|NL|IXON)|
|00005210| 29 3b 0a 09 74 65 6d 70 | 5f 6d 6f 64 65 2e 63 5f |);..temp|_mode.c_|
|00005220| 6f 66 6c 61 67 3d 28 74 | 74 79 5f 6d 6f 64 65 2e |oflag=(t|ty_mode.|
|00005230| 63 5f 6f 66 6c 61 67 7c | 28 4f 50 4f 53 54 7c 4f |c_oflag||(OPOST|O|
|00005240| 4e 4c 43 52 29 29 3b 0a | 23 65 6c 73 65 0a 09 74 |NLCR));.|#else..t|
|00005250| 65 6d 70 5f 6d 6f 64 65 | 2e 63 5f 69 66 6c 61 67 |emp_mode|.c_iflag|
|00005260| 3d 28 74 74 79 5f 6d 6f | 64 65 2e 63 5f 69 66 6c |=(tty_mo|de.c_ifl|
|00005270| 61 67 7c 28 42 52 4b 49 | 4e 54 7c 49 47 4e 50 41 |ag|(BRKI|NT|IGNPA|
|00005280| 52 7c 49 43 52 4e 4c 7c | 49 58 4f 4e 29 29 3b 0a |R|ICRNL||IXON));.|
|00005290| 09 74 65 6d 70 5f 6d 6f | 64 65 2e 63 5f 63 66 6c |.temp_mo|de.c_cfl|
|000052a0| 61 67 3d 28 74 74 79 5f | 6d 6f 64 65 2e 63 5f 63 |ag=(tty_|mode.c_c|
|000052b0| 66 6c 61 67 7c 28 43 53 | 38 7c 43 52 45 41 44 29 |flag|(CS|8|CREAD)|
|000052c0| 29 3b 0a 23 65 6e 64 69 | 66 0a 09 74 65 6d 70 5f |);.#endi|f..temp_|
|000052d0| 6d 6f 64 65 2e 63 5f 6c | 66 6c 61 67 3d 28 74 74 |mode.c_l|flag=(tt|
|000052e0| 79 5f 6d 6f 64 65 2e 63 | 5f 6c 66 6c 61 67 7c 28 |y_mode.c|_lflag|(|
|000052f0| 49 53 49 47 7c 49 43 41 | 4e 4f 4e 7c 45 43 48 4f |ISIG|ICA|NON|ECHO|
|00005300| 7c 45 43 48 4f 45 7c 45 | 43 48 4f 4b 29 29 3b 0a ||ECHOE|E|CHOK));.|
|00005310| 09 74 65 6d 70 5f 6d 6f | 64 65 2e 63 5f 63 66 6c |.temp_mo|de.c_cfl|
|00005320| 61 67 3d 28 74 74 79 5f | 6d 6f 64 65 2e 63 5f 63 |ag=(tty_|mode.c_c|
|00005330| 66 6c 61 67 7c 28 43 53 | 37 7c 50 41 52 45 4e 42 |flag|(CS|7|PARENB|
|00005340| 7c 43 52 45 41 44 29 29 | 3b 0a 09 74 65 6d 70 5f ||CREAD))|;..temp_|
|00005350| 6d 6f 64 65 2e 63 5f 63 | 63 5b 56 45 52 41 53 45 |mode.c_c|c[VERASE|
|00005360| 5d 3d 28 27 48 27 5e 36 | 34 29 3b 0a 09 74 65 6d |]=('H'^6|4);..tem|
|00005370| 70 5f 6d 6f 64 65 2e 63 | 5f 63 63 5b 56 4b 49 4c |p_mode.c|_cc[VKIL|
|00005380| 4c 5d 3d 28 27 55 27 5e | 36 34 29 3b 0a 09 74 65 |L]=('U'^|64);..te|
|00005390| 6d 70 5f 6d 6f 64 65 2e | 63 5f 63 63 5b 56 51 55 |mp_mode.|c_cc[VQU|
|000053a0| 49 54 5d 3d 28 27 5c 5c | 27 5e 36 34 29 3b 0a 09 |IT]=('\\|'^64);..|
|000053b0| 74 65 6d 70 5f 6d 6f 64 | 65 2e 63 5f 63 63 5b 56 |temp_mod|e.c_cc[V|
|000053c0| 49 4e 54 52 5d 3d 28 27 | 43 27 5e 36 34 29 3b 0a |INTR]=('|C'^64);.|
|000053d0| 09 74 65 6d 70 5f 6d 6f | 64 65 2e 63 5f 63 63 5b |.temp_mo|de.c_cc[|
|000053e0| 56 45 4f 46 5d 3d 28 27 | 44 27 5e 36 34 29 3b 0a |VEOF]=('|D'^64);.|
|000053f0| 09 0a 09 2f 2a 20 54 43 | 53 45 54 41 57 20 69 73 |.../* TC|SETAW is|
|00005400| 20 69 6d 70 6f 72 74 61 | 6e 74 20 66 6f 72 20 6c | importa|nt for l|
|00005410| 65 74 74 69 6e 67 20 74 | 74 79 20 69 6e 70 75 74 |etting t|ty input|
|00005420| 20 64 72 61 69 6e 2e 20 | 2a 2f 0a 09 69 66 20 28 | drain. |*/..if (|
|00005430| 20 69 6f 63 74 6c 28 66 | 64 2c 20 54 43 53 45 54 | ioctl(f|d, TCSET|
|00005440| 41 57 2c 20 28 63 68 61 | 72 20 2a 29 26 74 65 6d |AW, (cha|r *)&tem|
|00005450| 70 5f 6d 6f 64 65 29 20 | 3c 20 30 20 29 0a 09 7b |p_mode) |< 0 )..{|
|00005460| 0a 23 69 66 64 65 66 20 | 44 45 42 55 47 0a 09 09 |.#ifdef |DEBUG...|
|00005470| 70 65 72 72 6f 72 28 22 | 43 61 6e 27 74 20 73 65 |perror("|Can't se|
|00005480| 74 20 74 74 79 20 6d 6f | 64 65 73 22 29 3b 0a 23 |t tty mo|des");.#|
|00005490| 65 6e 64 69 66 0a 09 09 | 72 65 74 75 72 6e 28 2d |endif...|return(-|
|000054a0| 31 29 3b 0a 09 7d 0a 0a | 09 72 65 74 75 72 6e 28 |1);..}..|.return(|
|000054b0| 30 29 3b 0a 7d 0a 0a 0a | 2f 2a 20 53 65 74 20 61 |0);.}...|/* Set a|
|000054c0| 20 74 65 72 6d 69 6e 61 | 6c 20 69 6e 20 72 61 77 | termina|l in raw|
|000054d0| 20 6d 6f 64 65 20 2a 2f | 0a 0a 69 6e 74 20 74 74 | mode */|..int tt|
|000054e0| 79 5f 72 61 77 28 66 64 | 29 0a 69 6e 74 20 66 64 |y_raw(fd|).int fd|
|000054f0| 3b 20 20 20 20 20 2f 2a | 20 6f 66 20 74 74 79 20 |; /*| of tty |
|00005500| 64 65 76 69 63 65 20 2a | 2f 0a 7b 0a 09 73 74 72 |device *|/.{..str|
|00005510| 75 63 74 20 74 65 72 6d | 69 6f 20 74 65 6d 70 5f |uct term|io temp_|
|00005520| 6d 6f 64 65 3b 0a 0a 09 | 69 66 20 28 20 21 20 74 |mode;...|if ( ! t|
|00005530| 74 79 5f 69 6e 69 74 20 | 29 0a 09 09 72 65 74 75 |ty_init |)...retu|
|00005540| 72 6e 28 2d 31 29 3b 0a | 0a 09 69 66 20 28 20 21 |rn(-1);.|..if ( !|
|00005550| 20 69 73 61 74 74 79 28 | 66 64 29 20 29 0a 09 09 | isatty(|fd) )...|
|00005560| 72 65 74 75 72 6e 28 30 | 29 3b 0a 0a 09 69 66 20 |return(0|);...if |
|00005570| 28 20 69 6f 63 74 6c 28 | 66 64 2c 20 54 43 47 45 |( ioctl(|fd, TCGE|
|00005580| 54 41 2c 20 28 63 68 61 | 72 20 2a 29 26 74 65 6d |TA, (cha|r *)&tem|
|00005590| 70 5f 6d 6f 64 65 29 20 | 3c 20 30 20 29 0a 09 09 |p_mode) |< 0 )...|
|000055a0| 72 65 74 75 72 6e 28 2d | 31 29 3b 0a 0a 23 69 66 |return(-|1);..#if|
|000055b0| 64 65 66 20 53 45 56 45 | 4e 5f 42 49 54 0a 09 74 |def SEVE|N_BIT..t|
|000055c0| 65 6d 70 5f 6d 6f 64 65 | 2e 63 5f 69 66 6c 61 67 |emp_mode|.c_iflag|
|000055d0| 3d 28 49 47 4e 42 52 4b | 20 7c 20 49 53 54 52 49 |=(IGNBRK| | ISTRI|
|000055e0| 50 29 3b 09 2f 2a 20 74 | 75 72 6e 20 6f 66 66 20 |P);./* t|urn off |
|000055f0| 61 6c 6c 20 69 6e 70 75 | 74 20 63 6f 6e 74 72 6f |all inpu|t contro|
|00005600| 6c 20 2a 2f 0a 23 65 6c | 73 65 0a 09 74 65 6d 70 |l */.#el|se..temp|
|00005610| 5f 6d 6f 64 65 2e 63 5f | 69 66 6c 61 67 3d 28 49 |_mode.c_|iflag=(I|
|00005620| 47 4e 42 52 4b 29 3b 09 | 09 2f 2a 20 74 75 72 6e |GNBRK);.|./* turn|
|00005630| 20 6f 66 66 20 61 6c 6c | 20 69 6e 70 75 74 20 63 | off all| input c|
|00005640| 6f 6e 74 72 6f 6c 20 2a | 2f 0a 23 65 6e 64 69 66 |ontrol *|/.#endif|
|00005650| 0a 09 74 65 6d 70 5f 6d | 6f 64 65 2e 63 5f 6f 66 |..temp_m|ode.c_of|
|00005660| 6c 61 67 20 26 3d 20 7e | 28 4f 4c 43 55 43 20 7c |lag &= ~|(OLCUC ||
|00005670| 20 4f 4e 4c 43 52 20 7c | 20 4f 43 52 4e 4c 20 7c | ONLCR || OCRNL ||
|00005680| 20 4f 4e 4c 52 45 54 29 | 3b 0a 09 09 09 09 09 2f | ONLRET)|;....../|
|00005690| 2a 20 64 69 73 61 62 6c | 65 20 6f 75 74 70 75 74 |* disabl|e output|
|000056a0| 20 70 6f 73 74 2d 70 72 | 6f 63 65 73 73 69 6e 67 | post-pr|ocessing|
|000056b0| 20 2a 2f 0a 09 74 65 6d | 70 5f 6d 6f 64 65 2e 63 | */..tem|p_mode.c|
|000056c0| 5f 6c 66 6c 61 67 20 3d | 20 30 3b 0a 09 74 65 6d |_lflag =| 0;..tem|
|000056d0| 70 5f 6d 6f 64 65 2e 63 | 5f 63 63 5b 56 4d 49 4e |p_mode.c|_cc[VMIN|
|000056e0| 5d 3d 31 3b 09 09 2f 2a | 20 31 20 6f 72 20 6d 6f |]=1;../*| 1 or mo|
|000056f0| 72 65 20 63 68 61 72 73 | 20 73 61 74 69 73 66 79 |re chars| satisfy|
|00005700| 20 72 65 61 64 20 2a 2f | 0a 09 74 65 6d 70 5f 6d | read */|..temp_m|
|00005710| 6f 64 65 2e 63 5f 63 63 | 5b 56 54 49 4d 45 5d 3d |ode.c_cc|[VTIME]=|
|00005720| 30 3b 09 2f 2a 20 31 30 | 27 74 68 73 20 6f 66 20 |0;./* 10|'ths of |
|00005730| 73 65 63 6f 6e 64 73 20 | 62 65 74 77 65 65 6e 20 |seconds |between |
|00005740| 63 68 61 72 73 20 2a 2f | 0a 0a 09 2f 2a 20 54 43 |chars */|.../* TC|
|00005750| 53 45 54 41 57 20 69 73 | 20 69 6d 70 6f 72 74 61 |SETAW is| importa|
|00005760| 6e 74 20 66 6f 72 20 6c | 65 74 74 69 6e 67 20 74 |nt for l|etting t|
|00005770| 74 79 20 69 6e 70 75 74 | 20 64 72 61 69 6e 2e 20 |ty input| drain. |
|00005780| 2a 2f 0a 09 69 66 20 28 | 69 6f 63 74 6c 28 66 64 |*/..if (|ioctl(fd|
|00005790| 2c 20 54 43 53 45 54 41 | 57 2c 20 28 63 68 61 72 |, TCSETA|W, (char|
|000057a0| 20 2a 29 20 26 74 65 6d | 70 5f 6d 6f 64 65 29 20 | *) &tem|p_mode) |
|000057b0| 3c 20 30 29 0a 09 09 72 | 65 74 75 72 6e 28 2d 31 |< 0)...r|eturn(-1|
|000057c0| 29 3b 0a 09 72 65 74 75 | 72 6e 28 30 29 3b 0a 7d |);..retu|rn(0);.}|
|000057d0| 0a 0a 0a 2f 2a 20 52 65 | 73 74 6f 72 65 20 74 65 |.../* Re|store te|
|000057e0| 72 6d 69 6e 61 6c 27 73 | 20 6d 6f 64 65 20 74 6f |rminal's| mode to|
|000057f0| 20 77 68 61 74 65 76 65 | 72 20 69 74 20 77 61 73 | whateve|r it was|
|00005800| 20 6f 6e 20 74 68 65 20 | 6d 6f 73 74 0a 20 20 20 | on the |most. |
|00005810| 72 65 63 65 6e 74 20 63 | 61 6c 6c 20 74 6f 20 74 |recent c|all to t|
|00005820| 68 65 20 74 74 79 5f 67 | 65 74 6d 6f 64 65 28 29 |he tty_g|etmode()|
|00005830| 20 66 75 6e 63 74 69 6f | 6e 2e 20 2a 2f 0a 0a 69 | functio|n. */..i|
|00005840| 6e 74 20 74 74 79 5f 72 | 65 73 65 74 28 66 64 29 |nt tty_r|eset(fd)|
|00005850| 0a 69 6e 74 20 66 64 3b | 0a 7b 0a 09 69 66 20 28 |.int fd;|.{..if (|
|00005860| 20 21 20 74 74 79 5f 69 | 6e 69 74 20 29 0a 09 09 | ! tty_i|nit )...|
|00005870| 72 65 74 75 72 6e 28 2d | 31 29 3b 0a 0a 09 69 66 |return(-|1);...if|
|00005880| 20 28 20 21 20 69 73 61 | 74 74 79 28 66 64 29 20 | ( ! isa|tty(fd) |
|00005890| 29 0a 09 09 72 65 74 75 | 72 6e 28 30 29 3b 0a 0a |)...retu|rn(0);..|
|000058a0| 09 2f 2a 20 54 43 53 45 | 54 41 57 20 69 73 20 69 |./* TCSE|TAW is i|
|000058b0| 6d 70 6f 72 74 61 6e 74 | 20 66 6f 72 20 6c 65 74 |mportant| for let|
|000058c0| 74 69 6e 67 20 74 74 79 | 20 69 6e 70 75 74 20 64 |ting tty| input d|
|000058d0| 72 61 69 6e 2e 20 2a 2f | 0a 09 69 66 20 28 69 6f |rain. */|..if (io|
|000058e0| 63 74 6c 28 66 64 2c 20 | 54 43 53 45 54 41 57 2c |ctl(fd, |TCSETAW,|
|000058f0| 20 28 63 68 61 72 20 2a | 29 20 26 74 74 79 5f 6d | (char *|) &tty_m|
|00005900| 6f 64 65 29 20 3c 20 30 | 29 0a 09 09 72 65 74 75 |ode) < 0|)...retu|
|00005910| 72 6e 28 2d 31 29 3b 0a | 09 72 65 74 75 72 6e 28 |rn(-1);.|.return(|
|00005920| 30 29 3b 0a 7d 0a 0a 23 | 65 6c 73 65 20 20 2f 2a |0);.}..#|else /*|
|00005930| 20 6e 6f 20 2f 75 73 72 | 2f 69 6e 63 6c 75 64 65 | no /usr|/include|
|00005940| 2f 74 65 72 6d 69 6f 2e | 68 20 2a 2f 0a 23 69 66 |/termio.|h */.#if|
|00005950| 64 65 66 20 4e 45 45 44 | 5f 43 4f 4d 50 41 54 5f |def NEED|_COMPAT_|
|00005960| 48 09 09 2f 2a 20 46 72 | 65 65 42 53 44 20 6e 65 |H../* Fr|eeBSD ne|
|00005970| 65 64 73 20 74 68 69 73 | 20 2a 2f 0a 23 69 6e 63 |eds this| */.#inc|
|00005980| 6c 75 64 65 20 3c 73 79 | 73 2f 69 6f 63 74 6c 5f |lude <sy|s/ioctl_|
|00005990| 63 6f 6d 70 61 74 2e 68 | 3e 0a 23 65 6e 64 69 66 |compat.h|>.#endif|
|000059a0| 20 2f 2a 20 4e 45 45 44 | 5f 43 4f 4d 50 41 54 5f | /* NEED|_COMPAT_|
|000059b0| 48 20 2a 2f 0a 0a 2f 2a | 20 53 65 74 20 61 20 74 |H */../*| Set a t|
|000059c0| 74 79 20 74 6f 20 61 20 | 73 61 6e 65 20 6d 6f 64 |ty to a |sane mod|
|000059d0| 65 20 2a 2f 0a 0a 69 6e | 74 20 74 74 79 5f 73 61 |e */..in|t tty_sa|
|000059e0| 6e 65 28 66 64 29 0a 69 | 6e 74 20 66 64 3b 0a 7b |ne(fd).i|nt fd;.{|
|000059f0| 0a 09 73 74 72 75 63 74 | 20 73 67 74 74 79 62 20 |..struct| sgttyb |
|00005a00| 74 65 6d 70 5f 6d 6f 64 | 65 3b 0a 0a 09 69 66 20 |temp_mod|e;...if |
|00005a10| 28 20 21 20 69 73 61 74 | 74 79 28 66 64 29 20 29 |( ! isat|ty(fd) )|
|00005a20| 0a 09 09 72 65 74 75 72 | 6e 28 30 29 3b 0a 0a 09 |...retur|n(0);...|
|00005a30| 69 66 20 28 69 6f 63 74 | 6c 28 66 64 2c 20 54 49 |if (ioct|l(fd, TI|
|00005a40| 4f 43 47 45 54 50 2c 20 | 28 63 68 61 72 20 2a 29 |OCGETP, |(char *)|
|00005a50| 20 26 74 65 6d 70 5f 6d | 6f 64 65 29 20 3c 20 30 | &temp_m|ode) < 0|
|00005a60| 29 0a 09 09 72 65 74 75 | 72 6e 28 2d 31 29 3b 0a |)...retu|rn(-1);.|
|00005a70| 0a 09 74 65 6d 70 5f 6d | 6f 64 65 2e 73 67 5f 66 |..temp_m|ode.sg_f|
|00005a80| 6c 61 67 73 7c 3d 45 43 | 48 4f 3b 0a 09 0a 09 69 |lags|=EC|HO;....i|
|00005a90| 66 20 28 69 6f 63 74 6c | 28 66 64 2c 20 54 49 4f |f (ioctl|(fd, TIO|
|00005aa0| 43 53 45 54 50 2c 20 28 | 63 68 61 72 20 2a 29 20 |CSETP, (|char *) |
|00005ab0| 26 74 65 6d 70 5f 6d 6f | 64 65 29 20 3c 20 30 29 |&temp_mo|de) < 0)|
|00005ac0| 0a 09 09 72 65 74 75 72 | 6e 28 2d 31 29 3b 0a 0a |...retur|n(-1);..|
|00005ad0| 09 72 65 74 75 72 6e 28 | 30 29 3b 0a 7d 0a 0a 0a |.return(|0);.}...|
|00005ae0| 0a 2f 2a 20 47 65 74 20 | 74 68 65 20 6d 6f 64 65 |./* Get |the mode|
|00005af0| 73 20 6f 66 20 74 68 65 | 20 63 6f 6e 74 72 6f 6c |s of the| control|
|00005b00| 6c 69 6e 67 20 74 74 79 | 20 61 6e 64 20 73 61 76 |ling tty| and sav|
|00005b10| 65 20 74 68 65 6d 2e 20 | 20 53 61 76 65 73 0a 20 |e them. | Saves. |
|00005b20| 20 20 74 74 79 6d 6f 64 | 65 73 20 69 6e 20 74 74 | ttymod|es in tt|
|00005b30| 79 5f 6d 6f 64 65 20 61 | 6e 64 20 72 65 74 75 72 |y_mode a|nd retur|
|00005b40| 6e 73 20 31 20 69 66 20 | 69 6f 63 74 6c 20 66 61 |ns 1 if |ioctl fa|
|00005b50| 69 6c 73 2e 20 2a 2f 0a | 0a 73 74 61 74 69 63 20 |ils. */.|.static |
|00005b60| 73 74 72 75 63 74 20 73 | 67 74 74 79 62 09 74 74 |struct s|gttyb.tt|
|00005b70| 79 5f 6d 6f 64 65 3b 09 | 2f 2a 20 73 61 76 65 20 |y_mode;.|/* save |
|00005b80| 74 74 79 20 6d 6f 64 65 | 20 68 65 72 65 20 2a 2f |tty mode| here */|
|00005b90| 0a 0a 69 6e 74 20 74 74 | 79 5f 67 65 74 6d 6f 64 |..int tt|y_getmod|
|00005ba0| 65 28 66 64 29 0a 69 6e | 74 20 66 64 3b 0a 7b 0a |e(fd).in|t fd;.{.|
|00005bb0| 09 69 66 20 28 20 21 20 | 69 73 61 74 74 79 28 66 |.if ( ! |isatty(f|
|00005bc0| 64 29 20 29 0a 09 09 72 | 65 74 75 72 6e 28 30 29 |d) )...r|eturn(0)|
|00005bd0| 3b 0a 0a 09 69 66 20 28 | 69 6f 63 74 6c 28 66 64 |;...if (|ioctl(fd|
|00005be0| 2c 20 54 49 4f 43 47 45 | 54 50 2c 20 28 63 68 61 |, TIOCGE|TP, (cha|
|00005bf0| 72 20 2a 29 20 26 74 74 | 79 5f 6d 6f 64 65 29 20 |r *) &tt|y_mode) |
|00005c00| 3c 20 30 29 0a 09 09 72 | 65 74 75 72 6e 28 2d 31 |< 0)...r|eturn(-1|
|00005c10| 29 3b 0a 0a 09 72 65 74 | 75 72 6e 28 30 29 3b 0a |);...ret|urn(0);.|
|00005c20| 7d 0a 0a 2f 2a 0a 20 2a | 20 50 75 74 20 61 20 74 |}../*. *| Put a t|
|00005c30| 65 72 6d 69 6e 61 6c 20 | 64 65 76 69 63 65 20 69 |erminal |device i|
|00005c40| 6e 74 6f 20 52 41 57 20 | 6d 6f 64 65 20 77 69 74 |nto RAW |mode wit|
|00005c50| 68 20 45 43 48 4f 20 6f | 66 66 2e 0a 20 2a 20 42 |h ECHO o|ff.. * B|
|00005c60| 65 66 6f 72 65 20 64 6f | 69 6e 67 20 73 6f 20 77 |efore do|ing so w|
|00005c70| 65 20 66 69 72 73 74 20 | 73 61 76 65 20 74 68 65 |e first |save the|
|00005c80| 20 74 65 72 6d 69 6e 61 | 6c 27 73 20 63 75 72 72 | termina|l's curr|
|00005c90| 65 6e 74 20 6d 6f 64 65 | 2c 0a 20 2a 20 61 73 73 |ent mode|,. * ass|
|00005ca0| 75 6d 69 6e 67 20 74 68 | 65 20 63 61 6c 6c 65 72 |uming th|e caller|
|00005cb0| 20 77 69 6c 6c 20 63 61 | 6c 6c 20 74 68 65 20 74 | will ca|ll the t|
|00005cc0| 74 79 5f 72 65 73 65 74 | 28 29 20 66 75 6e 63 74 |ty_reset|() funct|
|00005cd0| 69 6f 6e 0a 20 2a 20 28 | 61 6c 73 6f 20 69 6e 20 |ion. * (|also in |
|00005ce0| 74 68 69 73 20 66 69 6c | 65 29 20 77 68 65 6e 20 |this fil|e) when |
|00005cf0| 69 74 27 73 20 64 6f 6e | 65 20 77 69 74 68 20 72 |it's don|e with r|
|00005d00| 61 77 20 6d 6f 64 65 2e | 0a 20 2a 2f 0a 0a 69 6e |aw mode.|. */..in|
|00005d10| 74 20 74 74 79 5f 72 61 | 77 28 66 64 29 0a 69 6e |t tty_ra|w(fd).in|
|00005d20| 74 09 66 64 3b 09 09 2f | 2a 20 6f 66 20 74 65 72 |t.fd;../|* of ter|
|00005d30| 6d 69 6e 61 6c 20 64 65 | 76 69 63 65 20 2a 2f 0a |minal de|vice */.|
|00005d40| 7b 0a 09 73 74 72 75 63 | 74 20 73 67 74 74 79 62 |{..struc|t sgttyb|
|00005d50| 09 74 65 6d 70 5f 6d 6f | 64 65 3b 0a 0a 09 69 66 |.temp_mo|de;...if|
|00005d60| 20 28 20 21 20 69 73 61 | 74 74 79 28 66 64 29 20 | ( ! isa|tty(fd) |
|00005d70| 29 0a 09 09 72 65 74 75 | 72 6e 28 30 29 3b 0a 0a |)...retu|rn(0);..|
|00005d80| 09 74 65 6d 70 5f 6d 6f | 64 65 20 3d 20 74 74 79 |.temp_mo|de = tty|
|00005d90| 5f 6d 6f 64 65 3b 0a 0a | 09 74 65 6d 70 5f 6d 6f |_mode;..|.temp_mo|
|00005da0| 64 65 2e 73 67 5f 66 6c | 61 67 73 20 7c 3d 20 52 |de.sg_fl|ags |= R|
|00005db0| 41 57 3b 09 2f 2a 20 74 | 75 72 6e 20 52 41 57 20 |AW;./* t|urn RAW |
|00005dc0| 6d 6f 64 65 20 6f 6e 20 | 2a 2f 0a 09 74 65 6d 70 |mode on |*/..temp|
|00005dd0| 5f 6d 6f 64 65 2e 73 67 | 5f 66 6c 61 67 73 20 26 |_mode.sg|_flags &|
|00005de0| 3d 20 7e 45 43 48 4f 3b | 09 2f 2a 20 74 75 72 6e |= ~ECHO;|./* turn|
|00005df0| 20 45 43 48 4f 20 6f 66 | 66 20 2a 2f 0a 09 69 66 | ECHO of|f */..if|
|00005e00| 20 28 69 6f 63 74 6c 28 | 66 64 2c 20 54 49 4f 43 | (ioctl(|fd, TIOC|
|00005e10| 53 45 54 50 2c 20 28 63 | 68 61 72 20 2a 29 20 26 |SETP, (c|har *) &|
|00005e20| 74 65 6d 70 5f 6d 6f 64 | 65 29 20 3c 20 30 29 0a |temp_mod|e) < 0).|
|00005e30| 09 09 72 65 74 75 72 6e | 28 2d 31 29 3b 0a 0a 09 |..return|(-1);...|
|00005e40| 72 65 74 75 72 6e 28 30 | 29 3b 0a 7d 0a 0a 2f 2a |return(0|);.}../*|
|00005e50| 0a 20 2a 20 52 65 73 74 | 6f 72 65 20 61 20 74 65 |. * Rest|ore a te|
|00005e60| 72 6d 69 6e 61 6c 27 73 | 20 6d 6f 64 65 20 74 6f |rminal's| mode to|
|00005e70| 20 77 68 61 74 65 76 65 | 72 20 69 74 20 77 61 73 | whateve|r it was|
|00005e80| 20 6f 6e 20 74 68 65 20 | 6d 6f 73 74 0a 20 2a 20 | on the |most. * |
|00005e90| 72 65 63 65 6e 74 20 63 | 61 6c 6c 20 74 6f 20 74 |recent c|all to t|
|00005ea0| 68 65 20 74 74 79 5f 67 | 65 74 6d 6f 64 65 28 29 |he tty_g|etmode()|
|00005eb0| 20 66 75 6e 63 74 69 6f | 6e 20 61 62 6f 76 65 2e | functio|n above.|
|00005ec0| 0a 20 2a 2f 0a 0a 69 6e | 74 20 74 74 79 5f 72 65 |. */..in|t tty_re|
|00005ed0| 73 65 74 28 66 64 29 0a | 69 6e 74 09 66 64 3b 09 |set(fd).|int.fd;.|
|00005ee0| 09 2f 2a 20 6f 66 20 74 | 65 72 6d 69 6e 61 6c 20 |./* of t|erminal |
|00005ef0| 64 65 76 69 63 65 20 2a | 2f 0a 7b 0a 09 69 66 20 |device *|/.{..if |
|00005f00| 28 20 21 20 69 73 61 74 | 74 79 28 66 64 29 20 29 |( ! isat|ty(fd) )|
|00005f10| 0a 09 09 72 65 74 75 72 | 6e 28 30 29 3b 0a 0a 09 |...retur|n(0);...|
|00005f20| 69 66 20 28 69 6f 63 74 | 6c 28 66 64 2c 20 54 49 |if (ioct|l(fd, TI|
|00005f30| 4f 43 53 45 54 50 2c 20 | 28 63 68 61 72 20 2a 29 |OCSETP, |(char *)|
|00005f40| 20 26 74 74 79 5f 6d 6f | 64 65 29 20 3c 20 30 29 | &tty_mo|de) < 0)|
|00005f50| 0a 09 09 72 65 74 75 72 | 6e 28 2d 31 29 3b 0a 0a |...retur|n(-1);..|
|00005f60| 09 72 65 74 75 72 6e 28 | 30 29 3b 0a 7d 0a 23 65 |.return(|0);.}.#e|
|00005f70| 6e 64 69 66 20 2f 2a 20 | 48 41 56 45 5f 54 45 52 |ndif /* |HAVE_TER|
|00005f80| 4d 49 4f 5f 48 20 2a 2f | 0a 0a 0a 2f 2a 20 53 65 |MIO_H */|.../* Se|
|00005f90| 74 20 74 68 65 20 70 74 | 79 20 77 69 6e 64 6f 77 |t the pt|y window|
|00005fa0| 20 73 69 7a 65 20 74 6f | 20 74 68 65 20 73 69 7a | size to| the siz|
|00005fb0| 65 20 6f 66 20 74 68 65 | 20 76 69 72 74 75 61 6c |e of the| virtual|
|00005fc0| 20 77 69 6e 64 6f 77 20 | 2a 2f 0a 0a 23 69 66 64 | window |*/..#ifd|
|00005fd0| 65 66 20 54 49 4f 43 53 | 57 49 4e 53 5a 0a 0a 73 |ef TIOCS|WINSZ..s|
|00005fe0| 74 61 74 69 63 20 73 74 | 72 75 63 74 20 2f 2a 20 |tatic st|ruct /* |
|00005ff0| 77 69 6e 73 69 7a 65 20 | 2a 2f 20 7b 0a 09 09 75 |winsize |*/ {...u|
|00006000| 6e 73 69 67 6e 65 64 20 | 73 68 6f 72 74 09 77 73 |nsigned |short.ws|
|00006010| 5f 72 6f 77 3b 09 09 2f | 2a 20 72 6f 77 73 2c 20 |_row;../|* rows, |
|00006020| 69 6e 20 63 68 61 72 61 | 63 74 65 72 73 20 2a 2f |in chara|cters */|
|00006030| 0a 09 09 75 6e 73 69 67 | 6e 65 64 20 73 68 6f 72 |...unsig|ned shor|
|00006040| 74 09 77 73 5f 63 6f 6c | 3b 09 09 2f 2a 20 63 6f |t.ws_col|;../* co|
|00006050| 6c 75 6d 6e 73 2c 20 69 | 6e 20 63 68 61 72 61 63 |lumns, i|n charac|
|00006060| 74 65 72 73 20 2a 2f 0a | 09 09 75 6e 73 69 67 6e |ters */.|..unsign|
|00006070| 65 64 20 73 68 6f 72 74 | 09 77 73 5f 78 70 69 78 |ed short|.ws_xpix|
|00006080| 65 6c 3b 09 2f 2a 20 68 | 6f 72 69 7a 6f 6e 74 61 |el;./* h|orizonta|
|00006090| 6c 20 73 69 7a 65 20 2d | 20 6e 6f 74 20 75 73 65 |l size -| not use|
|000060a0| 64 20 2a 2f 0a 09 09 75 | 6e 73 69 67 6e 65 64 20 |d */...u|nsigned |
|000060b0| 73 68 6f 72 74 09 77 73 | 5f 79 70 69 78 65 6c 3b |short.ws|_ypixel;|
|000060c0| 09 2f 2a 20 76 65 72 74 | 69 63 61 6c 20 73 69 7a |./* vert|ical siz|
|000060d0| 65 20 2d 20 6e 6f 74 20 | 75 73 65 64 20 2a 2f 0a |e - not |used */.|
|000060e0| 09 7d 20 6d 79 77 69 6e | 7a 3b 0a 0a 76 6f 69 64 |.} mywin|z;..void|
|000060f0| 20 70 74 79 5f 73 65 74 | 77 69 6e 28 66 64 2c 20 | pty_set|win(fd, |
|00006100| 77 69 6e 29 0a 69 6e 74 | 20 66 64 3b 09 09 09 2f |win).int| fd;.../|
|00006110| 2a 20 54 68 65 20 70 74 | 79 20 66 69 6c 65 20 64 |* The pt|y file d|
|00006120| 65 73 63 72 69 70 74 6f | 72 20 2a 2f 0a 69 6e 74 |escripto|r */.int|
|00006130| 20 77 69 6e 3b 09 09 2f | 2a 20 30 20 66 6f 72 20 | win;../|* 0 for |
|00006140| 75 70 70 65 72 2c 20 31 | 20 66 6f 72 20 6c 6f 77 |upper, 1| for low|
|00006150| 65 72 20 77 69 6e 64 6f | 77 20 2a 2f 0a 7b 0a 09 |er windo|w */.{..|
|00006160| 69 66 20 28 20 77 69 6e | 20 3d 3d 20 55 50 50 45 |if ( win| == UPPE|
|00006170| 52 20 29 0a 09 09 6d 79 | 77 69 6e 7a 2e 77 73 5f |R )...my|winz.ws_|
|00006180| 72 6f 77 3d 57 55 5f 6c | 69 6e 65 73 3b 0a 09 65 |row=WU_l|ines;..e|
|00006190| 6c 73 65 0a 09 09 6d 79 | 77 69 6e 7a 2e 77 73 5f |lse...my|winz.ws_|
|000061a0| 72 6f 77 3d 57 4c 5f 6c | 69 6e 65 73 3b 0a 09 6d |row=WL_l|ines;..m|
|000061b0| 79 77 69 6e 7a 2e 77 73 | 5f 63 6f 6c 3d 57 5f 63 |ywinz.ws|_col=W_c|
|000061c0| 6f 6c 75 6d 6e 73 3b 0a | 09 6d 79 77 69 6e 7a 2e |olumns;.|.mywinz.|
|000061d0| 77 73 5f 78 70 69 78 65 | 6c 3d 30 3b 0a 09 6d 79 |ws_xpixe|l=0;..my|
|000061e0| 77 69 6e 7a 2e 77 73 5f | 79 70 69 78 65 6c 3d 30 |winz.ws_|ypixel=0|
|000061f0| 3b 0a 09 28 76 6f 69 64 | 29 20 69 6f 63 74 6c 28 |;..(void|) ioctl(|
|00006200| 66 64 2c 20 54 49 4f 43 | 53 57 49 4e 53 5a 2c 20 |fd, TIOC|SWINSZ, |
|00006210| 26 6d 79 77 69 6e 7a 29 | 3b 0a 7d 0a 0a 23 65 6c |&mywinz)|;.}..#el|
|00006220| 73 65 0a 76 6f 69 64 20 | 70 74 79 5f 73 65 74 77 |se.void |pty_setw|
|00006230| 69 6e 28 66 64 2c 20 77 | 69 6e 29 0a 69 6e 74 20 |in(fd, w|in).int |
|00006240| 66 64 3b 0a 69 6e 74 20 | 77 69 6e 3b 0a 7b 0a 09 |fd;.int |win;.{..|
|00006250| 2f 2a 20 42 6f 67 75 73 | 20 72 6f 75 74 69 6e 65 |/* Bogus| routine|
|00006260| 20 2a 2f 0a 7d 0a 23 65 | 6e 64 69 66 20 2f 2a 20 | */.}.#e|ndif /* |
|00006270| 54 49 4f 43 53 57 49 4e | 53 5a 20 2a 2f 0a 0a 2f |TIOCSWIN|SZ */../|
|00006280| 2a 0a 20 2a 20 57 72 69 | 74 65 20 22 6e 22 20 62 |*. * Wri|te "n" b|
|00006290| 79 74 65 73 20 74 6f 20 | 61 20 64 65 73 63 72 69 |ytes to |a descri|
|000062a0| 70 74 6f 72 2e 0a 20 2a | 20 55 73 65 20 69 6e 20 |ptor.. *| Use in |
|000062b0| 70 6c 61 63 65 20 6f 66 | 20 77 72 69 74 65 28 29 |place of| write()|
|000062c0| 20 77 68 65 6e 20 66 64 | 20 69 73 20 61 20 73 74 | when fd| is a st|
|000062d0| 72 65 61 6d 20 73 6f 63 | 6b 65 74 2e 0a 20 2a 2f |ream soc|ket.. */|
|000062e0| 0a 0a 69 6e 74 20 77 72 | 69 74 65 6e 28 66 64 2c |..int wr|iten(fd,|
|000062f0| 20 70 74 72 2c 20 6e 62 | 79 74 65 73 29 0a 72 65 | ptr, nb|ytes).re|
|00006300| 67 69 73 74 65 72 20 69 | 6e 74 09 66 64 3b 0a 72 |gister i|nt.fd;.r|
|00006310| 65 67 69 73 74 65 72 20 | 63 68 61 72 09 2a 70 74 |egister |char.*pt|
|00006320| 72 3b 0a 72 65 67 69 73 | 74 65 72 20 69 6e 74 09 |r;.regis|ter int.|
|00006330| 6e 62 79 74 65 73 3b 0a | 7b 0a 09 69 6e 74 09 6e |nbytes;.|{..int.n|
|00006340| 6c 65 66 74 2c 20 6e 77 | 72 69 74 74 65 6e 3b 0a |left, nw|ritten;.|
|00006350| 0a 09 6e 6c 65 66 74 20 | 3d 20 6e 62 79 74 65 73 |..nleft |= nbytes|
|00006360| 3b 0a 09 77 68 69 6c 65 | 20 28 6e 6c 65 66 74 20 |;..while| (nleft |
|00006370| 3e 20 30 29 20 7b 0a 09 | 09 6e 77 72 69 74 74 65 |> 0) {..|.nwritte|
|00006380| 6e 20 3d 20 77 72 69 74 | 65 28 66 64 2c 20 70 74 |n = writ|e(fd, pt|
|00006390| 72 2c 20 6e 6c 65 66 74 | 29 3b 0a 09 09 69 66 20 |r, nleft|);...if |
|000063a0| 28 6e 77 72 69 74 74 65 | 6e 20 3c 3d 20 30 29 0a |(nwritte|n <= 0).|
|000063b0| 09 09 09 72 65 74 75 72 | 6e 28 6e 77 72 69 74 74 |...retur|n(nwritt|
|000063c0| 65 6e 29 3b 09 09 2f 2a | 20 65 72 72 6f 72 20 2a |en);../*| error *|
|000063d0| 2f 0a 0a 09 09 6e 6c 65 | 66 74 20 2d 3d 20 6e 77 |/....nle|ft -= nw|
|000063e0| 72 69 74 74 65 6e 3b 0a | 09 09 70 74 72 20 20 20 |ritten;.|..ptr |
|000063f0| 2b 3d 20 6e 77 72 69 74 | 74 65 6e 3b 0a 09 7d 0a |+= nwrit|ten;..}.|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.