adds offset flag
This commit is contained in:
parent
4b00322be0
commit
74bedb5e3a
@ -16,6 +16,8 @@ void init_flags(struct flags* flags)
|
||||
flags->customcols = false;
|
||||
flags->coloured = true;
|
||||
|
||||
flags->offset = 0;
|
||||
|
||||
flags->octets = 2;
|
||||
flags->len = -1; // -1 means til EOF
|
||||
flags->uppercase = false;
|
||||
@ -154,7 +156,7 @@ static void c_output(char** text, FILE* stream)
|
||||
void display_hex_chunk(hex_chunk_t* chunk, FILE* stream)
|
||||
{
|
||||
if (!flags.postscript && !flags.c_style)
|
||||
write_offset(chunk->line * flags.cols, stream);
|
||||
write_offset((chunk->line * flags.cols) + flags.offset, stream);
|
||||
|
||||
if (flags.c_style)
|
||||
c_output(&(chunk->hex), stream);
|
||||
|
@ -26,6 +26,8 @@ struct flags {
|
||||
|
||||
uint cols; // choose the amount of columns to display (default 16) // done
|
||||
bool customcols;
|
||||
|
||||
uint offset;
|
||||
|
||||
uint octets; // number of octets per line (default 2) // done
|
||||
int len; // max len to stop at //done
|
||||
|
@ -22,6 +22,7 @@ static struct argp_option options[] = {
|
||||
{0, 'i', 0, 0, "output in C include file style.", 0},
|
||||
{0, 'C', 0, 0, "capitalize variable names in C include file style (-i).", 0},
|
||||
{0, 'n', "name", 0, "set the variable name used in C include output (-i).", 0},
|
||||
{0, 'o', "off", 0, "add <off> to the displayed file position.", 0},
|
||||
{0}
|
||||
};
|
||||
|
||||
@ -42,6 +43,9 @@ static error_t parse_opt(int key, char* arg, struct argp_state* state)
|
||||
case 'g':
|
||||
flags->octets = atoi(arg);
|
||||
break;
|
||||
case 'o':
|
||||
flags->offset = atoi(arg);
|
||||
break;
|
||||
case 'R':
|
||||
if (strcmp(arg, "none") == 0)
|
||||
flags->coloured = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user