Commit | Line | Data |
---|---|---|
dd195a2f | 1 | /* |
59d11f9a KB |
2 | * Copyright (c) 1989, 1993 |
3 | * The Regents of the University of California. All rights reserved. | |
dd195a2f KB |
4 | * |
5 | * This code is derived from software contributed to Berkeley by | |
6 | * Michael Fischbein. | |
7 | * | |
0ce0ae04 | 8 | * %sccs.include.redist.c% |
dd195a2f KB |
9 | */ |
10 | ||
11 | #ifndef lint | |
59d11f9a | 12 | static char sccsid[] = "@(#)cmp.c 8.1 (Berkeley) %G%"; |
dd195a2f KB |
13 | #endif /* not lint */ |
14 | ||
15 | #include <sys/types.h> | |
16 | #include <sys/stat.h> | |
0dca63c3 | 17 | |
e2e80ad2 | 18 | #include <fts.h> |
b651adfd | 19 | #include <string.h> |
0dca63c3 | 20 | |
dd195a2f | 21 | #include "ls.h" |
0ce0ae04 | 22 | #include "extern.h" |
dd195a2f | 23 | |
0ce0ae04 | 24 | int |
dd195a2f | 25 | namecmp(a, b) |
e2e80ad2 | 26 | const FTSENT *a, *b; |
dd195a2f | 27 | { |
e2e80ad2 | 28 | return (strcmp(a->fts_name, b->fts_name)); |
dd195a2f KB |
29 | } |
30 | ||
0ce0ae04 | 31 | int |
dd195a2f | 32 | revnamecmp(a, b) |
e2e80ad2 | 33 | const FTSENT *a, *b; |
dd195a2f | 34 | { |
e2e80ad2 | 35 | return (strcmp(b->fts_name, a->fts_name)); |
dd195a2f KB |
36 | } |
37 | ||
0ce0ae04 | 38 | int |
dd195a2f | 39 | modcmp(a, b) |
e2e80ad2 | 40 | const FTSENT *a, *b; |
dd195a2f | 41 | { |
e2e80ad2 | 42 | return (b->fts_statp->st_mtime - a->fts_statp->st_mtime); |
dd195a2f KB |
43 | } |
44 | ||
0ce0ae04 | 45 | int |
dd195a2f | 46 | revmodcmp(a, b) |
e2e80ad2 | 47 | const FTSENT *a, *b; |
dd195a2f | 48 | { |
e2e80ad2 | 49 | return (a->fts_statp->st_mtime - b->fts_statp->st_mtime); |
dd195a2f KB |
50 | } |
51 | ||
0ce0ae04 | 52 | int |
dd195a2f | 53 | acccmp(a, b) |
e2e80ad2 | 54 | const FTSENT *a, *b; |
dd195a2f | 55 | { |
e2e80ad2 | 56 | return (b->fts_statp->st_atime - a->fts_statp->st_atime); |
dd195a2f KB |
57 | } |
58 | ||
0ce0ae04 | 59 | int |
dd195a2f | 60 | revacccmp(a, b) |
e2e80ad2 | 61 | const FTSENT *a, *b; |
dd195a2f | 62 | { |
e2e80ad2 | 63 | return (a->fts_statp->st_atime - b->fts_statp->st_atime); |
dd195a2f KB |
64 | } |
65 | ||
0ce0ae04 | 66 | int |
dd195a2f | 67 | statcmp(a, b) |
e2e80ad2 | 68 | const FTSENT *a, *b; |
dd195a2f | 69 | { |
e2e80ad2 | 70 | return (b->fts_statp->st_ctime - a->fts_statp->st_ctime); |
dd195a2f KB |
71 | } |
72 | ||
0ce0ae04 | 73 | int |
dd195a2f | 74 | revstatcmp(a, b) |
e2e80ad2 | 75 | const FTSENT *a, *b; |
dd195a2f | 76 | { |
e2e80ad2 | 77 | return (a->fts_statp->st_ctime - b->fts_statp->st_ctime); |
dd195a2f | 78 | } |