Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/config If an option is selected, select the matching...



details:   https://anonhg.NetBSD.org/src/rev/6267776f9fea
branches:  trunk
changeset: 332827:6267776f9fea
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Fri Oct 10 10:22:49 2014 +0000

description:
If an option is selected, select the matching (lowercased) attribute.  Handle
dependencies too.

diffstat:

 usr.bin/config/main.c |  20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diffs (58 lines):

diff -r d690abbf01cd -r 6267776f9fea usr.bin/config/main.c
--- a/usr.bin/config/main.c     Fri Oct 10 10:16:19 2014 +0000
+++ b/usr.bin/config/main.c     Fri Oct 10 10:22:49 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.60 2014/10/10 07:48:50 uebayasi Exp $       */
+/*     $NetBSD: main.c,v 1.61 2014/10/10 10:22:49 uebayasi Exp $       */
 
 /*
  * Copyright (c) 1992, 1993
@@ -531,6 +531,8 @@
        if (fs != NULL) {
                do_depends(fs->nv_ptr);
        }
+
+       CFGDBG(3, "depend `%s' searched", name);
 }
 
 static void
@@ -549,16 +551,25 @@
        struct attr *a;
 
        if (nv != NULL && (nv->nv_flags & NV_DEPENDED) == 0) {
+               const char *n = strtolower(nv->nv_name);
+
                nv->nv_flags |= NV_DEPENDED;
                /*
                 * If the dependency is an attribute, then just add
                 * it to the selecttab.
                 */
+               CFGDBG(3, "depend attr `%s'", nv->nv_name);
+               /* XXX Do uppercased attribute names exist? */
                if ((a = ht_lookup(attrtab, nv->nv_name)) != NULL) {
                        if (a->a_iattr)
                                panic("do_depend(%s): dep `%s' is an iattr",
                                    nv->nv_name, a->a_name);
                        expandattr(a, selectattr);
+               } else if ((a = ht_lookup(attrtab, n)) != NULL) {
+                       if (a->a_iattr)
+                               panic("do_depend(%s): dep `%s' is an iattr",
+                                   n, a->a_name);
+                       expandattr(a, selectattr);
                } else {
                        if (ht_lookup(opttab, nv->nv_name) == NULL)
                                addoption(nv->nv_name, NULL);
@@ -975,6 +986,13 @@
        n = strtolower(name);
        (void)ht_insert(selecttab, n, (void *)__UNCONST(n));
        CFGDBG(3, "option selected `%s'", n);
+
+       /*
+        * Select attribute if one exists.
+        */
+       struct attr *a;
+       if ((a = ht_lookup(attrtab, n)) != NULL)
+               selectattr(a);
 }
 
 void



Home | Main Index | Thread Index | Old Index