home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / unix / volume15 / modem.ctl < prev    next >
SHell self-extracting ARchive  |  1989-01-13  |  35.1 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: SHell self-extracting ARchive (archive/shar).

You can browse this item here: modem.ctl

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert SHell self-extracting ARchive (archive/shar) magic Supported
1% dexvert LabVIEW Control data (other/labVIEWControlData) ext Unsupported
1% dexvert Text File (text/txt) fallback Supported
100% file ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/329 Shell Archive Format default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/rfc822 default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 53 75 62 6a 65 63 74 3a | 20 20 76 31 35 69 30 31 |Subject:| v15i01|
|00000010| 30 3a 20 20 55 55 43 50 | 2f 43 55 20 61 63 63 65 |0: UUCP|/CU acce|
|00000020| 73 73 20 6f 6e 20 6f 6e | 65 20 6d 6f 64 65 6d 0a |ss on on|e modem.|
|00000030| 4e 65 77 73 67 72 6f 75 | 70 73 3a 20 63 6f 6d 70 |Newsgrou|ps: comp|
|00000040| 2e 73 6f 75 72 63 65 73 | 2e 75 6e 69 78 0a 41 70 |.sources|.unix.Ap|
|00000050| 70 72 6f 76 65 64 3a 20 | 72 73 61 6c 7a 40 75 75 |proved: |rsalz@uu|
|00000060| 6e 65 74 2e 55 55 2e 4e | 45 54 0a 0a 53 75 62 6d |net.UU.N|ET..Subm|
|00000070| 69 74 74 65 64 2d 62 79 | 3a 20 44 61 76 65 20 53 |itted-by|: Dave S|
|00000080| 65 74 74 6c 65 20 3c 4e | 6f 20 6e 65 74 20 61 64 |ettle <N|o net ad|
|00000090| 64 72 65 73 73 3e 0a 50 | 6f 73 74 69 6e 67 2d 6e |dress>.P|osting-n|
|000000a0| 75 6d 62 65 72 3a 20 56 | 6f 6c 75 6d 65 20 31 35 |umber: V|olume 15|
|000000b0| 2c 20 49 73 73 75 65 20 | 31 30 0a 41 72 63 68 69 |, Issue |10.Archi|
|000000c0| 76 65 2d 6e 61 6d 65 3a | 20 75 6c 74 72 69 78 2d |ve-name:| ultrix-|
|000000d0| 6d 6f 64 65 6d 0a 0a 5b | 20 20 53 65 65 6d 73 20 |modem..[| Seems |
|000000e0| 6f 72 69 65 6e 74 65 64 | 20 74 6f 77 61 72 64 20 |oriented| toward |
|000000f0| 53 79 73 74 65 6d 20 56 | 2d 6f 69 64 20 6d 61 63 |System V|-oid mac|
|00000100| 68 69 6e 65 73 2e 2e 2e | 20 20 2d 2d 72 24 20 20 |hines...| --r$ |
|00000110| 5d 0a 0a 09 49 27 6d 20 | 73 75 62 6d 69 74 74 69 |]...I'm |submitti|
|00000120| 6e 67 20 74 68 65 20 6e | 65 77 20 76 65 72 73 69 |ng the n|ew versi|
|00000130| 6f 6e 20 6f 66 20 27 6d | 6f 64 65 6d 27 2c 20 61 |on of 'm|odem', a|
|00000140| 20 70 72 6f 67 72 61 6d | 0a 74 6f 20 61 6c 6c 6f | program|.to allo|
|00000150| 77 20 61 20 6c 69 6e 65 | 20 63 6f 6e 6e 65 63 74 |w a line| connect|
|00000160| 65 64 20 74 6f 20 61 20 | 6d 6f 64 65 6d 20 74 6f |ed to a |modem to|
|00000170| 20 62 65 20 75 73 65 64 | 20 66 6f 72 20 62 69 2d | be used| for bi-|
|00000180| 64 69 72 65 63 74 69 6f | 6e 61 6c 0a 75 75 63 70 |directio|nal.uucp|
|00000190| 2f 63 75 20 61 63 63 65 | 73 73 65 73 2e 0a 0a 09 |/cu acce|sses....|
|000001a0| 49 74 20 66 75 6e 63 74 | 69 6f 6e 61 6c 6c 79 20 |It funct|ionally |
|000001b0| 72 65 70 6c 61 63 65 73 | 20 27 75 75 67 65 74 74 |replaces| 'uugett|
|000001c0| 79 27 2c 20 62 75 74 20 | 70 72 6f 76 69 64 65 73 |y', but |provides|
|000001d0| 20 61 20 6d 6f 72 65 20 | 73 6f 70 68 69 73 74 69 | a more |sophisti|
|000001e0| 63 61 74 65 64 0a 6d 65 | 74 68 6f 64 20 6f 66 20 |cated.me|thod of |
|000001f0| 74 61 6c 6b 69 6e 67 20 | 74 6f 20 69 6e 74 65 6c |talking |to intel|
|00000200| 6c 69 67 65 6e 74 20 6d | 6f 64 65 6d 73 2c 20 77 |ligent m|odems, w|
|00000210| 68 69 63 68 20 63 61 6e | 20 73 63 72 65 77 20 75 |hich can| screw u|
|00000220| 70 20 75 75 67 65 74 74 | 79 20 62 79 0a 74 61 6c |p uugett|y by.tal|
|00000230| 6b 69 6e 67 20 74 6f 6f | 20 6d 75 63 68 2e 0a 0a |king too| much...|
|00000240| 09 54 68 65 20 6e 65 77 | 20 76 65 72 73 69 6f 6e |.The new| version|
|00000250| 20 6e 6f 77 20 68 61 73 | 20 73 75 70 70 6f 72 74 | now has| support|
|00000260| 20 66 6f 72 20 68 61 72 | 64 77 61 72 65 20 44 43 | for har|dware DC|
|00000270| 44 20 64 65 74 65 63 74 | 69 6f 6e 2c 20 77 68 69 |D detect|ion, whi|
|00000280| 63 68 0a 61 6c 6c 6f 77 | 73 20 74 68 65 20 73 68 |ch.allow|s the sh|
|00000290| 65 6c 6c 20 74 6f 20 62 | 65 20 68 75 6e 67 75 70 |ell to b|e hungup|
|000002a0| 20 77 68 65 6e 20 74 68 | 65 20 6c 69 6e 65 20 69 | when th|e line i|
|000002b0| 73 20 64 72 6f 70 70 65 | 64 2e 0a 0a 43 68 65 65 |s droppe|d...Chee|
|000002c0| 72 73 2c 0a 09 44 61 76 | 65 2e 0a 0a 23 21 20 2f |rs,..Dav|e...#! /|
|000002d0| 62 69 6e 2f 73 68 0a 23 | 20 54 68 69 73 20 69 73 |bin/sh.#| This is|
|000002e0| 20 61 20 73 68 65 6c 6c | 20 61 72 63 68 69 76 65 | a shell| archive|
|000002f0| 2c 20 6d 65 61 6e 69 6e | 67 3a 0a 23 20 31 2e 20 |, meanin|g:.# 1. |
|00000300| 52 65 6d 6f 76 65 20 65 | 76 65 72 79 74 68 69 6e |Remove e|verythin|
|00000310| 67 20 61 62 6f 76 65 20 | 74 68 65 20 23 21 20 2f |g above |the #! /|
|00000320| 62 69 6e 2f 73 68 20 6c | 69 6e 65 2e 0a 23 20 32 |bin/sh l|ine..# 2|
|00000330| 2e 20 53 61 76 65 20 74 | 68 65 20 72 65 73 75 6c |. Save t|he resul|
|00000340| 74 69 6e 67 20 74 65 78 | 74 20 69 6e 20 61 20 66 |ting tex|t in a f|
|00000350| 69 6c 65 2e 0a 23 20 33 | 2e 20 45 78 65 63 75 74 |ile..# 3|. Execut|
|00000360| 65 20 74 68 65 20 66 69 | 6c 65 20 77 69 74 68 20 |e the fi|le with |
|00000370| 2f 62 69 6e 2f 73 68 20 | 28 6e 6f 74 20 63 73 68 |/bin/sh |(not csh|
|00000380| 29 20 74 6f 20 63 72 65 | 61 74 65 3a 0a 23 09 52 |) to cre|ate:.#.R|
|00000390| 45 41 44 4d 45 0a 23 09 | 6d 6f 64 65 6d 2e 31 0a |EADME.#.|modem.1.|
|000003a0| 23 09 4d 61 6b 65 66 69 | 6c 65 0a 23 09 6d 6f 64 |#.Makefi|le.#.mod|
|000003b0| 65 6d 2e 68 0a 23 09 6d | 6f 64 65 6d 2e 63 0a 23 |em.h.#.m|odem.c.#|
|000003c0| 09 75 63 68 61 6e 67 65 | 2e 63 0a 23 09 73 65 6e |.uchange|.c.#.sen|
|000003d0| 64 65 78 2e 63 0a 23 09 | 69 6f 2e 63 0a 23 09 6c |dex.c.#.|io.c.#.l|
|000003e0| 69 6e 65 2e 63 0a 23 09 | 73 74 61 74 65 6c 6f 6f |ine.c.#.|stateloo|
|000003f0| 6b 2e 63 0a 65 78 70 6f | 72 74 20 50 41 54 48 3b |k.c.expo|rt PATH;|
|00000400| 20 50 41 54 48 3d 2f 62 | 69 6e 3a 2f 75 73 72 2f | PATH=/b|in:/usr/|
|00000410| 62 69 6e 3a 24 50 41 54 | 48 0a 65 63 68 6f 20 73 |bin:$PAT|H.echo s|
|00000420| 68 61 72 3a 20 22 65 78 | 74 72 61 63 74 69 6e 67 |har: "ex|tracting|
|00000430| 20 27 52 45 41 44 4d 45 | 27 22 20 27 28 32 32 37 | 'README|'" '(227|
|00000440| 36 20 63 68 61 72 61 63 | 74 65 72 73 29 27 0a 69 |6 charac|ters)'.i|
|00000450| 66 20 74 65 73 74 20 2d | 66 20 27 52 45 41 44 4d |f test -|f 'READM|
|00000460| 45 27 0a 74 68 65 6e 0a | 09 65 63 68 6f 20 73 68 |E'.then.|.echo sh|
|00000470| 61 72 3a 20 22 77 69 6c | 6c 20 6e 6f 74 20 6f 76 |ar: "wil|l not ov|
|00000480| 65 72 2d 77 72 69 74 65 | 20 65 78 69 73 74 69 6e |er-write| existin|
|00000490| 67 20 66 69 6c 65 20 27 | 52 45 41 44 4d 45 27 22 |g file '|README'"|
|000004a0| 0a 65 6c 73 65 0a 63 61 | 74 20 3c 3c 20 5c 53 48 |.else.ca|t << \SH|
|000004b0| 41 52 5f 45 4f 46 20 3e | 20 27 52 45 41 44 4d 45 |AR_EOF >| 'README|
|000004c0| 27 0a 4d 6f 64 65 6d 3a | 20 41 20 62 69 2d 64 69 |'.Modem:| A bi-di|
|000004d0| 72 65 63 74 69 6f 6e 61 | 6c 20 75 75 67 65 74 74 |rectiona|l uugett|
|000004e0| 79 20 72 65 70 6c 61 63 | 65 6d 65 6e 74 2e 0a 0a |y replac|ement...|
|000004f0| 22 4d 6f 64 65 6d 22 20 | 77 6f 72 6b 73 20 6a 75 |"Modem" |works ju|
|00000500| 73 74 20 6c 69 6b 65 20 | 22 75 75 67 65 74 74 79 |st like |"uugetty|
|00000510| 22 2c 20 61 6e 64 20 61 | 6c 6c 6f 77 73 20 69 6e |", and a|llows in|
|00000520| 63 6f 6d 69 6e 67 20 61 | 6e 64 20 6f 75 74 67 6f |coming a|nd outgo|
|00000530| 69 6e 67 20 63 61 6c 6c | 73 20 0a 74 68 72 6f 75 |ing call|s .throu|
|00000540| 67 68 20 74 68 65 20 73 | 61 6d 65 20 70 6f 72 74 |gh the s|ame port|
|00000550| 2e 0a 0a 49 6e 20 61 64 | 64 69 74 69 6f 6e 2c 20 |...In ad|dition, |
|00000560| 69 74 20 61 6c 6c 6f 77 | 73 20 70 72 6f 76 69 64 |it allow|s provid|
|00000570| 65 73 20 61 64 64 69 74 | 69 6f 6e 61 6c 20 66 61 |es addit|ional fa|
|00000580| 63 69 6c 69 74 69 65 73 | 3a 0a 0a 31 2f 2e 09 4f |cilities|:..1/..O|
|00000590| 70 74 69 6f 6e 20 74 6f | 20 69 6e 73 65 72 74 20 |ption to| insert |
|000005a0| 61 20 75 75 63 70 2d 73 | 74 79 6c 65 20 73 65 6e |a uucp-s|tyle sen|
|000005b0| 64 2d 65 78 70 65 63 74 | 20 63 6f 6e 76 65 72 73 |d-expect| convers|
|000005c0| 61 74 69 6f 6e 20 74 6f | 0a 69 6e 69 74 69 61 6c |ation to|.initial|
|000005d0| 69 73 65 20 74 68 65 20 | 6d 6f 64 65 6d 2e 0a 0a |ise the |modem...|
|000005e0| 32 2f 2e 09 43 6f 64 65 | 20 74 6f 20 73 70 61 77 |2/..Code| to spaw|
|000005f0| 6e 20 67 65 74 74 79 20 | 61 74 20 74 68 65 20 63 |n getty |at the c|
|00000600| 6f 72 72 65 63 74 20 73 | 70 65 65 64 2c 20 69 66 |orrect s|peed, if|
|00000610| 20 79 6f 75 20 68 61 76 | 65 20 61 20 6d 6f 64 65 | you hav|e a mode|
|00000620| 6d 20 74 68 61 74 0a 63 | 61 6e 20 73 65 6e 73 65 |m that.c|an sense|
|00000630| 20 74 68 65 20 73 70 65 | 65 64 20 6f 66 20 69 6e | the spe|ed of in|
|00000640| 63 6f 6d 69 6e 67 20 63 | 61 6c 6c 73 2e 0a 0a 33 |coming c|alls...3|
|00000650| 2f 2e 09 41 75 74 6f 6c | 6f 67 6f 75 74 20 66 61 |/..Autol|ogout fa|
|00000660| 63 69 6c 69 74 79 2c 20 | 69 66 20 74 68 65 72 65 |cility, |if there|
|00000670| 20 69 73 20 6e 6f 20 61 | 63 74 69 76 69 74 79 20 | is no a|ctivity |
|00000680| 6f 6e 20 74 68 65 20 6d | 6f 64 65 6d 20 66 6f 72 |on the m|odem for|
|00000690| 0a 61 20 73 70 65 63 69 | 66 69 65 64 20 70 65 72 |.a speci|fied per|
|000006a0| 69 6f 64 20 6f 66 20 74 | 69 6d 65 2e 0a 0a 34 2f |iod of t|ime...4/|
|000006b0| 2e 09 4c 6f 67 20 6f 66 | 20 61 6c 6c 20 63 6f 6e |..Log of| all con|
|000006c0| 6e 65 63 74 65 64 20 63 | 61 6c 6c 73 2e 0a 0a 35 |nected c|alls...5|
|000006d0| 2f 2e 09 4f 70 74 69 6f | 6e 20 74 6f 20 72 75 6e |/..Optio|n to run|
|000006e0| 20 22 77 68 6f 22 20 61 | 6e 64 20 22 70 73 22 20 | "who" a|nd "ps" |
|000006f0| 6f 6e 20 74 68 65 20 70 | 6f 72 74 2c 20 77 68 65 |on the p|ort, whe|
|00000700| 6e 20 63 6f 6e 6e 65 63 | 74 65 64 2c 0a 69 66 20 |n connec|ted,.if |
|00000710| 79 6f 75 27 72 65 20 72 | 65 61 6c 6c 79 20 73 65 |you're r|eally se|
|00000720| 63 75 72 69 74 79 2d 63 | 6f 6e 63 69 6f 75 73 2e |curity-c|oncious.|
|00000730| 0a 0a 36 2f 2e 09 43 6f | 72 72 65 63 74 20 68 61 |..6/..Co|rrect ha|
|00000740| 6e 64 6c 69 6e 67 20 6f | 66 20 44 43 44 20 28 63 |ndling o|f DCD (c|
|00000750| 61 72 72 69 65 72 20 64 | 65 74 65 63 74 29 20 73 |arrier d|etect) s|
|00000760| 69 67 6e 61 6c 73 20 66 | 72 6f 6d 20 74 68 65 20 |ignals f|rom the |
|00000770| 6d 6f 64 65 6d 2e 0a 0a | 37 2f 2e 09 57 6f 72 6b |modem...|7/..Work|
|00000780| 73 20 68 61 70 70 69 6c | 79 20 77 69 74 68 20 22 |s happil|y with "|
|00000790| 75 75 63 70 22 2c 20 22 | 63 75 22 2c 20 61 6e 64 |uucp", "|cu", and|
|000007a0| 20 22 6b 65 72 6d 69 74 | 22 2c 20 77 68 69 63 68 | "kermit|", which|
|000007b0| 20 61 72 65 20 6e 6f 74 | 20 61 77 61 72 65 0a 74 | are not| aware.t|
|000007c0| 68 61 74 20 22 6d 6f 64 | 65 6d 22 20 69 73 20 72 |hat "mod|em" is r|
|000007d0| 75 6e 6e 69 6e 67 2e 20 | 5b 4e 42 20 53 6c 69 67 |unning. |[NB Slig|
|000007e0| 68 74 20 63 68 61 6e 67 | 65 20 6e 65 63 65 73 73 |ht chang|e necess|
|000007f0| 61 72 79 20 74 6f 20 75 | 75 63 70 20 64 69 61 6c |ary to u|ucp dial|
|00000800| 65 72 20 73 63 72 69 70 | 74 0a 72 65 71 75 69 72 |er scrip|t.requir|
|00000810| 65 64 5d 0a 0a 38 2f 2e | 09 53 74 61 74 65 2d 63 |ed]..8/.|.State-c|
|00000820| 68 61 6e 67 69 6e 67 20 | 63 6f 64 65 2c 20 77 68 |hanging |code, wh|
|00000830| 69 63 68 20 61 6c 6c 6f | 77 73 20 79 6f 75 20 74 |ich allo|ws you t|
|00000840| 6f 20 73 65 74 20 74 68 | 65 20 6d 6f 64 65 6d 20 |o set th|e modem |
|00000850| 69 6e 20 61 20 73 74 61 | 74 65 0a 72 65 6c 61 74 |in a sta|te.relat|
|00000860| 65 64 20 74 6f 20 74 68 | 65 20 74 69 6d 65 20 6f |ed to th|e time o|
|00000870| 66 20 64 61 79 2e 20 55 | 73 65 66 75 6c 20 69 66 |f day. U|seful if|
|00000880| 20 79 6f 75 20 77 61 6e | 74 20 69 74 20 6f 6e 6c | you wan|t it onl|
|00000890| 79 20 74 6f 20 61 75 74 | 6f 2d 61 6e 73 77 65 72 |y to aut|o-answer|
|000008a0| 0a 77 68 65 6e 20 79 6f | 75 27 72 65 20 6e 6f 74 |.when yo|u're not|
|000008b0| 20 74 68 65 72 65 2c 20 | 61 6e 64 20 77 61 6e 74 | there, |and want|
|000008c0| 20 74 6f 20 75 73 65 20 | 69 74 20 61 73 20 61 20 | to use |it as a |
|000008d0| 74 65 6c 65 70 68 6f 6e | 65 20 6f 74 68 65 72 77 |telephon|e otherw|
|000008e0| 69 73 65 2e 0a 5b 54 68 | 61 6e 6b 73 20 74 6f 20 |ise..[Th|anks to |
|000008f0| 6a 61 63 6b 40 73 77 6c | 61 62 73 2e 75 75 63 70 |jack@swl|abs.uucp|
|00000900| 20 66 6f 72 20 74 68 69 | 73 20 63 6f 64 65 2e 5d | for thi|s code.]|
|00000910| 0a 0a 0a 49 74 20 77 6f | 72 6b 73 20 66 69 6e 65 |...It wo|rks fine|
|00000920| 20 6f 6e 20 6d 79 20 6d | 6f 64 65 6d 2c 20 77 68 | on my m|odem, wh|
|00000930| 69 63 68 20 74 61 6c 6b | 73 20 74 6f 6f 20 6d 75 |ich talk|s too mu|
|00000940| 63 68 20 66 6f 72 20 75 | 75 67 65 74 74 79 20 74 |ch for u|ugetty t|
|00000950| 6f 20 62 65 20 61 62 6c | 65 20 74 6f 0a 68 61 6e |o be abl|e to.han|
|00000960| 64 6c 65 20 69 74 21 0a | 0a 0a 46 6f 72 20 79 6f |dle it!.|..For yo|
|00000970| 75 72 20 6c 6f 63 61 6c | 20 73 69 74 65 2c 20 79 |ur local| site, y|
|00000980| 6f 75 20 68 61 76 65 20 | 74 6f 20 64 6f 20 74 68 |ou have |to do th|
|00000990| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 3a 0a 0a 50 75 |e follow|ing:..Pu|
|000009a0| 74 20 74 68 69 73 20 6c | 69 6e 65 20 69 6e 20 2f |t this l|ine in /|
|000009b0| 65 74 63 2f 69 6e 69 74 | 74 61 62 0a 58 58 3a 32 |etc/init|tab.XX:2|
|000009c0| 3a 72 65 73 70 61 77 6e | 3a 2f 75 73 72 2f 6c 69 |:respawn|:/usr/li|
|000009d0| 62 2f 6d 6f 64 65 6d 20 | 74 74 79 58 58 09 09 77 |b/modem |ttyXX..w|
|000009e0| 68 65 72 65 20 74 74 79 | 58 58 20 69 73 20 79 6f |here tty|XX is yo|
|000009f0| 75 72 20 6d 6f 64 65 6d | 20 6c 69 6e 65 0a 0a 4d |ur modem| line..M|
|00000a00| 61 6b 65 20 73 75 72 65 | 20 74 68 61 74 20 79 6f |ake sure| that yo|
|00000a10| 75 72 20 64 69 61 6c 65 | 72 20 73 63 72 69 70 74 |ur diale|r script|
|00000a20| 20 69 73 20 70 72 65 70 | 61 72 65 64 20 74 6f 3a | is prep|ared to:|
|00000a30| 0a 0a 09 61 29 20 73 6c | 65 65 70 20 66 6f 72 20 |...a) sl|eep for |
|00000a40| 3e 20 31 20 73 65 63 20 | 42 45 46 4f 52 45 20 72 |> 1 sec |BEFORE r|
|00000a50| 65 61 64 69 6e 67 20 74 | 68 65 20 66 69 72 73 74 |eading t|he first|
|00000a60| 20 72 65 70 6c 79 20 66 | 72 6f 6d 20 74 68 65 20 | reply f|rom the |
|00000a70| 6d 6f 64 65 6d 0a 09 62 | 29 20 61 63 63 65 70 74 |modem..b|) accept|
|00000a80| 20 74 68 61 74 20 74 68 | 65 20 66 69 72 73 74 20 | that th|e first |
|00000a90| 63 68 61 72 61 63 74 65 | 72 20 73 65 6e 74 20 62 |characte|r sent b|
|00000aa0| 79 20 74 68 65 20 6d 6f | 64 65 6d 20 77 69 6c 6c |y the mo|dem will|
|00000ab0| 20 4e 4f 54 20 67 65 74 | 20 74 68 65 72 65 0a 0a | NOT get| there..|
|00000ac0| 65 2e 67 2e 20 4d 79 20 | 48 61 79 65 73 20 64 69 |e.g. My |Hayes di|
|00000ad0| 61 6c 65 72 20 73 63 72 | 69 70 74 20 69 73 20 4e |aler scr|ipt is N|
|00000ae0| 4f 52 4d 41 4c 4c 59 0a | 0a 09 2e 2e 2e 20 41 54 |ORMALLY.|..... AT|
|00000af0| 20 4f 4b 20 41 54 44 50 | 5c 54 20 43 4f 4e 4e 45 | OK ATDP|\T CONNE|
|00000b00| 43 54 0a 0a 62 75 74 20 | 4d 55 53 54 20 62 65 20 |CT..but |MUST be |
|00000b10| 6d 6f 64 69 66 69 65 64 | 20 74 6f 0a 0a 09 2e 2e |modified| to.....|
|00000b20| 2e 20 41 54 5c 72 5c 44 | 20 4f 4b 20 41 54 44 50 |. AT\r\D| OK ATDP|
|00000b30| 5c 54 20 43 4f 4e 4e 45 | 43 54 20 20 09 09 23 28 |\T CONNE|CT ..#(|
|00000b40| 20 5c 44 20 69 73 20 61 | 20 32 2d 73 65 63 20 70 | \D is a| 2-sec p|
|00000b50| 61 75 73 65 20 29 0a 0a | 0a 4d 6f 64 69 66 79 20 |ause )..|.Modify |
|00000b60| 74 68 65 20 69 6e 63 6c | 75 64 65 64 20 64 69 61 |the incl|uded dia|
|00000b70| 6c 65 72 20 73 63 72 69 | 70 74 20 74 6f 20 74 61 |ler scri|pt to ta|
|00000b80| 6c 6b 20 74 6f 20 59 4f | 55 52 20 6d 6f 64 65 6d |lk to YO|UR modem|
|00000b90| 2c 20 69 66 20 79 6f 75 | 20 68 61 76 65 20 61 20 |, if you| have a |
|00000ba0| 6e 6f 6e 2d 0a 73 75 70 | 70 6f 72 74 65 64 20 6d |non-.sup|ported m|
|00000bb0| 6f 64 65 6d 20 74 79 70 | 65 2e 20 50 6c 65 61 73 |odem typ|e. Pleas|
|00000bc0| 65 20 6c 65 74 20 6d 65 | 20 68 61 76 65 20 79 6f |e let me| have yo|
|00000bd0| 75 72 20 73 63 72 69 70 | 74 73 2c 20 73 6f 20 74 |ur scrip|ts, so t|
|00000be0| 68 61 74 20 49 20 63 61 | 6e 20 69 6e 63 6c 75 64 |hat I ca|n includ|
|00000bf0| 65 0a 74 68 65 6d 20 69 | 6e 20 66 75 74 75 72 65 |e.them i|n future|
|00000c00| 20 72 65 6c 65 61 73 65 | 73 2e 0a 0a 4d 6f 64 69 | release|s...Modi|
|00000c10| 66 79 20 74 68 65 20 73 | 70 65 65 64 2d 64 65 74 |fy the s|peed-det|
|00000c20| 65 63 74 69 6f 6e 20 72 | 6f 75 74 69 6e 65 2c 20 |ection r|outine, |
|00000c30| 69 66 20 79 6f 75 72 20 | 6d 6f 64 65 6d 20 69 73 |if your |modem is|
|00000c40| 20 6e 6f 74 20 61 20 68 | 61 79 65 73 2d 63 6f 6d | not a h|ayes-com|
|00000c50| 70 61 74 69 62 6c 65 0a | 0a 4d 6f 64 69 66 79 20 |patible.|.Modify |
|00000c60| 22 6c 6f 63 6b 65 64 28 | 29 22 20 74 6f 20 72 65 |"locked(|)" to re|
|00000c70| 61 64 20 59 4f 55 52 20 | 6c 6f 63 6b 20 64 69 72 |ad YOUR |lock dir|
|00000c80| 65 63 74 6f 72 79 20 2d | 20 62 75 74 20 73 65 65 |ectory -| but see|
|00000c90| 20 74 68 65 20 6d 61 6b | 65 66 69 6c 65 20 6f 70 | the mak|efile op|
|00000ca0| 74 69 6f 6e 73 0a 66 6f | 72 20 76 61 72 69 6f 75 |tions.fo|r variou|
|00000cb0| 73 20 6c 6f 63 6b 66 69 | 6c 65 20 70 72 6f 74 6f |s lockfi|le proto|
|00000cc0| 63 6f 6c 73 2e 0a 0a 49 | 66 20 6e 65 63 65 73 73 |cols...I|f necess|
|00000cd0| 61 72 79 2c 20 6d 6f 64 | 69 66 79 20 74 68 65 20 |ary, mod|ify the |
|00000ce0| 77 69 72 69 6e 67 20 74 | 6f 20 74 68 65 20 6d 6f |wiring t|o the mo|
|00000cf0| 64 65 6d 20 73 6f 20 74 | 68 61 74 20 44 43 44 20 |dem so t|hat DCD |
|00000d00| 69 73 20 61 73 73 65 72 | 74 65 64 0a 77 68 65 6e |is asser|ted.when|
|00000d10| 20 74 68 65 20 6d 6f 64 | 65 6d 20 69 73 20 6f 6e | the mod|em is on|
|00000d20| 6c 69 6e 65 2c 20 62 75 | 74 20 6e 6f 74 20 61 73 |line, bu|t not as|
|00000d30| 73 65 72 74 65 64 20 61 | 74 20 6f 74 68 65 72 20 |serted a|t other |
|00000d40| 74 69 6d 65 73 2e 20 20 | 54 68 69 73 20 69 73 0a |times. |This is.|
|00000d50| 6e 65 63 65 73 73 61 72 | 79 20 66 6f 72 20 74 68 |necessar|y for th|
|00000d60| 65 20 6d 6f 64 65 6d 20 | 74 6f 20 67 65 6e 65 72 |e modem |to gener|
|00000d70| 61 74 65 20 61 20 68 61 | 6e 67 75 70 20 73 69 67 |ate a ha|ngup sig|
|00000d80| 6e 61 6c 20 77 68 65 6e | 20 61 20 72 65 6d 6f 74 |nal when| a remot|
|00000d90| 65 20 73 69 74 65 0a 64 | 69 73 63 6f 6e 6e 65 63 |e site.d|isconnec|
|00000da0| 74 73 2e 20 0a 0a 53 48 | 41 52 5f 45 4f 46 0a 69 |ts. ..SH|AR_EOF.i|
|00000db0| 66 20 74 65 73 74 20 32 | 32 37 36 20 2d 6e 65 20 |f test 2|276 -ne |
|00000dc0| 22 60 77 63 20 2d 63 20 | 3c 20 27 52 45 41 44 4d |"`wc -c |< 'READM|
|00000dd0| 45 27 60 22 0a 74 68 65 | 6e 0a 09 65 63 68 6f 20 |E'`".the|n..echo |
|00000de0| 73 68 61 72 3a 20 22 65 | 72 72 6f 72 20 74 72 61 |shar: "e|rror tra|
|00000df0| 6e 73 6d 69 74 74 69 6e | 67 20 27 52 45 41 44 4d |nsmittin|g 'READM|
|00000e00| 45 27 22 20 27 28 73 68 | 6f 75 6c 64 20 68 61 76 |E'" '(sh|ould hav|
|00000e10| 65 20 62 65 65 6e 20 32 | 32 37 36 20 63 68 61 72 |e been 2|276 char|
|00000e20| 61 63 74 65 72 73 29 27 | 0a 66 69 0a 66 69 0a 65 |acters)'|.fi.fi.e|
|00000e30| 63 68 6f 20 73 68 61 72 | 3a 20 22 65 78 74 72 61 |cho shar|: "extra|
|00000e40| 63 74 69 6e 67 20 27 6d | 6f 64 65 6d 2e 31 27 22 |cting 'm|odem.1'"|
|00000e50| 20 27 28 32 30 36 35 20 | 63 68 61 72 61 63 74 65 | '(2065 |characte|
|00000e60| 72 73 29 27 0a 69 66 20 | 74 65 73 74 20 2d 66 20 |rs)'.if |test -f |
|00000e70| 27 6d 6f 64 65 6d 2e 31 | 27 0a 74 68 65 6e 0a 09 |'modem.1|'.then..|
|00000e80| 65 63 68 6f 20 73 68 61 | 72 3a 20 22 77 69 6c 6c |echo sha|r: "will|
|00000e90| 20 6e 6f 74 20 6f 76 65 | 72 2d 77 72 69 74 65 20 | not ove|r-write |
|00000ea0| 65 78 69 73 74 69 6e 67 | 20 66 69 6c 65 20 27 6d |existing| file 'm|
|00000eb0| 6f 64 65 6d 2e 31 27 22 | 0a 65 6c 73 65 0a 63 61 |odem.1'"|.else.ca|
|00000ec0| 74 20 3c 3c 20 5c 53 48 | 41 52 5f 45 4f 46 20 3e |t << \SH|AR_EOF >|
|00000ed0| 20 27 6d 6f 64 65 6d 2e | 31 27 0a 2e 54 48 20 6d | 'modem.|1'..TH m|
|00000ee0| 6f 64 65 6d 20 31 20 6c | 6f 63 61 6c 0a 2e 53 48 |odem 1 l|ocal..SH|
|00000ef0| 20 4e 41 4d 45 0a 6d 6f | 64 65 6d 0a 2e 53 48 20 | NAME.mo|dem..SH |
|00000f00| 53 59 4e 4f 50 53 49 53 | 0a 2e 42 20 22 6d 6f 64 |SYNOPSIS|..B "mod|
|00000f10| 65 6d 20 5b 73 70 65 65 | 64 5d 20 74 74 79 22 0a |em [spee|d] tty".|
|00000f20| 2e 50 50 0a 2e 53 48 20 | 44 45 53 43 52 49 50 54 |.PP..SH |DESCRIPT|
|00000f30| 49 4f 4e 0a 2e 49 20 6d | 6f 64 65 6d 0a 69 73 20 |ION..I m|odem.is |
|00000f40| 61 20 66 75 6e 63 74 69 | 6f 6e 61 6c 20 72 65 70 |a functi|onal rep|
|00000f50| 6c 61 63 65 6d 65 6e 74 | 20 66 6f 72 20 5c 66 49 |lacement| for \fI|
|00000f60| 75 75 67 65 74 74 79 5c | 66 52 2c 20 61 6e 64 20 |uugetty\|fR, and |
|00000f70| 61 6c 6c 6f 77 73 20 61 | 20 6c 69 6e 65 20 63 6f |allows a| line co|
|00000f80| 6e 6e 65 63 74 65 64 0a | 74 6f 20 61 20 6d 6f 64 |nnected.|to a mod|
|00000f90| 65 6d 20 74 6f 20 62 65 | 20 75 73 65 64 20 66 6f |em to be| used fo|
|00000fa0| 72 20 62 6f 74 68 20 69 | 6e 63 6f 6d 69 6e 67 20 |r both i|ncoming |
|00000fb0| 61 6e 64 20 6f 75 74 67 | 6f 69 6e 67 20 75 75 63 |and outg|oing uuc|
|00000fc0| 70 2f 63 75 20 63 61 6c | 6c 73 2e 0a 2e 50 50 0a |p/cu cal|ls...PP.|
|00000fd0| 49 74 20 68 61 73 20 61 | 6e 20 69 6e 69 74 69 61 |It has a|n initia|
|00000fe0| 6c 20 63 6f 6e 76 65 72 | 73 61 74 69 6f 6e 20 77 |l conver|sation w|
|00000ff0| 69 74 68 20 74 68 65 20 | 6d 6f 64 65 6d 2c 20 73 |ith the |modem, s|
|00001000| 6f 20 74 68 61 74 20 69 | 74 20 63 61 6e 20 62 65 |o that i|t can be|
|00001010| 20 73 65 74 0a 69 6e 20 | 74 68 65 20 63 6f 72 72 | set.in |the corr|
|00001020| 65 63 74 20 6d 6f 64 65 | 2c 20 61 6e 64 20 74 68 |ect mode|, and th|
|00001030| 65 6e 20 77 61 69 74 73 | 20 66 6f 72 20 74 68 65 |en waits| for the|
|00001040| 20 6d 6f 64 65 6d 20 74 | 6f 20 64 65 74 65 63 74 | modem t|o detect|
|00001050| 20 61 6e 20 69 6e 63 6f | 6d 69 6e 67 0a 63 61 6c | an inco|ming.cal|
|00001060| 6c 2e 20 49 74 20 74 68 | 65 6e 20 73 70 61 77 6e |l. It th|en spawn|
|00001070| 73 20 5c 66 49 67 65 74 | 74 79 28 38 29 5c 66 52 |s \fIget|ty(8)\fR|
|00001080| 20 74 6f 20 6c 6f 67 69 | 6e 20 74 68 65 20 75 73 | to logi|n the us|
|00001090| 65 72 2c 20 61 66 74 65 | 72 20 6d 61 6b 69 6e 67 |er, afte|r making|
|000010a0| 20 61 6e 0a 61 6c 74 65 | 72 61 74 69 6f 6e 20 69 | an.alte|ration i|
|000010b0| 6e 20 74 68 65 20 66 69 | 6c 65 20 2f 65 74 63 2f |n the fi|le /etc/|
|000010c0| 75 74 6d 70 2c 20 73 6f | 20 74 68 61 74 20 67 65 |utmp, so| that ge|
|000010d0| 74 74 79 20 74 68 69 6e | 6b 73 20 69 74 20 77 61 |tty thin|ks it wa|
|000010e0| 73 20 73 70 61 77 6e 65 | 64 20 62 79 0a 5c 66 49 |s spawne|d by.\fI|
|000010f0| 69 6e 69 74 28 38 29 5c | 66 52 2e 0a 2e 50 50 0a |init(8)\|fR...PP.|
|00001100| 57 68 69 6c 65 20 74 68 | 65 20 75 73 65 72 20 72 |While th|e user r|
|00001110| 65 6d 61 69 6e 73 20 6c | 6f 67 67 65 64 20 6f 6e |emains l|ogged on|
|00001120| 2c 20 5c 66 49 6d 6f 64 | 65 6d 5c 72 42 20 77 69 |, \fImod|em\rB wi|
|00001130| 6c 6c 20 70 65 72 69 6f | 64 69 63 61 6c 6c 79 20 |ll perio|dically |
|00001140| 72 75 6e 0a 5c 66 49 70 | 73 5c 66 52 20 6f 6e 20 |run.\fIp|s\fR on |
|00001150| 74 68 65 20 6c 69 6e 65 | 2c 20 73 6f 20 74 68 61 |the line|, so tha|
|00001160| 74 20 69 74 20 63 61 6e | 20 72 65 63 6f 72 64 20 |t it can| record |
|00001170| 77 68 61 74 20 74 68 65 | 20 75 73 65 72 20 69 73 |what the| user is|
|00001180| 20 64 6f 69 6e 67 2e 0a | 54 68 69 73 20 66 61 63 | doing..|This fac|
|00001190| 69 6c 69 74 79 20 63 61 | 6e 20 62 65 20 74 75 72 |ility ca|n be tur|
|000011a0| 6e 65 64 20 6f 66 66 20 | 28 73 65 65 20 57 41 54 |ned off |(see WAT|
|000011b0| 43 48 49 54 29 20 6f 70 | 74 69 6f 6e 2c 20 69 66 |CHIT) op|tion, if|
|000011c0| 20 6e 6f 74 20 72 65 71 | 75 69 72 65 64 2e 0a 2e | not req|uired...|
|000011d0| 50 50 0a 49 66 2c 20 61 | 74 20 61 6e 79 20 70 6f |PP.If, a|t any po|
|000011e0| 69 6e 74 20 70 72 69 6f | 72 20 74 6f 20 74 68 65 |int prio|r to the|
|000011f0| 20 69 6e 63 6f 6d 69 6e | 67 20 63 61 6c 6c 2c 20 | incomin|g call, |
|00001200| 5c 66 49 6d 6f 64 65 6d | 5c 66 52 20 64 65 74 65 |\fImodem|\fR dete|
|00001210| 63 74 73 20 61 6e 0a 5c | 66 42 6f 75 74 67 6f 69 |cts an.\|fBoutgoi|
|00001220| 6e 67 5c 66 52 20 63 61 | 6c 6c 2c 20 74 68 65 6e |ng\fR ca|ll, then|
|00001230| 20 69 74 20 65 78 69 74 | 73 2e 20 4a 75 73 74 20 | it exit|s. Just |
|00001240| 62 65 66 6f 72 65 20 74 | 68 65 20 65 78 69 74 2c |before t|he exit,|
|00001250| 20 69 74 20 61 74 74 65 | 6d 70 74 73 0a 74 6f 20 | it atte|mpts.to |
|00001260| 73 65 74 20 74 68 65 20 | 6c 69 6e 65 20 73 6f 20 |set the |line so |
|00001270| 74 68 61 74 20 69 74 20 | 63 61 6e 20 62 65 20 75 |that it |can be u|
|00001280| 73 65 64 20 62 79 20 6f | 75 74 67 6f 69 6e 67 20 |sed by o|utgoing |
|00001290| 63 61 6c 6c 65 72 73 2e | 0a 2e 50 50 0a 49 66 20 |callers.|..PP.If |
|000012a0| 5c 66 49 6d 6f 64 65 6d | 5c 66 52 20 64 65 74 65 |\fImodem|\fR dete|
|000012b0| 63 74 73 20 61 20 4c 4f | 43 4b 20 66 69 6c 65 20 |cts a LO|CK file |
|000012c0| 77 68 65 6e 20 69 74 20 | 69 73 20 69 6e 76 6f 6b |when it |is invok|
|000012d0| 65 64 2c 20 74 68 65 6e | 20 69 74 20 77 69 6c 6c |ed, then| it will|
|000012e0| 0a 77 61 69 74 20 75 6e | 74 69 6c 20 74 68 69 73 |.wait un|til this|
|000012f0| 20 66 69 6c 65 20 69 73 | 20 72 65 6d 6f 76 65 64 | file is| removed|
|00001300| 20 62 65 66 6f 72 65 20 | 70 72 6f 63 65 65 64 69 | before |proceedi|
|00001310| 6e 67 2e 0a 2e 50 50 0a | 5c 66 49 6d 6f 64 65 6d |ng...PP.|\fImodem|
|00001320| 5c 66 52 20 61 6c 73 6f | 20 65 6e 66 6f 72 63 65 |\fR also| enforce|
|00001330| 73 20 61 6e 20 69 64 6c | 65 20 74 69 6d 65 6f 75 |s an idl|e timeou|
|00001340| 74 2c 20 73 6f 20 74 68 | 61 74 20 69 74 20 74 68 |t, so th|at it th|
|00001350| 65 20 6c 69 6e 65 20 61 | 70 70 65 61 72 73 0a 74 |e line a|ppears.t|
|00001360| 6f 20 62 65 20 69 64 6c | 65 20 66 6f 72 20 74 6f |o be idl|e for to|
|00001370| 6f 20 6c 6f 6e 67 2c 20 | 74 68 65 20 75 73 65 72 |o long, |the user|
|00001380| 20 69 73 20 6c 6f 67 67 | 65 64 20 6f 75 74 2e 20 | is logg|ed out. |
|00001390| 54 68 69 73 20 6d 61 79 | 20 63 61 75 73 65 20 70 |This may| cause p|
|000013a0| 72 6f 62 6c 65 6d 73 0a | 77 69 74 68 20 6b 65 72 |roblems.|with ker|
|000013b0| 6d 69 74 2c 20 77 68 69 | 63 68 20 64 6f 65 73 6e |mit, whi|ch doesn|
|000013c0| 27 74 20 75 70 64 61 74 | 65 20 74 68 65 20 74 69 |'t updat|e the ti|
|000013d0| 6d 65 73 20 6f 6e 20 74 | 68 65 20 64 65 76 69 63 |mes on t|he devic|
|000013e0| 65 2c 20 62 75 74 20 75 | 73 65 73 0a 5c 66 49 2f |e, but u|ses.\fI/|
|000013f0| 64 65 76 2f 74 74 79 5c | 66 52 20 69 6e 73 74 65 |dev/tty\|fR inste|
|00001400| 61 64 2e 0a 2e 50 50 0a | 54 68 65 20 6f 70 74 69 |ad...PP.|The opti|
|00001410| 6f 6e 61 6c 20 5c 66 42 | 73 70 65 65 64 5c 66 52 |onal \fB|speed\fR|
|00001420| 20 61 72 67 75 6d 65 6e | 74 20 63 61 6e 20 62 65 | argumen|t can be|
|00001430| 20 75 73 65 64 20 74 6f | 20 66 6f 72 63 65 20 5c | used to| force \|
|00001440| 66 49 6d 6f 64 65 6d 5c | 66 52 20 74 6f 20 74 61 |fImodem\|fR to ta|
|00001450| 6c 6b 0a 74 6f 20 74 68 | 65 20 6d 6f 64 65 6d 20 |lk.to th|e modem |
|00001460| 61 74 20 74 68 65 20 73 | 70 65 63 69 66 69 65 64 |at the s|pecified|
|00001470| 20 73 70 65 65 64 2c 20 | 6f 74 68 65 72 77 69 73 | speed, |otherwis|
|00001480| 65 20 69 74 20 77 69 6c | 6c 20 74 61 6c 6b 20 61 |e it wil|l talk a|
|00001490| 74 20 31 32 30 30 20 62 | 61 75 64 2e 0a 2e 50 50 |t 1200 b|aud...PP|
|000014a0| 0a 54 68 65 20 74 74 79 | 20 6e 61 6d 65 20 73 68 |.The tty| name sh|
|000014b0| 6f 75 6c 64 20 62 65 20 | 6f 66 20 74 68 65 20 66 |ould be |of the f|
|000014c0| 6f 72 6d 20 5c 66 42 74 | 74 79 34 34 5c 66 52 2e |orm \fBt|ty44\fR.|
|000014d0| 0a 2e 53 48 20 45 58 41 | 4d 50 4c 45 53 0a 2e 50 |..SH EXA|MPLES..P|
|000014e0| 50 0a 34 34 3a 32 3a 72 | 65 73 70 61 77 6e 3a 2f |P.44:2:r|espawn:/|
|000014f0| 75 73 72 2f 6c 69 62 2f | 6d 6f 64 65 6d 20 74 74 |usr/lib/|modem tt|
|00001500| 79 34 34 0a 2e 50 50 0a | 31 61 3a 32 33 34 3a 72 |y44..PP.|1a:234:r|
|00001510| 65 73 70 61 77 6e 3a 2f | 75 73 72 2f 6c 69 62 2f |espawn:/|usr/lib/|
|00001520| 6d 6f 64 65 6d 20 32 34 | 30 30 20 74 74 79 31 61 |modem 24|00 tty1a|
|00001530| 0a 2e 50 50 0a 2e 53 48 | 20 46 49 4c 45 53 0a 2f |..PP..SH| FILES./|
|00001540| 64 65 76 2f 5c 66 49 3c | 74 74 79 3e 5c 66 42 0a |dev/\fI<|tty>\fB.|
|00001550| 2e 50 50 0a 2f 75 73 72 | 2f 73 70 6f 6f 6c 2f 75 |.PP./usr|/spool/u|
|00001560| 75 63 70 2f 6d 6f 64 65 | 6d 2e 6c 6f 67 0a 2e 53 |ucp/mode|m.log..S|
|00001570| 48 20 53 45 45 20 41 4c | 53 4f 0a 67 65 74 74 79 |H SEE AL|SO.getty|
|00001580| 28 38 29 2c 20 75 75 67 | 65 74 74 79 28 38 29 2c |(8), uug|etty(8),|
|00001590| 20 73 68 28 31 29 2c 20 | 70 73 28 31 29 2c 20 77 | sh(1), |ps(1), w|
|000015a0| 68 6f 28 31 29 2c 20 75 | 74 6d 70 28 34 29 0a 2e |ho(1), u|tmp(4)..|
|000015b0| 53 48 20 42 55 47 53 0a | 54 68 65 20 63 6f 64 65 |SH BUGS.|The code|
|000015c0| 20 66 6f 72 20 68 61 72 | 64 77 61 72 65 20 44 43 | for har|dware DC|
|000015d0| 44 20 64 65 74 65 63 74 | 69 6f 6e 20 73 75 70 70 |D detect|ion supp|
|000015e0| 6f 72 74 20 69 73 20 6e | 65 77 2e 0a 2e 50 50 0a |ort is n|ew...PP.|
|000015f0| 54 68 65 72 65 20 61 72 | 65 20 73 74 69 6c 6c 20 |There ar|e still |
|00001600| 73 6f 6d 65 20 75 6e 65 | 78 70 6c 61 69 6e 65 64 |some une|xplained|
|00001610| 20 64 69 61 67 6e 6f 73 | 74 69 63 73 20 69 6e 20 | diagnos|tics in |
|00001620| 6d 79 20 6c 6f 67 20 66 | 69 6c 65 2c 20 6d 61 69 |my log f|ile, mai|
|00001630| 6e 6c 79 20 61 62 6f 75 | 74 0a 77 72 69 74 65 28 |nly abou|t.write(|
|00001640| 31 29 20 63 61 6c 6c 73 | 20 66 61 69 6c 69 6e 67 |1) calls| failing|
|00001650| 20 74 6f 20 77 72 69 74 | 65 20 63 68 61 72 61 63 | to writ|e charac|
|00001660| 74 65 72 73 2e 0a 2e 50 | 50 0a 59 6f 75 20 77 69 |ters...P|P.You wi|
|00001670| 6c 6c 20 68 61 76 65 20 | 74 6f 20 6d 6f 64 69 66 |ll have |to modif|
|00001680| 79 20 73 6f 6d 65 20 73 | 6f 75 72 63 65 20 63 6f |y some s|ource co|
|00001690| 64 65 20 69 66 20 79 6f | 75 72 20 6d 6f 64 65 6d |de if yo|ur modem|
|000016a0| 20 61 6e 64 2f 6f 72 20 | 73 79 73 74 65 6d 20 69 | and/or |system i|
|000016b0| 73 0a 64 69 66 66 65 72 | 65 6e 74 20 66 72 6f 6d |s.differ|ent from|
|000016c0| 20 6d 69 6e 65 20 28 73 | 70 65 65 64 20 63 6f 6e | mine (s|peed con|
|000016d0| 66 69 67 75 72 61 74 69 | 6f 6e 20 61 6e 64 20 6c |figurati|on and l|
|000016e0| 6f 63 6b 20 66 69 6c 65 | 73 29 2e 0a 53 48 41 52 |ock file|s)..SHAR|
|000016f0| 5f 45 4f 46 0a 69 66 20 | 74 65 73 74 20 32 30 36 |_EOF.if |test 206|
|00001700| 35 20 2d 6e 65 20 22 60 | 77 63 20 2d 63 20 3c 20 |5 -ne "`|wc -c < |
|00001710| 27 6d 6f 64 65 6d 2e 31 | 27 60 22 0a 74 68 65 6e |'modem.1|'`".then|
|00001720| 0a 09 65 63 68 6f 20 73 | 68 61 72 3a 20 22 65 72 |..echo s|har: "er|
|00001730| 72 6f 72 20 74 72 61 6e | 73 6d 69 74 74 69 6e 67 |ror tran|smitting|
|00001740| 20 27 6d 6f 64 65 6d 2e | 31 27 22 20 27 28 73 68 | 'modem.|1'" '(sh|
|00001750| 6f 75 6c 64 20 68 61 76 | 65 20 62 65 65 6e 20 32 |ould hav|e been 2|
|00001760| 30 36 35 20 63 68 61 72 | 61 63 74 65 72 73 29 27 |065 char|acters)'|
|00001770| 0a 66 69 0a 66 69 0a 65 | 63 68 6f 20 73 68 61 72 |.fi.fi.e|cho shar|
|00001780| 3a 20 22 65 78 74 72 61 | 63 74 69 6e 67 20 27 4d |: "extra|cting 'M|
|00001790| 61 6b 65 66 69 6c 65 27 | 22 20 27 28 31 33 32 38 |akefile'|" '(1328|
|000017a0| 20 63 68 61 72 61 63 74 | 65 72 73 29 27 0a 69 66 | charact|ers)'.if|
|000017b0| 20 74 65 73 74 20 2d 66 | 20 27 4d 61 6b 65 66 69 | test -f| 'Makefi|
|000017c0| 6c 65 27 0a 74 68 65 6e | 0a 09 65 63 68 6f 20 73 |le'.then|..echo s|
|000017d0| 68 61 72 3a 20 22 77 69 | 6c 6c 20 6e 6f 74 20 6f |har: "wi|ll not o|
|000017e0| 76 65 72 2d 77 72 69 74 | 65 20 65 78 69 73 74 69 |ver-writ|e existi|
|000017f0| 6e 67 20 66 69 6c 65 20 | 27 4d 61 6b 65 66 69 6c |ng file |'Makefil|
|00001800| 65 27 22 0a 65 6c 73 65 | 0a 63 61 74 20 3c 3c 20 |e'".else|.cat << |
|00001810| 5c 53 48 41 52 5f 45 4f | 46 20 3e 20 27 4d 61 6b |\SHAR_EO|F > 'Mak|
|00001820| 65 66 69 6c 65 27 0a 23 | 0a 23 20 6e 65 77 20 6d |efile'.#|.# new m|
|00001830| 61 6b 65 66 69 6c 65 20 | 66 6f 72 20 6d 6f 64 65 |akefile |for mode|
|00001840| 6d 2e 0a 23 0a 23 20 69 | 66 20 79 6f 75 72 20 6c |m..#.# i|f your l|
|00001850| 6f 63 6b 66 69 6c 65 20 | 69 73 3a 0a 23 20 2f 75 |ockfile |is:.# /u|
|00001860| 73 72 2f 73 70 6f 6f 6c | 2f 75 75 63 70 2f 4c 43 |sr/spool|/uucp/LC|
|00001870| 4b 2e 2e 3c 73 79 73 74 | 65 6d 3e 09 09 4e 6f 20 |K..<syst|em>..No |
|00001880| 64 65 66 69 6e 65 73 20 | 6e 65 65 64 65 64 2e 0a |defines |needed..|
|00001890| 23 20 2f 75 73 72 2f 73 | 70 6f 6f 6c 2f 6c 6f 63 |# /usr/s|pool/loc|
|000018a0| 6b 73 2f 4c 43 4b 2e 2e | 3c 73 79 73 74 65 6d 3e |ks/LCK..|<system>|
|000018b0| 09 2d 44 4f 4c 33 42 32 | 0a 23 20 2f 75 73 72 2f |.-DOL3B2|.# /usr/|
|000018c0| 73 70 6f 6f 6c 2f 6c 6f | 63 6b 73 2f 4c 43 4b 2e |spool/lo|cks/LCK.|
|000018d0| 4c 2e 3c 73 79 73 74 65 | 6d 3e 09 2d 44 48 44 42 |L.<syste|m>.-DHDB|
|000018e0| 0a 23 0a 23 20 4e 65 77 | 20 64 65 66 69 6e 69 74 |.#.# New| definit|
|000018f0| 69 6f 6e 73 3a 0a 23 09 | 48 44 42 3a 09 09 49 66 |ions:.#.|HDB:..If|
|00001900| 20 79 6f 75 20 68 61 76 | 65 20 48 6f 6e 65 79 2d | you hav|e Honey-|
|00001910| 44 61 6e 62 65 72 20 55 | 55 43 50 20 28 54 68 61 |Danber U|UCP (Tha|
|00001920| 6e 6b 73 20 52 69 63 6b | 29 0a 23 09 4f 4c 33 42 |nks Rick|).#.OL3B|
|00001930| 32 3a 09 09 49 66 20 79 | 6f 75 20 68 61 76 65 20 |2:..If y|ou have |
|00001940| 61 6e 20 4f 6c 69 76 65 | 74 74 69 20 33 42 32 0a |an Olive|tti 3B2.|
|00001950| 23 09 53 50 45 45 44 43 | 4f 4e 46 49 47 3a 09 49 |#.SPEEDC|ONFIG:.I|
|00001960| 66 20 79 6f 75 20 68 61 | 76 65 20 61 20 6d 6f 64 |f you ha|ve a mod|
|00001970| 65 6d 20 74 68 61 74 20 | 74 65 6c 6c 73 20 79 6f |em that |tells yo|
|00001980| 75 20 74 68 65 20 73 70 | 65 65 64 20 6f 66 20 69 |u the sp|eed of i|
|00001990| 6e 63 6f 6d 69 6e 67 0a | 23 09 09 09 63 61 6c 6c |ncoming.|#...call|
|000019a0| 73 20 28 49 6e 20 41 53 | 43 49 49 20 2d 20 33 30 |s (In AS|CII - 30|
|000019b0| 30 28 6f 72 20 5c 72 29 | 2c 20 31 32 30 30 2c 20 |0(or \r)|, 1200, |
|000019c0| 32 34 30 30 2c 20 31 32 | 37 35 2c 20 37 35 31 32 |2400, 12|75, 7512|
|000019d0| 29 0a 23 09 09 09 49 66 | 20 79 6f 75 72 20 6d 6f |).#...If| your mo|
|000019e0| 64 65 6d 20 73 61 79 73 | 20 64 69 66 66 65 72 65 |dem says| differe|
|000019f0| 6e 74 20 74 68 69 6e 67 | 73 2c 20 68 61 63 6b 20 |nt thing|s, hack |
|00001a00| 74 68 65 20 63 6f 64 65 | 0a 23 09 57 41 54 43 48 |the code|.#.WATCH|
|00001a10| 49 54 3a 09 49 66 20 79 | 6f 75 20 77 61 6e 74 20 |IT:.If y|ou want |
|00001a20| 22 77 68 6f 22 20 61 6e | 64 20 22 70 73 22 20 72 |"who" an|d "ps" r|
|00001a30| 75 6e 20 70 65 72 69 6f | 64 69 63 61 6c 6c 79 20 |un perio|dically |
|00001a40| 74 6f 20 63 68 65 63 6b | 0a 23 09 09 09 77 68 61 |to check|.#...wha|
|00001a50| 74 27 73 20 67 6f 69 6e | 67 20 6f 6e 2e 0a 23 09 |t's goin|g on..#.|
|00001a60| 48 41 59 45 53 09 09 49 | 66 20 79 6f 75 20 68 61 |HAYES..I|f you ha|
|00001a70| 76 65 20 61 20 48 61 79 | 65 73 2d 74 79 70 65 20 |ve a Hay|es-type |
|00001a80| 6d 6f 64 65 6d 2e 0a 23 | 09 4a 53 45 54 3a 09 09 |modem..#|.JSET:..|
|00001a90| 49 66 20 79 6f 75 20 68 | 61 76 65 20 61 6e 20 41 |If you h|ave an A|
|00001aa0| 54 26 54 20 41 7a 74 65 | 63 20 6d 6f 64 65 6d 20 |T&T Azte|c modem |
|00001ab0| 28 54 68 61 6e 6b 73 20 | 52 69 63 6b 29 2e 0a 23 |(Thanks |Rick)..#|
|00001ac0| 09 44 45 42 55 47 3a 09 | 09 53 65 65 20 77 68 61 |.DEBUG:.|.See wha|
|00001ad0| 74 27 73 20 67 6f 69 6e | 67 20 6f 6e 2e 0a 23 09 |t's goin|g on..#.|
|00001ae0| 53 4c 4f 57 3a 09 09 57 | 61 69 74 20 31 20 73 65 |SLOW:..W|ait 1 se|
|00001af0| 63 20 62 65 74 77 65 65 | 6e 20 65 61 63 68 20 63 |c betwee|n each c|
|00001b00| 68 61 72 61 63 74 65 72 | 20 77 72 69 74 74 65 6e |haracter| written|
|00001b10| 20 74 6f 20 74 68 65 20 | 6d 6f 64 65 6d 2e 20 0a | to the |modem. .|
|00001b20| 23 09 53 54 41 54 45 53 | 09 09 49 66 20 79 6f 75 |#.STATES|..If you|
|00001b30| 20 77 61 6e 74 20 74 6f | 20 75 73 65 20 4a 61 63 | want to| use Jac|
|00001b40| 6b 27 73 20 73 74 61 74 | 65 2d 63 68 61 6e 67 69 |k's stat|e-changi|
|00001b50| 6e 67 20 73 74 75 66 66 | 2e 0a 23 0a 23 20 63 68 |ng stuff|..#.# ch|
|00001b60| 65 63 6b 20 22 6d 6f 64 | 65 6d 2e 68 22 20 66 6f |eck "mod|em.h" fo|
|00001b70| 72 20 61 64 64 69 74 69 | 6f 6e 61 6c 20 6f 70 74 |r additi|onal opt|
|00001b80| 69 6f 6e 73 20 6f 6e 20 | 64 65 66 61 75 6c 74 20 |ions on |default |
|00001b90| 6d 6f 64 65 6d 20 73 70 | 65 65 64 20 61 6e 64 20 |modem sp|eed and |
|00001ba0| 74 69 6d 65 7a 6f 6e 65 | 2e 0a 23 0a 43 46 4c 41 |timezone|..#.CFLA|
|00001bb0| 47 53 20 3d 20 2d 44 4f | 4c 33 42 32 20 2d 44 53 |GS = -DO|L3B2 -DS|
|00001bc0| 50 45 45 44 43 4f 4e 46 | 49 47 20 2d 44 57 41 54 |PEEDCONF|IG -DWAT|
|00001bd0| 43 48 49 54 20 2d 44 48 | 41 59 45 53 20 0a 50 41 |CHIT -DH|AYES .PA|
|00001be0| 52 54 53 20 3d 20 6d 6f | 64 65 6d 2e 6f 20 75 63 |RTS = mo|dem.o uc|
|00001bf0| 68 61 6e 67 65 2e 6f 20 | 73 65 6e 64 65 78 2e 6f |hange.o |sendex.o|
|00001c00| 20 69 6f 2e 6f 20 6c 69 | 6e 65 2e 6f 20 73 74 61 | io.o li|ne.o sta|
|00001c10| 74 65 6c 6f 6f 6b 2e 6f | 0a 23 20 4c 49 42 53 20 |telook.o|.# LIBS |
|00001c20| 3d 20 2d 6c 67 0a 0a 6d | 6f 64 65 6d 3a 20 24 7b |= -lg..m|odem: ${|
|00001c30| 50 41 52 54 53 7d 0a 09 | 72 6d 20 2d 66 20 6d 6f |PARTS}..|rm -f mo|
|00001c40| 64 65 6d 0a 09 63 63 20 | 24 7b 50 41 52 54 53 7d |dem..cc |${PARTS}|
|00001c50| 20 2d 6f 20 6d 6f 64 65 | 6d 20 24 7b 4c 49 42 53 | -o mode|m ${LIBS|
|00001c60| 7d 0a 0a 69 6e 73 74 61 | 6c 6c 3a 20 6d 6f 64 65 |}..insta|ll: mode|
|00001c70| 6d 0a 09 6d 76 20 2f 65 | 74 63 2f 6d 6f 64 65 6d |m..mv /e|tc/modem|
|00001c80| 20 2f 65 74 63 2f 6d 6f | 64 65 6d 2e 6f 6c 64 0a | /etc/mo|dem.old.|
|00001c90| 09 63 70 20 6d 6f 64 65 | 6d 20 2f 65 74 63 0a 09 |.cp mode|m /etc..|
|00001ca0| 0a 6c 69 6e 74 3a 0a 09 | 6c 69 6e 74 20 24 7b 43 |.lint:..|lint ${C|
|00001cb0| 46 4c 41 47 53 7d 20 24 | 7b 50 41 52 54 53 3a 2e |FLAGS} $|{PARTS:.|
|00001cc0| 6f 3d 2e 63 7d 0a 09 0a | 24 7b 50 41 52 54 53 7d |o=.c}...|${PARTS}|
|00001cd0| 3a 20 6d 6f 64 65 6d 2e | 68 20 4d 61 6b 65 66 69 |: modem.|h Makefi|
|00001ce0| 6c 65 0a 0a 73 68 61 72 | 3a 0a 09 73 68 61 72 20 |le..shar|:..shar |
|00001cf0| 2d 63 76 20 52 45 41 44 | 4d 45 20 6d 6f 64 65 6d |-cv READ|ME modem|
|00001d00| 2e 31 20 4d 61 6b 65 66 | 69 6c 65 20 6d 6f 64 65 |.1 Makef|ile mode|
|00001d10| 6d 2e 68 20 24 7b 50 41 | 52 54 53 3a 2e 6f 3d 2e |m.h ${PA|RTS:.o=.|
|00001d20| 63 7d 20 3e 20 6d 6f 64 | 65 6d 2e 73 68 61 72 0a |c} > mod|em.shar.|
|00001d30| 0a 0a 6d 61 6e 3a 0a 09 | 6e 72 6f 66 66 20 2d 6d |..man:..|nroff -m|
|00001d40| 61 6e 20 6d 6f 64 65 6d | 2e 31 20 3e 20 6d 6f 64 |an modem|.1 > mod|
|00001d50| 65 6d 2e 6d 61 6e 0a 53 | 48 41 52 5f 45 4f 46 0a |em.man.S|HAR_EOF.|
|00001d60| 69 66 20 74 65 73 74 20 | 31 33 32 38 20 2d 6e 65 |if test |1328 -ne|
|00001d70| 20 22 60 77 63 20 2d 63 | 20 3c 20 27 4d 61 6b 65 | "`wc -c| < 'Make|
|00001d80| 66 69 6c 65 27 60 22 0a | 74 68 65 6e 0a 09 65 63 |file'`".|then..ec|
|00001d90| 68 6f 20 73 68 61 72 3a | 20 22 65 72 72 6f 72 20 |ho shar:| "error |
|00001da0| 74 72 61 6e 73 6d 69 74 | 74 69 6e 67 20 27 4d 61 |transmit|ting 'Ma|
|00001db0| 6b 65 66 69 6c 65 27 22 | 20 27 28 73 68 6f 75 6c |kefile'"| '(shoul|
|00001dc0| 64 20 68 61 76 65 20 62 | 65 65 6e 20 31 33 32 38 |d have b|een 1328|
|00001dd0| 20 63 68 61 72 61 63 74 | 65 72 73 29 27 0a 66 69 | charact|ers)'.fi|
|00001de0| 0a 66 69 0a 65 63 68 6f | 20 73 68 61 72 3a 20 22 |.fi.echo| shar: "|
|00001df0| 65 78 74 72 61 63 74 69 | 6e 67 20 27 6d 6f 64 65 |extracti|ng 'mode|
|00001e00| 6d 2e 68 27 22 20 27 28 | 32 38 39 38 20 63 68 61 |m.h'" '(|2898 cha|
|00001e10| 72 61 63 74 65 72 73 29 | 27 0a 69 66 20 74 65 73 |racters)|'.if tes|
|00001e20| 74 20 2d 66 20 27 6d 6f | 64 65 6d 2e 68 27 0a 74 |t -f 'mo|dem.h'.t|
|00001e30| 68 65 6e 0a 09 65 63 68 | 6f 20 73 68 61 72 3a 20 |hen..ech|o shar: |
|00001e40| 22 77 69 6c 6c 20 6e 6f | 74 20 6f 76 65 72 2d 77 |"will no|t over-w|
|00001e50| 72 69 74 65 20 65 78 69 | 73 74 69 6e 67 20 66 69 |rite exi|sting fi|
|00001e60| 6c 65 20 27 6d 6f 64 65 | 6d 2e 68 27 22 0a 65 6c |le 'mode|m.h'".el|
|00001e70| 73 65 0a 63 61 74 20 3c | 3c 20 5c 53 48 41 52 5f |se.cat <|< \SHAR_|
|00001e80| 45 4f 46 20 3e 20 27 6d | 6f 64 65 6d 2e 68 27 0a |EOF > 'm|odem.h'.|
|00001e90| 2f 2a 0a 20 2a 20 73 6f | 6d 65 20 63 6f 6e 73 74 |/*. * so|me const|
|00001ea0| 61 6e 74 73 20 66 6f 72 | 20 79 6f 75 72 20 6d 6f |ants for| your mo|
|00001eb0| 64 65 6d 0a 20 2a 2f 0a | 20 0a 23 64 65 66 69 6e |dem. */.| .#defin|
|00001ec0| 65 20 54 49 4d 45 5a 4f | 4e 45 20 22 54 5a 3d 47 |e TIMEZO|NE "TZ=G|
|00001ed0| 4d 54 30 42 53 54 22 09 | 09 2f 2a 20 74 69 6d 65 |MT0BST".|./* time|
|00001ee0| 20 7a 6f 6e 65 20 79 6f | 75 20 6f 70 65 72 61 74 | zone yo|u operat|
|00001ef0| 65 20 69 6e 09 2a 2f 0a | 23 64 65 66 69 6e 65 20 |e in.*/.|#define |
|00001f00| 44 45 46 53 50 45 45 44 | 20 22 31 32 30 30 22 09 |DEFSPEED| "1200".|
|00001f10| 09 09 2f 2a 20 73 70 65 | 65 64 20 79 6f 75 72 20 |../* spe|ed your |
|00001f20| 6d 6f 64 65 6d 20 6c 69 | 6b 65 73 20 6d 6f 73 74 |modem li|kes most|
|00001f30| 09 2a 2f 0a 0a 23 64 65 | 66 69 6e 65 20 57 54 49 |.*/..#de|fine WTI|
|00001f40| 4d 45 20 35 09 09 09 09 | 2f 2a 20 64 65 66 61 75 |ME 5....|/* defau|
|00001f50| 6c 74 20 77 61 69 74 20 | 74 69 6d 65 20 09 09 2a |lt wait |time ..*|
|00001f60| 2f 0a 0a 23 64 65 66 69 | 6e 65 20 4c 4f 47 46 49 |/..#defi|ne LOGFI|
|00001f70| 4c 45 20 22 2f 75 73 72 | 2f 73 70 6f 6f 6c 2f 75 |LE "/usr|/spool/u|
|00001f80| 75 63 70 2f 6d 6f 64 65 | 6d 2e 6c 6f 67 22 09 09 |ucp/mode|m.log"..|
|00001f90| 2f 2a 20 6c 6f 67 20 66 | 69 6c 65 20 2a 2f 0a 0a |/* log f|ile */..|
|00001fa0| 23 64 65 66 69 6e 65 20 | 6d 61 78 28 61 2c 62 29 |#define |max(a,b)|
|00001fb0| 20 28 28 61 29 20 3e 20 | 28 62 29 20 3f 20 28 61 | ((a) > |(b) ? (a|
|00001fc0| 29 20 3a 20 28 62 29 29 | 0a 23 64 65 66 69 6e 65 |) : (b))|.#define|
|00001fd0| 20 6d 69 6e 28 61 2c 62 | 29 20 28 28 61 29 20 3c | min(a,b|) ((a) <|
|00001fe0| 20 28 62 29 20 3f 20 28 | 61 29 20 3a 20 28 62 29 | (b) ? (|a) : (b)|
|00001ff0| 29 0a 0a 23 64 65 66 69 | 6e 65 20 4d 49 4e 55 54 |)..#defi|ne MINUT|
|00002000| 45 53 09 36 30 0a 23 64 | 65 66 69 6e 65 20 49 44 |ES.60.#d|efine ID|
|00002010| 4c 45 54 49 4d 45 20 35 | 2a 4d 49 4e 55 54 45 53 |LETIME 5|*MINUTES|
|00002020| 09 09 09 09 2f 2a 20 61 | 75 74 6f 6c 6f 67 6f 75 |..../* a|utologou|
|00002030| 74 20 74 69 6d 65 20 2a | 2f 0a 23 69 66 64 65 66 |t time *|/.#ifdef|
|00002040| 20 57 41 54 43 48 49 54 | 0a 23 64 65 66 69 6e 65 | WATCHIT|.#define|
|00002050| 20 53 50 59 54 49 4d 45 | 20 31 2a 4d 49 4e 55 54 | SPYTIME| 1*MINUT|
|00002060| 45 53 0a 23 65 6c 73 65 | 0a 23 64 65 66 69 6e 65 |ES.#else|.#define|
|00002070| 20 53 50 59 54 49 4d 45 | 20 49 44 4c 45 54 49 4d | SPYTIME| IDLETIM|
|00002080| 45 0a 23 65 6e 64 69 66 | 0a 0a 23 64 65 66 69 6e |E.#endif|..#defin|
|00002090| 65 20 47 52 41 43 45 54 | 49 4d 45 09 35 09 2f 2a |e GRACET|IME.5./*|
|000020a0| 20 74 69 6d 65 20 74 6f | 20 77 61 69 74 20 66 6f | time to| wait fo|
|000020b0| 72 20 73 69 67 6e 61 6c | 20 74 6f 20 74 61 6b 65 |r signal| to take|
|000020c0| 20 65 66 66 65 63 74 20 | 2a 2f 0a 0a 65 78 74 65 | effect |*/..exte|
|000020d0| 72 6e 20 69 6e 74 20 65 | 72 72 6e 6f 3b 0a 0a 23 |rn int e|rrno;..#|
|000020e0| 69 66 64 65 66 20 4d 41 | 49 4e 44 45 46 0a 23 64 |ifdef MA|INDEF.#d|
|000020f0| 65 66 69 6e 65 20 45 58 | 54 45 52 4e 0a 23 65 6c |efine EX|TERN.#el|
|00002100| 73 65 0a 23 64 65 66 69 | 6e 65 20 45 58 54 45 52 |se.#defi|ne EXTER|
|00002110| 4e 20 65 78 74 65 72 6e | 0a 23 65 6e 64 69 66 0a |N extern|.#endif.|
|00002120| 0a 6c 6f 6e 67 20 74 69 | 6d 65 28 29 3b 0a 69 6e |.long ti|me();.in|
|00002130| 74 20 64 72 65 61 64 28 | 29 2c 20 64 77 72 69 74 |t dread(|), dwrit|
|00002140| 65 28 29 2c 20 6d 79 72 | 65 61 64 28 29 3b 0a 76 |e(), myr|ead();.v|
|00002150| 6f 69 64 20 6d 79 77 72 | 69 74 65 28 29 3b 0a 0a |oid mywr|ite();..|
|00002160| 45 58 54 45 52 4e 20 63 | 68 61 72 20 6c 6f 63 6b |EXTERN c|har lock|
|00002170| 66 5b 35 30 5d 3b 09 09 | 09 09 2f 2a 20 61 72 67 |f[50];..|../* arg|
|00002180| 75 6d 65 6e 74 20 6c 6f | 63 6b 20 66 69 6c 65 20 |ument lo|ck file |
|00002190| 2a 2f 0a 45 58 54 45 52 | 4e 20 63 68 61 72 20 64 |*/.EXTER|N char d|
|000021a0| 6e 61 6d 65 5b 33 30 5d | 3b 09 09 09 09 2f 2a 20 |name[30]|;..../* |
|000021b0| 64 65 76 69 63 65 20 6e | 61 6d 65 20 69 6e 20 66 |device n|ame in f|
|000021c0| 75 6c 6c 20 2d 20 2f 64 | 65 76 2f 2e 2e 2e 2e 20 |ull - /d|ev/.... |
|000021d0| 2a 2f 0a 0a 45 58 54 45 | 52 4e 20 69 6e 74 20 73 |*/..EXTE|RN int s|
|000021e0| 68 65 6c 6c 2c 20 73 74 | 61 74 75 73 3b 09 09 09 |hell, st|atus;...|
|000021f0| 2f 2a 20 70 69 64 20 6f | 66 20 73 68 65 6c 6c 2c |/* pid o|f shell,|
|00002200| 20 61 6e 64 20 65 78 69 | 74 20 73 74 61 74 75 73 | and exi|t status|
|00002210| 20 2a 2f 0a 0a 45 58 54 | 45 52 4e 20 69 6e 74 20 | */..EXT|ERN int |
|00002220| 64 65 76 3b 09 09 09 09 | 09 2f 2a 20 64 65 76 69 |dev;....|./* devi|
|00002230| 63 65 20 75 73 65 64 20 | 28 6f 70 65 6e 20 66 69 |ce used |(open fi|
|00002240| 6c 64 65 73 29 20 2a 2f | 0a 2f 2a 0a 20 2a 20 54 |ldes) */|./*. * T|
|00002250| 68 65 20 27 72 65 73 65 | 74 27 20 73 65 71 75 65 |he 'rese|t' seque|
|00002260| 6e 63 65 2c 20 69 66 20 | 74 68 65 20 6d 6f 64 65 |nce, if |the mode|
|00002270| 6d 20 64 6f 65 73 6e 27 | 74 20 62 65 68 61 76 65 |m doesn'|t behave|
|00002280| 20 61 73 20 65 78 70 65 | 63 74 65 64 2e 0a 20 2a | as expe|cted.. *|
|00002290| 20 49 20 73 74 69 6c 6c | 20 67 65 74 20 70 72 6f | I still| get pro|
|000022a0| 62 6c 65 6d 73 20 77 69 | 74 68 20 74 68 65 20 6d |blems wi|th the m|
|000022b0| 6f 64 65 6d 20 6e 6f 74 | 20 72 65 73 70 6f 6e 64 |odem not| respond|
|000022c0| 69 6e 67 20 74 6f 20 27 | 41 54 27 2e 0a 20 2a 2f |ing to '|AT'.. */|
|000022d0| 0a 23 69 66 20 64 65 66 | 69 6e 65 64 28 48 41 59 |.#if def|ined(HAY|
|000022e0| 45 53 29 0a 23 64 65 66 | 69 6e 65 20 52 45 53 45 |ES).#def|ine RESE|
|000022f0| 54 20 22 5c 6e 5c 72 41 | 54 5c 72 5c 72 41 54 5c |T "\n\rA|T\r\rAT\|
|00002300| 72 5c 72 41 54 5c 72 5c | 72 22 0a 23 65 6c 73 65 |r\rAT\r\|r".#else|
|00002310| 0a 23 64 65 66 69 6e 65 | 20 52 45 53 45 54 20 22 |.#define| RESET "|
|00002320| 22 0a 23 65 6e 64 69 66 | 0a 2f 2a 0a 20 2a 20 54 |".#endif|./*. * T|
|00002330| 68 65 20 27 63 6f 6e 76 | 65 72 73 61 74 69 6f 6e |he 'conv|ersation|
|00002340| 27 20 6e 65 63 65 73 73 | 61 72 79 20 74 6f 20 67 |' necess|ary to g|
|00002350| 65 74 20 79 6f 75 72 20 | 6d 6f 64 65 6d 20 69 6e |et your |modem in|
|00002360| 74 6f 20 61 20 27 6c 69 | 73 74 65 6e 69 6e 67 27 |to a 'li|stening'|
|00002370| 20 73 74 61 74 65 2e 0a | 20 2a 20 54 68 65 20 63 | state..| * The c|
|00002380| 6f 6e 76 65 72 61 73 61 | 74 69 6f 6e 20 73 68 6f |onverasa|tion sho|
|00002390| 75 6c 64 20 63 6f 6d 70 | 6c 65 74 65 20 69 66 66 |uld comp|lete iff|
|000023a0| 20 61 6e 20 69 6e 63 6f | 6d 69 6e 67 20 63 61 6c | an inco|ming cal|
|000023b0| 6c 20 69 73 20 63 6f 6e | 6e 65 63 74 65 64 2e 0a |l is con|nected..|
|000023c0| 20 2a 20 49 66 20 75 73 | 69 6e 67 20 4a 61 63 6b | * If us|ing Jack|
|000023d0| 27 73 20 73 74 61 74 65 | 73 2c 20 73 65 74 20 75 |'s state|s, set u|
|000023e0| 70 20 79 6f 75 72 20 73 | 74 61 74 65 73 20 62 65 |p your s|tates be|
|000023f0| 6c 6f 77 2e 20 45 61 63 | 68 20 6d 6f 64 65 6d 20 |low. Eac|h modem |
|00002400| 6c 69 6e 65 0a 20 2a 20 | 6d 75 73 74 20 68 61 76 |line. * |must hav|
|00002410| 65 20 66 6c 61 67 73 20 | 73 65 74 20 74 6f 20 69 |e flags |set to i|
|00002420| 6e 64 69 63 61 74 65 20 | 69 6e 20 77 68 69 63 68 |ndicate |in which|
|00002430| 20 73 74 61 74 65 28 73 | 29 20 69 74 20 63 61 6e | state(s|) it can|
|00002440| 20 62 65 20 65 78 65 63 | 75 74 65 64 2e 0a 20 2a | be exec|uted.. *|
|00002450| 20 49 66 20 79 6f 75 27 | 72 65 20 6e 6f 74 20 75 | If you'|re not u|
|00002460| 73 69 6e 67 20 74 68 65 | 20 53 54 41 54 45 53 20 |sing the| STATES |
|00002470| 73 74 75 66 66 2c 20 6c | 65 61 76 65 20 74 68 65 |stuff, l|eave the|
|00002480| 6d 20 61 74 20 7a 65 72 | 6f 2e 0a 20 2a 2f 0a 23 |m at zer|o.. */.#|
|00002490| 64 65 66 69 6e 65 20 53 | 50 4b 09 09 09 30 78 30 |define S|PK...0x0|
|000024a0| 30 30 31 09 2f 2a 20 53 | 70 65 61 6b 65 72 20 63 |001./* S|peaker c|
|000024b0| 6f 6e 74 72 6f 6c 20 2a | 2f 0a 23 64 65 66 69 6e |ontrol *|/.#defin|
|000024c0| 65 09 41 41 09 09 09 30 | 78 30 30 30 32 09 2f 2a |e.AA...0|x0002./*|
|000024d0| 20 41 75 74 6f 20 41 6e | 73 77 65 72 20 43 6f 6e | Auto An|swer Con|
|000024e0| 74 72 6f 6c 20 2a 2f 0a | 0a 73 74 72 75 63 74 20 |trol */.|.struct |
|000024f0| 63 6f 6e 76 20 7b 0a 09 | 63 68 61 72 20 2a 63 5f |conv {..|char *c_|
|00002500| 73 65 6e 64 3b 0a 09 63 | 68 61 72 20 2a 63 5f 65 |send;..c|har *c_e|
|00002510| 78 70 65 63 74 3b 0a 09 | 69 6e 74 20 63 5f 77 61 |xpect;..|int c_wa|
|00002520| 69 74 3b 09 09 2f 2a 20 | 74 69 6d 65 20 74 6f 20 |it;../* |time to |
|00002530| 77 61 69 74 20 66 6f 72 | 20 63 5f 65 78 70 65 63 |wait for| c_expec|
|00002540| 74 20 2a 2f 0a 09 69 6e | 74 20 63 5f 66 6c 61 67 |t */..in|t c_flag|
|00002550| 73 3b 09 09 2f 2a 20 66 | 6c 61 67 73 20 66 6f 72 |s;../* f|lags for|
|00002560| 20 6d 61 74 63 68 69 6e | 67 20 77 69 74 68 20 74 | matchin|g with t|
|00002570| 68 65 20 73 74 61 74 65 | 2e 20 2a 2f 0a 7d 3b 0a |he state|. */.};.|
|00002580| 0a 23 69 66 64 65 66 20 | 4d 41 49 4e 44 45 46 0a |.#ifdef |MAINDEF.|
|00002590| 0a 73 74 72 75 63 74 20 | 63 6f 6e 76 20 72 69 6e |.struct |conv rin|
|000025a0| 67 5b 5d 20 3d 20 7b 0a | 0a 23 69 66 20 64 65 66 |g[] = {.|.#if def|
|000025b0| 69 6e 65 64 28 48 41 59 | 45 53 29 0a 09 7b 22 41 |ined(HAY|ES)..{"A|
|000025c0| 54 5c 72 22 2c 20 22 4f | 4b 22 2c 20 57 54 49 4d |T\r", "O|K", WTIM|
|000025d0| 45 2c 20 41 41 20 7c 20 | 53 50 4b 20 7d 2c 09 2f |E, AA | |SPK },./|
|000025e0| 2a 20 61 6e 79 6f 6e 65 | 20 74 68 65 72 65 3f 20 |* anyone| there? |
|000025f0| 2a 2f 0a 09 7b 22 41 54 | 4d 30 5c 72 22 2c 20 22 |*/..{"AT|M0\r", "|
|00002600| 4f 4b 22 2c 20 57 54 49 | 4d 45 2c 20 41 41 20 7c |OK", WTI|ME, AA ||
|00002610| 20 53 50 4b 20 7d 2c 09 | 2f 2a 20 74 75 72 6e 20 | SPK },.|/* turn |
|00002620| 4f 46 46 20 73 70 65 61 | 6b 65 72 20 2a 2f 0a 09 |OFF spea|ker */..|
|00002630| 7b 22 41 54 53 30 3d 30 | 5c 72 22 2c 20 22 4f 4b |{"ATS0=0|\r", "OK|
|00002640| 22 2c 20 57 54 49 4d 45 | 2c 20 41 41 20 7c 20 53 |", WTIME|, AA | S|
|00002650| 50 4b 7d 2c 09 2f 2a 20 | 44 49 53 41 42 4c 45 20 |PK},./* |DISABLE |
|00002660| 61 75 74 6f 2d 61 6e 73 | 77 65 72 20 2a 2f 0a 09 |auto-ans|wer */..|
|00002670| 7b 22 41 54 53 30 3d 31 | 5c 72 22 2c 20 22 4f 4b |{"ATS0=1|\r", "OK|
|00002680| 22 2c 20 57 54 49 4d 45 | 2c 20 41 41 7d 2c 09 09 |", WTIME|, AA},..|
|00002690| 2f 2a 20 6d 61 79 62 65 | 20 65 6e 61 62 6c 65 20 |/* maybe| enable |
|000026a0| 61 75 74 6f 20 61 6e 73 | 77 65 72 20 2a 2f 0a 09 |auto ans|wer */..|
|000026b0| 7b 22 41 54 4d 31 5c 72 | 22 2c 20 22 4f 4b 22 2c |{"ATM1\r|", "OK",|
|000026c0| 20 57 54 49 4d 45 2c 20 | 53 50 4b 7d 2c 09 09 2f | WTIME, |SPK},../|
|000026d0| 2a 20 6d 61 79 62 65 20 | 74 75 72 6e 20 73 70 65 |* maybe |turn spe|
|000026e0| 61 6b 65 72 20 6f 6e 20 | 2a 2f 0a 09 7b 22 41 54 |aker on |*/..{"AT|
|000026f0| 58 31 56 31 5c 72 22 2c | 20 22 4f 4b 22 2c 20 57 |X1V1\r",| "OK", W|
|00002700| 54 49 4d 45 2c 20 41 41 | 20 7c 20 53 50 4b 20 7d |TIME, AA| | SPK }|
|00002710| 2c 09 2f 2a 20 74 75 72 | 6e 20 6f 6e 20 72 65 73 |,./* tur|n on res|
|00002720| 70 6f 6e 73 65 73 20 2a | 2f 20 0a 09 7b 22 41 54 |ponses *|/ ..{"AT|
|00002730| 53 32 34 3d 33 5c 72 22 | 2c 20 22 4f 4b 22 2c 20 |S24=3\r"|, "OK", |
|00002740| 57 54 49 4d 45 2c 20 41 | 41 20 7c 20 53 50 4b 7d |WTIME, A|A | SPK}|
|00002750| 2c 09 2f 2a 20 65 6e 61 | 62 6c 65 20 73 70 65 65 |,./* ena|ble spee|
|00002760| 64 2d 73 65 65 6b 69 6e | 67 20 2a 2f 0a 09 7b 22 |d-seekin|g */..{"|
|00002770| 22 2c 20 22 52 49 4e 47 | 22 2c 20 30 2c 20 41 41 |", "RING|", 0, AA|
|00002780| 20 7c 20 53 50 4b 7d 2c | 09 09 2f 2a 20 77 61 69 | | SPK},|../* wai|
|00002790| 74 20 28 69 6e 64 65 66 | 69 6e 61 74 65 6c 79 29 |t (indef|inately)|
|000027a0| 20 66 6f 72 20 52 49 4e | 47 20 69 6e 20 2a 2f 0a | for RIN|G in */.|
|000027b0| 09 7b 22 22 2c 20 22 43 | 4f 4e 4e 45 43 54 22 2c |.{"", "C|ONNECT",|
|000027c0| 20 32 30 2c 20 41 41 20 | 7c 20 53 50 4b 7d 2c 09 | 20, AA || SPK},.|
|000027d0| 09 2f 2a 20 77 61 69 74 | 20 66 6f 72 20 63 61 6c |./* wait| for cal|
|000027e0| 6c 20 74 6f 20 62 65 20 | 63 6f 6e 6e 65 63 74 65 |l to be |connecte|
|000027f0| 64 20 2a 2f 0a 09 7b 4e | 55 4c 4c 2c 20 4e 55 4c |d */..{N|ULL, NUL|
|00002800| 4c 2c 20 30 2c 20 30 7d | 09 09 09 2f 2a 20 66 69 |L, 0, 0}|.../* fi|
|00002810| 6e 69 73 68 65 64 20 2a | 2f 0a 0a 23 65 6c 73 65 |nished *|/..#else|
|00002820| 20 2f 2a 20 64 65 66 69 | 6e 65 64 20 28 48 41 59 | /* defi|ned (HAY|
|00002830| 45 53 29 20 2a 2f 0a 23 | 69 66 20 64 65 66 69 6e |ES) */.#|if defin|
|00002840| 65 64 28 4a 53 45 54 29 | 09 2f 2a 20 41 54 26 54 |ed(JSET)|./* AT&T|
|00002850| 20 41 7a 74 65 63 20 50 | 72 6f 74 6f 63 6f 6c 20 | Aztec P|rotocol |
|00002860| 2a 2f 0a 09 7b 22 5c 5c | 64 5c 72 5c 5c 64 22 2c |*/..{"\\|d\r\\d",|
|00002870| 20 22 4d 4f 44 45 4d 3a | 20 22 2c 20 57 54 49 4d | "MODEM:| ", WTIM|
|00002880| 45 2c 20 30 20 7d 2c 09 | 2f 2a 20 61 6e 79 6f 6e |E, 0 },.|/* anyon|
|00002890| 65 20 74 68 65 72 65 3f | 20 2a 2f 0a 09 7b 22 22 |e there?| */..{""|
|000028a0| 2c 20 22 44 41 54 41 22 | 2c 20 33 36 30 30 2c 20 |, "DATA"|, 3600, |
|000028b0| 30 7d 2c 09 09 2f 2a 20 | 77 61 69 74 20 28 31 20 |0},../* |wait (1 |
|000028c0| 68 6f 75 72 29 20 66 6f | 72 20 52 49 4e 47 20 69 |hour) fo|r RING i|
|000028d0| 6e 20 2a 2f 0a 09 7b 4e | 55 4c 4c 2c 20 4e 55 4c |n */..{N|ULL, NUL|
|000028e0| 4c 2c 20 30 2c 20 30 7d | 09 09 09 2f 2a 20 53 68 |L, 0, 0}|.../* Sh|
|000028f0| 6f 75 6c 64 20 62 65 20 | 69 6e 64 65 66 69 6e 69 |ould be |indefini|
|00002900| 74 65 2c 20 62 75 74 20 | 70 72 65 76 65 6e 74 0a |te, but |prevent.|
|00002910| 09 09 09 09 09 20 20 20 | 70 72 6f 62 6c 65 6d 73 |..... |problems|
|00002920| 20 69 66 20 6d 6f 64 65 | 6d 20 67 65 74 73 20 77 | if mode|m gets w|
|00002930| 65 64 67 65 64 20 2a 2f | 0a 0a 23 65 6c 73 65 20 |edged */|..#else |
|00002940| 2f 2a 20 64 65 66 69 6e | 65 64 20 28 4a 53 45 54 |/* defin|ed (JSET|
|00002950| 29 20 2a 2f 0a 09 7b 4e | 55 4c 4c 2c 20 4e 55 4c |) */..{N|ULL, NUL|
|00002960| 4c 2c 20 30 2c 20 30 7d | 09 09 09 2f 2a 20 6e 6f |L, 0, 0}|.../* no|
|00002970| 20 69 6e 69 74 20 63 6f | 6e 76 65 72 73 61 74 69 | init co|nversati|
|00002980| 6f 6e 20 2a 2f 0a 0a 23 | 65 6e 64 69 66 20 2f 2a |on */..#|endif /*|
|00002990| 20 64 65 66 69 6e 65 64 | 20 28 4a 53 45 54 29 20 | defined| (JSET) |
|000029a0| 2a 2f 0a 23 65 6e 64 69 | 66 20 2f 2a 20 64 65 66 |*/.#endi|f /* def|
|000029b0| 69 6e 65 64 20 28 48 41 | 59 45 53 29 20 2a 2f 0a |ined (HA|YES) */.|
|000029c0| 7d 3b 0a 23 65 6e 64 69 | 66 20 2f 2a 20 64 65 66 |};.#endi|f /* def|
|000029d0| 69 6e 65 64 20 28 4d 41 | 49 4e 44 45 46 29 20 2a |ined (MA|INDEF) *|
|000029e0| 2f 0a 53 48 41 52 5f 45 | 4f 46 0a 69 66 20 74 65 |/.SHAR_E|OF.if te|
|000029f0| 73 74 20 32 38 39 38 20 | 2d 6e 65 20 22 60 77 63 |st 2898 |-ne "`wc|
|00002a00| 20 2d 63 20 3c 20 27 6d | 6f 64 65 6d 2e 68 27 60 | -c < 'm|odem.h'`|
|00002a10| 22 0a 74 68 65 6e 0a 09 | 65 63 68 6f 20 73 68 61 |".then..|echo sha|
|00002a20| 72 3a 20 22 65 72 72 6f | 72 20 74 72 61 6e 73 6d |r: "erro|r transm|
|00002a30| 69 74 74 69 6e 67 20 27 | 6d 6f 64 65 6d 2e 68 27 |itting '|modem.h'|
|00002a40| 22 20 27 28 73 68 6f 75 | 6c 64 20 68 61 76 65 20 |" '(shou|ld have |
|00002a50| 62 65 65 6e 20 32 38 39 | 38 20 63 68 61 72 61 63 |been 289|8 charac|
|00002a60| 74 65 72 73 29 27 0a 66 | 69 0a 66 69 0a 65 63 68 |ters)'.f|i.fi.ech|
|00002a70| 6f 20 73 68 61 72 3a 20 | 22 65 78 74 72 61 63 74 |o shar: |"extract|
|00002a80| 69 6e 67 20 27 6d 6f 64 | 65 6d 2e 63 27 22 20 27 |ing 'mod|em.c'" '|
|00002a90| 28 31 30 31 39 34 20 63 | 68 61 72 61 63 74 65 72 |(10194 c|haracter|
|00002aa0| 73 29 27 0a 69 66 20 74 | 65 73 74 20 2d 66 20 27 |s)'.if t|est -f '|
|00002ab0| 6d 6f 64 65 6d 2e 63 27 | 0a 74 68 65 6e 0a 09 65 |modem.c'|.then..e|
|00002ac0| 63 68 6f 20 73 68 61 72 | 3a 20 22 77 69 6c 6c 20 |cho shar|: "will |
|00002ad0| 6e 6f 74 20 6f 76 65 72 | 2d 77 72 69 74 65 20 65 |not over|-write e|
|00002ae0| 78 69 73 74 69 6e 67 20 | 66 69 6c 65 20 27 6d 6f |xisting |file 'mo|
|00002af0| 64 65 6d 2e 63 27 22 0a | 65 6c 73 65 0a 63 61 74 |dem.c'".|else.cat|
|00002b00| 20 3c 3c 20 5c 53 48 41 | 52 5f 45 4f 46 20 3e 20 | << \SHA|R_EOF > |
|00002b10| 27 6d 6f 64 65 6d 2e 63 | 27 0a 2f 2a 0a 20 2a 20 |'modem.c|'./*. * |
|00002b20| 43 6f 70 79 72 69 67 68 | 74 20 28 63 29 20 44 61 |Copyrigh|t (c) Da|
|00002b30| 76 65 20 53 65 74 74 6c | 65 20 31 39 38 37 0a 20 |ve Settl|e 1987. |
|00002b40| 2a 20 41 6c 6c 20 72 69 | 67 68 74 73 20 72 65 73 |* All ri|ghts res|
|00002b50| 65 72 76 65 64 2e 0a 20 | 2a 20 50 65 72 6d 69 73 |erved.. |* Permis|
|00002b60| 73 69 6f 6e 20 69 73 20 | 67 72 61 6e 74 65 64 20 |sion is |granted |
|00002b70| 74 6f 20 64 6f 20 61 6e | 79 74 68 69 6e 67 20 77 |to do an|ything w|
|00002b80| 69 74 68 20 74 68 69 73 | 20 70 72 6f 67 72 61 6d |ith this| program|
|00002b90| 2c 20 65 78 63 65 70 74 | 20 72 65 6d 6f 76 65 0a |, except| remove.|
|00002ba0| 20 2a 20 74 68 69 73 20 | 63 6f 70 79 72 69 67 68 | * this |copyrigh|
|00002bb0| 74 20 6e 6f 74 69 63 65 | 2c 20 6f 72 20 73 65 6c |t notice|, or sel|
|00002bc0| 6c 20 69 74 20 66 6f 72 | 20 70 72 6f 66 69 74 2e |l it for| profit.|
|00002bd0| 0a 20 2a 0a 20 2a 20 50 | 72 6f 62 6c 65 6d 73 2c |. *. * P|roblems,|
|00002be0| 20 73 75 67 67 65 73 74 | 69 6f 6e 73 2c 20 62 75 | suggest|ions, bu|
|00002bf0| 67 20 66 69 78 65 73 20 | 65 74 63 2c 20 74 6f 3a |g fixes |etc, to:|
|00002c00| 0a 20 2a 0a 20 2a 20 44 | 61 76 65 20 53 65 74 74 |. *. * D|ave Sett|
|00002c10| 6c 65 2c 20 53 4d 42 20 | 42 75 73 69 6e 65 73 73 |le, SMB |Business|
|00002c20| 20 53 6f 66 74 77 61 72 | 65 2c 20 54 68 6f 72 6e | Softwar|e, Thorn|
|00002c30| 20 45 4d 49 20 44 61 74 | 61 73 6f 6c 76 65 0a 20 | EMI Dat|asolve. |
|00002c40| 2a 20 0a 20 2a 20 55 55 | 43 50 3a 0a 20 2a 20 09 |* . * UU|CP:. * .|
|00002c50| 64 61 76 65 40 73 6d 62 | 2e 63 6f 2e 75 6b 0a 20 |dave@smb|.co.uk. |
|00002c60| 2a 20 09 2e 2e 2e 21 6d | 63 76 61 78 21 75 6b 63 |* ....!m|cvax!ukc|
|00002c70| 21 6e 6f 74 74 2d 63 73 | 21 73 6d 62 21 64 61 76 |!nott-cs|!smb!dav|
|00002c80| 65 09 0a 20 2a 20 0a 20 | 2a 20 53 4d 41 49 4c 3a |e.. * . |* SMAIL:|
|00002c90| 09 09 09 09 09 56 6f 69 | 63 65 3a 0a 20 2a 20 09 |.....Voi|ce:. * .|
|00002ca0| 53 4d 42 20 42 75 73 69 | 6e 65 73 73 20 53 6f 66 |SMB Busi|ness Sof|
|00002cb0| 74 77 61 72 65 09 09 20 | 20 20 20 20 2b 34 34 20 |tware.. | +44 |
|00002cc0| 36 32 33 20 36 35 31 36 | 35 31 0a 20 2a 20 09 48 |623 6516|51. * .H|
|00002cd0| 69 67 68 20 53 74 72 65 | 65 74 0a 20 2a 20 09 4d |igh Stre|et. * .M|
|00002ce0| 61 6e 73 66 69 65 6c 64 | 09 09 09 54 65 6c 65 78 |ansfield|...Telex|
|00002cf0| 3a 0a 20 2a 20 09 4e 6f | 74 74 69 6e 67 68 61 6d |:. * .No|ttingham|
|00002d00| 20 4e 47 31 38 20 31 45 | 53 09 09 20 20 20 20 20 | NG18 1E|S.. |
|00002d10| 33 37 33 39 32 20 54 45 | 43 53 4d 47 0a 20 2a 20 |37392 TE|CSMG. * |
|00002d20| 09 45 6e 67 6c 61 6e 64 | 09 0a 20 2a 20 09 09 09 |.England|.. * ...|
|00002d30| 09 09 46 61 78 3a 0a 20 | 2a 20 09 09 09 09 09 20 |..Fax:. |* ..... |
|00002d40| 20 20 20 20 2b 34 34 20 | 36 32 33 20 36 35 39 39 | +44 |623 6599|
|00002d50| 34 37 0a 20 2a 20 0a 20 | 2a 20 6d 6f 64 65 6d 2e |47. * . |* modem.|
|00002d60| 63 3a 20 61 20 62 69 2d | 64 69 72 65 63 74 69 6f |c: a bi-|directio|
|00002d70| 6e 61 6c 20 22 67 65 74 | 74 79 22 20 74 6f 20 61 |nal "get|ty" to a|
|00002d80| 6c 6c 6f 77 20 69 6e 63 | 6f 6d 69 6e 67 20 63 61 |llow inc|oming ca|
|00002d90| 6c 6c 73 20 41 4e 44 20 | 6f 75 74 67 6f 69 6e 67 |lls AND |outgoing|
|00002da0| 20 0a 20 2a 20 75 75 63 | 69 63 6f 27 73 0a 20 2a | . * uuc|ico's. *|
|00002db0| 0a 20 2a 20 4d 6f 64 69 | 66 69 65 64 20 62 79 20 |. * Modi|fied by |
|00002dc0| 52 69 63 6b 20 52 69 63 | 68 61 72 64 73 6f 6e 20 |Rick Ric|hardson |
|00002dd0| 66 6f 72 20 48 44 42 20 | 75 75 63 70 20 61 6e 64 |for HDB |uucp and|
|00002de0| 20 41 54 26 54 20 41 7a | 74 65 63 20 70 72 6f 74 | AT&T Az|tec prot|
|00002df0| 6f 63 6f 6c 0a 20 2a 0a | 20 2a 20 4d 6f 64 69 66 |ocol. *.| * Modif|
|00002e00| 69 65 64 20 62 79 20 4a | 61 63 6b 20 42 6f 6e 6e |ied by J|ack Bonn|
|00002e10| 20 66 6f 72 20 73 74 61 | 74 65 20 6c 6f 67 69 63 | for sta|te logic|
|00002e20| 20 28 61 6c 6c 6f 77 73 | 20 61 75 74 6f 61 6e 73 | (allows| autoans|
|00002e30| 77 65 72 20 6f 6e 2f 6f | 66 66 20 61 74 0a 20 2a |wer on/o|ff at. *|
|00002e40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002e50| 20 20 20 20 20 20 20 61 | 20 67 69 76 65 6e 20 74 | a| given t|
|00002e60| 69 6d 65 20 66 6f 72 20 | 65 61 63 68 20 64 61 79 |ime for |each day|
|00002e70| 20 6f 66 20 74 68 65 20 | 77 65 65 6b 29 0a 20 2a | of the |week). *|
|00002e80| 0a 20 2a 20 4d 6f 64 69 | 66 69 65 64 20 62 79 20 |. * Modi|fied by |
|00002e90| 44 61 76 65 20 53 65 74 | 74 6c 65 3a 0a 20 2a 0a |Dave Set|tle:. *.|
|00002ea0| 20 2a 20 43 6f 64 65 20 | 66 69 78 65 73 3a 0a 20 | * Code |fixes:. |
|00002eb0| 2a 09 68 61 6e 67 75 70 | 20 72 6f 75 74 69 6e 65 |*.hangup| routine|
|00002ec0| 20 61 64 64 65 64 2c 20 | 74 6f 20 6d 61 6b 65 20 | added, |to make |
|00002ed0| 73 75 72 65 20 70 68 6f | 6e 65 20 69 73 20 64 6f |sure pho|ne is do|
|00002ee0| 77 6e 20 62 65 66 6f 72 | 65 20 73 63 72 69 70 74 |wn befor|e script|
|00002ef0| 2c 20 61 6e 64 0a 20 2a | 09 09 61 66 74 65 72 20 |, and. *|..after |
|00002f00| 75 73 65 72 20 64 69 73 | 63 6f 6e 6e 65 63 74 73 |user dis|connects|
|00002f10| 2e 0a 20 2a 09 50 61 72 | 61 6d 65 74 65 72 69 73 |.. *.Par|ameteris|
|00002f20| 65 64 20 73 65 6e 64 2d | 65 78 70 65 63 74 20 72 |ed send-|expect r|
|00002f30| 6f 75 74 69 6e 65 73 2e | 0a 20 2a 09 4d 69 6e 6f |outines.|. *.Mino|
|00002f40| 72 20 62 75 67 20 66 69 | 78 20 74 6f 20 64 72 65 |r bug fi|x to dre|
|00002f50| 61 64 28 29 0a 20 2a 09 | 52 65 2d 65 6e 61 62 6c |ad(). *.|Re-enabl|
|00002f60| 65 20 53 49 47 41 4c 52 | 4d 20 69 6e 20 77 61 6b |e SIGALR|M in wak|
|00002f70| 65 75 70 28 29 0a 20 2a | 09 43 61 74 63 68 20 61 |eup(). *|.Catch a|
|00002f80| 6c 6c 20 73 69 67 6e 61 | 6c 73 2c 20 74 6f 20 65 |ll signa|ls, to e|
|00002f90| 6e 61 62 6c 65 20 63 72 | 61 73 68 65 73 20 74 6f |nable cr|ashes to|
|00002fa0| 20 62 65 20 64 65 74 65 | 63 74 65 64 2e 0a 20 2a | be dete|cted.. *|
|00002fb0| 09 43 68 6d 6f 64 20 64 | 65 76 69 63 65 20 62 61 |.Chmod d|evice ba|
|00002fc0| 63 6b 20 74 6f 20 36 36 | 36 2c 20 73 6f 20 74 68 |ck to 66|6, so th|
|00002fd0| 61 74 20 77 65 20 63 61 | 6e 20 75 73 65 20 69 74 |at we ca|n use it|
|00002fe0| 20 61 66 74 65 72 77 61 | 72 64 73 2e 0a 20 2a 20 | afterwa|rds.. * |
|00002ff0| 20 20 20 20 20 4f 63 74 | 20 38 37 3a 20 66 69 78 | Oct| 87: fix|
|00003000| 75 70 20 6d 6f 64 65 6d | 20 63 6f 6e 74 72 6f 6c |up modem| control|
|00003010| 20 77 69 74 68 20 43 4c | 4f 43 41 4c 2c 20 73 6f | with CL|OCAL, so|
|00003020| 20 74 68 61 74 20 72 65 | 6d 6f 74 65 20 64 69 73 | that re|mote dis|
|00003030| 63 6f 6e 6e 65 63 74 0a | 20 2a 09 09 63 61 6e 20 |connect.| *..can |
|00003040| 62 65 20 64 65 74 65 63 | 74 65 64 20 61 6e 64 20 |be detec|ted and |
|00003050| 64 65 61 6c 74 20 77 69 | 74 68 2e 0a 20 2a 09 4f |dealt wi|th.. *.O|
|00003060| 63 74 20 38 37 3a 20 66 | 69 78 20 61 75 74 6f 6c |ct 87: f|ix autol|
|00003070| 6f 67 6f 75 74 20 74 6f | 20 73 65 6e 64 20 73 65 |ogout to| send se|
|00003080| 72 69 65 73 20 6f 66 20 | 73 69 67 6e 61 6c 73 2c |ries of |signals,|
|00003090| 20 6e 6f 74 20 6a 75 73 | 74 20 53 49 47 48 55 50 | not jus|t SIGHUP|
|000030a0| 0a 20 2a 09 4f 63 74 20 | 38 37 3a 20 43 6c 65 61 |. *.Oct |87: Clea|
|000030b0| 6e 20 75 70 20 63 6f 64 | 65 2c 20 61 6e 64 20 64 |n up cod|e, and d|
|000030c0| 69 73 74 72 69 62 75 74 | 65 20 74 6f 20 6f 74 68 |istribut|e to oth|
|000030d0| 65 72 20 73 6f 75 72 63 | 65 20 66 69 6c 65 73 2e |er sourc|e files.|
|000030e0| 0a 20 2a 09 4e 6f 76 20 | 38 37 3a 20 46 69 78 20 |. *.Nov |87: Fix |
|000030f0| 6c 75 72 6b 69 6e 67 20 | 62 75 67 20 69 6e 20 27 |lurking |bug in '|
|00003100| 65 78 70 65 63 74 27 2e | 20 43 6c 65 61 6e 20 63 |expect'.| Clean c|
|00003110| 6f 64 65 20 66 6f 72 20 | 27 6c 69 6e 74 27 2e 0a |ode for |'lint'..|
|00003120| 20 2a 09 4e 6f 76 20 38 | 37 3a 20 49 67 6e 6f 72 | *.Nov 8|7: Ignor|
|00003130| 65 20 53 49 48 47 55 50 | 27 73 20 67 65 6e 65 72 |e SIHGUP|'s gener|
|00003140| 61 74 65 64 20 62 79 20 | 27 68 61 6e 67 75 70 27 |ated by |'hangup'|
|00003150| 2e 0a 20 2a 09 44 65 63 | 20 38 37 3a 20 46 6f 72 |.. *.Dec| 87: For|
|00003160| 63 65 20 67 65 74 74 79 | 20 4e 4f 54 20 74 6f 20 |ce getty| NOT to |
|00003170| 68 61 6e 67 75 70 20 74 | 68 65 20 6c 69 6e 65 20 |hangup t|he line |
|00003180| 62 65 66 6f 72 65 20 6c | 6f 67 69 6e 2e 0a 20 2a |before l|ogin.. *|
|00003190| 09 4a 61 6e 20 38 37 3a | 20 4f 70 65 6e 20 73 74 |.Jan 87:| Open st|
|000031a0| 64 69 6f 20 66 69 6c 65 | 20 64 65 73 63 72 69 70 |dio file| descrip|
|000031b0| 74 6f 72 73 2e 0a 20 2a | 0a 20 2a 0a 20 2a 2f 0a |tors.. *|. *. */.|
|000031c0| 23 69 6e 63 6c 75 64 65 | 20 3c 73 79 73 2f 74 79 |#include| <sys/ty|
|000031d0| 70 65 73 2e 68 3e 0a 23 | 69 6e 63 6c 75 64 65 20 |pes.h>.#|include |
|000031e0| 3c 73 74 64 69 6f 2e 68 | 3e 0a 23 69 6e 63 6c 75 |<stdio.h|>.#inclu|
|000031f0| 64 65 20 3c 73 69 67 6e | 61 6c 2e 68 3e 0a 23 69 |de <sign|al.h>.#i|
|00003200| 6e 63 6c 75 64 65 20 3c | 65 72 72 6e 6f 2e 68 3e |nclude <|errno.h>|
|00003210| 0a 23 69 6e 63 6c 75 64 | 65 20 3c 66 63 6e 74 6c |.#includ|e <fcntl|
|00003220| 2e 68 3e 0a 23 69 6e 63 | 6c 75 64 65 20 3c 74 65 |.h>.#inc|lude <te|
|00003230| 72 6d 69 6f 2e 68 3e 0a | 23 69 6e 63 6c 75 64 65 |rmio.h>.|#include|
|00003240| 20 3c 73 79 73 2f 73 74 | 61 74 2e 68 3e 0a 23 69 | <sys/st|at.h>.#i|
|00003250| 6e 63 6c 75 64 65 20 3c | 74 69 6d 65 2e 68 3e 0a |nclude <|time.h>.|
|00003260| 0a 23 69 66 64 65 66 20 | 57 41 54 43 48 49 54 0a |.#ifdef |WATCHIT.|
|00003270| 23 69 6e 63 6c 75 64 65 | 20 3c 70 77 64 2e 68 3e |#include| <pwd.h>|
|00003280| 0a 73 74 72 75 63 74 20 | 70 61 73 73 77 64 20 2a |.struct |passwd *|
|00003290| 67 65 74 70 77 75 69 64 | 28 29 3b 0a 23 65 6e 64 |getpwuid|();.#end|
|000032a0| 69 66 0a 0a 23 64 65 66 | 69 6e 65 20 4d 41 49 4e |if..#def|ine MAIN|
|000032b0| 44 45 46 0a 23 69 6e 63 | 6c 75 64 65 20 22 6d 6f |DEF.#inc|lude "mo|
|000032c0| 64 65 6d 2e 68 22 09 09 | 2f 2a 20 76 61 72 69 61 |dem.h"..|/* varia|
|000032d0| 62 6c 65 20 64 65 66 69 | 6e 69 74 69 6f 6e 73 20 |ble defi|nitions |
|000032e0| 2a 2f 0a 2f 2a 20 0a 20 | 2a 20 77 61 6b 65 75 70 |*/./* . |* wakeup|
|000032f0| 20 67 65 74 73 20 63 61 | 6c 6c 65 64 20 77 68 65 | gets ca|lled whe|
|00003300| 6e 20 74 68 65 20 61 6c | 61 72 6d 20 67 6f 65 73 |n the al|arm goes|
|00003310| 20 6f 66 66 20 0a 20 2a | 2f 0a 77 61 6b 65 75 70 | off . *|/.wakeup|
|00003320| 28 29 7b 0a 09 73 69 67 | 6e 61 6c 28 53 49 47 41 |(){..sig|nal(SIGA|
|00003330| 4c 52 4d 2c 20 77 61 6b | 65 75 70 29 3b 0a 7d 0a |LRM, wak|eup);.}.|
|00003340| 0a 66 61 75 6c 74 28 73 | 69 67 29 7b 0a 09 70 72 |.fault(s|ig){..pr|
|00003350| 69 6e 74 66 28 22 43 72 | 61 73 68 65 64 20 77 69 |intf("Cr|ashed wi|
|00003360| 74 68 20 73 69 67 6e 61 | 6c 20 25 64 5c 6e 22 2c |th signa|l %d\n",|
|00003370| 20 73 69 67 29 3b 0a 09 | 63 6c 6f 73 65 64 6f 77 | sig);..|closedow|
|00003380| 6e 28 73 69 67 29 3b 0a | 7d 0a 0a 63 6c 6f 73 65 |n(sig);.|}..close|
|00003390| 64 6f 77 6e 28 73 69 67 | 29 7b 0a 09 74 69 6d 65 |down(sig|){..time|
|000033a0| 5f 74 20 6e 6f 77 3b 0a | 09 6e 6f 77 20 3d 20 74 |_t now;.|.now = t|
|000033b0| 69 6d 65 28 28 6c 6f 6e | 67 20 2a 29 20 30 29 3b |ime((lon|g *) 0);|
|000033c0| 0a 2f 2a 0a 20 2a 20 5b | 4e 6f 76 20 38 37 5d 3a |./*. * [|Nov 87]:|
|000033d0| 20 53 69 6e 63 65 20 77 | 65 27 72 65 20 61 62 6f | Since w|e're abo|
|000033e0| 75 74 20 74 6f 20 68 61 | 6e 67 20 75 70 20 74 68 |ut to ha|ng up th|
|000033f0| 65 20 70 68 6f 6e 65 2c | 20 0a 20 2a 20 69 67 6e |e phone,| . * ign|
|00003400| 6f 72 65 20 74 68 65 20 | 73 69 67 6e 61 6c 20 74 |ore the |signal t|
|00003410| 68 61 74 20 74 68 69 73 | 20 69 73 20 67 6f 69 6e |hat this| is goin|
|00003420| 67 20 74 6f 20 67 65 6e | 65 72 61 74 65 2e 0a 20 |g to gen|erate.. |
|00003430| 2a 2f 0a 09 73 69 67 6e | 61 6c 28 53 49 47 48 55 |*/..sign|al(SIGHU|
|00003440| 50 2c 20 53 49 47 5f 49 | 47 4e 29 3b 0a 09 69 66 |P, SIG_I|GN);..if|
|00003450| 28 73 69 67 29 20 70 72 | 69 6e 74 66 28 22 43 61 |(sig) pr|intf("Ca|
|00003460| 75 67 68 74 20 73 69 67 | 6e 61 6c 20 25 64 5c 6e |ught sig|nal %d\n|
|00003470| 22 2c 20 73 69 67 29 3b | 0a 09 70 72 69 6e 74 66 |", sig);|..printf|
|00003480| 28 22 43 6c 6f 73 65 64 | 6f 77 6e 20 61 74 20 25 |("Closed|own at %|
|00003490| 73 22 2c 20 61 73 63 74 | 69 6d 65 28 6c 6f 63 61 |s", asct|ime(loca|
|000034a0| 6c 74 69 6d 65 28 26 6e | 6f 77 29 29 29 3b 0a 2f |ltime(&n|ow)));./|
|000034b0| 2a 0a 20 2a 20 4f 63 74 | 20 38 37 3a 20 6e 65 77 |*. * Oct| 87: new|
|000034c0| 20 61 64 64 69 74 69 6f | 6e 20 66 6f 72 20 53 49 | additio|n for SI|
|000034d0| 47 48 55 50 2e 20 57 65 | 20 72 65 63 65 69 76 65 |GHUP. We| receive|
|000034e0| 20 74 68 69 73 20 73 69 | 67 6e 61 6c 20 77 68 65 | this si|gnal whe|
|000034f0| 6e 09 74 68 65 20 6c 69 | 6e 65 0a 20 2a 20 69 73 |n.the li|ne. * is|
|00003500| 20 64 69 73 63 6f 6e 6e | 65 63 74 65 64 20 62 79 | disconn|ected by|
|00003510| 20 61 20 72 65 6d 6f 74 | 65 20 63 61 6c 6c 65 72 | a remot|e caller|
|00003520| 2e 20 53 69 6e 63 65 20 | 74 68 65 20 6c 69 6e 65 |. Since |the line|
|00003530| 20 69 73 20 64 65 61 64 | 2c 20 73 6f 20 73 68 6f | is dead|, so sho|
|00003540| 75 6c 64 0a 20 2a 20 74 | 68 65 20 73 68 65 6c 6c |uld. * t|he shell|
|00003550| 20 62 65 20 28 69 74 20 | 67 6f 74 20 53 49 47 48 | be (it |got SIGH|
|00003560| 55 50 20 73 61 6d 65 20 | 61 73 20 75 73 29 3b 20 |UP same |as us); |
|00003570| 6c 6f 67 20 69 74 20 6f | 75 74 20 61 6e 79 77 61 |log it o|ut anywa|
|00003580| 79 2c 20 65 76 65 6e 20 | 69 66 20 69 74 27 73 0a |y, even |if it's.|
|00003590| 20 2a 20 74 72 79 69 6e | 67 20 74 6f 20 69 67 6e | * tryin|g to ign|
|000035a0| 6f 72 65 20 69 74 2e 0a | 20 2a 2f 0a 09 69 66 28 |ore it..| */..if(|
|000035b0| 28 73 69 67 20 3d 3d 20 | 53 49 47 48 55 50 29 20 |(sig == |SIGHUP) |
|000035c0| 26 26 20 73 68 65 6c 6c | 29 20 61 75 74 6f 6c 6f |&& shell|) autolo|
|000035d0| 67 6f 75 74 28 73 68 65 | 6c 6c 29 3b 0a 2f 2a 0a |gout(she|ll);./*.|
|000035e0| 20 2a 20 63 68 61 6e 67 | 65 20 74 68 65 20 76 61 | * chang|e the va|
|000035f0| 6c 75 65 20 69 6e 20 75 | 74 6d 70 20 62 61 63 6b |lue in u|tmp back|
|00003600| 20 74 6f 20 6f 75 72 20 | 70 69 64 2e 0a 20 2a 2f | to our |pid.. */|
|00003610| 09 09 0a 09 69 66 28 73 | 68 65 6c 6c 29 20 75 63 |....if(s|hell) uc|
|00003620| 68 61 6e 67 65 28 73 68 | 65 6c 6c 2c 20 67 65 74 |hange(sh|ell, get|
|00003630| 70 69 64 28 29 29 3b 09 | 2f 2a 20 62 61 63 6b 20 |pid());.|/* back |
|00003640| 74 6f 20 6e 6f 72 6d 61 | 6c 20 2a 2f 0a 2f 2a 0a |to norma|l */./*.|
|00003650| 20 2a 20 63 6c 65 61 72 | 20 6d 6f 64 65 6d 20 6c | * clear| modem l|
|00003660| 69 6e 65 2c 20 77 68 69 | 63 68 20 73 68 6f 75 6c |ine, whi|ch shoul|
|00003670| 64 20 61 6c 73 6f 20 68 | 61 6e 67 75 70 20 74 68 |d also h|angup th|
|00003680| 65 20 70 68 6f 6e 65 20 | 28 69 66 20 69 74 20 77 |e phone |(if it w|
|00003690| 61 73 6e 27 74 20 61 6c | 72 65 61 64 79 29 2e 0a |asn't al|ready)..|
|000036a0| 20 2a 2f 09 0a 09 68 61 | 6e 67 75 70 28 64 65 76 | */...ha|ngup(dev|
|000036b0| 29 3b 0a 09 63 6c 6f 73 | 65 28 64 65 76 29 3b 0a |);..clos|e(dev);.|
|000036c0| 2f 2a 0a 20 2a 20 63 68 | 6d 6f 64 20 74 68 65 20 |/*. * ch|mod the |
|000036d0| 64 65 76 69 63 65 20 62 | 61 63 6b 20 74 6f 20 36 |device b|ack to 6|
|000036e0| 36 36 2c 20 73 6f 20 74 | 68 61 74 20 75 75 63 69 |66, so t|hat uuci|
|000036f0| 63 6f 20 61 6e 64 20 63 | 75 20 63 61 6e 20 61 63 |co and c|u can ac|
|00003700| 63 65 73 73 20 69 74 2e | 0a 20 2a 20 4e 4f 54 45 |cess it.|. * NOTE|
|00003710| 3a 20 49 20 70 72 65 66 | 65 72 20 74 68 69 73 20 |: I pref|er this |
|00003720| 74 6f 20 63 68 6f 77 6e | 28 75 75 63 70 29 2c 20 |to chown|(uucp), |
|00003730| 77 68 69 63 68 20 64 6f | 65 73 20 6e 6f 74 20 61 |which do|es not a|
|00003740| 6c 6c 6f 77 20 22 63 75 | 22 20 61 63 63 65 73 73 |llow "cu|" access|
|00003750| 2e 0a 20 2a 2f 0a 09 63 | 68 6d 6f 64 28 64 6e 61 |.. */..c|hmod(dna|
|00003760| 6d 65 2c 30 36 36 36 29 | 3b 09 2f 2a 20 75 75 63 |me,0666)|;./* uuc|
|00003770| 70 20 61 63 63 65 73 73 | 20 2a 2f 0a 09 75 6e 6c |p access| */..unl|
|00003780| 69 6e 6b 28 6c 6f 63 6b | 66 29 3b 0a 09 69 66 28 |ink(lock|f);..if(|
|00003790| 73 74 61 74 75 73 29 20 | 70 72 69 6e 74 66 28 22 |status) |printf("|
|000037a0| 4c 6f 67 6f 75 74 20 73 | 74 61 74 75 73 20 30 78 |Logout s|tatus 0x|
|000037b0| 25 78 5c 6e 22 2c 20 73 | 74 61 74 75 73 29 3b 0a |%x\n", s|tatus);.|
|000037c0| 09 66 63 6c 6f 73 65 28 | 73 74 64 6f 75 74 29 3b |.fclose(|stdout);|
|000037d0| 0a 09 65 78 69 74 28 30 | 29 3b 0a 7d 0a 09 09 0a |..exit(0|);.}....|
|000037e0| 6d 61 69 6e 28 61 72 67 | 63 2c 20 61 72 67 76 2c |main(arg|c, argv,|
|000037f0| 20 65 6e 76 70 29 0a 63 | 68 61 72 20 2a 2a 61 72 | envp).c|har **ar|
|00003800| 67 76 2c 20 2a 2a 65 6e | 76 70 3b 0a 7b 0a 09 6c |gv, **en|vp;.{..l|
|00003810| 6f 6e 67 20 74 3b 0a 09 | 63 68 61 72 20 2a 61 72 |ong t;..|char *ar|
|00003820| 67 5b 35 5d 2c 20 2a 73 | 70 65 65 64 3b 0a 09 69 |g[5], *s|peed;..i|
|00003830| 6e 74 20 62 61 75 64 2c | 20 69 3b 0a 09 73 74 72 |nt baud,| i;..str|
|00003840| 75 63 74 20 63 6f 6e 76 | 20 2a 70 3b 0a 09 73 74 |uct conv| *p;..st|
|00003850| 72 75 63 74 20 73 74 61 | 74 20 73 62 75 66 3b 0a |ruct sta|t sbuf;.|
|00003860| 09 74 69 6d 65 5f 74 20 | 6e 6f 77 2c 20 6d 74 69 |.time_t |now, mti|
|00003870| 6d 65 3b 0a 23 69 66 64 | 65 66 20 57 41 54 43 48 |me;.#ifd|ef WATCH|
|00003880| 49 54 0a 09 46 49 4c 45 | 20 2a 70 72 6f 63 73 3b |IT..FILE| *procs;|
|00003890| 0a 09 73 74 72 75 63 74 | 20 70 61 73 73 77 64 20 |..struct| passwd |
|000038a0| 2a 70 77 3b 0a 09 63 68 | 61 72 20 70 73 62 75 66 |*pw;..ch|ar psbuf|
|000038b0| 66 5b 31 32 38 5d 3b 0a | 23 65 6e 64 69 66 0a 23 |f[128];.|#endif.#|
|000038c0| 69 66 64 65 66 20 53 50 | 45 45 44 43 4f 4e 46 49 |ifdef SP|EEDCONFI|
|000038d0| 47 0a 09 63 68 61 72 20 | 63 2c 20 62 75 66 66 5b |G..char |c, buff[|
|000038e0| 38 5d 3b 0a 23 65 6e 64 | 69 66 0a 23 69 66 64 65 |8];.#end|if.#ifde|
|000038f0| 66 20 53 54 41 54 45 53 | 0a 09 74 69 6d 65 5f 74 |f STATES|..time_t|
|00003900| 20 64 65 6c 74 61 2c 20 | 73 75 69 63 69 64 65 3b | delta, |suicide;|
|00003910| 0a 09 69 6e 74 20 73 74 | 61 74 65 3b 0a 23 65 6e |..int st|ate;.#en|
|00003920| 64 69 66 0a 09 46 49 4c | 45 20 2a 6c 6f 63 6b 3b |dif..FIL|E *lock;|
|00003930| 0a 2f 2a 0a 20 2a 20 63 | 61 74 63 68 20 61 6e 64 |./*. * c|atch and|
|00003940| 20 72 65 70 6f 72 74 20 | 61 6c 6c 20 73 69 67 6e | report |all sign|
|00003950| 61 6c 73 2c 20 62 75 74 | 20 61 70 70 6c 79 20 73 |als, but| apply s|
|00003960| 70 65 63 69 61 6c 20 74 | 72 65 61 74 6d 65 6e 74 |pecial t|reatment|
|00003970| 20 74 6f 20 6c 65 67 61 | 6c 20 73 69 67 6e 61 6c | to lega|l signal|
|00003980| 73 0a 20 2a 20 41 6e 79 | 20 70 72 6f 67 72 61 6d |s. * Any| program|
|00003990| 20 62 75 67 73 20 67 65 | 74 20 72 65 70 6f 72 74 | bugs ge|t report|
|000039a0| 65 64 20 74 68 69 73 20 | 77 61 79 2e 20 59 6f 75 |ed this |way. You|
|000039b0| 20 63 61 6e 20 67 65 74 | 20 61 20 63 6f 72 65 20 | can get| a core |
|000039c0| 64 75 6d 70 20 62 79 20 | 73 65 6e 64 69 6e 67 0a |dump by |sending.|
|000039d0| 20 2a 20 69 74 20 53 49 | 47 46 50 45 2e 0a 20 2a | * it SI|GFPE.. *|
|000039e0| 2f 0a 20 09 66 6f 72 28 | 69 3d 31 3b 69 3c 53 49 |/. .for(|i=1;i<SI|
|000039f0| 47 55 53 52 31 3b 69 2b | 2b 29 20 73 69 67 6e 61 |GUSR1;i+|+) signa|
|00003a00| 6c 28 69 2c 20 66 61 75 | 6c 74 29 3b 0a 20 09 0a |l(i, fau|lt);. ..|
|00003a10| 20 09 73 69 67 6e 61 6c | 28 53 49 47 48 55 50 2c | .signal|(SIGHUP,|
|00003a20| 20 53 49 47 5f 49 47 4e | 29 3b 0a 20 09 73 69 67 | SIG_IGN|);. .sig|
|00003a30| 6e 61 6c 28 53 49 47 49 | 4e 54 2c 20 53 49 47 5f |nal(SIGI|NT, SIG_|
|00003a40| 49 47 4e 29 3b 0a 20 09 | 73 69 67 6e 61 6c 28 53 |IGN);. .|signal(S|
|00003a50| 49 47 51 55 49 54 2c 20 | 53 49 47 5f 49 47 4e 29 |IGQUIT, |SIG_IGN)|
|00003a60| 3b 0a 20 09 73 69 67 6e | 61 6c 28 53 49 47 46 50 |;. .sign|al(SIGFP|
|00003a70| 45 2c 20 53 49 47 5f 44 | 46 4c 29 3b 09 2f 2a 20 |E, SIG_D|FL);./* |
|00003a80| 79 6f 75 20 63 61 6e 20 | 67 65 74 20 61 20 63 6f |you can |get a co|
|00003a90| 72 65 20 64 75 6d 70 20 | 68 65 72 65 20 2a 2f 0a |re dump |here */.|
|00003aa0| 20 09 73 69 67 6e 61 6c | 28 53 49 47 41 4c 52 4d | .signal|(SIGALRM|
|00003ab0| 2c 20 77 61 6b 65 75 70 | 29 3b 0a 20 09 73 69 67 |, wakeup|);. .sig|
|00003ac0| 6e 61 6c 28 53 49 47 54 | 45 52 4d 2c 20 63 6c 6f |nal(SIGT|ERM, clo|
|00003ad0| 73 65 64 6f 77 6e 29 3b | 0a 2f 2a 0a 20 2a 20 4f |sedown);|./*. * O|
|00003ae0| 70 65 6e 20 74 68 65 20 | 73 74 61 6e 64 61 72 64 |pen the |standard|
|00003af0| 20 49 2f 4f 20 66 69 6c | 65 20 64 65 73 63 72 69 | I/O fil|e descri|
|00003b00| 70 74 6f 72 73 2c 20 69 | 66 20 6e 6f 74 20 61 6c |ptors, i|f not al|
|00003b10| 72 65 61 64 79 20 6f 70 | 65 6e 2e 0a 20 2a 20 52 |ready op|en.. * R|
|00003b20| 75 6e 6e 69 6e 67 20 66 | 72 6f 6d 20 69 6e 69 74 |unning f|rom init|
|00003b30| 2c 20 77 65 20 64 6f 6e | 27 74 20 68 61 76 65 20 |, we don|'t have |
|00003b40| 61 20 74 65 72 6d 69 6e | 61 6c 2c 20 73 6f 20 6f |a termin|al, so o|
|00003b50| 75 74 70 75 74 20 74 6f | 20 4c 4f 47 46 49 4c 45 |utput to| LOGFILE|
|00003b60| 2e 0a 20 2a 2f 0a 20 09 | 69 66 28 28 69 20 3d 20 |.. */. .|if((i = |
|00003b70| 6f 70 65 6e 28 22 2f 64 | 65 76 2f 6e 75 6c 6c 22 |open("/d|ev/null"|
|00003b80| 2c 20 30 29 29 20 3d 3d | 20 30 29 20 7b 0a 20 09 |, 0)) ==| 0) {. .|
|00003b90| 09 6f 70 65 6e 28 22 2f | 64 65 76 2f 6e 75 6c 6c |.open("/|dev/null|
|00003ba0| 22 2c 20 31 29 3b 0a 20 | 09 09 6f 70 65 6e 28 22 |", 1);. |..open("|
|00003bb0| 2f 64 65 76 2f 6e 75 6c | 6c 22 2c 20 31 29 3b 0a |/dev/nul|l", 1);.|
|00003bc0| 20 09 7d 0a 20 09 65 6c | 73 65 20 63 6c 6f 73 65 | .}. .el|se close|
|00003bd0| 28 69 29 3b 0a 20 09 66 | 72 65 6f 70 65 6e 28 4c |(i);. .f|reopen(L|
|00003be0| 4f 47 46 49 4c 45 2c 20 | 22 61 22 2c 20 73 74 64 |OGFILE, |"a", std|
|00003bf0| 6f 75 74 29 3b 0a 23 69 | 66 64 65 66 20 53 45 54 |out);.#i|fdef SET|
|00003c00| 42 55 46 0a 09 73 65 74 | 62 75 66 28 73 74 64 6f |BUF..set|buf(stdo|
|00003c10| 75 74 2c 20 4e 55 4c 4c | 29 3b 09 09 09 2f 2a 20 |ut, NULL|);.../* |
|00003c20| 69 66 20 73 65 74 76 62 | 75 66 20 62 72 6f 6b 65 |if setvb|uf broke|
|00003c30| 6e 20 2a 2f 0a 23 65 6c | 73 65 0a 20 09 73 65 74 |n */.#el|se. .set|
|00003c40| 76 62 75 66 28 73 74 64 | 6f 75 74 2c 20 4e 55 4c |vbuf(std|out, NUL|
|00003c50| 4c 2c 20 5f 49 4f 4c 42 | 46 2c 20 30 29 3b 0a 23 |L, _IOLB|F, 0);.#|
|00003c60| 65 6e 64 69 66 0a 0a 09 | 69 66 20 28 61 72 67 63 |endif...|if (argc|
|00003c70| 20 3c 20 32 29 0a 09 7b | 0a 09 09 70 72 69 6e 74 | < 2)..{|...print|
|00003c80| 66 28 22 55 73 61 67 65 | 3a 20 25 73 20 3c 74 74 |f("Usage|: %s <tt|
|00003c90| 79 3e 20 5b 3c 73 70 65 | 65 64 3e 5d 5c 6e 22 2c |y> [<spe|ed>]\n",|
|00003ca0| 20 61 72 67 76 5b 30 5d | 29 3b 0a 09 09 73 6c 65 | argv[0]|);...sle|
|00003cb0| 65 70 28 35 29 3b 0a 09 | 09 65 78 69 74 28 35 29 |ep(5);..|.exit(5)|
|00003cc0| 3b 0a 09 7d 0a 20 09 20 | 09 0a 09 73 70 72 69 6e |;..}. . |...sprin|
|00003cd0| 74 66 28 64 6e 61 6d 65 | 2c 20 22 2f 64 65 76 2f |tf(dname|, "/dev/|
|00003ce0| 25 73 22 2c 20 61 72 67 | 76 5b 31 5d 29 3b 0a 23 |%s", arg|v[1]);.#|
|00003cf0| 69 66 20 64 65 66 69 6e | 65 64 28 4f 4c 33 42 32 |if defin|ed(OL3B2|
|00003d00| 29 0a 09 73 70 72 69 6e | 74 66 28 6c 6f 63 6b 66 |)..sprin|tf(lockf|
|00003d10| 2c 20 22 2f 75 73 72 2f | 73 70 6f 6f 6c 2f 6c 6f |, "/usr/|spool/lo|
|00003d20| 63 6b 73 2f 4c 43 4b 2e | 2e 25 73 22 2c 20 61 72 |cks/LCK.|.%s", ar|
|00003d30| 67 76 5b 31 5d 29 3b 0a | 23 65 6c 73 65 0a 23 69 |gv[1]);.|#else.#i|
|00003d40| 66 20 20 64 65 66 69 6e | 65 64 28 48 44 42 29 0a |f defin|ed(HDB).|
|00003d50| 09 73 70 72 69 6e 74 66 | 28 6c 6f 63 6b 66 2c 20 |.sprintf|(lockf, |
|00003d60| 22 2f 75 73 72 2f 73 70 | 6f 6f 6c 2f 6c 6f 63 6b |"/usr/sp|ool/lock|
|00003d70| 73 2f 4c 43 4b 2e 4c 2e | 25 73 22 2c 20 61 72 67 |s/LCK.L.|%s", arg|
|00003d80| 76 5b 31 5d 29 3b 0a 23 | 65 6c 73 65 0a 09 73 70 |v[1]);.#|else..sp|
|00003d90| 72 69 6e 74 66 28 6c 6f | 63 6b 66 2c 20 22 2f 75 |rintf(lo|ckf, "/u|
|00003da0| 73 72 2f 73 70 6f 6f 6c | 2f 75 75 63 70 2f 4c 43 |sr/spool|/uucp/LC|
|00003db0| 4b 2e 2e 25 73 22 2c 20 | 61 72 67 76 5b 31 5d 29 |K..%s", |argv[1])|
|00003dc0| 3b 0a 23 65 6e 64 69 66 | 0a 23 65 6e 64 69 66 0a |;.#endif|.#endif.|
|00003dd0| 2f 2a 0a 20 2a 20 64 6f | 20 6e 6f 74 20 73 74 61 |/*. * do| not sta|
|00003de0| 72 74 20 77 68 69 6c 65 | 20 64 65 76 69 63 65 20 |rt while| device |
|00003df0| 69 73 20 6c 6f 63 6b 65 | 64 0a 20 2a 2f 0a 20 09 |is locke|d. */. .|
|00003e00| 77 68 69 6c 65 28 6c 6f | 63 6b 65 64 28 29 29 20 |while(lo|cked()) |
|00003e10| 73 6c 65 65 70 28 33 30 | 29 3b 0a 09 69 66 28 28 |sleep(30|);..if((|
|00003e20| 64 65 76 20 3d 20 6f 70 | 65 6e 28 64 6e 61 6d 65 |dev = op|en(dname|
|00003e30| 2c 20 4f 5f 52 44 57 52 | 20 7c 20 4f 5f 4e 44 45 |, O_RDWR| | O_NDE|
|00003e40| 4c 41 59 29 29 20 3d 3d | 20 2d 31 29 20 7b 0a 09 |LAY)) ==| -1) {..|
|00003e50| 09 09 70 65 72 72 6f 72 | 28 64 6e 61 6d 65 29 3b |..perror|(dname);|
|00003e60| 0a 09 09 09 73 6c 65 65 | 70 28 35 29 3b 09 2f 2a |....slee|p(5);./*|
|00003e70| 20 64 6f 6e 27 74 20 67 | 6f 20 63 72 61 7a 79 20 | don't g|o crazy |
|00003e80| 77 69 74 68 20 72 65 73 | 70 61 77 6e 73 20 2a 2f |with res|pawns */|
|00003e90| 0a 09 09 09 65 78 69 74 | 28 34 29 3b 0a 09 7d 0a |....exit|(4);..}.|
|00003ea0| 0a 20 2f 2a 0a 20 20 2a | 20 73 65 74 75 70 20 63 |. /*. *| setup c|
|00003eb0| 6f 72 72 65 63 74 20 74 | 69 6d 65 20 7a 6f 6e 65 |orrect t|ime zone|
|00003ec0| 0a 20 20 2a 2f 0a 09 70 | 75 74 65 6e 76 28 54 49 |. */..p|utenv(TI|
|00003ed0| 4d 45 5a 4f 4e 45 29 3b | 0a 20 2f 2a 0a 20 20 2a |MEZONE);|. /*. *|
|00003ee0| 20 73 65 74 20 74 65 72 | 6d 69 6e 61 6c 20 70 61 | set ter|minal pa|
|00003ef0| 72 61 6d 65 74 65 72 73 | 0a 20 20 2a 20 41 64 64 |rameters|. * Add|
|00003f00| 69 74 69 6f 6e 61 6c 20 | 61 72 67 75 6d 65 6e 74 |itional |argument|
|00003f10| 20 28 69 66 20 70 72 65 | 73 65 6e 74 29 20 63 61 | (if pre|sent) ca|
|00003f20| 6e 20 62 65 20 75 73 65 | 64 20 74 6f 20 66 6f 72 |n be use|d to for|
|00003f30| 63 65 20 61 6e 20 69 6e | 69 74 69 61 6c 20 73 70 |ce an in|itial sp|
|00003f40| 65 65 64 0a 20 20 2a 20 | 28 54 68 61 6e 6b 73 20 |eed. * |(Thanks |
|00003f50| 72 69 63 6b 29 0a 20 20 | 2a 2f 0a 09 69 66 28 61 |rick). |*/..if(a|
|00003f60| 72 67 63 20 3e 20 32 29 | 20 73 70 65 65 64 20 3d |rgc > 2)| speed =|
|00003f70| 20 61 72 67 76 5b 32 5d | 3b 0a 09 65 6c 73 65 20 | argv[2]|;..else |
|00003f80| 73 70 65 65 64 20 3d 20 | 44 45 46 53 50 45 45 44 |speed = |DEFSPEED|
|00003f90| 3b 0a 09 62 61 75 64 20 | 3d 20 66 69 6e 64 73 70 |;..baud |= findsp|
|00003fa0| 65 65 64 28 73 70 65 65 | 64 29 3b 0a 09 69 6e 69 |eed(spee|d);..ini|
|00003fb0| 74 5f 74 65 72 6d 28 64 | 65 76 2c 20 62 61 75 64 |t_term(d|ev, baud|
|00003fc0| 29 3b 0a 2f 2a 0a 20 2a | 20 73 65 6e 64 2d 65 78 |);./*. *| send-ex|
|00003fd0| 70 65 63 74 20 73 74 72 | 69 6e 67 73 20 2d 20 61 |pect str|ings - a|
|00003fe0| 74 20 74 68 65 20 65 6e | 64 2c 20 73 6f 6d 65 6f |t the en|d, someo|
|00003ff0| 6e 65 20 68 61 73 20 63 | 6f 6e 6e 65 63 74 65 64 |ne has c|onnected|
|00004000| 20 74 6f 20 74 68 65 20 | 6d 6f 64 65 6d 0a 20 2a | to the |modem. *|
|00004010| 2f 0a 23 69 66 64 65 66 | 20 53 54 41 54 45 53 0a |/.#ifdef| STATES.|
|00004020| 2f 2a 0a 20 2a 20 66 69 | 6e 64 20 6f 75 74 20 77 |/*. * fi|nd out w|
|00004030| 68 65 6e 20 74 68 65 20 | 6e 65 78 74 20 73 74 61 |hen the |next sta|
|00004040| 74 65 20 63 68 61 6e 67 | 65 20 69 73 20 64 75 65 |te chang|e is due|
|00004050| 20 74 6f 20 6f 63 63 75 | 72 2e 20 41 74 20 74 68 | to occu|r. At th|
|00004060| 69 73 20 70 6f 69 6e 74 | 2c 20 77 65 20 65 78 69 |is point|, we exi|
|00004070| 74 2e 0a 20 2a 20 54 68 | 65 20 6e 65 78 74 20 69 |t.. * Th|e next i|
|00004080| 6e 69 74 69 61 74 69 6f | 6e 20 77 69 6c 6c 20 73 |nitiatio|n will s|
|00004090| 65 74 20 74 68 65 20 6d | 6f 64 65 6d 20 75 70 20 |et the m|odem up |
|000040a0| 64 69 66 66 65 72 65 6e | 74 6c 79 2e 0a 20 2a 2f |differen|tly.. */|
|000040b0| 0a 09 64 65 6c 74 61 20 | 3d 20 64 75 72 61 74 69 |..delta |= durati|
|000040c0| 6f 6e 28 26 73 74 61 74 | 65 29 3b 0a 09 73 75 69 |on(&stat|e);..sui|
|000040d0| 63 69 64 65 20 3d 20 74 | 69 6d 65 28 28 6c 6f 6e |cide = t|ime((lon|
|000040e0| 67 20 2a 29 20 30 29 20 | 2b 20 64 65 6c 74 61 3b |g *) 0) |+ delta;|
|000040f0| 0a 23 65 6e 64 69 66 0a | 09 66 6f 72 28 70 20 3d |.#endif.|.for(p =|
|00004100| 20 72 69 6e 67 3b 20 70 | 2d 3e 63 5f 73 65 6e 64 | ring; p|->c_send|
|00004110| 3b 20 70 2b 2b 29 20 7b | 0a 23 69 66 64 65 66 20 |; p++) {|.#ifdef |
|00004120| 53 54 41 54 45 53 0a 09 | 09 69 66 28 21 61 70 70 |STATES..|.if(!app|
|00004130| 6c 69 63 61 62 6c 65 28 | 70 2c 20 73 74 61 74 65 |licable(|p, state|
|00004140| 29 29 20 63 6f 6e 74 69 | 6e 75 65 3b 0a 23 65 6e |)) conti|nue;.#en|
|00004150| 64 69 66 0a 09 09 73 65 | 6e 64 28 70 2d 3e 63 5f |dif...se|nd(p->c_|
|00004160| 73 65 6e 64 2c 20 6d 79 | 77 72 69 74 65 29 3b 0a |send, my|write);.|
|00004170| 23 69 66 64 65 66 20 53 | 54 41 54 45 53 0a 09 09 |#ifdef S|TATES...|
|00004180| 69 66 28 65 78 70 65 63 | 74 28 70 2d 3e 63 5f 65 |if(expec|t(p->c_e|
|00004190| 78 70 65 63 74 2c 20 28 | 69 6e 74 29 28 70 2d 3e |xpect, (|int)(p->|
|000041a0| 63 5f 77 61 69 74 20 3f | 20 6d 69 6e 28 70 2d 3e |c_wait ?| min(p->|
|000041b0| 63 5f 77 61 69 74 2c 20 | 64 65 6c 74 61 29 20 3a |c_wait, |delta) :|
|000041c0| 20 64 65 6c 74 61 29 2c | 20 6d 79 72 65 61 64 29 | delta),| myread)|
|000041d0| 29 20 7b 0a 23 65 6c 73 | 65 0a 09 09 69 66 28 65 |) {.#els|e...if(e|
|000041e0| 78 70 65 63 74 28 70 2d | 3e 63 5f 65 78 70 65 63 |xpect(p-|>c_expec|
|000041f0| 74 2c 20 70 2d 3e 63 5f | 77 61 69 74 2c 20 6d 79 |t, p->c_|wait, my|
|00004200| 72 65 61 64 29 29 20 7b | 0a 23 65 6e 64 69 66 0a |read)) {|.#endif.|
|00004210| 09 09 09 74 20 3d 20 74 | 69 6d 65 28 28 6c 6f 6e |...t = t|ime((lon|
|00004220| 67 20 2a 29 20 30 29 3b | 0a 23 69 66 64 65 66 20 |g *) 0);|.#ifdef |
|00004230| 53 54 41 54 45 53 0a 09 | 09 09 69 66 28 74 20 3e |STATES..|..if(t >|
|00004240| 3d 20 73 75 69 63 69 64 | 65 29 20 7b 0a 09 09 09 |= suicid|e) {....|
|00004250| 09 70 72 69 6e 74 66 28 | 22 45 78 69 74 20 64 75 |.printf(|"Exit du|
|00004260| 65 20 74 6f 20 73 74 61 | 74 65 20 63 68 61 6e 67 |e to sta|te chang|
|00004270| 65 5c 6e 22 29 3b 0a 09 | 09 09 09 65 78 69 74 28 |e\n");..|...exit(|
|00004280| 30 29 3b 0a 09 09 09 7d | 0a 23 65 6e 64 69 66 0a |0);....}|.#endif.|
|00004290| 09 09 09 70 72 69 6e 74 | 66 28 22 49 6e 63 6f 6d |...print|f("Incom|
|000042a0| 69 6e 67 20 63 61 6c 6c | 20 66 61 69 6c 65 64 20 |ing call| failed |
|000042b0| 74 6f 20 63 6f 6e 6e 65 | 63 74 20 6f 6e 20 25 73 |to conne|ct on %s|
|000042c0| 22 2c 20 61 73 63 74 69 | 6d 65 28 6c 6f 63 61 6c |", ascti|me(local|
|000042d0| 74 69 6d 65 28 26 74 29 | 29 29 3b 0a 2f 2a 0a 20 |time(&t)|));./*. |
|000042e0| 2a 20 77 65 20 64 6f 6e | 27 74 20 68 61 76 65 20 |* we don|'t have |
|000042f0| 74 6f 20 64 6f 20 61 6e | 79 74 68 69 6e 67 20 73 |to do an|ything s|
|00004300| 70 65 63 69 61 6c 20 68 | 65 72 65 2c 20 73 69 6e |pecial h|ere, sin|
|00004310| 63 65 20 6e 6f 20 6c 6f | 63 6b 73 20 68 61 76 65 |ce no lo|cks have|
|00004320| 20 62 65 65 6e 20 73 65 | 74 75 70 2e 0a 20 2a 20 | been se|tup.. * |
|00004330| 48 6f 77 65 76 65 72 2c | 20 73 69 6e 63 65 20 74 |However,| since t|
|00004340| 68 65 20 6d 61 69 6e 20 | 70 72 6f 62 6c 65 6d 73 |he main |problems|
|00004350| 20 61 70 70 65 61 72 20 | 74 6f 20 62 65 20 6e 6f | appear |to be no|
|00004360| 6e 2d 72 65 73 70 6f 6e | 64 69 6e 67 20 6d 6f 64 |n-respon|ding mod|
|00004370| 65 6d 73 2c 20 73 65 6e | 64 0a 20 2a 20 69 74 20 |ems, sen|d. * it |
|00004380| 73 6f 6d 65 20 73 6f 72 | 74 20 6f 66 20 27 75 6e |some sor|t of 'un|
|00004390| 2d 77 65 64 67 69 6e 67 | 27 20 73 65 71 75 65 6e |-wedging|' sequen|
|000043a0| 63 65 0a 20 2a 2f 0a 20 | 09 09 09 73 65 6e 64 28 |ce. */. |...send(|
|000043b0| 52 45 53 45 54 2c 20 6d | 79 77 72 69 74 65 29 3b |RESET, m|ywrite);|
|000043c0| 0a 20 09 09 09 73 6c 65 | 65 70 28 33 29 3b 0a 09 |. ...sle|ep(3);..|
|000043d0| 09 09 68 61 6e 67 75 70 | 28 64 65 76 29 3b 0a 09 |..hangup|(dev);..|
|000043e0| 09 09 73 6c 65 65 70 28 | 31 30 29 3b 0a 09 09 09 |..sleep(|10);....|
|000043f0| 69 6f 63 74 6c 28 64 65 | 76 2c 20 54 43 46 4c 53 |ioctl(de|v, TCFLS|
|00004400| 48 2c 20 32 29 3b 09 2f | 2a 20 46 6c 75 73 68 20 |H, 2);./|* Flush |
|00004410| 62 6f 74 68 20 71 75 65 | 75 65 73 20 2a 2f 0a 09 |both que|ues */..|
|00004420| 09 09 65 78 69 74 28 33 | 29 3b 0a 09 09 09 2f 2a |..exit(3|);..../*|
|00004430| 4e 4f 54 52 45 41 43 48 | 45 44 2a 2f 0a 09 09 7d |NOTREACH|ED*/...}|
|00004440| 0a 09 7d 0a 09 73 69 67 | 6e 61 6c 28 53 49 47 41 |..}..sig|nal(SIGA|
|00004450| 4c 52 4d 2c 20 77 61 6b | 65 75 70 29 3b 0a 2f 2a |LRM, wak|eup);./*|
|00004460| 0a 20 2a 20 4f 4b 20 2d | 20 69 6e 63 6f 6d 69 6e |. * OK -| incomin|
|00004470| 67 20 63 61 6c 6c 20 63 | 6f 6e 6e 65 63 74 65 64 |g call c|onnected|
|00004480| 2e 20 46 69 6e 64 20 73 | 70 65 65 64 20 28 69 66 |. Find s|peed (if|
|00004490| 20 70 6f 73 73 69 62 6c | 65 29 2c 20 63 72 65 61 | possibl|e), crea|
|000044a0| 74 65 20 6c 6f 63 6b 20 | 66 69 6c 65 2c 0a 20 2a |te lock |file,. *|
|000044b0| 20 74 68 65 6e 20 73 70 | 61 77 6e 20 67 65 74 74 | then sp|awn gett|
|000044c0| 79 2e 0a 20 2a 20 41 74 | 20 74 68 69 73 20 70 6f |y.. * At| this po|
|000044d0| 69 6e 74 2c 20 77 65 20 | 61 6c 73 6f 20 74 72 61 |int, we |also tra|
|000044e0| 70 20 68 61 6e 67 75 70 | 73 2c 20 73 6f 20 74 68 |p hangup|s, so th|
|000044f0| 61 74 20 77 65 20 63 61 | 6e 20 63 6c 65 61 6e 20 |at we ca|n clean |
|00004500| 75 70 20 61 66 74 65 72 | 0a 20 2a 20 61 6e 79 20 |up after|. * any |
|00004510| 69 6e 63 6f 6d 69 6e 67 | 20 63 61 6c 6c 73 2e 20 |incoming| calls. |
|00004520| 28 48 61 6e 67 75 70 73 | 20 61 72 65 20 6e 6f 77 |(Hangups| are now|
|00004530| 20 64 65 74 65 63 74 65 | 64 20 62 79 20 74 68 65 | detecte|d by the|
|00004540| 20 68 61 72 64 77 61 72 | 65 29 2e 0a 20 2a 2f 0a | hardwar|e).. */.|
|00004550| 20 09 73 69 67 6e 61 6c | 28 53 49 47 48 55 50 2c | .signal|(SIGHUP,|
|00004560| 20 63 6c 6f 73 65 64 6f | 77 6e 29 3b 0a 23 69 66 | closedo|wn);.#if|
|00004570| 64 65 66 20 53 50 45 45 | 44 43 4f 4e 46 49 47 0a |def SPEE|DCONFIG.|
|00004580| 20 09 64 72 65 61 64 28 | 64 65 76 2c 20 26 63 2c | .dread(|dev, &c,|
|00004590| 20 31 29 3b 0a 20 09 69 | 66 28 63 20 3d 3d 20 27 | 1);. .i|f(c == '|
|000045a0| 5c 72 27 29 20 73 70 65 | 65 64 20 3d 20 22 33 30 |\r') spe|ed = "30|
|000045b0| 30 22 3b 0a 20 09 65 6c | 73 65 20 7b 0a 20 09 09 |0";. .el|se {. ..|
|000045c0| 64 72 65 61 64 28 64 65 | 76 2c 20 62 75 66 66 2c |dread(de|v, buff,|
|000045d0| 20 34 29 3b 0a 20 09 09 | 69 66 28 21 73 74 72 63 | 4);. ..|if(!strc|
|000045e0| 6d 70 28 62 75 66 66 2c | 20 22 31 32 30 30 22 29 |mp(buff,| "1200")|
|000045f0| 29 20 73 70 65 65 64 20 | 3d 20 22 31 32 30 30 22 |) speed |= "1200"|
|00004600| 3b 0a 20 09 09 69 66 28 | 21 73 74 72 63 6d 70 28 |;. ..if(|!strcmp(|
|00004610| 62 75 66 66 2c 20 22 32 | 34 30 30 22 29 29 20 73 |buff, "2|400")) s|
|00004620| 70 65 65 64 20 3d 20 22 | 32 34 30 30 22 3b 0a 20 |peed = "|2400";. |
|00004630| 09 09 69 66 28 21 73 74 | 72 63 6d 70 28 62 75 66 |..if(!st|rcmp(buf|
|00004640| 66 2c 20 22 31 32 37 35 | 22 29 29 20 73 70 65 65 |f, "1275|")) spee|
|00004650| 64 20 3d 20 22 31 32 30 | 30 22 3b 0a 20 09 09 69 |d = "120|0";. ..i|
|00004660| 66 28 21 73 74 72 63 6d | 70 28 62 75 66 66 2c 20 |f(!strcm|p(buff, |
|00004670| 22 37 35 31 32 22 29 29 | 20 73 70 65 65 64 20 3d |"7512"))| speed =|
|00004680| 20 22 31 32 30 30 22 3b | 0a 20 09 7d 0a 20 09 62 | "1200";|. .}. .b|
|00004690| 61 75 64 20 3d 20 66 69 | 6e 64 73 70 65 65 64 28 |aud = fi|ndspeed(|
|000046a0| 73 70 65 65 64 29 3b 0a | 23 65 6e 64 69 66 0a 09 |speed);.|#endif..|
|000046b0| 0a 20 09 74 20 3d 20 74 | 69 6d 65 28 28 6c 6f 6e |. .t = t|ime((lon|
|000046c0| 67 20 2a 29 30 29 3b 0a | 20 09 70 72 69 6e 74 66 |g *)0);.| .printf|
|000046d0| 28 22 43 61 6c 6c 20 63 | 6f 6e 6e 65 63 74 65 64 |("Call c|onnected|
|000046e0| 20 61 74 20 25 73 20 6f | 6e 20 25 73 22 2c 20 73 | at %s o|n %s", s|
|000046f0| 70 65 65 64 2c 20 61 73 | 63 74 69 6d 65 28 6c 6f |peed, as|ctime(lo|
|00004700| 63 61 6c 74 69 6d 65 28 | 26 74 29 29 29 3b 0a 2f |caltime(|&t)));./|
|00004710| 2a 0a 20 2a 20 53 6f 6d | 65 6f 6e 65 20 68 61 73 |*. * Som|eone has|
|00004720| 20 72 75 6e 67 20 69 6e | 20 2d 20 6c 6f 63 6b 20 | rung in| - lock |
|00004730| 74 68 65 20 64 65 76 69 | 63 65 2e 0a 20 2a 2f 0a |the devi|ce.. */.|
|00004740| 20 09 6c 6f 63 6b 20 3d | 20 66 6f 70 65 6e 28 6c | .lock =| fopen(l|
|00004750| 6f 63 6b 66 2c 20 22 77 | 22 29 3b 0a 20 2f 2a 0a |ockf, "w|");. /*.|
|00004760| 20 20 2a 20 68 61 6e 64 | 20 6f 76 65 72 20 74 6f | * hand| over to|
|00004770| 20 22 67 65 74 74 79 22 | 0a 20 20 2a 2f 0a 20 09 | "getty"|. */. .|
|00004780| 61 72 67 5b 30 5d 20 3d | 20 22 67 65 74 74 79 22 |arg[0] =| "getty"|
|00004790| 3b 0a 20 09 61 72 67 5b | 31 5d 20 3d 20 22 2d 68 |;. .arg[|1] = "-h|
|000047a0| 22 3b 0a 20 09 61 72 67 | 5b 32 5d 20 3d 20 61 72 |";. .arg|[2] = ar|
|000047b0| 67 76 5b 31 5d 3b 0a 20 | 09 61 72 67 5b 33 5d 20 |gv[1];. |.arg[3] |
|000047c0| 3d 20 73 70 65 65 64 3b | 0a 09 61 72 67 5b 34 5d |= speed;|..arg[4]|
|000047d0| 20 3d 20 4e 55 4c 4c 3b | 0a 09 0a 09 69 66 28 73 | = NULL;|....if(s|
|000047e0| 68 65 6c 6c 20 3d 20 66 | 6f 72 6b 28 29 29 20 7b |hell = f|ork()) {|
|000047f0| 0a 2f 2a 0a 20 2a 20 63 | 68 61 6e 67 65 20 74 68 |./*. * c|hange th|
|00004800| 65 20 75 74 6d 70 20 70 | 69 64 20 74 6f 20 74 68 |e utmp p|id to th|
|00004810| 65 20 22 67 65 74 74 79 | 22 20 70 72 6f 63 65 73 |e "getty|" proces|
|00004820| 73 2c 20 73 6f 20 74 68 | 61 74 20 69 74 20 63 61 |s, so th|at it ca|
|00004830| 6e 20 6c 6f 67 69 6e 0a | 20 2a 2f 0a 09 09 75 63 |n login.| */...uc|
|00004840| 68 61 6e 67 65 28 67 65 | 74 70 69 64 28 29 2c 20 |hange(ge|tpid(), |
|00004850| 73 68 65 6c 6c 29 3b 09 | 2f 2a 20 63 68 61 6e 67 |shell);.|/* chang|
|00004860| 65 20 75 74 6d 70 20 65 | 6e 74 72 79 20 2a 2f 0a |e utmp e|ntry */.|
|00004870| 23 69 66 20 64 65 66 69 | 6e 65 64 28 4f 4c 33 42 |#if defi|ned(OL3B|
|00004880| 32 29 0a 09 20 09 66 70 | 72 69 6e 74 66 28 6c 6f |2).. .fp|rintf(lo|
|00004890| 63 6b 2c 22 20 20 20 20 | 20 20 20 25 64 5c 6e 22 |ck," | %d\n"|
|000048a0| 2c 20 73 68 65 6c 6c 29 | 3b 0a 23 65 6c 73 65 0a |, shell)|;.#else.|
|000048b0| 23 69 66 20 20 64 65 66 | 69 6e 65 64 28 48 44 42 |#if def|ined(HDB|
|000048c0| 29 0a 09 20 09 66 70 72 | 69 6e 74 66 28 6c 6f 63 |).. .fpr|intf(loc|
|000048d0| 6b 2c 22 25 64 5c 6e 22 | 2c 20 73 68 65 6c 6c 29 |k,"%d\n"|, shell)|
|000048e0| 3b 0a 23 65 6c 73 65 0a | 09 09 66 77 72 69 74 65 |;.#else.|..fwrite|
|000048f0| 28 28 63 68 61 72 20 2a | 29 20 26 73 68 65 6c 6c |((char *|) &shell|
|00004900| 2c 20 73 69 7a 65 6f 66 | 20 73 68 65 6c 6c 2c 20 |, sizeof| shell, |
|00004910| 31 2c 20 6c 6f 63 6b 29 | 3b 0a 23 65 6e 64 69 66 |1, lock)|;.#endif|
|00004920| 0a 23 65 6e 64 69 66 0a | 09 20 09 66 63 6c 6f 73 |.#endif.|. .fclos|
|00004930| 65 28 6c 6f 63 6b 29 3b | 0a 2f 2a 0a 20 2a 20 77 |e(lock);|./*. * w|
|00004940| 61 69 74 20 66 6f 72 20 | 6c 6f 67 6f 75 74 20 66 |ait for |logout f|
|00004950| 72 6f 6d 20 73 68 65 6c | 6c 2e 20 0a 20 2a 20 69 |rom shel|l. . * i|
|00004960| 66 20 74 65 72 6d 69 6e | 61 6c 20 69 73 20 69 64 |f termin|al is id|
|00004970| 6c 65 20 66 6f 72 20 49 | 44 4c 45 54 49 4d 45 2c |le for I|DLETIME,|
|00004980| 20 66 6f 72 63 65 20 61 | 20 6c 6f 67 6f 75 74 20 | force a| logout |
|00004990| 61 6e 79 77 61 79 0a 20 | 2a 2f 0a 20 09 09 61 6c |anyway. |*/. ..al|
|000049a0| 61 72 6d 28 53 50 59 54 | 49 4d 45 29 3b 0a 09 09 |arm(SPYT|IME);...|
|000049b0| 77 68 69 6c 65 28 28 77 | 61 69 74 28 26 73 74 61 |while((w|ait(&sta|
|000049c0| 74 75 73 29 20 3d 3d 20 | 2d 31 29 20 26 26 20 28 |tus) == |-1) && (|
|000049d0| 65 72 72 6e 6f 20 3d 3d | 20 45 49 4e 54 52 29 29 |errno ==| EINTR))|
|000049e0| 20 7b 0a 09 09 09 69 66 | 28 73 74 61 74 28 64 6e | {....if|(stat(dn|
|000049f0| 61 6d 65 2c 20 26 73 62 | 75 66 29 20 3d 3d 20 2d |ame, &sb|uf) == -|
|00004a00| 31 29 20 7b 0a 09 09 09 | 09 70 65 72 72 6f 72 28 |1) {....|.perror(|
|00004a10| 64 6e 61 6d 65 29 3b 0a | 09 09 09 09 63 6f 6e 74 |dname);.|....cont|
|00004a20| 69 6e 75 65 3b 0a 09 09 | 09 7d 0a 09 09 09 6e 6f |inue;...|.}....no|
|00004a30| 77 20 3d 20 74 69 6d 65 | 28 28 6c 6f 6e 67 20 2a |w = time|((long *|
|00004a40| 29 30 29 3b 0a 09 09 09 | 6d 74 69 6d 65 20 3d 20 |)0);....|mtime = |
|00004a50| 6d 61 78 28 73 62 75 66 | 2e 73 74 5f 61 74 69 6d |max(sbuf|.st_atim|
|00004a60| 65 2c 20 73 62 75 66 2e | 73 74 5f 6d 74 69 6d 65 |e, sbuf.|st_mtime|
|00004a70| 29 3b 0a 0a 09 09 09 69 | 66 28 28 6e 6f 77 20 2d |);.....i|f((now -|
|00004a80| 20 6d 74 69 6d 65 29 20 | 3e 3d 20 49 44 4c 45 54 | mtime) |>= IDLET|
|00004a90| 49 4d 45 29 20 7b 0a 09 | 09 09 09 77 72 69 74 65 |IME) {..|...write|
|00004aa0| 28 64 65 76 2c 20 22 61 | 75 74 6f 6c 6f 67 6f 75 |(dev, "a|utologou|
|00004ab0| 74 5c 72 5c 6e 22 2c 20 | 31 32 29 3b 0a 09 09 09 |t\r\n", |12);....|
|00004ac0| 09 70 72 69 6e 74 66 28 | 22 44 65 76 69 63 65 20 |.printf(|"Device |
|00004ad0| 69 64 6c 65 20 2d 20 61 | 75 74 6f 6c 6f 67 6f 75 |idle - a|utologou|
|00004ae0| 74 20 61 74 20 25 73 5c | 6e 22 2c 0a 09 09 09 09 |t at %s\|n",.....|
|00004af0| 09 61 73 63 74 69 6d 65 | 28 6c 6f 63 61 6c 74 69 |.asctime|(localti|
|00004b00| 6d 65 28 26 6e 6f 77 29 | 29 29 3b 0a 09 09 09 09 |me(&now)|));.....|
|00004b10| 75 63 68 61 6e 67 65 28 | 73 68 65 6c 6c 2c 20 67 |uchange(|shell, g|
|00004b20| 65 74 70 69 64 28 29 29 | 3b 0a 09 09 09 09 61 75 |etpid())|;.....au|
|00004b30| 74 6f 6c 6f 67 6f 75 74 | 28 73 68 65 6c 6c 29 3b |tologout|(shell);|
|00004b40| 0a 09 09 09 09 62 72 65 | 61 6b 3b 0a 09 09 09 7d |.....bre|ak;....}|
|00004b50| 0a 0a 23 69 66 64 65 66 | 20 57 41 54 43 48 49 54 |..#ifdef| WATCHIT|
|00004b60| 0a 09 09 09 74 20 3d 20 | 74 69 6d 65 28 28 6c 6f |....t = |time((lo|
|00004b70| 6e 67 20 2a 29 20 30 29 | 3b 0a 09 09 09 70 77 20 |ng *) 0)|;....pw |
|00004b80| 3d 20 67 65 74 70 77 75 | 69 64 28 28 69 6e 74 29 |= getpwu|id((int)|
|00004b90| 20 73 62 75 66 2e 73 74 | 5f 75 69 64 29 3b 0a 09 | sbuf.st|_uid);..|
|00004ba0| 09 09 70 72 69 6e 74 66 | 28 22 4c 6f 67 6f 6e 20 |..printf|("Logon |
|00004bb0| 75 73 65 72 20 69 73 20 | 25 73 20 6f 6e 20 25 73 |user is |%s on %s|
|00004bc0| 22 2c 20 70 77 2d 3e 70 | 77 5f 6e 61 6d 65 2c 0a |", pw->p|w_name,.|
|00004bd0| 09 09 09 09 61 73 63 74 | 69 6d 65 28 6c 6f 63 61 |....asct|ime(loca|
|00004be0| 6c 74 69 6d 65 28 26 74 | 29 29 29 3b 0a 09 09 09 |ltime(&t|)));....|
|00004bf0| 70 72 6f 63 73 20 3d 20 | 70 6f 70 65 6e 28 22 70 |procs = |popen("p|
|00004c00| 73 20 2d 65 66 22 2c 20 | 22 72 22 29 3b 0a 09 09 |s -ef", |"r");...|
|00004c10| 09 77 68 69 6c 65 28 66 | 67 65 74 73 28 70 73 62 |.while(f|gets(psb|
|00004c20| 75 66 66 2c 20 73 69 7a | 65 6f 66 20 70 73 62 75 |uff, siz|eof psbu|
|00004c30| 66 66 2c 20 70 72 6f 63 | 73 29 29 20 0a 09 09 09 |ff, proc|s)) ....|
|00004c40| 09 69 66 28 70 61 72 74 | 6f 66 28 70 73 62 75 66 |.if(part|of(psbuf|
|00004c50| 66 2c 20 61 72 67 76 5b | 31 5d 29 20 26 26 20 70 |f, argv[|1]) && p|
|00004c60| 61 72 74 6f 66 28 70 73 | 62 75 66 66 2c 20 70 77 |artof(ps|buff, pw|
|00004c70| 2d 3e 70 77 5f 6e 61 6d | 65 29 29 0a 09 09 09 09 |->pw_nam|e)).....|
|00004c80| 09 70 72 69 6e 74 66 28 | 22 25 73 22 2c 20 70 73 |.printf(|"%s", ps|
|00004c90| 62 75 66 66 29 3b 0a 09 | 09 09 70 63 6c 6f 73 65 |buff);..|..pclose|
|00004ca0| 28 70 72 6f 63 73 29 3b | 0a 23 65 6e 64 69 66 0a |(procs);|.#endif.|
|00004cb0| 09 09 09 61 6c 61 72 6d | 28 53 50 59 54 49 4d 45 |...alarm|(SPYTIME|
|00004cc0| 29 3b 0a 09 09 7d 0a 20 | 09 09 74 20 3d 20 74 69 |);...}. |..t = ti|
|00004cd0| 6d 65 28 28 6c 6f 6e 67 | 20 2a 29 20 30 29 3b 0a |me((long| *) 0);.|
|00004ce0| 09 09 70 72 69 6e 74 66 | 28 22 43 61 6c 6c 20 64 |..printf|("Call d|
|00004cf0| 69 73 63 6f 6e 6e 65 63 | 74 65 64 20 6f 6e 20 25 |isconnec|ted on %|
|00004d00| 73 22 2c 20 61 73 63 74 | 69 6d 65 28 6c 6f 63 61 |s", asct|ime(loca|
|00004d10| 6c 74 69 6d 65 28 26 74 | 29 29 29 3b 0a 09 09 63 |ltime(&t|)));...c|
|00004d20| 6c 6f 73 65 64 6f 77 6e | 28 30 29 3b 09 09 2f 2a |losedown|(0);../*|
|00004d30| 20 72 65 6d 6f 76 65 20 | 6c 6f 63 6b 73 20 65 74 | remove |locks et|
|00004d40| 63 20 2a 2f 0a 09 09 2f | 2a 4e 4f 54 52 45 41 43 |c */.../|*NOTREAC|
|00004d50| 48 45 44 2a 2f 0a 09 7d | 0a 09 65 6c 73 65 20 7b |HED*/..}|..else {|
|00004d60| 0a 09 09 73 6c 65 65 70 | 28 31 29 3b 09 09 09 2f |...sleep|(1);.../|
|00004d70| 2a 20 61 6c 6c 6f 77 20 | 63 68 61 6e 67 65 73 20 |* allow |changes |
|00004d80| 74 6f 20 75 74 6d 70 20 | 2a 2f 0a 2f 2a 0a 20 2a |to utmp |*/./*. *|
|00004d90| 20 52 65 2d 64 6f 20 74 | 68 65 20 74 65 72 6d 69 | Re-do t|he termi|
|00004da0| 6f 20 73 65 74 74 69 6e | 67 73 2c 20 73 6f 20 74 |o settin|gs, so t|
|00004db0| 68 61 74 20 77 65 20 63 | 61 6e 20 6c 6f 67 69 6e |hat we c|an login|
|00004dc0| 2e 0a 20 2a 20 43 4c 4f | 43 41 4c 20 69 73 20 72 |.. * CLO|CAL is r|
|00004dd0| 65 6d 6f 76 65 64 20 61 | 74 20 74 68 69 73 20 70 |emoved a|t this p|
|00004de0| 6f 69 6e 74 2c 20 73 6f | 20 74 68 61 74 20 61 20 |oint, so| that a |
|00004df0| 68 61 6e 67 75 70 20 77 | 69 6c 6c 20 67 65 6e 65 |hangup w|ill gene|
|00004e00| 72 61 74 65 20 53 49 47 | 48 55 50 2e 0a 20 2a 20 |rate SIG|HUP.. * |
|00004e10| 43 6c 6f 73 65 20 61 6c | 6c 20 74 68 65 20 66 69 |Close al|l the fi|
|00004e20| 6c 65 73 20 77 68 69 63 | 68 20 77 65 20 68 61 76 |les whic|h we hav|
|00004e30| 65 20 6f 70 65 6e 20 2d | 20 67 65 74 74 79 20 65 |e open -| getty e|
|00004e40| 78 70 65 63 74 73 20 6e | 6f 6e 65 2e 0a 20 2a 2f |xpects n|one.. */|
|00004e50| 0a 20 09 09 6c 6f 67 69 | 6e 5f 74 65 72 6d 28 64 |. ..logi|n_term(d|
|00004e60| 65 76 2c 20 62 61 75 64 | 29 3b 0a 20 09 09 66 6f |ev, baud|);. ..fo|
|00004e70| 72 28 69 3d 30 3b 69 3c | 32 30 3b 69 2b 2b 29 20 |r(i=0;i<|20;i++) |
|00004e80| 63 6c 6f 73 65 28 69 29 | 3b 0a 23 69 66 64 65 66 |close(i)|;.#ifdef|
|00004e90| 09 44 45 42 55 47 09 20 | 0a 09 20 09 70 72 69 6e |.DEBUG. |.. .prin|
|00004ea0| 74 66 28 22 25 64 3a 20 | 2f 65 74 63 2f 67 65 74 |tf("%d: |/etc/get|
|00004eb0| 74 79 20 25 73 20 25 73 | 5c 6e 22 2c 20 67 65 74 |ty %s %s|\n", get|
|00004ec0| 70 69 64 28 29 2c 20 61 | 72 67 5b 31 5d 2c 20 61 |pid(), a|rg[1], a|
|00004ed0| 72 67 5b 32 5d 29 3b 0a | 23 65 6e 64 69 66 0a 09 |rg[2]);.|#endif..|
|00004ee0| 09 65 78 65 63 76 65 28 | 22 2f 65 74 63 2f 67 65 |.execve(|"/etc/ge|
|00004ef0| 74 74 79 22 2c 20 61 72 | 67 2c 20 65 6e 76 70 29 |tty", ar|g, envp)|
|00004f00| 3b 0a 09 09 70 72 69 6e | 74 66 28 22 63 61 6e 27 |;...prin|tf("can'|
|00004f10| 74 20 65 78 65 63 20 67 | 65 74 74 79 5c 6e 22 29 |t exec g|etty\n")|
|00004f20| 3b 0a 09 09 65 78 69 74 | 28 31 29 3b 0a 09 09 2f |;...exit|(1);.../|
|00004f30| 2a 20 4e 4f 54 52 45 41 | 43 48 45 44 20 2a 2f 0a |* NOTREA|CHED */.|
|00004f40| 09 7d 0a 7d 0a 2f 2a 0a | 20 2a 20 63 68 65 63 6b |.}.}./*.| * check|
|00004f50| 20 66 6f 72 20 70 72 65 | 73 65 6e 63 65 20 6f 66 | for pre|sence of|
|00004f60| 20 6c 6f 63 6b 20 66 69 | 6c 65 0a 20 2a 20 72 65 | lock fi|le. * re|
|00004f70| 74 75 72 6e 20 31 20 69 | 66 20 6c 6f 63 6b 65 64 |turn 1 i|f locked|
|00004f80| 2e 0a 20 2a 2f 0a 6c 6f | 63 6b 65 64 28 29 7b 0a |.. */.lo|cked(){.|
|00004f90| 09 73 74 72 75 63 74 20 | 73 74 61 74 20 73 62 3b |.struct |stat sb;|
|00004fa0| 0a 09 69 66 28 73 74 61 | 74 28 6c 6f 63 6b 66 2c |..if(sta|t(lockf,|
|00004fb0| 20 26 73 62 29 20 3d 3d | 20 2d 31 29 20 72 65 74 | &sb) ==| -1) ret|
|00004fc0| 75 72 6e 28 30 29 3b 0a | 23 69 66 64 65 66 09 44 |urn(0);.|#ifdef.D|
|00004fd0| 45 42 55 47 0a 09 70 72 | 69 6e 74 66 28 22 25 73 |EBUG..pr|intf("%s|
|00004fe0| 20 6c 6f 63 6b 65 64 5c | 6e 22 2c 20 6c 6f 63 6b | locked\|n", lock|
|00004ff0| 66 29 3b 0a 23 65 6e 64 | 69 66 0a 09 72 65 74 75 |f);.#end|if..retu|
|00005000| 72 6e 28 31 29 3b 0a 7d | 0a 23 69 66 64 65 66 20 |rn(1);.}|.#ifdef |
|00005010| 57 41 54 43 48 49 54 0a | 2f 2a 0a 20 2a 20 70 61 |WATCHIT.|/*. * pa|
|00005020| 72 74 6f 66 3a 20 6c 6f | 6f 6b 20 66 6f 72 20 73 |rtof: lo|ok for s|
|00005030| 74 72 20 69 6e 20 74 65 | 78 74 2e 20 48 61 73 20 |tr in te|xt. Has |
|00005040| 61 20 62 75 67 20 69 66 | 20 79 6f 75 20 6c 6f 6f |a bug if| you loo|
|00005050| 6b 20 66 6f 72 20 2e 2e | 2e 78 78 78 2e 2e 2e 0a |k for ..|.xxx....|
|00005060| 20 2a 2f 0a 70 61 72 74 | 6f 66 28 74 65 78 74 2c | */.part|of(text,|
|00005070| 20 73 74 72 29 0a 63 68 | 61 72 20 2a 74 65 78 74 | str).ch|ar *text|
|00005080| 2c 20 2a 73 74 72 3b 0a | 7b 0a 09 63 68 61 72 20 |, *str;.|{..char |
|00005090| 2a 6e 65 65 64 6c 65 2c | 20 2a 70 3b 0a 09 66 6f |*needle,| *p;..fo|
|000050a0| 72 28 70 20 3d 20 74 65 | 78 74 2c 20 6e 65 65 64 |r(p = te|xt, need|
|000050b0| 6c 65 20 3d 20 73 74 72 | 3b 20 2a 70 20 3b 20 70 |le = str|; *p ; p|
|000050c0| 2b 2b 29 20 7b 0a 09 09 | 69 66 28 2a 70 20 21 3d |++) {...|if(*p !=|
|000050d0| 20 2a 6e 65 65 64 6c 65 | 29 20 6e 65 65 64 6c 65 | *needle|) needle|
|000050e0| 20 3d 20 73 74 72 3b 0a | 09 09 69 66 28 2a 70 20 | = str;.|..if(*p |
|000050f0| 3d 3d 20 2a 6e 65 65 64 | 6c 65 29 20 6e 65 65 64 |== *need|le) need|
|00005100| 6c 65 2b 2b 3b 0a 09 09 | 69 66 28 2a 6e 65 65 64 |le++;...|if(*need|
|00005110| 6c 65 20 3d 3d 20 27 5c | 30 27 29 20 72 65 74 75 |le == '\|0') retu|
|00005120| 72 6e 28 31 29 3b 0a 09 | 7d 0a 09 72 65 74 75 72 |rn(1);..|}..retur|
|00005130| 6e 28 30 29 3b 0a 7d 0a | 23 65 6e 64 69 66 0a 2f |n(0);.}.|#endif./|
|00005140| 2a 0a 20 2a 20 61 75 74 | 6f 6c 6f 67 6f 75 74 3a |*. * aut|ologout:|
|00005150| 20 6c 6f 67 20 6f 75 74 | 20 74 68 65 20 63 68 69 | log out| the chi|
|00005160| 6c 64 20 73 68 65 6c 6c | 2e 20 53 65 6e 64 73 20 |ld shell|. Sends |
|00005170| 53 49 47 48 55 50 2c 20 | 53 49 47 54 45 52 4d 2c |SIGHUP, |SIGTERM,|
|00005180| 20 53 49 47 4b 49 4c 4c | 0a 20 2a 20 75 6e 74 69 | SIGKILL|. * unti|
|00005190| 6c 20 74 68 65 20 63 68 | 69 6c 64 20 65 78 69 74 |l the ch|ild exit|
|000051a0| 73 2e 0a 20 2a 2f 0a 61 | 75 74 6f 6c 6f 67 6f 75 |s.. */.a|utologou|
|000051b0| 74 28 63 68 69 6c 64 29 | 0a 7b 0a 09 6b 69 6c 6c |t(child)|.{..kill|
|000051c0| 28 63 68 69 6c 64 2c 20 | 53 49 47 48 55 50 29 3b |(child, |SIGHUP);|
|000051d0| 0a 09 61 6c 61 72 6d 28 | 47 52 41 43 45 54 49 4d |..alarm(|GRACETIM|
|000051e0| 45 29 3b 0a 09 69 66 28 | 77 61 69 74 28 26 73 74 |E);..if(|wait(&st|
|000051f0| 61 74 75 73 29 20 3d 3d | 20 2d 31 29 20 7b 0a 09 |atus) ==| -1) {..|
|00005200| 09 6b 69 6c 6c 28 63 68 | 69 6c 64 2c 20 53 49 47 |.kill(ch|ild, SIG|
|00005210| 54 45 52 4d 29 3b 0a 09 | 09 61 6c 61 72 6d 28 47 |TERM);..|.alarm(G|
|00005220| 52 41 43 45 54 49 4d 45 | 29 3b 0a 09 09 69 66 28 |RACETIME|);...if(|
|00005230| 77 61 69 74 28 26 73 74 | 61 74 75 73 29 20 3d 3d |wait(&st|atus) ==|
|00005240| 20 2d 31 29 20 7b 0a 09 | 09 09 6b 69 6c 6c 28 63 | -1) {..|..kill(c|
|00005250| 68 69 6c 64 2c 20 53 49 | 47 4b 49 4c 4c 29 3b 0a |hild, SI|GKILL);.|
|00005260| 09 09 09 61 6c 61 72 6d | 28 47 52 41 43 45 54 49 |...alarm|(GRACETI|
|00005270| 4d 45 29 3b 0a 09 09 09 | 69 66 28 77 61 69 74 28 |ME);....|if(wait(|
|00005280| 26 73 74 61 74 75 73 29 | 20 3d 3d 20 2d 31 29 20 |&status)| == -1) |
|00005290| 7b 0a 09 09 09 09 70 72 | 69 6e 74 66 28 22 43 61 |{.....pr|intf("Ca|
|000052a0| 6e 6e 6f 74 20 6b 69 6c | 6c 20 63 68 69 6c 64 20 |nnot kil|l child |
|000052b0| 70 69 64 20 25 64 5c 6e | 22 2c 20 63 68 69 6c 64 |pid %d\n|", child|
|000052c0| 29 3b 0a 09 09 09 09 73 | 74 61 74 75 73 20 3d 20 |);.....s|tatus = |
|000052d0| 30 3b 0a 09 09 09 7d 0a | 09 09 7d 0a 09 7d 0a 09 |0;....}.|..}..}..|
|000052e0| 61 6c 61 72 6d 28 30 29 | 3b 0a 7d 0a 53 48 41 52 |alarm(0)|;.}.SHAR|
|000052f0| 5f 45 4f 46 0a 69 66 20 | 74 65 73 74 20 31 30 31 |_EOF.if |test 101|
|00005300| 39 34 20 2d 6e 65 20 22 | 60 77 63 20 2d 63 20 3c |94 -ne "|`wc -c <|
|00005310| 20 27 6d 6f 64 65 6d 2e | 63 27 60 22 0a 74 68 65 | 'modem.|c'`".the|
|00005320| 6e 0a 09 65 63 68 6f 20 | 73 68 61 72 3a 20 22 65 |n..echo |shar: "e|
|00005330| 72 72 6f 72 20 74 72 61 | 6e 73 6d 69 74 74 69 6e |rror tra|nsmittin|
|00005340| 67 20 27 6d 6f 64 65 6d | 2e 63 27 22 20 27 28 73 |g 'modem|.c'" '(s|
|00005350| 68 6f 75 6c 64 20 68 61 | 76 65 20 62 65 65 6e 20 |hould ha|ve been |
|00005360| 31 30 31 39 34 20 63 68 | 61 72 61 63 74 65 72 73 |10194 ch|aracters|
|00005370| 29 27 0a 66 69 0a 66 69 | 0a 65 63 68 6f 20 73 68 |)'.fi.fi|.echo sh|
|00005380| 61 72 3a 20 22 65 78 74 | 72 61 63 74 69 6e 67 20 |ar: "ext|racting |
|00005390| 27 75 63 68 61 6e 67 65 | 2e 63 27 22 20 27 28 37 |'uchange|.c'" '(7|
|000053a0| 31 31 20 63 68 61 72 61 | 63 74 65 72 73 29 27 0a |11 chara|cters)'.|
|000053b0| 69 66 20 74 65 73 74 20 | 2d 66 20 27 75 63 68 61 |if test |-f 'ucha|
|000053c0| 6e 67 65 2e 63 27 0a 74 | 68 65 6e 0a 09 65 63 68 |nge.c'.t|hen..ech|
|000053d0| 6f 20 73 68 61 72 3a 20 | 22 77 69 6c 6c 20 6e 6f |o shar: |"will no|
|000053e0| 74 20 6f 76 65 72 2d 77 | 72 69 74 65 20 65 78 69 |t over-w|rite exi|
|000053f0| 73 74 69 6e 67 20 66 69 | 6c 65 20 27 75 63 68 61 |sting fi|le 'ucha|
|00005400| 6e 67 65 2e 63 27 22 0a | 65 6c 73 65 0a 63 61 74 |nge.c'".|else.cat|
|00005410| 20 3c 3c 20 5c 53 48 41 | 52 5f 45 4f 46 20 3e 20 | << \SHA|R_EOF > |
|00005420| 27 75 63 68 61 6e 67 65 | 2e 63 27 0a 2f 2a 0a 20 |'uchange|.c'./*. |
|00005430| 2a 20 43 6f 70 79 72 69 | 67 68 74 20 28 63 29 20 |* Copyri|ght (c) |
|00005440| 44 61 76 65 20 53 65 74 | 74 6c 65 2c 20 4d 61 72 |Dave Set|tle, Mar|
|00005450| 20 31 39 38 37 0a 20 2a | 20 50 65 72 6d 69 73 73 | 1987. *| Permiss|
|00005460| 69 6f 6e 20 69 73 20 67 | 72 61 6e 74 65 64 20 74 |ion is g|ranted t|
|00005470| 6f 20 64 6f 20 61 6e 79 | 74 68 69 6e 67 20 77 69 |o do any|thing wi|
|00005480| 74 68 20 74 68 69 73 20 | 70 72 6f 67 72 61 6d 2c |th this |program,|
|00005490| 20 65 78 63 65 70 74 20 | 72 65 6d 6f 76 65 0a 20 | except |remove. |
|000054a0| 2a 20 74 68 69 73 20 63 | 6f 70 79 72 69 67 68 74 |* this c|opyright|
|000054b0| 20 6e 6f 74 69 63 65 2c | 20 6f 72 20 73 65 6c 6c | notice,| or sell|
|000054c0| 20 69 74 20 66 6f 72 20 | 70 72 6f 66 69 74 2e 0a | it for |profit..|
|000054d0| 20 2a 0a 20 2a 0a 20 2a | 20 63 68 61 6e 67 65 20 | *. *. *| change |
|000054e0| 74 68 65 20 75 74 5f 70 | 69 64 20 76 61 6c 75 65 |the ut_p|id value|
|000054f0| 20 66 72 6f 6d 20 22 6f | 6c 64 22 20 74 6f 20 22 | from "o|ld" to "|
|00005500| 6e 65 77 22 2e 0a 20 2a | 20 41 74 74 65 6d 70 74 |new".. *| Attempt|
|00005510| 73 20 74 6f 20 64 6f 20 | 61 6c 6c 20 74 68 65 20 |s to do |all the |
|00005520| 74 68 69 6e 67 73 20 74 | 68 61 74 20 22 67 65 74 |things t|hat "get|
|00005530| 74 79 22 20 61 70 70 65 | 61 72 73 20 74 6f 20 64 |ty" appe|ars to d|
|00005540| 6f 2e 0a 20 2a 2f 0a 20 | 0a 23 69 6e 63 6c 75 64 |o.. */. |.#includ|
|00005550| 65 20 3c 73 79 73 2f 74 | 79 70 65 73 2e 68 3e 0a |e <sys/t|ypes.h>.|
|00005560| 23 69 6e 63 6c 75 64 65 | 20 3c 75 74 6d 70 2e 68 |#include| <utmp.h|
|00005570| 3e 0a 0a 73 74 72 75 63 | 74 20 75 74 6d 70 20 2a |>..struc|t utmp *|
|00005580| 75 74 6d 70 2c 20 2a 67 | 65 74 75 74 65 6e 74 28 |utmp, *g|etutent(|
|00005590| 29 3b 0a 0a 75 63 68 61 | 6e 67 65 28 6f 6c 64 2c |);..ucha|nge(old,|
|000055a0| 20 6e 65 77 29 0a 7b 0a | 09 73 65 74 75 74 65 6e | new).{.|.setuten|
|000055b0| 74 28 29 3b 0a 09 77 68 | 69 6c 65 28 75 74 6d 70 |t();..wh|ile(utmp|
|000055c0| 20 3d 20 67 65 74 75 74 | 65 6e 74 28 29 29 20 7b | = getut|ent()) {|
|000055d0| 0a 09 09 69 66 28 75 74 | 6d 70 2d 3e 75 74 5f 70 |...if(ut|mp->ut_p|
|000055e0| 69 64 20 3d 3d 20 6f 6c | 64 29 20 7b 0a 09 09 09 |id == ol|d) {....|
|000055f0| 75 74 6d 70 2d 3e 75 74 | 5f 70 69 64 20 3d 20 6e |utmp->ut|_pid = n|
|00005600| 65 77 3b 0a 09 09 09 69 | 66 28 73 74 72 63 6d 70 |ew;....i|f(strcmp|
|00005610| 28 75 74 6d 70 2d 3e 75 | 74 5f 75 73 65 72 2c 20 |(utmp->u|t_user, |
|00005620| 22 67 65 74 74 79 22 29 | 29 20 0a 09 09 09 09 73 |"getty")|) .....s|
|00005630| 74 72 63 70 79 28 75 74 | 6d 70 2d 3e 75 74 5f 75 |trcpy(ut|mp->ut_u|
|00005640| 73 65 72 2c 20 22 6d 6f | 64 65 6d 22 29 3b 0a 09 |ser, "mo|dem");..|
|00005650| 09 09 65 6c 73 65 0a 09 | 09 09 09 73 74 72 63 70 |..else..|...strcp|
|00005660| 79 28 75 74 6d 70 2d 3e | 75 74 5f 75 73 65 72 2c |y(utmp->|ut_user,|
|00005670| 20 22 67 65 74 74 79 22 | 29 3b 0a 09 09 09 70 75 | "getty"|);....pu|
|00005680| 74 75 74 6c 69 6e 65 28 | 75 74 6d 70 29 3b 0a 09 |tutline(|utmp);..|
|00005690| 09 09 65 6e 64 75 74 65 | 6e 74 28 29 3b 0a 09 09 |..endute|nt();...|
|000056a0| 09 72 65 74 75 72 6e 28 | 31 29 3b 0a 09 09 7d 0a |.return(|1);...}.|
|000056b0| 09 7d 0a 09 70 72 69 6e | 74 66 28 22 43 61 6e 27 |.}..prin|tf("Can'|
|000056c0| 74 20 66 69 6e 64 20 75 | 74 6d 70 20 65 6e 74 72 |t find u|tmp entr|
|000056d0| 79 5c 6e 22 29 3b 0a 09 | 65 6e 64 75 74 65 6e 74 |y\n");..|endutent|
|000056e0| 28 29 3b 0a 09 72 65 74 | 75 72 6e 28 31 29 3b 0a |();..ret|urn(1);.|
|000056f0| 7d 0a 0a 53 48 41 52 5f | 45 4f 46 0a 69 66 20 74 |}..SHAR_|EOF.if t|
|00005700| 65 73 74 20 37 31 31 20 | 2d 6e 65 20 22 60 77 63 |est 711 |-ne "`wc|
|00005710| 20 2d 63 20 3c 20 27 75 | 63 68 61 6e 67 65 2e 63 | -c < 'u|change.c|
|00005720| 27 60 22 0a 74 68 65 6e | 0a 09 65 63 68 6f 20 73 |'`".then|..echo s|
|00005730| 68 61 72 3a 20 22 65 72 | 72 6f 72 20 74 72 61 6e |har: "er|ror tran|
|00005740| 73 6d 69 74 74 69 6e 67 | 20 27 75 63 68 61 6e 67 |smitting| 'uchang|
|00005750| 65 2e 63 27 22 20 27 28 | 73 68 6f 75 6c 64 20 68 |e.c'" '(|should h|
|00005760| 61 76 65 20 62 65 65 6e | 20 37 31 31 20 63 68 61 |ave been| 711 cha|
|00005770| 72 61 63 74 65 72 73 29 | 27 0a 66 69 0a 66 69 0a |racters)|'.fi.fi.|
|00005780| 65 63 68 6f 20 73 68 61 | 72 3a 20 22 65 78 74 72 |echo sha|r: "extr|
|00005790| 61 63 74 69 6e 67 20 27 | 73 65 6e 64 65 78 2e 63 |acting '|sendex.c|
|000057a0| 27 22 20 27 28 31 37 39 | 37 20 63 68 61 72 61 63 |'" '(179|7 charac|
|000057b0| 74 65 72 73 29 27 0a 69 | 66 20 74 65 73 74 20 2d |ters)'.i|f test -|
|000057c0| 66 20 27 73 65 6e 64 65 | 78 2e 63 27 0a 74 68 65 |f 'sende|x.c'.the|
|000057d0| 6e 0a 09 65 63 68 6f 20 | 73 68 61 72 3a 20 22 77 |n..echo |shar: "w|
|000057e0| 69 6c 6c 20 6e 6f 74 20 | 6f 76 65 72 2d 77 72 69 |ill not |over-wri|
|000057f0| 74 65 20 65 78 69 73 74 | 69 6e 67 20 66 69 6c 65 |te exist|ing file|
|00005800| 20 27 73 65 6e 64 65 78 | 2e 63 27 22 0a 65 6c 73 | 'sendex|.c'".els|
|00005810| 65 0a 63 61 74 20 3c 3c | 20 5c 53 48 41 52 5f 45 |e.cat <<| \SHAR_E|
|00005820| 4f 46 20 3e 20 27 73 65 | 6e 64 65 78 2e 63 27 0a |OF > 'se|ndex.c'.|
|00005830| 2f 2a 0a 20 2a 20 43 6f | 70 79 72 69 67 68 74 20 |/*. * Co|pyright |
|00005840| 28 63 29 20 44 61 76 65 | 20 53 65 74 74 6c 65 2c |(c) Dave| Settle,|
|00005850| 20 4d 61 72 20 31 39 38 | 37 0a 20 2a 20 50 65 72 | Mar 198|7. * Per|
|00005860| 6d 69 73 73 69 6f 6e 20 | 69 73 20 67 72 61 6e 74 |mission |is grant|
|00005870| 65 64 20 74 6f 20 64 6f | 20 61 6e 79 74 68 69 6e |ed to do| anythin|
|00005880| 67 20 77 69 74 68 20 74 | 68 69 73 20 70 72 6f 67 |g with t|his prog|
|00005890| 72 61 6d 2c 20 65 78 63 | 65 70 74 20 72 65 6d 6f |ram, exc|ept remo|
|000058a0| 76 65 0a 20 2a 20 74 68 | 69 73 20 63 6f 70 79 72 |ve. * th|is copyr|
|000058b0| 69 67 68 74 20 6e 6f 74 | 69 63 65 2c 20 6f 72 20 |ight not|ice, or |
|000058c0| 73 65 6c 6c 20 69 74 20 | 66 6f 72 20 70 72 6f 66 |sell it |for prof|
|000058d0| 69 74 2e 0a 20 2a 0a 20 | 2a 0a 20 2a 20 73 65 6e |it.. *. |*. * sen|
|000058e0| 64 65 78 2e 63 3a 20 63 | 6f 6e 74 61 69 6e 73 20 |dex.c: c|ontains |
|000058f0| 74 68 65 20 73 65 6e 64 | 2d 65 78 70 65 63 74 20 |the send|-expect |
|00005900| 72 6f 75 74 69 6e 65 73 | 2c 20 62 65 65 66 65 64 |routines|, beefed|
|00005910| 2d 75 70 20 61 20 6c 69 | 74 74 6c 65 20 74 6f 0a |-up a li|ttle to.|
|00005920| 20 2a 20 6d 61 6b 65 20 | 74 68 65 6d 20 6d 6f 72 | * make |them mor|
|00005930| 65 20 75 73 65 66 75 6c | 2e 0a 20 2a 20 42 6f 74 |e useful|.. * Bot|
|00005940| 68 20 22 73 65 6e 64 22 | 20 61 6e 64 20 22 65 78 |h "send"| and "ex|
|00005950| 70 65 63 74 22 20 6e 6f | 77 20 68 61 76 65 20 61 |pect" no|w have a|
|00005960| 20 66 75 6e 63 74 69 6f | 6e 2c 20 72 61 74 68 65 | functio|n, rathe|
|00005970| 72 20 74 68 61 6e 0a 20 | 2a 20 61 20 66 69 6c 65 |r than. |* a file|
|00005980| 20 64 65 73 63 72 69 70 | 74 6f 72 2e 20 54 68 69 | descrip|tor. Thi|
|00005990| 73 20 66 75 6e 63 74 69 | 6f 6e 20 67 65 74 73 20 |s functi|on gets |
|000059a0| 63 61 6c 6c 65 64 20 61 | 73 20 66 6f 6c 6c 6f 77 |called a|s follow|
|000059b0| 73 3a 0a 20 2a 0a 20 2a | 09 28 69 6e 74 29 20 28 |s:. *. *|.(int) (|
|000059c0| 2a 72 64 66 75 6e 63 29 | 28 29 3b 09 09 5b 73 65 |*rdfunc)|();..[se|
|000059d0| 6e 64 5d 0a 20 2a 09 28 | 2a 77 74 66 75 6e 63 29 |nd]. *.(|*wtfunc)|
|000059e0| 28 28 63 68 61 72 20 2a | 29 73 29 3b 09 09 5b 65 |((char *|)s);..[e|
|000059f0| 78 70 65 63 74 5d 0a 20 | 2a 0a 20 2a 2f 0a 0a 23 |xpect]. |*. */..#|
|00005a00| 69 6e 63 6c 75 64 65 20 | 3c 73 65 74 6a 6d 70 2e |include |<setjmp.|
|00005a10| 68 3e 0a 23 69 6e 63 6c | 75 64 65 20 3c 73 69 67 |h>.#incl|ude <sig|
|00005a20| 6e 61 6c 2e 68 3e 0a 23 | 69 6e 63 6c 75 64 65 20 |nal.h>.#|include |
|00005a30| 3c 73 74 64 69 6f 2e 68 | 3e 0a 2f 2a 0a 20 2a 20 |<stdio.h|>./*. * |
|00005a40| 73 65 6e 64 3a 20 77 72 | 69 74 65 20 74 68 65 20 |send: wr|ite the |
|00005a50| 73 74 72 69 6e 67 20 6f | 75 74 2e 20 53 68 6f 77 |string o|ut. Show|
|00005a60| 20 74 68 65 20 63 68 61 | 72 73 20 77 72 69 74 74 | the cha|rs writt|
|00005a70| 65 6e 20 69 66 20 6e 65 | 63 65 73 73 61 72 79 2e |en if ne|cessary.|
|00005a80| 0a 20 2a 2f 0a 73 65 6e | 64 28 73 2c 20 66 75 6e |. */.sen|d(s, fun|
|00005a90| 63 29 0a 63 68 61 72 20 | 2a 73 3b 0a 76 6f 69 64 |c).char |*s;.void|
|00005aa0| 20 28 2a 66 75 6e 63 29 | 28 29 3b 0a 7b 0a 23 69 | (*func)|();.{.#i|
|00005ab0| 66 64 65 66 09 44 45 42 | 55 47 0a 09 70 72 69 6e |fdef.DEB|UG..prin|
|00005ac0| 74 66 28 22 73 65 6e 64 | 28 22 29 3b 0a 09 73 73 |tf("send|(");..ss|
|00005ad0| 68 6f 77 28 73 29 3b 0a | 09 70 72 69 6e 74 66 28 |how(s);.|.printf(|
|00005ae0| 22 29 5c 6e 22 29 3b 0a | 23 65 6e 64 69 66 0a 09 |")\n");.|#endif..|
|00005af0| 28 2a 66 75 6e 63 29 28 | 73 29 3b 0a 09 73 6c 65 |(*func)(|s);..sle|
|00005b00| 65 70 28 31 29 3b 0a 7d | 0a 2f 2a 0a 20 2a 20 65 |ep(1);.}|./*. * e|
|00005b10| 78 70 65 63 74 3a 20 65 | 78 70 65 63 74 20 61 20 |xpect: e|xpect a |
|00005b20| 73 74 72 69 6e 67 2e 20 | 52 65 74 75 72 6e 20 30 |string. |Return 0|
|00005b30| 20 6f 6e 20 73 75 63 63 | 65 73 73 2c 20 31 20 6f | on succ|ess, 1 o|
|00005b40| 6e 20 74 69 6d 65 6f 75 | 74 2e 0a 20 2a 20 63 68 |n timeou|t.. * ch|
|00005b50| 61 72 73 20 61 72 65 20 | 74 68 72 65 61 64 65 64 |ars are |threaded|
|00005b60| 20 6f 6e 20 74 68 65 20 | 6e 65 65 64 6c 65 20 61 | on the |needle a|
|00005b70| 73 20 74 68 65 79 20 6d | 61 74 63 68 20 74 68 65 |s they m|atch the|
|00005b80| 20 65 78 70 65 63 74 20 | 73 74 72 69 6e 67 0a 20 | expect |string. |
|00005b90| 2a 20 69 66 20 6f 6e 65 | 20 66 61 69 6c 73 20 74 |* if one| fails t|
|00005ba0| 6f 20 6d 61 74 63 68 2c | 20 61 6c 6c 20 63 68 61 |o match,| all cha|
|00005bb0| 72 73 20 61 72 65 20 75 | 6e 74 68 72 65 61 64 65 |rs are u|nthreade|
|00005bc0| 64 2e 20 0a 20 2a 20 65 | 78 70 65 63 74 20 73 75 |d. . * e|xpect su|
|00005bd0| 63 63 65 65 64 73 20 69 | 66 20 61 6c 6c 20 63 68 |cceeds i|f all ch|
|00005be0| 61 72 73 20 6f 6e 20 65 | 78 70 65 63 74 20 73 74 |ars on e|xpect st|
|00005bf0| 72 69 6e 67 20 61 72 65 | 20 74 68 72 65 61 64 65 |ring are| threade|
|00005c00| 64 2e 0a 20 2a 2f 0a 6a | 6d 70 5f 62 75 66 20 65 |d.. */.j|mp_buf e|
|00005c10| 6e 76 3b 0a 0a 74 69 6d | 65 6f 75 74 28 29 7b 0a |nv;..tim|eout(){.|
|00005c20| 09 6c 6f 6e 67 6a 6d 70 | 28 65 6e 76 2c 20 31 29 |.longjmp|(env, 1)|
|00005c30| 3b 0a 7d 0a 0a 65 78 70 | 65 63 74 28 73 2c 20 74 |;.}..exp|ect(s, t|
|00005c40| 2c 20 66 75 6e 63 29 0a | 63 68 61 72 20 2a 73 3b |, func).|char *s;|
|00005c50| 0a 69 6e 74 20 28 2a 66 | 75 6e 63 29 28 29 3b 0a |.int (*f|unc)();.|
|00005c60| 7b 0a 09 63 68 61 72 20 | 2a 6e 65 65 64 6c 65 20 |{..char |*needle |
|00005c70| 3d 20 73 2c 20 63 3b 0a | 09 69 6e 74 20 28 2a 68 |= s, c;.|.int (*h|
|00005c80| 61 6e 64 6c 65 72 29 28 | 29 3b 0a 09 61 6c 61 72 |andler)(|);..alar|
|00005c90| 6d 28 30 29 3b 0a 09 68 | 61 6e 64 6c 65 72 20 3d |m(0);..h|andler =|
|00005ca0| 20 73 69 67 6e 61 6c 28 | 53 49 47 41 4c 52 4d 2c | signal(|SIGALRM,|
|00005cb0| 20 74 69 6d 65 6f 75 74 | 29 3b 0a 09 69 66 28 73 | timeout|);..if(s|
|00005cc0| 65 74 6a 6d 70 28 65 6e | 76 29 29 20 7b 0a 09 09 |etjmp(en|v)) {...|
|00005cd0| 70 72 69 6e 74 66 28 22 | 54 69 6d 65 6f 75 74 20 |printf("|Timeout |
|00005ce0| 65 78 70 65 63 74 69 6e | 67 20 25 73 5c 6e 22 2c |expectin|g %s\n",|
|00005cf0| 20 73 29 3b 0a 09 09 72 | 65 74 75 72 6e 28 31 29 | s);...r|eturn(1)|
|00005d00| 3b 09 09 2f 2a 20 66 61 | 69 6c 20 2d 20 74 69 6d |;../* fa|il - tim|
|00005d10| 65 6f 75 74 20 2a 2f 0a | 09 7d 0a 09 61 6c 61 72 |eout */.|.}..alar|
|00005d20| 6d 28 74 29 3b 09 09 09 | 09 2f 2a 20 69 66 20 7a |m(t);...|./* if z|
|00005d30| 65 72 6f 2c 20 6e 6f 20 | 74 69 6d 65 6f 75 74 20 |ero, no |timeout |
|00005d40| 2a 2f 0a 23 69 66 64 65 | 66 09 44 45 42 55 47 0a |*/.#ifde|f.DEBUG.|
|00005d50| 09 70 72 69 6e 74 66 28 | 22 5c 6e 65 78 70 65 63 |.printf(|"\nexpec|
|00005d60| 74 28 25 73 29 5c 6e 22 | 2c 20 73 29 3b 0a 23 65 |t(%s)\n"|, s);.#e|
|00005d70| 6e 64 69 66 0a 09 77 68 | 69 6c 65 28 2a 6e 65 65 |ndif..wh|ile(*nee|
|00005d80| 64 6c 65 29 20 7b 0a 09 | 09 63 20 3d 20 28 2a 66 |dle) {..|.c = (*f|
|00005d90| 75 6e 63 29 28 29 3b 0a | 23 69 66 64 65 66 20 44 |unc)();.|#ifdef D|
|00005da0| 45 42 55 47 0a 09 09 73 | 68 6f 77 28 63 29 3b 0a |EBUG...s|how(c);.|
|00005db0| 23 65 6e 64 69 66 0a 09 | 09 69 66 28 2a 6e 65 65 |#endif..|.if(*nee|
|00005dc0| 64 6c 65 20 21 3d 20 63 | 29 20 6e 65 65 64 6c 65 |dle != c|) needle|
|00005dd0| 20 3d 20 73 3b 0a 09 09 | 69 66 28 2a 6e 65 65 64 | = s;...|if(*need|
|00005de0| 6c 65 20 3d 3d 20 63 29 | 20 6e 65 65 64 6c 65 2b |le == c)| needle+|
|00005df0| 2b 3b 0a 09 7d 0a 23 69 | 66 64 65 66 09 44 45 42 |+;..}.#i|fdef.DEB|
|00005e00| 55 47 0a 09 70 72 69 6e | 74 66 28 22 67 6f 74 20 |UG..prin|tf("got |
|00005e10| 69 74 5c 6e 22 29 3b 0a | 23 65 6e 64 69 66 0a 09 |it\n");.|#endif..|
|00005e20| 61 6c 61 72 6d 28 30 29 | 3b 0a 09 73 69 67 6e 61 |alarm(0)|;..signa|
|00005e30| 6c 28 53 49 47 41 4c 52 | 4d 2c 20 68 61 6e 64 6c |l(SIGALR|M, handl|
|00005e40| 65 72 29 3b 0a 09 72 65 | 74 75 72 6e 28 30 29 3b |er);..re|turn(0);|
|00005e50| 0a 7d 0a 23 69 66 64 65 | 66 09 44 45 42 55 47 0a |.}.#ifde|f.DEBUG.|
|00005e60| 2f 2a 0a 20 2a 20 73 73 | 68 6f 77 3a 20 73 68 6f |/*. * ss|how: sho|
|00005e70| 77 20 73 74 72 69 6e 67 | 0a 20 2a 2f 0a 73 73 68 |w string|. */.ssh|
|00005e80| 6f 77 28 73 29 0a 63 68 | 61 72 20 2a 73 3b 0a 7b |ow(s).ch|ar *s;.{|
|00005e90| 0a 09 77 68 69 6c 65 28 | 2a 73 29 20 73 68 6f 77 |..while(|*s) show|
|00005ea0| 28 2a 73 2b 2b 29 3b 0a | 7d 0a 73 68 6f 77 28 63 |(*s++);.|}.show(c|
|00005eb0| 29 0a 63 68 61 72 20 63 | 3b 0a 7b 0a 09 69 66 28 |).char c|;.{..if(|
|00005ec0| 28 63 20 3c 20 33 31 29 | 29 20 7b 0a 09 09 70 72 |(c < 31)|) {...pr|
|00005ed0| 69 6e 74 66 28 22 5e 25 | 63 22 2c 20 63 20 2b 20 |intf("^%|c", c + |
|00005ee0| 27 40 27 29 3b 0a 09 09 | 69 66 28 63 20 3d 3d 20 |'@');...|if(c == |
|00005ef0| 27 5c 6e 27 29 20 70 75 | 74 63 68 61 72 28 27 5c |'\n') pu|tchar('\|
|00005f00| 6e 27 29 3b 0a 09 7d 0a | 09 65 6c 73 65 20 70 75 |n');..}.|.else pu|
|00005f10| 74 63 68 61 72 28 63 29 | 3b 0a 09 66 66 6c 75 73 |tchar(c)|;..fflus|
|00005f20| 68 28 73 74 64 6f 75 74 | 29 3b 0a 7d 0a 23 65 6e |h(stdout|);.}.#en|
|00005f30| 64 69 66 0a 0a 53 48 41 | 52 5f 45 4f 46 0a 69 66 |dif..SHA|R_EOF.if|
|00005f40| 20 74 65 73 74 20 31 37 | 39 37 20 2d 6e 65 20 22 | test 17|97 -ne "|
|00005f50| 60 77 63 20 2d 63 20 3c | 20 27 73 65 6e 64 65 78 |`wc -c <| 'sendex|
|00005f60| 2e 63 27 60 22 0a 74 68 | 65 6e 0a 09 65 63 68 6f |.c'`".th|en..echo|
|00005f70| 20 73 68 61 72 3a 20 22 | 65 72 72 6f 72 20 74 72 | shar: "|error tr|
|00005f80| 61 6e 73 6d 69 74 74 69 | 6e 67 20 27 73 65 6e 64 |ansmitti|ng 'send|
|00005f90| 65 78 2e 63 27 22 20 27 | 28 73 68 6f 75 6c 64 20 |ex.c'" '|(should |
|00005fa0| 68 61 76 65 20 62 65 65 | 6e 20 31 37 39 37 20 63 |have bee|n 1797 c|
|00005fb0| 68 61 72 61 63 74 65 72 | 73 29 27 0a 66 69 0a 66 |haracter|s)'.fi.f|
|00005fc0| 69 0a 65 63 68 6f 20 73 | 68 61 72 3a 20 22 65 78 |i.echo s|har: "ex|
|00005fd0| 74 72 61 63 74 69 6e 67 | 20 27 69 6f 2e 63 27 22 |tracting| 'io.c'"|
|00005fe0| 20 27 28 34 36 39 30 20 | 63 68 61 72 61 63 74 65 | '(4690 |characte|
|00005ff0| 72 73 29 27 0a 69 66 20 | 74 65 73 74 20 2d 66 20 |rs)'.if |test -f |
|00006000| 27 69 6f 2e 63 27 0a 74 | 68 65 6e 0a 09 65 63 68 |'io.c'.t|hen..ech|
|00006010| 6f 20 73 68 61 72 3a 20 | 22 77 69 6c 6c 20 6e 6f |o shar: |"will no|
|00006020| 74 20 6f 76 65 72 2d 77 | 72 69 74 65 20 65 78 69 |t over-w|rite exi|
|00006030| 73 74 69 6e 67 20 66 69 | 6c 65 20 27 69 6f 2e 63 |sting fi|le 'io.c|
|00006040| 27 22 0a 65 6c 73 65 0a | 63 61 74 20 3c 3c 20 5c |'".else.|cat << \|
|00006050| 53 48 41 52 5f 45 4f 46 | 20 3e 20 27 69 6f 2e 63 |SHAR_EOF| > 'io.c|
|00006060| 27 0a 2f 2a 0a 20 2a 20 | 43 6f 70 79 72 69 67 68 |'./*. * |Copyrigh|
|00006070| 74 20 28 63 29 20 44 61 | 76 65 20 53 65 74 74 6c |t (c) Da|ve Settl|
|00006080| 65 2c 20 4d 61 72 63 68 | 20 31 39 38 37 0a 20 2a |e, March| 1987. *|
|00006090| 20 50 65 72 6d 69 73 73 | 69 6f 6e 20 69 73 20 67 | Permiss|ion is g|
|000060a0| 72 61 6e 74 65 64 20 74 | 6f 20 64 6f 20 61 6e 79 |ranted t|o do any|
|000060b0| 74 68 69 6e 67 20 77 69 | 74 68 20 74 68 69 73 20 |thing wi|th this |
|000060c0| 70 72 6f 67 72 61 6d 2c | 20 65 78 63 65 70 74 20 |program,| except |
|000060d0| 72 65 6d 6f 76 65 0a 20 | 2a 20 74 68 69 73 20 63 |remove. |* this c|
|000060e0| 6f 70 79 72 69 67 68 74 | 20 6e 6f 74 69 63 65 2c |opyright| notice,|
|000060f0| 20 6f 72 20 73 65 6c 6c | 20 69 74 20 66 6f 72 20 | or sell| it for |
|00006100| 70 72 6f 66 69 74 2e 0a | 20 2a 0a 20 2a 0a 20 2a |profit..| *. *. *|
|00006110| 20 69 6f 2e 63 3a 20 72 | 6f 75 74 69 6e 65 73 20 | io.c: r|outines |
|00006120| 74 6f 20 74 61 6c 6b 20 | 74 6f 20 74 68 65 20 64 |to talk |to the d|
|00006130| 65 76 69 63 65 20 64 69 | 72 65 63 74 6c 79 2e 0a |evice di|rectly..|
|00006140| 20 2a 0a 20 2a 20 64 72 | 65 61 64 20 61 6e 64 20 | *. * dr|ead and |
|00006150| 64 77 72 69 74 65 20 61 | 63 74 20 6c 69 6b 65 20 |dwrite a|ct like |
|00006160| 72 65 61 64 28 32 29 20 | 61 6e 64 20 77 72 69 74 |read(2) |and writ|
|00006170| 65 28 32 29 2c 20 65 78 | 65 63 70 74 20 74 68 61 |e(2), ex|ecpt tha|
|00006180| 74 20 74 68 65 79 20 61 | 6c 77 61 79 73 0a 20 2a |t they a|lways. *|
|00006190| 20 65 69 74 68 65 72 20 | 73 75 63 63 65 65 64 20 | either |succeed |
|000061a0| 6f 72 20 65 78 69 74 2c | 20 73 6f 20 74 68 65 20 |or exit,| so the |
|000061b0| 63 61 6c 6c 65 72 20 64 | 6f 65 73 6e 27 74 20 68 |caller d|oesn't h|
|000061c0| 61 76 65 20 74 6f 20 63 | 68 65 63 6b 2e 0a 20 2a |ave to c|heck.. *|
|000061d0| 0a 20 2a 20 68 61 6e 67 | 75 70 20 64 72 6f 70 73 |. * hang|up drops|
|000061e0| 20 74 68 65 20 44 54 52 | 20 6c 69 6e 65 20 74 6f | the DTR| line to|
|000061f0| 20 74 68 65 20 6d 6f 64 | 65 6d 2c 20 73 6f 20 74 | the mod|em, so t|
|00006200| 68 61 74 20 69 74 20 77 | 69 6c 6c 20 28 68 6f 70 |hat it w|ill (hop|
|00006210| 65 66 75 6c 6c 79 29 20 | 68 61 6e 67 20 75 70 0a |efully) |hang up.|
|00006220| 20 2a 20 74 68 65 20 70 | 68 6f 6e 65 20 6c 69 6e | * the p|hone lin|
|00006230| 65 2e 20 49 74 20 6b 65 | 65 70 73 20 69 74 20 74 |e. It ke|eps it t|
|00006240| 68 69 73 20 77 61 79 20 | 66 6f 72 20 35 20 73 65 |his way |for 5 se|
|00006250| 63 6f 6e 64 73 2e 0a 20 | 2a 0a 20 2a 20 66 69 6e |conds.. |*. * fin|
|00006260| 64 73 70 65 65 64 20 74 | 61 6b 65 73 20 61 6e 20 |dspeed t|akes an |
|00006270| 61 73 63 69 69 20 73 70 | 65 65 64 2c 20 61 6e 64 |ascii sp|eed, and|
|00006280| 20 72 65 74 75 72 6e 73 | 20 74 68 65 20 63 6f 72 | returns| the cor|
|00006290| 72 65 73 70 6f 6e 69 6e | 67 20 62 61 75 64 20 72 |responin|g baud r|
|000062a0| 61 74 65 2e 0a 20 2a 0a | 20 2a 20 75 75 65 78 69 |ate.. *.| * uuexi|
|000062b0| 74 20 69 73 20 61 20 64 | 6f 64 67 79 20 72 6f 75 |t is a d|odgy rou|
|000062c0| 74 69 6e 65 20 74 6f 20 | 6d 61 6b 65 20 55 55 43 |tine to |make UUC|
|000062d0| 50 20 68 61 70 70 79 2e | 0a 20 2a 2f 0a 0a 23 69 |P happy.|. */..#i|
|000062e0| 6e 63 6c 75 64 65 20 3c | 73 79 73 2f 65 72 72 6e |nclude <|sys/errn|
|000062f0| 6f 2e 68 3e 0a 23 69 6e | 63 6c 75 64 65 20 3c 74 |o.h>.#in|clude <t|
|00006300| 65 72 6d 69 6f 2e 68 3e | 0a 23 69 6e 63 6c 75 64 |ermio.h>|.#includ|
|00006310| 65 20 3c 66 63 6e 74 6c | 2e 68 3e 0a 0a 23 69 6e |e <fcntl|.h>..#in|
|00006320| 63 6c 75 64 65 20 22 6d | 6f 64 65 6d 2e 68 22 0a |clude "m|odem.h".|
|00006330| 0a 63 68 61 72 20 2a 73 | 79 73 5f 65 72 72 6c 69 |.char *s|ys_errli|
|00006340| 73 74 5b 5d 3b 09 09 2f | 2a 20 65 72 72 6f 72 20 |st[];../|* error |
|00006350| 6c 69 73 74 09 09 2a 2f | 0a 23 64 65 66 69 6e 65 |list..*/|.#define|
|00006360| 20 52 45 54 52 59 20 35 | 09 09 09 2f 2a 20 72 65 | RETRY 5|.../* re|
|00006370| 74 72 79 20 66 61 69 6c | 65 64 20 77 72 69 74 65 |try fail|ed write|
|00006380| 73 09 2a 2f 0a 2f 2a 0a | 20 2a 20 64 77 72 69 74 |s.*/./*.| * dwrit|
|00006390| 65 3a 20 77 72 69 74 65 | 20 73 6f 6d 65 20 63 68 |e: write| some ch|
|000063a0| 61 72 61 63 74 65 72 73 | 20 74 6f 20 74 68 65 20 |aracters| to the |
|000063b0| 6d 6f 64 65 6d 2e 20 0a | 20 2a 20 49 66 20 79 6f |modem. .| * If yo|
|000063c0| 75 72 20 6d 6f 64 65 6d | 20 6c 69 6b 65 73 20 63 |ur modem| likes c|
|000063d0| 68 61 72 61 63 74 65 72 | 73 20 74 6f 20 62 65 20 |haracter|s to be |
|000063e0| 77 72 69 74 74 65 6e 20 | 73 2d 6c 2d 6f 2d 77 2d |written |s-l-o-w-|
|000063f0| 6c 2d 79 2c 20 64 65 66 | 69 6e 65 20 27 53 4c 4f |l-y, def|ine 'SLO|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.