#else
struct utsname name; // uname information
- vars->add(new ppdcVariable("PLATFORM_NAME", name.sysname));
- vars->add(new ppdcVariable("PLATFORM_ARCH", name.machine));
+ if (!uname(&name))
+ {
+ vars->add(new ppdcVariable("PLATFORM_NAME", name.sysname));
+ vars->add(new ppdcVariable("PLATFORM_ARCH", name.machine));
+ }
+ else
+ {
+ vars->add(new ppdcVariable("PLATFORM_NAME", "unknown"));
+ vars->add(new ppdcVariable("PLATFORM_ARCH", "unknown"));
+ }
#endif // WIN32
if (f)
ppdcOptSection section; // Option section
float order; // Option order
ppdcOption *o; // Option
+ ppdcGroup *mg; // Matching group, if any
// Read the Option parameters:
order = get_float(fp);
// See if the option already exists...
- if ((o = d->find_option(name)) == NULL)
+ if ((o = d->find_option_group(name, &mg)) == NULL)
{
// Nope, add a new one...
o = new ppdcOption(ot, name, text, section, order);
"%d of %s!\n"), name, fp->line, fp->filename);
return (NULL);
}
+ else if (g != mg)
+ {
+ _cupsLangPrintf(stderr,
+ _("ppdc: Option %s defined in two different groups on line "
+ "%d of %s!\n"), name, fp->line, fp->filename);
+ return (NULL);
+ }
return (o);
}
}
else
{
- _cupsLangPrintf(stderr,
- _("ppdc: Undefined variable (%s) on line %d of "
- "%s.\n"), name, fp->line, fp->filename);
+ if (!(cond_state & PPDC_COND_SKIP))
+ _cupsLangPrintf(stderr,
+ _("ppdc: Undefined variable (%s) on line %d of "
+ "%s.\n"), name, fp->line, fp->filename);
+
snprintf(bufptr, bufend - bufptr + 1, "$%s", name);
bufptr += strlen(name) + 1;
}
{
ppdcDriver *d; // Current driver
ppdcGroup *g, // Current group
+ *mg, // Matching group
*general, // General options group
*install; // Installable options group
ppdcOption *o; // Current option
// Initialize things as needed...
if (inc && td)
+ {
d = td;
+ d->retain();
+ }
else
d = new ppdcDriver(td);
}
cond_current ++;
- if (get_integer(fp))
+ if (get_integer(fp) > 0)
*cond_current = PPDC_COND_SATISFIED;
else
{
get_integer(fp);
*cond_current |= PPDC_COND_SKIP;
}
- else if (get_integer(fp))
+ else if (get_integer(fp) > 0)
{
*cond_current |= PPDC_COND_SATISFIED;
*cond_current &= ~PPDC_COND_SKIP;
}
// Add the choice to the cupsDarkness option...
- if ((o = d->find_option("cupsDarkness")) == NULL)
+ if ((o = d->find_option_group("cupsDarkness", &mg)) == NULL)
{
// Create the cupsDarkness option...
o = new ppdcOption(PPDC_PICKONE, "cupsDarkness", "Darkness", PPDC_SECTION_ANY, 10.0f);
g = general;
g->add_option(o);
}
+ else if (mg != general)
+ {
+ _cupsLangPrintf(stderr,
+ _("ppdc: Option %s defined in two different groups on "
+ "line %d of %s!\n"), "cupsDarkness", fp->line,
+ fp->filename);
+ c->release();
+ continue;
+ }
o->add_choice(c);
}
// Add the choice to the cupsFinishing option...
- if ((o = d->find_option("cupsFinishing")) == NULL)
+ if ((o = d->find_option_group("cupsFinishing", &mg)) == NULL)
{
// Create the cupsFinishing option...
o = new ppdcOption(PPDC_PICKONE, "cupsFinishing", "Finishing", PPDC_SECTION_ANY, 10.0f);
g = general;
g->add_option(o);
}
+ else if (mg != general)
+ {
+ _cupsLangPrintf(stderr,
+ _("ppdc: Option %s defined in two different groups on "
+ "line %d of %s!\n"), "cupsFinishing", fp->line,
+ fp->filename);
+ c->release();
+ continue;
+ }
o->add_choice(c);
}
// Add the choice to the InputSlot option...
- if ((o = d->find_option("InputSlot")) == NULL)
+
+ if ((o = d->find_option_group("InputSlot", &mg)) == NULL)
{
// Create the InputSlot option...
o = new ppdcOption(PPDC_PICKONE, "InputSlot", "Media Source",
g = general;
g->add_option(o);
}
+ else if (mg != general)
+ {
+ _cupsLangPrintf(stderr,
+ _("ppdc: Option %s defined in two different groups on "
+ "line %d of %s!\n"), "InputSlot", fp->line,
+ fp->filename);
+ c->release();
+ continue;
+ }
o->add_choice(c);
}
// Add the choice to the MediaType option...
- if ((o = d->find_option("MediaType")) == NULL)
+ if ((o = d->find_option_group("MediaType", &mg)) == NULL)
{
// Create the MediaType option...
o = new ppdcOption(PPDC_PICKONE, "MediaType", "Media Type",
g = general;
g->add_option(o);
}
+ else if (mg != general)
+ {
+ _cupsLangPrintf(stderr,
+ _("ppdc: Option %s defined in two different groups on "
+ "line %d of %s!\n"), "MediaType", fp->line,
+ fp->filename);
+ c->release();
+ continue;
+ }
o->add_choice(c);
}
// Add the choice to the Resolution option...
- if ((o = d->find_option("Resolution")) == NULL)
+ if ((o = d->find_option_group("Resolution", &mg)) == NULL)
{
// Create the Resolution option...
o = new ppdcOption(PPDC_PICKONE, "Resolution", NULL, PPDC_SECTION_ANY,
g = general;
g->add_option(o);
}
+ else if (mg != general)
+ {
+ _cupsLangPrintf(stderr,
+ _("ppdc: Option %s defined in two different groups on "
+ "line %d of %s!\n"), "Resolution", fp->line,
+ fp->filename);
+ c->release();
+ continue;
+ }
o->add_choice(c);
drivers->add(d);
}
}
+ else if (inc && td)
+ td->release();
}