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