summaryrefslogtreecommitdiff
path: root/src/dged/path.h
diff options
context:
space:
mode:
authorAlbert Cervin <albert@acervin.com>2023-05-24 23:28:09 +0200
committerAlbert Cervin <albert@acervin.com>2023-05-24 23:28:09 +0200
commitf2614efe03e04575e1b9ded663a553557452c7ae (patch)
treede8d8a538cec3595fcb716d413fa3bf4f68e173c /src/dged/path.h
parent4f3b576db6b01c8c88076985478e2a7fa37be340 (diff)
downloaddged-f2614efe03e04575e1b9ded663a553557452c7ae.tar.gz
dged-f2614efe03e04575e1b9ded663a553557452c7ae.tar.xz
dged-f2614efe03e04575e1b9ded663a553557452c7ae.zip
Formatting changes
Diffstat (limited to 'src/dged/path.h')
-rw-r--r--src/dged/path.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/dged/path.h b/src/dged/path.h
index d74f723..6e11d6a 100644
--- a/src/dged/path.h
+++ b/src/dged/path.h
@@ -9,19 +9,19 @@ static char *expanduser(const char *path) {
if (tilde_pos != NULL) {
char *home = getenv("HOME");
if (home != NULL) {
- // allocate a new string based with the new len
- size_t home_len = strlen(home);
- size_t path_len = strlen(path);
- size_t total_len = path_len + home_len;
- res = malloc(total_len);
- size_t initial_len = tilde_pos - path;
- strncpy(res, path, initial_len);
+ // allocate a new string based with the new len
+ size_t home_len = strlen(home);
+ size_t path_len = strlen(path);
+ size_t total_len = path_len + home_len;
+ res = malloc(total_len);
+ size_t initial_len = tilde_pos - path;
+ strncpy(res, path, initial_len);
- strncpy(res + initial_len, home, home_len);
+ strncpy(res + initial_len, home, home_len);
- size_t rest_len = path_len - initial_len - 1;
- strncpy(res + initial_len + home_len, path + initial_len + 1, rest_len);
- res[total_len-1] = '\0';
+ size_t rest_len = path_len - initial_len - 1;
+ strncpy(res + initial_len + home_len, path + initial_len + 1, rest_len);
+ res[total_len - 1] = '\0';
}
}