1 1.1 christos /* Use of program name in error-reporting functions. 2 1.1 christos Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc. 3 1.1 christos Written by Bruno Haible <haible (at) clisp.cons.org>, 2001. 4 1.1 christos 5 1.1 christos This program is free software; you can redistribute it and/or modify 6 1.1 christos it under the terms of the GNU General Public License as published by 7 1.1 christos the Free Software Foundation; either version 2, or (at your option) 8 1.1 christos any later version. 9 1.1 christos 10 1.1 christos This program is distributed in the hope that it will be useful, 11 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of 12 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 1.1 christos GNU General Public License for more details. 14 1.1 christos 15 1.1 christos You should have received a copy of the GNU General Public License 16 1.1 christos along with this program; if not, write to the Free Software Foundation, 17 1.1 christos Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 18 1.1 christos 19 1.1 christos 20 1.1 christos #include <config.h> 21 1.1 christos 22 1.1 christos /* Specification. */ 23 1.1 christos #include "error-progname.h" 24 1.1 christos 25 1.1 christos #include <stdio.h> 26 1.1 christos 27 1.1 christos #include "progname.h" 28 1.1 christos 29 1.1 christos 30 1.1 christos /* Indicates whether errors and warnings get prefixed with program_name. 31 1.1 christos Default is true. */ 32 1.1 christos bool error_with_progname = true; 33 1.1 christos 34 1.1 christos /* Print program_name prefix on stderr if and only if error_with_progname 35 1.1 christos is true. */ 36 1.1 christos void 37 1.1 christos maybe_print_progname () 38 1.1 christos { 39 1.1 christos if (error_with_progname) 40 1.1 christos fprintf (stderr, "%s: ", program_name); 41 1.1 christos } 42