[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.29 and 1.30

version 1.29, 2004/07/01 18:25:47 version 1.30, 2004/07/20 03:50:25
Line 125 
Line 125 
  *      Parse a string of the form [+-]# and return the value.   *      Parse a string of the form [+-]# and return the value.
  */   */
 static long  static long
 find_parsenum(plan, option, vp, endch)  find_parsenum(PLAN *plan, char *option, char *vp, char *endch)
         PLAN *plan;  
         char *option, *vp, *endch;  
 {  {
         long value;          long value;
         char *endchar, *str;    /* Pointer to character ending conversion. */          char *endchar, *str;    /* Pointer to character ending conversion. */
Line 180 
Line 178 
  *     current time is n min periods.   *     current time is n min periods.
  */   */
 int  int
 f_amin(plan, entry)  f_amin(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         extern time_t now;          extern time_t now;
   
Line 210 
Line 206 
  *      current time is n 24 hour periods.   *      current time is n 24 hour periods.
  */   */
 int  int
 f_atime(plan, entry)  f_atime(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
   
         COMPARE((now - entry->fts_statp->st_atime +          COMPARE((now - entry->fts_statp->st_atime +
Line 239 
Line 233 
  *     status information and the current time is n min periods.   *     status information and the current time is n min periods.
  */   */
 int  int
 f_cmin(plan, entry)  f_cmin(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         extern time_t now;          extern time_t now;
   
Line 269 
Line 261 
  *      status information and the current time is n 24 hour periods.   *      status information and the current time is n 24 hour periods.
  */   */
 int  int
 f_ctime(plan, entry)  f_ctime(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
   
         COMPARE((now - entry->fts_statp->st_ctime +          COMPARE((now - entry->fts_statp->st_ctime +
Line 299 
Line 289 
  *      itself.   *      itself.
  */   */
 int  int
 f_always_true(plan, entry)  f_always_true(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         return (1);          return (1);
 }  }
Line 320 
Line 308 
  *      True if the file or directory is empty   *      True if the file or directory is empty
  */   */
 int  int
 f_empty(plan, entry)  f_empty(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         if (S_ISREG(entry->fts_statp->st_mode) && entry->fts_statp->st_size == 0)          if (S_ISREG(entry->fts_statp->st_mode) && entry->fts_statp->st_size == 0)
                 return (1);                  return (1);
Line 369 
Line 355 
  *      user before executing the utility.   *      user before executing the utility.
  */   */
 int  int
 f_exec(plan, entry)  f_exec(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         int cnt;          int cnt;
         pid_t pid;          pid_t pid;
Line 468 
Line 452 
  *      the directory where the file lives.   *      the directory where the file lives.
  */   */
 int  int
 f_execdir(plan, entry)  f_execdir(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         int cnt;          int cnt;
         pid_t pid;          pid_t pid;
Line 582 
Line 564 
  *      The flags argument is used to represent file flags bits.   *      The flags argument is used to represent file flags bits.
  */   */
 int  int
 f_flags(plan, entry)  f_flags(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         u_int flags;          u_int flags;
   
Line 644 
Line 624 
  *      True if the file is of a certain type.   *      True if the file is of a certain type.
  */   */
 int  int
 f_fstype(plan, entry)  f_fstype(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         static dev_t curdev;    /* need a guaranteed illegal dev value */          static dev_t curdev;    /* need a guaranteed illegal dev value */
         static int first = 1;          static int first = 1;
Line 742 
Line 720 
  *      name, gname is taken as a group ID.   *      name, gname is taken as a group ID.
  */   */
 int  int
 f_group(plan, entry)  f_group(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         return (entry->fts_statp->st_gid == plan->g_data);          return (entry->fts_statp->st_gid == plan->g_data);
 }  }
Line 777 
Line 753 
  *      True if the file has inode # n.   *      True if the file has inode # n.
  */   */
 int  int
 f_inum(plan, entry)  f_inum(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         COMPARE(entry->fts_statp->st_ino, plan->i_data);          COMPARE(entry->fts_statp->st_ino, plan->i_data);
 }  }
Line 802 
Line 776 
  *      True if the file has n links.   *      True if the file has n links.
  */   */
 int  int
 f_links(plan, entry)  f_links(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         COMPARE(entry->fts_statp->st_nlink, plan->l_data);          COMPARE(entry->fts_statp->st_nlink, plan->l_data);
 }  }
Line 827 
Line 799 
  *      Always true - prints the current entry to stdout in "ls" format.   *      Always true - prints the current entry to stdout in "ls" format.
  */   */
 int  int
 f_ls(plan, entry)  f_ls(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         printlong(entry->fts_path, entry->fts_accpath, entry->fts_statp);          printlong(entry->fts_path, entry->fts_accpath, entry->fts_statp);
         return (1);          return (1);
Line 851 
Line 821 
  *      maximum depth specified   *      maximum depth specified
  */   */
 int  int
 f_maxdepth(plan, entry)  f_maxdepth(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
   
         if (entry->fts_level >= plan->max_data)          if (entry->fts_level >= plan->max_data)
Line 878 
Line 846 
  *      minimum depth specified   *      minimum depth specified
  */   */
 int  int
 f_mindepth(plan, entry)  f_mindepth(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
   
         return (entry->fts_level >= plan->min_data);          return (entry->fts_level >= plan->min_data);
Line 903 
Line 869 
  *      current time is n 24 hour periods.   *      current time is n 24 hour periods.
  */   */
 int  int
 f_mtime(plan, entry)  f_mtime(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
   
         COMPARE((now - entry->fts_statp->st_mtime + SECSPERDAY - 1) /          COMPARE((now - entry->fts_statp->st_mtime + SECSPERDAY - 1) /
Line 932 
Line 896 
  *     current time is n min periods.   *     current time is n min periods.
  */   */
 int  int
 f_mmin(plan, entry)  f_mmin(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         extern time_t now;          extern time_t now;
   
Line 962 
Line 924 
  *      matches pattern using Pattern Matching Notation S3.14   *      matches pattern using Pattern Matching Notation S3.14
  */   */
 int  int
 f_name(plan, entry)  f_name(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         return (!fnmatch(plan->c_data, entry->fts_name, 0));          return (!fnmatch(plan->c_data, entry->fts_name, 0));
 }  }
Line 986 
Line 946 
  *   *
  */   */
 int  int
 f_iname(plan, entry)  f_iname(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         return (!fnmatch(plan->c_data, entry->fts_name, FNM_CASEFOLD));          return (!fnmatch(plan->c_data, entry->fts_name, FNM_CASEFOLD));
 }  }
Line 1011 
Line 969 
  *      file.   *      file.
  */   */
 int  int
 f_newer(plan, entry)  f_newer(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
   
         return (entry->fts_statp->st_mtimespec.tv_sec > plan->t_data.tv_sec ||          return (entry->fts_statp->st_mtimespec.tv_sec > plan->t_data.tv_sec ||
Line 1044 
Line 1000 
  *      file.   *      file.
  */   */
 int  int
 f_anewer(plan, entry)  f_anewer(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
   
         return (entry->fts_statp->st_atimespec.tv_sec > plan->t_data.tv_sec ||          return (entry->fts_statp->st_atimespec.tv_sec > plan->t_data.tv_sec ||
Line 1077 
Line 1031 
  *      file.   *      file.
  */   */
 int  int
 f_cnewer(plan, entry)  f_cnewer(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
   
         return (entry->fts_statp->st_ctimespec.tv_sec > plan->t_data.tv_sec ||          return (entry->fts_statp->st_ctimespec.tv_sec > plan->t_data.tv_sec ||
Line 1109 
Line 1061 
  *      of the getgrnam() 9.2.1 [POSIX.1] function returns NULL.   *      of the getgrnam() 9.2.1 [POSIX.1] function returns NULL.
  */   */
 int  int
 f_nogroup(plan, entry)  f_nogroup(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         return (group_from_gid(entry->fts_statp->st_gid, 1) ? 0 : 1);          return (group_from_gid(entry->fts_statp->st_gid, 1) ? 0 : 1);
 }  }
Line 1131 
Line 1081 
  *      of the getpwuid() 9.2.2 [POSIX.1] function returns NULL.   *      of the getpwuid() 9.2.2 [POSIX.1] function returns NULL.
  */   */
 int  int
 f_nouser(plan, entry)  f_nouser(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         return (user_from_uid(entry->fts_statp->st_uid, 1) ? 0 : 1);          return (user_from_uid(entry->fts_statp->st_uid, 1) ? 0 : 1);
 }  }
Line 1153 
Line 1101 
  *      matches pattern using Pattern Matching Notation S3.14   *      matches pattern using Pattern Matching Notation S3.14
  */   */
 int  int
 f_path(plan, entry)  f_path(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         return (!fnmatch(plan->c_data, entry->fts_path, 0));          return (!fnmatch(plan->c_data, entry->fts_path, 0));
 }  }
Line 1178 
Line 1124 
  *      symbolic mode.   *      symbolic mode.
  */   */
 int  int
 f_perm(plan, entry)  f_perm(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         mode_t mode;          mode_t mode;
   
Line 1223 
Line 1167 
  *      standard output.   *      standard output.
  */   */
 int  int
 f_print(plan, entry)  f_print(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         (void)printf("%s\n", entry->fts_path);          (void)printf("%s\n", entry->fts_path);
         return(1);          return(1);
Line 1233 
Line 1175 
   
 /* ARGSUSED */  /* ARGSUSED */
 int  int
 f_print0(plan, entry)  f_print0(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         (void)fputs(entry->fts_path, stdout);          (void)fputs(entry->fts_path, stdout);
         (void)fputc('\0', stdout);          (void)fputc('\0', stdout);
Line 1264 
Line 1204 
  *      Prune a portion of the hierarchy.   *      Prune a portion of the hierarchy.
  */   */
 int  int
 f_prune(plan, entry)  f_prune(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
   
         if (fts_set(tree, entry, FTS_SKIP))          if (fts_set(tree, entry, FTS_SKIP))
Line 1291 
Line 1229 
 static int divsize = 1;  static int divsize = 1;
   
 int  int
 f_size(plan, entry)  f_size(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         off_t size;          off_t size;
   
Line 1326 
Line 1262 
  *      regular file, respectively.   *      regular file, respectively.
  */   */
 int  int
 f_type(plan, entry)  f_type(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         return ((entry->fts_statp->st_mode & S_IFMT) == plan->m_data);          return ((entry->fts_statp->st_mode & S_IFMT) == plan->m_data);
 }  }
Line 1387 
Line 1321 
  *      return a valid user name, uname is taken as a user ID.   *      return a valid user name, uname is taken as a user ID.
  */   */
 int  int
 f_user(plan, entry)  f_user(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         return (entry->fts_statp->st_uid == plan->u_data);          return (entry->fts_statp->st_uid == plan->u_data);
 }  }
Line 1436 
Line 1368 
  *      True if expression is true.   *      True if expression is true.
  */   */
 int  int
 f_expr(plan, entry)  f_expr(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         PLAN *p;          PLAN *p;
         int state;          int state;
Line 1471 
Line 1401 
  *      Negation of a primary; the unary NOT operator.   *      Negation of a primary; the unary NOT operator.
  */   */
 int  int
 f_not(plan, entry)  f_not(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         PLAN *p;          PLAN *p;
         int state;          int state;
Line 1496 
Line 1424 
  * not evaluated if the first expression is true.   * not evaluated if the first expression is true.
  */   */
 int  int
 f_or(plan, entry)  f_or(PLAN *plan, FTSENT *entry)
         PLAN *plan;  
         FTSENT *entry;  
 {  {
         PLAN *p;          PLAN *p;
         int state;          int state;

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30