Tue, 20 Sep 2011 15:19:28 +0200
fixed makefile to run safely on compile errors + added -V option to cline
16
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1 | /* |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
2 | * stream.c |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
3 | * |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
4 | * Created on: 20.09.2011 |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
5 | * Author: beckermi |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
6 | */ |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
7 | |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
8 | #include "stream.h" |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
9 | |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
10 | void close_stdout() { |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
11 | #ifdef _WIN32 |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
12 | _STREAM_STDOUT = dup(STDOUT_FILENO); |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
13 | #endif |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
14 | freopen("/dev/null", "w", stdout); |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
15 | } |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
16 | |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
17 | void reopen_stdout() { |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
18 | #ifdef _WIN32 |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
19 | close(STDOUT_FILENO); |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
20 | fdopen(dup(_STREAM_STDOUT), "wa"); |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
21 | close(_STREAM_STDOUT); |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
22 | #else |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
23 | freopen("/dev/stdout", "w", stdout); |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
24 | #endif |
bc9a0fefd892
fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
25 | } |