Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #include <string.h>
  2. #include <libgen.h>
  3.  
  4. char *basename(char *s)
  5. {
  6.     size_t i;
  7.     if (!s || !*s) return ".";
  8.     i = strlen(s)-1;
  9.     for (; i&&s[i]=='/'; i--) s[i] = 0;
  10.     for (; i&&s[i-1]!='/'; i--);
  11.     return s+i;
  12. }
  13.  
  14.