]> arthur.barton.de Git - netatalk.git/blobdiff - etc/papd/ppd.c
remove bogus default ppd _PATH_PAPDPPDFILE, from Olaf Hering
[netatalk.git] / etc / papd / ppd.c
index 4e30e1b4f8dfa155d1a0934e2c9c9d435ba4245e..786ee9c69e4b888e6c039c61da03cc36cecb9f15 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ppd.c,v 1.12 2009-01-15 22:01:26 morgana 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 */
 
@@ -93,7 +94,7 @@ static char* my_fgets(buf, bufsize, stream)
     return buf;
 }
 
-struct ppdent *getppdent( stream )
+static struct ppdent *getppdent( stream )
     FILE       *stream;
 {
     static char                        buf[ 1024 ];
@@ -107,7 +108,7 @@ struct ppdent *getppdent( stream )
        if ( *p != '*' ) {      /* main key word */
            continue;
        }
-       if ( p[ strlen( p ) - 1 ] != '\n' && p[ strlen( p ) - 1 ] != '\r') {
+       if ( p[ strlen( p ) - 1 ] != '\n') {
            LOG(log_error, logtype_papd, "getppdent: line too long" );
            continue;
        }
@@ -205,7 +206,7 @@ int read_ppd( file, fcnt )
        }
 
        /* *Font */
-       if ( strcmp( pe->pe_main, "*Font" ) == 0 ) {
+       if ( strcmp( pe->pe_main, "*Font" ) == 0 && pe->pe_option ) {
            for ( pfo = ppd_fonts; pfo; pfo = pfo->pd_next ) {
                if ( strcmp( pfo->pd_font, pe->pe_option ) == 0 ) {
                    break;
@@ -238,7 +239,7 @@ int read_ppd( file, fcnt )
                break;
            }
        }
-       if ( pfe->pd_name ) { /*&& (pfe->pd_value == NULL) ) { */
+       if ( pfe->pd_name && pe->pe_value ) { 
            if (( pfe->pd_value =
                    (char *)malloc( strlen( pe->pe_value ) + 1 )) == NULL ) {
                LOG(log_error, logtype_papd, "malloc: %s", strerror(errno) );