diff options
Diffstat (limited to 'gdb/common/gdb_tilde_expand.c')
-rw-r--r-- | gdb/common/gdb_tilde_expand.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gdb/common/gdb_tilde_expand.c b/gdb/common/gdb_tilde_expand.c index b4f3714..fcb9796 100644 --- a/gdb/common/gdb_tilde_expand.c +++ b/gdb/common/gdb_tilde_expand.c @@ -80,3 +80,16 @@ gdb_tilde_expand (const char *dir) return expanded_dir; } + +/* See common/gdb_tilde_expand.h. */ + +gdb::unique_xmalloc_ptr<char> +gdb_tilde_expand_up (const char *dir) +{ + gdb_glob glob (dir, GLOB_TILDE_CHECK, NULL); + + gdb_assert (glob.pathc () > 0); + /* "glob" may return more than one match to the path provided by the + user, but we are only interested in the first match. */ + return gdb::unique_xmalloc_ptr<char> (xstrdup (glob.pathv ()[0])); +} |