summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTill Kamppeter <till.kamppeter@gmail.com>2016-02-13 22:22:24 -0200
committerTill Kamppeter <till.kamppeter@gmail.com>2016-02-13 22:22:24 -0200
commitaa40a1e8fe0c4ed29d21c5f79e682ac7bef1c33f (patch)
tree66996e1a8b1ad790b09c0890ac7986873b7d435a
parent879e6db06338166657609930768f76d8d7e7afbb (diff)
Imported Upstream version 2.0
-rw-r--r--COPYING640
-rw-r--r--ChangeLog469
-rw-r--r--INSTALL8
-rw-r--r--Makefile.am16
-rw-r--r--Makefile.in429
-rw-r--r--NEWS29
-rw-r--r--README31
-rw-r--r--README.levels39
-rw-r--r--TODO2
-rw-r--r--aclocal.m4597
-rw-r--r--bjnp-commands.c548
-rw-r--r--bjnp-commands.h34
-rw-r--r--bjnp-debug.c380
-rw-r--r--bjnp-discover.c848
-rw-r--r--bjnp-io.c704
-rw-r--r--bjnp-io.h108
-rw-r--r--bjnp-levels.c647
-rw-r--r--bjnp-protocol.h223
-rw-r--r--bjnp-runloop.c758
-rw-r--r--bjnp-utils.c497
-rw-r--r--bjnp.c710
-rw-r--r--bjnp.h237
-rwxr-xr-xcompile10
-rw-r--r--conf/norpm3
-rw-r--r--conf/rpmbuild4
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure598
-rw-r--r--configure.ac57
-rw-r--r--cups-bjnp.spec47
-rwxr-xr-xdepcomp455
-rwxr-xr-xinstall-sh14
-rwxr-xr-xmissing414
32 files changed, 4987 insertions, 4572 deletions
diff --git a/COPYING b/COPYING
index bff0367..d60c31a 100644
--- a/COPYING
+++ b/COPYING
@@ -1,154 +1,8 @@
- Common UNIX Printing System License Agreement
-
- Copyright 2007 by Apple Inc.
- 1 Infinite Loop
- Cupertino, CA 95014 USA
-
- WWW: http://www.cups.org/
-
-
-INTRODUCTION
-
-The Common UNIX Printing System(tm), ("CUPS(tm)"), is provided
-under the GNU General Public License ("GPL") and GNU Library
-General Public License ("LGPL"), Version 2, with exceptions for
-Apple operating systems and the OpenSSL toolkit. A copy of the
-exceptions and licenses follow this introduction.
-
-The GNU LGPL applies to the CUPS and CUPS Imaging libraries
-located in the "cups" and "filter" subdirectories of the CUPS
-source distribution and in the "cups" include directory and
-library files in the binary distributions. The GNU GPL applies to
-the remainder of the CUPS distribution, including the "pdftops"
-filter which is based upon Xpdf.
-
-For those not familiar with the GNU GPL, the license basically
-allows you to:
-
- - Use the CUPS software at no charge.
- - Distribute verbatim copies of the software in source or
- binary form.
- - Sell verbatim copies of the software for a media fee, or
- sell support for the software.
-
-What this license *does not* allow you to do is make changes or
-add features to CUPS and then sell a binary distribution without
-source code. You must provide source for any changes or additions
-to the software, and all code must be provided under the GPL or
-LGPL as appropriate. The only exceptions to this are the portions
-of the CUPS software covered by the Apple operating system
-license exceptions outlined later in this license agreement.
-
-The GNU LGPL relaxes the "link-to" restriction, allowing you to
-develop applications that use the CUPS and CUPS Imaging libraries
-under other licenses and/or conditions as appropriate for your
-application, driver, or filter.
-
-
-LICENSE EXCEPTIONS
-
-In addition, as the copyright holder of CUPS, Apple Inc. grants
-the following special exceptions:
-
- 1. Apple Operating System Development License Exception;
-
- a. Software that is developed by any person or entity
- for an Apple Operating System ("Apple OS-Developed
- Software"), including but not limited to Apple and
- third party printer drivers, filters, and backends
- for an Apple Operating System, that is linked to the
- CUPS imaging library or based on any sample filters
- or backends provided with CUPS shall not be
- considered to be a derivative work or collective work
- based on the CUPS program and is exempt from the
- mandatory source code release clauses of the GNU GPL.
- You may therefore distribute linked combinations of
- the CUPS imaging library with Apple OS-Developed
- Software without releasing the source code of the
- Apple OS-Developed Software. You may also use sample
- filters and backends provided with CUPS to develop
- Apple OS-Developed Software without releasing the
- source code of the Apple OS-Developed Software.
-
- b. An Apple Operating System means any operating system
- software developed and/or marketed by Apple Computer,
- Inc., including but not limited to all existing
- releases and versions of Apple's Darwin, Mac OS X,
- and Mac OS X Server products and all follow-on
- releases and future versions thereof.
-
- c. This exception is only available for Apple
- OS-Developed Software and does not apply to software
- that is distributed for use on other operating
- systems.
-
- d. All CUPS software that falls under this license
- exception have the following text at the top of each
- source file:
-
- This file is subject to the Apple OS-Developed
- Software exception.
-
- 2. OpenSSL Toolkit License Exception;
-
- a. Apple Inc. explicitly allows the compilation and
- distribution of the CUPS software with the OpenSSL
- Toolkit.
-
-No developer is required to provide these exceptions in a
-derived work.
-
-
-KERBEROS SUPPORT CODE
-
-The Kerberos support code ("KSC") is copyright 2006 by Jelmer
-Vernooij and is provided 'as-is', without any express or implied
-warranty. In no event will the author or Apple Inc. be held
-liable for any damages arising from the use of the KSC.
-
-Sources files containing KSC have the following text at the top
-of each source file:
-
- This file contains Kerberos support code, copyright 2006 by
- Jelmer Vernooij.
-
-The KSC copyright and license apply only to Kerberos-related
-feature code in CUPS. Such code is typically conditionally
-compiled based on the present of the HAVE_GSSAPI preprocessor
-definition.
-
-Permission is granted to anyone to use the KSC for any purpose,
-including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
- 1. The origin of the KSC must not be misrepresented; you
- must not claim that you wrote the original software. If
- you use the KSC in a product, an acknowledgment in the
- product documentation would be appreciated but is not
- required.
-
- 2. Altered source versions must be plainly marked as such,
- and must not be misrepresented as being the original
- software.
-
- 3. This notice may not be removed or altered from any source
- distribution.
-
-
-TRADEMARKS
-
-Apple Inc. has trademarked the Common UNIX Printing System, CUPS,
-and CUPS logo. You may use these names and logos in any direct port
-or binary distribution of CUPS. Please contact Apple Inc. for written
-permission to use them in derivative products. Our intention is to
-protect the value of these trademarks and ensure that any derivative
-product meets the same high-quality standards as the original.
-
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -425,7 +279,7 @@ POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
- Appendix: How to Apply These Terms to Your New Programs
+ How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@@ -437,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
+ Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -451,14 +305,15 @@ the "copyright" line and a pointer to where the full notice is found.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
- Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
@@ -483,486 +338,3 @@ proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
-
- GNU LIBRARY GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- [This is the first released version of the library GPL. It is
- numbered 2 because it goes with version 2 of the ordinary GPL.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Library General Public License, applies to some
-specially designated Free Software Foundation software, and to any
-other libraries whose authors decide to use it. You can use it for
-your libraries, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if
-you distribute copies of the library, or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link a program with the library, you must provide
-complete object files to the recipients so that they can relink them
-with the library, after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- Our method of protecting your rights has two steps: (1) copyright
-the library, and (2) offer you this license which gives you legal
-permission to copy, distribute and/or modify the library.
-
- Also, for each distributor's protection, we want to make certain
-that everyone understands that there is no warranty for this free
-library. If the library is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original
-version, so that any problems introduced by others will not reflect on
-the original authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that companies distributing free
-software will individually obtain patent licenses, thus in effect
-transforming the program into proprietary software. To prevent this,
-we have made it clear that any patent must be licensed for everyone's
-free use or not licensed at all.
-
- Most GNU software, including some libraries, is covered by the ordinary
-GNU General Public License, which was designed for utility programs. This
-license, the GNU Library General Public License, applies to certain
-designated libraries. This license is quite different from the ordinary
-one; be sure to read it in full, and don't assume that anything in it is
-the same as in the ordinary license.
-
- The reason we have a separate public license for some libraries is that
-they blur the distinction we usually make between modifying or adding to a
-program and simply using it. Linking a program with a library, without
-changing the library, is in some sense simply using the library, and is
-analogous to running a utility program or application program. However, in
-a textual and legal sense, the linked executable is a combined work, a
-derivative of the original library, and the ordinary General Public License
-treats it as such.
-
- Because of this blurred distinction, using the ordinary General
-Public License for libraries did not effectively promote software
-sharing, because most developers did not use the libraries. We
-concluded that weaker conditions might promote sharing better.
-
- However, unrestricted linking of non-free programs would deprive the
-users of those programs of all benefit from the free status of the
-libraries themselves. This Library General Public License is intended to
-permit developers of non-free programs to use free libraries, while
-preserving your freedom as a user of such programs to change the free
-libraries that are incorporated in them. (We have not seen how to achieve
-this as regards changes in header files, but we have achieved it as regards
-changes in the actual functions of the Library.) The hope is that this
-will lead to faster development of free libraries.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, while the latter only
-works together with the library.
-
- Note that it is possible for a library to be covered by the ordinary
-General Public License rather than by this special one.
-
- GNU LIBRARY GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library which
-contains a notice placed by the copyright holder or other authorized
-party saying it may be distributed under the terms of this Library
-General Public License (also called "this License"). Each licensee is
-addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also compile or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- c) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- d) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the source code distributed need not include anything that is normally
-distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Library General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- Appendix: How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
diff --git a/ChangeLog b/ChangeLog
index 1dbfcb9..8b9f299 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,491 +1,452 @@
------------------------------------------------------------------------
-r149 | louis | 2012-09-22 22:48:25 +0200 (Sat, 22 Sep 2012) | 5 lines
+r90 | llagendijk | 2014-03-28 21:49:00 +0100 (Fri, 28 Mar 2014) | 4 lines
-More refactoring:
-- split bjnp.h in a common include and one for the protocol definitions
-- combined definitions for the protocol commands and responses in common types
-- cleanup of configure.ac
+Fix parsing of the stats response for newer printers:
+There is no length field in the response
+Changed version to 0.9.1
------------------------------------------------------------------------
-r148 | louis | 2012-09-22 13:07:28 +0200 (Sat, 22 Sep 2012) | 2 lines
+r89 | llagendijk | 2014-03-27 23:36:05 +0100 (Thu, 27 Mar 2014) | 2 lines
-Demoted a number of logging statements to DEBUG level to make thebackend less noisy
+Updated Changelog
------------------------------------------------------------------------
-r147 | louis | 2012-09-22 00:32:05 +0200 (Sat, 22 Sep 2012) | 14 lines
+r88 | llagendijk | 2014-03-27 23:32:11 +0100 (Thu, 27 Mar 2014) | 4 lines
-Fixed compilation on MacOSX
+Added a check that paper out is seen a number of times before reporting it
+Removed paperout handling from bjnp-runloop and rely only on a timer based
+call to the reporting routines
------------------------------------------------------------------------
-r146 | louis | 2012-09-21 21:45:31 +0200 (Fri, 21 Sep 2012) | 2 lines
+r87 | llagendijk | 2014-03-20 22:45:59 +0100 (Thu, 20 Mar 2014) | 2 lines
-Updated side channel handling. This fixes a long standing "failed to read side-channel" error message
+Fix level reporting that does not always work when sprintf is used with dest string also used as source
------------------------------------------------------------------------
-r145 | louis | 2012-09-19 00:35:23 +0200 (Wed, 19 Sep 2012) | 4 lines
+r86 | llagendijk | 2014-03-15 22:09:20 +0100 (Sat, 15 Mar 2014) | 6 lines
-Fixed annoying "failed to read side channel" bug:
-Receiving a 0 length response (BAD COMMAND) is ok!
-Could be EOF
+Changed license to GPLv2
+hack to make distcheck work
+Removed rpmbuild
+Updated rpm spec (untested)
+Added COPYING
------------------------------------------------------------------------
-r144 | louis | 2012-09-12 22:47:17 +0200 (Wed, 12 Sep 2012) | 1 line
+r85 | llagendijk | 2014-03-15 19:47:45 +0100 (Sat, 15 Mar 2014) | 2 lines
-Added support for CUPS_SC_CMD_GET_CONNECTED
-------------------------------------------------------------------------
-r143 | louis | 2012-09-12 22:41:35 +0200 (Wed, 12 Sep 2012) | 1 line
+Added README.levels
-more changes to support IPv6/ corrected sidechannel handling
------------------------------------------------------------------------
-r142 | louis | 2012-09-01 00:20:00 +0200 (Sat, 01 Sep 2012) | 2 lines
+r84 | llagendijk | 2014-03-15 17:55:06 +0100 (Sat, 15 Mar 2014) | 2 lines
-updated TODO
+Fix typo introduced when reformatting
------------------------------------------------------------------------
-r141 | louis | 2012-08-31 23:01:44 +0200 (Fri, 31 Aug 2012) | 2 lines
+r83 | llagendijk | 2014-03-15 17:53:58 +0100 (Sat, 15 Mar 2014) | 2 lines
-Added IPv6 printer discovery
+Reformatted all source code using astyle
------------------------------------------------------------------------
-r140 | louis | 2012-08-30 15:25:38 +0200 (Thu, 30 Aug 2012) | 2 lines
+r82 | llagendijk | 2014-03-15 14:11:28 +0100 (Sat, 15 Mar 2014) | 2 lines
-Refactoring started. Compiles but untested
+Added output for marker-high-levels for ink level reporting
------------------------------------------------------------------------
-r139 | louis | 2012-08-24 12:11:05 +0200 (Fri, 24 Aug 2012) | 2 lines
+r81 | llagendijk | 2014-03-10 22:41:44 +0100 (Mon, 10 Mar 2014) | 2 lines
-Added IPv6 printing support. Detection still needs to be done
+Correcting paper empty value for DJS: PR is transient, but ID really seems to indicate out of paper
------------------------------------------------------------------------
-r136 | louis | 2011-06-26 00:10:29 +0200 (Sun, 26 Jun 2011) | 3 lines
-
-1.0 release
+r80 | llagendijk | 2014-03-09 00:16:14 +0100 (Sun, 09 Mar 2014) | 3 lines
+Code cleanup
+Paper out detection rewritten using DJS as PID does not work as expected
------------------------------------------------------------------------
-r135 | louis | 2011-06-25 23:52:34 +0200 (Sat, 25 Jun 2011) | 2 lines
+r79 | llagendijk | 2014-03-08 19:21:06 +0100 (Sat, 08 Mar 2014) | 2 lines
-Updated TODO, most items were already done
+Minor improvement to text of vendor specific ink warnings/errors: add ink in text
------------------------------------------------------------------------
-r134 | louis | 2011-06-25 23:49:31 +0200 (Sat, 25 Jun 2011) | 2 lines
+r78 | llagendijk | 2014-03-08 19:11:39 +0100 (Sat, 08 Mar 2014) | 3 lines
-Added 0.5.5-3 spec file
+Fix 2 cases in cups.c dereferencing printer where it migh be NULL
+Safety fix in bjnp_get_printer_status so it does not crash when printer is NULL
------------------------------------------------------------------------
-r133 | louis | 2011-06-25 23:47:22 +0200 (Sat, 25 Jun 2011) | 2 lines
+r77 | llagendijk | 2014-03-08 18:51:32 +0100 (Sat, 08 Mar 2014) | 3 lines
-Made compilation work on older cups versions again
+Bumped version to 1.9.0
+Changed configure to use cups-config for auto-detection of cupsbackenddir
------------------------------------------------------------------------
-r132 | louis | 2011-06-25 23:02:44 +0200 (Sat, 25 Jun 2011) | 5 lines
+r76 | llagendijk | 2014-03-08 15:34:21 +0100 (Sat, 08 Mar 2014) | 2 lines
-Removed some unused code
-Added proper check for buggy reverse namelookup (do a forward lookup
-on the returned name and use it only if it really resolves to the
-IP-address
+Make compile work also on older GCC version 4.4.7 on RHEL6
------------------------------------------------------------------------
-r131 | louis | 2010-11-27 18:45:50 +0100 (Sat, 27 Nov 2010) | 2 lines
+r75 | llagendijk | 2014-03-05 01:00:58 +0100 (Wed, 05 Mar 2014) | 5 lines
-Fixes for IPv6, release 0.5.5
+Added ink-level reporting
+Added a working out-of-paper detection
+Improved error handling
+Still needs a lot of testing
------------------------------------------------------------------------
-r130 | louis | 2009-05-29 21:58:57 +0200 (Fri, 29 May 2009) | 2 lines
+r74 | llagendijk | 2014-01-22 17:23:23 +0100 (Wed, 22 Jan 2014) | 2 lines
-Updated Changelog and NEWS for the 05.4 release
+Create 1.2.2 release
------------------------------------------------------------------------
-r129 | louis | 2009-05-29 20:59:41 +0200 (Fri, 29 May 2009) | 10 lines
-
-* Fri May 29 2009 Louis Lagendijk <llagendijk@users.sourceforge.net> - 0.5.4-1
-- More specfile cleanups suggested by Igor Jurišković <juriskovic.igor@gmail.com>
- and mtasaka@ioa.s.u-tokyo.ac.jp:
-- removed INSTALL
-- use macros where appropriate),
-- updated %files so we only own bjnp, not the directory
-- Removed generation of spec file from configure as it caused a lot of pain
-- bumped version to 0.5.4
+r73 | llagendijk | 2014-01-22 14:04:40 +0100 (Wed, 22 Jan 2014) | 3 lines
+- Fix crash on newer printers that sen an xml-document for printer status
+- Some code reorg
------------------------------------------------------------------------
-r128 | louis | 2009-05-16 21:53:01 +0200 (Sat, 16 May 2009) | 2 lines
+r72 | llagendijk | 2013-11-06 17:11:04 +0100 (Wed, 06 Nov 2013) | 2 lines
-Changelog for 0.5.3
+Fix mistake in error hadling of read
------------------------------------------------------------------------
-r127 | louis | 2009-05-16 21:47:30 +0200 (Sat, 16 May 2009) | 2 lines
+r71 | llagendijk | 2013-11-06 17:10:39 +0100 (Wed, 06 Nov 2013) | 2 lines
-Fixed renaming of cups-bjnp.spec.dist.in to cups-bjnp.spec.in
+Corrected comment on resource not being used
------------------------------------------------------------------------
-r126 | louis | 2009-05-16 21:45:35 +0200 (Sat, 16 May 2009) | 6 lines
+r70 | llagendijk | 2013-10-23 17:14:32 +0200 (Wed, 23 Oct 2013) | 2 lines
-Fixed bug in bjnp_send_broadcast: address family was not set in call to bind
-Fixed silly errors in configure script
-added more options for backend directory as used on FreeBSD
-fixed rpmlint errors
-released as 0.5.3
+Fix possible buffer overflow in response buffer
------------------------------------------------------------------------
-r125 | louis | 2009-05-11 23:51:38 +0200 (Mon, 11 May 2009) | 3 lines
+r69 | llagendijk | 2013-10-23 17:06:44 +0200 (Wed, 23 Oct 2013) | 2 lines
-- Set address family before bind in send_broadcast
-- Generate spec,dist file and use that as specfile
+DEbug loggin improvement: use stdou when we can not write to the logfile
------------------------------------------------------------------------
-r124 | louis | 2009-05-02 21:04:51 +0200 (Sat, 02 May 2009) | 4 lines
+r68 | llagendijk | 2013-02-23 22:15:08 +0100 (Sat, 23 Feb 2013) | 2 lines
-fixed order of inclusion (bjnp.h must come first as it includes config.h)
-which is needed for some conditional compilation
-Fixed 2 typos in configure.in
+README cleanup
------------------------------------------------------------------------
-r123 | louis | 2009-05-02 20:52:36 +0200 (Sat, 02 May 2009) | 2 lines
+r67 | llagendijk | 2013-02-23 21:15:28 +0100 (Sat, 23 Feb 2013) | 2 lines
-corrected size of sequence number field
+Release 1.2.1
------------------------------------------------------------------------
-r122 | louis | 2009-03-14 22:45:44 +0100 (Sat, 14 Mar 2009) | 2 lines
+r66 | llagendijk | 2013-01-22 22:25:22 +0100 (Tue, 22 Jan 2013) | 3 lines
-Final updates for 0.5 version
+Re-add reading tcp_print_response body and payload size into 2 reads.
+An MX700 does not send both in one write
------------------------------------------------------------------------
-r121 | louis | 2009-03-12 21:25:28 +0100 (Thu, 12 Mar 2009) | 2 lines
+r65 | llagendijk | 2013-01-21 23:36:17 +0100 (Mon, 21 Jan 2013) | 2 lines
-Release of 0.5 version
+Remove configure and config.h.in, should not be in svn
------------------------------------------------------------------------
-r120 | louis | 2009-02-28 21:13:57 +0100 (Sat, 28 Feb 2009) | 5 lines
+r64 | llagendijk | 2013-01-21 19:44:41 +0100 (Mon, 21 Jan 2013) | 2 lines
-Latest updates to configure.ac:
-- add AM_MAINTAINER_MODE
-- add conf subdirectory
-- updated README
+corrected length of job command
------------------------------------------------------------------------
-r119 | louis | 2009-02-19 21:12:49 +0100 (Thu, 19 Feb 2009) | 2 lines
+r62 | llagendijk | 2012-11-27 22:22:01 +0100 (Tue, 27 Nov 2012) | 2 lines
-removed Makefile and run
+Updated configure.ac for 1.2 release
------------------------------------------------------------------------
-r118 | louis | 2009-02-19 21:11:45 +0100 (Thu, 19 Feb 2009) | 2 lines
+r61 | llagendijk | 2012-10-20 11:49:58 +0200 (Sat, 20 Oct 2012) | 3 lines
-TODO/ INSTALL/ NEWS updated to match latest versions
+Corrected definition of bjnp_command_t and bjnp_response_t: older compilers complained about redefinition in bjnp_protocol.h.
+In bjnp_protocol.h we only define bjnp_command_u and bjnp_response_u
------------------------------------------------------------------------
-r117 | louis | 2009-02-19 21:10:38 +0100 (Thu, 19 Feb 2009) | 2 lines
+r60 | llagendijk | 2012-10-01 15:19:38 +0200 (Mon, 01 Oct 2012) | 2 lines
-Automake updated for rpmbuild improvements and cleanup
+Minor edits
------------------------------------------------------------------------
-r116 | louis | 2009-02-19 21:09:35 +0100 (Thu, 19 Feb 2009) | 2 lines
+r58 | llagendijk | 2012-09-29 15:56:24 +0200 (Sat, 29 Sep 2012) | 3 lines
-updates to configure.ac for auto detection of cups backend dir and rpmbuild improvements
+Fixed a crash that occured when an IPv6 reponse came from a gloabal address. We tried to
+add the link-local address. This does not make sense as we do not know the scope_id.
------------------------------------------------------------------------
-r115 | louis | 2009-02-19 21:08:06 +0100 (Thu, 19 Feb 2009) | 2 lines
+r57 | llagendijk | 2012-09-26 00:08:06 +0200 (Wed, 26 Sep 2012) | 3 lines
-config.h.in after autoconf updates
+Fix for missing initializations (crash on F15 on printer discovery)
+Updated NEWS
------------------------------------------------------------------------
-r114 | louis | 2009-02-19 21:07:10 +0100 (Thu, 19 Feb 2009) | 2 lines
+r56 | llagendijk | 2012-09-22 22:56:55 +0200 (Sat, 22 Sep 2012) | 2 lines
-Spec file adapted to improved target directory determination for cups backend dir
+Added bjnp-protocol.h to Makefile.am
------------------------------------------------------------------------
-r113 | louis | 2009-02-19 21:05:57 +0100 (Thu, 19 Feb 2009) | 2 lines
-
-adapted README to autoconf/automake
+r55 | llagendijk | 2012-09-22 22:51:46 +0200 (Sat, 22 Sep 2012) | 6 lines
-------------------------------------------------------------------------
-r112 | louis | 2009-02-19 21:05:15 +0100 (Thu, 19 Feb 2009) | 4 lines
-
-changed includes to be more portable (autoconf)
-Minor patches to solve some of the TODO's (if TCP writes result in unexpected
-lenths we treat that as an unrecoverable error
-
-------------------------------------------------------------------------
-r111 | louis | 2009-02-19 21:02:10 +0100 (Thu, 19 Feb 2009) | 2 lines
-
-remove include for Cups config.h
-
-------------------------------------------------------------------------
-r110 | louis | 2009-01-31 11:59:30 +0100 (Sat, 31 Jan 2009) | 3 lines
+More refactoring:
+- split bjnp.h in a common include and one for the protocol definitions
+- combined definitions for the protocol commands and responses in common types
+- cleanup of configure.ac
-Added checks on addr and broadcast addr in result from getifaddr() as they
-may be null
------------------------------------------------------------------------
-r109 | louis | 2009-01-24 23:46:05 +0100 (Sat, 24 Jan 2009) | 2 lines
+r54 | llagendijk | 2012-09-22 00:37:43 +0200 (Sat, 22 Sep 2012) | 3 lines
-First working version eith automake/autoconf support
+Cleaned up includes
+Fixed compilation on MacOSX
------------------------------------------------------------------------
-r108 | louis | 2009-01-23 22:46:41 +0100 (Fri, 23 Jan 2009) | 2 lines
+r53 | llagendijk | 2012-09-21 22:10:33 +0200 (Fri, 21 Sep 2012) | 3 lines
-added configure.ac config.h.in AUTHORS
+Fixed side channel handling: this fixes the long standing
+"Failed to read side channel" bug
------------------------------------------------------------------------
-r107 | louis | 2009-01-23 22:41:19 +0100 (Fri, 23 Jan 2009) | 2 lines
+r52 | llagendijk | 2012-09-01 00:42:37 +0200 (Sat, 01 Sep 2012) | 3 lines
-split Readme into two files: README and NEWS, to make automake happy
+Added IPv6 support
+Refactoring of bjnp-io into 3 files
------------------------------------------------------------------------
-r106 | louis | 2009-01-23 22:23:10 +0100 (Fri, 23 Jan 2009) | 2 lines
+r50 | llagendijk | 2011-07-05 22:44:10 +0200 (Tue, 05 Jul 2011) | 2 lines
-preparations for autoconf/automake
+Last updates to specfile, re-added configure
------------------------------------------------------------------------
-r105 | louis | 2009-01-21 23:32:13 +0100 (Wed, 21 Jan 2009) | 2 lines
+r49 | llagendijk | 2011-06-26 00:20:51 +0200 (Sun, 26 Jun 2011) | 7 lines
-corrected a type in a debug string
-
-------------------------------------------------------------------------
-r104 | louis | 2009-01-20 23:27:50 +0100 (Tue, 20 Jan 2009) | 2 lines
+Release 1.0
+Added forward lookup after reverse lookup to avoid problems with
+buggy routers
+IPv6 fixes
+Removed some unused code
-Changed OPTIONS to ADD -DVERSION rather than just define it
------------------------------------------------------------------------
-r103 | louis | 2009-01-16 23:37:38 +0100 (Fri, 16 Jan 2009) | 2 lines
+r48 | llagendijk | 2010-11-27 21:51:37 +0100 (Sat, 27 Nov 2010) | 2 lines
-added toCups flag to the debuglevel so we can optionally log all debug output to the cups errorlog
+Fix bjnp-runloop as cups 1.3 does not have CUPS_SC_CMD_NONE
------------------------------------------------------------------------
-r102 | louis | 2009-01-13 21:54:14 +0100 (Tue, 13 Jan 2009) | 2 lines
+r43 | llagendijk | 2010-11-26 20:41:26 +0100 (Fri, 26 Nov 2010) | 2 lines
-consistentlyuse htonl() around INADD_xxxx
+Released 0.5.5 without further changes
------------------------------------------------------------------------
-r101 | louis | 2009-01-13 21:43:15 +0100 (Tue, 13 Jan 2009) | 3 lines
+r42 | llagendijk | 2010-10-08 23:21:11 +0200 (Fri, 08 Oct 2010) | 2 lines
-changed source address/port for broadcasts to local address +
-bjnp printing port to make firewalling easier
+Remove autogenerated Makefile.in
------------------------------------------------------------------------
-r100 | louis | 2009-01-08 20:49:45 +0100 (Thu, 08 Jan 2009) | 4 lines
+r41 | llagendijk | 2010-10-08 23:20:24 +0200 (Fri, 08 Oct 2010) | 4 lines
-Added configuration option for the case where do not have getifaddrs().
-If so, we use a global broadcast. This will fail when we have more than one ipv4
-capable interface.
+Added fixes for issues reported by Ron Murray in Sourceforge patches tracker ID: 3083455.
+The MP990 appears to have some (?) IPv6 support, make sure we ignore IPv6 addresses for now.
+Also corrected some minor bugs
------------------------------------------------------------------------
-r97 | louis | 2008-11-18 21:59:17 +0100 (Tue, 18 Nov 2008) | 4 lines
+r40 | llagendijk | 2009-05-29 22:17:42 +0200 (Fri, 29 May 2009) | 3 lines
-Added 15 sec delay after printjob to make some printers happy that otherwise do
-no accept a new printjob (ZEDO)
-Updated TODO and Changelog
+0.5.4: removed autogeneration of spec file. It causes too much pain
+No functional changes. No need to update
------------------------------------------------------------------------
-r95 | louis | 2008-11-17 23:34:10 +0100 (Mon, 17 Nov 2008) | 2 lines
+r39 | llagendijk | 2009-05-16 21:20:14 +0200 (Sat, 16 May 2009) | 13 lines
-moved specfile to rootdir
+- reverted changes to spec file generation
+ Fixed some rpmlint comments that show up only on complete package but
+ not when rpmlint is run on spec file
-------------------------------------------------------------------------
-r94 | louis | 2008-11-17 23:05:58 +0100 (Mon, 17 Nov 2008) | 4 lines
-Added option to Makefile to generate specfile with version set from Makefile
-Single specfile for all Redhat based systems
-Updated TODO file
+M configure
+M Makefile.in
+M conf/rpmbuild
+A + cups-bjnp.spec.in
+D cups-bjnp.spec.dist.in
+M configure.ac
+M Makefile.am
------------------------------------------------------------------------
-r93 | louis | 2008-11-15 22:31:37 +0100 (Sat, 15 Nov 2008) | 2 lines
+r38 | llagendijk | 2009-05-16 18:13:31 +0200 (Sat, 16 May 2009) | 6 lines
-corrected typo
+2009-05-16:
+Fixed size of sequence number
+Fixed bug in printer detection that failed on FreeBSD (forgot to set
+address family for bind call in bjnp_send_broadcast)
+Fixed silly mistakes in configure script
------------------------------------------------------------------------
-r92 | louis | 2008-11-13 23:44:48 +0100 (Thu, 13 Nov 2008) | 2 lines
-
-corrected name of specfile
+r37 | llagendijk | 2009-05-16 18:05:22 +0200 (Sat, 16 May 2009) | 3 lines
-------------------------------------------------------------------------
-r91 | louis | 2008-11-13 23:44:28 +0100 (Thu, 13 Nov 2008) | 2 lines
+update changelog in spec file for 0.5 release
-renamed fc9 specfile to spec/cups-bjnp-.spec
------------------------------------------------------------------------
-r90 | louis | 2008-11-13 23:41:46 +0100 (Thu, 13 Nov 2008) | 4 lines
+r36 | llagendijk | 2009-03-12 21:31:38 +0100 (Thu, 12 Mar 2009) | 2 lines
-Removed c5 rpm specfile
-Added imake as build dependency
-Added a touch Dependencies to make mock happy
+Release 0.5 version with only minor documentation changes
------------------------------------------------------------------------
-r89 | louis | 2008-10-23 23:52:39 +0200 (Thu, 23 Oct 2008) | 2 lines
+r35 | llagendijk | 2009-02-28 12:45:27 +0100 (Sat, 28 Feb 2009) | 2 lines
-More rewrites of bjnp_backchannel to make it easier to understand
+Added AC_MAINTAINER_MODE to configure.ac to avoid automatic rebuilding of autoconf stuff
------------------------------------------------------------------------
-r88 | louis | 2008-10-23 22:21:52 +0200 (Thu, 23 Oct 2008) | 3 lines
+r34 | llagendijk | 2009-02-28 12:18:49 +0100 (Sat, 28 Feb 2009) | 2 lines
-Added keep-alive on interface to printer. This is an extended implementation of the patch
-provided by Florian from zedonet (Turboprint)
+added aclocal.m4
------------------------------------------------------------------------
-r87 | louis | 2008-10-18 13:32:01 +0200 (Sat, 18 Oct 2008) | 3 lines
+r33 | llagendijk | 2009-02-28 12:10:54 +0100 (Sat, 28 Feb 2009) | 2 lines
-Fixed a compile warning in bjnp.c: using a #ifdef in a statement is not portable
-Removed-m64 from compiler arguments, so we also support clean 32 bit compiles
+added config.h.in
------------------------------------------------------------------------
-r86 | louis | 2008-10-09 23:03:34 +0200 (Thu, 09 Oct 2008) | 2 lines
+r32 | llagendijk | 2009-02-28 11:58:47 +0100 (Sat, 28 Feb 2009) | 2 lines
-Re-added specfiles
+Added Makefile.in
------------------------------------------------------------------------
-r83 | louis | 2008-10-09 22:37:12 +0200 (Thu, 09 Oct 2008) | 3 lines
+r31 | llagendijk | 2009-02-19 22:56:44 +0100 (Thu, 19 Feb 2009) | 2 lines
-fixed some erors in the spec files.
-Fixed description of DIST_DIR in INSTALL files and added description in Makefile
+Added NEWS
------------------------------------------------------------------------
-r81 | louis | 2008-10-07 23:55:59 +0200 (Tue, 07 Oct 2008) | 2 lines
+r30 | llagendijk | 2009-02-19 22:54:32 +0100 (Thu, 19 Feb 2009) | 2 lines
-updated spec files for 0.3 release
+updated cups-bjnp.spec.in with latest changes
------------------------------------------------------------------------
-r80 | louis | 2008-10-07 23:13:20 +0200 (Tue, 07 Oct 2008) | 4 lines
+r29 | llagendijk | 2009-02-19 22:49:57 +0100 (Thu, 19 Feb 2009) | 3 lines
-added some sanity checks on call to gethostbyaddr so we do not bomb out
-when hostname field is not set (can this occur?) or when a buggy Avm fritz box
-returns noname rather then fail when no name is available on a reverse name lookup
+added autoconf output files to make building easier
-------------------------------------------------------------------------
-r79 | louis | 2008-10-04 21:27:03 +0200 (Sat, 04 Oct 2008) | 2 lines
-
-Added note on usage of DIS_DIR in Makefile to INSTALL and updated TODO
------------------------------------------------------------------------
-r78 | louis | 2008-10-04 20:52:17 +0200 (Sat, 04 Oct 2008) | 2 lines
+r28 | llagendijk | 2009-02-19 22:45:28 +0100 (Thu, 19 Feb 2009) | 2 lines
-Corrected some harmless compilation warnings
+Added configure
------------------------------------------------------------------------
-r77 | louis | 2008-10-04 19:51:48 +0200 (Sat, 04 Oct 2008) | 2 lines
+r27 | llagendijk | 2009-02-19 22:42:59 +0100 (Thu, 19 Feb 2009) | 2 lines
-pass version string to bjnp.c
+added conf directory with Makefile fragments required for rpmbuild
------------------------------------------------------------------------
-r76 | louis | 2008-10-04 19:50:45 +0200 (Sat, 04 Oct 2008) | 2 lines
+r26 | llagendijk | 2009-02-19 22:39:16 +0100 (Thu, 19 Feb 2009) | 2 lines
-Added a version string printout when incorrect number of arguments is recieved on command line
+added README
------------------------------------------------------------------------
-r75 | louis | 2008-10-04 19:49:48 +0200 (Sat, 04 Oct 2008) | 2 lines
+r25 | llagendijk | 2009-02-19 22:37:25 +0100 (Thu, 19 Feb 2009) | 2 lines
-changed printbuffer to 4k. Recommended by Zedo, the Turboprint people
+Changed to more gnu compliant INSTALL and ChangeLog
------------------------------------------------------------------------
-r74 | louis | 2008-10-04 19:48:53 +0200 (Sat, 04 Oct 2008) | 2 lines
+r24 | llagendijk | 2009-02-19 22:35:55 +0100 (Thu, 19 Feb 2009) | 2 lines
-changed throttle pause from 3 sec to 40 msec. Improves performance. Recommended by Zedo.
+iChanges due to CUPs dependency removal
------------------------------------------------------------------------
-r73 | louis | 2008-10-04 14:02:13 +0200 (Sat, 04 Oct 2008) | 4 lines
+r23 | llagendijk | 2009-02-19 22:33:27 +0100 (Thu, 19 Feb 2009) | 6 lines
-- corrected warnings found with new compilerflags
-- fixed a bug in scanning our interfaces when ifa_addr could be 0 (reported by Matt McHenry <jerith@speakeasy.org>)
-- added a number of items found during development of the bjnp interface for the sane pixma backend)to the TODO list
+Added support for OS's where getifaddr() is missing
+Added checks for case where getifaddr reports ptp link
+Changes for autoconf support (include config.h)
+Removed cups dependencies
-------------------------------------------------------------------------
-r72 | louis | 2008-10-04 13:57:17 +0200 (Sat, 04 Oct 2008) | 2 lines
-
-added new/ improved compiler flags that trap more mistakes
------------------------------------------------------------------------
-r71 | louis | 2008-10-04 13:56:07 +0200 (Sat, 04 Oct 2008) | 2 lines
+r22 | llagendijk | 2009-02-19 22:30:18 +0100 (Thu, 19 Feb 2009) | 2 lines
-sone cleanup with feedback from Sane-BJNP (revised protocol codes etc)
+Addedmissing \n to debug statement
------------------------------------------------------------------------
-r68 | louis | 2008-08-09 14:50:01 +0200 (Sat, 09 Aug 2008) | 2 lines
+r21 | llagendijk | 2009-02-19 22:29:12 +0100 (Thu, 19 Feb 2009) | 2 lines
-minor bugfixes for off-line behaviour
+debugging improvements (log to file)
------------------------------------------------------------------------
-r63 | louis | 2008-08-09 13:54:03 +0200 (Sat, 09 Aug 2008) | 3 lines
+r20 | llagendijk | 2009-02-19 22:27:49 +0100 (Thu, 19 Feb 2009) | 2 lines
-Corrected sequence in changelog of SPEC files
-Changed make-dist to first remove release ag if it already exists
+Debug setting improvement
------------------------------------------------------------------------
-r61 | louis | 2008-08-09 13:47:19 +0200 (Sat, 09 Aug 2008) | 2 lines
+r19 | llagendijk | 2009-02-19 22:21:39 +0100 (Thu, 19 Feb 2009) | 2 lines
-Changelog for 0.2
+Added autoconf support
------------------------------------------------------------------------
-r59 | louis | 2008-08-09 13:47:00 +0200 (Sat, 09 Aug 2008) | 2 lines
+r16 | llagendijk | 2008-11-18 23:49:30 +0100 (Tue, 18 Nov 2008) | 2 lines
-Final cleanups for trelease 0.2
+Use only cups-bjnp.spec.in in svn
------------------------------------------------------------------------
-r56 | louis | 2008-08-09 13:08:05 +0200 (Sat, 09 Aug 2008) | 2 lines
+r15 | llagendijk | 2008-11-18 23:47:46 +0100 (Tue, 18 Nov 2008) | 2 lines
-Forgot to mention on last ci that I added proper out of paper detection
+removed make-dist as it is site-specific
------------------------------------------------------------------------
-r55 | louis | 2008-08-09 13:04:32 +0200 (Sat, 09 Aug 2008) | 8 lines
-
-- added improved debugging/logging:
-Normally we log to the cups error log
-For debugging of printer discover we can set env. var BJNP_DEBUG
-For debugging of printing we can set the debuglevel as part of the device URI:
-bjnp://printer-1.pheasant:8611/?debuglevel=DEBUG
+r13 | llagendijk | 2008-11-18 23:38:05 +0100 (Tue, 18 Nov 2008) | 7 lines
-Debugging levels are named as in the CUPS documentation
+Release 0.4
+Added keep-alive for TCP connections to avoid that printer closes connection when no
+data is recieved for 30 sec (may occur due to a slow filer)
+Added a 15 sec delay at the end of a printjob as some printers may not allow new
+connections otherwise
+Rewrote makefile target for rpm
------------------------------------------------------------------------
-r54 | louis | 2008-08-08 22:46:10 +0200 (Fri, 08 Aug 2008) | 4 lines
+r11 | llagendijk | 2008-10-09 23:12:10 +0200 (Thu, 09 Oct 2008) | 2 lines
-Added better debug/logging support:
-bjnp now allows setting of env. var BJNP_DEBUG for debugging of printer discovery and
-setting debug level as part of the device URI: bjnp://printer-1.pheasant:8611/?debuglevel=DEBUG2
+Updated spec files for 0.3 release
------------------------------------------------------------------------
-r53 | louis | 2008-08-08 16:04:23 +0200 (Fri, 08 Aug 2008) | 4 lines
+r10 | llagendijk | 2008-10-09 22:44:18 +0200 (Thu, 09 Oct 2008) | 2 lines
-Started out of paper detection (untested)
-Changed make-dist to genereate Changelog
-Updated Changelog
+Minor updates related to DIST_DIR im Makefile
------------------------------------------------------------------------
-r49 | louis | 2008-08-07 23:20:59 +0200 (Thu, 07 Aug 2008) | 2 lines
+r9 | llagendijk | 2008-10-07 23:26:58 +0200 (Tue, 07 Oct 2008) | 4 lines
-Updated Release notes and changelog for version 0.1
+improved sanity check on results of gethostbyaddr. Makae sure hostname is not NULL
+and check for noname as some buggy routers seem to report that when no name is
+available on a reverse lookup
------------------------------------------------------------------------
-r47 | louis | 2008-08-07 22:30:41 +0200 (Thu, 07 Aug 2008) | 2 lines
+r8 | llagendijk | 2008-10-04 21:25:25 +0200 (Sat, 04 Oct 2008) | 2 lines
-uncommented cp to release branch in make-dist
+Updated TODO file,
------------------------------------------------------------------------
-r46 | louis | 2008-08-07 22:28:59 +0200 (Thu, 07 Aug 2008) | 2 lines
+r7 | llagendijk | 2008-10-04 21:00:05 +0200 (Sat, 04 Oct 2008) | 11 lines
-parameterized make-dist
-
-------------------------------------------------------------------------
-r43 | louis | 2008-08-07 22:18:09 +0200 (Thu, 07 Aug 2008) | 2 lines
+- sone cleanup with feedback from Sane-BJNP (revised protocol codes etc)
+- added new/ improved compiler flags that trap more mistakes
+- corrected warnings found with new compilerflags
+- fixed a bug in scanning our interfaces when ifa_addr could be 0 (reported by Matt McHenry <jerith@speakeasy.org>)
+- added a number of items found during development of the bjnp interface for the sane pixma backend)to the TODO list
+- changed throttle pause from 3 sec to 40 msec. Improves performance. Recommended by Zedo.
+- changed printbuffer to 4k. Recommended by Zedo, the Turboprint people
+- Added a version string printout when incorrect number of arguments is recieved on command line
+- added retry on udp failures
-clean up of make-dist
------------------------------------------------------------------------
-r40 | louis | 2008-08-07 21:57:16 +0200 (Thu, 07 Aug 2008) | 2 lines
-
-Release 0.1
+r5 | llagendijk | 2008-08-09 16:49:29 +0200 (Sat, 09 Aug 2008) | 1 line
+cups-bjnp-0.2
------------------------------------------------------------------------
-r37 | louis | 2008-08-07 21:50:06 +0200 (Thu, 07 Aug 2008) | 2 lines
+r2 | llagendijk | 2008-08-09 16:36:51 +0200 (Sat, 09 Aug 2008) | 2 lines
-corrected typo in make-dist
+import of CUPS-BJNP-0.1
------------------------------------------------------------------------
-r36 | louis | 2008-08-07 21:49:18 +0200 (Thu, 07 Aug 2008) | 2 lines
+r1 | llagendijk | 2008-08-09 16:33:56 +0200 (Sat, 09 Aug 2008) | 3 lines
-Added tagging in svn of release versions
-
-------------------------------------------------------------------------
-r33 | louis | 2008-08-07 20:27:36 +0200 (Thu, 07 Aug 2008) | 2 lines
+mkdir trunk
-first checkin to trunk
------------------------------------------------------------------------
diff --git a/INSTALL b/INSTALL
index a1e89e1..007e939 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,7 +1,7 @@
Installation Instructions
*************************
-Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
+Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification,
@@ -309,9 +309,10 @@ causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
-an Autoconf bug. Until the bug is fixed you can use this workaround:
+an Autoconf limitation. Until the limitation is lifted, you can use
+this workaround:
- CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+ CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
@@ -367,4 +368,3 @@ operates.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
-
diff --git a/Makefile.am b/Makefile.am
index ece33e0..19fa7f0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,6 @@
## Process this file with automake to produce Makefile.in
-## AUTOMAKE_OPTIONS = foreign
+# We must define a dummy directory for the backenddir so make discheck works
+AM_DISTCHECK_CONFIGURE_FLAGS = --with-cupsbackenddir=/tmp
cupsbackend_PROGRAMS = bjnp
bjnp_SOURCES = \
@@ -10,12 +11,17 @@ bjnp_SOURCES = \
bjnp-utils.c \
bjnp-discover.c \
bjnp-commands.c \
+ bjnp-levels.c \
cups-bjnp.spec \
bjnp.h \
+ bjnp-commands.h \
bjnp-protocol.h \
+ bjnp-io.h \
TODO \
- conf/rpmbuild \
- conf/norpm
-bjnp_CFLAGS = -Wall $(EXTRA_CFLAGS)
+ README \
+ README.levels \
+ COPYING
+bjnp_CFLAGS = -Wall $(CUPS_CFLAGS) $(EXTRA_CFLAGS)
+bjnp_LDFLAGS = $(CUPS_LDFLAGS)
+bjnp_LDADD = $(CUPS_LIBS)
-@rpmtarget@
diff --git a/Makefile.in b/Makefile.in
index 673fe43..249079e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.4 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,23 +15,51 @@
@SET_MAKE@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
esac; \
- test $$am__dry = yes; \
- }
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -51,10 +78,11 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
cupsbackend_PROGRAMS = bjnp$(EXEEXT)
subdir = .
-DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in $(srcdir)/config.h.in \
- $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
- TODO compile depcomp install-sh missing
+DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \
+ $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(top_srcdir)/configure $(am__configure_deps) \
+ $(srcdir)/config.h.in depcomp COPYING TODO compile install-sh \
+ missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
@@ -71,19 +99,44 @@ PROGRAMS = $(cupsbackend_PROGRAMS)
am_bjnp_OBJECTS = bjnp-bjnp.$(OBJEXT) bjnp-bjnp-runloop.$(OBJEXT) \
bjnp-bjnp-io.$(OBJEXT) bjnp-bjnp-debug.$(OBJEXT) \
bjnp-bjnp-utils.$(OBJEXT) bjnp-bjnp-discover.$(OBJEXT) \
- bjnp-bjnp-commands.$(OBJEXT)
+ bjnp-bjnp-commands.$(OBJEXT) bjnp-bjnp-levels.$(OBJEXT)
bjnp_OBJECTS = $(am_bjnp_OBJECTS)
-bjnp_LDADD = $(LDADD)
-bjnp_LINK = $(CCLD) $(bjnp_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
- -o $@
+am__DEPENDENCIES_1 =
+bjnp_DEPENDENCIES = $(am__DEPENDENCIES_1)
+bjnp_LINK = $(CCLD) $(bjnp_CFLAGS) $(CFLAGS) $(bjnp_LDFLAGS) \
+ $(LDFLAGS) -o $@
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
SOURCES = $(bjnp_SOURCES)
DIST_SOURCES = $(bjnp_SOURCES)
am__can_run_installinfo = \
@@ -91,8 +144,28 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
+ $(LISP)config.h.in
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
+CSCOPE = cscope
+AM_RECURSIVE_TARGETS = cscope
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@@ -102,14 +175,17 @@ am__remove_distdir = \
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
+am__post_remove_distdir = $(am__remove_distdir)
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
+DIST_TARGETS = dist-gzip
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@@ -119,6 +195,9 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CUPS_CFLAGS = @CUPS_CFLAGS@
+CUPS_LDFLAGS = @CUPS_LDFLAGS@
+CUPS_LIBS = @CUPS_LIBS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
@@ -150,7 +229,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
-RPMBUILD = @RPMBUILD@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
@@ -198,6 +276,9 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+
+# We must define a dummy directory for the backenddir so make discheck works
+AM_DISTCHECK_CONFIGURE_FLAGS = --with-cupsbackenddir=/tmp
bjnp_SOURCES = \
bjnp.c \
bjnp-runloop.c \
@@ -206,14 +287,20 @@ bjnp_SOURCES = \
bjnp-utils.c \
bjnp-discover.c \
bjnp-commands.c \
+ bjnp-levels.c \
cups-bjnp.spec \
bjnp.h \
+ bjnp-commands.h \
bjnp-protocol.h \
+ bjnp-io.h \
TODO \
- conf/rpmbuild \
- conf/norpm
+ README \
+ README.levels \
+ COPYING
-bjnp_CFLAGS = -Wall $(EXTRA_CFLAGS)
+bjnp_CFLAGS = -Wall $(CUPS_CFLAGS) $(EXTRA_CFLAGS)
+bjnp_LDFLAGS = $(CUPS_LDFLAGS)
+bjnp_LDADD = $(CUPS_LIBS)
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -277,10 +364,11 @@ install-cupsbackendPROGRAMS: $(cupsbackend_PROGRAMS)
fi; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
- while read p p1; do if test -f $$p; \
- then echo "$$p"; echo "$$p"; else :; fi; \
+ while read p p1; do if test -f $$p \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
done | \
- sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
@@ -301,16 +389,18 @@ uninstall-cupsbackendPROGRAMS:
@list='$(cupsbackend_PROGRAMS)'; test -n "$(cupsbackenddir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
- -e 's/$$/$(EXEEXT)/' `; \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(cupsbackenddir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(cupsbackenddir)" && rm -f $$files
clean-cupsbackendPROGRAMS:
-test -z "$(cupsbackend_PROGRAMS)" || rm -f $(cupsbackend_PROGRAMS)
+
bjnp$(EXEEXT): $(bjnp_OBJECTS) $(bjnp_DEPENDENCIES) $(EXTRA_bjnp_DEPENDENCIES)
@rm -f bjnp$(EXEEXT)
- $(bjnp_LINK) $(bjnp_OBJECTS) $(bjnp_LDADD) $(LIBS)
+ $(AM_V_CCLD)$(bjnp_LINK) $(bjnp_OBJECTS) $(bjnp_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -322,142 +412,146 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bjnp-bjnp-debug.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bjnp-bjnp-discover.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bjnp-bjnp-io.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bjnp-bjnp-levels.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bjnp-bjnp-runloop.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bjnp-bjnp-utils.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bjnp-bjnp.Po@am__quote@
.c.o:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
.c.obj:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
bjnp-bjnp.o: bjnp.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp.o -MD -MP -MF $(DEPDIR)/bjnp-bjnp.Tpo -c -o bjnp-bjnp.o `test -f 'bjnp.c' || echo '$(srcdir)/'`bjnp.c
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/bjnp-bjnp.Tpo $(DEPDIR)/bjnp-bjnp.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bjnp.c' object='bjnp-bjnp.o' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp.o -MD -MP -MF $(DEPDIR)/bjnp-bjnp.Tpo -c -o bjnp-bjnp.o `test -f 'bjnp.c' || echo '$(srcdir)/'`bjnp.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bjnp-bjnp.Tpo $(DEPDIR)/bjnp-bjnp.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bjnp.c' object='bjnp-bjnp.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp.o `test -f 'bjnp.c' || echo '$(srcdir)/'`bjnp.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp.o `test -f 'bjnp.c' || echo '$(srcdir)/'`bjnp.c
bjnp-bjnp.obj: bjnp.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp.obj -MD -MP -MF $(DEPDIR)/bjnp-bjnp.Tpo -c -o bjnp-bjnp.obj `if test -f 'bjnp.c'; then $(CYGPATH_W) 'bjnp.c'; else $(CYGPATH_W) '$(srcdir)/bjnp.c'; fi`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/bjnp-bjnp.Tpo $(DEPDIR)/bjnp-bjnp.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bjnp.c' object='bjnp-bjnp.obj' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp.obj -MD -MP -MF $(DEPDIR)/bjnp-bjnp.Tpo -c -o bjnp-bjnp.obj `if test -f 'bjnp.c'; then $(CYGPATH_W) 'bjnp.c'; else $(CYGPATH_W) '$(srcdir)/bjnp.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bjnp-bjnp.Tpo $(DEPDIR)/bjnp-bjnp.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bjnp.c' object='bjnp-bjnp.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp.obj `if test -f 'bjnp.c'; then $(CYGPATH_W) 'bjnp.c'; else $(CYGPATH_W) '$(srcdir)/bjnp.c'; fi`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp.obj `if test -f 'bjnp.c'; then $(CYGPATH_W) 'bjnp.c'; else $(CYGPATH_W) '$(srcdir)/bjnp.c'; fi`
bjnp-bjnp-runloop.o: bjnp-runloop.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-runloop.o -MD -MP -MF $(DEPDIR)/bjnp-bjnp-runloop.Tpo -c -o bjnp-bjnp-runloop.o `test -f 'bjnp-runloop.c' || echo '$(srcdir)/'`bjnp-runloop.c
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/bjnp-bjnp-runloop.Tpo $(DEPDIR)/bjnp-bjnp-runloop.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bjnp-runloop.c' object='bjnp-bjnp-runloop.o' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-runloop.o -MD -MP -MF $(DEPDIR)/bjnp-bjnp-runloop.Tpo -c -o bjnp-bjnp-runloop.o `test -f 'bjnp-runloop.c' || echo '$(srcdir)/'`bjnp-runloop.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bjnp-bjnp-runloop.Tpo $(DEPDIR)/bjnp-bjnp-runloop.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bjnp-runloop.c' object='bjnp-bjnp-runloop.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-runloop.o `test -f 'bjnp-runloop.c' || echo '$(srcdir)/'`bjnp-runloop.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-runloop.o `test -f 'bjnp-runloop.c' || echo '$(srcdir)/'`bjnp-runloop.c
bjnp-bjnp-runloop.obj: bjnp-runloop.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-runloop.obj -MD -MP -MF $(DEPDIR)/bjnp-bjnp-runloop.Tpo -c -o bjnp-bjnp-runloop.obj `if test -f 'bjnp-runloop.c'; then $(CYGPATH_W) 'bjnp-runloop.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-runloop.c'; fi`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/bjnp-bjnp-runloop.Tpo $(DEPDIR)/bjnp-bjnp-runloop.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bjnp-runloop.c' object='bjnp-bjnp-runloop.obj' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-runloop.obj -MD -MP -MF $(DEPDIR)/bjnp-bjnp-runloop.Tpo -c -o bjnp-bjnp-runloop.obj `if test -f 'bjnp-runloop.c'; then $(CYGPATH_W) 'bjnp-runloop.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-runloop.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bjnp-bjnp-runloop.Tpo $(DEPDIR)/bjnp-bjnp-runloop.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bjnp-runloop.c' object='bjnp-bjnp-runloop.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-runloop.obj `if test -f 'bjnp-runloop.c'; then $(CYGPATH_W) 'bjnp-runloop.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-runloop.c'; fi`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-runloop.obj `if test -f 'bjnp-runloop.c'; then $(CYGPATH_W) 'bjnp-runloop.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-runloop.c'; fi`
bjnp-bjnp-io.o: bjnp-io.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-io.o -MD -MP -MF $(DEPDIR)/bjnp-bjnp-io.Tpo -c -o bjnp-bjnp-io.o `test -f 'bjnp-io.c' || echo '$(srcdir)/'`bjnp-io.c
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/bjnp-bjnp-io.Tpo $(DEPDIR)/bjnp-bjnp-io.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bjnp-io.c' object='bjnp-bjnp-io.o' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-io.o -MD -MP -MF $(DEPDIR)/bjnp-bjnp-io.Tpo -c -o bjnp-bjnp-io.o `test -f 'bjnp-io.c' || echo '$(srcdir)/'`bjnp-io.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bjnp-bjnp-io.Tpo $(DEPDIR)/bjnp-bjnp-io.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bjnp-io.c' object='bjnp-bjnp-io.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-io.o `test -f 'bjnp-io.c' || echo '$(srcdir)/'`bjnp-io.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-io.o `test -f 'bjnp-io.c' || echo '$(srcdir)/'`bjnp-io.c
bjnp-bjnp-io.obj: bjnp-io.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-io.obj -MD -MP -MF $(DEPDIR)/bjnp-bjnp-io.Tpo -c -o bjnp-bjnp-io.obj `if test -f 'bjnp-io.c'; then $(CYGPATH_W) 'bjnp-io.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-io.c'; fi`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/bjnp-bjnp-io.Tpo $(DEPDIR)/bjnp-bjnp-io.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bjnp-io.c' object='bjnp-bjnp-io.obj' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-io.obj -MD -MP -MF $(DEPDIR)/bjnp-bjnp-io.Tpo -c -o bjnp-bjnp-io.obj `if test -f 'bjnp-io.c'; then $(CYGPATH_W) 'bjnp-io.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-io.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bjnp-bjnp-io.Tpo $(DEPDIR)/bjnp-bjnp-io.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bjnp-io.c' object='bjnp-bjnp-io.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-io.obj `if test -f 'bjnp-io.c'; then $(CYGPATH_W) 'bjnp-io.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-io.c'; fi`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-io.obj `if test -f 'bjnp-io.c'; then $(CYGPATH_W) 'bjnp-io.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-io.c'; fi`
bjnp-bjnp-debug.o: bjnp-debug.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-debug.o -MD -MP -MF $(DEPDIR)/bjnp-bjnp-debug.Tpo -c -o bjnp-bjnp-debug.o `test -f 'bjnp-debug.c' || echo '$(srcdir)/'`bjnp-debug.c
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/bjnp-bjnp-debug.Tpo $(DEPDIR)/bjnp-bjnp-debug.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bjnp-debug.c' object='bjnp-bjnp-debug.o' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-debug.o -MD -MP -MF $(DEPDIR)/bjnp-bjnp-debug.Tpo -c -o bjnp-bjnp-debug.o `test -f 'bjnp-debug.c' || echo '$(srcdir)/'`bjnp-debug.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bjnp-bjnp-debug.Tpo $(DEPDIR)/bjnp-bjnp-debug.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bjnp-debug.c' object='bjnp-bjnp-debug.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-debug.o `test -f 'bjnp-debug.c' || echo '$(srcdir)/'`bjnp-debug.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-debug.o `test -f 'bjnp-debug.c' || echo '$(srcdir)/'`bjnp-debug.c
bjnp-bjnp-debug.obj: bjnp-debug.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-debug.obj -MD -MP -MF $(DEPDIR)/bjnp-bjnp-debug.Tpo -c -o bjnp-bjnp-debug.obj `if test -f 'bjnp-debug.c'; then $(CYGPATH_W) 'bjnp-debug.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-debug.c'; fi`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/bjnp-bjnp-debug.Tpo $(DEPDIR)/bjnp-bjnp-debug.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bjnp-debug.c' object='bjnp-bjnp-debug.obj' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-debug.obj -MD -MP -MF $(DEPDIR)/bjnp-bjnp-debug.Tpo -c -o bjnp-bjnp-debug.obj `if test -f 'bjnp-debug.c'; then $(CYGPATH_W) 'bjnp-debug.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-debug.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bjnp-bjnp-debug.Tpo $(DEPDIR)/bjnp-bjnp-debug.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bjnp-debug.c' object='bjnp-bjnp-debug.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-debug.obj `if test -f 'bjnp-debug.c'; then $(CYGPATH_W) 'bjnp-debug.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-debug.c'; fi`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-debug.obj `if test -f 'bjnp-debug.c'; then $(CYGPATH_W) 'bjnp-debug.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-debug.c'; fi`
bjnp-bjnp-utils.o: bjnp-utils.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-utils.o -MD -MP -MF $(DEPDIR)/bjnp-bjnp-utils.Tpo -c -o bjnp-bjnp-utils.o `test -f 'bjnp-utils.c' || echo '$(srcdir)/'`bjnp-utils.c
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/bjnp-bjnp-utils.Tpo $(DEPDIR)/bjnp-bjnp-utils.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bjnp-utils.c' object='bjnp-bjnp-utils.o' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-utils.o -MD -MP -MF $(DEPDIR)/bjnp-bjnp-utils.Tpo -c -o bjnp-bjnp-utils.o `test -f 'bjnp-utils.c' || echo '$(srcdir)/'`bjnp-utils.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bjnp-bjnp-utils.Tpo $(DEPDIR)/bjnp-bjnp-utils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bjnp-utils.c' object='bjnp-bjnp-utils.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-utils.o `test -f 'bjnp-utils.c' || echo '$(srcdir)/'`bjnp-utils.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-utils.o `test -f 'bjnp-utils.c' || echo '$(srcdir)/'`bjnp-utils.c
bjnp-bjnp-utils.obj: bjnp-utils.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-utils.obj -MD -MP -MF $(DEPDIR)/bjnp-bjnp-utils.Tpo -c -o bjnp-bjnp-utils.obj `if test -f 'bjnp-utils.c'; then $(CYGPATH_W) 'bjnp-utils.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-utils.c'; fi`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/bjnp-bjnp-utils.Tpo $(DEPDIR)/bjnp-bjnp-utils.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bjnp-utils.c' object='bjnp-bjnp-utils.obj' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-utils.obj -MD -MP -MF $(DEPDIR)/bjnp-bjnp-utils.Tpo -c -o bjnp-bjnp-utils.obj `if test -f 'bjnp-utils.c'; then $(CYGPATH_W) 'bjnp-utils.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-utils.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bjnp-bjnp-utils.Tpo $(DEPDIR)/bjnp-bjnp-utils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bjnp-utils.c' object='bjnp-bjnp-utils.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-utils.obj `if test -f 'bjnp-utils.c'; then $(CYGPATH_W) 'bjnp-utils.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-utils.c'; fi`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-utils.obj `if test -f 'bjnp-utils.c'; then $(CYGPATH_W) 'bjnp-utils.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-utils.c'; fi`
bjnp-bjnp-discover.o: bjnp-discover.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-discover.o -MD -MP -MF $(DEPDIR)/bjnp-bjnp-discover.Tpo -c -o bjnp-bjnp-discover.o `test -f 'bjnp-discover.c' || echo '$(srcdir)/'`bjnp-discover.c
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/bjnp-bjnp-discover.Tpo $(DEPDIR)/bjnp-bjnp-discover.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bjnp-discover.c' object='bjnp-bjnp-discover.o' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-discover.o -MD -MP -MF $(DEPDIR)/bjnp-bjnp-discover.Tpo -c -o bjnp-bjnp-discover.o `test -f 'bjnp-discover.c' || echo '$(srcdir)/'`bjnp-discover.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bjnp-bjnp-discover.Tpo $(DEPDIR)/bjnp-bjnp-discover.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bjnp-discover.c' object='bjnp-bjnp-discover.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-discover.o `test -f 'bjnp-discover.c' || echo '$(srcdir)/'`bjnp-discover.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-discover.o `test -f 'bjnp-discover.c' || echo '$(srcdir)/'`bjnp-discover.c
bjnp-bjnp-discover.obj: bjnp-discover.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-discover.obj -MD -MP -MF $(DEPDIR)/bjnp-bjnp-discover.Tpo -c -o bjnp-bjnp-discover.obj `if test -f 'bjnp-discover.c'; then $(CYGPATH_W) 'bjnp-discover.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-discover.c'; fi`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/bjnp-bjnp-discover.Tpo $(DEPDIR)/bjnp-bjnp-discover.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bjnp-discover.c' object='bjnp-bjnp-discover.obj' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-discover.obj -MD -MP -MF $(DEPDIR)/bjnp-bjnp-discover.Tpo -c -o bjnp-bjnp-discover.obj `if test -f 'bjnp-discover.c'; then $(CYGPATH_W) 'bjnp-discover.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-discover.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bjnp-bjnp-discover.Tpo $(DEPDIR)/bjnp-bjnp-discover.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bjnp-discover.c' object='bjnp-bjnp-discover.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-discover.obj `if test -f 'bjnp-discover.c'; then $(CYGPATH_W) 'bjnp-discover.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-discover.c'; fi`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-discover.obj `if test -f 'bjnp-discover.c'; then $(CYGPATH_W) 'bjnp-discover.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-discover.c'; fi`
bjnp-bjnp-commands.o: bjnp-commands.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-commands.o -MD -MP -MF $(DEPDIR)/bjnp-bjnp-commands.Tpo -c -o bjnp-bjnp-commands.o `test -f 'bjnp-commands.c' || echo '$(srcdir)/'`bjnp-commands.c
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/bjnp-bjnp-commands.Tpo $(DEPDIR)/bjnp-bjnp-commands.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bjnp-commands.c' object='bjnp-bjnp-commands.o' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-commands.o -MD -MP -MF $(DEPDIR)/bjnp-bjnp-commands.Tpo -c -o bjnp-bjnp-commands.o `test -f 'bjnp-commands.c' || echo '$(srcdir)/'`bjnp-commands.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bjnp-bjnp-commands.Tpo $(DEPDIR)/bjnp-bjnp-commands.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bjnp-commands.c' object='bjnp-bjnp-commands.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-commands.o `test -f 'bjnp-commands.c' || echo '$(srcdir)/'`bjnp-commands.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-commands.o `test -f 'bjnp-commands.c' || echo '$(srcdir)/'`bjnp-commands.c
bjnp-bjnp-commands.obj: bjnp-commands.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-commands.obj -MD -MP -MF $(DEPDIR)/bjnp-bjnp-commands.Tpo -c -o bjnp-bjnp-commands.obj `if test -f 'bjnp-commands.c'; then $(CYGPATH_W) 'bjnp-commands.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-commands.c'; fi`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/bjnp-bjnp-commands.Tpo $(DEPDIR)/bjnp-bjnp-commands.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bjnp-commands.c' object='bjnp-bjnp-commands.obj' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-commands.obj -MD -MP -MF $(DEPDIR)/bjnp-bjnp-commands.Tpo -c -o bjnp-bjnp-commands.obj `if test -f 'bjnp-commands.c'; then $(CYGPATH_W) 'bjnp-commands.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-commands.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bjnp-bjnp-commands.Tpo $(DEPDIR)/bjnp-bjnp-commands.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bjnp-commands.c' object='bjnp-bjnp-commands.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-commands.obj `if test -f 'bjnp-commands.c'; then $(CYGPATH_W) 'bjnp-commands.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-commands.c'; fi`
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-commands.obj `if test -f 'bjnp-commands.c'; then $(CYGPATH_W) 'bjnp-commands.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-commands.c'; fi`
+
+bjnp-bjnp-levels.o: bjnp-levels.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-levels.o -MD -MP -MF $(DEPDIR)/bjnp-bjnp-levels.Tpo -c -o bjnp-bjnp-levels.o `test -f 'bjnp-levels.c' || echo '$(srcdir)/'`bjnp-levels.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bjnp-bjnp-levels.Tpo $(DEPDIR)/bjnp-bjnp-levels.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bjnp-levels.c' object='bjnp-bjnp-levels.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-levels.o `test -f 'bjnp-levels.c' || echo '$(srcdir)/'`bjnp-levels.c
+
+bjnp-bjnp-levels.obj: bjnp-levels.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -MT bjnp-bjnp-levels.obj -MD -MP -MF $(DEPDIR)/bjnp-bjnp-levels.Tpo -c -o bjnp-bjnp-levels.obj `if test -f 'bjnp-levels.c'; then $(CYGPATH_W) 'bjnp-levels.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-levels.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bjnp-bjnp-levels.Tpo $(DEPDIR)/bjnp-bjnp-levels.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bjnp-levels.c' object='bjnp-bjnp-levels.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bjnp_CFLAGS) $(CFLAGS) -c -o bjnp-bjnp-levels.obj `if test -f 'bjnp-levels.c'; then $(CYGPATH_W) 'bjnp-levels.c'; else $(CYGPATH_W) '$(srcdir)/bjnp-levels.c'; fi`
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
- list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@@ -469,15 +563,11 @@ TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@@ -486,9 +576,31 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
+cscope: cscope.files
+ test ! -s cscope.files \
+ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
+clean-cscope:
+ -rm -f cscope.files
+cscope.files: clean-cscope cscopelist
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+ -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(DISTFILES)
$(am__remove_distdir)
@@ -531,40 +643,36 @@ distdir: $(DISTFILES)
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
- $(am__remove_distdir)
+ $(am__post_remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
- $(am__remove_distdir)
+ $(am__post_remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
- $(am__remove_distdir)
-
-dist-lzma: distdir
- tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
- $(am__remove_distdir)
+ $(am__post_remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
- $(am__remove_distdir)
+ $(am__post_remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
- $(am__remove_distdir)
+ $(am__post_remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
- $(am__remove_distdir)
+ $(am__post_remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
- $(am__remove_distdir)
+ $(am__post_remove_distdir)
-dist dist-all: distdir
- tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
- $(am__remove_distdir)
+dist dist-all:
+ $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
+ $(am__post_remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
@@ -575,8 +683,6 @@ distcheck: dist
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
- *.tar.lzma*) \
- lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
@@ -588,9 +694,9 @@ distcheck: dist
*.zip*) \
unzip $(distdir).zip ;;\
esac
- chmod -R a-w $(distdir); chmod u+w $(distdir)
- mkdir $(distdir)/_build
- mkdir $(distdir)/_inst
+ chmod -R a-w $(distdir)
+ chmod u+w $(distdir)
+ mkdir $(distdir)/_build $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
@@ -622,7 +728,7 @@ distcheck: dist
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
- $(am__remove_distdir)
+ $(am__post_remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
@@ -763,25 +869,24 @@ uninstall-am: uninstall-cupsbackendPROGRAMS
.MAKE: all install-am install-strip
-.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
- clean-cupsbackendPROGRAMS clean-generic ctags dist dist-all \
- dist-bzip2 dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ \
- dist-xz dist-zip distcheck distclean distclean-compile \
- distclean-generic distclean-hdr distclean-tags distcleancheck \
- distdir distuninstallcheck dvi dvi-am html html-am info \
- info-am install install-am install-cupsbackendPROGRAMS \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
+.PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-am clean \
+ clean-cscope clean-cupsbackendPROGRAMS clean-generic cscope \
+ cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
+ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
+ distcheck distclean distclean-compile distclean-generic \
+ distclean-hdr distclean-tags distcleancheck distdir \
+ distuninstallcheck dvi dvi-am html html-am info info-am \
+ install install-am install-cupsbackendPROGRAMS install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
uninstall-am uninstall-cupsbackendPROGRAMS
-@rpmtarget@
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/NEWS b/NEWS
index 586f03c..c5231cd 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,32 @@
+2014-09-06
+- Relaese version 2.0 of cups-bjnp
+ This version:
+ - adds reporting of ink levels to Cups
+ - improves error hendling
+
+2014-03-05
+- This is a beta version of the upcoming bjnp 2.0 release
+ Ink level reporting is added as well as improved error handling.
+ If there are issues (e.g. one or more cartridges not recognized and showing as
+ white or any other issues, please report them in the bug-tracker on sourceforge.
+ Please provide the bjnp_log file with debuglevel set to DEBUG (see README for details
+ on how to set debugging. For most errors just ading the printer status string
+ (grep the debug output for BST) should be sufficient
+
+2014-01-22
+- This is the 1.2.2 release. The changes are quite limited:
+ bugfix for newer Canon printers that send an XML-document for the printer status
+ fix for a possible buffer overflow in parsing of reponses
+
+2013-02-23
+- versions 1.2.1
+ Fix issue where printer sent responses in 2 TCP packets
+
+2012-11-27
+- Version 1.2
+ Adds support from printing over IPv6
+ major code restructuring and rwrite
+
2012-09-25
- This is the 1.1 release. IPv6 is now supported for printing and printer detection.
- We now really use only port 8611 for printer detection.
diff --git a/README b/README
index c112f35..1a2b74f 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
This is the BJNP protocol backend for CUPS
-It works with cups 1.2 - 1.6 (verified)
+It works with cups 1.2 - 1.7 (verified)
CUPS-BJNP can be compiled standalone (when the cups-devel package or your OS
equivalent is installed, e.g. for Fedora install cups-devel).
@@ -40,16 +40,27 @@ directory.
configure cups through the web frontend (https://localhost:631), e.g. try
tab <administration> <find new printers>
+Ink level reporting
+===================
+Cups-bjnp reports ink levels to CUPS during printing. Many GUI tools like the Gnome
+printer settings tools can show the current ink-levels and report warnings whwn ink
+levels get low.
+
Debugging
=========
If you have problems, you may want to set the debugging level.
To debug printer detection you can set the environment variable BJNP_DEBUG
-export BJNP_DEBUG=DEBUG2 (for sh or bash) or
-setenv BJNP_DEBUG DEBUG2 (for csh or tcsh)
+export BJNP_DEBUG_LEVEL=DEBUG2 (for sh or bash) or
+setenv BJNP_DEBUG_LEVEL DEBUG2 (for csh or tcsh)
+
+The filename can be set by setting BJNP_DEBUG_FILE in similar way.
To debug printing, you can add the debug level as part of the printer URI:
-DeviceURI bjnp://printer-1.pheasant:8611/?debuglevel=DEBUG2
+DeviceURI bjnp://printer-1.pheasant:8611/?debuglevel=DEBUG2 or
+bnp:///printer-1.pheasant:8611/?debuglevel=DEBUG2+debugfile=./log to log to
+the file ./log. Normally this is not required as a logfile in the cups
+log directory is used when no name is defined.
In both cases the debuglevel is set to one of the cups debuglevels (see cups
documentation: http://www.cups.org/documentation.php/man-filter.html)
@@ -74,16 +85,4 @@ outgoing packets will be allowed by the rule above. Responses from the printer
are sent back to the computer TO port 8611. Connection tracking however does not
see a match. You will therefore have to allow packets received TO port 8611 as well.
-Louis Lagendijk
louis.lagendijk@gmail.com
-
-ChangeLog
-2012-08-31 Added IPv6 support
- Refactored into a number of c-files
-2011-07-05 Version 1.0
- Fixed some warnings from the latest GCC on unused code
- Made hostname resolution for the printer more robust by verifying
- that a forward lookup matches the reverse name lookup.
- This should fix printer detection for some buggy routers that
- return a bogus hostname on a reverse lookup
- Bumped version number to 1.0 the code seems to be stable.
diff --git a/README.levels b/README.levels
new file mode 100644
index 0000000..1335e2d
--- /dev/null
+++ b/README.levels
@@ -0,0 +1,39 @@
+cups-bjnp
+=========
+This version of cups-bjnp adds experimental support for ink-level reporting and improved
+out-of-paper reporting.
+
+Ink-level reporting requires translation of the mnemonic reported by the printer to the
+human readable color and to the RGB values to show the cartridge in the user interfaces.
+It is quite well possible that some cartridge types are not yet recognised.
+
+The ink-level status is updated regularly during printing of a document.
+I am now looking for success and failure reports for this cups-bjnp version.
+
+What to test
+============
+1) check in your favorite printer configuration tool (control-panel->printers,
+system-config-printer, or the KDE printer configuration tool) that all cartridges
+are correctly shown (if a certain cartridge is not recognized it is shown as
+"unknown" and the color is set to white (#FFFFFF). If this occurs, please report this
+with the details requested below
+
+2)Check that when cartridges are getting empty, they are reported (see system-config-printer->
+ink/toner-levels/status messages) with bjnp.xxx-ink-low / bjnp-xxx-ink-emty messages.
+Gnome 3 uses the genric ink level low messages to show a pop-up.
+
+3) verify that cups-bjnp correctly reports paper-empty events. When the printer detects an
+out of paper situation, Gnome 3 will show a popup. Other environments may do something
+similar.
+
+Reporting of issues (and success)
+=================================
+In order to get the required information, please change the printer URI from:
+bjnp://xxxx
+bjnp://xxx/?debuglevel=DEBUG
+
+and send me the resulting bjnp logfile /var/log/cups/bjnp_log when cups logs to
+/var/log/cups with te details of the issues found. Please mention the printer type
+to help me find out details
+
+Louis Lagendijk (louis.lagendijk@gmail.com)
diff --git a/TODO b/TODO
index 27bbade..2e23c92 100644
--- a/TODO
+++ b/TODO
@@ -12,7 +12,7 @@ DONE:
solved by the changes recommended by Zedo, the kind Turboprint people, that included
cups-bjnp in their product (www.turboprint.de). Throttle delay changed to 40 ms and
print buffer changed to 4k
-- improve documentationi per the mail from Jonathan Yu:
+- improve documentation per the mail from Jonathan Yu:
If I could make a suggestion, I think the INSTALL file should include some kind
of instruction to edit the DIST_DIR variable in the Makefile. This might make it
easier for less experienced users and might save people some time.
diff --git a/aclocal.m4 b/aclocal.m4
index 27b6293..ff64906 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,8 +1,7 @@
-# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
+# generated automatically by aclocal 1.13.4 -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
-# Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -12,33 +11,31 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
+m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
-[m4_warning([this file was generated for autoconf 2.68.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
-To do so, use the procedure documented by the package, typically `autoreconf'.])])
+To do so, use the procedure documented by the package, typically 'autoreconf'.])])
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 2002-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 1
-
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.11'
+[am__api_version='1.13'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.11.6], [],
+m4_if([$1], [1.13.4], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -54,24 +51,22 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.6])dnl
+[AM_AUTOMAKE_VERSION([1.13.4])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 1
-
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
-# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
-# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
+# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
@@ -90,7 +85,7 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
-# harmless because $srcdir is `.', but things will broke when you
+# harmless because $srcdir is '.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
@@ -116,22 +111,19 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
# AM_CONDITIONAL -*- Autoconf -*-
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 9
-
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
-[AC_PREREQ(2.52)dnl
- ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
- [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
@@ -150,16 +142,14 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
-# 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 12
-# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
@@ -169,7 +159,7 @@ fi])])
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
-# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
@@ -182,12 +172,13 @@ AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
-ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
- [$1], CXX, [depcc="$CXX" am_compiler_list=],
- [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
- [$1], UPC, [depcc="$UPC" am_compiler_list=],
- [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
- [depcc="$$1" am_compiler_list=])
+m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
+ [$1], [CXX], [depcc="$CXX" am_compiler_list=],
+ [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
+ [$1], [UPC], [depcc="$UPC" am_compiler_list=],
+ [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
@@ -195,8 +186,8 @@ AC_CACHE_CHECK([dependency style of $depcc],
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
- # making a dummy file named `D' -- because `-MD' means `put the output
- # in D'.
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
rm -rf conftest.dir
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
@@ -236,16 +227,16 @@ AC_CACHE_CHECK([dependency style of $depcc],
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
- # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
- # Solaris 8's {/usr,}/bin/sh.
- touch sub/conftst$i.h
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
- # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
- # handle `-M -o', and we need to detect this. Also, some Intel
- # versions had trouble with output in subdirs
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj"
case $depmode in
@@ -254,8 +245,8 @@ AC_CACHE_CHECK([dependency style of $depcc],
test "$am__universal" = false || continue
;;
nosideeffect)
- # after this tag, mechanisms are not by side-effect, so they'll
- # only be used when explicitly requested
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
if test "x$enable_dependency_tracking" = xyes; then
continue
else
@@ -263,7 +254,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
fi
;;
msvc7 | msvc7msys | msvisualcpp | msvcmsys)
- # This compiler won't grok `-c -o', but also, the minuso test has
+ # This compiler won't grok '-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
am__obj=conftest.${OBJEXT-o}
@@ -311,7 +302,7 @@ AM_CONDITIONAL([am__fastdep$1], [
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
-# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
@@ -321,9 +312,13 @@ AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
-[AC_ARG_ENABLE(dependency-tracking,
-[ --disable-dependency-tracking speeds up one-time build
- --enable-dependency-tracking do not reject slow dependency extractors])
+[AC_ARG_ENABLE([dependency-tracking], [dnl
+AS_HELP_STRING(
+ [--enable-dependency-tracking],
+ [do not reject slow dependency extractors])
+AS_HELP_STRING(
+ [--disable-dependency-tracking],
+ [speeds up one-time build])])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
@@ -338,20 +333,18 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-#serial 5
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[{
- # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
case $CONFIG_FILES in
@@ -364,7 +357,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
- # We used to match only the files named `Makefile.in', but
+ # We used to match only the files named 'Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
@@ -376,21 +369,19 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
- # from the Makefile without running `make'.
+ # from the Makefile without running 'make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
- test -z "am__include" && continue
+ test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
- # When using ansi2knr, U may be empty or an underscore; expand it
- U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
- sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
@@ -408,7 +399,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
-# is enabled. FIXME. This creates each `.P' file that we will
+# is enabled. FIXME. This creates each '.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
@@ -418,15 +409,12 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# Do all the work for Automake. -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 16
-
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
@@ -442,7 +430,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.62])dnl
+[AC_PREREQ([2.65])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
@@ -471,31 +459,40 @@ AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
-[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+[AC_DIAGNOSE([obsolete],
+ [$0: two- and three-arguments forms are deprecated.])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
-m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+m4_if(
+ m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+ [ok:ok],,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
-[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
- AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
+ AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
-AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
-AM_MISSING_PROG(AUTOCONF, autoconf)
-AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
-AM_MISSING_PROG(AUTOHEADER, autoheader)
-AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
+AM_MISSING_PROG([AUTOCONF], [autoconf])
+AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
+AM_MISSING_PROG([AUTOHEADER], [autoheader])
+AM_MISSING_PROG([MAKEINFO], [makeinfo])
AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
-AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+# For better backward compatibility. To be removed once Automake 1.9.x
+# dies out for good. For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
@@ -506,28 +503,32 @@ _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
- [_AM_DEPENDENCIES(CC)],
- [define([AC_PROG_CC],
- defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+ [_AM_DEPENDENCIES([CC])],
+ [m4_define([AC_PROG_CC],
+ m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
- [_AM_DEPENDENCIES(CXX)],
- [define([AC_PROG_CXX],
- defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+ [_AM_DEPENDENCIES([CXX])],
+ [m4_define([AC_PROG_CXX],
+ m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
- [_AM_DEPENDENCIES(OBJC)],
- [define([AC_PROG_OBJC],
- defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+ [_AM_DEPENDENCIES([OBJC])],
+ [m4_define([AC_PROG_OBJC],
+ m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+ [_AM_DEPENDENCIES([OBJCXX])],
+ [m4_define([AC_PROG_OBJCXX],
+ m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
])
-_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
-dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
-dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
-dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_REQUIRE([AM_SILENT_RULES])dnl
+dnl The testsuite driver may need to know about EXEEXT, so add the
+dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
+dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT],
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
])
-dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
+dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
dnl mangled by Autoconf and run in a shell conditional statement.
m4_define([_AC_COMPILER_EXEEXT],
@@ -555,15 +556,12 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
-# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
-# Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 1
-
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
@@ -577,16 +575,14 @@ if test x"${install_sh}" != xset; then
install_sh="\${SHELL} $am_aux_dir/install-sh"
esac
fi
-AC_SUBST(install_sh)])
+AC_SUBST([install_sh])])
-# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2003-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 2
-
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
@@ -603,20 +599,17 @@ AC_SUBST([am__leading_dot])])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
-# 2011 Free Software Foundation, Inc.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 5
-
# AM_MAINTAINER_MODE([DEFAULT-MODE])
# ----------------------------------
# Control maintainer-specific portions of Makefiles.
-# Default is to disable them, unless `enable' is passed literally.
-# For symmetry, `disable' may be passed as well. Anyway, the user
+# Default is to disable them, unless 'enable' is passed literally.
+# For symmetry, 'disable' may be passed as well. Anyway, the user
# can override the default with the --enable/--disable switch.
AC_DEFUN([AM_MAINTAINER_MODE],
[m4_case(m4_default([$1], [disable]),
@@ -627,10 +620,11 @@ AC_DEFUN([AM_MAINTAINER_MODE],
AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode's default is 'disable' unless 'enable' is passed
AC_ARG_ENABLE([maintainer-mode],
-[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful
- (and sometimes confusing) to the casual installer],
- [USE_MAINTAINER_MODE=$enableval],
- [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+ [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
+ am_maintainer_other[ make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer])],
+ [USE_MAINTAINER_MODE=$enableval],
+ [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
AC_MSG_RESULT([$USE_MAINTAINER_MODE])
AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
MAINT=$MAINTAINER_MODE_TRUE
@@ -638,18 +632,14 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
]
)
-AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
-
# Check to see how 'make' treats includes. -*- Autoconf -*-
-# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 4
-
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
@@ -667,7 +657,7 @@ am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
+# Ignore all kinds of additional output from 'make'.
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=include
@@ -692,15 +682,12 @@ AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
-# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 6
-
# AM_PROG_CC_C_O
# --------------
# Like AC_PROG_CC_C_O, but changed for automake.
@@ -729,15 +716,12 @@ m4_define([AC_PROG_CC],
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 6
-
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
@@ -745,11 +729,10 @@ AC_DEFUN([AM_MISSING_PROG],
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
-
# AM_MISSING_HAS_RUN
# ------------------
-# Define MISSING if not defined so far and test if it supports --run.
-# If it does, set am_missing_run to use it, otherwise, to nothing.
+# Define MISSING if not defined so far and test if it is modern enough.
+# If it is, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
@@ -762,54 +745,22 @@ if test x"${MISSING+set}" != xset; then
esac
fi
# Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
- am_missing_run="$MISSING --run "
+if eval "$MISSING --is-lightweight"; then
+ am_missing_run="$MISSING "
else
am_missing_run=
- AC_MSG_WARN([`missing' script is too old or missing])
+ AC_MSG_WARN(['missing' script is too old or missing])
fi
])
-# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
-# Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 1
-
-# AM_PROG_MKDIR_P
-# ---------------
-# Check for `mkdir -p'.
-AC_DEFUN([AM_PROG_MKDIR_P],
-[AC_PREREQ([2.60])dnl
-AC_REQUIRE([AC_PROG_MKDIR_P])dnl
-dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
-dnl while keeping a definition of mkdir_p for backward compatibility.
-dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
-dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
-dnl Makefile.ins that do not define MKDIR_P, so we do our own
-dnl adjustment using top_builddir (which is defined more often than
-dnl MKDIR_P).
-AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
-case $mkdir_p in
- [[\\/$]]* | ?:[[\\/]]*) ;;
- */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-])
-
# Helper functions for option handling. -*- Autoconf -*-
-# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 5
-
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
@@ -819,7 +770,7 @@ AC_DEFUN([_AM_MANGLE_OPTION],
# --------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
-[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
# _AM_SET_OPTIONS(OPTIONS)
# ------------------------
@@ -835,22 +786,16 @@ AC_DEFUN([_AM_IF_OPTION],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 5
-
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftest.file
# Reject unsafe characters in $srcdir or the absolute working directory
# name. Accept space and tab only in the latter.
am_lf='
@@ -861,32 +806,40 @@ case `pwd` in
esac
case $srcdir in
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
- AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+ AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
esac
-# Do `set' in a subshell so we don't clobber the current shell's
+# Do 'set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
- set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
- if test "$[*]" = "X"; then
- # -L didn't work.
- set X `ls -t "$srcdir/configure" conftest.file`
- fi
- rm -f conftest.file
- if test "$[*]" != "X $srcdir/configure conftest.file" \
- && test "$[*]" != "X conftest.file $srcdir/configure"; then
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
-alias in your environment])
- fi
-
+ am_has_slept=no
+ for am_try in 1 2; do
+ echo "timestamp, slept: $am_has_slept" > conftest.file
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+ alias in your environment])
+ fi
+ if test "$[2]" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ am_has_slept=yes
+ done
test "$[2]" = conftest.file
)
then
@@ -896,46 +849,118 @@ else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
-AC_MSG_RESULT(yes)])
+AC_MSG_RESULT([yes])
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+ ( sleep 1 ) &
+ am_sleep_pid=$!
+fi
+AC_CONFIG_COMMANDS_PRE(
+ [AC_MSG_CHECKING([that generated files are newer than configure])
+ if test -n "$am_sleep_pid"; then
+ # Hide warnings about reused PIDs.
+ wait $am_sleep_pid 2>/dev/null
+ fi
+ AC_MSG_RESULT([done])])
+rm -f conftest.file
+])
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2009-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 1
+# AM_SILENT_RULES([DEFAULT])
+# --------------------------
+# Enable less verbose build rules; with the default set to DEFAULT
+# ("yes" being less verbose, "no" or empty being verbose).
+AC_DEFUN([AM_SILENT_RULES],
+[AC_ARG_ENABLE([silent-rules], [dnl
+AS_HELP_STRING(
+ [--enable-silent-rules],
+ [less verbose build output (undo: "make V=1")])
+AS_HELP_STRING(
+ [--disable-silent-rules],
+ [verbose build output (undo: "make V=0")])dnl
+])
+case $enable_silent_rules in @%:@ (((
+ yes) AM_DEFAULT_VERBOSITY=0;;
+ no) AM_DEFAULT_VERBOSITY=1;;
+ *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+esac
+dnl
+dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
+dnl do not support nested variable expansions.
+dnl See automake bug#9928 and bug#10237.
+am_make=${MAKE-make}
+AC_CACHE_CHECK([whether $am_make supports nested variables],
+ [am_cv_make_support_nested_variables],
+ [if AS_ECHO([['TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+ @$(TRUE)
+.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
+ am_cv_make_support_nested_variables=yes
+else
+ am_cv_make_support_nested_variables=no
+fi])
+if test $am_cv_make_support_nested_variables = yes; then
+ dnl Using '$V' instead of '$(V)' breaks IRIX make.
+ AM_V='$(V)'
+ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+ AM_V=$AM_DEFAULT_VERBOSITY
+ AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AC_SUBST([AM_V])dnl
+AM_SUBST_NOTMAKE([AM_V])dnl
+AC_SUBST([AM_DEFAULT_V])dnl
+AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
+AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
+AM_BACKSLASH='\'
+AC_SUBST([AM_BACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+])
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_STRIP
# ---------------------
-# One issue with vendor `install' (even GNU) is that you can't
+# One issue with vendor 'install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
-# always use install-sh in `make install-strip', and initialize
+# always use install-sh in "make install-strip", and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'. However `strip' might not be the right
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip". However 'strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+# will honor the 'STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
-# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2006-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 3
-
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
@@ -949,18 +974,16 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
-# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2004-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 2
-
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
-# FORMAT should be one of `v7', `ustar', or `pax'.
+# FORMAT should be one of 'v7', 'ustar', or 'pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
@@ -970,76 +993,114 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
+#
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility. Yes, it's still used
# in the wild :-( We should find a proper way to deprecate it ...
AC_SUBST([AMTAR], ['$${TAR-tar}'])
-m4_if([$1], [v7],
- [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
- [m4_case([$1], [ustar],, [pax],,
- [m4_fatal([Unknown tar format])])
-AC_MSG_CHECKING([how to create a $1 tar archive])
-# Loop over all known methods to create a tar archive until one works.
+
+# We'll loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
-_am_tools=${am_cv_prog_tar_$1-$_am_tools}
-# Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of `-'.
-for _am_tool in $_am_tools
-do
- case $_am_tool in
- gnutar)
- for _am_tar in tar gnutar gtar;
- do
- AM_RUN_LOG([$_am_tar --version]) && break
- done
- am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
- am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
- am__untar="$_am_tar -xf -"
- ;;
- plaintar)
- # Must skip GNU tar: if it does not support --format= it doesn't create
- # ustar tarball either.
- (tar --version) >/dev/null 2>&1 && continue
- am__tar='tar chf - "$$tardir"'
- am__tar_='tar chf - "$tardir"'
- am__untar='tar xf -'
- ;;
- pax)
- am__tar='pax -L -x $1 -w "$$tardir"'
- am__tar_='pax -L -x $1 -w "$tardir"'
- am__untar='pax -r'
- ;;
- cpio)
- am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
- am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
- am__untar='cpio -i -H $1 -d'
- ;;
- none)
- am__tar=false
- am__tar_=false
- am__untar=false
- ;;
- esac
- # If the value was cached, stop now. We just wanted to have am__tar
- # and am__untar set.
- test -n "${am_cv_prog_tar_$1}" && break
+m4_if([$1], [v7],
+ [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+
+ [m4_case([$1],
+ [ustar],
+ [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
+ # There is notably a 21 bits limit for the UID and the GID. In fact,
+ # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
+ # and bug#13588).
+ am_max_uid=2097151 # 2^21 - 1
+ am_max_gid=$am_max_uid
+ # The $UID and $GID variables are not portable, so we need to resort
+ # to the POSIX-mandated id(1) utility. Errors in the 'id' calls
+ # below are definitely unexpected, so allow the users to see them
+ # (that is, avoid stderr redirection).
+ am_uid=`id -u || echo unknown`
+ am_gid=`id -g || echo unknown`
+ AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
+ if test $am_uid -le $am_max_uid; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ _am_tools=none
+ fi
+ AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
+ if test $am_gid -le $am_max_gid; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ _am_tools=none
+ fi],
+
+ [pax],
+ [],
+
+ [m4_fatal([Unknown tar format])])
+
+ AC_MSG_CHECKING([how to create a $1 tar archive])
+
+ # Go ahead even if we have the value already cached. We do so because we
+ # need to set the values for the 'am__tar' and 'am__untar' variables.
+ _am_tools=${am_cv_prog_tar_$1-$_am_tools}
+
+ for _am_tool in $_am_tools; do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar; do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
- # tar/untar a dummy directory, and stop if the command works
- rm -rf conftest.dir
- mkdir conftest.dir
- echo GrepMe > conftest.dir/file
- AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works.
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ AM_RUN_LOG([cat conftest.dir/file])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+ done
rm -rf conftest.dir
- if test -s conftest.tar; then
- AM_RUN_LOG([$am__untar <conftest.tar])
- grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
- fi
-done
-rm -rf conftest.dir
-AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
-AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+ AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+ AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
diff --git a/bjnp-commands.c b/bjnp-commands.c
index ede0a86..6c91af7 100644
--- a/bjnp-commands.c
+++ b/bjnp-commands.c
@@ -1,347 +1,349 @@
/*
- * TCP/IP IO communication implementation for
- * bjnp backend for the Common UNIX Printing System (CUPS).
- * Copyright 2008 by Louis Lagendijk
+ * Low level TCP and UDP IO communication implementation for
+ * bjnp backend for the Common UNIX Printing System (CUPS).
+ * Copyright 2008-2014 by Louis Lagendijk
*
- * These coded instructions, statements, and computer programs are the
- * property of Louis Lagendijk and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * "LICENSE" which should have been included with this file. If this
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * This program 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; version 2 only.
*
- * This file is subject to the Apple OS-Developed Software exception.
+ * This program 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.
*
- * Contents:
- * Process bjnp commands
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "bjnp.h"
-#include "bjnp-protocol.h"
#include <errno.h>
#include <stdio.h>
+#include "bjnp.h"
+#include "bjnp-protocol.h"
+#include "bjnp-commands.h"
+#include "bjnp-io.h"
-static int serial = 0;
-uint16_t session_id = 0;
-
-int
-parse_status_to_paperout (int len, char *status_str)
+void
+clear_cmd(bjnp_command_t *cmd)
{
-/*
- * parses the status string of the printer to retrieve paper status
- * of the printer
- * Returns: BJNP_PAPER_OK = paper ok
- * BJNP_PAPER_OUT = out of paper
- * BJNP_PAPER_UNKNOWN = paper status not found
- */
-
- char s[BJNP_IEEE1284_MAX];
- char *tok;
- unsigned int status;
-
- strcpy (s, status_str);
- s[len] = '\0';
-
- tok = strtok (s, ";");
- while (tok != NULL)
- {
- /* BST contains status */
-
- if (strncmp (tok, STR_BST, strlen (STR_BST)) == 0)
- {
- if (sscanf (tok + 4, "%2x", &status) != 1)
- {
- bjnp_debug (LOG_WARN, "Could not parse paper status tag: %s!\n",
- STR_BST);
- return BJNP_PAPER_UNKNOWN;
- }
- else
- {
- bjnp_debug (LOG_DEBUG,
- "Read printer status: %u\n Printing = %d\n Busy = %d\n PaperOut = %d\n",
- status, ((status & BST_PRINTING) != 0),
- ((status & BST_BUSY) != 0),
- ((status & BST_OPCALL) != 0));
- if (status & BST_OPCALL)
- {
- bjnp_debug (LOG_INFO, "Paper out!\n");
- return BJNP_PAPER_OUT;
- }
- else
- {
- bjnp_debug (LOG_INFO, "Paper ok!\n");
- return BJNP_PAPER_OK;
- }
- }
- }
- tok = strtok (NULL, ";");
- }
- return BJNP_PAPER_UNKNOWN;
+ memset(cmd, 0, sizeof(*cmd));
}
-void
-clear_cmd(bjnp_command_t * cmd)
+static void
+bjnp_set_command_header(uint8_t dev_type, uint16_t seq_no, uint16_t session_id, bjnp_command_t *cmd, char cmd_code,
+ int command_len)
{
- memset(cmd, 0, sizeof(*cmd) );
+ /*
+ * Set command buffer with command code, session_id and lenght of payload
+ * Returns: sequence number of command
+ */
+ strncpy(cmd->header.BJNP_id, BJNP_STRING, sizeof(cmd->header.BJNP_id));
+ cmd->header.dev_type = dev_type;
+ cmd->header.cmd_code = cmd_code;
+ cmd->header.unknown1 = htons(0);
+ cmd->header.payload_len = htonl(command_len - bjnp_header_size);
+ cmd->header.seq_no = htons(seq_no);
+ cmd->header.session_id = htons(session_id);
}
-
-int
-bjnp_set_command_header (bjnp_command_t *cmd, char cmd_code, int my_session_id,
- int command_len)
+
+void bjnp_defaults_set_command_header(bjnp_command_t *cmd, char cmd_code,
+ int command_len)
{
- /*
- * Set command buffer with command code, session_id and lenght of payload
- * Returns: sequence number of command
- */
- strncpy (cmd->header.BJNP_id, BJNP_STRING, sizeof (cmd->header.BJNP_id));
- cmd->header.dev_type = BJNP_CMD_PRINT;
- cmd->header.cmd_code = cmd_code;
- cmd->header.unknown1 = htons(0);
- cmd->header.seq_no = htons (++serial);
- cmd->header.session_id = htons (my_session_id);
-
- cmd->header.payload_len = htonl (command_len - bjnp_header_size);
-
- return serial;
+ bjnp_set_command_header(BJNP_CMD_PRINT, 0, 0, cmd, cmd_code, command_len);
}
+int
+bjnp_printer_set_command_header(printer_t *printer, bjnp_command_t *cmd, char cmd_code,
+ int command_len)
+{
+ bjnp_set_command_header( /* printer-> dev_type */ BJNP_CMD_PRINT, ++printer->serial,
+ printer->session_id, cmd, cmd_code, command_len);
+ return printer->serial;
+}
static int
-bjnp_process_udp_command (http_addr_t * addr, bjnp_command_t *command, int cmd_len, bjnp_response_t *response)
+bjnp_process_udp_command(http_addr_t *addr, bjnp_command_t *command,
+ int cmd_len, bjnp_response_t *response)
{
- /*
- * Send UDP command and retrieve response
- * Returns: length of response or -1 in case of error
- */
-
- int sockfd;
- int numbytes;
- fd_set fdset;
- struct timeval timeout;
- int try;
- char ipaddress[128];
- int port;
- int size;
-
- get_address_info( addr, ipaddress, &port);
- bjnp_debug (LOG_DEBUG, "Sending UDP command to %s port %d\n",
- ipaddress, port );
-
- if ((sockfd = socket (get_protocol_family( addr), SOCK_DGRAM, 0)) == -1)
- {
- bjnp_debug (LOG_CRIT, "bjnp_process_udp_command: sockfd - %s\n", strerror (errno));
- return -1;
+ /*
+ * Send UDP command and retrieve response
+ * Returns: length of response or -1 in case of error
+ */
+
+ int sockfd;
+ int numbytes;
+ fd_set fdset;
+ struct timeval timeout;
+ int attempt;
+ char ipaddress[128];
+ int port;
+ int size;
+ char family[BJNP_FAMILY_MAX];
+
+ get_address_info(addr, ipaddress, &port, family);
+ bjnp_debug(LOG_DEBUG, "Sending UDP command to %s port %d(%s)\n",
+ ipaddress, port, family);
+
+ if ((sockfd = socket(get_protocol_family(*addr), SOCK_DGRAM, 0)) == -1) {
+ bjnp_debug(LOG_CRIT, "bjnp_process_udp_command: sockfd - %s\n",
+ strerror(errno));
+ return -1;
}
- size = sa_size(addr);
- if (connect (sockfd, &(addr->addr), (socklen_t) size )
- != 0)
- {
- bjnp_debug (LOG_CRIT, "bjnp_process_udp_command: connect - %s\n", strerror (errno));
- close( sockfd);
- return -1;
+ size = sa_size(*addr);
+
+ if (connect(sockfd, &(addr->addr), (socklen_t) size)
+ != 0) {
+ bjnp_debug(LOG_CRIT, "bjnp_process_udp_command: connect - %s\n",
+ strerror(errno));
+ close(sockfd);
+ return -1;
}
- for (try = 0; try < 3; try++)
- {
- if ((numbytes = send (sockfd, command, cmd_len, 0)) != cmd_len)
- {
- bjnp_debug (LOG_CRIT, "bjnp_process_udp_command: Sent only %d bytes of packet",
- numbytes);
- }
-
-
- FD_ZERO (&fdset);
- FD_SET (sockfd, &fdset);
- timeout.tv_sec = 3;
- timeout.tv_usec = 0;
-
- if (select (sockfd + 1, &fdset, NULL, NULL, &timeout) <= 0)
- {
- /* no data recieved OR error, in either case retry */
- continue;
- }
-
- if ((numbytes = recv (sockfd, response, sizeof(*response), MSG_WAITALL)) == -1)
- {
- bjnp_debug (LOG_CRIT, "bjnp_process_udp_command: no data received (recv)");
- continue;
- }
- close (sockfd);
- return numbytes;
+ for (attempt = 0; attempt < 3; attempt++) {
+ if ((numbytes = send(sockfd, command, cmd_len, 0)) != cmd_len) {
+ bjnp_debug(LOG_CRIT, "bjnp_process_udp_command: Sent only %d bytes of packet",
+ numbytes);
+ }
+
+ FD_ZERO(&fdset);
+ FD_SET(sockfd, &fdset);
+ timeout.tv_sec = 3;
+ timeout.tv_usec = 0;
+
+ if (select(sockfd + 1, &fdset, NULL, NULL, &timeout) <= 0) {
+ /* no data received OR error, in either case retry */
+ continue;
+ }
+
+ if ((numbytes = recv(sockfd, response, sizeof(*response), MSG_WAITALL)) == -1) {
+ bjnp_debug(LOG_CRIT, "bjnp_process_udp_command: no data received (recv)");
+ continue;
+ }
+
+ close(sockfd);
+ return numbytes;
}
- /* max tries reached, return failure */
- close (sockfd);
- return -1;
+
+ /* max attempts reached, return failure */
+ close(sockfd);
+ return -1;
}
int
-get_printer_id (http_addr_t * addr, char *model, char *IEEE1284_id)
+get_printer_id(http_addr_t *addr, char *model, char *IEEE1284_id)
{
- /*
- * get printer identity
- * Sets model (make and model) and IEEE1284_id
- */
+ /*
+ * get printer identity
+ * Sets model (make and model) and IEEE1284_id
+ */
- bjnp_command_t cmd;
- bjnp_response_t id;
- char printer_id[BJNP_IEEE1284_MAX];
- int resp_len;
- int id_len;
- int min_size;
+ bjnp_command_t cmd;
+ bjnp_response_t id;
+ char printer_id[BJNP_IEEE1284_MAX];
+ int resp_len;
+ int id_len;
+ int min_size;
- /* set defaults */
+ /* set defaults */
- strcpy (model, "Unidentified printer");
- strcpy (IEEE1284_id, "");
+ strcpy(model, "Unidentified printer");
+ strcpy(IEEE1284_id, "");
- clear_cmd(&cmd);
- bjnp_set_command_header (&cmd, CMD_UDP_GET_ID, 0, sizeof(cmd.udp_get_id) );
+ clear_cmd(&cmd);
+ bjnp_defaults_set_command_header(&cmd, CMD_UDP_GET_ID, sizeof(cmd.udp_get_id));
- bjnp_hexdump (LOG_DEBUG2, "Get printer identity", (char *) &cmd,
- sizeof (cmd.udp_get_id));
+ bjnp_hexdump(LOG_DEBUG2, "Get printer identity", (char *) &cmd,
+ sizeof(cmd.udp_get_id));
- resp_len =
- bjnp_process_udp_command (addr, &cmd, sizeof (cmd.udp_get_id),
- &id);
+ resp_len =
+ bjnp_process_udp_command(addr, &cmd, sizeof(cmd.udp_get_id),
+ &id);
- min_size = bjnp_header_size + sizeof( id.udp_identity_response.id_len);
- if ( resp_len <= min_size )
- {
- return -1;
+ min_size = bjnp_header_size + sizeof(id.udp_identity_response.id_len);
+
+ if (resp_len <= min_size) {
+ return -1;
}
- bjnp_hexdump (LOG_DEBUG2, "Printer identity:", &id, resp_len);
+ bjnp_hexdump(LOG_DEBUG2, "Printer identity:", &id, resp_len);
+
+ id_len = ntohs(id.udp_identity_response.id_len) - sizeof(
+ id.udp_identity_response.id_len);
- id_len = ntohs (id.udp_identity_response.id_len) - sizeof (id.udp_identity_response.id_len);
+ /* check id_len */
- if ( (id_len < 0) || (id_len > (resp_len - bjnp_header_size) ) || ( id_len > BJNP_IEEE1284_MAX) )
- {
- bjnp_debug( LOG_DEBUG, "Id - length recieved is invalid: %d (total response length = %d\n",
- id_len, resp_len);
- return -1;
- }
+ if ((id_len < 0) || (id_len > (resp_len - bjnp_header_size)) ||
+ (id_len > BJNP_IEEE1284_MAX)) {
+ bjnp_debug(LOG_ERROR,
+ "Id - length received is invalid: %d (total response length = %d\n",
+ id_len, resp_len);
+ return -1;
+ }
- /* set IEEE1284_id */
+ /* set IEEE1284_id */
- strncpy (printer_id, id.udp_identity_response.id, id_len);
- printer_id[id_len] = '\0';
+ if (printer_id != NULL) {
+ strncpy(printer_id, id.udp_identity_response.id, id_len);
+ printer_id[id_len] = '\0';
+ }
- bjnp_debug (LOG_INFO, "Identity = %s\n", printer_id);
+ bjnp_debug(LOG_INFO, "Identity = %s\n", printer_id);
- if (IEEE1284_id != NULL)
- strcpy (IEEE1284_id, printer_id);
+ if (IEEE1284_id != NULL) {
+ strcpy(IEEE1284_id, printer_id);
+ }
- /* get make&model from IEEE1284 id */
+ /* get make&model from IEEE1284 id */
- if (model != NULL)
- {
- parse_IEEE1284_to_model (printer_id, model);
- bjnp_debug (LOG_DEBUG, "Printer model = %s\n", model);
+ if (model != NULL) {
+ model[0] = '\0';
+ parse_IEEE1284_to_model(printer_id, model);
+ bjnp_debug(LOG_DEBUG, "Printer model = %s\n", model);
}
- return 0;
+
+ return 0;
}
-bjnp_paper_status_t
-bjnp_get_paper_status (http_addr_t * addr)
+int
+bjnp_get_status(printer_t *printer, char *status_buf)
{
- /*
- * get printer paper status
- */
+ /*
+ * get printer status
+ */
- bjnp_command_t cmd;
- bjnp_response_t response;
- int resp_len;
+ bjnp_command_t cmd;
+ bjnp_response_t response;
+ int resp_len;
+ uint32_t status_len;
- /* set defaults */
-
- clear_cmd(&cmd);
- bjnp_set_command_header (&cmd, CMD_UDP_GET_STATUS, 0, sizeof(cmd.udp_get_status) );
+ /* set defaults */
- bjnp_hexdump (LOG_DEBUG2, "Get printer status", (char *) &cmd,
- sizeof (cmd.udp_get_status));
+ clear_cmd(&cmd);
+ bjnp_printer_set_command_header(printer, &cmd, CMD_UDP_GET_STATUS,
+ sizeof(cmd.udp_get_status));
- resp_len =
- bjnp_process_udp_command (addr, &cmd, sizeof (cmd.udp_get_status),
- &response);
+ bjnp_hexdump(LOG_DEBUG2, "Get printer status", (char *) &cmd,
+ sizeof(cmd.udp_get_status));
- if (resp_len <= 0)
- return BJNP_PAPER_UNKNOWN;
+ resp_len =
+ bjnp_process_udp_command(&(printer->printer_sa), &cmd,
+ sizeof(cmd.udp_get_status),
+ &response);
- bjnp_hexdump (LOG_DEBUG2, "Printer status:", &response, resp_len);
+ if (resp_len <= 0) {
+ return BJNP_IO_ERROR;
+ }
- return parse_status_to_paperout ( ntohs(response.udp_status_response.status_len), response.udp_status_response.status);
+ bjnp_hexdump(LOG_DEBUG2, "Printer status:", &response, resp_len);
-}
+ status_len = ntohl(response.udp_status_response.header.payload_len);
-int bjnp_send_job_details (http_addr_t *addr, char *user, char *title )
-{
-/*
- * send details of printjob to printer
- * Returns: 0 = ok, -1 = error
- */
+ if (status_len >= BJNP_STATUS_MAX || status_len < 16) {
+ bjnp_debug(LOG_ERROR, "Get printer status: ERROR, invalid response length (%d)\n", status_len);
+ return BJNP_IO_ERROR;
+ }
- char hostname[BJNP_HOST_MAX];
- int resp_len;
- bjnp_command_t cmd;
- bjnp_response_t resp;
+ if (status_len != (resp_len - sizeof(response.udp_status_response.header))) {
+ bjnp_debug(LOG_ERROR,
+ "status length (%d) does not match response length (%d)!!\n", status_len,
+ resp_len - sizeof(response.udp_status_response.header));
+ return BJNP_IO_ERROR;
+ }
- /* send job details command */
+ /* check which version of the response we received */
- clear_cmd(&cmd);
- bjnp_set_command_header (&cmd, CMD_UDP_PRINT_JOB_DET, 0,
- sizeof (cmd.udp_job_details) );
+ if (strncmp(response.udp_status_response_v2.status, "<?xml", 5) == 0) {
- /* create payload */
+ /* version 2 of the status response */
- gethostname (hostname, BJNP_HOST_MAX - 1);
+ response.udp_status_response_v2.status[status_len] = '\0';
+ strcpy(status_buf, response.udp_status_response_v2.status);
+ } else {
+ /* old format response message */
+ status_len = status_len - sizeof(response.udp_status_response.status_len);
+ response.udp_status_response.status[status_len] = '\0';
+ strcpy(status_buf, response.udp_status_response.status);
+ }
- charTo2byte (cmd.udp_job_details.unknown, "", sizeof (cmd.udp_job_details.unknown));
- charTo2byte (cmd.udp_job_details.hostname, hostname, sizeof (cmd.udp_job_details.hostname));
- charTo2byte (cmd.udp_job_details.username, user, sizeof (cmd.udp_job_details.username));
- charTo2byte (cmd.udp_job_details.jobtitle, title, sizeof (cmd.udp_job_details));
+ bjnp_debug(LOG_INFO, "Printer status: %s\n", status_buf);
+ return BJNP_OK;
+}
- bjnp_hexdump (LOG_DEBUG2, "Job details", &cmd,
- sizeof(cmd.udp_job_details));
- resp_len = bjnp_process_udp_command (addr, &cmd, sizeof(cmd.udp_job_details), &resp);
+int bjnp_send_job_details(http_addr_t *addr, const char *user, const char *title)
+{
+ /*
+ * send details of printjob to printer
+ * Returns: 0 = ok, -1 = error
+ */
+
+ char hostname[BJNP_HOST_MAX];
+ int resp_len;
+ bjnp_command_t cmd;
+ bjnp_response_t resp;
+ int session_id = 0;
+
+ /* send job details command */
+
+ clear_cmd(&cmd);
+ bjnp_defaults_set_command_header(&cmd, CMD_UDP_PRINT_JOB_DET,
+ sizeof(cmd.udp_job_details));
+
+ /* create payload */
+
+ gethostname(hostname, BJNP_HOST_MAX - 1);
+
+ charTo2byte(cmd.udp_job_details.unknown, "",
+ sizeof(cmd.udp_job_details.unknown));
+ charTo2byte(cmd.udp_job_details.hostname, hostname,
+ sizeof(cmd.udp_job_details.hostname));
+ charTo2byte(cmd.udp_job_details.username, user,
+ sizeof(cmd.udp_job_details.username));
+ charTo2byte(cmd.udp_job_details.jobtitle, title, sizeof(cmd.udp_job_details));
+
+ bjnp_hexdump(LOG_DEBUG2, "Job details", &cmd,
+ sizeof(cmd.udp_job_details));
+ resp_len = bjnp_process_udp_command(addr, &cmd, sizeof(cmd.udp_job_details),
+ &resp);
+
+ if (resp_len > 0) {
+ bjnp_hexdump(LOG_DEBUG2, "Job details response:", &resp,
+ resp_len);
+ session_id = ntohs(resp.udp_print_job_details_response.header.session_id);
+ return session_id;
+ }
- if (resp_len > 0)
- {
- bjnp_hexdump (LOG_DEBUG2, "Job details response:", &resp,
- resp_len);
- session_id = ntohs (resp.udp_print_job_details_response.header.session_id);
- return 0;
- }
- return -1;
+ return -1;
}
-int bjnp_send_close( http_addr_t *addr)
+int bjnp_send_close(printer_t *printer)
{
-/*
- * Signal end of printjob to printer
- */
-
- int resp_len;
- bjnp_command_t cmd;
- bjnp_response_t resp;
-
- clear_cmd(&cmd);
- bjnp_set_command_header (&cmd, CMD_UDP_CLOSE, session_id, sizeof(cmd.udp_close) );
-
- bjnp_hexdump (LOG_DEBUG2, "bjnp_send_close", (char *) &cmd,
- sizeof( cmd.udp_close));
- resp_len =
- bjnp_process_udp_command (addr, &cmd, sizeof (cmd.udp_close),
- &resp);
-
- if (resp_len != sizeof (resp.udp_close_response))
- {
- bjnp_debug (LOG_CRIT,
- "Received %d characters in close response, expected %d\n",
- resp_len, sizeof (resp.udp_close_response));
- return -1;
+ /*
+ * Signal end of printjob to printer
+ */
+
+ int resp_len;
+ bjnp_command_t cmd;
+ bjnp_response_t resp;
+
+ clear_cmd(&cmd);
+ bjnp_printer_set_command_header(printer, &cmd, CMD_UDP_CLOSE, sizeof(cmd.udp_close));
+
+ bjnp_hexdump(LOG_DEBUG2, "bjnp_send_close", (char *) &cmd,
+ sizeof(cmd.udp_close));
+ resp_len =
+ bjnp_process_udp_command(&(printer->printer_sa), &cmd, sizeof(cmd.udp_close),
+ &resp);
+
+ if (resp_len != sizeof(resp.udp_close_response)) {
+ bjnp_debug(LOG_CRIT,
+ "Received %d characters in close response, expected %d\n",
+ resp_len, sizeof(resp.udp_close_response));
+ return -1;
}
- bjnp_hexdump (LOG_DEBUG2, "Finish printjob response", &resp, resp_len);
- return 0;
+
+ bjnp_hexdump(LOG_DEBUG2, "Finish printjob response", &resp, resp_len);
+ return 0;
}
diff --git a/bjnp-commands.h b/bjnp-commands.h
new file mode 100644
index 0000000..49dc2b3
--- /dev/null
+++ b/bjnp-commands.h
@@ -0,0 +1,34 @@
+/*
+ * Low level TCP and UDP command function definitions for
+ * bjnp backend for the Common UNIX Printing System (CUPS).
+ * Copyright 2008-2014 by Louis Lagendijk
+ *
+ * This program 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; version 2 only.
+ *
+ * This program 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 <http://www.gnu.org/licenses/>.
+ */
+#ifndef _CUPS_BJNP_COMMANDS_H_
+#define _CUPS_BJNP_COMMANDS_H_
+
+/*
+ * bjnp-commands.c
+ */
+void clear_cmd(bjnp_command_t *cmd);
+int bjnp_printer_set_command_header(printer_t *printer, bjnp_command_t *cmd,
+ char cmd_code, int payload_len);
+void bjnp_defaults_set_command_header(bjnp_command_t *cmd,
+ char cmd_code, int payload_len);
+int get_printer_id(http_addr_t *addr, char *model, char *IEEE1284_id);
+int bjnp_get_status(printer_t *printer, char *status_buf);
+int bjnp_send_job_details(http_addr_t *addr, const char *user, const char *title);
+int bjnp_send_close(printer_t *printer);
+#endif
+
diff --git a/bjnp-debug.c b/bjnp-debug.c
index 05c52f4..a1da85d 100644
--- a/bjnp-debug.c
+++ b/bjnp-debug.c
@@ -1,19 +1,20 @@
/*
- * debug support code
- * Part of:
- * bjnp backend for the Common UNIX Printing System (CUPS).
- * Copyright 2008 by Louis Lagendijk
+ * debug support code
+ * Part of:
+ * bjnp backend for the Common UNIX Printing System (CUPS).
+ * Copyright 2008-2014 by Louis Lagendijk
*
- * These coded instructions, statements, and computer programs are the
- * property of Louis Lagendijk and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * "LICENSE" which should have been included with this file. If this
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * This program 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; version 2 only.
*
- * This file is subject to the Apple OS-Developed Software exception.
+ * This program 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.
*
- * Contents:
- * <to be added>
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -31,242 +32,237 @@
-typedef struct
-{
- bjnp_loglevel_t level;
- char string[10];
+typedef struct {
+ bjnp_loglevel_t level;
+ char string[10];
} logtable_entry_t;
static logtable_entry_t logtable[] = {
- {LOG_NONE, "NONE"},
- {LOG_EMERG, "EMERG"},
- {LOG_ALERT, "ALERT"},
- {LOG_CRIT, "CRIT"},
- {LOG_ERROR, "ERROR"},
- {LOG_WARN, "WARNING"},
- {LOG_NOTICE,"NOTICE"},
- {LOG_INFO, "INFO"},
- {LOG_DEBUG, "DEBUG"},
- {LOG_DEBUG2,"DEBUG2"},
- {LOG_END, ""}
+ {LOG_NONE, "NONE"},
+ {LOG_EMERG, "EMERG"},
+ {LOG_ALERT, "ALERT"},
+ {LOG_CRIT, "CRIT"},
+ {LOG_ERROR, "ERROR"},
+ {LOG_WARN, "WARNING"},
+ {LOG_NOTICE, "NOTICE"},
+ {LOG_INFO, "INFO"},
+ {LOG_DEBUG, "DEBUG"},
+ {LOG_DEBUG2, "DEBUG2"},
+ {LOG_END, ""}
};
-/*
- * static data
+/*
+ * static data
*/
static bjnp_loglevel_t debug_level = LOG_ERROR;
-static int to_cups = 0;
static FILE *debug_file = NULL;
static time_t start_sec = 0;
static int start_msec;
-/*
+/*
* local functions
*/
#ifndef NDEBUG
static void
-u8tohex (uint8_t x, char *str)
+u8tohex(uint8_t x, char *str)
{
- static const char hdigit[16] =
- { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd',
- 'e', 'f'
- };
- str[0] = hdigit[(x >> 4) & 0xf];
- str[1] = hdigit[x & 0xf];
- str[2] = '\0';
+ static const char hdigit[16] = {
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
+ };
+ str[0] = hdigit[(x >> 4) & 0xf];
+ str[1] = hdigit[x & 0xf];
+ str[2] = '\0';
}
static void
-u8tochar (uint8_t x, char *str)
+u8tochar(uint8_t x, char *str)
{
- if ((x > 0x20) && (x < 0x7f))
- str[0] = (char) x;
- else
- str[0] = (char) '.';
+ if ((x > 0x20) && (x < 0x7f)) {
+ str[0] = (char) x;
+ } else {
+ str[0] = (char) '.';
+ }
}
static void
-u32tohex (uint32_t x, char *str)
+u32tohex(uint32_t x, char *str)
{
- u8tohex (x >> 24, str);
- u8tohex (x >> 16, str + 2);
- u8tohex (x >> 8, str + 4);
- u8tohex (x, str + 6);
+ u8tohex(x >> 24, str);
+ u8tohex(x >> 16, str + 2);
+ u8tohex(x >> 8, str + 4);
+ u8tohex(x, str + 6);
}
char *
-level2str (bjnp_loglevel_t level)
+level2str(bjnp_loglevel_t level)
{
- int i;
- for (i = 0; logtable[i].level != LOG_END; i++)
- {
- if (logtable[i].level == level)
- return logtable[i].string;
+ int i;
+
+ for (i = 0; logtable[i].level != LOG_END; i++) {
+ if (logtable[i].level == level) {
+ return logtable[i].string;
+ }
}
- return "UNDEF";
+
+ return "UNDEF";
}
bjnp_loglevel_t
-str2level (const char *level)
+str2level(const char *level)
{
- int i;
+ int i;
- for (i = 0; strlen (logtable[i].string) != 0; i++)
- {
- if (strncasecmp (level, logtable[i].string, 10) == 0)
- return logtable[i].level;
+ for (i = 0; strlen(logtable[i].string) != 0; i++) {
+ if (strncasecmp(level, logtable[i].string, 10) == 0) {
+ return logtable[i].level;
+ }
}
- return LOG_END;
+
+ return LOG_END;
}
void
-bjnp_hexdump (bjnp_loglevel_t level, char *header, const void *d_,
- unsigned len)
+bjnp_hexdump(bjnp_loglevel_t level, char *header, const void *d_,
+ unsigned len)
{
- const uint8_t *d = (const uint8_t *) (d_);
- unsigned ofs, c;
- char line[100]; /* actually only 1+8+1+8*3+1+8*3+1+4+16 = 80 bytes needed */
-
- if (level > debug_level)
- return;
-
-
- bjnp_debug (level, "%s\n", header);
- ofs = 0;
- while (ofs < len)
- {
- char *p;
-
- memset (line, ' ', sizeof (line));
-
- line[0] = ' ';
- u32tohex (ofs, line + 1);
- line[9] = ':';
- p = line + 10;
- for (c = 0; c != 16 && (ofs + c) < len; c++)
- {
- u8tohex (d[ofs + c], p);
- p[2] = ' ';
- p += 3;
- if (c == 7)
- {
- p[0] = ' ';
- p++;
- }
- }
- p[0] = p[1] = p[2] = ' ';
- p = line + 61;
- for (c = 0; c != 16 && (ofs + c) < len; c++)
- {
- u8tochar (d[ofs + c], p);
-
- p++;
- if (c == 7)
- {
- p[0] = ' ';
- p++;
- }
- }
-
- p[0] = '\0';
- bjnp_debug (level, "%s\n", line);
- ofs += c;
+ const uint8_t *d = (const uint8_t *)(d_);
+ unsigned ofs, c;
+ char line[100]; /* actually only 1+8+1+8*3+1+8*3+1+4+16 = 80 bytes needed */
+
+ if (level > debug_level) {
+ return;
}
- bjnp_debug (level, "\n\n");
+
+
+ bjnp_debug(level, "%s\n", header);
+ ofs = 0;
+
+ while (ofs < len) {
+ char *p;
+
+ memset(line, ' ', sizeof(line));
+
+ line[0] = ' ';
+ u32tohex(ofs, line + 1);
+ line[9] = ':';
+ p = line + 10;
+
+ for (c = 0; c != 16 && (ofs + c) < len; c++) {
+ u8tohex(d[ofs + c], p);
+ p[2] = ' ';
+ p += 3;
+
+ if (c == 7) {
+ p[0] = ' ';
+ p++;
+ }
+ }
+
+ p[0] = p[1] = p[2] = ' ';
+ p = line + 61;
+
+ for (c = 0; c != 16 && (ofs + c) < len; c++) {
+ u8tochar(d[ofs + c], p);
+
+ p++;
+
+ if (c == 7) {
+ p[0] = ' ';
+ p++;
+ }
+ }
+
+ p[0] = '\0';
+ bjnp_debug(level, "%s\n", line);
+ ofs += c;
+ }
+
+ bjnp_debug(level, "\n\n");
}
#endif /* NDEBUG */
void
-bjnp_debug (bjnp_loglevel_t level, const char *fmt, ...)
+bjnp_debug(bjnp_loglevel_t level, const char *fmt, ...)
{
- va_list ap;
- char printbuf[256];
- struct timeb timebuf;
- int sec;
- int msec;
-
- /* print received data into a string */
- va_start (ap, fmt);
- vsnprintf (printbuf, sizeof (printbuf), fmt, ap);
- va_end (ap);
-
- /* we only send real errors & warnings to the cups logging facility, unless explicitely asked */
-
- if ((level <= LOG_WARN) || to_cups)
- fprintf (stderr, "%s: %s", level2str (level), printbuf);
-
- /* other log messages may go to the own logfile */
-
- if ((level <= debug_level) && debug_file)
- {
- ftime (&timebuf);
- if ((msec = timebuf.millitm - start_msec) < 0)
- {
- msec += 1000;
- timebuf.time -= 1;
- }
- sec = timebuf.time - start_sec;
-
- fprintf (debug_file, "%8s: %03d.%03d %s", level2str (level), sec, msec,
- printbuf);
+ va_list ap;
+ char printbuf[1024];
+ struct timeb timebuf;
+ int sec;
+ int msec;
+
+ if (level <= debug_level) {
+ /* print received data into a string */
+ va_start(ap, fmt);
+ vsnprintf(printbuf, sizeof(printbuf), fmt, ap);
+ va_end(ap);
+
+ /* we only send real errors & warnings to the cups logging facility */
+
+ if (level <= LOG_WARN) {
+ fprintf(stderr, "%s: %s", level2str(level), printbuf);
+ }
+
+ /* all log messages may go to the own logfile */
+
+ if (debug_file != NULL) {
+ ftime(&timebuf);
+
+ if ((msec = timebuf.millitm - start_msec) < 0) {
+ msec += 1000;
+ timebuf.time -= 1;
+ }
+
+ sec = timebuf.time - start_sec;
+
+ fprintf(debug_file, "%8s: %03d.%03d %s", level2str(level), sec, msec,
+ printbuf);
+ fflush(debug_file);
+ }
}
}
void
-bjnp_set_debug_level (const char *level)
+bjnp_set_debug_level(const char *level, const char *filename)
{
- /*
- * set debug level to level (string)
- */
-
- struct timeb timebuf;
- char loglevel[16];
- char *separator;
-
- ftime (&timebuf);
- start_sec = timebuf.time;
- start_msec = timebuf.millitm;
-
- /*
- * Split string into loglevel and optional cupslog string
- */
-
- to_cups = 0;
-
- /*
- * Set log level
- */
-
- if (level == NULL)
- debug_level = LOG_ERROR;
- else
- {
- strncpy (loglevel, level, 15);
- loglevel[15] = '\0';
-
- separator = strchr(loglevel, '_');
- if (separator)
- {
- *separator = '\0';
- separator++;
-
- /* any input after the _ will set logging to the cups-log */
-
- if (strlen(separator) > 0)
- to_cups = 1;
- }
- debug_level = str2level (level);
+ /*
+ * set debug level to level (string)
+ */
+
+ struct timeb timebuf;
+ char loglevel[16];
+
+ ftime(&timebuf);
+ start_sec = timebuf.time;
+ start_msec = timebuf.millitm;
+
+ /*
+ * Set log level
+ */
+
+ if (level == NULL) {
+ debug_level = LOG_ERROR;
+ } else {
+ strncpy(loglevel, level, 15);
+ loglevel[15] = '\0';
+ debug_level = str2level(loglevel);
+ }
+
+ if (filename == NULL) {
+ filename = CUPS_LOGDIR "/" LOGFILE;
}
+ if ((debug_file = fopen(filename, "w")) == NULL) {
+ bjnp_debug(LOG_WARN,
+ "Cannot open logfile: %s - %s\n",
+ filename, strerror(errno));
+ return;
+ }
- if ((debug_file = fopen (CUPS_LOGDIR "/" LOGFILE, "w")) == NULL)
- bjnp_debug(LOG_WARN, "Can not open logfile: %s - %s\n",
- CUPS_LOGDIR "/" LOGFILE, strerror(errno));
-
- bjnp_debug (LOG_INFO, "BJNP debug level = %s\n", level2str (debug_level));
+ bjnp_debug(LOG_WARN, "BJNP logging to %s, debug level = %s\n", filename, level2str(debug_level));
}
diff --git a/bjnp-discover.c b/bjnp-discover.c
index 9f005aa..eccddd3 100644
--- a/bjnp-discover.c
+++ b/bjnp-discover.c
@@ -1,522 +1,526 @@
/*
- * TCP/IP IO communication implementation for
- * bjnp backend for the Common UNIX Printing System (CUPS).
- * Copyright 2008 by Louis Lagendijk
+ * Printer discovery implementation for
+ * bjnp backend for the Common UNIX Printing System (CUPS).
+ * Copyright 2008-2014 by Louis Lagendijk
*
- * These coded instructions, statements, and computer programs are the
- * property of Louis Lagendijk and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * "LICENSE" which should have been included with this file. If this
- * file is missing or damaged, see the license at "http://www.cups.org/".
*
- * This file is subject to the Apple OS-Developed Software exception.
+ * This program 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; version 2 only.
*
- * Contents:
- * <to be added>
+ * This program 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 <http://www.gnu.org/licenses/>.
*/
-#include "bjnp.h"
+#include "config.h"
#include <errno.h>
#include <sys/types.h>
+#include <sys/socket.h>
#include <net/if.h>
#ifdef HAVE_GETIFADDRS
#include <ifaddrs.h>
#endif
+#include "bjnp.h"
#include "bjnp-protocol.h"
+#include "bjnp-commands.h"
-static int create_broadcast_socket( const http_addr_t * local_addr )
+static int create_broadcast_socket(const http_addr_t *local_addr)
{
- int sockfd = -1;
- int broadcast = 1;
- int ipv6_v6only = 1;
+ int sockfd = -1;
+ int broadcast = 1;
+ int ipv6_v6only = 1;
- if ((sockfd = socket (local_addr-> addr.sa_family, SOCK_DGRAM, 0)) == -1)
- {
- bjnp_debug
- (LOG_CRIT, "create_broadcast_socket: can not open socket - %s",
- strerror (errno));
- return -1;
+ if ((sockfd = socket(local_addr-> addr.sa_family, SOCK_DGRAM, 0)) == -1) {
+ bjnp_debug
+ (LOG_CRIT, "create_broadcast_socket: cannot open socket - %s",
+ strerror(errno));
+ return -1;
}
- /* Set broadcast flag on socket */
-
- if (setsockopt
- (sockfd, SOL_SOCKET, SO_BROADCAST, (const char *) &broadcast,
- sizeof (broadcast)) != 0)
- {
- bjnp_debug
- (LOG_CRIT,
- "create_broadcast_socket: setting socket option SO_BROADCAST failed - %s",
- strerror (errno));
- close (sockfd);
- return -1;
+ /* Set broadcast flag on socket */
+
+ if (setsockopt
+ (sockfd, SOL_SOCKET, SO_BROADCAST, (const char *) &broadcast,
+ sizeof(broadcast)) != 0) {
+ bjnp_debug
+ (LOG_CRIT,
+ "create_broadcast_socket: setting socket option SO_BROADCAST failed - %s",
+ strerror(errno));
+ close(sockfd);
+ return -1;
};
#ifdef ENABLE_IPV6
- /* For an IPv6 socket, bind to v6 only so a V6 socket can co-exist with a v4 socket */
- if ( (local_addr -> addr.sa_family == AF_INET6) && ( setsockopt
- (sockfd, IPPROTO_IPV6, IPV6_V6ONLY, (const char *) &ipv6_v6only,
- sizeof (ipv6_v6only)) != 0) )
- {
- bjnp_debug
- (LOG_CRIT,
- "create_broadcast_socket: setting socket option IPV6_V6ONLY failed - %s",
- strerror (errno));
- close (sockfd);
- return -1;
+
+ /* For an IPv6 socket, bind to v6 only so a V6 socket can co-exist with a v4 socket */
+ if ((local_addr -> addr.sa_family == AF_INET6) && (setsockopt
+ (sockfd, IPPROTO_IPV6, IPV6_V6ONLY, (const char *) &ipv6_v6only,
+ sizeof(ipv6_v6only)) != 0)) {
+ bjnp_debug
+ (LOG_CRIT,
+ "create_broadcast_socket: setting socket option IPV6_V6ONLY failed - %s",
+ strerror(errno));
+ close(sockfd);
+ return -1;
};
+
#endif
- if (bind
- (sockfd, &(local_addr->addr),
- (socklen_t) sa_size( local_addr)) != 0)
- {
- bjnp_debug
- (LOG_CRIT,
- "create_broadcast_socket: bind socket to local address failed - %s\n",
- strerror (errno));
- close (sockfd);
- return -1;
+ if (bind(sockfd, &(local_addr->addr), (socklen_t) sa_size(*local_addr)) != 0) {
+ bjnp_debug
+ (LOG_CRIT,
+ "create_broadcast_socket: bind socket to local address failed - %s\n",
+ strerror(errno));
+ close(sockfd);
+ return -1;
}
- return sockfd;
+
+ return sockfd;
}
-static int
-prepare_socket(const char *if_name, const http_addr_t *local_sa,
- const http_addr_t *broadcast_sa, http_addr_t * dest_sa)
+static int
+prepare_socket(const char *if_name, const http_addr_t *local_sa,
+ const http_addr_t *broadcast_sa, http_addr_t *dest_sa)
{
- /*
- * Prepare a socket for broadcast or multicast
- * Input:
- * if_name: the name of the interface
- * local_sa: local address to use
- * broadcast_sa: broadcast address to use, if NULL we use all hosts
- * dest_sa: (write) where to return destination address of broadcast
- * retuns: open socket or -1
- */
-
- int socket = -1;
- http_addr_t local_sa_copy;
-
- if ( local_sa == NULL )
- {
- bjnp_debug (LOG_DEBUG,
- "%s is not a valid IPv4 interface, skipping...\n",
- if_name);
- return -1;
+ /*
+ * Prepare a socket for broadcast or multicast
+ * Input:
+ * if_name: the name of the interface
+ * local_sa: local address to use
+ * broadcast_sa: broadcast address to use, if NULL we use all hosts
+ * dest_sa: (write) where to return destination address of broadcast
+ * retuns: open socket or -1
+ */
+
+ int socket = -1;
+ http_addr_t local_sa_copy;
+
+ if (local_sa == NULL) {
+ bjnp_debug(LOG_DEBUG,
+ "%s is not a valid IPv4 interface, skipping...\n",
+ if_name);
+ return -1;
}
- memset( &local_sa_copy, 0, sizeof(local_sa_copy) );
- memcpy( &local_sa_copy, local_sa, sa_size(local_sa) );
+ memset(&local_sa_copy, 0, sizeof(local_sa_copy));
+ memcpy(&local_sa_copy, local_sa, sa_size(*local_sa));
- switch( local_sa_copy.addr.sa_family )
- {
- case AF_INET:
- {
- local_sa_copy.ipv4.sin_port = htons(BJNP_PORT_PRINT);
+ switch (local_sa_copy.addr.sa_family) {
+ case AF_INET: {
+ local_sa_copy.ipv4.sin_port = htons(BJNP_PORT_PRINT);
- if (local_sa_copy.ipv4.sin_addr.s_addr == htonl (INADDR_LOOPBACK) )
- {
- /* not a valid interface */
+ if (local_sa_copy.ipv4.sin_addr.s_addr == htonl(INADDR_LOOPBACK)) {
+ /* not a valid interface */
- bjnp_debug (LOG_DEBUG,
+ bjnp_debug(LOG_DEBUG,
"%s is not a valid IPv4 interface, skipping...\n",
- if_name);
- return -1;
- }
+ if_name);
+ return -1;
+ }
- /* send broadcasts to the broadcast address of the interface */
+ /* send broadcasts to the broadcast address of the interface */
- memcpy(dest_sa, broadcast_sa, sa_size(dest_sa) );
- dest_sa -> ipv4.sin_port = htons(BJNP_PORT_PRINT);
- if ( (socket = create_broadcast_socket( &local_sa_copy) ) != -1)
- {
- bjnp_debug (LOG_DEBUG, "%s is IPv4 capable, sending broadcast, socket = %d\n",
- if_name, socket);
- }
- else
- {
- bjnp_debug (LOG_DEBUG, "%s is IPv4 capable, but failed to create a socket.\n",
- if_name);
- return -1;
+ memcpy(dest_sa, broadcast_sa, sa_size(*dest_sa));
+ dest_sa -> ipv4.sin_port = htons(BJNP_PORT_PRINT);
+
+ if ((socket = create_broadcast_socket(&local_sa_copy)) != -1) {
+ bjnp_debug(LOG_DEBUG, "%s is IPv4 capable, sending broadcast, socket = %d\n",
+ if_name, socket);
+ } else {
+ bjnp_debug(LOG_DEBUG, "%s is IPv4 capable, but failed to create a socket.\n",
+ if_name);
+ return -1;
+ }
}
- }
- break;
+ break;
#ifdef ENABLE_IPV6
- case AF_INET6:
- {
- local_sa_copy.ipv6.sin6_port = htons(BJNP_PORT_PRINT);
- if (IN6_IS_ADDR_LOOPBACK( &(local_sa_copy.ipv6.sin6_addr) ) )
- {
- /* not a valid interface */
+ case AF_INET6: {
+ local_sa_copy.ipv6.sin6_port = htons(BJNP_PORT_PRINT);
- bjnp_debug (LOG_DEBUG,
+ if (IN6_IS_ADDR_LOOPBACK(&(local_sa_copy.ipv6.sin6_addr))) {
+ /* not a valid interface */
+
+ bjnp_debug(LOG_DEBUG,
"%s is not a valid IPv6 interface, skipping...\n",
- if_name);
- return -1;
- }
- else
- {
- dest_sa -> ipv6.sin6_family = AF_INET6;
- dest_sa -> ipv6.sin6_port = htons(BJNP_PORT_PRINT);
- inet_pton(AF_INET6, "ff02::1", dest_sa -> ipv6.sin6_addr.s6_addr);
- if ( (socket = create_broadcast_socket( &local_sa_copy ) ) != -1)
- {
- bjnp_debug (LOG_DEBUG, "%s is IPv6 capable, sending broadcast, socket = %d\n",
- if_name, socket);
- }
- else
- {
- bjnp_debug (LOG_DEBUG, "%s is IPv6 capable, but failed to create a socket.\n",
- if_name);
- return -1;
+ if_name);
+ return -1;
+ } else {
+ dest_sa -> ipv6.sin6_family = AF_INET6;
+ dest_sa -> ipv6.sin6_port = htons(BJNP_PORT_PRINT);
+ inet_pton(AF_INET6, "ff02::1", dest_sa -> ipv6.sin6_addr.s6_addr);
+
+ if ((socket = create_broadcast_socket(&local_sa_copy)) != -1) {
+ bjnp_debug(LOG_DEBUG, "%s is IPv6 capable, sending broadcast, socket = %d\n",
+ if_name, socket);
+ } else {
+ bjnp_debug(LOG_DEBUG, "%s is IPv6 capable, but failed to create a socket.\n",
+ if_name);
+ return -1;
+ }
}
}
- }
- break;
+ break;
#endif
- default:
- socket = -1;
+ default:
+ socket = -1;
}
- return socket;
+
+ return socket;
}
static int
-bjnp_send_broadcast (int sockfd, const http_addr_t * broadcast_addr,
- bjnp_command_t cmd, int size)
+bjnp_send_broadcast(int sockfd, const http_addr_t *broadcast_addr,
+ bjnp_command_t cmd, int size)
{
- int num_bytes;
+ int num_bytes;
- /* set address to send packet to */
- /* usebroadcast address of interface */
+ /* set address to send packet to */
+ /* usebroadcast address of interface */
- if ((num_bytes = sendto (sockfd, &cmd, size, 0,
- &(broadcast_addr->addr),
- sa_size( broadcast_addr)) ) != size)
- {
- bjnp_debug (LOG_DEBUG,
- "bjnp_send_broadcast: Socket: %d: sent only %x = %d bytes of packet, error = %s\n",
- sockfd, num_bytes, num_bytes, strerror (errno));
- /* not allowed, skip this interface */
+ if ((num_bytes = sendto(sockfd, &cmd, size, 0,
+ &(broadcast_addr->addr),
+ sa_size(*broadcast_addr))) != size) {
+ bjnp_debug(LOG_DEBUG,
+ "bjnp_send_broadcast: Socket: %d: sent only %x = %d bytes of packet, error = %s\n",
+ sockfd, num_bytes, num_bytes, strerror(errno));
+ /* not allowed, skip this interface */
- return -1;
+ return -1;
}
- return sockfd;
+
+ return sockfd;
}
-static void add_printer_address( http_addr_t *printer_sa, char *mac_address, int *no_printers, struct printer_list *printers )
+static void add_printer_address(http_addr_t *printer_sa, char *mac_address,
+ int *no_printers, struct printer_list *printers)
{
- char ip_addr[BJNP_HOST_MAX];
- int port;
- int i;
- bjnp_address_type_t host_type;
- char host[BJNP_HOST_MAX];
-
-
- host_type = get_printer_host( printer_sa, host, &port);
-
- bjnp_debug (LOG_DEBUG, "add_printer_address(%s) %d\n", host, *no_printers );
-
- /* Check if a device number is already allocated to any of the printer's addresses */
- for (i = 0; i < *no_printers; i++)
- {
- /* we check for mac_addresses as */
- /* an IPv6 host can have multiple adresses */
-
- if ( strcmp( printers[i].mac_address, mac_address ) == 0 )
- {
- if (host_type > printers[i].host_type)
- {
- /* This is a better address as it resolves to a FQDN or */
- /* it is a global address, so we do not rely on a scope */
- /* which could change when the number of IP-interfaces changes */
- memcpy(printers[i].addr, printer_sa, sa_size(printer_sa) );
- strcpy( printers[i].hostname, host);
- printers[i].host_type = host_type;
- bjnp_debug (LOG_DEBUG, "Printer at %s found before, but found better address!\n",
- host);
- }
- else
- {
- bjnp_debug (LOG_DEBUG, "Printer at %s found before, not added!\n",
- host);
+ char ip_addr[BJNP_HOST_MAX];
+ int port;
+ char family[BJNP_FAMILY_MAX];
+ int i;
+ bjnp_address_type_t host_type;
+ char host[BJNP_HOST_MAX];
+
+
+ host_type = get_printer_host(*printer_sa, host, &port, family);
+
+ bjnp_debug(LOG_DEBUG, "add_printer_address(%s) %d\n", host, *no_printers);
+
+ /* Check if a device number is already allocated to any of the printer's addresses */
+ for (i = 0; i < *no_printers; i++) {
+ /* we check for mac_addresses as */
+ /* an IPv6 host can have multiple adresses */
+
+ if (strcmp(printers[i].mac_address, mac_address) == 0) {
+ if (host_type > printers[i].host_type) {
+ /* This is a better address as it resolves to a FQDN or */
+ /* it is a global address, so we do not rely on a scope */
+ /* which could change when the number of IP-interfaces changes */
+ memcpy(printers[i].addr, printer_sa, sa_size(*printer_sa));
+ strcpy(printers[i].hostname, host);
+ printers[i].host_type = host_type;
+ bjnp_debug(LOG_DEBUG, "Printer at %s found before, but found better address!\n",
+ host);
+ } else {
+ bjnp_debug(LOG_DEBUG, "Printer at %s found before, not added!\n",
+ host);
}
- return;
+
+ return;
}
}
- /* create a new device structure for this address */
-
- if (*no_printers == BJNP_PRINTERS_MAX)
- {
- bjnp_debug (LOG_CRIT,
- "Too many devices, ran out of device structures, can not add %s\n",
- host);
- return;
+ /* create a new device structure for this address */
+
+ if (*no_printers == BJNP_PRINTERS_MAX) {
+ bjnp_debug(LOG_CRIT,
+ "Too many devices, ran out of device structures, cannot add %s\n",
+ host);
+ return;
}
- printers[*no_printers].addr = malloc(sizeof(http_addr_t));
- memset(printers[*no_printers].addr, 0, sizeof(http_addr_t) );
- memcpy(printers[*no_printers].addr, printer_sa, sa_size(printer_sa));
- printers[*no_printers].host_type = host_type;
- printers[*no_printers].port = port;
- strcpy(printers[*no_printers].hostname, host);
- strcpy(printers[*no_printers].mac_address, mac_address);
- if (get_printer_id (printer_sa, printers[*no_printers].model,
- printers[*no_printers].IEEE1284_id ) != 0)
- {
- bjnp_debug (LOG_CRIT, "Cannot read printer make & model: %s\n", host);
- free(printers[*no_printers].addr);
- return;
+
+ printers[*no_printers].addr = malloc(sizeof(http_addr_t));
+ memset(printers[*no_printers].addr, 0, sizeof(http_addr_t));
+ memcpy(printers[*no_printers].addr, printer_sa, sa_size(*printer_sa));
+ printers[*no_printers].host_type = host_type;
+ printers[*no_printers].port = port;
+ strcpy(printers[*no_printers].hostname, host);
+ strcpy(printers[*no_printers].mac_address, mac_address);
+
+ if (get_printer_id(printer_sa, printers[*no_printers].model,
+ printers[*no_printers].IEEE1284_id) != 0) {
+ bjnp_debug(LOG_CRIT, "Cannot read printer make & model: %s\n", host);
+ free(printers[*no_printers].addr);
+ return;
}
- get_address_info( printer_sa, ip_addr, &port);
- bjnp_debug (LOG_DEBUG, "Printer not yet in our list, added it: %s:%d\n", host, port);
- (*no_printers)++;
+
+ get_address_info(printer_sa, ip_addr, &port, family);
+ bjnp_debug(LOG_DEBUG, "Printer not yet in our list, added it: %s:%d(%s)\n",
+ host, port, family);
+ (*no_printers)++;
}
-static void add_printer( http_addr_t *printer_sa, bjnp_response_t *resp,
- int *no_printers, struct printer_list *printers )
+static void add_printer(http_addr_t *printer_sa, bjnp_response_t *resp,
+ int *no_printers, struct printer_list *printers)
{
- char mac_address_string[BJNP_SERIAL_MAX];
- int i;
+ char mac_address_string[BJNP_SERIAL_MAX];
+ int i;
- /* create serial/mac_address string */
+ /* create serial/mac_address string */
- u8tohex_string(resp -> udp_discover_response.mac_addr, mac_address_string,
- sizeof(resp -> udp_discover_response.mac_addr) );
+ u8tohex_string(resp -> udp_discover_response.mac_addr, mac_address_string,
+ sizeof(resp -> udp_discover_response.mac_addr));
- if (printer_sa->addr.sa_family == AF_INET)
- {
- add_printer_address( printer_sa, mac_address_string, no_printers, printers);
+ if (printer_sa->addr.sa_family == AF_INET) {
+ add_printer_address(printer_sa, mac_address_string, no_printers, printers);
}
- else
- {
- int no_addresses;
- http_addr_t printer_addr;
-
- /* IPV6, we also need to try all adresses received in the discover response */
-
- add_printer_address( printer_sa, mac_address_string, no_printers, printers);
- no_addresses = resp -> udp_discover_response.addr_len >> 4;
- memset(&printer_addr, 0, sizeof(printer_addr) );
- memcpy(&printer_addr, printer_sa, sa_size(printer_sa) );
- for (i = 0; i < no_addresses; i++ )
- {
- memcpy(printer_addr.ipv6.sin6_addr.s6_addr, &(resp -> udp_discover_response.addresses.ipv6.ipv6_addr[i]), 16);
-
- /* we only add link-local address if the response came from a link-local aadress (done above) */
-
- if ( ! IN6_IS_ADDR_LINKLOCAL( &(printer_addr.ipv6.sin6_addr) ) )
- {
- /* address is already in network byte order */
-
- add_printer_address(&printer_addr, mac_address_string, no_printers, printers );
- }
- }
+
+#ifdef ENABLE_IPV6
+ else {
+ int no_addresses;
+ http_addr_t printer_addr;
+
+ /* IPV6, we also need to try all adresses received in the discover response */
+
+ add_printer_address(printer_sa, mac_address_string, no_printers, printers);
+ no_addresses = resp -> udp_discover_response.addr_len >> 4;
+ memset(&printer_addr, 0, sizeof(printer_addr));
+ memcpy(&printer_addr, printer_sa, sa_size(*printer_sa));
+
+ for (i = 0; i < no_addresses; i++) {
+ memcpy(printer_addr.ipv6.sin6_addr.s6_addr,
+ &(resp -> udp_discover_response.addresses.ipv6.ipv6_addr[i]), 16);
+
+ /* we only add link-local address if the response came from a */
+ /* link-local aadress (done above) */
+
+ if (! IN6_IS_ADDR_LINKLOCAL(&(printer_addr.ipv6.sin6_addr))) {
+ /* address is already in network byte order */
+
+ add_printer_address(&printer_addr, mac_address_string, no_printers, printers);
+ }
+ }
}
+
+#endif
}
-int bjnp_discover_printers ( struct printer_list *printers )
+int bjnp_discover_printers(struct printer_list *printers)
{
- int numbytes = 0;
- bjnp_command_t cmd;
- bjnp_response_t disc_resp;
- int socket_fd[BJNP_SOCK_MAX];
- int no_sockets = 0;
- int i;
- int attempt;
- int last_socketfd = 0;
- fd_set fdset;
- fd_set active_fdset;
- struct timeval timeout;
- int no_printers = 0;
- http_addr_t broadcast_addr[BJNP_SOCK_MAX];
- http_addr_t printer_sa;
- socklen_t socklen;
- char host[BJNP_HOST_MAX];
- int port;
-
- clear_cmd(&cmd);
- memset( broadcast_addr, 0, sizeof( broadcast_addr) );
- memset( &printer_sa, 0 ,sizeof( printer_sa ) );
- bjnp_debug (LOG_DEBUG, "sanei_bjnp_find_devices:\n");
-
- for (i=0; i < BJNP_SOCK_MAX; i++)
- {
- socket_fd[i] = -1;
+ int numbytes = 0;
+ bjnp_command_t cmd;
+ bjnp_response_t disc_resp;
+ int socket_fd[BJNP_SOCK_MAX];
+ int no_sockets = 0;
+ int i;
+ int attempt;
+ int last_socketfd = 0;
+ fd_set fdset;
+ fd_set active_fdset;
+ struct timeval timeout;
+ int no_printers = 0;
+ http_addr_t broadcast_addr[BJNP_SOCK_MAX];
+ http_addr_t printer_sa;
+ socklen_t socklen;
+ char host[BJNP_HOST_MAX];
+ int port;
+ char family[BJNP_FAMILY_MAX];
+
+ clear_cmd(&cmd);
+ memset(broadcast_addr, 0, sizeof(broadcast_addr));
+ memset(&printer_sa, 0 , sizeof(printer_sa));
+ bjnp_debug(LOG_DEBUG, "sanei_bjnp_find_devices:\n");
+
+ for (i = 0; i < BJNP_SOCK_MAX; i++) {
+ socket_fd[i] = -1;
}
- bjnp_debug
- (LOG_DEBUG,
- "Do auto detection of printers...\n");
- /*
- * Send UDP DISCOVER to discover printers and return the list of printers found
- */
+ bjnp_debug
+ (LOG_DEBUG,
+ "Do auto detection of printers...\n");
- FD_ZERO (&fdset);
- bjnp_set_command_header (&cmd, CMD_UDP_DISCOVER, 0, sizeof(cmd.udp_discover) );
+ /*
+ * Send UDP DISCOVER to discover printers and return the list of printers found
+ */
- no_sockets = 0;
+ FD_ZERO(&fdset);
+ bjnp_defaults_set_command_header(&cmd, CMD_UDP_DISCOVER, sizeof(cmd.udp_discover));
+
+ no_sockets = 0;
#ifdef HAVE_GETIFADDRS
- {
- struct ifaddrs *interfaces = NULL;
- struct ifaddrs *interface;
- getifaddrs (&interfaces);
-
- /* create a socket for each suitable interface */
-
- interface = interfaces;
- while ((no_sockets < BJNP_SOCK_MAX) && (interface != NULL))
- {
- if ( ! (interface -> ifa_flags & IFF_POINTOPOINT) &&
- ( (socket_fd[no_sockets] =
- prepare_socket( interface -> ifa_name,
- (http_addr_t *) interface -> ifa_addr,
- (http_addr_t *) interface -> ifa_broadaddr,
- &broadcast_addr[no_sockets] ) ) != -1 ) )
- {
- /* track highest used socket for later use in select */
- if (socket_fd[no_sockets] > last_socketfd)
- {
+ {
+ struct ifaddrs *interfaces = NULL;
+ struct ifaddrs *interface;
+ getifaddrs(&interfaces);
+
+ /* create a socket for each suitable interface */
+
+ interface = interfaces;
+
+ while ((no_sockets < BJNP_SOCK_MAX) && (interface != NULL)) {
+ if (!(interface -> ifa_flags & IFF_POINTOPOINT) &&
+ ((socket_fd[no_sockets] =
+ prepare_socket(interface -> ifa_name,
+ (http_addr_t *) interface -> ifa_addr,
+ (http_addr_t *) interface -> ifa_broadaddr,
+ &broadcast_addr[no_sockets])) != -1)) {
+ /* track highest used socket for later use in select */
+ if (socket_fd[no_sockets] > last_socketfd) {
+ last_socketfd = socket_fd[no_sockets];
+ }
+
+ FD_SET(socket_fd[no_sockets], &fdset);
+ no_sockets++;
+ }
+
+ interface = interface->ifa_next;
+ }
+
+ freeifaddrs(interfaces);
+ }
+#else
+ /* we have no easy way to find interfaces with their broadcast addresses. */
+ /* use global broadcast and all-hosts instead */
+ {
+ http_addr_t local;
+ http_addr_t bc_addr;
+
+ memset(&local, 0, sizeof(local));
+ local.ipv4.sin_family = AF_INET;
+ local.ipv4.sin_addr.s_addr = htonl(INADDR_ANY);
+
+ bc_addr.ipv4.sin_family = AF_INET;
+ bc_addr.ipv4.sin_port = htons(BJNP_PORT_PRINT);
+ bc_addr.ipv4.sin_addr.s_addr = htonl(INADDR_BROADCAST);
+
+ socket_fd[no_sockets] = prepare_socket("any_interface",
+ &local,
+ &bc_addr,
+ &broadcast_addr[no_sockets]);
+
+ if (socket_fd[no_sockets] >= 0) {
+ FD_SET(socket_fd[no_sockets], &fdset);
+
+ if (socket_fd[no_sockets] > last_socketfd) {
last_socketfd = socket_fd[no_sockets];
- }
- FD_SET (socket_fd[no_sockets], &fdset);
+ }
+
no_sockets++;
- }
- interface = interface->ifa_next;
- }
- freeifaddrs (interfaces);
- }
-#else
- /* we have no easy way to find interfaces with their broadcast addresses. */
- /* use global broadcast and all-hosts instead */
- {
- http_addr_t local;
- http_addr_t bc_addr;
-
- memset( &local, 0, sizeof( local) );
- local.ipv4.sin_family = AF_INET;
- local.ipv4.sin_addr.s_addr = htonl (INADDR_ANY);
-
- bc_addr.ipv4.sin_family = AF_INET;
- bc_addr.ipv4.sin_port = htons(BJNP_PORT_PRINT);
- bc_addr.ipv4.sin_addr.s_addr = htonl (INADDR_BROADCAST);
-
- socket_fd[no_sockets] = prepare_socket( "any_interface",
- &local,
- &bc_addr,
- &broadcast_addr[no_sockets] );
- if (socket_fd[no_sockets] >= 0)
- {
- FD_SET (socket_fd[no_sockets], &fdset);
- if (socket_fd[no_sockets] > last_socketfd)
- {
- last_socketfd = socket_fd[no_sockets];
- }
- no_sockets++;
- }
+ }
+
#ifdef ENABLE_IPV6
- local.ipv6.sin6_family = AF_INET6;
- local.ipv6.sin6_addr = in6addr_any;
-
- socket_fd[no_sockets] = prepare_socket( "any_interface",
- &local,
- NULL,
- &broadcast_addr[no_sockets] );
- if (socket_fd[no_sockets] >= 0)
- {
- FD_SET (socket_fd[no_sockets], &fdset);
- if (socket_fd[no_sockets] > last_socketfd)
- {
- last_socketfd = socket_fd[no_sockets];
- }
- no_sockets++;
- }
-#endif
- }
-#endif
+ local.ipv6.sin6_family = AF_INET6;
+ local.ipv6.sin6_addr = in6addr_any;
- /* send BJNP_MAX_BROADCAST_ATTEMPTS broadcasts on each prepared socket */
- for (attempt = 0; attempt < BJNP_MAX_BROADCAST_ATTEMPTS; attempt++)
- {
- for ( i=0; i < no_sockets; i++)
- {
- bjnp_send_broadcast ( socket_fd[i], &broadcast_addr[i], cmd, sizeof (cmd.udp_discover));
- }
- /* wait for some time between broadcast packets */
- usleep (BJNP_BROADCAST_INTERVAL * USLEEP_MS);
+ socket_fd[no_sockets] = prepare_socket("any_interface",
+ &local,
+ NULL,
+ &broadcast_addr[no_sockets]);
+
+ if (socket_fd[no_sockets] >= 0) {
+ FD_SET(socket_fd[no_sockets], &fdset);
+
+ if (socket_fd[no_sockets] > last_socketfd) {
+ last_socketfd = socket_fd[no_sockets];
+ }
+
+ no_sockets++;
+ }
+
+#endif /* ENABLE_IPV6 */
}
+#endif /* HAVE_GETIFADDRS */
- /* wait for a UDP response */
+ /* send BJNP_MAX_BROADCAST_ATTEMPTS broadcasts on each prepared socket */
+ for (attempt = 0; attempt < BJNP_MAX_BROADCAST_ATTEMPTS; attempt++) {
+ for (i = 0; i < no_sockets; i++) {
+ bjnp_send_broadcast(socket_fd[i], &broadcast_addr[i], cmd,
+ sizeof(cmd.udp_discover));
+ }
- timeout.tv_sec = 0;
- timeout.tv_usec = BJNP_BC_RESPONSE_TIMEOUT * USLEEP_MS;
+ /* wait for some time between broadcast packets */
+ usleep(BJNP_BROADCAST_INTERVAL * USLEEP_MS);
+ }
+ /* wait for a UDP response */
- active_fdset = fdset;
+ timeout.tv_sec = 0;
+ timeout.tv_usec = BJNP_BC_RESPONSE_TIMEOUT * USLEEP_MS;
- while (select (last_socketfd + 1, &active_fdset, NULL, NULL, &timeout) > 0)
- {
- bjnp_debug (LOG_DEBUG, "Select returned, time left %d.%d....\n",
- (int) timeout.tv_sec, (int) timeout.tv_usec);
- for (i = 0; i < no_sockets; i++)
- {
- if (FD_ISSET (socket_fd[i], &active_fdset))
- {
- socklen = sizeof(printer_sa);
- if ((numbytes =
- recvfrom (socket_fd[i], &disc_resp, sizeof (disc_resp), 0,
- &(printer_sa.addr), &socklen ) ) == -1)
- {
- bjnp_debug
- (LOG_INFO, "find_devices: no data received, while socket is ready");
- break;
- }
- else
- {
- get_address_info( &printer_sa, host, &port);
- bjnp_debug( LOG_DEBUG, "Response received from %s port %d\n", host, port);
- bjnp_hexdump (LOG_DEBUG2, "Discover response:\n", &disc_resp, numbytes);
-
- /* check if something sensible is returned */
- if ( (numbytes < bjnp_header_size ) ||
- (strncmp ("BJNP", disc_resp.header.BJNP_id, 4) != 0))
- {
- /* not a valid response, assume not a printer */
-
- char bjnp_id[5];
- strncpy(bjnp_id, disc_resp.header.BJNP_id, 4);
- bjnp_id[4] = '\0';
- bjnp_debug (LOG_INFO,
- "Invalid discover response! Length = %d, Id = %s\n",
- numbytes, bjnp_id );
- break;
- }
- if ( ! ((disc_resp.header.dev_type) & 0x80) )
- {
- /* not a response, a discover command from somebody else or */
- /* a discover command that we generated */
- break;
+
+ active_fdset = fdset;
+
+ while (select(last_socketfd + 1, &active_fdset, NULL, NULL, &timeout) > 0) {
+ bjnp_debug(LOG_DEBUG, "Select returned, time left %d.%d....\n",
+ (int) timeout.tv_sec, (int) timeout.tv_usec);
+
+ for (i = 0; i < no_sockets; i++) {
+ if (FD_ISSET(socket_fd[i], &active_fdset)) {
+
+ socklen = sizeof(printer_sa);
+
+ if ((numbytes =
+ recvfrom(socket_fd[i], &disc_resp, sizeof(disc_resp), 0,
+ &(printer_sa.addr), &socklen)) == -1) {
+ bjnp_debug
+ (LOG_INFO, "find_devices: no data received, while socket is ready");
+ break;
+ } else {
+ /* process incoming packet */
+
+ get_address_info(&printer_sa, host, &port, family);
+
+ bjnp_debug(LOG_DEBUG, "Response received from %s port %d(%s)\n", host, port,
+ family);
+ bjnp_hexdump(LOG_DEBUG2, "Discover response:\n", &disc_resp, numbytes);
+
+ /* check if something sensible is returned */
+ if ((numbytes < bjnp_header_size) ||
+ (strncmp("BJNP", disc_resp.header.BJNP_id, 4) != 0)) {
+ /* not a valid response, assume not a printer */
+
+ char bjnp_id[5];
+ strncpy(bjnp_id, disc_resp.header.BJNP_id, 4);
+ bjnp_id[4] = '\0';
+ bjnp_debug(LOG_INFO,
+ "Invalid discover response! Length = %d, Id = %s\n",
+ numbytes, bjnp_id);
+ break;
}
- };
+ if (!((disc_resp.header.dev_type) & 0x80)) {
+ /* not a response, a discover command from somebody else or */
+ /* a discover command that we generated */
+ break;
+ }
+ };
+
+ /* valid response, register printer */
+ add_printer(&printer_sa, &disc_resp, &no_printers, printers);
- add_printer( &printer_sa, &disc_resp, &no_printers, printers);
+ }
+ }
- }
- }
- active_fdset = fdset;
- timeout.tv_sec = 0;
- timeout.tv_usec = BJNP_BC_RESPONSE_TIMEOUT * USLEEP_MS;
+ active_fdset = fdset;
+ timeout.tv_sec = 0;
+ timeout.tv_usec = BJNP_BC_RESPONSE_TIMEOUT * USLEEP_MS;
}
- bjnp_debug (LOG_DEBUG, "printer discovery finished...\n");
- for (i = 0; i < no_sockets; i++)
- close (socket_fd[i]);
+ bjnp_debug(LOG_DEBUG, "printer discovery finished...\n");
+
+ for (i = 0; i < no_sockets; i++) {
+ close(socket_fd[i]);
+ }
- return no_printers;
+ return no_printers;
}
diff --git a/bjnp-io.c b/bjnp-io.c
index 46bd084..dccaaf1 100644
--- a/bjnp-io.c
+++ b/bjnp-io.c
@@ -1,18 +1,19 @@
/*
- * TCP/IP IO communication implementation for
- * bjnp backend for the Common UNIX Printing System (CUPS).
- * Copyright 2008 by Louis Lagendijk
+ * Higher level bjnp IO communication implementation for
+ * bjnp backend for the Common UNIX Printing System (CUPS).
+ * Copyright 2014 by Louis Lagendijk
*
- * These coded instructions, statements, and computer programs are the
- * property of Louis Lagendijk and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * "LICENSE" which should have been included with this file. If this
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * This program 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; version 2 only.
*
- * This file is subject to the Apple OS-Developed Software exception.
+ * This program 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.
*
- * Contents:
- * <to be added>
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <fcntl.h>
@@ -20,365 +21,500 @@
#include "bjnp.h"
#include "bjnp-protocol.h"
+#include "bjnp-io.h"
+#include "bjnp-commands.h"
-typedef struct
+/*
+ * new_printer - allocate printer struct and set defaults
+ */
+static printer_t *new_printer(void)
{
- uint16_t seq_no;
- ssize_t count;
- bjnp_command_t print_buf;
- char free;
+ int i;
+ printer_t *printer = malloc(sizeof(printer_t));
+ memset(printer, 0, sizeof(*printer));
+ printer->global_ink_warning_level = LEVEL_UNKNOWN;
+ printer->paper_out = -1;
+ printer->first_output = 1;
+ printer->reporting_capabilities = BJNP_REPORT_ALL;
+
+ for (i = 0; i < BJNP_CARTRIDGES_MAX; i++) {
+ printer->cartridges[i].cart_index = -1;
+ printer->cartridges[i].warning = LEVEL_UNKNOWN;
+ printer->cartridges[i].marker_level = -1;
+ }
+
+ printer->no_cartridges = -1;
+ printer->last_level_report = 0;
+ printer->fd = -1;
+ return printer;
}
-io_slot_t;
-char cur_printer_IEEE1284_id[BJNP_IEEE1284_MAX];
-char cur_printer_model[BJNP_MODEL_MAX];
-io_slot_t io_slot;
+void free_printer(printer_t *printer)
+{
+ free(printer);
+}
+
+/*
+ * Close printer and cleanup & free the structure
+ */
+void
+bjnp_close_printer(printer_t *printer)
+{
+ /*
+ * Signal end of printjob to printer
+ */
+ if (printer->fd >= 0) {
+ close(printer->fd);
+ }
+
+ bjnp_debug(LOG_DEBUG2, "Finish printjob\n");
+ bjnp_send_close(printer);
+ free_printer(printer);
+}
/*
- * 'bjnp_addr_connect - Setup a TCP connection to the addresses .
+ * bjnp_tcp_connect - Setup a TCP connection to the printer.
*
*/
-int bjnp_addr_connect( http_addr_t *addr)
+static int
+bjnp_tcp_connect(printer_t *printer)
{
- int val;
- int tcp_socket = -1;
+ int val;
+ int tcp_socket = -1;
#ifdef __APPLE__
- struct timeval timeout;
+ struct timeval timeout;
#endif /* __APPLE__ */
- char host[BJNP_HOST_MAX];
- int port;
-
- /*
- * Create the socket...
- */
-
- if ((tcp_socket = (int)socket(get_protocol_family(addr), SOCK_STREAM,
- 0)) < 0)
- {
- return tcp_socket;
+ char host[BJNP_HOST_MAX];
+ char family[BJNP_FAMILY_MAX];
+ int port;
+
+ /*
+ * Create the socket...
+ */
+
+ if ((tcp_socket = (int)socket(get_protocol_family(printer->printer_sa),
+ SOCK_STREAM,
+ 0)) < 0) {
+ return tcp_socket;
}
- /*
- * Set options...
- */
- val = 1;
- setsockopt(tcp_socket, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
+ /*
+ * Set options...
+ */
+ val = 1;
+ setsockopt(tcp_socket, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
#if 0
- val = 1;
- setsockopt(tcp_socket, SOL_SOCKET, SO_REUSEPORT, &val, sizeof(val));
+ val = 1;
+ setsockopt(tcp_socket, SOL_SOCKET, SO_REUSEPORT, &val, sizeof(val));
- val = 1;
- setsockopt(tcp_socket, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val));
+ val = 1;
+ setsockopt(tcp_socket, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val));
#endif
#ifdef __APPLE__
- /*
- * Use a 30-second read timeout when connecting to limit the amount of time
- * we block...
- */
-
- timeout.tv_sec = 30;
- timeout.tv_usec = 0;
- setsockopt(tcp_socket, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout));
+ /*
+ * Use a 30-second read timeout when connecting to limit the amount of time
+ * we block...
+ */
+
+ timeout.tv_sec = 30;
+ timeout.tv_usec = 0;
+ setsockopt(tcp_socket, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout));
#endif /* __APPLE__ */
- /*
- * Using TCP_NODELAY improves responsiveness, especially on systems
- * with a slow loopback interface...
- */
+ /*
+ * Using TCP_NODELAY improves responsiveness, especially on systems
+ * with a slow loopback interface...
+ */
- val = 1;
- setsockopt(tcp_socket, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
+ val = 1;
+ setsockopt(tcp_socket, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
- /*
- * Close this socket when starting another process...
- */
+ /*
+ * Close this socket when starting another process...
+ */
- fcntl(tcp_socket, F_SETFD, FD_CLOEXEC);
+ fcntl(tcp_socket, F_SETFD, FD_CLOEXEC);
- /*
- * Then connect...
- */
+ /*
+ * Then connect...
+ */
- get_address_info(addr, host, &port);
+ get_printer_address_info(printer, host, &port, family);
- if ( connect( tcp_socket, &(addr->addr), sa_size(addr) ) != 0)
- {
- bjnp_debug(LOG_CRIT, "Failed to establish TCP connection to printer %s port %d\n",
- host, port);
- close( tcp_socket);
- return -1;
+ if (connect(tcp_socket, &(printer->printer_sa.addr),
+ sa_size(printer->printer_sa)) != 0) {
+ bjnp_debug(LOG_CRIT,
+ "Failed to establish TCP connection to printer %s port %d\n",
+ host, port);
+ close(tcp_socket);
+ return -1;
}
- bjnp_debug( LOG_DEBUG, "Established TP connection to printer %s port %d\n",
- host, port);
- return tcp_socket;
+
+ bjnp_debug(LOG_DEBUG, "Established TCP connection (fd = %d) to printer %s port %d\n",
+ tcp_socket, host, port);
+ return tcp_socket;
}
-http_addr_t *
-bjnp_start_job (http_addrlist_t * list, char *user, char *title)
+static printer_t *
+bjnp_init_printer(printer_t *printer, http_addr_t *addr, const char *user, const char *title)
{
-/*
- * send details of printjob to printer
- * Returns: addrlist set to address details of used printer
- */
- http_addr_t * addr;
- http_addr_t * ret_addr;
- char host[BJNP_HOST_MAX];
- int port;
-
- while (list != NULL)
- {
- addr = (http_addr_t *) &(list->addr);
- get_address_info( addr, host, &port);
- bjnp_debug (LOG_DEBUG, "Connecting to %s port %d\n",
- host, port);
-
- if (bjnp_send_job_details( addr, user, title ) == 0 )
- {
- io_slot.free = 1;
-
- /* set printer information in case it is needed later */
-
- get_printer_id (&(list->addr), cur_printer_model,
- cur_printer_IEEE1284_id);
- ret_addr = malloc(sizeof(http_addr_t) );
- memset(ret_addr, 0, sizeof(http_addr_t) );
- memcpy(ret_addr, addr, sa_size(addr) );
- return ret_addr;
- }
- list = list->next;
+ uint16_t session_id;
+ char host[BJNP_HOST_MAX];
+ int port;
+ char family[BJNP_FAMILY_MAX];
+
+
+ get_address_info(addr, host, &port, family);
+ bjnp_debug(LOG_DEBUG, "Connecting to %s port %d (%s)\n",
+ host, port, family);
+
+ if ((session_id = bjnp_send_job_details(addr, user, title)) < 0) {
+
+ /* printer init failed, release struct */
+
+ if (printer != NULL) {
+ bjnp_close_printer(printer);
+ }
+
+ return NULL;
+ }
+
+ /* found printer, now fill the printer struct */
+ if (printer == NULL) {
+ printer = new_printer();
}
- return NULL; /* NULL */
+
+ printer->io_free = 1;
+ printer->session_id = session_id;
+ memcpy(&(printer->printer_sa), addr, sa_size(printer->printer_sa));
+ /* set printer information in case it is needed later */
+
+ get_printer_id(&(printer->printer_sa), printer->model,
+ printer->IEEE1284_id);
+ return printer;
}
-void
-bjnp_finish_job (http_addr_t * addr)
+
+static printer_t *
+bjnp_start_job(printer_t *printer, http_addrlist_t *list, const char *user,
+ const char *title)
{
-/*
- * Signal end of printjob to printer
- */
+ /*
+ * send details of printjob to printer
+ * Returns: addrlist set to address details of used printer
+ */
+ http_addr_t *addr;
+
+ if (printer == NULL) {
+ while (list != NULL) {
+ addr = (http_addr_t *) & (list->addr);
+
+ if ((printer = bjnp_init_printer(printer, addr, user, title)) != NULL) {
+ return printer;
+ }
+
+ list = list->next;
+ }
+ } else {
+
+ /* we already found the printer, but could not connect to it */
- bjnp_debug (LOG_DEBUG2, "Finish printjob\n");
- bjnp_send_close( addr );
+ printer = bjnp_init_printer(printer, &(printer->printer_sa), user, title);
+ }
+
+ return printer;
}
-ssize_t
-bjnp_write2 (int fd, const void *buf, size_t count)
+printer_t *
+bjnp_printer_connect(printer_t *printer, http_addrlist_t *list, const char *user,
+ const char *title, int *bjnp_error)
{
-/*
- * This function writes printdata to the printer. This function mimicks the std.
- * lib. write function as much as possible.
- * Returns: number of bytes written to the printer
- */
- int sent_bytes;
- int terrno;
- int command_len;
-
- if (!io_slot.free)
- {
- errno = EAGAIN;
- return -1;
- }
+ /* look for printer address and tell printer that we want to start printing */
+
+ if ((printer = bjnp_start_job(printer, list, user, title)) != NULL) {
+
+ /* found printer, check resources & state */
+
+ if ((*bjnp_error = bjnp_report_levels(printer)) != 0) {
- /* set BJNP command header */
+ /* printer not ready, we keep the printer struct around, */
+ /* but tell the printer to close the job. */
+ /* This avoids cluttering the printing log */
- command_len = bjnp_header_size + count;
- io_slot.seq_no = bjnp_set_command_header (&io_slot.print_buf, CMD_TCP_PRINT,
- session_id, command_len);
- io_slot.count = count;
- memcpy (&(io_slot.print_buf.tcp_print.data), buf, count);
+ bjnp_send_close(printer);
+ } else {
+ /* printer is ready, setup tcp-connection */
+ /* this should succeed */
- bjnp_debug (LOG_DEBUG, "bjnp_write2: printing %d bytes\n", count);
- bjnp_hexdump (LOG_DEBUG2, "Print data:", (char *) &io_slot.print_buf,
- command_len);
+ if ((printer->fd = bjnp_tcp_connect(printer)) < 0) {
- if ((sent_bytes =
- write (fd, &io_slot.print_buf, command_len)) < 0)
- {
- /* return result from write */
- terrno = errno;
- bjnp_debug (LOG_CRIT, "bjnp_write2: Could not send data!\n");
- errno = terrno;
- return sent_bytes;
+ /* remove the printer struct as we did fail */
+
+ bjnp_close_printer(printer);
+ printer = NULL;
+ }
+ }
}
- else if (sent_bytes != command_len)
- {
- errno = EIO;
- return -1;
+
+ return printer;
+}
+
+
+ssize_t
+bjnp_write2(printer_t *printer, const void *buf, size_t count)
+{
+ /*
+ * This function writes printdata to the printer. This function mimicks the std.
+ * lib. write function as much as possible.
+ * Returns: number of bytes written to the printer
+ */
+ int sent_bytes;
+ int terrno;
+ int command_len;
+
+ if (!printer->io_free) {
+ errno = EAGAIN;
+ return -1;
+ }
+
+ /* set BJNP command header */
+
+ command_len = bjnp_header_size + count;
+ printer->seq_no = bjnp_printer_set_command_header(printer, &(printer->print_buf),
+ CMD_TCP_PRINT,
+ command_len);
+ printer->io_count = count;
+ memcpy(&(printer->print_buf.tcp_print.data), buf, count);
+
+
+ bjnp_debug(LOG_DEBUG, "bjnp_write2: printing %d bytes\n", count);
+ bjnp_hexdump(LOG_DEBUG2, "Print data:", (char *) & (printer->print_buf),
+ command_len);
+
+ if ((sent_bytes =
+ write(printer->fd, &(printer->print_buf), command_len)) < 0) {
+ /* return result from write */
+ terrno = errno;
+ bjnp_debug(LOG_CRIT, "bjnp_write2: Could not send data!\n");
+ errno = terrno;
+ return sent_bytes;
+ } else if (sent_bytes != command_len) {
+ errno = EIO;
+ return -1;
}
- io_slot.free = 0;
- /* correct nr of bytes sent for length of command */
- /* sent_byte < expected is an unrecoverable error */
+ printer->io_free = 0;
- return sent_bytes - bjnp_header_size;
+ /* correct nr of bytes sent for length of command */
+ /* sent_byte < expected is an unrecoverable error */
+
+ return sent_bytes - bjnp_header_size;
}
int
-bjnp_backchannel (int fd, ssize_t * written)
+bjnp_backchannel(printer_t *printer, ssize_t *written)
{
-/*
- * This function receives the responses to the write commands.
- * written wil be set to the number of bytes confirmed by the printer
- * Returns:
- * BJNP_OK when valid ack is received, written is set to number of bytes
- * sent to and accepted by printer (could be 0 for keep-alive)
- * BJNP_IO_ERROR when any io-error occurred
- * BJNP_NOT_AN_ACK when the packet received was not an ack, must be ignored
- * BJNP_THROTTLE when printer indicated it could not handle the input data
- */
- bjnp_response_t response;
- unsigned int recv_bytes;
- unsigned int resp_seqno;
- int terrno;
- int payload;
-
- bjnp_debug (LOG_DEBUG, "bjnp_backchannel: receiving response\n");
-
- /* get response */
-
- if ((recv_bytes =
- read (fd, &response,
- sizeof(response) ) ) < bjnp_header_size )
- {
- terrno = errno;
- bjnp_debug (LOG_CRIT,
- "bjnp_backchannel: (recv) could not read response header, recieved %d bytes!\n",
- recv_bytes);
- bjnp_debug (LOG_CRIT, "bjnp_backchannel: (recv) error: %s!\n",
- strerror (terrno));
- errno = terrno;
- return BJNP_IO_ERROR;
+ /*
+ * This function receives the responses to the write commands.
+ * written wil be set to the number of bytes confirmed by the printer
+ * Returns:
+ * BJNP_OK when valid ack is received, written is set to number of bytes
+ * sent to and accepted by printer (could be 0 for keep-alive)
+ * BJNP_IO_ERROR when any io-error occurred
+ * BJNP_NOT_AN_ACK when the packet received was not an ack, must be ignored
+ * BJNP_THROTTLE when printer indicated it could not handle the input data
+ */
+ bjnp_response_t response;
+ unsigned int recv_bytes;
+ unsigned int resp_seqno;
+ int terrno;
+ uint32_t payload_len;
+ fd_set input;
+ struct timeval timeout;
+
+ bjnp_debug(LOG_DEBUG, "bjnp_backchannel: receiving response on fd = %d\n", printer->fd);
+
+ /* get response header, we can unfortunately not */
+ /* rely on getting the payload in the first read */
+
+ if ((recv_bytes =
+ read(printer->fd, &response,
+ bjnp_header_size)) < bjnp_header_size) {
+ terrno = errno;
+ bjnp_debug(LOG_CRIT,
+ "bjnp_backchannel: (recv) could not read response header, received %d bytes!\n",
+ recv_bytes);
+
+ if (terrno < 0) {
+ bjnp_debug(LOG_CRIT, "bjnp_backchannel: (recv) error: %s!\n",
+ strerror(terrno));
+ }
+
+ errno = terrno;
+ return BJNP_IO_ERROR;
}
- bjnp_hexdump (LOG_DEBUG2, "TCP response:", &response,
- recv_bytes);
-
- if (response.header.cmd_code != CMD_TCP_PRINT)
- {
- /* not a print response, discard */
-
- bjnp_debug (LOG_DEBUG, "Not a printing response packet, discarding!");
- return BJNP_NOT_AN_ACK;
+ /* got response header back, get payload length */
+
+ payload_len = ntohl(response.tcp_print_response.header.payload_len);
+
+ /* it should be at least the same size as the accepted field */
+
+ if ((payload_len >= sizeof(response.tcp_print_response.accepted)) &&
+ (payload_len < (sizeof(response) - sizeof(struct bjnp_header)))) {
+ /* read nr of bytes accepted by printer */
+
+ FD_ZERO(&input);
+ FD_SET(printer->fd, &input);
+
+ timeout.tv_sec = 1;
+ timeout.tv_usec = 0;
+
+ if (select(printer->fd + 1, &input, NULL, NULL, &timeout) <= 0) {
+ terrno = errno;
+ bjnp_debug(LOG_CRIT,
+ "bjnp_backchannel: could not read response payload (select)!\n");
+ errno = terrno;
+ return BJNP_IO_ERROR;
+ }
+
+ if ((recv_bytes =
+ read(printer->fd, &response.tcp_print_response.accepted,
+ payload_len)) < payload_len) {
+ terrno = errno;
+ bjnp_debug(LOG_CRIT,
+ "bjnp_backchannel: could not read response payload (recv)!\n");
+ errno = terrno;
+ return BJNP_IO_ERROR;
+ }
+
+ *written = ntohl(response.tcp_print_response.accepted);
+ } else {
+ /* there is no payload, assume 0 bytes received */
+ *written = 0;
+ errno = EIO;
+ return BJNP_IO_ERROR;
}
- resp_seqno = ntohs (response.header.seq_no);
- /* do sanity check on sequence number of response */
- if (resp_seqno != io_slot.seq_no)
- {
- bjnp_debug (LOG_CRIT,
- "bjnp_backchannel: printer reported sequence number %d, expected %d\n",
- resp_seqno, io_slot.seq_no);
+ bjnp_hexdump(LOG_DEBUG2, "TCP response:", &response,
+ bjnp_header_size + recv_bytes);
- errno = EIO;
- return BJNP_IO_ERROR;
+ if (response.tcp_print_response.header.cmd_code != CMD_TCP_PRINT) {
+ /* not a print response, discard */
+
+ bjnp_debug(LOG_DEBUG, "Not a printing response packet, discarding!");
+ return BJNP_NOT_AN_ACK;
}
- /* valid response, check payload length */
+ resp_seqno = ntohs(response.header.seq_no);
- payload = ntohl (response.tcp_print_response.header.payload_len);
+ /* do sanity check on sequence number of response */
+ if (resp_seqno != printer->seq_no) {
+ bjnp_debug(LOG_CRIT,
+ "bjnp_backchannel: printer reported sequence number %d, expected %d\n",
+ resp_seqno, printer->seq_no);
- if (payload == sizeof(response.tcp_print_response.accepted) )
- {
- *written = ntohl (response.tcp_print_response.accepted);
- }
- else
- {
- /* there is no or an incroorect length payload, assume 0 bytes received */
- *written = 0;
+ errno = EIO;
+ return BJNP_IO_ERROR;
}
- bjnp_debug (LOG_DEBUG,
- "bjnp_backchannel: response: written = %lx, seqno = %lx\n",
- *written, resp_seqno);
+ bjnp_debug(LOG_DEBUG,
+ "bjnp_backchannel: response: written = %lx, seqno = %lx\n",
+ *written, resp_seqno);
- io_slot.free = 1;
+ printer->io_free = 1;
- /* check length reported by printer */
+ /* check length reported by printer */
- if (io_slot.count == *written)
- {
- /* printer reported expected number of bytes */
- return BJNP_OK;
- }
- else if (*written == 0)
- {
- /* data was sent to printer, but printer reports that it is busy */
- /* add a delay before we try again */
-
- bjnp_debug (LOG_INFO, "Printer does not accept data, throttling....\n");
- usleep (40000);
- return BJNP_THROTTLE;
+ if (printer->io_count == *written) {
+ /* printer reported expected number of bytes */
+ return BJNP_OK;
+ } else if (*written == 0) {
+ /* data was sent to printer, but printer reports that it is busy */
+ /* add a delay before we try again */
+
+ bjnp_debug(LOG_INFO, "Printer does not accept data, throttling....\n");
+ usleep(40000);
+ return BJNP_THROTTLE;
}
- /* printer reports unexpected number of bytes */
- bjnp_debug (LOG_CRIT,
- "bjnp_backchannel: printer reported %d bytes received, expected %d\n",
- written, io_slot.count);
- errno = EIO;
- return BJNP_IO_ERROR;
+ /* printer reports unexpected number of bytes */
+ bjnp_debug(LOG_CRIT,
+ "bjnp_backchannel: printer reported %d bytes received, expected %d\n",
+ written, printer->io_count);
+ errno = EIO;
+ return BJNP_IO_ERROR;
}
ssize_t
-bjnp_write (int fd, const void *buf, size_t count)
+bjnp_write(printer_t *printer, const void *buf, size_t count)
{
- /* This is a wrapper around bjnp_write2. It parses the input stream for BJL commands
- * and outputs these in a new/separate tcp packet. Each call prints at most buffer upto
- * next command
- * It is an ugly hack, I know....
- * This function can also be used to send keep-alive packets when count = 0
- */
+ /* This is a wrapper around bjnp_write2. It parses the input stream for
+ * BJL commands and outputs these in a new/separate tcp packet. Each call
+ * prints at most buffer upto next command
+ * It is an ugly hack, I know....
+ * This function can also be used to send keep-alive packets when count = 0
+ */
- char start_cmd[] = { 0x1b, 0x5b, 0x4b, 0x2, 0x0, 0x0 };
- int print_count;
- int result;
- int terrno;
+ char start_cmd[] = { 0x1b, 0x5b, 0x4b, 0x2, 0x0, 0x0 };
+ int print_count;
+ int result;
+ int terrno;
- /* TODO: allow scanning over buffer borders */
+ /* TODO: allow scanning over buffer borders */
- bjnp_debug (LOG_DEBUG, "bjnp_write: starting printing of %d characters\n",
- count);
+ bjnp_debug(LOG_DEBUG, "bjnp_write: starting printing of %d characters\n",
+ count);
- if ((print_count =
- find_bin_string (buf, count, start_cmd, sizeof (start_cmd))) == -1)
- {
- /* no command found, print whole buffer */
+ if ((print_count =
+ find_bin_string(buf, count, start_cmd, sizeof(start_cmd))) == -1) {
+ /* no command found, print whole buffer */
- print_count = count;
+ print_count = count;
}
- /* print content of buf upto command */
- result = bjnp_write2 (fd, buf, print_count);
- terrno = errno;
- bjnp_debug (LOG_DEBUG,
- "bjnp_write: Printed %d bytes, last command sent: %d\n",
- result, io_slot.seq_no);
- errno = terrno;
+ /* print content of buf upto command */
- return result;
+ result = bjnp_write2(printer, buf, print_count);
+ terrno = errno;
+ bjnp_debug(LOG_DEBUG,
+ "bjnp_write: Printed %d bytes, last command sent: %d\n",
+ result, printer->seq_no);
+ errno = terrno;
+
+ return result;
}
int
-bjnp_backendGetDeviceID (char *device_id, int device_id_size,
- char *make_model, int make_model_size)
+bjnp_backendGetDeviceID(printer_t *printer, char *device_id, int device_id_size,
+ char *make_model, int make_model_size)
{
-/*
- * Returns the printer information for the active printer
- * Returns: 0 if ok
- * -1 if not found
- */
- strncpy (device_id, cur_printer_IEEE1284_id, device_id_size);
- device_id[device_id_size] = '\0';
-
- strncpy (make_model, cur_printer_model, make_model_size);
- make_model[make_model_size] = '\0';
- if ((strlen (make_model) == 0) && (strlen (device_id) == 0))
- return -1;
- return 0;
+ /*
+ * Returns the printer information for the active printer
+ * Returns: 0 if ok
+ * -1 if not found
+ */
+ strncpy(device_id, printer->IEEE1284_id, device_id_size);
+ device_id[device_id_size] = '\0';
+
+ strncpy(make_model, printer->model, make_model_size);
+ make_model[make_model_size] = '\0';
+
+ if ((strlen(make_model) == 0) && (strlen(device_id) == 0)) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int bjnp_get_device_fd(printer_t *printer)
+{
+ return printer->fd;
}
diff --git a/bjnp-io.h b/bjnp-io.h
new file mode 100644
index 0000000..0a9e828
--- /dev/null
+++ b/bjnp-io.h
@@ -0,0 +1,108 @@
+/*
+ * Higher level bjnp IO communication implementation for
+ * bjnp backend for the Common UNIX Printing System (CUPS).
+ * Copyright 2008-2014 by Louis Lagendijk
+ *
+ * This program 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; version 2 only.
+ *
+ * This program 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BJNP_IO_H
+#define BJNP_IO_H
+
+/* IEEE1284 related definitons */
+
+#define INK_LEVEL_TOKEN "CIR:"
+#define INK_WARNING_TOKEN "CTK:"
+#define PRINTER_STATUS_TOKEN "BST:"
+#define PAPER_STATUS_TOKEN "DJS:"
+
+#define PARAMETER_SEPARATOR ';'
+#define INK_LEVEL_DELIMITER ","
+#define INK_WARNING_DELIMITER ",/,"
+#define PAPER_PARAM_DELIMETER ","
+
+#define DJS_PAPER_OUT "ID"
+#define DJS_CANCELLING "CC"
+#define BJNP_PAPER_OUT_THRESHOLD 5
+
+#define BST_PRINTING 0x80
+#define BST_BUSY 0x20
+#define BST_ERROR 0x08
+
+/* printer status capabilities */
+#define BJNP_REPORT_MARKER_LEVELS 1
+#define BJNP_REPORT_INK_STATUS 2
+#define BJNP_REPORT_PRINTER_STATUS 4
+#define BJNP_REPORT_PAPER_STATUS 8
+
+#define BJNP_REPORT_ALL (BJNP_REPORT_MARKER_LEVELS | BJNP_REPORT_INK_STATUS | BJNP_REPORT_PRINTER_STATUS | BJNP_REPORT_PAPER_STATUS)
+
+#define BJNP_CARTRIDGES_MAX 16
+
+/*
+ * Ink level warning levels
+*/
+
+/* TODO: Convert to enum */
+
+typedef enum bjnp_ink_level_t {
+ LEVEL_OK = 0,
+ LEVEL_LOW = 1,
+ LEVEL_EMPTY = 2,
+ LEVEL_UNKNOWN = 3
+} bjnp_ink_level_t;
+
+struct printer_s {
+ int fd; /* tcp socket for the printer */
+ http_addr_t printer_sa; /* address struct for printer */
+
+ /* printer information for side channel */
+ char IEEE1284_id[BJNP_IEEE1284_MAX];
+ char model[BJNP_MODEL_MAX];
+
+ /* Protocol information */
+ int serial; /* last used serial number for command */
+ uint16_t session_id; /* session-id for this printjob */
+
+ uint16_t seq_no; /* Last command */
+ ssize_t io_count; /* last sent TCP data count */
+ bjnp_command_t print_buf; /* print buffer */
+ char io_free; /* is printbuffer free to be used? */
+
+ /*
+ * Printer reporting capabilities
+ */
+ int reporting_capabilities;
+
+ /*
+ * Warning levels per cartridge
+ */
+
+ int no_cartridges; /* number of warning levels (ink cartridges) found */
+ struct {
+ int cart_index; /* type of cartridge as index in cartridge_types */
+ int warning; /* warning level */
+ int marker_level;
+ } cartridges[BJNP_CARTRIDGES_MAX];
+
+ /*
+ * warnings set
+ */
+ int global_ink_warning_level;
+ int paper_out; /* number of consecutive times paper out is reported */
+
+ int first_output; /* at first output we report additional info */
+ time_t last_level_report; /* last time we reported the levels */
+} printer_s;
+
+#endif
diff --git a/bjnp-levels.c b/bjnp-levels.c
new file mode 100644
index 0000000..22b6998
--- /dev/null
+++ b/bjnp-levels.c
@@ -0,0 +1,647 @@
+/*
+ * Printer status, Ink-level and paper status related functions for the
+ * bjnp backend for the Common UNIX Printing System (CUPS).
+ * Copyright 2014 by Louis Lagendijk
+ *
+ * This program 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; version 2 only.
+ *
+ * This program 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include "bjnp.h"
+#include "bjnp-protocol.h"
+#include "bjnp-commands.h"
+#include "bjnp-io.h"
+
+/*
+ * Ink level warnings as reported by the printer
+ */
+
+static struct {
+ char *string;
+ int warning_level;
+} warning_level[] = {
+ { "SET", LEVEL_OK },
+ { "LOW", LEVEL_LOW },
+ { "IO", LEVEL_EMPTY },
+ { "", LEVEL_UNKNOWN }
+};
+
+
+/*
+ * Lookup table for cartridge properties
+*/
+
+static struct {
+ char *cart_type; /* string identifying type of cartridge */
+ char *marker_type; /* type of marker, e.g. "ink" */
+ char *marker_color; /* sRGB encoded color */
+ char *marker_name; /* supply name */
+ char *marker_low_level; /* almost empty level */
+ char *marker_high_level; /* full level */
+} cartridge_types[] = {
+ /* first define values for unknown cartridges */
+
+ { "", "ink", "#FFFFFF", "Unknown", "10", "100" },
+
+ /* This are the types we know about */
+ /* all strings must be less than 16 chars in length */
+
+ { "K", "ink", "#000000", "Black", "10", "100" },
+ { "C", "ink", "#00FFFF", "Cyan", "10", "100" },
+ { "M", "ink", "#FF00FF", "Magenta", "10", "100" },
+ { "Y", "ink", "#FFFF00", "Yellow", "10", "100" },
+ { "BK", "ink", "#000000", "Black", "10", "100" },
+ { "LC", "ink", "#E0FFFF", "LightCyan", "10", "100" },
+ { "LM", "ink", "#FF77FF", "LightMagenta", "10", "100" },
+ { "GY", "ink", "#808080", "Gray", "10", "100" },
+ { "PBK", "ink", "#000000", "PhotoBlack", "10", "100" },
+ { "CL", "ink", "#00FFFF#FF00FF#FFFF00", "Color", "10", "100" },
+
+ /* end of array record */
+
+ { NULL, NULL, NULL, NULL, "10", "100" }
+};
+
+#define reset_capability(a,b) b &= ~(a)
+
+/*
+ * Find cartridge properties
+ * Returns index in table
+ */
+static int cart_type(char *desc)
+{
+ int i;
+
+ /* index 0 is for unknown cartridges, so we start from 1 */
+ for (i = 1; cartridge_types[i].cart_type != NULL; i++) {
+ if (strcmp(cartridge_types[i].cart_type, desc) == 0) {
+ return i;
+ }
+ }
+
+ /* unrecognized carttridge */
+ bjnp_debug(LOG_NOTICE, "Unknown cartdige type %s, please report via %s!\n",
+ desc, BJNP_REPORT_URL);
+ return 0;
+}
+
+static int
+get_argument(char *buf, char *token, char *argument, int size, char *error_string)
+{
+ /*
+ * retrieve argument for parameter token
+ * stores argument in buffer argument of max size size
+ */
+ char *parameter_str;
+ int i;
+
+ /* find token string in status */
+ if ((parameter_str = strstr(buf, token)) == NULL) {
+ bjnp_debug(LOG_NOTICE,
+ "Cannot report %s, (token %s not found in status reponse)!\n", error_string, token);
+ return 0;
+ }
+
+ parameter_str += strlen(token);
+
+ /* copy argument */
+ for (i = 0; i < size - 1; i++) {
+ if (parameter_str[i] == PARAMETER_SEPARATOR ||
+ parameter_str[i] == '\0') {
+ break;
+ }
+
+ argument[i] = parameter_str[i];
+ }
+
+ argument[i] = '\0';
+ return strlen(argument);
+}
+
+static void
+report_marker_levels(printer_t *printer, char *status_buf, char first_output)
+{
+ char levels[BJNP_ARG_MAX];
+ char *token;
+ int no_cartridges = 0;
+ char *p;
+ int i;
+ int type;
+ long val;
+ int level_changed = 0;
+ int expected_type;
+ char marker_colors[BJNP_REPORT_MAX] = "";
+ char marker_low_levels[BJNP_REPORT_MAX] = "";
+ char marker_high_levels[BJNP_REPORT_MAX] = "";
+ char marker_names[BJNP_REPORT_MAX] = "";
+ char marker_types[BJNP_REPORT_MAX] = "";
+ char marker_levels[BJNP_REPORT_MAX] = "";
+ char level[16];
+
+ if ((printer->reporting_capabilities & BJNP_REPORT_MARKER_LEVELS) == 0 ||
+ (get_argument(status_buf, INK_LEVEL_TOKEN, levels, BJNP_ARG_MAX, "marker levels") == 0)) {
+ reset_capability(BJNP_REPORT_MARKER_LEVELS, printer->reporting_capabilities);
+ return;
+ }
+
+ /* now parse cartridges */
+ token = strtok(levels, INK_LEVEL_DELIMITER);
+
+ while ((token != NULL) && (no_cartridges < 16)) {
+ if ((p = index(token, '=')) == NULL) {
+ bjnp_debug(LOG_ERROR, "error parsing ink levels in %s, no ink levels output!\n",
+ token);
+ return;
+ }
+
+ *p = '\0';
+ p++;
+
+ /* get ink level */
+
+ errno = 0;
+ val = strtol(p, NULL, 10);
+
+ if (errno != 0 || val > 100 || val < 0) {
+ bjnp_debug(LOG_ERROR,
+ "error parsing ink level %s for %s, no ink levels output!\n",
+ p, token);
+ }
+
+ type = cart_type(token);
+
+ if (printer->no_cartridges == -1) {
+
+ /* first time we find cartridges, just store the type */
+
+ printer->cartridges[no_cartridges].cart_index = type;
+ } else if (printer->cartridges[no_cartridges].cart_index != type) {
+
+ /* unexpected cartridge type found */
+
+ expected_type = printer->cartridges[no_cartridges].cart_index;
+ bjnp_debug(LOG_ERROR, "Cartridge type %s (%s) expected, but found type %s (%s) in ink levels\n",
+ cartridge_types[expected_type].cart_type, cartridge_types[expected_type].marker_name,
+ token, cartridge_types[type].marker_name);
+ return;
+ }
+
+ /* check the level */
+ if (val != printer->cartridges[no_cartridges].marker_level) {
+ level_changed = 1;
+ printer->cartridges[no_cartridges].marker_level = val;
+ }
+
+ /* Next token & cartridge */
+ no_cartridges++;
+ token = strtok(NULL, INK_LEVEL_DELIMITER);
+ }
+
+ /* check if the number of cartridges found matches our expectations */
+
+ if (printer->no_cartridges != -1 && printer->no_cartridges != no_cartridges) {
+ bjnp_debug(LOG_ERROR, "Found %d ink levels, but expected %d\n",
+ no_cartridges, printer->no_cartridges);
+ } else if (printer->no_cartridges == -1) {
+ printer->no_cartridges = no_cartridges;
+ }
+
+ if (no_cartridges == 0) {
+ /* nothing to output */
+ bjnp_debug(LOG_ERROR, "No cartridges found!\n");
+ return;
+ }
+
+ /* When a level level_changed or reporting interval is exceeded, report ink levels */
+ if (level_changed || (printer->last_level_report - BJNP_MARKER_INTERVAL > 0)) {
+ printer->last_level_report = time(NULL);
+
+ /* report ink levels */
+ if (first_output) {
+
+ i = 0;
+
+ type = printer->cartridges[i].cart_index;
+
+ strcat(marker_colors, cartridge_types[type].marker_color);
+ strcat(marker_low_levels, cartridge_types[type].marker_low_level);
+ strcat(marker_high_levels, cartridge_types[type].marker_high_level);
+ strcat(marker_names, cartridge_types[type].marker_name);
+ strcat(marker_types, cartridge_types[type].marker_type);
+
+ while (++i < no_cartridges) {
+ type = printer->cartridges[i].cart_index;
+
+ strcat(marker_colors, ",");
+ strcat(marker_colors, cartridge_types[type].marker_color);
+
+ strcat(marker_low_levels, ",");
+ strcat(marker_low_levels, cartridge_types[type].marker_low_level);
+
+ strcat(marker_high_levels, ",");
+ strcat(marker_high_levels, cartridge_types[type].marker_high_level);
+
+ strcat(marker_names, ",");
+ strcat(marker_names, cartridge_types[type].marker_name);
+
+ strcat(marker_types, ",");
+ strcat(marker_types, cartridge_types[type].marker_type);
+
+ }
+
+ fprintf(stderr, "ATTR: marker-colors=\"%s\"\n", marker_colors);
+ fprintf(stderr, "ATTR: marker-low-levels=\"%s\"\n", marker_low_levels);
+ fprintf(stderr, "ATTR: marker-high-levels=\"%s\"\n", marker_high_levels);
+ fprintf(stderr, "ATTR: marker-names=\"%s\"\n", marker_names);
+ fprintf(stderr, "ATTR: marker-types=\"%s\"\n", marker_types);
+ }
+
+ i = 0;
+ sprintf(level, "%d", printer->cartridges[i].marker_level);
+ strcat(marker_levels, level);
+
+ while (++i < no_cartridges) {
+ strcat(marker_levels, ",");
+ sprintf(level, "%d", printer->cartridges[i].marker_level);
+ strcat(marker_levels, level);
+ }
+
+ fprintf(stderr, "ATTR: marker-levels=\"%s\"\n", marker_levels);
+ }
+}
+
+static int
+get_warning_level(char *string)
+{
+ int i = 0;
+
+ while (warning_level[i].warning_level != LEVEL_UNKNOWN) {
+ if (strcmp(string, warning_level[i].string) == 0) {
+ return i;
+ }
+
+ i++;
+ }
+
+ return LEVEL_UNKNOWN;
+}
+
+static char *strstrtok(char *in, const char *sep)
+{
+ static char *next = NULL;
+ char *p;
+ char *ret;
+
+ if (in != NULL) {
+ next = in;
+ }
+
+ if (next == NULL) {
+ return NULL;
+ }
+
+ ret = next;
+
+ if ((p = strstr(next, sep)) == NULL) {
+ next = NULL;
+ return ret;
+ }
+
+ *p = '\0';
+ next = p + strlen(sep);
+ return ret;
+}
+
+static int report_standard_ink_warnings(int old_level, int low, int empty)
+{
+ int new_level;
+
+ if (empty) {
+ new_level = LEVEL_EMPTY;
+ } else if (low) {
+ new_level = LEVEL_LOW;
+ } else {
+ new_level = LEVEL_OK;
+ }
+
+ if (new_level != old_level) {
+ /* reset old warning levels */
+ switch (old_level) {
+ case LEVEL_LOW:
+ fputs("STATE: -marker-supply-low-warning\n", stderr);
+ break;
+
+ case LEVEL_EMPTY:
+ fputs("STATE: -marker-supply-empty-error\n", stderr);
+ break;
+
+ case LEVEL_UNKNOWN:
+ if (new_level != LEVEL_LOW) {
+ fputs("STATE: -marker-supply-low-warning\n", stderr);
+ }
+
+ if (new_level != LEVEL_EMPTY) {
+ fputs("STATE: -marker-supply-empty-error\n", stderr);
+ }
+
+ break;
+ }
+
+ /* set new warning levels */
+ switch (new_level) {
+ case LEVEL_LOW:
+ fputs("STATE: +marker-supply-low-warning\n", stderr);
+ break;
+
+ case LEVEL_EMPTY:
+ fputs("STATE: +marker-supply-empty-error\n", stderr);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return new_level;
+}
+
+static void report_vendor_ink_warnings(char *marker_color, int old, int new)
+{
+ if (old == new) {
+ /* nothing to do */
+
+ return;
+ }
+
+ /* remove no longer valid warnings */
+ switch (old) {
+ case LEVEL_LOW:
+ fprintf(stderr, "STATE: -%s.%s-ink-low-warning\n", BJNP_VENDOR_PREFIX,
+ marker_color);
+ break;
+
+ case LEVEL_EMPTY:
+ fprintf(stderr, "STATE: -%s.%s-ink-empty-error\n", BJNP_VENDOR_PREFIX,
+ marker_color);
+ break;
+
+ case LEVEL_UNKNOWN:
+ if (new != LEVEL_LOW) {
+ fprintf(stderr, "STATE: -%s.%s-ink-low-warning\n", BJNP_VENDOR_PREFIX,
+ marker_color);
+ }
+
+ if (new != LEVEL_EMPTY) {
+ fprintf(stderr, "STATE: -%s.%s-ink-empty-error\n", BJNP_VENDOR_PREFIX,
+ marker_color);
+ }
+
+ break;
+ }
+
+ /* Set new level warnings */
+ switch (new) {
+ case LEVEL_LOW:
+ fprintf(stderr, "STATE: +%s.%s-ink-low-warning\n", BJNP_VENDOR_PREFIX,
+ marker_color);
+ break;
+
+ case LEVEL_EMPTY:
+ fprintf(stderr, "STATE: +%s.%s-ink-empty-error\n", BJNP_VENDOR_PREFIX,
+ marker_color);
+ break;
+
+ default:
+ break;
+ }
+}
+
+static int report_ink_status_messages(printer_t *printer, char *status_buf,
+ char first_output)
+{
+ char *token;
+ char warnings[BJNP_ARG_MAX];
+ int warning_level;
+ char level_low = 0;
+ char level_empty = 0;
+ int no_cartridges = 0;
+ int cartridge_type;
+ char *p;
+
+ if ((printer->reporting_capabilities & BJNP_REPORT_INK_STATUS) == 0 ||
+ get_argument(status_buf, INK_WARNING_TOKEN, warnings, BJNP_ARG_MAX, "ink status") == 0) {
+ reset_capability(BJNP_REPORT_INK_STATUS, printer->reporting_capabilities);
+ return LEVEL_OK;
+ }
+
+ /* now parse cartridges */
+
+ token = strstrtok(warnings, INK_WARNING_DELIMITER);
+
+ while ((token != NULL) && (no_cartridges < BJNP_CARTRIDGES_MAX)) {
+ if ((p = index(token, ',')) == NULL) {
+ bjnp_debug(LOG_ERROR,
+ "error in parsing warning levels in status reponse, "
+ "warning levels not supported! token = %s\n", token);
+ return !level_empty;
+ }
+
+ *p = '\0';
+ p++;
+ cartridge_type = cart_type(token);
+
+ if (printer->no_cartridges == -1) {
+ printer->cartridges[no_cartridges].cart_index = cartridge_type;
+ } else {
+ if (printer->cartridges[no_cartridges].cart_index !=
+ cartridge_type) {
+ bjnp_debug(LOG_ERROR,
+ "error in parsing warning levels in status reponse, "
+ "warning sequence does not match! token = %s\n",
+ token);
+ return !level_empty;
+ }
+ }
+
+ warning_level = get_warning_level(p);
+
+ switch (warning_level) {
+ case LEVEL_LOW:
+ level_low = 1;
+ break;
+
+ case LEVEL_EMPTY:
+ level_empty = 1;
+ break;
+
+ default:
+ /* nothing to do */
+ break;
+ }
+
+ report_vendor_ink_warnings(cartridge_types[cartridge_type].marker_name,
+ printer->cartridges[no_cartridges].warning,
+ warning_level);
+ printer->cartridges[no_cartridges].warning = warning_level;
+
+ no_cartridges++;
+ token = strstrtok(NULL, INK_WARNING_DELIMITER);
+ }
+
+ if (printer->no_cartridges == -1) {
+ /* nr of cartridges not set before */
+ printer->no_cartridges = no_cartridges;
+ } else {
+ if (printer->no_cartridges != no_cartridges)
+ bjnp_debug(LOG_ERROR, "Number of cartridges in this run is different "
+ "from first run: now: %d, first %d\n",
+ printer->no_cartridges, no_cartridges);
+ }
+
+ if (no_cartridges == 0) {
+ /* nothing to output */
+ bjnp_debug(LOG_ERROR, "No cartridges found!\n");
+ return LEVEL_OK;
+ }
+
+ printer->global_ink_warning_level = report_standard_ink_warnings(
+ printer->global_ink_warning_level, level_low, level_empty);
+ return level_empty;
+}
+
+static int
+report_printer_status(printer_t *printer, char *status_buf)
+{
+ /*
+ * parses the status string of the printer to retrieve status
+ * of the printer
+ * Returns: BJNP_OK = printer available
+ * BJNP_PRINTER_BUSY = Printer busy
+ */
+
+ char argument[BJNP_ARG_MAX];
+ unsigned int status;
+ int printer_status;
+ int ret = 0;
+
+ if ((printer->reporting_capabilities & BJNP_REPORT_PRINTER_STATUS) == 0 ||
+ (get_argument(status_buf, PRINTER_STATUS_TOKEN, argument, BJNP_ARG_MAX, "printer status") == 0)) {
+ reset_capability(BJNP_REPORT_PRINTER_STATUS, printer->reporting_capabilities);
+ return BJNP_OK;
+ }
+
+ if (sscanf(argument, "%2x", &status) == 1) {
+ bjnp_debug(LOG_DEBUG,
+ "Read printer status: %u, Printing = %d, Busy = %d, Error = %d\n",
+ status,
+ ((status & BST_PRINTING) != 0),
+ ((status & BST_BUSY) != 0),
+ ((status & BST_ERROR) != 0));
+ printer_status = status & (BST_PRINTING | BST_BUSY);
+
+ if (printer_status) {
+ ret = BJNP_PRINTER_BUSY;
+ } else {
+ ret = BJNP_OK;
+ }
+
+ if (status & BST_ERROR) {
+ ret |= BJNP_PRINTER_ERROR;
+ }
+
+ return ret;
+ }
+
+ bjnp_debug(LOG_WARN, "Could not parse printer status for tag: %s!\n",
+ PRINTER_STATUS_TOKEN);
+ return BJNP_OK;
+}
+
+static int
+report_paper_status(printer_t *printer, char *status_buf, int first_output)
+{
+ /*
+ * parses the status string of the printer to retrieve paper status
+ * of the printer
+ * Returns: BJNP_OK
+ * BJNP_NO_PAPER
+ */
+
+ char argument[BJNP_ARG_MAX];
+
+ if ((printer->reporting_capabilities & BJNP_REPORT_PAPER_STATUS) == 0 ||
+ get_argument(status_buf, PAPER_STATUS_TOKEN, argument, BJNP_ARG_MAX, "paper status") == 0) {
+ reset_capability(BJNP_REPORT_PAPER_STATUS, printer->reporting_capabilities);
+ return BJNP_OK;
+ }
+
+ if (first_output) {
+
+ /* on startup (first output) we set the out of paper state immediately */
+
+ if (strcmp(argument, DJS_PAPER_OUT) == 0) {
+ fputs("STATE: +media-empty-error\n", stderr);
+ printer->paper_out = BJNP_PAPER_OUT_THRESHOLD;
+ } else {
+ fputs("STATE: -media-empty-error\n", stderr);
+ printer->paper_out = 0;
+ }
+ } else {
+
+ /* report paper out only when we see the condition reported a number of times */
+
+ if (strcmp(argument, DJS_PAPER_OUT) == 0) {
+ if (printer->paper_out < BJNP_PAPER_OUT_THRESHOLD) {
+ printer->paper_out++;
+ bjnp_debug(LOG_DEBUG, "Paperout, condition seen %d times\n",
+ printer->paper_out);
+
+ if (printer->paper_out >= BJNP_PAPER_OUT_THRESHOLD) {
+ fputs("STATE: +media-empty-error\n", stderr);
+ }
+ }
+
+ } else {
+ /* paper out condition not found, report so if applicable,
+ * unless printing was cancelled on the printer
+ */
+
+ if (printer->paper_out >= BJNP_PAPER_OUT_THRESHOLD &&
+ strcmp(argument, DJS_CANCELLING) != 0) {
+ fputs("STATE: -media-empty-error\n", stderr);
+ printer->paper_out = 0;
+ }
+ }
+ }
+
+ return printer->paper_out >= BJNP_PAPER_OUT_THRESHOLD ? BJNP_NO_PAPER : BJNP_OK;
+}
+
+int bjnp_report_levels(printer_t *printer)
+{
+ char status_buf[BJNP_STATUS_MAX];
+ int ret = 0;
+
+ if (bjnp_get_status(printer, status_buf) != BJNP_OK) {
+ bjnp_debug(LOG_ERROR, "Cannot retrieve status, no level information!\n");
+ return BJNP_OK;
+ }
+
+ report_marker_levels(printer, status_buf, printer->first_output);
+ ret |= report_printer_status(printer, status_buf);
+ ret |= report_ink_status_messages(printer, status_buf, printer->first_output);
+ ret |= report_paper_status(printer, status_buf, printer->first_output);
+ printer->first_output = 0;
+ return ret;
+}
diff --git a/bjnp-protocol.h b/bjnp-protocol.h
index f55792b..7f2ba3a 100644
--- a/bjnp-protocol.h
+++ b/bjnp-protocol.h
@@ -1,18 +1,19 @@
/*
- * BJNP protocol definitions for the
- * bjnp backend for the Common UNIX Printing System (CUPS).
- * Copyright 2008 - 2012 by Louis Lagendijk
+ * BJNP protocol definitions for the
+ * bjnp backend for the Common UNIX Printing System (CUPS).
+ * Copyright 2008-2014 by Louis Lagendijk
*
- * These coded instructions, statements, and computer programs are the
- * property of Louis Lagendijk and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * "LICENSE" which should have been included with this file. If this
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * This program 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; version 2 only.
*
- * This file is subject to the Apple OS-Developed Software exception.
+ * This program 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.
*
- * Contents:
- * <to be added>
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _CUPS_BJNP_PROTOCOL_H_
#define _CUPS_BJNP_PROTOCOL_H_
@@ -25,140 +26,124 @@
#define BJNP_METHOD "bjnp"
/* commands */
-typedef enum bjnp_cmd_e
-{
- CMD_UDP_DISCOVER = 0x01, /* discover if service type is listening at
- this port */
- CMD_UDP_PRINT_JOB_DET = 0x10, /* send print job owner details */
- CMD_UDP_CLOSE = 0x11, /* request connection closure */
- CMD_TCP_PRINT = 0x21, /* print */
- CMD_UDP_GET_STATUS = 0x20, /* get printer status */
- CMD_UDP_GET_ID = 0x30, /* get printer identity */
- CMD_UDP_SCAN_JOB = 0x32 /* send scan job owner details */
+typedef enum bjnp_cmd_t {
+ CMD_UDP_DISCOVER = 0x01, /* discover if service type is listening at
+ this port */
+ CMD_UDP_PRINT_JOB_DET = 0x10, /* send print job owner details */
+ CMD_UDP_CLOSE = 0x11, /* request connection closure */
+ CMD_TCP_PRINT = 0x21, /* print */
+ CMD_UDP_GET_STATUS = 0x20, /* get printer status */
+ CMD_UDP_GET_ID = 0x30, /* get printer identity */
+ CMD_UDP_SCAN_JOB = 0x32 /* send scan job owner details */
} bjnp_cmd_t;
/* command type */
-typedef enum uint8_t
-{
- BJNP_CMD_PRINT = 0x1, /* printer command */
- BJNP_CMD_SCAN = 0x2, /* scanner command */
- BJNP_RES_PRINT = 0x81, /* printer response */
- BJNP_RES_SCAN = 0x82 /* scanner response */
-} bjnp_cmd_type_t;
+typedef enum bjnp_device_t {
+ BJNP_CMD_PRINT = 0x1, /* printer command */
+ BJNP_CMD_SCAN = 0x2, /* scanner command */
+ BJNP_RES_PRINT = 0x81, /* printer response */
+ BJNP_RES_SCAN = 0x82 /* scanner response */
+} bjnp_device_type_t;
/* the bjnp header, used for commands and responses */
-struct __attribute__ ((__packed__)) bjnp_header
-{
- char BJNP_id[4]; /* string: BJNP */
- uint8_t dev_type; /* 1 = printer, 2 = scanner */
- uint8_t cmd_code; /* command code/response code */
- uint16_t unknown1; /* unknown, always 0? */
- uint16_t seq_no; /* sequence number */
- uint16_t session_id; /* session id for printing */
- uint32_t payload_len; /* length of command buffer */
+struct __attribute__((__packed__)) bjnp_header {
+ char BJNP_id[4]; /* string: BJNP */
+ uint8_t dev_type; /* 1 = printer, 2 = scanner */
+ uint8_t cmd_code; /* command code/response code */
+ uint16_t unknown1; /* unknown, always 0? */
+ uint16_t seq_no; /* sequence number */
+ uint16_t session_id; /* session id for printing */
+ uint32_t payload_len; /* length of command buffer */
};
#define bjnp_header_size sizeof(struct bjnp_header)
/* command definition */
-typedef union __attribute__ ((__packed__)) bjnp_command_u
- {
+union __attribute__((__packed__)) bjnp_command_u {
struct bjnp_header header;
- struct __attribute__ ((__packed__))
- {
+ struct __attribute__((__packed__)) {
struct bjnp_header header;
- } udp_discover;
- struct __attribute__ ((__packed__))
- {
+ } udp_discover;
+ struct __attribute__((__packed__)) {
struct bjnp_header header;
- char unknown[8]; /* don't know what these are for */
- char hostname[64]; /* hostname of sender */
- char username[64]; /* username */
- char jobtitle[256]; /* job title */
- } udp_job_details;
- struct __attribute__ ((__packed__))
- {
+ char unknown[8]; /* don't know what these are for */
+ char hostname[64]; /* hostname of sender */
+ char username[64]; /* username */
+ char jobtitle[256]; /* job title */
+ } udp_job_details;
+ struct __attribute__((__packed__)) {
struct bjnp_header header;
- } udp_close;
- struct __attribute__ ((__packed__))
- {
+ } udp_close;
+ struct __attribute__((__packed__)) {
struct bjnp_header header;
char data [BJNP_PRINTBUF_MAX];
- /* data to be printer */
- } tcp_print;
- struct __attribute__ ((__packed__))
- {
+ /* data to be printer */
+ } tcp_print;
+ struct __attribute__((__packed__)) {
struct bjnp_header header;
- } udp_get_status;
- struct __attribute__ ((__packed__))
- {
+ } udp_get_status;
+ struct __attribute__((__packed__)) {
struct bjnp_header header;
- } udp_get_id;
- } bjnp_command_u;
-
-typedef union __attribute__ ((__packed__)) bjnp_response_u
-{
- struct bjnp_header header;
- struct __attribute__ ((__packed__))
- {
- struct bjnp_header header;
- char unknown1[4]; /* 00 01 08 00 */
- char mac_len; /* length of mac address */
- char addr_len; /* length od address field */
- unsigned char mac_addr[6];/* printers mac address */
- union __attribute__ ((__packed__) )
- {
- struct __attribute__ ((__packed__))
- {
- unsigned char ipv4_addr[4];
- /* a single IPv4 address */
- } ipv4;
- struct __attribute__ ((__packed__))
- {
+ } udp_get_id;
+} bjnp_command_u;
+
+
+typedef union __attribute__((__packed__)) bjnp_response_u {
+ struct bjnp_header header;
+ struct __attribute__((__packed__)) {
+ struct bjnp_header header;
+ char unknown1[4]; /* 00 01 08 00 */
+ char mac_len; /* length of mac address */
+ char addr_len; /* length od address field */
+ unsigned char mac_addr[6];/* printers mac address */
+ union __attribute__((__packed__)) {
+ struct __attribute__((__packed__)) {
+ unsigned char ipv4_addr[4];
+ /* a single IPv4 address */
+ }
+ ipv4;
+ struct __attribute__((__packed__)) {
unsigned char ipv6_addr[8][16];
- /* array of IPv6 address */
- } ipv6;
- } addresses;
+ /* array of IPv6 address */
+ }
+ ipv6;
+ }
+ addresses;
} udp_discover_response;
-
- struct __attribute__ ((__packed__))
- {
- struct bjnp_header header;
- } udp_print_job_details_response;
-
- struct __attribute__ ((__packed__))
- {
- struct bjnp_header header;
+
+ struct __attribute__((__packed__)) {
+ struct bjnp_header header;
+ } udp_print_job_details_response;
+
+ struct __attribute__((__packed__)) {
+ struct bjnp_header header;
} udp_close_response;
-
- struct __attribute__ ((__packed__))
- {
- struct bjnp_header header;
- uint32_t accepted; /* nr of bytes accepted by printer */
- } tcp_print_response;
-
- struct __attribute__ ((__packed__))
- {
- struct bjnp_header header;
- uint16_t status_len; /* length of status field */
- char status[2048];
+
+ struct __attribute__((__packed__)) {
+ struct bjnp_header header;
+ uint32_t accepted; /* nr of bytes accepted by printer */
+ } tcp_print_response;
+
+ struct __attribute__((__packed__)) {
+ struct bjnp_header header;
+ uint16_t status_len; /* length of status field */
+ char status[BJNP_UDP_MAX];
} udp_status_response;
-
- struct __attribute__ ((__packed__))
- {
- struct bjnp_header header;
- uint16_t id_len; /* length of identity field */
- char id[2048]; /* identity */
+
+ struct __attribute__((__packed__)) {
+ struct bjnp_header header;
+ char status[BJNP_UDP_MAX];
+ } udp_status_response_v2;
+
+ struct __attribute__((__packed__)) {
+ struct bjnp_header header;
+ uint16_t id_len; /* length of identity field */
+ char id[2048]; /* identity */
} udp_identity_response;
- char fillers[4096];
+ char fillers[65536];
} bjnp_response_u;
-#define BST_PRINTING 0x80
-#define BST_BUSY 0x20
-#define BST_OPCALL 0x08
-#define STR_BST "BST:"
-
#endif /* _CUPS_BJNP_PROTOCOL_H_ */
diff --git a/bjnp-runloop.c b/bjnp-runloop.c
index 17f18e3..4163446 100644
--- a/bjnp-runloop.c
+++ b/bjnp-runloop.c
@@ -1,26 +1,26 @@
/*
*
- * bjnp specifc run loop APIs for the Common UNIX Printing System (CUPS).
- * Copyright 2008 by Louis Lagendijk
+ * bjnp specifc run loop APIs for the Common UNIX Printing System (CUPS).
+ * Copyright 2008-2014 by Louis Lagendijk
*
- * based on:
+ * based on:
*
- * Common run loop APIs for the Common UNIX Printing System (CUPS).
+ * Common run loop APIs for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007-2008 by Apple Inc.
- * Copyright 2006-2007 by Easy Software Products, all rights reserved.
+ * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2006-2007 by Easy Software Products, all rights reserved.
*
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * "LICENSE" which should have been included with this file. If this
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * This program 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; version 2 only.
*
- * This file is subject to the Apple OS-Developed Software exception.
+ * This program 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.
*
- * Contents:
- *
- * backendRunLoop() - Read and write print and back-channel data.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
@@ -40,440 +40,396 @@
* 'backendRunLoop()' - Read and write print and back-channel data.
*/
-ssize_t /* O - Total bytes on success, -1 on error */
-bjnp_backendRunLoop (int print_fd, /* I - Print file descriptor */
- int device_fd, /* I - Device file descriptor */
- http_addr_t * addr)
- /* I - address for printer */
+ssize_t /* O - Total bytes on success, */
+/* -1 on error */
+bjnp_backendRunLoop(int print_fd, /* I - Print file descriptor */
+ printer_t *printer) /* I - address for printer */
{
- int send_keep_alive; /* flag that an empty data packet should be sent to printer */
- int nfds; /* Maximum file descriptor value + 1 */
- fd_set input, /* Input set for reading */
- output; /* Output set for writing */
- ssize_t print_bytes, /* Print bytes read */
- total_bytes, /* Total bytes written */
- bytes; /* Bytes written */
- int result; /* result code from select */
- int paperout, /* "Paper out" status */
- ack_pending; /* io slot status */
- int offline; /* "Off-line" status */
- int draining; /* Drain command recieved? */
- char print_buffer[BJNP_PRINTBUF_MAX],
- /* Print data buffer */
- *print_ptr; /* Pointer into print data buffer */
- struct timeval timeout;
+ int send_keep_alive; /* flag that an empty data packet */
+ /* should be sent to printer */
+ int nfds; /* Maximum file descriptor value + 1 */
+ int device_fd; /* Device file descriptor */
+ fd_set input, /* Input set for reading */
+ output; /* Output set for writing */
+ ssize_t print_bytes, /* Print bytes read */
+ total_bytes, /* Total bytes written */
+ bytes; /* Bytes written */
+ int result; /* result code from select */
+ int ack_pending; /* io slot status */
+ int draining; /* Drain command received? */
+ char print_buffer[BJNP_PRINTBUF_MAX], /* Print data buffer */
+ *print_ptr; /* Pointer into print data buffer */
+ struct timeval timeout;
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
+ struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
#if BJNP_CUPS_VERSION >= 103
- int side_channel_open; /* side channel status */
- cups_sc_command_t command; /* Request command */
- cups_sc_status_t status; /* Request/response status */
- char data[16536]; /* Request/response data */
- int datalen; /* Request/response data size */
- char model[BJNP_MODEL_MAX]; /* printer make & model */
- char dev_id[BJNP_IEEE1284_MAX]; /* IEEE1284 device id */
+ int side_channel_open; /* side channel status */
+ cups_sc_command_t command; /* Request command */
+ cups_sc_status_t status; /* Request/response status */
+ char data[16536]; /* Request/response data */
+ int datalen; /* Request/response data size */
+ char model[BJNP_MODEL_MAX]; /* printer make & model */
+ char dev_id[BJNP_IEEE1284_MAX]; /* IEEE1284 device id */
#endif /* cups >= 1.3 */
- fprintf (stderr,
- "DEBUG: bjnp_backendRunLoop(print_fd=%d, device_fd=%d\n",
- print_fd, device_fd);
-
- /*
- * If we are printing data from a print driver on stdin, ignore SIGTERM
- * so that the driver can finish out any page data, e.g. to eject the
- * current page. We only do this for stdin printing as otherwise there
- * is no way to cancel a raw print job...
- */
-
- if (!print_fd)
- {
-#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
- sigset (SIGTERM, SIG_IGN);
+ fprintf(stderr,
+ "DEBUG: bjnp_backendRunLoop(print_fd=%d\n", print_fd);
+
+ /*
+ * If we are printing data from a print driver on stdin, ignore SIGTERM
+ * so that the driver can finish out any page data, e.g. to eject the
+ * current page. We only do this for stdin printing as otherwise there
+ * is no way to cancel a raw print job...
+ */
+
+ if (!print_fd) {
+#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+ sigset(SIGTERM, SIG_IGN);
#elif defined(HAVE_SIGACTION)
- memset (&action, 0, sizeof (action));
+ memset(&action, 0, sizeof(action));
- sigemptyset (&action.sa_mask);
- action.sa_handler = SIG_IGN;
- sigaction (SIGTERM, &action, NULL);
+ sigemptyset(&action.sa_mask);
+ action.sa_handler = SIG_IGN;
+ sigaction(SIGTERM, &action, NULL);
#else
- signal (SIGTERM, SIG_IGN);
+ signal(SIGTERM, SIG_IGN);
#endif /* HAVE_SIGSET */
}
- /*
- * Figure out the maximum file descriptor value to use with select()...
- */
+ /*
+ * Figure out the maximum file descriptor value to use with select()...
+ */
- nfds = (print_fd > device_fd ? print_fd : device_fd) + 1;
+ device_fd = bjnp_get_device_fd(printer);
+ nfds = (print_fd > device_fd ? print_fd : device_fd) + 1;
- print_bytes = 0;
- print_ptr = print_buffer,
- offline = -1;
- paperout = -1;
- total_bytes = 0;
- ack_pending = 0;
- draining = 0;
- send_keep_alive = 0;
- side_channel_open = 1;
+ print_bytes = 0;
+ print_ptr = print_buffer,
+ total_bytes = 0;
+ ack_pending = 0;
+ draining = 0;
+ send_keep_alive = 0;
+ side_channel_open = 1;
+ int last_marker_level_time = time(NULL);
- /*
- * Now loop until we are out of data from print_fd...
- */
+ /*
+ * Now loop until we are out of data from print_fd...
+ */
- while (1)
- {
- /*
- * Use select() to determine whether we have data to copy around...
- */
+ while (1) {
+ /*
+ * Use select() to determine whether we have data to copy around...
+ */
- FD_ZERO (&input);
- FD_ZERO (&output);
+ FD_ZERO(&input);
+ FD_ZERO(&output);
- /*
- * Accept new printdata only when no data is left
- */
+ /*
+ * Accept new printdata only when no data is left
+ */
- if (!print_bytes)
- FD_SET (print_fd, &input);
+ if (!print_bytes) {
+ FD_SET(print_fd, &input);
+ }
- /*
- * accept backchannel data from printer, used for acks
- */
+ /*
+ * accept backchannel data from printer, used for acks
+ */
- FD_SET (device_fd, &input);
+ FD_SET(device_fd, &input);
- /*
- * Accept side channel data, unless there is print data pending (cups >= 1.3)
- */
+ /*
+ * Accept side channel data, unless there is print data pending
+ * (cups >= 1.3)
+ */
#if BJNP_CUPS_VERSION >= 103
- if (side_channel_open && !print_bytes && !draining)
- FD_SET (CUPS_SC_FD, &input);
+
+ if (side_channel_open && !print_bytes && !draining) {
+ FD_SET(CUPS_SC_FD, &input);
+ }
+
#endif
- /*
- * Check if printer is ready to receive data when we have something to send
- * (printdata is left or keep-alive is to be sent) but no ack is pending
- */
-
- if ((send_keep_alive || print_bytes) && !ack_pending)
- FD_SET (device_fd, &output);
-
- timeout.tv_sec = KEEP_ALIVE_SECONDS;
-
- timeout.tv_usec = 0;
-
- result = select (nfds, &input, &output, NULL, &timeout);
-
- if (result < 0)
- {
- /*
- * Pause printing to clear any pending errors...
- */
-
- if (errno == ENXIO && offline != 1)
- {
- fputs ("STATE: +offline-error\n", stderr);
- _cupsLangPuts (stderr,
- _("INFO: Printer is currently off-line.\n"));
- offline = 1;
- }
- else if (errno == EINTR && total_bytes == 0)
- {
- fputs ("DEBUG: Received an interrupt before any bytes were "
- "written, aborting!\n", stderr);
- return (0);
- }
-
- sleep (1);
- continue;
- }
- if (result == 0)
- {
- /*
- * timeout - no data for printer; make sure that next time we
- * send a keep-alive packet to avoid that connection to printer
- * times out
- */
- if (!ack_pending)
- send_keep_alive = 1;
-
- bjnp_debug (LOG_DEBUG,
- "bjnp_runloop: select timeout send_keep_alive=%d print_fd=%d "
- "device_fd=%d print_bytes=%d ack_pending=%d\n",
- send_keep_alive, print_fd, device_fd, print_bytes,
- ack_pending);
- continue;
- }
+ /*
+ * Check if printer is ready to receive data when we have something to
+ * send (printdata is left or keep-alive is to be sent) but no ack is
+ * pending
+ */
-#if BJNP_CUPS_VERSION >= 103
+ if ((send_keep_alive || print_bytes) && !ack_pending) {
+ FD_SET(device_fd, &output);
+ }
- /*
- * Check if we have a side-channel request ready (cups >= 1.3)...
- */
+ timeout.tv_sec = KEEP_ALIVE_SECONDS;
- if (FD_ISSET (CUPS_SC_FD, &input))
- {
- /*
- * Do the side-channel request
- */
+ timeout.tv_usec = 0;
- datalen = sizeof (data) -1;
+ result = select(nfds, &input, &output, NULL, &timeout);
- if (cupsSideChannelRead (&command, &status, data, &datalen, 1.0) != 0)
- {
- /* side channel is closed, or we lost synchronization */
- side_channel_open = 0;
+ if (result < 0) {
+ if (errno == EINTR && total_bytes == 0) {
+ fputs("DEBUG: Received an interrupt before any bytes were "
+ "written, aborting!\n", stderr);
+ return 0;
}
- else
- {
- bjnp_debug (LOG_DEBUG, "Received side-channel request, command is %d\n", command);
- switch (command)
- {
- case CUPS_SC_CMD_DRAIN_OUTPUT:
-
- /*
- * Our sockets disable the Nagle algorithm and data is sent immediately.
- *
- */
-
- draining = 1;
-
- /* we will do cupsSideChannelWrite() once there is no data left ! */
- break;
-
- case CUPS_SC_CMD_GET_BIDI:
- status = CUPS_SC_STATUS_OK;
- data[0] = CUPS_SC_BIDI_NOT_SUPPORTED;
- datalen = 1;
- cupsSideChannelWrite (command, status, data, datalen, 1.0);
- break;
-
- case CUPS_SC_CMD_GET_DEVICE_ID:
- if (bjnp_backendGetDeviceID
- (dev_id, sizeof (dev_id), model, sizeof (model)) == 0)
- {
- status = CUPS_SC_STATUS_OK;
- strncpy (data, dev_id, sizeof (data));
- datalen = (int) strlen (data);
- }
- else
- {
- status = CUPS_SC_STATUS_IO_ERROR;
- datalen = 0;
- }
- cupsSideChannelWrite (command, status, data, datalen, 1.0);
- break;
+
+ sleep(1);
+ continue;
+ }
+
+ /* report ink/marker levels when interval has expired */
+
+ if (time(NULL) - last_marker_level_time > BJNP_REPORT_INTERVAL) {
+ bjnp_report_levels(printer);
+ last_marker_level_time = time(NULL);
+ }
+
+ if (result == 0) {
+ /*
+ * timeout - no data for printer; make sure that next time we
+ * send a keep-alive packet to avoid that connection to printer
+ * times out
+ */
+ if (!ack_pending) {
+ send_keep_alive = 1;
+ }
+
+ bjnp_debug(LOG_DEBUG,
+ "bjnp_runloop: select timeout send_keep_alive=%d print_fd=%d "
+ "device_fd=%d print_bytes=%d ack_pending=%d\n",
+ send_keep_alive, print_fd, device_fd, print_bytes,
+ ack_pending);
+ continue;
+ }
+
+#if BJNP_CUPS_VERSION >= 103
+
+ /*
+ * Check if we have a side-channel request ready (cups >= 1.3)...
+ */
+
+ if (FD_ISSET(CUPS_SC_FD, &input)) {
+ /*
+ * Do the side-channel request
+ */
+
+ datalen = sizeof(data) - 1;
+
+ if (cupsSideChannelRead(&command, &status, data, &datalen, 1.0) !=
+ 0) {
+ /* side channel is closed, or we lost synchronization */
+ side_channel_open = 0;
+ } else {
+ bjnp_debug(LOG_DEBUG, "Received side-channel request, command is %d\n",
+ command);
+
+ switch (command) {
+ case CUPS_SC_CMD_DRAIN_OUTPUT:
+
+ /*
+ * Our sockets disable the Nagle algorithm and data is
+ * sent immediately.
+ *
+ */
+
+ draining = 1;
+
+ /*
+ * we will do cupsSideChannelWrite() once there is no
+ * data left !
+ */
+ break;
+
+ case CUPS_SC_CMD_GET_BIDI:
+ status = CUPS_SC_STATUS_OK;
+ data[0] = CUPS_SC_BIDI_NOT_SUPPORTED;
+ datalen = 1;
+ cupsSideChannelWrite(command, status, data, datalen,
+ 1.0);
+ break;
+
+ case CUPS_SC_CMD_GET_DEVICE_ID:
+ if (bjnp_backendGetDeviceID
+ (printer, dev_id, sizeof(dev_id), model,
+ sizeof(model)) == 0) {
+ status = CUPS_SC_STATUS_OK;
+ strncpy(data, dev_id, sizeof(data));
+ datalen = (int) strlen(data);
+ } else {
+ status = CUPS_SC_STATUS_IO_ERROR;
+ datalen = 0;
+ }
+
+ cupsSideChannelWrite(command, status, data, datalen,
+ 1.0);
+ break;
#if BJNP_CUPS_VERSION >= 105
- case CUPS_SC_CMD_GET_CONNECTED:
- status = CUPS_SC_STATUS_OK;
- data[0] = (device_fd != -1);
- datalen = 1;
- break;
+
+ case CUPS_SC_CMD_GET_CONNECTED:
+ status = CUPS_SC_STATUS_OK;
+ data[0] = (device_fd != -1);
+ datalen = 1;
+ break;
#endif
+ default:
+
+ /*
+ * this covers the following values
+ *
+ * case CUPS_SC_CMD_GET_STATE:
+ * case CUPS_SC_CMD_SOFT_RESET:
+ *
+ * for CUPS 1.4 and later
+ *
+ * case CUPS_SC_CMD_SNMP_GET:
+ * case CUPS_SC_CMD_SNMP_GET_NEXT:
+ *
+ * these values should not occur
+ * case CUPS_SC_CMD_NONE:
+ * case CUPS_SC_CMD_MAX:
+ */
+
+ status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
+ datalen = 0;
+ cupsSideChannelWrite(command, status, data, datalen,
+ 1.0);
+ break;
+ }
+
+ }
+ }
+
+#endif
+ /*
+ * Check if we have back-channel data (ack) ready...
+ */
+
+ if (FD_ISSET(device_fd, &input)) {
+ switch (bjnp_backchannel(printer, &bytes)) {
+ case BJNP_IO_ERROR:
+ if (errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR) {
+ perror("ERROR: failed to read backchannel data");
+ return -1;
+ }
+
+ break;
+
+ case BJNP_OK:
+ print_bytes -= bytes;
+ print_ptr += bytes;
+ total_bytes += bytes;
+ ack_pending = 0;
+
+ /*
+ * Success, reset error conditions
+ */
+
+ fprintf(stderr, "DEBUG: Wrote %d bytes of print data...\n",
+ (int) bytes);
+ break;
+
+ case BJNP_THROTTLE:
+
+ /*
+ * Data not accepted by printer, check paper out condition
+ */
+
+ ack_pending = 0;
+ break;
+
+ case BJNP_NOT_AN_ACK:
+ /* what we received was not an ack, no action */
+ break;
+
default:
+ /* no action */
+ break;
+ }
+ }
+
+ /*
+ * Check if we have print data ready...
+ */
- /*
- * this covers the following values
- *
- * case CUPS_SC_CMD_GET_STATE:
- * case CUPS_SC_CMD_SOFT_RESET:
- *
- * for CUPS 1.4 and later
- *
- * case CUPS_SC_CMD_SNMP_GET:
- * case CUPS_SC_CMD_SNMP_GET_NEXT:
- *
- * these values should not occur
- * case CUPS_SC_CMD_NONE:
- * case CUPS_SC_CMD_MAX:
+ if (FD_ISSET(print_fd, &input)) {
+ if ((print_bytes = read(print_fd, print_buffer,
+ sizeof(print_buffer))) < 0) {
+ /*
+ * Read error - bail if we don't see EAGAIN or EINTR...
*/
- status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
- datalen = 0;
- cupsSideChannelWrite (command, status, data, datalen, 1.0);
- break;
- }
+ if (errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR) {
+ perror("ERROR: Unable to read print data");
+ return -1;
+ }
- }
- }
-#endif
- /*
- * Check if we have back-channel data (ack) ready...
- */
-
- if (FD_ISSET (device_fd, &input))
- {
- result = bjnp_backchannel (device_fd, &bytes);
- switch (result)
- {
- case BJNP_IO_ERROR:
- perror ("ERROR: failed to read backchannel data");
- return (-1);
- break;
- case BJNP_OK:
- print_bytes -= bytes;
- print_ptr += bytes;
- total_bytes += bytes;
- ack_pending = 0;
-
- /*
- * Success, reset paper out error conditions
- */
-
- if (paperout)
- {
- fputs ("STATE: -media-empty-error\n", stderr);
- paperout = 0;
- }
-
- fprintf (stderr, "DEBUG: Wrote %d bytes of print data...\n",
- (int) bytes);
- break;
- case BJNP_THROTTLE:
- /*
- * Data not accepted by printer, check paper out condition
- */
-
- if ((paperout != 1)
- && (bjnp_get_paper_status (addr) == BJNP_PAPER_OUT))
- {
- fputs ("STATE: +media-empty-error\n", stderr);
- _cupsLangPuts (stderr, _("ERROR: Out of paper!\n"));
- paperout = 1;
- }
- ack_pending = 0;
- break;
-
- case BJNP_NOT_AN_ACK:
- /* what we received was not an ack, no action */
- break;
-
- default:
- /* no action */
- break;
- }
- }
-
- /*
- * Check if we have print data ready...
- */
-
- if (FD_ISSET (print_fd, &input))
- {
- if ((print_bytes = read (print_fd, print_buffer,
- sizeof (print_buffer))) < 0)
- {
- /*
- * Read error - bail if we don't see EAGAIN or EINTR...
- */
-
- if (errno != EAGAIN || errno != EINTR)
- {
- perror ("ERROR: Unable to read print data");
- return (-1);
- }
-
- print_bytes = 0;
- }
- else if (print_bytes == 0)
- {
- /*
- * End of input file, break out of the loop
- */
+ print_bytes = 0;
+ } else if (print_bytes == 0) {
+ /*
+ * End of input file, break out of the loop
+ */
#if BJNP_CUPS_VERSION >= 103
- if (draining)
- {
- command = CUPS_SC_CMD_DRAIN_OUTPUT;
- status = CUPS_SC_STATUS_OK;
- datalen = 0;
- cupsSideChannelWrite (command, status, data, datalen, 1.0);
- draining = 0;
- }
+ if (draining) {
+ command = CUPS_SC_CMD_DRAIN_OUTPUT;
+ status = CUPS_SC_STATUS_OK;
+ datalen = 0;
+ cupsSideChannelWrite(command, status, data, datalen, 1.0);
+ draining = 0;
+ }
+
#endif
- break;
- }
- else
- {
- print_ptr = print_buffer;
-
- fprintf (stderr, "DEBUG: Read %d bytes of print data...\n",
- (int) print_bytes);
- }
- }
-
- /*
- * Check if the device is ready to receive data and we have data to
- * send...
- */
-
- if ((send_keep_alive || print_bytes) && FD_ISSET (device_fd, &output))
- {
- bytes = bjnp_write (device_fd, print_ptr, print_bytes);
- send_keep_alive = 0;
- if (bytes < 0)
- {
- /*
- * Write error - bail if we don't see an error we can retry...
- */
-
- if (errno == ENOSPC)
- {
- if (paperout != 1)
- {
- fputs ("STATE: +media-empty-error\n", stderr);
- _cupsLangPuts (stderr, _("ERROR: Out of paper!\n"));
- paperout = 1;
- }
- }
- else if (errno == ENXIO)
- {
- if (offline != 1)
- {
- fputs ("STATE: +offline-error\n", stderr);
- _cupsLangPuts (stderr,
- _
- ("INFO: Printer is currently off-line.\n"));
- offline = 1;
- }
- }
- else if (errno != !EAGAIN && errno != EINTR && errno != ENOTTY)
- {
- fprintf (stderr,
- _("ERROR: Unable to write print data: %s\n"),
- strerror (errno));
- return (-1);
- }
- }
- else
- {
- if (offline)
- {
- fputs ("STATE: -offline-error\n", stderr);
- _cupsLangPuts (stderr,
- _("INFO: Printer is now on-line.\n"));
- offline = 0;
- }
-
- /*
- * we sent data, wait for the ack before sending more data
- */
-
- ack_pending = 1;
- }
- }
+ break;
+ } else {
+ print_ptr = print_buffer;
+
+ fprintf(stderr, "DEBUG: Read %d bytes of print data...\n",
+ (int) print_bytes);
+ }
+ }
+
+ /*
+ * Check if the device is ready to receive data and we have data to
+ * send...
+ */
+
+ if ((send_keep_alive || print_bytes) && FD_ISSET(device_fd, &output)) {
+ bytes = bjnp_write(printer, print_ptr, print_bytes);
+ send_keep_alive = 0;
+
+ if (bytes < 0) {
+ /*
+ * Write error - bail if we don't see an error we can retry...
+ */
+
+ if (errno != !EAGAIN && errno != EWOULDBLOCK &&
+ errno != EINTR && errno != ENOTTY && errno != ENOSPC) {
+ fprintf(stderr,
+ _("ERROR: Unable to write print data: %s\n"),
+ strerror(errno));
+ return -1;
+ }
+ } else {
+
+ /*
+ * we sent data, wait for the ack before sending more data
+ */
+
+ ack_pending = 1;
+ }
+ }
}
- /*
- * Return with success...
- */
+ /*
+ * Return with success...
+ */
- return (total_bytes);
+ return (total_bytes);
}
diff --git a/bjnp-utils.c b/bjnp-utils.c
index bcb37eb..fb2c77c 100644
--- a/bjnp-utils.c
+++ b/bjnp-utils.c
@@ -1,18 +1,19 @@
/*
- * TCP/IP IO communication implementation for
- * bjnp backend for the Common UNIX Printing System (CUPS).
- * Copyright 2008 by Louis Lagendijk
+ * utility functions
+ * bjnp backend for the Common UNIX Printing System (CUPS).
+ * Copyright 2008-2014 by Louis Lagendijk
*
- * These coded instructions, statements, and computer programs are the
- * property of Louis Lagendijk and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * "LICENSE" which should have been included with this file. If this
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * This program 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; version 2 only.
*
- * This file is subject to the Apple OS-Developed Software exception.
+ * This program 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.
*
- * Contents:
- * Utility functions
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -21,304 +22,348 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include "bjnp.h"
+#include "bjnp-protocol.h"
+#include "bjnp-io.h"
+#include "bjnp-commands.h"
+#include "bjnp-io.h"
-int sa_is_equal( const http_addr_t * sa1, const http_addr_t * sa2)
-{
- if ((sa1 == NULL) || (sa2 == NULL) )
- return 0;
+#define DES_TOKEN "DES:"
- if (sa1->addr.sa_family == sa2-> addr.sa_family)
- {
- if( sa1 -> addr.sa_family == AF_INET)
- {
- if ( (sa1->ipv4.sin_port == sa2->ipv4.sin_port) &&
- (sa1->ipv4.sin_addr.s_addr == sa2->ipv4.sin_addr.s_addr))
- {
- return 1;
+static int sa_is_equal(const http_addr_t sa1, const http_addr_t sa2)
+{
+ if (sa1.addr.sa_family == sa2.addr.sa_family) {
+ if (sa1.addr.sa_family == AF_INET) {
+ if ((sa1.ipv4.sin_port == sa2.ipv4.sin_port) &&
+ (sa1.ipv4.sin_addr.s_addr == sa2.ipv4.sin_addr.s_addr)) {
+ return 1;
}
}
+
#ifdef ENABLE_IPV6
- else if (sa1 -> addr.sa_family == AF_INET6 )
- {
- if ( (sa1-> ipv6.sin6_port == sa2->ipv6.sin6_port) &&
- (memcmp(&(sa1->ipv6.sin6_addr), &(sa2->ipv6.sin6_addr), sizeof(struct in6_addr)) == 0))
- {
- return 1;
+ else if (sa1.addr.sa_family == AF_INET6) {
+ if ((sa1.ipv6.sin6_port == sa2.ipv6.sin6_port) &&
+ (memcmp(&(sa1.ipv6.sin6_addr), &(sa2.ipv6.sin6_addr),
+ sizeof(struct in6_addr)) == 0)) {
+ return 1;
}
}
+
#endif
}
+
return 0;
}
-int sa_size( const http_addr_t *sa)
+int sa_size(const http_addr_t sa)
{
- switch (sa -> addr.sa_family)
- {
- case AF_INET:
- return (sizeof(struct sockaddr_in) );
+ switch (sa.addr.sa_family) {
+ case AF_INET:
+ return (sizeof(struct sockaddr_in));
#ifdef ENABLE_IPV6
- case AF_INET6:
- return (sizeof(struct sockaddr_in6) );
+
+ case AF_INET6:
+ return (sizeof(struct sockaddr_in6));
#endif
- default:
- /* should not occur */
- return sizeof( http_addr_t );
+
+ default:
+ /* should not occur */
+ return sizeof(http_addr_t);
}
}
-int get_protocol_family( const http_addr_t *sa)
+int get_protocol_family(const http_addr_t sa)
{
- switch (sa -> addr.sa_family)
- {
- case AF_INET:
- return PF_INET;
- break;
+ switch (sa.addr.sa_family) {
+ case AF_INET:
+ return PF_INET;
+ break;
#ifdef ENABLE_IPV6
- case AF_INET6:
- return PF_INET6;
- break;
+
+ case AF_INET6:
+ return PF_INET6;
+ break;
#endif
- default:
- /* should not occur */
- return -1;
+
+ default:
+ /* should not occur */
+ return -1;
}
}
-void get_address_info ( const http_addr_t *addr, char * addr_string, int *port)
+void get_address_info(const http_addr_t *addr, char *addr_string, int *port,
+ char *family)
{
- char tmp_addr[BJNP_HOST_MAX];
- if ( addr->addr.sa_family == AF_INET)
- {
- inet_ntop( AF_INET, &(addr -> ipv4.sin_addr.s_addr), addr_string, BJNP_HOST_MAX);
- *port = ntohs (addr->ipv4.sin_port);
+ char tmp_addr[BJNP_HOST_MAX];
+
+ if (addr->addr.sa_family == AF_INET) {
+ inet_ntop(AF_INET, &(addr -> ipv4.sin_addr.s_addr), addr_string,
+ BJNP_HOST_MAX);
+ *port = ntohs(addr->ipv4.sin_port);
+ strcpy(family, BJNP_FAMILY_IPV4);
}
+
#ifdef ENABLE_IPV6
- else if (addr->addr.sa_family == AF_INET6)
- {
- inet_ntop( AF_INET6, addr -> ipv6.sin6_addr.s6_addr, tmp_addr, sizeof(tmp_addr) );
-
- if (IN6_IS_ADDR_LINKLOCAL( &(addr -> ipv6.sin6_addr) ) )
- sprintf(addr_string, "[%s%%%d]", tmp_addr, addr -> ipv6.sin6_scope_id);
- else
- sprintf(addr_string, "[%s]", tmp_addr);
-
- *port = ntohs (addr->ipv6.sin6_port);
+ else if (addr->addr.sa_family == AF_INET6) {
+ inet_ntop(AF_INET6, addr->ipv6.sin6_addr.s6_addr, tmp_addr,
+ sizeof(tmp_addr));
+
+ if (IN6_IS_ADDR_LINKLOCAL(&(addr->ipv6.sin6_addr))) {
+ sprintf(addr_string, "[%s%%%d]", tmp_addr,
+ addr->ipv6.sin6_scope_id);
+ } else {
+ sprintf(addr_string, "[%s]", tmp_addr);
+ }
+
+ *port = ntohs(addr->ipv6.sin6_port);
+ strcpy(family, BJNP_FAMILY_IPV6);
}
+
#endif
- else
- {
- /* unknown address family, should not occur */
- strcpy(addr_string, "Unknown address family");
- *port = 0;
+ else {
+ /* unknown address family, should not occur */
+ strcpy(addr_string, "Unknown address family");
+ *port = 0;
+ strcpy(family, BJNP_FAMILY_UNKNOWN);
}
}
+void get_printer_address_info(const printer_t *printer, char *addr_string,
+ int *port, char *family)
+{
+ get_address_info(&(printer->printer_sa), addr_string, port, family);
+}
+
int
-parse_IEEE1284_to_model (char *printer_id, char *model)
+parse_IEEE1284_to_model(char *printer_id, char *model)
{
-/*
- * parses the IEEE1284 ID of the printer to retrieve make and model
- * of the printer
- * Returns: 0 = not found
- * 1 = found, model is set
- */
+ /*
+ * parses the IEEE1284 ID of the printer to retrieve make and model
+ * of the printer
+ * Returns: 0 = not found
+ * 1 = found, model is set
+ */
+
+ char s[BJNP_IEEE1284_MAX];
+ char *tok;
+ int len;
+
+ model[0] = '\0';
+ len = strlen(printer_id);
+
+ if ((len > BJNP_IEEE1284_MAX) || (len < 0)) {
+ bjnp_debug(LOG_ERROR, "printer id string (length) incorrect: %d\n",
+ len);
+ }
- char s[BJNP_IEEE1284_MAX];
- char *tok;
+ strcpy(s, printer_id);
- strcpy (s, printer_id);
- model[0] = '\0';
+ tok = strtok(s, ";");
- tok = strtok (s, ";");
- while (tok != NULL)
- {
- /* DES contains make and model */
+ while (tok != NULL) {
+ /* DES contains make and model */
- if (strncmp (tok, "DES:", 4) == 0)
- {
- strcpy (model, tok + 4);
- return 1;
- }
- tok = strtok (NULL, ";");
+ if (strncmp(tok, DES_TOKEN, strlen(DES_TOKEN)) == 0) {
+ strcpy(model, tok + strlen(DES_TOKEN));
+ return 1;
+ }
+
+ tok = strtok(NULL, ";");
}
- return 0;
+
+ return 0;
}
int
-charTo2byte (char d[], char s[], int len)
+charTo2byte(char d[], const char s[], int len)
{
- /*
- * copy ASCII string to 2 byte unicode string
- * Returns: number of characters copied
- */
-
- int done = 0;
- int copied = 0;
- int i;
-
- for (i = 0; i < len; i++)
- {
- d[2 * i] = '\0';
- if (s[i] == '\0')
- {
- done = 1;
- }
- if (done == 0)
- {
- d[2 * i + 1] = s[i];
- copied++;
- }
- else
- d[2 * i + 1] = '\0';
+ /*
+ * copy ASCII string to 2 byte unicode string
+ * Returns: number of characters copied
+ */
+
+ int done = 0;
+ int copied = 0;
+ int i;
+
+ for (i = 0; i < len; i++) {
+ d[2 * i] = '\0';
+
+ if (s[i] == '\0') {
+ done = 1;
+ }
+
+ if (done == 0) {
+ d[2 * i + 1] = s[i];
+ copied++;
+ } else {
+ d[2 * i + 1] = '\0';
+ }
}
- return copied;
+
+ return copied;
}
-void u8tohex_string( uint8_t * input, char * str, int size)
+void u8tohex_string(uint8_t *input, char *str, int size)
{
- static const char hdigit[16] =
- { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd',
- 'e', 'f'
- };
- int i;
- for (i = 0; i < size; i++)
- {
- str[ 2 * i] = hdigit[ (input[i] >> 4) & 0xf];
- str[ 2 * 1 +1] = hdigit[ input[i] & 0xf];
+ static const char hdigit[16] = {
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
+ };
+ int i;
+
+ for (i = 0; i < size; i++) {
+ str[ 2 * i] = hdigit[(input[i] >> 4) & 0xf];
+ str[ 2 * 1 + 1] = hdigit[ input[i] & 0xf];
}
- str[2 * i] = '\0';
+
+ str[2 * i] = '\0';
}
int
-find_bin_string (const void *in, int len, char *lookfor, int size)
+find_bin_string(const void *in, int len, char *lookfor, int size)
{
- /*
- * looks for a new print command in the input stream
- * Returns: offset where lookfor is found or -1 when not found
- */
-
- int i;
- const char *buf = in;
-
- /* start at offset 1 to avoid match at start of input */
- for (i = 1; i < (len - size); i++)
- {
- if ((buf[i] == lookfor[0]) && (memcmp (buf + i, lookfor, size) == 0))
- {
- return i;
- }
+ /*
+ * looks for a new print command in the input stream
+ * Returns: offset where lookfor is found or -1 when not found
+ */
+
+ int i;
+ const char *buf = in;
+
+ /* start at offset 1 to avoid match at start of input */
+ for (i = 1; i < (len - size); i++) {
+ if ((buf[i] == lookfor[0]) && (memcmp(buf + i, lookfor, size) == 0)) {
+ return i;
+ }
}
- return -1;
+
+ return -1;
}
bjnp_address_type_t
-get_printer_host (const http_addr_t *printer_addr, char *name, int *port)
+get_printer_host(const http_addr_t printer_addr, char *name, int *port,
+ char *family)
{
- /*
- * lookup hostname for printers address
- */
-
- struct addrinfo *results;
- struct addrinfo *result;
- http_addr_t *res_address;
- char ip_address[BJNP_HOST_MAX];
- char service[64];
- int error;
- int match = 0;
- bjnp_address_type_t level;
+ /*
+ * lookup hostname for printers address
+ */
+
+ struct addrinfo *results;
+ struct addrinfo *result;
+ http_addr_t *res_address;
+ char ip_address[BJNP_HOST_MAX];
+ char service[64];
+ int error;
+ int match = 0;
+ bjnp_address_type_t level;
#ifdef ENABLE_IPV6
- if ( ( printer_addr -> addr.sa_family == AF_INET6 ) &&
- ( IN6_IS_ADDR_LINKLOCAL( &(printer_addr -> ipv6.sin6_addr ) ) ) )
- level = BJNP_ADDRESS_IS_LINK_LOCAL;
- else
- level = BJNP_ADDRESS_IS_GLOBAL;
+
+ if ((printer_addr.addr.sa_family == AF_INET6) &&
+ (IN6_IS_ADDR_LINKLOCAL(&(printer_addr.ipv6.sin6_addr)))) {
+ level = BJNP_ADDRESS_IS_LINK_LOCAL;
+ } else {
+ level = BJNP_ADDRESS_IS_GLOBAL;
+ }
+
#else
- level = BJNP_ADDRESS_IS_GLOBAL;
+ level = BJNP_ADDRESS_IS_GLOBAL;
#endif
- get_address_info( printer_addr, ip_address, port);
+ get_address_info(&printer_addr, ip_address, port, family);
- bjnp_debug (LOG_INFO, "Found printer at ip address: %s\n", ip_address);
+ bjnp_debug(LOG_INFO, "Found printer at ip address: %s(%s)\n", ip_address,
+ family);
- /* do reverse name lookup, if hostname can not be found return IP-address */
+ /* do reverse name lookup, if hostname cannot be found, return IP-addr */
- if( (error = getnameinfo( &(printer_addr-> addr) , sa_size( printer_addr),
- name, BJNP_HOST_MAX , NULL, 0, NI_NAMEREQD) ) != 0 )
- {
- bjnp_debug(LOG_DEBUG, "Name for %s not found : %s\n",
- ip_address, gai_strerror(error) );
- strcpy( name, ip_address );
- return level;
+ if ((error = getnameinfo(&(printer_addr.addr) , sa_size(printer_addr),
+ name, BJNP_HOST_MAX , NULL, 0, NI_NAMEREQD))
+ != 0) {
+ bjnp_debug(LOG_DEBUG, "Name for %s not found : %s\n",
+ ip_address, gai_strerror(error));
+ strcpy(name, ip_address);
+ return level;
}
- /* some buggy routers return rubbish if reverse lookup fails, so
- * we do a forward lookup to see if the result matches the ip-address */
+ /* some buggy routers return rubbish if reverse lookup fails, so
+ * we do a forward lookup to see if the result matches the ip-address */
- sprintf( service, "%d", *port);
- if (getaddrinfo( name, service, NULL, &results) == 0) {
+ sprintf(service, "%d", *port);
- result = results;
+ if (getaddrinfo(name, service, NULL, &results) == 0) {
- while (result != NULL) {
+ result = results;
- res_address = (http_addr_t *)result-> ai_addr;
+ while (result != NULL) {
- if(sa_is_equal( res_address, printer_addr)) {
+ res_address = (http_addr_t *)result-> ai_addr;
- /* found match, good */
+ if (sa_is_equal(*res_address, printer_addr)) {
- match = 1;
- break;
- }
- result = result-> ai_next;
- }
- freeaddrinfo(results);
+ /* found match, good */
- if (match == 1) {
- bjnp_debug (LOG_DEBUG, "Reverse lookup for %s succeeded, using as hostname\n", name);
- level = BJNP_ADDRESS_HAS_FQDN;
- }
- else {
- bjnp_debug (LOG_DEBUG,
- "Reverse lookup for %s succeeded, forward lookup failed, using IP-address %s instead\n",
+ match = 1;
+ break;
+ }
+
+ result = result-> ai_next;
+ }
+
+ freeaddrinfo(results);
+
+ if (match == 1) {
+ bjnp_debug(LOG_DEBUG, "Reverse lookup for %s succeeded, using as hostname\n",
+ name);
+ level = BJNP_ADDRESS_HAS_FQDN;
+ } else {
+ bjnp_debug(LOG_DEBUG,
+ "Reverse lookup for %s succeeded, forward lookup failed, using IP-address %s instead\n",
+ name, ip_address);
+ strcpy(name, ip_address);
+ }
+ } else {
+ /* lookup failed, use ip-address */
+ bjnp_debug(LOG_DEBUG, "Reverse lookup of %s failed, using IP-address %s\n",
name, ip_address);
- strcpy (name, ip_address);
+ strcpy(name, ip_address);
}
- } else {
- /* lookup failed, use ip-address */
- bjnp_debug (LOG_DEBUG, "Reverse lookup of %s failed, using IP-address %s\n", name, ip_address);
- strcpy (name, ip_address);
- }
- return level;
+
+ return level;
}
-char * bjnp_map_status(cups_sc_status_t status)
+char *bjnp_map_status(cups_sc_status_t status)
{
- switch(status)
- {
- case CUPS_SC_STATUS_BAD_MESSAGE:
- return "bad message";
- case CUPS_SC_STATUS_IO_ERROR:
- return "I/O error";
- case CUPS_SC_STATUS_NONE:
- return "no status";
- case CUPS_SC_STATUS_NOT_IMPLEMENTED:
- return "not implemented";
- case CUPS_SC_STATUS_NO_RESPONSE:
- return "no response";
- case CUPS_SC_STATUS_OK:
- return "status ok";
- case CUPS_SC_STATUS_TIMEOUT:
- return "timeout";
- case CUPS_SC_STATUS_TOO_BIG:
- return "message too big";
- default:
- return "unknown status, please report!";
+ switch (status) {
+ case CUPS_SC_STATUS_BAD_MESSAGE:
+ return "bad message";
+
+ case CUPS_SC_STATUS_IO_ERROR:
+ return "I/O error";
+
+ case CUPS_SC_STATUS_NONE:
+ return "no status";
+
+ case CUPS_SC_STATUS_NOT_IMPLEMENTED:
+ return "not implemented";
+
+ case CUPS_SC_STATUS_NO_RESPONSE:
+ return "no response";
+
+ case CUPS_SC_STATUS_OK:
+ return "status ok";
+
+ case CUPS_SC_STATUS_TIMEOUT:
+ return "timeout";
+
+ case CUPS_SC_STATUS_TOO_BIG:
+ return "message too big";
+
+ default:
+ return "unknown status, please report!";
}
}
diff --git a/bjnp.c b/bjnp.c
index 2c7423e..8edcced 100644
--- a/bjnp.c
+++ b/bjnp.c
@@ -1,32 +1,28 @@
/*
- * bjnp backend for the Common UNIX Printing System (CUPS).
- * Copyright 2008 by Louis Lagendijk
+ * bjnp backend for the Common UNIX Printing System (CUPS).
+ * Copyright 2008-2014 by Louis Lagendijk
*
- * heavily based on cups AppSocket sources
- * Copyright 2007 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Based on cups AppSocket sources
+ * Copyright 2007 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * "LICENSE" which should have been included with this file. If this
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * This program 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; version 2 only.
*
- * This file is subject to the Apple OS-Developed Software exception.
+ * This program 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.
*
- * Contents:
- *
- * main() - Send a file to the printer or server.
- * side_cb() - removed and integrated in main loop of RunLoop
- * wait_bc() - removed as bjnp does not have a true backchannel
- * it is used to send acks only
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Include necessary headers.
*/
-#include "bjnp.h"
#include <stdio.h>
#include <stdarg.h>
#include <sys/types.h>
@@ -44,6 +40,7 @@
# include <arpa/inet.h>
# include <netdb.h>
#endif /* WIN32 */
+#include "bjnp.h"
/*
@@ -54,399 +51,386 @@
* printer-uri job-id user title copies options [file]
*/
-int /* O - Exit status */
-main (int argc, /* I - Number of command-line arguments (6 or 7) */
- char *argv[]) /* I - Command-line arguments */
+int /* O - Exit status */
+main(int argc, /* I - Number of command-line arguments */
+ /* (6 or 7) */
+ char *argv[]) /* I - Command-line arguments */
{
- char method[255], /* Method in URI */
- hostname[1024], /* Hostname */
- username[255], /* Username info (not used) */
- resource[1024], /* Resource info (not used) */
- *options, /* Pointer to options */
- *name, /* Name of option */
- *value, /* Value of option */
- sep; /* Option separator */
- int print_fd; /* Print file */
- int copies; /* Number of copies to print */
- time_t start_time; /* Time of first connect */
- int recoverable; /* Recoverable error shown? */
- int contimeout; /* Connection timeout */
- int port; /* Port number */
- char portname[255]; /* Port name */
- int delay; /* Delay for retries... */
- int device_fd; /* AppSocket */
- int error; /* Error code (if any) */
- int i; /* loop variable */
- http_addrlist_t *addrlist; /* Address list */
- http_addr_t *addr; /* Connected address */
- char addrname[256]; /* Address name */
- ssize_t tbytes; /* Total number of bytes written */
- char *bjnp_debugstr; /* environment string */
+ char method[255]; /* Method in URI */
+ char hostname[1024]; /* Hostname */
+ char username[255]; /* Username info (not used) */
+ char resource[1024]; /* Resource info */
+ char *options; /* Pointer to options in device URI*/
+ char *name; /* Name of option in device URI*/
+ char *value; /* Value of option in device URI*/
+ char sep; /* Option separator */
+ int print_fd; /* Print file */
+ int copies; /* Number of copies to print */
+ time_t start_time; /* Time of first connect */
+ int recoverable; /* Recoverable error shown? */
+ int contimeout; /* Connection timeout */
+ int port; /* Port number */
+ char portname[255]; /* Port name */
+ char family[BJNP_FAMILY_MAX]; /* address family */
+ int i; /* loop variable */
+ int bjnp_error; /* printer error */
+ http_addrlist_t *addrlist; /* Address list */
+ printer_t *printer; /* Connected printer */
+ char addrname[256]; /* Address name */
+ ssize_t tbytes; /* Total number of bytes written */
+ char *debug_level = NULL; /* debug level to be applied */
+ char *debug_file_name = NULL; /* filename for own debugging */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
- struct sigaction action; /* Actions for POSIX signals */
+ struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
- /*
- * Make sure status messages are not buffered...
- */
+ /*
+ * Make sure status messages are not buffered...
+ */
- setbuf (stderr, NULL);
+ setbuf(stderr, NULL);
- /*
- * Ignore SIGPIPE signals...
- */
+ /*
+ * Ignore SIGPIPE signals...
+ */
#ifdef HAVE_SIGSET
- sigset (SIGPIPE, SIG_IGN);
+ sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
- memset (&action, 0, sizeof (action));
- action.sa_handler = SIG_IGN;
- sigaction (SIGPIPE, &action, NULL);
+ memset(&action, 0, sizeof(action));
+ action.sa_handler = SIG_IGN;
+ sigaction(SIGPIPE, &action, NULL);
#else
- signal (SIGPIPE, SIG_IGN);
+ signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
- /*
- * get debug level for printer discovery based on environment settings
- */
-
- if ((bjnp_debugstr = getenv ("BJNP_DEBUG")) != NULL)
- bjnp_set_debug_level (bjnp_debugstr);
-
- /*
- * Check command-line...
- */
-
- if (argc == 1)
- {
- struct printer_list printers[BJNP_PRINTERS_MAX];
- int num_printers;
- int i;
-
- if ((num_printers = bjnp_discover_printers (printers)) == 0)
- puts ("network bjnp \"Unknown\" \"Canon network printer\"");
- else
- for (i = 0; i < num_printers; i++)
- {
- printf ("network bjnp://%s:%u \"%s\" \"%s %s\" \"%s\"\n",
- printers[i].hostname,
- printers[i].port,
- printers[i].model,
- printers[i].model,
- printers[i].hostname, printers[i].IEEE1284_id);
- }
-
- return (CUPS_BACKEND_OK);
+ /*
+ * Check command-line...
+ */
+
+ if (argc == 1) {
+ struct printer_list printers[BJNP_PRINTERS_MAX];
+ int num_printers;
+ int i;
+
+ /*
+ * get debug level for printer discovery based on environment settings
+ */
+
+ debug_level = getenv("BJNP_DEBUG_LEVEL");
+ debug_file_name = getenv("BJNP_DEBUG_FILE");
+
+ bjnp_set_debug_level(debug_level, debug_file_name);
+
+ if ((num_printers = bjnp_discover_printers(printers)) == 0) {
+ puts("network bjnp \"Unknown\" \"Canon network printer\"");
+ } else {
+ for (i = 0; i < num_printers; i++) {
+ printf("network bjnp://%s:%u \"%s\" \"%s %s\" \"%s\"\n",
+ printers[i].hostname,
+ printers[i].port,
+ printers[i].model,
+ printers[i].model,
+ printers[i].hostname,
+ printers[i].IEEE1284_id);
+ }
+ }
+
+ return (CUPS_BACKEND_OK);
+ } else if (argc < 6 || argc > 7) {
+ fprintf(stderr, "cups BJNP backend - version %s\n", VERSION);
+ _cupsLangPrintf(stderr,
+ _("Usage: %s job-id user title copies options [file]\n"),
+ argv[0]);
+ return CUPS_BACKEND_FAILED;
}
- else if (argc < 6 || argc > 7)
- {
- fprintf (stderr, "cups BJNP backend - version %s\n", VERSION);
- _cupsLangPrintf (stderr,
- _ ("Usage: %s job-id user title copies options [file]\n"),
- argv[0]);
- return (CUPS_BACKEND_FAILED);
+
+ /*
+ * If we have 7 arguments, print the file named on the command-line.
+ * Otherwise, send stdin instead...
+ */
+
+ if (argc == 6) {
+ print_fd = 0;
+ copies = 1;
+ } else {
+ /*
+ * Try to open the print file...
+ */
+
+ if ((print_fd = open(argv[6], O_RDONLY)) < 0) {
+ perror("ERROR: unable to open print file");
+ return CUPS_BACKEND_FAILED;
+ }
+
+ copies = atoi(argv[4]);
}
- /*
- * If we have 7 arguments, print the file named on the command-line.
- * Otherwise, send stdin instead...
- */
+ /*
+ * Extract the hostname and port number from the URI...
+ */
- if (argc == 6)
- {
- print_fd = 0;
- copies = 1;
- }
- else
- {
- /*
- * Try to open the print file...
- */
-
- if ((print_fd = open (argv[6], O_RDONLY)) < 0)
- {
- perror ("ERROR: unable to open print file");
- return (CUPS_BACKEND_FAILED);
- }
-
- copies = atoi (argv[4]);
+ httpSeparateURI(HTTP_URI_CODING_ALL, cupsBackendDeviceURI(argv),
+ method, sizeof(method), username, sizeof(username),
+ hostname, sizeof(hostname), &port,
+ resource, sizeof(resource));
+
+ if (port == 0) {
+ port = BJNP_PORT_PRINT;
}
- /*
- * Extract the hostname and port number from the URI...
- */
-
- httpSeparateURI (HTTP_URI_CODING_ALL, cupsBackendDeviceURI (argv),
- method, sizeof (method), username, sizeof (username),
- hostname, sizeof (hostname), &port,
- resource, sizeof (resource));
-
- if (port == 0)
- port = BJNP_PORT_PRINT;
-
- /*
- * Get options, if any...
- */
-
- contimeout = 7 * 24 * 60 * 60;
-
- if ((options = strchr (resource, '?')) != NULL)
- {
- /*
- * Yup, terminate the device name string and move to the first
- * character of the options...
- */
-
- *options++ = '\0';
-
- /*
- * Parse options...
- */
-
- while (*options)
- {
- /*
- * Get the name...
- */
-
- name = options;
-
- while (*options && *options != '=' && *options != '+'
- && *options != '&')
- options++;
-
- if ((sep = *options) != '\0')
- *options++ = '\0';
-
- if (sep == '=')
- {
- /*
- * Get the value...
- */
-
- value = options;
-
- while (*options && *options != '+' && *options != '&')
- options++;
-
- if (*options)
- *options++ = '\0';
- }
- else
- value = (char *) "";
-
- /*
- * Process the option...
- */
-
- if (!strcasecmp (name, "contimeout"))
- {
- /*
- * Set the connection timeout...
- */
-
- if (atoi (value) > 0)
- contimeout = atoi (value);
- }
- else if (!strcasecmp (name, "debuglevel"))
- {
- bjnp_set_debug_level (value);
- }
- }
+ /*
+ * Get options from the URI, if any...
+ */
+
+ contimeout = 7 * 24 * 60 * 60;
+
+ if ((options = strchr(resource, '?')) != NULL) {
+ /*
+ * Yup, terminate the device name string and move to the first
+ * character of the options...
+ */
+
+ *options++ = '\0';
+
+ /*
+ * Parse options...
+ */
+
+ while (*options) {
+ /*
+ * Get the name...
+ */
+
+ name = options;
+
+ while (*options && *options != '=' && *options != '+'
+ && *options != '&') {
+ options++;
+ }
+
+ if ((sep = *options) != '\0') {
+ *options++ = '\0';
+ }
+
+ if (sep == '=') {
+ /*
+ * Get the value...
+ */
+
+ value = options;
+
+ while (*options && *options != '+' && *options != '&') {
+ options++;
+ }
+
+ if (*options) {
+ *options++ = '\0';
+ }
+ } else {
+ value = (char *) "";
+ }
+
+ /*
+ * Process the option...
+ */
+
+ if (!strcasecmp(name, "contimeout")) {
+ /*
+ * Set the connection timeout...
+ */
+
+ if (atoi(value) > 0) {
+ contimeout = atoi(value);
+ }
+ } else if (!strcasecmp(name, "debuglevel")) {
+ debug_level = value;
+ } else if (!strcasecmp(name, "debugfile")) {
+ debug_file_name = value;
+ }
+ }
}
-
- /*
- * print command line arguments to debug log
- * We can not do that sooner, as we first need to initialize
- * the debug system
- */
-
- for (i = 0; i < argc; i++)
- {
- bjnp_debug(LOG_DEBUG, "cups-bjnp: argv[%d] = %s\n", i, argv[i]);
+
+ bjnp_set_debug_level(debug_level, debug_file_name);
+
+ /*
+ * print command line arguments to debug log
+ * We cannot do that sooner, as we first need to initialize
+ * the debug system
+ */
+
+ for (i = 0; i < argc; i++) {
+ bjnp_debug(LOG_DEBUG, "cups-bjnp: argv[%d] = %s\n", i, argv[i]);
}
- /*
- * Then try to connect to the remote host...
- */
+ /*
+ * Then try to connect to the remote host...
+ */
- recoverable = 0;
- start_time = time (NULL);
+ recoverable = 0;
+ start_time = time(NULL);
- sprintf (portname, "%d", port);
+ sprintf(portname, "%d", port);
- if ((addrlist = httpAddrGetList (hostname, AF_UNSPEC, portname)) == NULL)
- {
- _cupsLangPrintf (stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
- hostname);
- return (CUPS_BACKEND_STOP);
+ if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL) {
+ _cupsLangPrintf(stderr, _("ERROR: Unable to locate printer \'%s\'!\n"),
+ hostname);
+ return (CUPS_BACKEND_STOP);
}
- _cupsLangPrintf (stderr,
- _("INFO: Attempting to connect to host %s on port %d\n"),
- hostname, port);
-
- fputs ("STATE: +connecting-to-device\n", stderr);
-
- for (delay = 5;;)
- {
- if ( ( (addr = bjnp_start_job (addrlist, argv[2], argv[3]) ) == NULL) ||
- ( device_fd = bjnp_addr_connect (addr)) < 0 )
- {
- error = errno;
- device_fd = -1;
-
- if (getenv ("CLASS") != NULL)
- {
- /*
- * If the CLASS environment variable is set, the job was submitted
- * to a class and not to a specific queue. In this case, we want
- * to abort immediately so that the job can be requeued on the next
- * available printer in the class.
- */
-
- _cupsLangPuts (stderr,
- _
- ("INFO: Unable to contact printer, queuing on next "
- "printer in class...\n"));
-
- /*
- * Sleep 5 seconds to keep the job from requeuing too rapidly...
- */
-
- sleep (5);
-
- return (CUPS_BACKEND_FAILED);
- }
-
- if (error == ECONNREFUSED || error == EHOSTDOWN ||
- error == EHOSTUNREACH)
- {
- if (contimeout && (time (NULL) - start_time) > contimeout)
- {
- _cupsLangPuts (stderr,
- _("ERROR: Printer not responding!\n"));
- return (CUPS_BACKEND_FAILED);
- }
-
- recoverable = 1;
-
- _cupsLangPrintf (stderr,
- _
- ("WARNING: recoverable: Network host \'%s\' is busy; "
- "will retry in %d seconds...\n"), hostname,
- delay);
-
- sleep (delay);
-
- if (delay < 30)
- delay += 5;
- }
- else
- {
- recoverable = 1;
-
- _cupsLangPrintf (stderr, "DEBUG: Connection error: %s\n",
- strerror (errno));
- _cupsLangPuts (stderr,
- _
- ("ERROR: recoverable: Unable to connect to printer; "
- "will retry in 30 seconds...\n"));
- sleep (30);
- }
- }
- else
- break;
+ _cupsLangPrintf(stderr,
+ _("INFO: Attempting to connect to host %s on port %d\n"),
+ hostname, port);
+
+ fputs("STATE: +connecting-to-device\n", stderr);
+
+ printer = NULL;
+
+ while (1) {
+ if (((printer = bjnp_printer_connect(printer, addrlist, argv[2], argv[3], &bjnp_error)) == NULL) ||
+ bjnp_error != 0) {
+
+ if (getenv("CLASS") != NULL) {
+ /*
+ * If the CLASS environment variable is set, the job was submitted
+ * to a class and not to a specific queue. In this case, we want
+ * to abort immediately so that the job can be requeued on the next
+ * available printer in the class.
+ */
+
+ _cupsLangPuts(stderr,
+ _
+ ("INFO: Unable to contact printer, queuing on next "
+ "printer in class...\n"));
+
+ /*
+ * Sleep 5 seconds to keep the job from requeuing too rapidly...
+ */
+
+ sleep(5);
+
+ return CUPS_BACKEND_FAILED;
+ }
+
+ if (contimeout && (time(NULL) - start_time) > contimeout) {
+ _cupsLangPuts(stderr,
+ _("ERROR: Printer not ready to print!\n"));
+ return CUPS_BACKEND_FAILED;
+ }
+
+ recoverable = 1;
+
+ if (bjnp_error != 0) {
+ if (bjnp_error & BJNP_PRINTER_BUSY) {
+ _cupsLangPrintf(stderr,
+ _("WARNING: recoverable: Network printer \'%s\' is busy, "),
+ hostname);
+ }
+
+ if (bjnp_error & BJNP_NO_INK) {
+ _cupsLangPrintf(stderr,
+ _("WARNING: recoverable: Network printer \'%s\' is out of ink, "),
+ hostname);
+ }
+
+ if (bjnp_error & BJNP_NO_PAPER) {
+ _cupsLangPrintf(stderr,
+ _("WARNING: recoverable: Network host \'%s\' is out of paper, "),
+ hostname);
+ }
+
+ _cupsLangPrintf(stderr,
+ _("will retry in 30 seconds...\n"));
+ sleep(30);
+
+ } else {
+ _cupsLangPrintf(stderr, "DEBUG: Connection error: %s\n",
+ strerror(errno));
+ _cupsLangPuts(stderr,
+ _
+ ("ERROR: recoverable: Unable to connect to printer; "
+ "will retry in 30 seconds...\n"));
+
+ sleep(30);
+ }
+ } else {
+ break;
+ }
}
- if (recoverable)
- {
- /*
- * If we've shown a recoverable error make sure the printer proxies
- * have a chance to see the recovered message. Not pretty but
- * necessary for now...
- */
+ if (recoverable) {
+ /*
+ * If we've shown a recoverable error make sure the printer proxies
+ * have a chance to see the recovered message. Not pretty but
+ * necessary for now...
+ */
- fputs ("INFO: recovered: \n", stderr);
- sleep (5);
+ fputs("INFO: recovered: \n", stderr);
+ sleep(5);
}
- fputs ("STATE: -connecting-to-device\n", stderr);
- _cupsLangPrintf (stderr, _("INFO: Connected to %s...\n"), hostname);
+ fputs("STATE: -connecting-to-device\n", stderr);
+ _cupsLangPrintf(stderr, _("INFO: Connected to %s...\n"), hostname);
- get_address_info( addr, addrname, &port);
- fprintf (stderr, "DEBUG: Connected to [%s]:%d (%s)...\n",
- addrname, port, (addr->addr.sa_family == AF_INET ? "IPv4" : "IPV6") );
+ get_printer_address_info(printer, addrname, &port, family);
+ fprintf(stderr, "DEBUG: Connected to [%s]:%d (%s)...\n",
+ addrname, port, family);
- /*
- * Print everything...
- */
+ /*
+ * Print everything...
+ */
- tbytes = 0;
+ tbytes = 0;
- while (copies > 0 && tbytes >= 0)
- {
- copies--;
+ while (copies > 0 && tbytes >= 0) {
+ copies--;
- if (print_fd != 0)
- {
- fputs ("PAGE: 1 1\n", stderr);
- lseek (print_fd, 0, SEEK_SET);
- }
+ if (print_fd != 0) {
+ fputs("PAGE: 1 1\n", stderr);
+ lseek(print_fd, 0, SEEK_SET);
+ }
- tbytes = bjnp_backendRunLoop (print_fd, device_fd, addr);
+ tbytes = bjnp_backendRunLoop(print_fd, printer);
- if (print_fd != 0 && tbytes >= 0)
- {
+ if (print_fd != 0 && tbytes >= 0) {
#ifdef HAVE_LONG_LONG
- _cupsLangPrintf (stderr,
- _("INFO: Sent print file, %lld bytes...\n"),
- CUPS_LLCAST tbytes);
+ _cupsLangPrintf(stderr,
+ _("INFO: Sent print file, %lld bytes...\n"),
+ CUPS_LLCAST tbytes);
#else
- _cupsLangPrintf (stderr,
- _("INFO: Sent print file, %ld bytes...\n"),
- CUPS_LLCAST tbytes);
+ _cupsLangPrintf(stderr,
+ _("INFO: Sent print file, %ld bytes...\n"),
+ CUPS_LLCAST tbytes);
#endif /* HAVE_LONG_LONG */
- }
+ }
}
+ /*
+ * tell printer to finsh the print job and to close the connection
+ */
+ bjnp_close_printer(printer);
+ printer = NULL;
+ httpAddrFreeList(addrlist);
+ addrlist = NULL;
- /*
- * Close the socket connection...
- */
+ /*
+ * Close the input file and return...
+ */
- close (device_fd);
-
- /*
- * and tell printer to finsh job
- */
- bjnp_finish_job (addr);
- free(addr);
- addr = NULL;
- httpAddrFreeList (addrlist);
- addrlist = NULL;
-
- /*
- * delay a bit as otherwise next job may hang (reported by Zedonet for PIXMA MX7600)
- */
-
- sleep(15);
+ if (print_fd != 0) {
+ close(print_fd);
+ }
- /*
- * Close the input file and return...
- */
+ /*
+ * delay a bit as otherwise next job may hang (reported by Zedonet for PIXMA MX7600)
+ */
- if (print_fd != 0)
- close (print_fd);
+ sleep(15);
- if (tbytes >= 0)
- _cupsLangPuts (stderr, _("INFO: Ready to print.\n"));
+ if (tbytes >= 0) {
+ _cupsLangPuts(stderr, _("INFO: Ready to print.\n"));
+ }
- return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
+ return (tbytes < 0 ? CUPS_BACKEND_FAILED : CUPS_BACKEND_OK);
}
-
-/*
- * End of "$Id: socket.c 6911 2007-09-04 20:35:08Z mike $".
- */
-
diff --git a/bjnp.h b/bjnp.h
index 17b8fb6..f971e1c 100644
--- a/bjnp.h
+++ b/bjnp.h
@@ -1,18 +1,19 @@
/*
- * Data structures and definitions for
- * bjnp backend for the Common UNIX Printing System (CUPS).
- * Copyright 2008 by Louis Lagendijk
+ * Data structures and definitions for
+ * bjnp backend for the Common UNIX Printing System (CUPS).
+ * Copyright 2008-2014 by Louis Lagendijk
*
- * These coded instructions, statements, and computer programs are the
- * property of Louis Lagendijk and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * "LICENSE" which should have been included with this file. If this
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * This program 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; version 2 only.
*
- * This file is subject to the Apple OS-Developed Software exception.
+ * This program 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.
*
- * Contents:
- * <to be added>
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _CUPS_BJNP_H_
#define _CUPS_BJNP_H_
@@ -28,88 +29,93 @@
#include <cups/sidechannel.h>
#endif
-/*
- * BJNP definitions
+/*
+ * BJNP definitions
*/
-#define BJNP_PRINTBUF_MAX 4096 /* size of printbuffer */
-#define BJNP_CMD_MAX 2048 /* size of BJNP response buffer */
-#define BJNP_RESP_MAX 2048 /* size of BJNP response buffer */
-#define BJNP_STATUS_MAX 256 /* max size for status string */
+#define BJNP_PRINTBUF_MAX 4096 /* size of printbuffer */
+#define BJNP_CMD_MAX 2048 /* size of BJNP response buffer */
+#define BJNP_RESP_MAX 2048 /* size of BJNP response buffer */
+#define BJNP_STATUS_MAX 2048 /* max size for status string */
#define BJNP_IEEE1284_MAX 1024 /* max. allowed size of IEEE1284 id */
#define BJNP_METHOD_MAX 16 /* max length of method */
#define BJNP_HOST_MAX 128 /* max length of hostname or address */
#define BJNP_PORT_MAX 64 /* max length of port string */
+#define BJNP_FAMILY_MAX 16 /* max length of human readable addr family */
#define BJNP_ARGS_MAX 128 /* max size of argument string */
-#define BJNP_MODEL_MAX 64 /* max allowed size for make&model */
-#define BJNP_IEEE1284_MAX 1024 /* max. allowed size of IEEE1284 id */
-#define BJNP_SERIAL_MAX 16 /* siuze of serial (mac-address) string */
-#define BJNP_SOCK_MAX 256 /* maximum number of open sockets */
-#define BJNP_PRINTERS_MAX 64 /* nax. number of printers in discovery */
-#define KEEP_ALIVE_SECONDS 3 /* max interval/2 seconds before we */
- /* send an empty data packet to the */
- /* printer */
-#define BJNP_MAX_BROADCAST_ATTEMPTS 2 /* number of broadcast packets to be sent */
-#define BJNP_BROADCAST_INTERVAL 10 /* ms between broadcasts */
+#define BJNP_MODEL_MAX 64 /* max allowed size for make&model */
+#define BJNP_SERIAL_MAX 16 /* size of serial/mac-address string */
+#define BJNP_SOCK_MAX 256 /* maximum number of open sockets */
+#define BJNP_UDP_MAX 65536 /* maximum size of a UDP packet */
+#define BJNP_PRINTERS_MAX 64 /* max. number of printers in discovery */
+#define BJNP_REPORT_MAX 256 /* max length of a status line reported to cups */
+#define BJNP_ARG_MAX 256 /* max lenght of status arguments */
+#define KEEP_ALIVE_SECONDS 3 /* max interval/2 seconds before we */
+/* send a keep alive packet */
+#define BJNP_MAX_BROADCAST_ATTEMPTS 2
+/* number of broadcast packets to be sent */
+#define BJNP_BROADCAST_INTERVAL 10
+/* ms between broadcasts */
+#define BJNP_REPORT_INTERVAL 3 /* seconds between status checks */
+#define BJNP_MARKER_INTERVAL 30 /* max. nr of seconds between level reports */
+
+#define BJNP_FAMILY_IPV4 "IPv4"
+#define BJNP_FAMILY_IPV6 "IPv6"
+#define BJNP_FAMILY_UNKNOWN "Unknown"
+
+/* prefix for backend specific warnings */
+#define BJNP_VENDOR_PREFIX "bjnp"
#define USLEEP_MS 1000 /* sleep for 1 msec */
#define BJNP_BC_RESPONSE_TIMEOUT 500 /* waiting time for broadc. responses */
#define BJNP_PORT_PRINT 8611
-typedef enum
-{
- BJNP_ADDRESS_IS_LINK_LOCAL = 0,
- BJNP_ADDRESS_IS_GLOBAL = 1,
- BJNP_ADDRESS_HAS_FQDN = 2
+
+#define BJNP_REPORT_URL "http://sourceforge.net/tracker/?func=add&group_id=234369&atid=1093281"
+
+typedef enum {
+ BJNP_ADDRESS_IS_LINK_LOCAL = 0,
+ BJNP_ADDRESS_IS_GLOBAL = 1,
+ BJNP_ADDRESS_HAS_FQDN = 2
} bjnp_address_type_t;
-typedef enum bjnp_paper_status_e
-{
- BJNP_PAPER_UNKNOWN = -1,
- BJNP_PAPER_OK = 0,
- BJNP_PAPER_OUT = 1
-} bjnp_paper_status_t;
-
-typedef enum
-{
- BJNP_STATUS_GOOD,
- BJNP_STATUS_INVAL,
- BJNP_STATUS_ALREADY_ALLOCATED
+typedef enum {
+ BJNP_STATUS_GOOD,
+ BJNP_STATUS_INVAL,
+ BJNP_STATUS_ALREADY_ALLOCATED
} BJNP_Status;
/*
- * structure that stores information on found printers
+ * structure that stores information on found printers
*/
-struct printer_list
-{
- http_addr_t *addr; /* adress of printer */
- char hostname[BJNP_HOST_MAX]; /* hostame, if found, else ip-address */
- int host_type; /* indicates how desirable it is to use */
- /* this address: */
- /* 0 = link local address */
- /* 1 = global address without a FQDN */
- /* 2 = globall address with FQDN */
- int port; /* port number */
- char IEEE1284_id[BJNP_IEEE1284_MAX]; /* IEEE1284 printer id */
- char model[BJNP_MODEL_MAX]; /* printer make and model */
- char mac_address[BJNP_SERIAL_MAX]; /* unique serial number (mac_address) */
+struct printer_list {
+ http_addr_t *addr; /* adress of printer */
+ char hostname[BJNP_HOST_MAX]; /* hostame, if found, else ip-address */
+ int host_type; /* indicates how desirable it is to use */
+ /* this address: */
+ /* 0 = link local address */
+ /* 1 = global address without a FQDN */
+ /* 2 = globall address with FQDN */
+ int port; /* port number */
+ char IEEE1284_id[BJNP_IEEE1284_MAX]; /* IEEE1284 printer id */
+ char model[BJNP_MODEL_MAX]; /* printer make and model */
+ char mac_address[BJNP_SERIAL_MAX]; /* unique serial number (mac_address) */
};
#define BJNP_THROTTLE 2
-typedef enum bjnp_loglevel_e
-{
- LOG_NONE,
- LOG_EMERG,
- LOG_ALERT,
- LOG_CRIT,
- LOG_ERROR,
- LOG_WARN,
- LOG_NOTICE,
- LOG_INFO,
- LOG_DEBUG,
- LOG_DEBUG2,
- LOG_END /* not a real loglevel, but indicates end of list */
+typedef enum bjnp_loglevel_e {
+ LOG_NONE,
+ LOG_EMERG,
+ LOG_ALERT,
+ LOG_CRIT,
+ LOG_ERROR,
+ LOG_WARN,
+ LOG_NOTICE,
+ LOG_INFO,
+ LOG_DEBUG,
+ LOG_DEBUG2,
+ LOG_END /* not a real loglevel, but indicates end of list */
} bjnp_loglevel_t;
#ifndef CUPS_LOGDIR
@@ -124,85 +130,84 @@ union bjnp_response_u;
typedef union bjnp_command_u bjnp_command_t;
typedef union bjnp_response_u bjnp_response_t;
+typedef struct printer_s printer_t;
+
/*
* bjnp-runloop.c
*/
-extern ssize_t bjnp_backendRunLoop (int print_fd, int device_fd,
- http_addr_t * addr);
+extern ssize_t bjnp_backendRunLoop(int print_fd, printer_t *printer);
-/*
+/*
* bjnp-io.c
*/
-int bjnp_addr_connect( http_addr_t *addr);
-http_addr_t * bjnp_start_job (http_addrlist_t * list,
- char *user, char *title);
-void bjnp_finish_job (http_addr_t * addr);
-int bjnp_backchannel (int fd, ssize_t * written);
-ssize_t bjnp_write (int fd, const void *buf, size_t count);
-extern int bjnp_backendGetDeviceID (char *device_id,
- int device_id_size, char *make_model,
- int make_model_size);
+printer_t *bjnp_printer_connect(printer_t *printer, http_addrlist_t *list,
+ const char *user, const char *title, int *bjnp_error);
+void bjnp_close_printer(printer_t *printer);
+int bjnp_backchannel(printer_t *printer, ssize_t *written);
+ssize_t bjnp_write(printer_t *printer, const void *buf, size_t count);
+extern int bjnp_backendGetDeviceID(printer_t *printer, char *device_id,
+ int device_id_size, char *make_model,
+ int make_model_size);
+int bjnp_get_device_fd(printer_t *printer);
/*
* bjnp-discover.c
*/
-int bjnp_discover_printers (struct printer_list *list);
+int bjnp_discover_printers(struct printer_list *list);
/*
- * bjnp-commands.c
+ * bjnp-ink-level.c
*/
-void clear_cmd( bjnp_command_t *cmd);
-int bjnp_set_command_header (bjnp_command_t *cmd, char cmd_code,
- int my_session_id, int payload_len);
-int get_printer_id (http_addr_t * addr, char *model, char *IEEE1284_id);
-bjnp_paper_status_t bjnp_get_paper_status (http_addr_t * addr);
-int bjnp_send_job_details (http_addr_t *addr, char *user, char *title );
-int bjnp_send_close( http_addr_t *addr );
+int bjnp_report_levels(printer_t *printer);
/*
* bjnp-utils.c
*/
-int sa_is_equal( const http_addr_t * sa1, const http_addr_t * sa2);
-int sa_size( const http_addr_t *sa);
-int get_protocol_family( const http_addr_t *sa);
-void get_address_info ( const http_addr_t *addr, char * addr_string, int *port);
-int parse_IEEE1284_to_model (char *printer_id, char *model);
-int parse_status_to_paperout (int len, char *status_str);
-int charTo2byte (char d[], char s[], int len);
-int find_bin_string (const void *in, int len, char *lookfor, int size);
-bjnp_address_type_t get_printer_host (const http_addr_t *printer_addr,
- char *name, int *port);
-void u8tohex_string( uint8_t * input, char * str, int size);
-char * bjnp_map_status(cups_sc_status_t status);
+int sa_size(const http_addr_t sa);
+int get_protocol_family(const http_addr_t sa);
+void get_printer_address_info(const printer_t *printer, char *addr_string,
+ int *port, char *family);
+void get_address_info(const http_addr_t *addr, char *addr_string, int *port,
+ char *family);
+int parse_IEEE1284_to_model(char *printer_id, char *model);
+int charTo2byte(char d[], const char s[], int len);
+int find_bin_string(const void *in, int len, char *lookfor, int size);
+bjnp_address_type_t get_printer_host(const http_addr_t printer_addr,
+ char *name, int *port, char *family);
+void u8tohex_string(uint8_t *input, char *str, int size);
+char *bjnp_map_status(cups_sc_status_t status);
/*
* bjnp-debug.c
*/
-void bjnp_set_debug_level (const char *level);
-void bjnp_debug (bjnp_loglevel_t, const char *, ...);
-void bjnp_hexdump (bjnp_loglevel_t level, char *header, const void *d_,
- unsigned len);
+void bjnp_set_debug_level(const char *level, const char *filename);
+void bjnp_debug(bjnp_loglevel_t, const char *, ...);
+void bjnp_hexdump(bjnp_loglevel_t level, char *header, const void *d_,
+ unsigned len);
/*
- * return values for bjnp_backchannel
+ * return values
*/
#define BJNP_OK 0
#define BJNP_IO_ERROR -1
#define BJNP_NOT_AN_ACK 1
+/*
+ * Return values for bjnp_report_levels & bjnp_error
+ */
+#define BJNP_NO_PAPER 1
+#define BJNP_NO_INK 2
+#define BJNP_PRINTER_BUSY 4
+#define BJNP_PRINTER_ERROR 8
+
/* definitions for functions available in cups 1.3 and later source tree only*/
-#define _cupsLangPrintf fprintf
+#define _cupsLangPrintf fprintf
#define _cupsLangPuts(a,b) fputs(b,a)
#define _(x) (x)
#ifndef CUPS_LLCAST
-# define CUPS_LLCAST (long)
+# define CUPS_LLCAST (long)
#endif
-
-/* static data */
-
-extern uint16_t session_id;
-
#endif /* ! CUPS_BJNP_H_ */
diff --git a/compile b/compile
index 862a14e..531136b 100755
--- a/compile
+++ b/compile
@@ -1,10 +1,9 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
-scriptversion=2012-03-05.13; # UTC
+scriptversion=2012-10-14.11; # UTC
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free
-# Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
@@ -113,6 +112,11 @@ func_cl_dashl ()
lib=$dir/$lib.lib
break
fi
+ if test -f "$dir/lib$lib.a"; then
+ found=yes
+ lib=$dir/lib$lib.a
+ break
+ fi
done
IFS=$save_IFS
diff --git a/conf/norpm b/conf/norpm
deleted file mode 100644
index 05a0d07..0000000
--- a/conf/norpm
+++ /dev/null
@@ -1,3 +0,0 @@
-# rpmbuild not found, so we can not build an rpm
-
-
diff --git a/conf/rpmbuild b/conf/rpmbuild
deleted file mode 100644
index cd88fdd..0000000
--- a/conf/rpmbuild
+++ /dev/null
@@ -1,4 +0,0 @@
-# rpm target for rpm based systems
-
-rpm: dist-gzip ${PACKAGE}.spec
- $(RPMBUILD) -ta ${distdir}.tar.gz
diff --git a/config.h.in b/config.h.in
index 359d0fd..75b7e09 100644
--- a/config.h.in
+++ b/config.h.in
@@ -52,9 +52,6 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
-/* Define to 1 if you have the `cups' library (-lcups). */
-#undef HAVE_LIBCUPS
-
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
diff --git a/configure b/configure
index 706af2c..cda925c 100755
--- a/configure
+++ b/configure
@@ -1,13 +1,11 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for cups-bjnp 1.2.
+# Generated by GNU Autoconf 2.69 for cups-bjnp 2.0.
#
# Report bugs to <louis.lagendijk@gmail.com>.
#
#
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
@@ -136,6 +134,31 @@ export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
@@ -169,7 +192,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
else
exitcode=1; echo positional parameters were not saved.
fi
-test x\$exitcode = x0 || exit 1"
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -214,21 +238,25 @@ IFS=$as_save_IFS
if test "x$CONFIG_SHELL" != x; then :
- # We cannot yet assume a decent shell, so we have to provide a
- # neutralization value for shells without unset; and this also
- # works around shells that cannot unset nonexistent variables.
- # Preserve -v and -x to the replacement shell.
- BASH_ENV=/dev/null
- ENV=/dev/null
- (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
- export CONFIG_SHELL
- case $- in # ((((
- *v*x* | *x*v* ) as_opts=-vx ;;
- *v* ) as_opts=-v ;;
- *x* ) as_opts=-x ;;
- * ) as_opts= ;;
- esac
- exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
fi
if test x$as_have_required = xno; then :
@@ -331,6 +359,14 @@ $as_echo X"$as_dir" |
} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -452,6 +488,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
chmod +x "$as_me.lineno" ||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
@@ -486,16 +526,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
+ # In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -507,28 +547,8 @@ else
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in #(
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -560,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='cups-bjnp'
PACKAGE_TARNAME='cups-bjnp'
-PACKAGE_VERSION='1.2'
-PACKAGE_STRING='cups-bjnp 1.2'
+PACKAGE_VERSION='2.0'
+PACKAGE_STRING='cups-bjnp 2.0'
PACKAGE_BUGREPORT='louis.lagendijk@gmail.com'
PACKAGE_URL=''
@@ -612,7 +632,9 @@ MAINTAINER_MODE_TRUE
EGREP
GREP
CPP
-RPMBUILD
+CUPS_LDFLAGS
+CUPS_LIBS
+CUPS_CFLAGS
cupsbackenddir
EXTRA_CFLAGS
am__fastdepCC_FALSE
@@ -632,6 +654,10 @@ CPPFLAGS
LDFLAGS
CFLAGS
CC
+AM_BACKSLASH
+AM_DEFAULT_VERBOSITY
+AM_DEFAULT_V
+AM_V
am__untar
am__tar
AMTAR
@@ -693,9 +719,10 @@ PACKAGE_TARNAME
PACKAGE_NAME
PATH_SEPARATOR
SHELL'
-ac_subst_files='rpmtarget'
+ac_subst_files=''
ac_user_opts='
enable_option_checking
+enable_silent_rules
enable_dependency_tracking
enable_Werror
enable_ipv6
@@ -710,7 +737,6 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-RPMBUILD
CPP'
@@ -1167,8 +1193,6 @@ target=$target_alias
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
- $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used" >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
@@ -1254,7 +1278,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures cups-bjnp 1.2 to adapt to many kinds of systems.
+\`configure' configures cups-bjnp 2.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1320,7 +1344,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of cups-bjnp 1.2:";;
+ short | recursive ) echo "Configuration of cups-bjnp 2.0:";;
esac
cat <<\_ACEOF
@@ -1328,12 +1352,17 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --disable-dependency-tracking speeds up one-time build
- --enable-dependency-tracking do not reject slow dependency extractors
+ --enable-silent-rules less verbose build output (undo: "make V=1")
+ --disable-silent-rules verbose build output (undo: "make V=0")
+ --enable-dependency-tracking
+ do not reject slow dependency extractors
+ --disable-dependency-tracking
+ speeds up one-time build
--disable-Werror don't use gcc's -Werror option when building
--disable-ipv6 disable IPv6 support
- --enable-maintainer-mode enable make rules and dependencies not useful
- (and sometimes confusing) to the casual installer
+ --enable-maintainer-mode
+ enable make rules and dependencies not useful (and
+ sometimes confusing) to the casual installer
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1349,7 +1378,6 @@ Some influential environment variables:
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
- RPMBUILD rpmbuild command
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
@@ -1418,10 +1446,10 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-cups-bjnp configure 1.2
-generated by GNU Autoconf 2.68
+cups-bjnp configure 2.0
+generated by GNU Autoconf 2.69
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
@@ -1497,7 +1525,7 @@ $as_echo "$ac_try_echo"; } >&5
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
+ test -x conftest$ac_exeext
}; then :
ac_retval=0
else
@@ -1862,7 +1890,8 @@ int
main ()
{
static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
;
return 0;
@@ -1894,8 +1923,8 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by cups-bjnp $as_me 1.2, which was
-generated by GNU Autoconf 2.68. Invocation command line was
+It was created by cups-bjnp $as_me 2.0, which was
+generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2244,7 +2273,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
-am__api_version='1.11'
+am__api_version='1.13'
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
@@ -2312,7 +2341,7 @@ case $as_dir/ in #((
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
@@ -2370,9 +2399,6 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
$as_echo_n "checking whether build environment is sane... " >&6; }
-# Just in case
-sleep 1
-echo timestamp > conftest.file
# Reject unsafe characters in $srcdir or the absolute working directory
# name. Accept space and tab only in the latter.
am_lf='
@@ -2383,32 +2409,40 @@ case `pwd` in
esac
case $srcdir in
*[\\\"\#\$\&\'\`$am_lf\ \ ]*)
- as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+ as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
esac
-# Do `set' in a subshell so we don't clobber the current shell's
+# Do 'set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
- set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
- if test "$*" = "X"; then
- # -L didn't work.
- set X `ls -t "$srcdir/configure" conftest.file`
- fi
- rm -f conftest.file
- if test "$*" != "X $srcdir/configure conftest.file" \
- && test "$*" != "X conftest.file $srcdir/configure"; then
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
-alias in your environment" "$LINENO" 5
- fi
-
+ am_has_slept=no
+ for am_try in 1 2; do
+ echo "timestamp, slept: $am_has_slept" > conftest.file
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
+ alias in your environment" "$LINENO" 5
+ fi
+ if test "$2" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ am_has_slept=yes
+ done
test "$2" = conftest.file
)
then
@@ -2420,6 +2454,16 @@ Check your system clock" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+ ( sleep 1 ) &
+ am_sleep_pid=$!
+fi
+
+rm -f conftest.file
+
test "$program_prefix" != NONE &&
program_transform_name="s&^&$program_prefix&;$program_transform_name"
# Use a double $ so make ignores it.
@@ -2442,12 +2486,12 @@ if test x"${MISSING+set}" != xset; then
esac
fi
# Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
- am_missing_run="$MISSING --run "
+if eval "$MISSING --is-lightweight"; then
+ am_missing_run="$MISSING "
else
am_missing_run=
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
-$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
fi
if test x"${install_sh}" != xset; then
@@ -2459,10 +2503,10 @@ if test x"${install_sh}" != xset; then
esac
fi
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'. However `strip' might not be the right
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip". However 'strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
+# will honor the 'STRIP' environment variable to overrule this program.
if test "$cross_compiling" != no; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
@@ -2481,7 +2525,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_STRIP="${ac_tool_prefix}strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2521,7 +2565,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_STRIP="strip"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2572,7 +2616,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_prog in mkdir gmkdir; do
for ac_exec_ext in '' $ac_executable_extensions; do
- { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+ as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
'mkdir (GNU coreutils) '* | \
'mkdir (coreutils) '* | \
@@ -2601,12 +2645,6 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
$as_echo "$MKDIR_P" >&6; }
-mkdir_p="$MKDIR_P"
-case $mkdir_p in
- [\\/$]* | ?:[\\/]*) ;;
- */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-
for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -2625,7 +2663,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AWK="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2689,6 +2727,45 @@ else
fi
rmdir .tst 2>/dev/null
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+ enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in # (((
+ yes) AM_DEFAULT_VERBOSITY=0;;
+ no) AM_DEFAULT_VERBOSITY=1;;
+ *) AM_DEFAULT_VERBOSITY=1;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+ @$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+ am_cv_make_support_nested_variables=yes
+else
+ am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+ AM_V='$(V)'
+ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+ AM_V=$AM_DEFAULT_VERBOSITY
+ AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
@@ -2711,7 +2788,7 @@ fi
# Define the identity of the package.
PACKAGE='cups-bjnp'
- VERSION='1.2'
+ VERSION='2.0'
cat >>confdefs.h <<_ACEOF
@@ -2739,12 +2816,22 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+# For better backward compatibility. To be removed once Automake 1.9.x
+# dies out for good. For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+mkdir_p='$(MKDIR_P)'
+
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
# Always define AMTAR for backward compatibility. Yes, it's still used
# in the wild :-( We should find a proper way to deprecate it ...
AMTAR='$${TAR-tar}'
+
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar pax cpio none'
+
am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
@@ -2753,6 +2840,7 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
+
## Check for programs
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -2776,7 +2864,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2816,7 +2904,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2869,7 +2957,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2910,7 +2998,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
@@ -2968,7 +3056,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3012,7 +3100,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3458,8 +3546,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -3562,7 +3649,7 @@ am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
+# Ignore all kinds of additional output from 'make'.
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=include
@@ -3618,8 +3705,8 @@ else
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
- # making a dummy file named `D' -- because `-MD' means `put the output
- # in D'.
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
rm -rf conftest.dir
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
@@ -3654,16 +3741,16 @@ else
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
- # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
- # Solaris 8's {/usr,}/bin/sh.
- touch sub/conftst$i.h
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
- # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
- # handle `-M -o', and we need to detect this. Also, some Intel
- # versions had trouble with output in subdirs
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj"
case $depmode in
@@ -3672,8 +3759,8 @@ else
test "$am__universal" = false || continue
;;
nosideeffect)
- # after this tag, mechanisms are not by side-effect, so they'll
- # only be used when explicitly requested
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
if test "x$enable_dependency_tracking" = xyes; then
continue
else
@@ -3681,7 +3768,7 @@ else
fi
;;
msvc7 | msvc7msys | msvisualcpp | msvcmsys)
- # This compiler won't grok `-c -o', but also, the minuso test has
+ # This compiler won't grok '-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
am__obj=conftest.${OBJEXT-o}
@@ -4097,131 +4184,41 @@ else
ipv6="no"
fi
-## find cups lib
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cupsDoRequest in -lcups" >&5
-$as_echo_n "checking for cupsDoRequest in -lcups... " >&6; }
-if ${ac_cv_lib_cups_cupsDoRequest+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcups $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char cupsDoRequest ();
-int
-main ()
-{
-return cupsDoRequest ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_cups_cupsDoRequest=yes
-else
- ac_cv_lib_cups_cupsDoRequest=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cups_cupsDoRequest" >&5
-$as_echo "$ac_cv_lib_cups_cupsDoRequest" >&6; }
-if test "x$ac_cv_lib_cups_cupsDoRequest" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBCUPS 1
-_ACEOF
-
- LIBS="-lcups $LIBS"
-
+## find cups-configuration
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking cups development support" >&5
+$as_echo_n "checking cups development support... " >&6; }
+if test -n "`cups-config --build 2> /dev/null`"; then
+ cups_config_found=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cups_config_found" >&5
+$as_echo "$cups_config_found" >&6; }
else
- as_fn_error $? "CUPS library not found" "$LINENO" 5
+ as_fn_error $? "cups development files not found" "$LINENO" 5
fi
-
## determine cups backend directory
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking cups backend directory" >&5
+$as_echo_n "checking cups backend directory... " >&6; }
# Check whether --with-cupsbackenddir was given.
if test "${with_cupsbackenddir+set}" = set; then :
- withval=$with_cupsbackenddir;
- cupsbackenddir="${withval}"
-
+ withval=$with_cupsbackenddir; cupsbackenddir="${withval}"
else
-
- dirs="/usr/lib/cups/backend /usr/local/lib/cups/backend /opt/lib/cups/backend\
- /usr/local/libexec/cups/backend /usr/libexec/cups/backend"
- cupsbackenddir=""
- for dir in $dirs; do
- if test -d "$dir" -a -z "$cupsbackenddir"; then
- cupsbackenddir=$dir
- fi
- done
- if test -n "$cupsbackenddir"; then
- echo found Cups backend directory $cupsbackenddir
- else
- as_fn_error $? "Cups backend directory not specified and auto-detection failed!" "$LINENO" 5
- fi
-
+ cupsbackenddir=`cups-config --serverbin`/backend
fi
+if test -d "$cupsbackenddir"; then
-## Check if we have rpmbuild, so we can build rpm's
-# Extract the first word of "rpmbuild", so it can be a program name with args.
-set dummy rpmbuild; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_RPMBUILD+:} false; then :
- $as_echo_n "(cached) " >&6
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cupsbackenddir" >&5
+$as_echo "$cupsbackenddir" >&6; }
else
- case $RPMBUILD in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_RPMBUILD="$RPMBUILD" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_RPMBUILD="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-fi
-RPMBUILD=$ac_cv_path_RPMBUILD
-if test -n "$RPMBUILD"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RPMBUILD" >&5
-$as_echo "$RPMBUILD" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ as_fn_error $? "cups backend directory not found!" "$LINENO" 5
fi
+CUPS_CFLAGS="`cups-config --cflags`"
+CUPS_LIBS="`cups-config --libs`"
-
-if test -n "$RPMBUILD"; then
- rpmtarget=$srcdir/conf/rpmbuild
-else
- rpmtarget=$srcdir/conf/norpm
-fi
-
+CUPS_LDFLAGS="`cups-config --ldflags`"
## header file that contains output from configure
@@ -4500,7 +4497,7 @@ do
for ac_prog in grep ggrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+ as_fn_executable_p "$ac_path_GREP" || continue
# Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
@@ -4566,7 +4563,7 @@ do
for ac_prog in egrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+ as_fn_executable_p "$ac_path_EGREP" || continue
# Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
@@ -5073,6 +5070,14 @@ LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
+$as_echo_n "checking that generated files are newer than configure... " >&6; }
+ if test -n "$am_sleep_pid"; then
+ # Hide warnings about reused PIDs.
+ wait $am_sleep_pid 2>/dev/null
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
if test -n "$EXEEXT"; then
am__EXEEXT_TRUE=
am__EXEEXT_FALSE='#'
@@ -5391,16 +5396,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
+ # In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -5460,28 +5465,16 @@ else
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in #(
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -5502,8 +5495,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by cups-bjnp $as_me 1.2, which was
-generated by GNU Autoconf 2.68. Invocation command line was
+This file was extended by cups-bjnp $as_me 2.0, which was
+generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -5568,11 +5561,11 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-cups-bjnp config.status 1.2
-configured by $0, generated by GNU Autoconf 2.68,
+cups-bjnp config.status 2.0
+configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
@@ -5663,7 +5656,7 @@ fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
- set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
shift
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
CONFIG_SHELL='$SHELL'
@@ -5748,24 +5741,7 @@ ac_tmp=$tmp
# This happens for instance with `./config.status config.h'.
if test -n "$CONFIG_FILES"; then
-if $AWK 'BEGIN { getline <"/dev/null" }' </dev/null 2>/dev/null; then
- ac_cs_awk_getline=:
- ac_cs_awk_pipe_init=
- ac_cs_awk_read_file='
- while ((getline aline < (F[key])) > 0)
- print(aline)
- close(F[key])'
- ac_cs_awk_pipe_fini=
-else
- ac_cs_awk_getline=false
- ac_cs_awk_pipe_init="print \"cat <<'|#_!!_#|' &&\""
- ac_cs_awk_read_file='
- print "|#_!!_#|"
- print "cat " F[key] " &&"
- '$ac_cs_awk_pipe_init
- # The final `:' finishes the AND list.
- ac_cs_awk_pipe_fini='END { print "|#_!!_#|"; print ":" }'
-fi
+
ac_cr=`echo X | tr X '\015'`
# On cygwin, bash can eat \r inside `` if the user requested igncr.
# But we know of no other shell where ac_cr would be empty at this
@@ -5783,17 +5759,6 @@ fi
echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
_ACEOF
-# Create commands to substitute file output variables.
-{
- echo "cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1" &&
- echo 'cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&' &&
- echo "$ac_subst_files" | sed 's/.*/F["&"]="$&"/' &&
- echo "_ACAWK" &&
- echo "_ACEOF"
-} >conf$$files.sh &&
-. ./conf$$files.sh ||
- as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
-rm -f conf$$files.sh
{
echo "cat >conf$$subs.awk <<_ACEOF" &&
@@ -5870,7 +5835,7 @@ _ACAWK
cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
for (key in S) S_is_set[key] = 1
FS = ""
- \$ac_cs_awk_pipe_init
+
}
{
line = $ 0
@@ -5888,16 +5853,10 @@ cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
} else
len += 1 + keylen
}
- if (nfields == 3 && !substed) {
- key = field[2]
- if (F[key] != "" && line ~ /^[ ]*@.*@[ ]*$/) {
- \$ac_cs_awk_read_file
- next
- }
- }
+
print line
}
-\$ac_cs_awk_pipe_fini
+
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
@@ -6244,12 +6203,7 @@ s&@INSTALL@&$ac_INSTALL&;t t
s&@MKDIR_P@&$ac_MKDIR_P&;t t
$ac_datarootdir_hack
"
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" |
-if $ac_cs_awk_getline; then
- $AWK -f "$ac_tmp/subs.awk"
-else
- $AWK -f "$ac_tmp/subs.awk" | $SHELL
-fi \
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
>$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
@@ -6335,7 +6289,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
case $ac_file$ac_mode in
"depfiles":C) test x"$AMDEP_TRUE" != x"" || {
- # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
case $CONFIG_FILES in
@@ -6348,7 +6302,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
- # We used to match only the files named `Makefile.in', but
+ # We used to match only the files named 'Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
@@ -6382,21 +6336,19 @@ $as_echo X"$mf" |
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
- # from the Makefile without running `make'.
+ # from the Makefile without running 'make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
- test -z "am__include" && continue
+ test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
- # When using ansi2knr, U may be empty or an underscore; expand it
- U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
- sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`$as_dirname -- "$file" ||
diff --git a/configure.ac b/configure.ac
index 4101df0..d18854d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,8 +1,8 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(cups-bjnp, 1.2, louis.lagendijk@gmail.com)
+AC_INIT([cups-bjnp], [2.0], [louis.lagendijk@gmail.com])
AC_CONFIG_SRCDIR([bjnp.c])
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([gnu])
AC_LIBSOURCES([cups-bjnp.spec])
## Check for programs
@@ -66,45 +66,32 @@ else
ipv6="no"
fi
-## find cups lib
-
-AC_CHECK_LIB(cups, cupsDoRequest,, AC_MSG_ERROR(CUPS library not found),)
+## find cups-configuration
+AC_MSG_CHECKING(cups development support)
+if test -n "`cups-config --build 2> /dev/null`"; then
+ cups_config_found=yes
+ AC_MSG_RESULT($cups_config_found)
+else
+ AC_MSG_ERROR([cups development files not found])
+fi
## determine cups backend directory
+AC_MSG_CHECKING([cups backend directory])
AC_ARG_WITH(cupsbackenddir,
- AC_HELP_STRING([--with-cupsbackenddir=DIR],
- [ cups-backends directory (auto)]),
-[
- cupsbackenddir="${withval}"
- AC_SUBST([cupsbackenddir])dnl
-], [
- dirs="/usr/lib/cups/backend /usr/local/lib/cups/backend /opt/lib/cups/backend\
- /usr/local/libexec/cups/backend /usr/libexec/cups/backend"
- cupsbackenddir=""
- for dir in $dirs; do
- if test -d "$dir" -a -z "$cupsbackenddir"; then
- cupsbackenddir=$dir
- fi
- done
- if test -n "$cupsbackenddir"; then
- echo found Cups backend directory $cupsbackenddir
- AC_SUBST([cupsbackenddir])dnl
- else
- AC_MSG_ERROR([Cups backend directory not specified and auto-detection failed!])
- fi
-])
-
-## Check if we have rpmbuild, so we can build rpm's
-AC_PATH_PROG([RPMBUILD],rpmbuild)
-AC_ARG_VAR(RPMBUILD, rpmbuild command)
-if test -n "$RPMBUILD"; then
- rpmtarget=$srcdir/conf/rpmbuild
+ AC_HELP_STRING([--with-cupsbackenddir=DIR],
+ [cups-backends directory (auto)]),
+ [cupsbackenddir="${withval}"],
+ [cupsbackenddir=`cups-config --serverbin`/backend])
+if test -d "$cupsbackenddir"; then
+ AC_SUBST([cupsbackenddir])
+ AC_MSG_RESULT([$cupsbackenddir])
else
- rpmtarget=$srcdir/conf/norpm
+ AC_MSG_ERROR([cups backend directory not found!])
fi
-AC_SUBST_FILE(rpmtarget)
-AC_SUBST(RPMBUILD)
+AC_SUBST([CUPS_CFLAGS], ["`cups-config --cflags`"])
+AC_SUBST([CUPS_LIBS], ["`cups-config --libs`"])
+AC_SUBST([CUPS_LDFLAGS], ["`cups-config --ldflags`"])
## header file that contains output from configure
diff --git a/cups-bjnp.spec b/cups-bjnp.spec
index e2cf504..24e9389 100644
--- a/cups-bjnp.spec
+++ b/cups-bjnp.spec
@@ -1,6 +1,6 @@
Summary : CUPS backend for the Canon BJNP network printers
Name : cups-bjnp
-Version : 1.0
+Version : 1.9.0
Release : 1%{?dist}
License : GPLv2
Source : http://downloads.sourceforge.net/cups-bjnp/cups-bjnp-%{version}.tar.gz
@@ -20,7 +20,7 @@ proprietary BJNP network protocol.
%setup -q
%build
-%configure --prefix=%{_exec_prefix} --with-cupsbackenddir=%{cups_backend_dir}
+%configure --prefix=%{_exec_prefix} --with-cupsbackenddir=%{cups_backend_dir} --disable-Werror
make %{?_smp_mflags}
%install
@@ -36,9 +36,50 @@ rm -Rf $RPM_BUILD_ROOT
%doc COPYING ChangeLog TODO NEWS README
%changelog
+* Sat Mar 15 2014 Louis Lagendijk <llagendijk@users.sourceforge.net> - 1.9.0-1
+- Added experimental ink level support
+- Better out of paper support
+- License changed to GPLv2
+
+* Wed Jan 22 2014 Louis Lagendijk <llagendijk@users.sourceforge.net> - 1.2.2-1
+- new upstream release 1.2.2
+- Fix crash with newer printers that send an xml-document for printer status
+- Fix possible buffer overflow on response buffer
+
+* Wed Jan 22 2014 Louis Lagendijk <llagendijk@users.sourceforge.net> - 1.2.1-3
+- temporary release for testing
+- Fix crash with newer printers that send an xml-document for printer status
+- Fix possible buffer overflow on response buffer
+
+* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
+
+* Sat Feb 23 2013 Louis Lagendijk <llagendijk@users.sourceforge.net> - 1.2.1-1
+ New upstream release. Fixes hang with MX270 and possibly other printers (bug
+ introduced with version 1.1)
+
+* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
+
+* Tue Nov 27 2012 Louis Lagendijk <llagendijk@users.sourceforge.net> - 1.2-1
+- new upstream release 1.2, fixes compilation error on EL6
+
+* Sat Sep 29 2012 Louis Lagendijk <llagendijk@users.sourceforge.net> - 1.1-1
+- New upstream release 1.1
+- Fixes "Failed to read side channel" error message
+- Supports printing over IPv6
+
+* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
+
+* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
+
* Tue Jul 05 2011 Louis Lagendijk <llagendijk@users.sourceforge.net> - 1.0-1
- New upstream release
- Fix FTBS on Fedora BZ715649
+- Fix hostname resolution on some buggy routers that return bogus hostnames on a
+ reverse lookup
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
@@ -115,7 +156,7 @@ rm -Rf $RPM_BUILD_ROOT
- added some sanity checks on call to gethostbyaddr so we do not bomb out
when hostname field is not set (can this occur?) or when a buggy Avm fritz box
returns noname rather then fail when no name is available on a reverse name lookup
-- Added a version string printout when incorrect number of arguments is recieved on command line
+- Added a version string printout when incorrect number of arguments is received on command line
- changed printbuffer to 4k. Recommended by Zedo, the Turboprint people
changed throttle pause from 3 sec to 40 msec. Improves performance. Recommended by Zedo.
- fixed a bug in scanning our interfaces when ifa_addr could be 0
diff --git a/depcomp b/depcomp
index 25a39e6..4ebd5b3 100755
--- a/depcomp
+++ b/depcomp
@@ -1,10 +1,9 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
-scriptversion=2012-03-27.16; # UTC
+scriptversion=2013-05-30.07; # UTC
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
-# 2011, 2012 Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,9 +27,9 @@ scriptversion=2012-03-27.16; # UTC
case $1 in
'')
- echo "$0: No command. Try '$0 --help' for more information." 1>&2
- exit 1;
- ;;
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
@@ -57,11 +56,65 @@ EOF
;;
esac
+# Get the directory component of the given path, and save it in the
+# global variables '$dir'. Note that this directory component will
+# be either empty or ending with a '/' character. This is deliberate.
+set_dir_from ()
+{
+ case $1 in
+ */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
+ *) dir=;;
+ esac
+}
+
+# Get the suffix-stripped basename of the given path, and save it the
+# global variable '$base'.
+set_base_from ()
+{
+ base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
+}
+
+# If no dependency file was actually created by the compiler invocation,
+# we still have to create a dummy depfile, to avoid errors with the
+# Makefile "include basename.Plo" scheme.
+make_dummy_depfile ()
+{
+ echo "#dummy" > "$depfile"
+}
+
+# Factor out some common post-processing of the generated depfile.
+# Requires the auxiliary global variable '$tmpdepfile' to be set.
+aix_post_process_depfile ()
+{
+ # If the compiler actually managed to produce a dependency file,
+ # post-process it.
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form 'foo.o: dependency.h'.
+ # Do two passes, one to just change these to
+ # $object: dependency.h
+ # and one to simply output
+ # dependency.h:
+ # which is needed to avoid the deleted-header problem.
+ { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
+ sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
+ } > "$depfile"
+ rm -f "$tmpdepfile"
+ else
+ make_dummy_depfile
+ fi
+}
+
# A tabulation character.
tab=' '
# A newline character.
nl='
'
+# Character ranges might be problematic outside the C locale.
+# These definitions help.
+upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+lower=abcdefghijklmnopqrstuvwxyz
+digits=0123456789
+alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
@@ -75,6 +128,9 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
+# Avoid interferences from the environment.
+gccflag= dashmflag=
+
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
@@ -86,32 +142,32 @@ if test "$depmode" = hp; then
fi
if test "$depmode" = dashXmstdout; then
- # This is just like dashmstdout with a different argument.
- dashmflag=-xM
- depmode=dashmstdout
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
- # This is just like msvisualcpp but w/o cygpath translation.
- # Just convert the backslash-escaped backslashes to single forward
- # slashes to satisfy depend.m4
- cygpath_u='sed s,\\\\,/,g'
- depmode=msvisualcpp
+ # This is just like msvisualcpp but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
- # This is just like msvc7 but w/o cygpath translation.
- # Just convert the backslash-escaped backslashes to single forward
- # slashes to satisfy depend.m4
- cygpath_u='sed s,\\\\,/,g'
- depmode=msvc7
+ # This is just like msvc7 but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvc7
fi
if test "$depmode" = xlc; then
- # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
- gccflag=-qmakedep=gcc,-MF
- depmode=gcc
+ # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
+ gccflag=-qmakedep=gcc,-MF
+ depmode=gcc
fi
case "$depmode" in
@@ -134,8 +190,7 @@ gcc3)
done
"$@"
stat=$?
- if test $stat -eq 0; then :
- else
+ if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
@@ -143,13 +198,17 @@ gcc3)
;;
gcc)
+## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
+## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
+## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
-## -MM, not -M (despite what the docs say).
+## -MM, not -M (despite what the docs say). Also, it might not be
+## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
@@ -157,15 +216,14 @@ gcc)
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
- if test $stat -eq 0; then :
- else
+ if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
- alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
-## The second -e expression handles DOS-style file names with drive letters.
+ # The second -e expression handles DOS-style file names with drive
+ # letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
@@ -174,15 +232,15 @@ gcc)
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
- tr ' ' "$nl" < "$tmpdepfile" |
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
- sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
- | sed -e 's/$/ :/' >> "$depfile"
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
@@ -200,8 +258,7 @@ sgi)
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
- if test $stat -eq 0; then :
- else
+ if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
@@ -209,7 +266,6 @@ sgi)
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
-
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
@@ -217,19 +273,15 @@ sgi)
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
- | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
- tr "$nl" ' ' >> "$depfile"
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
+ | tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
-
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
- | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
- >> "$depfile"
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> "$depfile"
else
- # The sourcefile does not contain any dependencies, so just
- # store a dummy comment line, to avoid errors with the Makefile
- # "include basename.Plo" scheme.
- echo "#dummy" > "$depfile"
+ make_dummy_depfile
fi
rm -f "$tmpdepfile"
;;
@@ -247,9 +299,8 @@ aix)
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
- dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
- test "x$dir" = "x$object" && dir=
- base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ set_dir_from "$object"
+ set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
@@ -262,9 +313,7 @@ aix)
"$@" -M
fi
stat=$?
-
- if test $stat -eq 0; then :
- else
+ if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
@@ -273,65 +322,113 @@ aix)
do
test -f "$tmpdepfile" && break
done
- if test -f "$tmpdepfile"; then
- # Each line is of the form 'foo.o: dependent.h'.
- # Do two passes, one to just change these to
- # '$object: dependent.h' and one to simply 'dependent.h:'.
- sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
- sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
- else
- # The sourcefile does not contain any dependencies, so just
- # store a dummy comment line, to avoid errors with the Makefile
- # "include basename.Plo" scheme.
- echo "#dummy" > "$depfile"
+ aix_post_process_depfile
+ ;;
+
+tcc)
+ # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
+ # FIXME: That version still under development at the moment of writing.
+ # Make that this statement remains true also for stable, released
+ # versions.
+ # It will wrap lines (doesn't matter whether long or short) with a
+ # trailing '\', as in:
+ #
+ # foo.o : \
+ # foo.c \
+ # foo.h \
+ #
+ # It will put a trailing '\' even on the last line, and will use leading
+ # spaces rather than leading tabs (at least since its commit 0394caf7
+ # "Emit spaces for -MD").
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile"
+ exit $stat
fi
+ rm -f "$depfile"
+ # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
+ # We have to change lines of the first kind to '$object: \'.
+ sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
+ # And for each line of the second kind, we have to emit a 'dep.h:'
+ # dummy dependency, to avoid the deleted-header problem.
+ sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
-icc)
- # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
- # However on
- # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
- # ICC 7.0 will fill foo.d with something like
- # foo.o: sub/foo.c
- # foo.o: sub/foo.h
- # which is wrong. We want
- # sub/foo.o: sub/foo.c
- # sub/foo.o: sub/foo.h
- # sub/foo.c:
- # sub/foo.h:
- # ICC 7.1 will output
+## The order of this option in the case statement is important, since the
+## shell code in configure will try each of these formats in the order
+## listed in this file. A plain '-MD' option would be understood by many
+## compilers, so we must ensure this comes after the gcc and icc options.
+pgcc)
+ # Portland's C compiler understands '-MD'.
+ # Will always output deps to 'file.d' where file is the root name of the
+ # source file under compilation, even if file resides in a subdirectory.
+ # The object file name does not affect the name of the '.d' file.
+ # pgcc 10.2 will output
# foo.o: sub/foo.c sub/foo.h
- # and will wrap long lines using '\':
+ # and will wrap long lines using '\' :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
- # tcc 0.9.26 (FIXME still under development at the moment of writing)
- # will emit a similar output, but also prepend the continuation lines
- # with horizontal tabulation characters.
- "$@" -MD -MF "$tmpdepfile"
- stat=$?
- if test $stat -eq 0; then :
- else
+ set_dir_from "$object"
+ # Use the source, not the object, to determine the base name, since
+ # that's sadly what pgcc will do too.
+ set_base_from "$source"
+ tmpdepfile=$base.d
+
+ # For projects that build the same source file twice into different object
+ # files, the pgcc approach of using the *source* file root name can cause
+ # problems in parallel builds. Use a locking strategy to avoid stomping on
+ # the same $tmpdepfile.
+ lockdir=$base.d-lock
+ trap "
+ echo '$0: caught signal, cleaning up...' >&2
+ rmdir '$lockdir'
+ exit 1
+ " 1 2 13 15
+ numtries=100
+ i=$numtries
+ while test $i -gt 0; do
+ # mkdir is a portable test-and-set.
+ if mkdir "$lockdir" 2>/dev/null; then
+ # This process acquired the lock.
+ "$@" -MD
+ stat=$?
+ # Release the lock.
+ rmdir "$lockdir"
+ break
+ else
+ # If the lock is being held by a different process, wait
+ # until the winning process is done or we timeout.
+ while test -d "$lockdir" && test $i -gt 0; do
+ sleep 1
+ i=`expr $i - 1`
+ done
+ fi
+ i=`expr $i - 1`
+ done
+ trap - 1 2 13 15
+ if test $i -le 0; then
+ echo "$0: failed to acquire lock after $numtries attempts" >&2
+ echo "$0: check lockdir '$lockdir'" >&2
+ exit 1
+ fi
+
+ if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
- # Each line is of the form 'foo.o: dependent.h',
- # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
+ # Each line is of the form `foo.o: dependent.h',
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
- # '$object: dependent.h' and one to simply 'dependent.h:'.
- sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \
- < "$tmpdepfile" > "$depfile"
- sed '
- s/[ '"$tab"'][ '"$tab"']*/ /g
- s/^ *//
- s/ *\\*$//
- s/^[^:]*: *//
- /^$/d
- /:$/d
- s/$/ :/
- ' < "$tmpdepfile" >> "$depfile"
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
+ | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
@@ -342,9 +439,8 @@ hp2)
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
- dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
- test "x$dir" = "x$object" && dir=
- base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ set_dir_from "$object"
+ set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
@@ -355,8 +451,7 @@ hp2)
"$@" +Maked
fi
stat=$?
- if test $stat -eq 0; then :
- else
+ if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
@@ -366,76 +461,61 @@ hp2)
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
- sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+ sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
- s/^ *//
- s/ \\*$//
- s/$/:/
- p
- }' "$tmpdepfile" >> "$depfile"
+ s/^ *//
+ s/ \\*$//
+ s/$/:/
+ p
+ }' "$tmpdepfile" >> "$depfile"
else
- echo "#dummy" > "$depfile"
+ make_dummy_depfile
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
- # The Tru64 compiler uses -MD to generate dependencies as a side
- # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
- # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
- # dependencies in 'foo.d' instead, so we check for that too.
- # Subdirectories are respected.
- dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
- test "x$dir" = "x$object" && dir=
- base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-
- if test "$libtool" = yes; then
- # With Tru64 cc, shared objects can also be used to make a
- # static library. This mechanism is used in libtool 1.4 series to
- # handle both shared and static libraries in a single compilation.
- # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
- #
- # With libtool 1.5 this exception was removed, and libtool now
- # generates 2 separate objects for the 2 libraries. These two
- # compilations output dependencies in $dir.libs/$base.o.d and
- # in $dir$base.o.d. We have to check for both files, because
- # one of the two compilations can be disabled. We should prefer
- # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
- # automatically cleaned when .libs/ is deleted, while ignoring
- # the former would cause a distcleancheck panic.
- tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
- tmpdepfile2=$dir$base.o.d # libtool 1.5
- tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
- tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
- "$@" -Wc,-MD
- else
- tmpdepfile1=$dir$base.o.d
- tmpdepfile2=$dir$base.d
- tmpdepfile3=$dir$base.d
- tmpdepfile4=$dir$base.d
- "$@" -MD
- fi
-
- stat=$?
- if test $stat -eq 0; then :
- else
- rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
- exit $stat
- fi
-
- for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
- do
- test -f "$tmpdepfile" && break
- done
- if test -f "$tmpdepfile"; then
- sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
- sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
- else
- echo "#dummy" > "$depfile"
- fi
- rm -f "$tmpdepfile"
- ;;
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in 'foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ set_dir_from "$object"
+ set_base_from "$object"
+
+ if test "$libtool" = yes; then
+ # Libtool generates 2 separate objects for the 2 libraries. These
+ # two compilations output dependencies in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir$base.o.d # libtool 1.5
+ tmpdepfile2=$dir.libs/$base.o.d # Likewise.
+ tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -ne 0; then
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ # Same post-processing that is required for AIX mode.
+ aix_post_process_depfile
+ ;;
msvc7)
if test "$libtool" = yes; then
@@ -446,8 +526,7 @@ msvc7)
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
- if test "$stat" = 0; then :
- else
+ if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
@@ -473,6 +552,7 @@ $ {
G
p
}' >> "$depfile"
+ echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;
@@ -524,13 +604,14 @@ dashmstdout)
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
- sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
+ sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
- tr ' ' "$nl" < "$tmpdepfile" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly. Breaking it into two sed invocations is a workaround.
- sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this sed invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
@@ -583,10 +664,12 @@ makedepend)
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
- sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly. Breaking it into two sed invocations is a workaround.
- sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process the last invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed '1,2d' "$tmpdepfile" \
+ | tr ' ' "$nl" \
+ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
@@ -622,10 +705,10 @@ cpp)
esac
done
- "$@" -E |
- sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
- -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
- sed '$ s: \\$::' > "$tmpdepfile"
+ "$@" -E \
+ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ | sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
@@ -657,15 +740,15 @@ msvisualcpp)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
- set fnord "$@"
- shift
- shift
- ;;
+ set fnord "$@"
+ shift
+ shift
+ ;;
*)
- set fnord "$@" "$arg"
- shift
- shift
- ;;
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
esac
done
"$@" -E 2>/dev/null |
diff --git a/install-sh b/install-sh
index a9244eb..377bb86 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2011-01-19.21; # UTC
+scriptversion=2011-11-20.07; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -35,7 +35,7 @@ scriptversion=2011-01-19.21; # UTC
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
+# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
@@ -156,7 +156,7 @@ while test $# -ne 0; do
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
- # Protect names problematic for `test' and other utilities.
+ # Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
@@ -190,7 +190,7 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
fi
shift # arg
dst_arg=$arg
- # Protect names problematic for `test' and other utilities.
+ # Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
@@ -202,7 +202,7 @@ if test $# -eq 0; then
echo "$0: no input file specified." >&2
exit 1
fi
- # It's OK to call `install-sh -d' without argument.
+ # It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
@@ -240,7 +240,7 @@ fi
for src
do
- # Protect names problematic for `test' and other utilities.
+ # Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
@@ -354,7 +354,7 @@ do
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
- # other-writeable bit of parent directory when it shouldn't.
+ # other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
diff --git a/missing b/missing
index 86a8fc3..cdea514 100755
--- a/missing
+++ b/missing
@@ -1,11 +1,10 @@
#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
+# Common wrapper for a few potentially missing GNU programs.
-scriptversion=2012-01-06.13; # UTC
+scriptversion=2012-06-26.16; # UTC
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
-# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,68 +25,40 @@ scriptversion=2012-01-06.13; # UTC
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
- echo 1>&2 "Try \`$0 --help' for more information"
+ echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
-run=:
-sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
-sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
-
-# In the cases where this matters, `missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
- configure_ac=configure.ac
-else
- configure_ac=configure.in
-fi
+case $1 in
-msg="missing on your system"
+ --is-lightweight)
+ # Used by our autoconf macros to check whether the available missing
+ # script is modern enough.
+ exit 0
+ ;;
-case $1 in
---run)
- # Try to run requested program, and just exit if it succeeds.
- run=
- shift
- "$@" && exit 0
- # Exit code 63 means version mismatch. This often happens
- # when the user try to use an ancient version of a tool on
- # a file that requires a minimum version. In this case we
- # we should proceed has if the program had been absent, or
- # if --run hadn't been passed.
- if test $? = 63; then
- run=:
- msg="probably too old"
- fi
- ;;
+ --run)
+ # Back-compat with the calling convention used by older automake.
+ shift
+ ;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
+to PROGRAM being missing or too old.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
- --run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
- aclocal touch file \`aclocal.m4'
- autoconf touch file \`configure'
- autoheader touch file \`config.h.in'
- autom4te touch the output file, or create a stub one
- automake touch all \`Makefile.in' files
- bison create \`y.tab.[ch]', if possible, from existing .[ch]
- flex create \`lex.yy.c', if possible, from existing .c
- help2man touch the output file
- lex create \`lex.yy.c', if possible, from existing .c
- makeinfo touch the output file
- yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+ aclocal autoconf autoheader autom4te automake makeinfo
+ bison yacc flex lex help2man
-Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
-\`g' are ignored when checking the name.
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
+'g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
@@ -99,228 +70,141 @@ Send bug reports to <bug-automake@gnu.org>."
;;
-*)
- echo 1>&2 "$0: Unknown \`$1' option"
- echo 1>&2 "Try \`$0 --help' for more information"
+ echo 1>&2 "$0: unknown '$1' option"
+ echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
esac
-# normalize program name to check for.
-program=`echo "$1" | sed '
- s/^gnu-//; t
- s/^gnu//; t
- s/^g//; t'`
-
-# Now exit if we have it, but it failed. Also exit now if we
-# don't have it and --version was passed (most likely to detect
-# the program). This is about non-GNU programs, so use $1 not
-# $program.
-case $1 in
- lex*|yacc*)
- # Not GNU programs, they don't have --version.
- ;;
-
- *)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
- # Could not run --version or --help. This is probably someone
- # running `$TOOL --version' or `$TOOL --help' to check whether
- # $TOOL exists and not knowing $TOOL uses missing.
- exit 1
- fi
- ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case $program in
- aclocal*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`acinclude.m4' or \`${configure_ac}'. You might want
- to install the \`Automake' and \`Perl' packages. Grab them from
- any GNU archive site."
- touch aclocal.m4
- ;;
-
- autoconf*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`${configure_ac}'. You might want to install the
- \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
- archive site."
- touch configure
- ;;
-
- autoheader*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`acconfig.h' or \`${configure_ac}'. You might want
- to install the \`Autoconf' and \`GNU m4' packages. Grab them
- from any GNU archive site."
- files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
- test -z "$files" && files="config.h"
- touch_files=
- for f in $files; do
- case $f in
- *:*) touch_files="$touch_files "`echo "$f" |
- sed -e 's/^[^:]*://' -e 's/:.*//'`;;
- *) touch_files="$touch_files $f.in";;
- esac
- done
- touch $touch_files
- ;;
-
- automake*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
- You might want to install the \`Automake' and \`Perl' packages.
- Grab them from any GNU archive site."
- find . -type f -name Makefile.am -print |
- sed 's/\.am$/.in/' |
- while read f; do touch "$f"; done
- ;;
-
- autom4te*)
- echo 1>&2 "\
-WARNING: \`$1' is needed, but is $msg.
- You might have modified some files without having the
- proper tools for further handling them.
- You can get \`$1' as part of \`Autoconf' from any GNU
- archive site."
-
- file=`echo "$*" | sed -n "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
- if test -f "$file"; then
- touch $file
- else
- test -z "$file" || exec >$file
- echo "#! /bin/sh"
- echo "# Created by GNU Automake missing as a replacement of"
- echo "# $ $@"
- echo "exit 0"
- chmod +x $file
- exit 1
- fi
- ;;
-
- bison*|yacc*)
- echo 1>&2 "\
-WARNING: \`$1' $msg. You should only need it if
- you modified a \`.y' file. You may need the \`Bison' package
- in order for those modifications to take effect. You can get
- \`Bison' from any GNU archive site."
- rm -f y.tab.c y.tab.h
- if test $# -ne 1; then
- eval LASTARG=\${$#}
- case $LASTARG in
- *.y)
- SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
- if test -f "$SRCFILE"; then
- cp "$SRCFILE" y.tab.c
- fi
- SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
- if test -f "$SRCFILE"; then
- cp "$SRCFILE" y.tab.h
- fi
- ;;
- esac
- fi
- if test ! -f y.tab.h; then
- echo >y.tab.h
- fi
- if test ! -f y.tab.c; then
- echo 'main() { return 0; }' >y.tab.c
- fi
- ;;
-
- lex*|flex*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified a \`.l' file. You may need the \`Flex' package
- in order for those modifications to take effect. You can get
- \`Flex' from any GNU archive site."
- rm -f lex.yy.c
- if test $# -ne 1; then
- eval LASTARG=\${$#}
- case $LASTARG in
- *.l)
- SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
- if test -f "$SRCFILE"; then
- cp "$SRCFILE" lex.yy.c
- fi
- ;;
- esac
- fi
- if test ! -f lex.yy.c; then
- echo 'main() { return 0; }' >lex.yy.c
- fi
- ;;
-
- help2man*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified a dependency of a manual page. You may need the
- \`Help2man' package in order for those modifications to take
- effect. You can get \`Help2man' from any GNU archive site."
-
- file=`echo "$*" | sed -n "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
- if test -f "$file"; then
- touch $file
- else
- test -z "$file" || exec >$file
- echo ".ab help2man is required to generate this page"
- exit $?
- fi
- ;;
-
- makeinfo*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified a \`.texi' or \`.texinfo' file, or any other file
- indirectly affecting the aspect of the manual. The spurious
- call might also be the consequence of using a buggy \`make' (AIX,
- DU, IRIX). You might want to install the \`Texinfo' package or
- the \`GNU make' package. Grab either from any GNU archive site."
- # The file to touch is that specified with -o ...
- file=`echo "$*" | sed -n "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
- if test -z "$file"; then
- # ... or it is the one specified with @setfilename ...
- infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
- file=`sed -n '
- /^@setfilename/{
- s/.* \([^ ]*\) *$/\1/
- p
- q
- }' $infile`
- # ... or it is derived from the source name (dir/f.texi becomes f.info)
- test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
- fi
- # If the file does not exist, the user really needs makeinfo;
- # let's fail without touching anything.
- test -f $file || exit 1
- touch $file
- ;;
+# Run the given program, remember its exit status.
+"$@"; st=$?
+
+# If it succeeded, we are done.
+test $st -eq 0 && exit 0
+
+# Also exit now if we it failed (or wasn't found), and '--version' was
+# passed; such an option is passed most likely to detect whether the
+# program is present and works.
+case $2 in --version|--help) exit $st;; esac
+
+# Exit code 63 means version mismatch. This often happens when the user
+# tries to use an ancient version of a tool on a file that requires a
+# minimum version.
+if test $st -eq 63; then
+ msg="probably too old"
+elif test $st -eq 127; then
+ # Program was missing.
+ msg="missing on your system"
+else
+ # Program was found and executed, but failed. Give up.
+ exit $st
+fi
- *)
- echo 1>&2 "\
-WARNING: \`$1' is needed, and is $msg.
- You might have modified some files without having the
- proper tools for further handling them. Check the \`README' file,
- it often tells you about the needed prerequisites for installing
- this package. You may also peek at any GNU archive site, in case
- some other package would contain this missing \`$1' program."
- exit 1
+perl_URL=http://www.perl.org/
+flex_URL=http://flex.sourceforge.net/
+gnu_software_URL=http://www.gnu.org/software
+
+program_details ()
+{
+ case $1 in
+ aclocal|automake)
+ echo "The '$1' program is part of the GNU Automake package:"
+ echo "<$gnu_software_URL/automake>"
+ echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
+ echo "<$gnu_software_URL/autoconf>"
+ echo "<$gnu_software_URL/m4/>"
+ echo "<$perl_URL>"
+ ;;
+ autoconf|autom4te|autoheader)
+ echo "The '$1' program is part of the GNU Autoconf package:"
+ echo "<$gnu_software_URL/autoconf/>"
+ echo "It also requires GNU m4 and Perl in order to run:"
+ echo "<$gnu_software_URL/m4/>"
+ echo "<$perl_URL>"
+ ;;
+ esac
+}
+
+give_advice ()
+{
+ # Normalize program name to check for.
+ normalized_program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
+ printf '%s\n' "'$1' is $msg."
+
+ configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
+ case $normalized_program in
+ autoconf*)
+ echo "You should only need it if you modified 'configure.ac',"
+ echo "or m4 files included by it."
+ program_details 'autoconf'
+ ;;
+ autoheader*)
+ echo "You should only need it if you modified 'acconfig.h' or"
+ echo "$configure_deps."
+ program_details 'autoheader'
+ ;;
+ automake*)
+ echo "You should only need it if you modified 'Makefile.am' or"
+ echo "$configure_deps."
+ program_details 'automake'
+ ;;
+ aclocal*)
+ echo "You should only need it if you modified 'acinclude.m4' or"
+ echo "$configure_deps."
+ program_details 'aclocal'
+ ;;
+ autom4te*)
+ echo "You might have modified some maintainer files that require"
+ echo "the 'automa4te' program to be rebuilt."
+ program_details 'autom4te'
+ ;;
+ bison*|yacc*)
+ echo "You should only need it if you modified a '.y' file."
+ echo "You may want to install the GNU Bison package:"
+ echo "<$gnu_software_URL/bison/>"
+ ;;
+ lex*|flex*)
+ echo "You should only need it if you modified a '.l' file."
+ echo "You may want to install the Fast Lexical Analyzer package:"
+ echo "<$flex_URL>"
+ ;;
+ help2man*)
+ echo "You should only need it if you modified a dependency" \
+ "of a man page."
+ echo "You may want to install the GNU Help2man package:"
+ echo "<$gnu_software_URL/help2man/>"
;;
-esac
-
-exit 0
+ makeinfo*)
+ echo "You should only need it if you modified a '.texi' file, or"
+ echo "any other file indirectly affecting the aspect of the manual."
+ echo "You might want to install the Texinfo package:"
+ echo "<$gnu_software_URL/texinfo/>"
+ echo "The spurious makeinfo call might also be the consequence of"
+ echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
+ echo "want to install GNU make:"
+ echo "<$gnu_software_URL/make/>"
+ ;;
+ *)
+ echo "You might have modified some files without having the proper"
+ echo "tools for further handling them. Check the 'README' file, it"
+ echo "often tells you about the needed prerequisites for installing"
+ echo "this package. You may also peek at any GNU archive site, in"
+ echo "case some other package contains this missing '$1' program."
+ ;;
+ esac
+}
+
+give_advice "$1" | sed -e '1s/^/WARNING: /' \
+ -e '2,$s/^/ /' >&2
+
+# Propagate the correct exit status (expected to be 127 for a program
+# not found, 63 for a program that failed due to version mismatch).
+exit $st
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)