/*
- * $Id: ppd.c,v 1.13 2009-01-21 02:42:56 didg Exp $
+ * $Id: ppd.c,v 1.17 2009-10-14 02:24:05 didg Exp $
*
* Copyright (c) 1995 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
struct ppd_font *ppd_fonts = NULL;
struct ppd_feature ppd_features[] = {
- { "*LanguageLevel", 0 },
- { "*PSVersion", 0 },
+ { "*LanguageLevel", NULL },
+ { "*PSVersion", NULL },
#ifdef HAVE_CUPS
{ "*FreeVM", "33554432" },
#else
- { "*FreeVM", 0 },
+ { "*FreeVM", NULL },
#endif
- { "*Product", 0 },
- { "*PCFileName", 0 },
- { "*ModelName", 0 },
- { "*NickName", 0 },
- { "*ColorDevice", 0 },
- { "*FaxSupport", 0 },
- { "*TTRasterizer", 0 },
- { 0, 0 },
+ { "*Product", NULL },
+ { "*PCFileName", NULL },
+ { "*ModelName", NULL },
+ { "*NickName", NULL },
+ { "*ColorDevice", NULL },
+ { "*FaxSupport", NULL },
+ { "*TTRasterizer", NULL },
+ { NULL, NULL },
};
struct ppdent {
};
#ifndef SHOWPPD
-int ppd_inited = 0;
+static int ppd_inited;
-int ppd_init()
+static void ppd_init(void)
{
- 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 */
/* quick and ugly hack to be able to read
ppd files with Mac line ending */
-static char* my_fgets(buf, bufsize, stream)
- char *buf;
- size_t bufsize;
- FILE *stream;
+static char* my_fgets(char *buf, size_t bufsize, FILE *stream)
{
int p; /* uninitialized, OK 310105 */
size_t count = 0;
return buf;
}
-static struct ppdent *getppdent( stream )
- FILE *stream;
+static struct ppdent *getppdent( FILE *stream)
{
static char buf[ 1024 ];
static struct ppdent ppdent;
return( NULL );
}
-int read_ppd( file, fcnt )
- char *file;
- int fcnt;
+int read_ppd(char *file, int fcnt)
{
FILE *ppdfile;
struct ppdent *pe;
return( 0 );
}
-struct ppd_font *ppd_font( font )
- char *font;
+struct ppd_font *ppd_font( char *font)
{
struct ppd_font *pfo;
return( NULL );
}
-struct ppd_feature *ppd_feature( feature, len )
- const char *feature;
- int len;
+struct ppd_feature *ppd_feature( const char *feature, int len)
{
struct ppd_feature *pfe;
char ppd_feature_main[ 256 ];
}
#endif /* SHOWPPD */
+ if (len > sizeof(ppd_feature_main) -1)
+ return( NULL );
+
for ( end = feature + len, p = feature, q = ppd_feature_main;
(p <= end) && (*p != '\n') && (*p != '\r'); p++, q++ ) {
*q = *p;