~ubuntu-branches/ubuntu/gutsy/checkpolicy/gutsy

« back to all changes in this revision

Viewing changes to users.l

  • Committer: Bazaar Package Importer
  • Author(s): Manoj Srivastava
  • Date: 2005-06-27 14:42:10 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050627144210-so2wgrysi6glkqkt
Tags: 1.24-1
* New upstream release
      * Updated version for release.
      * Merged cleanup patch from Dan Walsh.
      * Added sepol_ prefix to Flask types to avoid namespace
        collision with libselinux.
      * Merged identifier fix from Joshua Brindle (Tresys).
      * Merged hierarchical type/role patch from Tresys Technology.
      * Merged MLS fixes from Darrel Goeddel of TCS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
%{
2
 
#include <string.h>
3
 
#include "users.tab.h"
4
 
 
5
 
static char linebuf[2][255];
6
 
static unsigned int lno = 0;
7
 
int yywarn(char *msg);
8
 
 
9
 
unsigned long policydb_lineno = 1;
10
 
 
11
 
unsigned int policydb_errors = 0;
12
 
%}
13
 
%array
14
 
letter  [A-Za-z]
15
 
digit   [0-9]
16
 
hexval  [0-9A-Fa-f]
17
 
%%
18
 
\n.*                            { strncpy(linebuf[lno], yytext+1, 255);
19
 
                                  linebuf[lno][254] = 0;
20
 
                                  lno = 1 - lno; 
21
 
                                  policydb_lineno++;
22
 
                                  yyless(1); }
23
 
ROLES |
24
 
roles                           { return(ROLES); }
25
 
RANGES |
26
 
ranges                          { return(RANGES); }
27
 
USER |
28
 
user                            { return(USER); }
29
 
{letter}({letter}|{digit}|_)*   { return(IDENTIFIER); }
30
 
{letter}({letter}|{digit}|_|"."|"-")*   { return(USER_IDENTIFIER); }
31
 
#[^\n]*                         { /* delete comments */ }
32
 
[ \t\f]+                        { /* delete whitespace */ }
33
 
"{" |
34
 
"}" |
35
 
";" |
36
 
"-" |
37
 
"~" |
38
 
"*"                             { return(yytext[0]); } 
39
 
.                               { yywarn("unrecognized character");}
40
 
%%
41
 
int yyerror(char *msg)
42
 
{
43
 
        fprintf(stderr, "ERROR '%s' at token '%s' on line %ld:\n%s\n%s\n",
44
 
                        msg,
45
 
                        yytext,
46
 
                        policydb_lineno,
47
 
                        linebuf[0], linebuf[1]);
48
 
        policydb_errors++;
49
 
        return -1;
50
 
}
51
 
 
52
 
int yywarn(char *msg)
53
 
{
54
 
        fprintf(stderr, "WARNING '%s' at token '%s' on line %ld:\n%s\n%s\n",
55
 
                        msg,
56
 
                        yytext,
57
 
                        policydb_lineno,
58
 
                        linebuf[0], linebuf[1]);
59
 
        return 0;
60
 
}