home *** CD-ROM | disk | FTP | other *** search
- From: wht@n4hgf.uucp (Warren Tucker)
- Newsgroups: comp.sources.misc
- Subject: v16i050: ECU async comm package rev 3.0, Part26/35
- Message-ID: <1991Jan6.052633.28654@sparky.IMD.Sterling.COM>
- Date: 6 Jan 91 05:26:33 GMT
- Approved: kent@sparky.imd.sterling.com
- X-Checksum-Snefru: cf38427c c202b56d 963eb372 0f7eb07f
-
- Submitted-by: wht@n4hgf.uucp (Warren Tucker)
- Posting-number: Volume 16, Issue 50
- Archive-name: ecu3/part26
-
- ---- Cut Here and feed the following to sh ----
- #!/bin/sh
- # This is part 26 of ecu3
- if touch 2>&1 | fgrep 'amc' > /dev/null
- then TOUCH=touch
- else TOUCH=true
- fi
- # ============= gendial/template.c ==============
- if test ! -d 'gendial'; then
- echo 'x - creating directory gendial'
- mkdir 'gendial'
- fi
- echo 'x - extracting gendial/template.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gendial/template.c' &&
- X/*+-------------------------------------------------------------------------
- X template.c - DCE-specific portion of generic SCO UUCP dialer
- X wht@n4hgf.Mt-Park.GA.US
- X
- X Necessary DCE switch setting or other configuration:
- X Switch foo off: enable onhook upon loss of DTR
- X--------------------------------------------------------------------------*/
- X/*+:EDITS:*/
- X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
- X
- X#include "dialer.h"
- X
- X/*
- X * DCE_DTR_low_msec - milliseconds to hold DTR low to ensure DCE
- X * sees the transition; this value may be changed
- X * as necessary before each call to ltoggleDTR(),
- X * but, generally, a constant value will do.
- X */
- Xlong DCE_DTR_low_msec = 500;
- X
- X/*
- X * DCE_DTR_high_msec - milliseconds DTR must remain high before the
- X * DCE may be expected to be ready to be commanded
- X */
- Xlong DCE_DTR_high_msec = 500;
- X
- X/*
- X * DCE_write_pase_msec - milliseconds to pause between each character
- X * sent to the DCE (zero if streaming I/O is
- X * permitted); this value may be changed as
- X * necessary before each call to lwrite(), but, generally, a constant
- X * value will do. Note that this value is used to feed a value to nap(),
- X * which has a granularity of .010 seconds on UNIX/386, .020 on XENIX/286
- X * and .050 seconds on XENIX/86.
- X */
- Xlong DCE_write_pace_msec = 20;
- X
- X/*
- X * DCE_name - short name for DCE
- X * DCE_revision - revision number for this module
- X */
- Xchar *DCE_name = "Frobozz 9600";
- Xchar *DCE_revision = "1.00";
- X
- X/*
- X * DCE_hangup_CBAUD - baud rate to use for hanging up DCE
- X * and readying it for dial in access
- X * (BXXX mask); use a value of zero if the speed
- X * specified by the invoker is to be used.
- X * This value is useful for DCEs such as the early Hayes 2400
- X * which are so unfortunately compatible with their 1200 predecessor
- X * that they refuse to answer at 2400 baud unless you last spoke to
- X * them at that rate. For such bad boys, use B2400 below.
- X */
- Xint DCE_hangup_CBAUD = 0;
- X/* int DCE_hangup_CBAUD = B2400; */
- X
- X/*
- X * DCE_results - a table of DCE response strings and a token
- X * code for each; when you call lread() or lread_ignore(),
- X * if the read routine detects one of the strings,
- X * the appropriate code is returned. If no string matches, then
- X * lread()/lread_ignore examines the DCE result string for a
- X * numeric value; if one is found, the numeric value or'd with
- X * 0x4000 is returned (in this way, e.g., you can read "modem
- X * S registers." If nothing agrees with this search, lread()
- X * will abort the program with RC|FAIL|RCE_TIMOUT, lread_ignore()
- X * will return -1. You may use any value between 0 and 0x3FFFFFFF.
- X * This module is the only consumer of the codes, although they
- X * are decoded by gendial.c's _lread()
- X */
- X#define rfConnect 0x00400000
- X
- X#define rOk 0
- X#define rNoCarrier 1
- X#define rError 2
- X#define rNoDialTone 3
- X#define rBusy 4
- X#define rNoAnswer 5
- X#define rRring 6
- X#define rConnect300 (7 | rfConnect)
- X#define rConnect1200 (8 | rfConnect)
- X#define rConnect2400 (9 | rfConnect)
- X
- XDCE_RESULT DCE_results[] =
- X{
- X { "OK", rOk, },
- X { "NO CARRIER", rNoCarrier, },
- X { "ERROR", rError },
- X { "NO DIALTONE", rNoDialTone, },
- X { "BUSY", rBusy },
- X { "NO ANSWER", rNoAnswer },
- X { (char *)0, -1 } /* end table */
- X};
- X
- X/*+-------------------------------------------------------------------------
- X DCE_baud_to_CBAUD(baud) - check for valid baud rates supported by DCE
- X
- X DCE dependent function must validate baud rates supported by DCE
- X returns baud rate in struct termio c_cflag fashion
- X or terminates program with error
- X--------------------------------------------------------------------------*/
- Xint
- XDCE_baud_to_CBAUD(baud)
- Xunsigned int baud;
- X{
- X switch(baud)
- X {
- X case 50: return(B50); /* delete the ones you dont handle */
- X case 75: return(B75);
- X case 110: return(B110);
- X case 134: return(B134);
- X case 150: return(B150);
- X case 300: return(B300);
- X case 1200: return(B1200);
- X case 2400: return(B2400);
- X case 4800: return(B4800);
- X case 9600: return(B9600);
- X
- X#if defined(B19200)
- X case 19200: return(B19200);
- X#else
- X#ifdef EXTA
- X case 19200: return(EXTA);
- X#endif
- X#endif
- X
- X#if defined(B38400)
- X case 38400: return(B38400);
- X#else
- X#ifdef EXTB
- X case 38400: return(EXTB);
- X#endif
- X#endif
- X
- X }
- X myexit(RC_FAIL | RCE_SPEED);
- X} /* end of DCE_baud_to_CBAUD */
- X
- X/*+-------------------------------------------------------------------------
- X DCE_hangup() - issue hangup command to DCE
- X
- XThis function should do whatever is necessary to ensure
- X1) any active connection is terminated
- X2) the DCE is ready to receive an incoming call if DTR is asserted
- X3) the DCE will not accept an incoming call if DTR is false
- X
- XThe function should return when done.
- X
- XAny necessary switch setting or other configuration necessary for this
- Xfunction to succeed should be documented at the top of the module.
- X--------------------------------------------------------------------------*/
- Xvoid
- XDCE_hangup()
- X{
- X DEBUG(3,"RESETING %s\n",DCE_name);
- X
- X} /* end of DCE_hangup */
- X
- X/*+-------------------------------------------------------------------------
- X DCE_dial(telno) - dial a remote DCE
- X
- XThis function should connect to the remote DCE and use any success
- Xindication to modify the tty baud rate if necessary before returning.
- X
- XUpon successful connection, return 0.
- X
- XUpon unsuccessful connection, return RC_FAIL or'd with an appropriate
- XRCE_XXX value from dialer.h.
- X
- Xlwrite() is used to write to the DCE.
- X
- Xlread() and lread_ignore() are used to read from the DCE. Read timeouts
- Xfrom calling lread() will result automatically in the proper error
- Xtermination of the program. Read timeouts from calling lread_ignore()
- Xreturn -1; you handle the execption here.
- X
- XAny necessary coding of phone numbers, switch settings or other
- Xconfiguration necessary for this function to succeed should be
- Xdocumented at the top of the module.
- X--------------------------------------------------------------------------*/
- Xint
- XDCE_dial(telno)
- Xchar *telno;
- X{
- Xchar cmd[80];
- X
- X/* preliminary setup */
- X
- X/* if root, let him see number, otherwise just say "remote system" */
- X DEBUG(1,"DIALING %s\n", (uid) ? "remote system" : telno);
- X
- X/* indicate non-root should not see DTE->DCE traffic */
- X secure = 1;
- X
- X/* issue the actual dialing command */
- X
- X/* indicate non-root can see DTE->DCE traffic */
- X secure = 0;
- X
- X return(0); /* succeeded */
- X
- X} /* end of DCE_dial */
- X
- X/**********************************************************
- X* You probably do not need to modify the code below here *
- X**********************************************************/
- X
- X/*+-------------------------------------------------------------------------
- X DCE_abort(sig) - dial attempt aborted
- X
- X sig = 0 if non-signal abort (read timeout, most likely)
- X != 0 if non-SIGALRM signal caught
- X
- X extern int dialing set 1 if dialing request was active,
- X else 0 if hangup request was active
- X
- XThis is a chance for the DCE-specific code to do anything it
- Xneeds to cl,ean up after a failure. Note that if a dialing
- Xcall fails, it is the responsibility of the higher-level
- Xprogram calling the dialer to call it again with a hangup request, so
- Xthis function is usually a no-op.
- X--------------------------------------------------------------------------*/
- Xvoid
- XDCE_abort(sig)
- Xint sig;
- X{
- X DEBUG(10,"DCE_abort(%d);\n",sig);
- X} /* end of DCE_abort */
- X
- X/*+-------------------------------------------------------------------------
- X DCE_exit(exitcode) - "last chance for gas" in this incarnation
- X
- XThe independent portion of the dialer program calls this routine in
- Xlieu of exit() in every case except one (see DCE_argv_hook() below).
- XNormally, this function just passes it's argument to exit(), but
- Xany necessary post-processing can be done. The function must,
- Xhowever, eventually call exit(exitcode);
- X--------------------------------------------------------------------------*/
- Xvoid
- XDCE_exit(exitcode)
- Xint exitcode;
- X{
- X DEBUG(10,"DCE_exit(%d);\n",exitcode);
- X exit(exitcode);
- X} /* end of DCE_exit */
- X
- X/*+-------------------------------------------------------------------------
- X DCE_argv_hook(argc,argv,optind,unrecognized_switches)
- X
- XThis hook gives DCE-specific code a chance to look over the entire
- Xcommand line, such as for -z Telebit processing.
- X
- Xargc andf argv are the same values passed to main(),
- X
- Xoptind is the value of optind at the end of normal getopt processing.
- X
- Xunrecognized_switches is the count of switches not handled by main().
- XSpecifically, -h and -x are standard switches.
- X
- XNormally, this function should just return RC_FAIL|RCE_ARGS if there are
- Xany unrecognized switches, otherwise zero. If you keep your nose clean
- Xthough, you can do anything you need to do here and exit the program.
- X
- XNote: only simple switches (with no argument) may be used with this
- Xfacility if the functrion is to return,' since main()'s getopt() will
- Xstop processing switches if it runs into an unrecognized switch with an
- Xargument.
- X
- XIf the function returns a non-zero value, then the value will be passed
- XDIRECTLY to exit() with no further ado. Thus, a non-zero value must be
- Xof the format expected by dialer program callers, with RC_FAIL set as a
- Xminimum.
- X--------------------------------------------------------------------------*/
- Xint
- XDCE_argv_hook(argc,argv,optind,unrecognized_switches)
- Xint argc;
- Xchar **argv;
- Xint optind;
- Xint unrecognized_switches;
- X{
- X if(unrecognized_switches)
- X return(RC_FAIL | RCE_ARGS);
- X return(0);
- X} /* end of DCE_argv_hook */
- X
- X/* vi: set tabstop=4 shiftwidth=4: */
- SHAR_EOF
- $TOUCH -am 0814204290 'gendial/template.c' &&
- chmod 0644 gendial/template.c ||
- echo 'restore of gendial/template.c failed'
- Wc_c="`wc -c < 'gendial/template.c'`"
- test 9615 -eq "$Wc_c" ||
- echo 'gendial/template.c: original size 9615, current size' "$Wc_c"
- # ============= gendial/dceMC9624.c ==============
- echo 'x - extracting gendial/dceMC9624.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gendial/dceMC9624.c' &&
- X/* CHK=0xB3C9 */
- X#define WHT
- X/*+-------------------------------------------------------------------------
- X dceMC9624.c - DCE-specific portion of generic SCO UUCP dialer
- X Driver for Microcom AX/9624c (assuming DTMF dialing only)
- X wht@n4hgf.Mt-Park.GA.US
- X--------------------------------------------------------------------------*/
- X/*+:EDITS:*/
- X/*:11-29-1990-18:31-r@n4hgf-revision/1st releasable */
- X/*:07-24-1990-15:36-wht@n4hgf-add speaker on/off */
- X/*:07-20-1990-00:10-wht@n4hgf-creation */
- X
- X#include "dialer.h"
- X
- X/*
- X * DCE_DTR_low_msec - milliseconds to hold DTR low to ensure DCE
- X * sees the transition; this value may be changed
- X * as necessary before each call to ltoggleDTR(),
- X * but, generally, a constant value will do.
- X */
- Xlong DCE_DTR_low_msec = 500;
- X
- X/*
- X * DCE_DTR_high_msec - milliseconds DTR must remain high before the
- X * DCE may be expected to be ready to be commanded
- X */
- Xlong DCE_DTR_high_msec = 500;
- X
- X/*
- X * DCE_write_pase_msec - milliseconds to pause between each character
- X * sent to the DCE (zero if streaming I/O is
- X * permitted); this value may be changed as
- X * necessary before each call to lwrite(), but, generally, a constant
- X * value will do. Note that this value is used to feed a value to nap(),
- X * which has a granularity of .010 seconds on UNIX/386, .020 on XENIX/286
- X * and .050 seconds on XENIX/86.
- X */
- Xlong DCE_write_pace_msec = 0;
- X
- X/*
- X * DCE_name - short name for DCE
- X * DCE_revision - revision number for this module
- X */
- Xchar *DCE_name = "Microcom AX/9624c";
- Xchar *DCE_revision = "1.00";
- X
- X/*
- X * DCE_hangup_CBAUD - baud rate to use for hanging up DCE
- X * and readying it for dial in access
- X * (BXXX mask); use a value of zero if the speed
- X * specified by the invoker is to be used.
- X * This value is useful for DCEs such as the early Hayes 2400
- X * which are so unfortunately compatible with their 1200 predecessor
- X * that they refuse to answer at 2400 baud unless you last spoke to
- X * them at that rate. For such bad boys, use B2400 below.
- X */
- Xint DCE_hangup_CBAUD = 0;
- X/* int DCE_hangup_CBAUD = B2400; */
- X
- X/*
- X * DCE_results - a table of DCE response strings and a token
- X * code for each; when you call lread() or lread_ignore(),
- X * if the read routine detects one of the strings,
- X * the appropriate code is returned. If no string matches, then
- X * lread()/lread_ignore examines the DCE result string for a
- X * numeric value; if one is found, the numeric value or'd with
- X * 0x40000000 is returned (in this way, e.g., you can read "modem
- X * S registers"). If nothing agrees with this search, lread()
- X * will abort the program with RC|FAIL|RCE_TIMOUT, lread_ignore()
- X * will return -1. You may use any value between 0 and 0x3FFFFFFF.
- X * This module is the only consumer of the codes, although they
- X * are decoded by gendial.c's _lread()
- X */
- X
- X/* flag bits */
- X#define rfConnect 0x00800000
- X#define rfREL 0x00400000
- X#define rfMASK 0x0000FFFF /* mask off rfBits */
- X
- X/* unique codes */
- X#define rOk 0
- X#define rNoCarrier 1
- X#define rError 2
- X#define rNoDialTone 3
- X#define rBusy 4
- X#define rNoAnswer 5
- X#define rConnect300 ( 300 | rfConnect)
- X#define rConnect1200 ( 1200 | rfConnect)
- X#define rConnect2400 ( 1200 | rfConnect)
- X#define rConnect4800 ( 4800 | rfConnect)
- X#define rConnect9600 ( 9600 | rfConnect)
- X#define rConnect300R ( 300 | rfConnect | rfREL)
- X#define rConnect1200R ( 1200 | rfConnect | rfREL)
- X#define rConnect2400R ( 2400 | rfConnect | rfREL)
- X#define rConnect4800R ( 4800 | rfConnect | rfREL)
- X#define rConnect9600R ( 9600 | rfConnect | rfREL)
- X
- XDCE_RESULT DCE_results[] =
- X{
- X { "OK", rOk, },
- X { "NO CARRIER", rNoCarrier, },
- X { "ERROR", rError },
- X { "NO DIALTONE", rNoDialTone, },
- X { "BUSY", rBusy },
- X { "NO ANSWER", rNoAnswer },
- X { "CONNECT 300/REL", rConnect300R },
- X { "CONNECT 1200/REL", rConnect1200R },
- X { "CONNECT 2400/REL", rConnect2400R },
- X { "CONNECT 4800/REL", rConnect4800R },
- X { "CONNECT 9600/REL", rConnect9600R },
- X { "CONNECT 300", rConnect300 },
- X { "CONNECT 1200", rConnect1200 },
- X { "CONNECT 2400", rConnect2400 },
- X { "CONNECT 4800", rConnect4800 },
- X { "CONNECT 9600", rConnect9600 },
- X { (char *)0, -1 } /* end table */
- X};
- X
- X/*+-------------------------------------------------------------------------
- X DCE_baud_to_CBAUD(baud) - check for valid baud rates supported by DCE
- X
- X DCE dependent function must validate baud rates supported by DCE
- X returns baud rate in struct termio c_cflag fashion
- X or terminates program with error
- X--------------------------------------------------------------------------*/
- Xint
- XDCE_baud_to_CBAUD(baud)
- Xunsigned int baud;
- X{
- X switch(baud)
- X {
- X case 110: return(B110);
- X case 300: return(B300);
- X case 1200: return(B1200);
- X case 2400: return(B2400);
- X case 4800: return(B4800);
- X case 9600: return(B9600);
- X
- X#if defined(B19200)
- X case 19200: return(B19200);
- X#else
- X#ifdef EXTA
- X case 19200: return(EXTA);
- X#endif
- X#endif
- X
- X }
- X myexit(RC_FAIL | RCE_SPEED);
- X} /* end of DCE_baud_to_CBAUD */
- X
- X/*+-------------------------------------------------------------------------
- X sync_Microcom() - sync modem with our DTE speed
- X--------------------------------------------------------------------------*/
- Xvoid
- Xsync_Microcom()
- X{
- Xregister int maxretry = 4;
- Xregister int count;
- Xunsigned char rdchar;
- X
- X while(maxretry--)
- X {
- X lflush();
- X DCE_write_pace_msec = 20;
- X lwrite("ATQ0E1V1\r");
- X DCE_write_pace_msec = 0;
- X if(lread_ignore(2) == rOk)
- X return;
- X }
- X
- X DEBUG(1,"Microcom SYNC FAILED\n",0);
- X myexit(RC_FAIL | RCE_TIMOUT);
- X
- X} /* end of sync_Microcom */
- X
- X/*+-------------------------------------------------------------------------
- X DCE_hangup() - issue hangup command to DCE
- X
- XThis function should do whatever is necessary to ensure
- X1) any active connection is terminated
- X2) the DCE is ready to receive an incoming call if DTR is asserted
- X3) the DCE will not accept an incoming call if DTR is false
- X
- XThe function should return when done.
- X
- XAny necessary switch setting or other configuration necessary for this
- Xfunction to succeed should be documented at the top of the module.
- X--------------------------------------------------------------------------*/
- Xvoid
- XDCE_hangup()
- X{
- Xchar *dialin = "ATS0=1Q1E0M0\\N3\\Q1\\G1%C1%P2\r";
- X
- X DEBUG(7,"INITIALIZING %s\n",dce_name);
- X
- X ltoggleDTR(2000L);
- X sync_Microcom();
- X lwrite(dialin);
- X nap(500L);
- X
- X} /* end of DCE_hangup */
- X
- X/*+-------------------------------------------------------------------------
- X DCE_dial(telno) - dial a remote DCE
- X
- XThis function should connect to the remote DCE and use any success
- Xindication to modify the tty baud rate if necessary before returning.
- X
- XUpon successful connection, return 0.
- X
- XUpon unsuccessful connection, return RC_FAIL or'd with an appropriate
- XRCE_XXX value from dialer.h.
- X
- Xlwrite() is used to write to the DCE.
- X
- Xlread() and lread_ignore() are used to read from the DCE. Read timeouts
- Xfrom calling lread() will result automatically in the proper error
- Xtermination of the program. Read timeouts from calling lread_ignore()
- Xreturn -1; you handle the execption here.
- X
- XAny necessary coding of phone numbers, switch settings or other
- Xconfiguration necessary for this function to succeed should be
- Xdocumented at the top of the module.
- X
- XMicrocom Plus-specific comments:
- X--------------------------------------------------------------------------*/
- Xint
- XDCE_dial(telno)
- Xchar *telno;
- X{
- Xchar cmd[128];
- Xint s50_set = 0;
- Xint s111_set = 0;
- Xint timeout;
- Xint result;
- Xlong then;
- Xlong now;
- Xchar *cptr;
- Xchar phnum[42];
- X#define MDVALID "0123456789NnSs,*#()-"
- Xchar *setup = "ATQ0E1V1X4S0=0&D2&C1%C1%P2";
- Xchar *setup_REL = "\\N3\\Q1\\G1";
- Xchar *setup_NORM = "\\N0\\Q0\\G0";
- X
- X/* preliminary setup */
- X translate("=,-,",telno);
- X if(strspn(telno,MDVALID) != strlen(telno))
- X {
- X DEBUG(1,"phone number has invalid characters\n",0);
- X return(RC_FAIL | RCE_PHNO);
- X }
- X if(decode_phone_number(telno,phnum,sizeof(phnum)))
- X {
- X DEBUG(1,"phone number too long\n",0);
- X return(RC_FAIL | RCE_PHNO);
- X }
- X
- X/*
- X * calculate a timeout for the connect
- X * allow a minimum of 40 seconds, if reliable, 50
- X * also if long distance (North American calculation here)
- X * make it 132
- X */
- X timeout = 40;
- X if(hiCBAUD > B2400)
- X timeout = 50;
- X if((phnum[0] == '1') && (phnum[0] != '0'))
- X timeout = 132;
- X for(cptr = phnum; cptr = strchr(cptr,','); cptr++)
- X timeout += 2; /* add extra time for pause characters */
- X DEBUG(6,"timeout waiting for connect = %d seconds\n",timeout);
- X
- X/*
- X * build and issue the dialout setup command
- X * 9624's S7 timing is way off (S7 is calculated as timeout * .6)
- X */
- X DEBUG(1,"--> issuing setup command\n",0);
- X sprintf(cmd,"%s%sS7=%d\r",
- X setup,
- X (hiCBAUD > B2400) ? setup_REL : setup_NORM,
- X (timeout * 6) / 10);
- X
- X sync_Microcom();
- X lwrite(cmd);
- X if(lread(2) != rOk)
- X return(RC_FAIL | RCE_NULL);
- X
- X/* indicate non-root should not see DTE->DCE traffic */
- X secure = 1;
- X
- X/*
- X * build and issue the actual dialing command
- X * if root, let him see number, otherwise just say "remote system"
- X */
- X#ifdef WHT
- X if(!strncmp(*gargv,"ECU",3))
- X dialer_codes['S' - 'A'] = 1;
- X#endif
- X DEBUG(1,"--> dialing %s\n", (uid) ? "remote system" : phnum);
- X sprintf(cmd,"ATS2=1M%dDT%s\r",
- X ((dialer_codes['S' - 'A']) && !(dialer_codes['N' - 'A'])) ? 1 : 0,
- X phnum);
- X
- X /* cmd string can only be 40 characters including "AT" */
- X if(strlen(cmd) > 40)
- X {
- X DEBUG(1,"phone number string too long\n",0);
- X cleanup(RC_FAIL | RCE_PHNO);
- X }
- X
- X lwrite(cmd);
- X
- X/* indicate non-root can see DTE->DCE traffic */
- X secure = 0;
- X
- X/* wait for connect */
- XWAIT_FOR_CONNECT:
- X time(&then);
- X result = lread(timeout);
- X if(!(result & rfConnect))
- X {
- X switch(result & rfMASK)
- X {
- X case rNoDialTone:
- X return(RC_FAIL | RCE_NOTONE);
- X case rBusy:
- X return(RC_FAIL | RCE_BUSY);
- X case rNoAnswer:
- X case rNoCarrier: /* with ATX4, NO CARRIER == NO ANSWER
- X * since BUSY and NO DIAL TONE are reported
- X */
- X return(RC_FAIL | RCE_ANSWER);
- X default:
- X return(RC_FAIL | RCE_NULL);
- X }
- X }
- X
- X return(0); /* succeeded */
- X
- X} /* end of DCE_dial */
- X
- X/**********************************************************
- X* You probably do not need to modify the code below here *
- X**********************************************************/
- X
- X/*+-------------------------------------------------------------------------
- X DCE_abort(sig) - dial attempt aborted
- X
- X sig = 0 if non-signal abort (read timeout, most likely)
- X != 0 if non-SIGALRM signal caught
- X
- X extern int dialing set 1 if dialing request was active,
- X else 0 if hangup request was active
- X
- XThis is a chance for the DCE-specific code to do anything it
- Xneeds to cl,ean up after a failure. Note that if a dialing
- Xcall fails, it is the responsibility of the higher-level
- Xprogram calling the dialer to call it again with a hangup request, so
- Xthis function is usually a no-op.
- X--------------------------------------------------------------------------*/
- Xvoid
- XDCE_abort(sig)
- Xint sig;
- X{
- X DEBUG(10,"DCE_abort(%d);\n",sig);
- X} /* end of DCE_abort */
- X
- X/*+-------------------------------------------------------------------------
- X DCE_exit(exitcode) - "last chance for gas" in this incarnation
- X
- XThe independent portion of the dialer program calls this routine in
- Xlieu of exit() in every case except one (see DCE_argv_hook() below).
- XNormally, this function just passes it's argument to exit(), but
- Xany necessary post-processing can be done. The function must,
- Xhowever, eventually call exit(exitcode);
- X--------------------------------------------------------------------------*/
- Xvoid
- XDCE_exit(exitcode)
- Xint exitcode;
- X{
- X DEBUG(10,"DCE_exit(%d);\n",exitcode);
- X exit(exitcode);
- X} /* end of DCE_exit */
- X
- X/*+-------------------------------------------------------------------------
- X DCE_argv_hook(argc,argv,optind,unrecognized_switches)
- X
- XThis hook gives DCE-specific code a chance to look over the entire
- Xcommand line, such as for -z processing.
- X
- Xargc andf argv are the same values passed to main(),
- X
- Xoptind is the value of optind at the end of normal getopt processing.
- X
- Xunrecognized_switches is the count of switches not handled by main().
- XSpecifically, -h and -x are standard switches.
- X
- XNormally, this function should just return RC_FAIL|RCE_ARGS if there are
- Xany unrecognized switches, otherwise zero. If you keep your nose clean
- Xthough, you can do anything you need to do here and exit the program.
- X
- XNote: only simple switches (with no argument) may be used with this
- Xfacility if the functrion is to return,' since main()'s getopt() will
- Xstop processing switches if it runs into an unrecognized switch with an
- Xargument.
- X
- XIf the function returns a non-zero value, then the value will be passed
- XDIRECTLY to exit() with no further ado. Thus, a non-zero value must be
- Xof the format expected by dialer program callers, with RC_FAIL set as a
- Xminimum.
- X--------------------------------------------------------------------------*/
- Xint
- XDCE_argv_hook(argc,argv,optind,unrecognized_switches)
- Xint argc;
- Xchar **argv;
- Xint optind;
- Xint unrecognized_switches;
- X{
- X if(unrecognized_switches)
- X return(RC_FAIL | RCE_ARGS);
- X return(0);
- X} /* end of DCE_argv_hook */
- X
- X/* vi: set tabstop=4 shiftwidth=4: */
- SHAR_EOF
- $TOUCH -am 1129183190 'gendial/dceMC9624.c' &&
- chmod 0644 gendial/dceMC9624.c ||
- echo 'restore of gendial/dceMC9624.c failed'
- Wc_c="`wc -c < 'gendial/dceMC9624.c'`"
- test 13186 -eq "$Wc_c" ||
- echo 'gendial/dceMC9624.c: original size 13186, current size' "$Wc_c"
- # ============= gendial/dceTBPlus.c ==============
- echo 'x - extracting gendial/dceTBPlus.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'gendial/dceTBPlus.c' &&
- X/* CHK=0xFF53 */
- X/* #define TRUSTING /* trust user has -z'd before use */
- X#define WHT
- X/*+-------------------------------------------------------------------------
- X dceTBPlus.c - DCE-specific portion of generic SCO UUCP dialer
- X Driver for Telebit Trailblazer Plus
- X wht@n4hgf.Mt-Park.GA.US
- X--------------------------------------------------------------------------*/
- X/*+:EDITS:*/
- X/*:11-29-1990-18:31-r@n4hgf-revision/1st releasable */
- X/*:07-20-1990-00:10-wht@n4hgf-creation */
- X
- X#include "dialer.h"
- X
- X/*
- X * DCE_DTR_low_msec - milliseconds to hold DTR low to ensure DCE
- X * sees the transition; this value may be changed
- X * as necessary before each call to ltoggleDTR(),
- X * but, generally, a constant value will do.
- X */
- Xlong DCE_DTR_low_msec = 500;
- X
- X/*
- X * DCE_DTR_high_msec - milliseconds DTR must remain high before the
- X * DCE may be expected to be ready to be commanded
- X */
- Xlong DCE_DTR_high_msec = 500;
- X
- X/*
- X * DCE_write_pase_msec - milliseconds to pause between each character
- X * sent to the DCE (zero if streaming I/O is
- X * permitted); this value may be changed as
- X * necessary before each call to lwrite(), but, generally, a constant
- X * value will do. Note that this value is used to feed a value to nap(),
- X * which has a granularity of .010 seconds on UNIX/386, .020 on XENIX/286
- X * and .050 seconds on XENIX/86.
- X */
- Xlong DCE_write_pace_msec = 0;
- X
- X/*
- X * DCE_name - short name for DCE
- X * DCE_revision - revision number for this module
- X */
- Xchar *DCE_name = "Telebit Trailblazer Plus";
- Xchar *DCE_revision = "1.00";
- X
- X/*
- X * DCE_hangup_CBAUD - baud rate to use for hanging up DCE
- X * and readying it for dial in access
- X * (BXXX mask); use a value of zero if the speed
- X * specified by the invoker is to be used.
- X * This value is useful for DCEs such as the early Hayes 2400
- X * which are so unfortunately compatible with their 1200 predecessor
- X * that they refuse to answer at 2400 baud unless you last spoke to
- X * them at that rate. For such bad boys, use B2400 below.
- X */
- Xint DCE_hangup_CBAUD = 0;
- X/* int DCE_hangup_CBAUD = B2400; */
- X
- X/*
- X * DCE_results - a table of DCE response strings and a token
- X * code for each; when you call lread() or lread_ignore(),
- X * if the read routine detects one of the strings,
- X * the appropriate code is returned. If no string matches, then
- X * lread()/lread_ignore examines the DCE result string for a
- X * numeric value; if one is found, the numeric value or'd with
- X * 0x40000000 is returned (in this way, e.g., you can read "modem
- X * S registers"). If nothing agrees with this search, lread()
- X * will abort the program with RC|FAIL|RCE_TIMOUT, lread_ignore()
- X * will return -1. You may use any value between 0 and 0x3FFFFFFF.
- X * This module is the only consumer of the codes, although they
- X * are decoded by gendial.c's _lread()
- X */
- X
- X/* flag bits */
- X#define rfConnect 0x00800000
- X#define rfREL 0x00400000
- X#define rfFAST 0x00200000
- X#define rfMASK 0x0000FFFF /* mask off rfBits */
- X
- X/* unique codes */
- X#define rOk 0
- X#define rNoCarrier 1
- X#define rError 2
- X#define rNoDialTone 3
- X#define rBusy 4
- X#define rNoAnswer 5
- X#define rRring 6
- X#define rConnect300 ( 300 | rfConnect)
- X#define rConnect1200 ( 1200 | rfConnect)
- X#define rConnect2400 ( 2400 | rfConnect)
- X#define rConnect300R ( 300 | rfConnect | rfREL)
- X#define rConnect1200R ( 1200 | rfConnect | rfREL)
- X#define rConnect2400R ( 2400 | rfConnect | rfREL)
- X#define rConnectFASTK (19200 | rfConnect | rfFAST)
- X#define rConnectFASTX (19200 | rfConnect | rfFAST)
- X#define rConnectFASTU (19200 | rfConnect | rfFAST)
- X#define rConnectFAST (19200 | rfConnect | rfFAST)
- X
- XDCE_RESULT DCE_results[] =
- X{
- X { "OK", rOk, },
- X { "NO CARRIER", rNoCarrier, },
- X { "ERROR", rError },
- X { "NO DIALTONE", rNoDialTone, },
- X { "BUSY", rBusy },
- X { "NO ANSWER", rNoAnswer },
- X { "RRING", rRring },
- X { "CONNECT 300/REL", rConnect300R },
- X { "CONNECT 1200/REL", rConnect1200R },
- X { "CONNECT 2400/REL", rConnect2400R },
- X { "CONNECT 300", rConnect300 },
- X { "CONNECT 1200", rConnect1200 },
- X { "CONNECT 2400", rConnect2400 },
- X { "CONNECT FAST/KERM", rConnectFASTK },
- X { "CONNECT FAST/XMDM", rConnectFASTX },
- X { "CONNECT FAST/UUCP", rConnectFASTU },
- X { "CONNECT FAST", rConnectFAST },
- X { (char *)0, -1 } /* end table */
- X};
- X
- X/*+-------------------------------------------------------------------------
- X DCE_baud_to_CBAUD(baud) - check for valid baud rates supported by DCE
- X
- X DCE dependent function must validate baud rates supported by DCE
- X returns baud rate in struct termio c_cflag fashion
- X or terminates program with error
- X--------------------------------------------------------------------------*/
- Xint
- XDCE_baud_to_CBAUD(baud)
- Xunsigned int baud;
- X{
- X switch(baud)
- X {
- X case 110: return(B110);
- X case 300: return(B300);
- X case 1200: return(B1200);
- X case 2400: return(B2400);
- X case 9600: return(B9600);
- X
- X#if defined(B19200)
- X case 19200: return(B19200);
- X#else
- X#ifdef EXTA
- X case 19200: return(EXTA);
- X#endif
- X#endif
- X
- X#if defined(B38400)
- X case 38400: return(B38400);
- X#else
- X#ifdef EXTB
- X case 38400: return(EXTB);
- X#endif
- X#endif
- X
- X }
- X myexit(RC_FAIL | RCE_SPEED);
- X} /* end of DCE_baud_to_CBAUD */
- X
- X/*+-------------------------------------------------------------------------
- X sync_Telebit() - sync modem with our DTE speed
- X--------------------------------------------------------------------------*/
- Xvoid
- Xsync_Telebit()
- X{
- Xregister int maxretry = 8;
- Xregister int count;
- Xunsigned char rdchar;
- X
- X while(maxretry--)
- X {
- X lflush();
- X write(fddce,"a",1);
- X count = 5;
- X while(count) /* wait 50-200 msec for character, depending on HZ */
- X {
- X if(rdchk(fddce))
- X break;
- X nap(50L);
- X count--;
- X }
- X if(count && (read(fddce,&rdchar,1) == 1) && (rdchar == 'a'))
- X return;
- X }
- X
- X DEBUG(1,"Telebit SYNC FAILED\n",0);
- X myexit(RC_FAIL | RCE_TIMOUT);
- X
- X} /* end of sync_Telebit */
- X
- X/*+-------------------------------------------------------------------------
- X init_TBPlus() - init TBPlus from scratch, assuming nothing
- X
- X reset to factory defaults, then set
- X E0 no local echo in command mode
- X F1 no local echo in data transfer mode
- X M0 speaker off
- X Q4 generate reult codes, but not RING
- X V1 verbal result codes
- X X3 extended result codes
- X S0=1 answer on first ring
- X S2=1 escape to "unusual" value
- X S11=50 50 msec DTMF timing
- X S45=1 enable remote access
- X S48=1 all 8 bits are significant
- X S50=0 use automatic connect speed determination
- X S51=252 set serial port baud rate automatically (no typeahead)
- X S52=2 go on hook when DTR drops and reset to NV-RAM
- X S53=1 DCD signal follows remote carrier, DSR on when modem ready
- X S54=3 pass BREAK signal to remote modem
- X S55=0 respond to command escape sequence
- X S58=2 DTE uses CTS/RTS flow control.
- X S64=1 ignore characters sent by DTE while answering
- X S66=0 don't lock interface speed, just go with the flow.
- X S68=255 DCE uses whatever flow control DTE uses
- X S92=1 PEP tones at the end of answer sequence
- X S95=0 no MNP
- X S110=255 use data compression when the remote modem requests it.
- X S111=255 accept any protocol
- X--------------------------------------------------------------------------*/
- Xvoid
- Xinit_TBPlus()
- X{
- Xregister itmp;
- Xint maxretry = 4;
- Xchar *init0 = "AT&FE0F1M0Q4V1X3\r";
- Xchar *init1 = "ATS0=1S2=1S11=50S45=1S48=1S50=0S51=252S52=2S53=1S54=3\r";
- Xchar *init2 = "ATS55=0S58=2S64=1S66=0S68=255S92=1S95=0S110=255S111=255\r";
- X
- X DEBUG(7,"INITIALIZING %s\n",dce_name);
- X ltoggleDTR(0L);
- X sync_Telebit();
- X
- X /*
- X * set to factory default (bless them for this command)
- X * and a few initial beachhead values
- X */
- X for(itmp = 0; itmp < maxretry; itmp++)
- X {
- X lwrite("AT&FE0F1M0Q4V1X3\r");
- X if(lread(2) == rOk)
- X break;
- X }
- X if(itmp == maxretry)
- X {
- X DEBUG(1,"INIT FAILED (init0)\n",0);
- X myexit(RC_FAIL | RCE_TIMOUT);
- X }
- X
- X /*
- X * send initialization string 1
- X */
- X for(itmp = 0; itmp < maxretry; itmp++)
- X {
- X lwrite(init1);
- X if(lread(2) == rOk)
- X break;
- X }
- X if(itmp == maxretry)
- X {
- X DEBUG(1,"INIT FAILED (init1)\n",0);
- X myexit(RC_FAIL | RCE_TIMOUT);
- X }
- X
- X /*
- X * send initialization string 2
- X */
- X for(itmp = 0; itmp < maxretry; itmp++)
- X {
- X lwrite(init2);
- X if(lread(2) == rOk)
- X break;
- X }
- X if(itmp == maxretry)
- X {
- X DEBUG(1,"INIT FAILED (init2)\n",0);
- X myexit(RC_FAIL | RCE_TIMOUT);
- X }
- X
- X} /* end of init_TBPlus */
- X
- X/*+-------------------------------------------------------------------------
- X DCE_hangup() - issue hangup command to DCE
- X
- XThis function should do whatever is necessary to ensure
- X1) any active connection is terminated
- X2) the DCE is ready to receive an incoming call if DTR is asserted
- X3) the DCE will not accept an incoming call if DTR is false
- X
- XThe function should return when done.
- X
- XAny necessary switch setting or other configuration necessary for this
- Xfunction to succeed should be documented at the top of the module.
- X--------------------------------------------------------------------------*/
- Xvoid
- XDCE_hangup()
- X{
- X#ifdef TRUSTING
- X DEBUG(7,"RESETING %s\n",dce_name);
- X ltoggle_DTR(0L);
- X lwrite("ATZ\r");
- X (void)lread_ignore(1);
- X#else /* !TRUSTING */
- X init_TBPlus();
- X#endif
- X
- X} /* end of DCE_hangup */
- X
- X/*+-------------------------------------------------------------------------
- X DCE_dial(telno) - dial a remote DCE
- X
- XThis function should connect to the remote DCE and use any success
- Xindication to modify the tty baud rate if necessary before returning.
- X
- XUpon successful connection, return 0.
- X
- XUpon unsuccessful connection, return RC_FAIL or'd with an appropriate
- XRCE_XXX value from dialer.h.
- X
- Xlwrite() is used to write to the DCE.
- X
- Xlread() and lread_ignore() are used to read from the DCE. Read timeouts
- Xfrom calling lread() will result automatically in the proper error
- Xtermination of the program. Read timeouts from calling lread_ignore()
- Xreturn -1; you handle the execption here.
- X
- XAny necessary coding of phone numbers, switch settings or other
- Xconfiguration necessary for this function to succeed should be
- Xdocumented at the top of the module.
- X
- XTelebit Plus-specific comments:
- X S0=0 dont allow connect while dialing
- X S54=3 pass BREAK signal to remote modem
- X S64=0 abort dialing if characters sent by DTE
- X S66=1 lock the interface speed
- X S110=0 disable data compression unless requested otherwise
- X--------------------------------------------------------------------------*/
- Xint
- XDCE_dial(telno)
- Xchar *telno;
- X{
- Xchar cmd[128];
- Xchar phone[50];
- Xint s50_set = 0;
- Xint s111_set = 0;
- Xint timeout;
- Xint result;
- Xint rrings = 0;
- Xlong then;
- Xlong now;
- Xchar *cptr;
- Xchar *dialout_default = "ATS0=0S7=40S54=3S64=0S66=1S110=0\r";
- X#define MDVALID "0123456789CcEeFfKkMmNnPpRrSsUuWwXx*#,!/()-"
- X
- X/* preliminary setup */
- X translate("=,-,",telno);
- X if(strspn(telno,MDVALID) != strlen(telno))
- X {
- X DEBUG(1,"phone number has invalid characters\n",0);
- X return(RC_FAIL | RCE_PHNO);
- X }
- X if(decode_phone_number(telno,phone,sizeof(phone)))
- X {
- X DEBUG(1,"phone number too long\n",0);
- X return(RC_FAIL | RCE_PHNO);
- X }
- X
- X/* walk through dialer codes, doing custom setup */
- X strcpy(cmd,"AT");
- X cptr = cmd + strlen(cmd);
- X if(dialer_codes['C' - 'A'])
- X {
- X DEBUG(5,"COMPRESSION requested\n",0);
- X strcat(cmd,"S110=1");
- X }
- X if(dialer_codes['E' - 'A'])
- X {
- X DEBUG(5,"ECHO SUPPRESSION requested\n",0);
- X strcat(cmd,"S121=1");
- X }
- X if(dialer_codes['F' - 'A'])
- X {
- X DEBUG(5,"XON/XOFF FLOW CONTROL requested\n",0);
- X strcat(cmd,"S58=3");
- X }
- X if(dialer_codes['K' - 'A'])
- X {
- X DEBUG(5,"KERMIT requested\n",0);
- X strcat(cmd,"S111=10");
- X s111_set++;
- X }
- X if(dialer_codes['X' - 'A'])
- X {
- X DEBUG(5,"XMODEM requested\n",0);
- X strcat(cmd,"S111=20");
- X s111_set++;
- X }
- X if(dialer_codes['U' - 'A'])
- X {
- X DEBUG(5,"UUCP requested\n",0);
- X strcat(cmd,"S111=30");
- X s111_set++;
- X }
- X if(dialer_codes['M' - 'A'])
- X {
- X DEBUG(5,"MNP requested\n",0);
- X strcat(cmd,"S95=1");
- X }
- X
- X if((dialer_codes['P' - 'A']) || s111_set || (hiCBAUD >= B9600))
- X {
- X if(hiCBAUD < B9600)
- X {
- X DEBUG(1,"baud rate not high enough for PEP\n",0);
- X return(RC_FAIL | RCE_SPEED);
- X }
- X if(dialer_codes['P' - 'A'])
- X DEBUG(5,"PEP requested\n",0);
- X else
- X DEBUG(5,"PEP inferred: speed >= 9600\n",0);
- X
- X dialer_codes['P' - 'A'] = 1;
- X strcat(cmd,"S50=255");
- X }
- X
- X
- X DEBUG(6,"--> issuing default setup command\n",0);
- X sync_Telebit();
- X lwrite(dialout_default);
- X if(lread(2) != rOk)
- X {
- X DEBUG(1,"default dialout setup failed\n",0);
- X return(RC_FAIL | RCE_NULL);
- X }
- X
- X/* issue the custom setup command */
- X if(*cptr)
- X {
- X DEBUG(5,"--> issuing custom setup cmd\n",0);
- X strcat(cmd,"\r");
- X sync_Telebit();
- X lwrite(cmd);
- X if(lread(2) != rOk)
- X {
- X DEBUG(1,"custom modem setup failed\n",0);
- X return(RC_FAIL | RCE_NULL);
- X }
- X }
- X
- X/*
- X * calculate a timeout for the connect
- X * allow a minimum of 40 seconds, but if PEP, 90
- X * also if long distance (North American calculation here)
- X * make it 132 (S7 is calculated as timeout * .9)
- X */
- X timeout = 40;
- X if((phone[0] == '1') && (phone[0] != '0'))
- X timeout = 132;
- X if((timeout < 90) && dialer_codes['P' - 'A'])
- X timeout = 90;
- X for(cptr = phone; cptr = strchr(cptr,','); cptr++)
- X timeout += 2; /* add extra time for pause characters */
- X DEBUG(6,"timeout waiting for connect = %d seconds\n",timeout);
- X
- X/* indicate non-root should not see DTE->DCE traffic */
- X secure = 1;
- X
- X/*
- X * build and issue the actual dialing command
- X * if root, let him see number, otherwise just say "remote system"
- X */
- X DEBUG(1,"--> dialing %s\n", (uid) ? "remote system" : telno);
- X#ifdef WHT
- X if(!strncmp(*gargv,"ECU",3))
- X dialer_codes['S' - 'A'] = 1;
- X#endif
- X sprintf(cmd,"ATM%dS7=%dDT%s\r",
- X ((dialer_codes['S' - 'A']) && !(dialer_codes['N' - 'A'])) ? 1 : 0,
- X (timeout * 9) / 10,telno);
- X
- X /* cmd string can only be 80 characters including "AT" */
- X if(strlen(cmd) > 80)
- X {
- X DEBUG(1,"phone number string too long\n",0);
- X cleanup(RC_FAIL | RCE_PHNO);
- X }
- X
- X sync_Telebit();
- X lwrite(cmd);
- X
- X/* indicate non-root can see DTE->DCE traffic */
- X secure = 0;
- X
- X/* wait for connect */
- XWAIT_FOR_CONNECT:
- X time(&then);
- X result = lread(timeout);
- X if(!(result & rfConnect))
- X {
- X switch(result & rfMASK)
- X {
- X case rNoCarrier:
- X return(RC_FAIL | ((rrings > 2) ? RCE_ANSWER : RCE_NOTONE));
- X case rNoDialTone:
- X return(RC_FAIL | RCE_NOTONE);
- X case rBusy:
- X return(RC_FAIL | RCE_BUSY);
- X case rNoAnswer:
- X return(RC_FAIL | RCE_ANSWER);
- X case rRring:
- X if(rrings++ > 7)
- X return(RC_FAIL | RCE_ANSWER);
- X time(&now);
- X if((timeout -= ((int)(then - now))) > 0)
- X goto WAIT_FOR_CONNECT;
- X case rError:
- X default:
- X return(RC_FAIL | RCE_NULL);
- X }
- X }
- X
- X return(0); /* succeeded */
- X
- X} /* end of DCE_dial */
- X
- X/**********************************************************
- X* You probably do not need to modify the code below here *
- X**********************************************************/
- X
- X/*+-------------------------------------------------------------------------
- X DCE_abort(sig) - dial attempt aborted
- X
- X sig = 0 if non-signal abort (read timeout, most likely)
- X != 0 if non-SIGALRM signal caught
- X
- X extern int dialing set 1 if dialing request was active,
- X else 0 if hangup request was active
- X
- XThis is a chance for the DCE-specific code to do anything it
- Xneeds to cl,ean up after a failure. Note that if a dialing
- Xcall fails, it is the responsibility of the higher-level
- Xprogram calling the dialer to call it again with a hangup request, so
- Xthis function is usually a no-op.
- X--------------------------------------------------------------------------*/
- Xvoid
- XDCE_abort(sig)
- Xint sig;
- X{
- X DEBUG(10,"DCE_abort(%d);\n",sig);
- X} /* end of DCE_abort */
- X
- X/*+-------------------------------------------------------------------------
- X DCE_exit(exitcode) - "last chance for gas" in this incarnation
- X
- XThe independent portion of the dialer program calls this routine in
- Xlieu of exit() in every case except one (see DCE_argv_hook() below).
- XNormally, this function just passes it's argument to exit(), but
- Xany necessary post-processing can be done. The function must,
- Xhowever, eventually call exit(exitcode);
- X--------------------------------------------------------------------------*/
- Xvoid
- XDCE_exit(exitcode)
- Xint exitcode;
- X{
- X DEBUG(10,"DCE_exit(%d);\n",exitcode);
- X exit(exitcode);
- X} /* end of DCE_exit */
- X
- X/*+-------------------------------------------------------------------------
- X DCE_argv_hook(argc,argv,optind,unrecognized_switches)
- X
- XThis hook gives DCE-specific code a chance to look over the entire
- Xcommand line, such as for -z Telebit processing.
- X
- Xargc andf argv are the same values passed to main(),
- X
- Xoptind is the value of optind at the end of normal getopt processing.
- X
- Xunrecognized_switches is the count of switches not handled by main().
- XSpecifically, -h and -x are standard switches.
- X
- XNormally, this function should just return RC_FAIL|RCE_ARGS if there are
- Xany unrecognized switches, otherwise zero. If you keep your nose clean
- Xthough, you can do anything you need to do here and exit the program.
- X
- XNote: only simple switches (with no argument) may be used with this
- Xfacility if the functrion is to return,' since main()'s getopt() will
- Xstop processing switches if it runs into an unrecognized switch with an
- Xargument.
- X
- XIf the function returns a non-zero value, then the value will be passed
- XDIRECTLY to exit() with no further ado. Thus, a non-zero value must be
- Xof the format expected by dialer program callers, with RC_FAIL set as a
- Xminimum.
- X--------------------------------------------------------------------------*/
- Xint
- XDCE_argv_hook(argc,argv,optind,unrecognized_switches)
- Xint argc;
- Xchar **argv;
- Xint optind;
- Xint unrecognized_switches;
- X{
- X if(unrecognized_switches)
- X return(RC_FAIL | RCE_ARGS);
- X return(0);
- X} /* end of DCE_argv_hook */
- X
- X/* vi: set tabstop=4 shiftwidth=4: */
- SHAR_EOF
- $TOUCH -am 1226045590 'gendial/dceTBPlus.c' &&
- chmod 0644 gendial/dceTBPlus.c ||
- echo 'restore of gendial/dceTBPlus.c failed'
- Wc_c="`wc -c < 'gendial/dceTBPlus.c'`"
- test 17853 -eq "$Wc_c" ||
- echo 'gendial/dceTBPlus.c: original size 17853, current size' "$Wc_c"
- true || echo 'restore of gendial/dceT1000.c failed'
- echo End of part 26, continue with part 27
- exit 0
- --------------------------------------------------------------------
- Warren Tucker, TuckerWare emory!n4hgf!wht or wht@n4hgf.Mt-Park.GA.US
- Hacker Extraordinaire d' async PADs, pods, proteins and protocols
-
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-