• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/iserver/alsa-lib-1.0.26/src/

Lines Matching defs:*

2  *  Get full filename
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
21 #include <config.h>
22 #include <string.h>
23 #include <errno.h>
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.
35 #ifdef HAVE_WORDEXP_H
36 #include <wordexp.h>
37 #include <assert.h>
38 int snd_user_file(const char *file, char **result)
40 wordexp_t we;
41 int err;
43 assert(file && result);
44 err = wordexp(file, &we, WRDE_NOCMD);
45 switch (err) {
46 case WRDE_NOSPACE:
47 return -ENOMEM;
48 case 0:
49 if (we.we_wordc == 1)
50 break;
51 /* fall thru */
52 default:
53 wordfree(&we);
54 return -EINVAL;
56 *result = strdup(we.we_wordv[0]);
57 if (*result == NULL)
58 return -ENOMEM;
59 wordfree(&we);
60 return 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);
68 if (! *result)
69 return -ENOMEM;
70 return 0;
72 #endif /* HAVE_WORDEXP_H */