diff --git a/usr.bin/config/defs.h b/usr.bin/config/defs.h index 82165a643753..d6250cdbd31d 100644 --- a/usr.bin/config/defs.h +++ b/usr.bin/config/defs.h @@ -1,4 +1,4 @@ -/* $NetBSD: defs.h,v 1.18 2007/01/09 13:03:47 cube Exp $ */ +/* $NetBSD: defs.h,v 1.19 2007/01/12 21:49:51 cube Exp $ */ /* * Copyright (c) 1992, 1993 @@ -558,6 +558,7 @@ __dead void panic(const char *, ...) struct nvlist *newnv(const char *, const char *, void *, int, struct nvlist *); void nvfree(struct nvlist *); void nvfreel(struct nvlist *); +struct nvlist *nvcat(struct nvlist *, struct nvlist *); /* liby */ void yyerror(const char *); diff --git a/usr.bin/config/gram.y b/usr.bin/config/gram.y index 7ce0052bf488..7af1b66f5be7 100644 --- a/usr.bin/config/gram.y +++ b/usr.bin/config/gram.y @@ -1,5 +1,5 @@ %{ -/* $NetBSD: gram.y,v 1.11 2007/01/09 13:03:47 cube Exp $ */ +/* $NetBSD: gram.y,v 1.12 2007/01/12 21:49:51 cube Exp $ */ /* * Copyright (c) 1992, 1993 @@ -329,7 +329,7 @@ optdep: WORD { $$ = $1; }; defopts: - defopts defopt { $2->nv_next = $1; $$ = $2; } | + defopts defopt { $$ = nvcat($2, $1); } | defopt { $$ = $1; }; defopt: diff --git a/usr.bin/config/util.c b/usr.bin/config/util.c index 0862e2fdef0c..4e3e537b01f9 100644 --- a/usr.bin/config/util.c +++ b/usr.bin/config/util.c @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.4 2006/09/03 07:45:40 dsl Exp $ */ +/* $NetBSD: util.c,v 1.5 2007/01/12 21:49:51 cube Exp $ */ /* * Copyright (c) 1992, 1993 @@ -235,6 +235,20 @@ nvfreel(struct nvlist *nv) } } +struct nvlist * +nvcat(struct nvlist *nv1, struct nvlist *nv2) +{ + struct nvlist *nv; + + if (nv1 == NULL) + return nv2; + + for (nv = nv1; nv->nv_next != NULL; nv = nv->nv_next); + + nv->nv_next = nv2; + return nv1; +} + void warn(const char *fmt, ...) {