summaryrefslogtreecommitdiff
path: root/cpp/src/IcePatch2/Client.cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2004-11-30 00:57:46 +0000
committerMarc Laukien <marc@zeroc.com>2004-11-30 00:57:46 +0000
commit073feb05ef222089105e8c50774c47af101fa52b (patch)
tree4effcda6f5320b1e356a5d383edc35b8bbb1a800 /cpp/src/IcePatch2/Client.cpp
parenttrivial fix (diff)
downloadice-073feb05ef222089105e8c50774c47af101fa52b.tar.bz2
ice-073feb05ef222089105e8c50774c47af101fa52b.tar.xz
ice-073feb05ef222089105e8c50774c47af101fa52b.zip
IcePatch2 for WIN32
Diffstat (limited to 'cpp/src/IcePatch2/Client.cpp')
-rw-r--r--cpp/src/IcePatch2/Client.cpp27
1 files changed, 24 insertions, 3 deletions
diff --git a/cpp/src/IcePatch2/Client.cpp b/cpp/src/IcePatch2/Client.cpp
index 1b544f896be..e1fc67d76b1 100644
--- a/cpp/src/IcePatch2/Client.cpp
+++ b/cpp/src/IcePatch2/Client.cpp
@@ -10,8 +10,13 @@
#include <Ice/Application.h>
#include <IcePatch2/Util.h>
#include <IcePatch2/ClientUtil.h>
-#include <fcntl.h>
-#include <termios.h>
+
+#ifdef _WIN32
+# include <conio.h>
+#else
+# include <fcntl.h>
+# include <termios.h>
+#endif
using namespace std;
using namespace Ice;
@@ -40,6 +45,7 @@ public:
TextPatcherFeedback()
{
+#ifndef _WIN32
tcgetattr(0, &_savedTerm);
termios term;
memcpy(&term, &_savedTerm, sizeof(termios));
@@ -52,12 +58,15 @@ public:
int flags = _savedFlags;
flags |= O_NONBLOCK;
fcntl(0, F_SETFL, flags);
+#endif
}
virtual ~TextPatcherFeedback()
{
+#ifndef _WIN32
tcsetattr(0, TCSANOW, &_savedTerm);
fcntl(0, F_SETFL, _savedFlags);
+#endif
}
virtual bool
@@ -76,6 +85,7 @@ public:
}
}
while(answer != "yes");
+ cout << "Calculating checksums -- please wait, this might take awhile..." << endl;
return true;
}
@@ -146,17 +156,28 @@ private:
keyPressed()
{
bool pressed = false;
+#ifdef _WIN32
+ while(_kbhit())
+ {
+ pressed = true;
+ _getch();
+ }
+#else
char c;
while(read(0, &c, 1) > 0)
{
pressed = true;
}
+#endif
return pressed;
}
string _lastProgress;
+
+#ifndef _WIN32
termios _savedTerm;
int _savedFlags;
+#endif
};
int
@@ -205,7 +226,7 @@ IcePatch2::Client::run(int argc, char* argv[])
}
}
- bool patchComplete;
+ bool patchComplete = false;
try
{