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

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

?? mv.c

?? HLPDK V10.0+ System Extension Library
?? C
字號:
/* mv -- move or rename files
   Copyright (C) 1986, 1989, 1990 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 1, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
/* MS-DOS port (c) 1990 by Thorsten Ohl, ohl@gnu.ai.mit.edu
   This port is also distributed under the terms of the
   GNU General Public License as published by the
   Free Software Foundation.

   Please note that this file is not identical to the
   original GNU release, you should have received this
   code as patch to the official release.  */

#ifdef MSDOS
static char RCS_Id[] =
  "$Header: e:/gnu/fileutil/RCS/mv.c 1.4.0.2 90/09/19 12:11:15 tho Exp $";

static char Program_Id[] = "mv";
static char RCS_Revision[] = "$Revision: 1.4.0.2 $";

#define VERSION \
  "GNU %s, Version %.*s (compiled %s %s for MS-DOS)\n", Program_Id, \
  (sizeof RCS_Revision - 14), (RCS_Revision + 11), __DATE__, __TIME__

#define COPYING \
  "This is free software, distributed under the terms of the\n" \
  "GNU General Public License.  For details, see the file COPYING.\n"
#endif /* MSDOS */

/* Options:
   -f, +force		Assume a 'y' answer to all questions it would
			normally ask, and not ask the questions.

   -i, +interactive	Require confirmation from the user before
			performing any move that would destroy an
			existing file. 

   -u, +update		Do not move a nondirectory that has an
			existing destination with the same or newer
			modification time.  

   -v, +verbose		List the name of each file as it is moved, and
			the name it is moved to. 

   -b, +backup
   -S, +suffix
   -V, +version-control
			Backup file creation.  See README.

   Written by Mike Parker and David MacKenzie */

#include <stdio.h>
#include <getopt.h>
#include <errno.h>
#include <sys/types.h>
#include "system.h"
#include "backupfile.h"

#ifdef STDC_HEADERS
#include <stdlib.h>
#else
char *getenv ();

extern int errno;
#endif

#ifdef MSDOS

#include <io.h>
#include <gnulib.h>

extern  void main (int argc, char **argv);
extern  void error (int status, int errnum, char *message, ...);
extern  int eaccess_stat (struct stat *statp, int mode);
extern  enum backup_type get_version (char *version);
static  int isdir (char *fn);
static  int movefile (char *from, char *to);
static  int do_move (char *from, char *to);
static  int copy (char *from, char *to);
static  int yesno (void );
static  void strip_trailing_slashes (char **path);
static  int force_unlink (char *filename);
static  void usage (void );

#define unlink(name)		force_unlink (name)
#define rename(from, to)	(unlink (to) || rename (from, to))
#define strip_trailing_slashes(path)	strip_trailing_slashes (&path)

#else /* not MSDOS */

enum backup_type get_version ();
int copy ();
int do_move ();
int isdir ();
int movefile ();
int yesno ();
void error ();
void strip_trailing_slashes ();
void usage ();

#endif /* not MSDOS */

/* The name this program was run with. */
char *program_name;

/* If nonzero, query the user before overwriting files. */
int interactive;

/* If nonzero, do not move a nondirectory that has an existing destination
   with the same or newer modification time. */
int update = 0;

/* If nonzero, list each file as it is moved. */
int verbose;

struct option long_options[] =
{
#ifdef MSDOS
  {"copying", 0, NULL, 30},
  {"version", 0, NULL, 31},
#endif
  {"backup", 0, NULL, 'b'},
  {"force", 0, NULL, 'f'},
  {"interactive", 0, NULL, 'i'},
  {"suffix", 1, NULL, 'S'},
  {"update", 0, &update, 1},
  {"verbose", 0, &verbose, 1},
  {"version-control", 1, NULL, 'V'},
  {NULL, 0, NULL, 0}
};

void
main (argc, argv)
     int argc;
     char **argv;
{
  int c;
  int ind;
  int errors;
  int make_backups = 0;
  char *version;

  version = getenv ("SIMPLE_BACKUP_SUFFIX");
  if (version)
    simple_backup_suffix = version;
  version = getenv ("VERSION_CONTROL");
  program_name = argv[0];
  interactive = verbose = update = 0;
  errors = 0;

  while ((c = getopt_long (argc, argv, "bfiuvS:V:", long_options, &ind))
	 != EOF)
    {
      switch (c)
	{
	case 0:
	  break;
	case 'b':
	  make_backups = 1;
	  break;
	case 'f':
	  interactive = 0;
	  break;
	case 'i':
	  interactive = 1;
	  break;
	case 'u':
	  update = 1;
	  break;
	case 'v':
	  verbose = 1;
	  break;
	case 'S':
	  simple_backup_suffix = optarg;
	  break;
	case 'V':
	  version = optarg;
	  break;
#ifdef MSDOS
	case 30:
	  fprintf (stderr, COPYING);
	  exit (0);
	  break;
	case 31:
	  fprintf (stderr, VERSION);
	  exit (0);
	  break;
#endif
	default:
	  usage ();
	}
    }
  if (argc < optind + 2)
    usage ();

  if (make_backups)
    backup_type = get_version (version);

  strip_trailing_slashes (argv[argc - 1]);

  if (argc > optind + 2 && !isdir (argv[argc - 1]))
    error (1, 0, "when moving multiple files, last argument must be a directory");

  /* Move each arg but the last onto the last. */
  for (; optind < argc - 1; ++optind)
    errors |= movefile (argv[optind], argv[argc - 1]);

  exit (errors);
}

/* Move file FROM onto TO.  Handles the case when TO is a directory.
   Return 0 if successful, 1 if an error occurred.  */

int
movefile (from, to)
     char *from;
     char *to;
{
  strip_trailing_slashes (from);
  if (isdir (to))
    {
      /* Target is a directory; build full target filename. */
      char *cp;
      char *newto;

      cp = rindex (from, '/');
      if (cp)
	cp++;
      else
	cp = from;

      newto = (char *) alloca (strlen (to) + 1 + strlen (cp) + 1);
#ifdef MSDOS
      /* Here a trailing slash might still be present (needed for
	 stat()'ing root directories), take care of that. */
      if (to[strlen(to) - 1] == '/')
	sprintf (newto, "%s%s", to, cp);
      else
#endif /* MSDOS */
      sprintf (newto, "%s/%s", to, cp);
      return do_move (from, newto);
    }
  else
    return do_move (from, to);
}

struct stat to_stats, from_stats;

/* Move FROM onto TO.  Handles cross-filesystem moves.
   If TO is a directory, FROM must be also.
   Return 0 if successful, 1 if an error occurred.  */

int
do_move (from, to)
     char *from;
     char *to;
{
  char *to_backup = NULL;

  if (lstat (from, &from_stats) != 0)
    {
      error (0, errno, "%s", from);
      return 1;
    }

  if (lstat (to, &to_stats) == 0)
    {
#ifdef MSDOS
      if (strcmp (to, from) == 0)
	{
	  error (0, 0, "`%s': can't move file to itself", from);
	  return 1;
	}
#else /* not MSDOS */
      if (from_stats.st_dev == to_stats.st_dev
	  && from_stats.st_ino == to_stats.st_ino)
	{
	  error (0, 0, "`%s' and `%s' are the same file", from, to);
	  return 1;
	}
#endif /* not MSDOS */

      if ((to_stats.st_mode & S_IFMT) == S_IFDIR)
	{
	  error (0, 0, "%s: cannot overwrite directory", to);
	  return 1;
	}

      if ((from_stats.st_mode & S_IFMT) != S_IFDIR && update
	  && from_stats.st_mtime <= to_stats.st_mtime)
	return 0;

      if (interactive)
	{
	  fprintf (stderr, "%s: replace `%s'? ", program_name, to);
	  if (!yesno ())
	    return 0;
	}

      if (backup_type != none)
	{
	  to_backup = find_backup_file_name (to);
	  if (to_backup == NULL)
	    error (1, 0, "virtual memory exhausted");
	  if (rename (to, to_backup))
	    {
	      if (errno != ENOENT)
		{
		  error (0, errno, "cannot backup `%s'", to);
		  free (to_backup);
		  return 1;
		}
	      else
		{
		  free (to_backup);
		  to_backup = NULL;
		}
	    }
	}
    }
  else if (errno != ENOENT)
    {
      error (0, errno, "%s", to);
      return 1;
    }

  if (verbose)
    printf ("%s -> %s\n", from, to);

  if (rename (from, to) == 0)
    {
      if (to_backup)
	free (to_backup);
      return 0;
    }

  if (errno != EXDEV)
    {
      error (0, errno, "cannot move `%s' to `%s'", from, to);
      goto un_backup;
    }

  /* rename failed on cross-filesystem link.  Copy the file instead. */

  if (copy (from, to))
    goto un_backup;
  
  if (to_backup)
    free (to_backup);

  if (unlink (from))
    {
      error (0, errno, "cannot remove `%s'", from);
      return 1;
    }

  return 0;

 un_backup:
  if (to_backup)
    {
      if (rename (to_backup, to))
	error (0, errno, "cannot un-backup `%s'", to);
      free (to_backup);
    }
  return 1;
}

/* Copy file FROM onto file TO.
   Return 1 if an error occurred, 0 if successful. */

int
copy (from, to)
     char *from, *to;
{
  int ifd;
  int ofd;
  char buf[1024 * 8];
  int len;			/* Number of bytes read into `buf'. */
  
  if ((from_stats.st_mode & S_IFMT) != S_IFREG)
    {
      error (0, 0, "cannot move `%s' across filesystems: Not a regular file",
	     from);
      return 1;
    }
  
  if (unlink (to) && errno != ENOENT)
    {
      error (0, errno, "cannot remove `%s'", to);
      return 1;
    }

#ifdef MSDOS
  ifd = open (from, O_RDONLY | O_BINARY, 0);
#else /* not MSDOS */
  ifd = open (from, O_RDONLY, 0);
#endif /* not MSDOS */
  if (ifd < 0)
    {
      error (0, errno, "%s", from);
      return 1;
    }

#ifdef MSDOS
  ofd = open (to, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0777);
#else /* not MSDOS */
  ofd = open (to, O_WRONLY | O_CREAT | O_TRUNC, 0777);
#endif /* not MSDOS */
  if (ofd < 0)
    {
      error (0, errno, "%s", to);
      close (ifd);
      return 1;
    }
  if (
#ifdef FCHMOD_MISSING
      chmod (to, from_stats.st_mode & 0777)
#else
      fchmod (ofd, from_stats.st_mode & 0777)
#endif
      )
      {
	error (0, errno, "%s", to);
	close (ifd);
	close (ofd);
	unlink (to);
	return 1;
      }
  
  while ((len = read (ifd, buf, sizeof (buf))) > 0)
    {
      int wrote = 0;
      char *bp = buf;
      
      do
	{
	  wrote = write (ofd, bp, len);
	  if (wrote < 0)
	    {
	      error (0, errno, "%s", to);
	      close (ifd);
	      close (ofd);
	      unlink (to);
	      return 1;
	    }
	  bp += wrote;
	  len -= wrote;
	} while (len > 0);
    }
  if (len < 0)
    {
      error (0, errno, "%s", from);
      close (ifd);
      close (ofd);
      unlink (to);
      return 1;
    }
  close (ifd);
  close (ofd);
  
  /* Try to copy the old file's modtime and access time.  */
  {
    struct utimbuf tv;

    tv.actime = from_stats.st_atime;
    tv.modtime = from_stats.st_mtime;
    if (utime (to, &tv))
      {
	error (0, errno, "%s", to);
	return 1;
      }
  }
  return 0;
}

/* Read one line from standard input
   and return nonzero if that line begins with y or Y,
   otherwise return 0. */

int
yesno ()
{
  int c;
  int rv;

  fflush (stderr);
  c = getchar ();
  rv = (c == 'y') || (c == 'Y');
  while (c != EOF && c != '\n')
    c = getchar ();

  return rv;
}

/* Return nonzero if FN is a directory or a symlink to a directory,
   zero if not. */

int
isdir (fn)
     char *fn;
{
  struct stat stats;

  return (stat (fn, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR);
}

/* Remove trailing slashes from PATH. */


#ifdef MSDOS
#undef strip_trailing_slashes

void
strip_trailing_slashes (char **path)
{
  char *new_path = _fullpath (NULL, *path, 0);
  free (*path);
  *path = msdos_format_filename (new_path);
}

#else /* not MSDOS */

void
strip_trailing_slashes (path)
     char *path;
{
  int last;

  last = strlen (path) - 1;
  while (last > 0 && path[last] == '/')
    path[last--] = '\0';
}

#endif /* not MSDOS */

void
usage ()
{
#ifdef MSDOS
  fprintf (stderr, "\
Usage: %s [-bfiuv] [-S backup-suffix] [-V {numbered,existing,simple}]\n\
       [+backup] [+force] [+interactive] [+update] [+verbose]\n\
       [+suffix backup-suffix] [+version-control {numbered,existing,simple}]\n\
       [+copying] [+version] source dest\n\
\n\
       %s [-bfiuv] [-S backup-suffix] [-V {numbered,existing,simple}]\n\
       [+backup] [+force] [+interactive] [+update] [+verbose]\n\
       [+suffix backup-suffix] [+version-control {numbered,existing,simple}]\n\
       [+copying] [+version] source... directory\n",
	   program_name, program_name);
#else /* not MSDOS */
  fprintf (stderr, "\
Usage: %s [-bfiuv] [-S backup-suffix] [-V {numbered,existing,simple}]\n\
       [+backup] [+force] [+interactive] [+update] [+verbose]\n\
       [+suffix backup-suffix] [+version-control {numbered,existing,simple}]\n\
       source dest\n\
\n\
       %s [-bfiuv] [-S backup-suffix] [-V {numbered,existing,simple}]\n\
       [+backup] [+force] [+interactive] [+update] [+verbose]\n\
       [+suffix backup-suffix] [+version-control {numbered,existing,simple}]\n\
       source... directory\n",
	   program_name, program_name);
#endif /* not MSDOS */
  exit (1);
}

#ifdef MSDOS
#undef unlink					/* nasty tricks ... */

int
force_unlink (char *filename)
{
  if (access (filename, 0))	/* file doesn't exist, pretend success */
    return 0;
  else
    {
      if (access (filename, 2)			  /* no write permission */
	  && chmod (filename, S_IREAD|S_IWRITE))  /* can't force it ...  */
	{
	  error (0, errno, "can't force write permission for %s", filename);
	  return -1;
	}
      else
	return unlink (filename);
    }
}
#endif /* MSDOS */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩国产一二三| 国产精品国产三级国产普通话三级 | 欧美高清性hdvideosex| 精品88久久久久88久久久| 中文字幕一区二区三区在线播放| 亚洲gay无套男同| 成人开心网精品视频| 91精品国产黑色紧身裤美女| 最新热久久免费视频| 国产美女av一区二区三区| 欧美日精品一区视频| 中文字幕亚洲区| 麻豆精品在线播放| 精品1区2区3区| 亚洲天堂福利av| 国产馆精品极品| 日韩欧美在线网站| 午夜欧美视频在线观看| 91麻豆国产福利在线观看| 国产网站一区二区| 狠狠色丁香婷婷综合久久片| 欧美高清dvd| 亚洲国产另类av| 色狠狠色狠狠综合| 亚洲女女做受ⅹxx高潮| 国产激情精品久久久第一区二区 | 91精品综合久久久久久| 亚洲色图欧洲色图| 成人aaaa免费全部观看| 国产亚洲美州欧州综合国| 精品一区二区综合| 欧美刺激午夜性久久久久久久| 日本亚洲欧美天堂免费| 欧美顶级少妇做爰| 日韩精品免费专区| 日韩视频免费观看高清完整版| 丝瓜av网站精品一区二区| 欧美三级中文字| 天堂一区二区在线| 3atv在线一区二区三区| 男男视频亚洲欧美| 3d动漫精品啪啪一区二区竹菊| 天堂资源在线中文精品| 欧美精品一二三| 美脚の诱脚舐め脚责91| 欧美精品一区二区三区视频 | 久久综合色婷婷| 国产揄拍国内精品对白| 国产日产欧产精品推荐色| 成人手机在线视频| 亚洲欧美成aⅴ人在线观看| 欧美在线看片a免费观看| 成人av资源在线| 国产精品家庭影院| 一本久道久久综合中文字幕| 亚洲国产美女搞黄色| 日韩欧美国产三级| 国产91丝袜在线观看| 亚洲三级理论片| 欧美一级专区免费大片| 国产精品一二三| 亚洲黄色录像片| 欧美一区二区福利在线| 国产成人亚洲精品狼色在线 | 亚洲制服丝袜av| 91精品国产麻豆| 成人精品在线视频观看| 一区二区三区精品在线观看| 日韩丝袜美女视频| www.亚洲在线| 天堂在线亚洲视频| 国产精品久久久久久久久果冻传媒| 91国产成人在线| 精品一区二区影视| √…a在线天堂一区| 在线播放/欧美激情| 日韩欧美三级在线| 成人白浆超碰人人人人| 日韩国产精品久久久| 中文字幕视频一区二区三区久| 欧美剧在线免费观看网站| 成人做爰69片免费看网站| 亚洲电影一级片| 国产精品毛片久久久久久| 91精选在线观看| 色视频一区二区| 国产一本一道久久香蕉| 午夜天堂影视香蕉久久| 亚洲欧美综合色| 久久久久久久综合| 6080亚洲精品一区二区| 色偷偷一区二区三区| 国产精品亚洲视频| 美日韩一级片在线观看| 一区二区三区欧美亚洲| 国产精品无圣光一区二区| 日韩一级免费观看| 欧美午夜精品一区二区三区| 成人激情视频网站| 精品中文字幕一区二区小辣椒| 亚洲综合男人的天堂| 亚洲欧洲一区二区三区| 91丨九色丨黑人外教| 粗大黑人巨茎大战欧美成人| 激情图区综合网| 理论电影国产精品| 美脚の诱脚舐め脚责91| 日av在线不卡| 蜜桃av一区二区三区| 日韩精品亚洲一区| 日日夜夜一区二区| 亚洲国产精品人人做人人爽| 亚洲精品免费电影| 亚洲男人电影天堂| 亚洲欧美日本韩国| 亚洲激情中文1区| 亚洲精品免费在线| 一区二区三区免费看视频| 一区二区三区在线免费观看| 日韩一区在线播放| 一区二区三区欧美激情| 亚洲午夜在线电影| 亚洲一区二区三区国产| 亚洲一区二区欧美日韩| 午夜伦欧美伦电影理论片| 午夜精品久久久久久久99水蜜桃 | 日韩欧美激情在线| 91精品国产手机| 欧美成人video| 久久综合九色欧美综合狠狠 | 欧美日本在线播放| 91精品久久久久久久91蜜桃| 日韩欧美成人激情| 久久久一区二区三区| 日本一区二区成人在线| 一区在线中文字幕| 亚洲高清免费观看| 美女性感视频久久| 成人永久aaa| 在线欧美小视频| 欧美一区二区精美| 国产欧美日韩中文久久| 亚洲视频在线一区二区| 亚洲风情在线资源站| 国模冰冰炮一区二区| 不卡一区二区在线| 欧美日韩一级视频| 久久久午夜电影| 一区二区久久久| 久久精品理论片| av在线不卡免费看| 在线播放视频一区| 亚洲国产高清aⅴ视频| 亚洲综合免费观看高清完整版在线 | 美女视频网站黄色亚洲| 国v精品久久久网| 在线观看av一区| 精品国产123| 亚洲综合一区二区精品导航| 久久福利资源站| 色噜噜狠狠成人中文综合| 欧美一级片免费看| 成人免费在线播放视频| 美国毛片一区二区三区| 国产精品一卡二| 欧美日韩日日夜夜| 国产精品久久毛片av大全日韩| 日韩精品一级二级 | 激情深爱一区二区| 欧美私人免费视频| 日本一区免费视频| 青青草97国产精品免费观看无弹窗版| 国产乱子伦视频一区二区三区| 欧美日韩中文另类| 最新欧美精品一区二区三区| 久久成人羞羞网站| 欧美日韩亚洲综合在线| 国产精品国产精品国产专区不片| 日本不卡高清视频| 在线观看免费一区| 亚洲图片你懂的| 国产精品综合二区| 欧美电影免费观看完整版 | 亚洲国产激情av| 狠狠色丁香九九婷婷综合五月| 欧美日韩精品一区二区三区蜜桃 | 1000精品久久久久久久久| 激情伊人五月天久久综合| 欧美色涩在线第一页| 亚洲欧美日韩国产中文在线| 粉嫩在线一区二区三区视频| 久久久噜噜噜久久中文字幕色伊伊 | 国产亲近乱来精品视频| 蜜桃传媒麻豆第一区在线观看| 欧美色手机在线观看| 一区二区三区日韩欧美精品| 91在线播放网址| 亚洲视频免费看| 色婷婷精品久久二区二区蜜臀av| 国产精品每日更新|