3 # Test recognition of C format strings.
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles
="$tmpfiles f-c-1.data"
9 cat <<\EOF
> f-c-1.data
12 # Valid: one character argument
14 # Valid: one string argument
16 # Valid: one integer argument
18 # Valid: one integer argument
20 # Valid: one integer argument
22 # Valid: one integer argument
24 # Valid: one integer argument
26 # Valid: one integer argument
28 # Valid: one floating-point argument
30 # Valid: one floating-point argument
32 # Valid: one floating-point argument
34 # Valid: one floating-point argument
36 # Valid: one floating-point argument
38 # Valid: one floating-point argument
40 # Valid: one floating-point argument
42 # Valid: one floating-point argument
44 # Valid: one pointer argument
46 # Valid: one argument with flags
48 # Valid: one argument with width
50 # Valid: one argument with width
52 # Valid: one argument with precision
54 # Valid: one argument with precision
56 # Valid: one argument with width and precision
58 # Valid: one argument with width and precision
60 # Valid: one argument with width and precision
62 # Valid: one argument with width and precision
64 # Valid: one argument with size specifier
66 # Valid: one argument with size specifier
68 # Valid: one argument with size specifier
70 # Valid: one argument with size specifier
72 # Valid: one argument with size specifier
74 # Valid: one argument with size specifier
76 # Valid: one argument with size specifier
78 # Valid: one argument with size specifier
80 # Valid: one argument with size specifier
82 # Invalid: unterminated
84 # Invalid: unknown format specifier
86 # Invalid: flags after width
88 # Invalid: twice precision
90 # Valid: three arguments
92 # Valid: a numbered argument
96 # Valid: two-digit numbered arguments
97 "abc%11$def%10$dgh%9$dij%8$dkl%7$dmn%6$dop%5$dqr%4$dst%3$duv%2$dwx%1$dyz"
98 # Invalid: unterminated number
100 # Invalid: flags before number
102 # Valid: three arguments, two with same number
104 # Invalid: argument with conflicting types
108 # Invalid: mixing of numbered and unnumbered arguments
110 # Valid: numbered argument with constant precision
112 # Invalid: mixing of numbered and unnumbered arguments
114 # Invalid: missing non-final argument
118 # Valid: multiple uses of same argument
119 "abc%2$xdef%1$pghi%2$x"
120 # Valid: one argument with width
122 # Valid: one argument with width and precision
128 : ${XGETTEXT=xgettext}
130 while read comment
; do
133 tmpfiles
="$tmpfiles f-c-1-$n.in f-c-1-$n.po"
134 cat <<EOF > f-c-1-$n.in
137 ${XGETTEXT} -L C
-o f-c-1-
$n.po f-c-1-
$n.
in ||
exit 1
138 test -f f-c-1-
$n.po ||
exit 1
140 if echo "$comment" |
grep 'Valid:' > /dev
/null
; then
141 if grep c-format f-c-1-
$n.po
> /dev
/null
; then
147 if grep c-format f-c-1-
$n.po
> /dev
/null
; then
153 if test -n "$fail"; then
154 echo "Format string recognition error:" 1>&2
160 rm -f f-c-1-
$n.
in f-c-1-
$n.po