diff options
-rw-r--r-- | include/perk/perk.h | 1 | ||||
-rw-r--r-- | project/common.mk | 2 | ||||
-rw-r--r-- | project/extras.mk | 4 | ||||
-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 |
9 files changed, 62 insertions, 1 deletions
diff --git a/include/perk/perk.h b/include/perk/perk.h index 6952b1b..5d02d98 100644 --- a/include/perk/perk.h +++ b/include/perk/perk.h @@ -303,6 +303,7 @@ perk_api int pe_lib_set_driver_fdctx (struct pe_driver_ctx *, const s perk_api int pe_cmd_perk (const struct pe_driver_ctx *, const char *); perk_api int pe_cmd_nm (const struct pe_driver_ctx *, const char *); perk_api int pe_cmd_size (const struct pe_driver_ctx *, const char *); +perk_api int pe_cmd_strip (const struct pe_driver_ctx *, const char *); perk_api int pe_cmd_ar (const struct pe_driver_ctx *, uint64_t, const char *, const char *, const char **); diff --git a/project/common.mk b/project/common.mk index 50583dc..4b9bc5a 100644 --- a/project/common.mk +++ b/project/common.mk @@ -10,6 +10,7 @@ API_SRCS = \ src/cmds/pe_cmd_nm.c \ src/cmds/pe_cmd_perk.c \ src/cmds/pe_cmd_size.c \ + src/cmds/pe_cmd_strip.c \ src/crc/pe_crc32.c \ src/crc/pe_crc64.c \ src/driver/pe_amain.c \ @@ -52,6 +53,7 @@ API_SRCS = \ src/skin/pe_skin_nm.c \ src/skin/pe_skin_perk.c \ src/skin/pe_skin_size.c \ + src/skin/pe_skin_strip.c \ INTERNAL_SRCS = \ src/internal/$(PACKAGE)_dprintf_impl.c \ diff --git a/project/extras.mk b/project/extras.mk index 41eb35d..0c67394 100644 --- a/project/extras.mk +++ b/project/extras.mk @@ -21,3 +21,7 @@ install-app-extras: rm -f bin/$(NICKNAME)-size$(OS_APP_SUFFIX).tmp ln -s ./$(NICKNAME)$(OS_APP_SUFFIX) bin/$(NICKNAME)-size$(OS_APP_SUFFIX).tmp mv bin/$(NICKNAME)-size$(OS_APP_SUFFIX).tmp $(DESTDIR)$(BINDIR)/$(NICKNAME)-size$(OS_APP_SUFFIX) + + rm -f bin/$(NICKNAME)-strip$(OS_APP_SUFFIX).tmp + ln -s ./$(NICKNAME)$(OS_APP_SUFFIX) bin/$(NICKNAME)-strip$(OS_APP_SUFFIX).tmp + mv bin/$(NICKNAME)-strip$(OS_APP_SUFFIX).tmp $(DESTDIR)$(BINDIR)/$(NICKNAME)-strip$(OS_APP_SUFFIX) 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} +}; |