Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 113549 Details for
Bug 170797
app-portage/portage-utils - add a -s/--skip-comments option to qgrep
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
qgrep--add_eclass_option.patch
qgrep--add_eclass_option.patch (text/plain), 3.00 KB, created by
TGL
on 2007-03-17 08:37:03 UTC
(
hide
)
Description:
qgrep--add_eclass_option.patch
Filename:
MIME Type:
Creator:
TGL
Created:
2007-03-17 08:37:03 UTC
Size:
3.00 KB
patch
obsolete
>Index: qgrep.c >=================================================================== >RCS file: /var/cvsroot/gentoo-projects/portage-utils/qgrep.c,v >retrieving revision 1.15 >diff -u -r1.15 qgrep.c >--- qgrep.c 9 Nov 2006 00:18:05 -0000 1.15 >+++ qgrep.c 17 Mar 2007 08:29:36 -0000 >@@ -10,13 +10,14 @@ > > #ifdef APPLET_qgrep > >-#define QGREP_FLAGS "IiHce" COMMON_FLAGS >+#define QGREP_FLAGS "IiHceE" COMMON_FLAGS > static struct option const qgrep_long_opts[] = { > {"invert-match", no_argument, NULL, 'I'}, > {"ignore-case", no_argument, NULL, 'i'}, > {"with-filename", no_argument, NULL, 'H'}, > {"count", no_argument, NULL, 'c'}, > {"regexp", no_argument, NULL, 'e'}, >+ {"eclass", no_argument, NULL, 'E'}, > COMMON_LONG_OPTS > }; > static const char *qgrep_opts_help[] = { >@@ -25,5 +26,6 @@ > "Print the filename for each match", > "Only print a count of matching lines per FILE", > "Use PATTERN as a regular expression", >+ "Search in eclasses instead of ebuilds", > COMMON_OPTS_HELP > }; >@@ -35,9 +37,11 @@ > int i; > int count = 0; > char *p; >- char do_count, do_regex; >+ char do_count, do_regex, do_eclass; > char show_filename; >- FILE *fp; >+ FILE *fp = NULL; >+ DIR *eclass_dir = NULL; >+ struct dirent *dentry; > char ebuild[_Q_PATH_MAX]; > char buf0[BUFSIZ]; > int reflags = REG_NOSUB; >@@ -49,7 +53,7 @@ > DBG("argc=%d argv[0]=%s argv[1]=%s", > argc, argv[0], argc > 1 ? argv[1] : "NULL?"); > >- do_count = do_regex = show_filename = 0; >+ do_count = do_regex = do_eclass = show_filename = 0; > > while ((i = GETOPT_LONG(QGREP, qgrep, "")) != -1) { > switch (i) { >@@ -60,6 +64,7 @@ > break; > case 'c': do_count = 1; break; > case 'e': do_regex = 1; break; >+ case 'E': do_eclass = 1; break; > case 'H': show_filename = 1; break; > COMMON_GETOPTS_CASES(qgrep) > } >@@ -67,14 +72,29 @@ > if (argc == optind) > qgrep_usage(EXIT_FAILURE); > >- initialize_ebuild_flat(); /* sets our pwd to $PORTDIR */ >+ if (!do_eclass) { >+ initialize_ebuild_flat(); /* sets our pwd to $PORTDIR */ >+ if ((fp = fopen(CACHE_EBUILD_FILE, "r")) == NULL) >+ return 1; >+ } else { >+ if ((chdir(portdir)) != 0) >+ errp("chdir to PORTDIR '%s' failed", portdir); >+ if ((eclass_dir = opendir("eclass")) == NULL) >+ errp("opendir(\"%s/eclass\") failed", portdir); >+ } > >- if ((fp = fopen(CACHE_EBUILD_FILE, "r")) == NULL) >- return 1; >- while ((fgets(ebuild, sizeof(ebuild), fp)) != NULL) { >+ while (do_eclass >+ ? ((dentry = readdir(eclass_dir)) >+ && snprintf(ebuild, sizeof(ebuild), "eclass/%s", dentry->d_name)) >+ : ((fgets(ebuild, sizeof(ebuild), fp)) != NULL)) { > FILE *newfp; >- if ((p = strchr(ebuild, '\n')) != NULL) >- *p = 0; >+ if (do_eclass) { >+ if ((p = strrchr(ebuild, '.')) == NULL) >+ continue; >+ if (strcmp(p, ".eclass")) >+ continue; >+ } else if ((p = strchr(ebuild, '\n')) != NULL) >+ *p = 0; > if ((newfp = fopen(ebuild, "r")) != NULL) { > unsigned int lineno = 0; > count = 0; >@@ -116,7 +136,10 @@ > } > } > } >- fclose(fp); >+ if (do_eclass) >+ closedir(eclass_dir); >+ else >+ fclose(fp); > return EXIT_SUCCESS; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 170797
:
113221
|
113549