fixes negative seek error
This commit is contained in:
parent
f4ab18171a
commit
ec3a1d44d4
@ -30,7 +30,7 @@ struct flags {
|
|||||||
bool littleendian;
|
bool littleendian;
|
||||||
|
|
||||||
uint offset;
|
uint offset;
|
||||||
uint seek;
|
int seek;
|
||||||
|
|
||||||
uint octets; // number of octets per line (default 2) // done
|
uint octets; // number of octets per line (default 2) // done
|
||||||
bool customoctets;
|
bool customoctets;
|
||||||
|
@ -134,7 +134,8 @@ static void do_text_parse(hex_chunk_t** lines, bool interactive)
|
|||||||
fprintf(stderr, "xxd: Sorry, cannot seek.\n");
|
fprintf(stderr, "xxd: Sorry, cannot seek.\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
seek = (strlen(file_content) - flags.seek);
|
seek = (strlen(file_content) - (flags.seek * -1));
|
||||||
|
flags.offset += seek;
|
||||||
}
|
}
|
||||||
|
|
||||||
filesize = (flags.len == -1) ? strlen(file_content + seek) : flags.len;
|
filesize = (flags.len == -1) ? strlen(file_content + seek) : flags.len;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user