aboutsummaryrefslogtreecommitdiff
path: root/scripts/basic/split-include.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/basic/split-include.c')
-rw-r--r--scripts/basic/split-include.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/scripts/basic/split-include.c b/scripts/basic/split-include.c
index 6ef29195e..a85ede8ef 100644
--- a/scripts/basic/split-include.c
+++ b/scripts/basic/split-include.c
@@ -39,8 +39,6 @@
39 exit(1); \ 39 exit(1); \
40 } 40 }
41 41
42
43
44int main(int argc, const char * argv []) 42int main(int argc, const char * argv [])
45{ 43{
46 const char * str_my_name; 44 const char * str_my_name;
@@ -89,7 +87,11 @@ int main(int argc, const char * argv [])
89 /* Make output directory if needed. */ 87 /* Make output directory if needed. */
90 if (stat(str_dir_config, &stat_buf) != 0) 88 if (stat(str_dir_config, &stat_buf) != 0)
91 { 89 {
90#ifdef __MINGW32__
91 if (mkdir(str_dir_config) != 0)
92#else
92 if (mkdir(str_dir_config, 0755) != 0) 93 if (mkdir(str_dir_config, 0755) != 0)
94#endif
93 ERROR_EXIT(str_dir_config); 95 ERROR_EXIT(str_dir_config);
94 } 96 }
95 97
@@ -149,7 +151,12 @@ int main(int argc, const char * argv [])
149 { 151 {
150 ptarget[islash] = '\0'; 152 ptarget[islash] = '\0';
151 if (stat(ptarget, &stat_buf) != 0 153 if (stat(ptarget, &stat_buf) != 0
152 && mkdir(ptarget, 0755) != 0) 154#ifdef __MINGW32__
155 && mkdir(ptarget) != 0
156#else
157 && mkdir(ptarget, 0755) != 0
158#endif
159 )
153 ERROR_EXIT( ptarget ); 160 ERROR_EXIT( ptarget );
154 ptarget[islash] = '/'; 161 ptarget[islash] = '/';
155 } 162 }
@@ -190,13 +197,21 @@ int main(int argc, const char * argv [])
190 * So by having an initial \n, strstr will find exact matches. 197 * So by having an initial \n, strstr will find exact matches.
191 */ 198 */
192 199
200#ifdef __MINGW32__
201 fp_find = popen("find . -type f -name \"*.h\" -print", "r");
202#else
193 fp_find = popen("find * -type f -name \"*.h\" -print", "r"); 203 fp_find = popen("find * -type f -name \"*.h\" -print", "r");
204#endif
194 if (fp_find == 0) 205 if (fp_find == 0)
195 ERROR_EXIT( "find" ); 206 ERROR_EXIT( "find" );
196 207
197 line[0] = '\n'; 208 line[0] = '\n';
198 while (fgets(line+1, buffer_size, fp_find)) 209 while (fgets(line+1, buffer_size, fp_find))
199 { 210 {
211#ifdef __MINGW32__
212 line[2] = '\n';
213# define line (line + 2)
214#endif
200 if (strstr(list_target, line) == NULL) 215 if (strstr(list_target, line) == NULL)
201 { 216 {
202 /* 217 /*
@@ -219,6 +234,9 @@ int main(int argc, const char * argv [])
219 ERROR_EXIT(line); 234 ERROR_EXIT(line);
220 } 235 }
221 } 236 }
237#ifdef __MINGW32__
238# undef line
239#endif
222 } 240 }
223 241
224 if (pclose(fp_find) != 0) 242 if (pclose(fp_find) != 0)