aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2013-02-26 00:36:53 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2013-02-26 00:36:53 +0100
commit1961aea305e258ba7ab3910d084451220f55ed44 (patch)
treebd889c8e596051c187b93af9c50508c6009f2683 /libbb
parent3305c008ed6084f58b59dde5198ae92e3a458e46 (diff)
downloadbusybox-w32-1961aea305e258ba7ab3910d084451220f55ed44.tar.gz
busybox-w32-1961aea305e258ba7ab3910d084451220f55ed44.tar.bz2
busybox-w32-1961aea305e258ba7ab3910d084451220f55ed44.zip
move endofname() to libbb
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/endofname.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libbb/endofname.c b/libbb/endofname.c
new file mode 100644
index 000000000..305f0932b
--- /dev/null
+++ b/libbb/endofname.c
@@ -0,0 +1,26 @@
1/*
2 * Utility routines.
3 *
4 * Copyright (C) 2013 Denys Vlasenko
5 *
6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */
8
9//kbuild:lib-y += endofname.o
10
11#include "libbb.h"
12
13#define is_name(c) ((c) == '_' || isalpha((unsigned char)(c)))
14#define is_in_name(c) ((c) == '_' || isalnum((unsigned char)(c)))
15
16const char* FAST_FUNC
17endofname(const char *name)
18{
19 if (!is_name(*name))
20 return name;
21 while (*++name) {
22 if (!is_in_name(*name))
23 break;
24 }
25 return name;
26}