summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/arbits/output/slbt_ar_output_symbols.c18
-rw-r--r--src/internal/slibtool_driver_impl.h1
-rw-r--r--src/logic/slbt_exec_ar.c4
-rw-r--r--src/skin/slbt_skin_ar.c5
4 files changed, 26 insertions, 2 deletions
diff --git a/src/arbits/output/slbt_ar_output_symbols.c b/src/arbits/output/slbt_ar_output_symbols.c
index b709755..cfd0be8 100644
--- a/src/arbits/output/slbt_ar_output_symbols.c
+++ b/src/arbits/output/slbt_ar_output_symbols.c
@@ -6,6 +6,7 @@
#include <time.h>
#include <locale.h>
+#include <regex.h>
#include <inttypes.h>
#include <slibtool/slibtool.h>
#include <slibtool/slibtool_output.h>
@@ -24,13 +25,26 @@ static int slbt_ar_output_symbols_posix(
const struct slbt_fd_ctx * fdctx)
{
int fdout;
+ const char * regex;
const char ** symv;
+ regex_t regctx;
+ regmatch_t pmatch[2] = {0};
fdout = fdctx->fdout;
+ if ((regex = dctx->cctx->regex))
+ if (regcomp(&regctx,regex,REG_NEWLINE))
+ return SLBT_CUSTOM_ERROR(
+ dctx,
+ SLBT_ERR_FLOW_ERROR);
+
for (symv=mctx->symstrv; *symv; symv++)
- if (slbt_dprintf(fdout,"%s\n",*symv) < 0)
- return SLBT_SYSTEM_ERROR(dctx,0);
+ if (!regex || !regexec(&regctx,*symv,1,pmatch,0))
+ if (slbt_dprintf(fdout,"%s\n",*symv) < 0)
+ return SLBT_SYSTEM_ERROR(dctx,0);
+
+ if (regex)
+ regfree(&regctx);
return 0;
}
diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h
index 17cb290..848aa94 100644
--- a/src/internal/slibtool_driver_impl.h
+++ b/src/internal/slibtool_driver_impl.h
@@ -89,6 +89,7 @@ enum app_tags {
TAG_AR_VERSION,
TAG_AR_CHECK,
TAG_AR_PRINT,
+ TAG_AR_REGEX,
TAG_AR_PRETTY,
TAG_AR_POSIX,
TAG_AR_YAML,
diff --git a/src/logic/slbt_exec_ar.c b/src/logic/slbt_exec_ar.c
index c808421..8f6016f 100644
--- a/src/logic/slbt_exec_ar.c
+++ b/src/logic/slbt_exec_ar.c
@@ -235,6 +235,10 @@ int slbt_exec_ar(
break;
+ case TAG_AR_REGEX:
+ ictx->cctx.regex = entry->arg;
+ break;
+
case TAG_AR_PRETTY:
if (!strcmp(entry->arg,"yaml")) {
ictx->cctx.fmtflags &= ~(uint64_t)SLBT_PRETTY_FLAGS;
diff --git a/src/skin/slbt_skin_ar.c b/src/skin/slbt_skin_ar.c
index a02372b..58059aa 100644
--- a/src/skin/slbt_skin_ar.c
+++ b/src/skin/slbt_skin_ar.c
@@ -36,6 +36,11 @@ const struct argv_option slbt_ar_options[] = {
"print out information pertaining to each archive file "
"and its various internal elements"},
+ {"Wregex", 0,TAG_AR_REGEX,ARGV_OPTARG_REQUIRED,
+ ARGV_OPTION_HYBRID_ONLY|ARGV_OPTION_HYBRID_SPACE,
+ 0,"<regexp>",
+ "filter armap symbols using the specified %s."},
+
{"Wpretty", 0,TAG_AR_PRETTY,ARGV_OPTARG_REQUIRED,
ARGV_OPTION_HYBRID_EQUAL,
"posix|yaml|hexdata",0,