diff options
author | Bjoern Michaelsen <b_michaelsen@openoffice.org> | 2010-07-13 14:36:24 +0200 |
---|---|---|
committer | Bjoern Michaelsen <b_michaelsen@openoffice.org> | 2010-07-13 14:36:24 +0200 |
commit | d6fff0796828dab5afb054e7ad3dd8c8c6ed8d52 (patch) | |
tree | 09721660070414d00cc2f83b19bf29892763c99e /tools/bootstrp | |
parent | 13650e71469d579a91f3de3eefa977e825567b57 (diff) | |
parent | be588658ea127a6a05390435126f1d739a477b58 (diff) |
CWS gnumake2: resync to DEV300_m84
Diffstat (limited to 'tools/bootstrp')
-rw-r--r-- | tools/bootstrp/makefile.mk | 9 | ||||
-rw-r--r-- | tools/bootstrp/rscdep.cxx | 67 |
2 files changed, 22 insertions, 54 deletions
diff --git a/tools/bootstrp/makefile.mk b/tools/bootstrp/makefile.mk index 1d16ed2aeec2..3db493cbe162 100644 --- a/tools/bootstrp/makefile.mk +++ b/tools/bootstrp/makefile.mk @@ -38,6 +38,10 @@ LIBTARGET=NO CDEFS+=-D_TOOLS_STRINGLIST +.IF "$(HAVE_GETOPT)" == "YES" +CDEFS += -DHAVE_GETOPT +.ENDIF + # --- Files -------------------------------------------------------- OBJFILES= \ @@ -71,6 +75,11 @@ APP2TARGET= rscdep APP2OBJS= $(OBJ)$/rscdep.obj APP2LIBS= $(LB)$/$(TARGET).lib $(LB)$/$(TARGET1).lib APP2STDLIBS= $(SALLIB) $(VOSLIB) $(TOOLSLIB) $(BASEGFXLIB) $(UCBHELPERLIB) $(CPPULIB) $(COMPHELPERLIB) $(I18NISOLANGLIB) $(CPPUHELPERLIB) $(SALHELPERLIB) +.IF "$(HAVE_GETOPT)" != "YES" +.IF "$(OS)"=="WNT" +APP2STDLIBS+=gnu_getopt.lib +.ENDIF +.ENDIF APP2RPATH= NONE APP2RPATH= NONE APP2RPATH= NONE diff --git a/tools/bootstrp/rscdep.cxx b/tools/bootstrp/rscdep.cxx index 35968654b5cd..37edfc6a8c18 100644 --- a/tools/bootstrp/rscdep.cxx +++ b/tools/bootstrp/rscdep.cxx @@ -36,6 +36,7 @@ #include <string.h> #include "bootstrp/prj.hxx" +#include "sal/main.h" #include <tools/string.hxx> #include <tools/list.hxx> @@ -44,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: @@ -69,21 +80,7 @@ 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 - - -int -#ifdef WNT -_cdecl -#endif -main( int argc, char **argv ) +SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv ) { int c; char aBuf[255]; @@ -183,7 +180,7 @@ main( int argc, char **argv ) while( 1 ) { - c = simple_getopt( argv, + c = getopt( argc, argv, "_abcdefghi:jklmnopqrstuvwxyzABCDEFGHI:JKLMNOPQRSTUVWXYZ1234567890/-+=.\\()\""); if ( c == -1 ) break; @@ -300,41 +297,3 @@ main( int argc, char **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; -} - |