Commit 3a72fb9226dd99fc9af996154a0210fc018d7ab8
1 parent
8fa946b5
Exists in
master
and in
1 other branch
Building with msvc.
Showing
7 changed files
with
50 additions
and
9 deletions
Show diff stats
src/core/get.cc
... | ... | @@ -69,7 +69,7 @@ |
69 | 69 | size_t length = strlen(buffer); |
70 | 70 | string contents = host.toString( (unsigned int) row, (unsigned int) col, (int) length); |
71 | 71 | |
72 | - strncpy((char *) buffer, contents.c_str(), std::min(length,contents.size())); | |
72 | + strncpy((char *) buffer, contents.c_str(), min(length,contents.size())); | |
73 | 73 | |
74 | 74 | }); |
75 | 75 | |
... | ... | @@ -92,7 +92,7 @@ |
92 | 92 | string contents = host.toString((int) offset, (int) len); |
93 | 93 | |
94 | 94 | memset(buffer,' ',len); |
95 | - strncpy((char *) buffer, contents.c_str(), std::min((size_t) len,contents.size())); | |
95 | + strncpy((char *) buffer, contents.c_str(), min((size_t) len,contents.size())); | |
96 | 96 | |
97 | 97 | }); |
98 | 98 | } |
... | ... | @@ -113,7 +113,7 @@ |
113 | 113 | |
114 | 114 | string luname = host.getAssociatedLUName(); |
115 | 115 | memset(buffer,' ',len); |
116 | - strncpy((char *) buffer, luname.c_str(), std::min((size_t) len,luname.size())); | |
116 | + strncpy((char *) buffer, luname.c_str(), min((size_t) len,luname.size())); | |
117 | 117 | |
118 | 118 | }); |
119 | 119 | ... | ... |
src/core/hllapi.cc
... | ... | @@ -27,6 +27,11 @@ |
27 | 27 | * |
28 | 28 | */ |
29 | 29 | |
30 | +#if defined(_MSC_VER) | |
31 | + #define strncasecmp _strnicmp | |
32 | + #define strcasecmp _stricmp | |
33 | + #endif | |
34 | + | |
30 | 35 | #include "private.h" |
31 | 36 | #include <lib3270/hllapi.h> |
32 | 37 | |
... | ... | @@ -315,7 +320,7 @@ static int copy_ps(char *buffer, unsigned short *length, unsigned short GNUC_UNU |
315 | 320 | |
316 | 321 | string contents = host.toString(0,-1,'\0'); |
317 | 322 | |
318 | - size_t szBuffer = std::min(contents.size(), ((size_t) *length)); | |
323 | + size_t szBuffer = min(contents.size(), ((size_t) *length)); | |
319 | 324 | *length = (unsigned short) szBuffer; |
320 | 325 | |
321 | 326 | strncpy(buffer,contents.c_str(),szBuffer); | ... | ... |
src/core/private.h
src/core/windows/init.cc
src/testprogram/testprogram.cc
... | ... | @@ -28,12 +28,20 @@ |
28 | 28 | */ |
29 | 29 | |
30 | 30 | #include <iostream> |
31 | - #include <getopt.h> | |
32 | 31 | #include <cstring> |
33 | 32 | #include <cstdio> |
33 | + #include <string> | |
34 | 34 | #include <ctime> |
35 | 35 | #include <lib3270/hllapi.h> |
36 | 36 | |
37 | + #if defined(_MSC_VER) | |
38 | + #pragma comment(lib,"hllapi.lib") | |
39 | + #define strncasecmp _strnicmp | |
40 | + #define strcasecmp _stricmp | |
41 | + #else | |
42 | + #include <getopt.h> | |
43 | + #endif | |
44 | + | |
37 | 45 | #define SCREEN_LENGTH 2000 |
38 | 46 | |
39 | 47 | using namespace std; |
... | ... | @@ -47,6 +55,8 @@ |
47 | 55 | const char *host = ""; |
48 | 56 | const char *session = ":a"; |
49 | 57 | |
58 | + #if ! defined(_MSC_VER) | |
59 | + | |
50 | 60 | #pragma GCC diagnostic push |
51 | 61 | static struct option options[] = |
52 | 62 | { |
... | ... | @@ -75,6 +85,8 @@ |
75 | 85 | |
76 | 86 | } |
77 | 87 | |
88 | + #endif // ! defined(_MSC_VER) | |
89 | + | |
78 | 90 | int rc = hllapi_init((char *) session); |
79 | 91 | if(rc) { |
80 | 92 | cout << "hllapi_init returns with rc=" << rc << " (" << hllapi_get_last_error() << ")" << endl; |
... | ... | @@ -88,7 +100,7 @@ |
88 | 100 | cout.flush(); |
89 | 101 | |
90 | 102 | string cmdline; |
91 | - while(std::getline(std::cin, cmdline)) { | |
103 | + while(getline(cin, cmdline)) { | |
92 | 104 | |
93 | 105 | if(cmdline.empty()) |
94 | 106 | break; | ... | ... |
win/Makefile.msc
... | ... | @@ -60,17 +60,32 @@ testprogram.exe: \ |
60 | 60 | @link \ |
61 | 61 | /nologo \ |
62 | 62 | /OUT:"$@" \ |
63 | + /LIBPATH:"$(PW3270_SDK_PATH)\lib" \ | |
63 | 64 | src\testprogram\testprogram.obj |
64 | 65 | |
65 | 66 | hllapi.dll: \ |
66 | - $(OBJ_FILES) \ | |
67 | + $(OBJ_FILES) | |
67 | 68 | @echo Build dll file.... |
68 | 69 | link \ |
69 | 70 | /NOLOGO \ |
70 | 71 | /DLL \ |
71 | 72 | /OUT:"$@" \ |
73 | + /LIBPATH:"$(PW3270_SDK_PATH)\lib" \ | |
72 | 74 | $(OBJ_FILES) \ |
73 | - $(PW3270_SDK_PATH)\lib\ipc3270.lib | |
75 | + "ipc3270.lib \ | |
76 | + Advapi32.lib | |
77 | + | |
78 | +install: \ | |
79 | + $(OBJ_FILES) | |
80 | + @echo Building library... | |
81 | + @-mkdir "$(PW3270_SDK_PATH)\lib" | |
82 | + @lib \ | |
83 | + /NOLOGO \ | |
84 | + /OUT:"$(PW3270_SDK_PATH)\lib\hllapi.lib" \ | |
85 | + $(OBJ_FILES) | |
86 | + | |
87 | + @-mkdir "$(PW3270_SDK_PATH)\include\lib3270" | |
88 | + @copy "src\include\lib3270\*.h" "$(PW3270_SDK_PATH)\include\lib3270" | |
74 | 89 | |
75 | 90 | clean: |
76 | 91 | del \ | ... | ... |