162 lines
3.6 KiB
C
162 lines
3.6 KiB
C
/*-
|
|
* Copyright (c) 2010-2013 Kai Wang
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
* SUCH DAMAGE.
|
|
*
|
|
* $Id: ld_options.h 3405 2016-02-14 10:56:34Z jkoshy $
|
|
*/
|
|
|
|
enum ld_dash {
|
|
ONE_DASH,
|
|
TWO_DASH,
|
|
ANY_DASH
|
|
};
|
|
|
|
enum ld_arg {
|
|
NO_ARG,
|
|
REQ_ARG,
|
|
OPT_ARG
|
|
};
|
|
|
|
enum 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wildcard {
|
|
char *lw_name; /* wildcard */
|
|
enum ld_wildcard_sort lw_sort; /* sort mode */
|
|
};
|
|
|
|
void ld_options_parse(struct ld*, int, char **);
|
|
struct ld_wildcard *ld_wildcard_alloc(struct ld *);
|
|
void ld_wildcard_free(void *);
|