commit a7f5907b436b1fae677dbf43bca1be8b3e512a75
parent dfcb1268ca8735c79cbb172b789e36a4abd43d43
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 11 Nov 2017 11:34:39 +0100
tweaks: move a general function to the utils.c file
Diffstat:
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -2684,14 +2684,3 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
return buf;
}
#endif /* ENABLE_TABCOMP */
-
-/* Return the filename part of the given path. */
-const char *tail(const char *path)
-{
- const char *slash = strrchr(path, '/');
-
- if (slash == NULL)
- return path;
- else
- return ++slash;
-}
diff --git a/src/proto.h b/src/proto.h
@@ -321,7 +321,6 @@ void free_chararray(char **array, size_t len);
char *input_tab(char *buf, bool allow_files, size_t *place,
bool *lastwastab, void (*refresh_func)(void), bool *listed);
#endif
-const char *tail(const char *path);
/* Some functions in global.c. */
size_t length_of_list(int menu);
@@ -581,6 +580,7 @@ void complete_a_word(void);
/* All functions in utils.c. */
void get_homedir(void);
+const char *tail(const char *path);
char *concatenate(const char *path, const char *name);
#ifdef ENABLE_LINENUMBERS
int digits(ssize_t n);
diff --git a/src/utils.c b/src/utils.c
@@ -53,6 +53,17 @@ void get_homedir(void)
}
}
+/* Return the filename part of the given path. */
+const char *tail(const char *path)
+{
+ const char *slash = strrchr(path, '/');
+
+ if (slash == NULL)
+ return path;
+ else
+ return ++slash;
+}
+
/* Return a copy of the two given strings, welded together. */
char *concatenate(const char *path, const char *name)
{