Switch to unified view

a/src/utils/fstreewalk.cpp b/src/utils/fstreewalk.cpp
...
...
436
#define OPT_c     0x10
436
#define OPT_c     0x10
437
#define OPT_b     0x20
437
#define OPT_b     0x20
438
#define OPT_d     0x40
438
#define OPT_d     0x40
439
#define OPT_m     0x80
439
#define OPT_m     0x80
440
#define OPT_L     0x100
440
#define OPT_L     0x100
441
#define OPT_w     0x200
441
442
442
class myCB : public FsTreeWalkerCB {
443
class myCB : public FsTreeWalkerCB {
443
 public:
444
 public:
444
    FsTreeWalker::Status processone(const string &path, 
445
    FsTreeWalker::Status processone(const string &path, 
445
                                    const struct stat *st,
446
                                    const struct stat *st,
...
...
485
" -c : no path canonification\n"
486
" -c : no path canonification\n"
486
" -L : follow symbolic links\n"
487
" -L : follow symbolic links\n"
487
" -b : use breadth first walk\n"
488
" -b : use breadth first walk\n"
488
" -d : use almost depth first (dir files, then subdirs)\n"
489
" -d : use almost depth first (dir files, then subdirs)\n"
489
" -m : use breadth up to 4 deep then switch to -d\n"
490
" -m : use breadth up to 4 deep then switch to -d\n"
491
" -w : unset default FNM_PATHNAME when using fnmatch() to match skipped paths\n"
490
;
492
;
491
static void
493
static void
492
Usage(void)
494
Usage(void)
493
{
495
{
494
    fprintf(stderr, "%s: usage:\n%s", thisprog, usage);
496
    fprintf(stderr, "%s: usage:\n%s", thisprog, usage);
...
...
512
      case 'b': op_flags |= OPT_b; break;
514
      case 'b': op_flags |= OPT_b; break;
513
      case 'c': op_flags |= OPT_c; break;
515
      case 'c': op_flags |= OPT_c; break;
514
      case 'd': op_flags |= OPT_d; break;
516
      case 'd': op_flags |= OPT_d; break;
515
      case 'L': op_flags |= OPT_L; break;
517
      case 'L': op_flags |= OPT_L; break;
516
      case 'm': op_flags |= OPT_m; break;
518
      case 'm': op_flags |= OPT_m; break;
517
      case 'r':   op_flags |= OPT_r; break;
518
      case 'p': op_flags |= OPT_p; if (argc < 2)  Usage();
519
      case 'p': op_flags |= OPT_p; if (argc < 2)  Usage();
519
      patterns.push_back(*(++argv));
520
      patterns.push_back(*(++argv));
520
      argc--; 
521
      argc--; 
521
      goto b1;
522
      goto b1;
522
      case 'P': op_flags |= OPT_P; if (argc < 2)  Usage();
523
      case 'P': op_flags |= OPT_P; if (argc < 2)  Usage();
523
      paths.push_back(*(++argv));
524
      paths.push_back(*(++argv));
524
    argc--; 
525
    argc--; 
525
    goto b1;
526
    goto b1;
527
      case 'r':   op_flags |= OPT_r; break;
528
      case 'w':   op_flags |= OPT_w; break;
526
      default: Usage(); break;
529
      default: Usage(); break;
527
      }
530
      }
528
  b1: argc--; argv++;
531
  b1: argc--; argv++;
529
  }
532
  }
530
533
...
...
550
  string reason;
553
  string reason;
551
  if (!recollinit(0, 0, reason)) {
554
  if (!recollinit(0, 0, reason)) {
552
      fprintf(stderr, "Init failed: %s\n", reason.c_str());
555
      fprintf(stderr, "Init failed: %s\n", reason.c_str());
553
      exit(1);
556
      exit(1);
554
  }
557
  }
555
558
  if (op_flags & OPT_w) {
559
      FsTreeWalker::setNoFnmPathname();
560
  }
556
  FsTreeWalker walker(opt);
561
  FsTreeWalker walker(opt);
557
  walker.setSkippedNames(patterns);
562
  walker.setSkippedNames(patterns);
558
  walker.setSkippedPaths(paths);
563
  walker.setSkippedPaths(paths);
559
  myCB cb;
564
  myCB cb;
560
  walker.walk(topdir, cb);
565
  walker.walk(topdir, cb);