From d1d41c22c8042f6ed152f44d0e6a9e2a27dbeb99 Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 3 Jun 2025 15:14:15 +0000 Subject: driver: pe_main(): support historic usage (first option/action without a dash). --- src/driver/pe_driver_ctx.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/driver/pe_driver_ctx.c') 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); -- cgit v1.2.3