Mercurial > projects > ldc
comparison dmd/inifile.c @ 990:2137797748a8
oups, seems like I broke some constness in D1 last commit, compiles again!
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Thu, 26 Feb 2009 14:23:18 +0100 |
parents | 2667e3a145be |
children |
comparison
equal
deleted
inserted
replaced
989:420ef073448d | 990:2137797748a8 |
---|---|
48 */ | 48 */ |
49 | 49 |
50 void inifile(char *argv0, const char *inifile) | 50 void inifile(char *argv0, const char *inifile) |
51 { | 51 { |
52 char *path; // need path for @P macro | 52 char *path; // need path for @P macro |
53 char *filename; | 53 const char *filename; |
54 OutBuffer buf; | 54 OutBuffer buf; |
55 int i; | 55 int i; |
56 int k; | 56 int k; |
57 int envsection = 0; | 57 int envsection = 0; |
58 | 58 |
78 else | 78 else |
79 { | 79 { |
80 filename = FileName::combine(getenv("HOME"), inifile); | 80 filename = FileName::combine(getenv("HOME"), inifile); |
81 if (!FileName::exists(filename)) | 81 if (!FileName::exists(filename)) |
82 { | 82 { |
83 filename = FileName::replaceName(argv0, inifile); | 83 filename = FileName::replaceName(argv0, (char*)inifile); |
84 if (!FileName::exists(filename)) | 84 if (!FileName::exists(filename)) |
85 { | 85 { |
86 #if POSIX | 86 #if POSIX |
87 | 87 |
88 #if 0 | 88 #if 0 |
110 const char *p = getenv("PATH"); | 110 const char *p = getenv("PATH"); |
111 Array *paths = FileName::splitPath(p); | 111 Array *paths = FileName::splitPath(p); |
112 filename = FileName::searchPath(paths, argv0, 0); | 112 filename = FileName::searchPath(paths, argv0, 0); |
113 if (!filename) | 113 if (!filename) |
114 goto Letc; // argv0 not found on path | 114 goto Letc; // argv0 not found on path |
115 filename = FileName::replaceName(filename, inifile); | 115 filename = FileName::replaceName((char*)filename, (char*)inifile); |
116 if (FileName::exists(filename)) | 116 if (FileName::exists(filename)) |
117 goto Ldone; | 117 goto Ldone; |
118 #endif | 118 #endif |
119 | 119 |
120 // Search /etc/ for inifile | 120 // Search /etc/ for inifile |
130 path = FileName::path(filename); | 130 path = FileName::path(filename); |
131 #if LOG | 131 #if LOG |
132 printf("\tpath = '%s', filename = '%s'\n", path, filename); | 132 printf("\tpath = '%s', filename = '%s'\n", path, filename); |
133 #endif | 133 #endif |
134 | 134 |
135 File file(filename); | 135 File file((char*)filename); |
136 | 136 |
137 if (file.read()) | 137 if (file.read()) |
138 return; // error reading file | 138 return; // error reading file |
139 | 139 |
140 // Parse into lines | 140 // Parse into lines |