Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ cdcmd(int argc, char **argv)
}
if (!dest)
dest = nullstr;
if (*dest == '/')
if (*dest == '/' || strchr(dest, ':'))
goto step6;
if (*dest == '.') {
c = dest[1];
Expand Down Expand Up @@ -210,19 +210,19 @@ updatepwd(const char *dir)

cdcomppath = sstrdup(dir);
STARTSTACKSTR(new);
if (*dir != '/') {
if (*dir != '/' && !strchr(dir, ':')) {
if (curdir == nullstr)
return 0;
new = stputs(curdir, new);
}
new = makestrspace(strlen(dir) + 2, new);
lim = stackblock() + 1;
if (*dir != '/') {
if (*dir != '/' && !strchr(dir, ':')) {
if (new[-1] != '/')
USTPUTC('/', new);
if (new > lim && *lim == '/')
lim++;
} else {
} else if (*dir == '/') {
USTPUTC('/', new);
cdcomppath++;
if (dir[1] == '/' && dir[2] != '/') {
Expand Down
12 changes: 6 additions & 6 deletions src/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ padvance(const char **path, const char *name)
if (*path == NULL)
return NULL;
start = *path;
for (p = start ; *p && *p != ':' && *p != '%' ; p++);
for (p = start ; *p && *p != ';' && *p != '%' ; p++);
len = p - start + strlen(name) + 2; /* "2" is for '/' and '\0' */
while (stackblocksize() < len)
growstackblock();
Expand All @@ -207,9 +207,9 @@ padvance(const char **path, const char *name)
pathopt = NULL;
if (*p == '%') {
pathopt = ++p;
while (*p && *p != ':') p++;
while (*p && *p != ';') p++;
}
if (*p == ':')
if (*p == ';')
*path = p + 1;
else
*path = NULL;
Expand Down Expand Up @@ -530,16 +530,16 @@ changepath(const char *newval)
for (;;) {
if (*old != *new) {
firstchange = idx;
if ((*old == '\0' && *new == ':')
|| (*old == ':' && *new == '\0'))
if ((*old == '\0' && *new == ';')
|| (*old == ';' && *new == '\0'))
firstchange++;
old = new; /* ignore subsequent differences */
}
if (*new == '\0')
break;
if (*new == '%' && bltin < 0 && prefix(new + 1, "builtin"))
bltin = idx;
if (*new == ':') {
if (*new == ';') {
idx++;
}
new++, old++;
Expand Down
20 changes: 16 additions & 4 deletions src/redir.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,28 @@ RESET {
* the original file dscriptor is not open.
*/

int dup10(int fd) {
// XXX hack
int new_fd = dup(fd);
if (new_fd < 0)
return -1;
if (new_fd > 10)
return new_fd;
else {
int new_fd2 = dup10(new_fd);
close(new_fd);
return new_fd2;
}

}

int
savefd(int from, int ofd)
{
return from; // FIXME
/*
int newfd;
int err;

newfd = fcntl(from, F_DUPFD, 10);
newfd = dup10(from);
err = newfd < 0 ? errno : 0;
if (err != EBADF) {
close(ofd);
Expand All @@ -409,7 +422,6 @@ savefd(int from, int ofd)
}

return newfd;
*/
}


Expand Down