diff options
author | midipix <writeonce@midipix.org> | 2025-06-18 19:37:12 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2025-06-18 19:37:12 +0000 |
commit | d0914542311cc7f8d14bb2113d802ae24a344eab (patch) | |
tree | 138906e96da116795cab6683f25532bb7373146e /src | |
parent | 809efcf90a58ad29f496f0caf14c0ddf72b214e7 (diff) | |
download | perk-d0914542311cc7f8d14bb2113d802ae24a344eab.tar.bz2 perk-d0914542311cc7f8d14bb2113d802ae24a344eab.tar.xz |
driver: pe_cmd_from_program(): refactor (utilize the tool program name table).
Diffstat (limited to 'src')
-rw-r--r-- | src/driver/pe_driver_ctx.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/driver/pe_driver_ctx.c b/src/driver/pe_driver_ctx.c index a806083..b99ee7f 100644 --- a/src/driver/pe_driver_ctx.c +++ b/src/driver/pe_driver_ctx.c @@ -175,6 +175,7 @@ static int pe_cmd_from_program(const char * program) const char * dot; const char * hyphen; const char * mark; + enum pe_cmd cmd; dot = strrchr(program,'.'); hyphen = strrchr(program,'-'); @@ -186,21 +187,12 @@ static int pe_cmd_from_program(const char * program) else mark = program; - if (!strcmp(mark,"perk")) { - return PERK_CMD_PERK; + for (cmd=0; cmd<PERK_CMD_CAP; cmd++) + if (perk_cmd_name[cmd]) + if (!strcmp(mark,perk_cmd_name[cmd])) + return cmd; - } else if (!strcmp(mark,"ar")) { - return PERK_CMD_AR; - - } else if (!strcmp(mark,"nm")) { - return PERK_CMD_NM; - - } else if (!strcmp(mark,"size")) { - return PERK_CMD_SIZE; - - } else { - return PERK_CMD_DEFAULT; - } + return PERK_CMD_DEFAULT; } static int pe_cctx_update( |