Annotation of xinu/sys/shell/x_dg.c, revision 1.1.1.1

1.1       root        1: /* x_dg.c - x_dg */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: #include <network.h>
                      6: 
                      7: /*------------------------------------------------------------------------
                      8:  *  x_dg  -  (command dg) print info for currently open datagram devices
                      9:  *------------------------------------------------------------------------
                     10:  */
                     11: COMMAND        x_dg(stdin, stdout, stderr, nargs, args)
                     12: int    stdin, stdout, stderr, nargs;
                     13: char   *args[];
                     14: {
                     15:        struct  dgblk   *dgptr;
                     16:        char    str[80];
                     17:        int     i;
                     18: 
                     19:        for (i=0 ; i<Ndg ; i++) {
                     20:                dgptr = &dgtab[i];
                     21:                if (dgptr->dg_state == DG_FREE)
                     22:                        continue;
                     23:                sprintf(str, "Dev=%2d: lport=%4d, fport=%4d, ",
                     24:                        dgptr->dg_dnum, dgptr->dg_lport, dgptr->dg_fport);
                     25: 
                     26:                sprintf(&str[strlen(str)],
                     27:                        "mode=%03o, xport=%2d addr=%d.%d.%d.%d\n",
                     28:                                dgptr->dg_mode, dgptr->dg_xport,
                     29:                                dgptr->dg_faddr[0] &0377,
                     30:                                dgptr->dg_faddr[1] &0377,
                     31:                                dgptr->dg_faddr[2] &0377,
                     32:                                dgptr->dg_faddr[3] &0377);
                     33:                write(stdout, str, strlen(str));
                     34:        }
                     35:        return(OK);
                     36: }

unix.superglobalmegacorp.com

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