aboutsummaryrefslogtreecommitdiffstats
path: root/src/ckutil.c
diff options
context:
space:
mode:
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) {