X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=cde%2Fprograms%2Fdtlogin%2Fresource.c;h=6608dba540c99776a690642cb982bc21c5fcc90a;hb=ee4a0a37ea2352311e30f1c63df1d1b471c30e8d;hp=0bd2d43e01f6bbeb12f1b03439870a1ed3ff3d6e;hpb=83b6996daa2c5ae22fc2b69093814cb08314954a;p=oweals%2Fcde.git diff --git a/cde/programs/dtlogin/resource.c b/cde/programs/dtlogin/resource.c index 0bd2d43e..6608dba5 100644 --- a/cde/programs/dtlogin/resource.c +++ b/cde/programs/dtlogin/resource.c @@ -1,3 +1,25 @@ +/* + * CDE - Common Desktop Environment + * + * Copyright (c) 1993-2012, The Open Group. All rights reserved. + * + * These libraries and programs are free software; you can + * redistribute them and/or modify them under the terms of the GNU + * Lesser General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * These libraries and programs are distributed in the hope that + * they will be useful, but WITHOUT ANY WARRANTY; without even the + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU Lesser General Public License for more + * details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with these libraries and programs; if not, write + * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth + * Floor, Boston, MA 02110-1301 USA + */ /* $TOG: resource.c /main/7 1997/03/14 13:45:09 barstow $ */ /* (c) Copyright 1997 The Open Group */ /* * @@ -50,6 +72,7 @@ int debugLevel; char *errorLogFile; int errorLogSize; int daemonMode; +int quiet; char *pidFile; int lockPidFile; char *authDir; @@ -67,9 +90,6 @@ int langListTimeout; #ifdef DEF_NETWORK_DEV char *networkDev; #endif -#if defined(__osf__) -char *ignoreLocales; -#endif /* * Dtlogin will accept both Dtlogin and XDM resources. The string variable @@ -199,12 +219,6 @@ static char AppName[16] = DTLOGIN; # ifdef __apollo # define DEF_LANG "C" # endif -# ifdef __osf__ -# define DEF_LANG "C" -# endif -# ifdef __hp_osf -# define DEF_LANG "en_US.88591" -# endif # ifdef sun /* default language under Solaris */ # define DEF_LANG "C" # endif @@ -232,6 +246,8 @@ struct dmResources { "50", "daemonMode", "DaemonMode", DM_BOOL, (char **) &daemonMode, "false", +"quiet", "quiet", DM_BOOL, (char **) &quiet, + "false", "pidFile", "PidFile", DM_STRING, &pidFile, "", "lockPidFile", "LockPidFile", DM_BOOL, (char **) &lockPidFile, @@ -265,10 +281,6 @@ struct dmResources { "networkDevice","NetworkDevice",DM_STRING, &networkDev, DEF_NETWORK_DEV, #endif -#if defined(__osf__) -"ignoreLocales", "IgnoreLocales", DM_STRING, &ignoreLocales, - "", -#endif }; # define NUM_DM_RESOURCES (sizeof DmResources / sizeof DmResources[0]) @@ -384,6 +396,7 @@ GetResource( char *name, char *class, int valueType, char **valuep, char *type; XrmValue value; char *string, *new_string; + char empty[] = ""; char str_buf[50]; int len; @@ -397,8 +410,13 @@ GetResource( char *name, char *class, int valueType, char **valuep, } else { - string = default_value; - len = (string == NULL ? 0 : strlen (string)); + if(default_value) { + string = default_value; + len = strlen (string); + } else { + string = empty; + len = 0; + } } Debug ("%s/%s value %*.*s\n", name, class, len, len, string); @@ -410,7 +428,7 @@ GetResource( char *name, char *class, int valueType, char **valuep, if (valueType == DM_STRING && *valuep) { if (string != NULL && strlen (*valuep) == len && !strncmp (*valuep, string, len)) - return; + return 0; else { free (*valuep); *(valuep) = NULL; @@ -425,7 +443,7 @@ GetResource( char *name, char *class, int valueType, char **valuep, if (!new_string) { LogOutOfMem( ReadCatalog(MC_LOG_SET,MC_LOG_GET_RSC,MC_DEF_LOG_GET_RSC)); - return; + return 0; } strncpy (new_string, string, len); new_string[len] = '\0'; @@ -455,6 +473,8 @@ GetResource( char *name, char *class, int valueType, char **valuep, break; } + + return 1; } XrmOptionDescRec configTable [] = { @@ -477,7 +497,8 @@ XrmOptionDescRec optionTable [] = { {"-debug", "*debugLevel", XrmoptionSepArg, (caddr_t) NULL }, {"-xrm", NULL, XrmoptionResArg, (caddr_t) NULL }, {"-daemon", ".daemonMode", XrmoptionNoArg, "true" }, -{"-nodaemon", ".daemonMode", XrmoptionNoArg, "false" } +{"-nodaemon", ".daemonMode", XrmoptionNoArg, "false" }, +{"-quiet", ".quiet", XrmoptionNoArg, "true" } }; static int originalArgc; @@ -837,9 +858,14 @@ char * newname; strncpy(newname, tempName, tempLen); strcpy(newname+tempLen, name); free (langString); + free (tempName); return(newname); } } + + default: + /* special is of an unknown value */ + return(NULL); } }