Annotation of cci/usr/src/usr.bin/bsc/cmd/3270/emperrs.c, revision 1.1

1.1     ! root        1: /*     D.L.Buck and Associates, Inc. - 8/27/84
        !             2:  *
        !             3:  *     COPYRIGHT NOTICE:
        !             4:  *             Copyright c 8/27/84 - An unpublished work by
        !             5:  *             D.L.Buck and Associates, Inc.
        !             6:  *
        !             7:  *     PROPRIETARY RIGHTS NOTICE:
        !             8:  *             All rights reserved. This document and program contains
        !             9:  *             proprietary information of D.L.Buck and Associates,Inc.
        !            10:  *             of San Jose, California, U.S.A., embodying confidential
        !            11:  *             information,  ideas, and expressions,  no part of which
        !            12:  *             may be reproduced, or transmitted in any form or by any
        !            13:  *             means,  electronic,  mechanical,  or otherwise, without
        !            14:  *             the written permission of D.L.Buck and Associates, Inc.
        !            15:  *
        !            16:  * NAME
        !            17:  *     get_errors
        !            18:  *
        !            19:  * SYNOPSIS
        !            20:  *     get_errors()
        !            21:  *
        !            22:  * DESCRIPTION
        !            23:  *     get_errors - deal with transmit/receive errors - called from em3280
        !            24:  * RETURNS:
        !            25:  *     1 for `nasty' errors, 0 for `tame' errors
        !            26:  */
        !            27: 
        !            28: #include <stdio.h>
        !            29: #include "local.h"
        !            30: #include <bsc/bscio.h>
        !            31: #include <errno.h>
        !            32: #include <empr.h>
        !            33: 
        !            34: char *bsc_errlist[] = {
        !            35:        "Internal error 0",
        !            36:        "Protocol error by remote host ",
        !            37:        "RVI abort ",
        !            38:        "NBID limit exceeded ",
        !            39:        "NNAK limit exceeded ",
        !            40:        "NRETRY limit exceeded ",
        !            41:        "NTTD limit exceeded ",
        !            42:        "NWACK limit exceeded ",
        !            43:        "No DSR indication from modem ",
        !            44:        "Transmit timeout ",
        !            45:        "Idle receive timeout ",
        !            46:        "Remote end sent DISC (DLE-EOT) ",
        !            47:        "Remote end aborted our sending ",
        !            48:        "Remote end aborted their sending ",
        !            49:        "Wrong host id ",
        !            50:        "Block received in transparent mode (not an error) ",
        !            51:        "Block began with SOH (not an error) ",
        !            52:        "Line contention (not an error) "
        !            53: };
        !            54: 
        !            55: extern struct bscio p;
        !            56: extern int devfd;
        !            57: extern int errno;
        !            58: extern char *sys_errlist[];
        !            59: extern char devname[];
        !            60: extern char note[];
        !            61: #ifndef lint
        !            62: static char sccsid[] = "@(#)emperrs.c  1.4 ";
        !            63: #endif
        !            64: 
        !            65: get_errors()
        !            66: {
        !            67: 
        !            68: /* check errno for system error */
        !            69:        if (errno == EINTR || errno == EINVAL)
        !            70:                return 1;
        !            71:        if (errno == EAGAIN)
        !            72:                return 0;
        !            73:        if (errno && errno != EIO) {
        !            74:                sprintf(note,"System error: %s",sys_errlist[errno]);
        !            75:                fprintf(stderr,"%s\n",note);
        !            76:                write_aud("E",note);
        !            77:                return 1;
        !            78:        }
        !            79:        /* do ioctl to get b_flags */
        !            80:        ioctl(devfd,BSCGET,&p);
        !            81: 
        !            82:        switch(p.b_flags)       {
        !            83:        case BSCPROTO:
        !            84:        case BSCRVI:
        !            85:        case BSCNBID:
        !            86:        case BSCNNAK:
        !            87:        case BSCNRETR:
        !            88:        case BSCNTTD:
        !            89:        case BSCNWACK:
        !            90:        case BSCNDSR:
        !            91:        case BSCTXTO:
        !            92:        case BSCDSC:
        !            93:                sprintf(note,"Comm.check: %s",bsc_errlist[p.b_flags]);
        !            94:                fprintf(stderr,"%s\n",note);
        !            95:                write_aud("E",note);
        !            96:                return 1;
        !            97: 
        !            98:        case BSCRXTO:
        !            99:        case BSCRABT:
        !           100:        case BSCEEOF:
        !           101:        case BSCWHI:
        !           102:        case BSCTXP:
        !           103:        case BSCBSOH:
        !           104:        case BSCONTND:
        !           105:        default:
        !           106:                return 0;
        !           107:        }
        !           108: }

unix.superglobalmegacorp.com

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