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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? enhance.c

?? BCAST Implementation for NS2
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
  (void) ioctl(fd, I_PUSH, "ptem");  (void) ioctl(fd, I_PUSH, "ldterm");/* * On BSD based systems other than SunOS 4.x, the following makes the * pseudo-terminal the controlling terminal of the child process. * According to the pseudo-terminal example code in Steven's * Advanced programming in the unix environment, the !defined(CIBAUD) * part of the clause prevents this from being used under SunOS. Since * I only have his code with me, and won't have access to the book, * I don't know why this is necessary. */#elif defined(TIOCSCTTY) && !defined(CIBAUD)  if(ioctl(fd, TIOCSCTTY, (char *) 0) < 0) {    fprintf(stderr, "%s: Unable to establish controlling terminal (%s).\n",	    prog, strerror(errno));    close(fd);    return -1;  };#endif  return fd;}/*....................................................................... * Read input from the controlling terminal of the program, using * gl_get_line(), and feed it to the user's program running in a child * process, via the controller side of the pseudo-terminal. Also pass * data received from the user's program via the conroller end of * the pseudo-terminal, to stdout. * * Input: *  prog  const char *  The name of this program. *  cntrl        int    The file descriptor of the controller end of the *                      pseudo-terminal. * Output: *  return       int    0 - OK. *                      1 - Error. */static int pty_parent(const char *prog, int cntrl){  GetLine *gl = NULL;  /* The gl_get_line() resource object */  char *line;          /* An input line read from the user */  char *rbuff=NULL;    /* A buffer for reading from the pseudo terminal *//* * Allocate the gl_get_line() resource object. */  gl = new_GetLine(PTY_MAX_LINE, PTY_HIST_SIZE);  if(!gl)    return pty_stop_parent(1, cntrl, gl, rbuff);/* * Allocate a buffer to use to accumulate bytes read from the * pseudo-terminal. */  rbuff = (char *) malloc(PTY_MAX_READ+1);  if(!rbuff)    return pty_stop_parent(1, cntrl, gl, rbuff);  rbuff[0] = '\0';/* * Register an event handler to watch for data appearing from the * user's program on the controller end of the pseudo terminal. */  if(gl_watch_fd(gl, cntrl, GLFD_READ, pty_read_from_program, rbuff))    return pty_stop_parent(1, cntrl, gl, rbuff);/* * Read input lines from the user and pass them on to the user's program, * by writing to the controller end of the pseudo-terminal. */  while((line=gl_get_line(gl, rbuff, NULL, 0))) {    if(pty_write_to_fd(cntrl, line, strlen(line)))       return pty_stop_parent(1, cntrl, gl, rbuff);    rbuff[0] = '\0';  };  return pty_stop_parent(0, cntrl, gl, rbuff);}/*....................................................................... * This is a private return function of pty_parent(), used to release * dynamically allocated resources, close the controller end of the * pseudo-terminal, and wait for the child to exit. It returns the * exit status of the child process, unless the caller reports an * error itself, in which case the caller's error status is returned. * * Input: *  waserr   int    True if the caller is calling this function because *                  an error occured. *  cntrl    int    The file descriptor of the controller end of the *                  pseudo-terminal. *  gl   GetLine *  The resource object of gl_get_line(). *  rbuff   char *  The buffer used to accumulate bytes read from *                  the pseudo-terminal. * Output: *  return  int    The desired exit status of the program. */static int pty_stop_parent(int waserr, int cntrl, GetLine *gl, char *rbuff){  int status;  /* The return status of the child process *//* * Close the controller end of the terminal. */  close(cntrl);/* * Delete the resource object. */  gl = del_GetLine(gl);/* * Delete the read buffer. */  if(rbuff)    free(rbuff);/* * Wait for the user's program to end. */  (void) wait(&status);/* * Return either our error status, or the return status of the child * program. */  return waserr ? 1 : status;}/*....................................................................... * Run the user's program, with its stdin and stdout connected to the * slave end of the psuedo-terminal. * * Input: *  prog  const char *   The name of this program. *  slave        int     The file descriptor of the slave end of the *                       pseudo terminal. *  argv        char *[] The argument vector to pass to the user's program, *                       where argv[0] is the name of the user's program, *                       and the last argument is followed by a pointer *                       to NULL. * Output: *  return   int         If this function returns at all, an error must *                       have occured when trying to overlay the process *                       with the user's program. In this case 1 is *                       returned. */static int pty_child(const char *prog, int slave, char *argv[]){  struct termios attr; /* The terminal attributes *//* * We need to stop the pseudo-terminal from echoing everything that we send it. */  if(tcgetattr(slave, &attr)) {    fprintf(stderr, "%s: Can't get pseudo-terminal attributes (%s).\n", prog,	    strerror(errno));    return 1;  };  attr.c_lflag &= ~(ECHO);  while(tcsetattr(slave, TCSADRAIN, &attr)) {    if(errno != EINTR) {      fprintf(stderr, "%s: tcsetattr error: %s\n", prog, strerror(errno));      return 1;    };  };/* * Arrange for stdin, stdout and stderr to be connected to the slave device, * ignoring errors that imply that either stdin or stdout is closed. */  while(dup2(slave, STDIN_FILENO) < 0 && errno==EINTR)    ;  while(dup2(slave, STDOUT_FILENO) < 0 && errno==EINTR)    ;  while(dup2(slave, STDERR_FILENO) < 0 && errno==EINTR)    ;/* * Run the user's program. */  if(execvp(argv[0], argv) < 0) {    fprintf(stderr, "%s: Unable to execute %s (%s).\n", prog, argv[0],	    strerror(errno));    fflush(stderr);    _exit(1);  };  return 0;  /* This should never be reached */}/*....................................................................... * This is the event-handler that is called by gl_get_line() whenever * there is tet waiting to be read from the user's program, via the * controller end of the pseudo-terminal. See libtecla.h for details * about its arguments. */static GL_FD_EVENT_FN(pty_read_from_program){  char *nlptr;   /* A pointer to the last newline in the accumulated string */  char *crptr;   /* A pointer to the last '\r' in the accumulated string */  char *nextp;   /* A pointer to the next unprocessed character *//* * Get the read buffer in which we are accumulating a line to be * forwarded to stdout. */  char *rbuff = (char *) data;/* * New data may arrive while we are processing the current read, and * it is more efficient to display this here than to keep returning to * gl_get_line() and have it display the latest prefix as a prompt, * followed by the current input line, so we loop, delaying a bit at * the end of each iteration to check for more data arriving from * the application, before finally returning to gl_get_line() when * no more input is available. */  do {/* * Get the current length of the output string. */    int len = strlen(rbuff);/* * Read the text from the program. */    int nnew = read(fd, rbuff + len, PTY_MAX_READ - len);    if(nnew < 0)      return GLFD_ABORT;    len += nnew;/* * Nul terminate the accumulated string. */    rbuff[len] = '\0';/* * Find the last newline and last carriage return in the buffer, if any. */    nlptr = strrchr(rbuff, '\n');    crptr = strrchr(rbuff, '\r');/* * We want to output up to just before the last newline or carriage * return. If there are no newlines of carriage returns in the line, * and the buffer is full, then we should output the whole line. In * all cases a new output line will be started after the latest text * has been output. The intention is to leave any incomplete line * in the buffer, for (perhaps temporary) use as the current prompt. */    if(nlptr) {      nextp = crptr && crptr < nlptr ? crptr : nlptr;    } else if(crptr) {      nextp = crptr;    } else if(len >= PTY_MAX_READ) {      nextp = rbuff + len;    } else {      nextp = NULL;    };/* * Do we have any text to output yet? */    if(nextp) {/* * If there was already some text in rbuff before this function * was called, then it will have been used as a prompt. Arrange * to rewrite this prefix, plus the new suffix, by moving back to * the start of the line. */      if(len > 0)	(void) pty_write_to_fd(STDOUT_FILENO, "\r", 1);/* * Write everything up to the last newline to stdout. */      (void) pty_write_to_fd(STDOUT_FILENO, rbuff, nextp - rbuff);/* * Start a new line. */      (void) pty_write_to_fd(STDOUT_FILENO, "\r\n", 2);/* * Skip trailing carriage returns and newlines. */      while(*nextp=='\n' || *nextp=='\r')	nextp++;/* * Move any unwritten text following the newline, to the start of the * buffer. */      memmove(rbuff, nextp, len - (nextp - rbuff) + 1);    };  } while(pty_master_readable(fd, PTY_READ_TIMEOUT));/* * Make the incomplete line in the output buffer the current prompt. */  gl_replace_prompt(gl, rbuff);  return GLFD_REFRESH;}/*....................................................................... * Write a given string to a specified file descriptor. * * Input: *  fd             int     The file descriptor to write to. *  string  const char *   The string to write (of at least 'n' characters). *  n              int     The number of characters to write. * Output: *  return         int     0 - OK. *                         1 - Error. */static int pty_write_to_fd(int fd, const char *string, int n){  int ndone = 0;  /* The number of characters written so far *//* * Do as many writes as are needed to write the whole string. */  while(ndone < n) {    int nnew = write(fd, string + ndone, n - ndone);    if(nnew > 0)      ndone += nnew;    else if(errno != EINTR)      return 1;  };  return 0;}/*....................................................................... * This is the signal handler that is called when the child process * that is running the user's program exits for any reason. It closes * the slave end of the terminal, so that gl_get_line() in the parent * process sees an end of file. */static void pty_child_exited(int sig){  raise(SIGINT);}/*....................................................................... * Return non-zero after a given amount of time if there is data waiting * to be read from a given file descriptor. * * Input: *  fd        int  The descriptor to watch. *  usec     long  The number of micro-seconds to wait for input to *                 arrive before giving up. * Output: *  return    int  0 - No data is waiting to be read (or select isn't *                     available). *                 1 - Data is waiting to be read. */static int pty_master_readable(int fd, long usec){#if HAVE_SELECT  fd_set rfds;             /* The set of file descriptors to check */  struct timeval timeout;  /* The timeout */  FD_ZERO(&rfds);  FD_SET(fd, &rfds);  timeout.tv_sec = 0;  timeout.tv_usec = usec;  return select(fd+1, &rfds, NULL, NULL, &timeout) == 1;#else  return 0;#endif}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产美女一区二区| 精品影院一区二区久久久| 97久久精品人人爽人人爽蜜臀| 2022国产精品视频| 精品午夜久久福利影院 | 国产精品18久久久久久久久| 精品少妇一区二区三区日产乱码| 奇米在线7777在线精品| 日韩一区二区免费在线观看| 日本不卡不码高清免费观看| 日韩欧美在线123| 裸体健美xxxx欧美裸体表演| 欧美va亚洲va| 国产成人免费视频网站高清观看视频 | 欧美乱妇15p| 亚洲电影第三页| 欧美高清视频一二三区| 日韩av一区二区三区四区| 日韩视频一区二区| 国产一区二区三区在线观看免费视频 | 精品福利一二区| 国产精品综合网| 国产精品天干天干在观线| av一区二区三区四区| 亚洲精品中文在线| 欧美色区777第一页| 蜜桃视频在线一区| 在线电影欧美成精品| 色婷婷综合在线| 国产在线播放一区三区四| 成人涩涩免费视频| 国产精品久久精品日日| 日本精品免费观看高清观看| 亚洲曰韩产成在线| 欧美丰满嫩嫩电影| 黑人精品欧美一区二区蜜桃| 欧美激情一区不卡| 欧美性大战久久久久久久| 日日夜夜免费精品| 久久伊人蜜桃av一区二区| 成人激情av网| 午夜精品福利一区二区三区av | 亚洲精品视频观看| 91麻豆精品国产自产在线| 国产综合色在线视频区| 国产精品高清亚洲| 欧美美女一区二区三区| 国产综合色精品一区二区三区| 国产精品少妇自拍| 欧美日韩中文字幕精品| 久久www免费人成看片高清| 中文字幕在线播放不卡一区| 欧美午夜在线一二页| 狠狠色综合日日| 亚洲乱码国产乱码精品精小说| 69av一区二区三区| 成人精品一区二区三区四区| 亚洲高清久久久| 久久亚洲影视婷婷| 日本二三区不卡| 久国产精品韩国三级视频| 综合色天天鬼久久鬼色| 日韩一区二区三区精品视频| 成人动漫视频在线| 日韩电影免费在线| 国产精品久久777777| 日韩欧美亚洲另类制服综合在线 | 激情五月婷婷综合网| 亚洲视频综合在线| 精品国产伦一区二区三区免费| 色综合久久久久网| 国模冰冰炮一区二区| 亚洲一二三区视频在线观看| 久久亚洲影视婷婷| 欧美高清激情brazzers| 成人黄色软件下载| 麻豆极品一区二区三区| 樱花影视一区二区| 久久久久综合网| 51午夜精品国产| 91视频www| 国产精品1024久久| 奇米色一区二区| 亚洲欧美视频在线观看| 久久综合九色综合97_久久久| 欧美探花视频资源| 成人午夜在线免费| 久久国产夜色精品鲁鲁99| 亚洲综合久久av| 国产精品乱码久久久久久| 欧美大片日本大片免费观看| 欧美日韩久久久一区| 91啪亚洲精品| 成人丝袜高跟foot| 久久99精品久久久久久动态图| 洋洋成人永久网站入口| 国产精品婷婷午夜在线观看| 精品三级在线看| 3d成人动漫网站| 在线影院国内精品| youjizz国产精品| 国产一区二区影院| 久久超碰97中文字幕| 午夜精品一区二区三区三上悠亚 | 亚洲欧美另类久久久精品| 久久精品视频一区二区三区| 日韩一区二区电影网| 在线欧美小视频| 91丨九色丨蝌蚪丨老版| 风间由美一区二区av101| 狠狠色丁香婷综合久久| 免费在线观看一区二区三区| 天天做天天摸天天爽国产一区 | 国产99精品国产| 国内一区二区在线| 久久99深爱久久99精品| 蜜臀av国产精品久久久久| 日本中文字幕不卡| 日韩和欧美的一区| 秋霞成人午夜伦在线观看| 天天做天天摸天天爽国产一区 | 欧美自拍偷拍一区| 一本大道综合伊人精品热热| 色综合夜色一区| 色www精品视频在线观看| 91成人在线免费观看| 欧美在线短视频| 欧美特级限制片免费在线观看| 欧美性猛交xxxx黑人交| 欧美日韩成人在线| 91麻豆精品国产91久久久久| 欧美日韩成人综合| 欧美一区二区大片| 337p亚洲精品色噜噜狠狠| 91麻豆精品久久久久蜜臀| 日韩视频不卡中文| 日韩手机在线导航| 久久亚区不卡日本| 久久九九99视频| 国产精品理伦片| 伊人性伊人情综合网| 亚洲尤物在线视频观看| 亚洲福利视频三区| 日韩 欧美一区二区三区| 加勒比av一区二区| 国产精品一区二区久激情瑜伽| 国产丶欧美丶日本不卡视频| 99这里只有久久精品视频| 91看片淫黄大片一级| 欧美日韩综合不卡| 日韩精品在线网站| 久久久99精品久久| 自拍偷拍亚洲欧美日韩| 亚洲视频在线一区| 亚洲3atv精品一区二区三区| 蜜桃视频在线观看一区| 国产乱人伦偷精品视频不卡| 97久久精品人人做人人爽50路| 欧美性猛交xxxx乱大交退制版| 日韩一区二区在线看| 久久婷婷色综合| 一区免费观看视频| 视频一区欧美日韩| 国产一区二区在线观看视频| 99精品热视频| 在线不卡中文字幕播放| 欧美精品一区视频| 成人欧美一区二区三区黑人麻豆| 亚洲国产精品久久不卡毛片| 精品亚洲porn| 色综合天天在线| 日韩三级视频中文字幕| 国产精品久久久久久久第一福利 | 在线不卡免费av| 久久久久久久久久久99999| 亚洲视频在线观看一区| 日韩精品成人一区二区三区| 国产精品夜夜爽| 欧美三级日韩三级| 精品盗摄一区二区三区| 成人免费在线播放视频| 日本美女一区二区三区| 成人少妇影院yyyy| 91麻豆精品国产91久久久久久久久 | 99re热视频精品| 91精品国产综合久久香蕉麻豆 | 日本伊人色综合网| 丁香亚洲综合激情啪啪综合| 欧美色综合影院| 国产亚洲欧洲997久久综合| 亚洲午夜在线电影| 国产精一区二区三区| 精品视频免费看| 欧美国产精品久久| 日韩一区欧美二区| 99精品黄色片免费大全| 欧美mv日韩mv亚洲| 久草热8精品视频在线观看| 国产一区二区网址| 欧美日韩久久不卡|