diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2012-03-30 05:59:14 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2012-03-30 05:59:14 +0000 |
commit | 82cc1f9ac32564e92bfbbe7a1de416f4ebcc8584 (patch) | |
tree | af43377451e06dac91d6639e35b1b5bf41d14d4e /systemv | |
parent | 3e7fe0ca760ad0054cf5c9ec7c90ca415cf6eb06 (diff) |
Merge changes from CUPS 1.6svn-r10390.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@3755 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'systemv')
-rw-r--r-- | systemv/cupstestppd.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/systemv/cupstestppd.c b/systemv/cupstestppd.c index d08189a58..b96f97cab 100644 --- a/systemv/cupstestppd.c +++ b/systemv/cupstestppd.c @@ -3,7 +3,7 @@ * * PPD test program for CUPS. * - * Copyright 2007-2011 by Apple Inc. + * Copyright 2007-2012 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -147,6 +147,7 @@ main(int argc, /* I - Number of command-line args */ int len; /* Length of option name */ char *opt; /* Option character */ const char *ptr; /* Pointer into string */ + cups_file_t *fp; /* PPD file */ int files; /* Number of files */ int verbose; /* Want verbose output? */ int warn; /* Which errors to just warn about */ @@ -303,7 +304,7 @@ main(int argc, /* I - Number of command-line args */ * Read from stdin... */ - ppd = ppdOpen(stdin); + ppd = _ppdOpen(cupsFileStdin(), _PPD_LOCALIZATION_ALL); if (verbose >= 0) printf("%s:", (ppd && ppd->pcfilename) ? ppd->pcfilename : "(stdin)"); @@ -317,7 +318,24 @@ main(int argc, /* I - Number of command-line args */ if (verbose >= 0) printf("%s:", argv[i]); - ppd = ppdOpenFile(argv[i]); + if ((fp = cupsFileOpen(argv[i], "r")) != NULL) + { + ppd = _ppdOpen(fp, _PPD_LOCALIZATION_ALL); + cupsFileClose(fp); + } + else + { + status = ERROR_FILE_OPEN; + + if (verbose >= 0) + { + _cupsLangPuts(stdout, _(" FAIL")); + _cupsLangPrintf(stdout, + _(" **FAIL** Unable to open PPD file - %s"), + strerror(errno)); + continue; + } + } } if (ppd == NULL) @@ -1067,7 +1085,7 @@ main(int argc, /* I - Number of command-line args */ * Check for PaperDimension... */ - if (size->width == 0.0 && size->length == 0.0) + if (size->width <= 0.0 && size->length <= 0.0) { if (verbose >= 0) { @@ -3120,8 +3138,9 @@ check_sizes(ppd_file_t *ppd, /* I - PPD file */ continue; } - else if (warn != 2 && size->name[0] == 'w' && - sscanf(size->name, "w%dh%d", &width, &length) == 2) + + if (warn != 2 && size->name[0] == 'w' && + sscanf(size->name, "w%dh%d", &width, &length) == 2) { /* * Validate device-specific size wNNNhNNN should have proper width and @@ -3262,7 +3281,8 @@ check_sizes(ppd_file_t *ppd, /* I - PPD file */ * Check for EnvSizeName as well... */ - snprintf(buf, sizeof(buf), "Env%s", pwg_media->ppd); + if (strncmp(pwg_media->ppd, "Env", 3)) + snprintf(buf, sizeof(buf), "Env%s", pwg_media->ppd); if (strcmp(size->name, buf)) is_ok = 0; |