aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qpdf.cc
diff options
context:
space:
mode:
Diffstat (limited to 'qpdf/qpdf.cc')
-rw-r--r--qpdf/qpdf.cc28
1 files changed, 3 insertions, 25 deletions
diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc
index 7bf41936..12053cbe 100644
--- a/qpdf/qpdf.cc
+++ b/qpdf/qpdf.cc
@@ -4,10 +4,6 @@
#include <stdlib.h>
#include <fcntl.h>
-#ifdef _WIN32
-# include <io.h>
-#endif
-
#include <qpdf/QUtil.hh>
#include <qpdf/QTC.hh>
#include <qpdf/Pl_StdioFile.hh>
@@ -20,7 +16,7 @@
static int const EXIT_ERROR = 2;
static int const EXIT_WARNING = 3;
-static char* whoami = 0;
+static char const* whoami = 0;
// Note: let's not be too noisy about documenting the fact that this
// software purposely fails to enforce the distinction between user
@@ -434,26 +430,8 @@ parse_encrypt_options(
int main(int argc, char* argv[])
{
-#ifdef _WIN32
- char pathsep = '\\';
-#else
- char pathsep = '/';
-#endif
- if ((whoami = strrchr(argv[0], pathsep)) == NULL)
- {
- whoami = argv[0];
- }
- else
- {
- ++whoami;
- }
-#ifdef _WIN32
- if ((strlen(whoami) > 4) &&
- (strcmp(whoami + strlen(whoami) - 4, ".exe") == 0))
- {
- whoami[strlen(whoami) - 4] = '\0';
- }
-#endif
+ whoami = QUtil::getWhoami(argv[0]);
+
// For libtool's sake....
if (strncmp(whoami, "lt-", 3) == 0)
{