From d015a5e66ac9b92bba4eb5020e7bf2384f65ed25 Mon Sep 17 00:00:00 2001 From: gramanas Date: Tue, 13 Nov 2018 01:29:29 +0200 Subject: Homedir finished --- src/ckutil.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/ckutil.c') diff --git a/src/ckutil.c b/src/ckutil.c index 0895677..8ae7e41 100644 --- a/src/ckutil.c +++ b/src/ckutil.c @@ -143,9 +143,9 @@ int str_is_empty(const char *s) { return 1; } -int swap_tilde_with_home(char *ret, const char *s, const char *home) { +char * swap_tilde_with_home(char *ret, const char *s, const char *home) { if (!ret || !s || !home) { - return -1; + return NULL; } ulong i; ulong homelen = strlen(home); @@ -154,22 +154,22 @@ int swap_tilde_with_home(char *ret, const char *s, const char *home) { for (i = 1; i < strlen(s); i++) { ret[homelen - 1 + i] = s[i]; } - return 0; + return ret; } - return -1; + return NULL; } -int swap_home_with_tilde(char *ret, const char *s, const char *home) { +char * swap_home_with_tilde(char *ret, const char *s, const char *home) { if (!ret || !s || !home) { - return -1; + return NULL; } ulong i; ulong homelen = strlen(home); for (i = 0; i < strlen(home); i++) { if (s[i] != home[i]) { - return -1; + return NULL; } } /* s starts with $HOME */ @@ -177,7 +177,7 @@ int swap_home_with_tilde(char *ret, const char *s, const char *home) { for (i = homelen; i < strlen(s); i++) { ret[i + 1 - homelen] = s[i]; } - return 0; + return ret; } int util_own_grp_copy(const char *dest, const char *original) { -- cgit v1.2.3