3 * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
5 * This library is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation; either version 2.1 of
8 * the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 * \brief Get the full file name
27 * \param file The file name string to parse
28 * \param result The pointer to store the resultant file name
29 * \return 0 if successful, or a negative error code
31 * Parses the given file name with POSIX-Shell-like expansion and
32 * stores the first matchine one. The returned string is strdup'ed.
38 int snd_user_file(const char *file, char **result)
43 assert(file && result);
44 err = wordexp(file, &we, WRDE_NOCMD);
56 *result = strdup(we.we_wordv[0]);
63 #else /* !HAVE_WORDEXP_H */
64 /* just copy the string - would be nicer to expand by ourselves, though... */
65 int snd_user_file(const char *file, char **result)
67 *result = strdup(file);
72 #endif /* HAVE_WORDEXP_H */