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

Diff for /src/usr.bin/find/function.c between version 1.16 and 1.17

version 1.16, 1999/10/04 21:26:10 version 1.17, 1999/12/04 22:42:32
Line 134 
Line 134 
  */   */
 #define TIME_CORRECT(p, ttype)                                          \  #define TIME_CORRECT(p, ttype)                                          \
         if ((p)->type == ttype && (p)->flags == F_LESSTHAN)             \          if ((p)->type == ttype && (p)->flags == F_LESSTHAN)             \
                 ++((p)->t_data);                  ++((p)->sec_data);
   
 /*  /*
  * -amin n functions --   * -amin n functions --
Line 150 
Line 150 
         extern time_t now;          extern time_t now;
   
         COMPARE((now - entry->fts_statp->st_atime +          COMPARE((now - entry->fts_statp->st_atime +
             60 - 1) / 60, plan->t_data);              60 - 1) / 60, plan->sec_data);
 }  }
   
 PLAN *  PLAN *
Line 162 
Line 162 
         ftsoptions &= ~FTS_NOSTAT;          ftsoptions &= ~FTS_NOSTAT;
   
         new = palloc(N_AMIN, f_amin);          new = palloc(N_AMIN, f_amin);
         new->t_data = find_parsenum(new, "-amin", arg, NULL);          new->sec_data = find_parsenum(new, "-amin", arg, NULL);
         TIME_CORRECT(new, N_AMIN);          TIME_CORRECT(new, N_AMIN);
         return (new);          return (new);
 }  }
Line 180 
Line 180 
 {  {
   
         COMPARE((now - entry->fts_statp->st_atime +          COMPARE((now - entry->fts_statp->st_atime +
             SECSPERDAY - 1) / SECSPERDAY, plan->t_data);              SECSPERDAY - 1) / SECSPERDAY, plan->sec_data);
 }  }
   
 PLAN *  PLAN *
Line 192 
Line 192 
         ftsoptions &= ~FTS_NOSTAT;          ftsoptions &= ~FTS_NOSTAT;
   
         new = palloc(N_ATIME, f_atime);          new = palloc(N_ATIME, f_atime);
         new->t_data = find_parsenum(new, "-atime", arg, NULL);          new->sec_data = find_parsenum(new, "-atime", arg, NULL);
         TIME_CORRECT(new, N_ATIME);          TIME_CORRECT(new, N_ATIME);
         return (new);          return (new);
 }  }
Line 211 
Line 211 
         extern time_t now;          extern time_t now;
   
         COMPARE((now - entry->fts_statp->st_ctime +          COMPARE((now - entry->fts_statp->st_ctime +
             60 - 1) / 60, plan->t_data);              60 - 1) / 60, plan->sec_data);
 }  }
   
 PLAN *  PLAN *
Line 223 
Line 223 
         ftsoptions &= ~FTS_NOSTAT;          ftsoptions &= ~FTS_NOSTAT;
   
         new = palloc(N_CMIN, f_cmin);          new = palloc(N_CMIN, f_cmin);
         new->t_data = find_parsenum(new, "-cmin", arg, NULL);          new->sec_data = find_parsenum(new, "-cmin", arg, NULL);
         TIME_CORRECT(new, N_CMIN);          TIME_CORRECT(new, N_CMIN);
         return (new);          return (new);
 }  }
Line 241 
Line 241 
 {  {
   
         COMPARE((now - entry->fts_statp->st_ctime +          COMPARE((now - entry->fts_statp->st_ctime +
             SECSPERDAY - 1) / SECSPERDAY, plan->t_data);              SECSPERDAY - 1) / SECSPERDAY, plan->sec_data);
 }  }
   
 PLAN *  PLAN *
Line 253 
Line 253 
         ftsoptions &= ~FTS_NOSTAT;          ftsoptions &= ~FTS_NOSTAT;
   
         new = palloc(N_CTIME, f_ctime);          new = palloc(N_CTIME, f_ctime);
         new->t_data = find_parsenum(new, "-ctime", arg, NULL);          new->sec_data = find_parsenum(new, "-ctime", arg, NULL);
         TIME_CORRECT(new, N_CTIME);          TIME_CORRECT(new, N_CTIME);
         return (new);          return (new);
 }  }
Line 838 
Line 838 
 {  {
   
         COMPARE((now - entry->fts_statp->st_mtime + SECSPERDAY - 1) /          COMPARE((now - entry->fts_statp->st_mtime + SECSPERDAY - 1) /
             SECSPERDAY, plan->t_data);              SECSPERDAY, plan->sec_data);
 }  }
   
 PLAN *  PLAN *
Line 850 
Line 850 
         ftsoptions &= ~FTS_NOSTAT;          ftsoptions &= ~FTS_NOSTAT;
   
         new = palloc(N_MTIME, f_mtime);          new = palloc(N_MTIME, f_mtime);
         new->t_data = find_parsenum(new, "-mtime", arg, NULL);          new->sec_data = find_parsenum(new, "-mtime", arg, NULL);
         TIME_CORRECT(new, N_MTIME);          TIME_CORRECT(new, N_MTIME);
         return (new);          return (new);
 }  }
Line 869 
Line 869 
         extern time_t now;          extern time_t now;
   
         COMPARE((now - entry->fts_statp->st_mtime + 60 - 1) /          COMPARE((now - entry->fts_statp->st_mtime + 60 - 1) /
             60, plan->t_data);              60, plan->sec_data);
 }  }
   
 PLAN *  PLAN *
Line 881 
Line 881 
         ftsoptions &= ~FTS_NOSTAT;          ftsoptions &= ~FTS_NOSTAT;
   
         new = palloc(N_MMIN, f_mmin);          new = palloc(N_MMIN, f_mmin);
         new->t_data = find_parsenum(new, "-mmin", arg, NULL);          new->sec_data = find_parsenum(new, "-mmin", arg, NULL);
         TIME_CORRECT(new, N_MMIN);          TIME_CORRECT(new, N_MMIN);
         return (new);          return (new);
 }  }
Line 923 
Line 923 
         PLAN *plan;          PLAN *plan;
         FTSENT *entry;          FTSENT *entry;
 {  {
         return (entry->fts_statp->st_mtime > plan->t_data);  
           return (entry->fts_statp->st_mtimespec.tv_sec > plan->t_data.tv_sec ||
               (entry->fts_statp->st_mtimespec.tv_sec == plan->t_data.tv_sec &&
               entry->fts_statp->st_mtimespec.tv_nsec > plan->t_data.tv_nsec));
 }  }
   
 PLAN *  PLAN *
Line 938 
Line 941 
         if (stat(filename, &sb))          if (stat(filename, &sb))
                 err(1, "%s", filename);                  err(1, "%s", filename);
         new = palloc(N_NEWER, f_newer);          new = palloc(N_NEWER, f_newer);
         new->t_data = sb.st_mtime;          memcpy(&new->t_data, &sb.st_mtimespec, sizeof(struct timespec));
         return (new);          return (new);
 }  }
   
 /*  /*
    * -anewer file functions --
    *
    *      True if the current file has been accessed more recently
    *      then the access time of the file named by the pathname
    *      file.
    */
   int
   f_anewer(plan, entry)
           PLAN *plan;
           FTSENT *entry;
   {
   
           return (entry->fts_statp->st_atimespec.tv_sec > plan->t_data.tv_sec ||
               (entry->fts_statp->st_atimespec.tv_sec == plan->t_data.tv_sec &&
               entry->fts_statp->st_atimespec.tv_nsec > plan->t_data.tv_nsec));
   }
   
   PLAN *
   c_anewer(filename)
           char *filename;
   {
           PLAN *new;
           struct stat sb;
   
           ftsoptions &= ~FTS_NOSTAT;
   
           if (stat(filename, &sb))
                   err(1, "%s", filename);
           new = palloc(N_NEWER, f_newer);
           memcpy(&new->t_data, &sb.st_atimespec, sizeof(struct timespec));
           return (new);
   }
   
   /*
    * -cnewer file functions --
    *
    *      True if the current file has been changed more recently
    *      then the inode change time of the file named by the pathname
    *      file.
    */
   int
   f_cnewer(plan, entry)
           PLAN *plan;
           FTSENT *entry;
   {
   
           return (entry->fts_statp->st_ctimespec.tv_sec > plan->t_data.tv_sec ||
               (entry->fts_statp->st_ctimespec.tv_sec == plan->t_data.tv_sec &&
               entry->fts_statp->st_ctimespec.tv_nsec > plan->t_data.tv_nsec));
   }
   
   PLAN *
   c_cnewer(filename)
           char *filename;
   {
           PLAN *new;
           struct stat sb;
   
           ftsoptions &= ~FTS_NOSTAT;
   
           if (stat(filename, &sb))
                   err(1, "%s", filename);
           new = palloc(N_NEWER, f_newer);
           memcpy(&new->t_data, &sb.st_ctimespec, sizeof(struct timespec));
           return (new);
   }
   
   /*
  * -nogroup functions --   * -nogroup functions --
  *   *
  *      True if file belongs to a user ID for which the equivalent   *      True if file belongs to a user ID for which the equivalent
Line 1376 
Line 1447 
 {  {
         PLAN *new;          PLAN *new;
   
         if ((new = malloc(sizeof(PLAN)))) {          if ((new = calloc(1, sizeof(PLAN)))) {
                 new->type = t;                  new->type = t;
                 new->eval = f;                  new->eval = f;
                 new->flags = 0;  
                 new->next = NULL;  
                 return (new);                  return (new);
         }          }
         err(1, NULL);          err(1, NULL);

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17