⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 let.def

📁 android-w.song.android.widget
💻 DEF
字号:
This file is let.def, from which is created let.c.It implements the builtin "let" in Bash.Copyright (C) 1987-2009 Free Software Foundation, Inc.This file is part of GNU Bash, the Bourne Again SHell.Bash is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.Bash is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with Bash.  If not, see <http://www.gnu.org/licenses/>.$BUILTIN let$FUNCTION let_builtin$PRODUCES let.c$SHORT_DOC let arg [arg ...]Evaluate arithmetic expressions.Evaluate each ARG as an arithmetic expression.  Evaluation is done infixed-width integers with no check for overflow, though division by 0is trapped and flagged as an error.  The following list of operators isgrouped into levels of equal-precedence operators.  The levels are listedin order of decreasing precedence.	id++, id--	variable post-increment, post-decrement	++id, --id	variable pre-increment, pre-decrement	-, +		unary minus, plus	!, ~		logical and bitwise negation	**		exponentiation	*, /, %		multiplication, division, remainder	+, -		addition, subtraction	<<, >>		left and right bitwise shifts	<=, >=, <, >	comparison	==, !=		equality, inequality	&		bitwise AND	^		bitwise XOR	|		bitwise OR	&&		logical AND	||		logical OR	expr ? expr : expr			conditional operator	=, *=, /=, %=,	+=, -=, <<=, >>=,	&=, ^=, |=	assignmentShell variables are allowed as operands.  The name of the variableis replaced by its value (coerced to a fixed-width integer) withinan expression.  The variable need not have its integer attributeturned on to be used in an expression.Operators are evaluated in order of precedence.  Sub-expressions inparentheses are evaluated first and may override the precedencerules above.Exit Status:If the last ARG evaluates to 0, let returns 1; let returns 0 otherwise.$END#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. */intlet_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_UNUSEDintexp_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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -