1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-19 11:31:26 +01:00

A few minor style tweaks (as discussed in 20595 and 20596).

This commit is contained in:
Wayne Davison 2004-12-01 18:18:23 +00:00
parent 5e2d881858
commit bb78896c7f

View file

@ -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