summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2014-04-01 19:43:58 -0700
committerMichael Pavone <pavone@retrodev.com>2014-04-01 19:43:58 -0700
commitc51f057715587f133abe9bfb32d6d453a7af698b (patch)
treef35a343e06ab8ad3ad4652a97878d0b62402a6d0 /config.c
parent4d15ffc63362410563a49481faf9652c138945ac (diff)
Initial work on Windows port
Diffstat (limited to 'config.c')
-rw-r--r--config.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/config.c b/config.c
index d1efc87..b9adf6f 100644
--- a/config.c
+++ b/config.c
@@ -11,6 +11,27 @@
#define MAX_NEST 30 //way more than I'll ever need
+#ifdef _WIN32
+char * strtok_r(char * input, char * sep, char ** state)
+{
+ if (input) {
+ *state = input;
+ }
+ char * ret = *state;
+ while (**state && **state != *sep)
+ {
+ ++*state;
+ }
+ if (**state)
+ {
+ **state = 0;
+ ++*state;
+ return ret;
+ }
+ return NULL;
+}
+#endif
+
tern_node * parse_config(char * config_data)
{
char *state, *curline;
@@ -100,6 +121,9 @@ open_fail:
tern_node * load_config()
{
+#ifdef _WIN32
+ tern_node * ret = parse_config_file("default.cfg");
+#else
char * exe_dir;
char * home = getenv("HOME");
if (!home) {
@@ -119,6 +143,7 @@ load_in_app_dir:
path = alloc_concat(exe_dir, "/default.cfg");
ret = parse_config_file(path);
free(path);
+#endif
success:
if (ret) {
return ret;