hirc

IRC client
Log | Files | Refs

commit f231e9cbd21a43dd2337e400eadb2f40928ffb93
parent 7bced859ecbb463d5f68d62723329fe8dc10c2de
Author: hhvn <dev@hhvn.uk>
Date:   Mon,  2 May 2022 16:18:55 +0100

Support ~ as home dir in commands and completion

Diffstat:
Msrc/commands.c | 3++-
Msrc/complete.c | 4++--
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/commands.c b/src/commands.c @@ -1389,7 +1389,7 @@ command_source) { p = strrchr(str, ' '); if (p && *(p+1) == '\0') *p = '\0'; /* remove trailing spaces */ - config_read(str); + config_read(homepath(str)); } COMMAND( @@ -1457,6 +1457,7 @@ command_dump) { command_toofew("dump"); return; } + str = homepath(str); p = strrchr(str, ' '); if (p && *(p+1) == '\0') *p = '\0'; diff --git a/src/complete.c b/src/complete.c @@ -111,8 +111,8 @@ complete_files(char *str, char **ret, int *fullcomplete) { int dirs, i; size_t len; - cpy[0] = estrdup(str); - cpy[1] = estrdup(str); + cpy[0] = estrdup(homepath(str)); + cpy[1] = estrdup(cpy[0]); dir = estrdup(dirname(cpy[0])); base = basename(cpy[1]); len = strlen(base);