1 /* 2 * Copyright (c) 1989, 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 * Michael Fischbein. 7 * 8 * %sccs.include.redist.c% 9 */ 10 11 #ifndef lint 12 static char sccsid[] = "@(#)cmp.c 8.1 (Berkeley) 05/31/93"; 13 #endif /* not lint */ 14 15 #include <sys/types.h> 16 #include <sys/stat.h> 17 18 #include <fts.h> 19 #include <string.h> 20 21 #include "ls.h" 22 #include "extern.h" 23 24 int 25 namecmp(a, b) 26 const FTSENT *a, *b; 27 { 28 return (strcmp(a->fts_name, b->fts_name)); 29 } 30 31 int 32 revnamecmp(a, b) 33 const FTSENT *a, *b; 34 { 35 return (strcmp(b->fts_name, a->fts_name)); 36 } 37 38 int 39 modcmp(a, b) 40 const FTSENT *a, *b; 41 { 42 return (b->fts_statp->st_mtime - a->fts_statp->st_mtime); 43 } 44 45 int 46 revmodcmp(a, b) 47 const FTSENT *a, *b; 48 { 49 return (a->fts_statp->st_mtime - b->fts_statp->st_mtime); 50 } 51 52 int 53 acccmp(a, b) 54 const FTSENT *a, *b; 55 { 56 return (b->fts_statp->st_atime - a->fts_statp->st_atime); 57 } 58 59 int 60 revacccmp(a, b) 61 const FTSENT *a, *b; 62 { 63 return (a->fts_statp->st_atime - b->fts_statp->st_atime); 64 } 65 66 int 67 statcmp(a, b) 68 const FTSENT *a, *b; 69 { 70 return (b->fts_statp->st_ctime - a->fts_statp->st_ctime); 71 } 72 73 int 74 revstatcmp(a, b) 75 const FTSENT *a, *b; 76 { 77 return (a->fts_statp->st_ctime - b->fts_statp->st_ctime); 78 } 79