Home | History | Annotate | Line # | Download | only in veriexecctl
veriexecctl_conf.l revision 1.9
      1 %{
      2 /*	$NetBSD: veriexecctl_conf.l,v 1.9 2006/11/28 22:22:03 elad Exp $	*/
      3 
      4 /*-
      5  * Copyright 2005 Elad Efrat <elad (at) NetBSD.org>
      6  * Copyright 2005 Brett Lymn <blymn (at) netbsd.org>
      7  *
      8  * All rights reserved.
      9  *
     10  * This code has been donated to The NetBSD Foundation by the Author.
     11  *
     12  * Redistribution and use in source and binary forms, with or without
     13  * modification, are permitted provided that the following conditions
     14  * are met:
     15  * 1. Redistributions of source code must retain the above copyright
     16  *    notice, this list of conditions and the following disclaimer.
     17  * 2. The name of the author may not be used to endorse or promote products
     18  *    derived from this software withough specific prior written permission
     19  *
     20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30  *
     31  *
     32  */
     33 
     34 #include <sys/param.h>
     35 #include <sys/types.h>
     36 #include <sys/queue.h>
     37 #include <sys/verified_exec.h>
     38 
     39 #include <stdio.h>
     40 #include <stdlib.h>
     41 #include <string.h>
     42 #include <unistd.h>
     43 #include <err.h>
     44 
     45 #include <prop/proplib.h>
     46 
     47 #include "veriexecctl_parse.h"
     48 #include "veriexecctl.h"
     49 
     50 u_int64_t entries;
     51 char *filename;
     52 %}
     53 
     54 STRING		[0-9a-zA-Z]+
     55 
     56 %%
     57 
     58 	/* path */
     59 \/[^ \t]+	{
     60 			if ((yylval.string = strdup(yytext)) == NULL)
     61 				err(1, "Cannot allocate string");
     62 			return PATH;
     63 		}
     64 
     65 	/* string (fingerprint, type, options) */
     66 {STRING} 	{
     67 			if ((yylval.string = strdup(yytext)) == NULL)
     68 				err(1, "Cannot allocate string");
     69 			return STRING;
     70 		}
     71 
     72 	/* comments, white-outs */
     73 [ \t\r]		|
     74 #.*		;
     75 #.*\n		|
     76 \\\n		|
     77 ^\n		{ line++; }
     78 
     79 	/* eol on a line with data. need a call to ioctl, return eol */
     80 \n		{
     81 			line++;
     82 			return EOL;
     83 		}
     84 
     85 ","		{
     86 			return TOKEN_COMMA;
     87 		}
     88 
     89 .		{ yyerror("Invalid character"); }
     90 
     91 %%
     92 
     93 int
     94 yywrap(void)
     95 {
     96 	return 1;
     97 }
     98 
     99 void
    100 yyerror(const char *string)
    101 {
    102 	(void)fprintf(stderr, "%s: %s at \"%s\", line %zu\n", getprogname(),
    103 	    string, yytext, line);
    104 }
    105