138289Sbostic /*
2*60671Sbostic * Copyright (c) 1989, 1993
3*60671Sbostic * The Regents of the University of California. 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*60671Sbostic static char sccsid[] = "@(#)cmp.c 8.1 (Berkeley) 05/31/93";
1338289Sbostic #endif /* not lint */
1438289Sbostic
1538289Sbostic #include <sys/types.h>
1638289Sbostic #include <sys/stat.h>
1759501Sbostic
1852258Selan #include <fts.h>
1952766Sbostic #include <string.h>
2059501Sbostic
2138289Sbostic #include "ls.h"
2251430Sbostic #include "extern.h"
2338289Sbostic
2451430Sbostic int
namecmp(a,b)2538289Sbostic namecmp(a, b)
2652258Selan const FTSENT *a, *b;
2738289Sbostic {
2852258Selan return (strcmp(a->fts_name, b->fts_name));
2938289Sbostic }
3038289Sbostic
3151430Sbostic int
revnamecmp(a,b)3238289Sbostic revnamecmp(a, b)
3352258Selan const FTSENT *a, *b;
3438289Sbostic {
3552258Selan return (strcmp(b->fts_name, a->fts_name));
3638289Sbostic }
3738289Sbostic
3851430Sbostic int
modcmp(a,b)3938289Sbostic modcmp(a, b)
4052258Selan const FTSENT *a, *b;
4138289Sbostic {
4252258Selan return (b->fts_statp->st_mtime - a->fts_statp->st_mtime);
4338289Sbostic }
4438289Sbostic
4551430Sbostic int
revmodcmp(a,b)4638289Sbostic revmodcmp(a, b)
4752258Selan const FTSENT *a, *b;
4838289Sbostic {
4952258Selan return (a->fts_statp->st_mtime - b->fts_statp->st_mtime);
5038289Sbostic }
5138289Sbostic
5251430Sbostic int
acccmp(a,b)5338289Sbostic acccmp(a, b)
5452258Selan const FTSENT *a, *b;
5538289Sbostic {
5652258Selan return (b->fts_statp->st_atime - a->fts_statp->st_atime);
5738289Sbostic }
5838289Sbostic
5951430Sbostic int
revacccmp(a,b)6038289Sbostic revacccmp(a, b)
6152258Selan const FTSENT *a, *b;
6238289Sbostic {
6352258Selan return (a->fts_statp->st_atime - b->fts_statp->st_atime);
6438289Sbostic }
6538289Sbostic
6651430Sbostic int
statcmp(a,b)6738289Sbostic statcmp(a, b)
6852258Selan const FTSENT *a, *b;
6938289Sbostic {
7052258Selan return (b->fts_statp->st_ctime - a->fts_statp->st_ctime);
7138289Sbostic }
7238289Sbostic
7351430Sbostic int
revstatcmp(a,b)7438289Sbostic revstatcmp(a, b)
7552258Selan const FTSENT *a, *b;
7638289Sbostic {
7752258Selan return (a->fts_statp->st_ctime - b->fts_statp->st_ctime);
7838289Sbostic }
79