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

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

?? cut.c

?? linux 應(yīng)用開發(fā)技術(shù)詳解中的附錄源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
	  break;
	}
      else if (wc == L'\n')
	{
	  putchar ('\n');
	  idx = 0;
	}
      else
	{
	  idx += (operating_mode == byte_mode) ? mblength : 1;
	  if (print_kth (idx))
	    fwrite (bufpos, mblength, sizeof(char), stdout);
	}

      buflen -= mblength;
      bufpos += mblength;
    }
}
#endif
		   
/* Read from stream STREAM, printing to standard output any selected fields.  */

static void
cut_fields (FILE *stream)
{
  int c;
  unsigned int field_idx;
  int found_any_selected_field;
  int buffer_first_field;
  int empty_input;

  found_any_selected_field = 0;
  field_idx = 1;

  c = getc (stream);
  empty_input = (c == EOF);
  if (c != EOF)
    ungetc (c, stream);

  /* To support the semantics of the -s flag, we may have to buffer
     all of the first field to determine whether it is `delimited.'
     But that is unnecessary if all non-delimited lines must be printed
     and the first field has been selected, or if non-delimited lines
     must be suppressed and the first field has *not* been selected.
     That is because a non-delimited line has exactly one field.  */
  buffer_first_field = (suppress_non_delimited ^ !print_kth (1));

  while (1)
    {
      if (field_idx == 1 && buffer_first_field)
	{
	  int len;
	  size_t n_bytes;

	  len = getstr (&field_1_buffer, &field_1_bufsize, stream,
			delim, '\n', 0);
	  if (len < 0)
	    {
	      if (ferror (stream) || feof (stream))
		break;
	      xalloc_die ();
	    }

	  n_bytes = len;
	  assert (n_bytes != 0);

	  /* If the first field extends to the end of line (it is not
	     delimited) and we are printing all non-delimited lines,
	     print this one.  */
	  if ((unsigned char) field_1_buffer[n_bytes - 1] != delim)
	    {
	      if (suppress_non_delimited)
		{
		  /* Empty.  */
		}
	      else
		{
		  fwrite (field_1_buffer, sizeof (char), n_bytes, stdout);
		  /* Make sure the output line is newline terminated.  */
		  if (field_1_buffer[n_bytes - 1] != '\n')
		    putchar ('\n');
		}
	      continue;
	    }
	  if (print_kth (1))
	    {
	      /* Print the field, but not the trailing delimiter.  */
	      fwrite (field_1_buffer, sizeof (char), n_bytes - 1, stdout);
	      found_any_selected_field = 1;
	    }
	  ++field_idx;
	}

      if (c != EOF)
	{
	  if (print_kth (field_idx))
	    {
	      if (found_any_selected_field)
		{
		  fwrite (output_delimiter_string, sizeof (char),
			  output_delimiter_length, stdout);
		}
	      found_any_selected_field = 1;

	      while ((c = getc (stream)) != delim && c != '\n' && c != EOF)
		{
		  putchar (c);
		}
	    }
	  else
	    {
	      while ((c = getc (stream)) != delim && c != '\n' && c != EOF)
		{
		  /* Empty.  */
		}
	    }
	}

      if (c == '\n')
	{
	  c = getc (stream);
	  if (c != EOF)
	    {
	      ungetc (c, stream);
	      c = '\n';
	    }
	}

      if (c == delim)
	++field_idx;
      else if (c == '\n' || c == EOF)
	{
	  if (found_any_selected_field
	      || (!empty_input && !(suppress_non_delimited && field_idx == 1)))
	    putchar ('\n');
	  if (c == EOF)
	    break;
	  field_idx = 1;
	  found_any_selected_field = 0;
	}
    }
}

#if HAVE_MBRTOWC
static void
cut_fields_mb (FILE *stream)
{
  int c;
  unsigned int field_idx;
  int found_any_selected_field;
  int buffer_first_field;
  int empty_input;
  char buf[MB_LEN_MAX + BUFSIZ];  /* For spooling a read byte sequence. */
  char *bufpos;		/* Next read position of BUF. */
  size_t buflen;	/* The length of the byte sequence in buf. */
  wint_t wc;		/* A gotten wide character. */
  size_t mblength;	/* The byte size of a multibyte character which shows
			   as same character as WC. */
  mbstate_t state;	/* State of the stream. */
  int convfail;		/* 1, when conversion is failed. Otherwise 0. */

  found_any_selected_field = 0;
  field_idx = 1;
  bufpos = buf;
  buflen = 0;
  memset (&state, '\0', sizeof(mbstate_t));

  c = getc (stream);
  empty_input = (c == EOF);
  if (c != EOF)
    ungetc (c, stream);
  else
    wc = WEOF;

  /* To support the semantics of the -s flag, we may have to buffer
     all of the first field to determine whether it is `delimited.'
     But that is unnecessary if all non-delimited lines must be printed
     and the first field has been selected, or if non-delimited lines
     must be suppressed and the first field has *not* been selected.
     That is because a non-delimited line has exactly one field.  */
  buffer_first_field = (suppress_non_delimited ^ !print_kth (1));

  while (1)
    {
      if (field_idx == 1 && buffer_first_field)
	{
	  int len = 0;

	  while (1)
	    {
	      REFILL_BUFFER (buf, bufpos, buflen, stream);

	      GET_NEXT_WC_FROM_BUFFER
		(wc, bufpos, buflen, mblength, state, convfail);

	      if (wc == WEOF)
		break;

	      field_1_buffer = xrealloc (field_1_buffer, len + mblength);
	      memcpy (field_1_buffer + len, bufpos, mblength);
	      len += mblength;
	      buflen -= mblength;
	      bufpos += mblength;

	      if (!convfail && (wc == L'\n' || wc == wcdelim))
		break;
	    }

	  if (wc == WEOF)
	    break;

	  /* If the first field extends to the end of line (it is not
	     delimited) and we are printing all non-delimited lines,
	     print this one.  */
	  if (convfail || (!convfail && wc != wcdelim))
	    {
	      if (suppress_non_delimited)
		{
		  /* Empty.	*/
		}
	      else
		{
		  fwrite (field_1_buffer, sizeof (char), len, stdout);
		  /* Make sure the output line is newline terminated.  */
		  if (convfail || (!convfail && wc != L'\n'))
		    putchar ('\n');
		}
	      continue;
	    }

	  if (print_kth (1))
	    {
	      /* Print the field, but not the trailing delimiter.  */
	      fwrite (field_1_buffer, sizeof (char), len - 1, stdout);
	      found_any_selected_field = 1;
	    }
	  ++field_idx;
	}

      if (wc != WEOF)
	{
	  if (print_kth (field_idx))
	    {
	      if (found_any_selected_field)
		{
		  fwrite (output_delimiter_string, sizeof (char),
			  output_delimiter_length, stdout);
		}
	      found_any_selected_field = 1;
	    }

	  while (1)
	    {
	      REFILL_BUFFER (buf, bufpos, buflen, stream);

	      GET_NEXT_WC_FROM_BUFFER
		(wc, bufpos, buflen, mblength, state, convfail);

	      if (wc == WEOF)
		break;
	      else if (!convfail && (wc == wcdelim || wc == L'\n'))
		{
		  buflen -= mblength;
		  bufpos += mblength;
		  break;
		}

	      if (print_kth (field_idx))
		fwrite (bufpos, mblength, sizeof(char), stdout);

	      buflen -= mblength;
	      bufpos += mblength;
	    }
	}

      if ((!convfail || wc == L'\n') && buflen < 1)
	wc = WEOF;

      if (!convfail && wc == wcdelim)
	++field_idx;
      else if (wc == WEOF || (!convfail && wc == L'\n'))
	{
	  if (found_any_selected_field
	      || (!empty_input && !(suppress_non_delimited && field_idx == 1)))
	    putchar ('\n');
	  if (wc == WEOF)
	    break;
	  field_idx = 1;
	  found_any_selected_field = 0;
	}
    }
}
#endif

static void
cut_stream (FILE *stream)
{
#if HAVE_MBRTOWC
  if (MB_CUR_MAX > 1 && !force_singlebyte_mode)
    {
      switch (operating_mode)
	{
	case byte_mode:
	  if (byte_mode_character_aware)
	    cut_characters_or_cut_bytes_no_split (stream);
	  else
	    cut_bytes (stream);
	  break;

	case character_mode:
	  cut_characters_or_cut_bytes_no_split (stream);
	  break;

	case field_mode:
	  cut_fields_mb (stream);
	  break;

	default:
	  abort ();
	}
    }
  else
#endif
    {
      if (operating_mode == field_mode)
	cut_fields (stream);
      else
	cut_bytes (stream);
    }
}

/* Process file FILE to standard output.
   Return 0 if successful, 1 if not. */

static int
cut_file (char *file)
{
  FILE *stream;

  if (STREQ (file, "-"))
    {
      have_read_stdin = 1;
      stream = stdin;
    }
  else
    {
      stream = fopen (file, "r");
      if (stream == NULL)
	{
	  error (0, errno, "%s", file);
	  return 1;
	}
    }

  cut_stream (stream);

  if (ferror (stream))
    {
      error (0, errno, "%s", file);
      return 1;
    }
  if (STREQ (file, "-"))
    clearerr (stream);		/* Also clear EOF. */
  else if (fclose (stream) == EOF)
    {
      error (0, errno, "%s", file);
      return 1;
    }
  return 0;
}

int
main (int argc, char **argv)
{
  int optc, exit_status = 0;
  int delim_specified = 0;
  char mbdelim[MB_LEN_MAX + 1];
  size_t delimlen = 0;

  program_name = argv[0];
  setlocale (LC_ALL, "");
  bindtextdomain (PACKAGE, LOCALEDIR);
  textdomain (PACKAGE);

  atexit (close_stdout);

  operating_mode = undefined_mode;

  /* By default, all non-delimited lines are printed.  */
  suppress_non_delimited = 0;

  delim = '\0';
  have_read_stdin = 0;

  while ((optc = getopt_long (argc, argv, "b:c:d:f:ns", longopts, NULL)) != -1)
    {
      switch (optc)
	{
	case 0:
	  break;

	case 'b':
	  /* Build the byte list. */
	  if (operating_mode != undefined_mode)
	    FATAL_ERROR (_("only one type of list may be specified"));
	  operating_mode = byte_mode;
	  if (set_fields (optarg) == 0)
	    FATAL_ERROR (_("missing list of positions"));
	  break;

	case 'c':
	  /* Build the character list. */
	  if (operating_mode != undefined_mode)
	    FATAL_ERROR (_("only one type of list may be specified"));
	  operating_mode = character_mode;
	  if (set_fields (optarg) == 0)
	    FATAL_ERROR (_("missing list of positions"));
	  break;

	case 'f':
	  /* Build the field list. */
	  if (operating_mode != undefined_mode)
	    FATAL_ERROR (_("only one type of list may be specified"));
	  operating_mode = field_mode;
	  if (set_fields (optarg) == 0)
	    FATAL_ERROR (_("missing list of fields"));
	  break;

	case 'd':
	  /* New delimiter. */
	  /* Interpret -d '' to mean `use the NUL byte as the delimiter.'  */
#if HAVE_MBRTOWC
	    {
	      if(MB_CUR_MAX > 1)
		{
		  mbstate_t state;

		  memset (&state, '\0', sizeof(mbstate_t));
		  delimlen = mbrtowc (&wcdelim, optarg, strnlen(optarg, MB_LEN_MAX), &state);

		  if (delimlen == (size_t)-1 || delimlen == (size_t)-2)
		    ++force_singlebyte_mode;
		  else
		    {
		      delimlen = (delimlen < 1) ? 1 : delimlen;
		      if (wcdelim != L'\0' && *(optarg + delimlen) != '\0')
			FATAL_ERROR (_("the delimiter must be a single character"));
		      memcpy (mbdelim, optarg, delimlen);
		    }
		}

	      if (MB_CUR_MAX <= 1 || force_singlebyte_mode)
#endif
		{
		  if (optarg[0] != '\0' && optarg[1] != '\0')
		    FATAL_ERROR (_("the delimiter must be a single character"));
		  delim = (unsigned char) optarg[0];
		}
	  delim_specified = 1;
	    }
	  break;

	case OUTPUT_DELIMITER_OPTION:
	  /* Interpret --output-delimiter='' to mean
	     `use the NUL byte as the delimiter.'  */
	  output_delimiter_length = (optarg[0] == '\0'
				     ? 1 : strlen (optarg));
	  output_delimiter_string = xstrdup (optarg);
	  break;

	case 'n':
	  byte_mode_character_aware = 1;
	  break;

	case 's':
	  suppress_non_delimited = 1;
	  break;

	case_GETOPT_HELP_CHAR;

	case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);

	default:
	  usage (2);
	}
    }

  if (operating_mode == undefined_mode)
    FATAL_ERROR (_("you must specify a list of bytes, characters, or fields"));

  if (delim_specified && operating_mode != field_mode)
    FATAL_ERROR (_("a delimiter may be specified only when operating on fields"));

  if (suppress_non_delimited && operating_mode != field_mode)
    FATAL_ERROR (_("suppressing non-delimited lines makes sense\n\
\tonly when operating on fields"));

  if (!delim_specified)
    {
      delim = '\t';
#ifdef HAVE_MBRTOWC
      wcdelim = L'\t';
      mbdelim[0] = '\t';
      mbdelim[1] = '\0';
      delimlen = 1;
#endif
    }

  if (output_delimiter_string == NULL)
    {
#ifdef HAVE_MBRTOWC
      if (MB_CUR_MAX > 1 && !force_singlebyte_mode)
	{
	  output_delimiter_string = xstrdup(mbdelim);
	  output_delimiter_length = delimlen;
	}

      if (MB_CUR_MAX <= 1 || force_singlebyte_mode)
#endif
	{
	  static char dummy[2]; 
	  dummy[0] = delim;
	  dummy[1] = '\0';
	  output_delimiter_string = dummy;
	  output_delimiter_length = 1;
	}
    }

  if (optind == argc)
    exit_status |= cut_file ("-");
  else
    for (; optind < argc; optind++)
      exit_status |= cut_file (argv[optind]);

  if (have_read_stdin && fclose (stdin) == EOF)
    {
      error (0, errno, "-");
      exit_status = 1;
    }

  exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品 日产精品 欧美精品| av在线免费不卡| 久久伊99综合婷婷久久伊| 九九**精品视频免费播放| 久久综合九色综合欧美就去吻 | 91日韩精品一区| 亚洲美女在线国产| 欧美日韩亚洲综合在线 | 国产成人av资源| 成人免费小视频| 亚洲一区二区在线免费看| 欧美午夜精品久久久久久超碰 | 性做久久久久久免费观看欧美| 欧美一级生活片| 国产精品中文有码| **网站欧美大片在线观看| 精品视频免费在线| 激情综合色综合久久| 国产精品丝袜久久久久久app| 99国产精品国产精品毛片| 亚洲福利一区二区| 精品国产一区二区三区av性色| 懂色av中文字幕一区二区三区 | 亚洲一级二级在线| 日韩美女主播在线视频一区二区三区| 国产精品456| 玉米视频成人免费看| 日韩久久久久久| 不卡视频免费播放| 日日夜夜一区二区| 国内精品伊人久久久久av影院| 中文字幕一区日韩精品欧美| 欧美精品在线观看播放| 国产91丝袜在线播放九色| 亚洲伊人色欲综合网| 亚洲精品在线观看视频| 色婷婷亚洲一区二区三区| 久久国产精品色婷婷| 亚洲免费三区一区二区| 日韩一区二区三区四区 | 成人午夜激情视频| 视频一区视频二区中文| 欧美韩日一区二区三区四区| 欧美日韩国产一级| 成人免费福利片| 日本亚洲一区二区| 成人免费在线视频| 精品入口麻豆88视频| 色综合久久久久久久久| 精品一区二区三区免费| 亚洲最新视频在线观看| 久久精品水蜜桃av综合天堂| 欧美四级电影在线观看| 国产91露脸合集magnet| 欧美一区二区三区四区五区 | 色婷婷亚洲综合| 国产一区二区三区国产| 亚洲第一成年网| 国产精品久久久久久亚洲毛片| 日韩美女视频在线| 欧美日韩综合色| 99精品视频一区| 国产精品自拍毛片| 日韩av不卡一区二区| 亚洲精品欧美二区三区中文字幕| 精品成人一区二区三区| 欧美乱妇15p| 色婷婷国产精品| 懂色av一区二区夜夜嗨| 久久成人av少妇免费| 亚洲第一成年网| 亚洲美女偷拍久久| 日本一区二区三区国色天香| 日韩欧美国产一二三区| 欧美日韩综合一区| 91久久精品日日躁夜夜躁欧美| 国产三级精品视频| 精品久久人人做人人爰| 欧美情侣在线播放| 91精品福利视频| av成人老司机| 高清久久久久久| 国产美女主播视频一区| 日韩高清一区二区| 亚洲国产aⅴ成人精品无吗| 国产精品视频看| 精品久久久久久久人人人人传媒 | 久久久久97国产精华液好用吗| 91精品国产综合久久精品| 在线观看免费一区| 91免费在线看| 99久久精品国产观看| 狠狠网亚洲精品| 激情文学综合丁香| 日韩成人午夜精品| 视频一区在线播放| 视频一区二区欧美| 亚洲成人在线观看视频| 欧美视频一区二区三区四区 | 一区二区三区国产精华| 亚洲人成小说网站色在线| 国产精品久久久一区麻豆最新章节| 国产香蕉久久精品综合网| 久久亚洲一级片| 久久精品日韩一区二区三区| 久久你懂得1024| 久久久不卡影院| 国产蜜臀av在线一区二区三区| 久久毛片高清国产| 久久精品人人做人人爽人人| 久久久www成人免费无遮挡大片| 欧美成人video| 日韩精品一区二区三区视频播放| 日韩一区二区三区免费看 | 777午夜精品视频在线播放| 欧美午夜影院一区| 欧美日韩精品三区| 欧美视频在线不卡| 91精品国产综合久久精品麻豆| 欧美一区二区三区在线视频| 欧美午夜精品久久久| 欧美丰满高潮xxxx喷水动漫| 欧美日韩精品一区二区天天拍小说| 欧美老女人第四色| 欧美高清激情brazzers| 91精品婷婷国产综合久久竹菊| 91精品国产综合久久久蜜臀图片| 日韩精品专区在线影院观看| 精品福利一二区| 亚洲国产精品成人综合| 中文字幕在线一区| 亚洲精品亚洲人成人网| 香港成人在线视频| 麻豆91精品91久久久的内涵| 国产美女娇喘av呻吟久久| 成人综合婷婷国产精品久久| 色婷婷综合久久久久中文 | 丰满少妇在线播放bd日韩电影| 国产精品一线二线三线精华| 成人视屏免费看| 91丨九色丨蝌蚪富婆spa| 91丝袜美女网| 91在线无精精品入口| 91传媒视频在线播放| 欧美一区二区三区视频免费| 久久精品亚洲乱码伦伦中文 | 日韩av二区在线播放| 国产一区二区精品久久99| aa级大片欧美| 欧美卡1卡2卡| 国产日产精品一区| 一区二区三区加勒比av| 精品一区二区三区免费| 91色视频在线| 欧美一区二区在线免费观看| 国产欧美一二三区| 一区二区三区四区亚洲| 久久精品国产久精国产| 99久久夜色精品国产网站| 欧美精品一二三| 国产农村妇女精品| 亚洲国产成人tv| 国产伦精品一区二区三区免费| 色婷婷国产精品久久包臀| 欧美不卡视频一区| 亚洲男帅同性gay1069| 美腿丝袜在线亚洲一区| 夫妻av一区二区| 777亚洲妇女| 中文字幕一区在线| 久久国产精品无码网站| 99久免费精品视频在线观看| 91精品欧美久久久久久动漫| 中文字幕av不卡| 免费在线观看精品| 99国产精品久久久久久久久久| 欧美刺激脚交jootjob| 亚洲精品日日夜夜| 国产91精品在线观看| 欧美一区三区二区| 亚洲精品v日韩精品| 国产麻豆精品theporn| 欧美日韩高清不卡| 中文字幕日韩一区二区| 精品影视av免费| 精品视频资源站| 国产精品视频你懂的| 激情偷乱视频一区二区三区| 欧美亚洲国产一区在线观看网站 | 亚洲嫩草精品久久| 国产精品综合一区二区三区| 884aa四虎影成人精品一区| 亚洲日本va午夜在线电影| 国产一区二区导航在线播放| 欧美日本在线一区| 亚洲精品v日韩精品| 成人精品小蝌蚪| 2023国产精品| 奇米一区二区三区| 欧美亚洲另类激情小说|