|
|
1.1 root 1: #include <libc.h>
2: #include "worm.h"
3: #include <sys/types.h>
4: #include <sys/udaioc.h>
5:
6: main(argc, argv)
7: char **argv;
8: {
9: Superblock s;
10: char *vol_id = 0;
11: char buf[1024];
12: char *dev = "/dev/worm0";
13: int c;
14: extern char *optarg;
15: extern int optind;
16:
17: while((c = getopt(argc, argv, "f:")) != -1)
18: switch(c)
19: {
20: case 'f': dev = optarg; break;
21: case '?': usage();
22: }
23: if(optind != argc)
24: usage();
25: dev = mapdev(dev);
26: if((s.fd = open(dev, 2)) < 0){
27: if(!vol_id)
28: perror(dev);
29: exit(2);
30: }
31: /* have to read to make ioctl work */
32: lseek(s.fd, 1024L, 0);
33: read(s.fd, buf, sizeof buf);
34: if(ioctl(s.fd, UIOSPDW) < 0){
35: perror("ioctl");
36: exit(2);
37: }
38: exit(0);
39: }
40:
41: usage()
42: {
43: print("Usage: worm offline [-fdevice]\n");
44: exit(2);
45: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.