summaryrefslogtreecommitdiffstats
path: root/env.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-07-23 18:36:04 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-07-23 18:36:04 +0200
commitf290bdc333b01dbc5f695236e0b72db1ac2a67d5 (patch)
tree7e7ee8e7ec7405ff4a1e0b6d24e59d4844abe6b7 /env.c
parent3402c81500eecc678c7369ca94067c8d99e22bea (diff)
downloadipecamera-f290bdc333b01dbc5f695236e0b72db1ac2a67d5.tar.gz
ipecamera-f290bdc333b01dbc5f695236e0b72db1ac2a67d5.tar.bz2
ipecamera-f290bdc333b01dbc5f695236e0b72db1ac2a67d5.tar.xz
ipecamera-f290bdc333b01dbc5f695236e0b72db1ac2a67d5.zip
Support for new CMOSIS 20MPix camera
Diffstat (limited to 'env.c')
-rw-r--r--env.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/env.c b/env.c
new file mode 100644
index 0000000..fa75408
--- /dev/null
+++ b/env.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "env.h"
+
+
+static const char *env_cache[IPECAMERA_MAX_ENV] = {0};
+
+const char *ipecamera_getenv(ipecamera_env_t env, const char *var) {
+ if (!env_cache[env]) {
+ const char *var_env = getenv(var);
+ env_cache[env] = var_env?var_env:(void*)-1;
+ return var_env;
+ }
+
+ return (env_cache[env] == (void*)-1)?NULL:env_cache[env];
+}
+