I also have a patch to config.  It lets you put a line of the form

CONFIG_OLD_OPTION = CONFIG_NEW_OPTION

in the options files.  This is useful when optioning are changing and
have a rather wide scope and need to be merged, as with the recent
CONFIG_FREEBSD32 option.  With this merged to stable, we can rename
that without requiring config file tweaks on a stable branch.

Comments?

Warner


Index: mkoptions.c
===================================================================
--- mkoptions.c (revision 205300)
+++ mkoptions.c (working copy)
@@ -90,6 +90,17 @@
        SLIST_INSERT_HEAD(&opt, op, op_next);
 
        read_options();
+       SLIST_FOREACH(op, &opt, op_next) {
+               SLIST_FOREACH(ol, &otab, o_next) {
+                       if (eq(op->op_name, ol->o_name) &&
+                           (ol->o_flags & OL_ALIAS)) {
+                               printf("Mapping option %s to %s.\n",
+                                   op->op_name, ol->o_file);
+                               op->op_name = ol->o_file;
+                               break;
+                       }
+               }
+       }
        SLIST_FOREACH(ol, &otab, o_next)
                do_option(ol->o_name);
        SLIST_FOREACH(op, &opt, op_next) {
@@ -120,7 +131,6 @@
        int tidy;
 
        file = tooption(name);
-
        /*
         * Check to see if the option was specified..
         */
@@ -284,6 +294,7 @@
        struct opt_list *po;
        int first = 1;
        char genopt[MAXPATHLEN];
+       int flags = 0;
 
        SLIST_INIT(&otab);
        (void) snprintf(fname, sizeof(fname), "../../conf/options");
@@ -293,6 +304,7 @@
                return;
        }
 next:
+       flags = 0;
        wd = get_word(fp);
        if (wd == (char *)EOF) {
                (void) fclose(fp);
@@ -324,6 +336,18 @@
                (void) snprintf(genopt, sizeof(genopt), "opt_%s.h", lower(s));
                val = genopt;
                free(s);
+       } else if (eq(val, "=")) {
+               val = get_word(fp);
+               if (val == (char *)EOF) {
+                       printf("%s: unexpected end of file\n", fname);
+                       exit(1);
+               }
+               if (val == 0) {
+                       printf("%s: Expected a right hand side at %s\n", fname,
+                           this);
+                       exit(1);
+               }
+               flags |= OL_ALIAS;
        }
        val = ns(val);
 
@@ -338,6 +362,7 @@
        po = (struct opt_list *) calloc(1, sizeof *po);
        po->o_name = this;
        po->o_file = val;
+       po->o_flags = flags;
        SLIST_INSERT_HEAD(&otab, po, o_next);
 
        goto next;
Index: config.h
===================================================================
--- config.h    (revision 205300)
+++ config.h    (working copy)
@@ -129,6 +129,8 @@
 struct opt_list {
        char *o_name;
        char *o_file;
+       int o_flags;
+#define OL_ALIAS       1
        SLIST_ENTRY(opt_list) o_next;
 };
 
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to