summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2006-09-04 00:06:56 +0000
committerChris Wilson <chris+github@qwirx.com>2006-09-04 00:06:56 +0000
commitcfbb24dbc08bcb0e506922d826808549fd107181 (patch)
treedefe19eead9ee06998a30597e06dce6026321ff4 /lib
parent98009bbda2550b7e6aa28fd53f3daaa14d6cd577 (diff)
(refs #3)
Remove more vestiges of old getopt
Diffstat (limited to 'lib')
-rw-r--r--lib/win32/emu.h54
1 files changed, 1 insertions, 53 deletions
diff --git a/lib/win32/emu.h b/lib/win32/emu.h
index 69daaa67..a861d3b9 100644
--- a/lib/win32/emu.h
+++ b/lib/win32/emu.h
@@ -227,59 +227,7 @@ inline int getuid(void)
// MinGW provides a getopt implementation
#ifndef __MINGW32__
-
-// this will need to be implemented if we see fit that command line
-// options are going to be used! (probably then:)
-// where the calling function looks for the parsed parameter
-extern char *optarg;
-
-// optind looks like an index into the string - how far we have moved along
-extern int optind;
-extern char nextchar;
-
-inline int getopt(int count, char * const * args, const char * tolookfor)
-{
- if (optind >= count) return -1;
-
- std::string str((const char *)args[optind]);
- std::string interestin(tolookfor);
- int opttolookfor = 0;
- int index = -1;
- // just initialize the string - just in case it is used.
- // optarg[0] = 0;
- std::string opt;
-
- if (count == 0) return -1;
-
- do
- {
- if (index != -1)
- {
- str = str.substr(index+1, str.size());
- }
-
- index = (int)str.find('-');
-
- if (index == -1) return -1;
-
- opt = str[1];
-
- optind ++;
- str = args[optind];
- }
- while ((opttolookfor = (int)interestin.find(opt)) == -1);
-
- if (interestin[opttolookfor+1] == ':')
- {
-
- // strcpy(optarg, str.c_str());
- optarg = args[optind];
- optind ++;
- }
-
- // indicate we have finished
- return opt[0];
-}
+#include "getopt.h"
#endif // !__MINGW32__
#define timespec timeval