xref: /original-bsd/bin/ls/cmp.c (revision e59fb703)
1 /*
2  * Copyright (c) 1989 The Regents of the University of California.
3  * 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	5.5 (Berkeley) 10/28/91";
13 #endif /* not lint */
14 
15 #include <sys/types.h>
16 #include <sys/stat.h>
17 #include "ls.h"
18 #include "extern.h"
19 
20 int
21 namecmp(a, b)
22 	LS *a, *b;
23 {
24 	return (strcmp(a->name, b->name));
25 }
26 
27 int
28 revnamecmp(a, b)
29 	LS *a, *b;
30 {
31 	return (strcmp(b->name, a->name));
32 }
33 
34 int
35 modcmp(a, b)
36 	LS *a, *b;
37 {
38 	return (b->lstat.st_mtime - a->lstat.st_mtime);
39 }
40 
41 int
42 revmodcmp(a, b)
43 	LS *a, *b;
44 {
45 	return (a->lstat.st_mtime - b->lstat.st_mtime);
46 }
47 
48 int
49 acccmp(a, b)
50 	LS *a, *b;
51 {
52 	return (b->lstat.st_atime - a->lstat.st_atime);
53 }
54 
55 int
56 revacccmp(a, b)
57 	LS *a, *b;
58 {
59 	return (a->lstat.st_atime - b->lstat.st_atime);
60 }
61 
62 int
63 statcmp(a, b)
64 	LS *a, *b;
65 {
66 	return (b->lstat.st_ctime - a->lstat.st_ctime);
67 }
68 
69 int
70 revstatcmp(a, b)
71 	LS *a, *b;
72 {
73 	return (a->lstat.st_ctime - b->lstat.st_ctime);
74 }
75