basename.c 445 B

1234567891011121314151617181920212223242526
  1. /*
  2. * Copyright (C) 2002 Manuel Novoa III
  3. * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
  4. *
  5. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. */
  7. #include "_string.h"
  8. char attribute_hidden *__basename(const char *path)
  9. {
  10. register const char *s;
  11. register const char *p;
  12. p = s = path;
  13. while (*s) {
  14. if (*s++ == '/') {
  15. p = s;
  16. }
  17. }
  18. return (char *) p;
  19. }
  20. strong_alias(__basename,basename)