From 5405311157e29df5062bdecc045f71e40fb8ccbe Mon Sep 17 00:00:00 2001 From: "Steffen (Daode) Nurpmeso" Date: Wed, 20 Apr 2016 15:50:12 +0200 Subject: [PATCH] Add n_is_all_or_aster() --- auxlily.c | 10 ++++++++++ nailfuns.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/auxlily.c b/auxlily.c index ee92e731..2b76af5c 100644 --- a/auxlily.c +++ b/auxlily.c @@ -1713,6 +1713,16 @@ quadify(char const *inbuf, uiz_t inlen, char const *prompt, si8_t emptyrv) return rv; } +FL bool_t +n_is_all_or_aster(char const *name){ + bool_t rv; + NYD_ENTER; + + rv = ((name[0] == '*' && name[1] == '\0') || !asccasecmp(name, "all")); + NYD_LEAVE; + return rv; +} + FL time_t n_time_epoch(void) { diff --git a/nailfuns.h b/nailfuns.h index 49269ec4..5b641ce9 100644 --- a/nailfuns.h +++ b/nailfuns.h @@ -412,6 +412,9 @@ FL si8_t boolify(char const *inbuf, uiz_t inlen, si8_t emptyrv); FL si8_t quadify(char const *inbuf, uiz_t inlen, char const *prompt, si8_t emptyrv); +/* Is the argument "all" (case-insensitive) or "*" */ +FL bool_t n_is_all_or_aster(char const *name); + /* Get seconds since epoch */ FL time_t n_time_epoch(void); -- 2.11.4.GIT