[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.3 and 1.4

version 1.3, 1997/01/15 23:43:22 version 1.4, 2000/09/20 13:26:55
Line 138 
Line 138 
   
         for (rval = 0; *argv; ++argv) {          for (rval = 0; *argv; ++argv) {
                 /* See if the file exists. */                  /* See if the file exists. */
                 if (stat(*argv, &sb))                  if (stat(*argv, &sb)) {
                         if (!cflag) {                          if (!cflag) {
                                 /* Create the file. */                                  /* Create the file. */
                                 fd = open(*argv,                                  fd = open(*argv,
Line 154 
Line 154 
                                         continue;                                          continue;
                         } else                          } else
                                 continue;                                  continue;
                   }
   
                 if (!aflag)                  if (!aflag)
                         TIMESPEC_TO_TIMEVAL(&tv[0], &sb.st_atimespec);                          TIMESPEC_TO_TIMEVAL(&tv[0], &sb.st_atimespec);
Line 264 
Line 265 
         if ((t = localtime(&tmptime)) == NULL)          if ((t = localtime(&tmptime)) == NULL)
                 err(1, "localtime");                  err(1, "localtime");
   
         t->tm_mon = ATOI2(arg);         /* MMDDhhmm[yy] */          t->tm_mon = ATOI2(arg);         /* MMDDhhmm[YY] */
         --t->tm_mon;                    /* Convert from 01-12 to 00-11 */          --t->tm_mon;                    /* Convert from 01-12 to 00-11 */
         t->tm_mday = ATOI2(arg);          t->tm_mday = ATOI2(arg);
         t->tm_hour = ATOI2(arg);          t->tm_hour = ATOI2(arg);
         t->tm_min = ATOI2(arg);          t->tm_min = ATOI2(arg);
         if (year)          if (year) {
                 t->tm_year = ATOI2(arg);                  t->tm_year = ATOI2(arg);
                   if (t->tm_year < 69)
                           t->tm_year += 100;
           }
   
         t->tm_isdst = -1;               /* Figure out DST. */          t->tm_isdst = -1;               /* Figure out DST. */
         tvp[0].tv_sec = tvp[1].tv_sec = mktime(t);          tvp[0].tv_sec = tvp[1].tv_sec = mktime(t);
         if (tvp[0].tv_sec == -1)          if (tvp[0].tv_sec == -1)
                 errx(1,                  errx(1,
         "out of range or illegal time specification: MMDDhhmm[yy]");          "out of range or illegal time specification: MMDDhhmm[YY]");
   
         tvp[0].tv_usec = tvp[1].tv_usec = 0;          tvp[0].tv_usec = tvp[1].tv_usec = 0;
 }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4