scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit dddda2173652528dda59bef3f5a2e3ce408d0606
parent 2dc37e0dadf780af8cdba452e3f7d6a28ab6b476
Author: Quentin Rameau <quinq@fifth.space>
Date:   Tue,  7 Jun 2016 14:24:48 +0200

[driver] adapt spawn() style to the other functions

Diffstat:
Mdriver/posix/scc.c | 30+++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/driver/posix/scc.c b/driver/posix/scc.c @@ -206,27 +206,27 @@ settool(int tool, char *infile, int nexttool) } static void -spawn(int t) +spawn(int tool) { - Tool *tool = tools[t]; + Tool *t = tools[tool]; - switch (tool->pid = fork()) { + switch (t->pid = fork()) { case -1: - die("scc: %s: %s", tool->bin, strerror(errno)); + die("scc: %s: %s", t->bin, strerror(errno)); case 0: - if (tool->out) - dup2(tool->out, 1); - if (tool->in) - dup2(tool->in, 0); - execvp(tool->cmd, tool->args); - fprintf(stderr, "scc: execp %s: %s\n", - tool->cmd, strerror(errno)); + if (t->out) + dup2(t->out, 1); + if (t->in) + dup2(t->in, 0); + execvp(t->cmd, t->args); + fprintf(stderr, "scc: execvp %s: %s\n", + t->cmd, strerror(errno)); _exit(1); default: - if (tool->in) - close(tool->in); - if (tool->out) - close(tool->out); + if (t->in) + close(t->in); + if (t->out) + close(t->out); break; } }