mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-01 00:38:31 +00:00
Add bash 5.2 to third_party
This commit is contained in:
parent
e1f65d5f2b
commit
f4a2a65cc8
237 changed files with 120739 additions and 1 deletions
68
third_party/bash/builtins_let.c
vendored
Normal file
68
third_party/bash/builtins_let.c
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
/* 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;
|
||||
|
||||
CHECK_HELPOPT (list);
|
||||
|
||||
/* 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, EXP_EXPANDED, &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, EXP_EXPANDED, &expok);
|
||||
(void)free (exp);
|
||||
return (((ret == 0) || (expok == 0)) ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
|
||||
}
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue