亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hush.c

?? 手機嵌入式Linux下可用的busybox源碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* vi: set sw=4 ts=4: *//* * sh.c -- a prototype Bourne shell grammar parser *      Intended to follow the original Thompson and Ritchie *      "small and simple is beautiful" philosophy, which *      incidentally is a good match to today's BusyBox. * * Copyright (C) 2000,2001  Larry Doolittle  <larry@doolittle.boa.org> * * Credits: *      The parser routines proper are all original material, first *      written Dec 2000 and Jan 2001 by Larry Doolittle.  The *      execution engine, the builtins, and much of the underlying *      support has been adapted from busybox-0.49pre's lash, which is *      Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen *      written by Erik Andersen <andersee@debian.org>.  That, in turn, *      is based in part on ladsh.c, by Michael K. Johnson and Erik W. *      Troan, which they placed in the public domain.  I don't know *      how much of the Johnson/Troan code has survived the repeated *      rewrites. * * Other credits: *      simple_itoa() was lifted from boa-0.93.15 *      b_addchr() derived from similar w_addchar function in glibc-2.2 *      setup_redirect(), redirect_opt_num(), and big chunks of main() *        and many builtins derived from contributions by Erik Andersen *      miscellaneous bugfixes from Matt Kraai * * There are two big (and related) architecture differences between * this parser and the lash parser.  One is that this version is * actually designed from the ground up to understand nearly all * of the Bourne grammar.  The second, consequential change is that * the parser and input reader have been turned inside out.  Now, * the parser is in control, and asks for input as needed.  The old * way had the input reader in control, and it asked for parsing to * take place as needed.  The new way makes it much easier to properly * handle the recursion implicit in the various substitutions, especially * across continuation lines. * * Bash grammar not implemented: (how many of these were in original sh?) *      $@ (those sure look like weird quoting rules) *      $_ *      ! negation operator for pipes *      &> and >& redirection of stdout+stderr *      Brace Expansion *      Tilde Expansion *      fancy forms of Parameter Expansion *      aliases *      Arithmetic Expansion *      <(list) and >(list) Process Substitution *      reserved words: case, esac, select, function *      Here Documents ( << word ) *      Functions * Major bugs: *      job handling woefully incomplete and buggy *      reserved word execution woefully incomplete and buggy * to-do: *      port selected bugfixes from post-0.49 busybox lash - done? *      finish implementing reserved words: for, while, until, do, done *      change { and } from special chars to reserved words *      builtins: break, continue, eval, return, set, trap, ulimit *      test magic exec *      handle children going into background *      clean up recognition of null pipes *      check setting of global_argc and global_argv *      control-C handling, probably with longjmp *      follow IFS rules more precisely, including update semantics *      figure out what to do with backslash-newline *      explain why we use signal instead of sigaction *      propagate syntax errors, die on resource errors? *      continuation lines, both explicit and implicit - done? *      memory leak finding and plugging - done? *      more testing, especially quoting rules and redirection *      document how quoting rules not precisely followed for variable assignments *      maybe change map[] to use 2-bit entries *      (eventually) remove all the printf's * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#include <ctype.h>     /* isalpha, isdigit */#include <unistd.h>    /* getpid */#include <stdlib.h>    /* getenv, atoi */#include <string.h>    /* strchr */#include <stdio.h>     /* popen etc. */#include <glob.h>      /* glob, of course */#include <stdarg.h>    /* va_list */#include <errno.h>#include <fcntl.h>#include <getopt.h>    /* should be pretty obvious */#include <sys/stat.h>  /* ulimit */#include <sys/types.h>#include <sys/wait.h>#include <signal.h>/* #include <dmalloc.h> *//* #define DEBUG_SHELL */#ifdef BB_VER#include "busybox.h"#include "cmdedit.h"#else#define applet_name "hush"#include "standalone.h"#define hush_main main#undef BB_FEATURE_SH_FANCY_PROMPT#endif#define SPECIAL_VAR_SYMBOL 03#define FLAG_EXIT_FROM_LOOP 1#define FLAG_PARSE_SEMICOLON (1 << 1)		/* symbol ';' is special for parser */#define FLAG_REPARSING		 (1 << 2)		/* >=2nd pass */typedef enum {	REDIRECT_INPUT     = 1,	REDIRECT_OVERWRITE = 2,	REDIRECT_APPEND    = 3,	REDIRECT_HEREIS    = 4,	REDIRECT_IO        = 5} redir_type;/* The descrip member of this structure is only used to make debugging * output pretty */struct {int mode; int default_fd; char *descrip;} redir_table[] = {	{ 0,                         0, "()" },	{ O_RDONLY,                  0, "<"  },	{ O_CREAT|O_TRUNC|O_WRONLY,  1, ">"  },	{ O_CREAT|O_APPEND|O_WRONLY, 1, ">>" },	{ O_RDONLY,                 -1, "<<" },	{ O_RDWR,                    1, "<>" }};typedef enum {	PIPE_SEQ = 1,	PIPE_AND = 2,	PIPE_OR  = 3,	PIPE_BG  = 4,} pipe_style;/* might eventually control execution */typedef enum {	RES_NONE  = 0,	RES_IF    = 1,	RES_THEN  = 2,	RES_ELIF  = 3,	RES_ELSE  = 4,	RES_FI    = 5,	RES_FOR   = 6,	RES_WHILE = 7,	RES_UNTIL = 8,	RES_DO    = 9,	RES_DONE  = 10,	RES_XXXX  = 11,	RES_IN    = 12,	RES_SNTX  = 13} reserved_style;#define FLAG_END   (1<<RES_NONE)#define FLAG_IF    (1<<RES_IF)#define FLAG_THEN  (1<<RES_THEN)#define FLAG_ELIF  (1<<RES_ELIF)#define FLAG_ELSE  (1<<RES_ELSE)#define FLAG_FI    (1<<RES_FI)#define FLAG_FOR   (1<<RES_FOR)#define FLAG_WHILE (1<<RES_WHILE)#define FLAG_UNTIL (1<<RES_UNTIL)#define FLAG_DO    (1<<RES_DO)#define FLAG_DONE  (1<<RES_DONE)#define FLAG_IN    (1<<RES_IN)#define FLAG_START (1<<RES_XXXX)/* This holds pointers to the various results of parsing */struct p_context {	struct child_prog *child;	struct pipe *list_head;	struct pipe *pipe;	struct redir_struct *pending_redirect;	reserved_style w;	int old_flag;				/* for figuring out valid reserved words */	struct p_context *stack;	int type;			/* define type of parser : ";$" common or special symbol */	/* How about quoting status? */};struct redir_struct {	redir_type type;			/* type of redirection */	int fd;						/* file descriptor being redirected */	int dup;					/* -1, or file descriptor being duplicated */	struct redir_struct *next;	/* pointer to the next redirect in the list */ 	glob_t word;				/* *word.gl_pathv is the filename */};struct child_prog {	pid_t pid;					/* 0 if exited */	char **argv;				/* program name and arguments */	struct pipe *group;			/* if non-NULL, first in group or subshell */	int subshell;				/* flag, non-zero if group must be forked */	struct redir_struct *redirects;	/* I/O redirections */	glob_t glob_result;			/* result of parameter globbing */	int is_stopped;				/* is the program currently running? */	struct pipe *family;		/* pointer back to the child's parent pipe */	int sp;				/* number of SPECIAL_VAR_SYMBOL */	int type;};struct pipe {	int jobid;					/* job number */	int num_progs;				/* total number of programs in job */	int running_progs;			/* number of programs running */	char *text;					/* name of job */	char *cmdbuf;				/* buffer various argv's point into */	pid_t pgrp;					/* process group ID for the job */	struct child_prog *progs;	/* array of commands in pipe */	struct pipe *next;			/* to track background commands */	int stopped_progs;			/* number of programs alive, but stopped */	int job_context;			/* bitmask defining current context */	pipe_style followup;		/* PIPE_BG, PIPE_SEQ, PIPE_OR, PIPE_AND */	reserved_style r_mode;		/* supports if, for, while, until */};struct close_me {	int fd;	struct close_me *next;};struct variables {	char *name;	char *value;	int flg_export;	int flg_read_only;	struct variables *next;};/* globals, connect us to the outside world * the first three support $?, $#, and $1 */char **global_argv;unsigned int global_argc;unsigned int last_return_code;extern char **environ; /* This is in <unistd.h>, but protected with __USE_GNU */ /* "globals" within this file */static char *ifs;static char map[256];static int fake_mode;static int interactive;static struct close_me *close_me_head;static const char *cwd;static struct pipe *job_list;static unsigned int last_bg_pid;static unsigned int last_jobid;static unsigned int shell_terminal;static char *PS1;static char *PS2;struct variables shell_ver = { "HUSH_VERSION", "0.01", 1, 1, 0 };struct variables *top_vars = &shell_ver;#define B_CHUNK (100)#define B_NOSPAC 1typedef struct {	char *data;	int length;	int maxlen;	int quote;	int nonnull;} o_string;#define NULL_O_STRING {NULL,0,0,0,0}/* used for initialization:	o_string foo = NULL_O_STRING; *//* I can almost use ordinary FILE *.  Is open_memstream() universally * available?  Where is it documented? */struct in_str {	const char *p;	char peek_buf[2];	int __promptme;	int promptmode;	FILE *file;	int (*get) (struct in_str *);	int (*peek) (struct in_str *);};#define b_getch(input) ((input)->get(input))#define b_peek(input) ((input)->peek(input))#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n"struct built_in_command {	char *cmd;					/* name */	char *descr;				/* description */	int (*function) (struct child_prog *);	/* function ptr */};/* belongs in busybox.h */static inline int max(int a, int b) {	return (a>b)?a:b;}/* This should be in utility.c */#ifdef DEBUG_SHELLstatic void debug_printf(const char *format, ...){	va_list args;	va_start(args, format);	vfprintf(stderr, format, args);	va_end(args);}#elsestatic inline void debug_printf(const char *format, ...) { }#endif#define final_printf debug_printfstatic void __syntax(char *file, int line) {	error_msg("syntax error %s:%d", file, line);}#define syntax() __syntax(__FILE__, __LINE__)/* Index of subroutines: *//*   function prototypes for builtins */static int builtin_cd(struct child_prog *child);static int builtin_env(struct child_prog *child);static int builtin_eval(struct child_prog *child);static int builtin_exec(struct child_prog *child);static int builtin_exit(struct child_prog *child);static int builtin_export(struct child_prog *child);static int builtin_fg_bg(struct child_prog *child);static int builtin_help(struct child_prog *child);static int builtin_jobs(struct child_prog *child);static int builtin_pwd(struct child_prog *child);static int builtin_read(struct child_prog *child);static int builtin_set(struct child_prog *child);static int builtin_shift(struct child_prog *child);static int builtin_source(struct child_prog *child);static int builtin_umask(struct child_prog *child);static int builtin_unset(struct child_prog *child);static int builtin_not_written(struct child_prog *child);/*   o_string manipulation: */static int b_check_space(o_string *o, int len);static int b_addchr(o_string *o, int ch);static void b_reset(o_string *o);static int b_addqchr(o_string *o, int ch, int quote);static int b_adduint(o_string *o, unsigned int i);/*  in_str manipulations: */static int static_get(struct in_str *i);static int static_peek(struct in_str *i);static int file_get(struct in_str *i);static int file_peek(struct in_str *i);static void setup_file_in_str(struct in_str *i, FILE *f);static void setup_string_in_str(struct in_str *i, const char *s);/*  close_me manipulations: */static void mark_open(int fd);static void mark_closed(int fd);static void close_all();/*  "run" the final data structures: */static char *indenter(int i);static int free_pipe_list(struct pipe *head, int indent);static int free_pipe(struct pipe *pi, int indent);/*  really run the final data structures: */static int setup_redirects(struct child_prog *prog, int squirrel[]);static int run_list_real(struct pipe *pi);static void pseudo_exec(struct child_prog *child) __attribute__ ((noreturn));static int run_pipe_real(struct pipe *pi);/*   extended glob support: */static int globhack(const char *src, int flags, glob_t *pglob);static int glob_needed(const char *s);static int xglob(o_string *dest, int flags, glob_t *pglob);/*   variable assignment: */static int is_assignment(const char *s);/*   data structure manipulation: */static int setup_redirect(struct p_context *ctx, int fd, redir_type style, struct in_str *input);static void initialize_context(struct p_context *ctx);static int done_word(o_string *dest, struct p_context *ctx);static int done_command(struct p_context *ctx);static int done_pipe(struct p_context *ctx, pipe_style type);/*   primary string parsing: */static int redirect_dup_num(struct in_str *input);static int redirect_opt_num(o_string *o);static int process_command_subs(o_string *dest, struct p_context *ctx, struct in_str *input, int subst_end);static int parse_group(o_string *dest, struct p_context *ctx, struct in_str *input, int ch);static char *lookup_param(char *src);static char *make_string(char **inp);static int handle_dollar(o_string *dest, struct p_context *ctx, struct in_str *input);static int parse_string(o_string *dest, struct p_context *ctx, const char *src);static int parse_stream(o_string *dest, struct p_context *ctx, struct in_str *input0, int end_trigger);/*   setup: */static int parse_stream_outer(struct in_str *inp, int flag);static int parse_string_outer(const char *s, int flag);static int parse_file_outer(FILE *f);/*   job management: */static int checkjobs(struct pipe* fg_pipe);static void insert_bg_job(struct pipe *pi);static void remove_bg_job(struct pipe *pi);/*     local variable support */static char **make_list_in(char **inp, char *name);static char *insert_var_value(char *inp);static char *get_local_var(const char *var);static void  unset_local_var(const char *name);static int set_local_var(const char *s, int flg_export);/* Table of built-in functions.  They can be forked or not, depending on * context: within pipes, they fork.  As simple commands, they do not. * When used in non-forking context, they can change global variables * in the parent shell process.  If forked, of course they can not. * For example, 'unset foo | whatever' will parse and run, but foo will * still be set at the end. */static struct built_in_command bltins[] = {	{"bg", "Resume a job in the background", builtin_fg_bg},	{"break", "Exit for, while or until loop", builtin_not_written},	{"cd", "Change working directory", builtin_cd},	{"continue", "Continue for, while or until loop", builtin_not_written},	{"env", "Print all environment variables", builtin_env},	{"eval", "Construct and run shell command", builtin_eval},	{"exec", "Exec command, replacing this shell with the exec'd process", 		builtin_exec},	{"exit", "Exit from shell()", builtin_exit},	{"export", "Set environment variable", builtin_export},	{"fg", "Bring job into the foreground", builtin_fg_bg},	{"jobs", "Lists the active jobs", builtin_jobs},	{"pwd", "Print current directory", builtin_pwd},	{"read", "Input environment variable", builtin_read},	{"return", "Return from a function", builtin_not_written},	{"set", "Set/unset shell local variables", builtin_set},	{"shift", "Shift positional parameters", builtin_shift},	{"trap", "Trap signals", builtin_not_written},	{"ulimit","Controls resource limits", builtin_not_written},	{"umask","Sets file creation mask", builtin_umask},	{"unset", "Unset environment variable", builtin_unset},	{".", "Source-in and run commands in a file", builtin_source},	{"help", "List shell built-in commands", builtin_help},	{NULL, NULL, NULL}};static const char *set_cwd(void){	if(cwd==unknown)		cwd = NULL;     /* xgetcwd(arg) called free(arg) */	cwd = xgetcwd((char *)cwd);	if (!cwd)		cwd = unknown;	return cwd;}/* built-in 'eval' handler */static int builtin_eval(struct child_prog *child){	char *str = NULL;	int rcode = EXIT_SUCCESS;		if (child->argv[1]) {		str = make_string(child->argv + 1);		parse_string_outer(str, FLAG_EXIT_FROM_LOOP | 					FLAG_PARSE_SEMICOLON);		free(str);		rcode = last_return_code;	}	return rcode;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91麻豆蜜桃一区二区三区| 日韩欧美国产1| 精品日本一线二线三线不卡| 国产精品久久久久7777按摩| 蜜臀av性久久久久蜜臀av麻豆 | 欧美综合在线视频| 久久午夜老司机| 丝袜诱惑亚洲看片| 一本一道综合狠狠老| 国产日韩欧美制服另类| 日精品一区二区| 欧美综合久久久| 亚洲人妖av一区二区| 国产福利一区二区| 精品日韩欧美在线| 欧美a一区二区| 在线成人免费观看| 亚洲一区二区三区四区的 | 国产成人超碰人人澡人人澡| 日韩欧美一区在线| 婷婷开心久久网| 欧美裸体一区二区三区| 一区二区三区精品视频在线| 色综合天天综合网天天看片| 中文字幕乱码亚洲精品一区| 国产精品一二三四五| 2欧美一区二区三区在线观看视频| 日本一区中文字幕| 欧美一区二区福利在线| 日韩国产欧美三级| 日韩亚洲电影在线| 免费观看成人av| 精品国产91久久久久久久妲己| 日本免费在线视频不卡一不卡二| 91.麻豆视频| 日韩福利电影在线观看| 欧美一二三在线| 国产真实乱偷精品视频免| 久久久久久免费| 粉嫩av一区二区三区粉嫩 | 亚洲综合视频在线观看| 欧美午夜理伦三级在线观看| 亚洲愉拍自拍另类高清精品| 欧洲一区在线电影| 日韩激情中文字幕| 精品国产乱码久久久久久图片| 久久不见久久见免费视频1| 精品国产乱码久久久久久浪潮| 久久爱另类一区二区小说| 久久久电影一区二区三区| 成人av资源在线| 一区二区三区蜜桃| 91精品国产全国免费观看| 国产在线一区二区综合免费视频| 国产亚洲短视频| 色婷婷久久久久swag精品| 婷婷综合五月天| 久久久久久99精品| 色综合天天做天天爱| 日本特黄久久久高潮 | 日韩亚洲欧美在线观看| 国产精品中文字幕一区二区三区| 久久久久久久免费视频了| 91视频观看免费| 日本不卡一二三区黄网| 欧美韩日一区二区三区| 欧美亚洲动漫精品| 精品一区二区三区免费毛片爱| 国产精品久久久久久久久快鸭| 欧美色图在线观看| 国产精品亚洲视频| 亚洲成av人片在www色猫咪| 久久精品夜夜夜夜久久| 欧美在线free| 国产成人精品免费在线| 亚洲成人动漫精品| 中国色在线观看另类| 欧美日韩精品一区视频| 国产.欧美.日韩| 美女高潮久久久| 亚洲午夜免费电影| 国产欧美精品一区| 91精品欧美福利在线观看| 不卡一区二区中文字幕| 麻豆91在线观看| 亚洲成人av电影| 亚洲同性gay激情无套| 精品国产乱码久久久久久免费 | 色诱视频网站一区| 国产一区二区三区观看| 视频在线在亚洲| 亚洲久草在线视频| 日本一区二区免费在线观看视频 | 免费观看在线色综合| 中文字幕一区不卡| 久久精品免费在线观看| 欧美一区二区私人影院日本| 色噜噜狠狠色综合欧洲selulu| 国产成人精品www牛牛影视| 久久激情五月激情| 日日嗨av一区二区三区四区| 亚洲综合一区二区| 亚洲美女免费视频| 国产精品久久久久影院色老大| 久久亚洲私人国产精品va媚药| 欧美日韩一区二区三区视频 | 亚洲视频在线一区观看| 久久久久亚洲蜜桃| 久久久一区二区| 久久婷婷国产综合国色天香| 欧美一级久久久久久久大片| 91精品蜜臀在线一区尤物| 91成人免费网站| 一本到高清视频免费精品| 99精品一区二区三区| av成人动漫在线观看| 99精品欧美一区二区蜜桃免费| 波多野洁衣一区| 91尤物视频在线观看| 91碰在线视频| 欧美亚洲国产一区在线观看网站| 日本久久电影网| 欧美亚洲日本一区| 欧美日韩精品电影| 日韩欧美中文字幕制服| 精品乱码亚洲一区二区不卡| 26uuu亚洲综合色| 国产精品人成在线观看免费| 中文字幕在线观看一区| 亚洲欧美国产高清| 亚洲gay无套男同| 精品一区二区在线视频| 国产成人精品一区二区三区四区| 成人久久视频在线观看| 91美女片黄在线观看| 欧美日韩精品欧美日韩精品一| 日韩亚洲国产中文字幕欧美| 国产午夜精品一区二区| 亚洲色图视频网| 三级影片在线观看欧美日韩一区二区| 日精品一区二区| 国产v日产∨综合v精品视频| 91网站在线播放| 在线成人免费视频| 国产视频一区二区在线观看| 亚洲黄色小说网站| 美女一区二区视频| 99久久伊人久久99| 欧美精品九九99久久| 久久久美女毛片| 亚洲国产日韩综合久久精品| 免费成人在线网站| 91亚洲精品久久久蜜桃| 欧美一级黄色片| 中文字幕一区二区三区不卡在线| 午夜久久电影网| 成人av在线一区二区| 欧美另类一区二区三区| 国产三级欧美三级日产三级99 | 日本精品一区二区三区四区的功能| 91精品国产美女浴室洗澡无遮挡| 欧美高清在线一区| 日本亚洲天堂网| 色视频成人在线观看免| 欧美精品一区二区不卡| 亚洲在线免费播放| 成人免费观看视频| 91精品国产综合久久精品图片| 国产精品嫩草影院com| 蜜臀久久99精品久久久画质超高清| 白白色 亚洲乱淫| 精品成人免费观看| 石原莉奈一区二区三区在线观看| 91在线国内视频| 久久久久亚洲综合| 麻豆一区二区在线| 欧美日韩国产天堂| 亚洲蜜臀av乱码久久精品| 国产成人精品综合在线观看| 日韩色视频在线观看| 亚洲一区在线电影| 一本色道久久加勒比精品| 中文字幕 久热精品 视频在线| 久久国产视频网| 制服丝袜在线91| 亚洲v精品v日韩v欧美v专区| 色哟哟一区二区三区| 中文av字幕一区| 成人精品视频一区二区三区 | 精品日韩欧美在线| 日本不卡123| 欧美精品99久久久**| 亚洲午夜久久久久中文字幕久| 91视视频在线观看入口直接观看www| 久久久久成人黄色影片| 国产一区二区网址| 国产午夜亚洲精品不卡| 国产乱人伦精品一区二区在线观看| 欧美成人一级视频| 黄页网站大全一区二区|