soap

simple xdg-open replacement with fallback
git clone git://git.2f30.org/soap
Log | Files | Refs | LICENSE

commit a7a897397007e9efff5525ba3da49dbab2c0cd17
parent 2f9dea655486ecc8396284e22192a48a81180566
Author: Svyatoslav Mishyn <juef@openmailbox.org>
Date:   Wed, 10 Aug 2016 08:41:42 +0300

stop if invalid regexp was found

Diffstat:
Msoap.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/soap.c b/soap.c @@ -39,8 +39,11 @@ main(int argc, char *argv[]){ /* check regex and launch action if it matches argv[1] */ for (i=0; i < sizeof(pairs)/sizeof(*pairs); ++i) { - if (regcomp(&regex, pairs[i].regex, REG_EXTENDED | REG_NOSUB)) + if (regcomp(&regex, pairs[i].regex, + REG_EXTENDED | REG_NOSUB)) { fprintf(stderr, "invalid regex: %s\n", pairs[i].regex); + return EXIT_FAILURE; + } if (!regexec(&regex, argv[1], 0, NULL, 0)) { snprintf(cmd, sizeof cmd, pairs[i].action, sharg); system(cmd);