Commit 5c5fefc8 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

files: tweak the function tail() and rename two variables

parent 8aeb8434
Showing with 7 additions and 10 deletions
+7 -10
...@@ -2927,18 +2927,15 @@ char *input_tab(char *buf, bool allow_files, size_t *place, ...@@ -2927,18 +2927,15 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
} }
#endif /* !DISABLE_TABCOMP */ #endif /* !DISABLE_TABCOMP */
/* Only print the last part of a path. Isn't there a shell command for /* Return the filename part of the given path. */
* this? */ const char *tail(const char *path)
const char *tail(const char *foo)
{ {
const char *tmp = strrchr(foo, '/'); const char *slash = strrchr(path, '/');
if (tmp == NULL) if (slash == NULL)
tmp = foo; return path;
else else
tmp++; return ++slash;
return tmp;
} }
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
......
...@@ -342,7 +342,7 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t ...@@ -342,7 +342,7 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t
char *input_tab(char *buf, bool allow_files, size_t *place, char *input_tab(char *buf, bool allow_files, size_t *place,
bool *lastwastab, bool *listed); bool *lastwastab, bool *listed);
#endif #endif
const char *tail(const char *foo); const char *tail(const char *path);
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
char *histfilename(void); char *histfilename(void);
void load_history(void); void load_history(void);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment