cmp.c (205793) | cmp.c (242725) |
---|---|
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 * Redistribution and use in source and binary forms, with or without --- 22 unchanged lines hidden (view full) --- 31 */ 32 33#if 0 34#ifndef lint 35static char sccsid[] = "@(#)cmp.c 8.1 (Berkeley) 5/31/93"; 36#endif /* not lint */ 37#endif 38#include <sys/cdefs.h> | 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 * Redistribution and use in source and binary forms, with or without --- 22 unchanged lines hidden (view full) --- 31 */ 32 33#if 0 34#ifndef lint 35static char sccsid[] = "@(#)cmp.c 8.1 (Berkeley) 5/31/93"; 36#endif /* not lint */ 37#endif 38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: head/bin/ls/cmp.c 205793 2010-03-28 13:16:08Z ed $"); | 39__FBSDID("$FreeBSD: head/bin/ls/cmp.c 242725 2012-11-08 00:24:26Z grog $"); |
40 41 42#include <sys/types.h> 43#include <sys/stat.h> 44 45#include <fts.h> 46#include <string.h> 47 --- 25 unchanged lines hidden (view full) --- 73 a->fts_statp->st_mtim.tv_sec) 74 return (-1); 75 if (b->fts_statp->st_mtim.tv_nsec > 76 a->fts_statp->st_mtim.tv_nsec) 77 return (1); 78 if (b->fts_statp->st_mtim.tv_nsec < 79 a->fts_statp->st_mtim.tv_nsec) 80 return (-1); | 40 41 42#include <sys/types.h> 43#include <sys/stat.h> 44 45#include <fts.h> 46#include <string.h> 47 --- 25 unchanged lines hidden (view full) --- 73 a->fts_statp->st_mtim.tv_sec) 74 return (-1); 75 if (b->fts_statp->st_mtim.tv_nsec > 76 a->fts_statp->st_mtim.tv_nsec) 77 return (1); 78 if (b->fts_statp->st_mtim.tv_nsec < 79 a->fts_statp->st_mtim.tv_nsec) 80 return (-1); |
81 return (strcoll(a->fts_name, b->fts_name)); | 81 if (f_samesort) 82 return (strcoll(b->fts_name, a->fts_name)); 83 else 84 return (strcoll(a->fts_name, b->fts_name)); |
82} 83 84int 85revmodcmp(const FTSENT *a, const FTSENT *b) 86{ 87 88 return (modcmp(b, a)); 89} --- 9 unchanged lines hidden (view full) --- 99 a->fts_statp->st_atim.tv_sec) 100 return (-1); 101 if (b->fts_statp->st_atim.tv_nsec > 102 a->fts_statp->st_atim.tv_nsec) 103 return (1); 104 if (b->fts_statp->st_atim.tv_nsec < 105 a->fts_statp->st_atim.tv_nsec) 106 return (-1); | 85} 86 87int 88revmodcmp(const FTSENT *a, const FTSENT *b) 89{ 90 91 return (modcmp(b, a)); 92} --- 9 unchanged lines hidden (view full) --- 102 a->fts_statp->st_atim.tv_sec) 103 return (-1); 104 if (b->fts_statp->st_atim.tv_nsec > 105 a->fts_statp->st_atim.tv_nsec) 106 return (1); 107 if (b->fts_statp->st_atim.tv_nsec < 108 a->fts_statp->st_atim.tv_nsec) 109 return (-1); |
107 return (strcoll(a->fts_name, b->fts_name)); | 110 if (f_samesort) 111 return (strcoll(b->fts_name, a->fts_name)); 112 else 113 return (strcoll(a->fts_name, b->fts_name)); |
108} 109 110int 111revacccmp(const FTSENT *a, const FTSENT *b) 112{ 113 114 return (acccmp(b, a)); 115} --- 9 unchanged lines hidden (view full) --- 125 a->fts_statp->st_birthtim.tv_sec) 126 return (-1); 127 if (b->fts_statp->st_birthtim.tv_nsec > 128 a->fts_statp->st_birthtim.tv_nsec) 129 return (1); 130 if (b->fts_statp->st_birthtim.tv_nsec < 131 a->fts_statp->st_birthtim.tv_nsec) 132 return (-1); | 114} 115 116int 117revacccmp(const FTSENT *a, const FTSENT *b) 118{ 119 120 return (acccmp(b, a)); 121} --- 9 unchanged lines hidden (view full) --- 131 a->fts_statp->st_birthtim.tv_sec) 132 return (-1); 133 if (b->fts_statp->st_birthtim.tv_nsec > 134 a->fts_statp->st_birthtim.tv_nsec) 135 return (1); 136 if (b->fts_statp->st_birthtim.tv_nsec < 137 a->fts_statp->st_birthtim.tv_nsec) 138 return (-1); |
133 return (strcoll(a->fts_name, b->fts_name)); | 139 if (f_samesort) 140 return (strcoll(b->fts_name, a->fts_name)); 141 else 142 return (strcoll(a->fts_name, b->fts_name)); |
134} 135 136int 137revbirthcmp(const FTSENT *a, const FTSENT *b) 138{ 139 140 return (birthcmp(b, a)); 141} --- 9 unchanged lines hidden (view full) --- 151 a->fts_statp->st_ctim.tv_sec) 152 return (-1); 153 if (b->fts_statp->st_ctim.tv_nsec > 154 a->fts_statp->st_ctim.tv_nsec) 155 return (1); 156 if (b->fts_statp->st_ctim.tv_nsec < 157 a->fts_statp->st_ctim.tv_nsec) 158 return (-1); | 143} 144 145int 146revbirthcmp(const FTSENT *a, const FTSENT *b) 147{ 148 149 return (birthcmp(b, a)); 150} --- 9 unchanged lines hidden (view full) --- 160 a->fts_statp->st_ctim.tv_sec) 161 return (-1); 162 if (b->fts_statp->st_ctim.tv_nsec > 163 a->fts_statp->st_ctim.tv_nsec) 164 return (1); 165 if (b->fts_statp->st_ctim.tv_nsec < 166 a->fts_statp->st_ctim.tv_nsec) 167 return (-1); |
159 return (strcoll(a->fts_name, b->fts_name)); | 168 if (f_samesort) 169 return (strcoll(b->fts_name, a->fts_name)); 170 else 171 return (strcoll(a->fts_name, b->fts_name)); |
160} 161 162int 163revstatcmp(const FTSENT *a, const FTSENT *b) 164{ 165 166 return (statcmp(b, a)); 167} --- 18 unchanged lines hidden --- | 172} 173 174int 175revstatcmp(const FTSENT *a, const FTSENT *b) 176{ 177 178 return (statcmp(b, a)); 179} --- 18 unchanged lines hidden --- |