option.c (207677) | option.c (207705) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Cimarron D. Taylor of the University of California, Berkeley. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 18 unchanged lines hidden (view full) --- 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. | 1/*- 2 * Copyright (c) 1990, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Cimarron D. Taylor of the University of California, Berkeley. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 18 unchanged lines hidden (view full) --- 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. |
35 * 36 * @(#)option.c 8.2 (Berkeley) 4/16/94 | |
37 */ 38 | 35 */ 36 |
37#ifndef lint 38/* 39static char sccsid[] = "@(#)option.c 8.2 (Berkeley) 4/16/94"; 40*/ 41#endif /* not lint */ 42 |
|
39#include <sys/cdefs.h> | 43#include <sys/cdefs.h> |
40__FBSDID("$FreeBSD: head/usr.bin/find/option.c 207677 2010-05-05 21:24:18Z delphij $"); | 44__FBSDID("$FreeBSD: head/usr.bin/find/option.c 207705 2010-05-06 17:06:36Z delphij $"); |
41 42#include <sys/types.h> 43#include <sys/stat.h> 44 45#include <err.h> 46#include <fts.h> 47#include <regex.h> 48#include <stdio.h> 49#include <stdlib.h> 50#include <string.h> 51 52#include "find.h" 53 | 45 46#include <sys/types.h> 47#include <sys/stat.h> 48 49#include <err.h> 50#include <fts.h> 51#include <regex.h> 52#include <stdio.h> 53#include <stdlib.h> 54#include <string.h> 55 56#include "find.h" 57 |
54int typecompare(const void *, const void *); | 58static int typecompare(const void *, const void *); |
55 56/* NB: the following table must be sorted lexically. */ 57/* Options listed with C++ comments are in gnu find, but not our find */ 58static OPTION const options[] = { 59 { "!", c_simple, f_not, 0 }, 60 { "(", c_simple, f_openparen, 0 }, 61 { ")", c_simple, f_closeparen, 0 }, 62 { "-Bmin", c_Xmin, f_Xmin, F_TIME_B }, --- 122 unchanged lines hidden (view full) --- 185{ 186 OPTION tmp; 187 188 tmp.name = name; 189 return ((OPTION *)bsearch(&tmp, options, 190 sizeof(options)/sizeof(OPTION), sizeof(OPTION), typecompare)); 191} 192 | 59 60/* NB: the following table must be sorted lexically. */ 61/* Options listed with C++ comments are in gnu find, but not our find */ 62static OPTION const options[] = { 63 { "!", c_simple, f_not, 0 }, 64 { "(", c_simple, f_openparen, 0 }, 65 { ")", c_simple, f_closeparen, 0 }, 66 { "-Bmin", c_Xmin, f_Xmin, F_TIME_B }, --- 122 unchanged lines hidden (view full) --- 189{ 190 OPTION tmp; 191 192 tmp.name = name; 193 return ((OPTION *)bsearch(&tmp, options, 194 sizeof(options)/sizeof(OPTION), sizeof(OPTION), typecompare)); 195} 196 |
193int | 197static int |
194typecompare(const void *a, const void *b) 195{ 196 return (strcmp(((const OPTION *)a)->name, ((const OPTION *)b)->name)); 197} | 198typecompare(const void *a, const void *b) 199{ 200 return (strcmp(((const OPTION *)a)->name, ((const OPTION *)b)->name)); 201} |