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

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

?? touch.c

?? 《Linux應用開發(fā)技術(shù)詳解》附書光盤中的例程。
?? C
字號:
/* touch -- change modification and access times of files   Copyright (C) 87, 1989-1991, 1995-2002 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 2, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  *//* Written by Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie,   and Randy Smith. */#include <config.h>#include <stdio.h>#include <getopt.h>#include <sys/types.h>#include "system.h"#include "argmatch.h"#include "error.h"#include "getdate.h"#include "posixtm.h"#include "posixver.h"#include "quote.h"#include "safe-read.h"/* The official name of this program (e.g., no `g' prefix).  */#define PROGRAM_NAME "touch"#define AUTHORS \N_ ("Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie, and Randy Smith")#ifndef STDC_HEADERStime_t time ();#endif/* Bitmasks for `change_times'. */#define CH_ATIME 1#define CH_MTIME 2#if !defined O_NDELAY# define O_NDELAY 0#endif#if !defined O_NONBLOCK# define O_NONBLOCK O_NDELAY#endif#if !defined O_NOCTTY# define O_NOCTTY 0#endif#if !defined EISDIR# define EISDIR 0#endif/* The name by which this program was run. */char *program_name;/* Which timestamps to change. */static int change_times;/* (-c) If nonzero, don't create if not already there. */static int no_create;/* (-d) If nonzero, date supplied on command line in get_date formats. */static int flexible_date;/* (-r) If nonzero, use times from a reference file. */static int use_ref;/* (-t) If nonzero, date supplied on command line in POSIX format. */static int posix_date;/* If nonzero, the only thing we have to do is change both the   modification and access time to the current time, so we don't   have to own the file, just be able to read and write it.   On some systems, we can do this if we own the file, even though   we have neither read nor write access to it.  */static int amtime_now;/* New time to use when setting time. */static time_t newtime;/* Time modifier, allowing to "make file x 10 seconds older than file y" */static int time_modifier = 0;/* File to use for -r. */static char *ref_file;/* Info about the reference file. */static struct stat ref_stats;/* For long options that have no equivalent short option, use a   non-character as a pseudo short option, starting with CHAR_MAX + 1.  */enum{  TIME_OPTION = CHAR_MAX + 1};static struct option const longopts[] ={  {"time", required_argument, 0, TIME_OPTION},  {"no-create", no_argument, 0, 'c'},  {"date", required_argument, 0, 'd'},  {"file", required_argument, 0, 'r'}, /* FIXME: phase out --file */  {"forward", required_argument, 0, 'F'},  {"backward", required_argument, 0, 'B'},  {"reference", required_argument, 0, 'r'},  {GETOPT_HELP_OPTION_DECL},  {GETOPT_VERSION_OPTION_DECL},  {0, 0, 0, 0}};/* Valid arguments to the `--time' option. */static char const* const time_args[] ={  "atime", "access", "use", "mtime", "modify", 0};/* The bits in `change_times' that those arguments set. */static int const time_masks[] ={  CH_ATIME, CH_ATIME, CH_ATIME, CH_MTIME, CH_MTIME};/* Update the time of file FILE according to the options given.   Return 0 if successful, 1 if an error occurs. */static inttouch (const char *file){  int status;  struct stat sbuf;  int fd = -1;  int open_errno = 0;  if (! no_create)    {      /* Try to open FILE, creating it if necessary.  */      fd = open (file, O_WRONLY | O_CREAT | O_NONBLOCK | O_NOCTTY,		 S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);      /* Don't save a copy of errno if it's EISDIR, since that would lead	 touch to give a bogus diagnostic for e.g., `touch /' (assuming	 we don't own / or have write access to it).  On Solaris 5.6,	 and probably other systems, it is EINVAL.  On SunOS4, it's EPERM.  */      if (fd == -1 && errno != EISDIR && errno != EINVAL && errno != EPERM)	open_errno = errno;    }  if (! amtime_now)    {      /* We're setting only one of the time values.  stat the target to get	 the other one.  If we have the file descriptor already, use fstat.	 Otherwise, either we're in no-create mode (and hence didn't call open)	 or FILE is inaccessible or a directory, so we have to use stat.  */      if (fd != -1 ? fstat (fd, &sbuf) : stat (file, &sbuf))	{	  if (open_errno)	    error (0, open_errno, _("creating %s"), quote (file));	  else	    {	      if (no_create && errno == ENOENT)		return 0;	      error (0, errno, _("failed to get attributes of %s"),		     quote (file));	    }	  close (fd);	  return 1;	}    }  if (fd != -1 && close (fd) < 0)    {      error (0, errno, _("creating %s"), quote (file));      return 1;    }  if (amtime_now)    {      if (time_modifier == 0)	{          /* Pass NULL to utime so it will not fail if we just have	  write access to the file, but don't own it.  */          status = utime (file, NULL);	}      else	{	  struct utimbuf t;	  t.actime = time(NULL) + time_modifier;	  t.modtime = time(NULL) + time_modifier;	  status = utime (file, &t);	}    }  else    {      struct utimbuf utb;      /* There's currently no interface to set file timestamps with	 better than 1-second resolution, so discard any fractional	 part of the source timestamp.  */      if (use_ref)	{	  utb.actime = ref_stats.st_atime + time_modifier;	  utb.modtime = ref_stats.st_mtime + time_modifier;	}      else	utb.actime = utb.modtime = newtime;      if (!(change_times & CH_ATIME))	utb.actime = sbuf.st_atime + time_modifier;      if (!(change_times & CH_MTIME))	utb.modtime = sbuf.st_mtime + time_modifier;      status = utime (file, &utb);    }  if (status)    {      if (open_errno && open_errno != EISDIR)	error (0, open_errno, _("creating %s"), quote (file));      else	{	  if (no_create && errno == ENOENT)	    return 0;	  error (0, errno, _("setting times of %s"), quote (file));	}      return 1;    }  return 0;}voidusage (int status){  if (status != 0)    fprintf (stderr, _("Try `%s --help' for more information.\n"),	     program_name);  else    {      printf (_("Usage: %s [OPTION]... FILE...\n"), program_name);      fputs (_("\Update the access and modification times of each FILE to the current time.\n\\n\"), stdout);      fputs (_("\Mandatory arguments to long options are mandatory for short options too.\n\"), stdout);      fputs (_("\  -a                     change only the access time\n\  -B SEC, --backward=SEC date back SEC seconds\n\  -c, --no-create        do not create any files\n\  -d, --date=STRING      parse STRING and use it instead of current time\n\  -F SEC, --forward=SEC  date forward SEC seconds\n\  -f                     (ignored)\n\  -m                     change only the modification time\n\"), stdout);      fputs (_("\  -r, --reference=FILE   use this file's times instead of current time\n\  -t STAMP               use [[CC]YY]MMDDhhmm[.ss] instead of current time\n\  --time=WORD            set time given by WORD: access atime use (same as -a)\n\                           modify mtime (same as -m)\n\"), stdout);      fputs (HELP_OPTION_DESCRIPTION, stdout);      fputs (VERSION_OPTION_DESCRIPTION, stdout);      fputs (_("\\n\Note that the -d and -t options accept different time-date formats.\n\"), stdout);      printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);    }  exit (status);}intmain (int argc, char **argv){  int c;  int date_set = 0;  int err = 0;  program_name = argv[0];  setlocale (LC_ALL, "");  bindtextdomain (PACKAGE, LOCALEDIR);  textdomain (PACKAGE);  atexit (close_stdout);  change_times = no_create = use_ref = posix_date = flexible_date = 0;  while ((c = getopt_long (argc, argv, "B:F:acd:fmr:t:", longopts, NULL)) != -1)    {      switch (c)	{	case 0:	  break;	case 'B':	  time_modifier = -atoi(optarg);	  break;	case 'F':	  time_modifier = atoi(optarg);	  break;	case 'a':	  change_times |= CH_ATIME;	  break;	case 'c':	  no_create++;	  break;	case 'd':	  flexible_date++;	  newtime = get_date (optarg, NULL);	  if (newtime == (time_t) -1)	    error (EXIT_FAILURE, 0, _("invalid date format %s"), quote (optarg));	  date_set++;	  break;	case 'f':	  break;	case 'm':	  change_times |= CH_MTIME;	  break;	case 'r':	  use_ref++;	  ref_file = optarg;	  break;	case 't':	  posix_date++;	  if (! posixtime (&newtime, optarg,			   PDS_LEADING_YEAR | PDS_CENTURY | PDS_SECONDS))	    error (EXIT_FAILURE, 0, _("invalid date format %s"), quote (optarg));	  date_set++;	  break;	case TIME_OPTION:	/* --time */	  change_times |= XARGMATCH ("--time", optarg,				     time_args, time_masks);	  break;	case_GETOPT_HELP_CHAR;	case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);	default:	  usage (EXIT_FAILURE);	}    }  if (change_times == 0)    change_times = CH_ATIME | CH_MTIME;  if ((use_ref && (posix_date || flexible_date))      || (posix_date && flexible_date))    {      error (0, 0, _("cannot specify times from more than one source"));      usage (EXIT_FAILURE);    }  if (use_ref)    {      if (stat (ref_file, &ref_stats))	error (EXIT_FAILURE, errno,	       _("failed to get attributes of %s"), quote (ref_file));      date_set++;    }  /* The obsolete `MMDDhhmm[YY]' form is valid IFF there are     two or more non-option arguments.  */  if (!date_set && 2 <= argc - optind && !STREQ (argv[optind - 1], "--")      && (posix2_version () < 200112 || !getenv ("POSIXLY_CORRECT")))    {      if (posixtime (&newtime, argv[optind], PDS_TRAILING_YEAR))	{	  if (! getenv ("POSIXLY_CORRECT"))	    {	      struct tm const *tm = localtime (&newtime);	      error (0, 0,		     _("warning: `touch %s' is obsolete; use\ `touch -t %04d%02d%02d%02d%02d.%02d'"),		     argv[optind],		     tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,		     tm->tm_hour, tm->tm_min, tm->tm_sec);	    }	  optind++;	  date_set++;	}    }  if (!date_set)    {      if ((change_times & (CH_ATIME | CH_MTIME)) == (CH_ATIME | CH_MTIME))	amtime_now = 1;      else	time (&newtime);    }  if (optind == argc)    {      error (0, 0, _("file arguments missing"));      usage (EXIT_FAILURE);    }  for (; optind < argc; ++optind)    err += touch (argv[optind]);  exit (err != 0);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91视频在线看| 国产在线一区观看| 91国偷自产一区二区开放时间| 亚洲制服丝袜一区| 在线观看亚洲一区| 偷拍亚洲欧洲综合| 欧美精品一二三区| 久久精品国产亚洲一区二区三区| 国产精品一区免费在线观看| 精品日韩av一区二区| 国产成人综合在线| 亚洲欧美综合另类在线卡通| 日本精品视频一区二区三区| 青青草91视频| 国产精品嫩草99a| 欧美日韩一区国产| 国产在线麻豆精品观看| 中文字幕日韩av资源站| 欧美午夜理伦三级在线观看| 精品综合久久久久久8888| 欧美国产亚洲另类动漫| 欧美三级乱人伦电影| 久久99精品久久久久久久久久久久 | 亚洲一级二级在线| 69精品人人人人| 国产激情一区二区三区四区 | 首页国产欧美日韩丝袜| 久久久青草青青国产亚洲免观| 最新热久久免费视频| 色94色欧美sute亚洲线路一久| 久久人人爽人人爽| 色狠狠一区二区三区香蕉| 免费看黄色91| 综合久久久久综合| 精品少妇一区二区三区免费观看 | 三级不卡在线观看| 中文一区二区完整视频在线观看| 免费观看91视频大全| 欧美韩国日本综合| 欧美一级日韩不卡播放免费| 99vv1com这只有精品| 久久精品国产精品亚洲红杏 | 久久精品国产99国产精品| 中文一区二区在线观看| 4438x亚洲最大成人网| 色婷婷综合中文久久一本| 国内外成人在线| 免费观看在线综合色| 亚洲一区在线视频观看| 国产精品无圣光一区二区| 日韩欧美综合在线| 在线观看91视频| 91亚洲精品久久久蜜桃网站| 国产麻豆成人精品| 免费观看成人av| 日韩高清一区二区| 亚洲一区二区三区国产| 亚洲另类色综合网站| 中文一区在线播放| 国产免费观看久久| 久久久一区二区| 精品久久久久久久久久久久久久久久久 | 激情文学综合丁香| 日韩专区欧美专区| 亚洲国产一区二区在线播放| 中文在线免费一区三区高中清不卡 | 综合自拍亚洲综合图不卡区| 国产午夜三级一区二区三| 欧美大度的电影原声| 欧美一区二区三区四区高清| 欧美高清hd18日本| 欧美日本免费一区二区三区| 91久久香蕉国产日韩欧美9色| 亚洲三级电影全部在线观看高清| 欧美一a一片一级一片| 99久久777色| 99精品黄色片免费大全| 成人精品gif动图一区| 国产精品91xxx| 国产成人av电影免费在线观看| 亚洲欧美日韩国产手机在线 | 色婷婷av一区二区三区软件 | 久久亚洲影视婷婷| xvideos.蜜桃一区二区| 精品国产91九色蝌蚪| 久久久久久久久免费| 久久久久久一级片| 国产精品成人免费在线| 综合欧美亚洲日本| 亚洲福利视频一区| 男女男精品网站| 国产精品一区一区| 99精品国产视频| 欧美人伦禁忌dvd放荡欲情| 欧美一级一级性生活免费录像| aaa国产一区| 欧美日韩视频在线一区二区| 欧美精品日日鲁夜夜添| 精品成人a区在线观看| 国产精品久久久久久久久免费樱桃 | 日本精品免费观看高清观看| 欧美精品乱人伦久久久久久| 日韩欧美在线不卡| 中文字幕精品一区二区三区精品| 欧美日本乱大交xxxxx| 2023国产精品视频| 中文字幕日本乱码精品影院| 丝袜美腿成人在线| 国产精品自拍网站| 在线观看91视频| 精品国产一区二区在线观看| 亚洲欧洲日产国产综合网| 日本不卡一区二区三区高清视频| 亚洲国产另类av| 国产精品1区2区3区在线观看| 五月婷婷激情综合网| 久久国产精品第一页| 91影院在线观看| 精品成人一区二区三区四区| 亚洲精品自拍动漫在线| 蜜桃视频在线一区| 91在线高清观看| 精品sm捆绑视频| 亚洲综合在线五月| 国产69精品久久99不卡| 欧美久久久久久久久中文字幕| 在线观看国产日韩| 欧美激情一区不卡| 男女激情视频一区| 在线看不卡av| 国产精品美女久久久久aⅴ国产馆| 久久久久久久久久久电影| 亚洲18女电影在线观看| 不卡一区二区中文字幕| 日韩午夜在线观看| 亚洲国产视频一区二区| 国产成人精品免费| 日韩一区二区在线免费观看| 一区二区三区日韩在线观看| 国产黄色精品网站| 精品奇米国产一区二区三区| 午夜精品久久一牛影视| 91黄视频在线观看| 国产精品网站在线播放| 国产福利精品导航| 精品欧美久久久| 老司机一区二区| 6080yy午夜一二三区久久| 亚洲综合色成人| 色综合天天综合色综合av| 国产精品国产三级国产有无不卡 | 日产国产高清一区二区三区| 成人国产精品视频| 精品捆绑美女sm三区| 久久国产精品99久久久久久老狼| 国产成人超碰人人澡人人澡| 精品国产乱码91久久久久久网站| 国产香蕉久久精品综合网| 国产制服丝袜一区| 精品福利一二区| 久久国产精品72免费观看| 欧美一级免费大片| 视频一区二区国产| 91精品婷婷国产综合久久竹菊| 国产日韩成人精品| 国产成人在线视频网站| 欧美精品一区二区高清在线观看 | 黄一区二区三区| 宅男噜噜噜66一区二区66| 日韩精品乱码av一区二区| 欧美一区二区三区视频免费播放| 久久综合久久鬼色| 国产一区二区三区美女| 欧美精品一区二区三区蜜桃视频| 亚洲天堂免费看| 99热精品国产| 亚洲一区二区三区精品在线| 欧美人牲a欧美精品| 蜜臀av一级做a爰片久久| 精品少妇一区二区三区日产乱码 | 久久你懂得1024| 国产精品18久久久久久久久久久久 | 午夜精品久久久久久久久久久 | 亚洲一二三区不卡| 7878成人国产在线观看| 久久99这里只有精品| 国产午夜精品久久久久久免费视 | 午夜激情综合网| 日韩午夜激情视频| 国产一本一道久久香蕉| 国产性做久久久久久| 91老司机福利 在线| 午夜视频一区二区三区| 久久中文娱乐网| 成人av电影免费在线播放| 亚洲国产乱码最新视频 | 日韩av网站免费在线| 久久综合av免费| 99久久国产免费看| 日本亚洲欧美天堂免费|