summaryrefslogtreecommitdiffhomepage
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2025-06-18 19:37:12 +0000
committermidipix <writeonce@midipix.org>2025-06-18 19:37:12 +0000
commitd0914542311cc7f8d14bb2113d802ae24a344eab (patch)
tree138906e96da116795cab6683f25532bb7373146e /src/driver
parent809efcf90a58ad29f496f0caf14c0ddf72b214e7 (diff)
downloadperk-d0914542311cc7f8d14bb2113d802ae24a344eab.tar.bz2
perk-d0914542311cc7f8d14bb2113d802ae24a344eab.tar.xz
driver: pe_cmd_from_program(): refactor (utilize the tool program name table).
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/pe_driver_ctx.c20
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(