aboutsummaryrefslogtreecommitdiff
path: root/src/commands.c
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2022-02-27 16:53:22 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2022-02-27 16:53:22 +0100
commit7de88d1bcd420447023b8e74b0aa4f5e8ba1df6b (patch)
tree71458dbc99241c9d56744508996d68099bf01936 /src/commands.c
parent48cd8b6b1779f34ba0507cb697492de83c4e9da8 (diff)
downloadnissy-7de88d1bcd420447023b8e74b0aa4f5e8ba1df6b.tar.gz
nissy-7de88d1bcd420447023b8e74b0aa4f5e8ba1df6b.zip
Removed array-size constants for certain objects (steps, commands...)
Diffstat (limited to 'src/commands.c')
-rw-r--r--src/commands.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/commands.c b/src/commands.c
index b397878..03eded0 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -150,7 +150,7 @@ version_cmd = {
150 .exec = version_exec, 150 .exec = version_exec,
151}; 151};
152 152
153Command *commands[NCOMMANDS] = { 153Command *commands[] = {
154 &commands_cmd, 154 &commands_cmd,
155 &gen_cmd, 155 &gen_cmd,
156 &help_cmd, 156 &help_cmd,
@@ -164,6 +164,7 @@ Command *commands[NCOMMANDS] = {
164 &cleanup_cmd, 164 &cleanup_cmd,
165 &unniss_cmd, 165 &unniss_cmd,
166 &version_cmd, 166 &version_cmd,
167 NULL
167}; 168};
168 169
169/* Other constants ***********************************************************/ 170/* Other constants ***********************************************************/
@@ -336,9 +337,8 @@ help_parse_args(int c, char **v)
336 CommandArgs *a = new_args(); 337 CommandArgs *a = new_args();
337 338
338 if (c == 1) { 339 if (c == 1) {
339 for (i = 0; i < NCOMMANDS; i++) 340 for (i = 0; commands[i] != NULL; i++)
340 if (commands[i] != NULL && 341 if (!strcmp(v[0], commands[i]->name))
341 !strcmp(v[0], commands[i]->name))
342 a->command = commands[i]; 342 a->command = commands[i];
343 if (a->command == NULL) 343 if (a->command == NULL)
344 fprintf(stderr, "%s: command not found\n", v[0]); 344 fprintf(stderr, "%s: command not found\n", v[0]);
@@ -473,7 +473,7 @@ gen_exec(CommandArgs *args)
473 init_symcoord(); 473 init_symcoord();
474 474
475 fprintf(stderr, "Generating pruning tables...\n"); 475 fprintf(stderr, "Generating pruning tables...\n");
476 for (i = 0; i < NPTABLES && allpd[i] != NULL; i++) 476 for (i = 0; allpd[i] != NULL; i++)
477 genptable(allpd[i], args->opts->nthreads); 477 genptable(allpd[i], args->opts->nthreads);
478 478
479 fprintf(stderr, "Done!\n"); 479 fprintf(stderr, "Done!\n");
@@ -495,7 +495,7 @@ steps_exec(CommandArgs *args)
495{ 495{
496 int i; 496 int i;
497 497
498 for (i = 0; i < NSTEPS && steps[i] != NULL; i++) 498 for (i = 0; steps[i] != NULL; i++)
499 printf("%-15s %s\n", steps[i]->shortname, steps[i]->name); 499 printf("%-15s %s\n", steps[i]->shortname, steps[i]->name);
500} 500}
501 501
@@ -504,7 +504,7 @@ commands_exec(CommandArgs *args)
504{ 504{
505 int i; 505 int i;
506 506
507 for (i = 0; i < NCOMMANDS && commands[i] != NULL; i++) 507 for (i = 0; commands[i] != NULL; i++)
508 printf("%s\n", commands[i]->usage); 508 printf("%s\n", commands[i]->usage);
509 509
510} 510}
@@ -642,8 +642,8 @@ read_step(CommandArgs *args, char *str)
642{ 642{
643 int i; 643 int i;
644 644
645 for (i = 0; i < NSTEPS; i++) { 645 for (i = 0; steps[i] != NULL; i++) {
646 if (steps[i] != NULL && !strcmp(steps[i]->shortname, str)) { 646 if (!strcmp(steps[i]->shortname, str)) {
647 args->step = steps[i]; 647 args->step = steps[i];
648 return true; 648 return true;
649 } 649 }

Generated with cgit - Back to sebastiano.tronto.net