1/* let.c, created from let.def. */ 2#line 65 "let.def" 3 4#include <config.h> 5 6#if defined (HAVE_UNISTD_H) 7# ifdef _MINIX 8# include <sys/types.h> 9# endif 10# include <unistd.h> 11#endif 12 13#include "../bashintl.h" 14 15#include "../shell.h" 16#include "common.h" 17 18/* Arithmetic LET function. */ 19int 20let_builtin (list) 21 WORD_LIST *list; 22{ 23 intmax_t ret; 24 int expok; 25 26 /* Skip over leading `--' argument. */ 27 if (list && list->word && ISOPTION (list->word->word, '-')) 28 list = list->next; 29 30 if (list == 0) 31 { 32 builtin_error (_("expression expected")); 33 return (EXECUTION_FAILURE); 34 } 35 36 for (; list; list = list->next) 37 { 38 ret = evalexp (list->word->word, &expok); 39 if (expok == 0) 40 return (EXECUTION_FAILURE); 41 } 42 43 return ((ret == 0) ? EXECUTION_FAILURE : EXECUTION_SUCCESS); 44} 45 46#ifdef INCLUDE_UNUSED 47int 48exp_builtin (list) 49 WORD_LIST *list; 50{ 51 char *exp; 52 intmax_t ret; 53 int expok; 54 55 if (list == 0) 56 { 57 builtin_error (_("expression expected")); 58 return (EXECUTION_FAILURE); 59 } 60 61 exp = string_list (list); 62 ret = evalexp (exp, &expok); 63 (void)free (exp); 64 return (((ret == 0) || (expok == 0)) ? EXECUTION_FAILURE : EXECUTION_SUCCESS); 65} 66#endif 67