1 /* rm-suffix.c: remove any suffix.
3 Copyright 2008, 2011, 2012 Karl Berry.
4 Copyright 1992, 1993, 1995 Free Software Foundation, Inc.
5 Modified for kpathsea by Karl Berry.
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public License
18 along with this library; if not, see <http://www.gnu.org/licenses/>. */
20 #include <kpathsea/config.h>
24 remove_suffix (const_string s)
27 const_string suffix = find_suffix (s);
31 /* Back up to before the dot. */
33 ret = (string) xmalloc (suffix - s + 1);
34 strncpy (ret, s, suffix - s);