summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>1999-08-19 04:43:46 +0000
committerPaul Smith <psmith@gnu.org>1999-08-19 04:43:46 +0000
commit4ff6c6245665ba7b611bd1f3ee2f5141895d9d69 (patch)
tree15f9e88091217af5eea789eb276d3324d3b10754
parentcbb9e38d10b35a469d0880542b12530817b11003 (diff)
downloadmake-4ff6c6245665ba7b611bd1f3ee2f5141895d9d69.tar.gz
make-4ff6c6245665ba7b611bd1f3ee2f5141895d9d69.tar.bz2
make-4ff6c6245665ba7b611bd1f3ee2f5141895d9d69.zip
* Code cleanup.
-rw-r--r--job.c21
-rw-r--r--main.c54
2 files changed, 38 insertions, 37 deletions
diff --git a/job.c b/job.c
index 7c7d5a0..36a9443 100644
--- a/job.c
+++ b/job.c
@@ -90,7 +90,7 @@ static int amiga_batch_file;
#endif
#ifdef HAVE_WAITPID
-# define WAIT_NOHANG(status) waitpid (-1, (status), WNOHANG)
+# define WAIT_NOHANG (status) waitpid (-1, (status), WNOHANG)
#else /* Don't have waitpid. */
# ifdef HAVE_WAIT3
# ifndef wait3
@@ -248,7 +248,7 @@ free_job_token (child)
/* Write any other job tokens back to the pipe. */
while (write (job_fds[1], &child->job_token, 1) != 1)
if (!EINTR_SET)
- pfatal_with_name(_("write jobserver"));
+ pfatal_with_name (_("write jobserver"));
break;
}
@@ -678,7 +678,7 @@ reap_children (block, err)
block_sigs ();
/* If this job has a token out, return it. */
- free_job_token(c);
+ free_job_token (c);
/* There is now another slot open. */
if (job_slots_used > 0)
@@ -733,7 +733,7 @@ free_child (child)
/* If this child has a token it hasn't relinquished, give it up now.
This can happen if the job completes immediately, mainly because
all the command lines evaluated to empty strings. */
- free_job_token(child);
+ free_job_token (child);
free ((char *) child);
}
@@ -889,10 +889,11 @@ start_job_command (child)
#ifdef __MSDOS__
unixy_shell /* the test is complicated and we already did it */
#else
- (argv[0] && !strcmp(argv[0], "/bin/sh"))
+ (argv[0] && !strcmp (argv[0], "/bin/sh"))
#endif
- && (argv[1] && !strcmp(argv[1], "-c"))
- && (argv[2] && !strcmp(argv[2], ":"))
+ && (argv[1]
+ && argv[1][0] == '-' && argv[1][1] == 'c' && argv[1][2] == '\0')
+ && (argv[2] && argv[2][0] == ':' && argv[2][1] == '\0')
&& argv[3] == NULL)
{
free (argv[0]);
@@ -1404,7 +1405,7 @@ new_job (file)
reap_children (0, 0);
}
- assert(c->job_token != '-');
+ assert (c->job_token != '-');
if (debug_flag)
printf (_("Obtained token `%c' for child 0x%08lx (%s).\n"),
c->job_token, (unsigned long int) c, c->file->name);
@@ -2146,7 +2147,7 @@ construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr)
/* Note these overlap and strcpy() is undefined for
overlapping objects in ANSI C. The strlen() _IS_ right,
since we need to copy the nul byte too. */
- bcopy (p + 1, p, strlen(p));
+ bcopy (p + 1, p, strlen (p));
if (instring)
goto string_char;
@@ -2314,7 +2315,7 @@ construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr)
}
*dptr = 0;
- new_argv = (char **) xmalloc(2 * sizeof(char *));
+ new_argv = (char **) xmalloc (2 * sizeof (char *));
new_argv[0] = buffer;
new_argv[1] = 0;
}
diff --git a/main.c b/main.c
index 72a8aa9..af77d5f 100644
--- a/main.c
+++ b/main.c
@@ -1139,7 +1139,7 @@ int main (int argc, char ** argv)
while (!feof (stdin))
{
char buf[2048];
- unsigned int n = fread (buf, 1, sizeof(buf), stdin);
+ unsigned int n = fread (buf, 1, sizeof (buf), stdin);
if (n > 0 && fwrite (buf, 1, n, outfile) != n)
pfatal_with_name (_("fwrite (temporary file)"));
}
@@ -1156,7 +1156,7 @@ int main (int argc, char ** argv)
}
/* Make sure the temporary file will not be remade. */
- stdin_nm = savestring (name, sizeof(name) -1);
+ stdin_nm = savestring (name, sizeof (name) -1);
f = enter_file (stdin_nm);
f->updated = 1;
f->update_status = 0;
@@ -1193,9 +1193,9 @@ int main (int argc, char ** argv)
/* This is supposed to be the default, but what the heck... */
sa.sa_flags = SA_INTERRUPT;
# endif
-# define HANDLESIG(s) sigaction(s, &sa, NULL)
+# define HANDLESIG(s) sigaction (s, &sa, NULL)
# else
-# define HANDLESIG(s) signal(s, child_handler)
+# define HANDLESIG(s) signal (s, child_handler)
# endif
/* OK, now actually install the handlers. */
@@ -1329,7 +1329,7 @@ int main (int argc, char ** argv)
if (job_slots > 1)
{
- char buf[(sizeof("1024")*2)+1];
+ char buf[(sizeof ("1024")*2)+1];
char c = '0';
if (pipe (job_fds) < 0 || (job_rfd = dup (job_fds[0])) < 0)
@@ -1341,7 +1341,7 @@ int main (int argc, char ** argv)
while (--job_slots)
{
- write(job_fds[1], &c, 1);
+ write (job_fds[1], &c, 1);
if (c == '9')
c = 'a';
else if (c == 'z')
@@ -1352,8 +1352,8 @@ int main (int argc, char ** argv)
++c;
}
- sprintf(buf, "%d,%d", job_fds[0], job_fds[1]);
- job_slots_str = xstrdup(buf);
+ sprintf (buf, "%d,%d", job_fds[0], job_fds[1]);
+ job_slots_str = xstrdup (buf);
}
#endif
@@ -1590,9 +1590,9 @@ int main (int argc, char ** argv)
/* Add -o option for the stdin temporary file, if necessary. */
if (stdin_nm)
{
- nargv = (char **)xmalloc((nargc + 2) * sizeof(char *));
- bcopy((char *)argv, (char *)nargv, argc * sizeof(char *));
- nargv[nargc++] = concat("-o", stdin_nm, "");
+ nargv = (char **) xmalloc ((nargc + 2) * sizeof (char *));
+ bcopy ((char *) argv, (char *) nargv, argc * sizeof (char *));
+ nargv[nargc++] = concat ("-o", stdin_nm, "");
nargv[nargc] = 0;
}
@@ -1670,8 +1670,8 @@ int main (int argc, char ** argv)
/* If there is a temp file from reading a makefile from stdin, get rid of
it now. */
- if (stdin_nm && unlink(stdin_nm) < 0 && errno != ENOENT)
- perror_with_name(_("unlink (temporary file): "), stdin_nm);
+ if (stdin_nm && unlink (stdin_nm) < 0 && errno != ENOENT)
+ perror_with_name (_("unlink (temporary file): "), stdin_nm);
{
int status;
@@ -1849,7 +1849,7 @@ handle_non_switch_argument (arg, env)
struct variable *v;
char *value;
- v = lookup_variable("MAKECMDGOALS", 12);
+ v = lookup_variable ("MAKECMDGOALS", 12);
if (v == 0)
value = f->name;
else
@@ -1857,14 +1857,14 @@ handle_non_switch_argument (arg, env)
/* Paste the old and new values together */
unsigned int oldlen, newlen;
- oldlen = strlen(v->value);
- newlen = strlen(f->name);
- value = (char *)alloca(oldlen + 1 + newlen + 1);
- bcopy(v->value, value, oldlen);
+ oldlen = strlen (v->value);
+ newlen = strlen (f->name);
+ value = (char *) alloca (oldlen + 1 + newlen + 1);
+ bcopy (v->value, value, oldlen);
value[oldlen] = ' ';
- bcopy(f->name, &value[oldlen + 1], newlen + 1);
+ bcopy (f->name, &value[oldlen + 1], newlen + 1);
}
- define_variable("MAKECMDGOALS", 12, value, o_default, 0);
+ define_variable ("MAKECMDGOALS", 12, value, o_default, 0);
}
}
}
@@ -2041,7 +2041,7 @@ decode_switches (argc, argv, env)
if (optarg == 0)
optarg = cs->noarg_value;
- *(char **)cs->value_ptr = optarg;
+ *(char **) cs->value_ptr = optarg;
break;
case string:
@@ -2129,7 +2129,7 @@ positive integral argument"),
if (!env && (bad || print_usage_flag))
{
- print_usage(bad);
+ print_usage (bad);
die (bad ? 2 : 0);
}
}
@@ -2345,16 +2345,16 @@ define_makeflags (all, makefile)
case int_string:
if (all)
{
- char *vp = *(char **)cs->value_ptr;
+ char *vp = *(char **) cs->value_ptr;
if (cs->default_value != 0
- && streq(vp, cs->default_value))
+ && streq (vp, cs->default_value))
break;
if (cs->noarg_value != 0
- && streq(vp, cs->noarg_value))
- ADD_FLAG("", 0); /* Optional value omitted; see below. */
+ && streq (vp, cs->noarg_value))
+ ADD_FLAG ("", 0); /* Optional value omitted; see below. */
else
- ADD_FLAG(vp, strlen(vp));
+ ADD_FLAG (vp, strlen (vp));
}
break;