home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ckc197.zip / ckudia.c < prev    next >
C/C++ Source or Header  |  2000-01-02  |  230KB  |  7,681 lines

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