Beispiel #1
0
int
copy (const char *src_path, const char *dst_path,
      int nonexistent_dst, const struct cp_options *options,
      int *copy_into_self, int *rename_succeeded)
{
  assert (valid_options (options));

  /* Record the file names: they're used in case of error, when copying
     a directory into itself.  I don't like to make these tools do *any*
     extra work in the common case when that work is solely to handle
     exceptional cases, but in this case, I don't see a way to derive the
     top level source and destination directory names where they're used.
     An alternative is to use COPY_INTO_SELF and print the diagnostic
     from every caller -- but I don't want to do that.  */
  top_level_src_path = src_path;
  top_level_dst_path = dst_path;

  return copy_internal (src_path, dst_path, nonexistent_dst, 0, NULL,
			options, 1, copy_into_self, rename_succeeded);
}
Beispiel #2
0
int			check_options(char **argv, t_options **options)
{
	int			i;
	char		*str;

	i = 1;
	if (argv[1][0] == '-' && ft_isdigit(argv[1][1]) == 0)
	{
		while (argv[1][i])
		{
			if ((str = ft_strchr(OPTIONS, argv[1][i])) != NULL)
			{
				if (valid_options(str, options) == 0)
					return (0);
				i++;
			}
		}
	}
	else
		return (0);
	return (1);
}