Commit 1ec062cea8336d3ec2dfed55ea89a0d6978a3a74

Authored by Perry Werneck
1 parent 10da349a

Fixing windows customized build.

@@ -70,7 +70,6 @@ @@ -70,7 +70,6 @@
70 <Unit filename="src/include/pw3270/hllapi.h" /> 70 <Unit filename="src/include/pw3270/hllapi.h" />
71 <Unit filename="src/include/pw3270/ipcpackets.h" /> 71 <Unit filename="src/include/pw3270/ipcpackets.h" />
72 <Unit filename="src/include/pw3270/plugin.h" /> 72 <Unit filename="src/include/pw3270/plugin.h" />
73 - <Unit filename="src/include/pw3270/trace.h" />  
74 <Unit filename="src/include/pw3270cpp.h" /> 73 <Unit filename="src/include/pw3270cpp.h" />
75 <Unit filename="src/include/rules.mak.in" /> 74 <Unit filename="src/include/rules.mak.in" />
76 <Unit filename="src/java/Makefile.in" /> 75 <Unit filename="src/java/Makefile.in" />
src/include/config.h.in
@@ -50,7 +50,10 @@ @@ -50,7 +50,10 @@
50 #undef HAVE_ICONV 50 #undef HAVE_ICONV
51 #undef ICONV_CONST 51 #undef ICONV_CONST
52 52
53 - #undef ENABLE_WINDOWS_REGISTRY 53 + #ifdef _WIN32
  54 + #define ENABLE_WINDOWS_REGISTRY 1
  55 + #endif // _WIN32
  56 +
54 #undef HAVE_GNOME 57 #undef HAVE_GNOME
55 #undef HAVE_GTKMAC 58 #undef HAVE_GTKMAC
56 59
src/include/pw3270/hllapi.h
@@ -107,7 +107,7 @@ extern &quot;C&quot; { @@ -107,7 +107,7 @@ extern &quot;C&quot; {
107 107
108 #define HLLAPI_STATUS_WAITING HLLAPI_STATUS_TIMEOUT 108 #define HLLAPI_STATUS_WAITING HLLAPI_STATUS_TIMEOUT
109 109
110 - #if defined(WIN32) 110 + #if defined(_WIN32)
111 111
112 #include <windows.h> 112 #include <windows.h>
113 113
@@ -145,7 +145,7 @@ extern &quot;C&quot; { @@ -145,7 +145,7 @@ extern &quot;C&quot; {
145 145
146 #define HLLAPI_API_CALL __attribute__((visibility("default"))) extern DWORD 146 #define HLLAPI_API_CALL __attribute__((visibility("default"))) extern DWORD
147 147
148 - #endif // WIN32 148 + #endif // _WIN32
149 149
150 HLLAPI_API_CALL hllapi(const LPWORD func, LPSTR str, LPWORD length, LPWORD rc); 150 HLLAPI_API_CALL hllapi(const LPWORD func, LPSTR str, LPWORD length, LPWORD rc);
151 151
src/include/pw3270cpp.h
@@ -31,11 +31,11 @@ @@ -31,11 +31,11 @@
31 31
32 #define PW3270_CLASS_H_INCLUDED 1 32 #define PW3270_CLASS_H_INCLUDED 1
33 33
34 - #ifdef WIN32 34 + #ifdef _WIN32
35 #define SYSTEM_CHARSET "CP1252" 35 #define SYSTEM_CHARSET "CP1252"
36 #else 36 #else
37 #define SYSTEM_CHARSET "UTF-8" 37 #define SYSTEM_CHARSET "UTF-8"
38 - #endif // WIN32 38 + #endif // _WIN32
39 39
40 #include <exception> 40 #include <exception>
41 #include <errno.h> 41 #include <errno.h>
@@ -92,11 +92,11 @@ @@ -92,11 +92,11 @@
92 exception(int syserror = errno); 92 exception(int syserror = errno);
93 exception(const char *fmt, ...); 93 exception(const char *fmt, ...);
94 94
95 -#ifdef WIN32 95 +#ifdef _WIN32
96 exception(DWORD error, const char *fmt, ...); 96 exception(DWORD error, const char *fmt, ...);
97 #else 97 #else
98 exception(int error, const char *fmt, ...); 98 exception(int error, const char *fmt, ...);
99 -#endif // WIN32 99 +#endif // _WIN32
100 100
101 virtual const char * what() const throw(); 101 virtual const char * what() const throw();
102 102
@@ -108,13 +108,13 @@ @@ -108,13 +108,13 @@
108 class module 108 class module
109 { 109 {
110 private: 110 private:
111 -#ifdef WIN32 111 +#ifdef _WIN32
112 HMODULE hModule; 112 HMODULE hModule;
113 int get_datadir(LPSTR datadir); 113 int get_datadir(LPSTR datadir);
114 #else 114 #else
115 void * hModule; 115 void * hModule;
116 116
117 -#endif // WIN32 117 +#endif // _WIN32
118 118
119 public: 119 public:
120 module(const char *name, const char *version = NULL) throw (std::exception); 120 module(const char *name, const char *version = NULL) throw (std::exception);
@@ -136,9 +136,9 @@ @@ -136,9 +136,9 @@
136 136
137 // Factory methods and settings 137 // Factory methods and settings
138 static session * start(const char *name = 0); 138 static session * start(const char *name = 0);
139 - static session * create(const char *name = 0) throw (std::exception);  
140 - static session * create_local(H3270 *hSession) throw (std::exception);  
141 - static session * create_local() throw (std::exception); 139 + static session * create(const char *name = 0);
  140 + static session * create_local(H3270 *hSession);
  141 + static session * create_local();
142 142
143 static session * get_default(void); 143 static session * get_default(void);
144 static bool has_default(void); 144 static bool has_default(void);
@@ -173,12 +173,12 @@ @@ -173,12 +173,12 @@
173 virtual void set_unlock_delay(unsigned short ms) = 0; 173 virtual void set_unlock_delay(unsigned short ms) = 0;
174 174
175 // charset 175 // charset
176 -#ifdef WIN32 176 +#ifdef _WIN32
177 void set_display_charset(const char *remote = 0, const char *local = "CP1252"); 177 void set_display_charset(const char *remote = 0, const char *local = "CP1252");
178 static string win32_strerror(int e); 178 static string win32_strerror(int e);
179 #else 179 #else
180 void set_display_charset(const char *remote = 0, const char *local = "UTF-8"); 180 void set_display_charset(const char *remote = 0, const char *local = "UTF-8");
181 -#endif // WIN32 181 +#endif // _WIN32
182 182
183 virtual int set_host_charset(const char *charset) = 0; 183 virtual int set_host_charset(const char *charset) = 0;
184 virtual string get_host_charset(void) = 0; 184 virtual string get_host_charset(void) = 0;
src/libpw3270cpp/exception.cc
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
51 va_end(arg_ptr); 51 va_end(arg_ptr);
52 } 52 }
53 53
54 -#ifdef WIN32 54 +#ifdef _WIN32
55 exception::exception(DWORD error, const char *fmt, ...) 55 exception::exception(DWORD error, const char *fmt, ...)
56 { 56 {
57 LPVOID lpMsgBuf = 0; 57 LPVOID lpMsgBuf = 0;
@@ -90,7 +90,7 @@ @@ -90,7 +90,7 @@
90 snprintf(this->msg+szPrefix,4095-szPrefix,": %s (rc=%d)",strerror(error),(int) error); 90 snprintf(this->msg+szPrefix,4095-szPrefix,": %s (rc=%d)",strerror(error),(int) error);
91 91
92 } 92 }
93 -#endif // WIN32 93 +#endif // _WIN32
94 94
95 const char * exception::what() const throw() 95 const char * exception::what() const throw()
96 { 96 {
src/libpw3270cpp/local.cc
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 * 27 *
28 */ 28 */
29 29
30 -#if defined WIN32 30 +#ifdef _WIN32
31 31
32 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx 32 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx
33 #ifndef LOAD_LIBRARY_SEARCH_DEFAULT_DIRS 33 #ifndef LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
src/libpw3270cpp/module.cc
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 * 27 *
28 */ 28 */
29 29
30 -#if defined WIN32 30 +#ifdef _WIN32
31 31
32 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx 32 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx
33 #ifndef LOAD_LIBRARY_SEARCH_DEFAULT_DIRS 33 #ifndef LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
@@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
54 namespace PW3270_NAMESPACE 54 namespace PW3270_NAMESPACE
55 { 55 {
56 56
57 -#ifdef WIN32 57 +#ifdef _WIN32
58 int module::get_datadir(LPSTR datadir) 58 int module::get_datadir(LPSTR datadir)
59 { 59 {
60 HKEY hKey = 0; 60 HKEY hKey = 0;
@@ -72,13 +72,13 @@ namespace PW3270_NAMESPACE @@ -72,13 +72,13 @@ namespace PW3270_NAMESPACE
72 72
73 return *datadir; 73 return *datadir;
74 } 74 }
75 -#endif // WIN32 75 +#endif // _WIN32
76 76
77 module::module(const char *name, const char *version) throw (std::exception) 77 module::module(const char *name, const char *version) throw (std::exception)
78 { 78 {
79 string dllname = name; 79 string dllname = name;
80 80
81 -#ifdef WIN32 81 +#ifdef _WIN32
82 82
83 dllname += ".dll"; 83 dllname += ".dll";
84 if(version) 84 if(version)
@@ -176,18 +176,18 @@ namespace PW3270_NAMESPACE @@ -176,18 +176,18 @@ namespace PW3270_NAMESPACE
176 if(!hModule) 176 if(!hModule)
177 throw exception("Can't load lib3270: %s",dllname.c_str()); 177 throw exception("Can't load lib3270: %s",dllname.c_str());
178 178
179 -#endif // WIN32 179 +#endif // _WIN32
180 180
181 181
182 } 182 }
183 183
184 module::~module() 184 module::~module()
185 { 185 {
186 -#ifdef WIN32 186 +#ifdef _WIN32
187 FreeLibrary(hModule); 187 FreeLibrary(hModule);
188 #else 188 #else
189 dlclose(hModule); 189 dlclose(hModule);
190 -#endif // WIN32 190 +#endif // _WIN32
191 } 191 }
192 192
193 193
@@ -195,7 +195,7 @@ namespace PW3270_NAMESPACE @@ -195,7 +195,7 @@ namespace PW3270_NAMESPACE
195 { 195 {
196 void *symbol; 196 void *symbol;
197 197
198 -#ifdef WIN32 198 +#ifdef _WIN32
199 199
200 symbol = (void *) GetProcAddress(hModule,name); 200 symbol = (void *) GetProcAddress(hModule,name);
201 201
@@ -208,7 +208,7 @@ namespace PW3270_NAMESPACE @@ -208,7 +208,7 @@ namespace PW3270_NAMESPACE
208 if(!symbol) 208 if(!symbol)
209 throw exception("Can't load symbol %s dlerror was \"%s\"",name,dlerror()); 209 throw exception("Can't load symbol %s dlerror was \"%s\"",name,dlerror());
210 210
211 -#endif // WIN32 211 +#endif // _WIN32
212 212
213 return symbol; 213 return symbol;
214 } 214 }
src/libpw3270cpp/remote.cc
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 45
46 #endif // HAVE_DBUS 46 #endif // HAVE_DBUS
47 47
48 - #if defined(WIN32) 48 + #if defined(_WIN32)
49 #include <windows.h> 49 #include <windows.h>
50 #include <pw3270/ipcpackets.h> 50 #include <pw3270/ipcpackets.h>
51 #include <process.h> 51 #include <process.h>
@@ -72,7 +72,7 @@ @@ -72,7 +72,7 @@
72 #define HLLAPI_PACKET_ASC2EBC "asc2ebc" 72 #define HLLAPI_PACKET_ASC2EBC "asc2ebc"
73 #define HLLAPI_PACKET_EBC2ASC "ebc2asc" 73 #define HLLAPI_PACKET_EBC2ASC "ebc2asc"
74 #define HLLAPI_PACKET_SET_UNLOCK_DELAY "setUnlockDelay" 74 #define HLLAPI_PACKET_SET_UNLOCK_DELAY "setUnlockDelay"
75 - #endif // WIN32 75 + #endif // _WIN32
76 76
77 #include <pw3270cpp.h> 77 #include <pw3270cpp.h>
78 #include <lib3270/log.h> 78 #include <lib3270/log.h>
@@ -93,7 +93,7 @@ @@ -93,7 +93,7 @@
93 { 93 {
94 private: 94 private:
95 95
96 -#if defined(WIN32) 96 +#if defined(_WIN32)
97 97
98 HANDLE hPipe; 98 HANDLE hPipe;
99 99
@@ -477,7 +477,7 @@ @@ -477,7 +477,7 @@
477 } 477 }
478 #endif // HAVE_DBUS 478 #endif // HAVE_DBUS
479 479
480 -#if defined(WIN32) 480 +#if defined(_WIN32)
481 481
482 static string getRegistryKey(const char *name) throw (std::exception) 482 static string getRegistryKey(const char *name) throw (std::exception)
483 { 483 {
@@ -509,7 +509,7 @@ @@ -509,7 +509,7 @@
509 509
510 remote(const char *session) throw (std::exception) 510 remote(const char *session) throw (std::exception)
511 { 511 {
512 -#if defined(WIN32) 512 +#if defined(_WIN32)
513 static DWORD dwMode = PIPE_READMODE_MESSAGE; 513 static DWORD dwMode = PIPE_READMODE_MESSAGE;
514 char buffer[4096]; 514 char buffer[4096];
515 char * str; 515 char * str;
@@ -756,7 +756,7 @@ @@ -756,7 +756,7 @@
756 756
757 virtual ~remote() 757 virtual ~remote()
758 { 758 {
759 -#if defined(WIN32) 759 +#if defined(_WIN32)
760 760
761 if(hPipe != INVALID_HANDLE_VALUE) 761 if(hPipe != INVALID_HANDLE_VALUE)
762 CloseHandle(hPipe); 762 CloseHandle(hPipe);
@@ -832,7 +832,7 @@ @@ -832,7 +832,7 @@
832 url = ""; 832 url = "";
833 } 833 }
834 834
835 -#if defined(WIN32) 835 +#if defined(_WIN32)
836 836
837 size_t cbSize = sizeof(struct hllapi_packet_query) + strlen(url) + 1; 837 size_t cbSize = sizeof(struct hllapi_packet_query) + strlen(url) + 1;
838 struct hllapi_packet_query * pkt = (struct hllapi_packet_query *) malloc(cbSize); 838 struct hllapi_packet_query * pkt = (struct hllapi_packet_query *) malloc(cbSize);
@@ -884,7 +884,7 @@ @@ -884,7 +884,7 @@
884 { 884 {
885 int rc; 885 int rc;
886 886
887 -#if defined(WIN32) 887 +#if defined(_WIN32)
888 888
889 size_t cbSize = sizeof(struct hllapi_packet_text)+strlen(uri); 889 size_t cbSize = sizeof(struct hllapi_packet_text)+strlen(uri);
890 struct hllapi_packet_text * pkt = (struct hllapi_packet_text *) malloc(cbSize); 890 struct hllapi_packet_text * pkt = (struct hllapi_packet_text *) malloc(cbSize);
@@ -910,7 +910,7 @@ @@ -910,7 +910,7 @@
910 910
911 string get_url() 911 string get_url()
912 { 912 {
913 -#if defined(WIN32) 913 +#if defined(_WIN32)
914 914
915 struct hllapi_packet_query query = { HLLAPI_PACKET_GET_HOST }; 915 struct hllapi_packet_query query = { HLLAPI_PACKET_GET_HOST };
916 return query_string(&query,sizeof(query),1024); 916 return query_string(&query,sizeof(query),1024);
@@ -926,7 +926,7 @@ @@ -926,7 +926,7 @@
926 926
927 int wait_for_ready(int seconds) 927 int wait_for_ready(int seconds)
928 { 928 {
929 -#if defined(WIN32) 929 +#if defined(_WIN32)
930 930
931 time_t end = time(0)+seconds; 931 time_t end = time(0)+seconds;
932 932
@@ -982,7 +982,7 @@ @@ -982,7 +982,7 @@
982 982
983 int wait(int seconds) 983 int wait(int seconds)
984 { 984 {
985 -#if defined(WIN32) 985 +#if defined(_WIN32)
986 986
987 time_t end = time(0)+seconds; 987 time_t end = time(0)+seconds;
988 988
@@ -1018,7 +1018,7 @@ @@ -1018,7 +1018,7 @@
1018 1018
1019 int iterate(bool wait) 1019 int iterate(bool wait)
1020 { 1020 {
1021 -#if defined(WIN32) 1021 +#if defined(_WIN32)
1022 if(wait) 1022 if(wait)
1023 Sleep(250); 1023 Sleep(250);
1024 return 0; 1024 return 0;
@@ -1033,7 +1033,7 @@ @@ -1033,7 +1033,7 @@
1033 1033
1034 string get_text_at(int row, int col, size_t sz, bool lf) 1034 string get_text_at(int row, int col, size_t sz, bool lf)
1035 { 1035 {
1036 -#if defined(WIN32) 1036 +#if defined(_WIN32)
1037 1037
1038 struct hllapi_packet_query_at query = { HLLAPI_PACKET_GET_TEXT_AT, (unsigned short) row, (unsigned short) col, (unsigned short) sz, lf ? '\n' : 0 }; 1038 struct hllapi_packet_query_at query = { HLLAPI_PACKET_GET_TEXT_AT, (unsigned short) row, (unsigned short) col, (unsigned short) sz, lf ? '\n' : 0 };
1039 1039
@@ -1065,7 +1065,7 @@ @@ -1065,7 +1065,7 @@
1065 1065
1066 int set_text_at(int row, int col, const char *str) 1066 int set_text_at(int row, int col, const char *str)
1067 { 1067 {
1068 -#if defined(WIN32) 1068 +#if defined(_WIN32)
1069 1069
1070 struct hllapi_packet_text_at * query; 1070 struct hllapi_packet_text_at * query;
1071 struct hllapi_packet_result response; 1071 struct hllapi_packet_result response;
@@ -1102,7 +1102,7 @@ @@ -1102,7 +1102,7 @@
1102 { 1102 {
1103 debug("%s(%d,%d,\"%s\")",__FUNCTION__,row,col,text); 1103 debug("%s(%d,%d,\"%s\")",__FUNCTION__,row,col,text);
1104 1104
1105 -#if defined(WIN32) 1105 +#if defined(_WIN32)
1106 1106
1107 struct hllapi_packet_text_at * query; 1107 struct hllapi_packet_text_at * query;
1108 size_t cbSize = sizeof(struct hllapi_packet_text_at)+strlen(text); 1108 size_t cbSize = sizeof(struct hllapi_packet_text_at)+strlen(text);
@@ -1141,7 +1141,7 @@ @@ -1141,7 +1141,7 @@
1141 if(!cmp_text_at(row,col,key,false)) 1141 if(!cmp_text_at(row,col,key,false))
1142 return 0; 1142 return 0;
1143 1143
1144 -#ifdef WIN32 1144 +#ifdef _WIN32
1145 Sleep(500); 1145 Sleep(500);
1146 #else 1146 #else
1147 usleep(500); 1147 usleep(500);
@@ -1153,7 +1153,7 @@ @@ -1153,7 +1153,7 @@
1153 1153
1154 string get_text(int baddr, size_t len, bool lf) 1154 string get_text(int baddr, size_t len, bool lf)
1155 { 1155 {
1156 -#if defined(WIN32) 1156 +#if defined(_WIN32)
1157 1157
1158 struct hllapi_packet_query_offset query = { HLLAPI_PACKET_GET_TEXT_AT_OFFSET, (unsigned short) baddr, (unsigned short) len, lf ? '\n' : 0 }; 1158 struct hllapi_packet_query_offset query = { HLLAPI_PACKET_GET_TEXT_AT_OFFSET, (unsigned short) baddr, (unsigned short) len, lf ? '\n' : 0 };
1159 return query_string(&query,sizeof(query),len); 1159 return query_string(&query,sizeof(query),len);
@@ -1181,7 +1181,7 @@ @@ -1181,7 +1181,7 @@
1181 1181
1182 int set_cursor_position(int row, int col) 1182 int set_cursor_position(int row, int col)
1183 { 1183 {
1184 -#if defined(WIN32) 1184 +#if defined(_WIN32)
1185 1185
1186 struct hllapi_packet_cursor query = { HLLAPI_PACKET_SET_CURSOR_POSITION, (unsigned short) row, (unsigned short) col }; 1186 struct hllapi_packet_cursor query = { HLLAPI_PACKET_SET_CURSOR_POSITION, (unsigned short) row, (unsigned short) col };
1187 1187
@@ -1201,7 +1201,7 @@ @@ -1201,7 +1201,7 @@
1201 1201
1202 int set_cursor_addr(int addr) 1202 int set_cursor_addr(int addr)
1203 { 1203 {
1204 -#if defined(WIN32) 1204 +#if defined(_WIN32)
1205 1205
1206 struct hllapi_packet_addr query = { HLLAPI_PACKET_SET_CURSOR, (unsigned short) addr }; 1206 struct hllapi_packet_addr query = { HLLAPI_PACKET_SET_CURSOR, (unsigned short) addr };
1207 1207
@@ -1242,7 +1242,7 @@ @@ -1242,7 +1242,7 @@
1242 1242
1243 int pfkey(int key) 1243 int pfkey(int key)
1244 { 1244 {
1245 -#if defined(WIN32) 1245 +#if defined(_WIN32)
1246 1246
1247 struct hllapi_packet_keycode query = { HLLAPI_PACKET_PFKEY, (unsigned short) key }; 1247 struct hllapi_packet_keycode query = { HLLAPI_PACKET_PFKEY, (unsigned short) key };
1248 1248
@@ -1264,7 +1264,7 @@ @@ -1264,7 +1264,7 @@
1264 1264
1265 int pakey(int key) 1265 int pakey(int key)
1266 { 1266 {
1267 -#if defined(WIN32) 1267 +#if defined(_WIN32)
1268 1268
1269 struct hllapi_packet_keycode query = { HLLAPI_PACKET_PAKEY, (unsigned short) key }; 1269 struct hllapi_packet_keycode query = { HLLAPI_PACKET_PAKEY, (unsigned short) key };
1270 1270
@@ -1291,7 +1291,7 @@ @@ -1291,7 +1291,7 @@
1291 1291
1292 int set_toggle(LIB3270_TOGGLE ix, bool value) 1292 int set_toggle(LIB3270_TOGGLE ix, bool value)
1293 { 1293 {
1294 -#if defined(WIN32) 1294 +#if defined(_WIN32)
1295 1295
1296 struct hllapi_packet_set query = { HLLAPI_PACKET_SET_TOGGLE, (unsigned short) ix, (unsigned short) value }; 1296 struct hllapi_packet_set query = { HLLAPI_PACKET_SET_TOGGLE, (unsigned short) ix, (unsigned short) value };
1297 1297
@@ -1313,7 +1313,7 @@ @@ -1313,7 +1313,7 @@
1313 1313
1314 int emulate_input(const char *str) 1314 int emulate_input(const char *str)
1315 { 1315 {
1316 -#if defined(WIN32) 1316 +#if defined(_WIN32)
1317 1317
1318 size_t len = strlen(str); 1318 size_t len = strlen(str);
1319 struct hllapi_packet_emulate_input * query; 1319 struct hllapi_packet_emulate_input * query;
@@ -1341,7 +1341,7 @@ @@ -1341,7 +1341,7 @@
1341 int action(const char *str) 1341 int action(const char *str)
1342 { 1342 {
1343 1343
1344 -#if defined(WIN32) 1344 +#if defined(_WIN32)
1345 1345
1346 size_t len = strlen(str); 1346 size_t len = strlen(str);
1347 struct hllapi_packet_text * query; 1347 struct hllapi_packet_text * query;
@@ -1367,7 +1367,7 @@ @@ -1367,7 +1367,7 @@
1367 1367
1368 int get_field_start(int baddr) 1368 int get_field_start(int baddr)
1369 { 1369 {
1370 -#if defined(WIN32) 1370 +#if defined(_WIN32)
1371 1371
1372 struct hllapi_packet_addr query = { HLLAPI_PACKET_FIELD_START, (unsigned short) baddr }; 1372 struct hllapi_packet_addr query = { HLLAPI_PACKET_FIELD_START, (unsigned short) baddr };
1373 1373
@@ -1389,7 +1389,7 @@ @@ -1389,7 +1389,7 @@
1389 1389
1390 int get_field_len(int baddr) 1390 int get_field_len(int baddr)
1391 { 1391 {
1392 -#if defined(WIN32) 1392 +#if defined(_WIN32)
1393 1393
1394 struct hllapi_packet_addr query = { HLLAPI_PACKET_FIELD_LEN, (unsigned short) baddr }; 1394 struct hllapi_packet_addr query = { HLLAPI_PACKET_FIELD_LEN, (unsigned short) baddr };
1395 1395
@@ -1410,7 +1410,7 @@ @@ -1410,7 +1410,7 @@
1410 1410
1411 int get_next_unprotected(int baddr) 1411 int get_next_unprotected(int baddr)
1412 { 1412 {
1413 -#if defined(WIN32) 1413 +#if defined(_WIN32)
1414 1414
1415 struct hllapi_packet_addr query = { HLLAPI_PACKET_NEXT_UNPROTECTED, (unsigned short) baddr }; 1415 struct hllapi_packet_addr query = { HLLAPI_PACKET_NEXT_UNPROTECTED, (unsigned short) baddr };
1416 1416
@@ -1439,7 +1439,7 @@ @@ -1439,7 +1439,7 @@
1439 1439
1440 int get_is_protected(int baddr) 1440 int get_is_protected(int baddr)
1441 { 1441 {
1442 -#if defined(WIN32) 1442 +#if defined(_WIN32)
1443 1443
1444 struct hllapi_packet_addr query = { HLLAPI_PACKET_IS_PROTECTED, (unsigned short) baddr }; 1444 struct hllapi_packet_addr query = { HLLAPI_PACKET_IS_PROTECTED, (unsigned short) baddr };
1445 1445
@@ -1468,7 +1468,7 @@ @@ -1468,7 +1468,7 @@
1468 1468
1469 int get_is_protected_at(int row,int col) 1469 int get_is_protected_at(int row,int col)
1470 { 1470 {
1471 -#if defined(WIN32) 1471 +#if defined(_WIN32)
1472 1472
1473 struct hllapi_packet_query_at query = { HLLAPI_PACKET_IS_PROTECTED_AT, (unsigned short) row, (unsigned short) col, 0 }; 1473 struct hllapi_packet_query_at query = { HLLAPI_PACKET_IS_PROTECTED_AT, (unsigned short) row, (unsigned short) col, 0 };
1474 1474
@@ -1499,7 +1499,7 @@ @@ -1499,7 +1499,7 @@
1499 1499
1500 int set_host_charset(const char *charset) 1500 int set_host_charset(const char *charset)
1501 { 1501 {
1502 -#if defined(WIN32) 1502 +#if defined(_WIN32)
1503 1503
1504 size_t len = strlen(charset); 1504 size_t len = strlen(charset);
1505 struct hllapi_packet_set_text * query; 1505 struct hllapi_packet_set_text * query;
@@ -1523,7 +1523,7 @@ @@ -1523,7 +1523,7 @@
1523 1523
1524 string get_host_charset(void) 1524 string get_host_charset(void)
1525 { 1525 {
1526 -#if defined(WIN32) 1526 +#if defined(_WIN32)
1527 1527
1528 struct hllapi_packet_query query = { HLLAPI_PACKET_GET_HOST_CHARSET }; 1528 struct hllapi_packet_query query = { HLLAPI_PACKET_GET_HOST_CHARSET };
1529 return query_string(&query,sizeof(query),100); 1529 return query_string(&query,sizeof(query),100);
src/libpw3270cpp/session.cc
@@ -344,7 +344,7 @@ @@ -344,7 +344,7 @@
344 344
345 string session::get_clipboard(void) 345 string session::get_clipboard(void)
346 { 346 {
347 -#if defined(WIN32) 347 +#if defined(_WIN32)
348 348
349 if (! OpenClipboard(0)) 349 if (! OpenClipboard(0))
350 { 350 {
@@ -378,12 +378,12 @@ @@ -378,12 +378,12 @@
378 errno = EINVAL; 378 errno = EINVAL;
379 return NULL; 379 return NULL;
380 380
381 -#endif // WIN32 381 +#endif // _WIN32
382 } 382 }
383 383
384 int session::set_clipboard(const char *text) 384 int session::set_clipboard(const char *text)
385 { 385 {
386 -#if defined(WIN32) 386 +#if defined(_WIN32)
387 if (! OpenClipboard(0)) 387 if (! OpenClipboard(0))
388 { 388 {
389 throw exception(GetLastError(),"%s","Can´t open system clipboard"); 389 throw exception(GetLastError(),"%s","Can´t open system clipboard");
@@ -412,7 +412,7 @@ @@ -412,7 +412,7 @@
412 412
413 return EINVAL; 413 return EINVAL;
414 414
415 -#endif // WIN32 415 +#endif // _WIN32
416 } 416 }
417 417
418 418
@@ -649,7 +649,7 @@ @@ -649,7 +649,7 @@
649 return rc; 649 return rc;
650 } 650 }
651 651
652 -#ifdef WIN32 652 +#ifdef _WIN32
653 string session::win32_strerror(int e) 653 string session::win32_strerror(int e)
654 { 654 {
655 static char buffer[4096]; 655 static char buffer[4096];
@@ -672,7 +672,7 @@ @@ -672,7 +672,7 @@
672 672
673 return string(buffer); 673 return string(buffer);
674 } 674 }
675 -#endif // WIN32 675 +#endif // _WIN32
676 676
677 int session::erase(int mode) { 677 int session::erase(int mode) {
678 678
src/plugins/dbus3270/iocallback.c
@@ -70,7 +70,7 @@ static gboolean IO_closure(gpointer data); @@ -70,7 +70,7 @@ static gboolean IO_closure(gpointer data);
70 HANDLE source; 70 HANDLE source;
71 #else 71 #else
72 int source; 72 int source;
73 -#endif // WIN32 73 +#endif // _WIN32
74 void (*fn)(H3270 *session); 74 void (*fn)(H3270 *session);
75 H3270 *session; 75 H3270 *session;
76 } IO_Source; 76 } IO_Source;
@@ -94,11 +94,11 @@ static gboolean IO_closure(gpointer data); @@ -94,11 +94,11 @@ static gboolean IO_closure(gpointer data);
94 94
95 /*---[ Implement ]-----------------------------------------------------------------------------------------*/ 95 /*---[ Implement ]-----------------------------------------------------------------------------------------*/
96 96
97 -#ifdef WIN32 97 +#ifdef _WIN32
98 static void * AddSource(HANDLE source, H3270 *session, gushort events, void (*fn)(H3270 *session)) 98 static void * AddSource(HANDLE source, H3270 *session, gushort events, void (*fn)(H3270 *session))
99 #else 99 #else
100 static void * AddSource(int source, H3270 *session, gushort events, void (*fn)(H3270 *session)) 100 static void * AddSource(int source, H3270 *session, gushort events, void (*fn)(H3270 *session))
101 -#endif // WIN32 101 +#endif // _WIN32
102 { 102 {
103 IO_Source *src = (IO_Source *) g_source_new(&IOSources,sizeof(IO_Source)); 103 IO_Source *src = (IO_Source *) g_source_new(&IOSources,sizeof(IO_Source));
104 104
@@ -114,11 +114,11 @@ static void * AddSource(int source, H3270 *session, gushort events, void (*fn)(H @@ -114,11 +114,11 @@ static void * AddSource(int source, H3270 *session, gushort events, void (*fn)(H
114 return src; 114 return src;
115 } 115 }
116 116
117 -#ifdef WIN32 117 +#ifdef _WIN32
118 static void * static_AddInput(HANDLE source, H3270 *session, void (*fn)(H3270 *session)) 118 static void * static_AddInput(HANDLE source, H3270 *session, void (*fn)(H3270 *session))
119 #else 119 #else
120 static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session)) 120 static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session))
121 -#endif // WIN32 121 +#endif // _WIN32
122 { 122 {
123 return AddSource(source,session,G_IO_IN|G_IO_HUP|G_IO_ERR,fn); 123 return AddSource(source,session,G_IO_IN|G_IO_HUP|G_IO_ERR,fn);
124 } 124 }
@@ -129,7 +129,7 @@ static void static_RemoveSource(void *id) @@ -129,7 +129,7 @@ static void static_RemoveSource(void *id)
129 g_source_destroy((GSource *) id); 129 g_source_destroy((GSource *) id);
130 } 130 }
131 131
132 -#if defined(WIN32) 132 +#if defined(_WIN32)
133 static void * static_AddExcept(HANDLE source, H3270 *session, void (*fn)(H3270 *session)) 133 static void * static_AddExcept(HANDLE source, H3270 *session, void (*fn)(H3270 *session))
134 { 134 {
135 return 0; 135 return 0;
@@ -139,7 +139,7 @@ static void * static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *ses @@ -139,7 +139,7 @@ static void * static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *ses
139 { 139 {
140 return AddSource(source,session,G_IO_HUP|G_IO_ERR,fn); 140 return AddSource(source,session,G_IO_HUP|G_IO_ERR,fn);
141 } 141 }
142 -#endif // WIN32 142 +#endif // _WIN32
143 143
144 static gboolean do_timer(TIMER *t) 144 static gboolean do_timer(TIMER *t)
145 { 145 {
src/plugins/hllapi/remotectl.h
@@ -44,9 +44,9 @@ @@ -44,9 +44,9 @@
44 44
45 typedef struct _remotequery 45 typedef struct _remotequery
46 { 46 {
47 -#ifdef WIN32 47 +#ifdef _WIN32
48 HANDLE hPipe; /**< Pipe handle (for response) */ 48 HANDLE hPipe; /**< Pipe handle (for response) */
49 -#endif // WIN32 49 +#endif // _WIN32
50 50
51 H3270 * hSession; /**< 3270 Session */ 51 H3270 * hSession; /**< 3270 Session */
52 int cmd; /**< Command */ 52 int cmd; /**< Command */
@@ -68,14 +68,14 @@ @@ -68,14 +68,14 @@
68 // int run_hllapi(unsigned long function, char *string, unsigned short length, unsigned short rc); 68 // int run_hllapi(unsigned long function, char *string, unsigned short length, unsigned short rc);
69 69
70 70
71 -#ifdef WIN32 71 +#ifdef _WIN32
72 72
73 #define PIPE_BUFFER_LENGTH 8192 73 #define PIPE_BUFFER_LENGTH 8192
74 74
75 void init_source_pipe(HANDLE hPipe); 75 void init_source_pipe(HANDLE hPipe);
76 void popup_lasterror(const gchar *fmt, ...); 76 void popup_lasterror(const gchar *fmt, ...);
77 77
78 -#endif // WIN32 78 +#endif // _WIN32
79 79
80 80
81 81
src/plugins/hllapi/server.h
@@ -48,6 +48,6 @@ @@ -48,6 +48,6 @@
48 G_GNUC_INTERNAL void popup_lasterror(const gchar *fmt, ...); 48 G_GNUC_INTERNAL void popup_lasterror(const gchar *fmt, ...);
49 G_GNUC_INTERNAL void set_active(gboolean on); 49 G_GNUC_INTERNAL void set_active(gboolean on);
50 50
51 -#endif // WIN32 51 +#endif // _WIN32
52 52
53 53
src/pw3270/common/common.h
@@ -29,72 +29,60 @@ @@ -29,72 +29,60 @@
29 29
30 #ifndef COMMON_H_INCLUDED 30 #ifndef COMMON_H_INCLUDED
31 31
32 - #define COMMON_H_INCLUDED 1  
33 -  
34 - // "PW" Standards  
35 - #include <gtk/gtk.h>  
36 - #include <errno.h>  
37 - #include <config.h>  
38 -  
39 - #ifdef WIN32 32 + #include <config.h>
40 33
  34 +#ifdef _WIN32
41 #include <windows.h> 35 #include <windows.h>
  36 +#endif // _WIN32
42 37
43 - #ifndef KEY_WOW64_64KEY  
44 - #define KEY_WOW64_64KEY 0x0100  
45 - #endif // KEY_WOW64_64KEY  
46 -  
47 - #ifndef KEY_WOW64_32KEY  
48 - #define KEY_WOW64_32KEY 0x0200  
49 - #endif // KEY_WOW64_64KEY  
50 -  
51 - #endif // WIN32  
52 38
53 - #define ENABLE_NLS 39 + #define COMMON_H_INCLUDED 1
54 40
55 - #ifndef GETTEXT_PACKAGE  
56 - #define GETTEXT_PACKAGE PACKAGE_NAME  
57 - #endif 41 + #include <gtk/gtk.h>
  42 + #include <errno.h>
58 43
59 - #include <libintl.h>  
60 - #include <glib/gi18n.h>  
61 - #include <gtk/gtk.h> 44 + #ifndef GETTEXT_PACKAGE
  45 + #define GETTEXT_PACKAGE PACKAGE_NAME
  46 + #endif
62 47
63 - #if defined( DEBUG )  
64 - #define trace(x, ...) fprintf(stderr,"%s(%d):\t" x "\n",__FILE__,__LINE__, __VA_ARGS__); fflush(stderr);  
65 - #else  
66 - #define trace(x, ...) /* */  
67 - #endif 48 + #include <libintl.h>
  49 + #include <glib/gi18n.h>
  50 + #include <gtk/gtk.h>
68 51
69 - // Configuration  
70 - void configuration_init(void);  
71 - void configuration_deinit(void); 52 + #if defined( DEBUG )
  53 + #define trace(x, ...) fprintf(stderr,"%s(%d):\t" x "\n",__FILE__,__LINE__, __VA_ARGS__); fflush(stderr);
  54 + #else
  55 + #define trace(x, ...) /* */
  56 + #endif
72 57
73 - gchar * get_string_from_config(const gchar *group, const gchar *key, const gchar *def);  
74 - gboolean get_boolean_from_config(const gchar *group, const gchar *key, gboolean def);  
75 - gint get_integer_from_config(const gchar *group, const gchar *key, gint def); 58 + // Configuration
  59 + void configuration_init(void);
  60 + void configuration_deinit(void);
76 61
77 - void set_string_to_config(const gchar *group, const gchar *key, const gchar *fmt, ...);  
78 - void set_boolean_to_config(const gchar *group, const gchar *key, gboolean val);  
79 - void set_integer_to_config(const gchar *group, const gchar *key, gint val); 62 + gchar * get_string_from_config(const gchar *group, const gchar *key, const gchar *def);
  63 + gboolean get_boolean_from_config(const gchar *group, const gchar *key, gboolean def);
  64 + gint get_integer_from_config(const gchar *group, const gchar *key, gint def);
80 65
81 - gchar * build_data_filename(const gchar *first_element, ...);  
82 - gchar * filename_from_va(const gchar *first_element, va_list args); 66 + void set_string_to_config(const gchar *group, const gchar *key, const gchar *fmt, ...);
  67 + void set_boolean_to_config(const gchar *group, const gchar *key, gboolean val);
  68 + void set_integer_to_config(const gchar *group, const gchar *key, gint val);
83 69
  70 + gchar * build_data_filename(const gchar *first_element, ...);
  71 + gchar * filename_from_va(const gchar *first_element, va_list args);
84 72
85 - void save_window_state_to_config(const gchar *group, const gchar *key, GdkWindowState CurrentState);  
86 - void save_window_size_to_config(const gchar *group, const gchar *key, GtkWidget *hwnd); 73 + void save_window_state_to_config(const gchar *group, const gchar *key, GdkWindowState CurrentState);
  74 + void save_window_size_to_config(const gchar *group, const gchar *key, GtkWidget *hwnd);
87 75
88 - void restore_window_from_config(const gchar *group, const gchar *key, GtkWidget *hwnd); 76 + void restore_window_from_config(const gchar *group, const gchar *key, GtkWidget *hwnd);
89 77
90 -#ifdef ENABLE_WINDOWS_REGISTRY  
91 - gboolean get_registry_handle(const gchar *group, HKEY *hKey, REGSAM samDesired);  
92 - void registry_foreach(HKEY parent, const gchar *name,void (*cbk)(const gchar *key, const gchar *val, gpointer *user_data), gpointer *user_data);  
93 - void registry_set_double(HKEY hKey, const gchar *key, gdouble value);  
94 - gboolean registry_get_double(HKEY hKey, const gchar *key, gdouble *value);  
95 -#else  
96 - GKeyFile * get_application_keyfile(void);  
97 -#endif // ENABLE_WINDOWS_REGISTRY 78 + #ifdef ENABLE_WINDOWS_REGISTRY
  79 + gboolean get_registry_handle(const gchar *group, HKEY *hKey, REGSAM samDesired);
  80 + void registry_foreach(HKEY parent, const gchar *name,void (*cbk)(const gchar *key, const gchar *val, gpointer *user_data), gpointer *user_data);
  81 + void registry_set_double(HKEY hKey, const gchar *key, gdouble value);
  82 + gboolean registry_get_double(HKEY hKey, const gchar *key, gdouble *value);
  83 + #else
  84 + GKeyFile * get_application_keyfile(void);
  85 + #endif // ENABLE_WINDOWS_REGISTRY
98 86
99 87
100 #endif 88 #endif
src/pw3270/common/config.c
@@ -29,6 +29,12 @@ @@ -29,6 +29,12 @@
29 * 29 *
30 */ 30 */
31 31
  32 +#ifdef _WIN32
  33 + #include <windows.h>
  34 +#endif // _WIN32
  35 +
  36 + #include <config.h>
  37 +
32 #define ENABLE_NLS 38 #define ENABLE_NLS
33 #define GETTEXT_PACKAGE PACKAGE_NAME 39 #define GETTEXT_PACKAGE PACKAGE_NAME
34 40
@@ -40,7 +46,7 @@ @@ -40,7 +46,7 @@
40 #include <stdarg.h> 46 #include <stdarg.h>
41 #include <glib/gstdio.h> 47 #include <glib/gstdio.h>
42 48
43 -#ifdef WIN32 49 +#ifdef _WIN32
44 50
45 #include <windows.h> 51 #include <windows.h>
46 52
@@ -52,7 +58,7 @@ @@ -52,7 +58,7 @@
52 #define KEY_WOW64_32KEY 0x0200 58 #define KEY_WOW64_32KEY 0x0200
53 #endif // KEY_WOW64_64KEY 59 #endif // KEY_WOW64_64KEY
54 60
55 -#endif // WIN32 61 +#endif // _WIN32
56 62
57 /*--[ Globals ]--------------------------------------------------------------------------------------*/ 63 /*--[ Globals ]--------------------------------------------------------------------------------------*/
58 64
@@ -189,6 +195,7 @@ @@ -189,6 +195,7 @@
189 195
190 196
191 #else 197 #else
  198 +
192 static gchar * search_for_ini(void) 199 static gchar * search_for_ini(void)
193 { 200 {
194 static const gchar * (*dir[])(void) = 201 static const gchar * (*dir[])(void) =
src/pw3270/dialog.c
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 #include "globals.h" 33 #include "globals.h"
34 #include <v3270.h> 34 #include <v3270.h>
35 35
36 - #if defined WIN32 36 + #ifdef _WIN32
37 #include <gdk/gdkwin32.h> 37 #include <gdk/gdkwin32.h>
38 38
39 struct file { 39 struct file {
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 }; 45 };
46 46
47 47
48 - #endif // WIN32 48 + #endif // _WIN32
49 49
50 #if defined(HAVE_LIBSSL) 50 #if defined(HAVE_LIBSSL)
51 #include <openssl/ssl.h> 51 #include <openssl/ssl.h>
@@ -579,7 +579,7 @@ @@ -579,7 +579,7 @@
579 g_free(info); 579 g_free(info);
580 } 580 }
581 581
582 -#ifdef WIN32 582 +#ifdef _WIN32
583 static gpointer select_file(struct file *fl) { 583 static gpointer select_file(struct file *fl) {
584 584
585 585
@@ -722,7 +722,7 @@ static gpointer select_file(struct file *fl) { @@ -722,7 +722,7 @@ static gpointer select_file(struct file *fl) {
722 } 722 }
723 723
724 gtk_widget_destroy(dialog); 724 gtk_widget_destroy(dialog);
725 -#endif // WIN32 725 +#endif // _WIN32
726 726
727 if(filename && *filename) 727 if(filename && *filename)
728 set_string_to_config("files",name,"%s",filename); 728 set_string_to_config("files",name,"%s",filename);
src/pw3270/main.c
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 31
32 #include <config.h> 32 #include <config.h>
33 33
34 -#if defined( _WIN32 ) 34 +#ifdef _WIN32
35 #include <windows.h> 35 #include <windows.h>
36 #endif // _WIN32 36 #endif // _WIN32
37 37
@@ -237,6 +237,10 @@ int main(int argc, char *argv[]) @@ -237,6 +237,10 @@ int main(int argc, char *argv[])
237 { 237 {
238 const gchar * pluginpath = NULL; 238 const gchar * pluginpath = NULL;
239 239
  240 +#ifdef _WIN32
  241 + const char * app_name = PACKAGE_NAME;
  242 +#endif // _WIN32
  243 +
240 #ifdef DEFAULT_SESSION_NAME 244 #ifdef DEFAULT_SESSION_NAME
241 const gchar * session_name = G_STRINGIFY(DEFAULT_SESSION_NAME); 245 const gchar * session_name = G_STRINGIFY(DEFAULT_SESSION_NAME);
242 #else 246 #else
@@ -263,8 +267,6 @@ int main(int argc, char *argv[]) @@ -263,8 +267,6 @@ int main(int argc, char *argv[])
263 g_autofree gchar * appdir = g_win32_get_package_installation_directory_of_module(NULL); 267 g_autofree gchar * appdir = g_win32_get_package_installation_directory_of_module(NULL);
264 g_autofree gchar * locdir = g_build_filename(appdir,"locale",NULL); 268 g_autofree gchar * locdir = g_build_filename(appdir,"locale",NULL);
265 269
266 - g_set_application_name(PACKAGE_NAME);  
267 -  
268 trace("appdir=\"%s\"",appdir); 270 trace("appdir=\"%s\"",appdir);
269 trace("locdir=\"%s\"",locdir); 271 trace("locdir=\"%s\"",locdir);
270 272
@@ -341,6 +343,7 @@ int main(int argc, char *argv[]) @@ -341,6 +343,7 @@ int main(int argc, char *argv[])
341 } 343 }
342 #else 344 #else
343 { 345 {
  346 + #error aqui
344 bind_textdomain_codeset(PACKAGE_NAME, "UTF-8"); 347 bind_textdomain_codeset(PACKAGE_NAME, "UTF-8");
345 textdomain(PACKAGE_NAME); 348 textdomain(PACKAGE_NAME);
346 } 349 }
@@ -351,27 +354,31 @@ int main(int argc, char *argv[]) @@ -351,27 +354,31 @@ int main(int argc, char *argv[])
351 const GOptionEntry app_options[] = 354 const GOptionEntry app_options[] =
352 { 355 {
353 #ifdef DEFAULT_SESSION_NAME 356 #ifdef DEFAULT_SESSION_NAME
354 - { "session", 's', 0, G_OPTION_ARG_STRING, &session_name, N_( "Session name" ), G_STRINGIFY(DEFAULT_SESSION_NAME) }, 357 + { "session", 's', 0, G_OPTION_ARG_STRING, &session_name, N_( "Session name" ), G_STRINGIFY(DEFAULT_SESSION_NAME) },
355 #else 358 #else
356 - { "session", 's', 0, G_OPTION_ARG_STRING, &session_name, N_( "Session name" ), PACKAGE_NAME }, 359 + { "session", 's', 0, G_OPTION_ARG_STRING, &session_name, N_( "Session name" ), PACKAGE_NAME },
357 #endif // DEFAULT_SESSION_NAME 360 #endif // DEFAULT_SESSION_NAME
358 361
359 - { "host", 'h', 0, G_OPTION_ARG_STRING, &host, N_( "Host to connect"), host },  
360 - { "colors", 'c', 0, G_OPTION_ARG_CALLBACK, optcolors, N_( "Set reported colors (8/16)" ), "16" },  
361 - { "systype", 't', 0, G_OPTION_ARG_STRING, &systype, N_( "Host system type" ), "S390" },  
362 - { "toggleset", 'S', 0, G_OPTION_ARG_STRING, &toggleset, N_( "Set toggles ON" ), NULL },  
363 - { "togglereset", 'R', 0, G_OPTION_ARG_STRING, &togglereset, N_( "Set toggles OFF" ), NULL },  
364 - { "charset", 'C', 0, G_OPTION_ARG_STRING, &charset, N_( "Set host charset" ), NULL },  
365 - { "remap", 'm', 0, G_OPTION_ARG_FILENAME, &remap, N_( "Remap charset from xml file" ), NULL },  
366 - { "model", 'M', 0, G_OPTION_ARG_STRING, &model, N_( "The model of 3270 display to be emulated" ), NULL },  
367 - { "autodisconnect", 'D', 0, G_OPTION_ARG_INT, &timer, N_( "Minutes for auto-disconnect" ), 0 },  
368 - { "pluginpath", 'P', 0, G_OPTION_ARG_STRING, &pluginpath, N_( "Path for plugin files" ), NULL }, 362 + { "host", 'h', 0, G_OPTION_ARG_STRING, &host, N_( "Host to connect"), host },
  363 + { "colors", 'c', 0, G_OPTION_ARG_CALLBACK, optcolors, N_( "Set reported colors (8/16)" ), "16" },
  364 + { "systype", 't', 0, G_OPTION_ARG_STRING, &systype, N_( "Host system type" ), "S390" },
  365 + { "toggleset", 'S', 0, G_OPTION_ARG_STRING, &toggleset, N_( "Set toggles ON" ), NULL },
  366 + { "togglereset", 'R', 0, G_OPTION_ARG_STRING, &togglereset, N_( "Set toggles OFF" ), NULL },
  367 + { "charset", 'C', 0, G_OPTION_ARG_STRING, &charset, N_( "Set host charset" ), NULL },
  368 + { "remap", 'm', 0, G_OPTION_ARG_FILENAME, &remap, N_( "Remap charset from xml file" ), NULL },
  369 + { "model", 'M', 0, G_OPTION_ARG_STRING, &model, N_( "The model of 3270 display to be emulated" ), NULL },
  370 + { "autodisconnect", 'D', 0, G_OPTION_ARG_INT, &timer, N_( "Minutes for auto-disconnect" ), 0 },
  371 + { "pluginpath", 'P', 0, G_OPTION_ARG_STRING, &pluginpath, N_( "Path for plugin files" ), NULL },
  372 +
  373 +#ifdef _WIN32
  374 + { "application-name", 'A', 0, G_OPTION_ARG_STRING, &app_name, N_( "Application name" ), PACKAGE_NAME },
  375 +#endif // _WIN32
369 376
370 #if defined( HAVE_SYSLOG ) 377 #if defined( HAVE_SYSLOG )
371 - { "syslog", 'l', 0, G_OPTION_ARG_NONE, &log_to_syslog, N_( "Send messages to syslog" ), NULL }, 378 + { "syslog", 'l', 0, G_OPTION_ARG_NONE, &log_to_syslog, N_( "Send messages to syslog" ), NULL },
372 #endif 379 #endif
373 - { "tracefile", 'T', 0, G_OPTION_ARG_FILENAME, &tracefile, N_( "Set trace filename" ), NULL },  
374 - { "log", 'L', 0, G_OPTION_ARG_FILENAME, &logfile, N_( "Log to file" ), NULL }, 380 + { "tracefile", 'T', 0, G_OPTION_ARG_FILENAME, &tracefile, N_( "Set trace filename" ), NULL },
  381 + { "log", 'L', 0, G_OPTION_ARG_FILENAME, &logfile, N_( "Log to file" ), NULL },
375 382
376 { NULL } 383 { NULL }
377 }; 384 };
@@ -413,6 +420,10 @@ int main(int argc, char *argv[]) @@ -413,6 +420,10 @@ int main(int argc, char *argv[])
413 } 420 }
414 } 421 }
415 422
  423 +#ifdef _WIN32
  424 + g_set_application_name(app_name);
  425 +#endif // _WIN32
  426 +
416 // Init GTK 427 // Init GTK
417 gtk_init(&argc, &argv); 428 gtk_init(&argc, &argv);
418 429
src/pw3270/plugin.c
@@ -45,9 +45,9 @@ @@ -45,9 +45,9 @@
45 const gchar * name; 45 const gchar * name;
46 GError * err = NULL; 46 GError * err = NULL;
47 GList * lst = NULL; 47 GList * lst = NULL;
48 -#ifdef WIN32 48 +#ifdef _WIN32
49 UINT errorMode; 49 UINT errorMode;
50 -#endif // WIN32 50 +#endif // _WIN32
51 51
52 52
53 trace("Loading plugins from %s",path); 53 trace("Loading plugins from %s",path);
@@ -63,11 +63,11 @@ @@ -63,11 +63,11 @@
63 return; 63 return;
64 } 64 }
65 65
66 -#ifdef WIN32 66 +#ifdef _WIN32
67 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621(v=vs.85).aspx 67 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621(v=vs.85).aspx
68 errorMode = SetErrorMode(1); 68 errorMode = SetErrorMode(1);
69 SetErrorMode(errorMode); 69 SetErrorMode(errorMode);
70 -#endif // WIN32 70 +#endif // _WIN32
71 71
72 name = g_dir_read_name(dir); 72 name = g_dir_read_name(dir);
73 while(name) 73 while(name)
@@ -133,9 +133,9 @@ @@ -133,9 +133,9 @@
133 name = g_dir_read_name(dir); 133 name = g_dir_read_name(dir);
134 } 134 }
135 135
136 -#ifdef WIN32 136 +#ifdef _WIN32
137 SetErrorMode(errorMode); 137 SetErrorMode(errorMode);
138 -#endif // WIN32 138 +#endif // _WIN32
139 139
140 g_dir_close(dir); 140 g_dir_close(dir);
141 141
src/pw3270/print.c
@@ -199,7 +199,7 @@ @@ -199,7 +199,7 @@
199 } 199 }
200 } 200 }
201 201
202 -#ifdef WIN32 202 +#ifdef _WIN32
203 203
204 #define save_string(h,k,v) save_settings(k,v,h) 204 #define save_string(h,k,v) save_settings(k,v,h)
205 #define save_double(h,k,v) registry_set_double(h,k,v) 205 #define save_double(h,k,v) registry_set_double(h,k,v)
@@ -233,7 +233,7 @@ static gchar * enum_to_string(GType type, guint enum_value) @@ -233,7 +233,7 @@ static gchar * enum_to_string(GType type, guint enum_value)
233 return retval; 233 return retval;
234 } 234 }
235 235
236 -#endif // WIN32 236 +#endif // _WIN32
237 237
238 static void show_print_error(GtkWidget *widget, GError *err) 238 static void show_print_error(GtkWidget *widget, GError *err)
239 { 239 {
@@ -555,7 +555,7 @@ static gchar * enum_to_string(GType type, guint enum_value) @@ -555,7 +555,7 @@ static gchar * enum_to_string(GType type, guint enum_value)
555 555
556 } 556 }
557 557
558 -#ifdef WIN32 558 +#ifdef _WIN32
559 void update_settings(const gchar *key, const gchar *val, gpointer *settings) 559 void update_settings(const gchar *key, const gchar *val, gpointer *settings)
560 { 560 {
561 trace("%s: %s=\"%s\"",__FUNCTION__,key,val); 561 trace("%s: %s=\"%s\"",__FUNCTION__,key,val);
@@ -586,7 +586,7 @@ static gchar * enum_to_string(GType type, guint enum_value) @@ -586,7 +586,7 @@ static gchar * enum_to_string(GType type, guint enum_value)
586 } 586 }
587 } 587 }
588 588
589 -#endif // WIN32 589 +#endif // _WIN32
590 590
591 static GtkPrintOperation * begin_print_operation(GObject *obj, GtkWidget *widget, PRINT_INFO **info) 591 static GtkPrintOperation * begin_print_operation(GObject *obj, GtkWidget *widget, PRINT_INFO **info)
592 { 592 {
@@ -621,7 +621,7 @@ static gchar * enum_to_string(GType type, guint enum_value) @@ -621,7 +621,7 @@ static gchar * enum_to_string(GType type, guint enum_value)
621 g_signal_connect(print,"custom-widget-apply",G_CALLBACK(custom_widget_apply), *info); 621 g_signal_connect(print,"custom-widget-apply",G_CALLBACK(custom_widget_apply), *info);
622 #else 622 #else
623 load_settings(*info); 623 load_settings(*info);
624 -#endif // WIN32 624 +#endif // _WIN32
625 625
626 // Load page and print settings 626 // Load page and print settings
627 { 627 {
src/pw3270/tools.c
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 #include "globals.h" 30 #include "globals.h"
31 #include <lib3270/charset.h> 31 #include <lib3270/charset.h>
32 32
33 -#if defined WIN32 33 +#ifdef _WIN32
34 BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd); 34 BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd);
35 35
36 static int libpw3270_loaded(void); 36 static int libpw3270_loaded(void);
@@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
43 43
44 /*--[ Implement ]------------------------------------------------------------------------------------*/ 44 /*--[ Implement ]------------------------------------------------------------------------------------*/
45 45
46 -#if defined WIN32 46 +#ifdef _WIN32
47 47
48 BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd) 48 BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd)
49 { 49 {
@@ -63,7 +63,7 @@ BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd) @@ -63,7 +63,7 @@ BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd)
63 return TRUE; 63 return TRUE;
64 } 64 }
65 65
66 -#endif // WIN32 66 +#endif // _WIN32
67 67
68 int libpw3270_loaded(void) 68 int libpw3270_loaded(void)
69 { 69 {
src/pw3270/uiparser/parsefile.c
@@ -173,7 +173,7 @@ @@ -173,7 +173,7 @@
173 name = ui_get_attribute("platform",names,values); 173 name = ui_get_attribute("platform",names,values);
174 if(name) 174 if(name)
175 { 175 {
176 -#if defined(WIN32) 176 +#if defined(_WIN32)
177 static const gchar *platname = "windows"; 177 static const gchar *platname = "windows";
178 #elif defined(linux) 178 #elif defined(linux)
179 static const gchar *platname = "linux"; 179 static const gchar *platname = "linux";