From f42bd3a3f9f018fc5a1a09c2a3175048660ba48f Mon Sep 17 00:00:00 2001 From: Clint Adams Date: Wed, 27 Sep 2000 19:31:44 +0000 Subject: 12863: remove ztrdupstrip, use VARARR in ztat --- Src/Zle/compresult.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'Src/Zle/compresult.c') diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c index 92bb2c803..544d4a8a8 100644 --- a/Src/Zle/compresult.c +++ b/Src/Zle/compresult.c @@ -732,16 +732,22 @@ mod_export int ztat(char *nam, struct stat *buf, int ls) { int e; - char *b; if (!(ls ? lstat(nam, buf) : stat(nam, buf))) return 0; - - b = ztrdupstrip(nam, '\\'); - - e = ls ? lstat(b, buf) : stat(b, buf); - zsfree(b); - return e; + else { + char *p; + VARARR(char, b, strlen(nam) + 1); + + for (p = b; *nam; nam++) + if (*nam == '\\' && nam[1]) + *p++ = *++nam; + else + *p++ = *nam; + *p = '\0'; + + return ls ? lstat(b, buf) : stat(b, buf); + } } /* Insert a single match in the command line. */ -- cgit 1.4.1