/*
- * "$Id: cupstestppd.c 7807 2008-07-28 21:54:24Z mike $"
+ * "$Id$"
*
* PPD test program for CUPS.
*
- * Copyright 2007-2011 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
int warn);
static void show_conflicts(ppd_file_t *ppd, const char *prefix);
static int test_raster(ppd_file_t *ppd, int verbose);
-static void usage(void);
+static void usage(void) __attribute__((noreturn));
static int valid_path(const char *keyword, const char *path, int errors,
int verbose, int warn);
static int valid_utf8(const char *s);
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 */
* Read from stdin...
*/
- ppd = ppdOpen(stdin);
+ ppd = _ppdOpen(cupsFileStdin(), _PPD_LOCALIZATION_ALL);
if (verbose >= 0)
printf("%s:", (ppd && ppd->pcfilename) ? ppd->pcfilename : "(stdin)");
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 on "
+ "line %d."), strerror(errno), 0);
+ continue;
+ }
+ }
}
if (ppd == NULL)
{
_cupsLangPuts(stdout, _(" FAIL"));
_cupsLangPrintf(stdout,
- _(" **FAIL** Unable to open PPD file - %s"),
- strerror(errno));
+ _(" **FAIL** Unable to open PPD file - %s on "
+ "line %d."), strerror(errno), 0);
}
}
else
attr->value)
ppdversion = (int)(10 * _cupsStrScand(attr->value, NULL, loc) + 0.5);
- for (j = 0; j < ppd->num_filters; j ++)
- if (strstr(ppd->filters[j], "application/vnd.cups-raster"))
- {
- if (!test_raster(ppd, verbose))
- errors ++;
- break;
+ if ((attr = ppdFindAttr(ppd, "cupsFilter2", NULL)) != NULL)
+ {
+ do
+ {
+ if (strstr(attr->value, "application/vnd.cups-raster"))
+ {
+ if (!test_raster(ppd, verbose))
+ errors ++;
+ break;
+ }
}
+ while ((attr = ppdFindNextAttr(ppd, "cupsFilter2", NULL)) != NULL);
+ }
+ else
+ {
+ for (j = 0; j < ppd->num_filters; j ++)
+ if (strstr(ppd->filters[j], "application/vnd.cups-raster"))
+ {
+ if (!test_raster(ppd, verbose))
+ errors ++;
+ break;
+ }
+ }
/*
* Look for default keywords with no matching option...
_cupsLangPuts(stdout, _(" FAIL"));
_cupsLangPrintf(stdout,
- _(" **FAIL** BAD DefaultImageableArea %s\n"
+ _(" **FAIL** Bad DefaultImageableArea %s\n"
" REF: Page 102, section 5.15."),
attr->value);
}
_cupsLangPuts(stdout, _(" FAIL"));
_cupsLangPrintf(stdout,
- _(" **FAIL** BAD DefaultPaperDimension %s\n"
+ _(" **FAIL** Bad DefaultPaperDimension %s\n"
" REF: Page 103, section 5.15."),
attr->value);
}
_cupsLangPuts(stdout, _(" FAIL"));
_cupsLangPrintf(stdout,
- _(" **FAIL** BAD Default%s %s\n"
+ _(" **FAIL** Bad Default%s %s\n"
" REF: Page 40, section 4.5."),
option->keyword, option->defchoice);
}
ptr = attr->value;
if (*ptr == '4' && ptr[1] == '.')
{
-
+
for (ptr += 2; *ptr; ptr ++)
if (!isdigit(*ptr & 255))
break;
if (ppd->manufacturer != NULL)
{
- if (!strncasecmp(ppd->manufacturer, "Hewlett-Packard", 15) ||
- !strncasecmp(ppd->manufacturer, "Hewlett Packard", 15))
+ if (!_cups_strncasecmp(ppd->manufacturer, "Hewlett-Packard", 15) ||
+ !_cups_strncasecmp(ppd->manufacturer, "Hewlett Packard", 15))
{
if (verbose >= 0)
{
if (!errors && !verbose)
_cupsLangPuts(stdout, _(" FAIL"));
- _cupsLangPuts(stdout,
- _(" **FAIL** BAD Manufacturer (should be "
- "\"HP\")\n"
- " REF: Page 211, table D.1."));
+ _cupsLangPrintf(stdout,
+ _(" **FAIL** Bad Manufacturer (should be "
+ "\"%s\")\n"
+ " REF: Page 211, table D.1."),
+ "HP");
}
errors ++;
}
- else if (!strncasecmp(ppd->manufacturer, "OkiData", 7) ||
- !strncasecmp(ppd->manufacturer, "Oki Data", 8))
+ else if (!_cups_strncasecmp(ppd->manufacturer, "OkiData", 7) ||
+ !_cups_strncasecmp(ppd->manufacturer, "Oki Data", 8))
{
if (verbose >= 0)
{
if (!errors && !verbose)
_cupsLangPuts(stdout, _(" FAIL"));
- _cupsLangPuts(stdout,
- _(" **FAIL** BAD Manufacturer (should be "
- "\"Oki\")\n"
- " REF: Page 211, table D.1."));
+ _cupsLangPrintf(stdout,
+ _(" **FAIL** Bad Manufacturer (should be "
+ "\"%s\")\n"
+ " REF: Page 211, table D.1."),
+ "Oki");
}
errors ++;
_cupsLangPuts(stdout, _(" FAIL"));
_cupsLangPrintf(stdout,
- _(" **FAIL** BAD ModelName - \"%c\" not "
+ _(" **FAIL** Bad ModelName - \"%c\" not "
"allowed in string.\n"
" REF: Pages 59-60, section 5.3."),
*ptr);
_cupsLangPuts(stdout, _(" FAIL"));
_cupsLangPuts(stdout,
- _(" **FAIL** BAD Product - not \"(string)\".\n"
+ _(" **FAIL** Bad Product - not \"(string)\".\n"
" REF: Page 62, section 5.3."));
}
_cupsLangPuts(stdout, _(" FAIL"));
_cupsLangPuts(stdout,
- _(" **FAIL** BAD PSVersion - not \"(string) "
+ _(" **FAIL** Bad PSVersion - not \"(string) "
"int\".\n"
" REF: Pages 62-64, section 5.3."));
}
_cupsLangPuts(stdout, _(" FAIL"));
_cupsLangPuts(stdout,
- _(" **FAIL** BAD ShortNickName - longer "
+ _(" **FAIL** Bad ShortNickName - longer "
"than 31 chars.\n"
" REF: Pages 64-65, section 5.3."));
}
_cupsLangPuts(stdout, _(" FAIL"));
_cupsLangPuts(stdout,
- _(" **FAIL** BAD JobPatchFile attribute in file\n"
+ _(" **FAIL** Bad JobPatchFile attribute in file\n"
" REF: Page 24, section 3.4."));
}
* Check for PaperDimension...
*/
- if (size->width == 0.0 && size->length == 0.0)
+ if (size->width <= 0.0 && size->length <= 0.0)
{
if (verbose >= 0)
{
_cupsLangPuts(stdout, _(" FAIL"));
_cupsLangPrintf(stdout,
- _(" **FAIL** Bad %s choice %s\n"
+ _(" **FAIL** Bad option %s choice %s\n"
" REF: Page 84, section 5.9"),
option->keyword, choice->choice);
}
errors ++;
}
-
+
/*
* Loop through all options and choices...
*/
!strcmp(attr->name, "DefaultTransfer"))
continue;
- if (!strncmp(attr->name, "Default", 7) &&
+ if (!strncmp(attr->name, "Default", 7) &&
!ppdFindOption(ppd, attr->name + 7))
_cupsLangPrintf(stdout,
_(" WARN %s has no corresponding "
"5.3."));
}
- if (!strcasecmp(ppd->pcfilename, "unused.ppd"))
+ if (!_cups_strcasecmp(ppd->pcfilename, "unused.ppd"))
_cupsLangPuts(stdout,
_(" WARN PCFileName should contain a "
"unique filename.\n"
/*
* Then list the options, if "-v" was provided...
- */
+ */
if (verbose > 1)
{
else if (eol != EOL_CR)
mixed = 1;
}
-
+
if (col > 0 && whitespace)
_cupsLangPrintf(stdout,
_(" WARN Line %d only contains whitespace."),
*ptr = '\0';
}
- if (!strncasecmp(option, "Custom", 6) && !strcasecmp(choice, "True"))
+ if (!_cups_strncasecmp(option, "Custom", 6) && !_cups_strcasecmp(choice, "True"))
{
_cups_strcpy(option, option + 6);
- strcpy(choice, "Custom");
+ strlcpy(choice, "Custom", sizeof(choice));
}
if ((o = ppdFindOption(ppd, option)) == NULL)
_(" %s Missing option %s in "
"cupsUIConstraints %s: \"%s\""),
prefix, option, constattr->spec, constattr->value);
-
+
if (!warn)
errors ++;
else
{
for (i = 0; i < o->num_choices; i ++)
- if (strcasecmp(o->choices[i].choice, "None") &&
- strcasecmp(o->choices[i].choice, "Off") &&
- strcasecmp(o->choices[i].choice, "False"))
+ if (_cups_strcasecmp(o->choices[i].choice, "None") &&
+ _cups_strcasecmp(o->choices[i].choice, "Off") &&
+ _cups_strcasecmp(o->choices[i].choice, "False"))
{
num_options = cupsAddOption(option, o->choices[i].choice,
num_options, &options);
for (i = ppd->num_consts, c = ppd->consts; i > 0; i --, c ++)
{
- if (!strncasecmp(c->option1, "Custom", 6) &&
- !strcasecmp(c->choice1, "True"))
+ if (!_cups_strncasecmp(c->option1, "Custom", 6) &&
+ !_cups_strcasecmp(c->choice1, "True"))
{
- strcpy(option, c->option1 + 6);
- strcpy(choice, "Custom");
+ strlcpy(option, c->option1 + 6, sizeof(option));
+ strlcpy(choice, "Custom", sizeof(choice));
}
else
{
- strcpy(option, c->option1);
- strcpy(choice, c->choice1);
+ strlcpy(option, c->option1, sizeof(option));
+ strlcpy(choice, c->choice1, sizeof(choice));
}
if ((o = ppdFindOption(ppd, option)) == NULL)
errors ++;
}
- if (!strncasecmp(c->option2, "Custom", 6) &&
- !strcasecmp(c->choice2, "True"))
+ if (!_cups_strncasecmp(c->option2, "Custom", 6) &&
+ !_cups_strcasecmp(c->choice2, "True"))
{
- strcpy(option, c->option2 + 6);
- strcpy(choice, "Custom");
+ strlcpy(option, c->option2 + 6, sizeof(option));
+ strlcpy(choice, "Custom", sizeof(choice));
}
else
{
- strcpy(option, c->option2);
- strcpy(choice, c->choice2);
+ strlcpy(option, c->option2, sizeof(option));
+ strlcpy(choice, c->choice2, sizeof(choice));
}
if ((o = ppdFindOption(ppd, option)) == NULL)
for (i = ppd->num_groups, groupa = ppd->groups; i > 1; i --, groupa ++)
for (j = i - 1, groupb = groupa + 1; j > 0; j --, groupb ++)
- if (!strcasecmp(groupa->name, groupb->name))
+ if (!_cups_strcasecmp(groupa->name, groupb->name))
{
if (!errors && !verbose)
_cupsLangPuts(stdout, _(" FAIL"));
{
cupsArraySave(ppd->options);
for (optionb = ppdNextOption(ppd); optionb; optionb = ppdNextOption(ppd))
- if (!strcasecmp(optiona->keyword, optionb->keyword))
+ if (!_cups_strcasecmp(optiona->keyword, optionb->keyword))
{
if (!errors && !verbose)
_cupsLangPuts(stdout, _(" FAIL"));
if (verbose >= 0)
_cupsLangPrintf(stdout,
- _(" **FAIL** Multiple occurrences of %s "
- "choice name %s."),
+ _(" **FAIL** Multiple occurrences of "
+ "option %s choice name %s."),
optiona->keyword, choicea->choice);
errors ++;
i --;
break;
}
- else if (!strcasecmp(choicea->choice, choiceb->choice))
+ else if (!_cups_strcasecmp(choicea->choice, choiceb->choice))
{
if (!errors && !verbose)
_cupsLangPuts(stdout, _(" FAIL"));
if (verbose >= 0)
_cupsLangPrintf(stdout,
- _(" **FAIL** %s choice names %s and %s "
- "differ only by case."),
+ _(" **FAIL** Option %s choice names %s and "
+ "%s differ only by case."),
optiona->keyword, choicea->choice, choiceb->choice);
errors ++;
int verbose, /* I - Verbosity level */
int warn) /* I - Warnings only? */
{
- int i; /* Looping var */
ppd_attr_t *attr; /* PPD attribute */
const char *ptr; /* Pointer into string */
char super[16], /* Super-type for filter */
type[256], /* Type for filter */
+ dstsuper[16], /* Destination super-type for filter */
+ dsttype[256], /* Destination type for filter */
program[1024], /* Program/filter name */
pathprog[1024]; /* Complete path to program/filter */
int cost; /* Cost of filter */
* cupsFilter
*/
- for (i = 0; i < ppd->num_filters; i ++)
+ for (attr = ppdFindAttr(ppd, "cupsFilter", NULL);
+ attr;
+ attr = ppdFindNextAttr(ppd, "cupsFilter", NULL))
{
- if (sscanf(ppd->filters[i], "%15[^/]/%255s%d%*[ \t]%1023[^\n]", super, type,
+ if (strcmp(attr->name, "cupsFilter"))
+ {
+ if (!warn && !errors && !verbose)
+ _cupsLangPuts(stdout, _(" FAIL"));
+
+ if (verbose >= 0)
+ _cupsLangPrintf(stdout,
+ _(" %s Bad spelling of %s - should be %s."),
+ prefix, attr->name, "cupsFilter");
+
+ if (!warn)
+ errors ++;
+ }
+
+ if (!attr->value ||
+ sscanf(attr->value, "%15[^/]/%255s%d%*[ \t]%1023[^\n]", super, type,
&cost, program) != 4)
{
if (!warn && !errors && !verbose)
if (verbose >= 0)
_cupsLangPrintf(stdout,
_(" %s Bad cupsFilter value \"%s\"."),
- prefix, ppd->filters[i]);
+ prefix, attr->value);
if (!warn)
errors ++;
}
}
+ /*
+ * cupsFilter2
+ */
+
+ for (attr = ppdFindAttr(ppd, "cupsFilter2", NULL);
+ attr;
+ attr = ppdFindNextAttr(ppd, "cupsFilter2", NULL))
+ {
+ if (strcmp(attr->name, "cupsFilter2"))
+ {
+ if (!warn && !errors && !verbose)
+ _cupsLangPuts(stdout, _(" FAIL"));
+
+ if (verbose >= 0)
+ _cupsLangPrintf(stdout,
+ _(" %s Bad spelling of %s - should be %s."),
+ prefix, attr->name, "cupsFilter2");
+
+ if (!warn)
+ errors ++;
+ }
+
+ if (!attr->value ||
+ sscanf(attr->value, "%15[^/]/%255s%*[ \t]%15[^/]/%255s%d%*[ \t]%1023[^\n]",
+ super, type, dstsuper, dsttype, &cost, program) != 6)
+ {
+ if (!warn && !errors && !verbose)
+ _cupsLangPuts(stdout, _(" FAIL"));
+
+ if (verbose >= 0)
+ _cupsLangPrintf(stdout,
+ _(" %s Bad cupsFilter2 value \"%s\"."),
+ prefix, attr->value);
+
+ if (!warn)
+ errors ++;
+ }
+ else if (strcmp(program, "-"))
+ {
+ if (strncmp(program, "maxsize(", 8) &&
+ (ptr = strchr(program + 8, ')')) != NULL)
+ {
+ ptr ++;
+ while (_cups_isspace(*ptr))
+ ptr ++;
+
+ _cups_strcpy(program, ptr);
+ }
+
+ if (program[0] == '/')
+ snprintf(pathprog, sizeof(pathprog), "%s%s", root, program);
+ else
+ {
+ if ((ptr = getenv("CUPS_SERVERBIN")) == NULL)
+ ptr = CUPS_SERVERBIN;
+
+ if (*ptr == '/' || !*root)
+ snprintf(pathprog, sizeof(pathprog), "%s%s/filter/%s", root, ptr,
+ program);
+ else
+ snprintf(pathprog, sizeof(pathprog), "%s/%s/filter/%s", root, ptr,
+ program);
+ }
+
+ if (stat(pathprog, &fileinfo))
+ {
+ if (!warn && !errors && !verbose)
+ _cupsLangPuts(stdout, _(" FAIL"));
+
+ if (verbose >= 0)
+ _cupsLangPrintf(stdout, _(" %s Missing %s file \"%s\"."),
+ prefix, "cupsFilter2", pathprog);
+
+ if (!warn)
+ errors ++;
+ }
+ else if (fileinfo.st_uid != 0 ||
+ (fileinfo.st_mode & MODE_WRITE) ||
+ (fileinfo.st_mode & MODE_MASK) != MODE_PROGRAM)
+ {
+ if (!warn && !errors && !verbose)
+ _cupsLangPuts(stdout, _(" FAIL"));
+
+ if (verbose >= 0)
+ _cupsLangPrintf(stdout,
+ _(" %s Bad permissions on %s file \"%s\"."),
+ prefix, "cupsFilter2", pathprog);
+
+ if (!warn)
+ errors ++;
+ }
+ else
+ errors = valid_path("cupsFilter2", pathprog, errors, verbose, warn);
+ }
+ }
+
/*
* cupsPreFilter
*/
* APDialogExtension
*/
- for (attr = ppdFindAttr(ppd, "APDialogExtension", NULL);
- attr != NULL;
+ for (attr = ppdFindAttr(ppd, "APDialogExtension", NULL);
+ attr != NULL;
attr = ppdFindNextAttr(ppd, "APDialogExtension", NULL))
{
if (strcmp(attr->name, "APDialogExtension"))
if (!warn)
errors ++;
}
-
+
snprintf(pathprog, sizeof(pathprog), "%s%s", root,
attr->value ? attr->value : "(null)");
const char *prefix; /* WARN/FAIL prefix */
ppd_option_t *page_size, /* PageSize option */
*page_region; /* PageRegion option */
- _pwg_media_t *pwg_media; /* PWG media */
- char buf[1024]; /* PapeSize name that is supposed to be */
+ _pwg_media_t *pwg_media; /* PWG media */
+ char buf[PPD_MAX_NAME]; /* PapeSize name that is supposed to be */
const char *ptr; /* Pointer into string */
int width_2540ths, /* PageSize width in 2540ths */
length_2540ths; /* PageSize length in 2540ths */
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
/*
* Verify that the size name is Adobe standard name if it's a standard size
- * and the dementional name if it's not a standard size. Suffix should be
+ * and the dimentional name if it's not a standard size. Suffix should be
* .Fullbleed, etc., or numeric, e.g., Letter, Letter.Fullbleed,
* Letter.Transverse, Letter1, Letter2, 4x8, 55x91mm, 55x91mm.Fullbleed, etc.
*/
{
is_ok = 1;
width_2540ths = (size->length > size->width) ?
- _PWG_FROMPTS(size->width) :
- _PWG_FROMPTS(size->length);
+ PWG_FROM_POINTS(size->width) :
+ PWG_FROM_POINTS(size->length);
length_2540ths = (size->length > size->width) ?
- _PWG_FROMPTS(size->length) :
- _PWG_FROMPTS(size->width);
- pwg_media = _pwgMediaForSize(width_2540ths, length_2540ths);
+ PWG_FROM_POINTS(size->length) :
+ PWG_FROM_POINTS(size->width);
+ pwg_media = pwgMediaForSize(width_2540ths, length_2540ths);
+
+ if (pwg_media &&
+ (fabs(pwg_media->width - width_2540ths) > 34 ||
+ fabs(pwg_media->length - length_2540ths) > 34))
+ pwg_media = NULL; /* Only flag matches within a point */
- if (pwg_media && pwg_media->ppd)
+ if (pwg_media && pwg_media->ppd &&
+ (pwg_media->ppd[0] < 'a' || pwg_media->ppd[0] > 'z'))
{
+ size_t ppdlen = strlen(pwg_media->ppd);
+ /* Length of standard PPD name */
+
strlcpy(buf, pwg_media->ppd, sizeof(buf));
- if (size->left == 0 && size->bottom == 0 &&
- size->right == size->width && size->top == size->length)
+ if (strcmp(size->name, buf) && size->width > size->length)
{
- snprintf(buf, sizeof(buf), "%s.Fullbleed", pwg_media->ppd);
- if (strcmp(size->name, buf))
- is_ok = 0;
+ if (!strcmp(pwg_media->ppd, "DoublePostcardRotated"))
+ strlcpy(buf, "DoublePostcard", sizeof(buf));
+ else if (strstr(size->name, ".Transverse"))
+ snprintf(buf, sizeof(buf), "%s.Transverse", pwg_media->ppd);
+ else
+ snprintf(buf, sizeof(buf), "%sRotated", pwg_media->ppd);
+
+ ppdlen = strlen(buf);
}
- else if (size->width > size->length)
+
+ if (size->left == 0 && size->bottom == 0 &&
+ size->right == size->width && size->top == size->length)
{
- if ((ptr = pwg_media->ppd + strlen(pwg_media->ppd) - 7)
- >= pwg_media->ppd && !strcmp(ptr, "Rotated"))
+ strlcat(buf, ".Fullbleed", sizeof(buf) - strlen(buf));
+ if (_cups_strcasecmp(size->name, buf))
{
- if (strcmp(size->name, buf))
+ /*
+ * Allow an additional qualifier such as ".WithTab"...
+ */
+
+ size_t buflen = strlen(buf);/* Length of full bleed name */
+
+ if (_cups_strncasecmp(size->name, buf, buflen) ||
+ size->name[buflen] != '.')
is_ok = 0;
}
- else
- {
- snprintf(buf, sizeof(buf), "%sRotated", pwg_media->ppd);
- if (strcmp(size->name, buf))
- {
- snprintf(buf, sizeof(buf), "%s.Transverse", pwg_media->ppd);
- if (strcmp(size->name, buf))
- is_ok = 0;
- }
- }
}
- else
- {
- if ((!strncmp(size->name, pwg_media->ppd, strlen(pwg_media->ppd))))
+ else if (!strncmp(size->name, pwg_media->ppd, ppdlen))
+ {
+ /*
+ * Check for a proper qualifier (number, "Small", or .something)...
+ */
+
+ ptr = size->name + ppdlen;
+
+ if (isdigit(*ptr & 255))
{
- for (ptr = size->name + strlen(pwg_media->ppd); *ptr; ptr ++)
+ for (ptr ++; *ptr; ptr ++)
{
if (!isdigit(*ptr & 255))
{
}
}
}
- else
- is_ok = 0;
+ else if (*ptr != '.' && *ptr && strcmp(ptr, "Small"))
+ is_ok = 0;
}
-
+ else
+ {
+ /*
+ * Check for EnvSizeName as well...
+ */
+
+ if (strncmp(pwg_media->ppd, "Env", 3) &&
+ !strncmp(size->name, "Env", 3))
+ snprintf(buf, sizeof(buf), "Env%s", pwg_media->ppd);
+
+ if (strcmp(size->name, buf))
+ is_ok = 0;
+ }
+
if (!is_ok)
_cupsLangPrintf(stdout,
_(" %s Size \"%s\" should be the Adobe "
length_tmp = (fabs(size->length - ceil(size->length)) < 0.1) ?
ceil(size->length) : size->length;
- if (fmod(width_tmp, 18.0) == 0.0 && fmod(length_tmp, 18.0) == 0.0)
+ if (fmod(width_tmp, 9.0) == 0.0 && fmod(length_tmp, 9.0) == 0.0)
{
width_inch = width_tmp / 72.0;
length_inch = length_tmp / 72.0;
else if (size->width > size->length)
strlcat(buf, ".Transverse", sizeof(buf));
- if (strcmp(size->name, buf))
- _cupsLangPrintf(stdout,
- _(" %s Size \"%s\" should be \"%s\"."),
- prefix, size->name, buf);
+ if (_cups_strcasecmp(size->name, buf))
+ {
+ size_t buflen = strlen(buf);
+ /* Length of proposed name */
+
+ if (_cups_strncasecmp(size->name, buf, buflen) ||
+ (strcmp(size->name + buflen, "in") &&
+ size->name[buflen] != '.'))
+ {
+ char altbuf[PPD_MAX_NAME];
+ /* Alternate "wNNNhNNN" name */
+ size_t altlen; /* Length of alternate name */
+
+ snprintf(altbuf, sizeof(altbuf), "w%.0fh%.0f", size->width,
+ size->length);
+ altlen = strlen(altbuf);
+ if (_cups_strncasecmp(size->name, altbuf, altlen) ||
+ (size->name[altlen] && size->name[altlen] != '.'))
+ _cupsLangPrintf(stdout,
+ _(" %s Size \"%s\" should be \"%s\"."),
+ prefix, size->name, buf);
+ }
+ }
}
}
}
* Check custom choices differently...
*/
- if (!strcasecmp(option->choices[j].choice, "Custom") &&
+ if (!_cups_strcasecmp(option->choices[j].choice, "Custom") &&
(coption = ppdFindCustomOption(ppd,
option->keyword)) != NULL)
{
errors ++;
}
- if (strcasecmp(option->keyword, "PageSize"))
+ if (_cups_strcasecmp(option->keyword, "PageSize"))
{
for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
cparam;
break;
if (j == 0 ||
- !strcasecmp(c1->choice, "None") ||
- !strcasecmp(c1->choice, "Off") ||
- !strcasecmp(c1->choice, "False"))
+ !_cups_strcasecmp(c1->choice, "None") ||
+ !_cups_strcasecmp(c1->choice, "Off") ||
+ !_cups_strcasecmp(c1->choice, "False"))
c1 = NULL;
}
break;
if (j == 0 ||
- !strcasecmp(c2->choice, "None") ||
- !strcasecmp(c2->choice, "Off") ||
- !strcasecmp(c2->choice, "False"))
+ !_cups_strcasecmp(c2->choice, "None") ||
+ !_cups_strcasecmp(c2->choice, "Off") ||
+ !_cups_strcasecmp(c2->choice, "False"))
c2 = NULL;
}
"errors."));
_cupsLangPuts(stdout, _(" -q Run silently."));
_cupsLangPuts(stdout, _(" -r Use 'relaxed' open mode."));
- _cupsLangPuts(stdout, _(" -v Be slightly verbose."));
+ _cupsLangPuts(stdout, _(" -v Be verbose."));
_cupsLangPuts(stdout, _(" -vv Be very verbose."));
exit(ERROR_USAGE);
/*
- * End of "$Id: cupstestppd.c 7807 2008-07-28 21:54:24Z mike $".
+ * End of "$Id$".
*/