Name: print/cups/cups-browsed Summary: OpenPrinting cups-browsed Publisher: solaris Version: 2.1.1 Build Release: 11.4 Branch: 11.4.90.0.0.212.0 Packaging Date: Wed Dec 17 21:06:07 2025 Size: 1.10 MB Compressed Size: 412.86 kB FMRI: pkg://solaris/print/cups/cups-browsed@2.1.1,11.4-11.4.90.0.0.212.0:20251217T210607Z License: ## Files: LICENSE Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ## Files: COPYING Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: cups-browsed Upstream-Contact: OpenPrinting Source: http://www.openprinting.org/download/cups-browsed/ Files: * Copyright: 2011-2022 OpenPrinting 1996-2023 Free Software Foundation, Inc. 2011-2022 Till Kamppeter 2013-2015 Tim Waugh 2018-2019 Deepak Patankar 2020 Mohit Mohan License: Apache-2.0-with-GPL2-LGPL2-Exception License: Apache-2.0-with-GPL2-LGPL2-Exception Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. . On Debian systems, the complete text of the Apache License, Version 2.0 can be found in '/usr/share/common-licenses/Apache-2.0'. . As an exception, if, as a result of your compiling your source code, portions of this Software are embedded into an Object form of such source code, you may redistribute such embedded portions in such Object form without complying with the conditions of Sections 4(a), 4(b) and 4(d) of the License. . In addition, if you combine or link compiled forms of this Software with software that is licensed under the GPLv2 ("Combined Software") and if a court of competent jurisdiction determines that the patent provision (Section 3), the indemnity provision (Section 9) or other Section of the License conflicts with the conditions of the GPLv2, you may retroactively and prospectively choose to deem waived or otherwise exclude such Section(s) of the License, but only in their entirety and only with respect to the Combined Software. ## Files: README.md # OpenPrinting cups-browsed v2.1.0 - 2024-10-17 Looking for compile instructions? Read the file "INSTALL" instead... ## INTRODUCTION CUPS is a standards-based, open-source printing system used by Apple's Mac OS® and other UNIX®-like operating systems, especially also Linux. CUPS uses the Internet Printing Protocol ("IPP") and provides System V and Berkeley command-line interfaces, a web interface, and a C API to manage printers and print jobs. This package contains cups-browsed, a helper daemon to browse the network for remote CUPS queues and IPP network printers and automatically create local queues pointing to them. cups-browsed has the following functionality: - Auto-discover print services advertised via DNS-SD (network printers, IPP-over-USB printers, Printer Applications, remote CUPS queues) and create local queues pointing to them. CUPS usually automatically creates temporary queues for such print services, but several print dialogs use old CUPS APIs and therefore require permanent local queues to see such printers. - Creating printer clusters where jobs are printed to one single queue and get automatically passed on to a suitable member printer. + Manual (via config file) and automatic (equally-named remote CUPS printers form local cluster, as in legacy CUPS 1.5.x and older) creation of cluster queues + If member printers are different models/types, the local queue gets the totality of all their features, options, and choices. Job goes to printer which actually supports the user-selected job settings. So in a cluster of photo printer, fast laser, and large format selecting photo paper for example makes the job go to the photo printer, duplex makes it go to the laser, A2 paper to the large format ... So user has one queue for all printers, they select features, not printers for their jobs ... + Automatic selection of destination printer depending on job option settings + Load balancing on equally suitable printers + `implicitclass` backend holds the job, waits for instructions about the destination printer of cups-browsed, converts the (PDF) job to one of the destination's (driverless) input formats, and passes on the job. - Highly configurable: Which printers are considered? For which type of printers queues are created? Cluster types and member printers? which names auto-created queues should get? DNS-SD and/or BrowsePoll? ... - Multi-threading allows several tasks to be done in parallel and assures responsiveness of the daemon when there is a large amount of printers available in the network. For compiling and using this package CUPS (2.2.2 or newer), libcupsfilters 2.x, libppd, libavahi-common, libavahi-client, libdbus, and glib are needed. It also needs gcc (C compiler), automake, autoconf, autopoint, and libtool. On Debian, Ubuntu, and distributions derived from them you could also install the "build-essential" package to auto-install most of these packages. Report bugs to [GitHub Issues for cups-browsed](https://github.com/OpenPrinting/cups-browsed/issues) See the "COPYING", "LICENCE", and "NOTICE" files for legal information. The license is the same as for CUPS, for a maximum of compatibility. ## LINKS * [Short history of cups-browsed](https://openprinting.github.io/achievements/#cups-browsed) ## TEST SUITE The script test/run-tests.sh creates emulations of IPP printers via "ippeveprinter" (of CUPS 2.x) and checks whether cups-browsed creates corresponding CUPS queues, whether a job to such a queue gets actually printed, and whether cups-browsed removes the queues again when the printers are shut down. SIDE EFFECT: By developing this script cups-browsed got tested running as non-root user (only needs to be member of the "lpadmin" group) and works properly this way. Appropriate distribution packaging is recommended to improve system security. REQUIREMENTS: Most of these are already needed for building or using cups-browsed. - CUPS 2.x must be installed: cupsd, lpstat, lp, ippevepriner, cups-config, and everything needed to run cupsd. - cups-filters 2.x needs to be installed, providing the filters for processing print jobs and the "driverless" utility to discover printers via shell script. - cups-browsed 2.x needs to be installed for test mode 3 or for running the script as root. The script has different modes: - Run without arguments by "make" it goes into "make check" mode, copying the files of the system's CUPS (to pull it out of the distro's AppArmor harness of the distro, run it as normal user, and modify the configuration) to run an own CUPS instance on port 8631, and running the cups-browsed executable built by "make", attached to this CUPS instance. - Run without arguments directly it asks the use for the test mode and whether tey want to run the daemons under Valgrind. Modes are + 0: Only start cupsd and cups-browsed, for manual testing independent of the system's environment + 1: As 0, but also run the 2 ippeveprinter instances to emulate printers + 2: Run the "make check" mode described above. + 3: Do the same tests as in "make check" mode, but use the system's CUPS and cups-browsed. This mode is for the autopkgtest of Debian and Ubuntu, or for CI tests in general. - Run with a number (0-3) as argument the appropriate mode is selected, run with a number (0-3) as first and "yes" or "no" as second argument using or not using Valgrind is also selected. - Running the script as root always uses the system's CUPS and cups-browsed. The test's CUPS instance and all log files are held in /tmp/cups-browsed${USER}/. ## DOCUMENTATION FROM CUPS-FILTERS 1.x Most of this is still valid for the current cups-browsed. ### HELPER DAEMON FOR BROWSING REMOTE CUPS PRINTERS AND IPP NETWORK PRINTERS From version 1.6.0 on in CUPS the CUPS broadcasting/browsing facility was dropped, in favour of DNS-SD-based broadcasting of shared printers. This is done as DNS-SD broadcasting of shared printers is a standard, established by the PWG (Printing Working Group, http://www.pwg.org/), and most other network services (shared file systems, shared media files/streams, remote desktop services, ...) are also broadcasted via DNS-SD. Problem is that CUPS only broadcasts its shared printers but does not browse broadcasts of other CUPS servers to make the shared remote printers available locally without any configuration efforts. This is a regression compared to the old CUPS broadcasting/browsing. The intention of CUPS upstream is that the application's print dialogs browse the DNS-SD broadcasts as an AirPrint-capable iPhone does, but it will take its time until all toolkit developers add the needed functionality, and programs using old toolkits or no toolkits at all, or the command line stay uncovered. The solution is cups-browsed, a helper daemon running in parallel to the CUPS daemon which listens to DNS-SD broadcasts of shared CUPS printers on remote machines in the local network via Avahi. For each reported remote printer it creates a local raw queue pointing to the remote printer so that the printer appears in local print dialogs and is also available for printing via the command line. As with the former CUPS broadcasting/browsing with this queue the driver on the server is used and the local print dialogs give access to all options of the server-side printer driver. Also high availability with redundant print servers and load balancing is supported. If there is more than one server providing a shared print queue with the same name, cups-browsed forms a cluster locally with this name as queue name and printing through the "implicitclass" backend. Each job triggers cups-browsed to check which remote queue is suitable for the job, meaning that it is enabled, accepts jobs, and is not currently printing. If none of the remote queues fulfills these criteria, we check again in 5 seconds, until a printer gets free to accommodate the job. When we search for a free printer, we do not start at the first in the list, but always on the one after the last one used (as CUPS also does with classes), so that all printer get used, even if the frequency of jobs is low. This is also what CUPS formerly did with implicit classes. Optionally, jobs can be sent immediately into the remote queue with the lowest number of waiting jobs, so that no local queue of waiting jobs is built up. For maximum security cups-browsed uses IPPS (encrypted IPP) whenever possible. In addition, cups-browsed is also capable of discovering IPP network printers (native printers, not CUPS queues) with known page description languages (PWG Raster, Apple Raster, PDF, PostScript, PCL XL, PCL 5c/e) in the local network and auto-create print queues with auto-created PPD files. This functionality is primarily for mobile devices running CUPS to not need a printer setup tool nor a collection of printer drivers and PPDs. cups-browsed can also be started on-demand, for example to save resources on mobile devices. For this, cups-browsed can be set into an auto shutdown mode so that it stops automatically when it has no remote printers to take care of any more, especially if an on-demand running avahi-daemon stops. Note that CUPS must stay running for cups-browsed removing its queues and so being able to shut down. Ideal is if CUPS stays running another 30 seconds after finishing its last job so that cups-browsed can take down the queue. For how to set up and control this mode via command line, configuration directives, or sending signals see the man pages cups-browsed(8) and cups-browsed.conf(5). The configuration file for cups-browsed is /etc/cups/cups-browsed.conf. This file can include limited forms of the original CUPS BrowseRemoteProtocols, BrowseLocalProtocols, BrowsePoll, and BrowseAllow directives. It also can contain the new CreateIPPPrinterQueues to activate discovering of IPP network printers and creating PPD-less queues for them. Note that cups-browsed does not work with remote CUPS servers specified by a client.conf file. It always connects to the local CUPS daemon by setting the CUPS_SERVER environment variable and so overriding client.conf. If your local CUPS daemon uses a non-standard domain socket as only way of access, you need to specify it via the DomainSocket directive in /etc/cups/cups-browsed.conf. The "make install" process installs init scripts which make the daemon automatically started during boot. You can also manually start it with (as root): /usr/sbin/cups-browsed & or in debug mode with /usr/sbin/cups-browsed --debug Shut it down by sending signal 2 (SIGINT) or 15 (SIGTERM) to it. The queues which it has created get removed then (except a queue set as system default, to not loose its system default state). On systems using systemd use a /usr/lib/systemd/system/cups-browsed.service file like this: [Unit] Description=Make remote CUPS printers available locally After=cups.service avahi-daemon.service Wants=cups.service avahi-daemon.service [Service] ExecStart=/usr/sbin/cups-browsed [Install] WantedBy=multi-user.target On systems using Upstart use an /etc/init/cups-browsed.conf file like this: start on (filesystem and (started cups or runlevel [2345])) stop on runlevel [016] respawn respawn limit 3 240 pre-start script [ -x /usr/sbin/cups-browsed ] end script exec /usr/sbin/cups-browsed These files are included in the source distribution as utils/cups-browsed.service and utils/cups-browsed-upstart.conf. In the examples we start cups-browsed after starting avahi-daemon. This is not required. If cups-browsed starts first, then Bonjour/DNS-SD browsing kicks in as soon as avahi-daemon comes up. cups-browsed is also robust against any shutdown and restart of avahi-daemon. Here is some info on how cups-browsed works internally (first concept of a daemon which does only DNS-SD browsing): - Daemon start o Wait for CUPS daemon if it is not running o Read out all CUPS queues created by this daemon (in former sessions) o Mark them unconfirmed and set timeout 10 sec from now - Main loop (use avahi_simple_poll_iterate() to do queue list maintenance regularly) o Event: New printer shows up + Queue for printer is already created by this daemon -> Mark list entry confirmed, if discovered printer is ipps but existing queue ipp, upgrade existing queue by setting URI to ipps. Set status to to-be-created and timeout to now-1 sec to make the CUPS queue be updated. + Queue does not yet exist -> Mark as to-be-created and set timeout to now-1 sec. o Event: A printer disappears + If we have listed a queue for it, mark the entry as disappeared, set timeout to now-1 sec o On any of the above events and every 2 sec + Check through list of our listed queues - If queue is unconfirmed and timeout has passed, mark it as disappeared, set timeout to now-1 sec - If queue is marked disappered and timeout has passed, check whether there are still jobs in it, if yes, set timeout to 10 sec from now, if no, remove the CUPS queue and the queue entry in our list. If removal fails, set timeout to 10 sec. - If queue is to-be-created, create it, if succeeded set to confirmed, if not, set timeout to 10 sec fron now. printer-is-shared must be set to false. - Daemon shutdown o Remove all CUPS queues in our list, as long as they do not have jobs. Do not overwrite existing queues which are not created by us If the simple name is already taken, try to create a @ name, if this is also taken, ignore the remote printer. Do not retry, to avoid polling CUPS all the time. Do not remove queues which are not created by us. We do this by listing only our queues and remove only listed queues. Queue names: Use the name of the remote queue. If a queue with the same name from another server already exists, mark the new queue as duplicate and when a queue disappears, check whether it has duplicates and change the URI of the disappeared queue to the URI of the first duplicate, mark the queue as to-be-created with timeout now-1 sec (to update the URI of the CUPS queue) and mark the duplicate disappeared with timeout now-1 sec. In terms of high availability we replace the old load balancing of the implicit class by a failover solution. Alternatively (not implemented), if queue with same name but from other server appears, create new queue as @. When queue with simple name is removed, replace the first of the others by one with simple name (mark old queue disappeared with timeout now-1 sec and create new queue with simple name). Fill description of the created CUPS queue with the DNS-SD service name (= original description) and location with the server name without .local. stderr messages only in debug mode (command line options: "--debug" or "-d" or "-v"). Queue identified as from this daemon by doing the equivalent of "lpadmin -p printer -o cups-browsed-default", this generates a "cups-browsed" attribute in printers.conf with value "true". ## Files: backend/implicitclass.c implicitclass backend for implementing an implicit-class-like behavior of redundant print servers managed by cups-browsed. Copyright 2015-2022 by OpenPrinting Copyright 2015-2022 by Till Kamppeter Copyright 2018-2019 by Deepak Patankar This is based on dnssd.c of CUPS dnssd.c copyright notice is follows: Copyright 2008-2015 by Apple Inc. Licensed under Apache License v2.0. See the file "LICENSE" for more information. ## Files: daemon/cups-browsed.c This file is part of cups-browsed. Copyright 2011-2022 OpenPrinting Copyright 2011-2022 Till Kamppeter Copyright 2013-2015 Tim Waugh Copyright 2018-2019 Deepak Patankar Copyright 2020 Mohit Mohan Licensed under Apache License v2.0. See the file "LICENSE" for more information. ## Files: ltmain.sh Copyright (C) 1996-2019, 2021-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ## Files: ltmain.sh GNU Libtool is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. As a special exception to the GNU General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program. GNU Libtool is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . ## Files: ltmain.sh This is free software. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Copyright (C) 2004-2019, 2021 Bootstrap Authors This file is dual licensed under the terms of the MIT license , and GPL version 2 or later . You must apply one of these licenses when using or redistributing this software or any of the files within it. See the URLs above, or the file `LICENSE` included in the Bootstrap distribution for the full license texts. ## Files: ltmain.sh This is free software. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Copyright (C) 2010-2019, 2021 Bootstrap Authors This file is dual licensed under the terms of the MIT license , and GPL version 2 or later . You must apply one of these licenses when using or redistributing this software or any of the files within it. See the URLs above, or the file `LICENSE` included in the Bootstrap distribution for the full license texts. ## Files: ltmain.sh This file is a library for parsing options in your shell scripts along with assorted other useful supporting features that you can make use of too. For the simplest scripts you might need only: #!/bin/sh . relative/path/to/funclib.sh . relative/path/to/options-parser scriptversion=1.0 func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ...rest of your script... In order for the '--version' option to work, you will need to have a suitably formatted comment like the one at the top of this file starting with '# Written by ' and ending with '# Copyright'. For '-h' and '--help' to work, you will also need a one line description of your script's purpose in a comment directly above the '# Written by ' line, like the one at the top of this file. The default options also support '--debug', which will turn on shell execution tracing (see the comment above debug_cmd below for another use), and '--verbose' and the func_verbose function to allow your script to display verbose messages only when your user has specified '--verbose'. After sourcing this file, you can plug in processing for additional options by amending the variables from the 'Configuration' section below, and following the instructions in the 'Option parsing' section further down. ## Files: ltmain.sh func_version ------------ Echo version message to standard output and exit. The version message is extracted from the calling file's header comments, with leading '# ' stripped: 1. First display the progname and version 2. Followed by the header comment line matching /^# Written by / 3. Then a blank line followed by the first following line matching /^# Copyright / 4. Immediately followed by any lines between the previous matches, except lines preceding the intervening completely blank line. For example, see the header comments of this file. ## Files: test/run-tests.sh Perform testing of automatic print queue generation and removal by cups-browsed Copyright © 2020-2023 by OpenPrinting Copyright © 2007-2021 by Apple Inc. Copyright © 1997-2007 by Easy Software Products, all rights reserved. Licensed under Apache License v2.0. See the file "LICENSE" for more information.