[BACK]Return to compat_fts.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/compat_fts.c between version 1.12 and 1.14

version 1.12, 2016/10/18 23:58:12 version 1.14, 2017/02/18 12:24:24
Line 63  static FTSENT *fts_sort(FTS *, FTSENT *, int);
Line 63  static FTSENT *fts_sort(FTS *, FTSENT *, int);
 static unsigned short    fts_stat(FTS *, FTSENT *);  static unsigned short    fts_stat(FTS *, FTSENT *);
   
 #define ISDOT(a)        (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))  #define ISDOT(a)        (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
 #ifndef O_DIRECTORY  
 #define O_DIRECTORY     0  
 #endif  
 #ifndef O_CLOEXEC  #ifndef O_CLOEXEC
 #define O_CLOEXEC       0  #define O_CLOEXEC       0
 #endif  #endif
 #ifndef PATH_MAX  
 #define PATH_MAX        4096  
 #endif  
   
 #define CLR(opt)        (sp->fts_options &= ~(opt))  #define CLR(opt)        (sp->fts_options &= ~(opt))
 #define ISSET(opt)      (sp->fts_options & (opt))  #define ISSET(opt)      (sp->fts_options & (opt))
Line 84  fts_open(char * const *argv, int options,
Line 78  fts_open(char * const *argv, int options,
         FTS *sp;          FTS *sp;
         FTSENT *p, *root;          FTSENT *p, *root;
         int nitems;          int nitems;
         FTSENT *parent, *tmp;          FTSENT *parent, *prev;
   
         /* Options check. */          /* Options check. */
         if (options & ~FTS_OPTIONMASK) {          if (options & ~FTS_OPTIONMASK) {
Line 117  fts_open(char * const *argv, int options,
Line 111  fts_open(char * const *argv, int options,
         parent->fts_level = FTS_ROOTPARENTLEVEL;          parent->fts_level = FTS_ROOTPARENTLEVEL;
   
         /* Allocate/initialize root(s). */          /* Allocate/initialize root(s). */
         for (root = NULL, nitems = 0; *argv; ++argv, ++nitems) {          for (root = prev = NULL, nitems = 0; *argv; ++argv, ++nitems) {
                 if ((p = fts_alloc(sp, *argv, strlen(*argv))) == NULL)                  if ((p = fts_alloc(sp, *argv, strlen(*argv))) == NULL)
                         goto mem3;                          goto mem3;
                 p->fts_level = FTS_ROOTLEVEL;                  p->fts_level = FTS_ROOTLEVEL;
Line 139  fts_open(char * const *argv, int options,
Line 133  fts_open(char * const *argv, int options,
                 } else {                  } else {
                         p->fts_link = NULL;                          p->fts_link = NULL;
                         if (root == NULL)                          if (root == NULL)
                                 tmp = root = p;                                  root = p;
                         else {                          else
                                 tmp->fts_link = p;                                  prev->fts_link = p;
                                 tmp = p;                          prev = p;
                         }  
                 }                  }
         }          }
         if (compar && nitems > 1)          if (compar && nitems > 1)

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

CVSweb