1
diff -Nur -x '*.orig' -x '*~' foomatic-filters-4.0.0/foomaticrip.c foomatic-filters-4.0.0.new/foomaticrip.c
2
--- foomatic-filters-4.0.0/foomaticrip.c 2009-03-31 00:13:46.000000000 +0200
3
+++ foomatic-filters-4.0.0.new/foomaticrip.c 2009-03-31 00:14:11.000000000 +0200
5
/* processes job->optstr */
6
void process_cmdline_options()
8
- char *p, *nextopt, *pagerange, *key, *value;
9
+ char *p, *cmdlineopts, *nextopt, *pagerange, *key, *value;
14
- for (nextopt = extract_next_option(job->optstr->data, &pagerange, &key, &value);
15
+ _log("Printing system options:\n");
16
+ cmdlineopts = strdup(job->optstr->data);
17
+ for (nextopt = extract_next_option(cmdlineopts, &pagerange, &key, &value);
19
nextopt = extract_next_option(nextopt, &pagerange, &key, &value))
21
+ /* Consider only options which are not in the PPD file here */
22
+ if ((opt = find_option(key)) != NULL) continue;
24
_log("Pondering option '%s=%s'\n", key, value);
28
snprintf(tmp, 256, "pages:%s", pagerange);
29
optset = optionset(tmp);
31
- opt = find_option(key);
32
- if (opt && (option_get_section(opt) != SECTION_ANYSETUP &&
33
- option_get_section(opt) != SECTION_PAGESETUP)) {
34
- _log("This option (%s) is not a \"PageSetup\" or \"AnySetup\" option, so it cannot be restricted to a page range.\n", key);
39
optset = optionset("userval");
41
for Collate and StapleLocation? These may be here...
45
- /* Various non-standard printer-specific options */
46
- if ((opt = find_option(key))) {
47
- if (!option_set_value(opt, optset, value)) {
48
- _log(" invalid choice \"%s\", using \"%s\" instead\n",
49
- value, option_get_value(opt, optset));
52
- else if (spooler == SPOOLER_PPR_INT) {
53
- /* Unknown option, pass it to PPR's backend interface */
54
- if (!backendoptions)
55
- backendoptions = create_dstr();
56
- dstrcatf(backendoptions, "%s=%s ", key, value);
59
- _log("Unknown option %s=%s.\n", key, value);
61
+ else if (spooler == SPOOLER_PPR_INT) {
62
+ /* Unknown option, pass it to PPR's backend interface */
63
+ if (!backendoptions)
64
+ backendoptions = create_dstr();
65
+ dstrcatf(backendoptions, "%s=%s ", key, value);
68
+ _log("Unknown option %s=%s.\n", key, value);
70
/* Custom paper size */
71
else if ((opt = find_option("PageSize")) && option_set_value(opt, optset, key)) {
72
/* do nothing, if the value could be set, it has been set */
75
+ _log("Unknown boolean option \"%s\".\n", key);
79
+ _log("Options from the PPD file:\n");
80
+ cmdlineopts = strdup(job->optstr->data);
81
+ for (nextopt = extract_next_option(cmdlineopts, &pagerange, &key, &value);
83
+ nextopt = extract_next_option(nextopt, &pagerange, &key, &value))
85
+ /* Consider only PPD file options here */
86
+ if ((opt = find_option(key)) == NULL) continue;
88
+ _log("Pondering option '%s=%s'\n", key, value);
90
+ _log("Pondering option '%s'\n", key);
93
+ snprintf(tmp, 256, "pages:%s", pagerange);
94
+ optset = optionset(tmp);
96
+ if (opt && (option_get_section(opt) != SECTION_ANYSETUP &&
97
+ option_get_section(opt) != SECTION_PAGESETUP)) {
98
+ _log("This option (%s) is not a \"PageSetup\" or \"AnySetup\" option, so it cannot be restricted to a page range.\n", key);
103
+ optset = optionset("userval");
106
+ /* Various non-standard printer-specific options */
107
+ if (!option_set_value(opt, optset, value)) {
108
+ _log(" invalid choice \"%s\", using \"%s\" instead\n",
109
+ value, option_get_value(opt, optset));
112
/* Standard bool args:
113
landscape; what to do here?
114
duplex; we should just handle this one OK now? */
115
- else if (!prefixcasecmp(key, "no") && (opt = find_option(&key[2])))
116
+ else if (!prefixcasecmp(key, "no"))
117
option_set_value(opt, optset, "0");
118
- else if ((opt = find_option(key)))
119
- option_set_value(opt, optset, "1");
121
- _log("Unknown boolean option \"%s\".\n", key);
122
+ option_set_value(opt, optset, "1");
127
/* checks whether a pdq driver declaration file should be build
128
diff -Nur -x '*.orig' -x '*~' foomatic-filters-4.0.0/options.c foomatic-filters-4.0.0.new/options.c
129
--- foomatic-filters-4.0.0/options.c 2009-01-14 20:23:15.000000000 +0100
130
+++ foomatic-filters-4.0.0.new/options.c 2009-03-31 00:14:11.000000000 +0200
132
return find_option("PageSize");
134
for (opt = optionlist; opt; opt = opt->next) {
135
- if (!strcasecmp(opt->name, name))
136
+ if ((!strcasecmp(opt->name, name)) ||
137
+ ((!strcasecmp(opt->name, &name[2])) &&
138
+ (!prefixcasecmp(name, "no"))))
142
@@ -427,12 +429,12 @@
143
imin = !isempty(param->min) ? atoi(param->min) : -999999;
144
imax = !isempty(param->max) ? atoi(param->max) : 1000000;
146
- _log("Value \"%s\" for option \"%s.%s\" is smaller than the minimum value \"%d\"\n",
147
+ _log("Value \"%s\" for option \"%s\", parameter \"%s\" is smaller than the minimum value \"%d\"\n",
148
str, opt->name, param->name, imin);
152
- _log("Value \"%s\" for option \"%s.%s\" is larger than the maximum value \"%d\"\n",
153
+ _log("Value \"%s\" for option \"%s\", parameter \"%s\" is larger than the maximum value \"%d\"\n",
154
str, opt->name, param->name, imax);
157
@@ -448,12 +450,12 @@
158
fmin = !isempty(param->min) ? atof(param->min) : -999999.0;
159
fmax = !isempty(param->max) ? atof(param->max) : 1000000.0;
161
- _log("Value \"%s\" for option \"%s.%s\" is smaller than the minimum value \"%d\"\n",
162
+ _log("Value \"%s\" for option \"%s\", parameter \"%s\" is smaller than the minimum value \"%d\"\n",
163
str, opt->name, param->name, fmin);
167
- _log("Value \"%s\" for option \"%s.%s\" is larger than the maximum value \"%d\"\n",
168
+ _log("Value \"%s\" for option \"%s\", parameter \"%s\" is larger than the maximum value \"%d\"\n",
169
str, opt->name, param->name, fmax);
172
@@ -466,24 +468,24 @@
174
if (param->allowedchars &&
175
regexec(param->allowedchars, str, 0, NULL, 0) != 0) {
176
- _log("Custom string \"%s\" for \"%s.%s\" contains illegal characters.\n",
177
+ _log("Custom string \"%s\" for \"%s\", parameter \"%s\" contains illegal characters.\n",
178
str, opt->name, param->name);
181
if (param->allowedregexp &&
182
regexec(param->allowedregexp, str, 0, NULL, 0) != 0) {
183
- _log("Custom string \"%s\" for \"%s.%s\" does not match the allowed regexp.\n",
184
+ _log("Custom string \"%s\" for \"%s\", parameter \"%s\" does not match the allowed regexp.\n",
185
str, opt->name, param->name);
189
if (!isempty(param->min) && len < atoi(param->min)) {
190
- _log("Custom value \"%s\" is too short for \"%s.%s\".\n",
191
+ _log("Custom value \"%s\" is too short for option \"%s\", parameter \"%s\".\n",
192
str, opt->name, param->name);
195
if (!isempty(param->max) && len > atoi(param->max)) {
196
- _log("Custom value \"%s\" is too long for \"%s.%s\".\n",
197
+ _log("Custom value \"%s\" is too long for option \"%s\", parameter \"%s\".\n",
198
str, opt->name, param->name);
202
else if (!strcasecmp(param->name, "height"))
203
paramvalues[i] = get_valid_param_string_int(opt, param, (int)height);
205
- paramvalues[i] = get_valid_param_string(opt, param, "0");
206
+ paramvalues[i] = !isempty(param->min) ? param->min : "-999999";
207
if (!paramvalues[i]) {
208
free_paramvalues(opt, paramvalues);