Home | History | Annotate | Line # | Download | only in net
nslexer.l revision 1.1.4.2
      1  1.1.4.1  lukem %{
      2  1.1.4.2  lukem /*	$NetBSD: nslexer.l,v 1.1.4.2 1998/11/02 03:29:36 lukem Exp $	*/
      3  1.1.4.1  lukem 
      4  1.1.4.1  lukem /*-
      5  1.1.4.2  lukem  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
      6  1.1.4.1  lukem  * All rights reserved.
      7  1.1.4.1  lukem  *
      8  1.1.4.2  lukem  * This code is derived from software contributed to The NetBSD Foundation
      9  1.1.4.2  lukem  * by Luke Mewburn.
     10  1.1.4.2  lukem  *
     11  1.1.4.1  lukem  * Redistribution and use in source and binary forms, with or without
     12  1.1.4.1  lukem  * modification, are permitted provided that the following conditions
     13  1.1.4.1  lukem  * are met:
     14  1.1.4.1  lukem  * 1. Redistributions of source code must retain the above copyright
     15  1.1.4.1  lukem  *    notice, this list of conditions and the following disclaimer.
     16  1.1.4.1  lukem  * 2. Redistributions in binary form must reproduce the above copyright
     17  1.1.4.1  lukem  *    notice, this list of conditions and the following disclaimer in the
     18  1.1.4.1  lukem  *    documentation and/or other materials provided with the distribution.
     19  1.1.4.1  lukem  * 3. All advertising materials mentioning features or use of this software
     20  1.1.4.1  lukem  *    must display the following acknowledgement:
     21  1.1.4.2  lukem  *        This product includes software developed by the NetBSD
     22  1.1.4.2  lukem  *        Foundation, Inc. and its contributors.
     23  1.1.4.2  lukem  * 4. Neither the name of The NetBSD Foundation nor the names of its
     24  1.1.4.2  lukem  *    contributors may be used to endorse or promote products derived
     25  1.1.4.2  lukem  *    from this software without specific prior written permission.
     26  1.1.4.2  lukem  *
     27  1.1.4.2  lukem  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28  1.1.4.2  lukem  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29  1.1.4.2  lukem  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30  1.1.4.2  lukem  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31  1.1.4.2  lukem  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32  1.1.4.2  lukem  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33  1.1.4.2  lukem  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34  1.1.4.2  lukem  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35  1.1.4.2  lukem  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36  1.1.4.2  lukem  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37  1.1.4.2  lukem  * POSSIBILITY OF SUCH DAMAGE.
     38  1.1.4.1  lukem  */
     39  1.1.4.1  lukem 
     40  1.1.4.1  lukem #include <ctype.h>
     41  1.1.4.2  lukem #include <err.h>
     42  1.1.4.2  lukem #define _NS_PRIVATE
     43  1.1.4.2  lukem #include <nsswitch.h>
     44  1.1.4.1  lukem #include <string.h>
     45  1.1.4.1  lukem 
     46  1.1.4.2  lukem #include "nsparser.h"
     47  1.1.4.2  lukem 
     48  1.1.4.2  lukem #define YY_NO_UNPUT
     49  1.1.4.2  lukem 
     50  1.1.4.1  lukem %}
     51  1.1.4.1  lukem 
     52  1.1.4.1  lukem BLANK		[ \t]
     53  1.1.4.1  lukem CR		\n
     54  1.1.4.1  lukem DBNAME		[a-zA-Z][a-zA-Z0-9_]*
     55  1.1.4.1  lukem 
     56  1.1.4.1  lukem %%
     57  1.1.4.1  lukem 
     58  1.1.4.1  lukem {BLANK}+	;	/* skip whitespace */
     59  1.1.4.1  lukem 
     60  1.1.4.1  lukem #.*		;	/* nuke comments */
     61  1.1.4.1  lukem 
     62  1.1.4.1  lukem \\{CR}		;	/* allow continuation */
     63  1.1.4.1  lukem 
     64  1.1.4.1  lukem {CR}		return NL;
     65  1.1.4.1  lukem 
     66  1.1.4.1  lukem [sS][uU][cC][cC][eE][sS][sS]		return SUCCESS;
     67  1.1.4.1  lukem [uU][nN][aA][vV][aA][iI][lL]		return UNAVAIL;
     68  1.1.4.1  lukem [nN][oO][tT][fF][oO][uU][nN][dD]	return NOTFOUND;
     69  1.1.4.1  lukem [tT][rR][yY][aA][gG][aA][iI][nN]	return TRYAGAIN;
     70  1.1.4.1  lukem 
     71  1.1.4.1  lukem [rR][eE][tT][uU][rR][nN]		return RETURN;
     72  1.1.4.1  lukem [cC][oO][nN][tT][iI][nN][uU][eE]	return CONTINUE;
     73  1.1.4.1  lukem 
     74  1.1.4.1  lukem [fF][iI][lL][eE][sS]			return FILES;
     75  1.1.4.1  lukem [dD][nN][sS]				return DNS;
     76  1.1.4.1  lukem [nN][iI][sS]				return NIS;
     77  1.1.4.1  lukem [nN][iI][sS][pP][lL][uU][sS]		return NISPLUS;
     78  1.1.4.1  lukem [cC][oO][mM][pP][aA][tT]		return COMPAT;
     79  1.1.4.1  lukem 
     80  1.1.4.1  lukem {DBNAME}	{
     81  1.1.4.1  lukem 			int i, c;
     82  1.1.4.1  lukem 
     83  1.1.4.1  lukem 			for (i = 0; i < NS_MAXDBLEN; i++) {
     84  1.1.4.1  lukem 				c = yytext[i];
     85  1.1.4.1  lukem 				if (isupper(c))
     86  1.1.4.1  lukem 					c = tolower(c);
     87  1.1.4.1  lukem 				_nsyylval.dbstr[i] = c;
     88  1.1.4.1  lukem 				if (! yytext[i])
     89  1.1.4.1  lukem 					break;
     90  1.1.4.1  lukem 			}
     91  1.1.4.1  lukem 			_nsyylval.dbstr[NS_MAXDBLEN - 1] = '\0';
     92  1.1.4.1  lukem 			return DATABASE;
     93  1.1.4.1  lukem 		}
     94  1.1.4.1  lukem 
     95  1.1.4.1  lukem [:=\[\]]	return yytext[0];
     96  1.1.4.1  lukem 
     97  1.1.4.1  lukem .		;	/* ignore all else */
     98  1.1.4.1  lukem 
     99  1.1.4.1  lukem %%
    100  1.1.4.1  lukem 
    101  1.1.4.1  lukem #undef _nsyywrap
    102  1.1.4.1  lukem int
    103  1.1.4.1  lukem _nsyywrap()
    104  1.1.4.1  lukem {
    105  1.1.4.1  lukem 	return 1;
    106  1.1.4.1  lukem } /* _nsyywrap */
    107  1.1.4.1  lukem 
    108  1.1.4.1  lukem void
    109  1.1.4.1  lukem _nsyyerror(msg)
    110  1.1.4.1  lukem 	char *msg;
    111  1.1.4.1  lukem {
    112  1.1.4.1  lukem 
    113  1.1.4.2  lukem 		/* XXX: syslog the following */
    114  1.1.4.2  lukem 	 fprintf(stderr, "nsswitch.conf: %s at '%s'\n", msg, yytext);
    115  1.1.4.1  lukem } /* _nsyyerror */
    116