summaryrefslogtreecommitdiffstats
path: root/qpdf/qpdf.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2009-07-15 05:47:44 +0200
committerJay Berkenbilt <ejb@ql.org>2009-07-15 05:47:44 +0200
commita1c0aaf03adf0344b34dd591f9103479f249e965 (patch)
treeb7d801e15d733791b47328349abd86f0317ce207 /qpdf/qpdf.cc
parent7acc0498ebfe13c48ecbaee718537a4c088cca5e (diff)
downloadqpdf-a1c0aaf03adf0344b34dd591f9103479f249e965.tar.zst
windows fixes
git-svn-id: svn+q:///qpdf/trunk@684 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'qpdf/qpdf.cc')
-rw-r--r--qpdf/qpdf.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc
index 90025f46..7bf41936 100644
--- a/qpdf/qpdf.cc
+++ b/qpdf/qpdf.cc
@@ -2,6 +2,11 @@
#include <iostream>
#include <string.h>
#include <stdlib.h>
+#include <fcntl.h>
+
+#ifdef _WIN32
+# include <io.h>
+#endif
#include <qpdf/QUtil.hh>
#include <qpdf/QTC.hh>
@@ -15,7 +20,7 @@
static int const EXIT_ERROR = 2;
static int const EXIT_WARNING = 3;
-static char const* whoami = 0;
+static char* whoami = 0;
// Note: let's not be too noisy about documenting the fact that this
// software purposely fails to enforce the distinction between user
@@ -429,7 +434,12 @@ parse_encrypt_options(
int main(int argc, char* argv[])
{
- if ((whoami = strrchr(argv[0], '/')) == NULL)
+#ifdef _WIN32
+ char pathsep = '\\';
+#else
+ char pathsep = '/';
+#endif
+ if ((whoami = strrchr(argv[0], pathsep)) == NULL)
{
whoami = argv[0];
}
@@ -437,6 +447,13 @@ int main(int argc, char* argv[])
{
++whoami;
}
+#ifdef _WIN32
+ if ((strlen(whoami) > 4) &&
+ (strcmp(whoami + strlen(whoami) - 4, ".exe") == 0))
+ {
+ whoami[strlen(whoami) - 4] = '\0';
+ }
+#endif
// For libtool's sake....
if (strncmp(whoami, "lt-", 3) == 0)
{
@@ -790,6 +807,7 @@ int main(int argc, char* argv[])
}
else
{
+ QUtil::binary_stdout();
Pl_StdioFile out("stdout", stdout);
obj.pipeStreamData(&out, filter, normalize, false);
}