diff options
| author | Nguyễn Gia Phong <cnx@loang.net> | 2025-10-17 07:41:10 +0900 |
|---|---|---|
| committer | Nguyễn Gia Phong <cnx@loang.net> | 2025-10-17 07:41:10 +0900 |
| commit | 3a2e8fd0b06ebb738d9d4677659249e05b09e7cb (patch) | |
| tree | 46e7ab24161958d60fb980dd1e28096c0fb28dd6 /patch.c | |
| parent | 663ea12374e958fa83ac7e1b439dd6ab22bb59ed (diff) | |
| download | taosc-3a2e8fd0b06ebb738d9d4677659249e05b09e7cb.tar.gz | |
Give up fancy things 0.0.3.dev1
Diffstat (limited to 'patch.c')
| -rw-r--r-- | patch.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/patch.c b/patch.c index eacf2b1..027142b 100644 --- a/patch.c +++ b/patch.c @@ -20,32 +20,32 @@ #include "stdlib.c" -const char *taosc_predicate; -const void *taosc_destination; +static const void *destination; +static const char *predicate; /* * Get an environment variable and parse as a number. * Return 0 on error. */ -uint64_t getenvull(const char *name) +static uint64_t getenvull(const char *name) { - const char *const s = getenv(name); - if (s == NULL) + const char *const str = getenv(name); + if (str == NULL) return 0ULL; errno = 0; - const uint64_t u = strtoull(s, NULL, 0); + const uint64_t ull = strtoull(str, NULL, 0); if (errno) return 0ULL; - return u; + return ull; } void init(int argc, const char *const *argv, char **envp) { environ = envp; - taosc_predicate = getenv("TAOSC_PREDICATE"); - if (taosc_predicate == NULL) - taosc_predicate = "p0"; /* false */ - taosc_destination = (void *) getenvull("TAOSC_DESTINATION"); + destination = (void *) getenvull("TAOSC_DEST"); + predicate = getenv("TAOSC_PRED"); + if (predicate == NULL) + predicate = "p0"; /* false */ } /* Parse *p as an integer. */ @@ -97,6 +97,6 @@ int64_t eval(const char **ptr, const int64_t *env) const void *dest(const struct STATE *state) { - const char *tmp = taosc_predicate; - return eval(&tmp, (const int64_t *) state) ? NULL : taosc_destination; + const char *tmp = predicate; + return eval(&tmp, (const int64_t *) state) ? NULL : destination; } |
