diff options
-rw-r--r-- | sal/rtl/source/bootstrap.cxx | 38 | ||||
-rwxr-xr-x | sal/test/bootstrap.pl | 27 | ||||
-rw-r--r-- | sal/test/makefile.mk | 10 | ||||
-rw-r--r-- | sal/test/testbootstrap.ini | 3 |
4 files changed, 59 insertions, 19 deletions
diff --git a/sal/rtl/source/bootstrap.cxx b/sal/rtl/source/bootstrap.cxx index fde08b768760..7e278a39f0d6 100644 --- a/sal/rtl/source/bootstrap.cxx +++ b/sal/rtl/source/bootstrap.cxx @@ -2,9 +2,9 @@ * * $RCSfile: bootstrap.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: kr $ $Date: 2001-08-30 11:51:36 $ + * last change: $Author: kr $ $Date: 2001-10-05 08:00:21 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -224,10 +224,11 @@ static void getFromList(NameValueList *pNameValueList, rtl_uString **ppValue, rt } } -static void getValue(NameValueList *pNameValueList, rtl_uString * pName, rtl_uString ** ppValue, rtl_uString * pDefault) +static sal_Bool getValue(NameValueList *pNameValueList, rtl_uString * pName, rtl_uString ** ppValue, rtl_uString * pDefault) { static const OUString sysUserConfig(RTL_CONSTASCII_USTRINGPARAM("SYSUSERCONFIG")); static const OUString sysUserHome(RTL_CONSTASCII_USTRINGPARAM("SYSUSERHOME")); + sal_Bool result = sal_True; // we have build ins: if(!rtl_ustr_compare_WithLength(pName->buffer, pName->length, sysUserConfig.pData->buffer, sysUserConfig.pData->length)) @@ -251,9 +252,12 @@ static void getValue(NameValueList *pNameValueList, rtl_uString * pName, rtl_uSt if( ! *ppValue ) { getFromEnvironment( ppValue, pName ); - if( ! *ppValue && pDefault ) + if( ! *ppValue ) { - rtl_uString_assign( ppValue , pDefault ); + result = sal_False; + + if(pDefault) + rtl_uString_assign( ppValue , pDefault ); } } } @@ -266,6 +270,8 @@ static void getValue(NameValueList *pNameValueList, rtl_uString * pName, rtl_uSt sValue = OUStringToOString(OUString(*ppValue), RTL_TEXTENCODING_ASCII_US); OSL_TRACE("bootstrap.cxx::getValue - name:%s value:%s\n", sName.getStr(), sValue.getStr()); #endif + + return result; } typedef struct Bootstrap_Impl { @@ -359,14 +365,16 @@ sal_Bool SAL_CALL rtl_bootstrap_get_from_handle(rtlBootstrapHandle handle, rtl_u { MutexGuard guard(Mutex::getGlobalMutex()); - sal_Bool result = sal_False; + sal_Bool found = sal_False; if(ppValue && pName) { if(handle) { - rtl_uString_release(*ppValue); - *ppValue = 0; + if(*ppValue) { + rtl_uString_release(*ppValue); + *ppValue = 0; + } - getValue(&((Bootstrap_Impl *)handle)->_nameValueList, pName, ppValue, pDefault); + found = getValue(&((Bootstrap_Impl *)handle)->_nameValueList, pName, ppValue, pDefault); if(*ppValue) @@ -376,18 +384,22 @@ sal_Bool SAL_CALL rtl_bootstrap_get_from_handle(rtlBootstrapHandle handle, rtl_u rtl_uString_assign(ppValue, result.pData ); } + if(!found) { + // fall back to executable rc + if(((Bootstrap_Impl *)handle)->_iniName != getIniFileNameImpl()) + found = rtl_bootstrap_get(pName, ppValue, pDefault); + } + if(!*ppValue) rtl_uString_new(ppValue); - else - result = sal_True; } else - result = rtl_bootstrap_get(pName, ppValue, pDefault); + found = rtl_bootstrap_get(pName, ppValue, pDefault); } - return result; + return found; } void SAL_CALL rtl_bootstrap_get_iniName_from_handle(rtlBootstrapHandle handle, rtl_uString ** ppIniName) diff --git a/sal/test/bootstrap.pl b/sal/test/bootstrap.pl index 9b70878d3073..538ba23c004a 100755 --- a/sal/test/bootstrap.pl +++ b/sal/test/bootstrap.pl @@ -5,9 +5,9 @@ eval 'exec perl -wS $0 ${1+"$@"}' # # $RCSfile: bootstrap.pl,v $ # -# $Revision: 1.1 $ +# $Revision: 1.2 $ # -# last change: $Author: kr $ $Date: 2001-08-30 12:17:44 $ +# last change: $Author: kr $ $Date: 2001-10-05 08:00:22 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -116,6 +116,29 @@ if (!$rc) { $state = 0; } + +if ($ENV{GUI} eq "WNT") { + $rc = system "./testbootstrap", "inherited_value", '-env:MYBOOTSTRAPTESTVALUE=$INHERITED_VALUE', "-env:iniName=ini.ini"; +} +else { + $rc = system "./testbootstrap", "inherited_value", '-env:MYBOOTSTRAPTESTVALUE=$INHERITED_VALUE', "-env:iniName=inirc"; +} +if (!$rc) { + $comment = $comment . "inherited value not passed\n"; + $state = 0; +} + +if ($ENV{GUI} eq "WNT") { + $rc = system "./testbootstrap", "inherited_overwritten_value", '-env:MYBOOTSTRAPTESTVALUE=$INHERITED_OVERWRITTEN_VALUE', "-env:iniName=ini.ini"; +} +else { + $rc = system "./testbootstrap", "inherited_overwritten_value", '-env:MYBOOTSTRAPTESTVALUE=$INHERITED_OVERWRITTEN_VALUE', "-env:iniName=inirc"; +} +if (!$rc) { + $comment = $comment . "inherited overwritten value not passed\n"; + $state = 0; +} + delete $ENV{MYBOOTSTRAPTESTVALUE}; diff --git a/sal/test/makefile.mk b/sal/test/makefile.mk index c35ef8c833b1..d7d1c1a0f669 100644 --- a/sal/test/makefile.mk +++ b/sal/test/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.10 $ +# $Revision: 1.11 $ # -# last change: $Author: jbu $ $Date: 2001-09-26 16:42:06 $ +# last change: $Author: kr $ $Date: 2001-10-05 08:00:22 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -127,14 +127,16 @@ $(BIN)$/$(APP2TARGET).exe : $(APP2TARGETN) cp $(APP2TARGETN) $@ $(BIN)$/inirc: - echo "MYBOOTSTRAPTESTVALUE=auxaux" > $@ + echo "MYBOOTSTRAPTESTVALUE=auxaux" > $@ + echo "INHERITED_OVERWRITTEN_VALUE=inherited_overwritten_value" >> $@ .ELSE ALL: $(BIN)$/ini.ini $(BIN)$/ini.ini: - echo MYBOOTSTRAPTESTVALUE=auxaux > $@ + echo MYBOOTSTRAPTESTVALUE=auxaux > $@ + echo INHERITED_OVERWRITTEN_VALUE=inherited_overwritten_value >> $@ .ENDIF diff --git a/sal/test/testbootstrap.ini b/sal/test/testbootstrap.ini index 3c02875cd483..2cf7b667cd91 100644 --- a/sal/test/testbootstrap.ini +++ b/sal/test/testbootstrap.ini @@ -1 +1,4 @@ MYBOOTSTRAPTESTVALUE=file +INHERITED_VALUE=inherited_value +INHERITED_OVERWRITTEN_VALUE=not_overwritten + |