~ubuntu-branches/ubuntu/utopic/xen/utopic

« back to all changes in this revision

Viewing changes to tools/flask/policy/policy/support/misc_macros.spt

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2010-05-06 15:47:38 UTC
  • mto: (1.3.1) (15.1.1 sid) (4.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20100506154738-agoz0rlafrh1fnq7
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
########################################
 
3
#
 
4
# Helper macros
 
5
#
 
6
 
 
7
#
 
8
# shiftn(num,list...)
 
9
#
 
10
# shift the list num times
 
11
#
 
12
define(`shiftn',`ifelse($1,0,`shift($*)',`shiftn(decr($1),shift(shift($*)))')')
 
13
 
 
14
#
 
15
# ifndef(expr,true_block,false_block)
 
16
#
 
17
# m4 does not have this.
 
18
#
 
19
define(`ifndef',`ifdef(`$1',`$3',`$2')')
 
20
 
 
21
#
 
22
# __endline__
 
23
#
 
24
# dummy macro to insert a newline.  used for 
 
25
# errprint, so the close parentheses can be
 
26
# indented correctly.
 
27
#
 
28
define(`__endline__',`
 
29
')
 
30
 
 
31
########################################
 
32
#
 
33
# refpolwarn(message)
 
34
#
 
35
# print a warning message
 
36
#
 
37
define(`refpolicywarn',`errprint(__file__:__line__: Warning: `$1'__endline__)')
 
38
 
 
39
########################################
 
40
#
 
41
# refpolerr(message)
 
42
#
 
43
# print an error message.  does not
 
44
# make anything fail.
 
45
#
 
46
define(`refpolicyerr',`errprint(__file__:__line__: Error: `$1'__endline__)')
 
47
 
 
48
########################################
 
49
#
 
50
# gen_user(username, prefix, role_set, mls_defaultlevel, mls_range)
 
51
#
 
52
define(`gen_user',`dnl
 
53
user $1 roles { $3 }`'ifdef(`enable_mls', ` level $4 range $5')`';
 
54
')
 
55
 
 
56
########################################
 
57
#
 
58
# gen_context(context,mls_sensitivity,[mcs_categories])
 
59
#
 
60
define(`gen_context',`$1`'ifdef(`enable_mls',`:$2')`'')
 
61
 
 
62
########################################
 
63
#
 
64
# gen_bool(name,default_value)
 
65
#
 
66
define(`gen_bool',`
 
67
        bool $1 dflt_or_overr(`$1'_conf,$2);
 
68
')