ash: make internal globbing code selectable from config
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
cac4d002e7
commit
514b51ddf3
82
shell/ash.c
82
shell/ash.c
@ -39,13 +39,22 @@
|
|||||||
|
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include <fnmatch.h>
|
#include <fnmatch.h>
|
||||||
#include <glob.h>
|
|
||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
#include <sys/utsname.h> /* for setting $HOSTNAME */
|
#include <sys/utsname.h> /* for setting $HOSTNAME */
|
||||||
|
|
||||||
#include "busybox.h" /* for applet_names */
|
#include "busybox.h" /* for applet_names */
|
||||||
#include "unicode.h"
|
|
||||||
|
|
||||||
|
#if defined(__ANDROID_API__) && __ANDROID_API__ <= 24
|
||||||
|
/* Bionic at least up to version 24 has no glob() */
|
||||||
|
# undef ENABLE_ASH_INTERNAL_GLOB
|
||||||
|
# define ENABLE_ASH_INTERNAL_GLOB 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !ENABLE_ASH_INTERNAL_GLOB
|
||||||
|
# include <glob.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "unicode.h"
|
||||||
#include "shell_common.h"
|
#include "shell_common.h"
|
||||||
#if ENABLE_SH_MATH_SUPPORT
|
#if ENABLE_SH_MATH_SUPPORT
|
||||||
# include "math.h"
|
# include "math.h"
|
||||||
@ -87,6 +96,42 @@
|
|||||||
//config: shell (by Herbert Xu), which was created by porting the 'ash' shell
|
//config: shell (by Herbert Xu), which was created by porting the 'ash' shell
|
||||||
//config: (written by Kenneth Almquist) from NetBSD.
|
//config: (written by Kenneth Almquist) from NetBSD.
|
||||||
//config:
|
//config:
|
||||||
|
//config:config ASH_OPTIMIZE_FOR_SIZE
|
||||||
|
//config: bool "Optimize for size instead of speed"
|
||||||
|
//config: default y
|
||||||
|
//config: depends on ASH
|
||||||
|
//config: help
|
||||||
|
//config: Compile ash for reduced size at the price of speed.
|
||||||
|
//config:
|
||||||
|
//config:config ASH_INTERNAL_GLOB
|
||||||
|
//config: bool "Use internal glob() implementation"
|
||||||
|
//config: default n
|
||||||
|
//config: depends on ASH
|
||||||
|
//config: help
|
||||||
|
//config: Do not use glob() function from libc, use internal implementation.
|
||||||
|
//config: Use this if you are getting "glob.h: No such file or directory"
|
||||||
|
//config: or similar build errors.
|
||||||
|
//config:
|
||||||
|
//config:config ASH_RANDOM_SUPPORT
|
||||||
|
//config: bool "Pseudorandom generator and $RANDOM variable"
|
||||||
|
//config: default y
|
||||||
|
//config: depends on ASH
|
||||||
|
//config: help
|
||||||
|
//config: Enable pseudorandom generator and dynamic variable "$RANDOM".
|
||||||
|
//config: Each read of "$RANDOM" will generate a new pseudorandom value.
|
||||||
|
//config: You can reset the generator by using a specified start value.
|
||||||
|
//config: After "unset RANDOM" the generator will switch off and this
|
||||||
|
//config: variable will no longer have special treatment.
|
||||||
|
//config:
|
||||||
|
//config:config ASH_EXPAND_PRMT
|
||||||
|
//config: bool "Expand prompt string"
|
||||||
|
//config: default y
|
||||||
|
//config: depends on ASH
|
||||||
|
//config: help
|
||||||
|
//config: "PS#" may contain volatile content, such as backquote commands.
|
||||||
|
//config: This option recreates the prompt string from the environment
|
||||||
|
//config: variable each time it is displayed.
|
||||||
|
//config:
|
||||||
//config:config ASH_BASH_COMPAT
|
//config:config ASH_BASH_COMPAT
|
||||||
//config: bool "bash-compatible extensions"
|
//config: bool "bash-compatible extensions"
|
||||||
//config: default y
|
//config: default y
|
||||||
@ -166,33 +211,6 @@
|
|||||||
//config: help
|
//config: help
|
||||||
//config: Enable "check for new mail" function in the ash shell.
|
//config: Enable "check for new mail" function in the ash shell.
|
||||||
//config:
|
//config:
|
||||||
//config:config ASH_OPTIMIZE_FOR_SIZE
|
|
||||||
//config: bool "Optimize for size instead of speed"
|
|
||||||
//config: default y
|
|
||||||
//config: depends on ASH
|
|
||||||
//config: help
|
|
||||||
//config: Compile ash for reduced size at the price of speed.
|
|
||||||
//config:
|
|
||||||
//config:config ASH_RANDOM_SUPPORT
|
|
||||||
//config: bool "Pseudorandom generator and $RANDOM variable"
|
|
||||||
//config: default y
|
|
||||||
//config: depends on ASH
|
|
||||||
//config: help
|
|
||||||
//config: Enable pseudorandom generator and dynamic variable "$RANDOM".
|
|
||||||
//config: Each read of "$RANDOM" will generate a new pseudorandom value.
|
|
||||||
//config: You can reset the generator by using a specified start value.
|
|
||||||
//config: After "unset RANDOM" the generator will switch off and this
|
|
||||||
//config: variable will no longer have special treatment.
|
|
||||||
//config:
|
|
||||||
//config:config ASH_EXPAND_PRMT
|
|
||||||
//config: bool "Expand prompt string"
|
|
||||||
//config: default y
|
|
||||||
//config: depends on ASH
|
|
||||||
//config: help
|
|
||||||
//config: "PS#" may contain volatile content, such as backquote commands.
|
|
||||||
//config: This option recreates the prompt string from the environment
|
|
||||||
//config: variable each time it is displayed.
|
|
||||||
//config:
|
|
||||||
|
|
||||||
//applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP))
|
//applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP))
|
||||||
//applet:IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, BB_DIR_BIN, BB_SUID_DROP, sh))
|
//applet:IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, BB_DIR_BIN, BB_SUID_DROP, sh))
|
||||||
@ -6994,7 +7012,7 @@ addfname(const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If we want to use glob() from libc... */
|
/* If we want to use glob() from libc... */
|
||||||
#if 1
|
#if !ENABLE_ASH_INTERNAL_GLOB
|
||||||
|
|
||||||
/* Add the result of glob() to the list */
|
/* Add the result of glob() to the list */
|
||||||
static void
|
static void
|
||||||
@ -7055,7 +7073,7 @@ nometa:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* Homegrown globbing code. (dash also has both, uses homegrown one.) */
|
/* ENABLE_ASH_INTERNAL_GLOB: Homegrown globbing code. (dash also has both, uses homegrown one.) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do metacharacter (i.e. *, ?, [...]) expansion.
|
* Do metacharacter (i.e. *, ?, [...]) expansion.
|
||||||
@ -7286,7 +7304,7 @@ expandmeta(struct strlist *str /*, int flag*/)
|
|||||||
str = str->next;
|
str = str->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* our globbing code */
|
#endif /* ENABLE_ASH_INTERNAL_GLOB */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Perform variable substitution and command substitution on an argument,
|
* Perform variable substitution and command substitution on an argument,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user