annotate config.c @ 495:39cad98d2789

Allow OpenGL support to be disabled at compile time. Move generic utility functions out of config.c
author Mike Pavone <pavone@retrodev.com>
date Mon, 28 Oct 2013 19:37:30 -0700
parents 140af5509ce7
children 6fc71114d145
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
467
140af5509ce7 Added copyright notice to source files and added GPL license text in COPYING
Mike Pavone <pavone@retrodev.com>
parents: 431
diff changeset
1 /*
140af5509ce7 Added copyright notice to source files and added GPL license text in COPYING
Mike Pavone <pavone@retrodev.com>
parents: 431
diff changeset
2 Copyright 2013 Michael Pavone
495
39cad98d2789 Allow OpenGL support to be disabled at compile time. Move generic utility functions out of config.c
Mike Pavone <pavone@retrodev.com>
parents: 467
diff changeset
3 This file is part of BlastEm.
467
140af5509ce7 Added copyright notice to source files and added GPL license text in COPYING
Mike Pavone <pavone@retrodev.com>
parents: 431
diff changeset
4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
140af5509ce7 Added copyright notice to source files and added GPL license text in COPYING
Mike Pavone <pavone@retrodev.com>
parents: 431
diff changeset
5 */
430
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
6 #include "tern.h"
495
39cad98d2789 Allow OpenGL support to be disabled at compile time. Move generic utility functions out of config.c
Mike Pavone <pavone@retrodev.com>
parents: 467
diff changeset
7 #include "util.h"
430
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
8 #include <stdio.h>
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
9 #include <stdlib.h>
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
10 #include <string.h>
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
11
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
12 #include <sys/types.h>
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
13 #include <sys/stat.h>
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
14 #include <unistd.h>
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
15
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
16 #define MAX_NEST 30 //way more than I'll ever need
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
17
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
18 tern_node * parse_config(char * config_data)
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
19 {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
20 char *state, *curline;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
21 char *prefix = NULL;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
22 int nest_level = 0;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
23 char * prefix_parts[MAX_NEST];
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
24 int line = 1;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
25 tern_node * head = NULL;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
26 while ((curline = strtok_r(config_data, "\n", &state)))
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
27 {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
28 config_data = NULL;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
29 curline = strip_ws(curline);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
30 int len = strlen(curline);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
31 if (!len) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
32 continue;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
33 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
34 if (curline[0] == '#') {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
35 continue;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
36 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
37 if (curline[0] == '}') {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
38 if (!nest_level) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
39 fprintf(stderr, "unexpected } on line %d\n", line);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
40 exit(1);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
41 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
42 if (prefix) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
43 free(prefix);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
44 prefix = NULL;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
45 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
46 nest_level--;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
47 curline = strip_ws(curline+1);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
48 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
49 char * end = curline + len - 1;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
50 if (*end == '{') {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
51 *end = 0;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
52 curline = strip_ws(curline);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
53 prefix_parts[nest_level++] = curline;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
54 if (prefix) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
55 free(prefix);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
56 prefix = NULL;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
57 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
58 } else {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
59 if (nest_level && !prefix) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
60 prefix = alloc_concat_m(nest_level, prefix_parts);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
61 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
62 char * val = strip_ws(split_keyval(curline));
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
63 char * key = curline;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
64 if (*key) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
65 if (prefix) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
66 key = alloc_concat(prefix, key);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
67 }
431
440efd7d27a9 Read key bindings from config file
Mike Pavone <pavone@retrodev.com>
parents: 430
diff changeset
68 head = tern_insert_ptr(head, key, strdup(val));
430
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
69 if (prefix) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
70 free(key);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
71 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
72 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
73 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
74 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
75 if (prefix) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
76 free(prefix);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
77 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
78 return head;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
79 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
80
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
81 tern_node * parse_config_file(char * config_path)
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
82 {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
83 tern_node * ret = NULL;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
84 FILE * config_file = fopen(config_path, "r");
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
85 if (!config_file) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
86 goto open_fail;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
87 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
88 long config_size = file_size(config_file);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
89 if (!config_size) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
90 goto config_empty;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
91 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
92 char * config_data = malloc(config_size);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
93 if (fread(config_data, 1, config_size, config_file) != config_size) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
94 goto config_read_fail;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
95 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
96 ret = parse_config(config_data);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
97 config_read_fail:
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
98 free(config_data);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
99 config_empty:
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
100 fclose(config_file);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
101 open_fail:
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
102 return ret;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
103 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
104
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
105 char * readlink_alloc(char * path)
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
106 {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
107 char * linktext = NULL;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
108 ssize_t linksize = 512;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
109 ssize_t cursize = 0;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
110 do {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
111 if (linksize > cursize) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
112 cursize = linksize;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
113 if (linktext) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
114 free(linktext);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
115 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
116 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
117 linktext = malloc(cursize);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
118 linksize = readlink(path, linktext, cursize-1);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
119 if (linksize == -1) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
120 perror("readlink");
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
121 free(linktext);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
122 linktext = NULL;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
123 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
124 } while (linksize > cursize);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
125 return linktext;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
126 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
127
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
128 tern_node * load_config(char * expath)
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
129 {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
130 char * linktext;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
131 char * home = getenv("HOME");
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
132 if (!home) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
133 goto load_in_app_dir;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
134 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
135 char * path = alloc_concat(home, "/.config/blastem/blastem.cfg");
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
136 tern_node * ret = parse_config_file(path);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
137 if (ret) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
138 goto success;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
139 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
140 free(path);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
141 load_in_app_dir:
495
39cad98d2789 Allow OpenGL support to be disabled at compile time. Move generic utility functions out of config.c
Mike Pavone <pavone@retrodev.com>
parents: 467
diff changeset
142
430
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
143 linktext = readlink_alloc("/proc/self/exe");
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
144 if (!linktext) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
145 goto link_prob;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
146 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
147 char * cur;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
148 int linksize = strlen(linktext);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
149 for(cur = linktext + linksize - 1; cur != linktext; cur--)
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
150 {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
151 if (*cur == '/') {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
152 *cur = 0;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
153 break;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
154 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
155 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
156 if (cur == linktext) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
157 goto link_prob;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
158 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
159 path = alloc_concat(linktext, "/default.cfg");
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
160 ret = parse_config_file(path);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
161 success:
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
162 return ret;
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
163 link_prob:
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
164 if (linktext) {
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
165 free(linktext);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
166 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
167 no_proc:
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
168 //TODO: Fall back to using expath if /proc is not available
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
169 fputs("Failed to find a config file in ~/.config/blastem/blastem.cfg or in the blastem executable directory\n", stderr);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
170 exit(1);
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
171 }
7f84090ab1cd Add config file parser and default config file
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
172