diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cmds/pe_cmd_strings.c | 15 | ||||
-rw-r--r-- | src/driver/pe_amain.c | 4 | ||||
-rw-r--r-- | src/driver/pe_driver_ctx.c | 11 | ||||
-rw-r--r-- | src/internal/perk_driver_impl.h | 1 | ||||
-rw-r--r-- | src/internal/perk_synopsis_impl.h | 8 | ||||
-rw-r--r-- | src/skin/pe_skin_default.c | 2 | ||||
-rw-r--r-- | src/skin/pe_skin_strings.c | 13 |
7 files changed, 53 insertions, 1 deletions
diff --git a/src/cmds/pe_cmd_strings.c b/src/cmds/pe_cmd_strings.c new file mode 100644 index 0000000..b4ccf68 --- /dev/null +++ b/src/cmds/pe_cmd_strings.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_strings(const struct pe_driver_ctx * dctx, const char * path) +{ + (void)dctx; + (void)path; + return 0; +} diff --git a/src/driver/pe_amain.c b/src/driver/pe_amain.c index 9d016be..63cec52 100644 --- a/src/driver/pe_amain.c +++ b/src/driver/pe_amain.c @@ -113,6 +113,10 @@ int pe_main(char ** argv, char ** envp, const struct pe_fd_ctx * fdctx) pe_cmd_common(dctx,pe_cmd_ranlib); break; + case PERK_CMD_STRINGS: + pe_cmd_common(dctx,pe_cmd_strings); + break; + case PERK_CMD_AR: arflags = dctx->cctx->drvflags; diff --git a/src/driver/pe_driver_ctx.c b/src/driver/pe_driver_ctx.c index 8e652af..955484a 100644 --- a/src/driver/pe_driver_ctx.c +++ b/src/driver/pe_driver_ctx.c @@ -33,6 +33,7 @@ static const char * const perk_cmd_name[PERK_CMD_CAP] = { [PERK_CMD_SIZE] = "size", [PERK_CMD_STRIP] = "strip", [PERK_CMD_RANLIB] = "ranlib", + [PERK_CMD_STRINGS] = "strings", }; /* perk command options */ @@ -44,6 +45,7 @@ static const struct argv_option * perk_cmd_options[PERK_CMD_CAP] = { [PERK_CMD_SIZE] = pe_size_options, [PERK_CMD_STRIP] = pe_strip_options, [PERK_CMD_RANLIB] = pe_ranlib_options, + [PERK_CMD_STRINGS] = pe_strings_options, }; /* default fd context */ @@ -131,6 +133,12 @@ static int pe_driver_usage( cmdname,cmdname); break; + case PERK_CMD_STRINGS: + snprintf(header,sizeof(header), + PERK_STRINGS_CMD_SYNOPSIS, + cmdname,cmdname); + break; + case PERK_CMD_PERK: snprintf(header,sizeof(header), PERK_PERK_CMD_SYNOPSIS, @@ -530,6 +538,9 @@ int pe_lib_get_driver_ctx( } else if (cctx.cmd == PERK_CMD_RANLIB) { argv_optv_init(pe_ranlib_options,optv); + + } else if (cctx.cmd == PERK_CMD_STRINGS) { + argv_optv_init(pe_strings_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 b1062ac..db0ffc7 100644 --- a/src/internal/perk_driver_impl.h +++ b/src/internal/perk_driver_impl.h @@ -19,6 +19,7 @@ extern const struct argv_option pe_nm_options[]; extern const struct argv_option pe_size_options[]; extern const struct argv_option pe_strip_options[]; extern const struct argv_option pe_ranlib_options[]; +extern const struct argv_option pe_strings_options[]; enum app_tags { TAG_HELP, diff --git a/src/internal/perk_synopsis_impl.h b/src/internal/perk_synopsis_impl.h index b41098c..1c53f52 100644 --- a/src/internal/perk_synopsis_impl.h +++ b/src/internal/perk_synopsis_impl.h @@ -65,6 +65,14 @@ +#define PERK_STRINGS_CMD_SYNOPSIS \ + "%s — PE/COFF String Finder\n\n" \ + "Synopsis:\n" \ + " %s [-V] [-a] [-t format] [-n number] <file> ...\n\n" \ + "Options:\n" + + + #define PERK_AR_CMD_SYNOPSIS \ "%s — the PE/COFF Archive Manipulator\n\n" \ "Synopsis:\n" \ diff --git a/src/skin/pe_skin_default.c b/src/skin/pe_skin_default.c index c44ce7c..85c420c 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|strip|ranlib",0, + "perk|ar|nm|size|strip|ranlib|strings",0, "invoke one of the following perk commands: {%s}"}, {0,0,0,0,0,0,0,0} diff --git a/src/skin/pe_skin_strings.c b/src/skin/pe_skin_strings.c new file mode 100644 index 0000000..3a1e69d --- /dev/null +++ b/src/skin/pe_skin_strings.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_strings_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} +}; |