1%{ 2/*- 3 * Copyright (c) 2010 James Gritton 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: projects/jailconf/usr.sbin/jail/jailparse.y 223188 2011-06-17 16:06:13Z jamie $"); |
30 31#include <stdlib.h> 32#include <string.h> 33 34#include "jailp.h" 35 36#ifdef DEBUG 37#define YYDEBUG 1 --- 69 unchanged lines hidden (view full) --- 107 */ 108param : name 109 { 110 $$ = $1; 111 } 112 | name '=' value 113 { 114 $$ = $1; |
115 TAILQ_CONCAT(&$$->val, $3, tq); |
116 free($3); 117 } 118 | name PLEQ value 119 { 120 $$ = $1; |
121 TAILQ_CONCAT(&$$->val, $3, tq); |
122 $$->flags |= PF_APPEND; 123 free($3); 124 } 125 | name value 126 { 127 $$ = $1; |
128 TAILQ_CONCAT(&$$->val, $2, tq); |
129 free($2); 130 } 131 | error 132 { 133 } 134 ; 135 136/* 137 * A parameter has a fixed name. A variable definition looks just like a 138 * parameter except that the name is a variable. 139 */ 140name : STR 141 { 142 $$ = emalloc(sizeof(struct cfparam)); 143 $$->name = $1; |
144 TAILQ_INIT(&$$->val); |
145 $$->flags = 0; 146 } 147 | VAR 148 { 149 $$ = emalloc(sizeof(struct cfparam)); 150 $$->name = $1; |
151 TAILQ_INIT(&$$->val); |
152 $$->flags = PF_VAR; 153 } 154 ; 155 156value : string 157 { 158 $$ = emalloc(sizeof(struct cfstrings)); |
159 TAILQ_INIT($$); 160 TAILQ_INSERT_TAIL($$, $1, tq); |
161 } 162 | value ',' string 163 { 164 $$ = $1; |
165 TAILQ_INSERT_TAIL($$, $3, tq); |
166 } 167 ; 168 169/* 170 * Strings may be passed in pieces, because of quoting and/or variable 171 * interpolation. Reassemble them into a single string. 172 */ 173string : STR --- 43 unchanged lines hidden --- |