dtprintinfo: Coverity 88650
[oweals/cde.git] / cde / programs / localized / util / merge.c
index 474960002a525580e10ad4d5318c1411bf35c25f..cca339377e57a66a87bd1c6c9d0bca8cf2b948ac 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
+ */
 /* $XConsortium: merge.c /main/4 1995/12/08 09:44:13 rswiston $ */
 /*
     merge.c
@@ -71,6 +93,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <locale.h>
 #include <nl_types.h>
 
@@ -95,9 +118,7 @@ void fatal ();
 void get_option ();
 
 
-void main (argc, argv)
-int argc;
-char *argv [];
+void main (int argc, char *argv [])
 {
     int c;
 
@@ -159,7 +180,7 @@ char *argv [];
  * If the pattern "%|nls-???-###|" is found in the template file, replace it
  * by big_buff.
  */
-void process_message ()
+void process_message (void)
 {
     int c;
     int m = 0;
@@ -197,7 +218,7 @@ void process_message ()
 /*
  * Get a character from template. Incriment line count if new line is found.
  */
-int get_char ()
+int get_char (void)
 {
     int c;
 
@@ -210,7 +231,7 @@ int get_char ()
 /*
  * Open message files
  */
-void cat_open ()
+void cat_open (void)
 {
     char line[255];
 
@@ -219,26 +240,23 @@ void cat_open ()
 
     if(pfile != NULL)
     {
-#if defined(USL) || defined(__uxp__)
-        sprintf(line,"/usr/bin/gencat -m ./.dt_pfile.cat %s",pfile);
-#else
         sprintf(line,"/usr/bin/gencat ./.dt_pfile.cat %s",pfile);
-#endif
         if ( system(line) != 0 )
+       {
            fatal("primary .tmsg file would not gencat\n",0,9);
+       }
     }
 
     catfile[0] =  catopen("./.dt_pfile.cat",0);
 
     if(dfile != NULL)
     {
-#if defined(USL) || defined(__uxp__)
-        sprintf(line,"/usr/bin/gencat -m ./.dt_dfile.cat %s",dfile);
-#else
         sprintf(line,"/usr/bin/gencat ./.dt_dfile.cat %s",dfile);
-#endif
         if ( system(line) != 0 )
+       {
            fatal("default .tmsg file would not gencat\n",0,9);
+       }
+
     }
 
     catfile[1] = catopen("./.dt_dfile.cat",0);
@@ -252,9 +270,9 @@ void cat_open ()
 /*
  * Search a message by specified number. If found, returns 1 and the message
  * will be set in big_buff. If not found, returns 0.
+ * msg, message number to be searched
  */
-int find_message (msg)
-int msg; /* message number to be searched */
+int find_message (int msg)
 {
     int ret = 0;
 
@@ -269,10 +287,11 @@ int msg; /* message number to be searched */
  * Search a line starts with the message number in specified file. If found,
  * the line will be passed to get_message() and returns 1.
  * If not found, returns 0.
+ *
+ * msg, message number to be searched
+ * file, 0: Primary message file, 1: Default message file
  */
-int find_msg_in_file (msg, file)
-int msg; /* message number to be searched */
-int file; /* 0: Primary message file, 1: Default message file */
+int find_msg_in_file (int msg, int file)
 {
         big_buff = catgets(catfile[file],1,msg,"MSG_NOT_FOUND");
         if ( strcmp(big_buff,"MSG_NOT_FOUND") )
@@ -283,17 +302,20 @@ int file; /* 0: Primary message file, 1: Default message file */
 
 /*
  * Display error message and exit program.
+ *
+ * file == file in which the error found  0: Primary message file 
+ *                                1: Default message file 
+ *                                2: Template file        
+ *                                9: N/A                  
  */
-void fatal (m, line, file)
-char *m;
-int line; /* line where the error found */
-int file; /* file in which the error found  0: Primary message file */
+void fatal (char *m, int line, int file)
+/* file in which the error found  0: Primary message file */
           /*                                1: Default message file */
           /*                                2: Template file        */
           /*                                9: N/A                  */
 {
     fprintf (stderr, "*** Fatal: ");
-    fprintf (stderr, m);
+    fprintf (stderr, "%s", m);
     switch(file)
     {
     case 0:
@@ -311,9 +333,7 @@ int file; /* file in which the error found  0: Primary message file */
 /*
  * Parse command line options.
  */
-void get_option (argc, argv)
-int *argc;
-char *argv[];
+void get_option (int *argc, char *argv[])
 {
     int i;