mirror of
https://git.freebsd.org/ports.git
synced 2025-05-14 16:21:50 -04:00
to print a generated PostScript file. When lpd(8) is used, lpr(1) from base must be used. Also, status command for lpc(8) requires a printer name. If no argument is specified, i.e., "/usr/sbin/lpc status", then it displays the command usage, i.e., "usage: status {all | printer ...}". Unfortunately, "usage" is interpreted as a printer name because ":" is included. Add "all" and adjust an expression for grep(1).
34 lines
1.5 KiB
Java
34 lines
1.5 KiB
Java
--- jdk/src/share/classes/sun/print/PSPrinterJob.java
|
|
+++ jdk/src/share/classes/sun/print/PSPrinterJob.java
|
|
@@ -1588,8 +1588,30 @@
|
|
|
|
String osname = System.getProperty("os.name");
|
|
if (osname.equals("Linux") || osname.endsWith("BSD") || osname.contains("OS X")) {
|
|
+ String lprPath = "/usr/bin/lpr";
|
|
+ if (osname.endsWith("BSD")) {
|
|
+ final PrintService pservice = getPrintService();
|
|
+ Boolean isIPPPrinter =
|
|
+ (Boolean)java.security.AccessController.doPrivileged(
|
|
+ new java.security.PrivilegedAction() {
|
|
+ public Object run() {
|
|
+ try {
|
|
+ Class psClass =
|
|
+ Class.forName("sun.print.IPPPrintService");
|
|
+ if (psClass.isInstance(pservice)) {
|
|
+ return Boolean.TRUE;
|
|
+ }
|
|
+ } catch (Throwable t) {
|
|
+ }
|
|
+ return Boolean.FALSE;
|
|
+ }
|
|
+ });
|
|
+ if (isIPPPrinter) {
|
|
+ lprPath = "%%LOCALBASE%%/bin/lpr";
|
|
+ }
|
|
+ }
|
|
execCmd = new String[ncomps];
|
|
- execCmd[n++] = "/usr/bin/lpr";
|
|
+ execCmd[n++] = lprPath;
|
|
if ((pFlags & PRINTER) != 0) {
|
|
execCmd[n++] = "-P" + printer;
|
|
}
|