On Tue, Mar 17, 2020 at 03:26:56PM +0100, Mark Kettenis wrote:
> > @@ -2889,7 +2896,8 @@ list_components(void)
> >  
> >     pri_init(pri);
> >  
> > +   printf("PATH\t\tNAME\n");
> 
> Using tabs to make things line up isn't going to work very well.  So
> better use field widths in the printf calls.
Sure thing, assignable paths should not be longer than 15 characters, so
I went with even 16 as column width.

OK?


Index: config.c
===================================================================
RCS file: /cvs/src/usr.sbin/ldomctl/config.c,v
retrieving revision 1.35
diff -u -p -r1.35 config.c
--- config.c    7 Mar 2020 18:51:06 -0000       1.35
+++ config.c    17 Mar 2020 16:00:29 -0000
@@ -48,6 +48,7 @@ TAILQ_HEAD(, core) cores;
 
 struct component {
        const char *path;
+       const char *nac;
        int assigned;
 
        struct md_node *hv_node;
@@ -216,6 +217,7 @@ pri_init_components(struct md *md)
        struct component *component;
        struct md_node *node;
        const char *path;
+       const char *nac;
        const char *type;
 
        TAILQ_INIT(&components);
@@ -228,6 +230,10 @@ pri_init_components(struct md *md)
                if (md_get_prop_str(md, node, "assignable-path", &path)) {
                        component = xzalloc(sizeof(*component));
                        component->path = path;
+                       if (md_get_prop_str(md, node, "nac", &nac))
+                               component->nac = nac;
+                       else
+                               component->nac = "-";
                        TAILQ_INSERT_TAIL(&components, component, link);
                }
 
@@ -2889,7 +2896,8 @@ list_components(void)
 
        pri_init_components(pri);
 
+       printf("%-16s %s\n", "PATH", "NAME");
        TAILQ_FOREACH(component, &components, link) {
-               printf("%s\n", component->path);
+               printf("%-16s %s\n", component->path, component->nac);
        }
 }

Reply via email to