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

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

?? history.c

?? Linux下的MUD客戶端程序
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* History.c -- standalone history library *//* Copyright (C) 1989, 1992 Free Software Foundation, Inc.   This file contains the GNU History Library (the Library), a set of   routines for managing the text of previously typed lines.   The Library 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 1, or (at your option)   any later version.   The Library 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.   The GNU General Public License is often shipped with GNU software, and   is generally kept in a file called COPYING or LICENSE.  If you do not   have a copy of the license, write to the Free Software Foundation,   675 Mass Ave, Cambridge, MA 02139, USA. *//* The goal is to make the implementation transparent, so that you   don't have to know what data types are used, just what functions   you can call.  I think I have done that. */#define READLINE_LIBRARY#if defined (HAVE_CONFIG_H)#  include "config.h"#endif#include <stdio.h>#include <sys/types.h>#include <sys/file.h>#include <sys/stat.h>#include <fcntl.h>#if defined (HAVE_STDLIB_H)#  include <stdlib.h>#else#  include "ansi_stdlib.h"#endif /* HAVE_STDLIB_H */#if defined (HAVE_UNISTD_H)#  include <unistd.h>#endif#if defined (HAVE_STRING_H)#  include <string.h>#else#  include <strings.h>#endif /* !HAVE_STRING_H */#include <errno.h>/* Not all systems declare ERRNO in errno.h... and some systems #define it! */#if !defined (errno)extern int errno;#endif /* !errno */#include "memalloc.h"#include "history.h"#if defined (STATIC_MALLOC)static char *xmalloc (), *xrealloc ();#elseextern char *xmalloc (), *xrealloc ();#endif /* STATIC_MALLOC */#define STREQ(a, b)	(((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))#define STREQN(a, b, n)	(((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))#ifndef savestring#  ifndef strcpyextern char *strcpy ();#  endif#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))#endif#ifndef whitespace#define whitespace(c) (((c) == ' ') || ((c) == '\t'))#endif#ifndef digit_p#define digit_p(c)  ((c) >= '0' && (c) <= '9')#endif#ifndef digit_value#define digit_value(c) ((c) - '0')#endif#ifndef member#  ifndef strchrextern char *strchr ();#  endif#define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0)#endif/* Possible history errors passed to hist_error. */#define EVENT_NOT_FOUND 0#define BAD_WORD_SPEC	1#define SUBST_FAILED	2#define BAD_MODIFIER	3static char error_pointer;static char *subst_lhs;static char *subst_rhs;static int subst_lhs_len = 0;static int subst_rhs_len = 0;static char *get_history_word_specifier ();#if defined (SHELL)extern char *single_quote ();#endif/* **************************************************************** *//*								    *//*			History Functions			    *//*								    *//* **************************************************************** *//* An array of HIST_ENTRY.  This is where we store the history. */static HIST_ENTRY **the_history = (HIST_ENTRY **)NULL;/* Non-zero means that we have enforced a limit on the amount of   history that we save. */static int history_stifled = 0;/* If HISTORY_STIFLED is non-zero, then this is the maximum number of   entries to remember. */int max_input_history;/* The current location of the interactive history pointer.  Just makes   life easier for outside callers. */static int history_offset = 0;/* The number of strings currently stored in the input_history list. */int history_length = 0;/* The current number of slots allocated to the input_history. */static int history_size = 0;/* The number of slots to increase the_history by. */#define DEFAULT_HISTORY_GROW_SIZE 50/* The character that represents the start of a history expansion   request.  This is usually `!'. */char history_expansion_char = '!';/* The character that invokes word substitution if found at the start of   a line.  This is usually `^'. */char history_subst_char = '^';/* During tokenization, if this character is seen as the first character   of a word, then it, and all subsequent characters upto a newline are   ignored.  For a Bourne shell, this should be '#'.  Bash special cases   the interactive comment character to not be a comment delimiter. */char history_comment_char = '\0';/* The list of characters which inhibit the expansion of text if found   immediately following history_expansion_char. */char *history_no_expand_chars = " \t\n\r=";/* The logical `base' of the history array.  It defaults to 1. */int history_base = 1;/* Return the current HISTORY_STATE of the history. */HISTORY_STATE *history_get_history_state (){  HISTORY_STATE *state;  state = (HISTORY_STATE *)xmalloc (sizeof (HISTORY_STATE));  state->entries = the_history;  state->offset = history_offset;  state->length = history_length;  state->size = history_size;  state->flags = 0;  if (history_stifled)    state->flags |= HS_STIFLED;  return (state);}/* Set the state of the current history array to STATE. */voidhistory_set_history_state (state)     HISTORY_STATE *state;{  the_history = state->entries;  history_offset = state->offset;  history_length = state->length;  history_size = state->size;  if (state->flags & HS_STIFLED)    history_stifled = 1;}/* Begin a session in which the history functions might be used.  This   initializes interactive variables. */voidusing_history (){  history_offset = history_length;}/* Return the number of bytes that the primary history entries are using.   This just adds up the lengths of the_history->lines. */inthistory_total_bytes (){  register int i, result;  result = 0;  for (i = 0; the_history && the_history[i]; i++)    result += strlen (the_history[i]->line);  return (result);}/* Place STRING at the end of the history list.  The data field   is  set to NULL. */voidadd_history (string)     char *string;{  HIST_ENTRY *temp;  if (history_stifled && (history_length == max_input_history))    {      register int i;      /* If the history is stifled, and history_length is zero,	 and it equals max_input_history, we don't save items. */      if (history_length == 0)	return;      /* If there is something in the slot, then remove it. */      if (the_history[0])	{	  free (the_history[0]->line);	  free (the_history[0]);	}      /* Copy the rest of the entries, moving down one slot. */      for (i = 0; i < history_length; i++)	the_history[i] = the_history[i + 1];      history_base++;    }  else    {      if (!history_size)	{	  history_size = DEFAULT_HISTORY_GROW_SIZE;	  the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));	  history_length = 1;	}      else	{	  if (history_length == (history_size - 1))	    {	      history_size += DEFAULT_HISTORY_GROW_SIZE;	      the_history = (HIST_ENTRY **)		xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));	    }	  history_length++;	}    }  temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));  temp->line = savestring (string);  temp->data = (char *)NULL;  the_history[history_length] = (HIST_ENTRY *)NULL;  the_history[history_length - 1] = temp;}/* Make the history entry at WHICH have LINE and DATA.  This returns   the old entry so you can dispose of the data.  In the case of an   invalid WHICH, a NULL pointer is returned. */HIST_ENTRY *replace_history_entry (which, line, data)     int which;     char *line;     char *data;{  HIST_ENTRY *temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));  HIST_ENTRY *old_value;  if (which >= history_length)    return ((HIST_ENTRY *)NULL);  old_value = the_history[which];  temp->line = savestring (line);  temp->data = data;  the_history[which] = temp;  return (old_value);}/* Returns the magic number which says what history element we are   looking at now.  In this implementation, it returns history_offset. */intwhere_history (){  return (history_offset);}/* Search the history for STRING, starting at history_offset.   If DIRECTION < 0, then the search is through previous entries, else   through subsequent.  If ANCHORED is non-zero, the string must   appear at the beginning of a history line, otherwise, the string   may appear anywhere in the line.  If the string is found, then   current_history () is the history entry, and the value of this   function is the offset in the line of that history entry that the   string was found in.  Otherwise, nothing is changed, and a -1 is   returned. */#define ANCHORED_SEARCH 1#define NON_ANCHORED_SEARCH 0static inthistory_search_internal (string, direction, anchored)     char *string;     int direction, anchored;{  register int i, reverse;  register char *line;  register int line_index;  int string_len;  i = history_offset;  reverse = (direction < 0);  /* Take care of trivial cases first. */  if (!history_length || ((i == history_length) && !reverse))    return (-1);  if (reverse && (i == history_length))    i--;#define NEXT_LINE() do { if (reverse) i--; else i++; } while (0)  string_len = strlen (string);  while (1)    {      /* Search each line in the history list for STRING. */      /* At limit for direction? */      if ((reverse && i < 0) || (!reverse && i == history_length))	return (-1);      line = the_history[i]->line;      line_index = strlen (line);      /* If STRING is longer than line, no match. */      if (string_len > line_index)	{	  NEXT_LINE ();	  continue;	}      /* Handle anchored searches first. */      if (anchored == ANCHORED_SEARCH)	{	  if (STREQN (string, line, string_len))	    {	      history_offset = i;	      return (0);	    }	  NEXT_LINE ();	  continue;	}      /* Do substring search. */      if (reverse)	{	  line_index -= string_len;	  while (line_index >= 0)	    {	      if (STREQN (string, line + line_index, string_len))		{		  history_offset = i;		  return (line_index);		}	      line_index--;	    }	}      else	{	  register int limit = line_index - string_len + 1;	  line_index = 0;	  while (line_index < limit)	    {	      if (STREQN (string, line + line_index, string_len))		{		  history_offset = i;		  return (line_index);		}	      line_index++;	    }	}      NEXT_LINE ();    }}/* Do a non-anchored search for STRING through the history in DIRECTION. */inthistory_search (string, direction)     char *string;     int direction;{  return (history_search_internal (string, direction, NON_ANCHORED_SEARCH));}/* Do an anchored search for string through the history in DIRECTION. */inthistory_search_prefix (string, direction)     char *string;     int direction;{  return (history_search_internal (string, direction, ANCHORED_SEARCH));}/* Remove history element WHICH from the history.  The removed   element is returned to you so you can free the line, data,   and containing structure. */HIST_ENTRY *remove_history (which)     int which;{  HIST_ENTRY *return_value;  if (which >= history_length || !history_length)    return_value = (HIST_ENTRY *)NULL;  else    {      register int i;      return_value = the_history[which];      for (i = which; i < history_length; i++)	the_history[i] = the_history[i + 1];      history_length--;    }  return (return_value);}/* Stifle the history list, remembering only MAX number of lines. */voidstifle_history (max)     int max;{  if (max < 0)    max = 0;  if (history_length > max)    {      register int i, j;      /* This loses because we cannot free the data. */      for (i = 0; i < (history_length - max); i++)	{	  free (the_history[i]->line);	  free (the_history[i]);	}      history_base = i;      for (j = 0, i = history_length - max; j < max; i++, j++)	the_history[j] = the_history[i];      the_history[j] = (HIST_ENTRY *)NULL;      history_length = j;    }  history_stifled = 1;  max_input_history = max;}/* Stop stifling the history.  This returns the previous amount the history was stifled by.  The value is positive if the history was stifled, negative if it wasn't. */intunstifle_history (){  int result = max_input_history;  if (history_stifled)    {      result = -result;      history_stifled = 0;    }  return (result);}inthistory_is_stifled (){  return (history_stifled);}/* Return the string that should be used in the place of this   filename.  This only matters when you don't specify the   filename to read_history (), or write_history (). */static char *history_filename (filename)     char *filename;{  char *return_val = filename ? savestring (filename) : (char *)NULL;  if (!return_val)    {      char *home;      int home_len;      home = getenv ("HOME");      if (!home)	home = ".";      home_len = strlen (home);      /* strlen(".history") == 8 */      return_val = xmalloc (2 + home_len + 8);      strcpy (return_val, home);      return_val[home_len] = '/';      strcpy (return_val + home_len + 1, ".history");    }  return (return_val);}/* Add the contents of FILENAME to the history list, a line at a time.   If FILENAME is NULL, then read from ~/.history.  Returns 0 if   successful, or errno if not. */int

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美一级二级| 亚洲精品国产精品乱码不99| 中文字幕免费不卡| 亚洲午夜免费电影| 国产+成+人+亚洲欧洲自线| 91色在线porny| 久久人人97超碰com| 午夜影视日本亚洲欧洲精品| 成人自拍视频在线观看| 欧美一级久久久| 一区二区三区四区精品在线视频 | 欧美高清激情brazzers| 久久精品亚洲乱码伦伦中文| 亚洲一区二区综合| gogogo免费视频观看亚洲一| 日韩欧美国产系列| 天天综合天天做天天综合| 波多野结衣精品在线| 久久美女艺术照精彩视频福利播放| 亚洲午夜免费福利视频| 在线中文字幕不卡| 成人免费在线视频| 国产99久久久精品| 国产日韩欧美亚洲| 国内不卡的二区三区中文字幕 | 欧美人xxxx| 亚洲午夜精品网| 欧洲中文字幕精品| 亚洲精品国产一区二区精华液| 成人综合激情网| 国产亚洲精品精华液| 国产老女人精品毛片久久| 日韩欧美一区二区免费| 日本不卡免费在线视频| 91精品国产乱| 麻豆成人av在线| 欧美电影免费观看高清完整版在线| 亚洲一区二区美女| 欧美视频一区在线| 五月婷婷久久综合| 在线电影院国产精品| 日韩在线播放一区二区| 欧美久久久影院| 秋霞av亚洲一区二区三| 日韩三级伦理片妻子的秘密按摩| 三级精品在线观看| 日韩三级电影网址| 国产成人午夜精品5599| 国产情人综合久久777777| 粉嫩13p一区二区三区| 国产精品精品国产色婷婷| 色呦呦国产精品| 亚洲韩国一区二区三区| 777xxx欧美| 韩国精品免费视频| 国产亲近乱来精品视频| 99精品国产一区二区三区不卡| 亚洲精选视频在线| 在线成人av影院| 国产乱子伦一区二区三区国色天香| 国产日韩欧美亚洲| 91国偷自产一区二区使用方法| 午夜精品福利久久久| 精品国产一区二区三区久久影院| 国产宾馆实践打屁股91| 亚洲免费观看视频| 日韩欧美亚洲另类制服综合在线| 国产精品综合久久| 亚洲乱码中文字幕| 日韩三级免费观看| 99精品国产热久久91蜜凸| 日本少妇一区二区| 国产精品丝袜黑色高跟| 欧美日韩国产综合久久| 国产成人久久精品77777最新版本| 亚洲精品精品亚洲| 久久久久久亚洲综合| 在线观看三级视频欧美| 国产精品一级黄| 五月婷婷综合在线| 国产精品麻豆欧美日韩ww| 4438x成人网最大色成网站| 国产1区2区3区精品美女| 日韩精品免费专区| 亚洲少妇最新在线视频| 久久综合色婷婷| 欧美午夜免费电影| 成人在线一区二区三区| 日韩国产精品久久| 亚洲精品日韩专区silk| 国产亚洲一区二区在线观看| 欧美精品粉嫩高潮一区二区| 成人激情av网| 久久精品国产亚洲5555| 亚洲一区二区在线观看视频| 国产精品久久久久久久久免费樱桃| 欧美一区二区三区思思人| 色综合中文字幕国产 | 亚洲永久免费av| 国产午夜精品一区二区三区四区| 欧美日韩成人综合在线一区二区| 99久久er热在这里只有精品15| 激情综合色播激情啊| 日韩精品欧美精品| 午夜精品一区在线观看| 亚洲欧洲综合另类在线| 国产午夜亚洲精品理论片色戒 | 天天av天天翘天天综合网| 亚洲欧美色图小说| 国产精品欧美经典| 国产欧美一区二区精品久导航| 精品嫩草影院久久| 欧美岛国在线观看| 精品日韩一区二区三区免费视频| 7777精品伊人久久久大香线蕉最新版 | 国产一区在线观看麻豆| 麻豆国产一区二区| 日韩中文字幕不卡| 免费久久99精品国产| 日本中文一区二区三区| 天堂成人免费av电影一区| 午夜国产精品影院在线观看| 亚洲国产日产av| 天堂午夜影视日韩欧美一区二区| 午夜精品视频在线观看| 日韩成人精品视频| 久久国产婷婷国产香蕉| 国产一区二区主播在线| 国产91清纯白嫩初高中在线观看| 国产精品1区2区3区在线观看| 懂色av一区二区三区免费观看| 国产1区2区3区精品美女| 99久久久国产精品| 精品视频在线看| 欧美视频第二页| 欧美日韩第一区日日骚| 欧美成人欧美edvon| 国产人成一区二区三区影院| 日韩精品一区二区三区在线播放 | 日本精品视频一区二区| 欧美综合天天夜夜久久| 欧美日韩免费观看一区三区| 日韩一区二区三区观看| 久久色在线视频| 亚洲欧美日韩一区二区| 日韩不卡一二三区| 国产成人在线视频网址| 色婷婷综合久久久中文字幕| 91精品欧美福利在线观看| 久久久一区二区三区| 亚洲丝袜制服诱惑| 免费高清不卡av| 成人在线视频一区| 欧美老女人在线| 亚洲国产精品成人综合色在线婷婷| 一区二区激情小说| 极品美女销魂一区二区三区免费| 波多野结衣在线一区| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 制服.丝袜.亚洲.另类.中文| 国产欧美一区在线| 午夜不卡在线视频| 高清国产一区二区| 91精品国产麻豆国产自产在线| 国产精品国产三级国产普通话三级 | 在线视频你懂得一区二区三区| 欧美一区三区四区| 国产精品成人一区二区三区夜夜夜 | 中文字幕一区二区三区在线观看| 亚洲福利一二三区| 成人美女视频在线看| 欧美一区二区三区视频在线 | 久久久久久免费网| 天天综合网天天综合色| 91麻豆精东视频| 久久久久久久精| 日韩精品一卡二卡三卡四卡无卡| av一区二区不卡| 久久久美女毛片| 日本美女视频一区二区| 色噜噜狠狠成人网p站| 亚洲国产精品成人综合色在线婷婷 | 欧美系列亚洲系列| 欧美国产视频在线| 国产综合色精品一区二区三区| 欧美亚洲国产一区二区三区| 国产精品三级av| 国产91精品久久久久久久网曝门| 欧美一区二区三区日韩视频| 亚洲一区在线播放| 在线观看日产精品| 亚洲欧美精品午睡沙发| 成人黄色a**站在线观看| 26uuu精品一区二区| 免费高清不卡av| 日韩视频中午一区| 免费精品99久久国产综合精品| 6080午夜不卡| 日韩av不卡在线观看| 欧美一级日韩不卡播放免费|