diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-01-29 17:51:49 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-01-29 17:51:49 -0500 |
commit | a0b84cc8f40e19a506332be3a05222b87e6ed617 (patch) | |
tree | 68607facee3bb655cfe2166d4a578db9e91bdf1f /util.c | |
parent | 565b5e619ed64f459f1b38b5b94bb72b5b9a714f (diff) |
better tab bar, default to "save as" on Ctrl+S with starting buffer
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -204,3 +204,13 @@ static void qsort_with_context(void *base, size_t nmemb, size_t size, int (*comp qsort_ctx_cmp = compar; qsort(base, nmemb, size, qsort_with_context_cmp); } + +// the actual file name part of the path; get rid of the containing directory. +// NOTE: the returned string is part of path, so you don't need to free it or anything. +static char const *path_filename(char const *path) { + char const *last_path_sep = strrchr(path, PATH_SEPARATOR); + if (last_path_sep) + return last_path_sep + 1; + // (a relative path with no path separators) + return path; +} |