From 6d0d8a6511bfd13970811abd58c1374a0064c5de Mon Sep 17 00:00:00 2001 From: dfffffff Date: Sat, 3 Sep 2016 08:42:50 -0400 Subject: [PATCH] re-indented/formated --- Applications/util/which.c | 70 +++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/Applications/util/which.c b/Applications/util/which.c index 4782ced5..167cdab0 100644 --- a/Applications/util/which.c +++ b/Applications/util/which.c @@ -4,45 +4,45 @@ int main(int argc, char *argv[]) { - int quit, found; - char *envpath; - char *path, *cp; - static char buf[512]; - static char patbuf[512]; + int quit, found; + char *envpath; + char *path, *cp; + static char buf[512]; + static char patbuf[512]; - if (argc < 2) { - fprintf(stderr, "Usage: which cmd [cmd, ..]\n"); - return 1; - } - if ((envpath = getenv("PATH")) == 0) { - envpath = "."; - } - argv[argc] = 0; - for (argv++; *argv; argv++) { + if (argc < 2) { + fprintf(stderr, "Usage: which cmd [cmd, ..]\n"); + return 1; + } + if ((envpath = getenv("PATH")) == 0) { + envpath = "."; + } + argv[argc] = 0; + for (argv++; *argv; argv++) { - strcpy(patbuf, envpath); - cp = path = patbuf; - quit = found = 0; + strcpy(patbuf, envpath); + cp = path = patbuf; + quit = found = 0; - while (!quit) { - cp = index(path, ':'); - if (cp == NULL) { - quit++; - } else { - *cp = '\0'; - } - snprintf(buf, 512, "%s/%s", (*path ? path : "."), *argv); - path = ++cp; + while (!quit) { + cp = index(path, ':'); + if (cp == NULL) { + quit++; + } else { + *cp = '\0'; + } + snprintf(buf, 512, "%s/%s", (*path ? path : "."), *argv); + path = ++cp; - if (access(buf, 1) == 0) { - printf("%s\n", buf); - found++; - } - } - if (!found) { - printf("No %s in %s\n", *argv, envpath); + if (access(buf, 1) == 0) { + printf("%s\n", buf); + found++; + } + } + if (!found) { + printf("No %s in %s\n", *argv, envpath); + } } - } - return 0; + return 0; } -- 2.34.1