- {
- char *target = u->dir;
-
- DEBUGP (("changing working directory\n"));
-
- /* Change working directory. To change to a non-absolute
- Unix directory, we need to prepend initial directory
- (con->id) to it. Absolute directories "just work".
-
- A relative directory is one that does not begin with '/'
- and, on non-Unix OS'es, one that doesn't begin with
- "[a-z]:".
-
- This is not done for OS400, which doesn't use
- "/"-delimited directories, nor does it support directory
- hierarchies. "CWD foo" followed by "CWD bar" leaves us
- in "bar", not in "foo/bar", as would be customary
- elsewhere. */
-
- if (target[0] != '/'
- && !(con->rs != ST_UNIX
- && ISALPHA (target[0])
- && target[1] == ':')
- && con->rs != ST_OS400)
- {
- int idlen = strlen (con->id);
- char *ntarget, *p;
-
- /* Strip trailing slash(es) from con->id. */
- while (idlen > 0 && con->id[idlen - 1] == '/')
- --idlen;
- p = ntarget = (char *)alloca (idlen + 1 + strlen (u->dir) + 1);
- memcpy (p, con->id, idlen);
- p += idlen;
- *p++ = '/';
- strcpy (p, target);
+ {
+ char *target = u->dir;
+
+ DEBUGP (("changing working directory\n"));
+
+ /* Change working directory. To change to a non-absolute
+ Unix directory, we need to prepend initial directory
+ (con->id) to it. Absolute directories "just work".
+
+ A relative directory is one that does not begin with '/'
+ and, on non-Unix OS'es, one that doesn't begin with
+ "[a-z]:".
+
+ This is not done for OS400, which doesn't use
+ "/"-delimited directories, nor does it support directory
+ hierarchies. "CWD foo" followed by "CWD bar" leaves us
+ in "bar", not in "foo/bar", as would be customary
+ elsewhere. */
+
+ if (target[0] != '/'
+ && !(con->rs != ST_UNIX
+ && c_isalpha (target[0])
+ && target[1] == ':')
+ && con->rs != ST_OS400)
+ {
+ int idlen = strlen (con->id);
+ char *ntarget, *p;
+
+ /* Strip trailing slash(es) from con->id. */
+ while (idlen > 0 && con->id[idlen - 1] == '/')
+ --idlen;
+ p = ntarget = (char *)alloca (idlen + 1 + strlen (u->dir) + 1);
+ memcpy (p, con->id, idlen);
+ p += idlen;
+ *p++ = '/';
+ strcpy (p, target);