Home | History | Annotate | Line # | Download | only in veriexecctl
veriexecctl_conf.l revision 1.2.2.2
      1 %{
      2 /*	$NetBSD: veriexecctl_conf.l,v 1.2.2.2 2005/06/10 14:53:09 tron Exp $	*/
      3 
      4 /*-
      5  * Copyright 2005 Elad Efrat <elad (at) bsd.org.il>
      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 "veriexecctl_parse.h"
     46 #include "veriexecctl.h"
     47 
     48 u_int64_t entries;
     49 char *filename;
     50 %}
     51 
     52 STRING		[0-9a-zA-Z]+
     53 
     54 %%
     55 
     56 	/* path */
     57 \/[^ \t]+	{
     58 			if ((yylval.string = strdup(yytext)) == NULL)
     59 				err(1, "Cannot allocate string");
     60 			return PATH;
     61 		}
     62 
     63 	/* string (fingerprint, type, options) */
     64 {STRING} 	{
     65 			if ((yylval.string = strdup(yytext)) == NULL)
     66 				err(1, "Cannot allocate string");
     67 			return STRING;
     68 		}
     69 
     70 
     71 	/* comments, white-outs */
     72 [ \t\r]		|
     73 #.*		;
     74 #.*\n		|
     75 ^\n		{ line++; }
     76 
     77 	/* eol on a line with data. need a call to ioctl, return eol */
     78 \n		{
     79 			line++;
     80 			return EOL;
     81 		}
     82 
     83 .		{ yyerror("Invalid character"); }
     84 
     85 %%
     86 
     87 int
     88 yywrap(void)
     89 {
     90 	return 1;
     91 }
     92 
     93 void
     94 yyerror(const char *string)
     95 {
     96 	(void)fprintf(stderr, "%s: %s at \"%s\", line %d\n", getprogname(),
     97 	    string, yytext, line);
     98 }
     99