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

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

?? history.c

?? BCAST Implementation for NS2
?? C
?? 第 1 頁 / 共 4 頁
字號:
 *  dim     size_t    The allocated dimensions of the line buffer. * Output: *  return    char *  The line requested, or NULL if no matching line *                    was found. */char *_glh_find_forwards(GlHistory *glh, char *line, size_t dim){  GlLineNode *node; /* The line location node being checked *//* * Check the arguments. */  if(!glh || !line) {    fprintf(stderr, "_glh_find_forwards: NULL argument(s).\n");    return NULL;  };/* * Is history enabled? */  if(!glh->enable || !glh->buffer || glh->max_lines == 0)    return NULL;/* * Check the line dimensions. */  if(dim < strlen(line) + 1) {    fprintf(stderr,       "_glh_find_forwards: 'dim' inconsistent with strlen(line) contents.\n");    return NULL;  };/* * From where should we start the search? */  if(glh->recall)    node = glh->recall->next;  else    return NULL;/* * If there is no search prefix, the prefix last set by glh_search_prefix() * doesn't exist in the history buffer. */  if(!glh->prefix)    return NULL;/* * Search forwards through the list for the first match with the * prefix string. */  for( ; node &&      (node->group != glh->group ||       strncmp(glh->buffer + node->start, glh->prefix, glh->prefix_len) != 0);      node = node->next)    ;/* * Was a matching line found? */  if(node) {/* * Did we hit the line that was originally being edited when the * current history traversal started? */    if(node == glh->list.tail)      return _glh_restore_line(glh, line, dim);/* * Copy the matching line into the provided line buffer. */    strncpy(line, glh->buffer + node->start, dim);    line[dim-1] = '\0';/* * Record the starting point of the next search. */    glh->recall = node;/* * Return the matching line to the user. */    return line;  };/* * No match was found. */  return NULL;}/*....................................................................... * If a search is in progress, cancel it. * * This involves discarding the line that was temporarily saved by * _glh_find_backwards() when the search was originally started, * and reseting the search iteration pointer to NULL. * * Input: *  glh  GlHistory *  The input-line history maintenance object. * Output: *  return     int    0 - OK. *                    1 - Error. */int _glh_cancel_search(GlHistory *glh){/* * Check the arguments. */  if(!glh) {    fprintf(stderr, "_glh_cancel_search: NULL argument(s).\n");    return 1;  };/* * If there wasn't a search in progress, do nothing. */  if(!glh->recall)    return 0;/* * Delete the node of the preserved line. */  _glh_discard_node(glh, glh->list.tail);/* * Reset the search pointers. */  glh->recall = NULL;  glh->prefix = "";  glh->prefix_len = 0;  return 0;}/*....................................................................... * Set the prefix of subsequent history searches. * * Input: *  glh  GlHistory *  The input-line history maintenance object. *  line      char *  The command line who's prefix is to be used. *  prefix_len int    The length of the prefix. * Output: *  return     int    0 - OK. *                    1 - Error. */int _glh_search_prefix(GlHistory *glh, const char *line, int prefix_len){  GlLineNode *node; /* The line location node being checked *//* * Check the arguments. */  if(!glh) {    fprintf(stderr, "_glh_search_prefix: NULL argument(s).\n");    return 1;  };/* * Is history enabled? */  if(!glh->enable || !glh->buffer || glh->max_lines == 0)    return 0;/* * Record a zero length search prefix? */  if(prefix_len <= 0) {    glh->prefix_len = 0;    glh->prefix = "";    return 0;  };/* * Record the length of the new search prefix. */  glh->prefix_len = prefix_len;/* * If any history line starts with the specified prefix, record a * pointer to it for comparison in subsequent searches. If the prefix * doesn't match any of the lines, then simply record NULL to indicate * that there is no point in searching. Note that _glh_add_history() * clears this pointer by calling _glh_cancel_search(), so there is * no danger of it being used after the buffer has been modified. */  for(node = glh->list.tail ; node &&      (node->group != glh->group ||       strncmp(glh->buffer + node->start, line, prefix_len) != 0);      node = node->prev)    ;/* * If a matching line was found record it for use as the search * prefix. */  glh->prefix = node ? glh->buffer + node->start : NULL;  return 0;}/*....................................................................... * Recall the oldest recorded line. * * Input: *  glh  GlHistory *  The input-line history maintenance object. *  line      char *  The input line buffer. On input this should contain *                    the current input line, and on output, its contents *                    will have been replaced with the oldest line. *  dim     size_t    The allocated dimensions of the line buffer. * Output: *  return    char *  A pointer to line[0], or NULL if not found. */char *_glh_oldest_line(GlHistory *glh, char *line, size_t dim){  GlLineNode *node; /* The line location node being checked */  int first;        /* True if this is the start of a new search *//* * Check the arguments. */  if(!glh || !line) {    fprintf(stderr, "_glh_oldest_line: NULL argument(s).\n");    return NULL;  };/* * Is history enabled? */  if(!glh->enable || !glh->buffer || glh->max_lines == 0)    return NULL;/* * Check the line dimensions. */  if(dim < strlen(line) + 1) {    fprintf(stderr,       "_glh_oldest_line: 'dim' inconsistent with strlen(line) contents.\n");    return NULL;  };/* * Is this the start of a new search? */  first = glh->recall==NULL;/* * If this is the first search backwards, save the current line * for potential recall later, and mark it as the last line * recalled. */  if(first) {    if(_glh_add_history(glh, line, 1))      return NULL;    glh->recall = glh->list.tail;  };/* * Locate the oldest line that belongs to the current group. */  for(node=glh->list.head; node && node->group != glh->group;       node = node->next)    ;/* * No line found? */  if(!node)    return NULL;/* * Record the above node as the starting point for subsequent * searches. */  glh->recall = node;/* * Copy the recalled line into the provided line buffer. */  strncpy(line, glh->buffer + node->start, dim);  line[dim-1] = '\0';  return line;}/*....................................................................... * Recall the line that was being entered when the search started. * * Input: *  glh  GlHistory *  The input-line history maintenance object. *  line      char *  The input line buffer. On input this should contain *                    the current input line, and on output, its contents *                    will have been replaced with the line that was *                    being entered when the search was started. *  dim     size_t    The allocated dimensions of the line buffer. * Output: *  return    char *  A pointer to line[0], or NULL if not found. */char *_glh_current_line(GlHistory *glh, char *line, size_t dim){/* * Check the arguments. */  if(!glh || !line) {    fprintf(stderr, "_glh_current_line: NULL argument(s).\n");    return NULL;  };/* * Is history enabled? */  if(!glh->enable || !glh->buffer || glh->max_lines == 0)    return NULL;/* * Check the line dimensions. */  if(dim < strlen(line) + 1) {    fprintf(stderr,       "_glh_current_line: 'dim' inconsistent with strlen(line) contents.\n");    return NULL;  };/* * Restore the original line. */  return _glh_restore_line(glh, line, dim);}/*....................................................................... * Remove the line that was originally being edited when the history * traversal was started, from its saved position in the history list, * and place it in the provided line buffer. * * Input: *  glh  GlHistory *  The input-line history maintenance object. *  line      char *  The input line buffer. On input this should contain *                    the current input line, and on output, its contents *                    will have been replaced with the saved line. *  dim     size_t    The allocated dimensions of the line buffer. * Output: *  return    char *  A pointer to line[0], or NULL if not found. */static char *_glh_restore_line(GlHistory *glh, char *line, size_t dim){  GlLineNode *tail;   /* The tail node to be discarded *//* * If there wasn't a search in progress, do nothing. */  if(!glh->recall)    return NULL;/* * Get the list node that is to be removed. */  tail = glh->list.tail;/* * If a pointer to the saved line is being used to record the * current search prefix, reestablish the search prefix, to * have it recorded by another history line if possible. */  if(glh->prefix == glh->buffer + tail->start)    (void) _glh_search_prefix(glh, glh->buffer + tail->start, glh->prefix_len);/* * Copy the recalled line into the input-line buffer. */  strncpy(line, glh->buffer + tail->start, dim);  line[dim-1] = '\0';/* * Discard the line-location node. */  _glh_discard_node(glh, tail);/* * Mark the search as ended. */  glh->recall = NULL;  return line;}/*....................................................................... * Query the id of a history line offset by a given number of lines from * the one that is currently being recalled. If a recall session isn't * in progress, or the offset points outside the history list, 0 is * returned. * * Input: *  glh    GlHistory *  The input-line history maintenance object. *  offset       int    The line offset (0 for the current line, < 0 *                      for an older line, > 0 for a newer line. * Output: *  return GlhLineID    The identifier of the line that is currently *                      being recalled, or 0 if no recall session is *                      currently in progress. */GlhLineID _glh_line_id(GlHistory *glh, int offset){  GlLineNode *node; /* The line location node being checked *//* * Is history enabled? */  if(!glh->enable || !glh->buffer || glh->max_lines == 0)    return 0;/* * Search forward 'offset' lines to find the required line. */  if(offset >= 0) {    for(node=glh->recall; node && offset != 0; node=node->next) {      if(node->group == glh->group)	offset--;    };  } else {    for(node=glh->recall; node && offset != 0; node=node->prev) {      if(node->group == glh->group)	offset++;    };  };  return node ? node->id : 0;}/*....................................................................... * Recall a line by its history buffer ID. If the line is no longer * in the buffer, or the id is zero, NULL is returned. * * Input: *  glh  GlHistory *  The input-line history maintenance object. *  id   GlhLineID    The ID of the line to be returned. *  line      char *  The input line buffer. On input this should contain *                    the current input line, and on output, its contents *                    will have been replaced with the saved line. *  dim     size_t    The allocated dimensions of the line buffer. * Output: *  return    char *  A pointer to line[0], or NULL if not found. */char *_glh_recall_line(GlHistory *glh, GlhLineID id, char *line, size_t dim){  GlLineNode *node; /* The line location node being checked *//* * Is history enabled? */  if(!glh->enable || !glh->buffer || glh->max_lines == 0)    return NULL;/* * If we are starting a new recall session, save the current line * for potential recall later. */  if(!glh->recall && _glh_add_history(glh, line, 1))    return NULL;/* * Search for the specified line. */  node = _glh_find_id(glh, id);/* * Not found? */  if(!node || node->group != glh->group)    return NULL;/* * Record the node of the matching line as the starting point * for subsequent searches. */  glh->recall = node;/* * Copy the recalled line into the provided line buffer. */  strncpy(line, glh->buffer + node->start, dim);  line[dim-1] = '\0';  return line;}/*....................................................................... * Save the current history in a specified file. * * Input: *  glh        GlHistory *  The input-line history maintenance object. *  filename  const char *  The name of the new file to record the *                          history in. *  comment   const char *  Extra information such as timestamps will *                          be recorded on a line started with this *                          string, the idea being that the file can *                          double as a command file. Specify "" if *                          you don't care. *  max_lines        int    The maximum number of lines to save, or -1 *                          to save all of the lines in the history *                          list. * Output: *  return           int    0 - OK. *                          1 - Error. */int _glh_save_history(GlHistory *glh, const char *filename, const char *comment,		      int max_lines){  FILE *fp;         /* The output file */  GlLineNode *node; /* The line being saved */  GlLineNode *head; /* The head of the list of lines to be saved *//* * Check the arguments. */  if(!glh || !filename || !comment) {    fprintf(stderr, "_glh_save_history: NULL argument(s).\n");    return 1;  };/* * Attempt to open the specified file. */  fp = fopen(filename, "w");  if(!fp) {    fprintf(stderr, "_glh_save_history: Can't open %s (%s).\n",	    filename, strerror(errno));    return 1;  };/* * If a ceiling on the number of lines to save was specified, count * that number of lines backwards, to find the first line to be saved. */  head = NULL;  if(max_lines >= 0) {    for(head=glh->list.tail; head && --max_lines > 0; head=head->prev)      ;  };  if(!head)    head = glh->list.head;/* * Write the contents of the history buffer to the history file, writing * associated data such as timestamps, to a line starting with the * specified comment string. */  for(node=head; node; node=node->next) {/* * Write peripheral information associated with the line, as a comment. */    if(fprintf(fp, "%s ", comment) < 0 ||       _glh_write_timestamp(fp, node->timestamp) ||       fprintf(fp, " %u\n", node->group) < 0) {      fprintf(stderr, "Error writing %s (%s).\n", filename, strerror(errno));      (void) fclose(fp);      return 1;    };

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一区中文字幕| 日韩午夜激情视频| 亚洲精选一二三| av在线不卡观看免费观看| 国产精品色眯眯| 99久久国产综合精品麻豆| 夜夜嗨av一区二区三区| 91福利资源站| 青青草97国产精品免费观看 | 美女一区二区三区在线观看| 日韩一区二区三区精品视频| 免费av成人在线| 久久久久国产精品厨房| 波多野结衣的一区二区三区| 亚洲国产精品尤物yw在线观看| 91精品一区二区三区久久久久久 | 久久久亚洲高清| 成人v精品蜜桃久久一区| 亚洲精品va在线观看| 日韩一二在线观看| 成人精品视频一区二区三区| 亚洲精品美国一| 欧美va天堂va视频va在线| av中文字幕亚洲| 免费美女久久99| 亚洲欧洲99久久| 欧美电视剧在线看免费| 95精品视频在线| 精品一二三四在线| 亚洲美女视频一区| 精品国产乱子伦一区| 在线国产电影不卡| 国产精品一卡二卡| 日韩成人一级片| 国产精品热久久久久夜色精品三区 | 另类成人小视频在线| 国产精品久久影院| 日韩三级高清在线| 在线观看91视频| 国产91精品久久久久久久网曝门| 亚洲亚洲精品在线观看| 欧美国产精品中文字幕| 欧美一区二区啪啪| 91久久精品国产91性色tv| 国产精品资源站在线| 日本亚洲最大的色成网站www| 国产精品久久久久一区二区三区| 欧美xxxx在线观看| 欧美高清视频不卡网| 91美女视频网站| 国产91精品久久久久久久网曝门| 蜜桃在线一区二区三区| 亚洲第一会所有码转帖| 亚洲三级理论片| 国产欧美综合在线观看第十页 | 亚洲精品一区二区在线观看| 欧美色涩在线第一页| 97精品国产97久久久久久久久久久久| 欧美96一区二区免费视频| 亚洲午夜av在线| 亚洲三级免费电影| 国产精品成人免费| 国产精品乱码一区二三区小蝌蚪| 久久蜜桃香蕉精品一区二区三区| 日韩色在线观看| 日韩视频在线你懂得| 欧美剧情片在线观看| 欧美日韩欧美一区二区| 欧美亚洲综合久久| 在线精品亚洲一区二区不卡| 色综合久久久久网| 色域天天综合网| 在线一区二区三区四区五区 | 日本一区二区动态图| 久久久蜜桃精品| 久久午夜电影网| 国产亚洲成年网址在线观看| 久久一区二区三区国产精品| 亚洲精品一区二区三区99| 精品国产一区二区三区忘忧草| 日韩一级黄色片| 欧美成人综合网站| 久久久亚洲精品石原莉奈| 国产拍欧美日韩视频二区| 国产精品传媒入口麻豆| 日韩伦理av电影| 亚洲午夜精品在线| 日韩av中文字幕一区二区 | 亚洲一区二区视频| 亚洲国产成人av好男人在线观看| 午夜不卡av在线| 麻豆国产欧美一区二区三区| 国产精品影视网| 99久久99久久综合| 精品视频在线免费看| 91精品国产一区二区三区蜜臀| 精品三级av在线| 国产精品免费免费| 午夜欧美视频在线观看| 久久精品国产一区二区| 国产99精品视频| 欧美性猛交xxxxxxxx| 精品国产一区二区三区久久久蜜月 | 日韩亚洲欧美成人一区| 久久久久久久久久久电影| 亚洲欧美日韩久久| 日本不卡视频在线| 成人网在线免费视频| 在线一区二区三区| 精品久久免费看| 亚洲色图在线看| 日本aⅴ亚洲精品中文乱码| 国产裸体歌舞团一区二区| 欧美日韩在线播放一区| 欧美一区二区三区在线电影 | 精品国产伦一区二区三区观看体验| 亚洲国产成人在线| 丝袜美腿一区二区三区| 成人综合日日夜夜| 欧美一区二区视频在线观看2022| 久久久精品蜜桃| 偷偷要91色婷婷| 不卡的av网站| 日韩一区二区三区高清免费看看| 自拍偷拍亚洲综合| 国产一区二区网址| 欧美精品久久99久久在免费线| 欧美—级在线免费片| 免费成人在线影院| 欧美专区在线观看一区| 国产三级精品视频| 蜜臀va亚洲va欧美va天堂| 97久久超碰国产精品| 亚洲精品在线免费观看视频| 亚洲va韩国va欧美va| 成人黄色av电影| 精品国产伦一区二区三区免费 | 精品一二三四在线| 欧美精品第一页| 一区二区三区.www| 99久久精品免费看| 国产亚洲欧美色| 麻豆精品久久久| 色婷婷国产精品| 日韩一区在线免费观看| 国产乱码精品一区二区三| 欧美一卡2卡3卡4卡| 亚洲国产精品久久人人爱蜜臀| eeuss鲁片一区二区三区| 国产亚洲午夜高清国产拍精品| 美国三级日本三级久久99| 欧美日韩三级视频| 亚洲午夜精品久久久久久久久| youjizz久久| 国产精品视频yy9299一区| 国产一本一道久久香蕉| www国产精品av| 久久电影网电视剧免费观看| 日韩一区二区在线看| 日本不卡一二三区黄网| 日韩一区二区高清| 欧美a级理论片| 欧美一级免费观看| 久久激情五月激情| 精品国产乱码久久| 国内精品久久久久影院薰衣草| 精品欧美乱码久久久久久1区2区| 日本美女一区二区三区视频| 在线不卡欧美精品一区二区三区| 视频一区二区三区在线| 日韩一区二区三免费高清| 麻豆国产精品一区二区三区 | 日韩高清中文字幕一区| 91精品国产麻豆国产自产在线| 蜜桃视频一区二区| 2019国产精品| 波波电影院一区二区三区| 亚洲欧洲成人自拍| 欧美亚洲自拍偷拍| 人禽交欧美网站| 精品国产乱码久久| 国产成a人亚洲| 亚洲欧洲国产专区| 欧美性色黄大片手机版| 五月天婷婷综合| 26uuu亚洲综合色欧美| 粉嫩欧美一区二区三区高清影视 | 精品盗摄一区二区三区| 国产精品一级在线| 亚洲色图在线看| 欧美夫妻性生活| 国产一区在线视频| 亚洲特黄一级片| 欧美精品一二三四| 久久66热偷产精品| 亚洲欧美在线aaa| 欧美三级日韩三级| 国产中文字幕精品| 亚洲精品日产精品乱码不卡| 91精品国产色综合久久ai换脸 |