1*bec4d750Shaad /* $NetBSD: last-path-component.h,v 1.1.1.2 2009/02/18 11:17:16 haad Exp $ */
256a34939Shaad
356a34939Shaad /*
456a34939Shaad * Copyright (C) 2007 Red Hat, Inc. All rights reserved.
556a34939Shaad *
656a34939Shaad * This file is part of LVM2.
756a34939Shaad *
856a34939Shaad * This copyrighted material is made available to anyone wishing to use,
956a34939Shaad * modify, copy, or redistribute it subject to the terms and conditions
1056a34939Shaad * of the GNU Lesser General Public License v.2.1.
1156a34939Shaad *
1256a34939Shaad * You should have received a copy of the GNU Lesser General Public License
1356a34939Shaad * along with this program; if not, write to the Free Software Foundation,
1456a34939Shaad * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1556a34939Shaad */
1656a34939Shaad
1756a34939Shaad /*
1856a34939Shaad * Return the address of the last file name component of NAME.
1956a34939Shaad * If NAME ends in a slash, return the empty string.
2056a34939Shaad */
2156a34939Shaad
2256a34939Shaad #include <string.h>
2356a34939Shaad
last_path_component(char const * name)24*bec4d750Shaad static inline const char *last_path_component(char const *name)
2556a34939Shaad {
2656a34939Shaad char const *slash = strrchr(name, '/');
2756a34939Shaad
28*bec4d750Shaad return (slash) ? slash + 1 : name;
2956a34939Shaad }
30