From 7aa651a6a4496d848f86de9b1e6b3a003256a01f Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 13 Nov 2012 17:14:08 -0600 Subject: Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style. The actual code should be the same afterward, this is just cosmetic refactoring. --- toys/posix/env.c | 64 +++++++++++++++++++++++++++----------------------------- 1 file changed, 31 insertions(+), 33 deletions(-) (limited to 'toys/posix/env.c') diff --git a/toys/posix/env.c b/toys/posix/env.c index 32272799..8f7ccf1f 100644 --- a/toys/posix/env.c +++ b/toys/posix/env.c @@ -1,6 +1,4 @@ -/* vi: set sw=4 ts=4: - * - * env.c - Set the environment for command invocation. +/* env.c - Set the environment for command invocation. * * Copyright 2012 Tryn Mirell * @@ -9,14 +7,14 @@ USE_ENV(NEWTOY(env, "^i", TOYFLAG_USR|TOYFLAG_BIN)) config ENV - bool "env" - default y - help - usage: env [-i] [NAME=VALUE...] [command [option...]] + bool "env" + default y + help + usage: env [-i] [NAME=VALUE...] [command [option...]] - Set the environment for command invocation. + Set the environment for command invocation. - -i Clear existing environment. + -i Clear existing environment. */ #include "toys.h" @@ -25,29 +23,29 @@ extern char **environ; void env_main(void) { - char **ev; - char **command = NULL; - char *del = "="; - - if (toys.optflags) clearenv(); - - for (ev = toys.optargs; *ev != NULL; ev++) { - char *env, *val = NULL; - - env = strtok(*ev, del); - - if (env) val = strtok(NULL, del); - - if (val) setenv(env, val, 1); - else { - command = ev; - break; - } + char **ev; + char **command = NULL; + char *del = "="; + + if (toys.optflags) clearenv(); + + for (ev = toys.optargs; *ev != NULL; ev++) { + char *env, *val = NULL; + + env = strtok(*ev, del); + + if (env) val = strtok(NULL, del); + + if (val) setenv(env, val, 1); + else { + command = ev; + break; } - - if (!command) { - char **ep; - for (ep = environ; *ep; ep++) xputs(*ep); - return; - } else xexec(command); + } + + if (!command) { + char **ep; + for (ep = environ; *ep; ep++) xputs(*ep); + return; + } else xexec(command); } -- cgit v1.2.3