#include "kextfind_tables.h"
#include "kextfind_query.h"
#include "kextfind_report.h"
int longopt = 0;
struct option opt_info[] = {
{ kOptNameHelp, no_argument, NULL, kOptHelp },
{ kOptNameCaseInsensitive, no_argument, NULL, kOptCaseInsensitive },
{ kOptNameSearchItem, required_argument, NULL, kOptSearchItem },
{ kOptNameSystemExtensions, no_argument, NULL, kOptSystemExtensions },
{ kOptNameSubstring, no_argument, NULL, kOptSubstring },
#ifdef EXTRA_INFO
{ kOptNameExtraInfo, no_argument, &longopt, kLongOptExtraInfo },
#endif
{ kOptNameRelativePaths, no_argument, &longopt, kLongOptRelativePaths },
{ kOptNameNoPaths, no_argument, &longopt, kLongOptNoPaths },
#ifdef MEEK_PICKY
{ kOptNameMeek, no_argument, &longopt, kLongOptMeek },
{ kOptNamePicky, no_argument, &longopt, kLongOptPicky },
#endif
QUERY_PREDICATES
QUERY_COMMANDS
{ &kKeywordReport[1], no_argument, &longopt, kLongOptQueryPredicate },
{ NULL, 0, NULL, 0 } };
struct querySetup queryCallbackList[] = {
{ CFSTR(kPredNameProperty), CFSTR(kPredCharProperty),
parseProperty, evalProperty },
{ CFSTR(kPredNamePropertyExists), CFSTR(kPredCharPropertyExists),
parseProperty, NULL },
{ CFSTR(kPredNameMatchProperty), CFSTR(kPredCharMatchProperty),
parseMatchProperty, evalMatchProperty },
{ CFSTR(kPredNameMatchPropertyExists), CFSTR(kPredCharMatchPropertyExists),
parseMatchProperty, NULL },
{ CFSTR(kPredNameLoaded), NULL,
parseFlag, NULL },
{ CFSTR(kPredNameValid), CFSTR(kPredCharValid),
parseFlag, NULL },
{ CFSTR(kPredNameAuthentic), CFSTR(kPredCharAuthentic),
parseFlag, NULL },
{ CFSTR(kPredNameDependenciesMet), CFSTR(kPredCharDependenciesMet),
parseFlag, NULL },
{ CFSTR(kPredNameLoadable), CFSTR(kPredCharLoadable),
parseFlag, NULL },
{ CFSTR(kPredNameWarnings), CFSTR(kPredCharWarnings),
parseFlag, NULL },
{ CFSTR(kPredNameIsLibrary), CFSTR(kPredCharIsLibrary),
parseFlag, NULL },
{ CFSTR(kPredNameInvalid), CFSTR(kPredCharInvalid),
parseFlag, NULL },
{ CFSTR(kPredNameInauthentic), CFSTR(kPredCharInauthentic),
parseFlag, NULL },
{ CFSTR(kPredNameDependenciesMissing), CFSTR(kPredCharDependenciesMissing),
parseFlag, NULL },
{ CFSTR(kPredNameNonloadable), CFSTR(kPredCharNonloadable),
parseFlag, NULL },
{ CFSTR(kPredNameHasPlugins), NULL,
parseFlag, NULL },
{ CFSTR(kPredNameIsPlugin), NULL,
parseFlag, NULL },
{ CFSTR(kPredNameHasDebugProperties), NULL,
parseFlag, NULL },
{ CFSTR(kPredNameIsKernelResource), NULL,
parseFlag, NULL },
{ CFSTR(kPredNameVersion), CFSTR(kPredCharVersion),
parseVersion, evalVersion },
{ CFSTR(kPredNameCompatibleWithVersion), NULL,
parseCompatibleWithVersion, evalCompatibleWithVersion },
{ CFSTR(kPredNameIntegrity), NULL,
parseIntegrity, evalIntegrity },
{ CFSTR(kPredNameArch), NULL,
parseArch, evalArch },
{ CFSTR(kPredNameArchExact), CFSTR(kPredCharArchExact),
parseArch, evalArchExact },
{ CFSTR(kPredNameExecutable), CFSTR(kPredCharExecutable),
parseFlag, NULL },
{ CFSTR(kPredNameNoExecutable), CFSTR(kPredCharNoExecutable),
parseFlag, NULL },
{ CFSTR(kPredNameDefinesSymbol), CFSTR(kPredCharDefinesSymbol),
parseDefinesOrReferencesSymbol, evalDefinesOrReferencesSymbol },
{ CFSTR(kPredNameReferencesSymbol), CFSTR(kPredCharReferencesSymbol),
parseDefinesOrReferencesSymbol, evalDefinesOrReferencesSymbol },
{ CFSTR(kPredNameBundleID), CFSTR(kPredCharBundleID),
parseShorthand, NULL },
{ CFSTR(kPredNameBundleName), CFSTR(kPredCharBundleName),
parseBundleName, evalBundleName },
{ CFSTR(kPredNameRoot), CFSTR(kPredCharRoot),
parseShorthand, NULL },
{ CFSTR(kPredNameConsole), CFSTR(kPredCharConsole),
parseShorthand, NULL },
{ CFSTR(kPredNameLocalRoot), CFSTR(kPredCharLocalRoot),
parseShorthand, NULL },
{ CFSTR(kPredNameNetworkRoot), CFSTR(kPredCharNetworkRoot),
parseShorthand, NULL },
{ CFSTR(kPredNameSafeBoot), CFSTR(kPredCharSafeBoot),
parseShorthand, NULL },
{ CFSTR(kPredNameEcho), NULL,
parseCommand, NULL },
{ CFSTR(kPredNamePrint), NULL,
parseCommand, NULL },
{ CFSTR(kPredNamePrint0), NULL,
parseCommand, NULL },
{ CFSTR(kPredNamePrintDiagnostics), CFSTR(kPredCharPrintDiagnostics),
parseCommand, NULL },
{ CFSTR(kPredNamePrintProperty), CFSTR(kPredCharPrintProperty),
parseCommand, NULL },
{ CFSTR(kPredNamePrintArches), CFSTR(kPredCharPrintArches),
parseCommand, NULL },
{ CFSTR(kPredNamePrintDependencies), NULL,
parseCommand, NULL },
{ CFSTR(kPredNamePrintDependents), NULL,
parseCommand, NULL },
{ CFSTR(kPredNamePrintIntegrity), NULL,
parseCommand, NULL },
{ CFSTR(kPredNamePrintPlugins), NULL,
parseCommand, NULL },
{ CFSTR(kPredNamePrintInfoDictionary), CFSTR(kPredCharPrintInfoDictionary),
parseCommand, NULL },
{ CFSTR(kPredNamePrintExecutable), CFSTR(kPredCharPrintExecutable),
parseCommand, NULL },
{ CFSTR(kPredNameExec), NULL, parseExec, evalExec },
{ CFSTR(kPredNameFlag), NULL,
NULL, evalFlag },
{ CFSTR(kPredNameCommand), NULL,
NULL, evalCommand },
{ NULL, NULL, NULL, NULL }
};
struct querySetup reportCallbackList[] = {
{ CFSTR(kPredNameProperty), CFSTR(kPredCharProperty),
reportParseProperty, reportEvalProperty },
{ CFSTR(kPredNameLoaded), NULL,
reportParseFlag, NULL },
{ CFSTR(kPredNameValid), CFSTR(kPredCharValid),
reportParseFlag, NULL },
{ CFSTR(kPredNameAuthentic), CFSTR(kPredCharAuthentic),
reportParseFlag, NULL },
{ CFSTR(kPredNameDependenciesMet), CFSTR(kPredCharDependenciesMet),
reportParseFlag, NULL },
{ CFSTR(kPredNameLoadable), CFSTR(kPredCharLoadable),
reportParseFlag, NULL },
{ CFSTR(kPredNameWarnings), CFSTR(kPredCharWarnings),
reportParseFlag, NULL },
{ CFSTR(kPredNameIsLibrary), CFSTR(kPredCharIsLibrary),
reportParseFlag, NULL },
{ CFSTR(kPredNameHasPlugins), NULL,
reportParseFlag, NULL },
{ CFSTR(kPredNameIsPlugin), NULL,
reportParseFlag, NULL },
{ CFSTR(kPredNameHasDebugProperties), NULL,
reportParseFlag, NULL },
{ CFSTR(kPredNameIsKernelResource), NULL,
reportParseFlag, NULL },
{ CFSTR(kPredNameIntegrity), NULL,
reportParseFlag, NULL },
{ CFSTR(kPredNameVersion), CFSTR(kPredCharVersion),
reportParseShorthand, reportEvalProperty },
{ CFSTR(kPredNameArch), NULL,
reportParseArch, reportEvalArch },
{ CFSTR(kPredNameArchExact), CFSTR(kPredCharArchExact),
reportParseArch, reportEvalArchExact },
{ CFSTR(kPredNameExecutable), CFSTR(kPredCharExecutable),
reportParseFlag, NULL },
{ CFSTR(kPredNameSymbol), CFSTR(kPredCharSymbol),
reportParseDefinesOrReferencesSymbol, reportEvalDefinesOrReferencesSymbol },
{ CFSTR(kPredNameBundleID), CFSTR(kPredCharBundleID),
reportParseShorthand, NULL },
{ CFSTR(kPredNameBundleName), CFSTR(kPredCharBundleName),
reportParseCommand, NULL },
{ CFSTR(kPredNamePrint), NULL,
reportParseCommand, NULL },
{ CFSTR(kPredNamePrintProperty), CFSTR(kPredCharPrintProperty),
reportParseCommand, NULL },
{ CFSTR(kPredNamePrintArches), CFSTR(kPredCharPrintArches),
reportParseCommand, NULL },
{ CFSTR(kPredNamePrintDependencies), NULL,
reportParseCommand, NULL },
{ CFSTR(kPredNamePrintDependents), NULL,
reportParseCommand, NULL },
{ CFSTR(kPredNamePrintPlugins), NULL,
reportParseCommand, NULL },
{ CFSTR(kPredNamePrintIntegrity), NULL,
reportParseCommand, NULL },
{ CFSTR(kPredNamePrintInfoDictionary), CFSTR(kPredCharPrintInfoDictionary),
reportParseCommand, NULL },
{ CFSTR(kPredNamePrintExecutable), CFSTR(kPredCharPrintExecutable),
reportParseCommand, NULL },
{ CFSTR(kPredNameFlag), NULL,
NULL, reportEvalFlag },
{ CFSTR(kPredNameCommand), NULL,
NULL, reportEvalCommand },
{ NULL, NULL, NULL, NULL }
};