/*
- * "$Id: ppd.c,v 1.51.2.59 2003/08/20 14:29:31 mike Exp $"
+ * "$Id: ppd.c,v 1.51.2.60 2003/08/20 15:54:39 mike Exp $"
*
* PPD file routines for the Common UNIX Printing System (CUPS).
*
const char *text);
static ppd_option_t *ppd_get_option(ppd_group_t *group, const char *name);
static int ppd_read(FILE *fp, char *keyword, char *option,
- char *text, char **string);
+ char *text, char **string, int ignoreblank);
/*
* Grab the first line and make sure it reads '*PPD-Adobe: "major.minor"'...
*/
- mask = ppd_read(fp, keyword, name, text, &string);
+ mask = ppd_read(fp, keyword, name, text, &string, 0);
+
+ DEBUG_printf(("mask=%x, keyword=\"%s\"...\n", mask, keyword));
if (mask == 0 ||
strcmp(keyword, "PPD-Adobe") != 0 ||
* Either this is not a PPD file, or it is not a 4.x PPD file.
*/
- if (ppd_status != PPD_OK)
+ if (ppd_status == PPD_OK)
ppd_status = PPD_MISSING_PPDADOBE4;
ppd_free(string);
choice = NULL;
ui_keyword = 0;
- while ((mask = ppd_read(fp, keyword, name, text, &string)) != 0)
+ while ((mask = ppd_read(fp, keyword, name, text, &string, 1)) != 0)
{
#ifdef DEBUG
printf("mask = %x, keyword = \"%s\"", mask, keyword);
char *keyword, /* O - Keyword from line */
char *option, /* O - Option from line */
char *text, /* O - Human-readable text from line */
- char **string) /* O - Code/string data */
+ char **string, /* O - Code/string data */
+ int ignoreblank) /* I - Ignore blank lines? */
{
int ch, /* Character from file */
col, /* Column in line */
ungetc(ch, fp);
}
- if (lineptr == line) /* Skip blank lines */
- continue;
+ if (lineptr == line && ignoreblank)
+ continue; /* Skip blank lines */
ch = '\n';
*lineptr = '\0';
-/* DEBUG_printf(("LINE = \"%s\"\n", line));*/
+ DEBUG_printf(("LINE = \"%s\"\n", line));
if (ch == EOF && lineptr == line)
return (0);
text[0] = '\0';
*string = NULL;
- if (!line[0] || /* Blank line */
- strncmp(line, "*%", 2) == 0 || /* Comment line */
- strcmp(line, "*End") == 0) /* End of multi-line string */
+ if ((!line[0] || /* Blank line */
+ strncmp(line, "*%", 2) == 0 || /* Comment line */
+ strcmp(line, "*End") == 0) && /* End of multi-line string */
+ ignoreblank) /* Ignore these? */
{
startline = ppd_line + 1;
continue;
ppd_status = PPD_MISSING_ASTERISK;
return (0);
}
- else
+ else if (ignoreblank)
continue;
+ else
+ return (0);
}
/*
/*
- * End of "$Id: ppd.c,v 1.51.2.59 2003/08/20 14:29:31 mike Exp $".
+ * End of "$Id: ppd.c,v 1.51.2.60 2003/08/20 15:54:39 mike Exp $".
*/