Commits

Paul Barbu - Gheorghe committed 42ed4c1

added get_filename() and remove_ext()

  • Participants
  • Parent commits e87aad8

Comments (0)

Files changed (1)

     return len;
 }
 
+int remove_ext(char *str){
+    char *dot = strrchr(str, '.');
+
+    if(dot){
+        *dot = '\0';
+        return dot-str+1;
+    }
+
+    return -1;
+}
+
+char *get_filename(const char *str){
+    char *dir_sep = strrchr(str, '/');
+
+    if(dir_sep == NULL){
+        return (char *)str;
+    }
+
+    return dir_sep+1;
+}
+
 char *
 getmpd() {
     struct mpd_connection *conn;