remove ultrix support
[oweals/cde.git] / cde / programs / dtpad / main.c
index 8b598ae9333f3c7d6c9753943392e9001180be46..8cf93e37952cd63a73ee1b391c96fdce1976a676 100644 (file)
@@ -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: main.c /main/27 1999/09/15 15:16:51 mgreess $ */
 /**********************************<+>*************************************
 ***************************************************************************
@@ -22,7 +44,7 @@
 **  This file contains the routines that control the client/server architecture
 **  of dtpad and creation of the top level widgets.
 **
-**  See the comments preceeding main() for a description of the        client/server
+**  See the comments preceding main() for a description of the client/server
 **  architecture of dtpad as well as an overview of the routine hierarchy of
 **  dtpad.  The widget hierarchy of dtpad goes something like this:
 **
 # if !defined(NL_CAT_LOCALE)
 #  define NL_CAT_LOCALE 0
 # endif
-# ifdef __ultrix
-#  define _DTPAD_CAT_NAME "dtpad.cat"
-# else  /* __ultrix */
 static const char catalogName[] = "dtpad";
-#  define _DTPAD_CAT_NAME catalogName
-# endif /* __ultrix */
+# define _DTPAD_CAT_NAME catalogName
 #endif
 
 
@@ -254,7 +272,7 @@ static int dtpadXIOErrorHandler(
  *                             edit window)
  *
  ************************************************************************/ 
-void 
+int 
 main(
         int argc,
         char **argv )
@@ -417,11 +435,6 @@ main(
       
     } else {
 
-#ifdef __osf__
-/* Temporary work around for action database problem(platinum BL5 03/29/95). */
-      StartDbUpdate((XtPointer) NULL);
-#endif
-
        /*--------------------------------------------------------
         * Requestor Mode
         *
@@ -495,7 +508,7 @@ CreateFirstPad(
     char **argv_l, **c_argv_l;
     Editor *pPad;
     Arg al[10];
-    register int ac;
+    int ac;
     Widget foo;
     int i;
     /* Added for the argument fix*/
@@ -611,6 +624,11 @@ CreateFirstPad(
        initialServerResources = pPad->xrdb;
        initialServerResources.server = False; /* so window will be mapped */ 
        initialServerGeometry = pPad->geometry;
+       if(pPad->xrdb.workspaceList)
+               pPad->xrdb.workspaceList = strdup(pPad->xrdb.workspaceList);
+       if(pPad->xrdb.session)
+               pPad->xrdb.session = strdup(pPad->xrdb.session);
+       pPad->geometry = strdup(pPad->geometry);
     }
 
     /* Set some initial Editor instance values */
@@ -902,7 +920,7 @@ SendMessageToServer(
      ttdt_subcontract_manage(msg,
                        pStatusCB,
                        NULL,
-                       (void *) ((int) pPad->xrdb.blocking));/* client data */
+                       (void *) ((XtArgVal) pPad->xrdb.blocking));/* client data */
 
      /* Add pArgs to msg using tt_message_context_set */
      SetupLoadArgs(msg, pPad);
@@ -963,7 +981,7 @@ InitEditSessionAndFirstPad(
         sigfillset(&act.sa_mask);
         act.sa_flags = 0;
         act.sa_handler = SigcldHndlr;
-        sigaction(SIGCLD, &act, (struct sigaction *)NULL);
+        sigaction(SIGCHLD, &act, (struct sigaction *)NULL);
     }
 }
 
@@ -985,7 +1003,7 @@ RealizeNewPad(
         Editor *pPad)
 {
     Arg al[5];                 /* arg list */
-    register int ac;           /* arg count */
+    int ac;            /* arg count */
 
     /* Create the title */
     pPad->dialogTitle = DialogTitle(pPad);
@@ -1141,7 +1159,7 @@ StartDbUpdate(
 void
 exitCB(Widget w, XtPointer callData, XtPointer clientData)
 {
-    exit((int) clientData);
+    exit((XtArgVal) clientData);
 }
 
 /************************************************************************
@@ -1210,7 +1228,7 @@ GetAdjustedResizeHints(
         XSizeHints *pHints)
 {
     Arg al[2];                 /* arg list */
-    register int ac;           /* arg count */
+    int ac;            /* arg count */
     Dimension MBheight;
 
     /* get Dt Editor widget size hints */
@@ -1335,7 +1353,7 @@ SetWindowSize(
         Editor *pPad)
 {
     Arg al[10];                        /* arg list */
-    register int ac;           /* arg count */
+    int ac;            /* arg count */
     XSizeHints  size_hints;
     XWMHints   *wmhints;
     long supplied_return;
@@ -1569,7 +1587,7 @@ void SigcldHndlr (int dummy)
     /*
      * Is this really necessary?
      */
-    sigaction(SIGCLD, &act, (struct sigaction *)NULL);
+    sigaction(SIGCHLD, &act, (struct sigaction *)NULL);
 }
 
 
@@ -1655,7 +1673,6 @@ RestoreInitialServerResources(
        XtFree(pPad->geometry );
 
     pPad->xrdb = initialServerResources;
-    pPad->geometry = initialServerGeometry;
 
     /* -----> duplicate resource strings */
     if (initialServerResources.workspaceList != (char *)NULL)
@@ -1796,7 +1813,7 @@ Usage(
 
    template = (GETMESSAGE(7,10, message_string2));
 
-   fprintf (stderr, template);
+   fprintf (stderr, "%s", template);
 
    exit (0);
 }
@@ -1822,7 +1839,7 @@ dtpadXErrorHandler(
     _DtSimpleError("dtpad", DtWarning, NULL, msg, NULL);
 
     /*
-     * if the error occured on the print display we're going to set
+     * if the error occurred on the print display we're going to set
      * a variable so that and when the job is done, right before calling
      * XpEndJob, we call XpCancelJob, and notify the user.
      */
@@ -1855,4 +1872,8 @@ dtpadXIOErrorHandler(
 
     fprintf(stderr, "X IO Error");
     PanicSave();
+
+    /* Man page for XSetIOErrorhandler says this is a fatal error and
+     * should not return */
+    exit(EXIT_FAILURE);
 }