[BACK]Return to touch.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / touch

Diff for /src/usr.bin/touch/touch.c between version 1.12 and 1.13

version 1.12, 2005/04/20 19:16:34 version 1.13, 2006/03/07 11:49:40
Line 30 
Line 30 
  * SUCH DAMAGE.   * SUCH DAMAGE.
  */   */
   
 #ifndef lint  
 static char copyright[] =  
 "@(#) Copyright (c) 1993\n\  
         The Regents of the University of California.  All rights reserved.\n";  
 #endif /* not lint */  
   
 #ifndef lint  
 #if 0  
 static char sccsid[] = "@(#)touch.c     8.2 (Berkeley) 4/28/95";  
 #endif  
 static char rcsid[] = "$OpenBSD$";  
 #endif /* not lint */  
   
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/stat.h>  #include <sys/stat.h>
 #include <sys/time.h>  #include <sys/time.h>
Line 58 
Line 45 
 #include <tzfile.h>  #include <tzfile.h>
 #include <unistd.h>  #include <unistd.h>
   
 void    stime_arg1(char *, struct timeval *);  void            stime_arg1(char *, struct timeval *);
 void    stime_arg2(char *, int, struct timeval *);  void            stime_arg2(char *, int, struct timeval *);
 void    stime_file(char *, struct timeval *);  void            stime_file(char *, struct timeval *);
 void    usage(void);  __dead void     usage(void);
   
 int  int
 main(int argc, char *argv[])  main(int argc, char *argv[])
 {  {
         struct stat sb;          struct   stat sb;
         struct timeval tv[2];          struct   timeval tv[2];
         int aflag, cflag, mflag, ch, fd, len, rval, timeset;          int      aflag, cflag, mflag, ch, fd, len, rval, timeset;
         char *p;          char    *p;
   
         setlocale(LC_ALL, "");          (void)setlocale(LC_ALL, "");
   
         aflag = cflag = mflag = timeset = 0;          aflag = cflag = mflag = timeset = 0;
         if (gettimeofday(&tv[0], NULL))          if (gettimeofday(&tv[0], NULL))
Line 183 
Line 170 
 void  void
 stime_arg1(char *arg, struct timeval *tvp)  stime_arg1(char *arg, struct timeval *tvp)
 {  {
         struct tm *t;          struct tm       *t;
         time_t tmptime;          time_t           tmptime;
         int yearset;          int              yearset;
         char *p;          char            *p;
                                         /* Start with the current time. */                                          /* Start with the current time. */
         tmptime = tvp[0].tv_sec;          tmptime = tvp[0].tv_sec;
         if ((t = localtime(&tmptime)) == NULL)          if ((t = localtime(&tmptime)) == NULL)
Line 242 
Line 229 
 void  void
 stime_arg2(char *arg, int year, struct timeval *tvp)  stime_arg2(char *arg, int year, struct timeval *tvp)
 {  {
         struct tm *t;          struct tm       *t;
         time_t tmptime;          time_t           tmptime;
                                         /* Start with the current time. */                                          /* Start with the current time. */
         tmptime = tvp[0].tv_sec;          tmptime = tvp[0].tv_sec;
         if ((t = localtime(&tmptime)) == NULL)          if ((t = localtime(&tmptime)) == NULL)
Line 275 
Line 262 
 void  void
 stime_file(char *fname, struct timeval *tvp)  stime_file(char *fname, struct timeval *tvp)
 {  {
         struct stat sb;          struct stat     sb;
   
         if (stat(fname, &sb))          if (stat(fname, &sb))
                 err(1, "%s", fname);                  err(1, "%s", fname);
Line 286 
Line 273 
 __dead void  __dead void
 usage(void)  usage(void)
 {  {
           extern char     *__progname;
   
         (void)fprintf(stderr,          (void)fprintf(stderr,
             "usage: touch [-acm] [-r file] [-t time] file ...\n");              "usage: %s [-acm] [-r file] [-t time] file ...\n", __progname);
         exit(1);          exit(1);
 }  }

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13