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

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

?? lash.c

?? 手機嵌入式Linux下可用的busybox源碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* vi: set sw=4 ts=4: *//* * lash -- the BusyBox Lame-Ass SHell * * Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen * Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org> * * Based in part on ladsh.c by Michael K. Johnson and Erik W. Troan, which is * under the following liberal license: "We have placed this source code in the * public domain. Use it in any project, free or commercial." * * 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 * *//* This shell's parsing engine is officially at a dead-end. * Future work shell work should be done using hush.c *///For debugging/development on the shell only...//#define DEBUG_SHELL#include <stdio.h>#include <stdlib.h>#include <ctype.h>#include <errno.h>#include <fcntl.h>#include <signal.h>#include <string.h>#include <sys/ioctl.h>#include <sys/wait.h>#include <unistd.h>#include <getopt.h>#include <termios.h>#include "busybox.h"#include "cmdedit.h"#ifdef BB_LOCALE_SUPPORT#include <locale.h>#endif#include <glob.h>#define expand_t	glob_tstatic const int MAX_READ = 128;	/* size of input buffer for `read' builtin */#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n"enum redir_type { REDIRECT_INPUT, REDIRECT_OVERWRITE,	REDIRECT_APPEND};static const unsigned int DEFAULT_CONTEXT=0x1;static const unsigned int IF_TRUE_CONTEXT=0x2;static const unsigned int IF_FALSE_CONTEXT=0x4;static const unsigned int THEN_EXP_CONTEXT=0x8;static const unsigned int ELSE_EXP_CONTEXT=0x10;struct jobset {	struct job *head;			/* head of list of running jobs */	struct job *fg;				/* current foreground job */};struct redir_struct {	enum redir_type type;	/* type of redirection */	int fd;						/* file descriptor being redirected */	char *filename;				/* file to redirect fd to */};struct child_prog {	pid_t pid;					/* 0 if exited */	char **argv;				/* program name and arguments */	int num_redirects;			/* elements in redirection array */	struct redir_struct *redirects;	/* I/O redirects */	int is_stopped;				/* is the program currently running? */	struct job *family;			/* pointer back to the child's parent job */};struct job {	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 programs in job */	struct job *next;			/* to track background commands */	int stopped_progs;			/* number of programs alive, but stopped */	unsigned int job_context;	/* bitmask defining current context */	struct jobset *job_list;};struct built_in_command {	char *cmd;					/* name */	char *descr;				/* description */	int (*function) (struct child_prog *);	/* function ptr */};struct close_me {	int fd;	struct close_me *next;};/* function prototypes for builtins */static int builtin_cd(struct child_prog *cmd);static int builtin_exec(struct child_prog *cmd);static int builtin_exit(struct child_prog *cmd);static int builtin_fg_bg(struct child_prog *cmd);static int builtin_help(struct child_prog *cmd);static int builtin_jobs(struct child_prog *dummy);static int builtin_pwd(struct child_prog *dummy);static int builtin_export(struct child_prog *cmd);static int builtin_source(struct child_prog *cmd);static int builtin_unset(struct child_prog *cmd);static int builtin_read(struct child_prog *cmd);/* function prototypes for shell stuff */static void mark_open(int fd);static void mark_closed(int fd);static void close_all(void);static void checkjobs(struct jobset *job_list);static void remove_job(struct jobset *j_list, struct job *job);static int get_command(FILE * source, char *command);static int parse_command(char **command_ptr, struct job *job, int *inbg);static int run_command(struct job *newjob, int inbg, int outpipe[2]);static int pseudo_exec(struct child_prog *cmd) __attribute__ ((noreturn));static int busy_loop(FILE * input);/* Table of built-in functions (these are non-forking builtins, meaning they * can change global variables in the parent shell process but they will not * work with pipes and redirects; 'unset foo | whatever' will not work) */static struct built_in_command bltins[] = {	{"bg", "Resume a job in the background", builtin_fg_bg},	{"cd", "Change working directory", builtin_cd},	{"exec", "Exec command, replacing this shell with the exec'd process", builtin_exec},	{"exit", "Exit from shell()", builtin_exit},	{"fg", "Bring job into the foreground", builtin_fg_bg},	{"jobs", "Lists the active jobs", builtin_jobs},	{"export", "Set environment variable", builtin_export},	{"unset", "Unset environment variable", builtin_unset},	{"read", "Input environment variable", builtin_read},	{".", "Source-in and run commands in a file", builtin_source},	/* to do: add ulimit */	{NULL, NULL, NULL}};/* Table of forking built-in functions (things that fork cannot change global * variables in the parent process, such as the current working directory) */static struct built_in_command bltins_forking[] = {	{"pwd", "Print current directory", builtin_pwd},	{"help", "List shell built-in commands", builtin_help},	{NULL, NULL, NULL}};static int shell_context;  /* Type prompt trigger (PS1 or PS2) *//* Globals that are static to this file */static const char *cwd;static char *local_pending_command = NULL;static struct jobset job_list = { NULL, NULL };static int argc;static char **argv;static struct close_me *close_me_head;static int last_return_code;static int last_bg_pid;static unsigned int last_jobid;static int shell_terminal;static pid_t shell_pgrp;static char *PS1;static char *PS2 = "> ";#ifdef DEBUG_SHELLstatic inline 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/*	Most builtins need access to the struct child_prog that has	their arguments, previously coded as cmd->progs[0].  That coding	can exhibit a bug, if the builtin is not the first command in	a pipeline: "echo foo | exec sort" will attempt to exec foo.builtin   previous use      notes------ -----------------  ---------cd      cmd->progs[0]exec    cmd->progs[0]  squashed bug: didn't look for applets or forking builtinsexit    cmd->progs[0]fg_bg   cmd->progs[0], job_list->head, job_list->fghelp    0jobs    job_list->headpwd     0export  cmd->progs[0]source  cmd->progs[0]unset   cmd->progs[0]read    cmd->progs[0]I added "struct job *family;" to struct child_prog,and switched API to builtin_foo(struct child_prog *child);So   cmd->text        becomes  child->family->text     cmd->job_context  becomes  child->family->job_context     cmd->progs[0]    becomes  *child     job_list          becomes  child->family->job_list *//* built-in 'cd <path>' handler */static int builtin_cd(struct child_prog *child){	char *newdir;	if (child->argv[1] == NULL)		newdir = getenv("HOME");	else		newdir = child->argv[1];	if (chdir(newdir)) {		printf("cd: %s: %m\n", newdir);		return EXIT_FAILURE;	}	cwd = xgetcwd((char *)cwd);	if (!cwd)		cwd = unknown;	return EXIT_SUCCESS;}/* built-in 'exec' handler */static int builtin_exec(struct child_prog *child){	if (child->argv[1] == NULL)		return EXIT_SUCCESS;   /* Really? */	child->argv++;	close_all();	pseudo_exec(child);	/* never returns */}/* built-in 'exit' handler */static int builtin_exit(struct child_prog *child){	if (child->argv[1] == NULL)		exit(EXIT_SUCCESS);	exit (atoi(child->argv[1]));}/* built-in 'fg' and 'bg' handler */static int builtin_fg_bg(struct child_prog *child){	int i, jobnum;	struct job *job=NULL;	/* If they gave us no args, assume they want the last backgrounded task */	if (!child->argv[1]) {		for (job = child->family->job_list->head; job; job = job->next) {			if (job->jobid == last_jobid) {				break;			}		}		if (!job) {			error_msg("%s: no current job", child->argv[0]);			return EXIT_FAILURE;		}	} else {		if (sscanf(child->argv[1], "%%%d", &jobnum) != 1) {			error_msg("%s: bad argument '%s'", child->argv[0], child->argv[1]);			return EXIT_FAILURE;		}		for (job = child->family->job_list->head; job; job = job->next) {			if (job->jobid == jobnum) {				break;			}		}		if (!job) {			error_msg("%s: %d: no such job", child->argv[0], jobnum);			return EXIT_FAILURE;		}	}	if (*child->argv[0] == 'f') {		/* Put the job into the foreground.  */		tcsetpgrp(shell_terminal, job->pgrp);		child->family->job_list->fg = job;	}	/* Restart the processes in the job */	for (i = 0; i < job->num_progs; i++)		job->progs[i].is_stopped = 0;	job->stopped_progs = 0;	if ( (i=kill(- job->pgrp, SIGCONT)) < 0) {		if (i == ESRCH) {			remove_job(&job_list, job);		} else {			perror_msg("kill (SIGCONT)");		}	}	return EXIT_SUCCESS;}/* built-in 'help' handler */static int builtin_help(struct child_prog *dummy){	struct built_in_command *x;	printf("\nBuilt-in commands:\n");	printf("-------------------\n");	for (x = bltins; x->cmd; x++) {		if (x->descr==NULL)			continue;		printf("%s\t%s\n", x->cmd, x->descr);	}	for (x = bltins_forking; x->cmd; x++) {		if (x->descr==NULL)			continue;		printf("%s\t%s\n", x->cmd, x->descr);	}	printf("\n\n");	return EXIT_SUCCESS;}/* built-in 'jobs' handler */static int builtin_jobs(struct child_prog *child){	struct job *job;	char *status_string;	for (job = child->family->job_list->head; job; job = job->next) {		if (job->running_progs == job->stopped_progs)			status_string = "Stopped";		else			status_string = "Running";		printf(JOB_STATUS_FORMAT, job->jobid, status_string, job->text);	}	return EXIT_SUCCESS;}/* built-in 'pwd' handler */static int builtin_pwd(struct child_prog *dummy){	cwd = xgetcwd((char *)cwd);	if (!cwd)		cwd = unknown;	puts(cwd);	return EXIT_SUCCESS;}/* built-in 'export VAR=value' handler */static int builtin_export(struct child_prog *child){	int res;	char *v = child->argv[1];	if (v == NULL) {		char **e;		for (e = environ; *e; e++) {			puts(*e);		}		return 0;	}	res = putenv(v);	if (res)		fprintf(stderr, "export: %m\n");#ifdef BB_FEATURE_SH_FANCY_PROMPT	if (strncmp(v, "PS1=", 4)==0)		PS1 = getenv("PS1");#endif#ifdef BB_LOCALE_SUPPORT	if(strncmp(v, "LC_ALL=", 7)==0)		setlocale(LC_ALL, getenv("LC_ALL"));	if(strncmp(v, "LC_CTYPE=", 9)==0)		setlocale(LC_CTYPE, getenv("LC_CTYPE"));#endif	return (res);}/* built-in 'read VAR' handler */static int builtin_read(struct child_prog *child){	int res = 0, len, newlen;	char *s;	char string[MAX_READ];	if (child->argv[1]) {		/* argument (VAR) given: put "VAR=" into buffer */		snprintf(string, sizeof(string)-1, "%s=", child->argv[1]);		len = strlen(string);		fgets(&string[len], sizeof(string) - len, stdin);	/* read string */		newlen = strlen(string);		if(newlen > len)			string[--newlen] = '\0';	/* chomp trailing newline */		/*		** string should now contain "VAR=<value>"		** copy it (putenv() won't do that, so we must make sure		** the string resides in a static buffer!)		*/		res = -1;		if((s = strdup(string)))			res = putenv(s);		if (res)			fprintf(stderr, "read: %m\n");	}	else		fgets(string, sizeof(string), stdin);	return (res);}/* Built-in '.' handler (read-in and execute commands from file) */static int builtin_source(struct child_prog *child){	FILE *input;	int status;	int fd;	if (child->argv[1] == NULL)		return EXIT_FAILURE;	input = fopen(child->argv[1], "r");	if (!input) {		printf( "Couldn't open file '%s'\n", child->argv[1]);		return EXIT_FAILURE;	}	fd=fileno(input);	mark_open(fd);	/* Now run the file */	status = busy_loop(input);	fclose(input);	mark_closed(fd);	return (status);}/* built-in 'unset VAR' handler */static int builtin_unset(struct child_prog *child){	if (child->argv[1] == NULL) {		printf( "unset: parameter required.\n");		return EXIT_FAILURE;	}	unsetenv(child->argv[1]);	return EXIT_SUCCESS;}static void mark_open(int fd){	struct close_me *new = xmalloc(sizeof(struct close_me));	new->fd = fd;	new->next = close_me_head;	close_me_head = new;}static void mark_closed(int fd){	struct close_me *tmp;	if (close_me_head == NULL || close_me_head->fd != fd)		error_msg_and_die("corrupt close_me");	tmp = close_me_head;	close_me_head = close_me_head->next;	free(tmp);}static void close_all(){	struct close_me *c, *tmp;	for (c=close_me_head; c; c=tmp) {		close(c->fd);		tmp=c->next;		free(c);	}	close_me_head = NULL;}/* free up all memory from a job */static void free_job(struct job *cmd){	int i;	struct jobset *keep;	for (i = 0; i < cmd->num_progs; i++) {		free(cmd->progs[i].argv);		if (cmd->progs[i].redirects)			free(cmd->progs[i].redirects);	}	if (cmd->progs)		free(cmd->progs);	if (cmd->text)		free(cmd->text);	if (cmd->cmdbuf)		free(cmd->cmdbuf);	keep = cmd->job_list;	memset(cmd, 0, sizeof(struct job));	cmd->job_list = keep;}/* remove a job from a jobset */static void remove_job(struct jobset *j_list, struct job *job){	struct job *prevjob;	free_job(job);	if (job == j_list->head) {		j_list->head = job->next;	} else {		prevjob = j_list->head;		while (prevjob->next != job)			prevjob = prevjob->next;		prevjob->next = job->next;	}	if (j_list->head)		last_jobid = j_list->head->jobid;	else		last_jobid = 0;	free(job);}/* Checks to see if any background processes have exited -- if they 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
视频一区二区三区在线| 日韩精品视频网站| 亚洲成av人片一区二区三区| 精品在线免费视频| 精品一区二区国语对白| 在线观看91精品国产入口| 国产日产欧产精品推荐色| 午夜欧美大尺度福利影院在线看| 亚洲制服丝袜一区| 国产成人av一区二区三区在线观看| 国产精一品亚洲二区在线视频| 精一区二区三区| 国产麻豆精品95视频| 在线观看亚洲一区| 中文字幕中文在线不卡住| 国产美女精品人人做人人爽| 在线综合亚洲欧美在线视频| 国产酒店精品激情| 国产成人精品免费在线| 日韩视频123| 日韩精品一二三| 欧美日韩在线播放| 亚洲国产一二三| 91久久奴性调教| 亚洲激情第一区| 91女神在线视频| 亚洲精选视频免费看| 色婷婷综合久久久中文一区二区 | 黄色资源网久久资源365| 国产一本一道久久香蕉| 日韩欧美精品三级| 久久精品国产精品青草| 不卡的av电影| 国产精品美女久久久久久2018| 亚洲精品日韩一| 美日韩一级片在线观看| 欧美一二三区精品| 久久se这里有精品| 久久精品夜色噜噜亚洲aⅴ| 亚洲精品视频在线观看免费| caoporm超碰国产精品| 国产精品久久久久久久久动漫| 欧美aaa在线| 精品欧美一区二区三区精品久久| 亚洲欧美电影院| 欧美在线高清视频| 蜜臀99久久精品久久久久久软件| 成人丝袜高跟foot| 亚洲另类一区二区| 国产成a人亚洲| 中文字幕在线观看不卡| 在线一区二区三区四区| 午夜精品视频一区| 精品国内片67194| 国产福利电影一区二区三区| 国产精品毛片高清在线完整版| 免费观看久久久4p| 国产视频一区不卡| 免费xxxx性欧美18vr| 久久嫩草精品久久久久| 免费观看在线色综合| 26uuu久久天堂性欧美| 丝袜美腿高跟呻吟高潮一区| 精品国产1区二区| 99久久99久久综合| 日韩电影在线免费看| 国产欧美精品国产国产专区| 91久久精品一区二区三| 美腿丝袜亚洲一区| 亚洲精品欧美在线| 精品福利av导航| 欧美色精品在线视频| 亚洲一区二区欧美激情| 欧美在线看片a免费观看| 国产美女久久久久| 亚洲成人免费视频| 国产精品福利一区二区三区| 在线成人av网站| 99精品热视频| 久久国产综合精品| 亚洲妇女屁股眼交7| 中国av一区二区三区| 日韩欧美一区电影| 欧美日韩一区成人| 99re成人在线| 国产成人综合网站| 喷水一区二区三区| 亚洲成av人**亚洲成av**| 国产精品美女一区二区| 日韩精品一区国产麻豆| 欧美三电影在线| 99国产一区二区三精品乱码| 国产曰批免费观看久久久| 日韩国产欧美一区二区三区| 亚洲人成精品久久久久| 欧美韩国日本一区| 国产三级精品在线| 久久久久国产精品麻豆| 日韩精品一区二区三区视频在线观看 | 一区二区不卡在线视频 午夜欧美不卡在 | 欧美日韩国产另类一区| 高清不卡在线观看| 韩国精品免费视频| 蜜臀久久99精品久久久久宅男| 26uuuu精品一区二区| 欧美精品一二三| 欧美主播一区二区三区美女| 色悠久久久久综合欧美99| 成人性生交大片| 成人高清av在线| 丁香激情综合五月| 99久久er热在这里只有精品66| 亚洲一区二区三区四区在线| 欧美一级在线免费| 国产成人亚洲精品狼色在线| 精品无人码麻豆乱码1区2区 | 久久久久久夜精品精品免费| 欧美一区二区三区在线电影| 欧美精品色一区二区三区| 国产乱码精品一区二区三| 国产精品自在欧美一区| 国产乱码精品一区二区三区忘忧草| 亚洲在线一区二区三区| 亚洲乱码精品一二三四区日韩在线| 日韩免费观看高清完整版| 26uuu精品一区二区三区四区在线| 色偷偷久久一区二区三区| 激情欧美日韩一区二区| 国产大片一区二区| 91麻豆自制传媒国产之光| 欧美综合色免费| 日韩一级二级三级精品视频| 久久亚区不卡日本| 亚洲国产高清aⅴ视频| 欧美一区二区三区免费视频| 99久久99久久精品免费看蜜桃 | 91精品欧美福利在线观看 | 国产精品三级久久久久三级| 中文av一区特黄| 一区二区三区四区在线免费观看| 久久久亚洲精品一区二区三区| 欧美婷婷六月丁香综合色| 欧美剧情电影在线观看完整版免费励志电影 | 久久99精品久久久久久动态图 | 国产精品久久夜| 夜夜揉揉日日人人青青一国产精品| 国产欧美日韩一区二区三区在线观看| 欧美精品久久天天躁| 91免费观看国产| 6080午夜不卡| 国产精品女上位| 三级成人在线视频| 成人小视频在线观看| 欧美夫妻性生活| 欧美日韩国产小视频| 久久久一区二区三区捆绑**| 亚洲男同性恋视频| 精品一区二区免费视频| 91久久免费观看| 国产农村妇女毛片精品久久麻豆 | 宅男在线国产精品| 国产精品婷婷午夜在线观看| 国产亚洲女人久久久久毛片| 悠悠色在线精品| 亚洲一区二区三区视频在线播放| 18欧美乱大交hd1984| 精品在线播放午夜| 欧美日韩国产区一| 亚洲欧洲韩国日本视频| 国内成人免费视频| 欧美老肥妇做.爰bbww视频| ㊣最新国产の精品bt伙计久久| 中文字幕一区二| 麻豆国产精品一区二区三区| 91久久香蕉国产日韩欧美9色| 欧美在线免费观看亚洲| 中文字幕免费不卡| 国产伦精一区二区三区| 日韩欧美色电影| 日韩一区欧美二区| 欧美日韩精品一区二区三区四区 | 日韩av一区二| 色婷婷综合久久久中文一区二区| 欧美日韩一区三区| 亚洲美女在线国产| 99国产精品国产精品毛片| 久久久精品国产免费观看同学| 综合亚洲深深色噜噜狠狠网站| 亚洲欧美色综合| 99久久精品国产导航| 欧美吻胸吃奶大尺度电影| 亚洲欧美激情一区二区| www.在线欧美| 国产精品白丝在线| 成人aaaa免费全部观看| 中文字幕久久午夜不卡| 成人一级片网址| 1024国产精品| 欧洲精品在线观看| 亚洲成人第一页|