[Box Backup-commit] COMMIT r1131 - box/trunk/lib/win32
boxbackup-dev at fluffy.co.uk
boxbackup-dev at fluffy.co.uk
Fri Oct 27 20:25:12 BST 2006
Author: chris
Date: 2006-10-27 20:25:12 +0100 (Fri, 27 Oct 2006)
New Revision: 1131
Modified:
box/trunk/lib/win32/emu.cpp
box/trunk/lib/win32/emu.h
Log:
Removed last vestiges of old getopt().
Modified: box/trunk/lib/win32/emu.cpp
===================================================================
--- box/trunk/lib/win32/emu.cpp 2006-10-27 19:24:26 UTC (rev 1130)
+++ box/trunk/lib/win32/emu.cpp 2006-10-27 19:25:12 UTC (rev 1131)
@@ -561,15 +561,6 @@
return hdir;
}
-// MinGW provides a getopt implementation
-#ifndef __MINGW32__
-//works with getopt
-char *optarg;
-//optind looks like an index into the string - how far we have moved along
-int optind = 1;
-char nextchar = -1;
-#endif
-
// --------------------------------------------------------------------------
//
// Function
Modified: box/trunk/lib/win32/emu.h
===================================================================
--- box/trunk/lib/win32/emu.h 2006-10-27 19:24:26 UTC (rev 1130)
+++ box/trunk/lib/win32/emu.h 2006-10-27 19:25:12 UTC (rev 1131)
@@ -216,59 +216,7 @@
// 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
More information about the Boxbackup-commit
mailing list