commit:     0486e2a62cdce058a9a569940a93dae1f0442f1a
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat May 11 07:13:06 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat May 11 07:13:06 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=0486e2a6

libq/atom: split out SLOT and SUBSLOT for atom_format

it is a bit unclear whether SUBSLOT is part of SLOT or not, but PMS
doesn't allow '/' so probably it's supposed to be separate, hence split
them up, to format the former combo use %[SLOT]%[SUBSLOT]

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 libq/atom.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libq/atom.c b/libq/atom.c
index 0eaee5c..5627415 100644
--- a/libq/atom.c
+++ b/libq/atom.c
@@ -609,7 +609,7 @@ atom_to_string_r(char *buf, size_t buflen, depend_atom *a)
  *  %{keyword}: Always display the field that matches "keyword" or <unset>
  *  %[keyword]: Only display the field when it's set (or pverbose)
  * The possible "keywords" are:
- *  CATEGORY  P  PN  PV  PVR  PF  PR  SLOT  REPO  USE
+ *  CATEGORY  P  PN  PV  PVR  PF  PR  SLOT  SUBSLOT  REPO  USE
  *    - these are all the standard portage variables (so see ebuild(5))
  *  pfx - the version qualifier if set (e.g. > < = !)
  *  sfx - the version qualifier if set (e.g. *)
@@ -695,11 +695,16 @@ atom_format_r(
                                                                CYAN, 
atom->PR_int, NORM);
                                } else if (!strncmp("SLOT", fmt, len)) {
                                        if (showit || atom->SLOT)
-                                               append_buf(buf, buflen, 
"%s%s%s%s%s%s%s",
+                                               append_buf(buf, buflen, 
"%s%s%s%s",
                                                                YELLOW,
                                                                bracket == '[' 
? ":" : "",
                                                                atom->SLOT ? 
atom->SLOT : "<unset>",
-                                                               atom->SUBSLOT ? 
"/" : "",
+                                                               NORM);
+                               } else if (!strncmp("SUBSLOT", fmt, len)) {
+                                       if (showit || atom->SUBSLOT)
+                                               append_buf(buf, buflen, 
"%s%s%s%s%s",
+                                                               YELLOW,
+                                                               bracket == '[' 
? "/" : "",
                                                                atom->SUBSLOT ? 
atom->SUBSLOT : "",
                                                                
atom_slotdep_str[atom->slotdep],
                                                                NORM);

Reply via email to