comparison util.c @ 773:13d3744b170e

Merge
author Michael Pavone <pavone@retrodev.com>
date Sat, 18 Jul 2015 10:42:15 -0700
parents 2f48a3c187c6 2a25ea5d94f7
children 724bbec47f86 bce97fc0bb8a
comparison
equal deleted inserted replaced
772:1b82b282b829 773:13d3744b170e
148 char * get_exe_dir() 148 char * get_exe_dir()
149 { 149 {
150 static char * exe_dir; 150 static char * exe_dir;
151 if (!exe_dir) { 151 if (!exe_dir) {
152 char * cur; 152 char * cur;
153 #ifndef HAS_PROC 153 #ifdef HAS_PROC
154 char * linktext = readlink_alloc("/proc/self/exe"); 154 char * linktext = readlink_alloc("/proc/self/exe");
155 if (!linktext) { 155 if (!linktext) {
156 goto fallback; 156 goto fallback;
157 } 157 }
158 int linksize = strlen(linktext); 158 int linksize = strlen(linktext);
178 memcpy(exe_dir, exe_str, cur-exe_str); 178 memcpy(exe_dir, exe_str, cur-exe_str);
179 exe_dir[cur-exe_str] = 0; 179 exe_dir[cur-exe_str] = 0;
180 break; 180 break;
181 } 181 }
182 } 182 }
183 #ifndef HAS_PROC 183 #ifdef HAS_PROC
184 } else { 184 } else {
185 exe_dir = linktext; 185 exe_dir = linktext;
186 } 186 }
187 #endif 187 #endif
188 } 188 }