1/*	$NetBSD: last-path-component.h,v 1.1.1.2 2009/02/18 11:16:46 haad Exp $	*/
2
3/*
4 * Copyright (C) 2007 Red Hat, Inc. All rights reserved.
5 *
6 * This file is part of LVM2.
7 *
8 * This copyrighted material is made available to anyone wishing to use,
9 * modify, copy, or redistribute it subject to the terms and conditions
10 * of the GNU Lesser General Public License v.2.1.
11 *
12 * You should have received a copy of the GNU Lesser General Public License
13 * along with this program; if not, write to the Free Software Foundation,
14 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15 */
16
17/*
18 * Return the address of the last file name component of NAME.
19 * If NAME ends in a slash, return the empty string.
20 */
21
22#include <string.h>
23
24static inline const char *last_path_component(char const *name)
25{
26	char const *slash = strrchr(name, '/');
27
28	return (slash) ? slash + 1 : name;
29}
30