diff options
author | Wayne Davison <wayned@users.sourceforge.net> | 2004-12-01 18:18:23 +0000 |
---|---|---|
committer | Wayne Davison <wayned@users.sourceforge.net> | 2004-12-01 18:18:23 +0000 |
commit | bb78896c7ffb23546dca127e324f33e4ba753669 (patch) | |
tree | 337eebcb08cb0e57f2252049bc466db12d2d3311 /Src/compat.c | |
parent | 5e2d881858acc5d4d84599ac0153dcb758395f68 (diff) | |
download | zsh-bb78896c7ffb23546dca127e324f33e4ba753669.tar.gz zsh-bb78896c7ffb23546dca127e324f33e4ba753669.tar.xz zsh-bb78896c7ffb23546dca127e324f33e4ba753669.zip |
A few minor style tweaks (as discussed in 20595 and 20596).
Diffstat (limited to 'Src/compat.c')
-rw-r--r-- | Src/compat.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Src/compat.c b/Src/compat.c index b8e1a6f0f..1265e7ee9 100644 --- a/Src/compat.c +++ b/Src/compat.c @@ -38,7 +38,7 @@ char * strstr(const char *s, const char *t) { char *p1, *p2; - + for (; *s; s++) { for (p1 = s, p2 = t; *p2; p1++, p2++) if (*p1 != *p2) @@ -387,8 +387,7 @@ zchdir(char *dir) int currdir = -2; for (;;) { - if (!*dir || !chdir(dir)) - { + if (!*dir || chdir(dir) == 0) { #ifdef HAVE_FCHDIR if (currdir >= 0) close(currdir); @@ -398,7 +397,8 @@ zchdir(char *dir) if ((errno != ENAMETOOLONG && errno != ENOMEM) || strlen(dir) < PATH_MAX) break; - for (s = dir + PATH_MAX - 1; s > dir && *s != '/'; s--); + for (s = dir + PATH_MAX - 1; s > dir && *s != '/'; s--) + ; if (s == dir) break; #ifdef HAVE_FCHDIR @@ -406,7 +406,7 @@ zchdir(char *dir) currdir = open(".", O_RDONLY|O_NOCTTY); #endif *s = '\0'; - if (chdir(dir)) { + if (chdir(dir) < 0) { *s = '/'; break; } @@ -414,7 +414,8 @@ zchdir(char *dir) currdir = -1; #endif *s = '/'; - while (*++s == '/'); + while (*++s == '/') + ; dir = s; } #ifdef HAVE_FCHDIR |