Author | Jamozed <[email protected]> |
Date | 2020-07-09 09:48:14 |
Commit | b6408670959e3ec344ce5c1973d0a3f810527118 |
Parent | 0b0be97cc31f21056a2cd77f84c5f98c812f95b9 |
env: Fix misleading indentation warning
Diffstat
M | src/env.c | | | 15 | ++++++++------- |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/env.c b/src/env.c index 889f3dd..11afa76 100644 --- a/src/env.c +++ b/src/env.c @@ -1,4 +1,4 @@ -// env.c, version 1.0.1 +// env.c, version 1.0.2 // OMKOV coreutils implementation of POSIX env // Copyright (C) 2020, Jakob Wakeling // All rights reserved. @@ -43,14 +43,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. #include <stdio.h> #include <stdlib.h> -#define VERSION "1.0.1" +#define VERSION "1.0.2" extern char **environ; static void help(void); static void version(void); -int main(int ac, char *av[]) { A0 = av[0]; +int main(int ac, char *av[]) { (void)ac; A0 = av[0]; lop_t lops[] = { { "help", ARG_NUL, 256 }, { "version", ARG_NUL, 257 }, @@ -66,11 +66,12 @@ int main(int ac, char *av[]) { A0 = av[0]; } register char **p = &av[opt.ind]; - for (; *p && strchr(*p, '=') != NULL; ++p) { putenv(*p); } + for (; *p && strchr(*p, '='); ++p) { putenv(*p); } - if (!*p) { if (environ) for (char **v = environ; *v; ++v) { - fputs(*v, stdout); fputc('\n', stdout); - } return 0; } + if (!*p) { + if (environ) for (char **v = environ; *v; ++v) { puts(*v); } + return 0; + } execvp(*p, &*p);