From 5917e1e388cb28a0b8b9d20561ebebf185733505 Mon Sep 17 00:00:00 2001 From: "dbragg%netscape.com" Date: Thu, 8 Mar 2001 22:02:39 +0000 Subject: [PATCH] Adding a standalone build necessary to fix bug 65682. r,a=dveditz, sr=mscott git-svn-id: svn://10.0.0.236/trunk@88987 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/modules/libreg/Makefile.in | 2 +- mozilla/modules/libreg/src/Makefile.in | 3 +- mozilla/modules/libreg/src/objs.mk | 31 ++++++ mozilla/modules/libreg/src/vr_stubs.c | 105 +----------------- mozilla/modules/libreg/src/vr_stubs.h | 1 + mozilla/modules/libreg/standalone/Makefile.in | 64 +++++++++++ 6 files changed, 102 insertions(+), 104 deletions(-) create mode 100644 mozilla/modules/libreg/src/objs.mk create mode 100644 mozilla/modules/libreg/standalone/Makefile.in diff --git a/mozilla/modules/libreg/Makefile.in b/mozilla/modules/libreg/Makefile.in index 04e25575ad2..9a278a6b814 100644 --- a/mozilla/modules/libreg/Makefile.in +++ b/mozilla/modules/libreg/Makefile.in @@ -26,7 +26,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = include src +DIRS = include src standalone include $(topsrcdir)/config/rules.mk diff --git a/mozilla/modules/libreg/src/Makefile.in b/mozilla/modules/libreg/src/Makefile.in index f132876d36c..ae7ada25a24 100644 --- a/mozilla/modules/libreg/src/Makefile.in +++ b/mozilla/modules/libreg/src/Makefile.in @@ -25,13 +25,12 @@ srcdir = @srcdir@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk +include $(srcdir)/objs.mk MODULE = libreg LIBRARY_NAME = mozreg_s -PROGRAM = vreg$(BIN_SUFFIX) - CSRCS = reg.c VerReg.c vr_stubs.c nr_bufio.c BIN_SRCS = VerReg.c reg.c vr_stubs.c diff --git a/mozilla/modules/libreg/src/objs.mk b/mozilla/modules/libreg/src/objs.mk new file mode 100644 index 00000000000..6e6b262dc05 --- /dev/null +++ b/mozilla/modules/libreg/src/objs.mk @@ -0,0 +1,31 @@ +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 2000 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# + +MODULES_LIBREG_SRC_LCSRCS = \ + reg.c \ + VerReg.c \ + vr_stubs.c \ + $(NULL) + + +MODULES_LIBREG_SRC_CSRCS := $(addprefix $(topsrcdir)/modules/libreg/src/, $(MODULES_LIBREG_SRC_LCSRCS)) + + diff --git a/mozilla/modules/libreg/src/vr_stubs.c b/mozilla/modules/libreg/src/vr_stubs.c index b383374cda8..585df007753 100644 --- a/mozilla/modules/libreg/src/vr_stubs.c +++ b/mozilla/modules/libreg/src/vr_stubs.c @@ -279,7 +279,7 @@ extern void vr_findGlobalRegName() // we have no idea if this moves memory, so better lock the handle #if defined(STANDALONE_REGISTRY) || defined(USE_STDIO_MODES) HLock(thePath); - globalRegName = XP_ALLOC(pathLen + 1); + globalRegName = (char *)XP_ALLOC(pathLen + 1); XP_STRNCPY(globalRegName, *thePath, pathLen); globalRegName[pathLen] = '\0'; #else @@ -338,7 +338,7 @@ extern char* vr_findVerRegName() // we have no idea if this moves memory, so better lock the handle #if defined(STANDALONE_REGISTRY) || defined(USE_STDIO_MODES) HLock(thePath); - verRegName = XP_ALLOC(pathLen + 1); + verRegName = (char *)XP_ALLOC(pathLen + 1); XP_STRNCPY(verRegName, *thePath, pathLen); verRegName[pathLen] = '\0'; #else @@ -413,10 +413,7 @@ extern int nr_RenameFile(char *from, char *to) } -#if 0 -/* Uncomment the following for older Mac build environments - * that don't support these functions - */ +#ifdef STANDALONE_REGISTRY char *strdup(const char *source) { char *newAllocation; @@ -489,7 +486,7 @@ int strncasecmp(const char *str1, const char *str2, int length) return currentChar1 - currentChar2; } -#endif /* 0 */ +#endif /* STANDALONE_REGISTRY */ #endif /* XP_MAC */ @@ -525,7 +522,6 @@ long BUILDNUM = NS_BUILD_ID; REGERR vr_ParseVersion(char *verstr, VERSION *result); -int main(int argc, char *argv[]); #ifdef XP_UNIX @@ -678,97 +674,4 @@ char* vr_findVerRegName () #endif /*XP_BEOS*/ -#if defined(STANDALONE_REGISTRY) && (defined(XP_UNIX) || defined(XP_OS2) || defined(XP_MAC) || defined(XP_BEOS)) - -int main(int argc, char *argv[]) -{ - XP_File fh; - char *entry; - char *p; - char *v; - char buff[1024]; - char name[MAXREGPATHLEN+1]; - char path[MAXREGPATHLEN+1]; - char ver[MAXREGPATHLEN+1]; - - if ( argc >= 3 ) - { - TheRegistry = argv[1]; - Flist = argv[2]; - } - else - { - fprintf(stderr, "Usage: %s RegistryName FileList\n", argv[0]); - fprintf(stderr, " The FileList file contains lines with comma-separated fields:\n"); - fprintf(stderr, " ,,\n"); - exit (1); - } - - /* tmp use of buff to get the registry directory, which must be - * the navigator home directory. Preserve the slash to match - * FE_GetDirectoryPath() called during navigator set-up - */ - - - strcpy(buff, TheRegistry); - p = strrchr( buff, '/' ); - if ( p ) - { - char pwd[1024]; - - *(p+1) = '\0'; - getcwd(pwd, sizeof(pwd)); - chdir(buff); getcwd(buff, sizeof(buff)); - chdir(pwd); - } - else - { - getcwd(buff, sizeof(buff)); - } - strcat(buff, "/"); - - - NR_StartupRegistry(); - VR_SetRegDirectory(buff); - - -#ifndef XP_MAC - if ( -1 == (access( TheRegistry, W_OK )) ) { - sprintf(ver,"4.50.0.%ld",BUILDNUM); - VR_CreateRegistry("Communicator", buff, ver); - } -#endif - - if ( !(fh = fopen( Flist, "r" )) ) - { - fprintf(stderr, "%s: Cannot open \"%s\"\n", argv[0], Flist); - exit (1); - } - - while ( fgets ( buff, 1024, fh ) ) - { - if ( *(entry = &buff[strlen(buff)-1]) == '\n' ) - *entry = '\0'; - - entry = strchr(buff, ','); - strcpy(name, strtok(buff, ",")); - strcpy(ver, strtok( NULL, ",")); - strcpy(path, strtok( NULL, ",")); - - v = ver; - while (*v && *v == ' ') - v++; - - p = path; - while (*p && *p == ' ') - p++; - - VR_Install ( name, p, v, FALSE ); - } - fclose( fh ); - return 0; -} - -#endif /* STANDALONE_REGISTRY && (XP_UNIX || XP_OS2 || XP_MAC) */ - #endif /* XP_UNIX || XP_OS2 */ diff --git a/mozilla/modules/libreg/src/vr_stubs.h b/mozilla/modules/libreg/src/vr_stubs.h index 98d304763ec..a7de8903423 100644 --- a/mozilla/modules/libreg/src/vr_stubs.h +++ b/mozilla/modules/libreg/src/vr_stubs.h @@ -99,6 +99,7 @@ #define XP_STRCAT(a,b) strcat((a),(b)) #define XP_ATOI atoi +#define XP_STRNCPY(a,b,n) strncpy((a),(b),(n)) #define XP_STRCPY(a,b) strcpy((a),(b)) #define XP_STRLEN(x) strlen(x) #define XP_SPRINTF sprintf diff --git a/mozilla/modules/libreg/standalone/Makefile.in b/mozilla/modules/libreg/standalone/Makefile.in new file mode 100644 index 00000000000..8afe8968784 --- /dev/null +++ b/mozilla/modules/libreg/standalone/Makefile.in @@ -0,0 +1,64 @@ +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# Samir Gehani +# + +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@:@srcdir@/../src/ + +include $(DEPTH)/config/autoconf.mk +include $(srcdir)/../src/objs.mk + +MODULE = libreg +LIBRARY_NAME = mozregsa_s + +CSRCS = $(MODULES_LIBREG_SRC_LCSRCS) + +OBJS = $(addprefix S_,$(CSRCS:.c=.$(OBJ_SUFFIX))) + +override NO_SHARED_LIB=1 +override NO_STATIC_LIB= + +MDDEPDIR := $(MDDEPDIR)_S + +GARBAGE_DIRS += .deps + +include $(topsrcdir)/config/rules.mk + +DEFINES += -DSTANDALONE_REGISTRY + +# Make sure that these custom rules stay in sync with rules.mk +S_%.$(OBJ_SUFFIX): $(srcdir)/../src/%.c + $(REPORT_BUILD) +ifdef STRICT_CPLUSPLUS_SUFFIX + echo "#line 1 \"$*.cpp\"" | cat - $*.cpp > t_$*.cc + $(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) t_$*.cc + rm -f t_$*.cc +else +ifeq ($(MOZ_OS2_TOOLS), VACPP) + $(ELOG) $(CCC) -Fo$@ -c $(COMPILE_CXXFLAGS) $< +else + $(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $< +endif +endif #STRICT_CPLUSPLUS_SUFFIX + +