- seek_blocks = strtoul(argv[2], 0, 0);
- blocks = strtoul(argv[3], 0, 0);
+ if (!strcmp(argv[1], "read"))
+ action = O_RDONLY;
+ else if (!strcmp(argv[1], "write"))
+ action = O_WRONLY;
+ else if (!strcmp(argv[1], "rdwr"))
+ action = O_RDWR;
+ else if (!strcmp(argv[1], "readhole")) {
+ action = O_RDONLY;
+ pad = 0;
+ } else {
+ printf("Usage: %s <read/write/rdwr> file seek nr_blocks [blocksize]\n", argv[0]);
+ return 1;
+ }
+
+ fname = argv[2];
+ seek_blocks = strtoul(argv[3], 0, 0);
+ blocks = strtoul(argv[4], 0, 0);
+ if (!blocks) {
+ printf("Usage: %s <read/write/rdwr> file seek nr_blocks [blocksize]\n", argv[0]);
+ return 1;
+ }