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

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

?? cp.c

?? 《Linux應用開發技術詳解》附書光盤中的例程。
?? C
?? 第 1 頁 / 共 3 頁
字號:

   SRC_OFFSET is the index in CONST_DIRPATH (which is a destination
   path) of the beginning of the source directory name.
   Create any leading directories that don't already exist.
   If VERBOSE_FMT_STRING is nonzero, use it as a printf format
   string for printing a message after successfully making a directory.
   The format should take two string arguments: the names of the
   source and destination directories.
   Creates a linked list of attributes of intermediate directories,
   *ATTR_LIST, for re_protect to use after calling copy.
   Sets *NEW_DST to 1 if this function creates parent of CONST_DIRPATH.

   Return 0 if parent of CONST_DIRPATH exists as a directory with the proper
   permissions when done, otherwise 1. */

/* FIXME: find a way to synch this function with the one in lib/makepath.c. */

static int
make_path_private (const char *const_dirpath, int src_offset,
		   const char *verbose_fmt_string, struct dir_attr **attr_list,
		   int *new_dst, struct cp_options const *x)
{
  struct stat stats;
  char *dirpath;		/* A copy of CONST_DIRPATH we can change. */
  char *src;			/* Source name in `dirpath'. */
  char *dst_dirname;		/* Leading path of `dirpath'. */
  size_t dirlen;		/* Length of leading path of `dirpath'. */

  dirpath = (char *) alloca (strlen (const_dirpath) + 1);
  strcpy (dirpath, const_dirpath);

  src = dirpath + src_offset;

  dirlen = dir_len (dirpath);
  dst_dirname = (char *) alloca (dirlen + 1);
  memcpy (dst_dirname, dirpath, dirlen);
  dst_dirname[dirlen] = '\0';

  *attr_list = NULL;

  if ((*x->xstat) (dst_dirname, &stats))
    {
      /* Parent of CONST_DIRNAME does not exist.
	 Make all missing intermediate directories. */
      char *slash;

      slash = src;
      while (*slash == '/')
	slash++;
      while ((slash = strchr (slash, '/')))
	{
	  /* Add this directory to the list of directories whose modes need
	     fixing later. */
	  struct dir_attr *new =
	    (struct dir_attr *) xmalloc (sizeof (struct dir_attr));
	  new->slash_offset = slash - dirpath;
	  new->next = *attr_list;
	  *attr_list = new;

	  *slash = '\0';
	  if ((*x->xstat) (dirpath, &stats))
	    {
	      mode_t src_mode;

	      /* This element of the path does not exist.  We must set
		 *new_dst and new->mode inside this loop because,
		 for example, in the command `cp --parents ../a/../b/c e_dir',
		 make_path_private creates only e_dir/../a if ./b already
		 exists. */
	      *new_dst = 1;

	      if ((*x->xstat) (src, &stats))
	        {
		  error (0, errno, _("failed to get attributes of %s"),
			 quote (src));
		  return 1;
		}
	      src_mode = stats.st_mode;

	      if (mkdir (dirpath, src_mode))
		{
		  error (0, errno, _("cannot make directory %s"),
			 quote (dirpath));
		  return 1;
		}
	      else
		{
		  if (verbose_fmt_string != NULL)
		    printf (verbose_fmt_string, src, dirpath);
		}

	      /* We need search and write permissions to the new directory
	         for writing the directory's contents. Check if these
		 permissions are there.  */

	      if (lstat (dirpath, &stats))
		{
		  error (0, errno, _("failed to get attributes of %s"),
			 quote (dirpath));
		  return 1;
		}
	      else
	        {
		  if (x->preserve_mode) {
		    new->mode = src_mode;
		    new->mode_valid = (src_mode != stats.st_mode);
		  } else {
		    new->mode = stats.st_mode;
		    new->mode_valid = 0;
		  }

		  if ((stats.st_mode & S_IRWXU) != S_IRWXU)
		    {
		      /* Make the new directory searchable and writable. The
			 original permissions will be restored later.  */

		      new->mode_valid = 1;

		      if (chmod (dirpath, stats.st_mode | S_IRWXU))
			{
			  error (0, errno, _("setting permissions for %s"),
				 quote (dirpath));
			  return 1;
			}
		    }
		}
	    }
	  else if (!S_ISDIR (stats.st_mode))
	    {
	      error (0, 0, _("%s exists but is not a directory"),
		     quote (dirpath));
	      return 1;
	    }
	  else
	    {
	      new->mode_valid = 0;
	      *new_dst = 0;
	    }
	  *slash++ = '/';

	  /* Avoid unnecessary calls to `stat' when given
	     pathnames containing multiple adjacent slashes.  */
	  while (*slash == '/')
	    slash++;
	}
    }

  /* We get here if the parent of `dirpath' already exists. */

  else if (!S_ISDIR (stats.st_mode))
    {
      error (0, 0, _("%s exists but is not a directory"), quote (dst_dirname));
      return 1;
    }
  else
    {
      *new_dst = 0;
    }
  return 0;
}

/* Scan the arguments, and copy each by calling copy.
   Return 0 if successful, 1 if any errors occur. */

static int
do_copy (int n_files, char **file, const char *target_directory,
	 struct cp_options *x)
{
  const char *dest;
  struct stat sb;
  int new_dst = 0;
  int ret = 0;
  int dest_is_dir = 0;

  if (n_files <= 0)
    {
      error (0, 0, _("missing file arguments"));
      usage (EXIT_FAILURE);
    }
  if (n_files == 1 && !target_directory)
    {
      error (0, 0, _("missing destination file"));
      usage (EXIT_FAILURE);
    }

  if (target_directory)
    dest = target_directory;
  else
    {
      dest = file[n_files - 1];
      --n_files;
    }

  /* Initialize these hash tables only if we'll need them.
     The problems they're used to detect can arise only if
     there are two or more files to copy.  */
  if (n_files >= 2)
    {
      dest_info_init (x);
      src_info_init (x);
    }

  if (lstat (dest, &sb))
    {
      if (errno != ENOENT)
	{
	  error (0, errno, _("accessing %s"), quote (dest));
	  return 1;
	}

      new_dst = 1;
    }
  else
    {
      struct stat sbx;

      /* If `dest' is not a symlink to a nonexistent file, use
	 the results of stat instead of lstat, so we can copy files
	 into symlinks to directories. */
      if (stat (dest, &sbx) == 0)
	sb = sbx;

      dest_is_dir = S_ISDIR (sb.st_mode);
    }

  if (!dest_is_dir)
    {
      if (target_directory)
	{
	  error (0, 0, _("%s: specified target is not a directory"),
		 quote (dest));
	  usage (EXIT_FAILURE);
	}

      if (n_files > 1)
	{
	  error (0, 0,
	 _("copying multiple files, but last argument %s is not a directory"),
	     quote (dest));
	  usage (EXIT_FAILURE);
	}
    }

  if (dest_is_dir)
    {
      /* cp file1...filen edir
	 Copy the files `file1' through `filen'
	 to the existing directory `edir'. */
      int i;

      for (i = 0; i < n_files; i++)
	{
	  char *dst_path;
	  int parent_exists = 1; /* True if dir_name (dst_path) exists. */
	  struct dir_attr *attr_list;
	  char *arg_in_concat = NULL;
	  char *arg = file[i];

	  /* Trailing slashes are meaningful (i.e., maybe worth preserving)
	     only in the source file names.  */
	  if (remove_trailing_slashes)
	    strip_trailing_slashes (arg);

	  if (flag_path)
	    {
	      char *arg_no_trailing_slash;

	      /* Use `arg' without trailing slashes in constructing destination
		 file names.  Otherwise, we can end up trying to create a
		 directory via `mkdir ("dst/foo/"...', which is not portable.
		 It fails, due to the trailing slash, on at least
		 NetBSD 1.[34] systems.  */
	      ASSIGN_STRDUPA (arg_no_trailing_slash, arg);
	      strip_trailing_slashes (arg_no_trailing_slash);

	      /* Append all of `arg' (minus any trailing slash) to `dest'.  */
	      dst_path = path_concat (dest, arg_no_trailing_slash,
				      &arg_in_concat);
	      if (dst_path == NULL)
		xalloc_die ();

	      /* For --parents, we have to make sure that the directory
	         dir_name (dst_path) exists.  We may have to create a few
	         leading directories. */
	      parent_exists = !make_path_private (dst_path,
						  arg_in_concat - dst_path,
						  (x->verbose
						   ? "%s -> %s\n" : NULL),
						  &attr_list, &new_dst, x);
	    }
  	  else
  	    {
	      char *arg_base;
	      /* Append the last component of `arg' to `dest'.  */

	      ASSIGN_BASENAME_STRDUPA (arg_base, arg);
	      /* For `cp -R source/.. dest', don't copy into `dest/..'. */
	      dst_path = (STREQ (arg_base, "..")
			  ? xstrdup (dest)
			  : path_concat (dest, arg_base, NULL));
	    }

	  if (!parent_exists)
	    {
	      /* make_path_private failed, so don't even attempt the copy. */
	      ret = 1;
  	    }
	  else
	    {
	      int copy_into_self;
	      ret |= copy (arg, dst_path, new_dst, x, &copy_into_self, NULL);

	      if (flag_path)
		{
		  ret |= re_protect (dst_path, arg_in_concat - dst_path,
				     attr_list, x);
		}
	    }

	  free (dst_path);
	}
      return ret;
    }
  else /* if (n_files == 1) */
    {
      char *new_dest;
      char *source;
      int unused;
      struct stat source_stats;

      if (flag_path)
	{
	  error (0, 0,
	       _("when preserving paths, the destination must be a directory"));
	  usage (EXIT_FAILURE);
	}

      source = file[0];

      /* When the force and backup options have been specified and
	 the source and destination are the same name for an existing
	 regular file, convert the user's command, e.g.,
	 `cp --force --backup foo foo' to `cp --force foo fooSUFFIX'
	 where SUFFIX is determined by any version control options used.  */

      if (x->unlink_dest_after_failed_open
	  && x->backup_type != none
	  && STREQ (source, dest)
	  && !new_dst && S_ISREG (sb.st_mode))
	{
	  static struct cp_options x_tmp;

	  new_dest = find_backup_file_name (dest, x->backup_type);
	  /* Set x->backup_type to `none' so that the normal backup
	     mechanism is not used when performing the actual copy.
	     backup_type must be set to `none' only *after* the above
	     call to find_backup_file_name -- that function uses
	     backup_type to determine the suffix it applies.  */
	  x_tmp = *x;
	  x_tmp.backup_type = none;
	  x = &x_tmp;

	  if (new_dest == NULL)
	    xalloc_die ();
	}

      /* When the destination is specified with a trailing slash and the
	 source exists but is not a directory, convert the user's command
	 `cp source dest/' to `cp source dest/basename(source)'.  Doing

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜亚洲福利老司机| 黄页网站大全一区二区| 日韩av成人高清| 国产成人午夜精品5599| 欧美专区亚洲专区| 欧美激情中文不卡| 日韩影院在线观看| 91视频一区二区| 精品日韩一区二区| 亚洲高清久久久| thepron国产精品| 精品国产91九色蝌蚪| 亚洲福利一二三区| 色综合欧美在线视频区| 国产网红主播福利一区二区| 五月天一区二区| 欧美性大战久久久久久久蜜臀| 国产午夜久久久久| 精品综合久久久久久8888| 欧洲色大大久久| 亚洲欧美日韩系列| 成人国产精品免费观看视频| 久久女同互慰一区二区三区| 日韩电影在线观看网站| 欧美日韩在线电影| 亚洲一区中文日韩| 在线视频欧美区| 一区二区三区色| 色成人在线视频| 亚洲一区二区欧美激情| 91国偷自产一区二区开放时间| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 粗大黑人巨茎大战欧美成人| 精品国产污网站| 九色综合狠狠综合久久| 欧美一区二区精美| 美国精品在线观看| 欧美一激情一区二区三区| 午夜免费欧美电影| 欧美一区二区三区日韩视频| 日韩在线一区二区| 精品少妇一区二区三区视频免付费| 首页国产欧美久久| 日韩欧美一级在线播放| 麻豆国产精品一区二区三区| 欧美一级夜夜爽| 精品一区二区三区在线观看| 精品对白一区国产伦| 国产精一品亚洲二区在线视频| 久久久久久久久久久久久夜| 成人午夜视频免费看| 中文字幕成人av| 日本高清不卡一区| 午夜在线成人av| 91精品国产乱码| 国产精品1区2区| 亚洲欧美一区二区三区孕妇| 欧美日韩国产大片| 国产乱一区二区| 亚洲激情自拍视频| 日韩免费电影一区| 成人精品视频网站| 午夜电影一区二区三区| 久久婷婷综合激情| 99re视频这里只有精品| 欧美精选午夜久久久乱码6080| 中文字幕乱码亚洲精品一区| 色综合久久综合中文综合网| 天天色综合天天| 中文字幕精品一区| 欧美性猛交xxxx黑人交| 国产精品18久久久久久久久久久久 | 日韩制服丝袜av| 久久精品亚洲麻豆av一区二区 | 亚洲乱码精品一二三四区日韩在线| 欧美日韩亚洲另类| 丁香六月久久综合狠狠色| 亚洲一区国产视频| 国产欧美一区二区三区在线老狼| 欧美丝袜自拍制服另类| 国产成人精品免费| 亚洲bt欧美bt精品777| 久久精品人人做人人综合| 成人av集中营| 国内久久婷婷综合| 亚洲嫩草精品久久| 欧美日韩不卡一区二区| 国产在线精品一区二区| 久久久久久久久久久久电影| 欧美揉bbbbb揉bbbbb| 国产精品自拍三区| 亚洲乱码中文字幕| 久久综合99re88久久爱| 91国产免费观看| 九色|91porny| 亚洲欧美激情插| 国产精品区一区二区三| 欧美一区二区三区四区久久 | 亚洲欧洲成人精品av97| 在线播放国产精品二区一二区四区| 韩国av一区二区三区四区| 国产精品久久国产精麻豆99网站| 欧美福利电影网| www.综合网.com| 青椒成人免费视频| 亚洲精品日韩一| 久久久亚洲精品一区二区三区 | 中文字幕精品一区| 欧美老年两性高潮| 欧美视频你懂的| 99天天综合性| 国产激情一区二区三区桃花岛亚洲| 亚洲乱码国产乱码精品精98午夜 | 97精品电影院| 丁香天五香天堂综合| 免费成人av资源网| 亚洲高清三级视频| 亚洲欧美日韩一区二区 | 国产v日产∨综合v精品视频| 日日夜夜免费精品视频| 专区另类欧美日韩| 国产三级一区二区三区| 欧美一区二区三区小说| 欧美老肥妇做.爰bbww视频| 国产精品一区二区无线| 奇米亚洲午夜久久精品| 亚洲第四色夜色| 一区二区三区四区视频精品免费| 日本一区二区三区国色天香| 精品伦理精品一区| 日韩一二三区视频| 欧美日韩免费在线视频| 欧美一区二区三区在线电影| 在线电影欧美成精品| 欧美丝袜丝nylons| 欧美人狂配大交3d怪物一区| 91精品1区2区| 欧美日韩综合色| 精品美女一区二区| 91精品婷婷国产综合久久| 欧美色爱综合网| 4438亚洲最大| 日韩色视频在线观看| 日韩午夜在线观看视频| 国产午夜精品福利| 中文字幕亚洲精品在线观看| 亚洲视频一二三| 亚洲一区二区视频在线观看| 亚洲影院理伦片| 婷婷丁香久久五月婷婷| 国内精品伊人久久久久av影院 | 丁香亚洲综合激情啪啪综合| 在线这里只有精品| 在线观看91av| 久久天堂av综合合色蜜桃网| 久久亚洲一级片| 国产精品久久国产精麻豆99网站| 最新国产の精品合集bt伙计| 日韩电影在线免费看| 国产麻豆成人传媒免费观看| 成人丝袜高跟foot| 色综合中文字幕国产| 色欧美88888久久久久久影院| 欧美伊人精品成人久久综合97| 欧美日韩亚洲国产综合| 久久久久久久久久久久久久久99| 国产精品毛片无遮挡高清| 亚洲午夜视频在线| 精品亚洲porn| 99精品久久久久久| 在线欧美日韩国产| 国产日韩精品一区二区三区在线| 亚洲卡通欧美制服中文| 日韩av一区二区三区四区| 成人深夜福利app| 欧美日韩成人综合在线一区二区| 久久精品亚洲麻豆av一区二区 | 日韩女优制服丝袜电影| 自拍偷拍欧美激情| 免费在线视频一区| 欧美日韩一区二区在线观看视频| 日韩欧美卡一卡二| 亚洲精品免费看| 久久99久久99| 欧美午夜电影在线播放| 亚洲欧美激情小说另类| 国产一区二区三区高清播放| 在线观看国产91| 国产三级三级三级精品8ⅰ区| 亚洲国产中文字幕在线视频综合| 国产精品亚洲视频| 欧美美女网站色| 亚洲色图在线播放| 激情成人综合网| 欧美精品色综合| 中文字幕一区二区三区av| 高清国产一区二区三区| 欧美刺激午夜性久久久久久久| 亚洲精品乱码久久久久久| 国产成人午夜精品5599|