|
Lines 1239-1246
Link Here
|
| 1239 |
} |
1239 |
} |
| 1240 |
|
1240 |
|
| 1241 |
/* Check for LPRng first so we do not pick up bogus ppd files by the -ppd option */ |
1241 |
/* Check for LPRng first so we do not pick up bogus ppd files by the -ppd option */ |
| 1242 |
if (arglist_remove_flag(arglist, "--lprng")) |
1242 |
if (spooler != SPOOLER_CUPS) { |
| 1243 |
spooler = SPOOLER_LPRNG; |
1243 |
if (arglist_remove_flag(arglist, "--lprng")) |
|
|
1244 |
spooler = SPOOLER_LPRNG; |
| 1245 |
} |
| 1244 |
|
1246 |
|
| 1245 |
/* 'PRINTCAP_ENTRY' environment variable is : LPRng |
1247 |
/* 'PRINTCAP_ENTRY' environment variable is : LPRng |
| 1246 |
the :ppd=/path/to/ppdfile printcap entry should be used */ |
1248 |
the :ppd=/path/to/ppdfile printcap entry should be used */ |
|
Lines 1262-1357
Link Here
|
| 1262 |
} |
1264 |
} |
| 1263 |
} |
1265 |
} |
| 1264 |
|
1266 |
|
| 1265 |
/* PPD file name given via the command line |
1267 |
/* CUPS calls foomatic-rip only with 5 or 6 positional parameters, |
| 1266 |
allow duplicates, and use the last specified one */ |
1268 |
not with named options, like for example "-p <string>" */ |
| 1267 |
if (spooler != SPOOLER_LPRNG) { |
1269 |
if (spooler != SPOOLER_CUPS) { |
| 1268 |
while ((str = arglist_get_value(arglist, "-p"))) { |
1270 |
/* PPD file name given via the command line |
|
|
1271 |
allow duplicates, and use the last specified one */ |
| 1272 |
if (spooler != SPOOLER_LPRNG) { |
| 1273 |
while ((str = arglist_get_value(arglist, "-p"))) { |
| 1274 |
strncpy(job->ppdfile, str, 256); |
| 1275 |
arglist_remove(arglist, "-p"); |
| 1276 |
} |
| 1277 |
} |
| 1278 |
while ((str = arglist_get_value(arglist, "--ppd"))) { |
| 1269 |
strncpy(job->ppdfile, str, 256); |
1279 |
strncpy(job->ppdfile, str, 256); |
| 1270 |
arglist_remove(arglist, "-p"); |
1280 |
arglist_remove(arglist, "--ppd"); |
| 1271 |
} |
1281 |
} |
| 1272 |
} |
1282 |
|
| 1273 |
while ((str = arglist_get_value(arglist, "--ppd"))) { |
1283 |
/* Check for LPD/GNUlpr by typical options which the spooler puts onto |
| 1274 |
strncpy(job->ppdfile, str, 256); |
1284 |
the filter's command line (options "-w": text width, "-l": text |
| 1275 |
arglist_remove(arglist, "--ppd"); |
1285 |
length, "-i": indent, "-x", "-y": graphics size, "-c": raw printing, |
| 1276 |
} |
1286 |
"-n": user name, "-h": host name) */ |
| 1277 |
|
1287 |
if ((str = arglist_get_value(arglist, "-h"))) { |
| 1278 |
/* Check for LPD/GNUlpr by typical options which the spooler puts onto |
1288 |
if (spooler != SPOOLER_GNULPR && spooler != SPOOLER_LPRNG) |
| 1279 |
the filter's command line (options "-w": text width, "-l": text |
1289 |
spooler = SPOOLER_LPD; |
| 1280 |
length, "-i": indent, "-x", "-y": graphics size, "-c": raw printing, |
1290 |
strncpy(job->host, str, 127); |
| 1281 |
"-n": user name, "-h": host name) */ |
1291 |
job->host[127] = '\0'; |
| 1282 |
if ((str = arglist_get_value(arglist, "-h"))) { |
1292 |
arglist_remove(arglist, "-h"); |
| 1283 |
if (spooler != SPOOLER_GNULPR && spooler != SPOOLER_LPRNG) |
1293 |
} |
| 1284 |
spooler = SPOOLER_LPD; |
1294 |
if ((str = arglist_get_value(arglist, "-n"))) { |
| 1285 |
strncpy(job->host, str, 127); |
1295 |
if (spooler != SPOOLER_GNULPR && spooler != SPOOLER_LPRNG) |
| 1286 |
job->host[127] = '\0'; |
1296 |
spooler = SPOOLER_LPD; |
| 1287 |
arglist_remove(arglist, "-h"); |
1297 |
|
| 1288 |
} |
1298 |
strncpy(job->user, str, 127); |
| 1289 |
if ((str = arglist_get_value(arglist, "-n"))) { |
1299 |
job->user[127] = '\0'; |
| 1290 |
if (spooler != SPOOLER_GNULPR && spooler != SPOOLER_LPRNG) |
1300 |
arglist_remove(arglist, "-n"); |
| 1291 |
spooler = SPOOLER_LPD; |
1301 |
} |
| 1292 |
|
1302 |
if (arglist_remove(arglist, "-w") || |
| 1293 |
strncpy(job->user, str, 127); |
1303 |
arglist_remove(arglist, "-l") || |
| 1294 |
job->user[127] = '\0'; |
1304 |
arglist_remove(arglist, "-x") || |
| 1295 |
arglist_remove(arglist, "-n"); |
1305 |
arglist_remove(arglist, "-y") || |
| 1296 |
} |
1306 |
arglist_remove(arglist, "-i") || |
| 1297 |
if (arglist_remove(arglist, "-w") || |
1307 |
arglist_remove_flag(arglist, "-c")) { |
| 1298 |
arglist_remove(arglist, "-l") || |
1308 |
if (spooler != SPOOLER_GNULPR && spooler != SPOOLER_LPRNG) |
| 1299 |
arglist_remove(arglist, "-x") || |
1309 |
spooler = SPOOLER_LPD; |
| 1300 |
arglist_remove(arglist, "-y") || |
1310 |
} |
| 1301 |
arglist_remove(arglist, "-i") || |
1311 |
/* LPRng delivers the option settings via the "-Z" argument */ |
| 1302 |
arglist_remove_flag(arglist, "-c")) { |
1312 |
if ((str = arglist_get_value(arglist, "-Z"))) { |
| 1303 |
if (spooler != SPOOLER_GNULPR && spooler != SPOOLER_LPRNG) |
1313 |
spooler = SPOOLER_LPRNG; |
| 1304 |
spooler = SPOOLER_LPD; |
1314 |
dstrcatf(job->optstr, "%s ", str); |
| 1305 |
} |
1315 |
arglist_remove(arglist, "-Z"); |
| 1306 |
/* LPRng delivers the option settings via the "-Z" argument */ |
1316 |
} |
| 1307 |
if ((str = arglist_get_value(arglist, "-Z"))) { |
1317 |
/* Job title and options for stock LPD */ |
| 1308 |
spooler = SPOOLER_LPRNG; |
1318 |
if ((str = arglist_get_value(arglist, "-j")) || (str = arglist_get_value(arglist, "-J"))) { |
| 1309 |
dstrcatf(job->optstr, "%s ", str); |
1319 |
strncpy_omit(job->title, str, 128, omit_shellescapes); |
| 1310 |
arglist_remove(arglist, "-Z"); |
1320 |
if (spooler == SPOOLER_LPD) |
| 1311 |
} |
1321 |
dstrcatf(job->optstr, "%s ", job->title); |
| 1312 |
/* Job title and options for stock LPD */ |
1322 |
if (!arglist_remove(arglist, "-j")) |
| 1313 |
if ((str = arglist_get_value(arglist, "-j")) || (str = arglist_get_value(arglist, "-J"))) { |
1323 |
arglist_remove(arglist, "-J"); |
| 1314 |
strncpy_omit(job->title, str, 128, omit_shellescapes); |
1324 |
} |
| 1315 |
if (spooler == SPOOLER_LPD) |
1325 |
/* Check for CPS */ |
| 1316 |
dstrcatf(job->optstr, "%s ", job->title); |
1326 |
if (arglist_remove_flag(arglist, "--cps") > 0) |
| 1317 |
if (!arglist_remove(arglist, "-j")) |
1327 |
spooler = SPOOLER_CPS; |
| 1318 |
arglist_remove(arglist, "-J"); |
1328 |
|
| 1319 |
} |
1329 |
/* Options for spooler-less printing, CPS, or PDQ */ |
| 1320 |
/* Check for CPS */ |
1330 |
while ((str = arglist_get_value(arglist, "-o"))) { |
| 1321 |
if (arglist_remove_flag(arglist, "--cps") > 0) |
1331 |
strncpy_omit(tmp, str, 1024, omit_shellescapes); |
| 1322 |
spooler = SPOOLER_CPS; |
1332 |
dstrcatf(job->optstr, "%s ", tmp); |
| 1323 |
|
1333 |
arglist_remove(arglist, "-o"); |
| 1324 |
/* Options for spooler-less printing, CPS, or PDQ */ |
1334 |
/* If we don't print as PPR RIP or as CPS filter, we print |
| 1325 |
while ((str = arglist_get_value(arglist, "-o"))) { |
1335 |
without spooler (we check for PDQ later) */ |
| 1326 |
strncpy_omit(tmp, str, 1024, omit_shellescapes); |
1336 |
if (spooler != SPOOLER_PPR && spooler != SPOOLER_CPS) |
| 1327 |
dstrcatf(job->optstr, "%s ", tmp); |
1337 |
spooler = SPOOLER_DIRECT; |
| 1328 |
arglist_remove(arglist, "-o"); |
1338 |
} |
| 1329 |
/* If we don't print as PPR RIP or as CPS filter, we print |
1339 |
|
| 1330 |
without spooler (we check for PDQ later) */ |
1340 |
/* Printer for spooler-less printing or PDQ */ |
| 1331 |
if (spooler != SPOOLER_PPR && spooler != SPOOLER_CPS) |
1341 |
if ((str = arglist_get_value(arglist, "-d"))) { |
| 1332 |
spooler = SPOOLER_DIRECT; |
1342 |
strncpy_omit(job->printer, str, 256, omit_shellescapes); |
| 1333 |
} |
1343 |
arglist_remove(arglist, "-d"); |
| 1334 |
|
1344 |
} |
| 1335 |
/* Printer for spooler-less printing or PDQ */ |
1345 |
|
| 1336 |
if ((str = arglist_get_value(arglist, "-d"))) { |
1346 |
/* Printer for spooler-less printing, PDQ, or LPRng */ |
| 1337 |
strncpy_omit(job->printer, str, 256, omit_shellescapes); |
1347 |
if ((str = arglist_get_value(arglist, "-P"))) { |
| 1338 |
arglist_remove(arglist, "-d"); |
1348 |
strncpy_omit(job->printer, str, 256, omit_shellescapes); |
| 1339 |
} |
1349 |
arglist_remove(arglist, "-P"); |
| 1340 |
|
1350 |
} |
| 1341 |
/* Printer for spooler-less printing, PDQ, or LPRng */ |
1351 |
|
| 1342 |
if ((str = arglist_get_value(arglist, "-P"))) { |
1352 |
/* Were we called from a PDQ wrapper? */ |
| 1343 |
strncpy_omit(job->printer, str, 256, omit_shellescapes); |
1353 |
if (arglist_remove_flag(arglist, "--pdq")) |
| 1344 |
arglist_remove(arglist, "-P"); |
1354 |
spooler = SPOOLER_PDQ; |
| 1345 |
} |
1355 |
|
| 1346 |
|
1356 |
/* Were we called to build the PDQ driver declaration file? */ |
| 1347 |
/* Were we called from a PDQ wrapper? */ |
1357 |
genpdqfile = check_pdq_file(arglist); |
| 1348 |
if (arglist_remove_flag(arglist, "--pdq")) |
1358 |
if (genpdqfile) |
| 1349 |
spooler = SPOOLER_PDQ; |
1359 |
spooler = SPOOLER_PDQ; |
| 1350 |
|
1360 |
} |
| 1351 |
/* Were we called to build the PDQ driver declaration file? */ |
|
|
| 1352 |
genpdqfile = check_pdq_file(arglist); |
| 1353 |
if (genpdqfile) |
| 1354 |
spooler = SPOOLER_PDQ; |
| 1355 |
|
1361 |
|
| 1356 |
/* spooler specific initialization */ |
1362 |
/* spooler specific initialization */ |
| 1357 |
switch (spooler) { |
1363 |
switch (spooler) { |