diff options
author | midipix <writeonce@midipix.org> | 2025-06-19 05:49:27 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2025-06-19 05:49:27 +0000 |
commit | 339b39c87643eaf20adf0a1c3755906d52408754 (patch) | |
tree | b4da15805b224243f5df7e0446fefb4ac926170b /src | |
parent | d0914542311cc7f8d14bb2113d802ae24a344eab (diff) | |
download | perk-339b39c87643eaf20adf0a1c3755906d52408754.tar.bz2 perk-339b39c87643eaf20adf0a1c3755906d52408754.tar.xz |
driver: added --cmd=strip support, pe_cmd_strip() stub, and perk-strip symlink.
Diffstat (limited to 'src')
-rw-r--r-- | src/cmds/pe_cmd_strip.c | 15 | ||||
-rw-r--r-- | src/driver/pe_driver_ctx.c | 12 | ||||
-rw-r--r-- | src/internal/perk_driver_impl.h | 1 | ||||
-rw-r--r-- | src/internal/perk_synopsis_impl.h | 13 | ||||
-rw-r--r-- | src/skin/pe_skin_default.c | 2 | ||||
-rw-r--r-- | src/skin/pe_skin_strip.c | 13 |
6 files changed, 55 insertions, 1 deletions
diff --git a/src/cmds/pe_cmd_strip.c b/src/cmds/pe_cmd_strip.c new file mode 100644 index 0000000..10e70d4 --- /dev/null +++ b/src/cmds/pe_cmd_strip.c @@ -0,0 +1,15 @@ +/***************************************************************/ +/* perk: PE Resource Kit */ +/* Copyright (C) 2015--2025 SysDeer Technologies, LLC */ +/* Released under GPLv2 and GPLv3; see COPYING.PERK. */ +/***************************************************************/ + +#include <perk/perk.h> +#include "perk_driver_impl.h" + +int pe_cmd_strip(const struct pe_driver_ctx * dctx, const char * path) +{ + (void)dctx; + (void)path; + return 0; +} diff --git a/src/driver/pe_driver_ctx.c b/src/driver/pe_driver_ctx.c index b99ee7f..43dc0b3 100644 --- a/src/driver/pe_driver_ctx.c +++ b/src/driver/pe_driver_ctx.c @@ -31,6 +31,7 @@ static const char * const perk_cmd_name[PERK_CMD_CAP] = { [PERK_CMD_AR] = "ar", [PERK_CMD_NM] = "nm", [PERK_CMD_SIZE] = "size", + [PERK_CMD_STRIP] = "strip", }; /* perk command options */ @@ -40,6 +41,7 @@ static const struct argv_option * perk_cmd_options[PERK_CMD_CAP] = { [PERK_CMD_AR] = pe_ar_options, [PERK_CMD_NM] = pe_nm_options, [PERK_CMD_SIZE] = pe_size_options, + [PERK_CMD_STRIP] = pe_strip_options, }; /* default fd context */ @@ -114,6 +116,13 @@ static int pe_driver_usage( cmdname,cmdname); break; + case PERK_CMD_STRIP: + snprintf(header,sizeof(header), + PERK_STRIP_CMD_SYNOPSIS, + cmdname,cmdname,cmdname,cmdname, + cmdname,cmdname,cmdname); + break; + case PERK_CMD_PERK: snprintf(header,sizeof(header), PERK_PERK_CMD_SYNOPSIS, @@ -507,6 +516,9 @@ int pe_lib_get_driver_ctx( } else if (cctx.cmd == PERK_CMD_SIZE) { argv_optv_init(pe_size_options,optv); + + } else if (cctx.cmd == PERK_CMD_STRIP) { + argv_optv_init(pe_strip_options,optv); } /* process the selected tool's command-line arguments */ diff --git a/src/internal/perk_driver_impl.h b/src/internal/perk_driver_impl.h index 453a032..44115c7 100644 --- a/src/internal/perk_driver_impl.h +++ b/src/internal/perk_driver_impl.h @@ -17,6 +17,7 @@ extern const struct argv_option pe_perk_options[]; extern const struct argv_option pe_ar_options[]; extern const struct argv_option pe_nm_options[]; extern const struct argv_option pe_size_options[]; +extern const struct argv_option pe_strip_options[]; enum app_tags { TAG_HELP, diff --git a/src/internal/perk_synopsis_impl.h b/src/internal/perk_synopsis_impl.h index 921a1db..2806881 100644 --- a/src/internal/perk_synopsis_impl.h +++ b/src/internal/perk_synopsis_impl.h @@ -44,6 +44,19 @@ +#define PERK_STRIP_CMD_SYNOPSIS \ + "%s — PE/COFF Fluff Removal Utility\n\n" \ + "Synopsis:\n" \ + " %s [-V] [-v] [-p] [-o output] <file> \n" \ + " %s [-X] [-x] <file> ... \n" \ + " %s [-s] [-g|-d|-S] <file> ... \n" \ + " %s [-w] [-R secname] ... <file> ... \n" \ + " %s [-w] [-K symname] ... <file> ... \n" \ + " %s [-w] [-N symname] ... <file> ... \n\n" \ + "Options:\n" + + + #define PERK_AR_CMD_SYNOPSIS \ "%s — the PE/COFF Resource Kit Archiver\n\n" \ "Synopsis:\n" \ diff --git a/src/skin/pe_skin_default.c b/src/skin/pe_skin_default.c index 5e1ec12..9c8f0a3 100644 --- a/src/skin/pe_skin_default.c +++ b/src/skin/pe_skin_default.c @@ -10,7 +10,7 @@ const perk_hidden struct argv_option pe_default_options[] = { "show usage information [listing %s options only]"}, {"cmd", 0,TAG_CMD,ARGV_OPTARG_REQUIRED,0, - "perk|ar|nm|size",0, + "perk|ar|nm|size|strip",0, "invoke one of the following perk commands: {%s}"}, {0,0,0,0,0,0,0,0} diff --git a/src/skin/pe_skin_strip.c b/src/skin/pe_skin_strip.c new file mode 100644 index 0000000..d225f12 --- /dev/null +++ b/src/skin/pe_skin_strip.c @@ -0,0 +1,13 @@ +#include "perk_driver_impl.h" +#include "perk_visibility_impl.h" +#include "argv/argv.h" + +const perk_hidden struct argv_option pe_strip_options[] = { + {"version", 'V',TAG_VERSION,ARGV_OPTARG_NONE,0,0,0, + "show version information"}, + + {"help", 'h',TAG_HELP,ARGV_OPTARG_OPTIONAL,0,"short|long",0, + "show usage information [listing %s options only]"}, + + {0,0,0,0,0,0,0,0} +}; |