138289Sbostic /* 238289Sbostic * Copyright (c) 1989 The Regents of the University of California. 338289Sbostic * All rights reserved. 438289Sbostic * 538289Sbostic * This code is derived from software contributed to Berkeley by 638289Sbostic * Michael Fischbein. 738289Sbostic * 851430Sbostic * %sccs.include.redist.c% 938289Sbostic */ 1038289Sbostic 1138289Sbostic #ifndef lint 12*52766Sbostic static char sccsid[] = "@(#)cmp.c 5.7 (Berkeley) 03/01/92"; 1338289Sbostic #endif /* not lint */ 1438289Sbostic 1538289Sbostic #include <sys/types.h> 1638289Sbostic #include <sys/stat.h> 1752258Selan #include <fts.h> 18*52766Sbostic #include <string.h> 1938289Sbostic #include "ls.h" 2051430Sbostic #include "extern.h" 2138289Sbostic 2251430Sbostic int 2338289Sbostic namecmp(a, b) 2452258Selan const FTSENT *a, *b; 2538289Sbostic { 2652258Selan return (strcmp(a->fts_name, b->fts_name)); 2738289Sbostic } 2838289Sbostic 2951430Sbostic int 3038289Sbostic revnamecmp(a, b) 3152258Selan const FTSENT *a, *b; 3238289Sbostic { 3352258Selan return (strcmp(b->fts_name, a->fts_name)); 3438289Sbostic } 3538289Sbostic 3651430Sbostic int 3738289Sbostic modcmp(a, b) 3852258Selan const FTSENT *a, *b; 3938289Sbostic { 4052258Selan return (b->fts_statp->st_mtime - a->fts_statp->st_mtime); 4138289Sbostic } 4238289Sbostic 4351430Sbostic int 4438289Sbostic revmodcmp(a, b) 4552258Selan const FTSENT *a, *b; 4638289Sbostic { 4752258Selan return (a->fts_statp->st_mtime - b->fts_statp->st_mtime); 4838289Sbostic } 4938289Sbostic 5051430Sbostic int 5138289Sbostic acccmp(a, b) 5252258Selan const FTSENT *a, *b; 5338289Sbostic { 5452258Selan return (b->fts_statp->st_atime - a->fts_statp->st_atime); 5538289Sbostic } 5638289Sbostic 5751430Sbostic int 5838289Sbostic revacccmp(a, b) 5952258Selan const FTSENT *a, *b; 6038289Sbostic { 6152258Selan return (a->fts_statp->st_atime - b->fts_statp->st_atime); 6238289Sbostic } 6338289Sbostic 6451430Sbostic int 6538289Sbostic statcmp(a, b) 6652258Selan const FTSENT *a, *b; 6738289Sbostic { 6852258Selan return (b->fts_statp->st_ctime - a->fts_statp->st_ctime); 6938289Sbostic } 7038289Sbostic 7151430Sbostic int 7238289Sbostic revstatcmp(a, b) 7352258Selan const FTSENT *a, *b; 7438289Sbostic { 7552258Selan return (a->fts_statp->st_ctime - b->fts_statp->st_ctime); 7638289Sbostic } 77