1  | 
     | 
     | 
    /* $OpenBSD: keynote-ver.y,v 1.10 2004/06/29 11:35:56 msf Exp $ */  | 
    
    
    2  | 
     | 
     | 
    /*  | 
    
    
    3  | 
     | 
     | 
     * The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)  | 
    
    
    4  | 
     | 
     | 
     *  | 
    
    
    5  | 
     | 
     | 
     * This code was written by Angelos D. Keromytis in Philadelphia, PA, USA,  | 
    
    
    6  | 
     | 
     | 
     * in April-May 1998  | 
    
    
    7  | 
     | 
     | 
     *  | 
    
    
    8  | 
     | 
     | 
     * Copyright (C) 1998, 1999 by Angelos D. Keromytis.  | 
    
    
    9  | 
     | 
     | 
     *  | 
    
    
    10  | 
     | 
     | 
     * Permission to use, copy, and modify this software with or without fee  | 
    
    
    11  | 
     | 
     | 
     * is hereby granted, provided that this entire notice is included in  | 
    
    
    12  | 
     | 
     | 
     * all copies of any software which is or includes a copy or  | 
    
    
    13  | 
     | 
     | 
     * modification of this software.  | 
    
    
    14  | 
     | 
     | 
     *  | 
    
    
    15  | 
     | 
     | 
     * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR  | 
    
    
    16  | 
     | 
     | 
     * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO  | 
    
    
    17  | 
     | 
     | 
     * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE  | 
    
    
    18  | 
     | 
     | 
     * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR  | 
    
    
    19  | 
     | 
     | 
     * PURPOSE.  | 
    
    
    20  | 
     | 
     | 
     */  | 
    
    
    21  | 
     | 
     | 
    %union { | 
    
    
    22  | 
     | 
     | 
    	struct s { | 
    
    
    23  | 
     | 
     | 
    		char   *string;  | 
    
    
    24  | 
     | 
     | 
    	} s;  | 
    
    
    25  | 
     | 
     | 
    };  | 
    
    
    26  | 
     | 
     | 
    %type <s.string> STRING VSTRING  | 
    
    
    27  | 
     | 
     | 
    %token STRING VSTRING EQ  | 
    
    
    28  | 
     | 
     | 
    %nonassoc EQ  | 
    
    
    29  | 
     | 
     | 
    %start program  | 
    
    
    30  | 
     | 
     | 
    %{ | 
    
    
    31  | 
     | 
     | 
     | 
    
    
    32  | 
     | 
     | 
    #include <sys/types.h>  | 
    
    
    33  | 
     | 
     | 
     | 
    
    
    34  | 
     | 
     | 
    #include <regex.h>  | 
    
    
    35  | 
     | 
     | 
    #include <stdio.h>  | 
    
    
    36  | 
     | 
     | 
    #include <stdlib.h>  | 
    
    
    37  | 
     | 
     | 
    #include <string.h>  | 
    
    
    38  | 
     | 
     | 
     | 
    
    
    39  | 
     | 
     | 
    #include "header.h"  | 
    
    
    40  | 
     | 
     | 
    #include "keynote.h"  | 
    
    
    41  | 
     | 
     | 
    %}  | 
    
    
    42  | 
     | 
     | 
    %%  | 
    
    
    43  | 
     | 
     | 
     | 
    
    
    44  | 
     | 
     | 
    program: expr  | 
    
    
    45  | 
     | 
     | 
           | STRING              { if (kn_add_authorizer(sessid, $1) != 0) | 
    
    
    46  | 
     | 
     | 
    				 return keynote_errno;  | 
    
    
    47  | 
     | 
     | 
                                   free($1);  | 
    
    
    48  | 
     | 
     | 
                                 }  | 
    
    
    49  | 
     | 
     | 
     | 
    
    
    50  | 
     | 
     | 
    expr: VSTRING EQ STRING      { int i = kn_add_action(sessid, $1, $3, 0); | 
    
    
    51  | 
     | 
     | 
     | 
    
    
    52  | 
     | 
     | 
                                   if (i != 0)  | 
    
    
    53  | 
     | 
     | 
    				 return i;  | 
    
    
    54  | 
     | 
     | 
    			       free($1);  | 
    
    
    55  | 
     | 
     | 
    			       free($3);  | 
    
    
    56  | 
     | 
     | 
                                 }  | 
    
    
    57  | 
     | 
     | 
        | VSTRING EQ STRING      { int i = kn_add_action(sessid, $1, $3, 0); | 
    
    
    58  | 
     | 
     | 
     | 
    
    
    59  | 
     | 
     | 
                                   if (i != 0)  | 
    
    
    60  | 
     | 
     | 
    				 return i;  | 
    
    
    61  | 
     | 
     | 
    			       free($1);  | 
    
    
    62  | 
     | 
     | 
    			       free($3);  | 
    
    
    63  | 
     | 
     | 
                                 } expr  | 
    
    
    64  | 
     | 
     | 
    %%  | 
    
    
    65  | 
     | 
     | 
    void  | 
    
    
    66  | 
     | 
     | 
    kverror(char *s)  | 
    
    
    67  | 
     | 
     | 
    {} |