Annotation of 43BSDReno/contrib/isode-beta/vt/map.c, revision 1.1

1.1     ! root        1: /* map.c - VT telnet profile mappings */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/vt/RCS/map.c,v 7.1 90/07/09 14:51:50 mrose Exp $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/vt/RCS/map.c,v 7.1 90/07/09 14:51:50 mrose Exp $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       map.c,v $
        !            12:  * Revision 7.1  90/07/09  14:51:50  mrose
        !            13:  * sync
        !            14:  * 
        !            15:  * Revision 7.0  89/11/23  22:31:31  mrose
        !            16:  * Release 6.0
        !            17:  * 
        !            18:  */
        !            19: 
        !            20: /*
        !            21:  *                               NOTICE
        !            22:  *
        !            23:  *    Acquisition, use, and distribution of this module and related
        !            24:  *    materials are subject to the restrictions of a license agreement.
        !            25:  *    Consult the Preface in the User's Manual for the full terms of
        !            26:  *    this agreement.
        !            27:  *
        !            28:  */
        !            29: 
        !            30: 
        !            31: #define DO_LOCAL_ECHO
        !            32: #undef PEPYPARM
        !            33: #define PEPYPARM int *
        !            34: 
        !            35: 
        !            36: #include "vtpm.h"
        !            37: #include "sector1.h"
        !            38: 
        !            39: #include <sys/ioctl.h>
        !            40: #ifdef BSD44
        !            41: #include <sys/termios.h>
        !            42: #endif
        !            43: 
        !            44: extern char erase_char;
        !            45: extern char erase_line;
        !            46: #ifdef BSD44
        !            47: extern struct termios oterm;
        !            48: #else
        !            49: extern struct sgttyb ottyb;
        !            50: extern struct tchars otc;
        !            51: #endif
        !            52: extern char intr_char;
        !            53: extern char ni_image;
        !            54: extern char na_image;
        !            55: extern char nego_state;
        !            56: extern char kb_image;
        !            57: extern char di_image;
        !            58: extern char sync_image;
        !            59: extern char ga_image;
        !            60: extern int my_right;
        !            61: extern int cur_emode;
        !            62: extern char *myhostname;
        !            63: extern int pty;
        !            64: extern int transparent;
        !            65: extern int showoptions;
        !            66: extern int debug;
        !            67: extern int telnet_profile;
        !            68: 
        !            69: TEXT_UPDATE *ndq_queue, *deq();                /*Incoming (From Net) NDQ's*/
        !            70: 
        !            71: map(ndq)       /*Parse the given NDQ (could contain several updates).
        !            72:                  Pass individual updates to appropriate processing
        !            73:                  routine.
        !            74:                */
        !            75: PE ndq;
        !            76: {
        !            77: 
        !            78:        TEXT_UPDATE *ud;
        !            79: 
        !            80:        if(unbuild_NDQPDU_NDQpdu(ndq,1,NULLIP,NULLVP,(PEPYPARM)0) == NOTOK)
        !            81:        {
        !            82:                advise (LLOG_NOTICE,NULLCP,  "NDQ parse failure (%s)", PY_pepy);
        !            83:                return;
        !            84:        }
        !            85:        while(ud = deq(&ndq_queue) )
        !            86:        {
        !            87:                if(ud->type_sw == DISPLAY_OBJ)
        !            88:                {
        !            89:                        display_ud(&ud->updates.do_list);
        !            90:                        free((char *)ud->updates.do_list.do_name);
        !            91:                }
        !            92:                else if(ud->type_sw == CTRL_OBJ)
        !            93:                {
        !            94:                        control_ud(&ud->updates.co_list);
        !            95:                        free((char *)ud->updates.co_list.co_name);
        !            96:                }
        !            97:                else 
        !            98:                        advise(LLOG_NOTICE,NULLCP,  "Invalid Update");
        !            99:                        free((char *)ud);
        !           100:        }
        !           101:        pe_free(ndq);
        !           102: }
        !           103: 
        !           104: 
        !           105: display_ud(doptr)              /*Handle Display Updates*/
        !           106: DO_UPDATE *doptr;
        !           107: {
        !           108: 
        !           109:        int i;
        !           110:        char *pt;
        !           111: #ifdef BSD44
        !           112:        struct termios term;
        !           113: #else
        !           114:        struct sgttyb ttyb;
        !           115: #endif
        !           116: 
        !           117:        switch(doptr->do_type) {
        !           118: 
        !           119:        case DO_NEXT_X:
        !           120:                if(putch('\r') == NOTOK) {
        !           121:                        if(debug)
        !           122:                                advise(LLOG_NOTICE,NULLCP,  "DROPPED CHAR");
        !           123:                        return;
        !           124:                }
        !           125: 
        !           126:                if(my_right == INITIATOR) {
        !           127:                        if(putch('\n') == NOTOK) /*Current Telnet only gives
        !           128:                                                                           CR to PTY*/
        !           129:                        {
        !           130:                                advise(LLOG_NOTICE,NULLCP,  "DROPPED CHAR");
        !           131:                                return;
        !           132:                        }
        !           133:                }
        !           134:                break;
        !           135: 
        !           136:        case DO_NEXT_Y:
        !           137:                if(debug)
        !           138:                        advise(LLOG_DEBUG,NULLCP,  "Next Y Array");
        !           139:                break;
        !           140: 
        !           141:        case DO_PTR_REL:        /*Ignore for TELNET since next update must
        !           142:                                                  be erase. */
        !           143:                break;
        !           144: 
        !           145:        case DO_PTR_ABS:        /*Ignore for TELNET since must have been
        !           146:                                                  preceeded by erase line. */
        !           147:                break;
        !           148: 
        !           149:        case DO_TEXT:
        !           150:                for(pt = doptr->do_cmd.text_ud.text_ptr, i = 0;
        !           151:                    i < doptr->do_cmd.text_ud.text_count; ++pt,++i)
        !           152:                {
        !           153:                        if(putch(*pt) == NOTOK)
        !           154:                        {
        !           155:                                advise(LLOG_NOTICE,NULLCP,  "DROPPED CHAR");
        !           156:                                return;
        !           157:                        }
        !           158:                }
        !           159:                free(doptr->do_cmd.text_ud.text_ptr);
        !           160:                break;
        !           161: 
        !           162:        case DO_RPT_TEXT:
        !           163:                if(debug)
        !           164:                        advise(LLOG_DEBUG,NULLCP,  "Repeat Text");
        !           165:                break;
        !           166: 
        !           167:        case DO_ATTR:
        !           168:                if(debug) 
        !           169:                        advise(LLOG_DEBUG,NULLCP,  "Write Attribute");
        !           170:                attrib_hdlr(doptr);
        !           171:                break;
        !           172: 
        !           173:        case DO_ERASE:
        !           174:                if((doptr->do_cmd.erase.start_erase.ptr_type == 0) &&
        !           175:                    (doptr->do_cmd.erase.end_erase.ptr_type == 0) )
        !           176:                {
        !           177:                        if(my_right == ACCEPTOR)
        !           178:                        {
        !           179: #ifdef BSD44
        !           180:                                if (tcgetattr(pty, &term) == -1)
        !           181:                                        perror("ioctl");
        !           182:                                else
        !           183:                                        (void)putch(erase_char=term.c_cc[VERASE]);      /* XXX what if _POSIX_VDISABLE */
        !           184: #else
        !           185:                                if (ioctl(pty,TIOCGETP,(char*)&ttyb) == -1) {
        !           186:                                        perror("ioctl");
        !           187:                                        adios(NULLCP, "ioctl failed");
        !           188:                                }
        !           189:                                (void)putch(ttyb.sg_erase);
        !           190:                                erase_char = ttyb.sg_erase;
        !           191: #endif
        !           192:                        }
        !           193:                        else (void)putch(erase_char);
        !           194:                }
        !           195:                else if((doptr->do_cmd.erase.start_erase.ptr_type == 3) &&
        !           196:                    (doptr->do_cmd.erase.end_erase.ptr_type == 6))
        !           197:                {
        !           198:                        if(my_right == ACCEPTOR)
        !           199:                        {
        !           200: #ifdef BSD44
        !           201:                                if (tcgetattr(pty, &term) == -1)
        !           202:                                        perror("ioctl");
        !           203:                                else
        !           204:                                        (void)putch(erase_line=term.c_cc[VKILL]);       /* XXX what if _POSIX_VDISABLE */
        !           205: #else
        !           206:                                if (ioctl(pty,TIOCGETP,(char*)&ttyb) == -1) {
        !           207:                                        perror("ioctl");
        !           208:                                        adios(NULLCP, "ioctl failed");
        !           209:                                }
        !           210:                                (void)putch(ttyb.sg_kill);
        !           211:                                erase_line = ttyb.sg_kill;
        !           212: #endif
        !           213:                        }
        !           214:                        else (void)putch(erase_line);
        !           215:                }
        !           216:                break;
        !           217: 
        !           218:        case DO_PREV_X:
        !           219:                if(debug)
        !           220:                        advise(LLOG_DEBUG,NULLCP,  "Previous X-Array\n");
        !           221:                break;
        !           222: 
        !           223:        case DO_PREV_Y:
        !           224:                if(debug)
        !           225:                        advise(LLOG_DEBUG,NULLCP,  "Previous Y-Array\n");
        !           226:                break;
        !           227:        }               /*End Switch*/
        !           228: }
        !           229: 
        !           230: 
        !           231: control_ud(coptr)              /*Handle Control Object Updates*/
        !           232: CO_UPDATE *coptr;
        !           233: {
        !           234: 
        !           235:        char active = 0;
        !           236: #ifdef BSD44
        !           237:        struct termios term;
        !           238: #else
        !           239:        struct sgttyb sb;
        !           240: #endif
        !           241: 
        !           242:        if(!telnet_profile)
        !           243:        {
        !           244:                if((my_right == INITIATOR) && (!strcmp(coptr->co_name,"E")))
        !           245:                /*The Echo Control Object in Default Profile is WACA*/
        !           246:                        def_echo(coptr);
        !           247:                else
        !           248:                        advise(LLOG_NOTICE,NULLCP,  "Received Invalid CO Update under Default Profile\n");
        !           249:                return;
        !           250:        }
        !           251:        if(coptr->co_type != 1) /*Only Booleans allowed in TELNET*/
        !           252:        {
        !           253:                advise(LLOG_NOTICE,NULLCP,  "Invalid CO Type\n");
        !           254:                return;
        !           255:        }
        !           256:        if(coptr->co_cmd.bool_update.mask_count == 0) active = 0xff;
        !           257:        else active = *coptr->co_cmd.bool_update.mask;
        !           258: 
        !           259:        if(my_right == INITIATOR)
        !           260:        {
        !           261:                if(!strcmp(coptr->co_name,"DI") )
        !           262:                {
        !           263:                        if(active & AYT_OBJ)
        !           264:                        /*If This CO contains potential update to Are You There bit*/
        !           265:                        {
        !           266:                                if( (di_image & AYT_OBJ) != 
        !           267:                                    (AYT_OBJ & *coptr->co_cmd.bool_update.value))
        !           268:                                /*If this bit was toggled*/
        !           269:                                {
        !           270:                                        if(debug)
        !           271:                                                advise(LLOG_DEBUG,NULLCP,  "Toggled AYT in DI\n");
        !           272:                                        di_image ^= AYT_OBJ;    /*Save the new value*/
        !           273:                                }
        !           274:                        }
        !           275:                        if(active & AO_OBJ)
        !           276:                        /*If potential update to Abort Output bit*/
        !           277:                        {
        !           278:                                if( (di_image & AO_OBJ) !=
        !           279:                                    (AO_OBJ & *coptr->co_cmd.bool_update.value))
        !           280:                                /*Toggled AO bit*/
        !           281:                                {
        !           282:                                        if(debug)
        !           283:                                                advise(LLOG_DEBUG,NULLCP,  "Toggled AO in DI\n");
        !           284:                                        di_image ^= AO_OBJ;     /*Record it*/
        !           285:                                }
        !           286:                        }
        !           287:                        if(active & IP_OBJ)
        !           288:                        /*If potential update to Interrupt Process bit*/
        !           289:                        {
        !           290:                                if( (di_image & IP_OBJ) !=
        !           291:                                    (IP_OBJ & *coptr->co_cmd.bool_update.value))
        !           292:                                /*Toggled AO bit*/
        !           293:                                {
        !           294:                                        if(debug)
        !           295:                                                advise(LLOG_DEBUG,NULLCP,  "Toggled IP in DI/n");
        !           296:                                        di_image ^= IP_OBJ;
        !           297:                                }
        !           298:                        }
        !           299:                        if(active & DM_OBJ)
        !           300:                        {
        !           301:                                if( (di_image & DM_OBJ) !=
        !           302:                                    (DM_OBJ & *coptr->co_cmd.bool_update.value) )
        !           303: 
        !           304:                                /*Toggled DM Bit*/
        !           305:                                {
        !           306:                                        if(debug)
        !           307:                                                advise(LLOG_DEBUG,NULLCP,  "Toggled DM in DI\n");
        !           308:                                        di_image ^= DM_OBJ;
        !           309:                                }
        !           310:                        }
        !           311:                        if(active & BRK_OBJ)
        !           312:                        {
        !           313:                                if( (di_image & BRK_OBJ) !=
        !           314:                                    (BRK_OBJ & *coptr->co_cmd.bool_update.value) )
        !           315:                                /*Toggled Break Bit*/
        !           316:                                {
        !           317:                                        if(debug)
        !           318:                                                advise(LLOG_DEBUG,NULLCP,  "Toggled BRK in DI\n");
        !           319:                                        di_image ^= BRK_OBJ;
        !           320:                                }
        !           321:                        }
        !           322:                }
        !           323:                else if( !strcmp(coptr->co_name,"NA") )
        !           324:                {
        !           325:                        if(active & ECHO_OBJ)
        !           326:                        /*Update to Echo Control Object*/
        !           327:                        {
        !           328:                                if(ECHO_OBJ & *coptr->co_cmd.bool_update.value)
        !           329:                                /*Request from Server for Remote Echo*/
        !           330:                                {
        !           331:                                        na_image |= ECHO_OBJ;
        !           332:                                        if(showoptions)
        !           333:                                                (void)printf("Remote Echo Update Received\r\n");
        !           334:                                        if(ECHO_OBJ & nego_state) /*If now in Remote Echo*/
        !           335:                                        {
        !           336:                                                if(ni_image & ECHO_OBJ) /*No request outstatnding*/
        !           337:                                                {
        !           338:                                                        if(showoptions)
        !           339:                                                                (void)printf("Server Request ignored--Now in Remote echo\r\n");
        !           340:                                                }
        !           341:                                                else
        !           342:                                                {
        !           343:                                                        if(showoptions)
        !           344:                                                                (void)printf("Request for Local Echo Denied by Server\r\n");
        !           345:                                                        ni_image |= ECHO_OBJ;
        !           346:                                                }
        !           347:                                        }
        !           348:                                        else    /*Else Not in Remote Echo*/
        !           349:                                        {
        !           350:                                                if(ni_image & ECHO_OBJ) /*I Requested Remote Echo*/
        !           351:                                                /*This must be confirmation*/
        !           352:                                                {
        !           353:                                                        if(showoptions)
        !           354:                                                                (void)printf("Server agreed to do Remote Echo\r\n");
        !           355:                                                }
        !           356:                                                else    /*Request to do Remote Echo*/
        !           357:                                                {
        !           358:                                                        if(showoptions)
        !           359:                                                                (void)printf("Server Requested Remote Echo\r\n");
        !           360:                                                        ni_image |= ECHO_OBJ;
        !           361:                                                        vt_set_nego(ni_image,ECHO_OBJ);/*Respond "WILL"*/
        !           362:                                                }
        !           363:                                                (void) tmode(1);
        !           364:                                                nego_state |= ECHO_OBJ;
        !           365:                                                cur_emode = ECHO_NOW;   /*Want Server to Echo*/
        !           366:                                        }
        !           367:                                }
        !           368:                                else    /*Request from server for Local Echo*/
        !           369:                                {
        !           370:                                        if(showoptions)
        !           371:                                                (void)printf("NA--Local Echo\r\n");
        !           372:                                        cur_emode = NOT_ECHO_NOW;
        !           373:                                        na_image &= ~ECHO_OBJ;
        !           374:                                        if(nego_state & ECHO_OBJ) /*If now in Remote Echo*/
        !           375:                                        {
        !           376:                                                if(ni_image & ECHO_OBJ) /*If no request pending*/
        !           377:                                                /*Must be request from sender*/
        !           378:                                                {
        !           379:                                                        if(showoptions)
        !           380:                                                                (void)printf("Server requested Local Echo -- O.K.\r\n");
        !           381:                                                        ni_image &= ~ECHO_OBJ;
        !           382:                                                        vt_set_nego(ni_image,ECHO_OBJ);/*Respond "WILL"*/
        !           383:                                                }
        !           384:                                                else
        !           385:                                                {
        !           386:                                                        if(showoptions)
        !           387:                                                                (void)printf("User request for Local Echo Accepted\r\n");
        !           388:                                                }
        !           389:                                                nego_state &= ~ECHO_OBJ;
        !           390:                                                /*                          sb = ottyb;
        !           391:                /*                          sb.sg_flags |= ECHO|CRMOD|CBREAK;
        !           392:                /*                          ioctl(fileno(stdin),TIOCSETP,(char*)&sb);
        !           393:                */
        !           394:                                                (void)tmode(2);
        !           395:                                        }
        !           396:                                        else    /*Else now in Local Echo*/
        !           397:                                        {
        !           398:                                                if(ni_image & ECHO_OBJ) /*If requeset pending*/
        !           399:                                                /*Must be negative response*/
        !           400:                                                {
        !           401:                                                        ni_image &= ~ECHO_OBJ;
        !           402:                                                        if(showoptions)
        !           403:                                                                (void)printf("Request for Remote Echo Denied by Server\r\n");
        !           404:                                                }
        !           405:                                                else /*Else no request pending*/
        !           406:                                                {
        !           407:                                                        if(showoptions)
        !           408:                                                                (void)printf("Server Request Ignored--Now in Local Echo\r\n");
        !           409:                                                }
        !           410:                                        }
        !           411:                                }
        !           412:                        }
        !           413:                        if(active & SUP_GA)
        !           414:                        /*Update to Suppress Go Ahead Control Object*/
        !           415:                        {
        !           416:                                if(SUP_GA & *coptr->co_cmd.bool_update.value)
        !           417:                                {
        !           418:                                        if(showoptions)
        !           419:                                                (void)printf("Suppress Go Ahead\r\n");
        !           420:                                        na_image |= SUP_GA;
        !           421:                                        if((ni_image & SUP_GA) == (nego_state & SUP_GA))
        !           422:                                        /*If no outstanding request from User*/
        !           423:                                        {
        !           424:                                                if(!(nego_state & SUP_GA))
        !           425:                                                /*If not currently in Suppress Go Ahead*/
        !           426:                                                {
        !           427:                                                        ni_image |= SUP_GA;
        !           428:                                                        vt_set_nego(ni_image,SUP_GA);/*Reply "Will"*/
        !           429:                                                }
        !           430:                                        }
        !           431:                                        nego_state |= SUP_GA;/*Either here now or entering*/
        !           432:                                }
        !           433:                                else
        !           434:                                {
        !           435:                                        if(showoptions)
        !           436:                                                (void)printf("Go Ahead\r\n");
        !           437:                                        na_image &= ~SUP_GA;
        !           438:                                        if( (ni_image & SUP_GA) == (nego_state & SUP_GA) )
        !           439:                                        /*Must be request from Server*/
        !           440:                                        {
        !           441:                                                ni_image |= SUP_GA;
        !           442:                                                vt_set_nego(ni_image,SUP_GA);/*Reply "Won't"*/
        !           443:                                        }
        !           444:                                        else    /*Else response to my request to Suppress*/
        !           445:                                        {
        !           446:                                                if(showoptions)
        !           447:                                                        (void)printf("Server refuses to Suppress Go Ahead\r\n");
        !           448:                                                ni_image &= ~SUP_GA;    /*Give Up*/
        !           449:                                                /*May want to terminate Association here*/
        !           450:                                        }
        !           451:                                }
        !           452:                        }
        !           453:                        if(active & DISP_BIN)
        !           454:                        /*Update to WACA Binary Repertoire*/
        !           455:                        {
        !           456:                                if(DISP_BIN & *coptr->co_cmd.bool_update.value)
        !           457:                                {
        !           458:                                        if(showoptions)
        !           459:                                                (void)printf("WACA requested Binary Repertoire on DI\r\n");
        !           460:                                        if((ni_image & DISP_BIN) == (nego_state & DISP_BIN))
        !           461:                                        /*No request outstanding from Initiator*/
        !           462:                                        {
        !           463:                                                if(!(nego_state & DISP_BIN)) /*If not now binary*/
        !           464:                                                {
        !           465:                                                        ni_image |= DISP_BIN;
        !           466:                                                        vt_set_nego(ni_image,DISP_BIN); /*Send "Will"*/
        !           467:                                                }
        !           468:                                        }
        !           469:                                        nego_state |= DISP_BIN;
        !           470:                                        ni_image |= DISP_BIN;
        !           471:                                }
        !           472:                                else
        !           473:                                {
        !           474:                                        if(showoptions)
        !           475:                                                (void)printf("WACA requested ASCII Repertoire on DI\r\n");
        !           476:                                        if((ni_image & DISP_BIN) == (nego_state & DISP_BIN))
        !           477:                                        {
        !           478:                                                if(nego_state & DISP_BIN) /*If not now ASCII*/
        !           479:                                                {
        !           480:                                                        ni_image &= ~DISP_BIN;
        !           481:                                                        vt_set_nego(ni_image,DISP_BIN);
        !           482:                                                }
        !           483:                                        }
        !           484:                                        nego_state &= ~DISP_BIN;
        !           485:                                        ni_image &= ~DISP_BIN;
        !           486:                                }
        !           487:                        }
        !           488:                        if(active & KBD_BIN)
        !           489:                        /*Update to WACI Binary Repertoire*/
        !           490:                        {
        !           491:                                if(KBD_BIN & *coptr->co_cmd.bool_update.value)
        !           492:                                {
        !           493:                                        if(showoptions)
        !           494:                                                (void)printf("WACA requested Binary Repertoire on KB\r\n");
        !           495:                                        if((ni_image & KBD_BIN) == (nego_state & KBD_BIN))
        !           496:                                        /*If no initiator request outstanding*/
        !           497:                                        {
        !           498:                                                if(!(nego_state & KBD_BIN))/*If not now binary*/
        !           499:                                                {
        !           500:                                                        ni_image |= KBD_BIN;
        !           501:                                                        vt_set_nego(ni_image,KBD_BIN); /*Reply "Will"*/
        !           502:                                                        switch_rep(2);
        !           503:                                                        /*Send Attribute update to use Binary Repertoire*/
        !           504:                                                }
        !           505:                                        }
        !           506:                                        else    /*Else a response to Initiator Request*/
        !           507:                                        {
        !           508:                                                if(ni_image & KBD_BIN) /*Positive response*/
        !           509:                                                        switch_rep(2);
        !           510:                                        }
        !           511:                                        ni_image |= KBD_BIN;
        !           512:                                        nego_state |= KBD_BIN;
        !           513:                                }
        !           514:                                else
        !           515:                                {
        !           516:                                        if(showoptions)
        !           517:                                                (void)printf("Acceptor requested ASCII Repertoire on KB\r\n");
        !           518:                                        if((ni_image & KBD_BIN) == (nego_state & KBD_BIN))
        !           519:                                        /*Request from Acceptor*/
        !           520:                                        {
        !           521:                                                if(nego_state & KBD_BIN) /*If not now ASCII*/
        !           522:                                                {
        !           523:                                                        ni_image &= ~KBD_BIN;
        !           524:                                                        vt_set_nego(ni_image,KBD_BIN); /*Reply "Will"*/
        !           525:                                                        switch_rep(1);/*Send Attr to ASCII*/
        !           526:                                                }
        !           527:                                        }
        !           528:                                        else    /*Else response to Initiator Request*/
        !           529:                                        {
        !           530:                                                if( !(ni_image & KBD_BIN))/*Positive response*/
        !           531:                                                        switch_rep(1);
        !           532:                                        }
        !           533:                                        ni_image &= ~KBD_BIN;
        !           534:                                        nego_state &= ~KBD_BIN;
        !           535:                                }
        !           536:                        }
        !           537:                }
        !           538:        }
        !           539:        else    /*Else Server (Display) side*/
        !           540:        {
        !           541:                if(!strcmp(coptr->co_name,"KB") )
        !           542:                /*Server receives updates to the Keyboard*/
        !           543:                {
        !           544:                        if(active & AYT_OBJ)
        !           545:                        /*If This CO contains potential update to Are You There bit*/
        !           546:                        {
        !           547:                                if( (kb_image & AYT_OBJ) != 
        !           548:                                    (AYT_OBJ & *coptr->co_cmd.bool_update.value))
        !           549:                                /*If this bit was toggled*/
        !           550:                                {
        !           551:                                        if(debug)
        !           552:                                                advise(LLOG_DEBUG,NULLCP,  "Toggled AYT in KB");
        !           553:                                        kb_image ^= AYT_OBJ;    /*Save the new value*/
        !           554:                                        if (vt_text("[associated with terminal service on ", strlen("[associated with terminal service on ")) != OK)
        !           555:                                                advise(LLOG_NOTICE,NULLCP,  "vt_text failed");
        !           556:                                        if (vt_text(myhostname,strlen(myhostname)) != OK)
        !           557:                                                advise(LLOG_NOTICE,NULLCP,  "vt_text failed");
        !           558:                                        if (vt_text("]\r\n",3) != OK)
        !           559:                                                advise(LLOG_NOTICE,NULLCP,  "vt_text failed");
        !           560:                                        vtsend();
        !           561:                                }
        !           562:                        }
        !           563:                        if(active & AO_OBJ)
        !           564:                        /*If potential update to Abort Output bit*/
        !           565:                        {
        !           566:                                if( (kb_image & AO_OBJ) !=
        !           567:                                    (AO_OBJ & *coptr->co_cmd.bool_update.value))
        !           568:                                /*Toggled AO bit*/
        !           569:                                {
        !           570:                                        if(debug) 
        !           571:                                                advise(LLOG_DEBUG,NULLCP,  "Toggled AO in KB");
        !           572:                                        kb_image ^= AO_OBJ;     /*Record it*/
        !           573:                                }
        !           574:                        }
        !           575:                        if(active & IP_OBJ)
        !           576:                        /*If potential update to Interrupt Process bit*/
        !           577:                        {
        !           578:                                if( (kb_image & IP_OBJ) !=
        !           579:                                    (IP_OBJ & *coptr->co_cmd.bool_update.value))
        !           580:                                /*Toggled IP bit*/
        !           581:                                {
        !           582:                                        if(debug)
        !           583:                                                advise(LLOG_DEBUG,NULLCP,  "Toggled IP in KB");
        !           584:                                        kb_image ^= IP_OBJ;
        !           585:                                        kill_proc();
        !           586:                                }
        !           587:                        }
        !           588:                        if(active & DM_OBJ)
        !           589:                        {
        !           590:                                if( (kb_image & DM_OBJ) !=
        !           591:                                    (DM_OBJ & *coptr->co_cmd.bool_update.value))
        !           592:                                {
        !           593:                                        /*Toggled DM BIt*/
        !           594:                                        if(debug)
        !           595:                                                advise(LLOG_DEBUG,NULLCP,  "Toggled DM in KB");
        !           596:                                        kb_image ^= DM_OBJ;
        !           597:                                }
        !           598:                        }
        !           599:                        if(active & BRK_OBJ)
        !           600:                        /*If potential update to Break Bit*/
        !           601:                        {
        !           602:                                if( (kb_image & BRK_OBJ) !=
        !           603:                                    (BRK_OBJ & *coptr->co_cmd.bool_update.value))
        !           604:                                /*Toggled BREAK bit*/
        !           605:                                {
        !           606:                                        if(debug)
        !           607:                                                advise(LLOG_DEBUG,NULLCP,  "Toggled BREAK in KB");
        !           608:                                        kb_image ^= BRK_OBJ;
        !           609:                                        kill_proc();
        !           610:                                }
        !           611:                        }
        !           612:                }
        !           613:                else if( !strcmp(coptr->co_name,"NI") )
        !           614:                {
        !           615:                        if(active & ECHO_OBJ)
        !           616:                        /*Update to Echo Control Object*/
        !           617:                        {
        !           618:                                if(ECHO_OBJ & *coptr->co_cmd.bool_update.value)
        !           619:                                /*Request from User for Remote Echo*/
        !           620:                                {
        !           621:                                        ni_image |= ECHO_OBJ;
        !           622:                                        if(showoptions)
        !           623:                                                (void)printf("Remote Echo Update Received\n");
        !           624:                                        if(ECHO_OBJ & nego_state) /*If now in Remote Echo*/
        !           625:                                        {
        !           626:                                                if(na_image & ECHO_OBJ) /*No request outstatnding*/
        !           627:                                                        advise(LLOG_NOTICE,NULLCP,  "User Request ignored--Now in Remote echo");
        !           628:                                                else /*Must be user's response to a request*/
        !           629:                                                {
        !           630:                                                        if(showoptions)
        !           631:                                                                (void)printf("Request for Local Echo Denied by User\n");
        !           632:                                                        na_image |= ECHO_OBJ;
        !           633:                                                }
        !           634:                                        }
        !           635:                                        else    /*Else Not in Remote Echo*/
        !           636:                                        {
        !           637:                                                if(na_image & ECHO_OBJ) /*I Requested Remote Echo*/
        !           638:                                                /*This must be confirmation*/
        !           639:                                                {
        !           640:                                                        if(showoptions)
        !           641:                                                                (void)printf("User agreed to do Remote Echo\n");
        !           642:                                                }
        !           643:                                                else    /*Request to do Remote Echo*/
        !           644:                                                {
        !           645:                                                        if(showoptions)
        !           646:                                                                (void)printf("User Requested Remote Echo--O.K.\n");
        !           647:                                                        na_image |= ECHO_OBJ;
        !           648:                                                        vt_set_nego(na_image,ECHO_OBJ);/*Respond "WILL"*/
        !           649:                                                }
        !           650: #ifdef BSD44
        !           651:                                                realptyecho(1);
        !           652: #else
        !           653:                                                if (ioctl(pty,TIOCGETP,(char*)&sb) == -1) {
        !           654:                                                        perror("ioctl");
        !           655:                                                        adios(NULLCP, "ioctl failed");
        !           656:                                                }
        !           657:                                                sb.sg_flags |= ECHO;    /*Turn on Echo*/
        !           658:                                                if (ioctl(pty,TIOCSETP,(char*)&sb) == -1) {
        !           659:                                                        perror("ioctl");
        !           660:                                                        adios(NULLCP, "ioctl failed");
        !           661:                                                }
        !           662: #endif
        !           663:                                                nego_state |= ECHO_OBJ;
        !           664:                                                cur_emode = NOT_ECHO_NOW;       /*Don't Want user to Echo*/
        !           665:                                        }
        !           666:                                }
        !           667:                                else    /*Request from user for Local Echo*/
        !           668:                                {
        !           669:                                        if(showoptions)
        !           670:                                                (void)printf("NI--Local Echo\n");
        !           671:                                        cur_emode = NOT_ECHO_NOW;
        !           672:                                        ni_image &= ~ECHO_OBJ;
        !           673:                                        if(nego_state & ECHO_OBJ) /*If now in Remote Echo*/
        !           674:                                        {
        !           675:                                                if(na_image & ECHO_OBJ) /*If no request pending*/
        !           676:                                                /*Must be request from user*/
        !           677:                                                {
        !           678: 
        !           679: #ifdef DO_LOCAL_ECHO
        !           680:                                                        if(showoptions)
        !           681:                                                                (void)printf("User requested Local Echo -- O.K.\n");
        !           682: 
        !           683:                                                        na_image &= ~ECHO_OBJ;
        !           684:                                                        nego_state &= ~ECHO_OBJ;
        !           685: #ifdef BSD44
        !           686:                                                        ptyecho(0);
        !           687: #else
        !           688:                                                        setmode(0,ECHO);
        !           689: #endif
        !           690: #else
        !           691:                                                        na_image |= ECHO_OBJ;
        !           692:                                                        if(showoptions)
        !           693:                                                                (void)printf("User requested Local Echo -- Denied\n");
        !           694: #endif
        !           695: 
        !           696:                                                        vt_set_nego(na_image,ECHO_OBJ); /*Respond "WILL"*/
        !           697:                                                }
        !           698:                                                else 
        !           699:                                                {
        !           700:                                                        if(showoptions)
        !           701:                                                                (void)printf("Server request for Local Echo Accepted\n");
        !           702:                                                        nego_state &= ~ECHO_OBJ;
        !           703: #ifdef BSD44
        !           704:                                                        ptyecho(0);
        !           705: #else
        !           706:                                                        setmode(0,ECHO);
        !           707: #endif
        !           708:                                                }
        !           709:                                        }
        !           710:                                        else    /*Else now in Local Echo*/
        !           711:                                        {
        !           712:                                                if(na_image & ECHO_OBJ) /*If requeset pending*/
        !           713:                                                /*Must be negative response*/
        !           714:                                                {
        !           715:                                                        na_image &= ~ECHO_OBJ;
        !           716:                                                        if(showoptions)
        !           717:                                                                (void)printf("Request for Remote Echo Denied by User\n");
        !           718:                                                }
        !           719:                                                else /*Else no request pending*/
        !           720:                                                {
        !           721:                                                        if(showoptions)
        !           722:                                                                (void)printf("User Request Ignored--Now in Local Echo\n");
        !           723:                                                }
        !           724:                                        }
        !           725:                                }
        !           726:                        }
        !           727:                        if(active & SUP_GA)
        !           728:                        /*Update to Suppress Go Ahead Control Object*/
        !           729:                        {
        !           730:                                if(SUP_GA & *coptr->co_cmd.bool_update.value)
        !           731:                                {
        !           732:                                        if(showoptions)
        !           733:                                                (void)printf("Suppress Go Ahead\n");
        !           734:                                        ni_image |= SUP_GA;
        !           735:                                        if((na_image & SUP_GA) == (nego_state &SUP_GA))
        !           736:                                        /*If no request from Acceptor outstanding*/
        !           737:                                        {
        !           738:                                                if(!(nego_state & SUP_GA))
        !           739:                                                /*If not currently in Supress Go Ahead*/
        !           740:                                                {
        !           741:                                                        na_image |= SUP_GA;
        !           742:                                                        vt_set_nego(na_image,SUP_GA);/*Reply "Will"*/
        !           743:                                                }
        !           744:                                        }
        !           745:                                        nego_state |= SUP_GA; /*Entering or already there*/
        !           746:                                }
        !           747:                                else
        !           748:                                {
        !           749:                                        if(showoptions) 
        !           750:                                                (void)printf("Don't Suppress Go Ahead\n");
        !           751:                                        ni_image &= ~SUP_GA;
        !           752:                                        if((na_image & SUP_GA) == (nego_state & SUP_GA))
        !           753:                                        /*Must be request from Initiator*/
        !           754:                                        {
        !           755:                                                na_image |= SUP_GA;
        !           756:                                                vt_set_nego(na_image,SUP_GA);/*Reply "Won't"*/
        !           757:                                        }
        !           758:                                        else /*Else reply to my request*/
        !           759:                                        {
        !           760:                                                if(showoptions)
        !           761:                                                        (void)printf("User refuses to Suppress Go Ahead\n");
        !           762:                                                na_image &= ~SUP_GA;    /*Give up*/
        !           763:                                        }
        !           764:                                }
        !           765:                        }
        !           766:                        if(active & DISP_BIN)
        !           767:                        /*Update to WACI Binary Repertoire*/
        !           768:                        {
        !           769:                                if(DISP_BIN & *coptr->co_cmd.bool_update.value)
        !           770:                                {
        !           771:                                        if(showoptions)
        !           772:                                                (void)printf("Initiator requested Binary Repertoire on DI\n");
        !           773:                                        if((na_image & DISP_BIN) == (nego_state & DISP_BIN))
        !           774:                                        /*No request outstanding from Acceptor*/
        !           775:                                        {
        !           776:                                                if(!(nego_state & DISP_BIN)) /*If not now binary*/
        !           777:                                                {
        !           778:                                                        na_image |= DISP_BIN;
        !           779:                                                        vt_set_nego(na_image,DISP_BIN); /*Send "Will"*/
        !           780:                                                        switch_rep(2);
        !           781:                                                }
        !           782:                                        }
        !           783:                                        else    /*Else a response to Acceptor request*/
        !           784:                                        {
        !           785:                                                if(na_image & KBD_BIN) /*Positive Response*/
        !           786:                                                        switch_rep(2);
        !           787:                                        }
        !           788:                                        nego_state |= DISP_BIN;
        !           789:                                        na_image |= DISP_BIN;
        !           790:                                }
        !           791:                                else
        !           792:                                {
        !           793:                                        if(showoptions)
        !           794:                                                (void)printf("Initiator requested ASCII Repertoire on DI\n");
        !           795:                                        if((na_image & DISP_BIN) == (nego_state & DISP_BIN))
        !           796:                                        {
        !           797:                                                if(nego_state & DISP_BIN) /*If not now ASCII*/
        !           798:                                                {
        !           799:                                                        na_image &= ~DISP_BIN;
        !           800:                                                        vt_set_nego(na_image,DISP_BIN);
        !           801:                                                        switch_rep(1);
        !           802:                                                }
        !           803:                                        }
        !           804:                                        else
        !           805:                                        {
        !           806:                                                if(!(na_image & KBD_BIN)) /*Positive Response*/
        !           807:                                                        switch_rep(1);
        !           808:                                        }
        !           809:                                        nego_state &= ~DISP_BIN;
        !           810:                                        na_image &= ~DISP_BIN;
        !           811:                                }
        !           812:                        }
        !           813:                        if(active & KBD_BIN)
        !           814:                        /*Update to WACI Binary Repertoire*/
        !           815:                        {
        !           816:                                if(KBD_BIN & *coptr->co_cmd.bool_update.value)
        !           817:                                {
        !           818:                                        if(showoptions)
        !           819:                                                (void)printf("Initiator requested Binary Repertoire on KB\n");
        !           820:                                        if((na_image & KBD_BIN) == (nego_state & KBD_BIN))
        !           821:                                        /*If no Acceptor request outstanding*/
        !           822:                                        {
        !           823:                                                if(!(nego_state & KBD_BIN))/*If not now binary*/
        !           824:                                                {
        !           825:                                                        na_image |= KBD_BIN;
        !           826:                                                        vt_set_nego(na_image,KBD_BIN); /*Reply "Will"*/
        !           827:                                                }
        !           828:                                        }
        !           829:                                        na_image |= KBD_BIN;
        !           830:                                        nego_state |= KBD_BIN;
        !           831:                                }
        !           832:                                else
        !           833:                                {
        !           834:                                        if(showoptions)
        !           835:                                                (void)printf("Initiator requested ASCII Repertoire on KB\n");
        !           836:                                        if((na_image & KBD_BIN) == (nego_state & KBD_BIN))
        !           837:                                        /*Request from Initator*/
        !           838:                                        {
        !           839:                                                if(nego_state & KBD_BIN) /*If not now ASCII*/
        !           840:                                                {
        !           841:                                                        na_image &= ~KBD_BIN;
        !           842:                                                        vt_set_nego(na_image,KBD_BIN); /*Reply "Will"*/
        !           843:                                                }
        !           844:                                        }
        !           845:                                        na_image &= ~KBD_BIN;
        !           846:                                        nego_state &= ~KBD_BIN;
        !           847:                                }
        !           848:                        }
        !           849:                }
        !           850:        }
        !           851:        if( !strcmp(coptr->co_name,"SY") ) /*SYNCHRONIZE CO can be written
        !           852:                                                        by Initiator or Acceptor*/
        !           853:        {
        !           854:                if(active & SYNC)
        !           855:                /*Potential Update to Synch*/
        !           856:                {
        !           857:                        if( (SYNC & *coptr->co_cmd.bool_update.value) !=
        !           858:                            (SYNC & sync_image) )
        !           859:                        {
        !           860:                                advise(LLOG_NOTICE,NULLCP,  "Toggled SYNC");
        !           861:                                sync_image ^= SYNC;
        !           862:                        }
        !           863:                }
        !           864:        }
        !           865:        if( !strcmp(coptr->co_name,"GA") )
        !           866:        {
        !           867:                if(active & GO_AHEAD)
        !           868:                /*Potential Update to Go Ahead*/
        !           869:                {
        !           870:                        if( (GO_AHEAD & *coptr->co_cmd.bool_update.value) !=
        !           871:                            (GO_AHEAD & ga_image) )
        !           872:                        {
        !           873:                                if(debug) 
        !           874:                                        advise(LLOG_DEBUG,NULLCP,  "Toggled Go Ahead");
        !           875:                                ga_image  ^= GO_AHEAD;
        !           876:                        }
        !           877:                }
        !           878:        }
        !           879: 
        !           880: }
        !           881: 
        !           882: attrib_hdlr(doptr)     /*Handle Write Attribute Display Object Update*/
        !           883: DO_UPDATE *doptr;
        !           884: {
        !           885: 
        !           886: 
        !           887:        if(doptr->do_cmd.wrt_attrib.attr_id == 0)
        !           888:        /*If switching repertoires*/
        !           889:        {
        !           890:                if(doptr->do_cmd.wrt_attrib.attr_ext == 2)
        !           891:                /*If Modal extent*/
        !           892:                {
        !           893:                        if(doptr->do_cmd.wrt_attrib.attr_val == 1)
        !           894:                        {
        !           895:                            if(showoptions)
        !           896:                                if(my_right == INITIATOR)
        !           897:                                        (void)printf("Switching to ASCII Repertoire\r\n");
        !           898:                            transparent = 0;
        !           899:                        }
        !           900:                        else if(doptr->do_cmd.wrt_attrib.attr_val == 2)
        !           901:                        {
        !           902:                            if(showoptions)
        !           903:                                if(my_right == INITIATOR)
        !           904:                                        (void)printf("Switching to Transparent profile.\r\n");
        !           905:                            transparent = 1;
        !           906:                        }
        !           907:                        else (void)printf("Attribute for unavailable repertoire\n");
        !           908:                }
        !           909:                else (void)printf("Attribute update with invalid extent (%d)\n",
        !           910:                    doptr->do_cmd.wrt_attrib.attr_ext);
        !           911:        }
        !           912:        else 
        !           913:                advise(LLOG_NOTICE,NULLCP,  "Attribute Update with invalid I.D. (%d)\n", doptr->do_cmd.wrt_attrib.attr_id);
        !           914: }
        !           915: 
        !           916: /*    TTY */
        !           917: 
        !           918: #ifdef BSD44
        !           919: extern struct  termios oterm;
        !           920: 
        !           921: int
        !           922: tmode(f)
        !           923:        int f;
        !           924: {
        !           925:        static int prevmode = 0;
        !           926:        struct termios term;
        !           927:        int onoff, old;
        !           928: 
        !           929:        if (prevmode == f)
        !           930:                return (f);
        !           931:        old = prevmode;
        !           932:        prevmode = f;
        !           933:        term = oterm;
        !           934:        switch (f) {
        !           935:        case 0:
        !           936:                onoff = 0;
        !           937:                break;
        !           938:        case 1:
        !           939:        case 2:
        !           940:                onoff = 1;
        !           941:                if (f == 1)
        !           942:                {
        !           943:                        term.c_lflag &= ~ECHO;
        !           944:                        term.c_oflag &= ~OPOST;
        !           945:                }
        !           946:                else
        !           947:                {
        !           948:                        term.c_lflag |= ECHO;
        !           949:                        term.c_oflag |= OPOST;
        !           950:                }
        !           951:                term.c_lflag &= ~(IEXTEN|ISIG|ICANON);
        !           952:                break;
        !           953:        default:
        !           954:                return old;
        !           955:        }
        !           956:        if (tcsetattr(fileno(stdin), TCSAFLUSH, &term) == -1)
        !           957:                perror("tcsetattr");
        !           958:        if (ioctl(fileno(stdin), FIONBIO, (char*)&onoff) == -1) {
        !           959:                perror("ioctl");
        !           960:        }
        !           961:        return (old);
        !           962: }
        !           963: 
        !           964: #else
        !           965: 
        !           966: extern struct  tchars otc;
        !           967: extern struct  ltchars oltc;
        !           968: extern struct  sgttyb ottyb;
        !           969: 
        !           970: /* struct      tchars notc =   { -1, 3, -1, -1, -1, -1 };*/
        !           971: struct tchars notc =   { 
        !           972:        -1, -1, -1, -1, -1, -1 };
        !           973: struct ltchars noltc = { 
        !           974:        -1, -1, -1, -1, -1, -1 };
        !           975: 
        !           976: int
        !           977: tmode(f)
        !           978: register int f;
        !           979: {
        !           980:        static int prevmode = 0;
        !           981:        struct tchars *tc;
        !           982:        struct ltchars *ltc;
        !           983:        struct sgttyb sb;
        !           984:        int onoff, old;
        !           985: 
        !           986:        if (prevmode == f)
        !           987:                return (f);
        !           988:        old = prevmode;
        !           989:        prevmode = f;
        !           990:        sb = ottyb;
        !           991:        switch (f) {
        !           992: 
        !           993:        case 0:
        !           994:                onoff = 0;
        !           995:                tc = &otc;
        !           996:                ltc = &oltc;
        !           997:                break;
        !           998: 
        !           999:        case 1:
        !          1000:        case 2:
        !          1001:                if (f == 1)
        !          1002:                {
        !          1003:                        sb.sg_flags |= CBREAK;
        !          1004:                        sb.sg_flags &= ~(ECHO|CRMOD);
        !          1005:                        sb.sg_erase = sb.sg_kill = -1;
        !          1006:                }
        !          1007:                else
        !          1008:                {
        !          1009:                        sb.sg_flags &= CBREAK;
        !          1010:                        sb.sg_flags |= ECHO|CRMOD;
        !          1011:                }
        !          1012:                tc = &notc;
        !          1013:                notc.t_stopc = otc.t_stopc;
        !          1014:                notc.t_startc = otc.t_startc;
        !          1015:                ltc = &noltc;
        !          1016:                onoff = 1;
        !          1017:                break;
        !          1018: 
        !          1019:        default:
        !          1020:                return old;
        !          1021:        }
        !          1022:        if (ioctl(fileno(stdin), TIOCSLTC, (char *)ltc) == -1) {
        !          1023:                perror("ioctl");
        !          1024:                adios(NULLCP, "ioctl failed");
        !          1025:        }
        !          1026:        if (ioctl(fileno(stdin), TIOCSETC, (char *)tc) == -1) {
        !          1027:                perror("ioctl");
        !          1028:                adios(NULLCP, "ioctl failed");
        !          1029:        }
        !          1030:        if (ioctl(fileno(stdin), TIOCSETP, (char *)&sb) == -1) {
        !          1031:                perror("ioctl");
        !          1032:                adios(NULLCP, "ioctl failed");
        !          1033:        }
        !          1034:        if (ioctl(fileno(stdin), FIONBIO, (char*)&onoff) == -1) {
        !          1035:                perror("ioctl");
        !          1036:                adios(NULLCP, "ioctl failed");
        !          1037:        }
        !          1038:        if (ioctl(fileno(stdout), FIONBIO, (char*)&onoff) == -1) {
        !          1039:                perror("ioctl");
        !          1040:                adios(NULLCP, "ioctl failed");
        !          1041:        }
        !          1042:        return (old);
        !          1043: }
        !          1044: #endif
        !          1045: 
        !          1046: kill_proc()    /*Terminate current UNIX process using UNIX interrupt char*/
        !          1047: {
        !          1048: #ifdef BSD44
        !          1049:        struct termios term;
        !          1050: 
        !          1051:        if (tcgetattr(pty, &term) == -1)
        !          1052:                perror("tcgetattr");
        !          1053:        else if (term.c_cc[VINTR] != _POSIX_VDISABLE)
        !          1054:                (void) putch(term.c_cc[VINTR]);
        !          1055: #else
        !          1056:        if(ioctl(pty,TIOCGETC,(char *)&otc) == -1)
        !          1057:        {
        !          1058:                perror("ioctl");
        !          1059:                adios(NULLCP, "ioctl failed");
        !          1060:        }
        !          1061:        (void) putch(otc.t_intrc);
        !          1062: #endif
        !          1063: }
        !          1064: 
        !          1065: def_echo(coptr)        /*Handle Default Profile Echo Ctrl Object*/
        !          1066: CO_UPDATE *coptr;
        !          1067: {
        !          1068: 
        !          1069:        char active = 0;
        !          1070: 
        !          1071:        if(coptr->co_cmd.bool_update.mask_count == 0) active = 0xff;
        !          1072:        else active = *coptr->co_cmd.bool_update.mask;
        !          1073: 
        !          1074:        if (active & ECHO_OBJ) {
        !          1075:            if(*coptr->co_cmd.bool_update.value & ECHO_OBJ)
        !          1076:                /*True means do local echo*/
        !          1077:                (void) tmode(2);
        !          1078:            else
        !          1079:                (void) tmode(1);
        !          1080:        }
        !          1081: } 
        !          1082: #ifdef BSD44
        !          1083: static realptyecho(on)
        !          1084: {
        !          1085:        struct termios term;
        !          1086: 
        !          1087:        if (tcgetattr(pty, &term) == -1) {
        !          1088:                perror("tcgetattr");
        !          1089:                return;
        !          1090:        }
        !          1091:        if (on)
        !          1092:                term.c_lflag |= ECHO;
        !          1093:        else
        !          1094:                term.c_lflag &= ECHO;
        !          1095:        if (tcsetattr(pty, TCSAFLUSH, &term) == -1) {
        !          1096:                perror("tcsetattr");
        !          1097:                return;
        !          1098:        }
        !          1099: }
        !          1100: #endif

unix.superglobalmegacorp.com

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