@@ -11,10 +11,17 @@ extern "C" {
11
11
#include < string.h>
12
12
#include < sys/stat.h>
13
13
#include < sys/types.h>
14
- #include < sys/wait.h>
15
14
#include < unistd.h>
16
15
}
17
16
17
+ #ifndef _WIN32
18
+
19
+ extern " C" {
20
+ #include < sys/wait.h>
21
+ };
22
+
23
+ #endif
24
+
18
25
/* ------------------------------------------------------------------------*/
19
26
20
27
namespace CaDiCaL {
@@ -243,6 +250,8 @@ FILE *File::read_pipe (Internal *internal, const char *fmt, const int *sig,
243
250
return open_pipe (internal, fmt, path, " r" );
244
251
}
245
252
253
+ #ifndef _WIN32
254
+
246
255
FILE *File::write_pipe (Internal *internal, const char *command,
247
256
const char *path, int &child_pid) {
248
257
assert (command[0 ] && command[0 ] != ' ' );
@@ -286,6 +295,8 @@ FILE *File::write_pipe (Internal *internal, const char *command,
286
295
return res;
287
296
}
288
297
298
+ #endif
299
+
289
300
/* ------------------------------------------------------------------------*/
290
301
291
302
File *File::read (Internal *internal, FILE *f, const char *n) {
@@ -334,6 +345,7 @@ File *File::read (Internal *internal, const char *path) {
334
345
File *File::write (Internal *internal, const char *path) {
335
346
FILE *file;
336
347
int close_output = 3 , child_pid = 0 ;
348
+ #ifndef _WIN32
337
349
if (has_suffix (path, " .xz" ))
338
350
file = write_pipe (internal, " xz -c" , path, child_pid);
339
351
else if (has_suffix (path, " .bz2" ))
@@ -343,6 +355,7 @@ File *File::write (Internal *internal, const char *path) {
343
355
else if (has_suffix (path, " .7z" ))
344
356
file = write_pipe (internal, " 7z a -an -txz -si -so" , path, child_pid);
345
357
else
358
+ #endif
346
359
file = write_file (internal, path), close_output = 1 ;
347
360
348
361
if (!file)
@@ -364,11 +377,13 @@ void File::close () {
364
377
MSG (" closing input pipe to read '%s'" , name ());
365
378
pclose (file);
366
379
}
380
+ #ifndef _WIN32
367
381
if (close_file == 3 ) {
368
382
MSG (" closing output pipe to write '%s'" , name ());
369
383
fclose (file);
370
384
waitpid (child_pid, 0 , 0 );
371
385
}
386
+ #endif
372
387
file = 0 ; // mark as closed
373
388
374
389
// TODO what about error checking for 'fclose', 'pclose' or 'waitpid'?
0 commit comments