diff options
| author | Dan Pasanen <dan.pasanen@gmail.com> | 2014-10-02 14:08:59 -0500 |
|---|---|---|
| committer | Dan Pasanen <dan.pasanen@gmail.com> | 2014-10-02 14:25:19 -0500 |
| commit | c6e37862a742387dafd6e175c6d9cb38df5f81e3 (patch) | |
| tree | 00623bbab3f1c1fe7fd8a3f85823333663d7c71e /builtins/let.c | |
| parent | 90a39f32de629ce849276388300f718db331c8b8 (diff) | |
| download | android_external_bash-c6e37862a742387dafd6e175c6d9cb38df5f81e3.tar.gz android_external_bash-c6e37862a742387dafd6e175c6d9cb38df5f81e3.tar.bz2 android_external_bash-c6e37862a742387dafd6e175c6d9cb38df5f81e3.zip | |
Set up build for android
Diffstat (limited to 'builtins/let.c')
| -rw-r--r-- | builtins/let.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/builtins/let.c b/builtins/let.c new file mode 100644 index 0000000..ea3caf3 --- /dev/null +++ b/builtins/let.c @@ -0,0 +1,66 @@ +/* let.c, created from let.def. */ +#line 66 "./let.def" + +#include <config.h> + +#if defined (HAVE_UNISTD_H) +# ifdef _MINIX +# include <sys/types.h> +# endif +# include <unistd.h> +#endif + +#include "../bashintl.h" + +#include "../shell.h" +#include "common.h" + +/* Arithmetic LET function. */ +int +let_builtin (list) + WORD_LIST *list; +{ + intmax_t ret; + int expok; + + /* Skip over leading `--' argument. */ + if (list && list->word && ISOPTION (list->word->word, '-')) + list = list->next; + + if (list == 0) + { + builtin_error (_("expression expected")); + return (EXECUTION_FAILURE); + } + + for (; list; list = list->next) + { + ret = evalexp (list->word->word, &expok); + if (expok == 0) + return (EXECUTION_FAILURE); + } + + return ((ret == 0) ? EXECUTION_FAILURE : EXECUTION_SUCCESS); +} + +#ifdef INCLUDE_UNUSED +int +exp_builtin (list) + WORD_LIST *list; +{ + char *exp; + intmax_t ret; + int expok; + + if (list == 0) + { + builtin_error (_("expression expected")); + return (EXECUTION_FAILURE); + } + + exp = string_list (list); + ret = evalexp (exp, &expok); + (void)free (exp); + return (((ret == 0) || (expok == 0)) ? EXECUTION_FAILURE : EXECUTION_SUCCESS); +} +#endif |
