summaryrefslogtreecommitdiff
path: root/tools/bootstrp/rscdep.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'tools/bootstrp/rscdep.cxx')
-rw-r--r--tools/bootstrp/rscdep.cxx59
1 files changed, 11 insertions, 48 deletions
diff --git a/tools/bootstrp/rscdep.cxx b/tools/bootstrp/rscdep.cxx
index 5c18793c9833..37edfc6a8c18 100644
--- a/tools/bootstrp/rscdep.cxx
+++ b/tools/bootstrp/rscdep.cxx
@@ -45,6 +45,16 @@
#include "cppdep.hxx"
+#if defined WNT
+#if !defined HAVE_GETOPT
+#define __STDC__ 1
+#define __GNU_LIBRARY__
+#include <external/glibc/getopt.h>
+#else
+#include <getopt.h>
+#endif
+#endif
+
class RscHrcDep : public CppDep
{
public:
@@ -70,15 +80,6 @@ void RscHrcDep::Execute()
//static String aDelim;
-/* poor man's getopt() */
-int simple_getopt(char *argv[], const char *optstring);
-#if defined(WNT) || defined(OS2)
-static char *optarg = NULL;
-static int optind = 1;
-static int optopt = 0;
-static int opterr = 0;
-#endif
-
SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
{
int c;
@@ -179,7 +180,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
while( 1 )
{
- c = simple_getopt( argv,
+ c = getopt( argc, argv,
"_abcdefghi:jklmnopqrstuvwxyzABCDEFGHI:JKLMNOPQRSTUVWXYZ1234567890/-+=.\\()\"");
if ( c == -1 )
break;
@@ -296,41 +297,3 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
return 0;
}
-/* my very simple minded implementation of getopt()
- * it's too sad that getopt() is not available everywhere
- * note: this is not a full POSIX conforming getopt()
- */
-int simple_getopt(char *argv[], const char *optstring)
-{
- char *arg = argv[optind];
-
- /* skip all response file arguments */
- if ( arg ) {
- while ( *arg == '@' )
- arg = argv[++optind];
-
- if ( arg[0] == '-' && arg[1] != '\0' ) {
- const char *popt;
- int c = arg[1];
- if ( (popt = strchr(optstring, c)) == NULL ) {
- optopt = c;
- if ( opterr )
- fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
- return '?';
- }
- if ( *(++popt) == ':') {
- if ( arg[2] != '\0' ) {
- optarg = ++arg;
- } else {
- optarg = argv[++optind];
- }
- } else {
- optarg = NULL;
- }
- ++optind;
- return c;
- }
- }
- return -1;
-}
-