- const char *inFile = NULL;
- const char *outFile = NULL;
- char *cp;
- int inFd;
- int outFd;
- int inCc = 0;
- int outCc;
- size_t blockSize = 512;
- //uintmax_t skipBlocks = 0;
- uintmax_t count = (uintmax_t)-1;
- uintmax_t intotal;
- uintmax_t outTotal;
- unsigned char *buf;
-
- argc--;
- argv++;
-
- /* Parse any options */
- while (argc) {
- if (inFile == NULL && (strncmp(*argv, "if", 2) == 0))
- inFile=((strchr(*argv, '='))+1);
- else if (outFile == NULL && (strncmp(*argv, "of", 2) == 0))
- outFile=((strchr(*argv, '='))+1);
- else if (strncmp("count", *argv, 5) == 0) {
- count = getNum ((strchr(*argv, '='))+1);
- if (count <= 0) {
- fprintf (stderr, "Bad count value %s\n", *argv);
- goto usage;
- }
- }
- else if (strncmp(*argv, "bs", 2) == 0) {
- blockSize = getNum ((strchr(*argv, '='))+1);
- if (blockSize <= 0) {
- fprintf (stderr, "Bad block size value %s\n", *argv);
- goto usage;
- }
+ const char *inFile = NULL;
+ const char *outFile = NULL;
+ char *cp;
+ int inFd;
+ int outFd;
+ int inCc = 0;
+ int outCc;
+ long blockSize = 512;
+ uintmax_t skipBlocks = 0;
+ uintmax_t seekBlocks = 0;
+ uintmax_t count = (uintmax_t) - 1;
+ uintmax_t intotal;
+ uintmax_t outTotal;
+ unsigned char *buf;
+
+ argc--;
+ argv++;
+
+ /* Parse any options */
+ while (argc) {
+ if (inFile == NULL && (strncmp(*argv, "if", 2) == 0))
+ inFile = ((strchr(*argv, '=')) + 1);
+ else if (outFile == NULL && (strncmp(*argv, "of", 2) == 0))
+ outFile = ((strchr(*argv, '=')) + 1);
+ else if (strncmp("count", *argv, 5) == 0) {
+ count = getNum((strchr(*argv, '=')) + 1);
+ if (count <= 0) {
+ fprintf(stderr, "Bad count value %s\n", *argv);
+ goto usage;
+ }
+ } else if (strncmp(*argv, "bs", 2) == 0) {
+ blockSize = getNum((strchr(*argv, '=')) + 1);
+ if (blockSize <= 0) {
+ fprintf(stderr, "Bad block size value %s\n", *argv);
+ goto usage;
+ }
+ } else if (strncmp(*argv, "skip", 4) == 0) {
+ skipBlocks = getNum((strchr(*argv, '=')) + 1);
+ if (skipBlocks <= 0) {
+ fprintf(stderr, "Bad skip value %s\n", *argv);
+ goto usage;
+ }
+
+ } else if (strncmp(*argv, "seek", 4) == 0) {
+ seekBlocks = getNum((strchr(*argv, '=')) + 1);
+ if (seekBlocks <= 0) {
+ fprintf(stderr, "Bad seek value %s\n", *argv);
+ goto usage;
+ }
+
+ } else {
+ goto usage;
+ }
+ argc--;
+ argv++;