source: MondoRescue/branches/2.2.9/mindi-busybox/libbb/get_last_path_component.c@ 2579

Last change on this file since 2579 was 1765, checked in by Bruno Cornec, 16 years ago

Update to busybox 1.7.2

File size: 536 bytes
Line 
1/* vi: set sw=4 ts=4: */
2/*
3 * bb_get_last_path_component implementation for busybox
4 *
5 * Copyright (C) 2001 Manuel Novoa III <mjn3@codepoet.org>
6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 */
9
10#include "libbb.h"
11
12char *bb_get_last_path_component(char *path)
13{
14 char *first = path;
15 char *last;
16
17 last = path - 1;
18
19 while (*path) {
20 if ((*path != '/') && (path > ++last)) {
21 last = first = path;
22 }
23 ++path;
24 }
25
26 if (*first == '/') {
27 last = first;
28 }
29 last[1] = '\0';
30
31 return first;
32}
Note: See TracBrowser for help on using the repository browser.