3
0

bb_basename.c 320 B

123456789101112131415161718
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * Utility routines.
  4. *
  5. * Copyright (C) 2007 Denys Vlasenko
  6. *
  7. * Licensed under GPL version 2, see file LICENSE in this tarball for details.
  8. */
  9. #include "libbb.h"
  10. const char *bb_basename(const char *name)
  11. {
  12. const char *cp = strrchr(name, '/');
  13. if (cp)
  14. return cp + 1;
  15. return name;
  16. }