home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / c-kermit / ckudia.c < prev    next >
C/C++ Source or Header  |  2020-01-01  |  240KB  |  8,250 lines

  1. #include "ckcsym.h"
  2. char *dialv = "Dial Command, 9.0.160, 16 Oct 2009";
  3.  
  4. /*  C K U D I A     --  Module for automatic modem dialing. */
  5.  
  6. /*
  7.   Copyright (C) 1985, 2009,
  8.     Trustees of Columbia University in the City of New York.
  9.     All rights reserved.  See the C-Kermit COPYING.TXT file or the
  10.     copyright text in the ckcmai.c module for disclaimer and permissions.
  11. */
  12.  
  13. /*
  14.   Authors:
  15.  
  16.   Original (version 1, 1985) author: Herm Fischer, Encino, CA.
  17.   Contributed to Columbia University in 1985 for inclusion in C-Kermit 4.0.
  18.   Author and maintainer since 1985: Frank da Cruz, Columbia University,
  19.   fdc@columbia.edu.
  20.  
  21.   Contributions by many others throughout the years, including: Jeffrey
  22.   Altman, Mark Berryman, Fernando Cabral, John Chmielewski, Joe Doupnik,
  23.   Richard Hill, Larry Jacobs, Eric Jones, Tom Kloos, Bob Larson, Peter Mauzey,
  24.   Joe Orost, Kevin O'Gorman, Kai Uwe Rommel, Dan Schullman, Warren Tucker, and
  25.   many others.
  26. */
  27.  
  28. /*
  29.   Entry points:
  30.     ckdial(char * number)   Dial a number or answer a call
  31.     dialhup()               Hang up a dialed connection
  32.     mdmhup()                Use modem commands to hang up
  33.  
  34.   All other routines are static.
  35.   Don't call dialhup() or mdmhup() without first calling ckdial().
  36. */
  37.  
  38. /*
  39.   This module calls externally defined system-dependent functions for
  40.   communications i/o, as described in CKCPLM.DOC, the C-Kermit Program Logic
  41.   Manual, and thus should be portable to all systems that implement those
  42.   functions, and where alarm() and signal() work.
  43.  
  44.   HOW TO ADD SUPPORT FOR ANOTHER MODEM:
  45.  
  46.   1. In ckuusr.h, define a modem-type number symbol (n_XXX) for the new modem,
  47.      the next highest one.
  48.  
  49.   2. In ckuusr.h, adjust MAX_MDM to the new number of modem types.
  50.  
  51. The remaining steps are in this module:
  52.  
  53.   3. Create a MDMINF structure for it.  NOTE: The wake_str should include
  54.      all invariant setup info, e.g. enable result codes, BREAK transparency,
  55.      modulation negotiation, etc.  See ckcker.h for MDMINF struct definition.
  56.  
  57.   4. Add the address of the MDMINF structure to the modemp[] array,
  58.      according to the numerical value of the modem-type number.
  59.  
  60.   5. Add the user-visible (SET MODEM) name and corresponding modem number
  61.      to the mdmtab[] array, in alphabetical order by modem-name string.
  62.  
  63.   6. If this falls into a class like is_rockwell, is_supra, etc, add the new
  64.      one to the definition of the class.
  65.  
  66.   7. Adjust the gethrn() routine to account for any special numeric result
  67.      codes (if it's a Hayes compatible modem).
  68.  
  69.   8. Read through the code and add any modem-specific sections as necessary.
  70.      For most modern Hayes-compatible modems, no specific code will be
  71.      needed.
  72.  
  73.   NOTE: The MINIDIAL symbol is used to build this module to include support
  74.   for only a minimum number of standard and/or generally useful modem types,
  75.   namely Hayes 1200 and 2400, ITU-T (CCITT) V.25bis and V.25ter (V.250),
  76.   Generic-High-Speed, "Unknown", and None.  When adding support for a new
  77.   modem type, keep it outside of the MINIDIAL sections unless it deserves to
  78.   be in it.
  79. */
  80.  
  81. #include "ckcdeb.h"
  82. #ifndef NOLOCAL
  83. #ifndef NODIAL
  84. #ifndef NOICP
  85.  
  86. #ifndef CK_ATDT
  87. #define CK_ATDT
  88. #endif /* CK_ATDT */
  89.  
  90. #ifndef NOOLDMODEMS        /* Unless instructed otherwise, */
  91. #define OLDMODEMS          /* keep support for old modems. */
  92. #endif /* NOOLDMODEMS */
  93.  
  94. #ifndef M_OLD           /* Hide old modem keywords in SET MODEM table. */
  95. #define M_OLD 0           /* Define as CM_INV to make them invisible. */
  96. #endif /* M_OLD */
  97.  
  98. #ifndef M_ALIAS
  99. #define M_ALIAS 64
  100. #endif /* M_ALIAS */
  101.  
  102. #ifndef MAC
  103. #include <signal.h>
  104. #endif /* MAC */
  105. #include "ckcasc.h"
  106. #include "ckcker.h"
  107. #include "ckucmd.h"
  108. #include "ckcnet.h"
  109. #include "ckuusr.h"
  110.  
  111. #ifdef OS2ONLY
  112. #define INCL_VIO            /* Needed for ckocon.h */
  113. #include <os2.h>
  114. #undef COMMENT
  115. #include "ckocon.h"
  116. #endif /* OS2ONLY */
  117.  
  118. #ifdef NT
  119. #include <windows.h>
  120. #include <tapi.h>
  121. #include "cknwin.h"
  122. #include "ckntap.h"
  123. #endif /* NT */
  124. #ifdef OS2
  125. #include "ckowin.h"
  126. #endif /* OS2 */
  127.  
  128. #ifndef ZILOG
  129. #ifdef NT
  130. #include <setjmpex.h>
  131. #else /* NT */
  132. #include <setjmp.h>
  133. #endif /* NT */
  134. #else
  135. #include <setret.h>
  136. #endif /* ZILOG */
  137.  
  138. #include "ckcsig.h"        /* C-Kermit signal processing */
  139.  
  140. #ifdef MAC
  141. #define signal msignal
  142. #define SIGTYP long
  143. #define alarm malarm
  144. #define SIG_IGN 0
  145. #define SIGALRM 1
  146. #define SIGINT  2
  147. SIGTYP (*msignal(int type, SIGTYP (*func)(int)))(int);
  148. #endif /* MAC */
  149.  
  150. #ifdef AMIGA
  151. #define signal asignal
  152. #define alarm aalarm
  153. #define SIGALRM (_NUMSIG+1)
  154. #define SIGTYP void
  155. SIGTYP (*asignal(int type, SIGTYP (*func)(int)))(int);
  156. unsigned aalarm(unsigned);
  157. #endif /* AMIGA */
  158.  
  159. #ifdef STRATUS
  160. /*
  161.   VOS doesn't have alarm(), but it does have some things we can work with.
  162.   However, we have to catch all the signals in one place to do this, so
  163.   we intercept the signal() routine and call it from our own replacement.
  164. */
  165. #define signal vsignal
  166. #define alarm valarm
  167. SIGTYP (*vsignal(int type, SIGTYP (*func)(int)))(int);
  168. int valarm(int interval);
  169. #ifdef putchar
  170. #undef putchar
  171. #endif /* putchar */
  172. #define putchar(x) conoc(x)
  173. #ifdef getchar
  174. #undef getchar
  175. #endif /* getchar */
  176. #define getchar(x) coninc(0)
  177. #endif /* STRATUS */
  178.  
  179. #ifdef OS2
  180. #ifdef putchar
  181. #undef putchar
  182. #endif /* putchar */
  183. #define putchar(x) conoc(x)
  184. #endif /* OS2 */
  185.  
  186. #ifndef NOHINTS
  187. extern int hints;
  188. #endif /* NOHINTS */
  189.  
  190. #ifdef CK_TAPI
  191. extern int tttapi;
  192. extern int tapipass;
  193. #endif /* CK_TAPI */
  194.  
  195. #ifdef CKLOGDIAL
  196. extern int dialog;
  197. #endif /* CKLOGDIAL */
  198.  
  199. char * dialmsg[] = {            /* DIAL status strings */
  200.  
  201.     /* Keyed to numbers defined in ckcker.h -- keep in sync! */
  202.  
  203.     "DIAL succeeded",                /*  0 DIA_OK */
  204.     "Modem type not specified",            /*  1 DIA_NOMO */
  205.     "Communication device not specified",   /*  2 DIA_NOLI */
  206.     "Communication device can't be opened", /*  3 DIA_OPEN */
  207.     "Speed not specified",            /*  4 DIA_NOSP */
  208.     "Pre-DIAL hangup failed",            /*  5 DIA_HANG */
  209.     "Internal error",                /*  6 DIA_IE   */
  210.     "Device input/output error",        /*  7 DIA_IO   */
  211.     "DIAL TIMEOUT expired",            /*  8 DIA_TIMO */
  212.     "Interrupted by user",            /*  9 DIA_INTR */
  213.     "Modem not ready",                /* 10 DIA_NRDY */
  214.     "Partial dial OK",                /* 11 DIA_PART */
  215.     "Dial directory lookup error",        /* 12 DIA_DIR  */
  216.     "Hangup OK",                /* 13 DIA_HUP  */
  217.     NULL,                    /* 14 (undef)  */
  218.     NULL,                    /* 15 (undef)  */
  219.     NULL,                    /* 16 (undef)  */
  220.     NULL,                    /* 17 (undef)  */
  221.     NULL,                    /* 18 (undef)  */
  222.     "No response from modem",            /* 19 DIA_NRSP */
  223.     "Modem command error",            /* 20 DIA_ERR  */
  224.     "Failure to initialize modem",        /* 21 DIA_NOIN */
  225.     "Phone busy",                /* 22 DIA_BUSY */
  226.     "No carrier",                /* 23 DIA_NOCA */
  227.     "No dialtone",                /* 24 DIA_NODT */
  228.     "Incoming call",                /* 25 DIA_RING */
  229.     "No answer",                /* 26 DIA_NOAN */
  230.     "Disconnected",                /* 27 DIA_DISC */
  231.     "Answered by voice",            /* 28 DIA_VOIC */
  232.     "Access denied / forbidden call",        /* 29 DIA_NOAC */
  233.     "Blacklisted",                /* 30 DIA_BLCK */
  234.     "Delayed",                    /* 31 DIA_DELA */
  235.     "Fax connection",                /* 32 DIA_FAX  */
  236.     "Digital line",                /* 33 DIA_DIGI */
  237.     "TAPI dialing failure",                /* 34 DIA_TAPI */
  238.     NULL                    /* 34 */
  239. };
  240.  
  241. #ifdef COMMENT
  242. #ifdef NOSPL
  243. static
  244. #endif /* NOSPL */
  245. char modemmsg[128] = { NUL, NUL };    /* DIAL response from modem */
  246. #endif /* COMMENT */
  247.  
  248. #ifdef NTSIG
  249. extern int TlsIndex;
  250. #endif /* NTSIG */
  251.  
  252. int mdmtyp = n_GENERIC;            /* Default modem type */
  253. int mdmset = 0;                /* User explicitly set a modem type */
  254.  
  255. int                    /* SET DIAL parameters */
  256.   dialhng = 1,                /* DIAL HANGUP, default is ON */
  257.   dialdpy = 0,                /* DIAL DISPLAY, default is OFF */
  258.   mdmspd  = 0,                /* DIAL SPEED-MATCHING (0 = OFF) */
  259.   mdmspk  = 1,                /* MODEM SPEAKER */
  260.   mdmvol  = 2,                /* MODEM VOLUME */
  261.   dialtmo = 0,                /* DIAL TIMEOUT */
  262.   dialatmo = -1,            /* ANSWER TIMEOUT */
  263.   dialksp = 0,                /* DIAL KERMIT-SPOOF, 0 = OFF */
  264.   dialidt = 0,                /* DIAL IGNORE-DIALTONE */
  265. #ifndef CK_RTSCTS
  266.   /* If we can't do RTS/CTS then there's no flow control at first.  */
  267.   /* So we might easily lose the echo to the init string and the OK */
  268.   /* and then give "No response from modem" errors. */
  269.   dialpace = 150,            /* DIAL PACING */
  270. #else
  271.   dialpace = -1,
  272. #endif /* CK_RTSCTS */
  273.  
  274.   /* 0 = RS232 (drop DTR); 1 = MODEM-COMMAND (e.g. <sec>+++<sec>ATH0) */
  275.   dialmhu = DEFMDMHUP;            /* MODEM HANGUP-METHOD */
  276.  
  277. int
  278.   dialec = 1,                /* DIAL ERROR-CORRECTION */
  279.   dialdc = 1,                /* DIAL COMPRESSION  */
  280. #ifdef VMS
  281.   /* VMS can only use Xon/Xoff */
  282.   dialfc = FLO_XONX,            /* DIAL FLOW-CONTROL */
  283. #else
  284.   dialfc = FLO_AUTO,
  285. #endif /* VMS */
  286.   dialmth = XYDM_D,            /* DIAL METHOD (Tone, Pulse, Defalt) */
  287.   dialmauto = 1,            /* DIAL METHOD is AUTO */
  288.   dialesc = 0;                /* DIAL ESCAPE */
  289.  
  290. int telephony = 0;            /* Command-line '-T' option */
  291.  
  292. long dialmax = 0L,            /* Modem's max interface speed */
  293.   dialcapas  = 0L;            /* Modem's capabilities */
  294.  
  295. int dialsta = DIA_UNK;            /* Detailed return code (ckuusr.h) */
  296.  
  297. #ifdef COMMENT
  298. int ans_cid = 0;            /* SET ANSWER parameters */
  299. int ans_rings = 0;            /* (not used yet...) */
  300. #endif /* COMMENT */
  301.  
  302. int is_rockwell = 0;
  303. int is_motorola = 0;
  304. int is_supra = 0;
  305. int is_hayeshispd = 0;
  306.  
  307. /* Dialing directory list */
  308.  
  309. char *dialdir[MAXDDIR];            /* DIAL DIRECTORY filename array */
  310. int   ndialdir = 0;            /* How many dial directories */
  311.  
  312. /* User overrides for built-in modem commands */
  313.  
  314. char *dialini = NULL;            /* MODEM INIT-STRING none */
  315. char *dialmstr = NULL;            /* MODEM DIALMODE-STRING */
  316. char *dialmprmt = NULL;            /* MODEM DIALMODE-PROMPT */
  317. char *dialcmd = NULL;            /* MODEM DIAL-COMMAND, default none */
  318. char *dialname  = NULL;            /* Descriptive name for modem */
  319. char *dialdcon  = NULL;            /* DC ON command */
  320. char *dialdcoff = NULL;            /* DC OFF command */
  321. char *dialecon  = NULL;            /* EC ON command */
  322. char *dialecoff = NULL;            /* EC OFF command */
  323. char *dialaaon  = NULL;            /* Autoanswer ON command */
  324. char *dialaaoff = NULL;            /* Autoanswer OFF command */
  325. char *dialhcmd  = NULL;            /* Hangup command */
  326. char *dialhwfc  = NULL;            /* Hardware flow control command */
  327. char *dialswfc  = NULL;            /* (Local) software f.c. command */
  328. char *dialnofc  = NULL;            /* No (Local) flow control command */
  329. char *dialtone  = NULL;            /* Command to force tone dialing */
  330. char *dialpulse = NULL;            /*  ..to force pulse dialing */
  331. char *dialx3    = NULL;            /* Ignore dialtone */
  332. char *mdmname   = NULL;
  333. char *dialspon  = NULL;            /* Speaker On command */
  334. char *dialspoff = NULL;            /* Speaker Off command */
  335. char *dialvol1  = NULL;            /* Volume Low command */
  336. char *dialvol2  = NULL;            /* Volume Medium command */
  337. char *dialvol3  = NULL;            /* Volume High command */
  338. char *dialini2  = NULL;            /* Second init string */
  339.  
  340. /* Phone number options */
  341.  
  342. char *dialnpr = NULL;            /* DIAL PREFIX, ditto */
  343. char *diallac = NULL;            /* DIAL LOCAL-AREA-CODE, ditto */
  344. char *diallcc = NULL;            /* DIAL LOCAL-COUNTRY-CODE, ditto */
  345. char *dialixp = NULL;            /* DIAL INTL-PREFIX */
  346. char *dialixs = NULL;            /* DIAL INTL-SUFFIX */
  347. char *dialldp = NULL;            /* DIAL LD-PREFIX */
  348. char *diallds = NULL;            /* DIAL LD-SUFFIX */
  349. char *diallcp = NULL;            /* DIAL LOCAL-PREFIX */
  350. char *diallcs = NULL;            /* DIAL LOCAL-SUFFIX */
  351. char *dialpxi = NULL;            /* DIAL PBX-INTERNAL-PREFIX */
  352. char *dialpxo = NULL;            /* DIAL PBX-OUTSIDE-PREFIX */
  353. char *dialsfx = NULL;            /* DIAL SUFFIX */
  354. char *dialtfp = NULL;            /* DIAL TOLL-FREE-PREFIX */
  355.  
  356. char *callid_date = NULL;        /* Caller ID strings */
  357. char *callid_time = NULL;
  358. char *callid_name = NULL;
  359. char *callid_nmbr = NULL;
  360. char *callid_mesg = NULL;
  361.  
  362. extern char * d_name;
  363. extern char * dialtfc[];        /* DIAL TOLL-FREE-AREA-CODE */
  364. extern char * dialpxx[];        /* DIAL PBX-EXCHANGE */
  365. extern int ntollfree;
  366. extern int ndialpxx;
  367.  
  368. extern char * dialpucc[];        /* DIAL Pulse countries */
  369. extern int ndialpucc;
  370. extern char * dialtocc[];        /* DIAL Tone countries */
  371. extern int ndialtocc;
  372.  
  373. char *dialmac   = NULL;            /* DIAL macro */
  374.  
  375. /* Countries where pulse dialing must be used (tone is not available) */
  376. static char * pulsecc[] = { NULL };    /* (Unknown at present) */
  377.  
  378. /* Countries where tone dialing may safely be the default. */
  379. /* "+" marks countries where pulse is also allowed. */
  380. /* Both Pulse and Tone are allowed in Austria & Switzerland but it is not */
  381. /* yet known if Tone is universally in those countries. */
  382. static char * tonecc[] = {
  383.     "1",                /* + North American Numbering Plan */
  384.     "31",                /*   Netherlands */
  385.     "32",                /*   Belgium */
  386.     "33",                /*   France */
  387.     "352",                /*   Luxembourg */
  388.     "353",                /*   Ireland */
  389.     "354",                /*   Iceland */
  390.     "358",                /*   Finland */
  391.     "39",                /*   Italy */
  392.     "44",                /* + UK */
  393.     "45",                /*   Denmark */
  394.     "46",                /*   Sweden */
  395.     "47",                /*   Norway */
  396.     "49",                /* + Germany */
  397.     NULL
  398. };
  399.  
  400. #ifndef MINIDIAL
  401. /*
  402.   Telebit model codes:
  403.  
  404.   ATI  Model Numbers           Examples
  405.   ---  -------------           --------
  406.   123                          Telebit in "total Hayes-1200" emulation mode
  407.   960                          Telebit in Conventional Command (Hayes) mode
  408.   961  RA12C                   IBM PC internal original Trailblazer
  409.   962  RA12E                   External original Trailblazer
  410.   963  RM12C                   Rackmount original Trailblazer
  411.   964  T18PC                   IBM PC internal Trailblazer-Plus (TB+)
  412.   965  T18SA, T2SAA, T2SAS     External TB+, T1600, T2000, T3000, WB, and later
  413.   966  T18RMM                  Rackmount TB+
  414.   967  T2MC                    IBM PS/2 internal TB+
  415.   968  T1000                   External T1000
  416.   969  ?                       Qblazer
  417.   970                          Qblazer Plus
  418.   971  T2500                   External T2500
  419.   972  T2500                   Rackmount T2500
  420. */
  421.  
  422. /* Telebit model codes */
  423.  
  424. #define TB_UNK  0            /* Unknown Telebit model */
  425. #define TB_BLAZ 1            /* Original TrailBlazer */
  426. #define TB_PLUS    2            /* TrailBlazer Plus */
  427. #define TB_1000 3            /* T1000 */
  428. #define TB_1500 4            /* T1500 */
  429. #define TB_1600 5            /* T1600 */
  430. #define TB_2000 6            /* T2000 */
  431. #define TB_2500 7            /* T2500 */
  432. #define TB_3000 8            /* T3000 */
  433. #define TB_QBLA 9            /* Qblazer */
  434. #define TB_WBLA 10            /* WorldBlazer */
  435. #define TB__MAX 10            /* Highest number */
  436.  
  437. char *tb_name[] = {            /* Array of model names */
  438.     "Unknown",                /* TB_UNK  */
  439.     "TrailBlazer",            /* TB_BLAZ */
  440.     "TrailBlazer-Plus",            /* TB_PLUS */
  441.     "T1000",                /* TB_1000 */
  442.     "T1500",                /* TB_1500 */
  443.     "T1600",                /* TB_1600 */
  444.     "T2000",                /* TB_2000 */
  445.     "T2500",                /* TB_2500 */
  446.     "T3000",                /* TB_3000 */
  447.     "Qblazer",                /* TB_QBLA */
  448.     "WorldBlazer",            /* TB_WBLA */
  449.     ""
  450. };
  451. #endif /* MINIDIAL */
  452.  
  453. extern int flow, local, mdmtyp, quiet, backgrd, parity, seslog, network;
  454. extern int carrier, duplex, mdmsav, reliable, setreliable;
  455. extern int ttnproto, nettype;
  456. extern long speed;
  457. extern char ttname[], sesfil[];
  458. #ifndef NOXFER
  459. extern CHAR stchr;
  460. extern int interrupted;
  461. #endif /* NOXFER */
  462.  
  463. /*  Failure codes  */
  464.  
  465. #define F_TIME        1        /* timeout */
  466. #define F_INT        2        /* interrupt */
  467. #define F_MODEM        3        /* modem-detected failure */
  468. #define F_MINIT        4        /* cannot initialize modem */
  469.  
  470. #ifndef CK_TAPI
  471. static
  472. #endif /* CK_TAPI */
  473. #ifdef OS2
  474.  volatile
  475. #endif /* OS2 */
  476.  int fail_code =  0;            /* Default failure reason. */
  477.  
  478. static int xredial = 0;
  479. static int func_code;            /* 0 = dialing, nonzero = answering */
  480. static int partial;
  481. static int mymdmtyp = 0;
  482.  
  483. #define DW_NOTHING      0        /* What we are doing */
  484. #define DW_INIT         1
  485. #define DW_DIAL         2
  486.  
  487. static int dial_what = DW_NOTHING;    /* Nothing at first. */
  488. static int nonverbal = 0;        /* Hayes in numeric response mode */
  489. static MDMINF * mp;
  490. static CHAR escbuf[6];
  491. static long mdmcapas;
  492.  
  493. _PROTOTYP (static VOID dreset, (void) );
  494. _PROTOTYP (static int (*xx_ok), (int,int) );
  495. _PROTOTYP (static int ddinc, (int) );
  496. _PROTOTYP (int dialhup, (void) );
  497. _PROTOTYP (int getok, (int,int) );
  498. _PROTOTYP (char * ck_time, (void) );
  499. _PROTOTYP (static VOID ttslow, (char *, int) );
  500. #ifdef COMMENT
  501. _PROTOTYP (static VOID xcpy, (char *, char *, unsigned int) );
  502. #endif /* COMMENT */
  503. _PROTOTYP (static VOID waitfor, (char *) );
  504. _PROTOTYP (static VOID dialoc, (char) );
  505. _PROTOTYP (static int didweget, (char *, char *) );
  506. _PROTOTYP (static VOID spdchg, (long) );
  507. _PROTOTYP (static int dialfail, (int) );
  508. _PROTOTYP (static VOID gethrw, (void) );
  509. _PROTOTYP (static VOID gethrn, (void) );
  510.  
  511. int dialudt = n_UDEF;            /* Number of user-defined type */
  512.  
  513. /* BEGIN MDMINF STRUCT DEFINITIONS */
  514.  
  515. /*
  516.   Declare structures containing modem-specific information.
  517.   REMEMBER that only the first SEVEN characters of these names are
  518.   guaranteed to be unique.
  519.  
  520.   First declare the three types that are allowed for MINIDIAL versions.
  521. */
  522. static
  523. MDMINF CCITT =                /* CCITT / ITU-T V.25bis autodialer */
  524. /*
  525.   According to V.25bis:
  526.   . Even parity is required for giving commands to the modem.
  527.   . Commands might or might not echo.
  528.   . Responses ("Indications") from the modem are terminated by CR and LF.
  529.   . Call setup is accomplished by:
  530.     - DTE raises DTR (V.24 circuit 108)              [ttopen() does this]
  531.     - Modem raises CTS (V.24 circuit 106)            [C-Kermit ignores this]
  532.     - DTE issues a call request command ("CRN")
  533.     - Modem responds with "VAL" ("command accepted")
  534.     - If the call is completed:
  535.         modem responds with "CNX" ("call connected");
  536.         modem turns CTS (106) OFF;
  537.         modem turns DSR (107) ON;
  538.       else:
  539.         modem responds with "CFI <parameter>" ("call failure indication").
  540.   . To clear a call, the DTE turns DTR (108) OFF.
  541.   . There is no mention of the Carrier Detect circuit (109) in the standard.
  542.   . There is no provision for "escaping back" to the modem's command mode.
  543.  
  544.   It is not known whether there exists in real life a pure V.25bis modem.
  545.   If there is, this code has never been tested on it.  See the Digitel entry.
  546. */
  547.     {
  548.     "Any CCITT / ITU-T V.25bis conformant modem",
  549.     "",            /* pulse command */
  550.     "",            /* tone command */
  551.     40,            /* dial_time -- programmable -- */
  552.     ",:",        /* pause_chars -- "," waits for programmable time */
  553.                         /* ":" waits for dial tone */
  554.     10,            /* pause_time (seconds, just a guess) */
  555.     "",            /* wake_str (none) */
  556.     200,        /* wake_rate (msec) */
  557.     "VAL",        /* wake_prompt */
  558.     "",            /* dmode_str (none) */
  559.     "",            /* dmode_prompt (none) */
  560.     "CRN%s\015",        /* dial_str */
  561.     200,        /* dial_rate (msec) */
  562.     0,            /* No esc_time */
  563.     0,            /* No esc_char  */
  564.     "",            /* No hup_str  */
  565.     "",            /* hwfc_str */
  566.     "",            /* swfc_str */
  567.     "",            /* nofc_str */
  568.     "",            /* ec_on_str */
  569.     "",            /* ec_off_str */
  570.     "",            /* dc_on_str */
  571.     "",            /* dc_off_str */
  572.     "CIC\015",        /* aa_on_str */
  573.     "DIC\015",        /* aa_off_str */
  574.     "",            /* sb_on_str */
  575.     "",            /* sb_off_str */
  576.     "",            /* sp_off_str */
  577.     "",            /* sp_on_str */
  578.     "",            /* vol1_str */
  579.     "",            /* vol2_str */
  580.     "",            /* vol3_str */
  581.     "",            /* ignoredt */
  582.     "",            /* ini2 */
  583.     0L,            /* max_speed */
  584.     CKD_V25,        /* capas */
  585.     NULL        /* No ok_fn    */
  586. };
  587.  
  588. static
  589. MDMINF HAYES =                /* Hayes 2400 and compatible modems */
  590.     {
  591.     "Hayes Smartmodem 2400 and compatibles",
  592.     "ATP\015",                /* pulse command */
  593.     "ATT\015",                /* tone command */
  594.     35,                    /* dial_time */
  595.     ",",                /* pause_chars */
  596.     2,                    /* pause_time */
  597. #ifdef OS2
  598.     "ATE1Q0V1&S0&C1&D2\015",        /* wake_str */
  599. #else
  600. #ifdef VMS
  601.     "ATQ0&S1\015",            /* wake_str */
  602. #else
  603.     "ATQ0\015",                /* wake_str */
  604. #endif /* VMS */
  605. #endif /* OS2 */
  606.     0,                    /* wake_rate */
  607.     "OK\015",                /* wake_prompt */
  608.     "",                    /* dmode_str */
  609.     "",                    /* dmode_prompt */
  610.     "ATD%s\015",            /* dial_str, user supplies D or T */
  611.     0,                    /* dial_rate */
  612.     1100,                /* esc_time */
  613.     43,                    /* esc_char */
  614.     "ATQ0H0\015",            /* hup_str */
  615.     "",                    /* hwfc_str */
  616.     "",                    /* swfc_str */
  617.     "",                    /* nofc_str */
  618.     "",                    /* ec_on_str */
  619.     "",                    /* ec_off_str */
  620.     "",                    /* dc_on_str */
  621.     "",                    /* dc_off_str */
  622.     "ATS0=1\015",            /* aa_on_str */
  623.     "ATS0=0\015",            /* aa_off_str */
  624.     "",                    /* sb_on_str */
  625.     "",                    /* sb_off_str */
  626.     "ATM1\015",                /* sp_on_str */
  627.     "ATM0\015",                /* sp_off_str */
  628.     "ATL1\015",                /* vol1_str */
  629.     "ATL2\015",                /* vol2_str */
  630.     "ATL3\015",                /* vol3_str */
  631.     "ATX3\015",                /* ignoredt */
  632.     "",                    /* ini2 */
  633.     2400L,                /* max_speed */
  634.     CKD_AT,                /* capas */
  635.     getok                /* ok_fn */
  636. };
  637.  
  638. /*
  639.   The intent of the "unknown" modem is to allow KERMIT to support
  640.   unknown modems by having the user type the entire autodial sequence
  641.   (possibly including control characters, etc.) as the "phone number".
  642.   The protocol and other characteristics of this modem are unknown, with
  643.   some "reasonable" values being chosen for some of them.  The only way to
  644.   detect if a connection is made is to look for carrier.
  645. */
  646. static
  647. MDMINF UNKNOWN =            /* Information for "Unknown" modem */
  648.     {
  649.     "Unknown",                /* name */
  650.     "",                    /* pulse command */
  651.     "",                    /* tone command */
  652.     30,                    /* dial_time */
  653.     "",                    /* pause_chars */
  654.     0,                    /* pause_time */
  655.     "",                    /* wake_str */
  656.     0,                    /* wake_rate */
  657.     "",                    /* wake_prompt */
  658.     "",                    /* dmode_str */
  659.     NULL,                /* dmode_prompt */
  660.     "%s\015",                /* dial_str */
  661.     0,                    /* dial_rate */
  662.     0,                    /* esc_time */
  663.     0,                    /* esc_char */
  664.     "",                    /* hup_str */
  665.     "",                    /* hwfc_str */
  666.     "",                    /* swfc_str */
  667.     "",                    /* nofc_str */
  668.     "",                    /* ec_on_str */
  669.     "",                    /* ec_off_str */
  670.     "",                    /* dc_on_str */
  671.     "",                    /* dc_off_str */
  672.     "",                    /* aa_on_str */
  673.     "",                    /* aa_off_str */
  674.     "",                    /* sb_on_str */
  675.     "",                    /* sb_off_str */
  676.     "",                    /* sp_off_str */
  677.     "",                    /* sp_on_str */
  678.     "",                    /* vol1_str */
  679.     "",                    /* vol2_str */
  680.     "",                    /* vol3_str */
  681.     "",                    /* ignoredt */
  682.     "",                    /* ini2 */
  683.     0L,                    /* max_speed */
  684.     0,                    /* capas */
  685.     NULL                /* ok_fn */
  686. };
  687.  
  688. #ifndef MINIDIAL
  689. static
  690. MDMINF ATTISN =                /* AT&T ISN Network */
  691.     {
  692.     "",                    /* pulse command */
  693.     "",                    /* tone command */
  694.     "AT&T ISN Network",
  695.     30,                    /* Dial time */
  696.     "",                    /* Pause characters */
  697.     0,                    /* Pause time */
  698.     "\015\015\015\015",            /* Wake string */
  699.     900,                /* Wake rate */
  700.     "DIAL",                /* Wake prompt */
  701.     "",                    /* dmode_str */
  702.     "",                    /* dmode_prompt */
  703.     "%s\015",                /* dial_str */
  704.     0,                    /* dial_rate */
  705.     0,                    /* esc_time */
  706.     0,                    /* esc_char */
  707.     "",                    /* hup_str */
  708.     "",                    /* hwfc_str */
  709.     "",                    /* swfc_str */
  710.     "",                    /* nofc_str */
  711.     "",                    /* ec_on_str */
  712.     "",                    /* ec_off_str */
  713.     "",                    /* dc_on_str */
  714.     "",                    /* dc_off_str */
  715.     "",                    /* aa_on_str */
  716.     "",                    /* aa_off_str */
  717.     "",                    /* sb_on_str */
  718.     "",                    /* sb_off_str */
  719.     "",                    /* sp_off_str */
  720.     "",                    /* sp_on_str */
  721.     "",                    /* vol1_str */
  722.     "",                    /* vol2_str */
  723.     "",                    /* vol3_str */
  724.     "",                    /* ignoredt */
  725.     "",                    /* ini2 */
  726.     0L,                    /* max_speed */
  727.     0,                    /* capas */
  728.     NULL                /* ok_fn */
  729. };
  730.  
  731. static
  732. MDMINF ATTMODEM =    /* information for AT&T switched-network modems */
  733.             /* "Number" following "dial" can include: p's and
  734.              * t's to indicate pulse or tone (default) dialing,
  735.              * + for wait for dial tone, , for pause, r for
  736.              * last number dialed, and, except for 2224B, some
  737.              * comma-delimited options like o12=y, before number.
  738.  
  739.  * "Important" options for the modems:
  740.  *
  741.  *    All:        Except for 2224B, enable option 12 for "transparent
  742.  *            data," o12=y.  If a computer port used for both
  743.  *            incoming and outgoing calls is connected to the
  744.  *            modem, disable "enter interactive mode on carriage
  745.  *            return," EICR.  The Kermit "dial" command can
  746.  *            function with EIA leads standard, EIAS.
  747.  *
  748.  *    2212C:        Internal hardware switches at their default
  749.  *            positions (four rockers down away from numbers)
  750.  *            unless EICR is not wanted (rocker down at the 4).
  751.  *            For EIAS, rocker down at the 1.
  752.  *
  753.  *    2224B:        Front-panel switch position 1 must be up (at the 1,
  754.  *            closed).  Disable EICR with position 2 down.
  755.  *            For EIAS, position 4 down.
  756.  *            All switches on the back panel down.
  757.  *
  758.  *    2224CEO:    All front-panel switches down except either 5 or 6.
  759.  *            Enable interactive flow control with o16=y.
  760.  *            Select normal asynchronous mode with o34=0 (zero).
  761.  *            Disable EICR with position 3 up.  For EIAS, 1 up.
  762.  *            Reset the modem after changing switches.
  763.  *
  764.  *    2296A:        If option 00 (zeros) is present, use o00=0.
  765.  *            Enable interactive flow control with o16=y.
  766.  *            Select normal asynchronous mode with o34=0 (zero).
  767.  *                      (available in Microcom Networking version, but
  768.  *                      not necessarily other models of the 2296A).
  769.  *            Enable modem-port flow control (if available) with
  770.  *             o42=y.  Enable asynchronous operation with o50=y.
  771.  *             Disable EICR with o69=n.  For EIAS, o66=n, using
  772.  *             front panel.
  773.  */
  774.     {
  775.    "AT&T switched-network modems",
  776.     "",                    /* pulse command */
  777.     "",                    /* tone command */
  778.     20,                    /* dial_time */
  779.     ",",                /* pause_chars */
  780.     2,                    /* pause_time */
  781.     "+",                /* wake_str */
  782.     0,                    /* wake_rate */
  783.     "",                    /* wake_prompt */
  784.     "",                    /* dmode_str */
  785.     "",                    /* dmode_prompt */
  786.     "at%s\015",                /* dial_str */
  787.     0,                    /* dial_rate */
  788.     0,                    /* esc_time */
  789.     0,                    /* esc_char */
  790.     "",                    /* hup_str */
  791.     "",                    /* hwfc_str */
  792.     "",                    /* swfc_str */
  793.     "",                    /* nofc_str */
  794.     "",                    /* ec_on_str */
  795.     "",                    /* ec_off_str */
  796.     "",                    /* dc_on_str */
  797.     "",                    /* dc_off_str */
  798.     "",                    /* aa_on_str */
  799.     "",                    /* aa_off_str */
  800.     "",                    /* sb_on_str */
  801.     "",                    /* sb_off_str */
  802.     "",                    /* sp_off_str */
  803.     "",                    /* sp_on_str */
  804.     "",                    /* vol1_str */
  805.     "",                    /* vol2_str */
  806.     "",                    /* vol3_str */
  807.     "",                    /* ignoredt */
  808.     "",                    /* ini2 */
  809.     0L,                    /* max_speed */
  810.     CKD_AT,                /* capas */
  811.     NULL                /* ok_fn */
  812. };
  813.  
  814. static
  815. MDMINF ATTDTDM = /* AT&T Digital Terminal Data Module  */
  816.          /* For dialing: KYBD switch down, others usually up. */
  817.     {
  818.     "AT&T Digital Terminal Data Module",
  819.     "",                    /* pulse command */
  820.     "",                    /* tone command */
  821.     20,                    /* dial_time */
  822.     "",                    /* pause_chars */
  823.     0,                    /* pause_time */
  824.     "",                    /* wake_str */
  825.     0,                    /* wake_rate */
  826.     "",                    /* wake_prompt */
  827.     "",                    /* dmode_str */
  828.     "",                    /* dmode_prompt */
  829.     "%s\015",                /* dial_str */
  830.     0,                    /* dial_rate */
  831.     0,                    /* esc_time */
  832.     0,                    /* esc_char */
  833.     "",                    /* hup_str */
  834.     "",                    /* hwfc_str */
  835.     "",                    /* swfc_str */
  836.     "",                    /* nofc_str */
  837.     "",                    /* ec_on_str */
  838.     "",                    /* ec_off_str */
  839.     "",                    /* dc_on_str */
  840.     "",                    /* dc_off_str */
  841.     "",                    /* aa_on_str */
  842.     "",                    /* aa_off_str */
  843.     "",                    /* sb_on_str */
  844.     "",                    /* sb_off_str */
  845.     "",                    /* sp_off_str */
  846.     "",                    /* sp_on_str */
  847.     "",                    /* vol1_str */
  848.     "",                    /* vol2_str */
  849.     "",                    /* vol3_str */
  850.     "",                    /* ignoredt */
  851.     "",                    /* ini2 */
  852.     0L,                    /* max_speed */
  853.     0,                    /* capas */
  854.     NULL                /* ok_fn */
  855. };
  856.  
  857. static
  858. MDMINF DIGITEL =        /* Digitel DT-22 CCITT variant used in Brazil */
  859. /*
  860.   Attempts to adhere strictly to the V.25bis specification do not produce good
  861.   results in real life.  The modem for which this code was developed: (a)
  862.   ignores parity; (b) sometimes terminates responses with LF CR instead of CR
  863.   LF; (c) has a Hayes-like escape sequence; (d) supports a hangup ("HUP")
  864.   command.  Information from Fernando Cabral in Brasilia.
  865. */
  866.     {
  867.     "Digitel DT-22 CCITT dialer",
  868.     "",                /* pulse command */
  869.     "",                /* tone command */
  870.     40,                /* dial_time -- programmable -- */
  871.     ",:",        /* pause_chars -- "," waits for programmable time */
  872.                         /* ":" waits for dial tone */
  873.     10,            /* pause_time (seconds, just a guess) */
  874.     "HUP\015",          /* wake_str (Not Standard CCITT) */
  875.     200,        /* wake_rate (msec) */
  876.     "VAL",        /* wake_prompt */
  877.     "",            /* dmode_str (none) */
  878.     "",            /* dmode_prompt (none) */
  879.     "CRN%s\015",        /* dial_str */
  880.     200,        /* dial_rate (msec) */
  881.     1100,        /* esc_time (Not Standard CCITT) */
  882.     43,            /* esc_char  (Not Standard CCITT) */
  883.     "HUP\015",        /* hup_str  (Not Standard CCITT) */
  884.     "",                    /* hwfc_str */
  885.     "",                    /* swfc_str */
  886.     "",                    /* nofc_str */
  887.     "",                    /* ec_on_str */
  888.     "",                    /* ec_off_str */
  889.     "",                    /* dc_on_str */
  890.     "",                    /* dc_off_str */
  891.     "CIC\015",                /* aa_on_str */
  892.     "DIC\015",                /* aa_off_str */
  893.     "",                    /* sb_on_str */
  894.     "",                    /* sb_off_str */
  895.     "",                    /* sp_off_str */
  896.     "",                    /* sp_on_str */
  897.     "",                    /* vol1_str */
  898.     "",                    /* vol2_str */
  899.     "",                    /* vol3_str */
  900.     "",                    /* ignoredt */
  901.     "",                    /* ini2 */
  902.     0L,                    /* max_speed */
  903.     CKD_V25,                /* capas */
  904.     getok                /* ok_fn */
  905. };
  906.  
  907. static
  908. MDMINF H_1200 =        /* Hayes 1200 and compatible modems */
  909.     {
  910.     "Hayes Smartmodem 1200 and compatibles",
  911.     "ATP\015",                /* pulse command */
  912.     "ATT\015",                /* tone command */
  913.     35,                    /* dial_time */
  914.     ",",                /* pause_chars */
  915.     2,                    /* pause_time */
  916. #ifdef OS2
  917.     "ATE1Q0V1\015",            /* wake_str */
  918. #else
  919.     "ATQ0\015",                /* wake_str */
  920. #endif /* OS2 */
  921.     0,                    /* wake_rate */
  922.     "OK\015",                /* wake_prompt */
  923.     "",                    /* dmode_str */
  924.     "",                    /* dmode_prompt */
  925.     "ATD%s\015",            /* dial_str */
  926.     0,                    /* dial_rate */
  927.     1100,                /* esc_time */
  928.     43,                    /* esc_char */
  929.     "ATQ0H0\015",            /* hup_str */
  930.     "",                    /* hwfc_str */
  931.     "",                    /* swfc_str */
  932.     "",                    /* nofc_str */
  933.     "",                    /* ec_on_str */
  934.     "",                    /* ec_off_str */
  935.     "",                    /* dc_on_str */
  936.     "",                    /* dc_off_str */
  937.     "ATS0=1\015",            /* aa_on_str */
  938.     "ATS0=0\015",            /* aa_off_str */
  939.     "",                    /* sb_on_str */
  940.     "",                    /* sb_off_str */
  941.     "ATM1\015",                /* sp_on_str */
  942.     "ATM0\015",                /* sp_off_str */
  943.     "ATL1\015",                /* vol1_str */
  944.     "ATL2\015",                /* vol2_str */
  945.     "ATL3\015",                /* vol3_str */
  946.     "",                    /* ignoredt */
  947.     "",                    /* ini2 */
  948.     1200L,                /* max_speed */
  949.     CKD_AT,                /* capas */
  950.     getok                /* ok_fn */
  951. };
  952.  
  953. static
  954. MDMINF H_ULTRA =            /* Hayes high-speed */
  955.     {
  956.     "Hayes Ultra/Optima/Accura 96/144/288", /* U,O,A */
  957.     "ATP\015",                /* pulse command */
  958.     "ATT\015",                /* tone command */
  959.     35,                    /* dial_time */
  960.     ",",                /* pause_chars */
  961.     2,                    /* pause_time */
  962. #ifdef OS2
  963.     "ATE1Q0V1X4N1Y0&S0&C1&D2S37=0S82=128\015", /* wake_str */
  964. #else
  965. #ifdef VMS
  966.     "ATQ0X4N1Y0&S1S37=0S82=128\015",    /* wake_str */
  967. #else
  968.     "ATQ0X4N1Y0S37=0S82=128\015",    /* wake_str */
  969. #endif /* VMS */
  970. #endif /* OS2 */
  971.     0,                    /* wake_rate */
  972.     "OK\015",                /* wake_prompt */
  973.     "",                    /* dmode_str */
  974.     "",                    /* dmode_prompt */
  975.     "ATD%s\015",            /* dial_str */
  976.     0,                    /* dial_rate */
  977.     1100,                /* esc_time */
  978.     43,                    /* esc_char */
  979.     "ATQ0H0\015",            /* hup_str */
  980.     "AT&K3\015",            /* hwfc_str */   /* OK for U,O */
  981.     "AT&K4\015",            /* swfc_str */   /* OK for U,O */
  982.     "AT&K0\015",            /* nofc_str */   /* OK for U,O */
  983.     "AT&Q5S36=7S48=7\015",        /* ec_on_str */  /* OK for U,O */
  984.     "AT&Q0\015",            /* ec_off_str */ /* OK for U,O */
  985.     "ATS46=2\015",            /* dc_on_str */
  986.     "ATS46=0\015",            /* dc_off_str */
  987.     "ATS0=1\015",            /* aa_on_str */
  988.     "ATS0=0\015",            /* aa_off_str */
  989.     "",                    /* sb_on_str */
  990.     "",                    /* sb_off_str */
  991.     "ATM1\015",                /* sp_on_str */
  992.     "ATM0\015",                /* sp_off_str */
  993.     "ATL1\015",                /* vol1_str */
  994.     "ATL2\015",                /* vol2_str */
  995.     "ATL3\015",                /* vol3_str */
  996.     "ATX3\015",                /* ignoredt */
  997.     "",                    /* ini2 */
  998.     115200L,                /* max_speed */  /* (varies) */
  999.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  1000.     getok                /* ok_fn */
  1001. };
  1002.  
  1003. static
  1004. MDMINF H_ACCURA =            /* Hayes Accura */
  1005.     {                    /* GUESSING IT'S LIKE ULTRA & OPTIMA */
  1006.     "Hayes Accura",
  1007.     "ATP\015",                /* pulse command */
  1008.     "ATT\015",                /* tone command */
  1009.     35,                    /* dial_time */
  1010.     ",",                /* pause_chars */
  1011.     2,                    /* pause_time */
  1012. #ifdef OS2
  1013.     "ATE1Q0V1X4N1Y0&S0&C1&D2S37=0\015",    /* wake_str */
  1014. #else
  1015. #ifdef VMS
  1016.     "ATQ0X4N1Y0&S1S37=0\015",        /* wake_str */
  1017. #else
  1018.     "ATQ0X4N1Y0S37=0\015",        /* wake_str */
  1019. #endif /* VMS */
  1020. #endif /* OS2 */
  1021.     0,                    /* wake_rate */
  1022.     "OK\015",                /* wake_prompt */
  1023.     "",                    /* dmode_str */
  1024.     "",                    /* dmode_prompt */
  1025.     "ATD%s\015",            /* dial_str */
  1026.     0,                    /* dial_rate */
  1027.     1100,                /* esc_time */
  1028.     43,                    /* esc_char */
  1029.     "ATQ0H0\015",            /* hup_str */
  1030.     "AT&K3\015",            /* hwfc_str */
  1031.     "AT&K4\015",            /* swfc_str */
  1032.     "AT&K0\015",            /* nofc_str */
  1033.     "AT&Q5S36=7S48=7\015",        /* ec_on_str */
  1034.     "AT&Q0\015",            /* ec_off_str */
  1035.     "ATS46=2\015",            /* dc_on_str */
  1036.     "ATS46=0\015",            /* dc_off_str */
  1037.     "ATS0=1\015",            /* aa_on_str */
  1038.     "ATS0=0\015",            /* aa_off_str */
  1039.     "",                    /* sb_on_str */
  1040.     "",                    /* sb_off_str */
  1041.     "ATM1\015",                /* sp_on_str */
  1042.     "ATM0\015",                /* sp_off_str */
  1043.     "ATL1\015",                /* vol1_str */
  1044.     "ATL2\015",                /* vol2_str */
  1045.     "ATL3\015",                /* vol3_str */
  1046.     "ATX3\015",                /* ignoredt */
  1047.     "",                    /* ini2 */
  1048.     115200L,                /* max_speed */  /* (varies) */
  1049.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  1050.     getok                /* ok_fn */
  1051. };
  1052.  
  1053. static
  1054. MDMINF PPI =                /* Practical Peripherals  */
  1055.     {
  1056.     "Practical Peripherals V.22bis or higher with V.42 and V.42bis",
  1057.     "ATP\015",                /* pulse command */
  1058.     "ATT\015",                /* tone command */
  1059.     35,                    /* dial_time */
  1060.     ",",                /* pause_chars */
  1061.     2,                    /* pause_time */
  1062. #ifdef COMMENT
  1063. /* In newer models S82 (BREAK handling) was eliminated, causing an error. */
  1064. #ifdef OS2
  1065.     "ATQ0X4N1&S0&C1&D2S37=0S82=128\015", /* wake_str */
  1066. #else
  1067.     "ATQ0X4N1S37=0S82=128\015",        /* wake_str */
  1068. #endif /* OS2 */
  1069. #else /* So now we use Y0 instead */
  1070. #ifdef OS2
  1071.     "ATE1Q0V1X4N1&S0&C1&D2Y0S37=0\015",    /* wake_str */
  1072. #else
  1073. #ifdef VMS
  1074.     "ATQ0X4N1Y0&S1S37=0\015",        /* wake_str */
  1075. #else
  1076.     "ATQ0X4N1Y0S37=0\015",        /* wake_str */
  1077. #endif /* VMS */
  1078. #endif /* OS2 */
  1079. #endif /* COMMENT */
  1080.     0,                    /* wake_rate */
  1081.     "OK\015",                /* wake_prompt */
  1082.     "",                    /* dmode_str */
  1083.     "",                    /* dmode_prompt */
  1084.     "ATD%s\015",            /* dial_str */
  1085.     0,                    /* dial_rate */
  1086.     1100,                /* esc_time */
  1087.     43,                    /* esc_char */
  1088.     "ATQ0H0\015",            /* hup_str */
  1089.     "AT&K3\015",            /* hwfc_str */
  1090.     "AT&K4\015",            /* swfc_str */
  1091.     "AT&K0\015",            /* nofc_str */
  1092.     "AT&Q5S36=7S48=7\015",        /* ec_on_str */
  1093.     "AT&Q0S36=0S48=128\015",        /* ec_off_str */
  1094.     "ATS46=2\015",            /* dc_on_str */
  1095.     "ATS46=0\015",            /* dc_off_str */
  1096.     "ATS0=1\015",            /* aa_on_str */
  1097.     "ATS0=0\015",            /* aa_off_str */
  1098.     "",                    /* sb_on_str  */
  1099.     "",                    /* sb_off_str  */
  1100.     "ATM1\015",                /* sp_on_str */
  1101.     "ATM0\015",                /* sp_off_str */
  1102.     "ATL1\015",                /* vol1_str */
  1103.     "ATL2\015",                /* vol2_str */
  1104.     "ATL3\015",                /* vol3_str */
  1105.     "ATX3\015",                /* ignoredt */
  1106.     "",                    /* ini2 */
  1107.     115200L,                /* max_speed */
  1108.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  1109.     getok                /* ok_fn */
  1110. };
  1111.  
  1112. static
  1113. MDMINF DATAPORT =            /* AT&T Dataport  */
  1114.     {
  1115.     "AT&T / Paradyne DataPort V.32 or higher",
  1116.     "ATP\015",                /* pulse command */
  1117.     "ATT\015",                /* tone command */
  1118.     35,                    /* dial_time */
  1119.     ",",                /* pause_chars */
  1120.     2,                    /* pause_time */
  1121.     /*
  1122.        Note: S41=0 (use highest modulation) omitted, since it is not
  1123.        supported on the V.32 and lower models.  So let's not touch it.
  1124.     */
  1125. #ifdef OS2
  1126.     "ATQ0E1V1X6&S0&C1&D2&Q0Y0\\K5S78=0\015", /* wake_str */
  1127. #else
  1128. #ifdef VMS
  1129.     "ATQ0E1X6&S1&Q0Y0\\K5S78=0\015",    /* wake_str */
  1130. #else
  1131.     "ATQ0E1X6&Q0Y0\\K5S78=0\015",        /* wake_str */
  1132. #endif /* VMS */
  1133. #endif /* OS2 */
  1134.     0,                    /* wake_rate */
  1135.     "OK\015",                /* wake_prompt */
  1136.     "",                    /* dmode_str */
  1137.     "",                    /* dmode_prompt */
  1138.     "ATD%s\015",            /* dial_str */
  1139.     0,                    /* dial_rate */
  1140.     1100,                /* esc_time */
  1141.     43,                    /* esc_char */
  1142.     "ATQ0H0\015",            /* hup_str */
  1143.     "AT\\Q3\015",            /* hwfc_str */
  1144.     "AT\\Q1\\X0\015",            /* swfc_str */
  1145.     "AT\\Q0\015",            /* nofc_str */
  1146.     "AT\\N7\015",            /* ec_on_str */
  1147.     "AT\\N0\015",            /* ec_off_str */
  1148.     "AT%C1\015",            /* dc_on_str */
  1149.     "AT%C0\015",            /* dc_off_str */
  1150.     "ATS0=1\015",            /* aa_on_str */
  1151.     "ATS0=0\015",            /* aa_off_str */
  1152.     "",                    /* sb_on_str */
  1153.     "",                    /* sb_off_str */
  1154.     "ATM1\015",                /* sp_on_str */
  1155.     "ATM0\015",                /* sp_off_str */
  1156.     "ATL1\015",                /* vol1_str */
  1157.     "ATL2\015",                /* vol2_str */
  1158.     "ATL3\015",                /* vol3_str */
  1159.     "ATX3\015",                /* ignoredt */
  1160.     "",                    /* ini2 */
  1161.     57600L,                /* max_speed */
  1162.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  1163.     getok                /* ok_fn */
  1164. };
  1165.  
  1166. static
  1167. MDMINF UCOM_AT =            /* Microcom DeskPorte FAST ES 28.8 */
  1168.     {
  1169.     "Microcom DeskPorte FAST 28.8",
  1170.     "ATP\015",                /* pulse command */
  1171.     "ATT\015",                /* tone command */
  1172.     35,                    /* dial_time */
  1173.     ",",                /* pause_chars */
  1174.     2,                    /* pause_time */
  1175. #ifdef OS2
  1176.     "ATE1Q0V1X4\\N0F0&S0&C1&D2\\K5\015", /* wake_str */
  1177. #else
  1178. #ifdef VMS
  1179.     "ATQ0X4F0&S1\\K5\015",        /* wake_str */
  1180. #else
  1181.     "ATQ0X4F0\\K5\015",            /* wake_str */
  1182. #endif /* VMS */
  1183. #endif /* OS2 */
  1184.     0,                    /* wake_rate */
  1185.     "OK\015",                /* wake_prompt */
  1186.     "",                    /* dmode_str */
  1187.     "",                    /* dmode_prompt */
  1188.     "ATD%s\015",            /* dial_str */
  1189.     0,                    /* dial_rate */
  1190.     1100,                /* esc_time */
  1191.     43,                    /* esc_char */
  1192.     "ATQ0H0\015",            /* hup_str */
  1193.     "AT\\Q3\015",            /* hwfc_str */
  1194.     "AT\\Q1\015",            /* swfc_str */
  1195.     "AT\\H0\\Q0\015",            /* nofc_str */
  1196.     "AT\\N3\015",            /* ec_on_str */
  1197.     "AT\\N0\015",            /* ec_off_str */
  1198.     "AT%C3\015",            /* dc_on_str */
  1199.     "AT%C0\015",            /* dc_off_str */
  1200.     "ATS0=1\015",            /* aa_on_str */
  1201.     "ATS0=0\015",            /* aa_off_str */
  1202.     "AT-J0\015",            /* sb_on_str */
  1203.     "AT-J1\015",            /* sb_off_str */
  1204.     "ATM1\015",                /* sp_on_str */
  1205.     "ATM0\015",                /* sp_off_str */
  1206.     "ATL1\015",                /* vol1_str */
  1207.     "ATL2\015",                /* vol2_str */
  1208.     "ATL3\015",                /* vol3_str */
  1209.     "ATX3\015",                /* ignoredt */
  1210.     "",                    /* ini2 */
  1211.     115200L,                /* max_speed */
  1212.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  1213.     getok                /* ok_fn */
  1214. };
  1215.  
  1216. static
  1217. MDMINF ZOOM =                /* Zoom Telephonics V.32bis  */
  1218.     {
  1219.     "Zoom Telephonics V.32bis",
  1220.     "ATP\015",                /* pulse command */
  1221.     "ATT\015",                /* tone command */
  1222.     35,                    /* dial_time */
  1223.     ",",                /* pause_chars */
  1224.     2,                    /* pause_time */
  1225. #ifdef OS2
  1226.     "ATE1Q0V1N1W1X4&S0&C1&D2S82=128S95=47\015", /* wake_str */
  1227. #else
  1228. #ifdef VMS
  1229.     "ATQ0E1N1W1X4&S1S82=128S95=47\015",    /* wake_str */
  1230. #else
  1231.     "ATQ0E1N1W1X4S82=128S95=47\015",    /* wake_str */
  1232. #endif /* VMS */
  1233. #endif /* OS2 */
  1234.     0,                    /* wake_rate */
  1235.     "OK\015",                /* wake_prompt */
  1236.     "",                    /* dmode_str */
  1237.     "",                    /* dmode_prompt */
  1238.     "ATD%s\015",            /* dial_str */
  1239.     0,                    /* dial_rate */
  1240.     1100,                /* esc_time */
  1241.     43,                    /* esc_char */
  1242.     "ATQ0H0\015",            /* hup_str */
  1243.     "AT&K3\015",            /* hwfc_str */
  1244.     "AT&K4\015",            /* swfc_str */
  1245.     "AT&K0\015",            /* nofc_str */
  1246.     "AT&Q5S36=7S48=7\015",        /* ec_on_str */
  1247.     "AT&Q0\015",            /* ec_off_str */
  1248.     "ATS46=138\015",            /* dc_on_str */
  1249.     "ATS46=136\015",            /* dc_off_str */
  1250.     "ATS0=1\015",            /* aa_on_str */
  1251.     "ATS0=0\015",            /* aa_off_str */
  1252.     "",                    /* sb_on_str */
  1253.     "",                    /* sb_off_str */
  1254.     "ATM1\015",                /* sp_on_str */
  1255.     "ATM0\015",                /* sp_off_str */
  1256.     "ATL1\015",                /* vol1_str */
  1257.     "ATL2\015",                /* vol2_str */
  1258.     "ATL3\015",                /* vol3_str */
  1259.     "ATX3\015",                /* ignoredt */
  1260.     "",                    /* ini2 */
  1261.     57600L,                /* max_speed */
  1262.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  1263.     getok                /* ok_fn */
  1264. };
  1265.  
  1266. static
  1267. MDMINF ZYXEL =                /* ZyXEL U-Series */
  1268.     {
  1269.     "ZyXEL U-Series V.32bis or higher",
  1270.     "ATP\015",                /* pulse command */
  1271.     "ATT\015",                /* tone command */
  1272.     35,                    /* dial_time */
  1273.     ",",                /* pause_chars */
  1274.     2,                    /* pause_time */
  1275. #ifdef OS2
  1276.     "ATE1Q0V1&S0&C1&D2&N0X5&Y1\015",    /* wake_str */
  1277. #else
  1278. #ifdef VMS
  1279.     "ATQ0E1&S1&N0X5&Y1\015",        /* wake_str */
  1280. #else
  1281.     "ATQ0E1&N0X5&Y1\015",        /* wake_str */
  1282. #endif /* VMS */
  1283. #endif /* OS2 */
  1284.     0,                    /* wake_rate */
  1285.     "OK\015",                /* wake_prompt */
  1286.     "",                    /* dmode_str */
  1287.     "",                    /* dmode_prompt */
  1288.     "ATD%s\015",            /* dial_str */
  1289.     0,                    /* dial_rate */
  1290.     1100,                /* esc_time */
  1291.     43,                    /* esc_char */
  1292.     "ATQ0H0\015",            /* hup_str */
  1293.     "AT&H3\015",            /* hwfc_str */
  1294.     "AT&H4\015",            /* swfc_str */
  1295.     "AT&H0\015",            /* nofc_str */
  1296.     "AT&K3\015",            /* ec_on_str */
  1297.     "AT&K0\015",            /* ec_off_str */
  1298.     "AT&K4\015",            /* dc_on_str */
  1299.     "AT&K3\015",            /* dc_off_str */
  1300.     "ATS0=1\015",            /* aa_on_str */
  1301.     "ATS0=0\015",            /* aa_off_str */
  1302.     "",                    /* sb_on_str */
  1303.     "",                    /* sb_off_str */
  1304.     "ATM1\015",                /* sp_on_str */
  1305.     "ATM0\015",                /* sp_off_str */
  1306.     "ATL1\015",                /* vol1_str */
  1307.     "ATL2\015",                /* vol2_str */
  1308.     "ATL3\015",                /* vol3_str */
  1309.     "ATX3\015",                /* ignoredt */
  1310.     "",                    /* ini2 */
  1311.     57600L,                /* max_speed */
  1312.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  1313.     getok                /* ok_fn */
  1314. };
  1315.  
  1316. static
  1317. MDMINF ZOLTRIX =            /* Zoltrix */
  1318.     {
  1319.     "Zoltrix V.32bis and V.34 modems with Rockwell ACI chipset",
  1320.     "ATP\015",                /* pulse command */
  1321.     "ATT\015",                /* tone command */
  1322.     35,                    /* dial_time */
  1323.     ",",                /* pause_chars */
  1324.     2,                    /* pause_time */
  1325. #ifdef OS2
  1326.    "ATE1Q0V1F0W1X4Y0&S0&C1&D2\\K5S82=128S95=41\015", /* wake_str */
  1327. #else
  1328. #ifdef VMS
  1329.    "ATQ0E1F0W1X4Y0&S1\\K5S82=128S95=41\015", /* wake_str */
  1330. #else
  1331.    "ATQ0E1F0W1X4Y0\\K5S82=128S95=41\015", /* wake_str */
  1332. #endif /* VMS */
  1333. #endif /* OS2 */
  1334.     0,                    /* wake_rate */
  1335.     "OK\015",                /* wake_prompt */
  1336.     "",                    /* dmode_str */
  1337.     "",                    /* dmode_prompt */
  1338.     "ATD%s\015",            /* dial_str */
  1339.     0,                    /* dial_rate */
  1340.     1100,                /* esc_time */
  1341.     43,                    /* esc_char */
  1342.     "ATQ0H0\015",            /* hup_str */
  1343.     "AT&K3\015",            /* hwfc_str */
  1344.     "AT&K4S32=17S33=19\015",        /* swfc_str */
  1345.     "AT&K0\015",            /* nofc_str */
  1346.     "AT\\N3\015",            /* ec_on_str */
  1347.     "AT\\N1\015",            /* ec_off_str */
  1348.     "ATS46=138%C3\015",            /* dc_on_str */
  1349.     "ATS46=136%C0\015",            /* dc_off_str */
  1350.     "ATS0=1\015",            /* aa_on_str */
  1351.     "ATS0=0\015",            /* aa_off_str */
  1352.     "AT\\N0\015",            /* sb_on_str */
  1353.     "AT&Q0\015",            /* sb_off_str */
  1354.     "ATM1\015",                /* sp_on_str */
  1355.     "ATM0\015",                /* sp_off_str */
  1356.     "ATL1\015",                /* vol1_str */
  1357.     "ATL2\015",                /* vol2_str */
  1358.     "ATL3\015",                /* vol3_str */
  1359.     "ATX3\015",                /* ignoredt */
  1360.     "",                    /* ini2 */
  1361.     57600L,                /* max_speed */
  1362.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  1363.     getok                /* ok_fn */
  1364. };
  1365.  
  1366. static
  1367. MDMINF MOTOROLA = {            /* Motorola FasTalk II or Lifestyle */
  1368. /*
  1369.   "\E" and "\X" commands removed - Motorola Lifestyle doesn't have them.
  1370.      \E0 = Don't echo while online
  1371.      \X0 = Process Xon/Xoff but don't pass through
  1372. */
  1373.     "Motorola FasTalk II or Lifestyle",    /* Name */
  1374.     "ATP\015",                /* pulse command */
  1375.     "ATT\015",                /* tone command */
  1376.     35,                    /* dial_time */
  1377.     ",",                /* pause_chars */
  1378.     2,                    /* pause_time */
  1379. #ifdef OS2
  1380.     "ATE1Q0V1X4&S0&C1&D2\\K5\\V1\015",    /* wake_str */
  1381. #else
  1382. #ifdef VMS
  1383.     "ATQ0E1X4&S1\\K5\\V1\015",        /* wake_str */
  1384. #else
  1385.     "ATQ0E1X4\\K5\\V1\015",        /* wake_str */
  1386. #endif /* VMS */
  1387. #endif /* OS2 */
  1388.     0,                    /* wake_rate */
  1389.     "OK\015",                /* wake_prompt */
  1390.     "",                    /* dmode_str */
  1391.     "",                    /* dmode_prompt */
  1392.     "ATD%s\015",            /* dial_str */
  1393.     0,                    /* dial_rate */
  1394.     1100,                /* esc_time */
  1395.     43,                    /* esc_char */
  1396.     "ATQ0H0\015",            /* hup_str */
  1397.     "AT\\Q3\015",            /* hwfc_str */
  1398.     "AT\\Q1\015",            /* swfc_str */
  1399.     "AT\\Q0\015",            /* nofc_str */
  1400.     "AT\\N6\015",            /* ec_on_str */
  1401.     "AT\\N1\015",            /* ec_off_str */
  1402.     "AT%C1\015",            /* dc_on_str */
  1403.     "AT%C0\015",            /* dc_off_str */
  1404.     "ATS0=1\015",            /* aa_on_str */
  1405.     "ATS0=0\015",            /* aa_off_str */
  1406.     "AT\\J0\015",            /* sb_on_str */
  1407.     "AT\\J1\015",            /* sb_off_str */
  1408.     "ATM1\015",                /* sp_on_str */
  1409.     "ATM0\015",                /* sp_off_str */
  1410.     "ATL1\015",                /* vol1_str */
  1411.     "ATL2\015",                /* vol2_str */
  1412.     "ATL3\015",                /* vol3_str */
  1413.     "ATX3\015",                /* ignoredt */
  1414.     "",                    /* ini2 */
  1415.     57600L,                /* max_speed */
  1416.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  1417.     getok                /* ok_fn */
  1418. };
  1419.  
  1420. static
  1421. MDMINF BOCA =                /* Boca */
  1422.     {
  1423.     "BOCA 14.4 Faxmodem",
  1424.     "ATP\015",                /* pulse command */
  1425.     "ATT\015",                /* tone command */
  1426.     35,                    /* dial_time */
  1427.     ",",                /* pause_chars */
  1428.     2,                    /* pause_time */
  1429. #ifdef OS2
  1430.     "ATE1Q0V1F1N1W1&S0&C1&D2\\K5S37=11S82=128S95=47X4\015", /* wake_str */
  1431. #else
  1432. #ifdef VMS
  1433.     "ATQ0E1F1N1W1&S1\\K5S37=11S82=128S95=47X4\015", /* wake_str */
  1434. #else
  1435.     "ATQ0E1F1N1W1\\K5S37=11S82=128S95=47X4\015", /* wake_str */
  1436. #endif /* VMS */
  1437. #endif /* OS2 */
  1438.     0,                    /* wake_rate */
  1439.     "OK\015",                /* wake_prompt */
  1440.     "",                    /* dmode_str */
  1441.     "",                    /* dmode_prompt */
  1442.     "ATD%s\015",            /* dial_str */
  1443.     0,                    /* dial_rate */
  1444.     1100,                /* esc_time */
  1445.     43,                    /* esc_char */
  1446.     "ATQ0H0\015",            /* hup_str */
  1447.     "AT&K3\015",            /* hwfc_str */
  1448.     "AT&K4\015",            /* swfc_str */
  1449.     "AT&K0\015",            /* nofc_str */
  1450.     "AT\\N3S36=7S48=7\015",        /* ec_on_str */
  1451.     "AT\\N1\015",            /* ec_off_str */
  1452.     "ATS46=138\015",            /* dc_on_str */
  1453.     "ATS46=136\015",            /* dc_off_str */
  1454.     "ATS0=1\015",            /* aa_on_str */
  1455.     "ATS0=0\015",            /* aa_off_str */
  1456.     "",                    /* sb_on_str */
  1457.     "",                    /* sb_off_str */
  1458.     "ATM1\015",                /* sp_on_str */
  1459.     "ATM0\015",                /* sp_off_str */
  1460.     "ATL1\015",                /* vol1_str */
  1461.     "ATL2\015",                /* vol2_str */
  1462.     "ATL3\015",                /* vol3_str */
  1463.     "ATX3\015",                /* ignoredt */
  1464.     "",                    /* ini2 */
  1465.     57600L,                /* max_speed */
  1466.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  1467.     getok                /* ok_fn */
  1468. };
  1469.  
  1470. static
  1471. MDMINF INTEL =                /* Intel */
  1472.     {
  1473.     "Intel High-Speed Faxmodem",
  1474.     "ATP\015",                /* pulse command */
  1475.     "ATT\015",                /* tone command */
  1476.     35,                    /* dial_time */
  1477.     ",",                /* pause_chars */
  1478.     2,                    /* pause_time */
  1479. #ifdef OS2
  1480.     "ATE1Q0V1Y0X4&S0&C1&D2\\K1\\V2S25=50\015", /* wake_str */
  1481. #else
  1482. #ifdef VMS
  1483.     "ATQ0E1Y0X4&S1\\K1\\V2S25=50\015",    /* wake_str */
  1484. #else
  1485.     "ATQ0E1Y0X4\\K1\\V2S25=50\015",    /* wake_str */
  1486. #endif /* VMS */
  1487. #endif /* OS2 */
  1488.     0,                    /* wake_rate */
  1489.     "OK\015",                /* wake_prompt */
  1490.     "ATB1+FCLASS=0\015",        /* dmode_str */
  1491.     "OK\015",                /* dmode_prompt */
  1492.     "ATD%s\015",            /* dial_str */
  1493.     0,                    /* dial_rate */
  1494.     1100,                /* esc_time */
  1495.     43,                    /* esc_char */
  1496.     "ATQ0H0\015",            /* hup_str */
  1497.     "AT\\G1\\Q3\015",            /* hwfc_str */
  1498.     "AT\\G1\\Q1\\X0\015",        /* swfc_str */
  1499.     "AT\\G0\015",            /* nofc_str */
  1500.     "AT\\J0\\N3\"H3\015",        /* ec_on_str */
  1501.     "AT\\N1\015",            /* ec_off_str */
  1502.     "AT%C1\015",            /* dc_on_str */
  1503.     "AT%C0\015",            /* dc_off_str */
  1504.     "ATS0=1\015",            /* aa_on_str */
  1505.     "ATS0=0\015",            /* aa_off_str */
  1506.     "",                    /* sb_on_str */
  1507.     "",                    /* sb_off_str */
  1508.     "ATM1\015",                /* sp_on_str */
  1509.     "ATM0\015",                /* sp_off_str */
  1510.     "ATL1\015",                /* vol1_str */
  1511.     "ATL2\015",                /* vol2_str */
  1512.     "ATL3\015",                /* vol3_str */
  1513.     "ATX3\015",                /* ignoredt */
  1514.     "",                    /* ini2 */
  1515.     57600L,                /* max_speed */
  1516.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  1517.     getok                /* ok_fn */
  1518. };
  1519.  
  1520. static
  1521. MDMINF MULTITECH =            /* Multitech */
  1522.     {
  1523.     "Multitech MT1432 or MT2834 Series",
  1524.     "ATP\015",                /* pulse command */
  1525.     "ATT\015",                /* tone command */
  1526.     35,                    /* dial_time */
  1527.     ",",                /* pause_chars */
  1528.     2,                    /* pause_time */
  1529. /* #P0 (= no parity) is not listed in the manual for newer models */
  1530. /* so it has been removed from all three copies of the Multitech wake_str */
  1531. #ifdef OS2
  1532.     "ATE1Q0V1X4&S0&C1&D2&E8&Q0\015",    /* wake_str */
  1533. #else
  1534. #ifdef VMS
  1535.     "ATQ0E1X4&S1&E8&Q0\015",        /* wake_str */
  1536. #else
  1537.     "ATQ0E1X4&E8&Q0\015",        /* wake_str */
  1538. #endif /* VMS */
  1539. #endif /* OS2 */
  1540.     0,                    /* wake_rate */
  1541.     "OK\015",                /* wake_prompt */
  1542.     "",                    /* dmode_str */
  1543.     "",                    /* dmode_prompt */
  1544.     "ATD%s\015",            /* dial_str */
  1545.     0,                    /* dial_rate */
  1546.     1100,                /* esc_time */
  1547.     43,                    /* esc_char */
  1548.     "ATQ0H0\015",            /* hup_str */
  1549.     "AT&E4&E7&E8&E11&E13\015",        /* hwfc_str */
  1550.     "AT&E5&E6&E8&E11&E13\015",        /* swfc_str */
  1551.     "AT&E3&E7&E8&E10&E12\015",        /* nofc_str */
  1552.     "AT&E1\015",            /* ec_on_str */
  1553.     "AT&E0\015",            /* ec_off_str */
  1554.     "AT&E15\015",            /* dc_on_str */
  1555.     "AT&E14\015",            /* dc_off_str */
  1556.     "ATS0=1\015",            /* aa_on_str */
  1557.     "ATS0=0\015",            /* aa_off_str */
  1558.     "AT$BA0\015",            /* sb_on_str (= "baud adjust off") */
  1559.     "AT$BA1\015",            /* sb_off_str */
  1560.     "ATM1\015",                /* sp_on_str */
  1561.     "ATM0\015",                /* sp_off_str */
  1562.     "ATL1\015",                /* vol1_str */
  1563.     "ATL2\015",                /* vol2_str */
  1564.     "ATL3\015",                /* vol3_str */
  1565.     "ATX3\015",                /* ignoredt */
  1566.     "",                    /* ini2 */
  1567.     57600L,                /* max_speed */
  1568.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  1569.     getok                /* ok_fn */
  1570. };
  1571.  
  1572. static
  1573. MDMINF SUPRA =                /* Supra */
  1574.     {
  1575.     "SupraFAXModem 144 or 288",
  1576.     "ATP\015",                /* pulse command */
  1577.     "ATT\015",                /* tone command */
  1578.     35,                    /* dial_time */
  1579.     ",",                /* pause_chars */
  1580.     2,                    /* pause_time */
  1581. #ifdef OS2
  1582.     "ATQ0E1V1N1W0X4Y0&S0&C1&D2\\K5S82=128\015", /* wake_str */
  1583. #else
  1584. #ifdef VMS
  1585.     "ATQ0E1N1W0X4Y0&S1\\K5S82=128\015",    /* wake_str */
  1586. #else
  1587.     "ATQ0E1N1W0X4Y0\\K5S82=128\015",    /* wake_str */
  1588. #endif /* VMS */
  1589. #endif /* OS2 */
  1590.     0,                    /* wake_rate */
  1591.     "OK\015",                /* wake_prompt */
  1592.     "",                    /* dmode_str */
  1593.     "",                    /* dmode_prompt */
  1594.     "ATD%s\015",            /* dial_str */
  1595.     0,                    /* dial_rate */
  1596.     1100,                /* esc_time */
  1597.     43,                    /* esc_char */
  1598.     "ATQ0H0\015",            /* hup_str */
  1599.     "AT&K3\015",            /* hwfc_str */
  1600.     "AT&K4\015",            /* swfc_str */
  1601.     "AT&K0\015",            /* nofc_str */
  1602.     "AT&Q5\\N3S48=7\015",        /* ec_on_str */
  1603.     "AT&Q0\\N1\015",            /* ec_off_str */
  1604.     "AT%C1S46=138\015",            /* dc_on_str */
  1605.     "AT%C0S46=136\015",            /* dc_off_str */
  1606.     "ATS0=1\015",            /* aa_on_str */
  1607.     "ATS0=0\015",            /* aa_off_str */
  1608.     "",                    /* sb_on_str */
  1609.     "",                    /* sb_off_str */
  1610.     "ATM1\015",                /* sp_on_str */
  1611.     "ATM\015",                /* sp_off_str */
  1612.     "ATL\015",                /* vol1_str */
  1613.     "ATL2\015",                /* vol2_str */
  1614.     "ATL3\015",                /* vol3_str */
  1615.     "ATX3\015",                /* ignoredt */
  1616.     "",                    /* ini2 */
  1617.     57600L,                /* max_speed */
  1618.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  1619.     getok                /* ok_fn */
  1620. };
  1621.  
  1622. static
  1623. MDMINF SUPRAX =                /* Supra Express */
  1624.     {
  1625.     "Diamond Supra Express V.90",
  1626.     "ATP\015",                /* pulse command */
  1627.     "ATT\015",                /* tone command */
  1628.     35,                    /* dial_time */
  1629.     ",",                /* pause_chars */
  1630.     2,                    /* pause_time */
  1631. #ifdef OS2
  1632.     "ATQ0E1V1W0X4&C1&D2&S0\\K5\015",    /* wake_str */
  1633. #else
  1634. #ifdef VMS
  1635.     "ATQ0E1W0X4&S1\\K5\015",        /* wake_str */
  1636. #else
  1637.     "ATQ0E1W0X4\\K5\015",        /* wake_str */
  1638. #endif /* VMS */
  1639. #endif /* OS2 */
  1640.     0,                    /* wake_rate */
  1641.     "OK\015",                /* wake_prompt */
  1642.     "",                    /* dmode_str */
  1643.     "",                    /* dmode_prompt */
  1644.     "ATD%s\015",            /* dial_str */
  1645.     0,                    /* dial_rate */
  1646.     1100,                /* esc_time */
  1647.     43,                    /* esc_char */
  1648.     "ATQ0H0\015",            /* hup_str */
  1649.     "AT&K3\015",            /* hwfc_str */
  1650.     "AT&K4\015",            /* swfc_str */
  1651.     "AT&K0\015",            /* nofc_str */
  1652.     "AT\\N3\015",            /* ec_on_str */
  1653.     "AT\\N1\015",            /* ec_off_str */
  1654.     "AT%C2\015",            /* dc_on_str */
  1655.     "AT%C0\015",            /* dc_off_str */
  1656.     "ATS0=1\015",            /* aa_on_str */
  1657.     "ATS0=0\015",            /* aa_off_str */
  1658.     "",                    /* sb_on_str */
  1659.     "",                    /* sb_off_str */
  1660.     "ATM1\015",                /* sp_on_str */
  1661.     "ATM\015",                /* sp_off_str */
  1662.     "ATL\015",                /* vol1_str */
  1663.     "ATL2\015",                /* vol2_str */
  1664.     "ATL3\015",                /* vol3_str */
  1665.     "ATX3\015",                /* ignoredt */
  1666.     "",                    /* ini2 */
  1667.     230400L,                /* max_speed */
  1668.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  1669.     getok                /* ok_fn */
  1670. };
  1671.  
  1672. static
  1673. MDMINF MAXTECH =            /* MaxTech */
  1674.     {
  1675.     "MaxTech XM288EA or GVC FAXModem",
  1676.     "ATP\015",                /* pulse command */
  1677.     "ATT\015",                /* tone command */
  1678.     35,                    /* dial_time */
  1679.     ",",                /* pause_chars */
  1680.     2,                    /* pause_time */
  1681. #ifdef OS2
  1682.     "ATQ0E1V1X4Y0&S0&C1&D2&L0&M0\\K5\015", /* wake_str */
  1683. #else
  1684. #ifdef VMS
  1685.     "ATQ0E1X4Y0&L0&M0&S1\\K5\015",    /* wake_str */
  1686. #else
  1687.     "ATQ0E1X4Y0&L0&M0\\K5\015",        /* wake_str */
  1688. #endif /* VMS */
  1689. #endif /* OS2 */
  1690.     0,                    /* wake_rate */
  1691.     "OK\015",                /* wake_prompt */
  1692.     "",                    /* dmode_str */
  1693.     "",                    /* dmode_prompt */
  1694.     "ATD%s\015",            /* dial_str */
  1695.     0,                    /* dial_rate */
  1696.     1100,                /* esc_time */
  1697.     43,                    /* esc_char */
  1698.     "ATQ0H0\015",            /* hup_str */
  1699.     "AT\\Q3\015",            /* hwfc_str */
  1700.     "AT\\Q1\\X0\015",            /* swfc_str */
  1701.     "AT\\Q0\015",            /* nofc_str */
  1702.     "AT\\N6\015",            /* ec_on_str */
  1703.     "AT\\N0\015",            /* ec_off_str */
  1704.     "AT\\N6%C1\015",            /* dc_on_str */
  1705.     "AT\\N6%C0\015",            /* dc_off_str */
  1706.     "ATS0=1\015",            /* aa_on_str */
  1707.     "ATS0=0\015",            /* aa_off_str */
  1708.     "",                    /* sb_on_str */
  1709.     "",                    /* sb_off_str */
  1710.     "ATM1\015",                /* sp_on_str */
  1711.     "ATM0\015",                /* sp_off_str */
  1712.     "ATL1\015",                /* vol1_str */
  1713.     "ATL2\015",                /* vol2_str */
  1714.     "ATL3\015",                /* vol3_str */
  1715.     "ATX3\015",                /* ignoredt */
  1716.     "",                    /* ini2 */
  1717.     115200L,                /* max_speed */
  1718.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  1719.     getok                /* ok_fn */
  1720. };
  1721.  
  1722. static
  1723. MDMINF ROLM =        /* IBM / Siemens / Rolm 8000, 9000, 9751 CBX DCM */
  1724.     {
  1725.     "IBM/Siemens/Rolm CBX Data Communications Module",
  1726.     "",                    /* pulse command */
  1727.     "",                    /* tone command */
  1728.     60,                    /* dial_time */
  1729.     "",                    /* pause_chars */
  1730.     0,                    /* pause_time */
  1731.     "\015\015",                /* wake_str */
  1732.     50,                    /* wake_rate */
  1733.     "MODIFY?",                /* wake_prompt */
  1734.     "",                    /* dmode_str */
  1735.     "",                    /* dmode_prompt */
  1736.     "CALL %s\015",            /* dial_str */
  1737.     0,                    /* dial_rate */
  1738.     0,                    /* esc_time */
  1739.     0,                    /* esc_char */
  1740.     "",                    /* hup_str */
  1741.     "",                    /* hwfc_str */
  1742.     "",                    /* swfc_str */
  1743.     "",                    /* nofc_str */
  1744.     "",                    /* ec_on_str */
  1745.     "",                    /* ec_off_str */
  1746.     "",                    /* dc_on_str */
  1747.     "",                    /* dc_off_str */
  1748.     "",                    /* aa_on_str */
  1749.     "",                    /* aa_off_str */
  1750.     "",                    /* sb_on_str */
  1751.     "",                    /* sb_off_str */
  1752.     "",                    /* sp_off_str */
  1753.     "",                    /* sp_on_str */
  1754.     "",                    /* vol1_str */
  1755.     "",                    /* vol2_str */
  1756.     "",                    /* vol3_str */
  1757.     "",                    /* ignoredt */
  1758.     "",                    /* ini2 */
  1759.     19200L,                /* max_speed */
  1760.     0,                    /* capas */
  1761.     NULL                /* ok_fn */
  1762. };
  1763.  
  1764. static
  1765. MDMINF USR =                /* USR Courier and Sportster modems */
  1766.     {
  1767.     "US Robotics Courier, Sportster, or compatible",
  1768.     "ATP\015",                /* pulse command */
  1769.     "ATT\015",                /* tone command */
  1770.     35,                    /* dial_time */
  1771.     ",",                /* pause_chars */
  1772.     2,                    /* pause_time */
  1773. #ifdef OS2
  1774.     "ATQ0E1V1X4&A3&S0&C1&D2&N0&Y3S14=0\015", /* wake_str */
  1775. #else
  1776. #ifdef SUNOS4
  1777.     "ATQ0X4&A3&S0&N0&Y3S14=0\015",    /* wake_str -- needs &S0 in SunOS */
  1778. #else
  1779. #ifdef VMS
  1780.     "ATQ0X4&A3&S1&N0&Y3S14=0\015",    /* wake_str -- needs &S1 in VMS */
  1781. #else
  1782.     "ATQ0X4&A3&N0&Y3S14=0\015",        /* wake_str */
  1783. #endif /* VMS */
  1784. #endif /* SUNOS4 */
  1785. #endif /* OS2 */
  1786.     0,                    /* wake_rate */
  1787.     "OK\015",                /* wake_prompt */
  1788.     "",                    /* dmode_str */
  1789.     "",                    /* dmode_prompt */
  1790.     "ATD%s\015",            /* dial_str */
  1791.     0,                    /* dial_rate */
  1792.     1100,                /* esc_time */
  1793.     43,                    /* esc_char */
  1794.     "ATQ0H0\015",            /* hup_str */
  1795.     "AT&H1&R2&I0\015",            /* hwfc_str */
  1796.     "AT&H2&R1&I2\015",            /* swfc_str */
  1797.     "AT&H0&R1&I0\015",            /* nofc_str */
  1798.     "AT&M4&B1\015",            /* ec_on_str */
  1799.     "AT&M0\015",            /* ec_off_str */
  1800.     "AT&K1\015",            /* dc_on_str */
  1801.     "AT&K0\015",            /* dc_off_str */
  1802.     "ATS0=1\015",            /* aa_on_str */
  1803.     "ATS0=0\015",            /* aa_off_str */
  1804.     "",                    /* sb_on_str */
  1805.     "",                    /* sb_off_str */
  1806.     "ATM1\015",                /* sp_on_str */
  1807.     "ATM0\015",                /* sp_off_str */
  1808.     "ATL1\015",                /* vol1_str */
  1809.     "ATL2\015",                /* vol2_str */
  1810.     "ATL3\015",                /* vol3_str */
  1811.     "ATX3\015",                /* ignoredt */
  1812.     "",                    /* ini2 */
  1813.     115200L,                /* max_speed */
  1814.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  1815.     getok                /* ok_fn */
  1816. };
  1817.  
  1818.  
  1819. static
  1820. MDMINF USRX2 =                /* USR XJ-CC1560 X2 56K */
  1821.     {
  1822.     "US Robotics / Megahertz CC/XJ-CC1560 X2",
  1823.     "ATP\015",                /* pulse command */
  1824.     "ATT\015",                /* tone command */
  1825.     35,                    /* dial_time */
  1826.     ",",                /* pause_chars */
  1827.     2,                    /* pause_time */
  1828. #ifdef OS2
  1829.     "ATQ0E1V1X4&A3&S0&B2&C1&D2&N0\015",    /* wake_str */
  1830. #else
  1831. #ifdef VMS
  1832.     "ATQ0X4&A3&B2&N0&S1\015",        /* wake_str */
  1833. #else
  1834.     "ATQ0X4&A3&B2&N0\015",        /* wake_str */
  1835. #endif /* VMS */
  1836. #endif /* OS2 */
  1837.     0,                    /* wake_rate */
  1838.     "OK\015",                /* wake_prompt */
  1839.     "",                    /* dmode_str */
  1840.     "",                    /* dmode_prompt */
  1841.     "ATD%s\015",            /* dial_str */
  1842.     0,                    /* dial_rate */
  1843.     1100,                /* esc_time */
  1844.     43,                    /* esc_char */
  1845.     "ATQ0H0\015",            /* hup_str */
  1846.     "AT&H1&I0\015",            /* hwfc_str */
  1847.     "AT&H2&I2\015",            /* swfc_str */
  1848.     "AT&H0&I0\015",            /* nofc_str */
  1849.     "AT&M4\015",            /* ec_on_str */
  1850.     "AT&M0\015",            /* ec_off_str */
  1851.     "AT&K1\015",            /* dc_on_str */
  1852.     "AT&K0\015",            /* dc_off_str */
  1853.     "ATS0=1\015",            /* aa_on_str */
  1854.     "ATS0=0\015",            /* aa_off_str */
  1855.     "AT&B1\015",            /* sb_on_str */
  1856.     "AT&B0\015",            /* sb_off_str */
  1857.     "ATM1\015",                /* sp_on_str */
  1858.     "ATM0\015",                /* sp_off_str */
  1859.     "ATL1\015",                /* vol1_str */
  1860.     "ATL2\015",                /* vol2_str */
  1861.     "ATL3\015",                /* vol3_str */
  1862.     "ATX3\015",                /* ignoredt */
  1863.     "",                    /* ini2 */
  1864.     115200L,                /* max_speed */
  1865.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  1866.     getok                /* ok_fn */
  1867. };
  1868.  
  1869. static
  1870. MDMINF OLDTB =                /* Old Telebits */
  1871.     {
  1872.     "Telebit TrailBlazer, T1000, T1500, T2000, T2500",
  1873.     "ATP\015",                /* pulse command */
  1874.     "ATT\015",                /* tone command */
  1875.     60,                    /* dial_time */
  1876.     ",",                /* pause_chars */
  1877.     2,                    /* pause_time */
  1878. #ifdef OS2
  1879.     "\021AAAAATQ0E1V1X1&S0&C1&D2S12=50S50=0S54=3\015", /* wake_str. */
  1880. #else
  1881. #ifdef VMS
  1882.     "\021AAAAATQ0X1S12=50S50=0S54=3\015", /* wake_str. */
  1883. #else
  1884.     "\021AAAAATQ0X1&S1S12=50S50=0S54=3\015", /* wake_str. */
  1885. #endif /* VMS */
  1886. #endif /* OS2 */
  1887.     100,                /* wake_rate = 100 msec */
  1888.     "OK\015",                /* wake_prompt */
  1889.     "",                    /* dmode_str */
  1890.     "",                    /* dmode_prompt */
  1891.     "ATD%s\015",            /* dial_str, Note: no T or P */
  1892.     80,                    /* dial_rate */
  1893.     1100,                /* esc_time (guard time) */
  1894.     43,                    /* esc_char */
  1895.     "ATQ0H0\015",            /* hup_str */
  1896.     "ATS58=2S68=2\015",            /* hwfc_str */
  1897.     "ATS58=3S68=3S69=0\015",        /* swfc_str */
  1898.     "ATS58=0S68=0\015",            /* nofc_str */
  1899.     "ATS66=1S95=2\015",            /* ec_on_str */
  1900.     "ATS95=0\015",            /* ec_off_str */
  1901.     "ATS110=1S96=1\015",        /* dc_on_str */
  1902.     "ATS110=0S96=0\015",        /* dc_off_str */
  1903.     "ATS0=1\015",            /* aa_on_str */
  1904.     "ATS0=0\015",            /* aa_off_str */
  1905.     "",                    /* sb_on_str */
  1906.     "",                    /* sb_off_str */
  1907.     "ATM1\015",                /* sp_on_str */
  1908.     "ATM0\015",                /* sp_off_str */
  1909.     "ATL1\015",                /* vol1_str */
  1910.     "ATL2\015",                /* vol2_str */
  1911.     "ATL3\015",                /* vol3_str */
  1912.     "ATX3\015",                /* ignoredt */
  1913.     "",                    /* ini2 */
  1914.     19200L,                /* max_speed */
  1915.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW|CKD_TB|CKD_KS, /* capas */
  1916.     getok                /* ok_fn */
  1917. };
  1918.  
  1919. static
  1920. MDMINF NEWTB =                /* New Telebits */
  1921.     {
  1922.     "Telebit T1600, T3000, QBlazer, WorldBlazer, etc.",
  1923.     "ATP\015",                /* pulse command */
  1924.     "ATT\015",                /* tone command */
  1925.     60,                    /* dial_time */
  1926.     ",",                /* pause_chars */
  1927.     2,                    /* pause_time */
  1928. #ifdef OS2
  1929.     "\021AAAAATQ0E1V1X2&S0&C1&D2S12=50S50=0S61=0S63=0\015", /* wake_str. */
  1930. #else
  1931. #ifdef VMS
  1932.     "\021AAAAATQ0X2&S1S12=50S50=0S61=0S63=0\015", /* wake_str. */
  1933. #else
  1934.     "\021AAAAATQ0X2S12=50S50=0S61=0S63=0\015", /* wake_str. */
  1935. #endif /* VMS */
  1936. #endif /* OS2 */
  1937.     100,                /* wake_rate = 100 msec */
  1938.     "OK\015",                /* wake_prompt */
  1939.     "",                    /* dmode_str */
  1940.     "",                    /* dmode_prompt */
  1941.     "ATD%s\015",            /* dial_str, Note: no T or P */
  1942.     80,                    /* dial_rate */
  1943.     1100,                /* esc_time (guard time) */
  1944.     43,                    /* esc_char */
  1945.     "ATQ0H0\015",            /* hup_str */
  1946.     "ATS58=2S68=2\015",            /* hwfc_str */
  1947.     "ATS58=3S68=3\015",            /* swfc_str */
  1948.     "ATS58=0S68=0\015",            /* nofc_str */
  1949.     "ATS180=3\015",            /* ec_on_str */
  1950.     "ATS180=0\015",            /* ec_off_str */
  1951.     "ATS190=1\015",            /* dc_on_str */
  1952.     "ATS190=0\015",            /* dc_off_str */
  1953.     "ATS0=1\015",            /* aa_on_str */
  1954.     "ATS0=0\015",            /* aa_off_str */
  1955.     "",                    /* sb_on_str */
  1956.     "",                    /* sb_off_str */
  1957.     "ATM1\015",                /* sp_on_str */
  1958.     "ATM0\015",                /* sp_off_str */
  1959.     "ATL1\015",                /* vol1_str */
  1960.     "ATL2\015",                /* vol2_str */
  1961.     "ATL3\015",                /* vol3_str */
  1962.     "ATX3\015",                /* ignoredt */
  1963.     "",                    /* ini2 */
  1964.     38400L,                /* max_speed */
  1965.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW|CKD_TB|CKD_KS, /* capas */
  1966.     getok                /* ok_fn */
  1967. };
  1968. #endif /* MINIDIAL */
  1969.  
  1970. static
  1971. MDMINF DUMMY = /* dummy information for modems that are handled elsewhere */
  1972.     {
  1973.     "(dummy)",
  1974.     "",                    /* pulse command */
  1975.     "",                    /* tone command */
  1976.     30,                    /* dial_time */
  1977.     "",                    /* pause_chars */
  1978.     0,                    /* pause_time */
  1979.     "",                    /* wake_str */
  1980.     0,                    /* wake_rate */
  1981.     "",                    /* wake_prompt */
  1982.     "",                    /* dmode_str */
  1983.     NULL,                /* dmode_prompt */
  1984.     "%s\015",                /* dial_str */
  1985.     0,                    /* dial_rate */
  1986.     0,                    /* esc_time */
  1987.     0,                    /* esc_char */
  1988.     "",                    /* hup_str */
  1989.     "",                    /* hwfc_str */
  1990.     "",                    /* swfc_str */
  1991.     "",                    /* nofc_str */
  1992.     "",                    /* ec_on_str */
  1993.     "",                    /* ec_off_str */
  1994.     "",                    /* dc_on_str */
  1995.     "",                    /* dc_off_str */
  1996.     "",                    /* aa_on_str */
  1997.     "",                    /* aa_off_str */
  1998.     "",                    /* sb_on_str */
  1999.     "",                    /* sb_off_str */
  2000.     "",                    /* sp_off_str */
  2001.     "",                    /* sp_on_str */
  2002.     "",                    /* vol1_str */
  2003.     "",                    /* vol2_str */
  2004.     "",                    /* vol3_str */
  2005.     "",                    /* ignoredt */
  2006.     "",                    /* ini2 */
  2007.     0L,                    /* max_speed */
  2008.     0,                    /* capas */
  2009.     NULL                /* ok_fn */
  2010. };
  2011.  
  2012. #ifndef MINIDIAL
  2013. static
  2014. MDMINF RWV32 =                /* Generic Rockwell V.32 */
  2015.     {
  2016.     "Generic Rockwell V.32 modem",    /* ATI3, ATI4, and ATI6 for details */
  2017.     "ATP\015",                /* pulse command */
  2018.     "ATT\015",                /* tone command */
  2019.     35,                    /* dial_time */
  2020.     ",",                /* pause_chars */
  2021.     2,                    /* pause_time */
  2022. #ifdef OS2
  2023.     "ATQ0E1V1X4Y0&S0&C1&D2%E2\\K5+FCLASS=0N1S37=0\015", /* wake_str */
  2024. #else
  2025. #ifdef VMS
  2026.     "ATQ0X4Y0&S1%E2\\K5+FCLASS=0N1S37=0\015", /* wake_str */
  2027. #else
  2028.     "ATQ0X4Y0%E2\\K5+FCLASS=0N1S37=0\015", /* wake_str */
  2029. #endif /* VMS */
  2030. #endif /* OS2 */
  2031.     0,                    /* wake_rate */
  2032.     "OK\015",                /* wake_prompt */
  2033.     "",                    /* dmode_str */
  2034.     "",                    /* dmode_prompt */
  2035.     "ATD%s\015",            /* dial_str */
  2036.     0,                    /* dial_rate */
  2037.     1100,                /* esc_time */
  2038.     43,                    /* esc_char */
  2039.     "ATQ0H0\015",            /* hup_str */
  2040.     "AT&K3\015",            /* hwfc_str */
  2041.     "AT&K4S32=17S33=19\015",        /* swfc_str */
  2042.     "AT&K0\015",            /* nofc_str */
  2043.     "AT&Q6\015",            /* ec_on_str */
  2044.     "AT&Q0\015",            /* ec_off_str */
  2045.     "AT%C1\015",            /* dc_on_str */
  2046.     "AT%C0\015",            /* dc_off_str */
  2047.     "ATS0=1\015",            /* aa_on_str */
  2048.     "ATS0=0\015",            /* aa_off_str */
  2049.     "",                    /* sb_on_str */
  2050.     "",                    /* sb_off_str */
  2051.     "ATM1\015",                /* sp_on_str */
  2052.     "ATM0\015",                /* sp_off_str */
  2053.     "ATL1\015",                /* vol1_str */
  2054.     "ATL2\015",                /* vol2_str */
  2055.     "ATL3\015",                /* vol3_str */
  2056.     "ATX3\015",                /* ignoredt */
  2057.     "",                    /* ini2 */
  2058.     57600L,                /* max_speed */
  2059.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  2060.     getok                /* ok_fn */
  2061. };
  2062.  
  2063. static
  2064. MDMINF RWV32B =                /* Generic Rockwell V.32bis */
  2065.     {
  2066.     "Generic Rockwell V.32bis modem",    /* ATI3, ATI4, and ATI6 for details */
  2067.     "ATP\015",                /* pulse command */
  2068.     "ATT\015",                /* tone command */
  2069.     35,                    /* dial_time */
  2070.     ",",                /* pause_chars */
  2071.     2,                    /* pause_time */
  2072. #ifdef OS2
  2073.     "ATQ0E1V1X4Y0&S0&C1&D2%E2\\K5+FCLASS=0N1S37=0\015", /* wake_str */
  2074. #else
  2075. #ifdef VMS
  2076.     "ATQ0X4Y0&S1%E2\\K5+FCLASS=0N1S37=0\015", /* wake_str */
  2077. #else
  2078.     "ATQ0X4Y0%E2\\K5+FCLASS=0N1S37=0\015", /* wake_str */
  2079. #endif /* VMS */
  2080. #endif /* OS2 */
  2081.     0,                    /* wake_rate */
  2082.     "OK\015",                /* wake_prompt */
  2083.     "",                    /* dmode_str */
  2084.     "",                    /* dmode_prompt */
  2085.     "ATD%s\015",            /* dial_str */
  2086.     0,                    /* dial_rate */
  2087.     1100,                /* esc_time */
  2088.     43,                    /* esc_char */
  2089.     "ATQ0H0\015",            /* hup_str */
  2090.     "AT&K3\015",            /* hwfc_str */
  2091.     "AT&K4S32=17S33=19\015",        /* swfc_str */
  2092.     "AT&K0\015",            /* nofc_str */
  2093.     "AT&Q5\015",            /* ec_on_str */
  2094.     "AT&Q0\015",            /* ec_off_str */
  2095.     "ATS%C1\015",            /* dc_on_str */
  2096.     "ATS%C0\015",            /* dc_off_str */
  2097.     "ATS0=1\015",            /* aa_on_str */
  2098.     "ATS0=0\015",            /* aa_off_str */
  2099.     "",                    /* sb_on_str */
  2100.     "",                    /* sb_off_str */
  2101.     "ATM1\015",                /* sp_on_str */
  2102.     "ATM0\015",                /* sp_off_str */
  2103.     "ATL1\015",                /* vol1_str */
  2104.     "ATL2\015",                /* vol2_str */
  2105.     "ATL3\015",                /* vol3_str */
  2106.     "ATX3\015",                /* ignoredt */
  2107.     "",                    /* ini2 */
  2108.     57600L,                /* max_speed */
  2109.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  2110.     getok                /* ok_fn */
  2111. };
  2112.  
  2113. static
  2114. MDMINF RWV34 =                /* Generic Rockwell V.34 Data/Fax */
  2115.     {
  2116.     "Generic Rockwell V.34 modem",    /* ATI3, ATI4, and ATI6 for details */
  2117.     "ATP\015",                /* pulse command */
  2118.     "ATT\015",                /* tone command */
  2119.     35,                    /* dial_time */
  2120.     ",",                /* pause_chars */
  2121.     2,                    /* pause_time */
  2122. #ifdef OS2
  2123.     "ATQ0V1X4Y0&C1&D2&S0%E2\\K5+FCLASS=0\015", /* wake_str */
  2124. #else
  2125. #ifdef VMS
  2126.     "ATQ0V1X4Y0&C1&D2&S1%E2\\K5+FCLASS=0\015", /* wake_str */
  2127. #else
  2128.     "ATQ0V1X4Y0&C1&D2%E2\\K5+FCLASS=0\015", /* wake_str */
  2129. #endif /* VMS */
  2130. #endif /* OS2 */
  2131.     0,                    /* wake_rate */
  2132.     "OK\015",                /* wake_prompt */
  2133.     "",                    /* dmode_str */
  2134.     "",                    /* dmode_prompt */
  2135.     "ATD%s\015",            /* dial_str */
  2136.     0,                    /* dial_rate */
  2137.     1100,                /* esc_time */
  2138.     43,                    /* esc_char */
  2139.     "ATQ0H0\015",            /* hup_str */
  2140.     "AT&K3\015",            /* hwfc_str */
  2141.     "AT&K4S32=17S33=19\015",        /* swfc_str */
  2142.     "AT&K0\015",            /* nofc_str */
  2143.     "AT&Q5\015",            /* ec_on_str */
  2144.     "AT&Q0\015",            /* ec_off_str */
  2145.     "ATS%C3\015",            /* dc_on_str */
  2146.     "ATS%C0\015",            /* dc_off_str */
  2147.     "ATS0=1\015",            /* aa_on_str */
  2148.     "ATS0=0\015",            /* aa_off_str */
  2149.     "",                    /* sb_on_str */
  2150.     "",                    /* sb_off_str */
  2151.     "ATM1\015",                /* sp_on_str */
  2152.     "ATM0\015",                /* sp_off_str */
  2153.     "ATL1\015",                /* vol1_str */
  2154.     "ATL2\015",                /* vol2_str */
  2155.     "ATL3\015",                /* vol3_str */
  2156.     "ATX3\015",                /* ignoredt */
  2157.     "",                    /* ini2 */
  2158.     115200L,                /* max_speed */
  2159.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  2160.     getok                /* ok_fn */
  2161. };
  2162.  
  2163. static
  2164. MDMINF RWV90 =                /* Generic Rockwell V.90 Data/Fax */
  2165.     {
  2166.     "Generic Rockwell V.90 56K modem",    /* ATI3, ATI4, and ATI6 for details */
  2167.     "ATP\015",                /* pulse command */
  2168.     "ATT\015",                /* tone command */
  2169.     35,                    /* dial_time */
  2170.     ",",                /* pause_chars */
  2171.     2,                    /* pause_time */
  2172. #ifdef OS2
  2173.     "ATQ0V1N1X4Y0&C1&D2&S0%E2\\K5+FCLASS=0S37=0\015", /* K95 */
  2174. #else
  2175. #ifdef VMS
  2176.     "ATQ0V1N1X4Y0&C1&D2&S1%E2\\K5+FCLASS=0S37=0\015", /* wake_str */
  2177. #else
  2178.     "ATQ0V1N1X4Y0&C1&D2%E2\\K5+FCLASS=0S37=0\015", /* wake_str */
  2179. #endif /* VMS */
  2180. #endif /* OS2 */
  2181.     0,                    /* wake_rate */
  2182.     "OK\015",                /* wake_prompt */
  2183.     "",                    /* dmode_str */
  2184.     "",                    /* dmode_prompt */
  2185.     "ATD%s\015",            /* dial_str */
  2186.     0,                    /* dial_rate */
  2187.     1100,                /* esc_time */
  2188.     43,                    /* esc_char */
  2189.     "ATQ0H0\015",            /* hup_str */
  2190.     "AT&K3\015",            /* hwfc_str */
  2191.     "AT&K4S32=17S33=19\015",        /* swfc_str */
  2192.     "AT&K0\015",            /* nofc_str */
  2193.     "AT&Q5\015",            /* ec_on_str */
  2194.     "AT&Q0\015",            /* ec_off_str */
  2195.     "AT%C3\015",            /* dc_on_str */
  2196.     "AT%C0\015",            /* dc_off_str */
  2197.     "ATS0=1\015",            /* aa_on_str */
  2198.     "ATS0=0\015",            /* aa_off_str */
  2199.     "",                    /* sb_on_str */
  2200.     "",                    /* sb_off_str */
  2201.     "ATM1\015",                /* sp_on_str */
  2202.     "ATM0\015",                /* sp_off_str */
  2203.     "ATL1\015",                /* vol1_str */
  2204.     "ATL2\015",                /* vol2_str */
  2205.     "ATL3\015",                /* vol3_str */
  2206.     "ATX3\015",                /* ignoredt */
  2207.     "",                    /* ini2 */
  2208.     115200L,                /* max_speed */
  2209.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  2210.     getok                /* ok_fn */
  2211. };
  2212.  
  2213. static
  2214. MDMINF MWAVE =                /* IBM Mwave */
  2215.     {
  2216.     "IBM Mwave Adapter",
  2217.     "ATP\015",                /* pulse command */
  2218.     "ATT\015",                /* tone command */
  2219.     35,                    /* dial_time */
  2220.     ",",                /* pause_chars */
  2221.     2,                    /* pause_time */
  2222. #ifdef OS2
  2223.     "ATQ0E1V1X4Y0&S0&C1&D2&M0&Q0&N1\\K3\\T0%E2S28=0\015", /* wake_str */
  2224. #else
  2225. #ifdef VMS
  2226.     "ATQ0X4Y0&M0&S1&Q0&N1&S0\\K3\\T0%E2S28=0\015", /* wake_str */
  2227. #else
  2228.     "ATQ0X4Y0&M0&Q0&N1&S0\\K3\\T0%E2S28=0\015", /* wake_str */
  2229. #endif /* VMS */
  2230. #endif /* OS2 */
  2231.     0,                    /* wake_rate */
  2232.     "OK\015",                /* wake_prompt */
  2233.     "",                    /* dmode_str */
  2234.     "",                    /* dmode_prompt */
  2235.     "ATD%s\015",            /* dial_str */
  2236.     0,                    /* dial_rate */
  2237.     1100,                /* esc_time */
  2238.     43,                    /* esc_char */
  2239.     "ATQ0H0\015",            /* hup_str */
  2240.     "AT\\Q3\015",            /* hwfc_str */
  2241.     "",                    /* swfc_str (it doesn't!) */
  2242.     "AT\\Q0\015",            /* nofc_str */
  2243.     "AT\\N7\015",            /* ec_on_str */
  2244.     "AT\\N0\015",            /* ec_off_str */
  2245.     "AT%C1\"H3\015",            /* dc_on_str */
  2246.     "AT%C0\"H0\015",            /* dc_off_str */
  2247.     "ATS0=1\015",            /* aa_on_str */
  2248.     "ATS0=0\015",            /* aa_off_str */
  2249.     "",                    /* sb_on_str */
  2250.     "",                    /* sb_off_str */
  2251.     "ATM1\015",                /* sp_on_str */
  2252.     "ATM0\015",                /* sp_off_str */
  2253.     "ATL1\015",                /* vol1_str */
  2254.     "ATL2\015",                /* vol2_str */
  2255.     "ATL3\015",                /* vol3_str */
  2256.     "ATX3\015",                /* ignoredt */
  2257.     "",                    /* ini2 */
  2258.     57600L,                /* max_speed */
  2259.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW, /* capas */
  2260.     getok                /* ok_fn */
  2261. };
  2262.  
  2263. static
  2264. MDMINF TELEPATH =            /* Gateway 2000 Telepath */
  2265.     {
  2266.     "Gateway 2000 Telepath II 28.8",
  2267.     "ATP\015",                /* pulse command */
  2268.     "ATT\015",                /* tone command */
  2269.     35,                    /* dial_time */
  2270.     ",",                /* pause_chars */
  2271.     2,                    /* pause_time */
  2272. #ifdef OS2
  2273.     "ATQ0E1V1X4&S0&C1&D2&N0&Y2#CLS=0S13=0S15=0S19=0\015", /* wake_str */
  2274. #else
  2275. #ifdef VMS
  2276.     "ATQ0X4&N0&S1&Y1#CLS=0S13=0S15=0S19=0\015", /* wake_str */
  2277. #else
  2278.     "ATQ0X4&N0&Y1#CLS=0S13=0S15=0S19=0\015", /* wake_str */
  2279. #endif /* VMS */
  2280. #endif /* OS2 */
  2281.     0,                    /* wake_rate */
  2282.     "OK\015",                /* wake_prompt */
  2283.     "",                    /* dmode_str */
  2284.     "",                    /* dmode_prompt */
  2285.     "ATD%s\015",            /* dial_str */
  2286.     0,                    /* dial_rate */
  2287.     1100,                /* esc_time */
  2288.     43,                    /* esc_char */
  2289.     "ATQ0H0\015",            /* hup_str */
  2290.     "AT&H1&R2\015",            /* hwfc_str */
  2291.     "AT&H2&I2S22=17S23=19\015",        /* swfc_str */
  2292.     "AT&H0&I0&R1\015",            /* nofc_str */
  2293.     "AT&M4&B1\015",            /* ec_on_str -- also fixes speed */
  2294.     "AT&M0\015",            /* ec_off_str */
  2295.     "AT&K1\015",            /* dc_on_str */
  2296.     "AT&K0\015",            /* dc_off_str */
  2297.     "ATS0=1\015",            /* aa_on_str */
  2298.     "ATS0=0\015",            /* aa_off_str */
  2299.     "",                    /* sb_on_str */
  2300.     "",                    /* sb_off_str */
  2301.     "ATM1\015",                /* sp_on_str */
  2302.     "ATM0\015",                /* sp_off_str */
  2303.     "ATL1\015",                /* vol1_str */
  2304.     "ATL2\015",                /* vol2_str */
  2305.     "ATL3\015",                /* vol3_str */
  2306.     "ATX3\015",                /* ignoredt */
  2307.     "",                    /* ini2 */
  2308.     57600L,                /* max_speed */
  2309.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  2310.     getok                /* ok_fn */
  2311. };
  2312.  
  2313. static
  2314. MDMINF CARDINAL =            /* Cardinal - based on Rockwell V.34 */
  2315.     {
  2316.     "Cardinal MVP288X Series",        /* ATI3, ATI4, and ATI6 for details */
  2317.     "ATP\015",                /* pulse command */
  2318.     "ATT\015",                /* tone command */
  2319.     35,                    /* dial_time */
  2320.     ",",                /* pause_chars */
  2321.     2,                    /* pause_time */
  2322. #ifdef OS2
  2323.     "ATQ0E1V1X4W1Y0%E2&S0&C1&D2\\K5+FCLASS=0+MS=11,1\015", /* wake_str */
  2324. #else
  2325. #ifdef VMS
  2326.     "ATQ0X4W1Y0&S1%E2\\K5+FCLASS=0+MS=11,1\015", /* wake_str */
  2327. #else
  2328.     "ATQ0X4W1Y0%E2\\K5+FCLASS=0+MS=11,1\015", /* wake_str */
  2329. #endif /* VMS */
  2330. #endif /* OS2 */
  2331.     0,                    /* wake_rate */
  2332.     "OK\015",                /* wake_prompt */
  2333.     "",                    /* dmode_str */
  2334.     "",                    /* dmode_prompt */
  2335.     "ATD%s\015",            /* dial_str */
  2336.     0,                    /* dial_rate */
  2337.     1100,                /* esc_time */
  2338.     43,                    /* esc_char */
  2339.     "ATQ0H0\015",            /* hup_str */
  2340.     "AT&K3\015",            /* hwfc_str */
  2341.     "AT&K4S32=17S33=19\015",        /* swfc_str */
  2342.     "AT&K0\015",            /* nofc_str */
  2343.     "AT&Q5S36=7S48=7\\N3\015",        /* ec_on_str */
  2344.     "AT&Q0S48=128\\N1\015",        /* ec_off_str */
  2345.     "ATS46=138%C1\015",            /* dc_on_str */
  2346.     "ATS46=136%C0\015",            /* dc_off_str */
  2347.     "ATS0=1\015",            /* aa_on_str */
  2348.     "ATS0=0\015",            /* aa_off_str */
  2349.     "",                    /* sb_on_str */
  2350.     "",                    /* sb_off_str */
  2351.     "ATM1\015",                /* sp_on_str */
  2352.     "ATM0\015",                /* sp_off_str */
  2353.     "ATL1\015",                /* vol1_str */
  2354.     "ATL2\015",                /* vol2_str */
  2355.     "ATL3\015",                /* vol3_str */
  2356.     "ATX3\015",                /* ignoredt */
  2357.     "",                    /* ini2 */
  2358.     115200L,                /* max_speed */
  2359.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  2360.     getok                /* ok_fn */
  2361. };
  2362.  
  2363. static
  2364. MDMINF LUCENT =                /* Lucent Venus or Data/Fax modem */
  2365.     {
  2366.     "Lucent Venus chipset",
  2367.     "ATP\015",                /* pulse command */
  2368.     "ATT\015",                /* tone command */
  2369.     35,                    /* dial_time */
  2370.     ",",                /* pause_chars */
  2371.     2,                    /* pause_time */
  2372. #ifdef OS2
  2373.     "ATQ0V1N1X4Y0&C1&D2&S0%E2\\K5+FCLASS=0S37=0\015", /* K95 */
  2374. #else
  2375. #ifdef VMS
  2376.     "ATQ0V1N1X4Y0&C1&D2&S1%E2\\K5+FCLASS=0S37=0\015", /* VMS */
  2377. #else
  2378.     "ATQ0V1N1X4Y0&C1&D2%E2\\K5+FCLASS=0S37=0\015", /* All others */
  2379. #endif /* VMS */
  2380. #endif /* OS2 */
  2381.     0,                    /* wake_rate */
  2382.     "OK\015",                /* wake_prompt */
  2383.     "",                    /* dmode_str */
  2384.     "",                    /* dmode_prompt */
  2385.     "ATD%s\015",            /* dial_str */
  2386.     0,                    /* dial_rate */
  2387.     1100,                /* esc_time */
  2388.     43,                    /* esc_char */
  2389.     "ATQ0H0\015",            /* hup_str */
  2390.     "AT&K3\015",            /* hwfc_str */
  2391.     "AT&K4S32=17S33=19\015",        /* swfc_str */
  2392.     "AT&K0\015",            /* nofc_str */
  2393.     "AT&Q5\015",            /* ec_on_str */
  2394.     "AT&Q0\015",            /* ec_off_str */
  2395.     "AT%C1\015",            /* dc_on_str */
  2396.     "AT%C0\015",            /* dc_off_str */
  2397.     "ATS0=1\015",            /* aa_on_str */
  2398.     "ATS0=0\015",            /* aa_off_str */
  2399.     "",                    /* sb_on_str */
  2400.     "",                    /* sb_off_str */
  2401.     "ATM1\015",                /* sp_on_str */
  2402.     "ATM0\015",                /* sp_off_str */
  2403.     "ATL1\015",                /* vol1_str */
  2404.     "ATL2\015",                /* vol2_str */
  2405.     "ATL3\015",                /* vol3_str */
  2406.     "ATX3\015",                /* ignoredt */
  2407.     "",                    /* ini2 */
  2408.     115200L,                /* max_speed */
  2409.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  2410.     getok                /* ok_fn */
  2411. };
  2412.  
  2413. static
  2414. MDMINF CONEXANT =            /* Conexant family */
  2415.     {
  2416.     "Conexant family of modems",
  2417.     "ATP\015",                /* pulse command */
  2418.     "ATT\015",                /* tone command */
  2419.     35,                    /* dial_time */
  2420.     ",",                /* pause_chars */
  2421.     2,                    /* pause_time */
  2422. #ifdef OS2
  2423.     "ATQ0V1X4&C1&D2&S0%E1+FCLASS=0\015", /* K95 */
  2424. #else
  2425. #ifdef VMS
  2426.     "ATQ0V1X4&C1&D2&S1%E1+FCLASS=0\015", /* VMS */
  2427. #else
  2428.     "ATQ0V1X4&C1&D2%E1+FCLASS=0\015", /* UNIX etc */
  2429. #endif /* VMS */
  2430. #endif /* OS2 */
  2431.     0,                    /* wake_rate */
  2432.     "OK\015",                /* wake_prompt */
  2433.     "",                    /* dmode_str */
  2434.     "",                    /* dmode_prompt */
  2435.     "ATD%s\015",            /* dial_str */
  2436.     0,                    /* dial_rate */
  2437.     1100,                /* esc_time */
  2438.     43,                    /* esc_char */
  2439.     "ATQ0H0\015",            /* hup_str */
  2440.     "AT&K3\015",            /* hwfc_str */
  2441.     "AT&K4S32=17S33=19\015",        /* swfc_str */
  2442.     "AT&K0\015",            /* nofc_str */
  2443.     "AT&Q5\015",            /* ec_on_str */
  2444.     "AT&Q0\015",            /* ec_off_str */
  2445.     "AT%C3\015",            /* dc_on_str */
  2446.     "AT%C0\015",            /* dc_off_str */
  2447.     "ATS0=1\015",            /* aa_on_str */
  2448.     "ATS0=0\015",            /* aa_off_str */
  2449.     "",                    /* sb_on_str */
  2450.     "",                    /* sb_off_str */
  2451.     "ATM1\015",                /* sp_on_str */
  2452.     "ATM0\015",                /* sp_off_str */
  2453.     "ATL1\015",                /* vol1_str */
  2454.     "ATL2\015",                /* vol2_str */
  2455.     "ATL3\015",                /* vol3_str */
  2456.     "ATX3\015",                /* ignoredt */
  2457.     "",                    /* ini2 */
  2458.     115200L,                /* max_speed */
  2459.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  2460.     getok                /* ok_fn */
  2461. };
  2462.  
  2463. static
  2464. MDMINF PCTEL =                /* PCTel chipset */
  2465.     {
  2466.     "PCTel chipset",
  2467.     "ATP\015",                /* pulse command */
  2468.     "ATT\015",                /* tone command */
  2469.     35,                    /* dial_time */
  2470.     ",",                /* pause_chars */
  2471.     2,                    /* pause_time */
  2472. #ifdef OS2
  2473.     "ATQ0V1N1X4Y0&C1&D2&S0%E2\\K5S37=0\015", /* K95 */
  2474. #else
  2475. #ifdef VMS
  2476.     "ATQ0V1N1X4Y0&C1&D2&S1%E2\\K5S37=0\015", /* VMS */
  2477. #else
  2478.     "ATQ0V1N1X4Y0&C1&D2%E2\\K5S37=0\015", /* UNIX etc */
  2479. #endif /* VMS */
  2480. #endif /* OS2 */
  2481.     0,                    /* wake_rate */
  2482.     "OK\015",                /* wake_prompt */
  2483.     "",                    /* dmode_str */
  2484.     "",                    /* dmode_prompt */
  2485.     "ATD%s\015",            /* dial_str */
  2486.     0,                    /* dial_rate */
  2487.     1100,                /* esc_time */
  2488.     43,                    /* esc_char */
  2489.     "ATQ0H0\015",            /* hup_str */
  2490.     "AT&K3\015",            /* hwfc_str */
  2491.     "AT&K4S32=17S33=19\015",        /* swfc_str */
  2492.     "AT&K0\015",            /* nofc_str */
  2493.     "AT\\N3\015",            /* ec_on_str */
  2494.     "AT\\N0\015",            /* ec_off_str */
  2495.     "AT%C1\015",            /* dc_on_str */
  2496.     "AT%C0\015",            /* dc_off_str */
  2497.     "ATS0=1\015",            /* aa_on_str */
  2498.     "ATS0=0\015",            /* aa_off_str */
  2499.     "",                    /* sb_on_str */
  2500.     "",                    /* sb_off_str */
  2501.     "ATM1\015",                /* sp_on_str */
  2502.     "ATM0\015",                /* sp_off_str */
  2503.     "ATL1\015",                /* vol1_str */
  2504.     "ATL2\015",                /* vol2_str */
  2505.     "ATL3\015",                /* vol3_str */
  2506.     "ATX3\015",                /* ignoredt */
  2507.     "",                    /* ini2 */
  2508.     115200L,                /* max_speed */
  2509.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  2510.     getok                /* ok_fn */
  2511. };
  2512.  
  2513. static
  2514. MDMINF ZOOMV34 =            /* Zoom Telephonics V.34  */
  2515.     {
  2516.     "Zoom Telephonics V.34",
  2517.     "ATP\015",                /* pulse command */
  2518.     "ATT\015",                /* tone command */
  2519.     35,                    /* dial_time */
  2520.     ",",                /* pause_chars */
  2521.     2,                    /* pause_time */
  2522. #ifdef OS2
  2523.     "ATQ0V1N1W1X4&S0&C1&D2S82=128\015", /* wake_str */
  2524. #else
  2525. #ifdef VMS
  2526.     "ATQ0V1N1W1X4&S1S82=128\015",    /* wake_str */
  2527. #else
  2528.     "ATQ0V1N1W1X4S82=128S015",        /* wake_str */
  2529. #endif /* VMS */
  2530. #endif /* OS2 */
  2531.     0,                    /* wake_rate */
  2532.     "OK\015",                /* wake_prompt */
  2533.     "",                    /* dmode_str */
  2534.     "",                    /* dmode_prompt */
  2535.     "ATD%s\015",            /* dial_str */
  2536.     0,                    /* dial_rate */
  2537.     1100,                /* esc_time */
  2538.     43,                    /* esc_char */
  2539.     "ATQ0H0\015",            /* hup_str */
  2540.     "AT&K3\015",            /* hwfc_str */
  2541.     "AT&K4\015S32=17S33=19",        /* swfc_str */
  2542.     "AT&K0\015",            /* nofc_str */
  2543.     "AT&Q5\015",            /* ec_on_str */
  2544.     "AT&Q0\015",            /* ec_off_str */
  2545.     "ATS%C3\015",            /* dc_on_str */
  2546.     "ATS%C0\015",            /* dc_off_str */
  2547.     "ATS0=1\015",            /* aa_on_str */
  2548.     "ATS0=0\015",            /* aa_off_str */
  2549.     "",                    /* sb_on_str */
  2550.     "",                    /* sb_off_str */
  2551.     "ATM1\015",                /* sp_on_str */
  2552.     "ATM0\015",                /* sp_off_str */
  2553.     "ATL1\015",                /* vol1_str */
  2554.     "ATL2\015",                /* vol2_str */
  2555.     "ATL3\015",                /* vol3_str */
  2556.     "ATX3\015",                /* ignoredt */
  2557.     "",                    /* ini2 */
  2558.     57600L,                /* max_speed */
  2559.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  2560.     getok                /* ok_fn */
  2561. };
  2562.  
  2563. static
  2564. MDMINF ZOOMV90 =            /* ZOOM V.90 */
  2565.     {
  2566.     "Zoom V.90 56K",
  2567.     "ATP\015",                /* pulse command */
  2568.     "ATT\015",                /* tone command */
  2569.     35,                    /* dial_time */
  2570.     ",",                /* pause_chars */
  2571.     2,                    /* pause_time */
  2572. #ifdef OS2
  2573.     "ATQ0V1N1X4Y0&C1&D2&S0%E2\\K5+FCLASS=0S37=0\015", /* K95 */
  2574. #else
  2575. #ifdef VMS
  2576.     "ATQ0V1N1X4Y0&C1&D2&S1%E2\\K5+FCLASS=0S37=0\015", /* VMS */
  2577. #else
  2578.     "ATQ0V1N1X4Y0&C1&D2%E2\\K5+FCLASS=0S37=0\015", /* All others */
  2579. #endif /* VMS */
  2580. #endif /* OS2 */
  2581.     0,                    /* wake_rate */
  2582.     "OK\015",                /* wake_prompt */
  2583.     "",                    /* dmode_str */
  2584.     "",                    /* dmode_prompt */
  2585.     "ATD%s\015",            /* dial_str */
  2586.     0,                    /* dial_rate */
  2587.     1100,                /* esc_time */
  2588.     43,                    /* esc_char */
  2589.     "ATQ0H0\015",            /* hup_str */
  2590.     "AT&K3\015",            /* hwfc_str */
  2591.     "AT&K4S32=17S33=19\015",        /* swfc_str */
  2592.     "AT&K0\015",            /* nofc_str */
  2593.     "AT&Q5\015",            /* ec_on_str */
  2594.     "AT&Q0\015",            /* ec_off_str */
  2595.     "AT%C1\015",            /* dc_on_str */
  2596.     "AT%C0\015",            /* dc_off_str */
  2597.     "ATS0=1\015",            /* aa_on_str */
  2598.     "ATS0=0\015",            /* aa_off_str */
  2599.     "",                    /* sb_on_str */
  2600.     "",                    /* sb_off_str */
  2601.     "ATM1\015",                /* sp_on_str */
  2602.     "ATM0\015",                /* sp_off_str */
  2603.     "ATL1\015",                /* vol1_str */
  2604.     "ATL2\015",                /* vol2_str */
  2605.     "ATL3\015",                /* vol3_str */
  2606.     "ATX3\015",                /* ignoredt */
  2607.     "",                    /* ini2 */
  2608.     115200L,                /* max_speed */
  2609.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  2610.     getok                /* ok_fn */
  2611. };
  2612.  
  2613. static
  2614. MDMINF ZOOMV92 =            /* ZOOM V.92 */
  2615.     {
  2616.     "Zoom V.92 with V.44 compression",
  2617.     "ATP\015",                /* pulse command */
  2618.     "ATT\015",                /* tone command */
  2619.     35,                    /* dial_time */
  2620.     ",",                /* pause_chars */
  2621.     2,                    /* pause_time */
  2622. #ifdef OS2
  2623.     "ATQ0V1N1X4Y0&C1&D2&S0%E2\\K5+FCLASS=0S37=0+MS=V92\015", /* K95 */
  2624. #else
  2625. #ifdef VMS
  2626.     "ATQ0V1N1X4Y0&C1&D2&S1%E2\\K5+FCLASS=0S37=0+MS=V92\015", /* VMS */
  2627. #else
  2628.     "ATQ0V1N1X4Y0&C1&D2%E2\\K5+FCLASS=0S37=0+MS=V92\015", /* All others */
  2629. #endif /* VMS */
  2630. #endif /* OS2 */
  2631.     0,                    /* wake_rate */
  2632.     "OK\015",                /* wake_prompt */
  2633.     "",                    /* dmode_str */
  2634.     "",                    /* dmode_prompt */
  2635.     "ATD%s\015",            /* dial_str */
  2636.     0,                    /* dial_rate */
  2637.     1100,                /* esc_time */
  2638.     43,                    /* esc_char */
  2639.     "ATQ0H0\015",            /* hup_str */
  2640.     "AT&K3\015",            /* hwfc_str */
  2641.     "AT&K4S32=17S33=19\015",        /* swfc_str */
  2642.     "AT&K0\015",            /* nofc_str */
  2643.     "AT&Q5\015",            /* ec_on_str */
  2644.     "AT&Q0\015",            /* ec_off_str */
  2645.     "AT%C1+DCS=1,1\015",        /* dc_on_str */
  2646.     "AT%C0\015",            /* dc_off_str */
  2647.     "ATS0=1\015",            /* aa_on_str */
  2648.     "ATS0=0\015",            /* aa_off_str */
  2649.     "",                    /* sb_on_str */
  2650.     "",                    /* sb_off_str */
  2651.     "ATM1\015",                /* sp_on_str */
  2652.     "ATM0\015",                /* sp_off_str */
  2653.     "ATL1\015",                /* vol1_str */
  2654.     "ATL2\015",                /* vol2_str */
  2655.     "ATL3\015",                /* vol3_str */
  2656.     "ATX3\015",                /* ignoredt */
  2657.     "",                    /* ini2 */
  2658.     115200L,                /* max_speed */
  2659.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  2660.     getok                /* ok_fn */
  2661. };
  2662.  
  2663.  
  2664. /*
  2665.   Now the "old" modems, all grouped together, and also within
  2666.   "if not defined MINIDIAL"...
  2667. */
  2668. #ifdef OLDMODEMS
  2669.  
  2670. static
  2671. MDMINF CERMETEK =    /* Information for "Cermetek Info-Mate 212 A" modem */
  2672.     {
  2673.     "Cermetek Info-Mate 212 A",
  2674.     "",                    /* pulse command */
  2675.     "",                    /* tone command */
  2676.     20,                    /* dial_time */
  2677.     "BbPpTt",                /* pause_chars */
  2678.     0,                    /* pause_time */
  2679.     "  XY\016R\015",            /* wake_str */
  2680.     200,                /* wake_rate */
  2681.     "",                    /* wake_prompt */
  2682.     "",                    /* dmode_str */
  2683.     NULL,                /* dmode_prompt */
  2684.     "\016D '%s'\015",            /* dial_str */
  2685.     200,                /* dial_rate */
  2686.     0,                    /* esc_time */
  2687.     0,                    /* esc_char */
  2688.     "",                    /* hup_str */
  2689.     "",                    /* hwfc_str */
  2690.     "",                    /* swfc_str */
  2691.     "",                    /* nofc_str */
  2692.     "",                    /* ec_on_str */
  2693.     "",                    /* ec_off_str */
  2694.     "",                    /* dc_on_str */
  2695.     "",                    /* dc_off_str */
  2696.     "",                    /* aa_on_str */
  2697.     "",                    /* aa_off_str */
  2698.     "",                    /* sb_on_str */
  2699.     "",                    /* sb_off_str */
  2700.     "",                    /* sp_off_str */
  2701.     "",                    /* sp_on_str */
  2702.     "",                    /* vol1_str */
  2703.     "",                    /* vol2_str */
  2704.     "",                    /* vol3_str */
  2705.     "",                    /* ignoredt */
  2706.     "",                    /* ini2 */
  2707.     1200L,                /* max_speed */
  2708.     0,                    /* capas */
  2709.     NULL                /* ok_fn */
  2710. };
  2711.  
  2712. static
  2713. MDMINF DF03 =        /* information for "DEC DF03-AC" modem */
  2714.     {
  2715.     "Digital DF03-AC",
  2716.     "",                    /* pulse command */
  2717.     "",                    /* tone command */
  2718.     27,                    /* dial_time */
  2719.     "=",                /* pause_chars */
  2720.     15,                    /* pause_time */
  2721.     "\001\002",                /* wake_str */
  2722.     0,                    /* wake_rate */
  2723.     "",                    /* wake_prompt */
  2724.     "",                    /* dmode_str */
  2725.     NULL,                /* dmode_prompt */
  2726.     "%s",                /* dial_str */
  2727.     0,                    /* dial_rate */
  2728.     0,                    /* esc_time */
  2729.     0,                    /* esc_char */
  2730.     "",                    /* hup_str */
  2731.     "",                    /* hwfc_str */
  2732.     "",                    /* swfc_str */
  2733.     "",                    /* nofc_str */
  2734.     "",                    /* ec_on_str */
  2735.     "",                    /* ec_off_str */
  2736.     "",                    /* dc_on_str */
  2737.     "",                    /* dc_off_str */
  2738.     "",                    /* aa_on_str */
  2739.     "",                    /* aa_off_str */
  2740.     "",                    /* sb_on_str */
  2741.     "",                    /* sb_off_str */
  2742.     "",                    /* sp_off_str */
  2743.     "",                    /* sp_on_str */
  2744.     "",                    /* vol1_str */
  2745.     "",                    /* vol2_str */
  2746.     "",                    /* vol3_str */
  2747.     "",                    /* ignoredt */
  2748.     "",                    /* ini2 */
  2749.     0L,                    /* max_speed */
  2750.     0,                    /* capas */
  2751.     NULL                /* ok_fn */
  2752. };
  2753.  
  2754. static
  2755. MDMINF DF100 =        /* information for "DEC DF100-series" modem */
  2756.             /*
  2757.              * The telephone "number" can include "P"s and/or "T"s
  2758.              * within it to indicate that subsequent digits are
  2759.              * to be dialed using pulse or tone dialing.  The
  2760.              * modem defaults to pulse dialing.  You may modify
  2761.              * the dial string below to explicitly default all
  2762.              * dialing to pulse or tone, but doing so prevents
  2763.              * the use of phone numbers that you may have stored
  2764.              * in the modem's memory.
  2765.              */
  2766.     {
  2767.     "Digital DF-100",
  2768.     "",                    /* pulse command */
  2769.     "",                    /* tone command */
  2770.     30,                    /* dial_time */
  2771.     "=",                /* pause_chars */
  2772.     15,                    /* pause_time */
  2773.     "\001",                /* wake_str */
  2774.     0,                    /* wake_rate */
  2775.     "",                    /* wake_prompt */
  2776.     "",                    /* dmode_str */
  2777.     NULL,                /* dmode_prompt */
  2778.     "%s#",                /* dial_str */
  2779.     0,                    /* dial_rate */
  2780.     0,                    /* esc_time */
  2781.     0,                    /* esc_char */
  2782.     "",                    /* hup_str */
  2783.     "",                    /* hwfc_str */
  2784.     "",                    /* swfc_str */
  2785.     "",                    /* nofc_str */
  2786.     "",                    /* ec_on_str */
  2787.     "",                    /* ec_off_str */
  2788.     "",                    /* dc_on_str */
  2789.     "",                    /* dc_off_str */
  2790.     "",                    /* aa_on_str */
  2791.     "",                    /* aa_off_str */
  2792.     "",                    /* sb_on_str */
  2793.     "",                    /* sb_off_str */
  2794.     "",                    /* sp_off_str */
  2795.     "",                    /* sp_on_str */
  2796.     "",                    /* vol1_str */
  2797.     "",                    /* vol2_str */
  2798.     "",                    /* vol3_str */
  2799.     "",                    /* ignoredt */
  2800.     "",                    /* ini2 */
  2801.     0L,                    /* max_speed */
  2802.     0,                    /* capas */
  2803.     NULL                /* ok_fn */
  2804. };
  2805.  
  2806. static
  2807. MDMINF DF200 =        /* information for "DEC DF200-series" modem */
  2808.             /*
  2809.              * The telephone "number" can include "P"s and/or "T"s
  2810.              * within it to indicate that subsequent digits are
  2811.              * to be dialed using pulse or tone dialing.  The
  2812.              * modem defaults to pulse dialing.  You may modify
  2813.              * the dial string below to explicitly default all
  2814.              * dialing to pulse or tone, but doing so prevents
  2815.              * the use of phone numbers that you may have stored
  2816.              * in the modem's memory.
  2817.              */
  2818.     {
  2819.     "Digital DF-200",
  2820.     "",            /* pulse command */
  2821.     "",            /* tone command */
  2822.     30,            /* dial_time */
  2823.     "=W",        /* pause_chars */    /* =: second tone; W: 5 secs */
  2824.     15,            /* pause_time */    /* worst case */
  2825.     "\002",        /* wake_str */        /* allow stored number usage */
  2826.     0,            /* wake_rate */
  2827.     "",            /* wake_prompt */
  2828.     "",            /* dmode_str */
  2829.     NULL,        /* dmode_prompt */
  2830. #ifdef COMMENT
  2831.     "%s!",        /* dial_str */
  2832. #else
  2833.     "   d %s\015",
  2834. #endif /* COMMENT */
  2835.     0,                    /* dial_rate */
  2836.     0,                    /* esc_time */
  2837.     0,                    /* esc_char */
  2838.     "",                    /* hup_str */
  2839.     "",                    /* hwfc_str */
  2840.     "",                    /* swfc_str */
  2841.     "",                    /* nofc_str */
  2842.     "",                    /* ec_on_str */
  2843.     "",                    /* ec_off_str */
  2844.     "",                    /* dc_on_str */
  2845.     "",                    /* dc_off_str */
  2846.     "",                    /* aa_on_str */
  2847.     "",                    /* aa_off_str */
  2848.     "",                    /* sb_on_str */
  2849.     "",                    /* sb_off_str */
  2850.     "",                    /* sp_off_str */
  2851.     "",                    /* sp_on_str */
  2852.     "",                    /* vol1_str */
  2853.     "",                    /* vol2_str */
  2854.     "",                    /* vol3_str */
  2855.     "",                    /* ignoredt */
  2856.     "",                    /* ini2 */
  2857.     0L,                    /* max_speed */
  2858.     0,                    /* capas */
  2859.     NULL                /* ok_fn */
  2860. };
  2861.  
  2862. static
  2863. MDMINF GDC =        /* information for "GeneralDataComm 212A/ED" modem */
  2864.     {
  2865.     "GeneralDataComm 212A/ED",
  2866.     "",                    /* pulse command */
  2867.     "",                    /* tone command */
  2868.     32,                    /* dial_time */
  2869.     "%",                /* pause_chars */
  2870.     3,                    /* pause_time */
  2871.     "\015\015",                /* wake_str */
  2872.     500,                /* wake_rate */
  2873.     "$",                /* wake_prompt */
  2874.     "D\015",                /* dmode_str */
  2875.     ":",                /* dmode_prompt */
  2876.     "T%s\015",                /* dial_str */
  2877.     0,                    /* dial_rate */
  2878.     0,                    /* esc_time */
  2879.     0,                    /* esc_char */
  2880.     "",                    /* hup_str */
  2881.     "",                    /* hwfc_str */
  2882.     "",                    /* swfc_str */
  2883.     "",                    /* nofc_str */
  2884.     "",                    /* ec_on_str */
  2885.     "",                    /* ec_off_str */
  2886.     "",                    /* dc_on_str */
  2887.     "",                    /* dc_off_str */
  2888.     "",                    /* aa_on_str */
  2889.     "",                    /* aa_off_str */
  2890.     "",                    /* sb_on_str */
  2891.     "",                    /* sb_off_str */
  2892.     "",                    /* sp_off_str */
  2893.     "",                    /* sp_on_str */
  2894.     "",                    /* vol1_str */
  2895.     "",                    /* vol2_str */
  2896.     "",                    /* vol3_str */
  2897.     "",                    /* ignoredt */
  2898.     "",                    /* ini2 */
  2899.     1200L,                /* max_speed */
  2900.     0,                    /* capas */
  2901.     NULL                /* ok_fn */
  2902. };
  2903.  
  2904. static
  2905. MDMINF PENRIL =        /* information for "Penril" modem */
  2906.     {
  2907.     "Penril modem",
  2908.     "",                    /* pulse command */
  2909.     "",                    /* tone command */
  2910.     50,                    /* dial_time */
  2911.     "",                    /* pause_chars */
  2912.     0,                    /* pause_time */
  2913.     "\015\015",                /* wake_str */
  2914.     300,                /* wake_rate */
  2915.     ">",                /* wake_prompt */
  2916.     "k\015",                /* dmode_str */
  2917.     ":",                /* dmode_prompt */
  2918.     "%s\015",                /* dial_str */
  2919.     0,                    /* dial_rate */
  2920.     0,                    /* esc_time */
  2921.     0,                    /* esc_char */
  2922.     "",                    /* hup_str */
  2923.     "",                    /* hwfc_str */
  2924.     "",                    /* swfc_str */
  2925.     "",                    /* nofc_str */
  2926.     "",                    /* ec_on_str */
  2927.     "",                    /* ec_off_str */
  2928.     "",                    /* dc_on_str */
  2929.     "",                    /* dc_off_str */
  2930.     "",                    /* aa_on_str */
  2931.     "",                    /* aa_off_str */
  2932.     "",                    /* sb_on_str */
  2933.     "",                    /* sb_off_str */
  2934.     "",                    /* sp_off_str */
  2935.     "",                    /* sp_on_str */
  2936.     "",                    /* vol1_str */
  2937.     "",                    /* vol2_str */
  2938.     "",                    /* vol3_str */
  2939.     "",                    /* ignoredt */
  2940.     "",                    /* ini2 */
  2941.     0L,                    /* max_speed */
  2942.     0,                    /* capas */
  2943.     NULL                /* ok_fn */
  2944. };
  2945.  
  2946. static
  2947. MDMINF RACAL =                /* Racal Vadic VA4492E */
  2948.     {
  2949.     "Racal Vadic VA4492E",
  2950.     "",                    /* pulse command */
  2951.     "",                    /* tone command */
  2952.     35,            /* dial_time (manual says modem is hardwired to 60) */
  2953.     "Kk",                /* pause_chars */
  2954.     5,                    /* pause_time */
  2955.     "\005\015",                /* wake_str, ^E^M */
  2956.     50,                    /* wake_rate */
  2957.     "*",                /* wake_prompt */
  2958.     "D\015",                /* dmode_str */
  2959.     "?",                /* dmode_prompt */
  2960.     "%s\015",                /* dial_str */
  2961.     0,                    /* dial_rate */
  2962.     1100,                /* esc_time */
  2963.     5,                    /* esc_char, ^E */
  2964.     "\003\004",                /* hup_str, ^C^D */
  2965.     0,                    /* hwfc_str */
  2966.     "",                    /* swfc_str */
  2967.     "",                    /* nofc_str */
  2968.     "",                    /* ec_on_str */
  2969.     "",                    /* ec_off_str */
  2970.     "",                    /* dc_on_str */
  2971.     "",                    /* dc_off_str */
  2972.     "",                    /* aa_on_str */
  2973.     "",                    /* aa_off_str */
  2974.     "",                    /* sb_on_str */
  2975.     "",                    /* sb_off_str */
  2976.     "",                    /* sp_off_str */
  2977.     "",                    /* sp_on_str */
  2978.     "",                    /* vol1_str */
  2979.     "",                    /* vol2_str */
  2980.     "",                    /* vol3_str */
  2981.     "",                    /* ignoredt */
  2982.     "",                    /* ini2 */
  2983.     0L,                    /* max_speed */
  2984.     0,                    /* capas */
  2985.     NULL                /* ok_fn */
  2986. };
  2987.  
  2988. static
  2989. MDMINF VENTEL =                /* Information for Ven-Tel modem */
  2990.     {
  2991.     "Ven-Tel",
  2992.     "",                    /* pulse command */
  2993.     "",                    /* tone command */
  2994.     20,                    /* dial_time */
  2995.     "%",                /* pause_chars */
  2996.     5,                    /* pause_time */
  2997.     "\015\015\015",            /* wake_str */
  2998.     300,                /* wake_rate */
  2999.     "$",                /* wake_prompt */
  3000.     "K\015",                /* dmode_str (was "") */
  3001.     "Number to call: ",            /* dmode_prompt (was NULL) */
  3002.     "%s\015",                /* dial_str (was "<K%s\r>") */
  3003.     0,                    /* dial_rate */
  3004.     0,                    /* esc_time */
  3005.     0,                    /* esc_char */
  3006.     "",                    /* hup_str */
  3007.     "",                    /* hwfc_str */
  3008.     "",                    /* swfc_str */
  3009.     "",                    /* nofc_str */
  3010.     "",                    /* ec_on_str */
  3011.     "",                    /* ec_off_str */
  3012.     "",                    /* dc_on_str */
  3013.     "",                    /* dc_off_str */
  3014.     "",                    /* aa_on_str */
  3015.     "",                    /* aa_off_str */
  3016.     "",                    /* sb_on_str */
  3017.     "",                    /* sb_off_str */
  3018.     "",                    /* sp_off_str */
  3019.     "",                    /* sp_on_str */
  3020.     "",                    /* vol1_str */
  3021.     "",                    /* vol2_str */
  3022.     "",                    /* vol3_str */
  3023.     "",                    /* ignoredt */
  3024.     "",                    /* ini2 */
  3025.     0L,                    /* max_speed */
  3026.     0,                    /* capas */
  3027.     NULL                /* ok_fn */
  3028. };
  3029.  
  3030. static
  3031. MDMINF CONCORD =    /* Info for Condor CDS 220 2400b modem */
  3032.     {
  3033.     "Concord Condor CDS 220 2400b",
  3034.     "",                    /* pulse command */
  3035.     "",                    /* tone command */
  3036.     35,                    /* dial_time */
  3037.     ",",                /* pause_chars */
  3038.     2,                    /* pause_time */
  3039.     "\015\015",                /* wake_str */
  3040.     20,                    /* wake_rate */
  3041.     "CDS >",                /* wake_prompt */
  3042.     "",                    /* dmode_str */
  3043.     NULL,                /* dmode_prompt */
  3044.     "<D M%s\015>",            /* dial_str */
  3045.     0,                    /* dial_rate */
  3046.     0,                    /* esc_time */
  3047.     0,                    /* esc_char */
  3048.     "",                    /* hup_str */
  3049.     "",                    /* hwfc_str */
  3050.     "",                    /* swfc_str */
  3051.     "",                    /* nofc_str */
  3052.     "",                    /* ec_on_str */
  3053.     "",                    /* ec_off_str */
  3054.     "",                    /* dc_on_str */
  3055.     "",                    /* dc_off_str */
  3056.     "",                    /* aa_on_str */
  3057.     "",                    /* aa_off_str */
  3058.     "",                    /* sb_on_str */
  3059.     "",                    /* sb_off_str */
  3060.     "",                    /* sp_off_str */
  3061.     "",                    /* sp_on_str */
  3062.     "",                    /* vol1_str */
  3063.     "",                    /* vol2_str */
  3064.     "",                    /* vol3_str */
  3065.     "",                    /* ignoredt */
  3066.     "",                    /* ini2 */
  3067.     2400L,                /* max_speed */
  3068.     0,                    /* capas */
  3069.     NULL                /* ok_fn */
  3070. };
  3071. #endif /* OLDMODEMS */
  3072.  
  3073. static
  3074. MDMINF MICROCOM =    /* Microcom modems in native SX mode */
  3075.             /* (long answer only) */
  3076. {
  3077.     "Microcom MNP modems in SX command mode",
  3078.     "DP\015",                /* pulse command */
  3079.     "DT\015",                /* tone command */
  3080.     35,                    /* dial_time */
  3081.     ",!@",        /* pause_chars (! and @ aren't pure pauses) */
  3082.     3,                    /* pause_time */
  3083. /*
  3084.   The following sets 8 bits, no parity, BREAK passthru, and SE0 disables the
  3085.   escape character, which is a single character with no guard time, totally
  3086.   unsafe, so we have no choice but to disable it.  Especially since, by
  3087.   default, it is Ctrl-A, which is Kermit's packet-start character.  We would
  3088.   change it to something else, which would enable "mdmhup()", but the user
  3089.   wouldn't know about it.  Very bad.  Note: SE1 sets it to Ctrl-A, SE2
  3090.   sets it to Ctrl-B, etc (1..31 allowed).  Also SE/Q sets it to "Q".
  3091. */
  3092.     "SE0;S1P4;SBRK5\015",        /* wake_str */
  3093.     100,                /* wake_rate */
  3094.     "!",                /* wake_prompt */
  3095.     "",                    /* dmode_str */
  3096.     NULL,                /* dmode_prompt */
  3097.     "D%s\015",                /* dial_str - number up to 39 chars */
  3098.     0,                    /* dial_rate */
  3099.     0,                    /* esc_time */
  3100.     0,                    /* esc_char - we can't use this */
  3101.     "",                    /* hup_str - it's "H" but can't use */
  3102.     "SF13\015",                /* hwfc_str */
  3103.     "SF11\015",                /* swfc_str */
  3104.     "SF10\015",                /* nofc_str */
  3105.     "BAOFF;SMAUT\015",            /* ec_on_str */
  3106.     "BAON;SMDIR\015",            /* ec_off_str */
  3107.     "COMP1\015",            /* dc_on_str */
  3108.     "COMP0\015",            /* dc_off_str */
  3109.     "AA",                /* aa_on_str */
  3110.     "",                    /* aa_off_str */
  3111.     "",                    /* sb_on_str */
  3112.     "",                    /* sb_off_str */
  3113.     "SA2",                /* sp_off_str */
  3114.     "SA0",                /* sp_on_str */
  3115.     "",                    /* vol1_str */
  3116.     "",                    /* vol2_str */
  3117.     "",                    /* vol3_str */
  3118.     "",                    /* ignoredt */
  3119.     "",                    /* ini2 */
  3120.     0L,                    /* max_speed */
  3121.     CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW|CKD_KS, /* capas */
  3122.     getok                /* ok_fn */
  3123. };
  3124.  
  3125. static
  3126. MDMINF MICROLINK =            /* MicroLink ... */
  3127.     {                    /* 14.4TQ,TL,PC;28.8TQ,TQV;2440T/TR */
  3128.     "ELSA MicroLink 14.4, 28.8, 33.6 or 56K", /* ELSA GmbH, Aachen */
  3129.     "ATP\015",                /* pulse command */
  3130.     "ATT\015",                /* tone command */
  3131.     35,                    /* dial_time */
  3132.     ",",                /* pause_chars */
  3133.     2,                    /* pause_time */
  3134. #ifdef OS2
  3135.     "ATQ0E1V1X4&S0\\D0&C1&D2\\K5\015",    /* wake_str */
  3136. #else
  3137. #ifdef VMS
  3138.     "ATQ0X4&S1\\K5\015",        /* wake_str */
  3139. #else
  3140.     "ATQ0X4\\K5\015",            /* wake_str */
  3141. #endif /* VMS */
  3142. #endif /* OS2 */
  3143.     0,                    /* wake_rate */
  3144.     "OK\015",                /* wake_prompt */
  3145.     "",                    /* dmode_str */
  3146.     "",                    /* dmode_prompt */
  3147.     "ATD%s\015",            /* dial_str */
  3148.     0,                    /* dial_rate */
  3149.     1100,                /* esc_time */
  3150.     43,                    /* esc_char */
  3151.     "ATQ0H\015",            /* hup_str */
  3152.     "AT\\Q3\015",            /* hwfc_str */
  3153.     "AT\\Q1\\X0\015",            /* swfc_str */
  3154.     "AT\\Q0\015",            /* nofc_str */
  3155.     "AT\\N3\015",            /* ec_on_str */
  3156.     "AT\\N0\015",            /* ec_off_str */
  3157.     "AT%C3\015",            /* dc_on_str */
  3158.     "AT%C0\015",            /* dc_off_str */
  3159.     "ATS0=1\015",            /* aa_on_str */
  3160.     "ATS0=0\015",            /* aa_off_str */
  3161.     "\\J0",                /* sb_on_str (?) */
  3162.     "",                    /* sb_off_str */
  3163.     "ATM1\015",                /* sp_on_str */
  3164.     "ATM0\015",                /* sp_off_str */
  3165.     "ATL1\015",                /* vol1_str */
  3166.     "ATL2\015",                /* vol2_str */
  3167.     "ATL3\015",                /* vol3_str */
  3168.     "ATX3\015",                /* ignoredt */
  3169.     "",                    /* ini2 */
  3170.     57600L,                /* max_speed */
  3171.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  3172.     getok                /* ok_fn */
  3173. };
  3174.  
  3175. static
  3176. MDMINF ULINKV250 =            /* MicroLink V.250 */
  3177.     {                    /* 56Kflex, V.90; V.250 command set */
  3178.     "ELSA MicroLink 56K V.250",        /* ELSA GmbH, Aachen */
  3179.     "ATP\015",                /* pulse command */
  3180.     "ATT\015",                /* tone command */
  3181.     35,                    /* dial_time */
  3182.     ",",                /* pause_chars */
  3183.     2,                    /* pause_time */
  3184. #ifdef OS2
  3185.     /* \D0 = DSR & CTS always on but hwfc overrides on CTS. */
  3186.     "ATQ0E1V1X4&S0\\D0&C1&D2\015",    /* wake_str */
  3187. #else
  3188. #ifdef VMS
  3189.     "ATQ0X4&S1\015",            /* wake_str */
  3190. #else
  3191.     "ATQ0X4\015",            /* wake_str */
  3192. #endif /* VMS */
  3193. #endif /* OS2 */
  3194.     0,                    /* wake_rate */
  3195.     "OK\015",                /* wake_prompt */
  3196.     "",                    /* dmode_str */
  3197.     "",                    /* dmode_prompt */
  3198.     "ATD%s\015",            /* dial_str */
  3199.     0,                    /* dial_rate */
  3200.     1100,                /* esc_time */
  3201.     43,                    /* esc_char */
  3202.     "ATQ0H0\015",            /* hup_str */
  3203.     "AT+IFC=2,2\015",            /* hwfc_str */
  3204.     "AT+IFC=1,1\015",            /* swfc_str */
  3205.     "AT+IFC=0,0\015",            /* nofc_str */
  3206.     "AT+ES=3,0\015",            /* ec_on_str */
  3207.     "AT+ES=1,0\015",            /* ec_off_str */
  3208.     "AT+DS=3,0,2048,32\015",        /* dc_on_str */
  3209.     "AT+DS=0,0\015",            /* dc_off_str */
  3210.  
  3211.     "ATS0=1\015",            /* aa_on_str */
  3212.     "ATS0=0\015",            /* aa_off_str */
  3213.     "",                    /* sb_on_str (?) */
  3214.     "",                    /* sb_off_str */
  3215.     "ATM1\015",                /* sp_on_str */
  3216.     "ATM0\015",                /* sp_off_str */
  3217.     "ATL1\015",                /* vol1_str */
  3218.     "ATL2\015",                /* vol2_str */
  3219.     "ATL3\015",                /* vol3_str */
  3220.     "ATX3\015",                /* ignoredt */
  3221.     "",                    /* ini2 */
  3222.     57600L,                /* max_speed */
  3223.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  3224.     getok                /* ok_fn */
  3225. };
  3226. #endif /* MINIDIAL */
  3227.  
  3228. static
  3229. MDMINF ITUTV250 =            /* ITU-T V.250 conforming modem */
  3230. {
  3231.     "Any ITU-T V.25ter/V.250 conformant modem",
  3232.     "ATP\015",                /* pulse command */
  3233.     "ATT\015",                /* tone command */
  3234.     35,                    /* dial_time */
  3235.     ",",                /* pause_chars */
  3236.     2,                    /* pause_time */
  3237.     "ATQ0E1V1X4&C1&D2\015",        /* wake_str (no &Sn in V.25) */
  3238.     0,                    /* wake_rate */
  3239.     "OK\015",                /* wake_prompt */
  3240.     "",                    /* dmode_str */
  3241.     "",                    /* dmode_prompt */
  3242.     "ATD%s\015",            /* dial_str */
  3243.     0,                    /* dial_rate */
  3244.     1100,                /* esc_time */
  3245.     43,                    /* esc_char */
  3246.     "ATQ0H0\015",            /* hup_str */
  3247.     "AT+IFC=2,2\015",            /* hwfc_str */
  3248.     "AT+IFC=1,1\015",            /* swfc_str */
  3249.     "AT+IFC=0,0\015",            /* nofc_str */
  3250.     "AT+ES=3,0,2;+EB=1,0,30\015",    /* ec_on_str */
  3251.     "AT+ES=0\015",            /* ec_off_str */
  3252.     "AT+DS=3,0\015",            /* dc_on_str */
  3253.     "AT+DS=0,0\015",            /* dc_off_str */
  3254.     "ATS0=1\015",            /* aa_on_str */
  3255.     "ATS0=0\015",            /* aa_off_str */
  3256.     "",                    /* sb_on_str */
  3257.     "",                    /* sb_off_str */
  3258.     "ATM1\015",                /* sp_on_str */
  3259.     "ATM0\015",                /* sp_off_str */
  3260.     "ATL1\015",                /* vol1_str */
  3261.     "ATL2\015",                /* vol2_str */
  3262.     "ATL3\015",                /* vol3_str */
  3263.     "ATX3\015",                /* ignoredt */
  3264.     "",                    /* ini2 */
  3265.     57600L,                /* max_speed */
  3266.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  3267.     getok                /* ok_fn */
  3268. };
  3269.  
  3270. #ifndef CK_TAPI
  3271. static
  3272. #endif /* CK_TAPI */
  3273. MDMINF GENERIC =            /* Generic high speed ... */
  3274.     {
  3275.     "Generic high-speed AT command set",
  3276.     "ATP\015",                /* pulse command */
  3277.     "ATT\015",                /* tone command */
  3278.     35,                    /* dial_time */
  3279.     ",",                /* pause_chars */
  3280.     2,                    /* pause_time */
  3281.     "",                    /* wake_str */
  3282.     0,                    /* wake_rate */
  3283.     "",                    /* wake_prompt */
  3284.     "",                    /* dmode_str */
  3285.     "",                    /* dmode_prompt */
  3286.     "ATD%s\015",            /* dial_str */
  3287.     0,                    /* dial_rate */
  3288.     1100,                /* esc_time */
  3289.     43,                    /* esc_char */
  3290.     "ATQ0H0\015",            /* hup_str */
  3291.     "",                    /* hwfc_str */
  3292.     "",                    /* swfc_str */
  3293.     "",                    /* nofc_str */
  3294.     "",                    /* ec_on_str */
  3295.     "",                    /* ec_off_str */
  3296.     "",                    /* dc_on_str */
  3297.     "",                    /* dc_off_str */
  3298.     "ATS0=1\015",            /* aa_on_str */
  3299.     "ATS0=0\015",            /* aa_off_str */
  3300.     "",                    /* sb_on_str */
  3301.     "",                    /* sb_off_str */
  3302.     "",                    /* sp_on_str */
  3303.     "",                    /* sp_off_str */
  3304.     "",                    /* vol1_str */
  3305.     "",                    /* vol2_str */
  3306.     "",                    /* vol3_str */
  3307.     "ATX3\015",                /* ignoredt */
  3308.     "",                    /* ini2 */
  3309.     115200,                /* max_speed */
  3310.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW, /* capas */
  3311.     getok                /* ok_fn */
  3312. };
  3313.  
  3314. #ifndef MINIDIAL
  3315. static
  3316. MDMINF XJACK =                /* Megahertz X-Jack */
  3317.     {
  3318.     "Megahertz X-Jack XJ3144 / CC6144",
  3319.     "ATP\015",                /* pulse command */
  3320.     "ATT\015",                /* tone command */
  3321.     35,                    /* dial_time */
  3322.     ",",                /* pause_chars */
  3323.     2,                    /* pause_time */
  3324. #ifdef OS2
  3325.     "ATQ0E1V1X4N1&C1&D2\\K5\015",    /* wake_str */
  3326. #else
  3327.     "ATQ0X4N1\\K5\015",            /* wake_str */
  3328. #endif /* OS2 */
  3329.     0,                    /* wake_rate */
  3330.     "OK\015",                /* wake_prompt */
  3331.     "",                    /* dmode_str */
  3332.     "",                    /* dmode_prompt */
  3333.     "ATD%s\015",            /* dial_str */
  3334.     0,                    /* dial_rate */
  3335.     1100,                /* esc_time */
  3336.     43,                    /* esc_char */
  3337.     "ATQ0H\015",            /* hup_str */
  3338.     "AT&K3\015",            /* hwfc_str */
  3339.     "AT&K4\015",            /* swfc_str */
  3340.     "AT&K0\015",            /* nofc_str */
  3341.     "AT\\N3&Q5\015",            /* ec_on_str */
  3342.     "AT\\N1&Q0\015",            /* ec_off_str */
  3343.     "AT%C3\015",            /* dc_on_str */
  3344.     "AT%C0\015",            /* dc_off_str */
  3345.     "ATS0=1\015",            /* aa_on_str */
  3346.     "ATS0=0\015",            /* aa_off_str */
  3347.     "",                    /* sb_on_str */
  3348.     "",                    /* sb_off_str */
  3349.     "ATM1\015",                /* sp_on_str */
  3350.     "ATM0\015",                /* sp_off_str */
  3351.     "ATL1\015",                /* vol1_str */
  3352.     "ATL2\015",                /* vol2_str */
  3353.     "ATL3\015",                /* vol3_str */
  3354.     "ATX3\015",                /* ignoredt */
  3355.     "",                    /* ini2 */
  3356.     57600L,                /* max_speed */
  3357.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  3358.     getok                /* ok_fn */
  3359. };
  3360.  
  3361. static
  3362. MDMINF SPIRITII =            /* QuickComm Spirit II */
  3363.     {
  3364.     "QuickComm Spirit II",
  3365.     "ATP\015",                /* pulse command */
  3366.     "ATT\015",                /* tone command */
  3367.     35,                    /* dial_time */
  3368.     ",",                /* pause_chars */
  3369.     2,                    /* pause_time */
  3370.     "AT&F\015",                /* wake_str */
  3371.     0,                    /* wake_rate */
  3372.     "OK\015",                /* wake_prompt */
  3373.     "",                    /* dmode_str */
  3374.     "",                    /* dmode_prompt */
  3375.     "ATD%s\015",            /* dial_str */
  3376.     0,                    /* dial_rate */
  3377.     1100,                /* esc_time */
  3378.     43,                    /* esc_char */
  3379.     "ATQ0H\015",            /* hup_str */
  3380.     "AT*F3\015",            /* hwfc_str */
  3381.     "AT*F2\015",            /* swfc_str */
  3382.     "AT*F0\015",            /* nofc_str */
  3383.     "AT*E6\015",            /* ec_on_str */
  3384.     "AT*E0\015",            /* ec_off_str */
  3385.     "AT*E9\015",            /* dc_on_str */
  3386.     "AT*E0\015",            /* dc_off_str */
  3387.     "ATS0=2\015",            /* aa_on_str */
  3388.     "ATS0=0\015",            /* aa_off_str */
  3389.     "",                    /* sb_on_str */
  3390.     "",                    /* sb_off_str */
  3391.     "ATM1\015",                /* sp_on_str */
  3392.     "ATM0\015",                /* sp_off_str */
  3393.     "ATL1\015",                /* vol1_str */
  3394.     "ATL2\015",                /* vol2_str */
  3395.     "ATL3\015",                /* vol3_str */
  3396.     "ATX3\015",                /* ignoredt */
  3397.     "",                    /* ini2 */
  3398.     57600L,                /* max_speed */
  3399.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  3400.     getok                /* ok_fn */
  3401. };
  3402.  
  3403. static
  3404. MDMINF MONTANA = {            /* Motorola Montana */
  3405.     "Motorola Montana",            /* Name */
  3406.     "ATP\015",                /* pulse command */
  3407.     "ATT\015",                /* tone command */
  3408.     35,                    /* dial_time */
  3409.     ",",                /* pause_chars */
  3410.     2,                    /* pause_time */
  3411. #ifdef OS2
  3412.     "ATQ0E1V1X4&S0&C1&D2\\K5\\V1\015",    /* wake_str */
  3413. #else
  3414. #ifdef VMS
  3415.     "ATQ0E1X4&S1\\K5\\V1\015",        /* wake_str */
  3416. #else
  3417.     "ATQ0E1X4\\K5\\V1\015",        /* wake_str */
  3418. #endif /* VMS */
  3419. #endif /* OS2 */
  3420.     0,                    /* wake_rate */
  3421.     "OK\015",                /* wake_prompt */
  3422.     "",                    /* dmode_str */
  3423.     "",                    /* dmode_prompt */
  3424.     "ATD%s\015",            /* dial_str */
  3425.     0,                    /* dial_rate */
  3426.     1100,                /* esc_time */
  3427.     43,                    /* esc_char */
  3428.     "ATQ0H0\015",            /* hup_str */
  3429.     "AT\\Q3\015",            /* hwfc_str */
  3430.     "AT\\Q1\015",            /* swfc_str */
  3431.     "AT\\Q0\015",            /* nofc_str */
  3432.     "AT\\N4\015",            /* ec_on_str */
  3433.     "AT\\N1\015",            /* ec_off_str */
  3434.     "AT%C1\015",            /* dc_on_str */
  3435.     "AT%C0\015",            /* dc_off_str */
  3436.     "ATS0=1\015",            /* aa_on_str */
  3437.     "ATS0=0\015",            /* aa_off_str */
  3438.     "AT\\J0\015",            /* sb_on_str */
  3439.     "AT\\J1\015",            /* sb_off_str */
  3440.     "ATM1\015",                /* sp_on_str */
  3441.     "ATM0\015",                /* sp_off_str */
  3442.     "ATL1\015",                /* vol1_str */
  3443.     "ATL2\015",                /* vol2_str */
  3444.     "ATL3\015",                /* vol3_str */
  3445.     "ATX3\015",                /* ignoredt */
  3446.     "",                    /* ini2 */
  3447.     57600L,                /* max_speed */
  3448.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  3449.     getok                /* ok_fn */
  3450. };
  3451.  
  3452. static
  3453. MDMINF COMPAQ = {            /* Compaq Data+Fax Modem */
  3454.     "Compaq Data+Fax Modem",        /* Name */
  3455.     "ATP\015",                /* pulse command */
  3456.     "ATT\015",                /* tone command */
  3457.     35,                    /* dial_time */
  3458.     ",",                /* pause_chars */
  3459.     2,                    /* pause_time */
  3460. #ifdef OS2
  3461.     "ATQ0E1V1X4&S0&C1&D2\015",        /* wake_str */
  3462. #else
  3463. #ifdef VMS
  3464.     "ATQ0E1X4&S1\015",            /* wake_str */
  3465. #else
  3466.     "ATQ0E1X4\015",            /* wake_str */
  3467. #endif /* VMS */
  3468. #endif /* OS2 */
  3469.     0,                    /* wake_rate */
  3470.     "OK\015",                /* wake_prompt */
  3471.     "",                    /* dmode_str */
  3472.     "",                    /* dmode_prompt */
  3473.     "ATD%s\015",            /* dial_str */
  3474.     0,                    /* dial_rate */
  3475.     1100,                /* esc_time */
  3476.     43,                    /* esc_char */
  3477.     "ATQ0H0\015",            /* hup_str */
  3478.     "AT\\Q3\015",            /* hwfc_str (same as &K3) */
  3479.     "AT\\Q1\015",            /* swfc_str (same as &K4) */
  3480.     "AT\\Q0\015",            /* nofc_str (same as &K0) */
  3481.     "AT\\N3\015",            /* ec_on_str */
  3482.     "AT\\N0\015",            /* ec_off_str */
  3483.     "AT%C1\015",            /* dc_on_str */
  3484.     "AT%C0\015",            /* dc_off_str */
  3485.     "ATS0=1\015",            /* aa_on_str */
  3486.     "ATS0=0\015",            /* aa_off_str */
  3487.     "AT\\N3\015",            /* sb_on_str */
  3488.     "AT\\N1\015",            /* sb_off_str */
  3489.     "ATM1\015",                /* sp_on_str */
  3490.     "ATM0\015",                /* sp_off_str */
  3491.     "ATL0\015",                /* vol1_str */
  3492.     "ATL2\015",                /* vol2_str */
  3493.     "ATL3\015",                /* vol3_str */
  3494.     "ATX3\015",                /* ignoredt */
  3495.     "",                    /* ini2 */
  3496.     115200L,                /* max_speed */
  3497.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  3498.     getok                /* ok_fn */
  3499. };
  3500.  
  3501.  
  3502. static
  3503. MDMINF FUJITSU = {            /* Fujitsu */
  3504.     "Fujitsu Fax/Modem Adapter",    /* Name */
  3505.     "ATP\015",                /* pulse command */
  3506.     "ATT\015",                /* tone command */
  3507.     35,                    /* dial_time */
  3508.     ",",                /* pause_chars */
  3509.     2,                    /* pause_time */
  3510. #ifdef OS2
  3511.     "ATQ0E1V1X4&S0&C1&D2\\K5\\N3\015",    /* wake_str */
  3512. #else
  3513. #ifdef VMS
  3514.     "ATQ0E1X4&S1\\K5\\N3\015",        /* wake_str */
  3515. #else
  3516.     "ATQ0E1X4\\K5\\N3\015",        /* wake_str */
  3517. #endif /* VMS */
  3518. #endif /* OS2 */
  3519.     0,                    /* wake_rate */
  3520.     "OK\015",                /* wake_prompt */
  3521.     "",                    /* dmode_str */
  3522.     "",                    /* dmode_prompt */
  3523.     "ATD%s\015",            /* dial_str */
  3524.     0,                    /* dial_rate */
  3525.     1100,                /* esc_time */
  3526.     43,                    /* esc_char */
  3527.     "ATQ0H0\015",            /* hup_str */
  3528.     "AT&K3\\Q3\015",            /* hwfc_str */
  3529.     "AT&K4\\Q1\015",            /* swfc_str */
  3530.     "AT&K0\\Q0\015",            /* nofc_str */
  3531.     "AT\\N3\015",            /* ec_on_str */
  3532.     "AT\\N0\015",            /* ec_off_str */
  3533.     "AT%C1",                /* dc_on_str */
  3534.     "AT%C0",                /* dc_off_str */
  3535.     "ATS0=1\015",            /* aa_on_str */
  3536.     "ATS0=0\015",            /* aa_off_str */
  3537.     "AT\\J0\015",            /* sb_on_str */
  3538.     "AT\\J1\015",            /* sb_off_str */
  3539.     "ATM1\015",                /* sp_on_str */
  3540.     "ATM0\015",                /* sp_off_str */
  3541.     "ATL1\015",                /* vol1_str */
  3542.     "ATL2\015",                /* vol2_str */
  3543.     "ATL3\015",                /* vol3_str */
  3544.     "ATX3\015",                /* ignoredt */
  3545.     "",                    /* ini2 */
  3546.     115200L,                /* max_speed */
  3547.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  3548.     getok                /* ok_fn */
  3549. };
  3550.  
  3551. static
  3552. MDMINF MHZATT =                /* Megahertz AT&T V.34 */
  3553.     {
  3554.     "Megahertz AT&T V.34",
  3555.     "ATP\015",                /* pulse command */
  3556.     "ATT\015",                /* tone command */
  3557.     35,                    /* dial_time */
  3558.     ",",                /* pause_chars */
  3559.     2,                    /* pause_time */
  3560. #ifdef OS2
  3561.     "ATQ0E1V1X4N1&C1&D2\\K5\015",    /* wake_str */
  3562. #else
  3563.     "ATQ0X4N1\\K5\015",            /* wake_str */
  3564. #endif /* OS2 */
  3565.     0,                    /* wake_rate */
  3566.     "OK\015",                /* wake_prompt */
  3567.     "",                    /* dmode_str */
  3568.     "",                    /* dmode_prompt */
  3569.     "ATD%s\015",            /* dial_str */
  3570.     0,                    /* dial_rate */
  3571.     1100,                /* esc_time */
  3572.     43,                    /* esc_char */
  3573.     "ATQ0H\015",            /* hup_str */
  3574.     "AT&K3\015",            /* hwfc_str */
  3575.     "AT&K4\015",            /* swfc_str */
  3576.     "AT&K0\015",            /* nofc_str */
  3577.     "AT\\N3\015",            /* ec_on_str */
  3578.     "AT\\N0\015",            /* ec_off_str */
  3579.     "AT%C1\"H3\015",            /* dc_on_str */
  3580.     "AT%C0\"H0\015",            /* dc_off_str */
  3581.     "ATS0=1\015",            /* aa_on_str */
  3582.     "ATS0=0\015",            /* aa_off_str */
  3583.     "AT\\J0\015",            /* sb_on_str */
  3584.     "AT\\J1\015",            /* sb_off_str */
  3585.     "ATM1\015",                /* sp_on_str */
  3586.     "ATM0\015",                /* sp_off_str */
  3587.     "ATL1\015",                /* vol1_str */
  3588.     "ATL2\015",                /* vol2_str */
  3589.     "ATL3\015",                /* vol3_str */
  3590.     "ATX3\015",                /* ignoredt */
  3591.     "",                    /* ini2 */
  3592.     115200L,                /* max_speed */
  3593.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  3594.     getok                /* ok_fn */
  3595. };
  3596.  
  3597. static
  3598. MDMINF SUPRASON =            /* SupraSonic */
  3599.     {
  3600.     "Diamond SupraSonic 288V+",        /* Diamond Multimedia Systems Inc */
  3601.     "ATP\015",                /* pulse command */
  3602.     "ATT\015",                /* tone command */
  3603.     35,                    /* dial_time */
  3604.     ",",                /* pause_chars */
  3605.     2,                    /* pause_time */
  3606. #ifdef OS2
  3607.     "ATQ0E1V1N1W0X4Y0&S0&C1&D2\015",    /* wake_str */
  3608. #else
  3609. #ifdef VMS
  3610.     "ATQ0E1N1W0X4Y0&S1\015",        /* wake_str */
  3611. #else
  3612.     "ATQ0E1N1W0X4Y0\015",        /* wake_str */
  3613. #endif /* VMS */
  3614. #endif /* OS2 */
  3615.     0,                    /* wake_rate */
  3616.     "OK\015",                /* wake_prompt */
  3617.     "",                    /* dmode_str */
  3618.     "",                    /* dmode_prompt */
  3619.     "ATD%s\015",            /* dial_str */
  3620.     0,                    /* dial_rate */
  3621.     1100,                /* esc_time */
  3622.     43,                    /* esc_char */
  3623.     "ATQ0H0\015",            /* hup_str */
  3624.     "AT&K3\015",            /* hwfc_str */
  3625.     "AT&K4\015",            /* swfc_str */
  3626.     "AT&K\015",                /* nofc_str */
  3627.     "AT&Q5\\N3S48=7\015",        /* ec_on_str */
  3628.     "AT&Q0\\N1\015",            /* ec_off_str */
  3629.     "AT%C3S46=138\015",            /* dc_on_str */
  3630.     "AT%C0S46=136\015",            /* dc_off_str */
  3631.     "ATS0=1\015",            /* aa_on_str */
  3632.     "ATS0=0\015",            /* aa_off_str */
  3633.     "",                    /* sb_on_str */
  3634.     "",                    /* sb_off_str */
  3635.     "ATM1\015",                /* sp_on_str */
  3636.     "ATM\015",                /* sp_off_str */
  3637.     "ATL\015",                /* vol1_str */
  3638.     "ATL2\015",                /* vol2_str */
  3639.     "ATL3\015",                /* vol3_str */
  3640.     "ATX3\015",                /* ignoredt */
  3641.     "",                    /* ini2 */
  3642.     115200L,                /* max_speed */
  3643.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  3644.     getok                /* ok_fn */
  3645. };
  3646.  
  3647. static
  3648. MDMINF BESTDATA =            /* Best Data */
  3649.     {
  3650.     "Best Data Fax Modem",        /* Best Data Fax Modem */
  3651.     "ATP\015",                /* pulse command */
  3652.     "ATT\015",                /* tone command */
  3653.     35,                    /* dial_time */
  3654.     ",",                /* pause_chars */
  3655.     2,                    /* pause_time */
  3656. #ifdef OS2
  3657.     "ATQ0E1V1N1W0X4Y0&S0&C1&D2\015",    /* wake_str */
  3658. #else
  3659. #ifdef VMS
  3660.     "ATQ0E1N1W0X4Y0&S1\015",        /* wake_str */
  3661. #else
  3662.     "ATQ0E1N1W0X4Y0\015",        /* wake_str */
  3663. #endif /* VMS */
  3664. #endif /* OS2 */
  3665.     0,                    /* wake_rate */
  3666.     "OK\015",                /* wake_prompt */
  3667.     "",                    /* dmode_str */
  3668.     "",                    /* dmode_prompt */
  3669.     "ATD%s\015",            /* dial_str */
  3670.     0,                    /* dial_rate */
  3671.     1100,                /* esc_time */
  3672.     43,                    /* esc_char */
  3673.     "ATQ0H0\015",            /* hup_str */
  3674.     "AT&K3\015",            /* hwfc_str */
  3675.     "AT&K4\015",            /* swfc_str */
  3676.     "AT&K\015",                /* nofc_str */
  3677.     "AT&Q6\\N3\015",            /* ec_on_str */
  3678.     "AT&Q0\\N1\015",            /* ec_off_str */
  3679.     "AT%C3\015",            /* dc_on_str */
  3680.     "AT%C0\015",            /* dc_off_str */
  3681.     "ATS0=1\015",            /* aa_on_str */
  3682.     "ATS0=0\015",            /* aa_off_str */
  3683.     "AT\\N3\015",            /* sb_on_str */
  3684.     "AT\\N0\015",            /* sb_off_str */
  3685.     "ATM1\015",                /* sp_on_str */
  3686.     "ATM0\015",                /* sp_off_str */
  3687.     "ATL1\015",                /* vol1_str */
  3688.     "ATL2\015",                /* vol2_str */
  3689.     "ATL3\015",                /* vol3_str */
  3690.     "ATX3\015",                /* ignoredt */
  3691.     "",                    /* ini2 */
  3692.     57600L,                /* max_speed */
  3693.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  3694.     getok                /* ok_fn */
  3695. };
  3696.  
  3697. static
  3698. MDMINF ATT1900 =            /* AT&T Secure Data STU III 1900 */
  3699.     {
  3700.     "AT&T Secure Data STU III Model 1900", /* name */
  3701.     "",                    /* pulse command */
  3702.     "",                    /* tone command */
  3703.     35,                    /* dial_time */
  3704.     ",",                /* pause_chars */
  3705.     2,                    /* pause_time */
  3706. #ifdef OS2
  3707.     "ATQ0E1V1X4\015",            /* wake_str */
  3708. #else
  3709.     "ATQ0E1X4\015",            /* wake_str */
  3710. #endif /* OS2 */
  3711.     0,                    /* wake_rate */
  3712.     "OK\015",                /* wake_prompt */
  3713.     "",                    /* dmode_str */
  3714.     "",                    /* dmode_prompt */
  3715.     "ATD%s\015",            /* dial_str */
  3716.     0,                    /* dial_rate */
  3717.     1100,                /* esc_time */
  3718.     43,                    /* esc_char */
  3719.     "ATQ0H0\015",            /* hup_str */
  3720.     "",                    /* hwfc_str */
  3721.     "",                    /* swfc_str */
  3722.     "",                    /* nofc_str */
  3723.     "",                    /* ec_on_str */
  3724.     "",                    /* ec_off_str */
  3725.     "",                    /* dc_on_str */
  3726.     "",                    /* dc_off_str */
  3727.     "ATS0=1\015",            /* aa_on_str */
  3728.     "ATS0=0\015",            /* aa_off_str */
  3729.     "",                    /* sb_on_str */
  3730.     "",                    /* sb_off_str */
  3731.     "",                    /* sp_on_str */
  3732.     "",                    /* sp_off_str */
  3733.     "",                    /* vol1_str */
  3734.     "",                    /* vol2_str */
  3735.     "",                    /* vol3_str */
  3736.     "",                    /* ignoredt */
  3737.     "",                    /* ini2 */
  3738.     9600L,                /* max_speed */
  3739.     CKD_AT|CKD_SB|CKD_HW,        /* capas */
  3740.     getok                /* ok_fn */
  3741. };
  3742.  
  3743. /*
  3744.   Experimentation showed that hardly any of the documented commands did
  3745.   anything other that print ERROR.  At first there was no communication at
  3746.   all at 9600 bps -- turns out the interface speed was stuck at 2400.
  3747.   ATS28=130 (given at 2400 bps) allowed it to work at 9600.
  3748. */
  3749. static
  3750. MDMINF ATT1910 =            /* AT&T Secure Data STU III 1910 */
  3751.     {                    /* Adds V.32bis, V.42, V.42bis */
  3752.     "AT&T Secure Data STU III Model 1910", /* name */
  3753.  
  3754. /* Believe it or not, "ATT" and "ATP" result in ERROR */
  3755.  
  3756.     "",                    /* pulse command */
  3757.     "",                    /* tone command */
  3758.     35,                    /* dial_time */
  3759.     ",",                /* pause_chars */
  3760.     2,                    /* pause_time */
  3761. #ifdef OS2
  3762.     "ATQ0E1V1X4\015",            /* wake_str */
  3763. #else
  3764.     "ATQ0E1X4\015",            /* wake_str */
  3765. #endif /* OS2 */
  3766.     0,                    /* wake_rate */
  3767.     "OK\015",                /* wake_prompt */
  3768.     "",                    /* dmode_str */
  3769.     "",                    /* dmode_prompt */
  3770.     "ATD%s\015",            /* dial_str */
  3771.     0,                    /* dial_rate */
  3772.     1100,                /* esc_time */
  3773.     43,                    /* esc_char */
  3774.     "ATQ0H0\015",            /* hup_str */
  3775.     "",                    /* hwfc_str */
  3776.     "",                    /* swfc_str */
  3777.     "",                    /* nofc_str */
  3778. #ifdef COMMENT
  3779. /* These are evidently read-only registers */
  3780.     "ATS46=138S47=0\015",        /* ec_on_str */
  3781.     "ATS46=138S47=128\015",        /* ec_off_str */
  3782.     "ATS46=138S47=0\015",        /* dc_on_str */
  3783.     "ATS46=138S47=128\015",        /* dc_off_str */
  3784. #else
  3785.     "",
  3786.     "",
  3787.     "",
  3788.     "",
  3789. #endif /* COMMENT */
  3790.     "ATS0=1\015",            /* aa_on_str */
  3791.     "ATS0=0\015",            /* aa_off_str */
  3792.     "",                    /* sb_on_str */
  3793.     "",                    /* sb_off_str */
  3794.     "",                    /* sp_on_str */
  3795.     "",                    /* sp_off_str */
  3796.     "",                    /* vol1_str */
  3797.     "",                    /* vol2_str */
  3798.     "",                    /* vol3_str */
  3799.     "",                    /* ignoredt */
  3800.     "",                    /* ini2 */
  3801.     9600L,                /* max_speed */
  3802.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW,    /* capas */
  3803.     getok                /* ok_fn */
  3804. };
  3805.  
  3806. static
  3807. MDMINF KEEPINTOUCH =            /* AT&T KeepinTouch Card Modem */
  3808.     {
  3809.     "AT&T KeepinTouch V.32bis Card Modem", /* Name */
  3810.     "ATP\015",                /* pulse command */
  3811.     "ATT\015",                /* tone command */
  3812.     35,                    /* dial_time */
  3813.     ",",                /* pause_chars */
  3814.     2,                    /* pause_time */
  3815. #ifdef OS2
  3816. /* This used to include &C1&S0&D2+Q0 but that gives ERROR */
  3817.     "ATQ0E1V1X4&S0&C1&D2\\K5\015",    /* wake_str */
  3818. #else
  3819. #ifdef VMS
  3820.     "ATQ0E1X4&S1\\K5\015",        /* wake_str */
  3821. #else
  3822.     "ATQ0E1X4\\K5\015",            /* wake_str */
  3823. #endif /* VMS */
  3824. #endif /* OS2 */
  3825.     0,                    /* wake_rate */
  3826.     "OK\015",                /* wake_prompt */
  3827.     "",                    /* dmode_str */
  3828.     "",                    /* dmode_prompt */
  3829.     "ATD%s\015",            /* dial_str */
  3830.     0,                    /* dial_rate */
  3831.     1100,                /* esc_time */
  3832.     43,                    /* esc_char */
  3833.     "ATQ0H0\015",            /* hup_str */
  3834.     "AT\\Q3\015",            /* hwfc_str */
  3835.     "AT\\Q1\\X0\015",            /* swfc_str */
  3836.     "AT\\Q0\015",            /* nofc_str */
  3837.     "AT\\N3-J1\015",            /* ec_on_str */
  3838.     "AT\\N1\015",            /* ec_off_str */
  3839.     "AT%C3\"H3\015",            /* dc_on_str */
  3840.     "AT%C0\"H0\015",            /* dc_off_str */
  3841.     "ATS0=1\015",            /* aa_on_str */
  3842.     "ATS0=0\015",            /* aa_off_str */
  3843.     "ATN0\\J0\015",            /* sb_on_str */
  3844.     "ATN1\\J1\015",            /* sb_off_str */
  3845.     "ATM1\015",                /* sp_on_str */
  3846.     "ATM0\015",                /* sp_off_str */
  3847.     "",                    /* vol1_str */
  3848.     "",                    /* vol2_str */
  3849.     "",                    /* vol3_str */
  3850.     "ATX3\015",                /* ignoredt */
  3851.     "",                    /* ini2 */
  3852.     57600L,                /* max_speed */
  3853.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  3854.     getok                /* ok_fn */
  3855. };
  3856.  
  3857. static
  3858. MDMINF ROLM_AT =        /* Rolm data phone with AT command set */
  3859.     {
  3860.     "Rolm 244PC or 600 Series with AT Command Set",
  3861.     "",                    /* pulse command */
  3862.     "",                    /* tone command */
  3863.     35,                    /* dial_time */
  3864.     ",",                /* pause_chars */
  3865.     2,                    /* pause_time */
  3866. #ifdef OS2
  3867.     "ATE1Q0V1\015",            /* wake_str */
  3868. #else
  3869.     "ATQ0\015",                /* wake_str */
  3870. #endif /* OS2 */
  3871.     0,                    /* wake_rate */
  3872.     "OK\015",                /* wake_prompt */
  3873.     "",                    /* dmode_str */
  3874.     "",                    /* dmode_prompt */
  3875.     "ATDT%s\015",            /* dial_str -- always Tone */
  3876.     0,                    /* dial_rate */
  3877.     1100,                /* esc_time */
  3878.     43,                    /* esc_char */
  3879.     "ATQ0H0\015",            /* hup_str */
  3880.     "",                    /* hwfc_str */
  3881.     "",                    /* swfc_str */
  3882.     "",                    /* nofc_str */
  3883.     "",                    /* ec_on_str */
  3884.     "",                    /* ec_off_str */
  3885.     "",                    /* dc_on_str */
  3886.     "",                    /* dc_off_str */
  3887.     "ATS0=1\015",            /* aa_on_str */
  3888.     "ATS0=0\015",            /* aa_off_str */
  3889.     "",                    /* sb_on_str */
  3890.     "",                    /* sb_off_str */
  3891.     "",                    /* sp_on_str */
  3892.     "",                    /* sp_off_str */
  3893.     "",                    /* vol1_str */
  3894.     "",                    /* vol2_str */
  3895.     "",                    /* vol3_str */
  3896.     "",                    /* ignoredt */
  3897.     "",                    /* ini2 */
  3898.     19200L,                /* max_speed */
  3899.     CKD_AT,                /* capas */
  3900.     getok                /* ok_fn */
  3901. };
  3902.  
  3903. static
  3904. MDMINF ATLAS =                /* Atlas / Newcom ixfC 33.6 */
  3905.     {
  3906.     "Atlas / Newcom 33600ixfC Data/Fax Modem", /* Name */
  3907.     "ATP\015",                /* pulse command */
  3908.     "ATT\015",                /* tone command */
  3909.     35,                    /* dial_time */
  3910.     ",",                /* pause_chars */
  3911.     2,                    /* pause_time */
  3912. #ifdef OS2
  3913.     "ATZ0&FQ0V1&C1&D2\015",        /* wake_str */
  3914. #else
  3915.     "ATZ0&FQ0V1\015",            /* wake_str */
  3916. #endif /* OS2 */
  3917.     0,                    /* wake_rate */
  3918.     "OK\015",                /* wake_prompt */
  3919.     "",                    /* dmode_str */
  3920.     "",                    /* dmode_prompt */
  3921.     "ATD%s\015",            /* dial_str */
  3922.     0,                    /* dial_rate */
  3923.     1100,                /* esc_time */
  3924.     43,                    /* esc_char */
  3925.     "ATQ0H0\015",            /* hup_str */
  3926.     "AT&K3\015",            /* hwfc_str */
  3927.     "AT&K4\015",            /* swfc_str */
  3928.     "AT&K0\015",            /* nofc_str */
  3929.     "AT\"H3\015",            /* ec_on_str */
  3930.     "AT\"H0\015",            /* ec_off_str */
  3931.     "AT%C1\015",            /* dc_on_str */
  3932.     "AT%C0\015",            /* dc_off_str */
  3933.     "ATS0=1\015",            /* aa_on_str */
  3934.     "ATS0=0\015",            /* aa_off_str */
  3935.     "ATN0\\J0\015",            /* sb_on_str */
  3936.     "ATN1\\J1\015",            /* sb_off_str */
  3937.     "ATM1\015",                /* sp_on_str */
  3938.     "ATM0\015",                /* sp_off_str */
  3939.     "ATL1\015",                /* vol1_str */
  3940.     "ATL2\015",                /* vol2_str */
  3941.     "ATL3\015",                /* vol3_str */
  3942.     "ATX3\015",                /* ignoredt */
  3943.     "",                    /* ini2 */
  3944.     115200L,                /* max_speed */
  3945.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  3946.     getok                /* ok_fn */
  3947. };
  3948.  
  3949. static
  3950. MDMINF CODEX = {            /* Motorola Codex */
  3951.     "Motorola Codex 326X Series",    /* Name - AT&V to see settings */
  3952.     "ATP\015",                /* pulse command */
  3953.     "ATT\015",                /* tone command */
  3954.     35,                    /* dial_time */
  3955.     ",",                /* pause_chars */
  3956.     2,                    /* pause_time */
  3957. #ifdef OS2
  3958.     /* &M0=Async (not sync) */
  3959.     /* *MM0=Automatic modulation negotiation */
  3960.     /* *DE22=Automatic data rate */
  3961.     "ATZQ0E1V1X4Y0*DE22*MM0&C1&M0&S0&D2\015", /* wake_str */
  3962. #else
  3963. #ifdef VMS
  3964.     "ATZQ0E1V1X4Y0*DE22*MM0&C1&M0&S1\015", /* wake_str */
  3965. #else
  3966.     "ATZQ0E1V1X4Y0*DE22*MM0&C1&M0\015",    /* wake_str */
  3967. #endif /* VMS */
  3968. #endif /* OS2 */
  3969.     0,                    /* wake_rate */
  3970.     "OK\015",                /* wake_prompt */
  3971.     "",                    /* dmode_str */
  3972.     "",                    /* dmode_prompt */
  3973.     "ATD%s\015",            /* dial_str */
  3974.     0,                    /* dial_rate */
  3975.     1100,                /* esc_time */
  3976.     43,                    /* esc_char */
  3977.     "ATQ0H0\015",            /* hup_str */
  3978.     "AT*MF1*FL3\015",            /* hwfc_str */
  3979.     "AT*MF1*FL1\015",            /* swfc_str */
  3980.     "AT*MF0*FL0\015",            /* nofc_str */
  3981.     "AT*EC0*SM3*SC0\015",        /* ec_on_str */
  3982.     "AT*SM0\015",            /* ec_off_str */
  3983.     "AT*DC1\015",            /* dc_on_str */
  3984.     "AT*DC0\015",            /* dc_off_str */
  3985.     "AT*AA5S0=1\015",            /* aa_on_str */
  3986.     "AT*AA5S0=0\015",            /* aa_off_str */
  3987.     "AT*SC1\015",            /* sb_on_str */
  3988.     "AT*SC0\015",            /* sb_off_str */
  3989.     "ATM1\015",                /* sp_on_str */
  3990.     "ATM0\015",                /* sp_off_str */
  3991.     "ATL1\015",                /* vol1_str */
  3992.     "ATL2\015",                /* vol2_str */
  3993.     "ATL3\015",                /* vol3_str */
  3994.     "ATX3*BD2\015",            /* ignoredt */
  3995.     "",                    /* ini2 */
  3996.     115200L,                /* max_speed */
  3997.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  3998.     getok                /* ok_fn */
  3999. };
  4000.  
  4001. static
  4002. MDMINF MT5634ZPX =            /* Multitech */
  4003.     {
  4004.     "Multitech MT5634ZPX",        /* name */
  4005.     "ATP\015",                /* pulse command */
  4006.     "ATT\015",                /* tone command */
  4007.     35,                    /* dial_time */
  4008.     ",",                /* pause_chars */
  4009.     2,                    /* pause_time */
  4010. #ifdef OS2
  4011.     "ATE1Q0V1X4&S0&C1&D2&Q0\015",    /* wake_str */
  4012. #else
  4013. #ifdef VMS
  4014.     "ATQ0E1X4&S1&Q0\015",        /* wake_str */
  4015. #else
  4016.     "ATQ0E1X4&Q0\015",            /* wake_str */
  4017. #endif /* VMS */
  4018. #endif /* OS2 */
  4019.     0,                    /* wake_rate */
  4020.     "OK\015",                /* wake_prompt */
  4021.     "",                    /* dmode_str */
  4022.     "",                    /* dmode_prompt */
  4023.     "ATD%s\015",            /* dial_str */
  4024.     0,                    /* dial_rate */
  4025.     1100,                /* esc_time */
  4026.     43,                    /* esc_char */
  4027.     "ATQ0H0\015",            /* hup_str */
  4028.     "AT&K3\015",            /* hwfc_str */
  4029.     "AT&K4\015",            /* swfc_str */
  4030.     "AT&K0\015",            /* nofc_str */
  4031.     "AT\\N3\015",            /* ec_on_str */
  4032.     "AT\\N1\015",            /* ec_off_str */
  4033.     "AT%C1\015",            /* dc_on_str */
  4034.     "AT%C0\015",            /* dc_off_str */
  4035.     "ATS0=1\015",            /* aa_on_str */
  4036.     "ATS0=0\015",            /* aa_off_str */
  4037.     "AT\\J0\015",            /* sb_on_str */
  4038.     "AT\\J1\015",            /* sb_off_str (NOT SUPPORTED) */
  4039.     "ATM1\015",                /* sp_on_str */
  4040.     "ATM0\015",                /* sp_off_str */
  4041.     "ATL1\015",                /* vol1_str */
  4042.     "ATL2\015",                /* vol2_str */
  4043.     "ATL3\015",                /* vol3_str */
  4044.     "ATX3\015",                /* ignoredt */
  4045.     "",                    /* ini2 */
  4046.     115200L,                /* max_speed */
  4047.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  4048.     getok                /* ok_fn */
  4049. };
  4050.  
  4051. static
  4052. MDMINF MOTSM56 =            /* Motorola SM56 Chipset */
  4053.     {
  4054.     "Motorola SM56 V.90 chipset",    /* name */
  4055.     "ATP\015",                /* pulse command */
  4056.     "ATT\015",                /* tone command */
  4057.     35,                    /* dial_time */
  4058.     ",",                /* pause_chars */
  4059.     2,                    /* pause_time */
  4060. #ifdef OS2
  4061.     "ATQ0V1X4&S0&C1&D2*MM16\015",    /* wake_str */
  4062. #else
  4063. #ifdef VMS
  4064.     "ATQ0V1X4&S1&C1&D2*MM16\015",    /* wake_str */
  4065. #else
  4066.     "ATQ0V1X4&C1&D2*MM16\015",        /* wake_str */
  4067. #endif /* VMS */
  4068. #endif /* OS2 */
  4069.     0,                    /* wake_rate */
  4070.     "OK\015",                /* wake_prompt */
  4071.     "",                    /* dmode_str */
  4072.     "",                    /* dmode_prompt */
  4073.     "ATD%s\015",            /* dial_str */
  4074.     0,                    /* dial_rate */
  4075.     1100,                /* esc_time */
  4076.     43,                    /* esc_char */
  4077.     "ATQ0H0\015",            /* hup_str */
  4078.     "AT\\Q3\015",            /* hwfc_str */
  4079.     "AT\\Q1\015",            /* swfc_str */
  4080.     "AT\\Q0\015",            /* nofc_str */
  4081.     "AT\\N7\015",            /* ec_on_str */
  4082.     "AT\\N1\015",            /* ec_off_str */
  4083.     "AT%C1\015",            /* dc_on_str */
  4084.     "AT%C0\015",            /* dc_off_str */
  4085.     "ATS0=1\015",            /* aa_on_str */
  4086.     "ATS0=0\015",            /* aa_off_str */
  4087.     "AT\\J0\015",            /* sb_on_str */
  4088.     "AT\\J1\015",            /* sb_off_str (NOT SUPPORTED) */
  4089.     "ATM1\015",                /* sp_on_str */
  4090.     "ATM0\015",                /* sp_off_str */
  4091.     "ATL1\015",                /* vol1_str */
  4092.     "ATL2\015",                /* vol2_str */
  4093.     "ATL3\015",                /* vol3_str */
  4094.     "ATX3\015",                /* ignoredt */
  4095.     "",                    /* ini2 */
  4096.     115200L,                /* max_speed */
  4097.     CKD_AT|CKD_SB|CKD_EC|CKD_DC|CKD_HW|CKD_SW, /* capas */
  4098.     getok                /* ok_fn */
  4099. };
  4100. #endif /* MINIDIAL */
  4101.  
  4102. /* END MDMINF STRUCT DEFINITIONS */
  4103.  
  4104. /*
  4105.   Table to convert modem numbers to MDMINF struct pointers.
  4106.   The entries MUST be in ascending order by modem number, without any
  4107.   "gaps" in the numbers, and starting from one (1).
  4108. */
  4109.  
  4110. MDMINF *modemp[] = {
  4111. #ifdef MINIDIAL
  4112.     NULL,                /*  0 */
  4113.     &CCITT,                /*  1 */
  4114.     &HAYES,                /*  2 */
  4115.     &UNKNOWN,                /*  3 */
  4116.     &DUMMY,                /*  4 */
  4117.     &GENERIC,                /*  5 */
  4118.     &ITUTV250                /*  6 */
  4119. #else  /* Not MINIDIAL */
  4120.     NULL,                /*  0 */
  4121.     &ATTDTDM,                /*  1 */
  4122.     &ATTISN,                /*  2 */
  4123.     &ATTMODEM,                /*  3 */
  4124.     &CCITT,                /*  4 */
  4125. #ifdef OLDMODEMS
  4126.     &CERMETEK,                /*  5 */
  4127.     &DF03,                /*  6 */
  4128.     &DF100,                /*  7 */
  4129.     &DF200,                /*  8 */
  4130.     &GDC,                /*  9 */
  4131. #else
  4132.     NULL,
  4133.     NULL,
  4134.     NULL,
  4135.     NULL,
  4136.     NULL,
  4137. #endif /* OLDMODEMS */
  4138.     &HAYES,                /* 10 */
  4139. #ifdef OLDMODEMS
  4140.     &PENRIL,                /* 11 */
  4141.     &RACAL,                /* 12 */
  4142. #else
  4143.     NULL,
  4144.     NULL,
  4145. #endif /* OLDMODEMS */
  4146.     &UNKNOWN,                /* 13 */
  4147. #ifdef OLDMODEMS
  4148.     &VENTEL,                /* 14 */
  4149.     &CONCORD,                /* 15 */
  4150. #else
  4151.     NULL,
  4152.     NULL,
  4153. #endif /* OLDMODEMS */
  4154.     &DUMMY,                /* 16 */
  4155.     &ROLM,                /* 17 */
  4156. #ifdef OLDMODEMS
  4157.     &MICROCOM,                /* 18 */
  4158. #else
  4159.     NULL,
  4160. #endif /* OLDMODEMS */
  4161.     &USR,                /* 19 USR Courier and Sportster */
  4162.     &OLDTB,                /* 20 Old Telebits */
  4163.     &DIGITEL,                /* 21 Digitel CCITT */
  4164.     &H_1200,                /* 22 Hayes 1200 */
  4165.     &H_ULTRA,                /* 23 Hayes Ultra */
  4166.     &H_ACCURA,                /* 24 Hayes Optima */
  4167.     &PPI,                /* 25 PPI */
  4168.     &DATAPORT,                /* 26 Dataport */
  4169.     &BOCA,                /* 27 Boca */
  4170.     &MOTOROLA,                /* 28 Motorola UDS MOTOROLA */
  4171.     NULL,                /* 29 Digicomm */
  4172.     NULL,                /* 30 Dynalink */
  4173.     &INTEL,                /* 31 Intel */
  4174.     &UCOM_AT,                /* 32 Microcom in AT mode */
  4175.     &MULTITECH,                /* 33 Multitech */
  4176.     &SUPRA,                /* 34 Supra */
  4177.     &ZOLTRIX,                /* 35 Zoltrix */
  4178.     &ZOOM,                /* 36 Zoom */
  4179.     &ZYXEL,                /* 37 ZyXEL */
  4180.     &DUMMY,                /* 38 TAPI */
  4181.     &NEWTB,                /* 39 New-Telebit */
  4182.     &MAXTECH,                /* 40 MaxTech */
  4183.     &DUMMY,                /* 41 User-defined */
  4184.     &RWV32,                /* 42 Rockwell V.32 */
  4185.     &RWV32B,                /* 43 Rockwell V.32bis */
  4186.     &RWV34,                /* 44 Rockwell V.34 */
  4187.     &MWAVE,                /* 45 IBM Mwave */
  4188.     &TELEPATH,                /* 46 Gateway 2000 Telepath II 28.8 */
  4189.     &MICROLINK,                /* 47 MicroLink modems */
  4190.     &CARDINAL,                /* 48 Cardinal */
  4191.     &GENERIC,                /* 49 Generic high-speed */
  4192.     &XJACK,                /* 50 Megahertz-Xjack */
  4193.     &SPIRITII,                /* 51 QuickComm Spirit II */
  4194.     &MONTANA,                /* 52 Motorola Montana */
  4195.     &COMPAQ,                /* 53 Compaq Data+Fax */
  4196.     &FUJITSU,                /* 54 Fujitsu */
  4197.     &MHZATT,                /* 55 Megahertz AT&T V.34 */
  4198.     &SUPRASON,                /* 56 Suprasonic */
  4199.     &BESTDATA,                /* 57 Best Data */
  4200.     &ATT1900,                /* 58 AT&T Secure Data STU III 1900 */
  4201.     &ATT1910,                /* 59 AT&T Secure Data STU III 1910 */
  4202.     &KEEPINTOUCH,            /* 60 AT&T KeepinTouch */
  4203.     &USRX2,                /* 61 USR XJ-1560 X2 */
  4204.     &ROLM_AT,                /* 62 Rolm with AT command set */
  4205.     &ATLAS,                /* 63 Atlas / Newcom */
  4206.     &CODEX,                /* 64 Motorola Codex */
  4207.     &MT5634ZPX,                /* 65 Multitech MT5634ZPX */
  4208.     &ULINKV250,                /* 66 Microlink V.250 56K */
  4209.     &ITUTV250,                /* 67 Generic ITU-T V.250 */
  4210.     &RWV90,                /* 68 Rockwell V.90 56K */
  4211.     &SUPRAX,                /* 69 Diamond Supra Express V.90 */
  4212.     &LUCENT,                /* 70 Lucent Venus chipset */
  4213.     &PCTEL,                /* 71 PCTel */
  4214.     &CONEXANT,                /* 72 Conexant */
  4215.     &ZOOMV34,                /* 73 Zoom V.34 */
  4216.     &ZOOMV90,                /* 74 Zoom V.90 */
  4217.     &ZOOMV92,                /* 75 Zoom V.92 */
  4218.     &MOTSM56                /* 76 Motorola SM56 chipset */
  4219. #endif /* MINIDIAL */
  4220. };
  4221. /*
  4222.  * Declare modem names and associated numbers for command parsing,
  4223.  * and also for doing number-to-name translation.
  4224.  *
  4225.  * The entries must be in alphabetical order by modem name.
  4226.  */
  4227. struct keytab mdmtab[] = {
  4228. #ifndef MINIDIAL
  4229.     "3com-usr-megahertz-56k", n_USRX2,  CM_INV,
  4230.     "acer-v90",         n_RWV90,        M_ALIAS,
  4231.     "atlas-newcom-33600ifxC", n_ATLAS,  0,
  4232.     "att-1900-stu-iii", n_ATT1900,      0,
  4233.     "att-1910-stu-iii", n_ATT1910,      0,
  4234.     "att-7300",        n_ATTUPC,    0,
  4235.     "att-dataport",    n_DATAPORT,    0,
  4236.     "att-dtdm",        n_ATTDTDM,    0,
  4237.     "att-isn",          n_ATTISN,       0,
  4238.     "att-keepintouch",  n_KEEPINTOUCH,  0,
  4239.     "att-switched-net", n_ATTMODEM,    0,
  4240.  
  4241.     "att7300",        n_ATTUPC,    CM_INV,    /* old name */
  4242.     "attdtdm",        n_ATTDTDM,    CM_INV,    /* old name */
  4243.     "attisn",           n_ATTISN,       CM_INV,    /* old name */
  4244.     "attmodem",        n_ATTMODEM,    CM_INV,    /* old name */
  4245.  
  4246.     "bestdata",         n_BESTDATA,     0,
  4247.     "boca",        n_BOCA,        0,
  4248.     "cardinal",         n_CARDINAL,     0,
  4249. #endif /* MINIDIAL */
  4250.     "ccitt-v25bis",    n_CCITT,    CM_INV, /* Name changed to ITU-T */
  4251. #ifndef MINIDIAL
  4252. #ifdef OLDMODEMS
  4253.     "cermetek",        n_CERMETEK,    M_OLD,
  4254. #endif /* OLDMODEMS */
  4255.     "compaq",           n_COMPAQ,       0,
  4256. #ifdef OLDMODEMS
  4257.     "concord",        n_CONCORD,    M_OLD,
  4258. #endif /* OLDMODEMS */
  4259.     "conexant",         n_CONEXANT,     0,
  4260.     "courier",          n_USR,          CM_INV,
  4261.     "dataport",        n_DATAPORT,    CM_INV,    /* == att-dataport */
  4262. #ifdef OLDMODEMS
  4263.     "df03-ac",        n_DF03,        M_OLD,
  4264.     "df100-series",    n_DF100,    M_OLD,
  4265.     "df200-series",    n_DF200,    M_OLD,
  4266. #endif /* OLDMODEMS */
  4267.     "digitel-dt22",    n_DIGITEL,    0,
  4268. #endif /* MINIDIAL */
  4269.     "direct",        0,        CM_INV,    /* Synonym for NONE */
  4270. #ifndef MINIDIAL
  4271.     "fujitsu",          n_FUJITSU,      0,
  4272.     "gateway-telepath", n_TELEPATH,     0,
  4273. #ifdef OLDMODEMS
  4274.     "gdc-212a/ed",    n_GDC,        M_OLD,
  4275.     "ge",               n_GENERIC,    CM_INV|CM_ABR,
  4276.     "gen",              n_GENERIC,    CM_INV|CM_ABR,
  4277.     "gendatacomm",    n_GDC,        CM_INV,    /* Synonym for GDC */
  4278. #endif /* OLDMODEMS */
  4279. #endif /* MINIDIAL */
  4280.     "gene",             n_GENERIC,      CM_INV|CM_ABR,
  4281.     "generic",          n_GENERIC,      0,
  4282.     "generic-high-speed",n_GENERIC,     CM_INV,
  4283.     "h",            n_HAYES,    CM_INV|CM_ABR,
  4284.     "ha",            n_HAYES,    CM_INV|CM_ABR,
  4285.     "hay",            n_HAYES,    CM_INV|CM_ABR,
  4286.     "haye",            n_HAYES,    CM_INV|CM_ABR,
  4287.     "hayes",        n_HAYES,    CM_INV|CM_ABR, /* Hayes 2400 */
  4288. #ifndef MINIDIAL
  4289.     "hayes-1200",    n_H_1200,    0,
  4290. #endif /* MINIDIAL */
  4291.     "hayes-2400",    n_HAYES,    0,
  4292. #ifndef MINIDIAL
  4293.     "hayes-high-speed", n_H_ACCURA,     0,
  4294.     "hayes-accura",     n_H_ACCURA,     CM_INV,
  4295.     "hayes-optima",     n_H_ACCURA,     CM_INV,
  4296.     "hayes-ultra",    n_H_ULTRA,    CM_INV,
  4297.     "hst-courier",      n_USR,          CM_INV,    /* Synonym for COURIER */
  4298.     "intel",        n_INTEL,        0,
  4299. #endif /* MINIDIAL */
  4300.  
  4301.     "itu-t-v250",       n_ITUTV250,     0,
  4302.     "itu-t-v25bis",    n_CCITT,    0,    /* New name for CCITT */
  4303.     "itu-t-v25ter/v250",n_ITUTV250,     CM_INV,
  4304.  
  4305. #ifndef MINIDIAL
  4306.     "lucent",           n_LUCENT,      0,
  4307.     "maxtech",        n_MAXTECH,     0,
  4308.  
  4309.     "megahertz-att-v34",    n_MHZATT,  0, /* Megahertzes */
  4310.     "megahertz-xjack",      n_XJACK,   CM_INV|CM_ABR,
  4311.     "megahertz-xjack-33.6", n_XJACK,   0,
  4312.     "megahertz-xjack-56k",  n_USRX2,   0, /* 3COM/USR/Megahertz 33.6 PC Card */
  4313.  
  4314.     "mi",        n_MICROCOM,    CM_INV|CM_ABR,
  4315.     "mic",        n_MICROCOM,    CM_INV|CM_ABR,
  4316.     "micr",        n_MICROCOM,    CM_INV|CM_ABR,
  4317.     "micro",        n_MICROCOM,    CM_INV|CM_ABR,
  4318.     "microc",        n_MICROCOM,    CM_INV|CM_ABR,
  4319.     "microco",        n_MICROCOM,    CM_INV|CM_ABR,
  4320.     "microcom",        n_MICROCOM,    CM_INV|CM_ABR,
  4321.     "microcom-at-mode",    n_UCOM_AT,    0, /* Microcom DeskPorte, etc */
  4322.     "microcom-sx-mode",    n_MICROCOM,    0, /* Microcom AX,QX,SX, native mode */
  4323.     "microlink",        n_MICROLINK,    0,
  4324.     "microlink-v250",   n_ULINKV250,    0,
  4325.     "motorola-codex",   n_CODEX,        0,
  4326.     "motorola-fastalk", n_MOTOROLA,    0,
  4327.     "motorola-lifestyle",n_MOTOROLA,    0,
  4328.     "motorola-montana", n_MONTANA,    0,
  4329.     "motorola-sm56-v90",n_MOTSM56,    0,
  4330.     "mt5634zpx",        n_MT5634ZPX,    0,
  4331.     "multitech",    n_MULTI,    0,
  4332.     "mwave",        n_MWAVE,    0,
  4333. #endif /* MINIDIAL */
  4334.     "none",             0,              0,
  4335. #ifndef MINIDIAL
  4336. #ifndef OLDTBCODE
  4337.     "old-telebit",      n_TELEBIT,      0,
  4338. #endif /* OLDTBCODE */
  4339.     "pctel",            n_PCTEL,        0,
  4340. #ifdef OLDMODEMS
  4341.     "penril",        n_PENRIL,    M_OLD,
  4342. #endif /* OLDMODEMS */
  4343.     "ppi",              n_PPI,        0,
  4344. #ifdef OLDMODEMS
  4345.     "racalvadic",    n_RACAL,    M_OLD,
  4346. #endif /* OLDMODEMS */
  4347.     "rockwell-v32",    n_RWV32,    0,
  4348.     "rockwell-v32bis",    n_RWV32B,    0,
  4349.     "rockwell-v34",    n_RWV34,    0,
  4350.     "rockwell-v90",    n_RWV90,    0,
  4351.     "rolm",             n_ROLM,        CM_INV|CM_ABR,
  4352.     "rolm-244pc",       n_ROLMAT,       0,
  4353.     "rolm-600-series",  n_ROLMAT,       0,
  4354.     "rolm-dcm",        n_ROLM,        0,
  4355.     "smartlink-v90",    n_USR,          M_ALIAS,
  4356.     "spirit-ii",        n_SPIRITII,     0,
  4357.     "sportster",        n_USR,          M_ALIAS,
  4358.     "sup",            n_SUPRA,    CM_INV|CM_ABR,
  4359.     "supr",            n_SUPRA,    CM_INV|CM_ABR,
  4360.     "supra",            n_SUPRA,    CM_INV|CM_ABR,
  4361.     "supra-express-v90",n_SUPRAX,       0,
  4362.     "suprafaxmodem",    n_SUPRA,    0,
  4363.     "suprasonic",    n_SUPRASON,    0,
  4364. #ifdef CK_TAPI
  4365.     "tapi",        n_TAPI,        0,
  4366. #endif /* CK_TAPI */
  4367.     "te",               n_TBNEW,        CM_INV|CM_ABR,
  4368.     "tel",              n_TBNEW,        CM_INV|CM_ABR,
  4369.     "telebit",          n_TBNEW,        0,
  4370.     "telepath",         n_TELEPATH,     CM_INV,
  4371. #endif /* MINIDIAL */
  4372.     "unknown",        n_UNKNOWN,    0,
  4373.     "user-defined",     n_UDEF,        0,
  4374. #ifndef MINIDIAL
  4375.  
  4376.     "usr",               n_USR,         CM_INV|CM_ABR,
  4377.     "usr-212a",         n_HAYES,    CM_INV|M_ALIAS,
  4378.     "usr-courier",       n_USR,         CM_INV,
  4379.     "usr-megahertz-56k", n_USRX2,       0,
  4380.     "usr-sportster",     n_USR,         CM_INV,
  4381.     "usr-xj1560-x2",     n_USRX2,       CM_INV,
  4382.     "usrobotics",        n_USR,         0,
  4383.  
  4384.     "v25bis",        n_CCITT,    CM_INV, /* Name changed to ITU-T */
  4385. #ifdef OLDMODEMS
  4386.     "ventel",        n_VENTEL,    M_OLD,
  4387. #endif /* OLDMODEMS */
  4388.     "zoltrix-v34",    n_ZOLTRIX,    0,
  4389.     "zoltrix-hsp-v90",  n_PCTEL,        M_ALIAS,
  4390.     "zoltrix-hcf-v90",  n_ITUTV250,     0,
  4391.     "zoo",        n_ZOOM,        CM_INV|CM_ABR,
  4392.     "zoom",        n_ZOOM,        CM_INV|CM_ABR,
  4393.     "zoom-v32bis",    n_ZOOM,        0,
  4394.     "zoom-v34",        n_ZOOMV34,    0,
  4395.     "zoom-v90",        n_ZOOMV90,    0,
  4396.     "zoom-v92",        n_ZOOMV92,    0,
  4397.     "zyxel",        n_ZYXEL,    0,
  4398. #endif /* MINIDIAL */
  4399.     "",                 0,              0
  4400. };
  4401. int nmdm = (sizeof(mdmtab) / sizeof(struct keytab)) - 1; /* Number of modems */
  4402.  
  4403. #define CONNECTED 1            /* For completion status */
  4404. #define D_FAILED  2
  4405. #define D_PARTIAL 3
  4406.  
  4407. static int tries = 0;
  4408. static int mdmecho = 0;            /* Assume modem does not echo */
  4409.  
  4410. static char *p;                /* For command strings & messages */
  4411.  
  4412. #define LBUFL 200
  4413. static char lbuf[LBUFL+4];
  4414. char modemmsg[LBUFL+4] = { NUL, NUL };    /* DIAL response from modem */
  4415.  
  4416. #ifdef DYNAMIC
  4417. #define RBUFL 256
  4418. static char *rbuf = NULL;
  4419. #else
  4420. #define RBUFL 63
  4421. static char rbuf[RBUFL+1];
  4422. #endif /* DYNAMIC */
  4423.  
  4424. #ifdef DYNAMIC
  4425. #define FULLNUML 256
  4426. char *fbuf = NULL;            /* For full (prefixed) phone number */
  4427. #else
  4428. #define FULLNUML 100
  4429. char fbuf[FULLNUML];
  4430. #endif /* DYNAMIC */
  4431.  
  4432. static ckjmpbuf sjbuf;
  4433.  
  4434. #ifdef CK_ANSIC
  4435. static SIGTYP (*savalrm)(int);    /* For saving alarm handler */
  4436. static SIGTYP (*savint)(int);    /* For saving interrupt handler */
  4437. #else
  4438. static SIGTYP (*savalrm)();    /* For saving alarm handler */
  4439. static SIGTYP (*savint)();    /* For saving interrupt handler */
  4440. #endif /* CK_ANSIC */
  4441.  
  4442. #ifdef CKLOGDIAL
  4443. static VOID
  4444. dologdial(s) char *s; {
  4445.     char buf2[16];
  4446.     char * r = NULL;
  4447.     int x, m, n;
  4448.     extern char cxlogbuf[], uidbuf[], myhost[];
  4449.  
  4450.     if (!s) s = "";
  4451.     if ((x = strlen(s)) > 0) {        /* Replace spaces by underscores */
  4452.     r = (char *)malloc(x+1);
  4453.     if (r) {
  4454.         int i;
  4455.         for (i = 0; i <= x; i++) {
  4456.         if (s[i] != 0 && s[i] <= SP)
  4457.           r[i] = '_';
  4458.         else
  4459.           r[i] = s[i];
  4460.         }
  4461.         s = r;
  4462.     }
  4463.     }
  4464.     p = ckdate();
  4465.     n = ckstrncpy(cxlogbuf,p,CXLOGBUFL);
  4466.     if (!uidbuf[0]) {
  4467.     debug(F100,"dologdial uidbuf empty","",0);
  4468.     ckstrncpy(uidbuf,(char *)whoami(),UIDBUFLEN);
  4469.     }
  4470.     m = strlen(uidbuf)+strlen(myhost)+strlen(ttname)+strlen(s)+strlen(buf2)+32;
  4471.     if (n+m < CXLOGBUFL-1) {
  4472.     p = cxlogbuf+n;
  4473.     if (diallcc && diallac) {
  4474.         buf2[0] = '+';
  4475.         ckmakmsg(&buf2[1],15,diallcc,"(",diallac,")");
  4476.     } else {
  4477.         ckstrncpy(buf2,"Unknown",16);
  4478.     }
  4479.     sprintf(p," %s %s T=DIAL H=%s D=%s N=%s O=%s ",    /* safe (prechecked) */
  4480.         uidbuf,
  4481.         ckgetpid(),
  4482.         myhost,
  4483.         ttname,
  4484.         s,
  4485.         buf2
  4486.         );
  4487.     debug(F110,"dologdial cxlogbuf",cxlogbuf,0);
  4488.     } else
  4489.       sprintf(p,"LOGDIAL BUFFER OVERFLOW");
  4490.     if (r) free(r);
  4491. }
  4492. #endif /* CKLOGDIAL */
  4493.  
  4494. #ifndef MINIDIAL
  4495.  
  4496. #ifdef COMMENT
  4497. static VOID
  4498. xcpy(to,from,len)        /* Copy the given number of bytes */
  4499.     register char *to, *from;
  4500.     register unsigned int len; {
  4501.     while (len--) *to++ = *from++;
  4502. }
  4503. #endif /* COMMENT */
  4504. #endif /* MINIDIAL */
  4505.  
  4506. static SIGTYP
  4507. #ifdef CK_ANSIC
  4508. dialtime(int foo)            /* Timer interrupt handler */
  4509. #else
  4510. dialtime(foo) int foo;            /* Timer interrupt handler */
  4511. #endif /* CK_ANSIC */
  4512. /* dialtime */ {
  4513.  
  4514.     fail_code = F_TIME;            /* Failure reason = timeout */
  4515.     debug(F100,"dialtime caught SIGALRM","",0);
  4516. #ifdef BEBOX
  4517. #ifdef BE_DR_7
  4518.     alarm_expired();
  4519. #endif /* BE_DR_7 */
  4520. #endif /* BEBOX */
  4521. #ifdef OS2
  4522.     signal(SIGALRM, dialtime);
  4523. #endif /* OS2 */
  4524. #ifdef __EMX__
  4525.     signal(SIGALRM, SIG_ACK);        /* Needed for OS/2 */
  4526. #endif /* __EMX__ */
  4527.  
  4528. #ifdef OSK                /* OS-9 */
  4529. /*
  4530.   We are in an intercept routine but do not perform a F$RTE (done implicitly
  4531.   by RTS), so we have to decrement the sigmask as F$RTE does.  Warning:
  4532.   longjump only restores the CPU registers, NOT the FPU registers.  So, don't
  4533.   use FPU at all or at least don't use common FPU (double or float) register
  4534.   variables.
  4535. */
  4536.     sigmask(-1);
  4537. #endif /* OSK */
  4538.  
  4539. #ifdef NTSIG
  4540.     if (foo == SIGALRM)
  4541.       PostAlarmSigSem();
  4542.     else
  4543.       PostCtrlCSem();
  4544. #else /* NTSIG */
  4545. #ifdef NT
  4546.     cklongjmp(ckjaddr(sjbuf),1);
  4547. #else /* NT */
  4548.     cklongjmp(sjbuf,1);
  4549. #endif /* NT */
  4550. #endif /* NTSIG */
  4551.     /* NOTREACHED */
  4552.     SIGRETURN;
  4553. }
  4554.  
  4555. static SIGTYP
  4556. #ifdef CK_ANSIC
  4557. dialint(int foo)            /* Keyboard interrupt handler */
  4558. #else
  4559. dialint(foo) int foo;
  4560. #endif /* CK_ANSIC */
  4561. /* dialint */ {
  4562.     fail_code = F_INT;
  4563.     debug(F100,"dialint caught SIGINT","",0);
  4564. #ifdef OS2
  4565.     signal(SIGINT, dialint);
  4566.     debug(F100,"dialint() SIGINT caught -- dialint restored","",0) ;
  4567. #endif /* OS2 */
  4568. #ifdef __EMX__
  4569.     signal(SIGINT, SIG_ACK);        /* Needed for OS/2 */
  4570. #endif /* __EMX__ */
  4571. #ifdef OSK                /* OS-9, see comment in dialtime() */
  4572.     sigmask(-1);
  4573. #endif /* OSK */
  4574. #ifdef NTSIG
  4575.     PostCtrlCSem() ;
  4576. #ifdef CK_TAPI
  4577.     PostTAPIConnectSem();
  4578.     PostTAPIAnswerSem();
  4579. #endif /* CK_TAPI */
  4580. #else /* NTSIG */
  4581. #ifdef NT
  4582.     cklongjmp(ckjaddr(sjbuf),1);
  4583. #else /* NT */
  4584.     cklongjmp(sjbuf,1);
  4585. #endif /* NT */
  4586. #endif /* NT */
  4587.     SIGRETURN;
  4588. }
  4589.  
  4590. /*
  4591.   Routine to read a character from communication device, handling TELNET
  4592.   protocol negotiations in case we're connected to the modem through a
  4593.   TCP/IP TELNET modem server.
  4594. */
  4595. static int
  4596. ddinc(n) int n; {
  4597. #ifdef TNCODE
  4598.     int c = 0;
  4599.     int done = 0;
  4600.     debug(F101,"ddinc entry n","",n);
  4601.     while (!done) {
  4602.     c = ttinc(n);
  4603.     /* debug(F000,"ddinc","",c); */
  4604.     if (c < 0) return(c);
  4605. #ifndef OS2
  4606.     if ((c == IAC) && network && IS_TELNET()) {
  4607.         switch (tn_doop((CHAR)(c & 0xff),duplex,ttinc)) {
  4608.           case 2: duplex = 0; continue;
  4609.           case 1: duplex = 1;
  4610.           default: continue;
  4611.         }
  4612.     } else done = 1;
  4613. #else /* OS2 */
  4614.     done = !(c == IAC && network && IS_TELNET());
  4615.     scriptwrtbuf(c);    /* TELNET negotiations handled by emulator */
  4616. #endif /* OS2 */
  4617.     }
  4618.     return(c & 0xff);
  4619. #else  /* TNCODE */
  4620.     return(ttinc(n));
  4621. #endif /* TNCODE */
  4622. }
  4623.  
  4624. static VOID
  4625. ttslow(s,millisec) char *s; int millisec; { /* Output s-l-o-w-l-y */
  4626. #ifdef TCPSOCKET
  4627.     extern int tn_nlm, tn_b_nlm;
  4628. #endif /* TCPSOCKET */
  4629.     debug(F111,"ttslow",s,millisec);
  4630.     if (dialdpy && (duplex || !mdmecho)) { /* Echo the command in case modem */
  4631.     printf("%s\n",s);        /* isn't echoing commands. */
  4632. #ifdef OS2
  4633.     {
  4634.         char *s2 = s;        /* Echo to emulator */
  4635.         while (*s2) {
  4636.         scriptwrtbuf((USHORT)*s2++);
  4637.         }
  4638.         scriptwrtbuf((USHORT)CR);
  4639.         scriptwrtbuf((USHORT)LF);
  4640.     }
  4641. #endif /* OS2 */
  4642.     }
  4643.     for (; *s; s++) {
  4644.     ttoc(*s);
  4645. #ifdef TCPSOCKET
  4646.     if (*s == CR && network && IS_TELNET()) {
  4647.         if (!TELOPT_ME(TELOPT_BINARY) && tn_nlm != TNL_CR)
  4648.           ttoc((char)((tn_nlm == TNL_CRLF) ? LF : NUL));
  4649.         else if (TELOPT_ME(TELOPT_BINARY) &&
  4650.              (tn_b_nlm == TNL_CRLF || tn_b_nlm == TNL_CRNUL))
  4651.           ttoc((char)((tn_b_nlm == TNL_CRLF) ? LF : NUL));
  4652.         }
  4653. #endif /* TCPSOCKET */
  4654.     if (millisec > 0)
  4655.       msleep(millisec);
  4656.     }
  4657. }
  4658.  
  4659. /*
  4660.  * Wait for a string of characters.
  4661.  *
  4662.  * The characters are waited for individually, and other characters may
  4663.  * be received "in between".  This merely guarantees that the characters
  4664.  * ARE received, and in the order specified.
  4665.  */
  4666. static VOID
  4667. waitfor(s) char *s; {
  4668.     CHAR c, x;
  4669.     while ((c = *s++)) {        /* while more characters remain... */
  4670.     do {                /* wait for the character */
  4671.         x = (CHAR) (ddinc(0) & 0177);
  4672.         debug(F000,"dial waitfor got","",x);
  4673.         if (dialdpy) {
  4674.         if (x != LF) conoc(x);
  4675.         if (x == CR) conoc(LF);
  4676.         }
  4677.     } while (x != c);
  4678.     }
  4679. }
  4680.  
  4681. static int
  4682. didweget(s,r) char *s, *r; {    /* Looks in string s for response r */
  4683.     int lr = (int)strlen(r);    /*  0 means not found, 1 means found it */
  4684.     int i;
  4685.     debug(F110,"didweget",r,0);
  4686.     debug(F110," in",s,0);
  4687.     for (i = (int)strlen(s)-lr; i >= 0; i--)
  4688.     if ( s[i] == r[0] ) if ( !strncmp(s+i,r,lr) ) return( 1 );
  4689.     return( 0 );
  4690. }
  4691.  
  4692.  
  4693. /* R E S E T -- Reset alarms, etc. on exit. */
  4694.  
  4695. static VOID
  4696. dreset() {
  4697.     debug(F100,"dreset resetting alarm and signal handlers","",0);
  4698.     alarm(0);
  4699.     signal(SIGALRM,savalrm);        /* restore alarm handler */
  4700.     signal(SIGINT,savint);        /* restore interrupt handler */
  4701.     debug(F100,"dreset alarm and signal handlers reset","",0);
  4702. }
  4703.  
  4704. /*
  4705.   Call this routine when the modem reports that it has connected at a certain
  4706.   speed, giving that speed as the argument.  If the connection speed is not
  4707.   the same as Kermit's current communication speed, AND the modem interface
  4708.   speed is not locked (i.e. DIAL SPEED-MATCHING is not ON), then change the
  4709.   device speed to the one given.
  4710. */
  4711. static VOID
  4712. #ifdef CK_ANSIC
  4713. spdchg(long s)
  4714. #else
  4715. spdchg(s) long s;
  4716. #endif /* CK_ANSIC */
  4717. /* spdchg */ {
  4718.     int s2;
  4719.     if (!mdmspd)            /* If modem interface speed locked, */
  4720.       return;                /*  don't do this. */
  4721.     if (speed != s) {            /* Speeds differ? */
  4722.     s2 = s / 10L;            /* Convert to cps expressed as int */
  4723.     if (ttsspd(s2) < 0) {        /* Change speed. */
  4724.         printf(" WARNING - speed change to %ld failed.\r\n",s);
  4725.     } else {
  4726.         printf(" Speed changed to %ld.\r\n",s);
  4727.         speed = s;            /* Update global speed variable */
  4728.     }
  4729.     }
  4730. }
  4731.  
  4732. /*
  4733.   Display all characters received from modem dialer through this routine,
  4734.   for consistent handling of carriage returns and linefeeds.
  4735. */
  4736. static VOID
  4737. #ifdef CK_ANSIC
  4738. dialoc(char c)
  4739. #else
  4740. dialoc(c) char c;
  4741. #endif /* CK_ANSIC */
  4742. { /* dialoc */                /* Dial Output Character */
  4743.     if (dialdpy) {
  4744.     if (c != LF) conoc(c);        /* Don't echo LF */
  4745.     if (c == CR) conoc(LF);        /* Echo CR as CRLF */
  4746.     }
  4747. }
  4748.  
  4749. #ifndef NOSPL
  4750. char *
  4751. getdm(x) int x; {            /* Return dial modifier */
  4752.     MDMINF * mp;
  4753.     int m;
  4754.     int ishayes = 0;
  4755.     m = mdmtyp;
  4756.     if (m < 1)
  4757.       if (mdmsav > -1)
  4758.     m = mdmsav;
  4759.     if (m < 1)
  4760.       return("");
  4761. #ifndef MINIDIAL
  4762.     if (m == n_TAPI)
  4763.       m = n_HAYES;
  4764. #endif /* MINIDIAL */
  4765.     mp = modemp[m];
  4766.     ishayes = (dialcapas ? dialcapas : mp->capas) & CKD_AT;
  4767.     switch (x) {
  4768.       case VN_DM_LP:
  4769.     return(ishayes ? "," : "");
  4770.       case VN_DM_SP:
  4771. #ifdef MINIDIAL
  4772.     return("");
  4773. #else
  4774.     return(m == n_USR ? "/" : "");
  4775. #endif /* MINIDIAL */
  4776.       case VN_DM_PD:
  4777.     return(ishayes ? "P" : "");
  4778.       case VN_DM_TD:
  4779.     return(ishayes ? "T" : "");
  4780.       case VN_DM_WA:
  4781.     return(ishayes ? "@" : "");
  4782.       case VN_DM_WD:
  4783.     return(ishayes ? "W" : "");
  4784.       case VN_DM_RC:
  4785.     return(ishayes ? ";" : "");
  4786.       case VN_DM_HF:
  4787.     return(ishayes ? "!" : "");
  4788.       case VN_DM_WB:
  4789.     return(ishayes ? "$" : "");
  4790.     }
  4791.     return("");
  4792. }
  4793. #endif /* NOSPL */
  4794.  
  4795. static VOID
  4796. getdialmth() {
  4797.     if (dialmauto && diallcc) {        /* If DIAL METHOD AUTO... */
  4798.     int i;                /* and we know our area code... */
  4799.     for (i = 0; i < ndialtocc; i++) { /* First check Tone countries list */
  4800.         if (!strcmp(dialtocc[i],diallcc)) {
  4801.         dialmth = XYDM_T;
  4802.         break;
  4803.         }
  4804.     }
  4805.     for (i = 0; i < ndialpucc; i++) { /* Then Pulse countries list */
  4806.         if (!strcmp(dialpucc[i],diallcc)) {
  4807.         dialmth = XYDM_P;
  4808.         break;
  4809.         }
  4810.     }
  4811.     }
  4812. }
  4813.  
  4814. VOID                /* Get dialing defaults from environment */
  4815. getdialenv() {
  4816.     char *p = NULL;
  4817.     int i, x;
  4818.  
  4819.     makestr(&p,getenv("K_DIAL_DIRECTORY"));
  4820.     if (p) {
  4821.     int i;
  4822.     xwords(p,(MAXDDIR - 2),dialdir,0);
  4823.     for (i = 0; i < (MAXDDIR - 1); i++) {
  4824.         if (!dialdir[i+1])
  4825.           break;
  4826.         else
  4827.           dialdir[i] = dialdir[i+1];
  4828.     }
  4829.     ndialdir = i;
  4830.     }
  4831.     xmakestr(&diallcc,getenv("K_COUNTRYCODE")); /* My country code */
  4832.     xmakestr(&dialixp,getenv("K_LD_PREFIX"));   /* My long-distance prefix */
  4833.     xmakestr(&dialldp,getenv("K_INTL_PREFIX")); /* My international prefix */
  4834.     xmakestr(&dialldp,getenv("K_TF_PREFIX"));   /* Ny Toll-free prefix */
  4835.  
  4836. #ifndef NOICP
  4837.     p = getenv("K_DIAL_METHOD");    /* Local dial method */
  4838.     if (p) if (*p) {
  4839.     extern struct keytab dial_m[];
  4840.     extern int ndial_m;
  4841.     i = lookup(dial_m,p,ndial_m,&x);
  4842.     if (i > -1) {
  4843.         if (i == XYDM_A) {
  4844.         dialmauto = 1;
  4845.         dialmth = XYDM_D;
  4846.         } else {
  4847.         dialmauto = 0;
  4848.         dialmth = i;
  4849.         }
  4850.     }
  4851.     }
  4852. #endif /* NOICP */
  4853.  
  4854.     p = NULL;
  4855.     xmakestr(&p,getenv("K_TF_AREACODE")); /* Toll-free areacodes */
  4856.     if (p) {
  4857.     int i;
  4858.     xwords(p,7,dialtfc,0);
  4859.     for (i = 0; i < 8; i++) {
  4860.         if (!dialtfc[i+1])
  4861.           break;
  4862.         else
  4863.           dialtfc[i] = dialtfc[i+1];
  4864.     }
  4865.     ntollfree = i;
  4866.     free(p);
  4867.     }
  4868.     for (i = 0; i < MAXTPCC; i++) {    /* Clear Tone/Pulse country lists */
  4869.     dialtocc[i] = NULL;
  4870.     dialpucc[i] = NULL;
  4871.     }
  4872.     for (i = 0; i < MAXTPCC; i++) {    /* Init Tone country list */
  4873.     if (tonecc[i])
  4874.       makestr(&(dialtocc[i]),tonecc[i]);
  4875.     else
  4876.       break;
  4877.     }
  4878.     ndialtocc = i;
  4879.     for (i = 0; i < MAXTPCC; i++) {    /* Init Pulse country list */
  4880.     if (pulsecc[i])
  4881.       makestr(&(dialpucc[i]),pulsecc[i]);
  4882.     else
  4883.       break;
  4884.     }
  4885.     ndialpucc = i;
  4886.  
  4887.     if (diallcc) {            /* Have country code */
  4888.     if (!strcmp(diallcc,"1")) {    /* If it's 1 */
  4889.         if (!dialldp)        /* Set these prefixes... */
  4890.           makestr(&dialldp,"1");
  4891.         if (!dialtfp)
  4892.           makestr(&dialtfp,"1");
  4893.         if (!dialixp)
  4894.           makestr(&dialixp,"011");
  4895.         if (ntollfree == 0) {    /* Toll-free area codes */
  4896.         if ((dialtfc[0] = malloc(4))) {
  4897.             ckstrncpy(dialtfc[0],"800",4); /* 1970-something */
  4898.             ntollfree++;
  4899.             if ((dialtfc[1] = malloc(4))) {
  4900.             ckstrncpy(dialtfc[1],"888",4); /* 1996 */
  4901.             ntollfree++;
  4902.             if ((dialtfc[2] = malloc(4))) {
  4903.                 ckstrncpy(dialtfc[2],"877",4); /* 5 April 1998 */
  4904.                 ntollfree++;
  4905.                 if ((dialtfc[3] = malloc(4))) {
  4906.                 ckstrncpy(dialtfc[3],"866",4); /* 2000? */
  4907.                 ntollfree++;
  4908.                 }
  4909.             }
  4910.             }
  4911.         }
  4912.         }
  4913.     } else if (!strcmp(diallcc,"358") &&
  4914.            ((int) strcmp(zzndate(),"19961011") > 0)
  4915.            ) {            /* Finland */
  4916.         if (!dialldp)        /* Long-distance prefix */
  4917.           makestr(&dialldp,"9");
  4918.         if (!dialixp)         /* International dialing prefix */
  4919.           makestr(&dialixp,"990");
  4920.     } else {            /* Not NANP or Finland */
  4921.         if (!dialldp)
  4922.           makestr(&dialldp,"0");
  4923.         if (!dialixp)
  4924.           makestr(&dialixp,"00");
  4925.     }
  4926.     }
  4927.     xmakestr(&diallac,getenv("K_AREACODE"));
  4928.     xmakestr(&dialpxo,getenv("K_PBX_OCP"));
  4929.     xmakestr(&dialpxi,getenv("K_PBX_ICP"));
  4930.     p = getenv("K_PBX_XCH");
  4931. #ifdef COMMENT
  4932.     xmakestr(&dialpxx,p);
  4933. #else
  4934.     if (p) if (*p) {
  4935.     char * s = NULL;
  4936.     char * pp[MAXPBXEXCH+2];
  4937.     makestr(&s,p);            /* Make a copy for poking */
  4938.     if (s) {
  4939.         xwords(s,MAXPBXEXCH+1,pp,0); /* Note: pp[] is 1-based. */
  4940.         for (i = 0; i <= MAXPBXEXCH; i++) {
  4941.                 if (!pp[i+1]) break;
  4942.         makestr(&(dialpxx[i]),pp[i+1]);
  4943.         ndialpxx++;
  4944.         }
  4945.         makestr(&s,NULL);        /* Free poked copy */
  4946.     }
  4947.     }
  4948. #endif /* COMMENT */
  4949. }
  4950.  
  4951. static int
  4952. dialfail(x) int x; {
  4953.     char * s;
  4954.  
  4955.     fail_code = x;
  4956.     debug(F101,"ckudial dialfail","",x);
  4957.     dreset();                /* Reset alarm and signal handlers */
  4958.  
  4959.     printf("%s Failure: ", func_code == 0 ? "DIAL" : "ANSWER");
  4960.     if (dialdpy) {            /* If showing progress */
  4961.        debug(F100,"dial display is on","",0);
  4962.     p = ck_time();            /* get current time; */
  4963.     if (*p) printf("%s: ",p);
  4964.     }
  4965.     switch (fail_code) {        /* Type of failure */
  4966.       case F_TIME:             /* Timeout */
  4967.     if (dial_what == DW_INIT)
  4968.       printf ("Timed out while trying to initialize modem.\n");
  4969.     else if (dial_what == DW_DIAL)
  4970.       printf ("%s interval expired.\n",
  4971.           func_code == 0 ? "DIAL TIMEOUT" : "ANSWER timeout");
  4972.     else
  4973.       printf("Timeout.\n");
  4974.     fflush(stdout);
  4975.     if (mdmcapas & CKD_AT)
  4976.       ttoc('\015');            /* Send CR to interrupt dialing */
  4977.     /* Some Hayes modems don't fail with BUSY on busy lines */
  4978.     dialsta = DIA_TIMO;
  4979.     debug(F110,"dial","timeout",0);
  4980.     break;
  4981.  
  4982.       case F_INT:            /* Dialing interrupted */
  4983.     printf ("Interrupted.\n");
  4984.     fflush(stdout);
  4985. #ifndef NOXFER
  4986.     interrupted = 1;
  4987. #endif /* NOXFER */
  4988.     debug(F111,"dial","interrupted",mdmcapas & CKD_AT);
  4989.     if (mdmcapas & CKD_AT)
  4990.       ttoc('\015');            /* Send CR to interrupt dialing */
  4991.     dialsta = DIA_INTR;
  4992.     break;
  4993.  
  4994.     case F_MODEM:            /* Modem detected a failure */
  4995.          debug(F111,"dialfail()","lbuf",lbuf);
  4996.          if (lbuf && *lbuf) {
  4997.             printf(" \"");
  4998.             for (s = lbuf; *s; s++)
  4999.                if (isprint(*s))
  5000.                   putchar(*s);        /* Display printable reason */
  5001.             printf ("\"");
  5002.          } else printf(func_code == 0 ?
  5003.                         " Call not completed." :
  5004.                         " Call did not come in."
  5005.                         );
  5006.     printf("\n");
  5007.     debug(F110,"dial",lbuf,0);
  5008.     if (dialsta < 0) dialsta = DIA_UNSP;
  5009.     break;
  5010.  
  5011.       case F_MINIT:            /* Failure to initialize modem */
  5012.     printf ("Error initializing modem.\n");
  5013.     debug(F110,"dial","modem init",0);
  5014.     dialsta = DIA_NOIN;
  5015.     break;
  5016.  
  5017.     default:
  5018.     printf("unknown\n");
  5019.     debug(F110,"dial","unknown",0);
  5020.     fflush(stdout);
  5021.     if (mdmcapas & CKD_AT)
  5022.       ttoc('\015');            /* Send CR to interrupt dialing */
  5023.     dialsta = DIA_INTR;
  5024.     }
  5025.  
  5026. #ifdef DYNAMIC
  5027.     if (rbuf) free(rbuf); rbuf = NULL;
  5028.     if (fbuf) free(fbuf); fbuf = NULL;
  5029. #endif /* DYNAMIC */
  5030.  
  5031.     if (dialsta < 0) dialsta = DIA_UERR; /* Set failure code */
  5032.     return(0);                /* Return zero (important) */
  5033. }
  5034.  
  5035. /*  C K D I A L     --  Dial up the remote system */
  5036.  
  5037. /* Returns 1 if call completed, 0 otherwise */
  5038.  
  5039. static int mdmwait, mdmstat = 0;
  5040. #ifndef CK_TAPI
  5041. static
  5042. #endif /* CK_TAPI */
  5043. int waitct;
  5044. int mdmwaitd = 10 ;            /* dialtmo / mdmwait difference */
  5045. static char c;
  5046. static char *telnbr;
  5047.  
  5048. static int wr = 0;            /* wr = wake rate */
  5049. static char * ws;            /* ws = wake string */
  5050. static char * xnum = NULL;
  5051. static int inited = 0;
  5052.  
  5053. static SIGTYP
  5054. #ifdef CK_ANSIC
  5055. _dodial(void * threadinfo)
  5056. #else /* CK_ANSIC */
  5057. _dodial(threadinfo) VOID * threadinfo;
  5058. #endif /* CK_ANSIC */
  5059. /* _dodial */ {
  5060.     char c2;
  5061.     char *dcmd, *s, *flocmd = NULL;
  5062.     int x = 0, n = F_TIME;
  5063.  
  5064. #ifdef NTSIG
  5065.     signal( SIGINT, dialint );
  5066.     if (threadinfo) {            /* Thread local storage... */
  5067.     TlsSetValue(TlsIndex,threadinfo);
  5068.     }
  5069. #endif /* NTSIG */
  5070.  
  5071.     dcmd = dialcmd ? dialcmd : mp->dial_str;
  5072.     if ((int)strlen(dcmd) + (int)strlen(telnbr) > (LBUFL - 2)) {
  5073.     printf("DIAL command + phone number too long!\n");
  5074.     dreset();
  5075. #ifdef DYNAMIC
  5076.     if (rbuf) free(rbuf); rbuf = NULL;
  5077.     if (fbuf) free(fbuf); fbuf = NULL;
  5078. #endif /* DYNAMIC */
  5079. #ifdef NTSIG
  5080.     ckThreadEnd(threadinfo);
  5081. #endif /* NTSIG */
  5082.     SIGRETURN;     /* No conversation with modem to complete dialing */
  5083.     }
  5084.     makestr(&xnum,telnbr);
  5085.  
  5086.     getdialmth();            /* Get dial method */
  5087.  
  5088. #ifdef CK_ATDT
  5089.     /* Combine the SET DIAL METHOD command with the DIAL command string */
  5090.     if (!dialcmd &&            /* Using default DIAL command */
  5091.     (mdmcapas & CKD_AT) &&        /* AT command set only */
  5092.     ((dialmth == XYDM_T && !dialtone) || /* and using default */
  5093.      (dialmth == XYDM_P && !dialpulse))) { /* modem commands... */
  5094.     char c;
  5095.     debug(F110,"dial atdt xnum 1",xnum,0);
  5096.     s = dcmd;
  5097.     debug(F110,"dial atdt s",s,0);
  5098.     if (*telnbr != 'T' &&
  5099.         *telnbr != 'P' &&
  5100.         *telnbr != 't' &&
  5101.         *telnbr != 'p' &&
  5102.         !ckstrcmp(s,"atd",3,0) &&
  5103.         s[3] != 'T' &&
  5104.         s[3] != 'P' &&
  5105.         s[3] != 't' &&
  5106.         s[3] != 'p') {
  5107.         char xbuf[200];
  5108.         c = (dialmth == XYDM_T) ? 'T' : 'P';
  5109.         if (islower(s[0]))
  5110.           c = tolower(c);
  5111.         if ((int)strlen(telnbr) < 199) {
  5112.         sprintf(xbuf,"%c%s",c,telnbr);
  5113.         makestr(&xnum,xbuf);
  5114.         }
  5115.     }
  5116.     }
  5117. #endif /* CK_ATDT */
  5118.     debug(F111,"_dodial",xnum,xredial);
  5119.  
  5120.     /* Hang up the modem (in case it wasn't "on hook") */
  5121.     /* But only if SET DIAL HANGUP ON... */
  5122.  
  5123.     if (!xredial) {            /* Modem not initalized yet. */
  5124.     inited = 0;
  5125.     }
  5126.     if (!xredial || !inited) {
  5127.     if (dialhup() < 0) {        /* Hangup first */
  5128.         debug(F100,"_dodial dialhup failed","",0);
  5129. #ifndef MINIDIAL
  5130.         if (mdmcapas & CKD_TB)    /* Telebits might need a BREAK */
  5131.           ttsndb();            /*  first. */
  5132. #endif /* MINIDIAL */
  5133.         if (dialhng && dialsta != DIA_PART) { /* If hangup failed, */
  5134.         ttclos(0);        /* close and reopen the device. */
  5135.         if (ttopen(ttname,&local,mymdmtyp,0) < 0) {
  5136.             printf("Sorry, Can't hang up communication device.\n");
  5137.             printf("Try 'set line %s' again.\n",ttname);
  5138.             dialsta = DIA_HANG;
  5139. #ifdef DYNAMIC
  5140.             if (rbuf) free(rbuf); rbuf = NULL;
  5141.             if (fbuf) free(fbuf); fbuf = NULL;
  5142. #endif /* DYNAMIC */
  5143.             dreset();
  5144. #ifdef NTSIG
  5145.             ckThreadEnd(threadinfo);
  5146. #endif /* NTSIG */
  5147.             SIGRETURN;
  5148.         }
  5149.         }
  5150.     }
  5151.     inited = 0;            /* We hung up so must reinit */
  5152.     }
  5153. #ifndef MINIDIAL
  5154.     /* Don't start talking to Rolm too soon */
  5155.     if (mymdmtyp == n_ROLM && dialsta != DIA_PART)
  5156.       msleep(500);
  5157. #endif /* MINIDIAL */
  5158.  
  5159.     if (dialsta != DIA_PART        /* Some initial setups. */
  5160. #ifndef MINIDIAL
  5161.     && mymdmtyp != n_ATTUPC
  5162. #endif /* MINIDIAL */
  5163.     ) {
  5164.     fail_code = F_MINIT;        /* Default failure code */
  5165.     dial_what = DW_INIT;        /* What I'm Doing Now   */
  5166.     if (dialdpy) {            /* If showing progress, */
  5167.         p = ck_time();        /* get timestamp.   */
  5168.         if (!inited)
  5169.           if (*p)
  5170.         printf(" Initializing: %s...\n",p);
  5171.     }
  5172.     }
  5173. #ifndef MINIDIAL
  5174. #ifdef ATT7300
  5175.     if (mymdmtyp == n_ATTUPC) {
  5176. /*
  5177.   For ATT7300/Unix PC's with their special internal modem.  Whole dialing
  5178.   process is handled right here, an exception to the normal structure.
  5179.   Timeout and user interrupts are enabled during dialing.  attdial() is in
  5180.   file ckutio.c.  - jrd
  5181. */
  5182.         _PROTOTYP( int attdial, (char *, long, char *) );
  5183.     fail_code = F_MODEM;        /* Default failure code */
  5184.     dial_what = DW_DIAL;
  5185.     if (dialdpy) {            /* If showing progress */
  5186.         p = ck_time();        /* get current time; */
  5187.         if (*p)
  5188.           printf(" Dialing: %s...\n",p);
  5189.     }
  5190.     alarm(waitct);            /* Set alarm */
  5191.     if (attdial(ttname,speed,telnbr)) { /* dial internal modem */
  5192.         dreset();            /* reset alarms, etc. */
  5193.         printf(" Call failed.\r\n");
  5194.         dialhup();                /* Hangup the call */
  5195. #ifdef DYNAMIC
  5196.         if (rbuf) free(rbuf); rbuf = NULL;
  5197.         if (fbuf) free(fbuf); fbuf = NULL;
  5198. #endif /* DYNAMIC */
  5199.         dialsta = DIA_UERR;
  5200. #ifdef NTSIG
  5201.         ckThreadEnd(threadinfo);
  5202. #endif /* NTSIG */
  5203.         SIGRETURN;            /* return failure */
  5204.     }
  5205.     dreset();            /* reset alarms, etc. */
  5206.     ttpkt(speed,FLO_DIAX,parity);    /* cancel dialing ioctl */
  5207.     if (!quiet && !backgrd) {
  5208.         if (dialdpy) {
  5209.         printf("\n");
  5210.         printf(" Call complete.\r\n");
  5211.         } else if (modemmsg[0])
  5212.         printf(" Call complete: \"%s\".\r\n",(char *)modemmsg);
  5213.         else
  5214.           printf(" Call complete.\r\n");
  5215.     }
  5216. #ifdef CKLOGDIAL
  5217.     dologdial(telnbr);
  5218. #endif /* CKLOGDIAL */
  5219.  
  5220.     dialsta = DIA_OK;
  5221. #ifdef DYNAMIC
  5222.     if (rbuf) free(rbuf); rbuf = NULL;
  5223.     if (fbuf) free(fbuf); fbuf = NULL;
  5224. #endif /* DYNAMIC */
  5225. #ifdef NTSIG
  5226.     ckThreadEnd(threadinfo);
  5227. #endif /* NTSIG */
  5228.     SIGRETURN;    /* No conversation with modem to complete dialing */
  5229.     } else
  5230. #endif /* ATT7300 */
  5231. #ifdef CK_TAPI
  5232.       if (tttapi && !tapipass) {    /* TAPI Dialing */
  5233.       switch (func_code) {
  5234.         case 0:            /* Dial */
  5235.           if (cktapidial(telnbr)) {
  5236.           fail_code = 0;
  5237.           if (partial) {
  5238.               dialsta = DIA_PART;
  5239.           } else {
  5240.               dialsta = DIA_OK;
  5241.               speed = ttgspd();
  5242.           }
  5243.           } else {
  5244.           if (dialsta == DIA_PART)
  5245.             cktapihangup();
  5246.           if (!fail_code)
  5247.             fail_code = F_MODEM;
  5248.           dialsta = DIA_TAPI;
  5249.           }
  5250.           break;
  5251.         case 1: {            /* Answer */
  5252.         long strttime = time((long *)NULL);
  5253.         long diff = 0;
  5254.         do {
  5255.             if (dialatmo > 0) {
  5256.             strttime += diff;
  5257.             waitct   -= diff;
  5258.             }
  5259.             fail_code = 0;
  5260.             if (cktapianswer()) { /* SUCCESS */
  5261.             dialsta = DIA_OK;
  5262.             speed = ttgspd();
  5263.             break;
  5264.             } else {        /* FAILURE */
  5265.             if (fail_code) {
  5266.                 dialsta = DIA_TAPI;
  5267.                 break;
  5268.             } else {
  5269.                 fail_code = F_MODEM;
  5270.                 dialsta = DIA_TAPI;
  5271.             }
  5272.             }
  5273.             if (dialatmo > 0) {
  5274.             diff = time((long *)NULL) - strttime;
  5275.             }
  5276.         } while ((dialatmo > 0) ? (diff < waitct) : 1);
  5277.         break;
  5278.         }
  5279.       }
  5280. #ifdef NTSIG
  5281.       ckThreadEnd(threadinfo);
  5282. #endif /* NTSIG */
  5283.       SIGRETURN;
  5284.       } else
  5285. #endif /* CK_TAPI */
  5286. #endif /* MINIDIAL */
  5287.  
  5288. /* Modems with AT command set... */
  5289.  
  5290.       if ((mdmcapas & CKD_AT) && dialsta != DIA_PART) {
  5291.  
  5292.       if (dialpace > -1)        /* Set intercharacter pacing */
  5293.         wr = dialpace;
  5294.       else
  5295.         wr = mp->wake_rate;
  5296.  
  5297.       if (dialini)            /* Get wakeup/init string */
  5298.         ws = dialini;
  5299.       else
  5300.         ws = mp->wake_str;
  5301. #ifdef COMMENT
  5302.       if (!ws) ws = "\015";        /* If none, use CR */
  5303. #endif /* COMMENT */
  5304.  
  5305.       /* First get the modem's attention and enable result codes */
  5306.  
  5307.       for (tries = 0; tries < 5; tries++) { /* Send short command */
  5308.           if (tries > 0) {
  5309.           ttoc('\015');        /* AT must go first for speed */
  5310.           msleep(wr);        /* detection. */
  5311.           }
  5312.           if (mymdmtyp == n_GENERIC) /* Force word result codes */
  5313.         ttslow("ATQ0V1\015",wr); /* for generic modem type */
  5314.           else
  5315.         ttslow("ATQ0\015",wr);
  5316.           mdmstat = getok(tries < 2 ? 2 : tries, 1); /* Get response */
  5317.           if (mdmstat > 0) break;    /* OK - done */
  5318.           if (dialdpy && tries > 0) {
  5319.           printf("\r\n No response from modem");
  5320.           if (tries == 4) {
  5321.               printf(".\r\n");
  5322.               dialsta = DIA_NRSP;
  5323. #ifdef DYNAMIC
  5324.               if (rbuf) free(rbuf); rbuf = NULL;
  5325.               if (fbuf) free(fbuf); fbuf = NULL;
  5326. #endif /* DYNAMIC */
  5327. #ifdef NTSIG
  5328.               ckThreadEnd(threadinfo);
  5329. #endif /* NTSIG */
  5330.               SIGRETURN;    /* return failure */
  5331.           }
  5332.           printf(", retrying%s...\r\n",
  5333.              (tries > 1) ? " again" : "");
  5334.           fflush(stdout);
  5335.           }
  5336.           ttflui();
  5337.           switch (tries) {
  5338.         case 0: msleep(100); break;
  5339.         case 1: ttsndb(); break;
  5340.         default:
  5341.           if (network) {
  5342.               ttsndb();
  5343.           } else {
  5344.               if (tries == 2) {
  5345.               tthang();
  5346.               ttflui();
  5347.               } else {
  5348.               mdmhup();
  5349.               }
  5350.               inited = 0;
  5351.           }
  5352.           }
  5353.           fflush(stdout);
  5354.       }
  5355.       debug(F101,"_dodial ATQ0 mdmstat","",mdmstat);
  5356.  
  5357.       if (xredial && inited) {    /* Redialing... */
  5358.           ttoc('\015');        /* Cancel previous */
  5359.           msleep(250);        /* Wait a bit */
  5360. #ifdef COMMENT
  5361. /* This wasn't the problem... */
  5362.           ttflui();            /* Clear out stuff from modem setup */
  5363.           ttslow("ATS7=60\015",wr);    /* Redo carrier wait */
  5364.           getok(4,1);        /* Get response */
  5365. #endif /* COMMENT */
  5366.           alarm(0);            /* Just in case... */
  5367.           ttflui();            /* Clear out stuff from modem setup */
  5368.           goto REDIAL;        /* Skip setup - we already did it */
  5369.       }
  5370. /*
  5371.   Do flow control next because a long init string echoing back could
  5372.   cause data overruns, causing us to miss the OK, or (worse) to get out
  5373.   of sync entirely.
  5374. */
  5375.       x = 0;            /* User said SET DIAL FLOW RTS/CTS */
  5376.       if (dialfc == FLO_RTSC ||    /* Even if Kermit's FLOW isn't...  */
  5377.           (dialfc == FLO_AUTO && flow == FLO_RTSC)) {
  5378.           if (dialhwfc) {        /* User-defined HWFC string */
  5379.           if (*dialhwfc) {
  5380.               x = 1;
  5381.               flocmd = dialhwfc;
  5382.           }
  5383.           } else if ((mdmcapas & CKD_HW) && *(mp->hwfc_str)) {
  5384.           x = 1;
  5385.           flocmd = mp->hwfc_str;
  5386.           }
  5387.       } else if (dialfc == FLO_XONX || /* User said SET DIAL FLOW SOFT */
  5388.              (dialfc == FLO_AUTO && flow == FLO_XONX)) {
  5389.           if (dialswfc) {
  5390.           if (*dialswfc) {
  5391.               x = 1;
  5392.               flocmd = dialswfc;
  5393.           }
  5394.           } else if ((mdmcapas & CKD_SW) && *(mp->swfc_str)) {
  5395.           x = 1;
  5396.           flocmd = mp->swfc_str;
  5397.           }
  5398.       } else if (dialfc == FLO_NONE) { /* User said SET DIAL FLOW NONE */
  5399.           if (dialnofc) {
  5400.           if (*dialnofc) {
  5401.               x = 1;
  5402.               flocmd = dialnofc;
  5403.           }
  5404.           } else if (mp->nofc_str && *(mp->nofc_str)) {
  5405.           x = 1;
  5406.           flocmd = mp->nofc_str;
  5407.           }
  5408.       }
  5409.       if (x) {            /* Send the flow control command */
  5410.           debug(F110,"_dodial flocmd",flocmd,0);
  5411.           for (tries = 4; tries > 0; tries--) { /* Send the command */
  5412.           ttslow(flocmd,wr);
  5413.           mdmstat = getok(5,1);
  5414.           if (mdmstat > 0) break;
  5415.           if (dialdpy && tries > 1)
  5416.             printf(" No response from modem, retrying%s...\n",
  5417.                (tries < 4) ? " again" : "");
  5418.           }
  5419.  
  5420. #ifdef CK_TTSETFLOW
  5421. #ifdef CK_RTSCTS
  5422. /*
  5423.   So far only ckutio.c has ttsetflow().
  5424.   We have just told the modem to turn on RTS/CTS flow control and the modem
  5425.   has said OK.  But we ourselves have not turned it on yet because of the
  5426.   disgusting ttpkt(...FLO_DIAL...) hack.  So now, if the computer does not
  5427.   happen to be asserting RTS, the modem will no longer send characters to it.
  5428.   So at EXACTLY THIS POINT, we must enable RTS/CTS in the device driver.
  5429. */
  5430.           if (dialfc == FLO_RTSC ||
  5431.           (dialfc == FLO_AUTO && flow == FLO_RTSC)) {
  5432.           ttsetflow(FLO_RTSC);
  5433.           }
  5434. #endif /* CK_RTSCTS */
  5435. #endif /* CK_TTSETFLOW */
  5436.       }
  5437.       ttflui();            /* Clear out stuff from modem setup */
  5438.       msleep(250);
  5439.  
  5440.       if (!ws) goto xdialec;    /* No init string */
  5441.       if (!*ws) goto xdialec;
  5442.  
  5443.       for (tries = 4; tries > 0; tries--) { /* Send init string */
  5444.           ttslow(ws,wr);
  5445.           mdmstat = getok(4,1);    /* Get response */
  5446.           if (mdmstat > 0) break;
  5447.           if (dialdpy && tries > 1)
  5448.         printf(" No response from modem, retrying%s...\n",
  5449.                (tries < 4) ? " again" : "");
  5450.       }
  5451.       debug(F101,"_dodial wake_str mdmstat","",mdmstat);
  5452.  
  5453.       if (mdmstat < 1) {        /* Initialized OK? */
  5454.           dialfail(F_MINIT);    /* No, fail. */
  5455. #ifdef NTSIG
  5456.           ckThreadEnd(threadinfo);
  5457. #endif /* NTSIG */
  5458.           SIGRETURN;
  5459.       }
  5460.  
  5461. #ifndef MINIDIAL
  5462.     } else if (mymdmtyp == n_ATTDTDM && dialsta != DIA_PART) { /* AT&T ... */
  5463.     ttsndb();            /* Send BREAK */
  5464. #endif /* MINIDIAL */
  5465.  
  5466.     } else if (dialsta != DIA_PART) { /* All others */
  5467.  
  5468.     /* Place modem into command mode */
  5469.  
  5470.     ws = dialini ? dialini : mp->wake_str;
  5471.     if (ws && (int)strlen(ws) > 0) {
  5472.         debug(F111,"_dodial default, wake string", ws, wr);
  5473.         ttslow(ws, wr);
  5474.     } else debug(F100,"_dodial no wake_str","",0);
  5475.     if (mp->wake_prompt && (int)strlen(mp->wake_prompt) > 0) {
  5476.         debug(F110,"_dodial default, waiting for wake_prompt",
  5477.           mp->wake_prompt,0);
  5478.         alarm(10);
  5479.         waitfor(mp->wake_prompt);
  5480.         alarm(0);
  5481.     } else debug(F100,"_dodial no wake_prompt","",0);
  5482.     }
  5483.  
  5484. /* Handle error correction, data compression, and flow control... */
  5485.  
  5486.   xdialec:
  5487.  
  5488.     if (dialsta != DIA_PART) {
  5489.     alarm(0);            /* Turn off alarm */
  5490.     debug(F100,"_dodial got wake prompt","",0);
  5491.     msleep(500);            /* Allow settling time */
  5492.  
  5493.     /* Enable/disable error-correction */
  5494.  
  5495.     x = 0;
  5496.     if (dialec) {            /* DIAL ERROR-CORRECTION is ON */
  5497.         if (dialecon) {        /* SET DIAL STRING ERROR-CORRECTION */
  5498.         if (*dialecon) {
  5499.             x = 1;
  5500.             ttslow(dialecon, wr);
  5501.         }
  5502.         } else if ((mdmcapas & CKD_EC) && *(mp->ec_on_str)) {
  5503.         x = 1;
  5504.         ttslow(mp->ec_on_str, wr);
  5505.         }
  5506. #ifdef COMMENT
  5507.         else printf(
  5508.           "WARNING - I don't know how to turn on EC for this modem\n"
  5509.              );
  5510. #endif /* COMMENT */
  5511.     } else {
  5512.         if (dialecoff) {        /* DIAL ERROR-CORRECTION OFF */
  5513.         if (*dialecoff) {
  5514.             x = 1;
  5515.             ttslow(dialecoff, wr);
  5516.         }
  5517.         } else if ((mdmcapas & CKD_EC) && *(mp->ec_off_str)) {
  5518.         x = 1;
  5519.         ttslow(mp->ec_off_str, wr);
  5520.         }
  5521. #ifdef COMMENT
  5522.         else printf(
  5523.           "WARNING - I don't know how to turn off EC for this modem\n"
  5524.              );
  5525. #endif /* COMMENT */
  5526.     }
  5527.     /* debug(F101,"ckudia xx_ok","",xx_ok); */
  5528.     if (x && xx_ok) {            /* Look for OK response */
  5529.         debug(F100,"ckudia calling xx_ok for EC","",0);
  5530.         x = (*xx_ok)(5,1);
  5531.         debug(F101,"ckudia xx_ok","",x);
  5532.         if (x < 0) {
  5533.         printf("WARNING - Trouble enabling error-correction.\n");
  5534.         printf(
  5535. " Likely cause: Your modem is an RPI model, which does not have built-in\n");
  5536.         printf(" error correction and data compression.");
  5537.         }
  5538.     }
  5539.  
  5540.     /* Enable/disable data compression */
  5541.  
  5542.     if (x > 0) x = 0;
  5543.     if (dialdc) {
  5544.         if (x < 0 || !dialec) {
  5545.         printf(
  5546. "WARNING - You can't have compression without error correction.\n");
  5547.         } else if (dialdcon) {    /* SET DIAL STRING ... */
  5548.         if (*dialdcon) {
  5549.             x = 1;
  5550.             ttslow(dialdcon, wr);
  5551.         }
  5552.         } else if ((mdmcapas & CKD_DC) && *(mp->dc_on_str)) {
  5553.         x = 1;
  5554.         ttslow(mp->dc_on_str, wr);
  5555.         }
  5556. #ifdef COMMENT
  5557.         else printf(
  5558.           "WARNING - I don't know how to turn on DC for this modem\n"
  5559.               );
  5560. #endif /* COMMENT */
  5561.     } else {
  5562.         if (dialdcoff) {
  5563.         if (*dialdcoff) {
  5564.             x = 1;
  5565.             ttslow(dialdcoff, wr);
  5566.         }
  5567.         } else if ((mdmcapas & CKD_DC) && *(mp->dc_off_str)) {
  5568.         x = 1;
  5569.         ttslow(mp->dc_off_str, wr);
  5570.         }
  5571. #ifdef COMMENT
  5572.         else printf(
  5573. "WARNING - I don't know how to turn off compression for this modem\n"
  5574.               );
  5575. #endif /* COMMENT */
  5576.     }
  5577.     if (x && xx_ok) {            /* Look for OK response */
  5578.         x = (*xx_ok)(5,1);
  5579.         if (x < 0) printf("WARNING - Trouble enabling compression\n");
  5580.     }
  5581.     }
  5582.  
  5583. #ifndef NOXFER
  5584. #ifndef MINIDIAL
  5585.     if (mdmcapas & CKD_KS && dialsta != DIA_PART) { /* Kermit spoof */
  5586.     int r;                /* Register */
  5587.     char tbcmdbuf[64];        /* Command buffer */
  5588.     switch (mymdmtyp) {
  5589.  
  5590.       case n_MICROCOM:        /* Microcoms in SX mode */
  5591.           if (dialksp)
  5592.           sprintf(tbcmdbuf,"APM1;KMC%d\015",stchr);    /* safe */
  5593.         else
  5594.           sprintf(tbcmdbuf,"APM0\015"); /* safe */
  5595.           ttslow(tbcmdbuf, MICROCOM.wake_rate);
  5596.           alarm(3);
  5597.         waitfor(mp->wake_prompt);
  5598.         alarm(0);
  5599.         break;
  5600.  
  5601.       case n_TELEBIT:        /* Old and new Telebits */
  5602.       case n_TBNEW:
  5603.         if (!dialksp) {
  5604.         sprintf(tbcmdbuf,"ATS111=0\015"); /* safe */
  5605.         } else {
  5606.         switch (parity) {    /* S111 value depends on parity */
  5607.           case 'e': r = 12; break;
  5608.           case 'm': r = 13; break;
  5609.           case 'o': r = 11; break;
  5610.           case 's': r = 14; break;
  5611.           case 0:
  5612.           default:  r = 10; break;
  5613.         }
  5614.         sprintf(tbcmdbuf,"ATS111=%d S112=%d\015",r,stchr); /* safe */
  5615.         }
  5616.         ttslow(tbcmdbuf, wr);
  5617.  
  5618. /* Not all Telebit models have the Kermit spoof, so ignore response. */
  5619.  
  5620.         if (xx_ok) {        /* Get modem's response */
  5621.         x = (*xx_ok)(5,1);
  5622.         }
  5623.     }
  5624.     }
  5625. #endif /* MINIDIAL */
  5626. #endif /* NOXFER */
  5627.  
  5628.     /* Speaker */
  5629.  
  5630.     if (mymdmtyp != n_GENERIC &&
  5631.     (mdmcapas & CKD_AT) && (dialsta != DIA_PART) &&
  5632.     !dialspon && !dialspoff &&
  5633.     !dialvol1 && !dialvol2 &&!dialvol3) {
  5634.     /* AT command set and commands have not been customized */
  5635.     /* so combine speaker and volume commands. */
  5636.     if (mdmspk)
  5637.       sprintf(lbuf,"ATM1L%d%c",mdmvol,13); /* safe */
  5638.     else
  5639.       sprintf(lbuf,"ATM0%c",13);    /* safe */
  5640.     ttslow(lbuf,wr);        /* Send command */
  5641.     getok(5,1);            /* Get but ignore response */
  5642.     } else if (dialsta != DIA_PART) {    /* Customized or not AT commands */
  5643.     x = 0;                /* Do it the hard way */
  5644.     if (mdmspk) {
  5645.         if (dialspon) {
  5646.         if (*dialspon) {
  5647.             x = 1;
  5648.             ttslow(dialspon,wr);
  5649.         }
  5650.         } else {
  5651.                 if (mp->sp_on_str[0]) {
  5652.             x = 1;
  5653.             ttslow(mp->sp_on_str,wr);
  5654.         }
  5655.         }
  5656.     } else {
  5657.         /* s = dialspoff ? dialspoff : mp->sp_off_str; */
  5658.         if (dialspoff) {
  5659.         if (*dialspoff) {
  5660.             x = 1;
  5661.             ttslow(dialspoff,wr);
  5662.         }
  5663.         } else {
  5664.                 if (mp->sp_off_str[0]) {
  5665.             x = 1;
  5666.             ttslow(mp->sp_off_str,wr);
  5667.         }
  5668.         }
  5669.     }
  5670.     if (x) {
  5671.         if (xx_ok)            /* Get response */
  5672.           x = (*xx_ok)(5,1);
  5673.         if (x && mdmspk) {        /* Good response and speaker on? */
  5674.         switch (mdmvol) {    /* Yes, send volume command. */
  5675.           case 0:
  5676.           case 1:
  5677.             s = dialvol1 ? dialvol1 : mp->vol1_str; break;
  5678.           case 2:
  5679.             s = dialvol2 ? dialvol2 : mp->vol2_str; break;
  5680.           case 3:
  5681.             s = dialvol3 ? dialvol3 : mp->vol3_str; break;
  5682.           default:
  5683.             s = NULL;
  5684.         }
  5685.         if (s) if (*s) {    /* Send volume command. */
  5686.             ttslow(s, wr);
  5687.             if (xx_ok)        /* Get response but ignore it */
  5688.               (*xx_ok)(5,1);
  5689.         }
  5690.         }
  5691.     }
  5692.     }
  5693.  
  5694. #ifndef CK_ATDT
  5695.     /* Dialing Method */
  5696.  
  5697.     if (dialmth && dialsta != DIA_PART) { /* If dialing method specified... */
  5698.     char *s = "";            /* Do it here... */
  5699.  
  5700.     if (dialmth == XYDM_T && dialtone) /* Tone */
  5701.       s = dialtone;
  5702.     else if (dialmth == XYDM_P && dialpulse) /* Pulse */
  5703.       s = dialpulse;
  5704.     if (s) if (*s) {
  5705.         ttslow(s, wr);
  5706.         if (xx_ok)            /* Get modem's response */
  5707.           (*xx_ok)(5,1);        /* (but ignore it...) */
  5708.     }
  5709.     }
  5710. #endif /* CK_ATDT */
  5711.  
  5712.     if (dialidt) {            /* Ignore dialtone? */
  5713.     char *s = "";
  5714.     s = dialx3 ? dialx3 : mp->ignoredt;
  5715.     if (s) if (*s) {
  5716.         ttslow(s, wr);
  5717.         if (xx_ok)            /* Get modem's response */
  5718.           (*xx_ok)(5,1);        /* (but ignore it...) */
  5719.     }
  5720.     }
  5721.     {
  5722.     char *s = "";            /* Last-minute init string? */
  5723.     s = dialini2 ? dialini2 : mp->ini2;
  5724.     if (s) if (*s) {
  5725.         ttslow(s, wr);
  5726.         if (xx_ok)            /* Get modem's response */
  5727.           (*xx_ok)(5,1);        /* (but ignore it...) */
  5728.     }
  5729.     }
  5730.     if (func_code == 1) {        /* ANSWER (not DIAL) */
  5731.     char *s;
  5732.     s = dialaaon ? dialaaon : mp->aa_on_str;
  5733.     if (!s) s = "";
  5734.     if (*s) {
  5735.         /* Here we would handle caller ID */
  5736.         ttslow(s, (dialpace > -1) ? wr : mp->dial_rate);
  5737.         if (xx_ok)            /* Get modem's response */
  5738.           (*xx_ok)(5,1);        /* (but ignore it...) */
  5739.     } else {
  5740.         printf(
  5741. "WARNING - I don't know how to enable autoanswer for this modem.\n"
  5742.            );
  5743.     } /* And skip all the phone-number & dialing stuff... */
  5744.     alarm(waitct);            /* This much time allowed. */
  5745.     debug(F101,"_dodial ANSWER waitct","",waitct);
  5746.  
  5747.     } else {                /* DIAL (not ANSWER) */
  5748.  
  5749.     if (dialsta != DIA_PART) {    /* Last dial was not partial */
  5750.  
  5751.         char *s = "";
  5752. #ifdef COMMENT
  5753.         s = dialaaoff ? dialaaoff : mp->aa_off_str;
  5754. #endif /* COMMENT */
  5755.         if (s) if (*s) {
  5756.         ttslow(s, (dialpace > -1) ? wr : mp->dial_rate);
  5757.         if (xx_ok)        /* Get modem's response */
  5758.           (*xx_ok)(5,1);    /* (but ignore it...) */
  5759.         }
  5760.  
  5761.         /* Put modem into dialing mode, if the modem requires it. */
  5762.  
  5763.         if (mp->dmode_str && *(mp->dmode_str)) {
  5764.         ttslow(mp->dmode_str, (dialpace > -1) ? wr : mp->dial_rate);
  5765.         savalrm = signal(SIGALRM,dialtime);
  5766.         alarm(10);
  5767.         /* Wait for prompt, if any expected */
  5768.         if (mp->dmode_prompt && *(mp->dmode_prompt)) {
  5769.             waitfor(mp->dmode_prompt);
  5770.             msleep(300);
  5771.         }
  5772.         alarm(0);        /* Turn off alarm on dialing prompts */
  5773.         signal(SIGALRM,savalrm); /* Restore alarm */
  5774.         }
  5775.     }
  5776.     /* AT-Command-Set non-Generic modem */
  5777.     if (mdmcapas & CKD_AT && mymdmtyp != n_GENERIC &&
  5778.         dialsta != DIA_PART) {
  5779.         if (mdmwait > 255)        /* If larger than maximum, */
  5780.           mdmwait = 255;        /* make it maximum. */
  5781.         if (dialesc > 0 &&        /* Modem escape character is set */
  5782.         dialmhu > 0) {        /* Hangup method is modem command */
  5783.         int x = dialesc;
  5784.         if (dialesc < 0 || dialesc > 127)
  5785.           x = 128;
  5786.         sprintf(lbuf,
  5787.             "ATS2=%dS7=%d\015",
  5788.             dialesc ? x : mp->esc_char, mdmwait); /* safe */
  5789.         } else
  5790.           sprintf(lbuf,"ATS7=%d%c",mdmwait,13); /* safe */
  5791.         ttslow(lbuf,wr);        /* Set it. */
  5792.         mdmstat = getok(5,1);    /* Get response from modem */
  5793.         /* If it gets an error, go ahead anyway */
  5794.         debug(F101,"_dodial S7 mdmstat","",mdmstat);
  5795.     }
  5796.     ttflui();            /* Clear out stuff from modem setup */
  5797.     inited = 1;            /* Remember modem is initialized */
  5798.  
  5799.       REDIAL:
  5800.     if ((int)strlen(dcmd) + (int)strlen(xnum) > LBUFL)
  5801.       ckstrncpy(lbuf,"NUMBER TOO LONG!",LBUFL);
  5802.     else
  5803.       sprintf(lbuf, dcmd, xnum);    /* safe (prechecked) */
  5804.     debug(F110,"dialing",lbuf,0);
  5805.     /* Send the dialing string */
  5806.     ttslow(lbuf,dialpace > -1 ? wr : mp->dial_rate);
  5807.  
  5808.     fail_code = F_MODEM;        /* New default failure code changes */
  5809.     dial_what = DW_DIAL;        /* and our state, too. */
  5810.     if (dialdpy) {            /* If showing progress */
  5811.         p = ck_time();        /* get current time; */
  5812.         if (*p) printf(" Dialing: %s...\n",p);
  5813. #ifdef VMS
  5814.         printf(" \n");
  5815.         fflush(stdout);
  5816. #endif /* VMS */
  5817.     }
  5818.     alarm(waitct);            /* This much time allowed. */
  5819.     debug(F101,"_dodial waitct","",waitct);
  5820.  
  5821. #ifndef MINIDIAL
  5822. #ifdef OLDMODEMS
  5823.     switch (mymdmtyp) {
  5824.       case n_RACAL:            /* Acknowledge dialing string */
  5825.         sleep(3);
  5826.         ttflui();
  5827.         ttoc('\015');
  5828.         break;
  5829.       case n_VENTEL:
  5830.         waitfor("\012\012");    /* Ignore the first two strings */
  5831.         break;
  5832.       default:
  5833.         break;
  5834.     }
  5835. #endif /* OLDMODEMS */
  5836. #endif /* MINIDIAL */
  5837.     }
  5838.  
  5839. /* Check for connection */
  5840.  
  5841.     mdmstat = 0;            /* No status yet */
  5842.     lbuf[0] = NUL;            /* Default reason for failure */
  5843.     debug(F101,"dial awaiting response, mymdmtyp","",mymdmtyp);
  5844.  
  5845. #ifndef NOSPL
  5846.     modemmsg[0] = NUL;
  5847. #endif /* NOSPL */
  5848.     while (mdmstat == 0) {        /* Till we get a result or time out */
  5849.  
  5850.     if ((mdmcapas & CKD_AT) && nonverbal) { /* AT command set */
  5851.         gethrn();            /* In digit result mode */
  5852.         if (partial && dialsta == DIA_ERR) {
  5853.         /*
  5854.            If we get an error here, the phone is still
  5855.            off hook so we have to hang it up.
  5856.         */
  5857.         dialhup();
  5858.         dialsta = DIA_ERR;    /* (because dialhup() changes it) */
  5859.         }
  5860.         continue;
  5861.  
  5862.     } else if (mymdmtyp == n_UNKNOWN) { /* Unknown modem type */
  5863.         int x, y = waitct;
  5864.         mdmstat = D_FAILED;        /* Assume failure. */
  5865.         while (y-- > -1) {
  5866.         x = ttchk();
  5867.         if (x > 0) {
  5868.             if (x > LBUFL) x = LBUFL;
  5869.             x = ttxin(x,(CHAR *)lbuf);
  5870.             if ((x > 0) && dialdpy) conol(lbuf);
  5871.         } else if (network 
  5872. #ifdef TN_COMPORT
  5873.                            && !istncomport()
  5874. #endif /* TN_COMPORT */
  5875.                            && x < 0) { /* Connection dropped */
  5876.             inited = 0;
  5877. #ifdef NTSIG
  5878.             ckThreadEnd(threadinfo);
  5879. #endif /* NTSIG */
  5880.             dialsta = DIA_IO;    /* Call it an I/O error */
  5881. #ifdef DYNAMIC
  5882.             if (rbuf) free(rbuf); rbuf = NULL;
  5883.             if (fbuf) free(fbuf); fbuf = NULL;
  5884. #endif /* DYNAMIC */
  5885.             SIGRETURN;
  5886.         }
  5887.         x = ttgmdm();        /* Try to read modem signals */
  5888.         if (x < 0) break;    /* Can't, fail. */
  5889.         if (x & BM_DCD) {    /* Got signals OK.  Carrier present? */
  5890.             mdmstat = CONNECTED; /* Yes, done. */
  5891.             break;
  5892.         }            /* No, keep waiting. */
  5893.         sleep(1);
  5894.         }
  5895.         continue;
  5896.     }
  5897.  
  5898.     for (n = -1; n < LBUFL-1; ) {    /* Accumulate modem response */
  5899.         int xx;
  5900.         c2 = (char) (xx = ddinc(0)); /* Read a character, blocking */
  5901.         if (xx < 1)            /* Ignore NULs and errors */
  5902.           continue;            /* (Timeout will handle errors) */
  5903.         else            /* Real character, keep it */
  5904.           lbuf[++n] = (char) (c2 & 0177);
  5905.         dialoc(lbuf[n]);        /* Maybe echo it  */
  5906.         if (mdmcapas & CKD_V25) {    /* V.25bis dialing... */
  5907. /*
  5908.   This assumes that V.25bis indications are all at least 3 characters long
  5909.   and are terminated by either CRLF or LFCR.
  5910. */
  5911.         if (mymdmtyp == n_CCITT) {
  5912.             if (n < 3) continue;
  5913.             if ((lbuf[n] == CR) && (lbuf[n-1] == LF)) break;
  5914.             if ((lbuf[n] == LF) && (lbuf[n-1] == CR)) break;
  5915.         }
  5916. #ifndef MINIDIAL
  5917.         else if (mymdmtyp == n_DIGITEL) {
  5918.             if (((lbuf[n] == CR) && (lbuf[n-1] == LF)) ||
  5919.             ((lbuf[n] == LF) && (lbuf[n-1] == CR)))
  5920.               break;
  5921.             else
  5922.               continue;
  5923.         }
  5924. #endif /* MINIDIAL */
  5925.         } else {            /* All others, break on CR or LF */
  5926.         if ( lbuf[n] == CR || lbuf[n] == LF ) break;
  5927.         }
  5928.     }
  5929.     lbuf[++n] = '\0';        /* Terminate response from modem */
  5930.     debug(F111,"_dodial modem response",lbuf,n);
  5931. #ifndef NOSPL
  5932.     ckstrncpy(modemmsg,lbuf,LBUFL);    /* Call result message */
  5933.     lbuf[79] = NUL;
  5934.     {
  5935.         int x;            /* Strip junk from end */
  5936.         x = (int)strlen(modemmsg) - 1;
  5937.         while (x > -1) {
  5938.         if (modemmsg[x] < (char) 33)
  5939.           modemmsg[x] = NUL;
  5940.         else
  5941.           break;
  5942.         x--;
  5943.         }
  5944.     }
  5945. #endif /* NOSPL */
  5946.     if (mdmcapas & CKD_AT) {    /* Hayes AT command set */
  5947.         gethrw();            /* in word result mode */
  5948.         if (partial && dialsta == DIA_ERR) {
  5949.         dialhup();
  5950.         dialsta = DIA_ERR;    /* (because dialhup() changes it) */
  5951.         }
  5952.         continue;
  5953.     } else if (mdmcapas & CKD_V25) { /* CCITT command set */
  5954.         if (didweget(lbuf,"VAL")) { /* Dial command confirmation */
  5955. #ifndef MINIDIAL
  5956.         if (mymdmtyp == n_CCITT)
  5957. #endif /* MINIDIAL */
  5958.           continue;        /* Go back and read more */
  5959. #ifndef MINIDIAL
  5960. /* Digitel doesn't give an explicit connect confirmation message */
  5961.         else {
  5962.             int n;
  5963.             for (n = -1; n < LBUFL-1; ) {
  5964.             lbuf[++n] = c2 = (char) (ddinc(0) & 0177);
  5965.             dialoc(lbuf[n]);
  5966.             if (((lbuf[n] == CR) && (lbuf[n-1] == LF)) ||
  5967.                 ((lbuf[n] == LF) && (lbuf[n-1] == CR)))
  5968.               break;
  5969.             }
  5970.             mdmstat = CONNECTED; /* Assume we're connected */
  5971.             if (dialdpy && carrier != CAR_OFF) {
  5972. #ifdef TN_COMPORT
  5973.                         if (istncomport()) {
  5974.                             int i;
  5975.                             for (i = 0; i < 5; i++) {
  5976.                                 debug(F100,"TN Com Port DCD wait...","",0);
  5977.                                 if ((n = ttgmdm()) >= 0) {
  5978.                                     if ((n & BM_DCD))
  5979.                                         break;
  5980.                                     msleep(500);
  5981.                                     tnc_wait(
  5982.                     (CHAR *)"_dodial waiting for DCD",1);
  5983.                                 }
  5984.                             }
  5985.                         } else
  5986. #endif /* TN_COMPORT */
  5987.               sleep(1);     /* Wait a second */
  5988.             n = ttgmdm();    /* Try to read modem signals */
  5989.             if ((n > -1) && ((n & BM_DCD) == 0))
  5990.               printf("WARNING - no carrier\n");
  5991.             }
  5992.         }
  5993. #endif /* MINIDIAL */
  5994.  
  5995.         /* Standard V.25bis stuff */
  5996.  
  5997.         } else if (didweget(lbuf,"CNX")) { /* Connected */
  5998.         mdmstat = CONNECTED;
  5999.         } else if (didweget(lbuf, "INV")) {
  6000.         mdmstat = D_FAILED;    /* Command error */
  6001.         dialsta = DIA_ERR;
  6002.         ckstrncpy(lbuf,"INV",LBUFL);
  6003.  
  6004.         } else if (didweget(lbuf,"CFI")) { /* Call Failure */
  6005.  
  6006.         if (didweget(lbuf,"AB")) { /* Interpret reason code */
  6007.             ckstrncpy(lbuf,"AB: Timed out",LBUFL);
  6008.             dialsta = DIA_TIMO;
  6009.         } else if (didweget(lbuf,"CB")) {
  6010.             ckstrncpy(lbuf,"CB: Local DCE Busy",LBUFL);
  6011.             dialsta = DIA_NRDY;
  6012.         } else if (didweget(lbuf,"ET")) {
  6013.             ckstrncpy(lbuf,"ET: Busy",LBUFL);
  6014.             dialsta = DIA_BUSY;
  6015.         } else if (didweget(lbuf, "NS")) {
  6016.             ckstrncpy(lbuf,"NS: Number not stored",LBUFL);
  6017.             dialsta = DIA_ERR;
  6018.         } else if (didweget(lbuf,"NT")) {
  6019.             ckstrncpy(lbuf,"NT: No answer",LBUFL);
  6020.             dialsta = DIA_NOAN;
  6021.         } else if (didweget(lbuf,"RT")) {
  6022.             ckstrncpy(lbuf,"RT: Ring tone",LBUFL);
  6023.             dialsta = DIA_RING;
  6024.         } else if (didweget(lbuf,"PV")) {
  6025.             ckstrncpy(lbuf,"PV: Parameter value error",LBUFL);
  6026.             dialsta = DIA_ERR;
  6027.         } else if (didweget(lbuf,"PS")) {
  6028.             ckstrncpy(lbuf,"PS: Parameter syntax error",LBUFL);
  6029.             dialsta = DIA_ERR;
  6030.         } else if (didweget(lbuf,"MS")) {
  6031.             ckstrncpy(lbuf,"MS: Message syntax error",LBUFL);
  6032.             dialsta = DIA_ERR;
  6033.         } else if (didweget(lbuf,"CU")) {
  6034.             ckstrncpy(lbuf,"CU: Command unknown",LBUFL);
  6035.             dialsta = DIA_ERR;
  6036.         } else if (didweget(lbuf,"FC")) {
  6037.             ckstrncpy(lbuf,"FC: Forbidden call",LBUFL);
  6038.             dialsta = DIA_NOAC;
  6039.         }
  6040.         mdmstat = D_FAILED;
  6041.         } else if (didweget(lbuf,"INC")) { /* Incoming Call */
  6042.         ckstrncpy(lbuf,"INC: Incoming call",LBUFL);
  6043.         dialsta = DIA_RING;
  6044.         mdmstat = D_FAILED;
  6045.         } else if (didweget(lbuf,"DLC")) { /* Delayed Call */
  6046.         ckstrncpy(lbuf,"DLC: Delayed call",LBUFL);
  6047.         dialsta = DIA_NOAN;
  6048.         mdmstat = D_FAILED;
  6049.         } else            /* Response was probably an echo. */
  6050. #ifndef MINIDIAL
  6051.           if (mymdmtyp == n_CCITT)
  6052. #endif /* MINIDIAL */
  6053.         continue;
  6054. #ifndef MINIDIAL
  6055.           else            /* Digitel: If no error, connect. */
  6056.         mdmstat = CONNECTED;
  6057. #endif /* MINIDIAL */
  6058.         break;
  6059.  
  6060.     } else if (n) {            /* Non-Hayes-compatibles... */
  6061.         switch (mymdmtyp) {
  6062. #ifndef MINIDIAL
  6063.           case n_ATTMODEM:
  6064.         /* Careful - "Connected" / "Not Connected" */
  6065.         if (didweget(lbuf,"Busy")) {
  6066.             mdmstat = D_FAILED;
  6067.             dialsta = DIA_BUSY;
  6068.         } else if (didweget(lbuf,"Not connected") ||
  6069.                didweget(lbuf,"Not Connected")) {
  6070.             mdmstat = D_FAILED;
  6071.             dialsta = DIA_NOCA;
  6072.         } else if (didweget(lbuf,"No dial tone") ||
  6073.                didweget(lbuf,"No Dial Tone")) {
  6074.             mdmstat = D_FAILED;
  6075.             dialsta = DIA_NODT;
  6076.         } else if (didweget(lbuf,"No answer") ||
  6077.                didweget(lbuf,"No Answer")) {
  6078.             mdmstat = D_FAILED;
  6079.             dialsta = DIA_NOAN;
  6080.         } else if (didweget(lbuf,"Answered") ||
  6081.                didweget(lbuf,"Connected")) {
  6082.             mdmstat = CONNECTED;
  6083.             dialsta = DIA_OK;
  6084.         }
  6085.         break;
  6086.  
  6087.           case n_ATTISN:
  6088.         if (didweget(lbuf,"ANSWERED")) {
  6089.             mdmstat = CONNECTED;
  6090.             dialsta = DIA_OK;
  6091.         } else if (didweget(lbuf,"BUSY")) {
  6092.             mdmstat = D_FAILED;
  6093.             dialsta = DIA_BUSY;
  6094.         } else if (didweget(lbuf,"DISCONNECT")) {
  6095.             mdmstat = D_FAILED;
  6096.             dialsta = DIA_DISC;
  6097.         } else if (didweget(lbuf,"NO ANSWER")) {
  6098.             mdmstat = D_FAILED;
  6099.             dialsta = DIA_NOAN;
  6100.         } else if (didweget(lbuf,"WRONG ADDRESS")) {
  6101.             mdmstat = D_FAILED;
  6102.             dialsta = DIA_NOAC;
  6103.         }
  6104.         break;
  6105.  
  6106.           case n_ATTDTDM:
  6107.         if (didweget(lbuf,"ANSWERED")) {
  6108.             mdmstat = CONNECTED;
  6109.         } else if (didweget(lbuf,"BUSY")) {
  6110.             mdmstat = D_FAILED;
  6111.             dialsta = DIA_BUSY;
  6112.         } else if (didweget(lbuf,"CHECK OPTIONS")) {
  6113.             mdmstat = D_FAILED;
  6114.             dialsta = DIA_ERR;
  6115.         } else if (didweget(lbuf,"DISCONNECTED")) {
  6116.             mdmstat = D_FAILED;
  6117.             dialsta = DIA_DISC;
  6118.         } else if (didweget(lbuf,"DENIED")) {
  6119.             mdmstat = D_FAILED;
  6120.             dialsta = DIA_NOAC;
  6121.         }
  6122. #ifdef DEBUG
  6123. #ifdef ATT6300
  6124.         /* Horrible hack lost in history. */
  6125.         else if (deblog && didweget(lbuf,"~~"))
  6126.           mdmstat = CONNECTED;
  6127. #endif /* ATT6300 */
  6128. #endif /* DEBUG */
  6129.         break;
  6130.  
  6131. #ifdef OLDMODEMS
  6132.           case n_CERMETEK:
  6133.         if (didweget(lbuf,"\016A")) {
  6134.             mdmstat = CONNECTED;
  6135.             ttslow("\016U 1\015",200); /* Make transparent*/
  6136.         }
  6137.         break;
  6138.  
  6139.           case n_DF03:
  6140.         /* Because response lacks CR or NL . . . */
  6141.         c = (char) (ddinc(0) & 0177);
  6142.         dialoc(c);
  6143.         debug(F000,"dial df03 got","",c);
  6144.         if ( c == 'A' ) mdmstat = CONNECTED;
  6145.         if ( c == 'B' ) mdmstat = D_FAILED;
  6146.         break;
  6147.  
  6148.           case n_DF100:         /* DF100 has short response codes */
  6149.         if (strcmp(lbuf,"A") == 0) {
  6150.             mdmstat = CONNECTED; /* Attached */
  6151.             dialsta = DIA_OK;
  6152.         } else if (strcmp(lbuf,"N") == 0) {
  6153.             mdmstat = D_FAILED;
  6154.             dialsta = DIA_NOAN; /* No answer or no dialtone */
  6155.         } else if (strcmp(lbuf,"E") == 0 || /* Error */
  6156.                strcmp(lbuf,"R") == 0) { /* "Ready" (?) */
  6157.             mdmstat = D_FAILED;
  6158.             dialsta = DIA_ERR;    /* Command error */
  6159.         }
  6160.         /* otherwise fall thru... */
  6161.  
  6162.           case n_DF200:
  6163.         if (didweget(lbuf,"Attached")) {
  6164.             mdmstat = CONNECTED;
  6165.             dialsta = DIA_OK;
  6166.             /*
  6167.              * The DF100 will respond with "Attached" even if DTR
  6168.              * and/or carrier are not present.    Another reason to
  6169.              * (also) wait for carrier?
  6170.              */
  6171.         } else if (didweget(lbuf,"Busy")) {
  6172.             mdmstat = D_FAILED;
  6173.             dialsta = DIA_BUSY;
  6174.         } else if (didweget(lbuf,"Disconnected")) {
  6175.             mdmstat = D_FAILED;
  6176.             dialsta = DIA_DISC;
  6177.         } else if (didweget(lbuf,"Error")) {
  6178.             mdmstat = D_FAILED;
  6179.             dialsta = DIA_ERR;
  6180.         } else if (didweget(lbuf,"No answer")) {
  6181.             mdmstat = D_FAILED;
  6182.             dialsta = DIA_NOAN;
  6183.         } else if (didweget(lbuf,"No dial tone")) {
  6184.             mdmstat = D_FAILED;
  6185.             dialsta = DIA_NODT;
  6186.         } else if (didweget(lbuf,"Speed:)")) {
  6187.             mdmstat = D_FAILED;
  6188.             dialsta = DIA_ERR;
  6189.         }
  6190.         /*
  6191.          * It appears that the "Speed:..." response comes after an
  6192.          * "Attached" response, so this is never seen.  HOWEVER,
  6193.          * it would be very handy to detect this and temporarily
  6194.          * reset the speed, since it's a nuisance otherwise.
  6195.          * If we wait for some more input from the modem, how do
  6196.          * we know if it's from the remote host or the modem?
  6197.          * Carrier reportedly doesn't get set until after the
  6198.          * "Speed:..." response (if any) is sent.  Another reason
  6199.          * to (also) wait for carrier.
  6200.          */
  6201.         break;
  6202.  
  6203.           case n_GDC:
  6204.         if (didweget(lbuf,"ON LINE"))
  6205.           mdmstat = CONNECTED;
  6206.         else if (didweget(lbuf,"NO CONNECT"))
  6207.           mdmstat = D_FAILED;
  6208.         break;
  6209.  
  6210.           case n_PENRIL:
  6211.         if (didweget(lbuf,"OK")) {
  6212.             mdmstat = CONNECTED;
  6213.         } else if (didweget(lbuf,"BUSY")) {
  6214.             mdmstat = D_FAILED;
  6215.             dialsta = DIA_BUSY;
  6216.             } else if (didweget(lbuf,"NO RING")) {
  6217.             mdmstat = D_FAILED;
  6218.             dialsta = DIA_NOCA;
  6219.             }
  6220.         break;
  6221.  
  6222.           case n_RACAL:
  6223.         if (didweget(lbuf,"ON LINE"))
  6224.           mdmstat = CONNECTED;
  6225.         else if (didweget(lbuf,"FAILED CALL"))
  6226.           mdmstat = D_FAILED;
  6227.         break;
  6228. #endif /* OLDMODEMS */
  6229.  
  6230.           case n_ROLM:
  6231.         if (didweget(lbuf,"CALLING"))
  6232.           mdmstat = 0;
  6233.         else if (didweget(lbuf,"COMPLETE"))
  6234.           mdmstat = CONNECTED;
  6235.         else if (didweget(lbuf,"FAILED") ||
  6236.              didweget(lbuf,"ABANDONDED")) {
  6237.             mdmstat = D_FAILED;
  6238.             dialsta = DIA_NOCA;
  6239.         } else if (didweget(lbuf,"NOT AVAILABLE") ||
  6240.                didweget(lbuf,"LACKS PERMISSION") ||
  6241.                didweget(lbuf,"NOT A DATALINE") ||
  6242.                didweget(lbuf,"INVALID DATA LINE NUMBER") ||
  6243.                didweget(lbuf,"INVALID GROUP NAME")) {
  6244.             mdmstat = D_FAILED;
  6245.             dialsta = DIA_NOAC;
  6246.         } else if (didweget(lbuf,"BUSY")) {
  6247.             mdmstat = D_FAILED;
  6248.             dialsta = DIA_BUSY;
  6249.         } else if (didweget(lbuf,"DOES NOT ANSWER")) {
  6250.             mdmstat = D_FAILED;
  6251.             dialsta = DIA_NOAN;
  6252.         }
  6253.         break;
  6254.  
  6255. #ifdef OLDMODEMS
  6256.           case n_VENTEL:
  6257.         if (didweget(lbuf,"ONLINE!") ||
  6258.             didweget(lbuf,"Online!")) {
  6259.             mdmstat = CONNECTED;
  6260.         } else if (didweget(lbuf,"BUSY") ||
  6261.                didweget(lbuf,"Busy")) {
  6262.             mdmstat = D_FAILED;
  6263.             dialsta = DIA_BUSY;
  6264.         } else if (didweget(lbuf,"DEAD PHONE")) {
  6265.             mdmstat = D_FAILED;
  6266.             dialsta = DIA_DISC;
  6267.         }
  6268.         break;
  6269.  
  6270.           case n_CONCORD:
  6271.         if (didweget(lbuf,"INITIATING"))
  6272.           mdmstat = CONNECTED;
  6273.         else if (didweget(lbuf,"BUSY")) {
  6274.             mdmstat = D_FAILED;
  6275.             dialsta = DIA_BUSY;
  6276.         } else if (didweget(lbuf,"CALL FAILED")) {
  6277.             mdmstat = D_FAILED;
  6278.             dialsta = DIA_NOCA;
  6279.         }
  6280.         break;
  6281. #endif /* OLDMODEMS */
  6282.  
  6283.           case n_MICROCOM:
  6284.         /* "RINGBACK" means phone line ringing, continue */
  6285.         if (didweget(lbuf,"NO CONNECT")) {
  6286.             mdmstat = D_FAILED;
  6287.             dialsta = DIA_NOCA;
  6288.         } else if (didweget(lbuf,"BUSY")) {
  6289.             mdmstat = D_FAILED;
  6290.             dialsta = DIA_BUSY;
  6291.         } else if (didweget(lbuf,"NO DIALTONE")) {
  6292.             mdmstat = D_FAILED;
  6293.             dialsta = DIA_NODT;
  6294.         } else if (didweget(lbuf,"COMMAND ERROR")) {
  6295.             mdmstat = D_FAILED;
  6296.             dialsta = DIA_ERR;
  6297.         } else if (didweget(lbuf,"IN USE")) {
  6298.             mdmstat = D_FAILED;
  6299.             dialsta = DIA_NOAC;
  6300.         } else if (didweget(lbuf,"CONNECT")) {
  6301.             mdmstat = CONNECTED;
  6302.             /* trailing speed ignored */
  6303.         }
  6304.         break;
  6305.  
  6306. #endif /* MINIDIAL */
  6307.           default:
  6308.         printf(
  6309.             "PROGRAM ERROR - No response handler for modem type %d\n",
  6310.                mymdmtyp);
  6311.         mdmstat = D_FAILED;
  6312.         dialsta = DIA_ERR;
  6313.         }
  6314.     }
  6315.     } /* while (mdmstat == 0) */
  6316.  
  6317.     debug(F101,"_dodial alarm off","",x);
  6318.     alarm(0);
  6319.     if (mdmstat == D_FAILED) {        /* Failure detected by modem  */
  6320.         dialfail(F_MODEM);
  6321. #ifdef NTSIG
  6322.     ckThreadEnd(threadinfo);
  6323. #endif /* NTSIG */
  6324.         SIGRETURN;
  6325.     } else if (mdmstat == D_PARTIAL )    { /* Partial dial command OK */
  6326.     msleep(500);
  6327.     debug(F100,"dial partial","",0);
  6328.     } else {                /* Call was completed */
  6329.     int x;
  6330.     msleep(700);            /* In case modem signals blink  */
  6331.     debug(F100,"dial succeeded","",0);
  6332.     if (
  6333. #ifndef MINIDIAL
  6334.         mymdmtyp != n_ROLM        /* Rolm has weird modem signaling */
  6335. #else
  6336.         1
  6337. #endif /* MINIDIAL */
  6338.         ) {
  6339.         alarm(3);            /* In case ttpkt() gets stuck... */
  6340.         ttpkt(speed,FLO_DIAX,parity); /* Cancel dialing state ioctl */
  6341.             alarm(0);
  6342.     }
  6343. /*
  6344.   In case CD went off in the interval between call completion and return
  6345.   from ttpkt()...
  6346. */
  6347.     if (carrier != CAR_OFF) {
  6348.             if ((x = ttgmdm()) >= 0) {
  6349. #ifdef TN_COMPORT
  6350.                 if (istncomport() && !(x & BM_DCD)) {
  6351.                     int i;
  6352.                     for (i = 0; i < 5; i++) {
  6353.                         msleep(500);
  6354.                         tnc_wait((CHAR *)"_dodial waiting for DCD",1);
  6355.                         if ((x = ttgmdm()) >= 0) {
  6356.                             if ((x & BM_DCD))
  6357.                                 break;
  6358.                         }
  6359.                     }
  6360.                 }
  6361. #endif /* TN_COMPORT */
  6362.                 if (!(x & BM_DCD))
  6363.           printf("WARNING: Carrier seems to have dropped...\n");
  6364.             }
  6365.         }
  6366.     }
  6367.     dreset();                /* Reset alarms and signals. */
  6368.     if (!quiet && !backgrd) {
  6369.     if (dialdpy && (p = ck_time())) { /* If DIAL DISPLAY ON, */
  6370.         printf(" %sall complete: %s.\n", /* include timestamp.  */
  6371.            (mdmstat == D_PARTIAL) ?
  6372.            "Partial c" :
  6373.            "C",
  6374.            p );
  6375.     } else if (modemmsg[0]) {
  6376.         printf (" %sall complete: \"%s\".\n",
  6377.             (mdmstat == D_PARTIAL) ? "Partial c" : "C",
  6378.             (char *)modemmsg
  6379.             );
  6380.     } else {
  6381.         printf (" %sall complete.\n",
  6382.             (mdmstat == D_PARTIAL) ?
  6383.             "Partial c" :
  6384.             "C"
  6385.             );
  6386.     }
  6387.     }
  6388. #ifdef CKLOGDIAL
  6389.     dologdial(telnbr);
  6390. #endif /* CKLOGDIAL */
  6391.  
  6392. #ifdef DYNAMIC
  6393.     if (rbuf) free(rbuf); rbuf = NULL;
  6394.     if (fbuf) free(fbuf); fbuf = NULL;
  6395. #endif /* DYNAMIC */
  6396.     dialsta = (mdmstat == D_PARTIAL) ? DIA_PART : DIA_OK;
  6397. #ifdef NTSIG
  6398.     ckThreadEnd(threadinfo);
  6399. #endif /* NTSIG */
  6400.     SIGRETURN;
  6401. }
  6402.  
  6403. static SIGTYP
  6404. #ifdef CK_ANSIC
  6405. faildial(void * threadinfo)
  6406. #else /* Not CK_ANSIC */
  6407. faildial(threadinfo) VOID * threadinfo;
  6408. #endif /* CK_ANSIC */
  6409. /* faildial */ {
  6410.     debug(F100,"longjmp returns to dial routine","",0);
  6411.     dialfail(fail_code);
  6412.     SIGRETURN;
  6413. }
  6414.  
  6415. /*
  6416.   nbr = number to dial (string)
  6417.   x1  = Retry counter
  6418.   x2  = Number counter
  6419.   fc  = Function code:
  6420.         0 == DIAL
  6421.         1 == ANSWER
  6422.         2 == INIT/CONFIG
  6423.         3 == PARTIAL DIAL
  6424. */
  6425.  
  6426. int
  6427. #ifdef OLD_DIAL
  6428. ckdial(nbr) char *nbr;
  6429. #else
  6430. ckdial(nbr, x1, x2, fc, redial) char *nbr; int x1, x2, fc, redial;
  6431. #endif /* OLD_DIAL */
  6432. /* ckdial */ {
  6433. #define ERMSGL 50
  6434.     char errmsg[ERMSGL], *erp;        /* For error messages */
  6435.     int n = F_TIME;
  6436.     char *s;
  6437.     long spdmax;
  6438. #ifdef OS2
  6439.     extern int term_io;
  6440.     int term_io_sav = term_io;
  6441. #endif /* OS2 */
  6442.  
  6443.     char *mmsg = "Sorry, DIAL memory buffer can't be allocated\n";
  6444.     /*
  6445.       A DIAL command implies a SET MODEM TYPE command and therefore enables
  6446.       hanging up by modem commands rather than dropping DTR.
  6447.     */
  6448.     mdmset = 1;                /* See mdmhup() */
  6449.  
  6450.     partial = 0;
  6451.     if (fc == 3) {            /* Partial dial requested */
  6452.     partial = 1;            /* Set flag */
  6453.     fc = 0;                /* Treat like regular dialing */
  6454.     }
  6455.     func_code = fc;            /* Make global to this module */
  6456.     telnbr = nbr;
  6457.     xredial = redial;
  6458.     debug(F111,"ckdial entry partial",ckitoa(fc),partial);
  6459.     debug(F111,"ckdial entry number",nbr,redial);
  6460.  
  6461.     if (fc == 1) {            /* ANSWER command? */
  6462.     /* Reset caller ID strings */
  6463.     if (callid_date) makestr(&callid_date,NULL);
  6464.     if (callid_time) makestr(&callid_time,NULL);
  6465.     if (callid_name) makestr(&callid_name,NULL);
  6466.     if (callid_nmbr) makestr(&callid_nmbr,NULL);
  6467.     if (callid_mesg) makestr(&callid_mesg,NULL);
  6468.     }
  6469.  
  6470. #ifdef CK_TAPI_X
  6471.     if (tttapi && tapipass) {
  6472.     if (modemp[n_TAPI] = cktapiGetModemInf()) {
  6473.         mymdmtyp = n_TAPI;
  6474.     } else {
  6475.         mymdmtyp = mdmtyp;
  6476.         modemp[n_TAPI] = &GENERIC;
  6477.     }
  6478.     } else
  6479. #endif /* CK_TAPI */
  6480.     mymdmtyp = mdmtyp;
  6481.     if (mymdmtyp < 0) {            /* Whoa, network dialing... */
  6482.     if (mdmsav > -1)
  6483.       mymdmtyp = mdmsav;
  6484.     }
  6485.     if (mymdmtyp < 0) {
  6486.     printf("Invalid modem type %d - internal error.\n",mymdmtyp);
  6487.     dialsta = DIA_NOMO;
  6488.     return(0);
  6489.     }
  6490.     dial_what = DW_NOTHING;        /* Doing nothing at first. */
  6491.     nonverbal = 0;
  6492.  
  6493. /* These are ONLY for the purpose of interpreting numeric result codes. */
  6494.  
  6495.     is_motorola =
  6496. #ifdef MINIDIAL
  6497.       0
  6498. #else
  6499.       mymdmtyp == n_SUPRA || mymdmtyp == n_SUPRASON;
  6500. #endif /* MINIDIAL */
  6501.     ;
  6502.  
  6503.     is_motorola =
  6504. #ifdef MINIDIAL
  6505.       0
  6506. #else
  6507.       mymdmtyp == n_MOTOROLA || mymdmtyp == n_MONTANA;
  6508. #endif /* MINIDIAL */
  6509.     ;
  6510.  
  6511.     is_rockwell =
  6512. #ifdef MINIDIAL
  6513.       0
  6514. #else
  6515.       mymdmtyp == n_RWV32 || mymdmtyp == n_RWV32B ||
  6516.     mymdmtyp == n_RWV34 || mymdmtyp == n_RWV90 ||
  6517.       mymdmtyp == n_BOCA || mymdmtyp == n_TELEPATH ||
  6518.         mymdmtyp == n_CARDINAL || mymdmtyp == n_BESTDATA ||
  6519.           mymdmtyp == n_CONEXANT || mymdmtyp == n_PCTEL
  6520. #endif /* MINIDIAL */
  6521.     ;
  6522.  
  6523.     is_hayeshispd =
  6524. #ifdef MINIDIAL
  6525.       0
  6526. #else
  6527.       mymdmtyp == n_H_ULTRA || mymdmtyp == n_H_ACCURA || n_PPI
  6528. #endif /* MINIDIAL */
  6529.     ;
  6530.  
  6531.     is_supra =
  6532. #ifdef MINIDIAL
  6533.       0
  6534. #else
  6535.       mymdmtyp == n_SUPRA || mymdmtyp == n_SUPRAX || n_SUPRASON
  6536. #endif /* MINIDIAL */
  6537.     ;
  6538.  
  6539.     mp = modemp[mymdmtyp];        /* Set pointer to modem info */
  6540.     if (!mp) {
  6541.     printf("Sorry, handler for this modem type not yet filled in.\n");
  6542.     dialsta = DIA_NOMO;
  6543.     return 0;
  6544.     }
  6545.     debug(F110,"dial number",telnbr,0);
  6546. #ifdef COMMENT
  6547.     debug(F110,"dial prefix",(dialnpr ? dialnpr : ""), 0);
  6548. #endif /* COMMENT */
  6549.  
  6550. #ifdef DYNAMIC
  6551.     *lbuf = NUL;
  6552.     debug(F101,"DIAL lbuf malloc ok","",LBUFL+1);
  6553.  
  6554.     if (!rbuf) {    /* This one might already have been allocated by getok() */
  6555.     if (!(rbuf = malloc(RBUFL+1))) {    /* Allocate input line buffer */
  6556.         printf("%s", mmsg);
  6557.         dialsta = DIA_IE;
  6558.         return 0;
  6559.     } else
  6560.       debug(F101,"DIAL rbuf malloc ok","",RBUFL+1);
  6561.     }
  6562.     if (!(fbuf = malloc(FULLNUML+1))) {    /* Allocate input line buffer */
  6563.     printf("%s", mmsg);
  6564.     dialsta = DIA_IE;
  6565.     if (rbuf) free(rbuf); rbuf = NULL;
  6566.     return 0;
  6567.     }
  6568.     debug(F101,"DIAL fbuf malloc ok","",FULLNUML+1);
  6569. #endif /* DYNAMIC */
  6570.  
  6571.     /* NOTE: mdmtyp, not mymdmtyp */
  6572.  
  6573.     if (ttopen(ttname,&local,mdmtyp,0) < 0) { /* Open, no carrier wait */
  6574.     erp = errmsg;
  6575.     if ((int)strlen(ttname) < (ERMSGL - 18)) /* safe, checked */
  6576.       sprintf(erp,"Sorry, can't open %s",ttname);
  6577.     else
  6578.       sprintf(erp,"Sorry, can't open device");
  6579.     perror(errmsg);
  6580.     dialsta = DIA_OPEN;
  6581. #ifdef DYNAMIC
  6582.     if (rbuf) free(rbuf); rbuf = NULL;
  6583.     if (fbuf) free(fbuf); fbuf = NULL;
  6584. #endif /* DYNAMIC */
  6585.     return 0;
  6586.     }
  6587.  
  6588. #ifdef CK_TAPI
  6589.     if (!tttapi) {
  6590. #endif /* CK_TAPI */
  6591.  
  6592. /* Condition console terminal and communication line */
  6593.  
  6594.     /* Place line into "clocal" dialing state, */
  6595.     /* important mainly for System V UNIX.     */
  6596.  
  6597.     if (ttpkt(speed,FLO_DIAL,parity) < 0) {
  6598.     ttclos(0);            /* If ttpkt fails do all this... */
  6599.     if (ttopen(ttname,&local,mymdmtyp,0) < 0) {
  6600.         erp = errmsg;
  6601.         if ((int)strlen(ttname) < (ERMSGL - 18)) /* safe, checked */
  6602.           sprintf(erp,"Sorry, can't reopen %s",ttname);
  6603.         else
  6604.           sprintf(erp,"Sorry, can't reopen device");
  6605.         perror(errmsg);
  6606.         dialsta = DIA_OPEN;
  6607. #ifdef DYNAMIC
  6608.         if (rbuf) free(rbuf); rbuf = NULL;
  6609.         if (fbuf) free(fbuf); fbuf = NULL;
  6610. #endif /* DYNAMIC */
  6611.         return 0;
  6612.     }                /* And try again. */
  6613.     if ((ttpkt(speed,FLO_DIAL,parity) < 0)
  6614. #ifdef UNIX
  6615.     && (strcmp(ttname,"/dev/null"))
  6616. #else
  6617. #ifdef OSK
  6618.     && (strcmp(ttname,"/nil"))
  6619. #endif /* OSK */
  6620. #endif /* UNIX */
  6621. #ifdef CK_TAPI
  6622.          && !tttapi
  6623. #endif /* CK_TAPI */
  6624.         ) {
  6625.         printf("Sorry, Can't condition communication line\n");
  6626.         printf("Try 'set line %s' again\n",ttname);
  6627.         dialsta = DIA_OPEN;
  6628. #ifdef DYNAMIC
  6629.         if (rbuf) free(rbuf); rbuf = NULL;
  6630.         if (fbuf) free(fbuf); fbuf = NULL;
  6631. #endif /* DYNAMIC */
  6632.         return 0;
  6633.     }
  6634.     }
  6635. #ifdef CK_TAPI
  6636.     }
  6637. #endif /* CK_TAPI */
  6638.  
  6639.     /* Modem's escape sequence... */
  6640.  
  6641.     if (dialesc < 0 || dialesc > 127)
  6642.       c = NUL;
  6643.     else
  6644.       c = (char) (dialesc ? dialesc : mp->esc_char);
  6645.     mdmcapas = dialcapas ? dialcapas : mp->capas;
  6646.  
  6647.     xx_ok = mp->ok_fn;            /* Pointer to response reader */
  6648.  
  6649.     if (mdmcapas & CKD_AT) {        /* Hayes compatible */
  6650.     escbuf[0] = c;
  6651.     escbuf[1] = c;
  6652.     escbuf[2] = c;
  6653.     escbuf[3] = NUL;
  6654.     /* In case this modem type is user-defined */
  6655.     if (!xx_ok) xx_ok = getok;
  6656.     } else {                /* Other */
  6657.     escbuf[0] = c;
  6658.     escbuf[1] = NUL;
  6659.     /* In case user-defined */
  6660.     if (mdmcapas & CKD_V25) if (!xx_ok) xx_ok = getok;
  6661.     }
  6662.  
  6663.     /* Partial dialing */
  6664.  
  6665.     if (mdmcapas & CKD_AT
  6666. #ifndef MINIDIAL
  6667.     || mymdmtyp == n_MICROCOM
  6668. #endif /* MINIDIAL */
  6669.     ) {
  6670.     int x;
  6671.     x = (int) strlen(telnbr);
  6672.     if (x > 0) {
  6673.         if (telnbr[x-1] == ';') {
  6674.         partial = 1;
  6675.         debug(F110,"ckdial sets partial=1:",telnbr,0);
  6676.         } else if (partial) {
  6677.         ckmakmsg(fbuf,FULLNUML,telnbr,";",NULL,NULL); /* add one */
  6678.         telnbr = fbuf;
  6679.         }
  6680.     }
  6681.     }
  6682.     msleep(500);
  6683.  
  6684.     debug(F101,"ckdial dialtmo","",dialtmo); /* Timeout */
  6685.  
  6686.     if (fc == 1) {            /* ANSWER */
  6687.     waitct = (dialatmo > -1) ? dialatmo : 0;
  6688.     } else {                /* DIAL */
  6689.     if (dialtmo < 1) {        /* Automatic computation. */
  6690. #ifdef CK_TAPI
  6691.         if (tttapi && !tapipass) {
  6692.         waitct = 1 * (int)strlen(telnbr) ; /* Worst case dial time */
  6693.         waitct += 60;        /* dialtone + completion wait times */
  6694.         for (s = telnbr; *s; s++) { /* add in pause characters time */
  6695.             if (*s == ',') {
  6696.             waitct += 2; /* unless it was changed in the modem */
  6697.             } else if (*s == 'W' ||
  6698.                    *s == 'w' ||
  6699.                    *s == '$' ||
  6700.                    *s == '@'
  6701.                    ) {
  6702.             waitct += 8;
  6703.             }
  6704.         }
  6705.         } else {
  6706. #endif /* CK_TAPI */
  6707.         waitct = 1 * (int)strlen(telnbr) ;
  6708.         /* dialtone + completion wait times */
  6709.         waitct += mp->dial_time;
  6710.         for (s = telnbr; *s; s++) {
  6711.             for (p = mp->pause_chars; *p; p++)
  6712.               if (*s == *p) {
  6713.               waitct += mp->pause_time;
  6714.               break;
  6715.               }
  6716.         }
  6717. #ifdef CK_TAPI
  6718.         }
  6719. #endif /* CK_TAPI */
  6720.     } else {
  6721.         waitct = dialtmo;        /* User-specified timeout */
  6722.     }
  6723.     debug(F101,"ckdial waitct A","",waitct);
  6724.     }
  6725.  
  6726. /*
  6727.   waitct is our alarm() timer.
  6728.   mdmwait is how long we tell the modem to wait for carrier.
  6729.   We set mdmwait to be 5 seconds less than waitct, to increase the
  6730.   chance that we get a response from the modem before timing out.
  6731. */
  6732.     if (waitct <= 0) {            /* 0 or negative means wait forever  */
  6733. #ifdef COMMENT
  6734.     waitct = 254;            /* These were backwards in 7.0.196 */
  6735.     mdmwait = 0;
  6736. #else
  6737.     waitct = 0;            /* Fixed in 7.0.198. */
  6738.     mdmwait = 254;
  6739. #endif /* COMMENT */
  6740.     } else {
  6741.     if (dialtmo < 1) {        /* Automatic computation. */
  6742. #ifdef XWAITCT
  6743.         /* Addtl wait slop can be defined at compile time */
  6744.         waitct += XWAITCT;
  6745. #endif /* XWAITCT */
  6746.         if (waitct < 60 + mdmwaitd)
  6747.           waitct = 60 + mdmwaitd;
  6748.     }
  6749.     if (mdmcapas & CKD_AT) {    /* AT command-set modems */
  6750.         mdmwait = waitct;        /* S7 timeout = what user asked for */
  6751.         waitct += mdmwaitd;        /* Kermit timeout a bit later */
  6752.     } else {            /* Non-AT */
  6753.         mdmwait = waitct;        /* no difference */
  6754.     }
  6755.     }
  6756.     debug(F101,"ckdial waitct B","",waitct);
  6757.     if (fc == 1) {            /* ANSWER */
  6758. #ifdef COMMENT
  6759. /*
  6760.   This is wrong.  mdmwait is the value given to S7 in Hayeslike modems.
  6761.   When in autoanswer mode, this is the amount of time the modem waits for
  6762.   carrier once ringing starts.  Whereas waitct is the timeout given to the
  6763.   ANSWER command, which is an entirely different thing.  Since the default
  6764.   ANSWER timeout is 0 (meaning "wait forever"), the following statement sets
  6765.   S7 to 0, which, on some modems (like the USR Sportster) makes it hang up
  6766.   and report NO CARRIER the instant the phone rings.
  6767. */
  6768.     mdmwait = waitct;
  6769. #else
  6770.     if (mdmwait <= 0)
  6771.       mdmwait = 60;            /* Always wait 60 seconds. */
  6772. #endif /* COMMENT */
  6773.  
  6774.     }
  6775.     if (!quiet && !backgrd) {        /* Print information messages. */
  6776. #ifdef VMS
  6777.     printf(" \n");
  6778.     fflush(stdout);
  6779. #endif /* VMS */
  6780.     if (fc == 1)
  6781.       printf(" Waiting for phone call...\n");
  6782.     else
  6783.       printf(" %srying: %s...\n", x1 > 0 ? "Ret" : "T", telnbr);
  6784.     if (x1 == 0 && x2 == 0 && dialsta != DIA_PART) {
  6785.         if (network) {
  6786.         printf(" Via modem server: %s, modem: %s\n",
  6787.                ttname, gmdmtyp() );
  6788.         } else {
  6789. #ifdef CK_TAPI
  6790.         if (tttapi && !tapipass)
  6791.           printf(" Device: %s, modem: %s", ttname, "TAPI" );
  6792.         else
  6793. #endif /* CK_TAPI */
  6794.         printf(" Device: %s, modem: %s",
  6795.                ttname, gmdmtyp() );
  6796.         if (speed > -1L)
  6797.           printf(", speed: %ld\n", speed);
  6798.         else
  6799.           printf(", speed: (unknown)\n");
  6800.         }
  6801.         spdmax = dialmax > 0L ? dialmax : mp->max_speed;
  6802.  
  6803. #ifndef NOHINTS
  6804.         if (hints && !quiet &&
  6805.         !network && spdmax > 0L && speed > spdmax
  6806. #ifdef CK_TAPI
  6807.         && (!tttapi || tapipass)
  6808. #endif /* CK_TAPI */
  6809.         ) {
  6810.         printf("\n*************************\n");
  6811.         printf(
  6812.     "Interface speed %ld might be too high for this modem type.\n",
  6813.                speed
  6814.                );
  6815.         printf(
  6816.     "If dialing fails, SET SPEED to %ld or less and try again.\n",
  6817.                spdmax
  6818.                );
  6819.         printf("(Use SET HINTS OFF to suppress future hints.)\n");
  6820.         printf("*************************\n");
  6821.         printf("\n");
  6822.         }
  6823. #endif /* NOHINTS */
  6824.         printf(" %s timeout: ", fc == 0 ? "Dial" : "Answer");
  6825.         if (waitct > 0)
  6826.           printf("%d seconds\n",mdmwait);
  6827.         else
  6828.           printf(" (none)\n");
  6829.         printf(
  6830. #ifdef MAC
  6831.            " Type Command-. to cancel.\n"
  6832. #else
  6833. #ifdef UNIX
  6834.            " To cancel: type your interrupt character (normally Ctrl-C).\n"
  6835. #else
  6836.            " To cancel: type Ctrl-C (hold down Ctrl, press C).\n"
  6837. #endif /* UNIX */
  6838. #endif /* MAC */
  6839.            );
  6840.         }
  6841.     }
  6842.     debug(F111,"ckdial",ttname,(int) (speed / 10L));
  6843.     debug(F101,"ckdial timeout","",waitct);
  6844. #ifdef OS2
  6845.     term_io = 0;
  6846. #endif /* OS2 */
  6847.  
  6848. /* Set timer and interrupt handlers. */
  6849.     savint = signal( SIGINT, dialint ) ; /* And terminal interrupt handler. */
  6850.     cc_alrm_execute(ckjaddr(sjbuf), 0, dialtime, _dodial, faildial);
  6851.  
  6852.     signal(SIGINT, savint);
  6853. #ifdef OS2
  6854.     if (dialsta == DIA_OK)        /* Dialing is completed */
  6855.       DialerSend(OPT_KERMIT_CONNECT, 0);
  6856.     term_io = term_io_sav;
  6857. #endif /* OS2 */
  6858.     if (dialsta == DIA_PART || dialsta == DIA_OK) {
  6859.     /* This is needed, e.g., for Telnet modem servers */
  6860.     if (reliable != SET_OFF || !setreliable) {
  6861.         reliable = SET_OFF;        /* Transport is not reliable */
  6862.         debug(F101,"ckdial reliable","",reliable);
  6863.     }
  6864.     return(1);            /* Dial attempt succeeded */
  6865.     } else {
  6866.     return(0);            /* Dial attempt failed */
  6867.     }
  6868. } /* ckdial */
  6869.  
  6870. /*
  6871.   getok() - wait up to n seconds for OK (0) or ERROR (4) response from modem.
  6872.   Use with Hayeslike or CCITT modems for reading the reply to a nondialing
  6873.   command.
  6874.  
  6875.   Second argument says whether to be strict about numeric result codes, i.e.
  6876.   to require they be preceded by CR or else be the first character in the
  6877.   response, e.g. to prevent the ATH0<CR> echo from looking like a valid
  6878.   response.  Strict == 0 is needed for ATI on Telebit, which can return the
  6879.   model number concatenated with the numeric response code, e.g. "9620"
  6880.   ("962" is the model number, "0" is the response code).  getok() Returns:
  6881.  
  6882.    0 if it timed out,
  6883.    1 if it succeeded,
  6884.   -1 on modem command, i/o, or other error.
  6885. */
  6886. static ckjmpbuf okbuf;
  6887.  
  6888. static SIGTYP
  6889. #ifdef CK_ANSIC
  6890. oktimo(int foo)                /* Alarm handler for getok(). */
  6891. #else
  6892. oktimo(foo) int foo;            /* Alarm handler for getok(). */
  6893. #endif /* CK_ANSIC */
  6894. /* oktimo */ {
  6895.  
  6896. #ifdef OS2
  6897.     alarm(0);
  6898.     /* signal(SIGALRM,SIG_IGN); */
  6899.     debug(F100,"oktimo() SIGALRM caught -- SIG_IGN set","",0) ;
  6900. #endif /* OS2 */
  6901.  
  6902. #ifdef OSK                /* OS-9, see comment in dialtime(). */
  6903.     sigmask(-1);
  6904. #endif /* OSK */
  6905. #ifdef NTSIG
  6906.     if ( foo == SIGALRM )
  6907.       PostAlarmSigSem();
  6908.     else
  6909.       PostCtrlCSem();
  6910. #else /* NTSIG */
  6911. #ifdef NT
  6912.     cklongjmp(ckjaddr(okbuf),1);
  6913. #else /* NT */
  6914.     cklongjmp(okbuf,1);
  6915. #endif /* NTSIG */
  6916. #endif /* NT */
  6917.     /* NOTREACHED */
  6918.     SIGRETURN;
  6919. }
  6920.  
  6921. static int okstatus, okn, okstrict;
  6922.  
  6923. static SIGTYP
  6924. #ifdef CK_ANSIC
  6925. dook(void * threadinfo)
  6926. #else /* CK_ANSIC */
  6927. dook(threadinfo) VOID * threadinfo ;
  6928. #endif /* CK_ANSIC */
  6929. /* dook */ {
  6930.     CHAR c;
  6931. #ifdef DEBUG
  6932.     char * mdmmsg = "";
  6933. #endif /* DEBUG */
  6934.  
  6935.     int i, x;
  6936. #ifdef IKSD
  6937.     extern int inserver;
  6938. #endif /* IKSD */
  6939. #ifdef NTSIG
  6940.     signal(SIGINT,oktimo);
  6941.     if (threadinfo) {            /* Thread local storage... */
  6942.     TlsSetValue(TlsIndex,threadinfo);
  6943.     }
  6944. #endif /* NTSIG */
  6945. #ifdef CK_LOGIN
  6946. #ifdef NT
  6947. #ifdef IKSD
  6948.     if (inserver)
  6949.       setntcreds();
  6950. #endif /* IKSD */
  6951. #endif /* NT */
  6952. #endif /* CK_LOGIN */
  6953.  
  6954.     if (mdmcapas & CKD_V25) {        /* CCITT, easy... */
  6955.         waitfor("VAL");
  6956.         okstatus = 1;
  6957.     debug(F111,"Modem_Response(V25)","VAL",okstatus);
  6958. #ifdef NTSIG
  6959.     ckThreadEnd(threadinfo);
  6960. #endif /* NTSIG */
  6961.     SIGRETURN;
  6962. #ifndef MINIDIAL
  6963.     } else if (mymdmtyp == n_MICROCOM) { /* Microcom in SX mode, also easy */
  6964.         waitfor(MICROCOM.wake_prompt);    /* (I think...) */
  6965.     debug(F111,"Modem_Response(Microcom)",MICROCOM.wake_prompt,okstatus);
  6966.         okstatus = 1;
  6967. #ifdef NTSIG
  6968.     ckThreadEnd(threadinfo);
  6969. #endif /* NTSIG */
  6970.     SIGRETURN;
  6971. #endif /* MINIDIAL */
  6972.     } else {                /* Hayes & friends, start here... */
  6973.     okstatus = 0;            /* No status yet. */
  6974.     for (x = 0; x < RBUFL; x++)    /* Initialize response buffer */
  6975.       rbuf[x] = SP;            /*  to all spaces */
  6976.     rbuf[RBUFL] = NUL;        /* and terminate with NUL. */
  6977.     while (okstatus == 0) {        /* While no status... */
  6978.         x = ddinc(okn);        /* Read a character */
  6979.         if (x < 0) {        /* I/O error */
  6980.         okstatus = -1;
  6981. #ifdef NTSIG
  6982.         ckThreadEnd(threadinfo);
  6983. #endif /* NTSIG */
  6984.         SIGRETURN;
  6985.         }
  6986. #ifdef COMMENT
  6987.         /* too much */
  6988.         debug(F101,"getok ddinc","",x); /* Got a character. */
  6989. #endif /* COMMENT */
  6990.         c = (char) (x & 0x7f);    /* Get low order 7 bits */
  6991.         if (!c)            /* Don't deposit NULs */
  6992.           continue;            /* or else didweget() won't work */
  6993.         if (dialdpy) conoc((char)c); /* Echo it if requested */
  6994.         for (i = 0; i < RBUFL-1; i++) /* Rotate buffer */
  6995.           rbuf[i] = rbuf[i+1];
  6996.         rbuf[RBUFL-1] = c;        /* Deposit character at end */
  6997. #ifdef COMMENT
  6998.         /* too much */
  6999.         debug(F000,"getok:",rbuf,(int) c); /* Log it */
  7000. #endif /* COMMENT */
  7001.         switch (c) {        /* Interpret it. */
  7002.           case CR:            /* Got a carriage return. */
  7003.         switch(rbuf[RBUFL-2]) {    /* Look at character before it. */
  7004.           case '0':        /* 0 = OK numeric response */
  7005.             if (!okstrict ||
  7006.             rbuf[RBUFL-3] == CR || rbuf[RBUFL-3] == SP) {
  7007.             nonverbal = 1;
  7008.             okstatus = 1;    /* Good response */
  7009.             }
  7010.             debug(F111,"Modem_Response(Hayes)","0",okstatus);
  7011.             break;
  7012.           case '4':        /* 4 = ERROR numeric response */
  7013. #ifndef MINIDIAL
  7014.             /* Or Telebit model number 964! */
  7015.             if (mymdmtyp == n_TELEBIT &&
  7016.             isdigit(rbuf[RBUFL-3]) &&
  7017.             isdigit(rbuf[RBUFL-4]))
  7018.               break;
  7019.             else
  7020. #endif /* MINIDIAL */
  7021.               if (!okstrict ||
  7022.             rbuf[RBUFL-3] == CR || rbuf[RBUFL-3] == SP) {
  7023.             nonverbal = 1;
  7024.             okstatus = -1;    /* Bad command */
  7025.             }
  7026.             debug(F111,"Modem_Response(Hayes)","4",okstatus);
  7027.             break;
  7028.         }
  7029.         if (dialdpy && nonverbal) /* If numeric results, */
  7030.           conoc(LF);          /* echo a linefeed too. */
  7031.         break;
  7032.           case LF:            /* Got a linefeed. */
  7033.         /*
  7034.           Note use of explicit octal codes in the string for
  7035.           CR and LF.  We want real CR and LF here, not whatever
  7036.           the compiler happens to replace \r and \n with...
  7037.         */
  7038.         if (!strcmp(rbuf+RBUFL-4,"OK\015\012")) { /* Good response */
  7039.             okstatus = 1;
  7040.             debug(F111,"Modem_Response(Hayes)","OK",okstatus);
  7041.         }
  7042.         if (!strcmp(rbuf+RBUFL-3,"OK\012")) { /* Good response */
  7043.             okstatus = 1;
  7044.             debug(F111,"Modem_Response(Hayes)","OK",okstatus);
  7045.         } else if (!strcmp(rbuf+RBUFL-7,"ERROR\015\012")) { /* Error */
  7046.             okstatus = -1;
  7047.             debug(F111,"Modem_Response(Hayes)","ERROR",okstatus);
  7048.         } else if (!strcmp(rbuf+RBUFL-6,"ERROR\012")) { /* Error */
  7049.             okstatus = -1;
  7050.             debug(F111,"Modem_Response(Hayes)","ERROR",okstatus);
  7051.         }
  7052.         break;
  7053.           /* Check whether modem echoes its commands... */
  7054.           case 't':            /* Got little t */
  7055.         if (!strcmp(rbuf+RBUFL-3,"\015at") || /* See if it's "at" */
  7056.             !strcmp(rbuf+RBUFL-3," at"))
  7057.             mdmecho = 1;
  7058.         /* debug(F111,"MDMECHO-t",rbuf+RBUFL-2,mdmecho); */
  7059.         break;
  7060.           case 'T':            /* Got Big T */
  7061.         if (!strcmp(rbuf+RBUFL-3,"\015AT") ||    /* See if it's "AT" */
  7062.             !strcmp(rbuf+RBUFL-3," AT"))
  7063.             mdmecho = 1;
  7064.         /* debug(F111,"MDMECHO-T",rbuf+RBUFL-3,mdmecho); */
  7065.         break;
  7066.           default:            /* Other characters, accumulate. */
  7067.         okstatus = 0;
  7068.         break;
  7069.         }
  7070.     }
  7071.     }
  7072.     debug(F101,"getok","",okstatus);    /* <-- It's a lie (why?) */
  7073. #ifdef NTSIG
  7074.     ckThreadEnd(threadinfo);
  7075. #endif /* NTSIG */
  7076.     SIGRETURN;
  7077. }
  7078.  
  7079. static SIGTYP
  7080. #ifdef CK_ANSIC
  7081. failok(void * threadinfo)
  7082. #else /* CK_ANSIC */
  7083. failok(threadinfo) VOID * threadinfo;
  7084. #endif /* CK_ANSIC */
  7085. /* failok */ {
  7086.     debug(F100,"longjmp returned to getok()","",0);
  7087.     debug(F100,"getok timeout","",0);
  7088.     SIGRETURN;
  7089. }
  7090.  
  7091. int
  7092. getok(n, strict) int n, strict; {
  7093.     debug(F101,"getok entry n","",n);
  7094.     okstatus = 0;
  7095.     okn = n;
  7096.     okstrict = strict;
  7097.  
  7098. #ifdef DYNAMIC
  7099.     if (!rbuf) {
  7100.     if (!(rbuf = malloc(RBUFL+1))) { /* Allocate input line buffer */
  7101.         dialsta = DIA_IE;
  7102.         return(-1);
  7103.     }
  7104.     debug(F101,"GETOK rbuf malloc ok","",RBUFL+1);
  7105.     }
  7106. #endif /* DYNAMIC */
  7107.  
  7108.     mdmecho = 0;            /* Assume no echoing of commands */
  7109.  
  7110.     debug(F100,"about to alrm_execute dook()","",0);
  7111.     alrm_execute( ckjaddr(okbuf), n, oktimo, dook, failok ) ;
  7112.     debug(F100,"returning from alrm_execute dook()","",0);
  7113.  
  7114.     ttflui();                /* Flush input buffer */
  7115.     return(okstatus);            /* Return status */
  7116. }
  7117.  
  7118. /*  G E T H R N  --  Get Hayes Result Numeric  */
  7119.  
  7120. static VOID
  7121. gethrn() {
  7122.     char c;
  7123.     int x;
  7124. /*
  7125.   Hayes numeric result codes (Hayes 1200 and higher):
  7126.      0 = OK
  7127.      1 = CONNECT at 300 bps (or 1200 bps on Hayes 1200 with basic code set)
  7128.      2 = RING
  7129.      3 = NO CARRIER
  7130.      4 = ERROR (in command line)
  7131.      5 = CONNECT 1200 (extended code set)
  7132.   Hayes 2400 and higher:
  7133.      6 = NO DIALTONE
  7134.      7 = BUSY
  7135.      8 = NO ANSWER
  7136.      9 = (there is no 9)
  7137.     10 = CONNECT 2400
  7138.   Reportedly, the codes for Hayes V.32 modems are:
  7139.     1x = CONNECT <suffix>
  7140.     5x = CONNECT 1200 <suffix>
  7141.     9x = CONNECT 2400 <suffix>
  7142.    11x = CONNECT 4800 <suffix>
  7143.    12x = CONNECT 9600 <suffix>
  7144.   Where:
  7145.     x:   suffix:
  7146.     R  = RELIABLE
  7147.     RC = RELIABLE COMPRESSED
  7148.     L  = LAPM
  7149.     LC = LAPM COMPRESSED
  7150.   And for Telebits, all the above, except no suffix in numeric mode, plus:
  7151.     11 = CONNECT 4800
  7152.     12 = CONNECT 9600
  7153.     13 = CONNECT 14400
  7154.     14 = CONNECT 19200
  7155.     15 = CONNECT 38400
  7156.     16 = CONNECT 57600
  7157.     20 = CONNECT 300/REL  (= MNP)
  7158.     22 = CONNECT 1200/REL (= MNP)
  7159.     23 = CONNECT 2400/REL (= MNP)
  7160.     46 = CONNECT 7512  (i.e. 75/1200)
  7161.     47 = CONNECT 1275  (i.e. 1200/75)
  7162.     48 = CONNECT 7200
  7163.     49 = CONNECT 12000
  7164.     50 = CONNECT FAST (not on T1600/3000)
  7165.     52 = RRING
  7166.     53 = DIALING
  7167.     54 = NO PROMPTTONE
  7168.     61 = CONNECT FAST/KERM (Kermit spoof)
  7169.     70 = CONNECT FAST/COMP (PEP + compression)
  7170.     71 = CONNECT FAST/KERM/COMP (PEP + compression + Kermit spoof)
  7171.  
  7172.   And for others, lots of special cases below...
  7173. */
  7174. #define NBUFL 8
  7175.     char nbuf[NBUFL+1];            /* Response buffer */
  7176.     int i = 0, j = 0;            /* Buffer pointers */
  7177.  
  7178.     debug(F101,"RESPONSE mdmecho","",mdmecho);
  7179.     if (mdmecho) {            /* Sponge up dialing string echo. */
  7180.     while (1) {
  7181.         c = (char) (ddinc(0) & 0x7f);
  7182.         debug(F000,"SPONGE","",c);
  7183.         dialoc(c);
  7184.         if (c == CR) break;
  7185.     }
  7186.     }
  7187.     while (mdmstat == 0) {        /* Read response */
  7188.     for (i = 0; i < NBUFL; i++)    /* Clear the buffer */
  7189.       nbuf[i] = '\0';
  7190.     i = 0;                /* Reset the buffer pointer. */
  7191.     c = (char) (ddinc(0) & 0177);    /* Get first digit of response. */
  7192.                     /* using an untimed, blocking read. */
  7193.     debug(F000,"RESPONSE-A","",c);
  7194.     dialoc(c);            /* Echo it if requested. */
  7195.     if (!isdigit(c))        /* If not a digit, keep looking. */
  7196.       continue;
  7197.     nbuf[i++] = c;            /* Got first digit, save it. */
  7198.     while (c != CR && i < 8) {    /* Read chars up to CR */
  7199.         x = ddinc(0) & 0177;    /* Get a character. */
  7200.         c = (char) x;        /* Got it OK. */
  7201.         debug(F000,"RESPONSE-C","",c);
  7202.         if (c != CR)        /* If it's not a carriage return, */
  7203.           nbuf[i++] = c;        /*  save it. */
  7204.         dialoc(c);            /* Echo it. */
  7205.     }
  7206.     nbuf[i] = '\0';            /* Done, terminate the buffer. */
  7207.     debug(F110,"dial hayesnv lbuf",lbuf,0);
  7208.     debug(F111,"dial hayesnv got",nbuf,i);
  7209.     /*
  7210.        Separate any non-numeric suffix from the numeric
  7211.        result code with a null.
  7212.     */
  7213.     for (j = i-1; (j > -1) && !isdigit(nbuf[j]); j--)
  7214.       nbuf[j+1] = nbuf[j];
  7215.     j++;
  7216.     nbuf[j++] = '\0';
  7217.     debug(F110,"dial hayesnv numeric",nbuf,0);
  7218.     debug(F111,"dial hayesnv suffix ",nbuf+j,j);
  7219.     /* Probably phone number echoing. */
  7220.     if ((int)strlen(nbuf) > 3)
  7221.       continue;
  7222.  
  7223.     /* Now read and interpret the results... */
  7224.  
  7225.     i = atoi(nbuf);    /* Convert to integer */
  7226.     switch (i) {
  7227.       case 0:
  7228.         mdmstat = D_PARTIAL;    /* OK response */
  7229.         break;
  7230.       case 1:            /* CONNECT */
  7231.         mdmstat = CONNECTED;    /* Could be any speed */
  7232.         break;
  7233.       case 2:            /* RING */
  7234.         if (dialdpy)
  7235.           printf("\r\n Local phone is ringing!\r\n");
  7236.         mdmstat = D_FAILED;
  7237.         dialsta = DIA_RING;
  7238.         break;
  7239.       case 3:            /* NO CARRIER */
  7240.         if (dialdpy) printf("\r\n No Carrier.\r\n");
  7241.         mdmstat = D_FAILED;
  7242.         dialsta = DIA_NOCA;
  7243.         break;
  7244.       case 4:            /* ERROR */
  7245.         if (dialdpy)
  7246.           printf("\r\n Modem Command Error.\r\n");
  7247.         mdmstat = D_FAILED;
  7248.         dialsta = DIA_ERR;
  7249.         break;
  7250.       case 5:            /* CONNECT 1200 */
  7251.         spdchg(1200L); /* Change speed if necessary. */
  7252.         mdmstat = CONNECTED;
  7253.         break;
  7254.       case 6:            /* NO DIALTONE */
  7255. #ifndef MINIDIAL
  7256.         if (mymdmtyp == n_MICROLINK && atoi(diallcc) == 49 && dialdpy)
  7257.           printf("\r\n Dial Locked.\r\n"); /* Germany */
  7258.         else
  7259. #endif /* MINIDIAL */
  7260.           if (dialdpy)
  7261.         printf("\r\n No Dialtone.\r\n");
  7262.         mdmstat = D_FAILED;
  7263.         dialsta = DIA_NODT;
  7264.         break;
  7265.       case 7:            /* BUSY */
  7266.         if (dialdpy) printf("\r\n Busy.\r\n");
  7267.         mdmstat = D_FAILED;
  7268.         dialsta = DIA_BUSY;
  7269.         break;
  7270.       case 8:            /* NO ANSWER */
  7271. #ifndef MINIDIAL
  7272.         if (mymdmtyp == n_MICROLINK && atoi(diallcc) == 41 && dialdpy)
  7273.           printf("\r\n Dial Locked.\r\n"); /* Switzerland */
  7274.         else
  7275. #endif /* MINIDIAL */
  7276.           if (dialdpy)
  7277.         printf("\r\n No Answer.\r\n");
  7278.         mdmstat = D_FAILED;
  7279.         dialsta = DIA_NOAN;
  7280.         break;
  7281.  
  7282.       case 9:
  7283. #ifndef MINIDIAL
  7284.         if (mymdmtyp == n_XJACK || mymdmtyp == n_SUPRAX) {
  7285.         spdchg(600);
  7286.         break;
  7287.         } /* fall thru */
  7288. #endif /* MINIDIAL */
  7289.       case 10:            /* CONNECT 2400 */
  7290.         spdchg(2400L);        /* Change speed if necessary. */
  7291.         mdmstat = CONNECTED;
  7292.         break;
  7293.  
  7294. #ifndef MINIDIAL
  7295.  
  7296. /* Starting here, we get different meanings from different manufacturers */
  7297.  
  7298.       case 11:
  7299.         if (mymdmtyp == n_USR) {
  7300.         if (dialdpy) printf(" Ringing...\r\n");
  7301.         } else {
  7302.         spdchg(4800L);        /* CONNECT 4800 */
  7303.         mdmstat = CONNECTED;
  7304.         }
  7305.         break;
  7306.       case 12:
  7307.         if (mymdmtyp == n_USR) {
  7308.         if (dialdpy)
  7309.           printf("\r\n Answered by voice.\r\n");
  7310.         mdmstat = D_FAILED;
  7311.         dialsta = DIA_VOIC;
  7312.         } else if (mymdmtyp == n_KEEPINTOUCH) {
  7313.         spdchg(7200L);
  7314.         mdmstat = CONNECTED;
  7315.         } else {
  7316.         spdchg(9600L);
  7317.         mdmstat = CONNECTED;
  7318.         }
  7319.         break;
  7320.       case 13:
  7321.         if (mymdmtyp == n_ATT1900 || mymdmtyp == n_ATT1910) {
  7322.         if (dialdpy) printf(" Wait...\r\n");
  7323.         break;
  7324.         } else if (mymdmtyp == n_USR || mymdmtyp == n_USRX2)
  7325.           spdchg(9600L);
  7326.         else if (is_rockwell || is_supra ||
  7327.         mymdmtyp == n_ZOLTRIX || mymdmtyp == n_XJACK)
  7328.           spdchg(7200L);
  7329.         else if (mymdmtyp != n_MICROLINK)
  7330.           spdchg(14400L);
  7331.         mdmstat = CONNECTED;
  7332.         break;
  7333.       case 14:
  7334.         if (is_rockwell || is_supra || mymdmtyp == n_XJACK)
  7335.           spdchg(12000L);
  7336.         else if (mymdmtyp == n_DATAPORT || mymdmtyp == n_MICROLINK)
  7337.           spdchg(14400L);
  7338.         else if (mymdmtyp == n_KEEPINTOUCH)
  7339.           spdchg(9600L);
  7340.         else if (mymdmtyp != n_USR && mymdmtyp != n_ZOLTRIX)
  7341.           spdchg(19200L);
  7342.         mdmstat = CONNECTED;
  7343.         break;
  7344.       case 15:
  7345.         if (is_rockwell || is_supra ||
  7346.         mymdmtyp == n_ZOLTRIX || mymdmtyp == n_XJACK)
  7347.           spdchg(14400L);
  7348.         else if (mymdmtyp == n_USR)
  7349.           spdchg(1200L);
  7350.         else if (mymdmtyp == n_ZYXEL || mymdmtyp == n_INTEL)
  7351.           spdchg(7200L);
  7352.         else if (mymdmtyp == n_DATAPORT)
  7353.           spdchg(19200L);
  7354.         else
  7355.           spdchg(38400L);
  7356.         mdmstat = CONNECTED;
  7357.         break;
  7358.       case 16:
  7359.         if (is_rockwell || is_supra ||
  7360.         mymdmtyp == n_ZOLTRIX || mymdmtyp == n_XJACK)
  7361.           spdchg(19200L);
  7362.         else if (mymdmtyp == n_USR)
  7363.           spdchg(2400L);
  7364.         else if (mymdmtyp == n_DATAPORT)
  7365.           spdchg(7200L);
  7366.         else if (mymdmtyp != n_ZYXEL && mymdmtyp != n_INTEL) /* 12000 */
  7367.           spdchg(57600L);
  7368.         mdmstat = CONNECTED;
  7369.         break;
  7370.       case 17:
  7371.         if (mymdmtyp != n_DATAPORT || mymdmtyp == n_XJACK)    /* 16800 */
  7372.           spdchg(38400L);
  7373.         else if (mymdmtyp == n_ZYXEL || mymdmtyp == n_INTEL)
  7374.           spdchg(14400L);
  7375.         else if (mymdmtyp == n_KEEPINTOUCH)
  7376.           spdchg(14400L);
  7377.         else if (mymdmtyp == n_USR)
  7378.           spdchg(9600L);
  7379.         mdmstat = CONNECTED;
  7380.         break;
  7381.       case 18:
  7382.         if (is_rockwell || is_supra ||
  7383.         mymdmtyp == n_ZOLTRIX || mymdmtyp == n_XJACK ||
  7384.         mymdmtyp == n_MHZATT || mymdmtyp == n_LUCENT)
  7385.           spdchg(57600L);
  7386.         else if (mymdmtyp == n_INTEL)
  7387.           spdchg(19200L);
  7388.         else if (mymdmtyp == n_USR || mymdmtyp == n_USRX2)
  7389.           spdchg(4800L);
  7390.         mdmstat = CONNECTED;
  7391.         break;
  7392.       case 19:
  7393.         if (mymdmtyp == n_DATAPORT)
  7394.           spdchg(300L);
  7395.         else if (mymdmtyp == n_ZYXEL || mymdmtyp == n_INTEL)
  7396.           spdchg(38400L);
  7397.         else
  7398.           spdchg(115200L);
  7399.         mdmstat = CONNECTED;
  7400.         break;
  7401.       case 20:
  7402.         if (mymdmtyp == n_USR || mymdmtyp == n_USRX2)
  7403.           spdchg(7200L);
  7404.         else if (mymdmtyp == n_DATAPORT)
  7405.           spdchg(2400L);
  7406.         else if (mymdmtyp == n_ZYXEL || mymdmtyp == n_INTEL)
  7407.           spdchg(57600L);
  7408.         else
  7409.           spdchg(300L);
  7410.         mdmstat = CONNECTED;
  7411.         break;
  7412.       case 21:
  7413.         if (mymdmtyp == n_DATAPORT)
  7414.           spdchg(4800L);
  7415.         mdmstat = CONNECTED;
  7416.         break;
  7417.       case 22:
  7418.         if (is_rockwell || is_supra || mymdmtyp == n_XJACK)
  7419.           spdchg(8880L);
  7420.         else if (mymdmtyp == n_DATAPORT)
  7421.           spdchg(9600L);
  7422.         else if (mymdmtyp == n_KEEPINTOUCH)
  7423.           spdchg(300L);
  7424.         else if (!is_hayeshispd)
  7425.           spdchg(1200L);
  7426.         mdmstat = CONNECTED;
  7427.         break;
  7428.       case 23:
  7429.         if (is_hayeshispd || is_supra ||
  7430.         mymdmtyp == n_MULTI || mymdmtyp == n_XJACK)
  7431.           spdchg(8880L);
  7432.         else if (mymdmtyp != n_DATAPORT && !is_rockwell) /* 12000 */
  7433.           spdchg(2400L);
  7434.         mdmstat = CONNECTED;
  7435.         break;
  7436.       case 24:
  7437.         if (is_rockwell ||  is_supra || mymdmtyp == n_XJACK) {
  7438.         mdmstat = D_FAILED;
  7439.         dialsta = DIA_DELA;    /* Delayed */
  7440.         break;
  7441.         } else if (is_hayeshispd || mymdmtyp == n_LUCENT)
  7442.           spdchg(7200L);
  7443.         else if (mymdmtyp == n_DATAPORT)
  7444.           spdchg(14400L);
  7445.         else if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH)
  7446.           spdchg(1200L);
  7447.         mdmstat = CONNECTED;
  7448.         break;
  7449.       case 25:
  7450.         if (mymdmtyp == n_USR || mymdmtyp == n_USRX2)
  7451.           spdchg(14400L);
  7452.         else if (mymdmtyp == n_LUCENT)
  7453.           spdchg(12000L);
  7454.         else if (is_motorola)
  7455.           spdchg(9600L);
  7456.         else if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH)
  7457.           spdchg(2400L);
  7458.         mdmstat = CONNECTED;
  7459.         break;
  7460.       case 26:
  7461.         if (mymdmtyp == n_DATAPORT)
  7462.           spdchg(19200L);
  7463.         else if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH)
  7464.           spdchg(4800L);
  7465.         mdmstat = CONNECTED;
  7466.         break;
  7467.       case 27:
  7468.         if (mymdmtyp == n_DATAPORT)
  7469.           spdchg(38400L);
  7470.         else if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH)
  7471.           spdchg(7200L);
  7472.         else if (mymdmtyp == n_MHZATT)
  7473.           spdchg(8880L);
  7474.         mdmstat = CONNECTED;
  7475.         break;
  7476.       case 28:
  7477.         if (mymdmtyp == n_DATAPORT)
  7478.           spdchg(7200L);
  7479.         else if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH)
  7480.           spdchg(9600L);
  7481.         else if (mymdmtyp == n_MHZATT || mymdmtyp == n_LUCENT)
  7482.           spdchg(38400L);
  7483.         mdmstat = CONNECTED;
  7484.         break;
  7485.       case 29:
  7486.         if (is_motorola)
  7487.           spdchg(4800L);
  7488.         else if (mymdmtyp == n_DATAPORT)
  7489.           spdchg(19200L);
  7490.         mdmstat = CONNECTED;
  7491.         break;
  7492.       case 30:
  7493.         if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7494.         spdchg(14400L);
  7495.         mdmstat = CONNECTED;
  7496.         } /* fall thru on purpose... */
  7497.       case 31:
  7498.         if (mymdmtyp == n_UCOM_AT || mymdmtyp == n_MICROLINK) {
  7499.         spdchg(4800L);
  7500.         mdmstat = CONNECTED;
  7501.         } else if (is_motorola) {
  7502.         spdchg(57600L);
  7503.         mdmstat = CONNECTED;
  7504.         }
  7505.         break;
  7506.       case 32:
  7507.         if (is_rockwell || is_supra || mymdmtyp == n_XJACK) {
  7508.         mdmstat = D_FAILED;
  7509.         dialsta = DIA_BLCK;    /* Blacklisted */
  7510.         } else if (mymdmtyp == n_UCOM_AT || mymdmtyp == n_MICROLINK) {
  7511.         spdchg(9600L);
  7512.         mdmstat = CONNECTED;
  7513.         } else if (mymdmtyp == n_KEEPINTOUCH) {
  7514.         spdchg(300L);
  7515.         mdmstat = CONNECTED;
  7516.         } else if (mymdmtyp == n_INTEL) {
  7517.         spdchg(2400L);
  7518.         mdmstat = CONNECTED;
  7519.         }
  7520.         break;
  7521.       case 33:            /* FAX connection */
  7522.         if (is_rockwell || is_supra ||
  7523.         mymdmtyp == n_ZOLTRIX || mymdmtyp == n_XJACK) {
  7524.         mdmstat = D_FAILED;
  7525.         dialsta = DIA_FAX;
  7526.         } else if (mymdmtyp == n_UCOM_AT ||
  7527.                is_motorola ||
  7528.                mymdmtyp == n_MICROLINK
  7529.                ) {
  7530.         spdchg(9600L);
  7531.         mdmstat = CONNECTED;
  7532.         } else if (mymdmtyp == n_MHZATT) {
  7533.         spdchg(115200L);
  7534.         mdmstat = CONNECTED;
  7535.         }
  7536.         break;
  7537.       case 34:
  7538.         if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7539.         spdchg(1200L);
  7540.         mdmstat = CONNECTED;
  7541.         } else if (mymdmtyp == n_MICROLINK) {
  7542.         spdchg(7200L);
  7543.         mdmstat = CONNECTED;
  7544.         }
  7545.         break;
  7546.       case 35:
  7547.         if (is_rockwell) {
  7548.         spdchg(300L);
  7549.         dialsta = CONNECTED;
  7550.         } else if (is_motorola) {
  7551.         spdchg(14400L);
  7552.         mdmstat = CONNECTED;
  7553.         } else if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7554.         spdchg(2400L);
  7555.         mdmstat = CONNECTED;
  7556.         } else if (mymdmtyp == n_MICROLINK) {
  7557.         spdchg(7200L);
  7558.         mdmstat = CONNECTED;
  7559.         } else if (mymdmtyp == n_ZOLTRIX || mymdmtyp == n_XJACK) /* DATA */
  7560.           mdmstat = CONNECTED;
  7561.         break;
  7562.       case 36:
  7563.         if (mymdmtyp == n_UCOM_AT) {
  7564.         spdchg(19200L);
  7565.         mdmstat = CONNECTED;
  7566.         } else if (is_motorola) {
  7567.         spdchg(1200L);
  7568.         mdmstat = CONNECTED;
  7569.         } else if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7570.         spdchg(4800L);
  7571.         mdmstat = CONNECTED;
  7572.         }
  7573.         break;
  7574.       case 37:
  7575.         if (mymdmtyp == n_UCOM_AT) {
  7576.         spdchg(19200L);
  7577.         mdmstat = CONNECTED;
  7578.         } else if (is_motorola) {
  7579.         spdchg(2400L);
  7580.         mdmstat = CONNECTED;
  7581.         } else if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7582.         spdchg(7200L);
  7583.         mdmstat = CONNECTED;
  7584.         }
  7585.         break;
  7586.       case 38:
  7587.         if (is_motorola) {
  7588.         spdchg(4800L);
  7589.         mdmstat = CONNECTED;
  7590.         } else if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7591.         spdchg(9600L);
  7592.         mdmstat = CONNECTED;
  7593.         } /* fall thru on purpose... */
  7594.       case 39:
  7595.         if (mymdmtyp == n_UCOM_AT) {
  7596.         spdchg(38400L);
  7597.         mdmstat = CONNECTED;
  7598.         } else if (is_motorola) {
  7599.         spdchg(9600L);
  7600.         mdmstat = CONNECTED;
  7601.         } else if (mymdmtyp == n_MICROLINK) {
  7602.         spdchg(14400L);
  7603.         mdmstat = CONNECTED;
  7604.         }
  7605.         break;
  7606.       case 40:
  7607.         if (mymdmtyp == n_UCOM_AT) {
  7608.         mdmstat = D_FAILED;
  7609.         dialsta = DIA_NOCA;
  7610.         } else if (is_motorola || mymdmtyp == n_INTEL ||
  7611.                mymdmtyp == n_KEEPINTOUCH) {
  7612.         spdchg(14400L);
  7613.         mdmstat = CONNECTED;
  7614.         }
  7615.         break;
  7616.       case 41:
  7617.         if (is_motorola) {
  7618.         spdchg(19200L);
  7619.         mdmstat = CONNECTED;
  7620.         }
  7621.         break;
  7622.       case 42:
  7623.         if (mymdmtyp == n_KEEPINTOUCH) {
  7624.         spdchg(300L);
  7625.         mdmstat = CONNECTED;
  7626.         } else if (is_motorola) {
  7627.         spdchg(38400L);
  7628.         mdmstat = CONNECTED;
  7629.         } /* fall thru on purpose... */
  7630.       case 43:
  7631.         if (mymdmtyp == n_UCOM_AT) {
  7632.         spdchg(57600L);
  7633.         mdmstat = CONNECTED;
  7634.         } else if (mymdmtyp == n_USRX2)
  7635.           mdmstat = CONNECTED;    /* 168000 */
  7636.         break;
  7637.       case 44:
  7638.         if (is_rockwell) {
  7639.         spdchg(8800L);
  7640.         dialsta = CONNECTED;
  7641.         } else if (is_motorola) {
  7642.         spdchg(7200L);
  7643.         mdmstat = CONNECTED;
  7644.         } else if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7645.         spdchg(1200L);
  7646.         mdmstat = CONNECTED;
  7647.         }
  7648.         break;
  7649.       case 45:
  7650.         if (is_motorola) {
  7651.         spdchg(57600L);
  7652.         mdmstat = CONNECTED;
  7653.         } else if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7654.         spdchg(2400L);
  7655.         mdmstat = CONNECTED;
  7656.         } else if (n_USR) {
  7657.         spdchg(14400L);
  7658.         mdmstat = CONNECTED;
  7659.         }
  7660.         break;
  7661.       case 46:
  7662.         if (is_rockwell)
  7663.           spdchg(1200L);
  7664.         else if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH)
  7665.           spdchg(4800L);
  7666.         else
  7667.           spdchg(8880L);        /* 75/1200 split speed */
  7668.         mdmstat = CONNECTED;
  7669.         break;
  7670.       case 47:
  7671.         if (is_rockwell)
  7672.           spdchg(2400L);
  7673.         else if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH)
  7674.           spdchg(7200L);
  7675.         else
  7676.           printf("CONNECT 1200/75 - Not supported by C-Kermit\r\n");
  7677.         mdmstat = CONNECTED;
  7678.         break;
  7679.       case 48:
  7680.         if (is_rockwell)
  7681.           spdchg(4800L);
  7682.         else if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH)
  7683.           spdchg(9600L);
  7684.         else
  7685.           spdchg(7200L);
  7686.         mdmstat = CONNECTED;
  7687.         break;
  7688.       case 49:
  7689.         if (is_rockwell)
  7690.           spdchg(7200L);
  7691.         mdmstat = CONNECTED;
  7692.         break;
  7693.       case 50:            /* CONNECT FAST */
  7694.         if (is_rockwell)
  7695.           spdchg(9600L);
  7696.         else if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH)
  7697.           spdchg(14400L);
  7698.         mdmstat = CONNECTED;
  7699.         break;
  7700.       case 51:
  7701.         if (mymdmtyp == n_UCOM_AT) {
  7702.         mdmstat = D_FAILED;
  7703.         dialsta = DIA_NODT;
  7704.         }
  7705.         break;
  7706.       case 52:            /* RRING */
  7707.         if (mymdmtyp == n_TELEBIT)
  7708.           if (dialdpy) printf(" Ringing...\r\n");
  7709.         break;
  7710.       case 53:            /* DIALING */
  7711.         if (mymdmtyp == n_TELEBIT)
  7712.           if (dialdpy) printf(" Dialing...\r\n");
  7713.         break;
  7714.       case 54:
  7715.         if (is_rockwell) {
  7716.         spdchg(19200L);
  7717.         mdmstat = CONNECTED;
  7718.         } else if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7719.         spdchg(1200L);
  7720.         mdmstat = CONNECTED;
  7721.         } else if (mymdmtyp == n_TELEBIT) {
  7722.         if (dialdpy) printf("\r\n No Prompttone.\r\n");
  7723.         mdmstat = D_FAILED;
  7724.         dialsta = DIA_NODT;
  7725.         }
  7726.         break;
  7727.       case 55:
  7728.         if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7729.         spdchg(2400L);
  7730.         mdmstat = CONNECTED;
  7731.         }
  7732.         break;
  7733.       case 56:
  7734.         if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7735.         spdchg(4800L);
  7736.         mdmstat = CONNECTED;
  7737.         }
  7738.         break;
  7739.       case 57:
  7740.         if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7741.         spdchg(7200L);
  7742.         mdmstat = CONNECTED;
  7743.         }
  7744.         break;
  7745.       case 58:
  7746.         if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7747.         spdchg(9600L);
  7748.         mdmstat = CONNECTED;
  7749.         }
  7750.         break;
  7751.       case 59:
  7752.         if (mymdmtyp == n_INTEL)    /* 12000 */
  7753.           mdmstat = CONNECTED;
  7754.         break;
  7755.       case 60:
  7756.         if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7757.         spdchg(14400L);
  7758.         mdmstat = CONNECTED;
  7759.         }
  7760.         break;
  7761.       case 64:
  7762.         if (mymdmtyp == n_INTEL) {
  7763.         spdchg(1200L);
  7764.         mdmstat = CONNECTED;
  7765.         } else if (is_supra) {
  7766.         spdchg(28800L);
  7767.         mdmstat = CONNECTED;
  7768.         }
  7769.         break;
  7770.       case 65:
  7771.         if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7772.         spdchg(2400L);
  7773.         mdmstat = CONNECTED;
  7774.         }
  7775.         break;
  7776.       case 66:
  7777.         if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7778.         spdchg(4800L);
  7779.         mdmstat = CONNECTED;
  7780.         }
  7781.         break;
  7782.       case 67:
  7783.         if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7784.         spdchg(7200L);
  7785.         mdmstat = CONNECTED;
  7786.         }
  7787.         break;
  7788.       case 68:
  7789.         if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7790.         spdchg(9600L);
  7791.         mdmstat = CONNECTED;
  7792.         }
  7793.         break;
  7794.       case 69:
  7795.         if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) /* 12000 */
  7796.           mdmstat = CONNECTED;
  7797.         break;
  7798.       case 70:
  7799.         if (mymdmtyp == n_INTEL || mymdmtyp == n_KEEPINTOUCH) {
  7800.         spdchg(14400L);
  7801.         mdmstat = CONNECTED;
  7802.         }
  7803.         break;
  7804.       case 73:
  7805.         if (mymdmtyp == n_UCOM_AT) {
  7806.         spdchg(115200L);
  7807.         mdmstat = CONNECTED;
  7808.         break;
  7809.         } /* else fall thru */
  7810.         if (mymdmtyp == n_TELEBIT)    /* Early models only */
  7811.           mdmstat = CONNECTED;
  7812.         break;
  7813.       case 85:
  7814.         if (mymdmtyp == n_USR || mymdmtyp == n_USRX2)
  7815.           spdchg(19200L);
  7816.         mdmstat = CONNECTED;
  7817.         break;
  7818.       case 91:            /* 21600 */
  7819.       case 99:            /* 24000 */
  7820.       case 103:            /* 26400 */
  7821.         if (mymdmtyp == n_USRX2)
  7822.           mdmstat = CONNECTED;
  7823.         break;
  7824.       case 107:
  7825.         if (mymdmtyp == n_USR || mymdmtyp == n_USRX2) {
  7826.         spdchg(28800L);
  7827.         mdmstat = CONNECTED;
  7828.         }
  7829.         break;
  7830.       case 151:            /* 312000 */
  7831.       case 155:            /* 336000 */
  7832.         if (mymdmtyp == n_USRX2)
  7833.           mdmstat = CONNECTED;
  7834.         break;
  7835.  
  7836. #endif /* MINIDIAL */
  7837.       default:
  7838. #ifndef MINIDIAL
  7839.         if (mymdmtyp == n_USR || mymdmtyp == n_USRX2 ||
  7840.         is_hayeshispd || is_rockwell)
  7841. #endif /* MINIDIAL */
  7842.           if (i > 12)        /* There are hundreds of them... */
  7843.         mdmstat = CONNECTED;
  7844.         break;
  7845.     }
  7846.     }
  7847.     if (mdmstat == CONNECTED && nbuf[j] != '\0') {
  7848.     if (dialdpy) {
  7849.         printf("\r\n");
  7850.         if (nbuf[j] == 'R') printf(" RELIABLE");
  7851.         if (nbuf[j] == 'L') printf(" LAPM");
  7852.         if (nbuf[j+1] == 'C') printf(" COMPRESSED");
  7853.         printf("\r\n");
  7854.     }
  7855.     ckstrncpy(lbuf,nbuf,LBUFL);        /* (for messages...) */
  7856.     }
  7857. }
  7858.  
  7859. static VOID                /* Get Hayes Result in Word mode */
  7860. gethrw() {
  7861.     char *cptr, *s;
  7862.     long conspd;
  7863.  
  7864.     if (mdmspd && !network) {
  7865.     s = lbuf;
  7866.     while (*s != '\0' && *s != 'C') s++;
  7867.     cptr = (*s == 'C') ? s : NULL;
  7868.     conspd = 0L;
  7869.     if ((cptr != NULL) && !strncmp(cptr,"CONNECT ",8)) {
  7870.         if ((int)strlen(cptr) < 9)   /* Just CONNECT, */
  7871.           conspd = 300L;         /* use 300 bps */
  7872.         else if (isdigit(*(cptr+8))) /* not CONNECT FAST */
  7873.           conspd = atol(cptr + 8);   /* CONNECT nnnn */
  7874.         if (conspd != speed) {
  7875.         if ((conspd / 10L) > 0) {
  7876.             if (ttsspd((int) (conspd / 10L)) < 0) {
  7877.             printf(" Can't change speed to %ld\r\n",
  7878.                    conspd);
  7879.             } else {
  7880.             speed = conspd;
  7881.             mdmstat = CONNECTED;
  7882.             if ( !quiet && !backgrd )
  7883.               printf(" Speed changed to %ld\r\n",
  7884.                  conspd);
  7885.             }
  7886.         }
  7887.         } /* Expanded to handle any conceivable speed */
  7888.     }
  7889.     }
  7890. #ifndef MINIDIAL
  7891.     if (mymdmtyp == n_TELEBIT) {
  7892.     if (didweget(lbuf,"CONNECT FAST/KERM")) {
  7893.         mdmstat = CONNECTED;
  7894.         if (dialdpy) printf("FAST/KERM ");
  7895.         return;
  7896.     }
  7897.     }
  7898. #endif /* MINIDIAL */
  7899.     if (didweget(lbuf,"RRING") ||
  7900.     didweget(lbuf,"RINGING") ||
  7901.     didweget(lbuf,"DIALING")) {
  7902.     mdmstat = 0;
  7903.     } else if (didweget(lbuf,"CONNECT")) {
  7904.     mdmstat = CONNECTED;
  7905.     } else if (didweget(lbuf,"OK")) {
  7906.     if (partial) {
  7907.         mdmstat = D_PARTIAL;
  7908.     } else {
  7909.         mdmstat = D_FAILED;
  7910.         dialsta = DIA_ERR;
  7911.     }
  7912.     } else if (didweget(lbuf,"NO CARRIER")) {
  7913.     mdmstat = D_FAILED;
  7914.     dialsta = DIA_NOCA;
  7915.     } else if (didweget(lbuf,"NO DIALTONE")) {
  7916.     mdmstat = D_FAILED;
  7917.     dialsta = DIA_NODT;
  7918.     } else if (didweget(lbuf,"NO DIAL TONE")) {
  7919.     mdmstat = D_FAILED;
  7920.     dialsta = DIA_NODT;
  7921.     } else if (didweget(lbuf,"BUSY")) {
  7922.     mdmstat = D_FAILED;
  7923.     dialsta = DIA_BUSY;
  7924.     } else if (didweget(lbuf,"NO ANSWER")) {
  7925.     mdmstat = D_FAILED;
  7926.     dialsta = DIA_NOAN;
  7927.     } else if (didweget(lbuf,"VOICE")) {
  7928.     mdmstat = D_FAILED;
  7929.     dialsta = DIA_VOIC;
  7930.     } else if (didweget(lbuf,"VCON")) {
  7931.     mdmstat = D_FAILED;
  7932.     dialsta = DIA_VOIC;
  7933.     } else if (didweget(lbuf,"NO PROMPT TONE")) {
  7934.     mdmstat = D_FAILED;
  7935.     dialsta = DIA_NODT;
  7936.     } else if (didweget(lbuf,"REMOTE ACCESS FAILED")) {
  7937.     mdmstat = D_FAILED;
  7938.     dialsta = DIA_NOCA;
  7939.     } else if (didweget(lbuf,"FAX")) {
  7940.     mdmstat = D_FAILED;
  7941.     dialsta = DIA_FAX;
  7942.     } else if (didweget(lbuf,"WAIT - CONNECTING") ||
  7943.            didweget(lbuf,"WAIT-CONNECTING")) { /* AT&T STU-III 19xx */
  7944.     mdmstat = 0;
  7945.     } else if (didweget(lbuf,"DELAYED")) {
  7946.     mdmstat = D_FAILED;
  7947.     dialsta = DIA_DELA;
  7948.     } else if (didweget(lbuf,"BLACKLISTED")) {
  7949.     mdmstat = D_FAILED;
  7950.     dialsta = DIA_BLCK;
  7951.     } else if (didweget(lbuf,"COMPRESSION")) {
  7952.     mdmstat = 0;
  7953.     } else if (didweget(lbuf,"PROTOCOL")) {
  7954.     mdmstat = 0;
  7955.     } else if (didweget(lbuf,"DIAL LOCKED")) { /* Germany, Austria, Schweiz */
  7956.     mdmstat = D_FAILED;
  7957.     dialsta = DIA_BLCK;
  7958.     } else if ( didweget(lbuf,"RING") ||
  7959.             didweget(lbuf,"RING1") || /* Distinctive Ring 1 */
  7960.         didweget(lbuf,"RING2") || /* Distinctive Ring 2 */
  7961.         didweget(lbuf,"RING3") ) {
  7962.     mdmstat = (func_code == 0) ? D_FAILED : 0;
  7963.     dialsta = DIA_RING;
  7964.     } else if (didweget(lbuf,"ERROR")) {
  7965.     mdmstat = D_FAILED;
  7966.     dialsta = DIA_ERR;
  7967.     } else if (didweget(lbuf,"CARRIER")) { /* Boca / Rockwell family */
  7968. #ifdef COMMENT
  7969.     if (is_rockwell)
  7970. #endif /* COMMENT */
  7971.       mdmstat = 0;
  7972. #ifdef COMMENT
  7973.     /* Does CARRIER ever mean the same as CONNECT? */
  7974.     else
  7975.       mdmstat = CONNECTED;
  7976. #endif /* COMMENT */
  7977.     } else if (didweget(lbuf,"DATA")) {    /* Boca / Rockwell family */
  7978.     /* This message is sent when the modem is in FAX mode  */
  7979.     /* So setting this to CONNECTED may not be appropriate */
  7980.     /* We must send ATO\015 to the modem in response       */
  7981.     /* Then we will get a CONNECTED message                */
  7982.     mdmstat = CONNECTED;
  7983.     } else if (didweget(lbuf,"DIGITAL LINE")) {
  7984.     mdmstat = D_FAILED;
  7985.     dialsta = DIA_DIGI;
  7986.     } else if (didweget(lbuf,"DATE")) { /* Caller ID Date */
  7987.     debug(F110,"CALLID DATE",lbuf,0);
  7988.     /* Format is "DATE     =   MMDD"   */
  7989.     makestr(&callid_date,lbuf);
  7990.     } else if (didweget(lbuf,"TIME")) { /* Caller ID Time */
  7991.     /* Format is "TIME     =   HHMM"   */
  7992.     debug(F110,"CALLID TIME",lbuf,0);
  7993.     makestr(&callid_time,lbuf);
  7994.     } else if (didweget(lbuf,"NAME")) { /* Caller ID Name */
  7995.     /* Format is "NAME     =   <listing name>"   */
  7996.     debug(F110,"CALLID NAME",lbuf,0);
  7997.     makestr(&callid_name,lbuf);
  7998.     } else if (didweget(lbuf,"NMBR")) { /* Caller ID Number */
  7999.     /* Format is "NMBR     =   <number>, 'P' or 'O'"   */
  8000.     /*     'P' means Privacy Requested            */
  8001.     /*      'O' means Out of Service or Not available  */
  8002.     debug(F110,"CALLID NMBR",lbuf,0);
  8003.     makestr(&callid_nmbr,lbuf);
  8004.     } else if (didweget(lbuf,"MESG")) { /* Caller ID Unrecognized Message */
  8005.     /* Format is "MESG     =   <tag><length><data><checksum>"   */
  8006.     debug(F110,"CALLID MESG",lbuf,0);
  8007.     makestr(&callid_mesg,lbuf);
  8008.     }
  8009. }
  8010.  
  8011. /* Maybe hang up the phone, depending on various SET DIAL parameters. */
  8012.  
  8013. int
  8014. dialhup() {
  8015.     int x = 0;
  8016.     if (dialhng && dialsta != DIA_PART) { /* DIAL HANGUP ON? */
  8017.     x = mdmhup();            /* Try modem-specific method first */
  8018.     debug(F101,"dialhup mdmhup","",x);
  8019.     if (x > 0) {            /* If it worked, */
  8020.         dialsta = DIA_HUP;
  8021.         if (dialdpy)
  8022.           printf(" Modem hangup OK\r\n"); /* fine. */
  8023.     } else if (network        /* If we're telnetted to */
  8024. #ifdef TN_COMPORT
  8025.                    && !istncomport()    /* (without RFC 2217)    */
  8026. #endif /* TN_COMPORT */
  8027.                    ) {        
  8028.         dialsta = DIA_HANG;
  8029.         if (dialdpy)        /* a modem server, just print a msg */
  8030.           printf(" WARNING - modem hangup failed\r\n"); /* don't hangup! */
  8031.         return(0);
  8032.     } else {            /* Otherwise */
  8033.         x = tthang();        /* Tell the OS to turn off DTR. */
  8034.         if (x > 0) {        /* Yes, tell results from tthang() */
  8035.         dialsta = DIA_HUP;
  8036.         if (dialdpy) printf(" Hangup OK\r\n");
  8037.         } else if (x == 0) {
  8038.         if (dialdpy) printf(" Hangup skipped\r\n");
  8039.         } else {
  8040.         dialsta = DIA_HANG;
  8041.         if (dialdpy) perror(" Hangup error");
  8042.         }
  8043.         ttflui();
  8044.     }
  8045.     } else if (dialdpy) printf(" Hangup skipped\r\n"); /* DIAL HANGUP OFF */
  8046.     return(x);
  8047. }
  8048.  
  8049. /*
  8050.   M D M H U P  --
  8051.  
  8052.   Sends escape sequence to modem, then sends its hangup command.  Returns:
  8053.    0: If modem type is 0 (direct serial connection),
  8054.       or if modem type is < 0 (network connection),
  8055.       or if no action taken because DIAL MODEM-HANGUP is OFF)
  8056.         or because no hangup string for current modem type,
  8057.       or C-Kermit is in remote mode,
  8058.       or if action taken but there was no positive response from modem;
  8059.    1: Success: modem is in command state and acknowledged the hangup command;
  8060.   -1: On modem command error.
  8061. */
  8062. int
  8063. mdmhup() {
  8064. #ifdef MDMHUP
  8065.     int m, x = 0;
  8066.     int xparity;
  8067.     int savcarr;
  8068.     extern int ttcarr;
  8069.     char *s, *p, c;
  8070.     MDMINF * mp = NULL;
  8071.  
  8072.     debug(F101,"mdmhup dialmhu","",dialmhu); /* MODEM-HANGUP METHOD */
  8073.     debug(F101,"mdmhup local","",local);
  8074.  
  8075.     if (dialmhu == 0 || local == 0)    /* If DIAL MODEM-HANGUP is OFF, */
  8076.       return(0);            /*  or not in local mode, fail. */
  8077.  
  8078.     debug(F101,"mdmhup dialsta","",dialsta);
  8079.     debug(F101,"mdmhup mdmset","",mdmset);
  8080.  
  8081.     if (dialsta != DIA_OK && !mdmset)    /* It's not a dialed connection */
  8082.       return(0);
  8083.  
  8084. #ifdef CK_TAPI
  8085.     if (tttapi && !tapipass)        /* Don't hangup if using TAPI */
  8086.       return(0);
  8087. #endif /* CK_TAPI */
  8088.  
  8089. #ifdef COMMENT
  8090.     /* No, we still need this for modems that ignore DTR */
  8091.     if (mymdmtyp == n_GENERIC && !network)
  8092.       return(0);
  8093. #endif /* COMMENT */
  8094.  
  8095.     debug(F101,"mdmhup dialesc","",dialesc);
  8096.     if (dialesc < 0)
  8097.       return(0);            /* No modem escape-character, fail. */
  8098.  
  8099.     savcarr = ttcarr;
  8100.     ttcarr = CAR_OFF;
  8101.     x = ttchk();
  8102.     ttcarr = savcarr;
  8103.     debug(F101,"mdmhup ttchk","",x);
  8104.     if (x < 0)                /* There appears to be no connection */
  8105.       return(0);
  8106.     x = 0;
  8107.  
  8108. #ifdef OS2
  8109. /*
  8110.   In OS/2, if CARRIER is OFF, and there is indeed no carrier signal, any
  8111.   attempt to do i/o at this point can hang the program.  This might be true
  8112.   for other operating systems too.
  8113. */
  8114.     if (!network            /* Not a network connection */
  8115. #ifdef TN_COMPORT
  8116.         || istncomport()
  8117. #endif /* TN_COMPORT */
  8118.     ) {
  8119.     m = ttgmdm();            /* Get modem signals */
  8120.     if ((m > -1) && (m & BM_DCD == 0)) /* Check for carrier */
  8121.       return(0);            /* No carrier, skip the rest */
  8122.     }
  8123. #endif /* OS2 */
  8124.  
  8125.     debug(F111,"mdmhup network",ttname,network);
  8126.     debug(F101,"mdmhup mymdmtyp","",mymdmtyp);
  8127.     debug(F101,"mdmhup mdmtyp","",mdmtyp);
  8128.     /* In case of HANGUP before DIAL */
  8129.     if (network && mdmtyp < 1)        /* SET HOST but no subsequent */
  8130.       return(0);            /* SET MODEM TYPE... */
  8131.     if (mymdmtyp == 0 && mdmtyp > 0)
  8132.       mymdmtyp = mdmtyp;
  8133.     if (mymdmtyp < 1)            /* Not using a modem */
  8134.       return(0);
  8135.     if (mymdmtyp > 0)            /* An actual modem... */
  8136.       mp = modemp[mymdmtyp];
  8137.     if (!mp) {                /* Get pointer to its MDMINF struct */
  8138.     debug(F100,"mdmhup no MDMINF","",0);
  8139.     return(0);
  8140.     }
  8141.     mdmcapas = dialcapas ? dialcapas : mp->capas;
  8142.     xx_ok = mp->ok_fn;            /* Pointer to response reader */
  8143.  
  8144.     s = dialhcmd ? dialhcmd : mp->hup_str; /* Get hangup command */
  8145.     if (!s) s = "";
  8146.     debug(F110,"mdmhup hup_str",s,0);
  8147.     if (!*s) return(0);            /* If none, fail. */
  8148.  
  8149.     if (ttpkt(speed,FLO_DIAL,parity) < 0) /* Condition line for dialing */
  8150.       return(-1);
  8151.  
  8152.     xparity = parity;            /* Set PARITY to NONE temporarily */
  8153.     parity = 0;
  8154.  
  8155.     /* In case they gave a SET MODEM ESCAPE command recently... */
  8156.  
  8157.     if (dialesc < 0 || dialesc > 127)
  8158.       c = NUL;
  8159.     else
  8160.       c = (char) (dialesc ? dialesc : mp->esc_char);
  8161.  
  8162.     if (mdmcapas & CKD_AT) {        /* Hayes compatible */
  8163.     escbuf[0] = c;
  8164.     escbuf[1] = c;
  8165.     escbuf[2] = c;
  8166.     escbuf[3] = NUL;
  8167.     } else {                /* Other */
  8168.     escbuf[0] = c;
  8169.     escbuf[1] = NUL;
  8170.     }
  8171.     debug(F110,"mdmhup escbuf",escbuf,0);
  8172.     if (escbuf[0]) {            /* Have escape sequence? */
  8173.     debug(F101,"mdmhup esc_time",0,mp->esc_time);
  8174.     if (mp->esc_time)        /* If we have a guard time */
  8175.       msleep(mp->esc_time);        /* Pause for guard time */
  8176.     debug(F100,"mdmhup pause 1 OK","",0);
  8177.  
  8178. #ifdef NETCONN                /* Send modem's escape sequence */
  8179.     if (network) {            /* Must catch errors here. */
  8180.         if (ttol((CHAR *)escbuf,(int)strlen((char *)escbuf)) < 0) {
  8181.         parity = xparity;
  8182.         return(-1);
  8183.         }
  8184.         debug(F110,"mdmhup ttslow net ok",escbuf,0);
  8185.     } else {
  8186. #endif /* NETCONN */
  8187.         ttslow((char *)escbuf,wr); /* Send escape sequence */
  8188.         debug(F110,"mdmhup ttslow ok",escbuf,0);
  8189. #ifdef NETCONN
  8190.     }
  8191. #endif /* NETCONN */
  8192.  
  8193.     if (mp->esc_time)        /* Pause for guard time again */
  8194.       msleep(mp->esc_time);
  8195.     else
  8196.       msleep(500);            /* Wait half a sec for echoes. */
  8197.     debug(F100,"mdmhup pause 1 OK","",0);
  8198. #ifdef COMMENT
  8199.     ttflui();            /* Flush response or echo, if any */
  8200.     debug(F100,"mdmhup ttflui OK","",0);
  8201. #endif /* COMMENT */
  8202.     }
  8203.     ttslow(s,wr);            /* Now Send hangup string */
  8204.     debug(F110,"mdmhup ttslow ok",s,0);
  8205. /*
  8206.   This is not exactly right, but it works.
  8207.   If we are online:
  8208.     the modem says OK when it gets the escape sequence,
  8209.     and it says NO CARRIER when it gets the hangup command.
  8210.   If we are offline:
  8211.     the modem does NOT say OK (or anything else) when it gets the esc sequence,
  8212.     but it DOES say OK (and not NO CARRIER) when it gets the hangup command.
  8213.   So the following function should read the OK in both cases.
  8214.   Of course, this is somewhat Hayes-specific...
  8215. */
  8216.     if (xx_ok) {            /* Look for OK response */
  8217.     debug(F100,"mdmhup calling response function","",0);
  8218.     x = (*xx_ok)(3,1);        /* Give it 3 seconds, be strict. */
  8219.     debug(F101,"mdmhup hangup response","",x);
  8220.     msleep(500);            /* Wait half a sec */
  8221.     ttflui();            /* Get rid of NO CARRIER, if any */
  8222.     } else {                /* No OK function, */
  8223.     x = 1;                /* so assume it worked */
  8224.     debug(F101,"mdmhup no ok_fn","",x);
  8225.     }
  8226.     parity = xparity;            /* Restore prevailing parity */
  8227.     return(x);                /* Return OK function's return code. */
  8228.  
  8229. #else  /* MDMHUP not defined. */
  8230.  
  8231.     debug(F100,"mdmhup MDMHUP not defined","",0);
  8232.     return(0);                /* Always fail. */
  8233.  
  8234. #endif /* MDMHUP */
  8235. }
  8236.  
  8237. #endif /* NOICP */
  8238. #else /* NODIAL */
  8239.  
  8240. int mdmtyp = 0;                /* Default modem type */
  8241.  
  8242. int                    /* To allow NODIAL versions to */
  8243. mdmhup() {                /* call mdmhup(), so calls to  */
  8244.     return(0);                /* mdmhup() need not be within */
  8245. }                    /* #ifndef NODIAL conditionals */
  8246. #endif /* NODIAL */
  8247. #else
  8248. int mdmtyp = 0;                /* Default modem type */
  8249. #endif /* NOLOCAL */
  8250.