summaryrefslogtreecommitdiff
path: root/src/bin/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/util.c')
-rw-r--r--src/bin/util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/bin/util.c b/src/bin/util.c
new file mode 100644
index 0000000..c8218fd
--- /dev/null
+++ b/src/bin/util.c
@@ -0,0 +1,17 @@
+#include "aplwc_repl.h"
+
+unsigned long
+getenv_ulong(const char *name, unsigned long def)
+{
+ unsigned long ret, parsed;
+ char *env, *p;
+
+ ret = def;
+ env = getenv(name);
+ if((env != NULL) && (strlen(env) > 0)){
+ parsed = strtoul(env, &p, 10);
+ if((*p) == 0)
+ ret = parsed;
+ }
+ return ret;
+}