]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/util.c
Replace explicit checks for "/" with calls to IsPathSeparator, strchr with first_path...
[bacula/bacula] / bacula / src / lib / util.c
index 154965b9d51583970abc9eb1722ac1df9de8c068..0519cb5d530d0d486e8c4fc637e13c241c933fd9 100644 (file)
@@ -700,3 +700,16 @@ void set_working_directory(char *wd)
    }
    working_directory = wd;            /* set global */
 }
+
+const char *last_path_separator(const char *str)
+{
+   if (*str != '\0') {
+      for (const char *p = &str[strlen(str) - 1]; p >= str; p--) {
+         if (IsPathSeparator(*p)) {
+            return p;
+         }
+      }
+   }
+   return NULL;
+}
+