blob: 29e7a2a82dece83a1768c3c9dfc8619e7d1bea32 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*
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
8#include "_string.h"
9
10#ifdef __USE_GNU
11
12char *basename(const char *path)
13{
14 register const char *s;
15 register const char *p;
16
17 p = s = path;
18
19 while (*s) {
20 if (*s++ == '/') {
21 p = s;
22 }
23 }
24
25 return (char *) p;
26}
27libc_hidden_def(basename)
28#endif