remove OSF1 support
[oweals/cde.git] / cde / programs / dtaction / Main.c
index 866ec8db76ad7259ee22961e79c7ecece5d6f175..eb1bc4e2c597f107579db5833cc5430aedabdb8f 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
  */
@@ -40,6 +40,7 @@
  ****************************************************************************
  ************************************<+>*************************************/
 
+#include <stdlib.h>
 #include <limits.h>
 #include <stddef.h>
 #include <unistd.h>
@@ -48,7 +49,7 @@
 #include <locale.h>
 #include <sys/param.h>         /* for MAXPATHLEN and MAXHOSTNAMELEN */
 
-#ifdef sun
+#if defined(sun) || defined(linux)
 #include <crypt.h>
 #include <shadow.h>
 #endif
@@ -60,6 +61,7 @@
 #include <X11/Intrinsic.h>
 #include <Xm/XmP.h>
 #include <Xm/Text.h>
+#include <Xm/TextF.h>
 #include <Xm/SelectioB.h>
 #include <Xm/MessageB.h>
 #include <Xm/Protocols.h>
@@ -86,12 +88,6 @@ XrmOptionDescRec option_list[] =
    {  "-termOpts", "termOpts",      XrmoptionSepArg,   NULL},
 };
 
-/* Fallback Resources */
-static char *fallback_resources[] = {
-    "*timeout: 5",
-    (char *) NULL
-};
-
 typedef struct {
    char * user;
    char * contextDir;
@@ -280,7 +276,7 @@ CheckForDone(
 }
 
 
-void
+int
 main( 
      int argc,
      char **argv ) 
@@ -290,7 +286,6 @@ main(
     int n=0;
     char *actionName;
     int numArgs = 0;
-    char contextDir[MAXPATHLEN+1];
     DtActionArg *ap = NULL;
   
     XtSetLanguageProc(NULL, NULL, NULL);
@@ -306,7 +301,7 @@ main(
                             &argc, argv)) )
     {
        setlocale(LC_ALL, "");
-        fprintf(stderr,GETMESSAGE(1,11,"Can't open display.\n"));
+        fprintf(stderr, "%s", GETMESSAGE(1,11,"Can't open display.\n"));
        exit(-1);
     }
   
@@ -351,7 +346,7 @@ main(
     */
     if ( (actionName = argv[1]) == NULL)
     {
-       fprintf(stderr,GETMESSAGE(1,10,"No action name specified.\n"));
+       fprintf(stderr, "%s", GETMESSAGE(1,10,"No action name specified.\n"));
        exit(-1);
     }
 
@@ -397,6 +392,7 @@ main(
 
     XtAppMainLoop(appContext);
 
+    return EXIT_SUCCESS;
 }
 
 
@@ -407,8 +403,10 @@ SetGidUid ( unsigned short rgid, unsigned short ruid )
        /* fix process gid */
 #if defined(SVR4) || defined(_AIX)
     setgid(rgid);
-#elif defined(__osf__) || defined(linux) || defined(CSRG_BASED)
-    setregid(rgid, rgid);
+#elif defined(linux) || defined(CSRG_BASED)
+    if(-1 == setregid(rgid, rgid)) {
+        fprintf(stderr, "SetGidUid: setregid failed on %d\n", rgid);
+    }
 #elif defined(__hpux)
     setresgid(rgid, rgid, rgid);
 #else
@@ -418,8 +416,10 @@ SetGidUid ( unsigned short rgid, unsigned short ruid )
        /* fix process uid */
 #if defined (SVR4) || defined (_AIX)
     setuid(ruid);
-#elif defined(__osf__) || defined(linux) || defined(CSRG_BASED)
-    setreuid(ruid, ruid);
+#elif defined(linux) || defined(CSRG_BASED)
+    if(-1 == setreuid(ruid, ruid)) {
+        fprintf(stderr, "SetGidUid: setreuid failed on %d\n", ruid);
+    }
 #elif defined(__hpux)
     setresuid(ruid, ruid, ruid);
 #else
@@ -1006,9 +1006,7 @@ LogSuccess( void )
 
    /* Set up the user's new id's */
    SetGidUid(basegid,newuid);
-#ifndef sco
    initgroups(appArgs.user, basegid);
-#endif
 
 }