diff options
author | Chet Ramey <chet.ramey@case.edu> | 2011-12-03 13:37:00 -0500 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2011-12-03 13:37:00 -0500 |
commit | 22e63b05c844e8bc57786e8085f59c47e1728ebe (patch) | |
tree | c0ba4794ade816759e28262c11d1a68ee806859a /lib/tilde/tilde.c | |
parent | 633e5c6dee15fe4b85c9eac159d6f4aa147b1f09 (diff) | |
download | bash-22e63b05c844e8bc57786e8085f59c47e1728ebe.tar.gz |
commit bash-20040923 snapshot
Diffstat (limited to 'lib/tilde/tilde.c')
-rw-r--r-- | lib/tilde/tilde.c | 33 |
1 files changed, 33 insertions, 0 deletions
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 * |