Use POSIX macros for linux
[oweals/cde.git] / cde / programs / dtstyle / I18nMain.c
index 433b5fd03459136b84d34d7c564a0ec08eba84e8..f88b86e0b2f8c31c26dd2c7c969f035d4f30e90a 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: I18nMain.c /main/4 1997/08/11 12:31:36 samborn $ */
 /*
  * (c) Copyright 1996 Digital Equipment Corporation.
@@ -24,6 +46,7 @@
 /*+++++++++++++++++++++++++++++++++++++++*/
 
 #include <X11/Xlib.h>
+#include <errno.h>
 #include <Xm/MwmUtil.h>
 
 #include <Xm/XmP.h>
@@ -354,9 +377,9 @@ BuildI18nDlg(
     /* get i18n resource values  */
 
     /* Set up DialogBoxDialog button labels */
-    button_string[0] = CMPSTR(_DtOkString);
-    button_string[1] = CMPSTR(_DtCancelString);
-    button_string[2] = CMPSTR(_DtHelpString);
+    button_string[0] = CMPSTR((String) _DtOkString);
+    button_string[1] = CMPSTR((String) _DtCancelString);
+    button_string[2] = CMPSTR((String) _DtHelpString);
 
     /* Create toplevel DialogBox */
 
@@ -487,7 +510,7 @@ BuildI18nDlg(
     n = 0;
     XtSetArg(args[n], XmNcomboBoxType, XmDROP_DOWN_COMBO_BOX); n++;
     i18n.serverHostCB =
-       (Widget) XmCreateComboBox(inputMethodForm, "serverHostCB", args, n);
+       (Widget) (intptr_t) XmCreateComboBox(inputMethodForm, "serverHostCB", args, n);
 
     XtAddCallback(XtNameToWidget(i18n.serverHostCB, "Text"),
                  XmNactivateCallback, ServerHostCB, NULL);
@@ -538,7 +561,7 @@ BuildI18nDlg(
     n = 0;
     XtSetArg(args[n], XmNselectionPolicy, XmBROWSE_SELECT); n++;
     i18n.preeditTypeList =
-       (Widget) XmCreateList(preeditTypeForm, "preeditTypeList", args, n);
+       (Widget) (intptr_t) XmCreateList(preeditTypeForm, "preeditTypeList", args, n);
 
     n = 0;
     string = CMPSTR((char *)GETMESSAGE(19, 10, "Move Up"));
@@ -803,7 +826,8 @@ UpdateImList(
     I18nEnv *env,
     char *hostname)
 {
-    Cardinal n,i;
+    Cardinal i;
+    XtArgVal n;
     Widget *im_tog = NULL;
     int ret = NoError;
 
@@ -970,7 +994,8 @@ SaveSelectedValues(
 {
     int ret = NoError;
     char *preeditStr = NULL, *tmpStr;
-    int i, num_preedit = 0;
+    int i;
+    XtArgVal num_preedit = 0;
     XmStringTable list_preedit;
     static char preeditTypeRes[1024];
 
@@ -1046,7 +1071,8 @@ SetFileSelValues(
 )
 {
     char *hostname;
-    Cardinal n,i;
+    Cardinal i;
+    XtArgVal n;
     Widget *im_tog;
 
     /* The hostname value is stored in the ImsSel structure. */
@@ -1109,7 +1135,7 @@ restoreI18n(
     XrmValue value;
 
     xrm_name [0] = XrmStringToQuark ("i18nDlg");
-    xrm_name [2] = NULL;
+    xrm_name [2] = 0;
 
     /* get x position */
     xrm_name [1] = XrmStringToQuark ("x");
@@ -1180,7 +1206,9 @@ saveI18n(
        sprintf(bufr, "%s*i18nDlg.y: %d\n", bufr, y);
        sprintf(bufr, "%s*i18nDlg.width: %d\n", bufr, width);
        sprintf(bufr, "%s*i18nDlg.height: %d\n", bufr, height);
-       write (fd, bufr, strlen(bufr));
+       if(-1 == write (fd, bufr, strlen(bufr))) {
+               perror(strerror(errno));
+       }
     }
 }
 
@@ -1376,7 +1404,7 @@ MoveUpCB(
            XtVaGetValues(i18n.preeditTypeList, XmNitems, &list_items, NULL);
 
            /* makes an array of two XmStrings by reversing the selected
-              one and the item preceeding it */
+              one and the item preceding it */
            items[0] = list_items[sel_index];
            items[1] = list_items[sel_index - 1];