2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 18:08:23 +00:00
sudo/parse.lex

81 lines
2.6 KiB
Plaintext
Raw Normal View History

1993-03-02 16:33:11 +00:00
%{
/*
1994-03-12 18:55:39 +00:00
* CU sudo version 1.3.1 (based on Root Group sudo version 1.1)
*
* This software comes with no waranty whatsoever, use at your own risk.
*
* Please send bugs, changes, problems to sudo-bugs@cs.colorado.edu
*
*/
1993-03-02 16:33:11 +00:00
/*
* sudo version 1.1 allows users to execute commands as root
* Copyright (C) 1991 The Root Group, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*******************************************************************************
* parse.lex, sudo project
* David R. Hieb
* March 18, 1991
*
* Lex Specification file for the sudo project.
*******************************************************************************/
#ifndef lint
static char rcsid[] = "$Id$";
#endif /* lint */
1994-05-28 17:21:11 +00:00
#include "config.h"
1994-09-22 17:30:19 +00:00
#if defined(HAVE_UNISTD_H) && defined(linux)
1994-08-30 22:29:48 +00:00
#include <unistd.h>
1994-09-22 17:30:19 +00:00
#endif /* HAVE_UNISTD_H && linux */
1994-09-20 23:18:15 +00:00
#ifdef HAVE_STRING_H
#include <string.h>
#endif /* HAVE_STRING_H */
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif /* HAVE_STRINGS_H */
1993-03-02 16:33:11 +00:00
#include <sys/types.h>
#include <sys/param.h>
1994-08-12 02:00:39 +00:00
#include <netinet/in.h>
1993-03-02 16:33:11 +00:00
#include "sudo.h"
1993-10-21 20:42:37 +00:00
#include "y.tab.h"
1993-10-18 00:31:49 +00:00
1994-03-12 22:42:16 +00:00
extern YYSTYPE yylval;
int sudolineno = 0;
1993-03-02 16:33:11 +00:00
%}
%%
[ \t]+ { ; } /* throw away space/tabs */
\\\n { ++sudolineno ; } /* throw away EOL after \ */
1993-03-02 16:33:11 +00:00
\, { return ','; } /* return ',' */
\! { return '!'; } /* return '!' */
= { return '='; } /* return '=' */
: { return ':'; } /* return ':' */
\n { ++sudolineno;
1993-10-18 00:31:49 +00:00
return COMMENT; } /* return newline */
1993-03-02 16:33:11 +00:00
#.*\n { return COMMENT; } /* return comments */
[@$%^&*()"'`/_+]* { return ERROR; } /* return error */
[?;<>\[\]{}|~.-]* { return ERROR; } /* return error */
^[a-zA-Z0-9_-]+ { fill(); return IDENT1;} /* user/{Host,Cmnd}_Alias */
[a-zA-Z0-9_.+-]+ { fill(); return IDENT2;} /* host_type/ALIASES */
(\/[a-zA-Z0-9_.+-]+)+\/? { fill(); return IDENT3;} /* absolute command path */
1993-03-02 16:33:11 +00:00
%%
fill() {
1994-09-20 23:18:15 +00:00
(void) strcpy(yylval.char_val, yytext);
1993-03-02 16:33:11 +00:00
}