diff options
author | midipix <writeonce@midipix.org> | 2025-06-03 15:14:15 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2025-06-03 23:03:18 +0000 |
commit | d1d41c22c8042f6ed152f44d0e6a9e2a27dbeb99 (patch) | |
tree | 76a109b747e1216c84ea5ed29675ae10d79d3632 /src | |
parent | 663098e8be251c89181cc56503d7fb7ab2e8c1c5 (diff) | |
download | perk-d1d41c22c8042f6ed152f44d0e6a9e2a27dbeb99.tar.bz2 perk-d1d41c22c8042f6ed152f44d0e6a9e2a27dbeb99.tar.xz |
driver: pe_main(): support historic usage (first option/action without a dash).
Diffstat (limited to 'src')
-rw-r--r-- | src/driver/pe_driver_ctx.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/driver/pe_driver_ctx.c b/src/driver/pe_driver_ctx.c index 8214f86..77a51d9 100644 --- a/src/driver/pe_driver_ctx.c +++ b/src/driver/pe_driver_ctx.c @@ -337,6 +337,7 @@ int pe_lib_get_driver_ctx( char ** pargcap; char ** cmdargv; char * cmdmark; + char stckarg[64]; struct argv_ctx actx = {ARGV_VERBOSITY_NONE, ARGV_MODE_SCAN, 0,0,0,0,0,0,0,0}; @@ -366,6 +367,17 @@ int pe_lib_get_driver_ctx( program,0, optv,0,0,cctx.cmd); + /* historic ar usage (vector will be cloned, so stack var is fine) */ + if (cctx.cmd == PERK_CMD_AR) { + if (argv && argv[0] && argv[1] && (argv[1][0] != '-')) { + if (strlen(argv[1]) < (sizeof(stckarg) - 1)) { + stckarg[0] = '-'; + strcpy(&stckarg[1],argv[1]); + argv[1] = stckarg; + } + } + } + /* initial argv scan: ... --cmd=xxx ... */ argv_scan(argv,optv,&actx,0); |