11590Srgrimes/* 21590Srgrimes * Copyright (c) 1989, 1993, 1994 31590Srgrimes * The Regents of the University of California. All rights reserved. 41590Srgrimes * 51590Srgrimes * This code is derived from software contributed to Berkeley by 61590Srgrimes * Chris Newcomb. 71590Srgrimes * 81590Srgrimes * Redistribution and use in source and binary forms, with or without 91590Srgrimes * modification, are permitted provided that the following conditions 101590Srgrimes * are met: 111590Srgrimes * 1. Redistributions of source code must retain the above copyright 121590Srgrimes * notice, this list of conditions and the following disclaimer. 131590Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 141590Srgrimes * notice, this list of conditions and the following disclaimer in the 151590Srgrimes * documentation and/or other materials provided with the distribution. 161590Srgrimes * 4. Neither the name of the University nor the names of its contributors 171590Srgrimes * may be used to endorse or promote products derived from this software 181590Srgrimes * without specific prior written permission. 191590Srgrimes * 201590Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 211590Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 221590Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 231590Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 241590Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 251590Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 261590Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 271590Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 281590Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 291590Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 301590Srgrimes * SUCH DAMAGE. 311590Srgrimes */ 321590Srgrimes 331590Srgrimes#ifndef lint 3441568Sarchiestatic const char copyright[] = 351590Srgrimes"@(#) Copyright (c) 1989, 1993, 1994\n\ 361590Srgrimes The Regents of the University of California. All rights reserved.\n"; 371590Srgrimes#endif /* not lint */ 381590Srgrimes 391590Srgrimes#ifndef lint 4056597Smharo#if 0 4141568Sarchiestatic const char sccsid[] = "@(#)du.c 8.5 (Berkeley) 5/4/95"; 4256597Smharo#endif 431590Srgrimes#endif /* not lint */ 4499112Sobrien#include <sys/cdefs.h> 4599112Sobrien__FBSDID("$FreeBSD$"); 461590Srgrimes 471590Srgrimes#include <sys/param.h> 4878158Sroam#include <sys/queue.h> 491590Srgrimes#include <sys/stat.h> 501590Srgrimes 511590Srgrimes#include <err.h> 521590Srgrimes#include <errno.h> 5378158Sroam#include <fnmatch.h> 541590Srgrimes#include <fts.h> 55129678Spjd#include <libutil.h> 56132201Stjr#include <locale.h> 57139813Spjd#include <stdint.h> 581590Srgrimes#include <stdio.h> 591590Srgrimes#include <stdlib.h> 601590Srgrimes#include <string.h> 6156597Smharo#include <sysexits.h> 6223693Speter#include <unistd.h> 631590Srgrimes 64227164Sedstatic SLIST_HEAD(ignhead, ignentry) ignores; 6578158Sroamstruct ignentry { 6678158Sroam char *mask; 6778158Sroam SLIST_ENTRY(ignentry) next; 6878158Sroam}; 6978158Sroam 70128772Skientzlestatic int linkchk(FTSENT *); 7192920Simpstatic void usage(void); 72184656Smlaierstatic void prthumanval(int64_t); 73184656Smlaierstatic void ignoreadd(const char *); 74184656Smlaierstatic void ignoreclean(void); 75184656Smlaierstatic int ignorep(FTSENT *); 76191677Simpstatic void siginfo(int __unused); 771590Srgrimes 78184656Smlaierstatic int nodumpflag = 0; 79184733Smlaierstatic int Aflag; 80184733Smlaierstatic long blocksize, cblocksize; 81191677Simpstatic volatile sig_atomic_t info; 82158339Smaxim 831590Srgrimesint 84100822Sdwmalonemain(int argc, char *argv[]) 851590Srgrimes{ 8632097Sjkh FTS *fts; 8732097Sjkh FTSENT *p; 88184733Smlaier off_t savednumber, curblocks; 89209362Sbrian off_t threshold, threshold_sign; 9032097Sjkh int ftsoptions; 9132097Sjkh int depth; 92228669Sjilles int Hflag, Lflag, aflag, sflag, dflag, cflag; 93176561Skeramida int hflag, lflag, ch, notused, rval; 9432097Sjkh char **save; 9587216Smarkm static char dot[] = "."; 961590Srgrimes 97132201Stjr setlocale(LC_ALL, ""); 98132201Stjr 99228669Sjilles Hflag = Lflag = aflag = sflag = dflag = cflag = hflag = 100184733Smlaier lflag = Aflag = 0; 101128772Skientzle 1021590Srgrimes save = argv; 103228669Sjilles ftsoptions = FTS_PHYSICAL; 104184654Smlaier savednumber = 0; 105209362Sbrian threshold = 0; 106209362Sbrian threshold_sign = 1; 107184733Smlaier cblocksize = DEV_BSIZE; 108184733Smlaier blocksize = 0; 10919120Sscrappy depth = INT_MAX; 11078158Sroam SLIST_INIT(&ignores); 111128772Skientzle 112238602Sdes while ((ch = getopt(argc, argv, "AB:HI:LPasd:cghklmnrt:x")) != -1) 1131590Srgrimes switch (ch) { 114184733Smlaier case 'A': 115184733Smlaier Aflag = 1; 116184733Smlaier break; 117184733Smlaier case 'B': 118184733Smlaier errno = 0; 119184733Smlaier cblocksize = atoi(optarg); 120184733Smlaier if (errno == ERANGE || cblocksize <= 0) { 121184733Smlaier warnx("invalid argument to option B: %s", 122184733Smlaier optarg); 123184733Smlaier usage(); 124184733Smlaier } 125184733Smlaier break; 126184654Smlaier case 'H': 127184654Smlaier Hflag = 1; 128228669Sjilles Lflag = 0; 129184654Smlaier break; 130184654Smlaier case 'I': 131184654Smlaier ignoreadd(optarg); 132184654Smlaier break; 133184654Smlaier case 'L': 134184654Smlaier Lflag = 1; 135228669Sjilles Hflag = 0; 136184654Smlaier break; 137184654Smlaier case 'P': 138228669Sjilles Hflag = Lflag = 0; 139184654Smlaier break; 140184654Smlaier case 'a': 141184654Smlaier aflag = 1; 142184654Smlaier break; 143184654Smlaier case 's': 144184654Smlaier sflag = 1; 145184654Smlaier break; 146184654Smlaier case 'd': 147184654Smlaier dflag = 1; 148184654Smlaier errno = 0; 149184654Smlaier depth = atoi(optarg); 150184654Smlaier if (errno == ERANGE || depth < 0) { 151184654Smlaier warnx("invalid argument to option d: %s", 152184654Smlaier optarg); 153184654Smlaier usage(); 154184654Smlaier } 155184654Smlaier break; 156184654Smlaier case 'c': 157184654Smlaier cflag = 1; 158184654Smlaier break; 159238602Sdes case 'g': 160238602Sdes hflag = 0; 161238602Sdes blocksize = 1073741824; 162238602Sdes break; 163184654Smlaier case 'h': 164184654Smlaier hflag = 1; 165184654Smlaier break; 166184654Smlaier case 'k': 167184654Smlaier hflag = 0; 168184733Smlaier blocksize = 1024; 169184654Smlaier break; 170184654Smlaier case 'l': 171184654Smlaier lflag = 1; 172184654Smlaier break; 173184654Smlaier case 'm': 174184654Smlaier hflag = 0; 175184733Smlaier blocksize = 1048576; 176184654Smlaier break; 177184654Smlaier case 'n': 178184654Smlaier nodumpflag = 1; 179184654Smlaier break; 180184654Smlaier case 'r': /* Compatibility. */ 181184654Smlaier break; 182209362Sbrian case 't' : 183209362Sbrian if (expand_number(optarg, &threshold) != 0 || 184209362Sbrian threshold == 0) { 185209362Sbrian warnx("invalid threshold: %s", optarg); 186209362Sbrian usage(); 187209362Sbrian } else if (threshold < 0) 188209362Sbrian threshold_sign = -1; 189209362Sbrian break; 190184654Smlaier case 'x': 191184654Smlaier ftsoptions |= FTS_XDEV; 192184654Smlaier break; 193184654Smlaier case '?': 194184654Smlaier default: 195184654Smlaier usage(); 196184654Smlaier /* NOTREACHED */ 1971590Srgrimes } 19832097Sjkh 1991590Srgrimes argc -= optind; 2001590Srgrimes argv += optind; 2011590Srgrimes 2021590Srgrimes /* 2031590Srgrimes * XXX 2041590Srgrimes * Because of the way that fts(3) works, logical walks will not count 2051590Srgrimes * the blocks actually used by symbolic links. We rationalize this by 2061590Srgrimes * noting that users computing logical sizes are likely to do logical 2071590Srgrimes * copies, so not counting the links is correct. The real reason is 2081590Srgrimes * that we'd have to re-implement the kernel's symbolic link traversing 2091590Srgrimes * algorithm to get this right. If, for example, you have relative 2101590Srgrimes * symbolic links referencing other relative symbolic links, it gets 2111590Srgrimes * very nasty, very fast. The bottom line is that it's documented in 2121590Srgrimes * the man page, so it's a feature. 2131590Srgrimes */ 21432097Sjkh 2151590Srgrimes if (Hflag) 2161590Srgrimes ftsoptions |= FTS_COMFOLLOW; 217228669Sjilles if (Lflag) { 218228669Sjilles ftsoptions &= ~FTS_PHYSICAL; 2191590Srgrimes ftsoptions |= FTS_LOGICAL; 220228669Sjilles } 2211590Srgrimes 222184733Smlaier if (!Aflag && (cblocksize % DEV_BSIZE) != 0) 223184733Smlaier cblocksize = howmany(cblocksize, DEV_BSIZE) * DEV_BSIZE; 224184733Smlaier 225227335Sed if (aflag + dflag + sflag > 1) 226227335Sed usage(); 227227335Sed if (sflag) 22832097Sjkh depth = 0; 2291590Srgrimes 2301590Srgrimes if (!*argv) { 2311590Srgrimes argv = save; 23287216Smarkm argv[0] = dot; 2331590Srgrimes argv[1] = NULL; 2341590Srgrimes } 2351590Srgrimes 236184733Smlaier if (blocksize == 0) 237184733Smlaier (void)getbsize(¬used, &blocksize); 2381590Srgrimes 239184733Smlaier if (!Aflag) { 240184733Smlaier cblocksize /= DEV_BSIZE; 241184733Smlaier blocksize /= DEV_BSIZE; 242184733Smlaier } 243184733Smlaier 244209362Sbrian if (threshold != 0) 245209362Sbrian threshold = howmany(threshold / DEV_BSIZE * cblocksize, 246209362Sbrian blocksize); 247209362Sbrian 24832097Sjkh rval = 0; 249128772Skientzle 250191677Simp (void)signal(SIGINFO, siginfo); 251191677Simp 2521590Srgrimes if ((fts = fts_open(argv, ftsoptions, NULL)) == NULL) 25332097Sjkh err(1, "fts_open"); 2541590Srgrimes 25532097Sjkh while ((p = fts_read(fts)) != NULL) { 2561590Srgrimes switch (p->fts_info) { 257184654Smlaier case FTS_D: /* Ignore. */ 258184654Smlaier if (ignorep(p)) 259184654Smlaier fts_set(fts, p, FTS_SKIP); 260184654Smlaier break; 261184654Smlaier case FTS_DP: 262184654Smlaier if (ignorep(p)) 2631590Srgrimes break; 26478158Sroam 265184733Smlaier curblocks = Aflag ? 266184733Smlaier howmany(p->fts_statp->st_size, cblocksize) : 267184733Smlaier howmany(p->fts_statp->st_blocks, cblocksize); 268184654Smlaier p->fts_parent->fts_bignum += p->fts_bignum += 269184733Smlaier curblocks; 270128772Skientzle 271209362Sbrian if (p->fts_level <= depth && threshold <= 272209362Sbrian threshold_sign * howmany(p->fts_bignum * 273209362Sbrian cblocksize, blocksize)) { 274184654Smlaier if (hflag) { 275184733Smlaier prthumanval(p->fts_bignum); 276184654Smlaier (void)printf("\t%s\n", p->fts_path); 277184654Smlaier } else { 278184654Smlaier (void)printf("%jd\t%s\n", 279184742Smlaier (intmax_t)howmany(p->fts_bignum * 280184742Smlaier cblocksize, blocksize), 281184742Smlaier p->fts_path); 28258601Scharnier } 283184654Smlaier } 284191677Simp if (info) { 285191677Simp info = 0; 286191677Simp (void)printf("\t%s\n", p->fts_path); 287191677Simp } 288184654Smlaier break; 289184654Smlaier case FTS_DC: /* Ignore. */ 290184654Smlaier break; 291184654Smlaier case FTS_DNR: /* Warn, continue. */ 292184654Smlaier case FTS_ERR: 293184654Smlaier case FTS_NS: 294184654Smlaier warnx("%s: %s", p->fts_path, strerror(p->fts_errno)); 295184654Smlaier rval = 1; 296184654Smlaier break; 297184654Smlaier default: 298184654Smlaier if (ignorep(p)) 29932097Sjkh break; 300184654Smlaier 301184654Smlaier if (lflag == 0 && p->fts_statp->st_nlink > 1 && 302184654Smlaier linkchk(p)) 30332097Sjkh break; 30478158Sroam 305184733Smlaier curblocks = Aflag ? 306184733Smlaier howmany(p->fts_statp->st_size, cblocksize) : 307184733Smlaier howmany(p->fts_statp->st_blocks, cblocksize); 308184733Smlaier 309227335Sed if (aflag || p->fts_level == 0) { 310184654Smlaier if (hflag) { 311184733Smlaier prthumanval(curblocks); 312184654Smlaier (void)printf("\t%s\n", p->fts_path); 313184654Smlaier } else { 314184654Smlaier (void)printf("%jd\t%s\n", 315184742Smlaier (intmax_t)howmany(curblocks * 316184742Smlaier cblocksize, blocksize), 317184742Smlaier p->fts_path); 31858601Scharnier } 319184654Smlaier } 32032097Sjkh 321184733Smlaier p->fts_parent->fts_bignum += curblocks; 3221590Srgrimes } 323139813Spjd savednumber = p->fts_parent->fts_bignum; 32432097Sjkh } 32532097Sjkh 3261590Srgrimes if (errno) 3271590Srgrimes err(1, "fts_read"); 32832097Sjkh 32958601Scharnier if (cflag) { 33056597Smharo if (hflag) { 331184733Smlaier prthumanval(savednumber); 332184654Smlaier (void)printf("\ttotal\n"); 33356597Smharo } else { 334184654Smlaier (void)printf("%jd\ttotal\n", (intmax_t)howmany( 335184733Smlaier savednumber * cblocksize, blocksize)); 33656597Smharo } 33758601Scharnier } 33832097Sjkh 33978158Sroam ignoreclean(); 34028891Swosch exit(rval); 3411590Srgrimes} 3421590Srgrimes 343128772Skientzlestatic int 344128772Skientzlelinkchk(FTSENT *p) 345128772Skientzle{ 346128772Skientzle struct links_entry { 347128806Skientzle struct links_entry *next; 348128806Skientzle struct links_entry *previous; 349128806Skientzle int links; 350128806Skientzle dev_t dev; 351128806Skientzle ino_t ino; 352128772Skientzle }; 353128806Skientzle static const size_t links_hash_initial_size = 8192; 354128806Skientzle static struct links_entry **buckets; 355128806Skientzle static struct links_entry *free_list; 356128806Skientzle static size_t number_buckets; 357128806Skientzle static unsigned long number_entries; 358128806Skientzle static char stop_allocating; 359128806Skientzle struct links_entry *le, **new_buckets; 360128806Skientzle struct stat *st; 361128806Skientzle size_t i, new_size; 362144840Sstefanf int hash; 36332097Sjkh 364128772Skientzle st = p->fts_statp; 36532097Sjkh 366128772Skientzle /* If necessary, initialize the hash table. */ 367128772Skientzle if (buckets == NULL) { 368128772Skientzle number_buckets = links_hash_initial_size; 369128772Skientzle buckets = malloc(number_buckets * sizeof(buckets[0])); 370128772Skientzle if (buckets == NULL) 371128834Skientzle errx(1, "No memory for hardlink detection"); 372128772Skientzle for (i = 0; i < number_buckets; i++) 373128772Skientzle buckets[i] = NULL; 374128772Skientzle } 3751590Srgrimes 376128772Skientzle /* If the hash table is getting too full, enlarge it. */ 377128772Skientzle if (number_entries > number_buckets * 10 && !stop_allocating) { 378128772Skientzle new_size = number_buckets * 2; 379128772Skientzle new_buckets = malloc(new_size * sizeof(struct links_entry *)); 380128772Skientzle 381128772Skientzle /* Try releasing the free list to see if that helps. */ 382128772Skientzle if (new_buckets == NULL && free_list != NULL) { 383128772Skientzle while (free_list != NULL) { 384128772Skientzle le = free_list; 385128772Skientzle free_list = le->next; 386128772Skientzle free(le); 387128772Skientzle } 388184654Smlaier new_buckets = malloc(new_size * 389184654Smlaier sizeof(new_buckets[0])); 390128772Skientzle } 391128772Skientzle 392128772Skientzle if (new_buckets == NULL) { 393128772Skientzle stop_allocating = 1; 394128834Skientzle warnx("No more memory for tracking hard links"); 395128772Skientzle } else { 396128772Skientzle memset(new_buckets, 0, 397128772Skientzle new_size * sizeof(struct links_entry *)); 398128772Skientzle for (i = 0; i < number_buckets; i++) { 399128772Skientzle while (buckets[i] != NULL) { 400128772Skientzle /* Remove entry from old bucket. */ 401128772Skientzle le = buckets[i]; 402128772Skientzle buckets[i] = le->next; 403128772Skientzle 404128772Skientzle /* Add entry to new bucket. */ 405128772Skientzle hash = (le->dev ^ le->ino) % new_size; 406128772Skientzle 407128772Skientzle if (new_buckets[hash] != NULL) 408128772Skientzle new_buckets[hash]->previous = 409128772Skientzle le; 410128772Skientzle le->next = new_buckets[hash]; 411128772Skientzle le->previous = NULL; 412128772Skientzle new_buckets[hash] = le; 413128772Skientzle } 414128772Skientzle } 415128772Skientzle free(buckets); 416128772Skientzle buckets = new_buckets; 417128772Skientzle number_buckets = new_size; 418128772Skientzle } 419128772Skientzle } 420128772Skientzle 421128772Skientzle /* Try to locate this entry in the hash table. */ 422128772Skientzle hash = ( st->st_dev ^ st->st_ino ) % number_buckets; 423128772Skientzle for (le = buckets[hash]; le != NULL; le = le->next) { 424128772Skientzle if (le->dev == st->st_dev && le->ino == st->st_ino) { 425128772Skientzle /* 426128772Skientzle * Save memory by releasing an entry when we've seen 427128772Skientzle * all of it's links. 428128772Skientzle */ 429128772Skientzle if (--le->links <= 0) { 430128772Skientzle if (le->previous != NULL) 431128772Skientzle le->previous->next = le->next; 432128772Skientzle if (le->next != NULL) 433128772Skientzle le->next->previous = le->previous; 434128772Skientzle if (buckets[hash] == le) 435128772Skientzle buckets[hash] = le->next; 436128772Skientzle number_entries--; 437128772Skientzle /* Recycle this node through the free list */ 438128772Skientzle if (stop_allocating) { 439128772Skientzle free(le); 440128772Skientzle } else { 441128772Skientzle le->next = free_list; 442128772Skientzle free_list = le; 443128772Skientzle } 444128772Skientzle } 445128772Skientzle return (1); 446128772Skientzle } 447128772Skientzle } 448128772Skientzle 449128772Skientzle if (stop_allocating) 450128772Skientzle return (0); 451128772Skientzle 452128772Skientzle /* Add this entry to the links cache. */ 453128772Skientzle if (free_list != NULL) { 454128772Skientzle /* Pull a node from the free list if we can. */ 455128772Skientzle le = free_list; 456128772Skientzle free_list = le->next; 457128772Skientzle } else 458128772Skientzle /* Malloc one if we have to. */ 459128772Skientzle le = malloc(sizeof(struct links_entry)); 460128772Skientzle if (le == NULL) { 461128772Skientzle stop_allocating = 1; 462128834Skientzle warnx("No more memory for tracking hard links"); 463128772Skientzle return (0); 464128772Skientzle } 465128772Skientzle le->dev = st->st_dev; 466128772Skientzle le->ino = st->st_ino; 467128772Skientzle le->links = st->st_nlink - 1; 468128772Skientzle number_entries++; 469128772Skientzle le->next = buckets[hash]; 470128772Skientzle le->previous = NULL; 471128772Skientzle if (buckets[hash] != NULL) 472128772Skientzle buckets[hash]->previous = le; 473128772Skientzle buckets[hash] = le; 4741590Srgrimes return (0); 4751590Srgrimes} 4761590Srgrimes 477184656Smlaierstatic void 478129678Spjdprthumanval(int64_t bytes) 47956597Smharo{ 480129678Spjd char buf[5]; 48156597Smharo 482184733Smlaier bytes *= cblocksize; 483184733Smlaier if (!Aflag) 484184733Smlaier bytes *= DEV_BSIZE; 48556597Smharo 486129678Spjd humanize_number(buf, sizeof(buf), bytes, "", HN_AUTOSCALE, 487129678Spjd HN_B | HN_NOSPACE | HN_DECIMAL); 48856597Smharo 489129678Spjd (void)printf("%4s", buf); 49056597Smharo} 49156597Smharo 49227099Scharnierstatic void 493100822Sdwmaloneusage(void) 4941590Srgrimes{ 4951590Srgrimes (void)fprintf(stderr, 496238817Spluknet "usage: du [-Aclnx] [-H | -L | -P] [-g | -h | -k | -m] " 497228356Sgjb "[-a | -s | -d depth] [-B blocksize] [-I mask] " 498228356Sgjb "[-t threshold] [file ...]\n"); 49956597Smharo exit(EX_USAGE); 5001590Srgrimes} 50178158Sroam 502184656Smlaierstatic void 503100822Sdwmaloneignoreadd(const char *mask) 50478158Sroam{ 50578158Sroam struct ignentry *ign; 50678158Sroam 50778158Sroam ign = calloc(1, sizeof(*ign)); 50878158Sroam if (ign == NULL) 50978158Sroam errx(1, "cannot allocate memory"); 51078158Sroam ign->mask = strdup(mask); 51178158Sroam if (ign->mask == NULL) 51278158Sroam errx(1, "cannot allocate memory"); 51378158Sroam SLIST_INSERT_HEAD(&ignores, ign, next); 51478158Sroam} 51578158Sroam 516184656Smlaierstatic void 517100822Sdwmaloneignoreclean(void) 51878158Sroam{ 51978158Sroam struct ignentry *ign; 52078158Sroam 52178158Sroam while (!SLIST_EMPTY(&ignores)) { 52278158Sroam ign = SLIST_FIRST(&ignores); 52378158Sroam SLIST_REMOVE_HEAD(&ignores, next); 52478158Sroam free(ign->mask); 52578158Sroam free(ign); 52678158Sroam } 52778158Sroam} 52878158Sroam 529184656Smlaierstatic int 530100822Sdwmaloneignorep(FTSENT *ent) 53178158Sroam{ 53278158Sroam struct ignentry *ign; 53378158Sroam 534158339Smaxim if (nodumpflag && (ent->fts_statp->st_flags & UF_NODUMP)) 535158339Smaxim return 1; 53678158Sroam SLIST_FOREACH(ign, &ignores, next) 53778158Sroam if (fnmatch(ign->mask, ent->fts_name, 0) != FNM_NOMATCH) 53878158Sroam return 1; 53978158Sroam return 0; 54078158Sroam} 541191677Simp 542191677Simpstatic void 543191677Simpsiginfo(int sig __unused) 544191677Simp{ 545191677Simp 546191677Simp info = 1; 547191677Simp} 548