summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2006-01-20 11:43:18 +0000
committerPeter S. Mazinger <ps.m@gmx.net>2006-01-20 11:43:18 +0000
commit16129810acd33d78e785bf636425a4dd9da03984 (patch)
tree853a39ef37af141c0a18067f2073aadb873b7528
parent42dfe0465e03b819a3508d653ce6e7cc39b40cff (diff)
Correct wordexp, I have hidden for now __libc_arg[c,v], there is no other use within uClibc, depends on fnmatch as well
-rw-r--r--extra/Configs/Config.in1
-rw-r--r--libc/misc/wordexp/wordexp.c38
2 files changed, 22 insertions, 17 deletions
diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index 65e1e4c1a..03ee6d52f 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -1124,6 +1124,7 @@ config UCLIBC_HAS_FNMATCH_OLD
config UCLIBC_HAS_WORDEXP
bool "Support the wordexp() interface"
depends on UCLIBC_HAS_GLOB
+ depends on UCLIBC_HAS_FNMATCH
default n
help
The SuSv3 wordexp() interface performs word expansions per the Shell
diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c
index 70d43e1e1..3713ac2e5 100644
--- a/libc/misc/wordexp/wordexp.c
+++ b/libc/misc/wordexp/wordexp.c
@@ -45,6 +45,7 @@ libc_hidden_proto(strlen)
libc_hidden_proto(strndup)
libc_hidden_proto(strspn)
libc_hidden_proto(strcspn)
+libc_hidden_proto(__environ)
libc_hidden_proto(setenv)
libc_hidden_proto(unsetenv)
libc_hidden_proto(waitpid)
@@ -66,12 +67,15 @@ libc_hidden_proto(getpid)
libc_hidden_proto(sprintf)
libc_hidden_proto(fprintf)
libc_hidden_proto(abort)
-
-extern void __wordfree (wordexp_t *__wordexp) __THROW attribute_hidden;
-extern int __glob (__const char *__restrict __pattern, int __flags,
- int (*__errfunc) (__const char *, int),
- glob_t *__restrict __pglob) __THROW attribute_hidden;
-extern void __globfree (glob_t *__pglob) __THROW attribute_hidden;
+libc_hidden_proto(stderr)
+libc_hidden_proto(glob)
+libc_hidden_proto(globfree)
+libc_hidden_proto(wordfree)
+#ifdef __UCLIBC_HAS_XLOCALE__
+libc_hidden_proto(__ctype_b_loc)
+#else
+libc_hidden_proto(__ctype_b)
+#endif
#define __WORDEXP_FULL
//#undef __WORDEXP_FULL
@@ -85,8 +89,8 @@ extern void __globfree (glob_t *__pglob) __THROW attribute_hidden;
//extern char **__libc_argv;
/* FIXME!!!! */
-int __libc_argc;
-char **__libc_argv;
+int attribute_hidden __libc_argc;
+char attribute_hidden **__libc_argv;
/* Some forward declarations */
static int parse_dollars(char **word, size_t * word_length,
@@ -379,7 +383,7 @@ do_parse_glob(const char *glob_word, char **word, size_t * word_length,
int match;
glob_t globbuf;
- error = __glob(glob_word, GLOB_NOCHECK, NULL, &globbuf);
+ error = glob(glob_word, GLOB_NOCHECK, NULL, &globbuf);
if (error != 0) {
/* We can only run into memory problems. */
@@ -398,7 +402,7 @@ do_parse_glob(const char *glob_word, char **word, size_t * word_length,
globbuf.gl_pathv[match]);
}
- __globfree(&globbuf);
+ globfree(&globbuf);
return *word ? 0 : WRDE_NOSPACE;
}
@@ -412,12 +416,12 @@ do_parse_glob(const char *glob_word, char **word, size_t * word_length,
char *matching_word = strdup(globbuf.gl_pathv[match]);
if (matching_word == NULL || w_addword(pwordexp, matching_word)) {
- __globfree(&globbuf);
+ globfree(&globbuf);
return WRDE_NOSPACE;
}
}
- __globfree(&globbuf);
+ globfree(&globbuf);
return 0;
}
@@ -500,7 +504,7 @@ parse_glob(char **word, size_t * word_length, size_t * max_length,
/* Now tidy up */
tidy_up:
- __wordfree(&glob_list);
+ wordfree(&glob_list);
return error;
}
@@ -2040,7 +2044,7 @@ parse_dquote(char **word, size_t * word_length, size_t * max_length,
* wordfree() is to be called after pwordexp is finished with.
*/
-void attribute_hidden __wordfree(wordexp_t * pwordexp)
+void wordfree(wordexp_t * pwordexp)
{
/* wordexp can set pwordexp to NULL */
@@ -2054,7 +2058,7 @@ void attribute_hidden __wordfree(wordexp_t * pwordexp)
pwordexp->we_wordv = NULL;
}
}
-strong_alias(__wordfree,wordfree)
+libc_hidden_def(wordfree)
/*
* wordexp()
@@ -2073,7 +2077,7 @@ int wordexp(const char *words, wordexp_t * we, int flags)
if (flags & WRDE_REUSE) {
/* Minimal implementation of WRDE_REUSE for now */
- __wordfree(we);
+ wordfree(we);
old_word.we_wordv = NULL;
}
@@ -2275,7 +2279,7 @@ int wordexp(const char *words, wordexp_t * we, int flags)
return WRDE_NOSPACE;
if ((flags & WRDE_APPEND) == 0)
- __wordfree(we);
+ wordfree(we);
*we = old_word;
return error;