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

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

?? sed.c

?? GNU Sed GNU Sed GNU Sed
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*  GNU SED, a batch stream editor.
    Copyright (C) 1989-1991 Free Software Foundation, Inc.

    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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.  */


/* TimF@microsoft.com:	7-Aug-92  Port to Microsoft's Windows NT (tm) */

#ifdef	WINDOWSNT
#include	<errno.h>
#include	<windows.h>
#endif


#ifdef __STDC__
#define VOID void
#else
#define VOID char
#endif

#define _GNU_SOURCE
#include <ctype.h>
#ifndef isblank
#define isblank(c) ((c) == ' ' || (c) == '\t')
#endif
#include <stdio.h>
#include <regex.h>
#include <getopt.h>
#if defined(STDC_HEADERS)
#include <stdlib.h>
#endif
#if defined(USG) || defined(STDC_HEADERS)
#include <string.h>
#include <memory.h>
#define bcopy(s, d, n) (memcpy((d), (s), (n)))
#else
#include <strings.h>
VOID *memchr();
#endif


char *version_string = "GNU sed version 1.08";

/* Struct vector is used to describe a chunk of a sed program.  There is one
   vector for the main program, and one for each { } pair. */
struct vector {
	struct sed_cmd *v;
	int v_length;
	int v_allocated;
	struct vector *up_one;
	struct vector *next_one;
};


/* Goto structure is used to hold both GOTO's and labels.  There are two
   separate lists, one of goto's, called 'jumps', and one of labels, called
   'labels'.
   the V element points to the descriptor for the program-chunk in which the
   goto was encountered.
   the v_index element counts which element of the vector actually IS the
   goto/label.  The first element of the vector is zero.
   the NAME element is the null-terminated name of the label.
   next is the next goto/label in the list. */

struct sed_label {
	struct vector *v;
	int v_index;
	char *name;
	struct sed_label *next;
};

/* ADDR_TYPE is zero for a null address,
   one if addr_number is valid, or
   two if addr_regex is valid,
   three, if the address is '$'

   Other values are undefined.
 */

#define ADDR_NULL	0
#define ADDR_NUM	1
#define ADDR_REGEX	2
#define ADDR_LAST	3
	
struct addr {
	int	addr_type;
	struct re_pattern_buffer *addr_regex;
	int	addr_number;
};


/* Aflags:  If the low order bit is set, a1 has been
   matched; apply this command until a2 matches.
   If the next bit is set, apply this command to all
   lines that DON'T match the address(es).
 */

#define A1_MATCHED_BIT	01
#define ADDR_BANG_BIT	02

 
struct sed_cmd {
	struct addr a1,a2;
	int aflags;

	char cmd;

	union {
		/* This structure is used for a, i, and c commands */
		struct {
			char *text;
			int text_len;
		} cmd_txt;

		/* This is used for b and t commands */
		struct sed_cmd *label;

		/* This for r and w commands */
		FILE *io_file;

		/* This for the hairy s command */
		/* For the flags var:
		   low order bit means the 'g' option was given,
		   next bit means the 'p' option was given,
		   and the next bit means a 'w' option was given,
		      and wio_file contains the file to write to. */

#define S_GLOBAL_BIT	01
#define S_PRINT_BIT	02
#define S_WRITE_BIT	04
#define S_NUM_BIT	010

		struct {
			struct re_pattern_buffer *regx;
			char *replacement;
			int replace_length;
			int flags;
			int numb;
			FILE *wio_file;
		} cmd_regex;

		/* This for the y command */
		unsigned char *translate;

		/* For { and } */
		struct vector *sub;
		struct sed_label *jump;
	} x;
};

/* Sed operates a line at a time. */
struct line {
	char *text;		/* Pointer to line allocated by malloc. */
	int length;		/* Length of text. */
	int alloc;		/* Allocated space for text. */
};

/* This structure holds information about files opend by the 'r', 'w',
   and 's///w' commands.  In paticular, it holds the FILE pointer to
   use, the file's name, a flag that is non-zero if the file is being
   read instead of written. */

#define NUM_FPS	32
struct {
	FILE *phile;
	char *name;
	int readit;
} file_ptrs[NUM_FPS];


#if defined(__STDC__)
# define P_(s) s
#else
# define P_(s) ()
#endif

void panic P_((char *str, ...));
char *__fp_name P_((FILE *fp));
FILE *ck_fopen P_((char *name, char *mode));
void ck_fwrite P_((char *ptr, int size, int nmemb, FILE *stream));
void ck_fclose P_((FILE *stream));
VOID *ck_malloc P_((int size));
VOID *ck_realloc P_((VOID *ptr, int size));
char *ck_strdup P_((char *str));
VOID *init_buffer P_((void));
void flush_buffer P_((VOID *bb));
int size_buffer P_((VOID *b));
void add_buffer P_((VOID *bb, char *p, int n));
void add1_buffer P_((VOID *bb, int ch));
char *get_buffer P_((VOID *bb));

void compile_string P_((char *str));
void compile_file P_((char *str));
struct vector *compile_program P_((struct vector *vector));
void bad_prog P_((char *why));
int inchar P_((void));
void savchar P_((int ch));
int compile_address P_((struct addr *addr));
void compile_regex P_((int slash));
struct sed_label *setup_jump P_((struct sed_label *list, struct sed_cmd *cmd, struct vector *vec));
FILE *compile_filename P_((int readit));
void read_file P_((char *name));
void execute_program P_((struct vector *vec));
int match_address P_((struct addr *addr));
int read_pattern_space P_((void));
void append_pattern_space P_((void));
void line_copy P_((struct line *from, struct line *to));
void line_append P_((struct line *from, struct line *to));
void str_append P_((struct line *to, char *string, int length));
void usage P_((void));

extern char *myname;

/* If set, don't write out the line unless explictly told to */
int no_default_output = 0;

/* Current input line # */
int input_line_number = 0;

/* Are we on the last input file? */
int last_input_file = 0;

/* Have we hit EOF on the last input file?  This is used to decide if we
   have hit the '$' address yet. */
int input_EOF = 0;

/* non-zero if a quit command has been executed. */
int quit_cmd = 0;

/* Have we done any replacements lately?  This is used by the 't' command. */
int replaced = 0;

/* How many '{'s are we executing at the moment */
int program_depth = 0;

/* The complete compiled SED program that we are going to run */
struct vector *the_program = 0;

/* information about labels and jumps-to-labels.  This is used to do
   the required backpatching after we have compiled all the scripts. */
struct sed_label *jumps = 0;
struct sed_label *labels = 0;

/* The 'current' input line. */
struct line line;

/* An input line that's been stored by later use by the program */
struct line hold;

/* A 'line' to append to the current line when it comes time to write it out */
struct line append;


/* When we're reading a script command from a string, 'prog_start' and
   'prog_end' point to the beginning and end of the string.  This
   would allow us to compile script strings that contain nulls, except
   that script strings are only read from the command line, which is
   null-terminated */ 
char *prog_start;
char *prog_end;

/* When we're reading a script command from a string, 'prog_cur' points
   to the current character in the string */
char *prog_cur;

/* This is the name of the current script file.
   It is used for error messages. */
char *prog_name;

/* This is the current script file.  If it is zero, we are reading
   from a string stored in 'prog_start' instead.  If both 'prog_file'
   and 'prog_start' are zero, we're in trouble! */
FILE *prog_file;

/* this is the number of the current script line that we're compiling.  It is
   used to give out useful and informative error messages. */
int prog_line = 1;

/* This is the file pointer that we're currently reading data from.  It may
   be stdin */
FILE *input_file;

/* If this variable is non-zero at exit, one or more of the input
   files couldn't be opened. */

int bad_input = 0;

/* 'an empty regular expression is equivalent to the last regular
   expression read' so we have to keep track of the last regex used.
   Here's where we store a pointer to it (it is only malloc()'d once) */
struct re_pattern_buffer *last_regex;

/* Various error messages we may want to print */
static char ONE_ADDR[] = "Command only uses one address";
static char NO_ADDR[] = "Command doesn't take any addresses";
static char LINE_JUNK[] = "Extra characters after command";
static char BAD_EOF[] = "Unexpected End-of-file";
static char NO_REGEX[] = "No previous regular expression";

static struct option longopts[] =
{
  {"expression", 1, NULL, 'e'},
  {"file", 1, NULL, 'f'},
  {"quiet", 0, NULL, 'n'},
  {"silent", 0, NULL, 'n'},
  {"version", 0, NULL, 'V'},
  {NULL, 0, NULL, 0}
};

/* Yes, the main program, which parses arguments, and does the right
   thing with them; it also inits the temporary storage, etc. */
void
main(argc,argv)
int argc;
char **argv;
{
	int opt;
	char *e_strings = NULL;
	int compiled = 0;
	struct sed_label *go,*lbl;

	myname=argv[0];
	while((opt=getopt_long(argc,argv,"ne:f:V", longopts, (int *) 0))
	      !=EOF) {
		switch(opt) {
		case 'n':
			no_default_output = 1;
			break;
		case 'e':
			if(e_strings == NULL) {
				e_strings=ck_malloc(strlen(optarg)+2);
				strcpy(e_strings,optarg);
			} else {
				e_strings=ck_realloc(e_strings,strlen(e_strings)+strlen(optarg)+2);
				strcat(e_strings,optarg);
			}
			strcat(e_strings,"\n");
			compiled = 1;
			break;
		case 'f':
			compile_file(optarg);
			compiled = 1;
			break;
		case 'V':
			fprintf(stderr, "%s\n", version_string);
			break;
		default:
			usage();
		}
	}
	if(e_strings) {
		compile_string(e_strings);
		free(e_strings);
	}
	if(!compiled) {
		if (optind == argc)
			usage();
		compile_string(argv[optind++]);
	}

	for(go=jumps;go;go=go->next) {
		for(lbl=labels;lbl;lbl=lbl->next)
			if(!strcmp(lbl->name,go->name))
				break;
		if(*go->name && !lbl)
			panic("Can't find label for jump to '%s'",go->name);
		go->v->v[go->v_index].x.jump=lbl;
	}

	line.length=0;
	line.alloc=50;
	line.text=ck_malloc(50);

	append.length=0;
	append.alloc=50;
	append.text=ck_malloc(50);

	hold.length=0;
	hold.alloc=50;
	hold.text=ck_malloc(50);

	if(argc<=optind) {
		last_input_file++;
		read_file("-");
	} else while(optind<argc) {
		if(optind==argc-1)
			last_input_file++;
		read_file(argv[optind]);
		optind++;
		if(quit_cmd)
			break;
	}
	if(bad_input)
		exit(2);
	exit(0);
}

/* 'str' is a string (from the command line) that contains a sed command.
   Compile the command, and add it to the end of 'the_program' */
void
compile_string(str)
char *str;
{
	prog_file = 0;
	prog_line=0;
	prog_start=prog_cur=str;
	prog_end=str+strlen(str);
	the_program=compile_program(the_program);
}

/* 'str' is the name of a file containing sed commands.  Read them in
   and add them to the end of 'the_program' */
void
compile_file(str)
char *str;
{
	int ch;

	prog_start=prog_cur=prog_end=0;
	prog_name=str;
	prog_line=1;
	if(str[0]=='-' && str[1]=='\0')
		prog_file=stdin;
	else
		prog_file=ck_fopen(str,"r");
	ch=getc(prog_file);
	if(ch=='#') {
		ch=getc(prog_file);
		if(ch=='n')
			no_default_output++;
		while(ch!=EOF && ch!='\n')
			ch=getc(prog_file);
	} else if(ch!=EOF)
		ungetc(ch,prog_file);
	the_program=compile_program(the_program);
}

#define MORE_CMDS 40

/* Read a program (or a subprogram within '{' '}' pairs) in and store
   the compiled form in *'vector'  Return a pointer to the new vector.  */
struct vector *
compile_program(vector)
struct vector *vector;
{
	struct sed_cmd *cur_cmd;
	int	ch;
	int	slash;
	VOID	*b;
	unsigned char	*string;
	int	num;

	if(!vector) {
		vector=(struct vector *)ck_malloc(sizeof(struct vector));
		vector->v=(struct sed_cmd *)ck_malloc(MORE_CMDS*sizeof(struct sed_cmd));
		vector->v_allocated=MORE_CMDS;
		vector->v_length=0;
		vector->up_one = 0;
		vector->next_one = 0;
	}
	for(;;) {
	skip_comment:
		do ch=inchar();
		while(ch!=EOF && (isblank(ch) || ch=='\n' || ch==';'));
		if(ch==EOF)
			break;
		savchar(ch);

		if(vector->v_length==vector->v_allocated) {
			vector->v=(struct sed_cmd *)ck_realloc((VOID *)vector->v,(vector->v_length+MORE_CMDS)*sizeof(struct sed_cmd));
			vector->v_allocated+=MORE_CMDS;
		}
		cur_cmd=vector->v+vector->v_length;
		vector->v_length++;

		cur_cmd->a1.addr_type=0;
		cur_cmd->a2.addr_type=0;
		cur_cmd->aflags=0;
		cur_cmd->cmd=0;

		if(compile_address(&(cur_cmd->a1))) {
			ch=inchar();
			if(ch==',') {
				do ch=inchar();
				while(ch!=EOF && isblank(ch));
				savchar(ch);
				if(compile_address(&(cur_cmd->a2)))
					;
				else
					bad_prog("Unexpected ','");
			} else
				savchar(ch);
		}
		ch=inchar();
		if(ch==EOF)
			break;
 new_cmd:
		switch(ch) {
		case '#':
			if(cur_cmd->a1.addr_type!=0)
				bad_prog(NO_ADDR);
			do ch=inchar();
			while(ch!=EOF && ch!='\n');
			vector->v_length--;
			goto skip_comment;
		case '!':
			if(cur_cmd->aflags & ADDR_BANG_BIT)
				bad_prog("Multiple '!'s");
			cur_cmd->aflags|= ADDR_BANG_BIT;
			do ch=inchar();
			while(ch!=EOF && isblank(ch));
			if(ch==EOF)
				bad_prog(BAD_EOF);
#if 0
			savchar(ch);
#endif
			goto new_cmd;
		case 'a':
		case 'i':
			if(cur_cmd->a2.addr_type!=0)
				bad_prog(ONE_ADDR);
			/* Fall Through */
		case 'c':
			cur_cmd->cmd=ch;
			if(inchar()!='\\' || inchar()!='\n')
				bad_prog(LINE_JUNK);
			b=init_buffer();
			while((ch=inchar())!=EOF && ch!='\n') {
				if(ch=='\\')
					ch=inchar();
				add1_buffer(b,ch);
			}
			if(ch!=EOF)
				add1_buffer(b,ch);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆精品在线播放| 国产成人午夜高潮毛片| 国产三级三级三级精品8ⅰ区| 91亚洲精品久久久蜜桃| 国产美女视频91| 午夜亚洲福利老司机| 亚洲欧洲精品一区二区精品久久久 | 2022国产精品视频| 在线精品视频小说1| 国产69精品久久99不卡| 麻豆精品视频在线观看视频| 亚洲精品日韩综合观看成人91| 欧美精品一区二区久久婷婷| 欧美精品久久久久久久多人混战| 99久久精品免费看| 国产成人日日夜夜| 精品影视av免费| 五月婷婷久久综合| 一级特黄大欧美久久久| 中文字幕日韩欧美一区二区三区| 欧美成人性福生活免费看| 欧美日韩国产综合一区二区 | 亚洲r级在线视频| 亚洲免费观看视频| 中文成人av在线| 久久精品人人做人人综合 | 色狠狠一区二区| 成人国产亚洲欧美成人综合网 | 国产乱码精品1区2区3区| 日韩av电影免费观看高清完整版在线观看 | 日本成人在线电影网| 亚洲一区二区成人在线观看| 亚洲欧美日韩中文字幕一区二区三区 | 精品粉嫩aⅴ一区二区三区四区| 欧美日韩激情一区二区| 欧美日韩免费一区二区三区 | 欧美经典一区二区| 久久美女艺术照精彩视频福利播放| 欧美一区二区播放| 制服丝袜国产精品| 欧美一区二区三区免费在线看| 欧美日韩大陆一区二区| 欧美人狂配大交3d怪物一区| 欧美区在线观看| 欧美一二三四区在线| 欧美一级片免费看| 精品少妇一区二区三区 | 亚洲欧美在线视频观看| 日韩久久一区二区| 一区二区三区日韩在线观看| 一卡二卡三卡日韩欧美| 视频一区二区三区入口| 美女任你摸久久| 福利一区二区在线观看| 日本韩国精品一区二区在线观看| 欧美性感一类影片在线播放| 7777精品伊人久久久大香线蕉超级流畅 | 成人黄色在线网站| 色婷婷久久99综合精品jk白丝| 欧美亚洲国产bt| 91.com在线观看| 精品粉嫩超白一线天av| 亚洲欧美在线视频观看| 亚洲国产裸拍裸体视频在线观看乱了 | 国产精品伦理在线| 亚洲精品伦理在线| 日韩中文字幕麻豆| 国产98色在线|日韩| 色综合av在线| 日韩精品一区二区三区在线| 国产三级三级三级精品8ⅰ区| 亚洲欧美日韩电影| 蜜桃av一区二区| 成人午夜在线免费| 欧美猛男超大videosgay| 精品久久久久一区| 亚洲女同ⅹxx女同tv| 日本视频一区二区三区| 成人黄色电影在线| 91精品国产综合久久久蜜臀图片| 久久久亚洲精品石原莉奈| 一区二区三区免费| 国产精品亚洲第一| 欧美卡1卡2卡| 国产精品无码永久免费888| 亚洲18色成人| 成人福利电影精品一区二区在线观看| 欧美这里有精品| 国产欧美日本一区二区三区| 亚洲图片有声小说| 国产不卡免费视频| 欧美一区二区在线观看| 自拍偷拍亚洲综合| 紧缚捆绑精品一区二区| 欧美亚洲一区二区在线| 日本一区二区成人| 精品在线观看免费| 欧美美女bb生活片| 亚洲乱码国产乱码精品精98午夜 | 久久精品72免费观看| 91在线看国产| 国产亚洲精久久久久久| 秋霞午夜av一区二区三区| 91浏览器打开| 国产欧美日韩精品一区| 精品中文字幕一区二区| 欧美三级中文字幕在线观看| 国产精品久久久久久久久免费桃花| 日本vs亚洲vs韩国一区三区 | 精品欧美一区二区三区精品久久 | 亚洲欧洲精品成人久久奇米网| 久草热8精品视频在线观看| 欧美三级韩国三级日本一级| 亚洲视频一二三区| 成人国产精品免费网站| 久久免费精品国产久精品久久久久| 日韩国产一区二| 欧美伦理电影网| 亚洲国产精品尤物yw在线观看| 97国产精品videossex| 国产欧美精品一区| 国产在线不卡视频| 337p日本欧洲亚洲大胆色噜噜| 青青草成人在线观看| 91麻豆精品国产91久久久久久久久| 一区二区三区影院| 色成人在线视频| 亚洲视频在线观看一区| 91免费国产在线| 自拍偷拍亚洲激情| 99re这里只有精品首页| 最新国产精品久久精品| 99国产欧美另类久久久精品| 亚洲欧美在线高清| 色婷婷综合在线| 亚洲一级在线观看| 欧美日韩中文字幕一区二区| 亚洲一区二区三区四区在线观看| 欧美自拍偷拍午夜视频| 亚洲午夜私人影院| 欧美一区二区三区视频在线| 麻豆91在线观看| 久久久国产精华| av动漫一区二区| 亚洲欧美一区二区三区国产精品 | 亚洲国产乱码最新视频 | 精品成人一区二区| 国产成人一区二区精品非洲| 欧美国产激情一区二区三区蜜月| 成人精品免费视频| 亚洲欧美日韩一区二区三区在线观看| 在线亚洲高清视频| 日本成人中文字幕| 久久久久久久久久久黄色| 成人亚洲一区二区一| **性色生活片久久毛片| 欧美日韩亚洲综合一区二区三区| 日本免费新一区视频| 国产女同互慰高潮91漫画| 色天天综合久久久久综合片| 亚洲第一主播视频| 久久综合久久鬼色中文字| 91在线你懂得| 日本亚洲欧美天堂免费| 国产午夜精品一区二区| 91蝌蚪porny| 久久99精品国产麻豆不卡| 中文字幕精品—区二区四季| 欧美图区在线视频| 国产毛片精品国产一区二区三区| 中文字幕人成不卡一区| 制服丝袜中文字幕亚洲| 懂色av一区二区三区免费观看| 一区二区欧美国产| 久久综合精品国产一区二区三区| 99天天综合性| 毛片av一区二区| 亚洲私人影院在线观看| 日韩亚洲电影在线| 91网上在线视频| 激情小说亚洲一区| 一区二区国产视频| 国产色产综合色产在线视频 | 精品国产电影一区二区| av电影天堂一区二区在线| 天天操天天色综合| 国产精品久久久久久久午夜片 | 久久欧美中文字幕| 欧美群妇大交群中文字幕| www.日韩av| 久久精品久久精品| 亚洲最大的成人av| 日本一区二区成人在线| 日韩一级精品视频在线观看| 99久久精品免费看国产| 国产一区不卡在线| 日韩成人一区二区| 亚洲黄一区二区三区| 国产三级精品三级| 日韩免费观看高清完整版|