Handle defopt lists properly, as ':=' syntax introduce an additional
element... For that, introduce nvcat(nv1, nv2).
This commit is contained in:
parent
b7d531ed9e
commit
718ffd7615
|
@ -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 *);
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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, ...)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue