rpc.cmsd: use TIRPC on Linux
[oweals/cde.git] / cde / programs / dtlogin / resource.c
index 6820cf4d061033e8f40ec277d0c78555e0e2996b..6608dba540c99776a690642cb982bc21c5fcc90a 100644 (file)
@@ -16,7 +16,7 @@
  * details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with these librararies and programs; if not, write
+ * 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
  */
@@ -72,6 +72,7 @@ int   debugLevel;
 char   *errorLogFile;
 int    errorLogSize;
 int    daemonMode;
+int    quiet;
 char   *pidFile;
 int    lockPidFile;
 char   *authDir;
@@ -89,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
@@ -221,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
@@ -254,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,
@@ -287,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])
@@ -406,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;
 
@@ -419,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);
@@ -432,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;
@@ -447,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';
@@ -477,6 +473,8 @@ GetResource( char *name, char *class, int valueType, char **valuep,
         break;
 
     }
+
+    return 1;
 }
 
 XrmOptionDescRec configTable [] = {
@@ -499,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;
@@ -859,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);
     }
 }