check number of arguments

This commit is contained in:
silverweed 2024-07-19 21:02:27 +02:00
parent 83ad84491f
commit 930ce52ba1
4 changed files with 6 additions and 4 deletions

View file

@ -8,7 +8,7 @@ Size=1152,1414
[Window][main] [Window][main]
Pos=0,0 Pos=0,0
Size=1211,806 Size=1282,1414
[Window][Hex View] [Window][Hex View]
Pos=91,62 Pos=91,62

View file

@ -22,8 +22,10 @@ bool os_open_and_map_file(const char *fname, App_State &app)
size_t fsize = file_size(file); size_t fsize = file_size(file);
void *fmem = mmap(0, fsize, PROT_READ, MAP_SHARED_VALIDATE, fd, 0); void *fmem = mmap(0, fsize, PROT_READ, MAP_SHARED_VALIDATE, fd, 0);
if (!fmem) if (!fmem) {
fprintf(stderr, "Failed to open file %s\n", fname); fprintf(stderr, "Failed to open file %s\n", fname);
return false;
}
app.inspected_file.name = str8(fname); app.inspected_file.name = str8(fname);
app.inspected_file.stream = file; app.inspected_file.stream = file;

View file

@ -155,7 +155,7 @@ void make_viewer(App_State &app)
COL(col_page_start, 200, 0, 200); COL(col_page_start, 200, 0, 200);
COL(col_checksum, 134, 65, 25); COL(col_checksum, 134, 65, 25);
COL(col_page_list, 60, 110, 120); COL(col_page_list, 60, 110, 120);
COL(col_highlight, 160, 160, 160); COL(col_highlight, 190, 190, 190);
#undef COL #undef COL
app.viewer = viewer; app.viewer = viewer;

View file

@ -82,7 +82,7 @@ int main(int argc, char **argv)
tctx_init(tctx); tctx_init(tctx);
defer { tctx_release(); }; defer { tctx_release(); };
if (argc > 1 && argv[1][0] == '-') { if ((argc > 1 && argv[1][0] == '-') || argc < 3) {
fprintf(stderr, "Usage: %s <ntuple_name> <ntuple_file.root>\n", argv[0]); fprintf(stderr, "Usage: %s <ntuple_name> <ntuple_file.root>\n", argv[0]);
return 1; return 1;
} }