Annotation of coherent/e/bin/cku179/ckuus7.c, revision 1.1.1.1

1.1       root        1: #ifndef NOICP
                      2: 
                      3: /*  C K U U S 7 --  "User Interface" for Unix Kermit, part 7  */
                      4:  
                      5: /*
                      6:  Author: Frank da Cruz ([email protected], [email protected]),
                      7:  Columbia University Center for Computing Activities.
                      8:  First released January 1985.
                      9:  Copyright (C) 1985, 1992, Trustees of Columbia University in the City of New 
                     10:  York.  Permission is granted to any individual or institution to use, copy, or
                     11:  redistribute this software so long as it is not sold for profit, provided this
                     12:  copyright notice is retained.
                     13: */
                     14:  
                     15: /*
                     16:   This file created from parts of ckuus3.c, which became to big for
                     17:   Mark Williams Coherent compiler to handle.
                     18: */
                     19: 
                     20: /*
                     21:   Definitions here supersede those from system include files.
                     22: */
                     23: #include "ckcdeb.h"                    /* Debugging & compiler things */
                     24: #include "ckcasc.h"                    /* ASCII character symbols */
                     25: #include "ckcker.h"                    /* Kermit application definitions */
                     26: #include "ckcxla.h"                    /* Character set translation */
                     27: #include "ckcnet.h"                    /* Network symbols */
                     28: #include "ckuusr.h"                    /* User interface symbols */
                     29: 
                     30: static int x, y = 0, z;
                     31: static char *s;
                     32: 
                     33: static int mdmsav = -1;                        /* Save modem type around network */
                     34: static int oldplex = -1;               /* Duplex holder around network */
                     35: 
                     36: extern int success, nfilp, fmask, quiet, fncnv, frecl, nfttyp, binary, warn;
                     37: extern int cmask, maxrps, wslotr, bigsbsiz, bigrbsiz, urpsiz, rpsiz, spsiz;
                     38: extern int spsizr, spsizf, maxsps, spmax, pflag, bctr, npad, timef, timint;
                     39: extern int pkttim, rtimo, local, nfils, displa, atcapr, nettype;
                     40: extern int mdmtyp, duplex, dfloc, network, cdtimo, fncact, mypadn;
                     41: extern int tnlm, sosi, tlevel, lf_opts, backgrd;
                     42: extern int
                     43:   atenci, atenco, atdati, atdato, atleni, atleno, atblki, atblko,
                     44:   attypi, attypo, atsidi, atsido, atsysi, atsyso, atdisi, atdiso; 
                     45: 
                     46: extern long speed;
                     47: 
                     48: extern CHAR sstate, eol, seol, stchr, mystch, mypadc, padch;
                     49: 
                     50: extern char *cmarg, *cmarg2, *dftty;
                     51: 
                     52: extern char tmpbuf[], *tp, *lp;                /* Temporary buffer & pointers */
                     53: #ifndef NOFRILLS
                     54: extern char optbuf[];                  /* Buffer for MAIL or PRINT options */
                     55: extern int rprintf;                    /* REMOTE PRINT flag */
                     56: #endif /* NOFRILLS */
                     57: extern char ttname[];
                     58: 
                     59: extern struct keytab onoff[], filtab[], fttab[];
                     60: 
                     61: #ifdef DCMDBUF
                     62: extern char *cmdbuf;                   /* Command buffer */
                     63: extern char *line;
                     64: #else
                     65: extern char cmdbuf[];                  /* Command buffer */
                     66: extern char line[];                    /* Character buffer for anything */
                     67: #endif /* DCMDBUF */
                     68: 
                     69: #ifndef NOCSETS
                     70: extern struct keytab fcstab[];         /* For 'set file character-set' */
                     71: extern struct keytab ttcstab[];
                     72: extern int nfilc, fcharset, ntermc, tcsr, tcsl;
                     73: #endif /* NOCSETS */
                     74: 
                     75: #ifndef NOSPL
                     76: extern int cmdlvl;                     /* Overall command level */
                     77: #endif /* NOSPL */
                     78: 
                     79: #ifdef TNCODE
                     80: extern int tn_init;
                     81: #endif /* TNCODE */
                     82: 
                     83: #ifdef SUNX25
                     84: extern int revcall, closgr, cudata, nx25, npadx3;
                     85: extern char udata[MAXCUDATA];
                     86: extern CHAR padparms[MAXPADPARMS+1];
                     87: extern struct keytab x25tab[], padx3tab[];
                     88: #endif /* SUNX25 */
                     89: 
                     90: #ifndef NODIAL
                     91: extern int dialhng, dialtmo, dialksp, dialdpy, dialmnp;
                     92: extern int mdmspd;
                     93: extern char *dialini;
                     94: 
                     95: struct keytab dialtab[] = {
                     96:     "display", XYDDPY, 0,
                     97:     "hangup",  XYDHUP, 0,
                     98:     "init-string", XYDINI, 0,
                     99:     "kermit-spoof", XYDKSP, 0,
                    100:     "mnp-enable", XYDMNP, 0,
                    101:     "speed-matching", XYDSPD, 0,
                    102:     "timeout", XYDTMO, 0
                    103: };
                    104: int ndial = (sizeof(dialtab) / sizeof(struct keytab));
                    105: #endif /* NODIAL */
                    106: 
                    107: #ifndef NOXMIT
                    108: /* set transmit */
                    109: #define XMITF 0
                    110: #define XMITL 1
                    111: #define XMITP 2
                    112: #define XMITE 3
                    113: #define XMITX 4
                    114: #define XMITS 5
                    115: #define XMITW 6
                    116: 
                    117: #ifndef NOXMIT
                    118: #define XMBUFL 50
                    119: extern int xmitf, xmitl, xmitp, xmitx, xmits, xmitw;
                    120: char xmitbuf[XMBUFL+1] = { NUL };      /* TRANSMIT eof string */
                    121: #endif /* NOXMIT */
                    122: 
                    123: struct keytab xmitab[] = {
                    124:     "echo",     XMITX, 0,
                    125:     "eof",      XMITE, 0,
                    126:     "fill",     XMITF, 0,
                    127:     "linefeed", XMITL, 0,
                    128:     "locking-shift", XMITS, 0,
                    129:     "pause",    XMITW, 0,
                    130:     "prompt",   XMITP, 0
                    131: };
                    132: int nxmit = (sizeof(xmitab) / sizeof(struct keytab));
                    133: #endif /* NOXMIT */
                    134: 
                    135: /* For SET FILE COLLISION */
                    136: /* Some of the following may be possible for some C-Kermit implementations */
                    137: /* but not others.  Those that are not possible for your implementation */
                    138: /* should be ifdef'd out. */
                    139: 
                    140: struct keytab colxtab[] = { /* SET FILE COLLISION options */
                    141:     "append",    XYFX_A, 0,  /* append to old file */
                    142: #ifdef COMMENT
                    143:     "ask",       XYFX_Q, 0,  /* ask what to do (not implemented) */
                    144: #endif
                    145:     "backup",    XYFX_B, 0,  /* rename old file */
                    146:     "discard",   XYFX_D, 0,  /* don't accept new file */
                    147:     "no-supersede", XYFX_D, CM_INV, /* ditto (MSK compatibility) */
                    148:     "overwrite", XYFX_X, 0,  /* overwrite the old file == file warning off */
                    149:     "rename",    XYFX_R, 0,  /* rename the incoming file == file warning on */
                    150:     "update",    XYFX_U, 0,  /* replace if newer */
                    151: };
                    152: int ncolx = (sizeof(colxtab) / sizeof(struct keytab));
                    153: 
                    154: static struct keytab rfiltab[] = {     /* for REMOTE SET FILE */
                    155:     "collision",     XYFILX, 0,
                    156:     "record-length", XYFILR, 0,
                    157:     "type",          XYFILT, 0
                    158: };
                    159: int nrfilp = (sizeof(rfiltab) / sizeof(struct keytab));
                    160: 
                    161: struct keytab fntab[] = {              /* File naming */
                    162:     "converted", 1, 0,
                    163:     "literal",   0, 0
                    164: };
                    165: 
                    166: /* Terminal parameters table */
                    167: struct keytab trmtab[] = {
                    168:     "bytesize",      XYTBYT, 0,
                    169: #ifndef NOCSETS
                    170: #ifdef OS2
                    171:     "color",         XYTCOL, 0,
                    172: #endif /* OS2 */
                    173:     "character-set", XYTCS,  0,
                    174: #endif /* NOCSETS */
                    175:     "locking-shift", XYTSO,  0,
                    176:     "newline-mode",  XYTNL,  0
                    177: #ifdef OS2PM
                    178:     ,"type",         XYTTYP, 0
                    179: #endif /* OS2PM */
                    180: };
                    181: int ntrm = (sizeof(trmtab) / sizeof(struct keytab));
                    182: 
                    183: #ifdef OS2
                    184: struct keytab ttycoltab[] = {
                    185:     "help",        4, 0,
                    186:     "normal",      0, 0,
                    187:     "reverse",     1, 0,
                    188:     "status",      3, 0,
                    189:     "underlined",  2, 0
                    190: };
                    191: 
                    192: int ncolors = 5;
                    193: struct keytab ttyclrtab[] = {
                    194:     "black",       0, 0,
                    195:     "blue",        1, 0,
                    196:     "brown",       6, 0,
                    197:     "cyan",        3, 0,
                    198:     "dgray",       8, 0,
                    199:     "green",       2, 0,
                    200:     "lblue",       9, 0,
                    201:     "lcyan",      11, 0,
                    202:     "lgray",       7, 0,
                    203:     "lgreen",     10, 0,
                    204:     "lmagenta",   13, 0,
                    205:     "lred",       12, 0,
                    206:     "magenta",     5, 0,
                    207:     "red",         4, 0,
                    208:     "white",      15, 0,
                    209:     "yellow",     14, 0
                    210: };
                    211: int nclrs = 16;
                    212: #endif /* OS2 */
                    213: 
                    214: #ifdef OS2PM
                    215: struct keytab ttyptab[] = {
                    216:     "tek4014", 2, 0,
                    217:     "vt100",   1, 0
                    218: };
                    219: int nttyp = 2;
                    220: #endif /* OS2PM */
                    221: 
                    222: /* #ifdef VMS */
                    223: struct keytab fbtab[] = {              /* Binary record types for VMS */
                    224:     "fixed",     XYFT_B, 0,            /* Fixed is normal for binary */
                    225:     "undefined", XYFT_U, 0             /* Undefined if they ask for it */
                    226: };
                    227: int nfbtyp = (sizeof(fbtab) / sizeof(struct keytab));
                    228: /* #endif */
                    229: 
                    230: #ifdef VMS
                    231: struct keytab lbltab[] = {             /* Labeled File info */
                    232:     "acl",         LBL_ACL, 0,
                    233:     "backup-date", LBL_BCK, 0,
                    234:     "name",        LBL_NAM, 0,
                    235:     "owner",       LBL_OWN, 0,
                    236:     "path",        LBL_PTH, 0
                    237: };
                    238: int nlblp = (sizeof(lbltab) / sizeof(struct keytab));
                    239: #endif /* VMS */
                    240: 
                    241: 
                    242: struct keytab rsrtab[] = {             /* For REMOTE SET RECEIVE */
                    243:     "packet-length", XYLEN, 0,
                    244:     "timeout", XYTIMO, 0
                    245: };
                    246: int nrsrtab = (sizeof(rsrtab) / sizeof(struct keytab));
                    247: 
                    248: /* Send/Receive Parameters */
                    249:  
                    250: struct keytab srtab[] = {
                    251:     "end-of-packet", XYEOL, 0,
                    252:     "packet-length", XYLEN, 0,
                    253:     "pad-character", XYPADC, 0,
                    254:     "padding", XYNPAD, 0,
                    255:     "start-of-packet", XYMARK, 0,
                    256:     "timeout", XYTIMO, 0
                    257: };
                    258: int nsrtab = (sizeof(srtab) / sizeof(struct keytab));
                    259: 
                    260: /* REMOTE SET */
                    261: 
                    262: struct keytab rmstab[] = {
                    263:     "attributes",  XYATTR, 0,
                    264:     "block-check", XYCHKT, 0,
                    265:     "file",        XYFILE, 0,
                    266:     "incomplete",  XYIFD,  0,
                    267:     "receive",     XYRECV, 0,
                    268:     "retry",       XYRETR, 0,
                    269:     "server",      XYSERV, 0,
                    270:     "transfer",    XYXFER, 0,
                    271:     "window",      XYWIND, 0
                    272: };
                    273: int nrms = (sizeof(rmstab) / sizeof(struct keytab));
                    274: 
                    275: struct keytab attrtab[] = {
                    276:     "all",           AT_XALL, 0,
                    277: #ifdef COMMENT
                    278:     "blocksize",     AT_BLKS, 0,       /* not used by UNIX or VMS */
                    279: #endif
                    280:     "character-set", AT_ENCO, 0,
                    281:     "date",          AT_DATE, 0,
                    282:     "disposition",   AT_DISP, 0,
                    283:     "encoding",      AT_ENCO, CM_INV,
                    284:     "length",        AT_LENK, 0,
                    285:     "off",           AT_ALLN, 0,
                    286:     "on",            AT_ALLY, 0,
                    287: #ifdef COMMENT
                    288:     "os-specific",   AT_SYSP, 0,       /* not used by UNIX or VMS */
                    289: #endif
                    290:     "system-id",     AT_SYSI, 0,
                    291:     "type",          AT_FTYP, 0,
                    292: };
                    293: int natr = (sizeof(attrtab) / sizeof(struct keytab)); /* how many attributes */
                    294: 
                    295: #ifndef NOSPL
                    296: extern int indef, intime, incase, inecho;
                    297: struct keytab inptab [] = {            /* SET INPUT parameters */
                    298:     "case",            IN_CAS, 0,
                    299:     "default-timeout", IN_DEF, CM_INV,
                    300:     "echo",            IN_ECH, 0,
                    301:     "timeout-action",  IN_TIM, 0
                    302: };
                    303: int ninp = (sizeof(inptab) / sizeof(struct keytab));
                    304: 
                    305: struct keytab intimt[] = {             /* SET INPUT TIMEOUT parameters */
                    306:     "proceed", 0, 0,                   /* 0 = proceed */
                    307:     "quit",    1, 0                    /* 1 = quit */
                    308: };
                    309: 
                    310: struct keytab incast[] = {             /* SET INPUT CASE parameters */
                    311:     "ignore",  0, 0,                   /* 0 = ignore */
                    312:     "observe", 1, 0                    /* 1 = observe */
                    313: };
                    314: #endif /* NOSPL */
                    315: 
                    316: /* The following routines broken out of doprm() to give compilers a break. */
                    317: 
                    318: /*  S E T O N  --  Parse on/off (default on), set parameter to result  */
                    319:  
                    320: int
                    321: seton(prm) int *prm; {
                    322:     int x, y;
                    323:     if ((y = cmkey(onoff,2,"","on",xxstring)) < 0) return(y);
                    324:     if ((x = cmcfm()) < 0) return(x);
                    325:     *prm = y;
                    326:     return(1);
                    327: }
                    328:  
                    329: /*  S E T N U M  --  Set parameter to result of cmnum() parse.  */
                    330: /*
                    331:  Call with x - number from cnum parse, y - return code from cmnum
                    332: */
                    333: int
                    334: setnum(prm,x,y,max) int x, y, *prm, max; {
                    335:     extern int cmflgs; extern char atxbuf[];
                    336:     debug(F101,"setnum","",y);
                    337:     if (y == -3) {
                    338:        printf("\n?Value required\n");
                    339:        return(-9);
                    340:     }
                    341:     if (y == -2) {
                    342:        printf("%s?Not a number: %s\n",cmflgs == 1 ? "" : "\n", atxbuf);
                    343:        return(-9);
                    344:     }
                    345:     if (y < 0) return(y);
                    346:     if (x > max) {
                    347:        printf("?Sorry, %d is the maximum\n",max);
                    348:        return(-9);
                    349:     }
                    350:     if ((y = cmcfm()) < 0) return(y);
                    351:     *prm = x;
                    352:     return(1);
                    353: }
                    354:  
                    355: /*  S E T C C  --  Set parameter to an ASCII control character value.  */
                    356:  
                    357: int
                    358: setcc(prm,x,y) int x, y, *prm; {
                    359:     if (y == -3) {
                    360:        printf("\n?Value required\n");
                    361:        return(-3);
                    362:     }
                    363:     if (y < 0) return(y);
                    364:     if ((x > 037) && (x != 0177)) {
                    365:        printf("\n?Not in ASCII control range - %d\n",x);
                    366:        return(-2);
                    367:     }
                    368:     if ((y = cmcfm()) < 0) return(y);
                    369:     *prm = x;
                    370:     return(1);
                    371: }
                    372: 
                    373: #ifndef NODIAL
                    374: int                                    /* Set DIAL command options */
                    375: setdial() {
                    376:     if ((y = cmkey(dialtab,ndial,"","",xxstring)) < 0) return(y);
                    377:     switch (y) {
                    378:       case XYDHUP:                     /* hangup */
                    379:        return(success = seton(&dialhng));
                    380:       case XYDINI:                     /* init-string */
                    381:        if ((x = cmtxt("Modem dialer initialization string",
                    382:                       "",&s,xxstring)) < 0)
                    383:          return(x);
                    384:        if (dialini) {                  /* Free any previous string. */
                    385:            free(dialini);
                    386:            dialini = (char *) 0;
                    387:        }       
                    388:        if ((x = (int)strlen(s)) > 0) {
                    389:            dialini = malloc(x + 1);    /* Allocate space for it */
                    390:            strcpy(dialini,s);          /* and make a safe copy. */
                    391:        }
                    392:        return(success = 1);
                    393:       case XYDKSP:                     /* Kermit-spoof */
                    394:        return(success = seton(&dialksp));
                    395:       case XYDTMO:                     /* Timeout */
                    396:        y = cmnum("Seconds to wait for call completion","",10,&x,xxstring);
                    397:        return(success = setnum(&dialtmo,x,y,10000));
                    398:       case XYDDPY:                     /* Display */
                    399:        return(success = seton(&dialdpy));
                    400:       case XYDSPD:                     /* speed-matching */
                    401:                                        /* used to be speed-changing */
                    402:        if ((y = seton(&mdmspd)) < 0) return(y);
                    403:        mdmspd = 1 - mdmspd;            /* so here we reverse the meaning */
                    404:        return(success = 1);
                    405:       case XYDMNP:                     /* MNP enable */
                    406:        return(success = seton(&dialmnp));
                    407:       default:
                    408:        printf("?unexpected dial parameter\n");
                    409:        return(-2);
                    410:     }
                    411: }
                    412: #endif /* NODIAL */
                    413: 
                    414: int
                    415: setfil(rmsflg) int rmsflg; {
                    416:     if (rmsflg) {
                    417:        if ((y = cmkey(rfiltab,nrfilp,"Remote file parameter","",
                    418:                       xxstring)) < 0) {
                    419:            if (y == -3) {
                    420:                printf("?Remote file parameter required\n");
                    421:                return(-9);
                    422:            } else return(y);
                    423:        }
                    424:     } else {
                    425:        if ((y = cmkey(filtab,nfilp,"File parameter","",xxstring)) < 0)
                    426:          return(y);
                    427:     }
                    428:     switch (y) {
                    429: #ifdef COMMENT                         /* Not needed */
                    430:       case XYFILB:                     /* Blocksize */
                    431:        sprintf(tmpbuf,"%d",DBLKSIZ);
                    432:        if ((y = cmnum("file block size",tmpbuf,10,&z,xxstring)) < 0)
                    433:          return(y);
                    434:        if ((x = cmcfm()) < 0) return(x);
                    435:        if (rmsflg) {
                    436:            sprintf(tmpbuf,"%d",z);
                    437:            sstate = setgen('S', "311", tmpbuf, "");
                    438:            return((int) sstate);
                    439:        } else {
                    440:            fblksiz = z;
                    441:            return(success = 1);
                    442:        }
                    443: #endif /* COMMENT */
                    444: 
                    445:       case XYFILS:                     /* Byte size */
                    446:        if ((y = cmnum("file byte size (7 or 8)","8",10,&z,xxstring)) < 0)
                    447:          return(y);
                    448:        if (z != 7 && z != 8) {
                    449:            printf("\n?The choices are 7 and 8\n");
                    450:            return(0);
                    451:        }
                    452:        if ((y = cmcfm()) < 0) return(y);
                    453:        if (z == 7) fmask = 0177;
                    454:        else if (z == 8) fmask = 0377;
                    455:        return(success = 1);
                    456: 
                    457: #ifndef NOCSETS
                    458:       case XYFILC:                     /* Character set */
                    459:        if ((x = cmkey(fcstab,nfilc,"local file code","ascii", xxstring)) < 0)
                    460:          return(x);
                    461:        if ((z = cmcfm()) < 0) return(z);
                    462:        fcharset = x;
                    463:        return(success = 1);
                    464: #endif /* NOCSETS */
                    465: 
                    466:       case XYFILD:                     /* Display */
                    467:        y = seton(&z);
                    468:        if (y < 0) return(y);
                    469:        quiet = !z;
                    470:        return(success = 1);
                    471: 
                    472:       case XYFILN:                     /* Names */
                    473:        if ((x = cmkey(fntab,2,"how to handle filenames","converted",
                    474:                       xxstring)) < 0)
                    475:          return(x);
                    476:        if ((z = cmcfm()) < 0) return(z);
                    477:        fncnv = x;
                    478:        return(success = 1);
                    479: 
                    480:       case XYFILR:                     /* Record length */
                    481:        sprintf(tmpbuf,"%d",DLRECL);
                    482:        if ((y = cmnum("file record length",tmpbuf,10,&z,xxstring)) < 0)
                    483:          return(y);
                    484:        if ((x = cmcfm()) < 0) return(x);
                    485:        if (rmsflg) {
                    486:            sprintf(tmpbuf,"%d",z);
                    487:            sstate = setgen('S', "312", tmpbuf, "");
                    488:            return((int) sstate);
                    489:        } else {
                    490:            frecl = z;
                    491:            return(success = 1);
                    492:        }
                    493: 
                    494: #ifdef COMMENT
                    495:       case XYFILO:                     /* Organization */
                    496:        if ((x = cmkey(forgtab,nforg,"file organization","sequential",
                    497:                       xxstring)) < 0)
                    498:          return(x);
                    499:        if ((y = cmcfm()) < 0) return(y);
                    500:        if (rmsflg) {
                    501:            sprintf(tmpbuf,"%d",x);
                    502:            sstate = setgen('S', "314", tmpbuf, "");
                    503:            return((int) sstate);
                    504:        } else {
                    505:            forg = x;
                    506:            return(success = 1);
                    507:        }       
                    508: #endif /* COMMENT */
                    509: 
                    510: #ifdef COMMENT                         /* Not needed */
                    511:       case XYFILF:                     /* Format */
                    512:        if ((x = cmkey(frectab,nfrec,"file record format","stream",
                    513:                       xxstring)) < 0)
                    514:          return(x);
                    515:        if ((y = cmcfm()) < 0) return(y);
                    516:        if (rmsflg) {
                    517:            sprintf(tmpbuf,"%d",x);
                    518:            sstate = setgen('S', "313", tmpbuf, "");
                    519:            return((int) sstate);
                    520:        } else {
                    521:            frecfm = x;
                    522:            return(success = 1);
                    523:        }
                    524: #endif /* COMMENT */
                    525: 
                    526: #ifdef COMMENT
                    527:       case XYFILP:                     /* Printer carriage control */
                    528:        if ((x = cmkey(fcctab,nfcc,"file carriage control","newline",
                    529:                       xxstring)) < 0)
                    530:          return(x);
                    531:        if ((y = cmcfm()) < 0) return(y);
                    532:        if (rmsflg) {
                    533:            sprintf(tmpbuf,"%d",x);
                    534:            sstate = setgen('S', "315", tmpbuf, "");
                    535:            return((int) sstate);
                    536:        } else {
                    537:            fcctrl = x;
                    538:            return(success = 1);
                    539:        }       
                    540: #endif /* COMMENT */
                    541: 
                    542:       case XYFILT:                     /* Type */
                    543:        if ((x = cmkey(fttab,nfttyp,"type of file","text",xxstring)) < 0)
                    544:          return(x);
                    545: #ifdef COMMENT
                    546:        if ((y = cmnum("file byte size (7 or 8)","8",10,&z,xxstring)) < 0)
                    547:          return(y);
                    548:        if (z != 7 && z != 8) {
                    549:            printf("\n?The choices are 7 and 8\n");
                    550:            return(0);
                    551:        }
                    552: #endif /* COMMENT */
                    553: 
                    554: #ifdef VMS
                    555:         /* Allow VMS users to choose record format for binary files */
                    556:         if ((x == XYFT_B) && (rmsflg == 0)) {
                    557:            if ((x = cmkey(fbtab,nfbtyp,"VMS record format","fixed",
                    558:                           xxstring)) < 0)
                    559:              return(x);
                    560:        }
                    561: #endif /* VMS */
                    562:        if ((y = cmcfm()) < 0) return(y);
                    563:        if (rmsflg) {
                    564:            sstate = setgen('S', "300", x ? "1" : "0", "");
                    565:            return((int) sstate);
                    566:        } else {
                    567:            binary = x;
                    568: #ifdef COMMENT
                    569:            if (z == 7) fmask = 0177;
                    570:            else if (z == 8) fmask = 0377;
                    571: #endif /* COMMENT */
                    572:            return(success = 1);
                    573:        }
                    574: 
                    575:       case XYFILX:                     /* Collision Action */
                    576:        if ((x = cmkey(colxtab,ncolx,"Filename collision action","backup",
                    577:                       xxstring)) < 0)
                    578:          return(x);
                    579:        if ((y = cmcfm()) < 0) return(y);
                    580:        fncact = x;
                    581:        if (rmsflg) {
                    582:            sprintf(tmpbuf,"%d",fncact);
                    583:            sstate = setgen('S', "302", tmpbuf, "");
                    584:            return((int) sstate);
                    585:        } else {
                    586:            if (fncact == XYFX_R) warn = 1; /* SET FILE WARNING implications */
                    587:            if (fncact == XYFX_X) warn = 0; /* ... */
                    588:            return(success = 1);
                    589:        }
                    590: 
                    591:       case XYFILW:                     /* Warning/Write-Protect */
                    592:        seton(&warn);
                    593:        if (warn)
                    594:          fncact = XYFX_R;
                    595:        else
                    596:          fncact = XYFX_X;
                    597:        return(success = 1);
                    598: 
                    599: #ifdef VMS
                    600:       case XYFILL:                     /* LABELED FILE parameters */
                    601:        if ((x = cmkey(lbltab,nlblp,"VMS labeled file feature","",
                    602:                       xxstring)) < 0)
                    603:          return(x);
                    604:        if ((success = seton(&y)) < 0)
                    605:          return(success);
                    606:        if (y)                          /* Set or reset the selected bit */
                    607:          lf_opts |= x;                 /* in the options bitmask. */
                    608:        else
                    609:          lf_opts &= ~x;
                    610:        return(success);
                    611: #endif /* VMS */
                    612: 
                    613:       default:
                    614:        printf("?unexpected file parameter\n");
                    615:        return(-2);
                    616:     }
                    617: }
                    618: 
                    619: int
                    620: settrm() {
                    621:     if ((y = cmkey(trmtab,ntrm,"","",xxstring)) < 0) return(y);
                    622: #ifdef MAC
                    623:     printf("\n?Sorry, not implemented yet.  Please use the Settings menu.\n");
                    624:     return(-9);
                    625: #else
                    626:     switch (y) {
                    627:       case XYTBYT:                     /* SET TERMINAL BYTESIZE */
                    628:        if ((y = cmnum("bytesize for terminal connection","8",10,&x,
                    629:                       xxstring)) < 0)
                    630:          return(y);
                    631:        if (x != 7 && x != 8) {
                    632:            printf("\n?The choices are 7 and 8\n");
                    633:            return(success = 0);
                    634:        }
                    635:        if ((y = cmcfm()) < 0) return(y);
                    636:        if (x == 7) cmask = 0177;
                    637:        else if (x == 8) cmask = 0377;
                    638:         return(success = 1);
                    639: 
                    640:       case XYTSO:                      /* SET TERMINAL SHIFT-IN/OUT */
                    641:        seton(&sosi);
                    642:        return(success = 1);
                    643: 
                    644:       case XYTNL:
                    645:        seton(&tnlm);                   /* SET TERMINAL NEWLINE-MODE */
                    646:        return(success = 1);    
                    647: 
                    648: #ifdef OS2
                    649:       case XYTCOL:                     /* SET TERMINAL COLOR */
                    650:        if ((x = cmkey(ttycoltab,ncolors,"","normal",xxstring)) < 0) {
                    651:            return(x);
                    652:         } else {
                    653:            extern int colornormal, colorreverse, colorunderline,
                    654:              colorstatus, colorhelp, scrninitialised;
                    655:            int fg, bg;
                    656:            if ((fg = cmkey(ttyclrtab,nclrs,"","lgray",xxstring)) < 0)
                    657:              return(fg);
                    658:            if ((bg = cmkey(ttyclrtab,nclrs,"","black",xxstring)) < 0)
                    659:              return(bg);
                    660:            if ((y = cmcfm()) < 0)
                    661:              return(y);
                    662:            switch (x) {
                    663:              case 0:
                    664:                colornormal = fg | bg << 4;
                    665:                break;
                    666:              case 1:
                    667:                colorreverse = fg | bg << 4;
                    668:                break;
                    669:              case 2:
                    670:                colorunderline = fg | bg << 4;
                    671:                break;
                    672:              case 3:
                    673:                colorstatus = fg | bg << 4;
                    674:                break;
                    675:              case 4:
                    676:                colorhelp = fg | bg << 4;
                    677:                break;
                    678:              default:
                    679:                printf("%s - invalid\n",cmdbuf);
                    680:                return(0);
                    681:                break;
                    682:            }
                    683:            scrninitialised = 0;
                    684:         }
                    685:        return(success = 1);
                    686: #endif /* OS2 */
                    687: 
                    688: #ifdef OS2PM
                    689:       case XYTTYP:                     /* SET TERMINAL TYPE */
                    690:        if ((x = cmkey(ttyptab,nttyp,"","vt100",xxstring)) < 0) return(x);
                    691:        if ((y = cmcfm()) < 0) return(y);
                    692:        if (x == 1) {
                    693:            Term_mode = VT100;
                    694:            return(success = 1);
                    695:        } else if (x == 2) {
                    696:            Term_mode = TEKTRONIX;
                    697:            Tek_scrinit(0);             /* Initialise Tektronix emulation */
                    698:            return(success = 1);
                    699:        } else {
                    700:            printf("%s - invalid\n",cmdbuf);
                    701:            return(0);
                    702:        }
                    703: #endif /* OS2 */
                    704: 
                    705: #ifndef NOCSETS
                    706:       case XYTCS:                      /* SET TERMINAL CHARACTER-SET */
                    707:        /* set terminal character-set <remote> <local> */
                    708:        if ((x = cmkey(ttcstab,ntermc,
                    709:                       "remote terminal character-set","",xxstring)) < 0) 
                    710:          return(x);
                    711:        if (x == FC_TRANSP) {           /* TRANSPARENT? */
                    712:            if ((x = cmcfm()) < 0) return(x); /* Confirm the command */
                    713:            tcsr = tcsl = FC_USASCII;   /* Make them both the same */
                    714:            return(success = 1);
                    715:        }
                    716: 
                    717: /* Not transparent, so get local set to translate it into */
                    718: 
                    719:        s = "";                         /* Make current file char set */
                    720:        for (y = 0; y <= nfilc; y++)    /* be the default... */
                    721:          if (fcstab[y].kwval == fcharset) {
                    722:              s = fcstab[y].kwd;
                    723:              break;
                    724:            }
                    725:        if ((y = cmkey(fcstab,nfilc,
                    726:                       "local character-set",s,xxstring)) < 0)
                    727:          return(y);
                    728:        if ((z = cmcfm()) < 0) return(z); /* Confirm the command */
                    729:        tcsr = x;                       /* Remote character set */
                    730:        tcsl = y;                       /* Local character set */
                    731:        return(success = 1);
                    732: #endif /* NOCSETS */
                    733: 
                    734:       default:                         /* Shouldn't get here. */
                    735:        return(-2);
                    736:     }    
                    737: #endif /* MAC */
                    738: }
                    739: 
                    740: int                                    /* SET SEND/RECEIVE */
                    741: setsr(xx, rmsflg) int xx; int rmsflg; {
                    742:     if (xx == XYRECV)
                    743:        strcpy(line,"Parameter for inbound packets");
                    744:     else
                    745:        strcpy(line,"Parameter for outbound packets");
                    746:  
                    747:     if (rmsflg) {
                    748:        if ((y = cmkey(rsrtab,nrsrtab,line,"",xxstring)) < 0) {
                    749:            if (y == -3) {
                    750:                printf("?Remote receive parameter required\n");
                    751:                return(-9);
                    752:            } else return(y);
                    753:        }
                    754:     } else {
                    755:        if ((y = cmkey(srtab,nsrtab,line,"",xxstring)) < 0) return(y);
                    756:     }
                    757:     switch (y) {
                    758:  
                    759:       case XYEOL:
                    760:        y = cmnum("Decimal ASCII code for packet terminator","13",10,&x,
                    761:                  xxstring);
                    762:        if ((y = setcc(&z,x,y)) < 0) return(y);
                    763:        if (xx == XYRECV) eol = z; else seol = z;
                    764:        return(success = y);
                    765:  
                    766:       case XYLEN:
                    767:        y = cmnum("Maximum number of characters in a packet","90",10,&x,
                    768:                  xxstring);
                    769:        if (xx == XYRECV) {             /* Receive... */
                    770:            if ((y = setnum(&z,x,y,maxrps)) < 0)
                    771:              return(y);
                    772:            if (rmsflg) {
                    773:                tp = tmpbuf;
                    774:                sprintf(tp,"%d",z);
                    775:                sstate = setgen('S', "401", tp, "");
                    776:                return((int) sstate);
                    777:            } else {
                    778:                if (z > MAXRP) z = MAXRP;
                    779:                y = adjpkl(z,wslotr,bigrbsiz);
                    780:                if (y != z) {
                    781:                    urpsiz = y;
                    782:                    if (
                    783: #ifndef NOSPL
                    784:                        cmdlvl == 0
                    785: #else
                    786:                        tlevel < 0
                    787: #endif /* NOSPL */
                    788:                        )
                    789:                      if (!quiet) printf(
                    790:                         "Adjusting packet size to %d for %d window slots\n",
                    791:                         y, wslotr);
                    792:                }
                    793:                urpsiz = y;
                    794:                rpsiz =  (y > 94) ? 94 : y;
                    795:            }
                    796:        } else {                        /* Send... */
                    797:            if ((y = setnum(&z,x,y,maxsps)) < 0)
                    798:              return(y);
                    799:            if (z > MAXSP) z = MAXSP;
                    800:            spsiz = z;                  /* Set it */
                    801:            y = adjpkl(spsiz,wslotr,bigsbsiz);
                    802:            if (y != spsiz &&
                    803: #ifndef NOSPL
                    804:                cmdlvl == 0
                    805: #else
                    806:                tlevel < 0
                    807: #endif /* NOSPL */
                    808:                )
                    809:              if (!quiet)
                    810:                printf("Adjusting packet size to %d for %d window slots\n",
                    811:                     y,wslotr);
                    812:            spsiz = spmax = spsizr = y; /* Set it and flag that it was set */
                    813:            spsizf = 1;                 /* to allow overriding Send-Init. */
                    814:        }
                    815:        if (pflag &&
                    816: #ifndef NOSPL
                    817:            cmdlvl == 0
                    818: #else
                    819:            tlevel < 0
                    820: #endif /* NOSPL */
                    821:            ) {
                    822:            if (z > 94 && !quiet) {
                    823:                printf("Extended-length packets requested.\n");
                    824:                if (bctr < 2 && z > 200) printf("\
                    825: Remember to SET BLOCK 2 or 3 for long packets.\n");
                    826:            }
                    827:            if (speed <= 0L) speed = ttgspd();
                    828:            if (speed <= 0L && z > 200 && !quiet) {
                    829:                printf("\
                    830: Make sure your timeout interval is long enough for %d-byte packets.\n",z);
                    831:            }
                    832:        }
                    833:        chktimo();                      /* Check timeout */
                    834:        return(success = y);
                    835: 
                    836:       case XYMARK:
                    837:        y = cmnum("Code for packet-start character","1",10,&x,xxstring);
                    838:        if ((y = setnum(&z,x,y,126)) < 0) return(y);
                    839:        if (xx == XYRECV) stchr = z; else mystch = z;
                    840:        return(success = y);
                    841: 
                    842:       case XYNPAD:                     /* Padding */
                    843:        y = cmnum("How many padding characters for inbound packets","0",10,&x,
                    844:                  xxstring);
                    845:        if ((y = setnum(&z,x,y,94)) < 0) return(y);
                    846:        if (xx == XYRECV) mypadn = z; else npad = z;
                    847:        return(success = y);
                    848:  
                    849:       case XYPADC:                     /* Pad character */
                    850:        y = cmnum("Decimal ASCII code for packet padding character","0",10,&x,
                    851:                  xxstring);
                    852:        if ((y = setcc(&z,x,y)) < 0) return(y);
                    853:        if (xx == XYRECV) mypadc = z; else padch = z;
                    854:        return(success = y);
                    855:  
                    856:       case XYTIMO:
                    857:        y = cmnum("Interpacket timeout interval","5",10,&x,xxstring);
                    858:        if ((y = setnum(&z,x,y,94)) < 0) return(y);
                    859:        if (xx == XYRECV) {
                    860:            if (rmsflg) {
                    861:                tp = tmpbuf;
                    862:                sprintf(tp,"%d",z);
                    863:                sstate = setgen('S', "402", tp, "");
                    864:                return((int) sstate);
                    865:            } else {
                    866:                timef = 1;
                    867:                timint = pkttim = z;
                    868:            }
                    869:        } else rtimo = z;
                    870:        chktimo();
                    871:        return(success = y);
                    872: 
                    873:       default:
                    874:        return(-2);
                    875:     }                                  /* End of SET SEND/RECEIVE... */
                    876: }
                    877: 
                    878: #ifndef NOXMIT
                    879: int
                    880: setxmit() {
                    881:     if ((y = cmkey(xmitab,nxmit,"","",xxstring)) < 0) return(y);
                    882:     switch (y) {
                    883:       case XMITE:                      /* EOF */
                    884:        y = cmtxt("Characters to send at end of file,\n\
                    885:  Use backslash codes for control characters","",&s,xxstring);
                    886:        if (y < 0) return(y);
                    887:        if ((int)strlen(s) > XMBUFL) {
                    888:            printf("?Too many characters, %d maximum\n",XMBUFL);
                    889:            return(-2);
                    890:        }
                    891:        strcpy(xmitbuf,s);
                    892:        return(success = 1);
                    893: 
                    894:       case XMITF:                      /* Fill */
                    895:        y = cmnum("Numeric code for blank-line fill character","0",10,&x,
                    896:                  xxstring);
                    897:        if ((y = setnum(&z,x,y,127)) < 0) return(y);
                    898:        xmitf = z;
                    899:        return(success = 1);
                    900:       case XMITL:                      /* Linefeed */
                    901:         return(success = seton(&xmitl));
                    902:       case XMITS:                      /* Locking-Shift */
                    903:         return(success = seton(&xmits));
                    904:       case XMITP:                      /* Prompt */
                    905:        y = cmnum("Numeric code for host's prompt character, 0 for none",
                    906:                  "10",10,&x,xxstring);
                    907:        if ((y = setnum(&z,x,y,127)) < 0) return(y);
                    908:        xmitp = z;
                    909:        return(success = 1);
                    910:       case XMITX:                      /* Echo */
                    911:         return(success = seton(&xmitx));
                    912:       case XMITW:                      /* Pause */
                    913:        y = cmnum("Number of milliseconds to pause between binary characters\n\
                    914: or text lines during transmission","0",10,&x,xxstring);
                    915:        if ((y = setnum(&z,x,y,1000)) < 0) return(y);
                    916:        xmitw = z;
                    917:        return(success = 1);
                    918:       default:
                    919:        return(-2);
                    920:     }
                    921: }
                    922: #endif /* NOXMIT */
                    923: 
                    924: /*  D O R M T  --  Do a remote command  */
                    925:  
                    926: int
                    927: dormt(xx) int xx; {
                    928:     int x, y, retcode;
                    929:     char *s, sbuf[50], *s2;
                    930:  
                    931:     if (xx < 0) return(xx);
                    932: 
                    933:     if (xx == XZSET) {                 /* REMOTE SET */
                    934:        if ((y = cmkey(rmstab,nrms,"","",xxstring)) < 0) {
                    935:            if (y == -3) {
                    936:                printf("?Parameter name required\n");
                    937:                return(-9);
                    938:            } else return(y);
                    939:        }
                    940:        return(doprm(y,1));
                    941:     }
                    942: 
                    943:     switch (xx) {                      /* Others... */
                    944:  
                    945: case XZCWD:                            /* CWD */
                    946:     if ((x = cmtxt("Remote directory name","",&s,xxstring)) < 0) return(x);
                    947:     debug(F111,"XZCWD: ",s,x);
                    948:     *sbuf = NUL;
                    949:     s2 = sbuf;
                    950: 
                    951: /* The following is commented out, because there is practically no */
                    952: /* computer in the world that requires a password for directory changing. */
                    953: /* (The DEC-20 was the only one, and they're mostly all gone.) */
                    954: #ifdef DIRPWDPR
                    955:     if (*s != NUL) {                   /* If directory name given, */
                    956:                                        /* get password on separate line. */
                    957:         if (tlevel > -1) {             /* From take file... */
                    958:  
                    959:            if (fgets(sbuf,50,tfile[tlevel]) == NULL)
                    960:                fatal("take file ends prematurely in 'remote cwd'");
                    961:            debug(F110," pswd from take file",s2,0);
                    962:            for (x = (int)strlen(sbuf);
                    963:                 x > 0 && (sbuf[x-1] == NL || sbuf[x-1] == CR);
                    964:                 x--)
                    965:                sbuf[x-1] = '\0';
                    966:  
                    967:         } else {                       /* From terminal... */
                    968:  
                    969:            printf(" Password: ");              /* get a password */
                    970: #ifdef OS2
                    971:            while (((x = isatty(0) ? coninc(0) :
                    972:                     getchar()) != NL) && (x != CR)) {     /* with no echo */
                    973: #else
                    974:            while (((x = getchar()) != NL) && (x != CR)) { /* with no echo */
                    975: #endif /* OS2 */
                    976:                if ((x &= 0177) == '?') {
                    977:                    printf("? Password of remote directory\n Password: ");
                    978:                    s2 = sbuf;
                    979:                    *sbuf = NUL;
                    980:                }
                    981:                else if (x == ESC)      /* Mini command line editor... */
                    982:                    putchar(BEL);
                    983:                else if (x == BS || x == 0177)
                    984:                    s2--;
                    985:                else if (x == 025) {    /* Ctrl-U */
                    986:                    s2 = sbuf;
                    987:                    *sbuf = NUL;
                    988:                }
                    989:                else
                    990:                    *s2++ = x;
                    991:             }
                    992:            *s2 = NUL;
                    993:            putchar('\n');
                    994:         }
                    995:         s2 = sbuf;
                    996:     } else s2 = "";
                    997: #endif /* DIRPWDPR */
                    998: 
                    999:     debug(F110," password",s2,0);
                   1000:     sstate = setgen('C',s,s2,"");
                   1001:     retcode = 0;
                   1002:     break;
                   1003: 
                   1004: case XZDEL:                            /* Delete */
                   1005:     if ((x = cmtxt("Name of remote file(s) to delete","",&s,xxstring)) < 0) {
                   1006:        if (x == -3) {
                   1007:            printf("?Name of remote file(s) required\n");
                   1008:            return(-9);
                   1009:        } else return(x);
                   1010:     }
                   1011:     if (local) ttflui();               /* If local, flush tty input buffer */
                   1012:     retcode = sstate = rfilop(s,'E');
                   1013:     break;
                   1014:  
                   1015: case XZDIR:                            /* Directory */
                   1016:     if ((x = cmtxt("Remote directory or file specification","",&s,
                   1017:                   xxstring)) < 0)
                   1018:        return(x);
                   1019:     if (local) ttflui();               /* If local, flush tty input buffer */
                   1020:     retcode = sstate = setgen('D',s,"","");
                   1021:     break;
                   1022:  
                   1023: case XZHLP:                            /* Help */
                   1024:     if ((x = cmcfm()) < 0) return(x);
                   1025:     sstate = setgen('H',"","","");
                   1026:     retcode = 0;
                   1027:     break; 
                   1028: 
                   1029: #ifndef NOPUSH
                   1030: case XZHOS:                            /* Host */
                   1031:     if ((x = cmtxt("Command for remote system","",&cmarg,xxstring)) < 0)
                   1032:       return(x);
                   1033:     if ((int)strlen(cmarg) < 1)  {
                   1034:        if (x == -3) {
                   1035:            printf("?Remote host command required\n");
                   1036:            return(-9);
                   1037:        } else return(x);
                   1038:     }
                   1039:     retcode = sstate = 'c';
                   1040:     break; 
                   1041: #endif /* NOPUSH */
                   1042: 
                   1043: #ifndef NOFRILLS
                   1044: case XZKER:
                   1045:     if ((x = cmtxt("Command for remote Kermit","",&cmarg,xxstring)) < 0)
                   1046:       return(x);
                   1047:     if ((int)strlen(cmarg) < 1)  {
                   1048:        if (x == -3) {
                   1049:            printf("?Remote Kermit command required\n");
                   1050:            return(-9);
                   1051:        } else return(x);
                   1052:     }
                   1053:     retcode = sstate = 'k';
                   1054:     break; 
                   1055: 
                   1056: case XZLGI: {                          /* Login */
                   1057:     char *p1, *p2, *p3;
                   1058:     if ((x = cmfld("User ID","",&s,xxstring)) < 0) return(x);
                   1059:     if ((p1 = malloc((int)strlen(s) + 1)) == NULL) {
                   1060:        printf("Internal error: malloc\n");
                   1061:        return(-2);
                   1062:     } else strcpy(p1,s);
                   1063:     if ((x = cmfld("Password","",&s,xxstring)) < 0) return(x);
                   1064:     if ((p2 = malloc((int)strlen(s) + 1)) == NULL) {
                   1065:        printf("Internal error: malloc\n");
                   1066:        return(-2);
                   1067:     } else strcpy(p2,s);
                   1068:     if ((x = cmtxt("Account","",&s,xxstring)) < 0 && x != -3)
                   1069:        return(x);
                   1070:     if ((p3 = malloc((int)strlen(s) + 1)) == NULL) {
                   1071:        printf("Internal error: malloc\n");
                   1072:        return(-2);
                   1073:     } else strcpy(p3,s);
                   1074:     sstate = setgen('I',p1,p2,p3);
                   1075:     if (p3) free(p3);
                   1076:     if (p2) free(p2);
                   1077:     if (p1) free(p1);
                   1078:     retcode = 0;
                   1079:     break; 
                   1080: }
                   1081: 
                   1082: case XZLGO:                            /* Logout */
                   1083:     if ((x = cmcfm()) < 0) return(x);
                   1084:     sstate = setgen('I',"","","");
                   1085:     retcode = 0;
                   1086:     break; 
                   1087: 
                   1088: case XZPRI:                            /* Print */
                   1089:     if (!atdiso || !atcapr) {          /* Disposition attribute off? */
                   1090:        printf("?Disposition Attribute is Off\n");
                   1091:        return(-2);
                   1092:     }
                   1093:     cmarg = "";
                   1094:     cmarg2 = "";
                   1095:     if ((x = cmifi("Local file(s) to print on remote printer","",&s,&y,
                   1096:                   xxstring)) < 0) {
                   1097:        if (x == -3) {
                   1098:            printf("?Name of local file(s) required\n");
                   1099:            return(-9);
                   1100:        }
                   1101:        return(x);
                   1102:     }
                   1103:     strcpy(line,s);                    /* Make a safe copy of filename */
                   1104:     *optbuf = NUL;                     /* Wipe out any old options */
                   1105:     if ((x = cmtxt("Options for remote print command","",&s,xxstring)) < 0)
                   1106:       return(x);
                   1107:     strcpy(optbuf,s);                  /* Make a safe copy of options */
                   1108:     if ((int)strlen(optbuf) > 94) {    /* Make sure this is legal */
                   1109:        printf("?Option string too long\n");
                   1110:        return(-9);
                   1111:     }
                   1112:     nfils = -1;                                /* Expand file list internally */
                   1113:     cmarg = line;                      /* Point to file list. */
                   1114:     rprintf = 1;                       /* REMOTE PRINT modifier for SEND */
                   1115:     sstate = 's';                      /* Set start state to SEND */
                   1116:     if (local) displa = 1;
                   1117:     retcode = 0;
                   1118:     break;
                   1119: #endif /* NOFRILLS */
                   1120:        
                   1121: case XZSPA:                            /* Space */
                   1122:     if ((x = cmtxt("Confirm, or remote directory name","",&s,xxstring)) < 0)
                   1123:       return(x);
                   1124:     retcode = sstate = setgen('U',s,"","");
                   1125:     break;
                   1126:     
                   1127: #ifndef NOFRILLS
                   1128: case XZTYP:                            /* Type */
                   1129:     if ((x = cmtxt("Remote file specification","",&s,xxstring)) < 0)
                   1130:       return(x);
                   1131:     if ((int)strlen(s) < 1) {
                   1132:        printf("?Remote filename required\n");
                   1133:         return(-9);    
                   1134:     }
                   1135:     retcode = sstate = rfilop(s,'T');
                   1136:     break;
                   1137: #endif /* NOFRILLS */
                   1138:  
                   1139: #ifndef NOFRILLS
                   1140: case XZWHO:
                   1141:     if ((x = cmtxt("Remote user name, or carriage return","",&s,xxstring)) < 0)
                   1142:        return(x);
                   1143:     retcode = sstate = setgen('W',s,"","");
                   1144:     break;
                   1145: #endif /* NOFRILLS */
                   1146:  
                   1147: default:
                   1148:         if ((x = cmcfm()) < 0) return(x);
                   1149:         printf("not working yet - %s\n",cmdbuf);
                   1150:         return(-2);
                   1151:     }
                   1152:     if (local) ttflui();               /* If local, flush tty input buffer */
                   1153:     return(retcode);
                   1154: }
                   1155:  
                   1156:  
                   1157: /*  R F I L O P  --  Remote File Operation  */
                   1158:  
                   1159: CHAR
                   1160: #ifdef CK_ANSIC
                   1161: rfilop(char * s, char t)
                   1162: #else
                   1163: rfilop(s,t) char *s, t; 
                   1164: #endif /* CK_ANSIC */
                   1165: /* rfilop */ {
                   1166:     if (*s == NUL) {
                   1167:        printf("?File specification required\n");
                   1168:        return(-2);
                   1169:     }
                   1170:     debug(F111,"rfilop",s,t);
                   1171:     return(setgen(t,s,"",""));
                   1172: }
                   1173: 
                   1174: #ifdef SUNX25
                   1175: int
                   1176: setx25() {
                   1177:     if ((y = cmkey(x25tab,nx25,"X.25 call options","",xxstring)) < 0)
                   1178:       return(y);
                   1179:     switch (y) {
                   1180:       case XYUDAT:
                   1181:        if ((z = cmkey(onoff,2,"X.25 call user data","",xxstring))
                   1182:            < 0) return(z);
                   1183:        if (z == 0) {
                   1184:            if ((z = cmcfm()) < 0) return(z);
                   1185:            cudata = 0;             /* disable call user data */
                   1186:            return (success = 1);
                   1187:        }
                   1188:        if ((x = cmtxt("X.25 call user data string","",&s,xxstring)) < 0)
                   1189:          return(x);
                   1190:        if ((int)strlen(s) == 0) {
                   1191:            return (-3);
                   1192:        } else if ((int)strlen(s) > MAXCUDATA) {
                   1193:            printf("?The length must be > 0 and <= %d\n",MAXCUDATA);
                   1194:            return(-2);
                   1195:        }
                   1196:        if ((y = cmcfm()) < 0) return(y);
                   1197:        strcpy(udata,s);
                   1198:        cudata = 1;                     /* X.25 call user data specified */
                   1199:        return (success = 1);
                   1200:       case XYCLOS:
                   1201:        if ((z = cmkey(onoff,2,"X.25 closed user group call","",xxstring))
                   1202:            < 0) return(z);
                   1203:        if (z == 0) {
                   1204:            if ((z = cmcfm()) < 0) return(z);
                   1205:            closgr = -1;                /* disable closed user group */
                   1206:            return (success = 1);
                   1207:        }
                   1208:        if ((y = cmnum("0 <= cug index >= 99","",10,&x,xxstring)) < 0)
                   1209:          return(y);
                   1210:        if (x < 0 || x > 99) {
                   1211:            printf("?The choices are 0 <= cug index >= 99\n");
                   1212:            return(-2);
                   1213:        }
                   1214:        if ((y = cmcfm()) < 0) return(y);
                   1215:        closgr = x;                     /* closed user group selected */
                   1216:        return (success = 1);
                   1217: 
                   1218:       case XYREVC:
                   1219:        if((z = cmkey(onoff,2,"X.25 reverse charge call","",xxstring)) < 0)
                   1220:          return(z);
                   1221:        if ((x = cmcfm()) < 0) return(x);
                   1222:        revcall = z;
                   1223:        return (success = 1);
                   1224:     }
                   1225: }
                   1226: 
                   1227: int
                   1228: setpadp() {
                   1229:     if ((y = cmkey(padx3tab,npadx3,"PAD X.3 parameter name","",xxstring)) < 0)
                   1230:       return(y);
                   1231:     x = y;
                   1232:     switch (x) {
                   1233:       case PAD_BREAK_CHARACTER:
                   1234:        if ((y = cmnum("PAD break character value","",10,&z,xxstring)) < 0)
                   1235:          return(y);
                   1236:        if ((y = cmcfm()) < 0) return(y);
                   1237:        break;
                   1238:       case PAD_ESCAPE:
                   1239:        if ((y = cmnum("PAD escape","",10,&z,xxstring)) < 0) return(y);
                   1240:        if (z != 0 && z != 1) {
                   1241:            printf("?The choices are 0 or 1\n");
                   1242:            return(-2);
                   1243:        }
                   1244:        if ((y = cmcfm()) < 0) return(y);
                   1245:        break;
                   1246:       case PAD_ECHO:
                   1247:        if ((y = cmnum("PAD echo","",10,&z,xxstring)) return(y);
                   1248:        if (z != 0 && z != 1) {
                   1249:            printf("?The choices are 0 or 1\n");
                   1250:            return(-2);
                   1251:        }
                   1252:        if ((y = cmcfm()) < 0) return(y);
                   1253:        break;
                   1254:       case PAD_DATA_FORWARD_CHAR:
                   1255:        if ((y = cmnum("PAD data forward char","",10,&z,xxstring)) return(y);
                   1256:        if (z != 0 && z != 2) {
                   1257:            printf("?The choices are 0 or 2\n");
                   1258:            return(-2);
                   1259:        }
                   1260:        if ((y = cmcfm()) < 0) return(y);
                   1261:        break;
                   1262:       case PAD_DATA_FORWARD_TIMEOUT:
                   1263:        if ((y = cmnum("PAD data forward timeout","",10,&z,xxstring))
                   1264:            return(y);
                   1265:        if (z < 0 || z > 255) {
                   1266:            printf("?The choices are 0 or 1 <= timeout <= 255\n");
                   1267:            return(-2);
                   1268:        }
                   1269:        if ((y = cmcfm()) < 0) return(y);
                   1270:        break;
                   1271:       case PAD_FLOW_CONTROL_BY_PAD:
                   1272:        if ((y = cmnum("PAD pad flow control","",10,&z,xxstring)) return(y);
                   1273:        if (z != 0 && z != 1) {
                   1274:            printf("?The choices are 0 or 1\n");
                   1275:            return(-2);
                   1276:        }
                   1277:        if ((y = cmcfm()) < 0) return(y);
                   1278:        break;
                   1279:       case PAD_SUPPRESSION_OF_SIGNALS:
                   1280:        if ((y = cmnum("PAD service","",10,&z,xxstring)) return(y);
                   1281:        if (z != 0 && z != 1) {
                   1282:            printf("?The choices are 0 or 1\n");
                   1283:            return(-2);
                   1284:        }
                   1285:        if ((y = cmcfm()) < 0) return(y);
                   1286:        break;
                   1287: 
                   1288:       case PAD_BREAK_ACTION:
                   1289:        if ((y = cmnum("PAD break action","",10,&z,xxstring)) return(y);
                   1290:        if (z != 0 && z != 1 && z != 2 && z != 5 && z != 8 && z != 21) {
                   1291:            printf("?The choices are 0, 1, 2, 5, 8 or 21\n");
                   1292:            return(-2);
                   1293:        }
                   1294:        if ((y = cmcfm()) < 0) return(y);
                   1295:        break;
                   1296: 
                   1297:       case PAD_SUPPRESSION_OF_DATA:
                   1298:        if ((y = cmnum("PAD data delivery","",10,&z,xxstring)) return(y);
                   1299:        if (z != 0 && z != 1) {
                   1300:            printf("?The choices are 0 or 1\n");
                   1301:            return(-2);
                   1302:        }
                   1303:        if ((y = cmcfm()) < 0) return(y);
                   1304:        break;
                   1305: 
                   1306:       case PAD_PADDING_AFTER_CR:
                   1307:        if ((y = cmnum("PAD crpad","",10,&z,xxstring)) return(y);
                   1308:        if (z < 0 || z > 7) {
                   1309:            printf("?The choices are 0 or 1 <= crpad <= 7\n");
                   1310:            return(-2);
                   1311:        }
                   1312:        if ((y = cmcfm()) < 0) return(y);
                   1313:        break;
                   1314: 
                   1315:       case PAD_LINE_FOLDING:
                   1316:        if ((y = cmnum("PAD linefold","",10,&z,xxstring)) return(y);
                   1317:        if (z < 0 || z > 255) {
                   1318:            printf("?The choices are 0 or 1 <= linefold <= 255\n");
                   1319:            return(-2);
                   1320:        }
                   1321:        if ((y = cmcfm()) < 0) return(y);
                   1322:        break;
                   1323: 
                   1324:       case PAD_LINE_SPEED:
                   1325:        if ((y = cmnum("PAD baudrate","",10,&z,xxstring)) return(y);
                   1326:        if (z < 0 || z > 18) {
                   1327:            printf("?The choices are 0 <= baudrate <= 18\n");
                   1328:            return(-2);
                   1329:        }
                   1330:        if ((y = cmcfm()) < 0) return(y);
                   1331:        break;
                   1332: 
                   1333:       case PAD_FLOW_CONTROL_BY_USER:
                   1334:        if ((y = cmnum("PAD terminal flow control","",10,&z,xxstring))
                   1335:            return(y);
                   1336:        if (z != 0 && z != 1) {
                   1337:            printf("?The choices are 0 or 1\n");
                   1338:            return(-2);
                   1339:        }
                   1340:        if ((y = cmcfm()) < 0) return(y);
                   1341:        break;
                   1342: 
                   1343:       case PAD_LF_AFTER_CR:
                   1344:        if ((y = cmnum("PAD linefeed insert","",10,&z,xxstring)) < 0)
                   1345:          return(y);
                   1346:        if (z < 0 || z == 3 || z > 7) {
                   1347:            printf("?The choices are 0, 1, 2, 4, 5, 6 or 7\n");
                   1348:            return(-2);
                   1349:        }
                   1350:        if ((y = cmcfm()) < 0) return(y);
                   1351:        break;
                   1352: 
                   1353:       case PAD_PADDING_AFTER_LF:
                   1354:        if ((y = cmnum("PAD lfpad","",10,&z,xxstring)) return(y);
                   1355:        if (z < 0 || z > 7) {
                   1356:            printf("?The choices are 0 or 1 <= lfpad <= 7\n");
                   1357:            return(-2);
                   1358:        }
                   1359:        if ((y = cmcfm()) < 0) return(y);
                   1360:        break;
                   1361: 
                   1362:       case PAD_EDITING:
                   1363:        if ((y = cmnum("PAD edit control","",10,&z,xxstring)) return(y);
                   1364:        if (z != 0 && z != 1) {
                   1365:            printf("?The choices are 0 or 1\n");
                   1366:            return(-2);
                   1367:        }
                   1368:        if ((y = cmcfm()) < 0) return(y);
                   1369:        break;
                   1370: 
                   1371:       case PAD_CHAR_DELETE_CHAR:
                   1372:        if ((y = cmnum("PAD char delete char","",10,&z,xxstring)) return(y);
                   1373:        if (z < 0 || z > 127) {
                   1374:            printf("?The choices are 0 or 1 <= chardelete <= 127\n");
                   1375:            return(-2);
                   1376:        }
                   1377:        if ((y = cmcfm()) < 0) return(y);
                   1378:        break;
                   1379: 
                   1380:       case PAD_BUFFER_DELETE_CHAR:
                   1381:        if ((y = cmnum("PAD buffer delete char","",10,&z,xxstring)) return(y);
                   1382:        if (z < 0 || z > 127) {
                   1383:            printf("?The choices are 0 or 1 <= bufferdelte <= 127\n");
                   1384:            return(-2);
                   1385:        }
                   1386:        if ((y = cmcfm()) < 0) return(y);
                   1387:        break;
                   1388: 
                   1389:       case PAD_BUFFER_DISPLAY_CHAR:
                   1390:        if ((y = cmnum("PAD display line char","",10,&z,xxstring)) return(y);
                   1391:        if (z < 0 || z > 127) {
                   1392:            printf("?The choices are 0 or 1 <= displayline <= 127\n");
                   1393:            return(-2);
                   1394:        }
                   1395:        if ((y = cmcfm()) < 0) return(y);
                   1396:        break;
                   1397:     }
                   1398:     padparms[x] = z;
                   1399:     return(success = 1);
                   1400: }
                   1401: #endif /* SUNX25 */ 
                   1402: 
                   1403: int
                   1404: setat(rmsflg) int rmsflg; {
                   1405:     if ((y = cmkey(attrtab,natr,"File Attribute packets","",xxstring)) < 0)
                   1406:       return(y);    
                   1407:     if (y == AT_XALL) {
                   1408:        if ((z = seton(&atcapr)) < 0) return(z);
                   1409:        if (rmsflg) {
                   1410:            sstate = setgen('S', "132", atcapr ? "1" : "0", "");
                   1411:            return((int) sstate);
                   1412:        } else {
                   1413:            atenci = atcapr;            /* Encoding in */
                   1414:            atenco = atcapr;            /* Encoding out */
                   1415:            atdati = atcapr;            /* Date in */
                   1416:            atdato = atcapr;            /* Date out */
                   1417:            atdisi = atcapr;            /* Disposition in/out */
                   1418:            atdiso = atcapr;
                   1419:            atleni = atcapr;            /* Length in/out (both kinds) */
                   1420:            atleno = atcapr;
                   1421:            atblki = atcapr;            /* Blocksize in/out */
                   1422:            atblko = atcapr;
                   1423:            attypi = atcapr;            /* File type in/out */
                   1424:            attypo = atcapr;
                   1425:            atsidi = atcapr;            /* System ID in/out */
                   1426:            atsido = atcapr;
                   1427:            atsysi = atcapr;            /* System-dependent params in/out */
                   1428:            atsyso = atcapr;
                   1429:        }
                   1430:        return(z);
                   1431:     } else if (y == AT_ALLY || y == AT_ALLN) { /* All On or All Off */
                   1432:        if ((x = cmcfm()) < 0) return(x);
                   1433:        atcapr = (y == AT_ALLY) ? 1 : 0;
                   1434:        if (rmsflg) {
                   1435:            sstate = setgen('S', "132", atcapr ? "1" : "0", "");
                   1436:            return((int) sstate);
                   1437:        } else return(success = 1);
                   1438:     }
                   1439:     /* Otherwise, it's an individual attribute that wants turning off/on */
                   1440: 
                   1441:     if ((z = cmkey(onoff,2,"","",xxstring)) < 0) return(z);
                   1442:     if ((x = cmcfm()) < 0) return(x);
                   1443: 
                   1444: /* There are better ways to do this... */
                   1445: /* The real problem is that we're not separating the in and out cases */
                   1446: /* and so we have to arbitrarily pick the "in" case, i.e tell the remote */
                   1447: /* server to ignore incoming attributes of the specified type, rather */
                   1448: /* than telling it not to send them.  The protocol does not (yet) define */
                   1449: /* codes for "in-and-out-at-the-same-time". */
                   1450: 
                   1451:     switch(y) {
                   1452:       case AT_DISP:
                   1453:        if (rmsflg) {
                   1454:            sstate = setgen('S', "142", z ? "1" : "0", "");
                   1455:            return((int) sstate);
                   1456:        }
                   1457:        atdisi = atdiso = z; break;
                   1458:       case AT_ENCO:
                   1459:        if (rmsflg) {
                   1460:            sstate = setgen('S', "141", z ? "1" : "0", "");
                   1461:            return((int) sstate);
                   1462:        }
                   1463:        atenci = atenco = z; break;
                   1464:       case AT_DATE:
                   1465:        if (rmsflg) {
                   1466:            sstate = setgen('S', "135", z ? "1" : "0", "");
                   1467:            return((int) sstate);
                   1468:        }
                   1469:        atdati = atdato = z; break;
                   1470:       case AT_LENB:
                   1471:       case AT_LENK:
                   1472:        if (rmsflg) {
                   1473:            sstate = setgen('S', "133", z ? "1" : "0", "");
                   1474:            return((int) sstate);
                   1475:        }
                   1476:        atleni = atleno = z; break;
                   1477:       case AT_BLKS:
                   1478:        if (rmsflg) {
                   1479:            sstate = setgen('S', "139", z ? "1" : "0", "");
                   1480:            return((int) sstate);
                   1481:        }
                   1482:        atblki = atblki = z; break;
                   1483:       case AT_FTYP:
                   1484:        if (rmsflg) {
                   1485:            sstate = setgen('S', "134", z ? "1" : "0", "");
                   1486:            return((int) sstate);
                   1487:        }
                   1488:        attypi = attypo = z; break;
                   1489:       case AT_SYSI:
                   1490:        if (rmsflg) {
                   1491:            sstate = setgen('S', "145", z ? "1" : "0", "");
                   1492:            return((int) sstate);
                   1493:        }
                   1494:        atsidi = atsido = z; break;
                   1495:       case AT_SYSP:
                   1496:        if (rmsflg) {
                   1497:            sstate = setgen('S', "147", z ? "1" : "0", "");
                   1498:            return((int) sstate);
                   1499:        }
                   1500:        atsysi = atsyso = z; break;
                   1501:       default:
                   1502:        printf("?Not available\n");
                   1503:        return(-2);
                   1504:     }
                   1505:     return(1);
                   1506: }
                   1507: 
                   1508: #ifndef NOSPL
                   1509: int
                   1510: setinp() {
                   1511:     if ((y = cmkey(inptab,ninp,"","",xxstring)) < 0) return(y);
                   1512:     switch (y) {
                   1513:       case IN_DEF:                     /* SET INPUT DEFAULT-TIMEOUT */
                   1514:        z = cmnum("Positive number","",10,&x,xxstring);
                   1515:        return(success = setnum(&indef,x,z,94));
                   1516:       case IN_TIM:                     /* SET INPUT TIMEOUT-ACTION */
                   1517:        if ((z = cmkey(intimt,2,"","",xxstring)) < 0) return(z);
                   1518:        if ((x = cmcfm()) < 0) return(x);
                   1519:        intime = z;
                   1520:        return(success = 1);
                   1521:       case IN_CAS:                     /* SET INPUT CASE */
                   1522:        if ((z = cmkey(incast,2,"","",xxstring)) < 0) return(z);
                   1523:        if ((x = cmcfm()) < 0) return(x);
                   1524:        incase = z;
                   1525:        return(success = 1);
                   1526:       case IN_ECH:                     /* SET INPUT ECHO */
                   1527:        return(success = seton(&inecho));
                   1528:     }
                   1529:     return(0);
                   1530: }
                   1531: #endif /* NOSPL */
                   1532: 
                   1533: /*
                   1534:   setlin -- parse name of and then open a communication device.
                   1535:   Call with:
                   1536:     xx == XXLINE for a serial (tty) line, XXHOST for a network host,
                   1537:     zz == 0 means if user doesn't give a device name, continue current
                   1538:             active connection (if any);
                   1539:     zz != 0 means if user doesn't give a device name, then close the
                   1540:             current connection and restore the default communication device.
                   1541: */
                   1542: int
                   1543: setlin(xx, zz) int xx, zz; {
                   1544:     if (xx == XYHOST) {                        /* SET HOST <hostname> */
                   1545: #ifndef NETCONN
                   1546:         printf("?Network connections not supported\n");
                   1547:        return(-9);
                   1548: #else
                   1549:        if (
                   1550:            (nettype != NET_SX25) &&
                   1551:             (nettype != NET_TCPB)) {
                   1552:            printf("?Network type not supported\n");
                   1553:            return(-9);
                   1554:          }
                   1555:        if (nettype != NET_TCPB) {      /* Not a TCP/IP connection */
                   1556:                                        /* Just get a text string */
                   1557:            if ((x = cmtxt( zz ? 
                   1558:    "Network host name,\n or carriage return to close an open connection" :
                   1559:    "Network host name,\n or carriage return to resume an open connection",
                   1560:                           "",&s,xxstring)) < 0)
                   1561:              return(x);
                   1562: 
                   1563:        } else {                        /* TCP/IP connection... */
                   1564: 
                   1565:            /* Parse for host and service separately. */
                   1566: 
                   1567:            if ((x = cmfld( zz ?
                   1568:    "IP host name or number,\n or carriage return to close an open connection" :
                   1569:    "IP host name or number,\n or carriage return to resume an open connection",
                   1570:                           "",&s,xxstring)) < 0) {
                   1571:                if (x != -3)            /* Parse error */
                   1572:                  return(x);            /* return it */
                   1573:                else if (!zz)           /* No hostname given */
                   1574:                  return(1);            /* and none required, */
                   1575:            }                           /* continue current connection. */
                   1576:            if (*s) {                   /* If they gave a host name... */
                   1577:                strcpy(line,s);         /* make a copy */
                   1578:                /* Check for "host:service" */
                   1579:                for ( ; (*s != '\0') && (*s != ':'); *s++) ;
                   1580: 
                   1581:                /* If no service given, let them type one now. */
                   1582: 
                   1583:                if (!*s) {
                   1584:                    if ((x = cmfld(
                   1585:     "TCP service name or number,\n or carriage return for telnet",
                   1586:                                   "23",&s,xxstring)) < 0 && x != -3)
                   1587:                      return(x);
                   1588:                    if (*s) {           /* If they gave a service, */
                   1589:                        strcat(line,":"); /* concatenate it to the hostname */
                   1590:                        strcat(line,s); /* separated by a colon, because */
                   1591:                    }                   /* this is how ttopen() wants it. */
                   1592:                }
                   1593:                if ((x = cmcfm()) < 0) return(x); /* Confirm the command */
                   1594:                s = line;
                   1595:            }
                   1596:        }
                   1597: 
                   1598:        /* New connection wanted. */
                   1599: 
                   1600:        ttflui();                       /* Clear away buffered up junk */
                   1601:        ttclos(0);                      /* Close old connection, if any */
                   1602:        if (oldplex > -1)               /* Restore duplex setting. */
                   1603:          duplex = oldplex;
                   1604:        if (*s) {                       /* They gave a hostname */
                   1605:            x = 1;                      /* Network connection always local */
                   1606:            mdmsav = mdmtyp;            /* Remember old modem type */
                   1607:            mdmtyp = -nettype;          /* Special code for network */
                   1608:            if (nettype == NET_TCPB) {  /* For TCP/IP telnet connections */
                   1609:                oldplex = duplex;       /* Remember previous duplex */
                   1610:                duplex = 0;             /* Set full duplex and let */
                   1611:          }                             /* negotiations change if necessary. */
                   1612:        } else {                        /* They just said "set host" */
                   1613:            if (network && !quiet && !backgrd)
                   1614:              printf("Closing connection\n");
                   1615:            s = dftty;                  /* So go back to normal */
                   1616:            x = dfloc;                  /* default tty, location, */
                   1617:            network = 0;                /* No more network connection. */
                   1618:            duplex = oldplex;           /* Restore old duplex setting. */
                   1619:            if (mdmtyp < 0) {           /* Switching from net to async? */
                   1620:                if (mdmsav > -1)        /* Restore modem type from last */
                   1621:                  mdmtyp = mdmsav;      /* SET MODEM command, if any. */
                   1622:                else
                   1623:                  mdmtyp = 0;
                   1624:            }
                   1625:        }
                   1626: #endif /* NETCONN */
                   1627:     }
                   1628: 
                   1629: /* Serial tty device, possibly modem, connection... */
                   1630: 
                   1631:     if (xx == XYLINE) {                        /* SET LINE */
                   1632:        if ((x = cmtxt("Communication device name",dftty,&s,xxstring)) < 0)
                   1633:          return(x);
                   1634:        if (local) ttflui();            /* Clear away buffered up junk */
                   1635:        ttclos(0);                      /* Close old line, if any was open */
                   1636:        if (*s) {                       /* They gave a device name */
                   1637:            x = -1;                     /* Let ttopen decide about it */
                   1638:        } else {                        /* They just said "set line" */
                   1639:            s = dftty;                  /* so go back to normal tty */
                   1640:            x = dfloc;                  /* and mode. */
                   1641:        }
                   1642:        if (mdmtyp < 0) {               /* Switching from net to async? */
                   1643:            if (mdmsav > -1)            /* Restore modem type from last */
                   1644:              mdmtyp = mdmsav;          /* SET MODEM command, if any. */
                   1645:            else
                   1646:              mdmtyp = 0;
                   1647:        }
                   1648:        if (oldplex > -1)               /* Restore previous duplex setting. */
                   1649:          duplex = oldplex;
                   1650:        network = 0;                    /* No more network. */
                   1651:     }
                   1652:     if ((y = ttopen(s,&x,mdmtyp,cdtimo)) < 0 ) { /* Open the new line */
                   1653:        printf("%s: ", s);              /* Error */
                   1654:        if (y == -2) {
                   1655:            printf("?Timed out, no carrier.\n");
                   1656:            printf("Try SET CARRIER OFF and SET LINE again, or else\n");
                   1657:            printf("SET MODEM, SET LINE, and then DIAL.\n");
                   1658:        } else if (y == -3) {
                   1659:            printf("Sorry, access to lock denied\n");
                   1660:        } else if (y == -4) {
                   1661:            printf("Sorry, access to device denied\n");
                   1662:        } else if (y == -5) {
                   1663:            printf("Sorry, device is in use\n");
                   1664:         } else {                       /* Other error. */
                   1665: #ifndef VMS
                   1666:            if (errno)
                   1667:              perror("Sorry, can't open connection");
                   1668:            else
                   1669: #endif /* VMS */
                   1670:              printf("Sorry, can't open connection\n");
                   1671:        }    
                   1672:        local = dfloc;                  /* Go back to normal */
                   1673: #ifndef MAC
                   1674:        strcpy(ttname,dftty);           /* Restore default tty name */
                   1675: #endif /* MAC */
                   1676:        speed = ttgspd();
                   1677:        network = 0;                    /* No network connection active */
                   1678:        return(success = 0);            /* Return failure */
                   1679:     }
                   1680:     if (x > -1) local = x;             /* Opened ok, set local/remote. */
                   1681:     network = (mdmtyp < 0);            /* Remember connection type. */
                   1682: #ifdef TNCODE
                   1683:     if (network) tn_init = 0;          /* Say telnet not init'd yet. */
                   1684: #endif /* TNCODE */
                   1685:     strcpy(ttname,s);                  /* Copy name into real place. */
                   1686:     speed = ttgspd();                  /* Get the current speed. */
                   1687:     debug(F111,"set line ",ttname,local);
                   1688: #ifdef NETCONN
                   1689: #ifdef SUNX25
                   1690:     if (nettype == NET_SX25) duplex = 1; /* Duplex half */
                   1691: #endif /* SUNX25 */
                   1692: #endif /* NETCONN */
                   1693:     return(success = 1);
                   1694: }
                   1695: #endif /* NOICP */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.