blob: ea3caf36723de53504a48f2b057fcde209869938 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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
|