Annotation of xinu/sys/shell/x_routes.c, revision 1.1

1.1     ! root        1: /* x_routes.c - x_routes */
        !             2: 
        !             3: #include <conf.h>
        !             4: #include <kernel.h>
        !             5: #include <proc.h>
        !             6: #include <network.h>
        !             7: 
        !             8: LOCAL  char    st[] = "F?GD";
        !             9: 
        !            10: /*------------------------------------------------------------------------
        !            11:  *  x_routes  -  (command routes) format and print routing cache entries
        !            12:  *------------------------------------------------------------------------
        !            13:  */
        !            14: COMMAND        x_routes(stdin, stdout, stderr, nargs, args)
        !            15: int    stdin, stdout, stderr, nargs;
        !            16: char   *args[];
        !            17: {
        !            18:        int     arindex;
        !            19:        char    str[80];
        !            20:        struct  arpent  *atabptr;
        !            21: 
        !            22:        if (nargs > 1) {
        !            23:                Arp.atabsiz = Arp.atabnxt = 0;
        !            24:                return(OK);
        !            25:        }
        !            26:        sprintf(str, "Routing cache: size=%d, next=%d\n",
        !            27:                Arp.atabsiz, Arp.atabnxt);
        !            28:        write(stdout, str, strlen(str));
        !            29:        for (arindex=0; arindex<Arp.atabsiz; arindex++) {
        !            30:                atabptr = &Arp.arptab[arindex];
        !            31:                if (atabptr->arp_state == AR_FREE)
        !            32:                        continue;
        !            33:                sprintf(str, " %2d. Route=%c, Dev=%2d",
        !            34:                        arindex,st[atabptr->arp_state],atabptr->arp_dev);
        !            35:                sprintf(&str[strlen(str)],
        !            36:                        " IPaddr=%03d.%03d.%03d.%03d, ",
        !            37:                                atabptr->arp_Iad[0] & 0377,
        !            38:                                atabptr->arp_Iad[1] & 0377,
        !            39:                                atabptr->arp_Iad[2] & 0377,
        !            40:                                atabptr->arp_Iad[3] & 0377);
        !            41:                sprintf(&str[strlen(str)],
        !            42:                        "Ether addr=%02x%02x.%02x%02x.%02x%02x\n",
        !            43:                                atabptr->arp_Ead[0]&0377,
        !            44:                                atabptr->arp_Ead[1]&0377,
        !            45:                                atabptr->arp_Ead[2]&0377,
        !            46:                                atabptr->arp_Ead[3]&0377,
        !            47:                                atabptr->arp_Ead[4]&0377,
        !            48:                                atabptr->arp_Ead[5]&0377 );
        !            49:                write(stdout, str, strlen(str));
        !            50:        }
        !            51:        return(OK);
        !            52: }

unix.superglobalmegacorp.com

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