summaryrefslogtreecommitdiffhomepage
path: root/src/arbits
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-02-17 05:21:44 +0000
committermidipix <writeonce@midipix.org>2024-02-17 05:21:44 +0000
commit76c5e99d92cd0e4bf6ac8fe6067ecb8e5c2b017f (patch)
tree63774bc86d45e3900827064c1b9e1f7dad217096 /src/arbits
parent1f1fa38ff06275a65e024ad66548b16a645b298c (diff)
downloadslibtool-76c5e99d92cd0e4bf6ac8fe6067ecb8e5c2b017f.tar.bz2
slibtool-76c5e99d92cd0e4bf6ac8fe6067ecb8e5c2b017f.tar.xz
ar mode: utility: armap symbol printing: added the -Wregex switch.
Diffstat (limited to 'src/arbits')
-rw-r--r--src/arbits/output/slbt_ar_output_symbols.c18
1 files changed, 16 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;
}