1 /* Child program invoked by test-system-quote-main.
2 Copyright (C) 2012 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, see <http://www.gnu.org/licenses/>. */
22 /* Do not use any gnulib replacements, since this program should
23 link against as few libraries as possible. */
27 #define EXPECTED_DATA_FILE "t-sq-data.tmp"
30 main (int argc, char *argv[])
33 char expected_data[1000];
34 size_t expected_data_len;
37 /* Expected one data argument, received none. */
40 /* Expected one data argument, received more than one. */
44 /* Read the contents of EXPECTED_DATA_FILE. */
46 FILE *fp = fopen (EXPECTED_DATA_FILE, "rb");
49 expected_data_len = fread (expected_data, 1, sizeof (expected_data), fp);
54 if (!(strlen (arg) == expected_data_len
55 && memcmp (arg, expected_data, expected_data_len) == 0))
57 /* arg is not as expected. */
58 fprintf (stderr, "expected: %.*s\nreceived: %s\n",
59 (int)expected_data_len, expected_data, arg);