3 # Copyright 2008 by Denys Vlasenko <vda.linux@googlemail.com>
4 # Licensed under GPLv2, see file LICENSE in this source tree.
8 COLLAPSE
=$
(( 0x00010000))
10 GREEDY
=$
(( 0x00040000))
11 MIN_DIE
=$
(( 0x00100000))
12 KEEP_COPY
=$
(( 0x00200000))
13 EOL_COMMENTS
=$
((0x00400000))
14 NORMAL
=$
(( COLLAPSE | TRIM | GREEDY | EOL_COMMENTS
))
16 # testing "description" "command" "result" "infile" "stdin"
18 testing
"parse mdev.conf" \
19 "parse -n 4 -m 3 -f $((NORMAL)) -" \
20 "[sda][0:0][644][@echo @echo TEST]\n" \
22 " sda 0:0 644 @echo @echo TEST # echo trap\n"
24 testing
"parse notrim" \
25 "parse -n 4 -m 3 -f $((NORMAL - TRIM - COLLAPSE)) -" \
26 "[][sda][0:0][644 @echo @echo TEST ]\n" \
28 " sda 0:0 644 @echo @echo TEST \n"
30 testing
"parse comments" \
31 "parse -n 4 -m 3 -f $((NORMAL - EOL_COMMENTS)) -" \
32 "[sda][0:0][644][@echo @echo TEST #this is not eaten]\n" \
35 # sda 0:0 644 @echo @echo TEST - this gets eaten
36 sda 0:0 644 @echo @echo TEST #this is not eaten
39 testing
"parse bad comment" \
40 "parse -n 2 -m 2 -d '#=' -f $((GREEDY)) - 2>&1" \
43 parse: bad line 3: 1 tokens found, 2 needed
52 #this causes error msg
61 # Device Point System Options
62 #_______________________________________________________________
63 /dev/hdb3 / ext2 defaults 1 0
64 /dev/hdb1 /dosc hpfs ro 1 0
65 /dev/fd0 /dosa vfat rw,user,noauto,nohide 0 0
66 /dev/fd1 /dosb vfat rw,user,noauto,nohide 0 0
68 /dev/cdrom /cdrom iso9660 ro,user,noauto,nohide 0 0
69 /dev/hdb5 /redhat ext2 rw,root,noauto,nohide 0 0 #sssd
70 /dev/hdb6 /win2home ntfs rw,root,noauto,nohide 0 0# ssdsd
71 /dev/hdb7 /win2skul ntfs rw,root,noauto,nohide none 0 0
72 none /dev/pts devpts gid=5,mode=620 0 0
73 none /proc proc defaults 0 0
77 [/dev/hdb3][/][ext2][defaults][1][0]
78 [/dev/hdb1][/dosc][hpfs][ro][1][0]
79 [/dev/fd0][/dosa][vfat][rw,user,noauto,nohide][0][0]
80 [/dev/fd1][/dosb][vfat][rw,user,noauto,nohide][0][0]
81 [/dev/cdrom][/cdrom][iso9660][ro,user,noauto,nohide][0][0]
82 [/dev/hdb5][/redhat][ext2][rw,root,noauto,nohide][0][0]
83 [/dev/hdb6][/win2home][ntfs][rw,root,noauto,nohide][0][0]
84 [/dev/hdb7][/win2skul][ntfs][rw,root,noauto,nohide][none][0 0]
85 [none][/dev/pts][devpts][gid=5,mode=620][0][0]
86 [none][/proc][proc][defaults][0][0]
89 testing
"parse polluted fstab" \
90 "parse -n 6 -m 6 $FILE" \
94 cp ..
/examples
/inittab
$FILE
96 [][][sysinit][/etc/init.d/rcS]
97 [][][askfirst][-/bin/sh]
98 [tty2][][askfirst][-/bin/sh]
99 [tty3][][askfirst][-/bin/sh]
100 [tty4][][askfirst][-/bin/sh]
101 [tty4][][respawn][/sbin/getty 38400 tty5]
102 [tty5][][respawn][/sbin/getty 38400 tty6]
103 [][][restart][/sbin/init]
104 [][][ctrlaltdel][/sbin/reboot]
105 [][][shutdown][/bin/umount -a -r]
106 [][][shutdown][/sbin/swapoff -a]
109 testing
"parse inittab from examples" \
110 "parse -n 4 -m 4 -f $((NORMAL - TRIM - COLLAPSE)) -d'#:' $FILE" \
111 "`cat $FILE.res`\n" \
115 cp ..
/examples
/udhcp
/udhcpd.conf
$FILE
117 [start][192.168.0.20]
120 [opt][dns][192.168.10.2][192.168.10.10]
121 [option][subnet][255.255.255.0]
122 [opt][router][192.168.10.2]
123 [opt][wins][192.168.10.10]
124 [option][dns][129.219.13.81]
125 [option][domain][local]
126 [option][lease][864000]
127 [option][msstaticroutes][10.0.0.0/8][10.127.0.1]
128 [option][staticroutes][10.0.0.0/8][10.127.0.1,][10.11.12.0/24][10.11.12.1]
129 [option][0x08][01020304]
132 testing
"parse udhcpd.conf from examples" \
133 "parse -n 127 $FILE" \
134 "`cat $FILE.res`\n" \
138 rm -f $FILE $FILE.res