Annotation of researchv10no/cmd/vsw/line.c, revision 1.1.1.1

1.1       root        1: #include       <libc.h>
                      2: #include       <string.h>
                      3: #include       "crossbar.h"
                      4: #include       "switch.h"
                      5: 
                      6: extern int verbose;
                      7: 
                      8: Line::Line(char lab, char *n1, char *n2, Crossbar *cb, int l)
                      9: {
                     10:        name[0] = n1;
                     11:        name[1] = n2;
                     12:        c = cb;
                     13:        line = l;
                     14:        label = lab;
                     15: }
                     16: 
                     17: int
                     18: Line::pr(int label, char *buf, int len)
                     19: {
                     20:        int n;
                     21: 
                     22:        if(this == 0){
                     23:                for(n = 0; n < len; n++)
                     24:                        buf[n] = ' ';
                     25:                buf[n] = 0;
                     26:                return(n);
                     27:        }
                     28:        sprint(buf, "%c: %s", inttolabel(label), name[verbose]);
                     29:        if((n = strlen(buf)) >= len)
                     30:                return(n);
                     31:        while(n < len)
                     32:                buf[n++] = ' ';
                     33:        buf[n] = 0;
                     34:        return(n);
                     35: }

unix.superglobalmegacorp.com

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