noice

small file browser
git clone git://git.2f30.org/noice.git
Log | Files | Refs | README | LICENSE

commit 3655cafcf4641e99d3098a148f453bc61f1426bd
parent 3ed67ea6cf3345639449ab24bb1eb996f9d43392
Author: sin <sin@2f30.org>
Date:   Fri, 23 Aug 2019 16:23:40 +0100

Reflect nopen(1) errors in exit status

If there is an error executing the rule, exit with a status of 1.

Diffstat:
Mnopen.c | 12++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/nopen.c b/nopen.c @@ -22,7 +22,7 @@ struct rule { char *argv0; -void +int run(struct rule *rule, char *arg) { char *argv[NR_ARGS]; @@ -36,7 +36,7 @@ run(struct rule *rule, char *arg) argv[i] = rule->argv[i]; } argv[i] = NULL; - spawnvp(NULL, rule->file, argv); + return spawnvp(NULL, rule->file, argv); } struct rule * @@ -79,6 +79,8 @@ usage(void) int main(int argc, char *argv[]) { + int r; + ARGBEGIN { default: usage(); @@ -87,13 +89,15 @@ main(int argc, char *argv[]) if (argc == 0) usage(); + r = 0; parserules(); for (; *argv != NULL; argv++) { struct rule *rule; if ((rule = matchrule(argv[0])) == NULL) continue; - run(rule, argv[0]); + if (run(rule, argv[0]) == -1) + r = 1; } - return 0; + return r; }