https://pubs.opengroup.org/onlinepubs/9799919799/
I think we should be adding the -e and -E stuff to echo That still cannot use getopt, it must manually look at argv[1] for - followed by a series of e, E, and n, then apply it. If the pattern isn't precisely -[eEn]* it should print it as if it wasn't this special argument. joshua stein <[email protected]> wrote: > I was trying to use the driverless thing in CUPS to be able to add > AirPrint printers on my network but 'driverless list' would never > show any printers even with Avahi running. > > Turns out the driverless binary is shelling out to ippfind and > passing a long string of args to act as a filter, and that filter > depends on echo having an -e flag to print in a format that > driverless reads back. Since we don't have -e, it was just reading > back garbage. > > ippfind -T 0 _ipps._tcp _ipp._tcp ! --txt printer-type --and \( --txt-pdl > image/pwg-raster --or --txt-pdl application/PCLm --or --txt-pdl image/urf > --or --txt-pdl application/pdf \) -x echo -en > '\n{service_scheme}\t{service_name}\t{service_domain}\t{txt_usb_MFG}\t{txt_usb_MDL}\t{txt_product}\t{txt_ty}\t{service_name}\t{txt_pdl}\t{txt_UUID}\t{txt_rfo}\t' > \; --local -x echo -en L \; > > The easiest solution seemed to be to depend on gecho from coreutils > but maybe there's a shorter path. > > > diff --git print/cups-filters/Makefile print/cups-filters/Makefile > index c34782cf7e5..9ec9dfb9e60 100644 > --- print/cups-filters/Makefile > +++ print/cups-filters/Makefile > @@ -2,7 +2,7 @@ COMMENT= OpenPrinting CUPS filters > > V= 2.0.1 > DISTNAME= cups-filters-${V} > -REVISION= 0 > +REVISION= 1 > > CATEGORIES= print > > @@ -32,7 +32,8 @@ LIB_DEPENDS= print/libcupsfilters \ > > # make it easier for users: bring in foomatic-db and allow the > # regeneration of PPD files from share/foomatic/db/source/*/*.xml > -RUN_DEPENDS += print/foomatic-db-engine > +RUN_DEPENDS += print/foomatic-db-engine \ > + sysutils/coreutils > > FAKE_FLAGS= pkgfontconfigdir=${PREFIX}/share/examples/cups-filters \ > > pkgcupsserverrootdir=${PREFIX}/share/examples/cups-filters/cups > diff --git print/cups-filters/patches/patch-utils_driverless_c > print/cups-filters/patches/patch-utils_driverless_c > new file mode 100644 > index 00000000000..e234226fbec > --- /dev/null > +++ print/cups-filters/patches/patch-utils_driverless_c > @@ -0,0 +1,26 @@ > +--- utils/driverless.c.orig Sun Feb 15 21:03:40 2026 > ++++ utils/driverless.c Sun Feb 15 21:04:25 2026 > +@@ -419,7 +419,11 @@ > + ippfind_argv[i++] = "application/pdf"; /* PDF */ > + ippfind_argv[i++] = ")"; > + ippfind_argv[i++] = "-x"; > ++#ifdef __OpenBSD__ > ++ ippfind_argv[i++] = "gecho"; /* Output the needed data fields > */ > ++#else > + ippfind_argv[i++] = "echo"; /* Output the needed data fields > */ > ++#endif > + ippfind_argv[i++] = "-en"; /* separated by tab characters */ > + if (mode < 0) { > + if (isFax) > +@@ -440,7 +444,11 @@ > + if (mode < 0) { > + ippfind_argv[i++] = "--local"; /* Rest only if local service */ > + ippfind_argv[i++] = "-x"; > ++#ifdef __OpenBSD__ > ++ ippfind_argv[i++] = "gecho"; /* Output an 'L' at the end of > the */ > ++#else > + ippfind_argv[i++] = "echo"; /* Output an 'L' at the end of > the */ > ++#endif > + ippfind_argv[i++] = "-en"; /* line */ > + ippfind_argv[i++] = "L"; > + ippfind_argv[i++] = ";"; >
