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

Diff for /src/usr.bin/cvs/file.c between version 1.72 and 1.73

version 1.72, 2005/05/20 05:01:34 version 1.73, 2005/05/20 05:13:44
Line 107 
Line 107 
 TAILQ_HEAD(, cvs_ignpat)  cvs_ign_pats;  TAILQ_HEAD(, cvs_ignpat)  cvs_ign_pats;
   
   
   static int cvs_file_getdir(CVSFILE *, int, char *, int (*)(CVSFILE *, void *), void *);
 static int      cvs_load_dirinfo  (CVSFILE *, int);  static int      cvs_load_dirinfo  (CVSFILE *, int);
 static int      cvs_file_getdir   (CVSFILE *, int, char *);  
 static int      cvs_file_sort    (struct cvs_flist *, u_int);  static int      cvs_file_sort    (struct cvs_flist *, u_int);
 static int      cvs_file_cmp     (const void *, const void *);  static int      cvs_file_cmp     (const void *, const void *);
 static int      cvs_file_cmpname (const char *, const char *);  static int      cvs_file_cmpname (const char *, const char *);
Line 345 
Line 345 
  */   */
   
 CVSFILE*  CVSFILE*
 cvs_file_get(const char *path, int flags)  cvs_file_get(const char *path, int flags, int (*cb)(CVSFILE *, void *),
       void *arg)
 {  {
         char *files[1];          char *files[1];
   
         files[0] = path;          files[0] = path;
         return cvs_file_getspec(files, 1, flags);          return cvs_file_getspec(files, 1, flags, cb, arg);
 }  }
   
   
Line 363 
Line 364 
  * files.   * files.
  */   */
 CVSFILE*  CVSFILE*
 cvs_file_getspec(char **fspec, int fsn, int flags)  cvs_file_getspec(char **fspec, int fsn, int flags, int (*cb)(CVSFILE *, void *),
       void *arg)
 {  {
         int i;          int i;
         int pwd;          int pwd;
Line 377 
Line 379 
         if (base == NULL)          if (base == NULL)
                 return (NULL);                  return (NULL);
   
           /* XXX - needed for some commands */
           if (cb != NULL) {
                   if (cb(base, arg) != CVS_EX_OK) {
                           cvs_file_free(base);
                           return (NULL);
                   }
           }
   
         for (i = 0; i < fsn; i++) {          for (i = 0; i < fsn; i++) {
                 strlcpy(pcopy, fspec[i], sizeof(pcopy));                  strlcpy(pcopy, fspec[i], sizeof(pcopy));
                 sp = pcopy;                  sp = pcopy;
Line 412 
Line 422 
                         if (np != NULL)                          if (np != NULL)
                                 *np++;                                  *np++;
   
                         if (cvs_file_getdir(nf, flags, np) < 0) {                          if (cvs_file_getdir(nf, flags, np, cb, arg) < 0) {
                                 cvs_file_free(base);                                  cvs_file_free(base);
                                 return (NULL);                                  return (NULL);
                         }                          }
                   } else {
                           if (cb != NULL) {
                                   if (cb(nf, arg) != CVS_EX_OK)
                                           return (NULL);
                           }
                 }                  }
         }          }
   
Line 591 
Line 606 
  * is performed by cvs_file_free().   * is performed by cvs_file_free().
  */   */
 static int  static int
 cvs_file_getdir(CVSFILE *cf, int flags, char *path)  cvs_file_getdir(CVSFILE *cf, int flags, char *path, int (*cb)(CVSFILE *, void *), void *arg)
 {  {
         int l;          int l;
         int check_entry;          int check_entry;
Line 630 
Line 645 
         if ((flags & CF_KNOWN) && (cf->cf_cvstat == CVS_FST_UNKNOWN))          if ((flags & CF_KNOWN) && (cf->cf_cvstat == CVS_FST_UNKNOWN))
                 return (0);                  return (0);
   
           /* callback for the directory entry */
           if (cb != NULL) {
                   if (cb(cf, arg) != CVS_EX_OK)
                           return (-1);
           }
   
         dirp = opendir(fpath);          dirp = opendir(fpath);
         if (dirp == NULL) {          if (dirp == NULL) {
                 cvs_log(LP_ERRNO, "failed to open directory %s", fpath);                  cvs_log(LP_ERRNO, "failed to open directory %s", fpath);
Line 699 
Line 720 
                 if (cfp->cf_type == DT_DIR) {                  if (cfp->cf_type == DT_DIR) {
                         ndirs++;                          ndirs++;
                         SIMPLEQ_INSERT_TAIL(&dirs, cfp, cf_list);                          SIMPLEQ_INSERT_TAIL(&dirs, cfp, cf_list);
                   } else {
                           /* callback for the file */
                           if (cb != NULL) {
                                   if (cb(cfp, arg) != CVS_EX_OK) {
                                           closedir(dirp);
                                           return (-1);
                                   }
                           }
                 }                  }
   
                 if (path != NULL) {                  if (path != NULL) {
Line 743 
Line 772 
                                 ndirs++;                                  ndirs++;
                                 SIMPLEQ_INSERT_TAIL(&dirs, cfp,                                  SIMPLEQ_INSERT_TAIL(&dirs, cfp,
                                     cf_list);                                      cf_list);
                           } else {
                                   /* callback for the file */
                                   if (cb != NULL) {
                                           if (cb(cfp, arg) != CVS_EX_OK)
                                                   return (-1);
                                   }
                         }                          }
   
                         if (path != NULL)                          if (path != NULL)
Line 767 
Line 802 
                 else                  else
                         cfp->cf_flags &= ~CVS_GDIR_IGNORE;                          cfp->cf_flags &= ~CVS_GDIR_IGNORE;
   
                 if (cvs_file_getdir(cfp, flags, np) < 0) {                  if (cvs_file_getdir(cfp, flags, np, cb, arg) < 0) {
                         cvs_log(LP_ERROR, "failed to get %s",                          cvs_log(LP_ERROR, "failed to get %s",
                             CVS_FILE_NAME(cfp));                              CVS_FILE_NAME(cfp));
                         continue;                          continue;

Legend:
Removed from v.1.72  
changed lines
  Added in v.1.73