Adding a standalone build necessary to fix bug 65682. r,a=dveditz, sr=mscott

This commit is contained in:
dbragg%netscape.com 2001-03-08 22:02:39 +00:00
Родитель 90fcb4639b
Коммит 56a00f4942
6 изменённых файлов: 102 добавлений и 104 удалений

Просмотреть файл

@ -26,7 +26,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = include src
DIRS = include src standalone
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -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

Просмотреть файл

@ -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))

Просмотреть файл

@ -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, " <regItemName>,<version>,<full filepath>\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 */

Просмотреть файл

@ -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

Просмотреть файл

@ -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 <sgehani@netscape.com>
#
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