]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - usr.sbin/ctm/ctm/ctm_syntax.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / usr.sbin / ctm / ctm / ctm_syntax.c
1 /*
2  * ----------------------------------------------------------------------------
3  * "THE BEER-WARE LICENSE" (Revision 42):
4  * <phk@FreeBSD.org> wrote this file.  As long as you retain this notice you
5  * can do whatever you want with this stuff. If we meet some day, and you think
6  * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
7  * ----------------------------------------------------------------------------
8  *
9  * $FreeBSD$
10  *
11  */
12
13 #include "ctm.h"
14
15 /* The fields... */
16 #define Name    CTM_F_Name
17 #define Uid     CTM_F_Uid
18 #define Gid     CTM_F_Gid
19 #define Mode    CTM_F_Mode
20 #define MD5     CTM_F_MD5
21 #define Count   CTM_F_Count
22 #define Bytes   CTM_F_Bytes
23
24 /* The qualifiers... */
25 #define File    CTM_Q_Name_File
26 #define Dir     CTM_Q_Name_Dir
27 #define New     CTM_Q_Name_New
28 #define Subst   CTM_Q_Name_Subst
29 #define After   CTM_Q_MD5_After
30 #define Before  CTM_Q_MD5_Before
31 #define Chunk   CTM_Q_MD5_Chunk
32 #define Force   CTM_Q_MD5_Force
33
34 static int ctmFM[] = /* File Make */
35     { Name|File|New|Subst, Uid, Gid, Mode,
36         MD5|After|Chunk, Count, Bytes,0 };
37
38 static int ctmFS[] = /* File Substitute */
39     { Name|File|Subst, Uid, Gid, Mode,
40         MD5|Before|Force, MD5|After|Chunk, Count, Bytes,0 };
41
42 static int ctmFE[] = /* File Edit */
43     { Name|File|Subst, Uid, Gid, Mode,
44         MD5|Before, MD5|After, Count, Bytes,0 };
45
46 static int ctmFR[] = /* File Remove */
47     { Name|File|Subst, MD5|Before, 0 };
48
49 static int ctmAS[] = /* Attribute Substitute */
50     { Name|Subst, Uid, Gid, Mode, 0 };
51
52 static int ctmDM[] = /* Directory Make */
53     { Name|Dir|New , Uid, Gid, Mode, 0 };
54
55 static int ctmDR[] = /* Directory Remove */
56     { Name|Dir, 0 };
57
58 struct CTM_Syntax Syntax[] = {
59     { "FM",     ctmFM },
60     { "FS",     ctmFS },
61     { "FE",     ctmFE },
62     { "FN",     ctmFE },
63     { "FR",     ctmFR },
64     { "AS",     ctmAS },
65     { "DM",     ctmDM },
66     { "DR",     ctmDR },
67     { 0,        0} };