OSDN Git Service

extra casting required by new pointer type
[pf3gnuchains/gcc-fork.git] / gcc / fixinc / fixincl.c
index bd13425..a1746af 100644 (file)
@@ -29,6 +29,9 @@ Boston, MA 02111-1307, USA.  */
 #endif
 
 #include <signal.h>
+#if ! defined( SIGCHLD ) && defined( SIGCLD )
+#  define SIGCHLD SIGCLD
+#endif
 #ifndef SEPARATE_FIX_PROC
 #include "server.h"
 #endif
@@ -67,7 +70,7 @@ typedef enum {
 te_verbose  verbose_level = VERB_PROGRESS;
 int have_tty = 0;
 
-#define VLEVEL(l)  (verbose_level >= l)
+#define VLEVEL(l)  ((unsigned int) verbose_level >= (unsigned int) l)
 #define NOT_SILENT VLEVEL(VERB_FIXES)
 
 pid_t process_chain_head = (pid_t) -1;
@@ -217,12 +220,14 @@ initialize ( argc, argv )
   char** argv;
 {
   static const char var_not_found[] =
+#ifndef __STDC__
+    "fixincl ERROR:  %s environment variable not defined\n"
+#else
     "fixincl ERROR:  %s environment variable not defined\n"
-#ifdef __STDC__
     "each of these must be defined:\n"
-#define _ENV_(v,m,n,t) "\t" n "  - " t "\n"
-ENV_TABLE
-#undef _ENV_
+# define _ENV_(v,m,n,t) "\t" n "  - " t "\n"
+  ENV_TABLE
+# undef _ENV_
 #endif
     ;
 
@@ -249,6 +254,12 @@ ENV_TABLE
       exit (EXIT_FAILURE);
     }
 
+#ifdef SIGCHLD
+  /* We *MUST* set SIGCHLD to SIG_DFL so that the wait4() call will
+     receive the signal.  A different setting is inheritable */
+  signal (SIGCHLD, SIG_DFL);
+#endif
+
 #define _ENV_(v,m,n,t)   { tSCC var[] = n;  \
   v = getenv (var); if (m && (v == NULL)) { \
   fprintf (stderr, var_not_found, var);     \
@@ -908,7 +919,7 @@ fix_with_system (p_fixd, pz_fix_file, pz_file_source, pz_temp_file)
       /*
        *  Now add the fix number and file names that may be needed
        */
-      sprintf (pz_scan, "%ld %s %s %s", p_fixd - fixDescList,
+      sprintf (pz_scan, "%ld \'%s\' \'%s\' \'%s\'", p_fixd - fixDescList,
               pz_fix_file, pz_file_source, pz_temp_file);
     }
   else /* NOT an "internal" fix: */
@@ -927,7 +938,7 @@ fix_with_system (p_fixd, pz_fix_file, pz_file_source, pz_temp_file)
          the following bizarre use of 'cat' only works on DOS boxes.
          It causes the file to be dropped into a temporary file for
          'cat' to read (pipes do not work on DOS).  */
-      tSCC   z_cmd_fmt[] = " %s | cat > %s";
+      tSCC   z_cmd_fmt[] = " \'%s\' | cat > \'%s\'";
 #else
       /* Don't use positional formatting arguments because some lame-o
          implementations cannot cope  :-(.  */
@@ -1250,7 +1261,7 @@ test_for_changes (read_fd)
 {
   FILE *in_fp = fdopen (read_fd, "r");
   FILE *out_fp = (FILE *) NULL;
-  char *pz_cmp = pz_curr_data;
+  unsigned char *pz_cmp = (unsigned char*)pz_curr_data;
 
 #ifdef DO_STATS
   fixed_ct++;
@@ -1262,6 +1273,7 @@ test_for_changes (read_fd)
       ch = getc (in_fp);
       if (ch == EOF)
         break;
+      ch &= 0xFF; /* all bytes are 8 bits */
 
       /*  IF we are emitting the output
           THEN emit this character, too.
@@ -1280,8 +1292,9 @@ test_for_changes (read_fd)
           altered_ct++;
 #endif
           /*  IF there are matched data, write the matched part now. */
-          if (pz_cmp != pz_curr_data)
-            fwrite (pz_curr_data, (size_t)(pz_cmp - pz_curr_data), 1, out_fp);
+          if ((char*)pz_cmp != pz_curr_data)
+            fwrite (pz_curr_data, (size_t)((char*)pz_cmp - pz_curr_data),
+                                       1, out_fp);
 
           /*  Emit the current unmatching character */
           putc (ch, out_fp);