From 22e63b05c844e8bc57786e8085f59c47e1728ebe Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Sat, 3 Dec 2011 13:37:00 -0500 Subject: commit bash-20040923 snapshot --- lib/tilde/tilde.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'lib/tilde/tilde.c') diff --git a/lib/tilde/tilde.c b/lib/tilde/tilde.c index 154f7f81..1136126b 100644 --- a/lib/tilde/tilde.c +++ b/lib/tilde/tilde.c @@ -277,6 +277,39 @@ isolate_tilde_prefix (fname, lenp) return ret; } +#if 0 +/* Public function to scan a string (FNAME) beginning with a tilde and find + the portion of the string that should be passed to the tilde expansion + function. Right now, it just calls tilde_find_suffix and allocates new + memory, but it can be expanded to do different things later. */ +char * +tilde_find_word (fname, flags, lenp) + const char *fname; + int flags, *lenp; +{ + int x; + char *r; + + x = tilde_find_suffix (fname); + if (x == 0) + { + r = savestring (fname); + if (lenp) + *lenp = 0; + } + else + { + r = (char *)xmalloc (1 + x); + strncpy (r, fname, x); + r[x] = '\0'; + if (lenp) + *lenp = x; + } + + return r; +} +#endif + /* Return a string that is PREFIX concatenated with SUFFIX starting at SUFFIND. */ static char * -- cgit v1.2.1