Debian Codegraph @

src/xml/printers/check_duplicate_printers.test.c

raw symbols SCIP
1 /*
2 * Check for duplicate printers (at build time).
3 *
4 * Copyright 2018 Robert Krawitz ([email protected])
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20 #include <config.h>
21 #include <gutenprint/gutenprint.h>
22 #include <stdlib.h>
23 #include <stdio.h>
24 #include <fcntl.h>
25 #include <unistd.h>
26 #include <string.h>
27 #include <limits.h>
28
29 int
30 main(int argc, char **argv)
31 {
32 if (getenv("STP_TEST_LOG_PREFIX"))
33 {
34 char path[PATH_MAX+1];
35 if (getenv("BUILD_VERBOSE"))
36 dup2(2, 3);
37 (void) snprintf(path, PATH_MAX, "%scheck_duplicate_printers_%d.log", getenv("STP_TEST_LOG_PREFIX"), getpid());
38 freopen(path, "w", stdout);
39 dup2(1, 2);
40 }
41
42 #if defined(HAVE_SETENV)
43 setenv("STP_CHECK_DUPLICATE_PRINTERS", "TRUE", 1);
44 #else
45 putenv("STP_CHECK_DUPLICATE_PRINTERS=TRUE");
46 #endif
47
48 fprintf(stderr, "CHECK_DUPLICATE_PRINTERS\n");
49 stp_init(); /* Aborts if duplicates are found */
50 return 0;
51 }