1 |
solar 10/11/27 05:00:18 |
2 |
|
3 |
Modified: qlist.c |
4 |
Log: |
5 |
- idl0r needed to split the atoms up in a simple way. this is a rework of his idea. |
6 |
|
7 |
Revision Changes Path |
8 |
1.56 portage-utils/qlist.c |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlist.c?rev=1.56&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlist.c?rev=1.56&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/portage-utils/qlist.c?r1=1.55&r2=1.56 |
13 |
|
14 |
Index: qlist.c |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-projects/portage-utils/qlist.c,v |
17 |
retrieving revision 1.55 |
18 |
retrieving revision 1.56 |
19 |
diff -u -r1.55 -r1.56 |
20 |
--- qlist.c 7 Apr 2010 05:58:16 -0000 1.55 |
21 |
+++ qlist.c 27 Nov 2010 05:00:18 -0000 1.56 |
22 |
@@ -1,7 +1,7 @@ |
23 |
/* |
24 |
* Copyright 2005-2010 Gentoo Foundation |
25 |
* Distributed under the terms of the GNU General Public License v2 |
26 |
- * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlist.c,v 1.55 2010/04/07 05:58:16 solar Exp $ |
27 |
+ * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlist.c,v 1.56 2010/11/27 05:00:18 solar Exp $ |
28 |
* |
29 |
* Copyright 2005-2010 Ned Ludd - <solar@g.o> |
30 |
* Copyright 2005-2010 Mike Frysinger - <vapier@g.o> |
31 |
@@ -10,11 +10,12 @@ |
32 |
|
33 |
#ifdef APPLET_qlist |
34 |
|
35 |
-#define QLIST_FLAGS "ISULDeados" COMMON_FLAGS |
36 |
+#define QLIST_FLAGS "ISULcDeados" COMMON_FLAGS |
37 |
static struct option const qlist_long_opts[] = { |
38 |
{"installed", no_argument, NULL, 'I'}, |
39 |
{"slots", no_argument, NULL, 'S'}, |
40 |
{"separator", no_argument, NULL, 'L'}, |
41 |
+ {"columns", no_argument, NULL, 'c'}, |
42 |
{"umap", no_argument, NULL, 'U'}, |
43 |
{"dups", no_argument, NULL, 'D'}, |
44 |
{"exact", no_argument, NULL, 'e'}, |
45 |
@@ -29,6 +30,7 @@ |
46 |
"Just show installed packages", |
47 |
"Display installed packages with slots", |
48 |
"Display : as the slot separator", |
49 |
+ "Display column view", |
50 |
"Display installed packages with flags used", |
51 |
"Only show package dups", |
52 |
"Exact match (only CAT/PN or PN without PV)", |
53 |
@@ -39,7 +41,7 @@ |
54 |
/* "query filename for pkgname", */ |
55 |
COMMON_OPTS_HELP |
56 |
}; |
57 |
-static const char qlist_rcsid[] = "$Id: qlist.c,v 1.55 2010/04/07 05:58:16 solar Exp $"; |
58 |
+static const char qlist_rcsid[] = "$Id: qlist.c,v 1.56 2010/11/27 05:00:18 solar Exp $"; |
59 |
#define qlist_usage(ret) usage(ret, QLIST_FLAGS, qlist_long_opts, qlist_opts_help, lookup_applet_idx("qlist")) |
60 |
|
61 |
extern char *grab_vdb_item(const char *, const char *, const char *); |
62 |
@@ -146,6 +148,7 @@ |
63 |
queue *sets = NULL; |
64 |
depend_atom *pkgname, *atom; |
65 |
char *slot_separator; |
66 |
+ int columns = 0; |
67 |
|
68 |
slot_separator = (char *) " "; |
69 |
|
70 |
@@ -167,9 +170,11 @@ |
71 |
case 'o': show_obj = 1; break; |
72 |
case 's': show_sym = 1; break; |
73 |
case 'D': dups_only = 1; exact = 1; just_pkgname = 1; break; |
74 |
+ case 'c': columns = 1; break; |
75 |
case 'f': break; |
76 |
} |
77 |
} |
78 |
+ if (columns) verbose = 0; /* if not set to zero; atom wont be exploded; segv */ |
79 |
/* default to showing syms and objs */ |
80 |
if (!show_dir && !show_obj && !show_sym) |
81 |
show_obj = show_sym = 1; |
82 |
@@ -260,9 +265,10 @@ |
83 |
slot = grab_vdb_item("SLOT", cat[j]->d_name, de[x]->d_name); |
84 |
|
85 |
/* display it */ |
86 |
- printf("%s%s/%s%s%s%s%s%s%s", BOLD, cat[j]->d_name, BLUE, |
87 |
- (pkgname ? pkgname->PN : de[x]->d_name), NORM, |
88 |
- YELLOW, slot ? slot_separator : "", slot ? slot : "", NORM); |
89 |
+ printf("%s%s/%s%s%s%s%s%s%s%s%s", BOLD, cat[j]->d_name, BLUE, |
90 |
+ (!columns ? (pkgname ? pkgname->PN : de[x]->d_name) : pkgname->PN), |
91 |
+ (columns ? " " : ""), (columns ? pkgname->PV : ""), |
92 |
+ NORM, YELLOW, slot ? slot_separator : "", slot ? slot : "", NORM); |
93 |
puts(umapstr(show_umap, cat[j]->d_name, de[x]->d_name)); |
94 |
} |
95 |
if (pkgname) |
96 |
@@ -330,9 +336,9 @@ |
97 |
char *slot = NULL; |
98 |
if (show_slots) |
99 |
slot = (char *) grab_vdb_item("SLOT", (const char *) atom->CATEGORY, (const char *) atom->P); |
100 |
- printf("%s%s/%s%s%s%s%s%s%s", BOLD, atom->CATEGORY, BLUE, |
101 |
- (verbose ? atom->P : atom->PN), NORM, |
102 |
- YELLOW, slot ? slot_separator : "", slot ? slot : "", NORM); |
103 |
+ printf("%s%s/%s%s%s%s%s%s%s%s%s", BOLD, atom->CATEGORY, BLUE, |
104 |
+ (!columns ? (verbose ? atom->P : atom->PN) : atom->PN), (columns ? " " : ""), (columns ? atom->PV : ""), |
105 |
+ NORM, YELLOW, slot ? slot_separator : "", slot ? slot : "", NORM); |
106 |
puts(umapstr(show_umap, atom->CATEGORY, atom->P)); |
107 |
} |
108 |
atom_implode(atom); |