diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2011-11-16 21:14:26 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2011-11-16 21:14:26 +0000 |
commit | 719a93c880bb75189371605a0773a1f9b77ed26a (patch) | |
tree | 47cd29735024b7e2361ff7038dc2095bc7ab1d9c /app/xterm/misc.c | |
parent | e2b9e6a531074d39884bbfb9fceea5452477e6e1 (diff) |
Update to xterm 276. Tested by ajacoutot@, krw@, naddy@, shadchin@.
Diffstat (limited to 'app/xterm/misc.c')
-rw-r--r-- | app/xterm/misc.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/app/xterm/misc.c b/app/xterm/misc.c index 50dd097c7..d2c171794 100644 --- a/app/xterm/misc.c +++ b/app/xterm/misc.c @@ -1,4 +1,4 @@ -/* $XTermId: misc.c,v 1.548 2011/09/11 20:18:45 tom Exp $ */ +/* $XTermId: misc.c,v 1.550 2011/10/09 14:13:41 tom Exp $ */ /* * Copyright 1999-2010,2011 by Thomas E. Dickey @@ -4318,6 +4318,9 @@ Cleanup(int code) } #ifndef VMS +#ifndef PATH_MAX +#define PATH_MAX 512 /* ... is not defined consistently in Xos.h */ +#endif char * xtermFindShell(char *leaf, Bool warning) { @@ -4327,7 +4330,21 @@ xtermFindShell(char *leaf, Bool warning) char *result = leaf; TRACE(("xtermFindShell(%s)\n", leaf)); - if (*result != '\0' && strchr("+/-", *result) == 0) { + + if (!strncmp("./", result, (size_t) 2) + || !strncmp("../", result, (size_t) 3)) { + size_t need = PATH_MAX; + size_t used = strlen(result) + 2; + char *buffer = malloc(used + need); + if (buffer != 0) { + if (getcwd(buffer, need) != 0) { + sprintf(buffer + strlen(buffer), "/%s", result); + result = buffer; + } else { + free(buffer); + } + } + } else if (*result != '\0' && strchr("+/-", *result) == 0) { /* find it in $PATH */ if ((s = x_getenv("PATH")) != 0) { if ((tmp = TypeMallocN(char, strlen(leaf) + strlen(s) + 2)) != 0) { |