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