diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..0d3d01e --- /dev/null +++ b/build.bat @@ -0,0 +1,2 @@ +@echo off +nmake /f win\Makefile.msc diff --git a/src/core/get.cc b/src/core/get.cc index f29efd1..828dcb0 100644 --- a/src/core/get.cc +++ b/src/core/get.cc @@ -69,7 +69,7 @@ size_t length = strlen(buffer); string contents = host.toString( (unsigned int) row, (unsigned int) col, (int) length); - strncpy((char *) buffer, contents.c_str(), std::min(length,contents.size())); + strncpy((char *) buffer, contents.c_str(), min(length,contents.size())); }); @@ -92,7 +92,7 @@ string contents = host.toString((int) offset, (int) len); memset(buffer,' ',len); - strncpy((char *) buffer, contents.c_str(), std::min((size_t) len,contents.size())); + strncpy((char *) buffer, contents.c_str(), min((size_t) len,contents.size())); }); } @@ -113,7 +113,7 @@ string luname = host.getAssociatedLUName(); memset(buffer,' ',len); - strncpy((char *) buffer, luname.c_str(), std::min((size_t) len,luname.size())); + strncpy((char *) buffer, luname.c_str(), min((size_t) len,luname.size())); }); diff --git a/src/core/hllapi.cc b/src/core/hllapi.cc index e05debc..1cc5367 100644 --- a/src/core/hllapi.cc +++ b/src/core/hllapi.cc @@ -27,6 +27,11 @@ * */ +#if defined(_MSC_VER) + #define strncasecmp _strnicmp + #define strcasecmp _stricmp + #endif + #include "private.h" #include @@ -315,7 +320,7 @@ static int copy_ps(char *buffer, unsigned short *length, unsigned short GNUC_UNU string contents = host.toString(0,-1,'\0'); - size_t szBuffer = std::min(contents.size(), ((size_t) *length)); + size_t szBuffer = min(contents.size(), ((size_t) *length)); *length = (unsigned short) szBuffer; strncpy(buffer,contents.c_str(),szBuffer); diff --git a/src/core/private.h b/src/core/private.h index 574092d..8239ecb 100644 --- a/src/core/private.h +++ b/src/core/private.h @@ -31,7 +31,10 @@ #define PRIVATE_H_INCLUDED 1 +#ifndef _MSC_VER #include +#endif // !_MSC_VER + #include #include #include diff --git a/src/core/windows/init.cc b/src/core/windows/init.cc index 5e98358..c77476c 100644 --- a/src/core/windows/init.cc +++ b/src/core/windows/init.cc @@ -36,7 +36,11 @@ * */ - #include +#ifndef _MSC_VER + #include + #pragma comment(lib,"Advapi32.lib") +#endif // !_MSC_VER + #include #include #include "../private.h" diff --git a/src/testprogram/testprogram.cc b/src/testprogram/testprogram.cc index 2f551b2..7f494d2 100644 --- a/src/testprogram/testprogram.cc +++ b/src/testprogram/testprogram.cc @@ -28,12 +28,20 @@ */ #include - #include #include #include + #include #include #include + #if defined(_MSC_VER) + #pragma comment(lib,"hllapi.lib") + #define strncasecmp _strnicmp + #define strcasecmp _stricmp + #else + #include + #endif + #define SCREEN_LENGTH 2000 using namespace std; @@ -47,6 +55,8 @@ const char *host = ""; const char *session = ":a"; + #if ! defined(_MSC_VER) + #pragma GCC diagnostic push static struct option options[] = { @@ -75,6 +85,8 @@ } + #endif // ! defined(_MSC_VER) + int rc = hllapi_init((char *) session); if(rc) { cout << "hllapi_init returns with rc=" << rc << " (" << hllapi_get_last_error() << ")" << endl; @@ -88,7 +100,7 @@ cout.flush(); string cmdline; - while(std::getline(std::cin, cmdline)) { + while(getline(cin, cmdline)) { if(cmdline.empty()) break; diff --git a/win/Makefile.msc b/win/Makefile.msc index fd865c3..af264c4 100644 --- a/win/Makefile.msc +++ b/win/Makefile.msc @@ -60,17 +60,32 @@ testprogram.exe: \ @link \ /nologo \ /OUT:"$@" \ + /LIBPATH:"$(PW3270_SDK_PATH)\lib" \ src\testprogram\testprogram.obj hllapi.dll: \ - $(OBJ_FILES) \ + $(OBJ_FILES) @echo Build dll file.... link \ /NOLOGO \ /DLL \ /OUT:"$@" \ + /LIBPATH:"$(PW3270_SDK_PATH)\lib" \ $(OBJ_FILES) \ - $(PW3270_SDK_PATH)\lib\ipc3270.lib + "ipc3270.lib \ + Advapi32.lib + +install: \ + $(OBJ_FILES) + @echo Building library... + @-mkdir "$(PW3270_SDK_PATH)\lib" + @lib \ + /NOLOGO \ + /OUT:"$(PW3270_SDK_PATH)\lib\hllapi.lib" \ + $(OBJ_FILES) + + @-mkdir "$(PW3270_SDK_PATH)\include\lib3270" + @copy "src\include\lib3270\*.h" "$(PW3270_SDK_PATH)\include\lib3270" clean: del \ -- libgit2 0.21.2