#endif
#include <signal.h>
+#if ! defined( SIGCHLD ) && defined( SIGCLD )
+# define SIGCHLD SIGCLD
+#endif
#ifndef SEPARATE_FIX_PROC
#include "server.h"
#endif
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;
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
;
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); \
/*
* 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: */
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 :-(. */
{
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++;
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.
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);