applets
arch
archival
console-tools
coreutils
debianutils
docs
e2fsprogs
editors
examples
findutils
include
init
ipsvd
libbb
Config.in
Kbuild
README
ask_confirmation.c
bb_askpass.c
bb_basename.c
bb_do_delay.c
bb_pwd.c
bb_strtonum.c
change_identity.c
chomp.c
compare_string_array.c
concat_path_file.c
concat_subpath_file.c
copy_file.c
copyfd.c
correct_password.c
crc32.c
create_icmp6_socket.c
create_icmp_socket.c
crypt_make_salt.c
default_error_retval.c
device_open.c
dump.c
error_msg.c
error_msg_and_die.c
execable.c
fclose_nonstdin.c
fflush_stdout_and_exit.c
fgets_str.c
find_mount_point.c
find_pid_by_name.c
find_root_device.c
full_write.c
get_console.c
get_last_path_component.c
get_line_from_file.c
getopt32.c
herror_msg.c
herror_msg_and_die.c
human_readable.c
inet_common.c
info_msg.c
inode_hash.c
isdirectory.c
kernel_version.c
last_char_is.c
lineedit.c
llist.c
login.c
loop.c
make_directory.c
makedev.c
match_fstype.c
md5.c
messages.c
mode_string.c
mtab.c
mtab_file.c
obscure.c
parse_mode.c
perror_msg.c
perror_msg_and_die.c
perror_nomsg.c
perror_nomsg_and_die.c
pidfile.c
process_escape_sequence.c
procps.c
pw_encrypt.c
read.c
recursive_action.c
remove_file.c
restricted_shell.c
run_shell.c
safe_strncpy.c
safe_write.c
selinux_common.c
setup_environment.c
sha1.c
simplify_path.c
skip_whitespace.c
speed_table.c
str_tolower.c
time.c
trim.c
u_signal_names.c
udp_io.c
update_passwd.c
uuencode.c
vdprintf.c
verror_msg.c
vfork_daemon_rexec.c
warn_ignoring_args.c
wfopen.c
wfopen_input.c
xatonum.c
xatonum_template.c
xconnect.c
xfuncs.c
xgetcwd.c
xgethostbyname.c
xreadlink.c
xregcomp.c
libpwdgrp
loginutils
miscutils
modutils
networking
procps
runit
scripts
selinux
shell
sysklogd
testsuite
util-linux
.indent.pro
AUTHORS
Config.in
INSTALL
LICENSE
Makefile
Makefile.custom
Makefile.flags
Makefile.help
README
TODO
TODO_config_nommu
33 lines
536 B
C
33 lines
536 B
C
/* vi: set sw=4 ts=4: */
|
|
/*
|
|
* bb_get_last_path_component implementation for busybox
|
|
*
|
|
* Copyright (C) 2001 Manuel Novoa III <mjn3@codepoet.org>
|
|
*
|
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
|
*/
|
|
|
|
#include "libbb.h"
|
|
|
|
char *bb_get_last_path_component(char *path)
|
|
{
|
|
char *first = path;
|
|
char *last;
|
|
|
|
last = path - 1;
|
|
|
|
while (*path) {
|
|
if ((*path != '/') && (path > ++last)) {
|
|
last = first = path;
|
|
}
|
|
++path;
|
|
}
|
|
|
|
if (*first == '/') {
|
|
last = first;
|
|
}
|
|
last[1] = '\0';
|
|
|
|
return first;
|
|
}
|