summaryrefslogtreecommitdiff
path: root/beos
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2010-03-21 13:32:59 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2010-03-21 13:32:59 +0000
commit033b5d815a19a05441a99cdc744a6a8752d191cc (patch)
treead0aadcb6bcfd10362fbe7f266906ecd9fa8fde3 /beos
parent1f67fed782a2c20e5b8222ef5fb9867f036ff054 (diff)
downloadnetsurf-033b5d815a19a05441a99cdc744a6a8752d191cc.tar.gz
netsurf-033b5d815a19a05441a99cdc744a6a8752d191cc.tar.bz2
Move code which extracts the filename from a given path into frontend.
svn path=/trunk/netsurf/; revision=10139
Diffstat (limited to 'beos')
-rw-r--r--beos/beos_gui.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/beos/beos_gui.cpp b/beos/beos_gui.cpp
index 3f83a8dcb..6c05bc401 100644
--- a/beos/beos_gui.cpp
+++ b/beos/beos_gui.cpp
@@ -1160,3 +1160,23 @@ static void *myrealloc(void *ptr, size_t len, void *pw)
{
return realloc(ptr, len);
}
+
+/**
+ * Return the filename part of a full path
+ *
+ * \param path full path and filename
+ * \return filename (will be freed with free())
+ */
+
+char *filename_from_path(char *path)
+{
+ char *leafname;
+
+ leafname = strrchr(path, '/');
+ if (!leafname)
+ leafname = path;
+ else
+ leafname += 1;
+
+ return strdup(leafname);
+}