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

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

?? demo2.c

?? BCAST Implementation for NS2
?? C
字號:
/* * Copyright (c) 2000, 2001 by Martin C. Shepherd. *  * All rights reserved. *  * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, and/or sell copies of the Software, and to permit persons * to whom the Software is furnished to do so, provided that the above * copyright notice(s) and this permission notice appear in all copies of * the Software and that both the above copyright notice(s) and this * permission notice appear in supporting documentation. *  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *  * Except as contained in this notice, the name of a copyright holder * shall not be used in advertising or otherwise to promote the sale, use * or other dealings in this Software without prior written authorization * of the copyright holder. */#include <stdio.h>#include <stdlib.h>#include <ctype.h>#include <string.h>#include <errno.h>#include <locale.h>#include <unistd.h>#include <sys/stat.h>#include "libtecla.h"/* * Encapsulate the resources needed by this demo. */typedef struct {  GetLine *gl;      /* The line editor */  PathCache *pc;    /* A cache of executables in the user's path */  PcaPathConf *ppc; /* The configuration argument of pca_path_completions() */} DemoRes;/* * The following functions allocate and free instances of the above * structure. */static DemoRes *new_DemoRes(void);static DemoRes *del_DemoRes(DemoRes *res);/* * Search backwards for the start of a pathname. */static char *start_of_path(const char *string, int back_from);/* * Find the array indexes of the first character of the first * space-delimited word in the specified string, and of the character * that follows it. */static int get_word_limits(const char *string, int *wa, int *wb);/* * This is the demonstration completion callback function (defined below). */static CPL_MATCH_FN(demo_cpl_fn);/*....................................................................... * This demo takes no arguments. It reads lines of input until the * word 'exit' is entered, or C-d is pressed. It replaces the default * tab-completion callback with one which when invoked at the start of * a line, looks up completions of commands in the user's execution * path, and when invoked in other parts of the line, reverts to * normal filename completion. Whenever a new line is entered, it * extracts the first word on the line, looks it up in the user's * execution path to see if it corresponds to a known executable file, * and if so, displays the full pathname of the file, along with the * remaining arguments. */int main(int argc, char *argv[]){  char *line;             /* A line of input */  DemoRes *res;           /* The resources of the demo */  int wa,wb;              /* The delimiting indexes of a word in line[] */  int major,minor,micro;  /* The version number of the library *//* * Allocate the resources needed by this demo. */  res = new_DemoRes();  if(!res)    return 1;/* * If the user has the LC_CTYPE or LC_ALL environment variables set, * enable display of characters corresponding to the specified locale. */  (void) setlocale(LC_CTYPE, "");/* * Lookup and display the version number of the library. */  libtecla_version(&major, &minor, &micro);  printf("Welcome to the demo2 program of libtecla version %d.%d.%d\n",	 major, minor, micro);/* * Read lines of input from the user and print them to stdout. */  do {/* * Get a new line from the user. */    line = gl_get_line(res->gl, "$ ", NULL, 0);    if(!line)      break;/* * Work out the extent of the first word in the input line, and * try to identify this as a command in the path, displaying the * full pathname of the match if found. */    if(get_word_limits(line, &wa, &wb) == 0) {      char *cmd = pca_lookup_file(res->pc, line + wa, wb-wa, 0);      if(cmd) {	printf("Command=%s\n", cmd);	printf("Arguments=%s", line+wb);      } else {	printf("Command not found\n");      };    };/* * If the user types "exit", quit the program. */    if(strcmp(line, "exit\n")==0)      break;  } while(1);/* * Clean up. */  res = del_DemoRes(res);  return 0;}/*....................................................................... * This completion callback searches for completions of executables in * the user's path when invoked on a word at the start of the path, and * performs normal filename completion elsewhere. */static CPL_MATCH_FN(demo_cpl_fn){/* * Get the resource object that was passed to gl_customize_completion(). */  DemoRes *res = (DemoRes *) data;/* * Find the start of the filename prefix to be completed, searching * backwards for the first unescaped space, or the start of the line. */  char *start = start_of_path(line, word_end);/* * Skip spaces preceding the start of the prefix. */  while(start > line && isspace((int)(unsigned char) start[-1]))    start--;/* * If the filename prefix is at the start of the line, attempt * to complete the filename as a command in the path. Otherwise * perform normal filename completion. */  return (start == line) ?    pca_path_completions(cpl, res->ppc, line, word_end) :    cpl_file_completions(cpl, NULL, line, word_end);}/*....................................................................... * Search backwards for the potential start of a filename. This * looks backwards from the specified index in a given string, * stopping at the first unescaped space or the start of the line. * * Input: *  string  const char *  The string to search backwards in. *  back_from      int    The index of the first character in string[] *                        that follows the pathname. * Output: *  return        char *  The pointer to the first character of *                        the potential pathname, or NULL on error. */static char *start_of_path(const char *string, int back_from){  int i, j;/* * Search backwards from the specified index. */  for(i=back_from-1; i>=0; i--) {    int c = string[i];/* * Stop on unescaped spaces. */    if(isspace((int)(unsigned char)c)) {/* * The space can't be escaped if we are at the start of the line. */      if(i==0)        break;/* * Find the extent of the escape characters which precedes the space. */      for(j=i-1; j>=0 && string[j]=='\\'; j--)	;/* * If there isn't an odd number of escape characters before the space, * then the space isn't escaped. */      if((i - 1 - j) % 2 == 0)	break;    };  };  return (char *)string + i + 1;}/*....................................................................... * Create a new DemoRes object containing the resources needed by the * demo. * * Output: *  return  DemoRes *  The new object, or NULL on error. */static DemoRes *new_DemoRes(void){  DemoRes *res;  /* The object to be returned *//* * Allocate the container. */  res = (DemoRes *)malloc(sizeof(DemoRes));  if(!res) {    fprintf(stderr, "new_DemoRes: Insufficient memory.\n");    return NULL;  };/* * Before attempting any operation that might fail, initialize the * container at least up to the point at which it can safely be passed * to del_DemoRes(). */  res->gl = NULL;  res->pc = NULL;  res->ppc = NULL;/* * Create the line editor, specifying a max line length of 500 bytes, * and 10000 bytes to allocate to storage of historical input lines. */  res->gl = new_GetLine(500, 10000);  if(!res->gl)    return del_DemoRes(res);/* * Enable text attribute formatting directives in prompt strings. */  gl_prompt_style(res->gl, GL_FORMAT_PROMPT);/* * Allocate a cache of the executable files found in the user's path. */  res->pc = new_PathCache();  if(!res->pc)    return del_DemoRes(res);/* * Populate the cache with the contents of the user's path. */  if(pca_scan_path(res->pc, getenv("PATH")))    return del_DemoRes(res);/* * Arrange for susequent calls to pca_lookup_file() and pca_path_completions() * to only report files that are executable by the user. */  pca_set_check_fn(res->pc, cpl_check_exe, NULL);/* * Allocate a configuration object for use with pca_path_completions(). */  res->ppc = new_PcaPathConf(res->pc);  if(!res->ppc)    return del_DemoRes(res);/* * Replace the builtin filename completion callback with one which * searches for completions of executables in the user's path when * invoked on a word at the start of the path, and completes files * elsewhere. */  if(gl_customize_completion(res->gl, res, demo_cpl_fn))    return del_DemoRes(res);  return res;}/*....................................................................... * Delete a DemoRes object. * * Input: *  res     DemoRes *  The object to be deleted. * Output: *  return  DemoRes *  The deleted object (always NULL). */static DemoRes *del_DemoRes(DemoRes *res){  if(res) {    res->gl = del_GetLine(res->gl);    res->pc = del_PathCache(res->pc);    res->ppc = del_PcaPathConf(res->ppc);    free(res);  };  return NULL;}/*....................................................................... * Return the limits of the word at the start of a given string, ignoring * leading white-space, and interpretting the first unescaped space, tab or * the end of the line, as the end of the word. * * Input: *  string   const char *  The string to tokenize. * Input/Output: *  wa,wb           int *  The indexes of the first character of the word, *                         and the character which follows the last *                         character of the word, will be assigned to *                         *wa and *wb, respectively. * Output: *  return          int    0 - A word was found. *                         1 - No word was found before the end of the *                             string. */static int get_word_limits(const char *string, int *wa, int *wb){  int escaped = 0;  /* True if the next character is escaped *//* * Skip leading white-space. */  for(*wa=0; isspace((int)(unsigned char)string[*wa]); (*wa)++)    ;/* * Find the first unescaped space, stopping early if the end of the * string is reached. */  for(*wb = *wa; ; (*wb)++) {    int c = string[*wb];    if(c=='\\')      escaped = !escaped;    else if((!escaped && isspace((int)(unsigned char)c)) || c=='\0')      break;  };  return *wa == *wb;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩视频一区二区在线观看| 免费在线一区观看| 久久国产成人午夜av影院| 成人免费黄色大片| 日韩一区二区免费电影| 一区2区3区在线看| 国产不卡免费视频| 欧美va在线播放| 亚洲午夜久久久久久久久电影院 | 精品福利在线导航| 亚洲综合男人的天堂| 不卡高清视频专区| 久久精品视频一区二区| 日本va欧美va瓶| 欧美日产在线观看| 亚洲小说欧美激情另类| 91视频在线观看免费| 中文字幕第一区综合| 国产激情91久久精品导航| 欧美mv和日韩mv的网站| 日韩1区2区日韩1区2区| 欧美午夜精品一区二区三区| 亚洲图片激情小说| 99国产欧美另类久久久精品| 国产精品国产三级国产aⅴ无密码| 国内精品第一页| 日韩欧美国产成人一区二区| 久久精品国产亚洲5555| 日韩欧美一级在线播放| 九九视频精品免费| 久久品道一品道久久精品| 久久电影国产免费久久电影| 日韩视频一区二区在线观看| 精品一区二区在线看| 精品国产sm最大网站| 久久精品国产99国产精品| 日韩欧美国产不卡| 国产剧情在线观看一区二区| 国产亚洲制服色| 成人性色生活片| 亚洲激情综合网| 宅男噜噜噜66一区二区66| 日本强好片久久久久久aaa| 欧美一二三区精品| 国产在线精品一区二区三区不卡| 国产亚洲一区二区三区| 成人高清视频免费观看| 一区二区三区在线影院| 欧美日韩视频不卡| 久久www免费人成看片高清| 国产视频911| 色香蕉成人二区免费| 午夜电影一区二区三区| www国产成人免费观看视频 深夜成人网| 另类综合日韩欧美亚洲| 欧美国产激情一区二区三区蜜月 | 91麻豆精品国产| 久久99国产精品久久| 中文字幕av在线一区二区三区| 91香蕉视频mp4| 日本午夜一区二区| 国产片一区二区| 欧美日韩在线三区| 国产一区二区三区黄视频| **性色生活片久久毛片| 91麻豆精品国产91久久久久| 成人黄色av网站在线| 亚洲18影院在线观看| 国产午夜一区二区三区| 欧美三级蜜桃2在线观看| 国产一区激情在线| 亚洲午夜久久久久久久久电影网 | 欧美一级精品大片| 风间由美一区二区三区在线观看 | 在线播放日韩导航| 成人午夜在线视频| 免费日韩伦理电影| 一区二区三区在线视频免费观看| 亚洲精品一区二区三区影院| 欧美在线你懂的| 成人av网站免费| 极品少妇一区二区三区精品视频| 亚洲色图第一区| 久久亚洲综合色一区二区三区| 欧美性三三影院| 国产激情精品久久久第一区二区 | 国产丝袜在线精品| 欧美一区二区在线视频| 91影视在线播放| 国产成人亚洲综合a∨婷婷| 日韩av网站在线观看| 亚洲午夜电影网| 亚洲三级在线播放| 国产欧美日韩在线视频| 欧美精品一区视频| 日韩欧美中文字幕制服| 欧美日韩一区二区三区四区五区 | 欧美成人aa大片| 91麻豆精品国产91久久久| 色嗨嗨av一区二区三区| 成人激情视频网站| 国产99久久久国产精品| 国产一区二区不卡在线| 国产做a爰片久久毛片| 日韩国产高清在线| 视频一区免费在线观看| 天天做天天摸天天爽国产一区 | 亚洲精品免费播放| 亚洲欧洲日韩在线| 国产精品第13页| 国产精品家庭影院| 综合久久给合久久狠狠狠97色| 国产精品久久久久影院亚瑟 | 久久狠狠亚洲综合| 蜜桃一区二区三区在线| 日本视频一区二区三区| 秋霞影院一区二区| 麻豆成人久久精品二区三区红| 石原莉奈一区二区三区在线观看| 视频一区二区中文字幕| 日本特黄久久久高潮| 久久99国产精品久久| 粉嫩一区二区三区在线看| 成人国产精品免费观看动漫| 色综合婷婷久久| 欧美日本在线播放| 日韩欧美你懂的| 国产日韩在线不卡| 亚洲色图在线播放| 日韩国产精品久久| 韩国欧美国产1区| 不卡在线观看av| 欧美亚洲综合久久| 精品日韩在线观看| 中文一区一区三区高中清不卡| 自拍偷拍亚洲综合| 日韩精品亚洲专区| 国产一二三精品| 在线观看亚洲成人| 精品国产一区二区三区久久影院| 欧美经典一区二区| 亚洲成人精品一区二区| 久久国产免费看| 91麻豆免费观看| 91精品国产aⅴ一区二区| 国产欧美日韩卡一| 天天综合天天做天天综合| 国产精品一区二区三区99| 色综合色综合色综合| 日韩欧美一卡二卡| 成人免费在线观看入口| 日韩高清不卡在线| 99久久精品免费观看| 日韩一区和二区| 亚洲精品美腿丝袜| 国产东北露脸精品视频| 欧美乱妇一区二区三区不卡视频| 国产午夜精品理论片a级大结局 | 欧美日韩aaa| 国产精品天干天干在线综合| 午夜视频在线观看一区二区三区| 蜜桃精品视频在线| 91年精品国产| 国产欧美日韩一区二区三区在线观看| 亚洲高清中文字幕| 成人精品视频一区二区三区| 日韩一区国产二区欧美三区| 亚洲免费观看高清完整版在线| 久久精品国产久精国产爱| 在线观看亚洲一区| 国产精品久久久久久久久免费桃花| 麻豆成人久久精品二区三区小说| 91成人在线精品| 1000部国产精品成人观看| 国产一二三精品| 337p粉嫩大胆噜噜噜噜噜91av| 亚洲地区一二三色| 一本大道久久精品懂色aⅴ | 精品免费99久久| 亚洲成人免费视| 欧美伊人精品成人久久综合97| 国产精品少妇自拍| 国产福利一区在线观看| 日韩欧美一级二级三级| 午夜欧美在线一二页| 91老师国产黑色丝袜在线| 国产精品电影一区二区| 成人午夜电影久久影院| 久久女同性恋中文字幕| 韩国欧美国产一区| 精品国产123| 国产一区二区三区四区五区美女 | 北岛玲一区二区三区四区| 精品嫩草影院久久| 九九精品视频在线看| 欧美mv日韩mv亚洲| 国产曰批免费观看久久久| 久久久一区二区| 国产99久久久久| 亚洲日韩欧美一区二区在线|