diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-01-16 00:01:25 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-01-16 00:01:25 +0000 |
commit | 38cb39339a8f1f9a0afb69340a404fd767db5a79 (patch) | |
tree | 0b5ed63f639e8d8e66011a425ee595545b74300d /atari/gui.c | |
parent | bd065d4a434755e67642a071e255cba596de8d1e (diff) | |
download | netsurf-38cb39339a8f1f9a0afb69340a404fd767db5a79.tar.gz netsurf-38cb39339a8f1f9a0afb69340a404fd767db5a79.tar.bz2 |
move filename_from_path and path_add_part into gui operation tables
Diffstat (limited to 'atari/gui.c')
-rw-r--r-- | atari/gui.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/atari/gui.c b/atari/gui.c index 49e3046e2..55a23a84a 100644 --- a/atari/gui.c +++ b/atari/gui.c @@ -115,6 +115,27 @@ short aes_msg_out[8]; bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy); +/** + * Return the filename part of a full path + * + * \param path full path and filename + * \return filename (will be freed with free()) + */ +static char *filename_from_path(char *path) +{ + char *leafname; + + leafname = strrchr(path, '\\'); + if( !leafname ) + leafname = strrchr(path, '/'); + if (!leafname) + leafname = path; + else + leafname += 1; + + return strdup(leafname); +} + static void gui_poll(bool active) { @@ -1055,6 +1076,8 @@ static struct gui_browser_table atari_browser_table = { .quit = gui_quit, .get_resource_url = gui_get_resource_url, .cert_verify = gui_cert_verify, + .filename_from_path = filename_from_path, + .path_add_part = path_add_part, }; /* #define WITH_DBG_LOGFILE 1 */ |