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

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

?? grep.c

?? 操作系統源代碼
?? C
字號:
/* grep - search a file for a pattern	Author: Norbert Schlenker *//* Norbert Schlenker (nfs@princeton.edu)  1990-02-08 * Released into the public domain. * * Grep searches files for lines containing a pattern, as specified by * a regular expression, and prints those lines.  It is invoked by: *	grep [flags] [pattern] [file ...] * * Flags: *	-e pattern	useful when pattern begins with '-' *	-c		print a count of lines matched *	-i		ignore case *	-l		prints just file names, no lines (quietly overrides -n) *	-n		printed lines are preceded by relative line numbers *	-s		prints errors only (quietly overrides -l and -n) *	-v		prints lines which don't contain the pattern * * Semantic note: * 	If both -l and -v are specified, grep prints the names of those *	files which do not contain the pattern *anywhere*. * * Exit: *	Grep sets an exit status which can be tested by the caller. *	Note that these settings are not necessarily compatible with *	any other version of grep, especially when -v is specified. *	Possible status values are: *	  0	if any matches are found *	  1	if no matches are found *	  2	if syntax errors are detected or any file cannot be opened *//* External interfaces */#include <sys/types.h>#include <regexp.h>		/* Thanks to Henry Spencer */#include <stdlib.h>#include <string.h>#include <stdio.h>#include <unistd.h>/* Internal constants */#define MATCH		0	/* exit code: some match somewhere */#define NO_MATCH	1	/* exit code: no match on any line */#define FAILURE		2	/* exit code: syntax error or bad file name *//* Macros */#define SET_FLAG(c)	(flags[(c)-'a'] = 1)#define FLAG(c)		(flags[(c)-'a'] != 0)#define uppercase(c)	(((unsigned) ((c) - 'A')) <= ('Z' - 'A'))#define downcase(c)	((c) - 'A' + 'a')/* Private storage */static char *program;		/* program name */static char flags[26];		/* invocation flags */static regexp *expression;	/* compiled search pattern *//* External variables. */extern int optind;extern char *optarg;/* Internal interfaces */_PROTOTYPE(int main, (int argc, char **argv));_PROTOTYPE(static int match, (FILE *input, char *label, char *filename));_PROTOTYPE(static char *get_line, (FILE *input));_PROTOTYPE(static char *map_nocase, (char *line));_PROTOTYPE(static void error_exit, (char *msg));_PROTOTYPE(void regerror , (char *s ) );int main(argc, argv)int argc;char *argv[];{  int opt;			/* option letter from getopt() */  char *pattern;		/* search pattern */  int exit_status = NO_MATCH;	/* exit status for our caller */  int file_status;		/* status of search in one file */  FILE *input;			/* input file (if not stdin) */  program = argv[0];  memset(flags, 0, sizeof(flags));  pattern = NULL;/* Process any command line flags. */  while ((opt = getopt(argc, argv, "e:cilnsv")) != EOF) {	if (opt == '?')		exit_status = FAILURE;	else	if (opt == 'e')		pattern = optarg;	else		SET_FLAG(opt);  }/* Detect a few problems. */  if ((exit_status == FAILURE) || (optind == argc && pattern == NULL))	error_exit("Usage: %s [-cilnsv] [-e] expression [file ...]\n");/* Ensure we have a usable pattern. */  if (pattern == NULL)	pattern = argv[optind++];/* Map pattern to lowercase if -i given. */  if (FLAG('i')) {	char *p;	for (p = pattern; *p != '\0'; p++) {		if (uppercase(*p))			*p = downcase(*p);	}  }  if ((expression = regcomp(pattern)) == NULL)	error_exit("%s: bad regular expression\n");/* Process the files appropriately. */  if (optind == argc) {		/* no file names - find pattern in stdin */	exit_status = match(stdin, (char *) NULL, "<stdin>");  }  else   if (optind + 1 == argc) {	/* one file name - find pattern in it */	if (strcmp(argv[optind], "-") == 0) {		exit_status = match(stdin, (char *) NULL, "-");	} else {		if ((input = fopen(argv[optind], "r")) == NULL) {			fprintf(stderr, "%s: couldn't open %s\n",							program, argv[optind]);			exit_status = FAILURE;		}		else {			exit_status = match(input, (char *) NULL, argv[optind]);		}	}  }  else  while (optind < argc) {	/* lots of file names - find pattern in all */	if (strcmp(argv[optind], "-") == 0) {		file_status = match(stdin, "-", "-");	} else {		if ((input = fopen(argv[optind], "r")) == NULL) {			fprintf(stderr, "%s: couldn't open %s\n",							program, argv[optind]);			exit_status = FAILURE;		} else {			file_status = match(input, argv[optind], argv[optind]);			fclose(input);		}	}	if (exit_status != FAILURE)		exit_status &= file_status;	++optind;  }  return(exit_status);}/* match - matches the lines of a file with the regular expression. * To improve performance when either -s or -l is specified, this * function handles those cases specially. */static int match(input, label, filename)FILE *input;char *label;char *filename;{  char *line, *testline;	/* pointers to input line */  long int lineno = 0;		/* line number */  long int matchcount = 0;	/* lines matched */  int status = NO_MATCH;	/* summary of what was found in this file */  if (FLAG('s') || FLAG('l')) {	while ((line = get_line(input)) != NULL) {		testline = FLAG('i') ? map_nocase(line) : line;		if (regexec(expression, testline, 1)) {			status = MATCH;			break;		}	}	if (FLAG('l'))		if ((!FLAG('v') && status == MATCH) ||		    ( FLAG('v') && status == NO_MATCH))			puts(filename);	return status;  }  while ((line = get_line(input)) != NULL) {	++lineno;	testline = FLAG('i') ? map_nocase(line) : line;	if (regexec(expression, testline, 1)) {		status = MATCH;		if (!FLAG('v')) {			if (label != NULL)				printf("%s:", label);			if (FLAG('n'))				printf("%ld:", lineno);			if (!FLAG('c')) puts(line);			matchcount++;		}	} else {		if (FLAG('v')) {			if (label != NULL)				printf("%s:", label);			if (FLAG('n'))				printf("%ld:", lineno);			if (!FLAG('c')) puts(line);			matchcount++;		}	}  }  if (FLAG('c')) printf("%ld\n", matchcount);  return status;}/* get_line - fetch a line from the input file * This function reads a line from the input file into a dynamically * allocated buffer.  If the line is too long for the current buffer, * attempts will be made to increase its size to accomodate the line. * The trailing newline is stripped before returning to the caller. */#define FIRST_BUFFER (size_t)256		/* first buffer size */static char *buf = NULL;	/* input buffer */static size_t buf_size = 0;		/* input buffer size */static char *get_line(input)FILE *input;{  int n;  register char *bp;  register int c;  char *new_buf;  size_t new_size;  if (buf_size == 0) {	if ((buf = (char *) malloc(FIRST_BUFFER)) == NULL)		error_exit("%s: not enough memory\n");	buf_size = FIRST_BUFFER;  }  bp = buf;  n = buf_size;  while (1) {	while (--n > 0 && (c = getc(input)) != EOF) {		if (c == '\n') {			*bp = '\0';			return buf;		}		*bp++ = c;	}	if (c == EOF)		return (ferror(input) || bp == buf) ? NULL : buf;	new_size = buf_size << 1;	if ((new_buf = (char *) realloc(buf, new_size)) == NULL) {		fprintf(stderr, "%s: line too long - truncated\n", program);		while ((c = getc(input)) != EOF && c != '\n') ;		*bp = '\0';		return buf;	} else {		bp = new_buf + (buf_size - 1);		n = buf_size + 1;		buf = new_buf;		buf_size = new_size;	}  }}/* map_nocase - map a line down to lowercase letters only. * bad points:	assumes line gotten from get_line. *		there is more than A-Z you say? */static char *map_nocase(line)char *line;{  static char *mapped;  static size_t map_size = 0;  char *mp;  if (map_size < buf_size) {	if (map_size == 0) {		mapped = (char *) malloc(buf_size);	} else {		mapped = (char *) realloc(mapped, buf_size);	}	if (mapped == NULL)		error_exit("%s: not enough memory\n");	map_size = buf_size;  }  mp = mapped;  do {	*mp++ = uppercase(*line) ? downcase(*line) : *line;  } while (*line++ != '\0');  return mapped;}/* Regular expression code calls this routine to print errors. */void regerror(s)char *s;{  fprintf(stderr, "regexp: %s\n", s);}/* Common exit point for outrageous errors. */static void error_exit(msg)char *msg;{  fprintf(stderr, msg, program);  exit(FAILURE);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产人妖乱国产精品人妖| 免费日本视频一区| 国产一区二区美女诱惑| 欧美挠脚心视频网站| 国产精品久久久久久久久免费樱桃| 日韩三区在线观看| 日韩在线观看一区二区| 欧美性生活影院| 亚洲mv大片欧洲mv大片精品| 一本一本大道香蕉久在线精品| 欧美男人的天堂一二区| 三级成人在线视频| 欧美一区二区三区人| 精品一区二区三区香蕉蜜桃| 日韩欧美卡一卡二| 韩国三级在线一区| 久久久噜噜噜久噜久久综合| 国产一区二区三区观看| 久久精品人人做人人综合| 国产一二精品视频| 国产蜜臀av在线一区二区三区| 国产一区二区三区四区在线观看| 在线看一区二区| 免费久久精品视频| 中日韩av电影| 欧美日韩免费观看一区三区| 日韩有码一区二区三区| 国产精品免费网站在线观看| 91片黄在线观看| 毛片av中文字幕一区二区| 久久久久成人黄色影片| 日本韩国一区二区三区| 久久精工是国产品牌吗| 最新高清无码专区| 久久综合色婷婷| 日韩欧美在线网站| 久久毛片高清国产| 欧美午夜不卡在线观看免费| 日韩美女视频一区| 国产激情91久久精品导航| 欧美成人官网二区| 国产宾馆实践打屁股91| 久久精品日产第一区二区三区高清版 | 精品日韩欧美在线| 国产成人精品免费网站| 日本vs亚洲vs韩国一区三区二区| 日韩你懂的电影在线观看| 欧美亚一区二区| 成人爱爱电影网址| 国内精品国产三级国产a久久| 亚洲国产精品黑人久久久| 日韩欧美色综合网站| 日韩免费福利电影在线观看| 欧美日韩精品福利| 欧美久久免费观看| 欧美日韩在线三级| 91成人国产精品| 91蜜桃婷婷狠狠久久综合9色| 国产在线视频一区二区三区| 奇米777欧美一区二区| 日本伊人午夜精品| 久久精品国产网站| 国产一区二区三区不卡在线观看 | 久久综合色综合88| 国产精品久久久久精k8| 日韩理论片一区二区| 亚洲视频中文字幕| 天天av天天翘天天综合网 | 欧美国产精品一区| 亚洲情趣在线观看| 亚洲成人av中文| 捆绑调教美女网站视频一区| 国产在线国偷精品产拍免费yy| 免费日韩伦理电影| www.亚洲国产| 91精品欧美综合在线观看最新| 欧美男女性生活在线直播观看| 欧美性猛片xxxx免费看久爱| 91麻豆免费观看| 99久久精品免费看国产 | 亚洲欧美日韩小说| 蜜桃一区二区三区在线观看| 国产在线国偷精品产拍免费yy| 黄色资源网久久资源365| 91小宝寻花一区二区三区| 欧美日韩久久久一区| 久久久精品欧美丰满| 亚洲高清免费观看高清完整版在线观看| 三级欧美在线一区| 一本色道久久综合亚洲精品按摩| 欧美熟乱第一页| 国产午夜精品一区二区三区嫩草 | 色婷婷激情一区二区三区| 精品国产乱码久久| 日本vs亚洲vs韩国一区三区 | 成人免费视频app| 日韩欧美高清dvd碟片| 午夜欧美一区二区三区在线播放| 久久国产视频网| 欧美丰满少妇xxxxx高潮对白| 久久综合九色综合欧美亚洲| 青青草97国产精品免费观看 | 亚洲一区二区三区在线| 99久久久国产精品免费蜜臀| 国产成人精品亚洲777人妖| 成人性生交大片免费看视频在线| 91在线观看高清| 一区二区三区视频在线看| 色综合久久中文综合久久牛| 成人欧美一区二区三区白人| 高清不卡一二三区| 亚洲欧美日韩国产中文在线| 色婷婷精品大视频在线蜜桃视频| 国产视频一区在线观看| 成人黄色免费短视频| 一区二区高清视频在线观看| 欧美日韩另类一区| 捆绑调教美女网站视频一区| 国产女主播视频一区二区| 91麻豆成人久久精品二区三区| 国产精品成人在线观看 | 国产视频一区在线播放| 成人动漫一区二区| 午夜不卡av免费| 久久久精品人体av艺术| 欧美三级韩国三级日本三斤| 麻豆国产精品一区二区三区 | 中文字幕一区二区三区精华液| 懂色一区二区三区免费观看| 午夜欧美电影在线观看| 国产丝袜在线精品| 欧美日韩精品综合在线| 国产69精品一区二区亚洲孕妇| 亚洲欧美在线视频| 精品黑人一区二区三区久久| 91美女蜜桃在线| 丁香天五香天堂综合| 日本视频免费一区| 一区二区三区四区av| 国产精品久久二区二区| 国产午夜精品久久久久久免费视| 波多野结衣中文字幕一区| 国产一区二区三区在线观看精品| 综合电影一区二区三区 | av在线综合网| 国产成人精品一区二区三区四区| 亚洲精品福利视频网站| 国产精品免费人成网站| 久久久久久久久99精品| 久久综合国产精品| 国产亚洲欧美日韩在线一区| www国产成人免费观看视频 深夜成人网| 成人av网站在线观看免费| 国产一区二区剧情av在线| 久久99精品国产麻豆婷婷| 图片区小说区国产精品视频| 亚洲国产另类av| 日日欢夜夜爽一区| 久久国产综合精品| 高清不卡一区二区| 色琪琪一区二区三区亚洲区| 欧美日韩中文国产| 欧美成人a∨高清免费观看| 精品国产123| 国产精品久久久久久久久晋中| 久久九九99视频| 国产精品久线在线观看| 亚洲最新视频在线播放| 丝袜美腿亚洲色图| 成人小视频在线| 欧美日韩一区在线| 精品国产亚洲在线| 一区二区三区91| 国产主播一区二区| 欧美网站大全在线观看| 精品久久五月天| 一区二区三区**美女毛片| 蜜臀av性久久久久av蜜臀妖精| 三级影片在线观看欧美日韩一区二区| 亚洲男人的天堂在线aⅴ视频| 综合久久久久久| 国产一区二区三区免费播放| 91网站黄www| 欧美国产1区2区| 欧美aaaaaa午夜精品| 欧美亚洲国产一区二区三区va| 欧美一区二区三区视频在线| 国产精品久久久久久久久久免费看| 亚洲日本电影在线| 国产高清在线观看免费不卡| 欧美一区二区三区四区五区| 最新日韩av在线| 99久久精品免费看国产免费软件| 欧美另类videos死尸| 亚洲欧美国产毛片在线| 成人av网站在线| 亚洲欧美另类综合偷拍| 成人精品小蝌蚪| 亚洲日本护士毛茸茸| 99re这里只有精品视频首页|