View | Details | Raw Unified
Collapse All | Expand All

(-) qgrep.c.eclass (-3 / +12 lines)
 Lines 10-16    Link Here 
#ifdef APPLET_qgrep
#ifdef APPLET_qgrep
#define QGREP_FLAGS "IiHceE" COMMON_FLAGS
#define QGREP_FLAGS "IiHceEs" COMMON_FLAGS
static struct option const qgrep_long_opts[] = {
static struct option const qgrep_long_opts[] = {
	{"invert-match",  no_argument, NULL, 'I'},
	{"invert-match",  no_argument, NULL, 'I'},
	{"ignore-case",   no_argument, NULL, 'i'},
	{"ignore-case",   no_argument, NULL, 'i'},
 Lines 18-23    Link Here 
	{"count",         no_argument, NULL, 'c'},
	{"count",         no_argument, NULL, 'c'},
	{"regexp",        no_argument, NULL, 'e'},
	{"regexp",        no_argument, NULL, 'e'},
	{"eclass",        no_argument, NULL, 'E'},
	{"eclass",        no_argument, NULL, 'E'},
	{"skip-comments", no_argument, NULL, 's'},
	COMMON_LONG_OPTS
	COMMON_LONG_OPTS
};
};
static const char *qgrep_opts_help[] = {
static const char *qgrep_opts_help[] = {
 Lines 27-31    Link Here 
	"Only print a count of matching lines per FILE",
	"Only print a count of matching lines per FILE",
	"Use PATTERN as a regular expression",
	"Use PATTERN as a regular expression",
	"Search in eclasses instead of ebuilds",
	"Search in eclasses instead of ebuilds",
	"Skip comments lines",
	COMMON_OPTS_HELP
	COMMON_OPTS_HELP
};
};
 Lines 38-44    Link Here 
	int count = 0;
	int count = 0;
	char *p;
	char *p;
	char do_count, do_regex, do_eclass;
	char do_count, do_regex, do_eclass;
	char show_filename;
	char show_filename, skip_comments;
	FILE *fp = NULL;
	FILE *fp = NULL;
	DIR *eclass_dir = NULL;
	DIR *eclass_dir = NULL;
	struct dirent *dentry;
	struct dirent *dentry;
 Lines 54-60    Link Here 
	DBG("argc=%d argv[0]=%s argv[1]=%s",
	DBG("argc=%d argv[0]=%s argv[1]=%s",
	    argc, argv[0], argc > 1 ? argv[1] : "NULL?");
	    argc, argv[0], argc > 1 ? argv[1] : "NULL?");
	do_count = do_regex = do_eclass = show_filename = 0;
	do_count = do_regex = do_eclass = show_filename = skip_comments = 0;
	while ((i = GETOPT_LONG(QGREP, qgrep, "")) != -1) {
	while ((i = GETOPT_LONG(QGREP, qgrep, "")) != -1) {
		switch (i) {
		switch (i) {
 Lines 67-72    Link Here 
		case 'e': do_regex = 1; break;
		case 'e': do_regex = 1; break;
		case 'E': do_eclass = 1; break;
		case 'E': do_eclass = 1; break;
		case 'H': show_filename = 1; break;
		case 'H': show_filename = 1; break;
		case 's': skip_comments = 1; break;
		COMMON_GETOPTS_CASES(qgrep)
		COMMON_GETOPTS_CASES(qgrep)
		}
		}
	}
	}
 Lines 107-112    Link Here 
				if ((p = strrchr(buf0, '\r')) != NULL)
				if ((p = strrchr(buf0, '\r')) != NULL)
					*p = 0;
					*p = 0;
				if (skip_comments) {
					p = buf0;
					while (*p == ' ' || *p == '\t') p++;
					if (*p == '#') continue;
				}
				if (!invert_match) {
				if (!invert_match) {
					if (do_regex == 0) {
					if (do_regex == 0) {
						if (( (FUNC *) (strfunc) (buf0, argv[optind])) == NULL) continue;
						if (( (FUNC *) (strfunc) (buf0, argv[optind])) == NULL) continue;