function.c (c0ff9709a503d98b10da45c03af645aafeab6480) | function.c (7fd5ee41e3fc0035fa23ee3022cd53fa8cb0c53d) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Cimarron D. Taylor of the University of California, Berkeley. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 536 unchanged lines hidden (view full) --- 545 546int 547f_flags(plan, entry) 548 PLAN *plan; 549 FTSENT *entry; 550{ 551 u_long flags; 552 | 1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Cimarron D. Taylor of the University of California, Berkeley. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 536 unchanged lines hidden (view full) --- 545 546int 547f_flags(plan, entry) 548 PLAN *plan; 549 FTSENT *entry; 550{ 551 u_long flags; 552 |
553 flags = entry->fts_statp->st_flags & 554 (UF_NODUMP | UF_IMMUTABLE | UF_APPEND | UF_OPAQUE | 555 SF_ARCHIVED | SF_IMMUTABLE | SF_APPEND); | 553 flags = entry->fts_statp->st_flags; |
556 if (plan->flags & F_ATLEAST) | 554 if (plan->flags & F_ATLEAST) |
557 /* note that plan->fl_flags always is a subset of 558 plan->fl_mask */ 559 return (flags & plan->fl_mask) == plan->fl_flags; | 555 return (flags | plan->fl_flags) == flags && 556 !(flags & plan->fl_notflags); 557 else if (plan->flags & F_ANY) 558 return (flags & plan->fl_flags) || 559 (flags | plan->fl_notflags) != flags; |
560 else | 560 else |
561 return flags == plan->fl_flags; 562 /* NOTREACHED */ | 561 return flags == plan->fl_flags && 562 !(plan->fl_flags & plan->fl_notflags); |
563} 564 565PLAN * 566c_flags(option, argvp) 567 OPTION *option; 568 char ***argvp; 569{ 570 char *flags_str; 571 PLAN *new; 572 u_long flags, notflags; 573 574 flags_str = nextarg(option, argvp); 575 ftsoptions &= ~FTS_NOSTAT; 576 577 new = palloc(option); 578 579 if (*flags_str == '-') { 580 new->flags |= F_ATLEAST; 581 flags_str++; | 563} 564 565PLAN * 566c_flags(option, argvp) 567 OPTION *option; 568 char ***argvp; 569{ 570 char *flags_str; 571 PLAN *new; 572 u_long flags, notflags; 573 574 flags_str = nextarg(option, argvp); 575 ftsoptions &= ~FTS_NOSTAT; 576 577 new = palloc(option); 578 579 if (*flags_str == '-') { 580 new->flags |= F_ATLEAST; 581 flags_str++; |
582 } else if (*flags_str == '+') { 583 new->flags |= F_ANY; 584 flags_str++; |
|
582 } 583 if (strtofflags(&flags_str, &flags, ¬flags) == 1) 584 errx(1, "%s: %s: illegal flags string", option->name, flags_str); 585 586 new->fl_flags = flags; | 585 } 586 if (strtofflags(&flags_str, &flags, ¬flags) == 1) 587 errx(1, "%s: %s: illegal flags string", option->name, flags_str); 588 589 new->fl_flags = flags; |
587 new->fl_mask = flags | notflags; | 590 new->fl_notflags = notflags; |
588 return new; 589} 590 591/* 592 * -follow functions -- 593 * 594 * Always true, causes symbolic links to be followed on a global 595 * basis. --- 861 unchanged lines hidden --- | 591 return new; 592} 593 594/* 595 * -follow functions -- 596 * 597 * Always true, causes symbolic links to be followed on a global 598 * basis. --- 861 unchanged lines hidden --- |