aboutsummaryrefslogtreecommitdiff
path: root/gcc/fixinc
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@acm.org>1999-05-20 07:10:41 +0000
committerBruce Korb <korbb@gcc.gnu.org>1999-05-20 07:10:41 +0000
commit48ac9ce28c62ff92048a97fd02af394668f027eb (patch)
treef430e64710d3ff45dbb58e4b25e60adcece2fd9b /gcc/fixinc
parent6de94858b971f7e73295163d0a28854ce93024b5 (diff)
downloadgcc-48ac9ce28c62ff92048a97fd02af394668f027eb.zip
gcc-48ac9ce28c62ff92048a97fd02af394668f027eb.tar.gz
gcc-48ac9ce28c62ff92048a97fd02af394668f027eb.tar.bz2
static initialization removal & K&R-ification
From-SVN: r27052
Diffstat (limited to 'gcc/fixinc')
-rw-r--r--gcc/fixinc/Makefile.in4
-rw-r--r--gcc/fixinc/fixincl.c37
-rw-r--r--gcc/fixinc/gnu-regex.c10
-rw-r--r--gcc/fixinc/procopen.c4
-rw-r--r--gcc/fixinc/server.c4
5 files changed, 43 insertions, 16 deletions
diff --git a/gcc/fixinc/Makefile.in b/gcc/fixinc/Makefile.in
index 2ba932f..8976c78 100644
--- a/gcc/fixinc/Makefile.in
+++ b/gcc/fixinc/Makefile.in
@@ -81,8 +81,8 @@ fixincl: $(OBJ)
chmod 777 $@ ; fi
gnu-regex.o: gnu-regex.c
- -$(CC) $(CFLAGS) $(FIXINC_DEFS) -DREGEX_MALLOC -DSTDC_HEADERS=1 \
- -c $(srcdir)/gnu-regex.c
+ -$(CC) $(CFLAGS) $(FIXINC_DEFS) $(INCLUDES) -DREGEX_MALLOC \
+ -DSTDC_HEADERS=1 -c $(srcdir)/gnu-regex.c
fixincl.o : fixincl.x fixincl.c
server.o : server.c server.h
diff --git a/gcc/fixinc/fixincl.c b/gcc/fixinc/fixincl.c
index c3da20f..f4cd5ec 100644
--- a/gcc/fixinc/fixincl.c
+++ b/gcc/fixinc/fixincl.c
@@ -58,6 +58,13 @@ static const char program_id[] = "fixincl version 1.0";
#endif
#define NAME_TABLE_SIZE (MINIMUM_MAXIMUM_LINES * MAXPATHLEN)
+#ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+#endif
+#ifndef EXIT_FAILURE
+# define EXIT_FAILURE 1
+#endif
+
char *file_name_buf;
#define tSCC static const char
@@ -382,7 +389,9 @@ initialize()
`waitpid(2)'. We also ensure that the children exit with success. */
void
-wait_for_pid( pid_t child, int file_name_ct )
+wait_for_pid(child, file_name_ct)
+ pid_t child;
+ int file_name_ct;
{
for (;;) {
int status;
@@ -934,18 +943,20 @@ process (pz_data, pz_file_name)
char *pz_data;
const char *pz_file_name;
{
- static char env_current_file[1024] = { "file=" };
+ static char env_current_file[1024];
tFixDesc *p_fixd = fixDescList;
int todo_ct = FIX_COUNT;
- t_fd_pair fdp = { -1, -1 };
+ int read_fd = -1;
int num_children = 0;
/* IF this is the first time through,
THEN put the 'file' environment variable into the environment.
This is used by some of the subject shell scripts and tests. */
- if (env_current_file[5] == NUL)
+ if (env_current_file[0] == NUL) {
+ strcpy (env_current_file, "file=");
putenv (env_current_file);
+ }
/*
Ghastly as it is, this actually updates the value of the variable:
@@ -1059,10 +1070,10 @@ process (pz_data, pz_file_name)
the first fix. Any subsequent fixes will use the
stdout descriptor of the previous fix as its stdin. */
- if (fdp.read_fd == -1)
+ if (read_fd == -1)
{
- fdp.read_fd = open (pz_file_name, O_RDONLY);
- if (fdp.read_fd < 0)
+ read_fd = open (pz_file_name, O_RDONLY);
+ if (read_fd < 0)
{
fprintf (stderr, "Error %d (%s) opening %s\n", errno,
strerror (errno), pz_file_name);
@@ -1071,7 +1082,7 @@ process (pz_data, pz_file_name)
}
/* This loop should only cycle for 1/2 of one loop.
- "chain_open" starts a process that uses "fdp.read_fd" as
+ "chain_open" starts a process that uses "read_fd" as
its stdin and returns the new fd this process will use
for stdout. */
@@ -1079,14 +1090,14 @@ process (pz_data, pz_file_name)
{
tSCC z_err[] = "Error %d (%s) starting filter process for %s\n";
static int failCt = 0;
- int fd = chain_open (fdp.read_fd,
+ int fd = chain_open (read_fd,
(t_pchar *) p_fixd->patch_args,
(process_chain_head == -1)
? &process_chain_head : (pid_t *) NULL);
if (fd != -1)
{
- fdp.read_fd = fd;
+ read_fd = fd;
num_children++;
break;
}
@@ -1106,7 +1117,7 @@ process (pz_data, pz_file_name)
/* IF after all the tests we did not start any patch programs,
THEN quit now. */
- if (fdp.read_fd < 0)
+ if (read_fd < 0)
return;
/* OK. We have work to do. Read back in the output
@@ -1117,7 +1128,7 @@ process (pz_data, pz_file_name)
output of the filter chain.
*/
{
- FILE *in_fp = fdopen (fdp.read_fd, "r");
+ FILE *in_fp = fdopen (read_fd, "r");
FILE *out_fp = (FILE *) NULL;
char *pz_cmp = pz_data;
@@ -1173,7 +1184,7 @@ process (pz_data, pz_file_name)
}
fclose (in_fp);
}
- close (fdp.read_fd); /* probably redundant, but I'm paranoid */
+ close (read_fd); /* probably redundant, but I'm paranoid */
/* Wait for child processes created by chain_open()
to avoid creating zombies. */
diff --git a/gcc/fixinc/gnu-regex.c b/gcc/fixinc/gnu-regex.c
index 84db70f..b24845b 100644
--- a/gcc/fixinc/gnu-regex.c
+++ b/gcc/fixinc/gnu-regex.c
@@ -80,6 +80,16 @@
#else /* not emacs */
+# include "auto-host.h"
+
+# if !defined(const) && !defined(HAVE_CONST)
+# define const
+# endif
+
+# if !defined(volatile) && !defined(HAVE_VOLATILE)
+# define volatile
+# endif
+
/* If we are not linking with Emacs proper,
we can't use the relocating allocator
even if config.h says that we can. */
diff --git a/gcc/fixinc/procopen.c b/gcc/fixinc/procopen.c
index 28004ee..00f13b7 100644
--- a/gcc/fixinc/procopen.c
+++ b/gcc/fixinc/procopen.c
@@ -104,10 +104,12 @@ chain_open (stdin_fd, pp_args, p_child)
t_pchar *pp_args;
pid_t *p_child;
{
- t_fd_pair stdout_pair = {-1, -1};
+ t_fd_pair stdout_pair;
pid_t ch_id;
char *pz_cmd;
+ stdout_pair.read_fd = stdout_pair.write_fd = -1;
+
/*
* Create a pipe it will be the child process' stdout,
* and the parent will read from it.
diff --git a/gcc/fixinc/server.c b/gcc/fixinc/server.c
index e803e0a..4af40e5 100644
--- a/gcc/fixinc/server.c
+++ b/gcc/fixinc/server.c
@@ -86,6 +86,10 @@
#define NUL '\0'
#endif
+#if !defined(volatile) && !defined(HAVE_VOLATILE)
+# define volatile
+#endif
+
STATIC volatile bool read_pipe_timeout;
static t_pchar def_args[] =