| 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 | * Redistribution and use in source and binary forms are permitted |
| 9 | * provided that the above copyright notice and this paragraph are |
| 10 | * duplicated in all such forms and that any documentation, |
| 11 | * advertising materials, and other materials related to such |
| 12 | * distribution and use acknowledge that the software was developed |
| 13 | * by the University of California, Berkeley. The name of the |
| 14 | * University may not be used to endorse or promote products derived |
| 15 | * from this software without specific prior written permission. |
| 16 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
| 17 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 19 | */ |
| 20 | |
| 21 | #ifndef lint |
| 22 | static char sccsid[] = "@(#)cmp.c 5.1 (Berkeley) %G%"; |
| 23 | #endif /* not lint */ |
| 24 | |
| 25 | #include <sys/types.h> |
| 26 | #include <sys/stat.h> |
| 27 | #include "ls.h" |
| 28 | |
| 29 | namecmp(a, b) |
| 30 | LS *a, *b; |
| 31 | { |
| 32 | return(strcmp(a->name, b->name)); |
| 33 | } |
| 34 | |
| 35 | revnamecmp(a, b) |
| 36 | LS *a, *b; |
| 37 | { |
| 38 | return(strcmp(b->name, a->name)); |
| 39 | } |
| 40 | |
| 41 | modcmp(a, b) |
| 42 | LS *a, *b; |
| 43 | { |
| 44 | return(a->lstat.st_mtime < b->lstat.st_mtime); |
| 45 | } |
| 46 | |
| 47 | revmodcmp(a, b) |
| 48 | LS *a, *b; |
| 49 | { |
| 50 | return(b->lstat.st_mtime < a->lstat.st_mtime); |
| 51 | } |
| 52 | |
| 53 | acccmp(a, b) |
| 54 | LS *a, *b; |
| 55 | { |
| 56 | return(a->lstat.st_atime < b->lstat.st_atime); |
| 57 | } |
| 58 | |
| 59 | revacccmp(a, b) |
| 60 | LS *a, *b; |
| 61 | { |
| 62 | return(b->lstat.st_atime < a->lstat.st_atime); |
| 63 | } |
| 64 | |
| 65 | statcmp(a, b) |
| 66 | LS *a, *b; |
| 67 | { |
| 68 | return(a->lstat.st_ctime < b->lstat.st_ctime); |
| 69 | } |
| 70 | |
| 71 | revstatcmp(a, b) |
| 72 | LS *a, *b; |
| 73 | { |
| 74 | return(b->lstat.st_ctime < a->lstat.st_ctime); |
| 75 | } |