Kaydet (Commit) 91da6e64 authored tarafından obo's avatar obo

CWS-TOOLING: integrate CWS systemlibc

...@@ -38,6 +38,10 @@ LIBTARGET=NO ...@@ -38,6 +38,10 @@ LIBTARGET=NO
CDEFS+=-D_TOOLS_STRINGLIST CDEFS+=-D_TOOLS_STRINGLIST
.IF "$(HAVE_GETOPT)" == "YES"
CDEFS += -DHAVE_GETOPT
.ENDIF
# --- Files -------------------------------------------------------- # --- Files --------------------------------------------------------
OBJFILES= \ OBJFILES= \
...@@ -83,6 +87,11 @@ APP2TARGET= rscdep ...@@ -83,6 +87,11 @@ APP2TARGET= rscdep
APP2OBJS= $(OBJ)$/rscdep.obj APP2OBJS= $(OBJ)$/rscdep.obj
APP2LIBS= $(LB)$/$(TARGET).lib $(LB)$/$(TARGET1).lib APP2LIBS= $(LB)$/$(TARGET).lib $(LB)$/$(TARGET1).lib
APP2STDLIBS= $(SALLIB) $(VOSLIB) $(TOOLSLIB) $(BASEGFXLIB) $(UCBHELPERLIB) $(CPPULIB) $(COMPHELPERLIB) $(I18NISOLANGLIB) $(CPPUHELPERLIB) $(SALHELPERLIB) 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 APP2RPATH= NONE
APP2RPATH= NONE APP2RPATH= NONE
......
...@@ -45,6 +45,16 @@ ...@@ -45,6 +45,16 @@
#include "cppdep.hxx" #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 class RscHrcDep : public CppDep
{ {
public: public:
...@@ -70,15 +80,6 @@ void RscHrcDep::Execute() ...@@ -70,15 +80,6 @@ void RscHrcDep::Execute()
//static String aDelim; //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 ) SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
{ {
int c; int c;
...@@ -179,7 +180,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv ) ...@@ -179,7 +180,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
while( 1 ) while( 1 )
{ {
c = simple_getopt( argv, c = getopt( argc, argv,
"_abcdefghi:jklmnopqrstuvwxyzABCDEFGHI:JKLMNOPQRSTUVWXYZ1234567890/-+=.\\()\""); "_abcdefghi:jklmnopqrstuvwxyzABCDEFGHI:JKLMNOPQRSTUVWXYZ1234567890/-+=.\\()\"");
if ( c == -1 ) if ( c == -1 )
break; break;
...@@ -296,41 +297,3 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv ) ...@@ -296,41 +297,3 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
return 0; 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment