From 5af990976d330c6f0716df277f59eab67b4aa397 Mon Sep 17 00:00:00 2001 From: didg Date: Wed, 21 Jan 2009 04:04:20 +0000 Subject: [PATCH] remove bogus default ppd _PATH_PAPDPPDFILE, from Olaf Hering --- etc/papd/main.c | 12 ++++-------- etc/papd/ppd.c | 15 ++++++++------- etc/papd/ppd.h | 3 +-- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/etc/papd/main.c b/etc/papd/main.c index 4351c697..18cce3f8 100644 --- a/etc/papd/main.c +++ b/etc/papd/main.c @@ -1,5 +1,5 @@ /* - * $Id: main.c,v 1.24 2009-01-16 18:21:16 morgana Exp $ + * $Id: main.c,v 1.25 2009-01-21 04:04:20 didg Exp $ * * Copyright (c) 1990,1995 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -72,7 +72,6 @@ char *strchr (), *strrchr (); #include "uam_auth.h" #include "print_cups.h" -#define _PATH_PAPDPPDFILE ".ppd" #define PIPED_STATUS "status: print spooler processing job" @@ -201,7 +200,6 @@ int main( ac, av ) defprinter.p_type = "LaserWriter"; defprinter.p_zone = "*"; memset(&defprinter.p_addr, 0, sizeof(defprinter.p_addr)); - defprinter.p_ppdfile = _PATH_PAPDPPDFILE; #ifdef __svr4__ defprinter.p_flags = P_PIPED; defprinter.p_printer = "/usr/bin/lp -T PS"; @@ -681,9 +679,7 @@ static void getprinters( cf ) /* * Get PPD file. */ - if (( p = pgetstr( "pd", &a )) == NULL ) { - pr->p_ppdfile = defprinter.p_ppdfile; - } else { + if (( p = pgetstr( "pd", &a ) )) { if (( pr->p_ppdfile = (char *)malloc( strlen( p ) + 1 )) == NULL ) { perror( "malloc" ); exit( 1 ); @@ -822,7 +818,7 @@ int rprintcap( pr ) * Check for ppd file, moved here because of cups_autoadd we cannot check at the usual location */ - if ( pr->p_ppdfile == defprinter.p_ppdfile ) { + if ( pr->p_ppdfile == NULL ) { if ( (p = (char *) cups_get_printer_ppd ( pr->p_printer )) != NULL ) { if (( pr->p_ppdfile = (char *)malloc( strlen( p ) + 1 )) == NULL ) { LOG(log_error, logtype_papd, "malloc: %s", strerror(errno) ); @@ -830,7 +826,7 @@ int rprintcap( pr ) } strcpy( pr->p_ppdfile, p ); pr->p_flags |= P_CUPS_PPD; - /*LOG(log_info, logtype_papd, "PPD File for %s set to %s", pr->p_printer, pr->p_ppdfile );*/ + LOG(log_info, logtype_papd, "PPD File for %s set to %s", pr->p_printer, pr->p_ppdfile ); } } diff --git a/etc/papd/ppd.c b/etc/papd/ppd.c index bde0ec0f..786ee9c6 100644 --- a/etc/papd/ppd.c +++ b/etc/papd/ppd.c @@ -1,5 +1,5 @@ /* - * $Id: ppd.c,v 1.13 2009-01-21 02:42:56 didg Exp $ + * $Id: ppd.c,v 1.14 2009-01-21 04:04:20 didg Exp $ * * Copyright (c) 1995 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -51,16 +51,17 @@ struct ppdent { }; #ifndef SHOWPPD -int ppd_inited = 0; +static int ppd_inited; -int ppd_init() +static void ppd_init() { - if ( ppd_inited ) { - return( -1 ); - } + if (ppd_inited) + return; + ppd_inited++; - return read_ppd( printer->p_ppdfile, 0 ); + if (printer->p_ppdfile) + read_ppd( printer->p_ppdfile, 0 ); } #endif /* SHOWPPD */ diff --git a/etc/papd/ppd.h b/etc/papd/ppd.h index bdfea746..12822977 100644 --- a/etc/papd/ppd.h +++ b/etc/papd/ppd.h @@ -1,5 +1,5 @@ /* - * $Id: ppd.h,v 1.4 2001-06-25 20:13:45 rufustfirefly Exp $ + * $Id: ppd.h,v 1.5 2009-01-21 04:04:20 didg Exp $ * * Copyright (c) 1995 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -23,6 +23,5 @@ struct ppd_feature { struct ppd_feature *ppd_feature __P((const char *, int)); struct ppd_font *ppd_font __P((char *)); int read_ppd __P((char *, int)); -int ppd_init __P(( void )); #endif /* PAPD_PPD_H */ -- 2.39.2