mirror of
https://github.com/sheumann/hush.git
synced 2025-01-04 22:34:37 +00:00
- use index_in_str_array also for find_main
text data bss dec hex filename 2605 1 12 2618 a3a find.o.r18274 2602 1 12 2615 a37 find.o.r18275
This commit is contained in:
parent
307d27df4f
commit
a87ed2c716
@ -646,6 +646,11 @@ int find_main(int argc, char **argv)
|
|||||||
char *arg;
|
char *arg;
|
||||||
char **argp;
|
char **argp;
|
||||||
int i, firstopt, status = EXIT_SUCCESS;
|
int i, firstopt, status = EXIT_SUCCESS;
|
||||||
|
const char * const options[] = {
|
||||||
|
"-follow",
|
||||||
|
USE_FEATURE_FIND_XDEV( "-xdev", )
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
for (firstopt = 1; firstopt < argc; firstopt++) {
|
for (firstopt = 1; firstopt < argc; firstopt++) {
|
||||||
if (argv[firstopt][0] == '-')
|
if (argv[firstopt][0] == '-')
|
||||||
@ -672,12 +677,13 @@ int find_main(int argc, char **argv)
|
|||||||
/* (-a will be ignored by recursive parser later) */
|
/* (-a will be ignored by recursive parser later) */
|
||||||
argp = &argv[firstopt];
|
argp = &argv[firstopt];
|
||||||
while ((arg = argp[0])) {
|
while ((arg = argp[0])) {
|
||||||
if (strcmp(arg, "-follow") == 0) {
|
i = index_in_str_array(options, arg);
|
||||||
|
if (i == 0) { /* -follow */
|
||||||
dereference = TRUE;
|
dereference = TRUE;
|
||||||
argp[0] = (char*)"-a";
|
argp[0] = (char*)"-a";
|
||||||
}
|
}
|
||||||
#if ENABLE_FEATURE_FIND_XDEV
|
#if ENABLE_FEATURE_FIND_XDEV
|
||||||
else if (strcmp(arg, "-xdev") == 0) {
|
else if (i == 1) { /* -xdev */
|
||||||
struct stat stbuf;
|
struct stat stbuf;
|
||||||
if (!xdev_count) {
|
if (!xdev_count) {
|
||||||
xdev_count = firstopt - 1;
|
xdev_count = firstopt - 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user