aboutsummaryrefslogtreecommitdiffstats
path: root/src/ckutil.c
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2018-11-13 01:29:29 +0200
committergramanas <anastasis.gramm2@gmail.com>2018-11-13 01:29:29 +0200
commitd015a5e66ac9b92bba4eb5020e7bf2384f65ed25 (patch)
treeb35417c4fb82e320f6d1297f449991c6c3537134 /src/ckutil.c
parent2638802ccd0d0776ebf1867181d4e3950a147074 (diff)
downloadck-d015a5e66ac9b92bba4eb5020e7bf2384f65ed25.tar.gz
ck-d015a5e66ac9b92bba4eb5020e7bf2384f65ed25.tar.bz2
ck-d015a5e66ac9b92bba4eb5020e7bf2384f65ed25.zip
Homedir finished
Diffstat (limited to 'src/ckutil.c')
-rw-r--r--src/ckutil.c16
1 files changed, 8 insertions, 8 deletions
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) {