Fossil SCM

be smarter about istty static initialization

jan.nijtmans 2012-09-05 09:26 eclipse-project
Commit 5d9f57a72104ffb938088e8ad93cab12fc2bc920
2 files changed +3 -6 +6 -4
+3 -6
--- src/file.c
+++ src/file.c
@@ -1127,16 +1127,13 @@
11271127
#ifdef _WIN32
11281128
int nChar;
11291129
wchar_t *zUnicode; /* Unicode version of zUtf8 */
11301130
DWORD dummy;
11311131
1132
- static int once = 1;
1133
- static int istty[2];
1134
- if( once ){
1135
- istty[0] = _isatty(fileno(stdout));
1136
- istty[1] = _isatty(fileno(stderr));
1137
- once = 0;
1132
+ static int istty[2] = { -1, -1 };
1133
+ if( istty[toStdErr] == -1 ){
1134
+ istty[toStdErr] = _isatty(toStdErr + 1) != 0;
11381135
}
11391136
if( !istty[toStdErr] ){
11401137
/* stdout/stderr is not a console. */
11411138
return -1;
11421139
}
11431140
--- src/file.c
+++ src/file.c
@@ -1127,16 +1127,13 @@
1127 #ifdef _WIN32
1128 int nChar;
1129 wchar_t *zUnicode; /* Unicode version of zUtf8 */
1130 DWORD dummy;
1131
1132 static int once = 1;
1133 static int istty[2];
1134 if( once ){
1135 istty[0] = _isatty(fileno(stdout));
1136 istty[1] = _isatty(fileno(stderr));
1137 once = 0;
1138 }
1139 if( !istty[toStdErr] ){
1140 /* stdout/stderr is not a console. */
1141 return -1;
1142 }
1143
--- src/file.c
+++ src/file.c
@@ -1127,16 +1127,13 @@
1127 #ifdef _WIN32
1128 int nChar;
1129 wchar_t *zUnicode; /* Unicode version of zUtf8 */
1130 DWORD dummy;
1131
1132 static int istty[2] = { -1, -1 };
1133 if( istty[toStdErr] == -1 ){
1134 istty[toStdErr] = _isatty(toStdErr + 1) != 0;
 
 
 
1135 }
1136 if( !istty[toStdErr] ){
1137 /* stdout/stderr is not a console. */
1138 return -1;
1139 }
1140
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -13,15 +13,15 @@
1313
#
1414
1515
#### Select one of MinGW, MinGW-64 (32-bit) or MinGW-w64 (64-bit) compilers.
1616
# By default, this is an empty string (i.e. use the native compiler).
1717
#
18
-PREFIX =
18
+# PREFIX =
1919
# PREFIX = mingw32-
2020
# PREFIX = i686-pc-mingw32-
2121
# PREFIX = i686-w64-mingw32-
22
-# PREFIX = x86_64-w64-mingw32-
22
+PREFIX = x86_64-w64-mingw32-
2323
2424
#### The toplevel directory of the source tree. Fossil can be built
2525
# in a directory that is separate from the source tree. Just change
2626
# the following to point from the build directory to the src/ folder.
2727
#
@@ -104,11 +104,11 @@
104104
# will run on the target platform. This is usually the same
105105
# as BCC, unless you are cross-compiling. This C compiler builds
106106
# the finished binary for fossil. The BCC compiler above is used
107107
# for building intermediate code-generator tools.
108108
#
109
-TCC = $(PREFIX)gcc -Os -Wall -L$(ZLIBDIR) -I$(ZINCDIR)
109
+TCC = $(PREFIX)gcc -Os -Wall -DUNICODE -D_UNICODE -L$(ZLIBDIR) -I$(ZINCDIR)
110110
111111
#### Compile resources for use in building executables that will run
112112
# on the target platform.
113113
#
114114
RCC = $(PREFIX)windres -I$(SRCDIR) -I$(ZINCDIR)
@@ -175,15 +175,17 @@
175175
ifdef FOSSIL_ENABLE_TCL
176176
LIB += -lnetapi32 -lkernel32 -luser32 -ladvapi32 -lws2_32
177177
else
178178
LIB += -lkernel32 -lws2_32
179179
endif
180
+
181
+LIB += -municode
180182
181183
#### Tcl shell for use in running the fossil test suite. This is only
182184
# used for testing.
183185
#
184
-TCLSH = tclsh
186
+TCLSH = tclsh86
185187
186188
#### Nullsoft installer MakeNSIS location
187189
#
188190
MAKENSIS = "$(ProgramFiles)\NSIS\MakeNSIS.exe"
189191
190192
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -13,15 +13,15 @@
13 #
14
15 #### Select one of MinGW, MinGW-64 (32-bit) or MinGW-w64 (64-bit) compilers.
16 # By default, this is an empty string (i.e. use the native compiler).
17 #
18 PREFIX =
19 # PREFIX = mingw32-
20 # PREFIX = i686-pc-mingw32-
21 # PREFIX = i686-w64-mingw32-
22 # PREFIX = x86_64-w64-mingw32-
23
24 #### The toplevel directory of the source tree. Fossil can be built
25 # in a directory that is separate from the source tree. Just change
26 # the following to point from the build directory to the src/ folder.
27 #
@@ -104,11 +104,11 @@
104 # will run on the target platform. This is usually the same
105 # as BCC, unless you are cross-compiling. This C compiler builds
106 # the finished binary for fossil. The BCC compiler above is used
107 # for building intermediate code-generator tools.
108 #
109 TCC = $(PREFIX)gcc -Os -Wall -L$(ZLIBDIR) -I$(ZINCDIR)
110
111 #### Compile resources for use in building executables that will run
112 # on the target platform.
113 #
114 RCC = $(PREFIX)windres -I$(SRCDIR) -I$(ZINCDIR)
@@ -175,15 +175,17 @@
175 ifdef FOSSIL_ENABLE_TCL
176 LIB += -lnetapi32 -lkernel32 -luser32 -ladvapi32 -lws2_32
177 else
178 LIB += -lkernel32 -lws2_32
179 endif
 
 
180
181 #### Tcl shell for use in running the fossil test suite. This is only
182 # used for testing.
183 #
184 TCLSH = tclsh
185
186 #### Nullsoft installer MakeNSIS location
187 #
188 MAKENSIS = "$(ProgramFiles)\NSIS\MakeNSIS.exe"
189
190
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -13,15 +13,15 @@
13 #
14
15 #### Select one of MinGW, MinGW-64 (32-bit) or MinGW-w64 (64-bit) compilers.
16 # By default, this is an empty string (i.e. use the native compiler).
17 #
18 # PREFIX =
19 # PREFIX = mingw32-
20 # PREFIX = i686-pc-mingw32-
21 # PREFIX = i686-w64-mingw32-
22 PREFIX = x86_64-w64-mingw32-
23
24 #### The toplevel directory of the source tree. Fossil can be built
25 # in a directory that is separate from the source tree. Just change
26 # the following to point from the build directory to the src/ folder.
27 #
@@ -104,11 +104,11 @@
104 # will run on the target platform. This is usually the same
105 # as BCC, unless you are cross-compiling. This C compiler builds
106 # the finished binary for fossil. The BCC compiler above is used
107 # for building intermediate code-generator tools.
108 #
109 TCC = $(PREFIX)gcc -Os -Wall -DUNICODE -D_UNICODE -L$(ZLIBDIR) -I$(ZINCDIR)
110
111 #### Compile resources for use in building executables that will run
112 # on the target platform.
113 #
114 RCC = $(PREFIX)windres -I$(SRCDIR) -I$(ZINCDIR)
@@ -175,15 +175,17 @@
175 ifdef FOSSIL_ENABLE_TCL
176 LIB += -lnetapi32 -lkernel32 -luser32 -ladvapi32 -lws2_32
177 else
178 LIB += -lkernel32 -lws2_32
179 endif
180
181 LIB += -municode
182
183 #### Tcl shell for use in running the fossil test suite. This is only
184 # used for testing.
185 #
186 TCLSH = tclsh86
187
188 #### Nullsoft installer MakeNSIS location
189 #
190 MAKENSIS = "$(ProgramFiles)\NSIS\MakeNSIS.exe"
191
192

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button