]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/options.c
Get the repository a bit closer to what will be released
[ppp.git] / pppd / options.c
index a85239abb0c523908e2e51d69d2b296b79754fb2..482eab99e3274086d7c6b13aac4b7c1254045c27 100644 (file)
@@ -40,7 +40,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: options.c,v 1.100 2006/06/18 11:26:00 paulus Exp $"
+#define RCSID  "$Id: options.c,v 1.102 2008/06/15 06:53:06 paulus Exp $"
 
 #include <ctype.h>
 #include <stdio.h>
@@ -771,17 +771,20 @@ process_option(opt, cmd, argv)
        if (!(*parser)(argv))
            return 0;
        if (opt->flags & OPT_A2LIST) {
-           struct option_value *ovp, **pp;
+           struct option_value *ovp, *pp;
 
            ovp = malloc(sizeof(*ovp) + strlen(*argv));
            if (ovp != 0) {
                strcpy(ovp->value, *argv);
                ovp->source = option_source;
                ovp->next = NULL;
-               pp = (struct option_value **) &opt->addr2;
-               while (*pp != 0)
-                   pp = &(*pp)->next;
-               *pp = ovp;
+               if (opt->addr2 == NULL) {
+                   opt->addr2 = ovp;
+               } else {
+                   for (pp = opt->addr2; pp->next != NULL; pp = pp->next)
+                       ;
+                   pp->next = ovp;
+               }
            }
        }
        break;
@@ -793,6 +796,10 @@ process_option(opt, cmd, argv)
        break;
     }
 
+    /*
+     * If addr2 wasn't used by any flag (OPT_A2COPY, etc.) but is set,
+     * treat it as a bool and set/clear it based on the OPT_A2CLR bit.
+     */
     if (opt->addr2 && (opt->flags & (OPT_A2COPY|OPT_ENABLE
                |OPT_A2PRINTER|OPT_A2STRVAL|OPT_A2LIST|OPT_A2OR)) == 0)
        *(bool *)(opt->addr2) = !(opt->flags & OPT_A2CLR);