Annotation of coherent/b/kernel/tools/vio.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * vio.c
                      3:  *
                      4:  * Usage:  vio a1 a2 a3
                      5:  *
                      6:  */
                      7: #include <stdio.h>
                      8: #include <sys/param.h>
                      9: 
                     10: char * cmd;
                     11: 
                     12: main(argc, argv)
                     13: int argc;
                     14: char ** argv;
                     15: {
                     16:        int a1, a2, a3, res;
                     17:        extern int errno;
                     18: 
                     19:        cmd = argv[0];
                     20:        if (argc != 4)
                     21:                usage();
                     22: 
                     23:        a1 = htoi(argv[1]);
                     24:        a2 = htoi(argv[2]);
                     25:        a3 = htoi(argv[3]);
                     26: 
                     27:        res = cohcall(COH_VIO, a1, a2, a3);
                     28:        if (errno)
                     29:                perror("vio");
                     30:        else
                     31:                printf("%s(%x, %x, %x) = %x\n", cmd, a1, a2, a3, res);
                     32: }
                     33: 
                     34: usage()
                     35: {
                     36:        fprintf(stderr, "Usage: %s a1 a2 a3\n", cmd);
                     37:        exit(1);
                     38: }
                     39: 
                     40: int
                     41: htoi(s)
                     42: char *s;
                     43: {
                     44:        int ret;
                     45: 
                     46:        sscanf(s, "%x", &ret);
                     47:        return ret;
                     48: }

unix.superglobalmegacorp.com

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