diff options
author | Thiago Jung Bauermann <bauerman@br.ibm.com> | 2012-05-30 03:42:21 +0000 |
---|---|---|
committer | Thiago Jung Bauermann <bauerman@br.ibm.com> | 2012-05-30 03:42:21 +0000 |
commit | ebd86fb5688dac848266e6a902ea192fe9aa1576 (patch) | |
tree | 358233d17205d9744bed552ecc76e78fb6325437 /gdb/source.c | |
parent | b887615911bfb54624c7efa905eaf543d40fcb06 (diff) | |
download | gdb-ebd86fb5688dac848266e6a902ea192fe9aa1576.zip gdb-ebd86fb5688dac848266e6a902ea192fe9aa1576.tar.gz gdb-ebd86fb5688dac848266e6a902ea192fe9aa1576.tar.bz2 |
* source.c (openp): Expand tilde in path entries.
Diffstat (limited to 'gdb/source.c')
-rw-r--r-- | gdb/source.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gdb/source.c b/gdb/source.c index 27c5b0e..7de86b4 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -769,6 +769,25 @@ openp (const char *path, int opts, const char *string, } strcpy (filename, current_directory); } + else if (strchr(dir, '~')) + { + /* See whether we need to expand the tilde. */ + int newlen; + char *tilde_expanded; + + tilde_expanded = tilde_expand (dir); + + /* First, realloc the filename buffer if too short. */ + len = strlen (tilde_expanded); + newlen = len + strlen (string) + 2; + if (newlen > alloclen) + { + alloclen = newlen; + filename = alloca (alloclen); + } + strcpy (filename, tilde_expanded); + xfree (tilde_expanded); + } else { /* Normal file name in path -- just use it. */ |