|
|
1.1 ! root 1: #include <stdio.h> ! 2: #include "jukebox.h" ! 3: #include "hdr.h" ! 4: ! 5: main(int argc, char *argv[]) ! 6: { ! 7: int c; ! 8: int err = 0, cold = 0, warm = 0; ! 9: char *toload = 0, *uload = 0; ! 10: char *drive = 0; ! 11: char buf[256]; ! 12: extern int optind; ! 13: extern char *optarg; ! 14: ! 15: setbuf(stdout, (char *)0); /* turn off buffering */ ! 16: /* gather options */ ! 17: while ((c = getopt(argc,argv,"cn:l:wu:")) != -1) ! 18: switch (c) ! 19: { ! 20: case 'l': toload = optarg; break; ! 21: case 'c': cold = 1; break; ! 22: case 'w': warm = 1; break; ! 23: case 'u': uload = optarg ; break; ! 24: case 'n': drive = optarg ; break; ! 25: default: err = 1; break; ! 26: } ! 27: if(err) ! 28: exit(1); ! 29: /* now actually do some work */ ! 30: if (toload){ ! 31: if (j_load(toload, buf, 30)) ! 32: printf("load %s failed: %s\n", toload, buf); ! 33: else ! 34: printf("loaded %s on %s\n", toload, buf); ! 35: } ! 36: if(drive){ ! 37: if(j_volid(atoi(drive), buf)) ! 38: printf("j_volid(%s) failed: %s\n", drive, buf); ! 39: else ! 40: printf("%s is mounted on drive %d\n", buf, atoi(drive)); ! 41: } ! 42: if(cold){ ! 43: printf("invent cold: %d\n", cold); ! 44: cold_inventory(30, buf); ! 45: ! 46: } ! 47: if (warm) { ! 48: printf("invent warm: %d\n", warm); ! 49: warm_inventory(buf); ! 50: ! 51: } ! 52: ! 53: ! 54: if (uload){ ! 55: if (j_unload(uload, buf)) ! 56: printf("unload %s failed: %s\n", uload, buf); ! 57: else ! 58: printf("unloaded %s from %s\n", uload, buf); ! 59: ! 60: ! 61: } ! 62: exit(0); ! 63: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.