| 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>cxx . . $ `<file>/config.h`/ |
| 21 | #include <gutenprint/gutenprint.h>cxx . . $ `<file>/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 | maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv) |
| 31 | { |
| 32 | if (getenvcxx . . $ getenv(a8b8e32347182212).("STP_TEST_LOG_PREFIX")) |
| 33 | { |
| 34 | char path[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!+1]; |
| 35 | if (getenvcxx . . $ getenv(a8b8e32347182212).("BUILD_VERBOSE")) |
| 36 | dup2cxx . . $ dup2(9b79fb6aee4c0440).(2, 3); |
| 37 | (void) snprintfcxx . . $ snprintf(ea502d73e74c754c).(path, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!, "%scheck_duplicate_printers_%d.log", getenvcxx . . $ getenv(a8b8e32347182212).("STP_TEST_LOG_PREFIX"), getpidcxx . . $ getpid(b126dc7c1de90089).()); |
| 38 | freopencxx . . $ freopen(8add521aa6a46b24).(path, "w", stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!); |
| 39 | dup2cxx . . $ dup2(9b79fb6aee4c0440).(1, 2); |
| 40 | } |
| 41 | |
| 42 | #if defined(HAVE_SETENVcxx . . $ `config.h:115:9`!) |
| 43 | setenvcxx . . $ setenv(f0be30763a490cce).("STP_CHECK_DUPLICATE_PRINTERS", "TRUE", 1); |
| 44 | #else |
| 45 | putenv("STP_CHECK_DUPLICATE_PRINTERS=TRUE"); |
| 46 | #endif |
| 47 | |
| 48 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "CHECK_DUPLICATE_PRINTERS\n"); |
| 49 | stp_initcxx . . $ stp_init(b126dc7c1de90089).(); /* Aborts if duplicates are found */ |
| 50 | return 0; |
| 51 | } |