pax_global_header00006660000000000000000000000064125634505350014522gustar00rootroot0000000000000052 comment=ca009e9691dd9eb913aa2525dfef26f1e4da1fb8 unibilium-1.2.0/000077500000000000000000000000001256345053500135175ustar00rootroot00000000000000unibilium-1.2.0/.gitignore000066400000000000000000000000551256345053500155070ustar00rootroot00000000000000*.o *.lo *.la .libs t/*.t tools/* !tools/*.c unibilium-1.2.0/Changes000066400000000000000000000023051256345053500150120ustar00rootroot000000000000001.1.6 2015-07-23 - fix nested conditionals 1.1.5 2015-07-17 - fix invalid memory access in %P/%g (gh #14) - avoid badly formatted lines in unibi_{g,s}et_ext_{bool,num,str}_name man pages (gh PR #12) 1.1.4 2015-04-26 - move maintainer options from GNUmakefile to maint.mk - compile with -O2 by default 1.1.3 2015-04-25 - fix permission error when installing into existing directory (gh PR #7) - relicense tools/*.c under MIT (gh #9) - add change log in Changes 1.1.2 2015-02-21 - support OS X's hex filename format 1.1.1 2014-12-02 - add unibi_format()/unibi_run() (merge sparchways into this library) - portability fixes for FreeBSD/OS X 1.0.1 2012-06-05 - document extended capabilities API - fix bugs in unibi_dump() - add automatic tests - stop using alloca() (improve portability) 1.0.0 2012-03-27 - add support for extended capabilities - some internal Makefile changes 0.1.0 2011-09-22 - remove homegrown configure script - new unibi_short_name_* functions - new Makefile - unibi-dump sample program unibilium-1.2.0/GPLv3000066400000000000000000001045131256345053500143410ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, 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 them 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 prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS 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 free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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, either version 3 of the License, or (at your option) any later version. 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 . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program 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. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into 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 Lesser General Public License instead of this License. But first, please read . unibilium-1.2.0/LGPLv3000066400000000000000000000167271256345053500144660ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. 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 that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser 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 as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. unibilium-1.2.0/LICENSE000066400000000000000000000006251256345053500145270ustar00rootroot00000000000000This library is under the GNU Lesser General Public License (either version 3 or (at your option) any later version). See the file LGPLv3 for details (it refers to the GNU General Public License, which can be found in GPLv3) or visit . If these terms are not acceptable to you, please contact the author at to negotiate other licensing terms. unibilium-1.2.0/Makefile000066400000000000000000000055471256345053500151720ustar00rootroot00000000000000ifneq ($(wildcard .git),) -include maint.mk endif ifeq ($(shell uname),Darwin) LIBTOOL?=glibtool else LIBTOOL?=libtool endif CFLAGS?=-O2 CFLAGS_DEBUG= PACKAGE=unibilium PKG_MAJOR=1 PKG_MINOR=2 PKG_REVISION=0 PKG_VERSION=$(PKG_MAJOR).$(PKG_MINOR).$(PKG_REVISION) # I am implementation $LT_REVISION of binary interface $LT_CURRENT, which is # a superset of all interfaces back to $LT_CURRENT - $LT_AGE. LT_REVISION=0 LT_CURRENT=3 LT_AGE=3 PREFIX=/usr/local LIBDIR=$(PREFIX)/lib INCDIR=$(PREFIX)/include MANDIR=$(PREFIX)/share/man MAN3DIR=$(MANDIR)/man3 TERMINFO_DIRS="/etc/terminfo:/lib/terminfo:/usr/share/terminfo:/usr/lib/terminfo:/usr/local/share/terminfo:/usr/local/lib/terminfo" POD2MAN=pod2man POD2MAN_OPTS=-c "$(PACKAGE)" -s3 -r "$(PACKAGE)-$(PKG_VERSION)" PROVE=prove ifeq ($(DEBUG),1) CFLAGS_DEBUG=-ggdb -DDEBUG endif OBJECTS=unibilium.lo uninames.lo uniutil.lo LIBRARY=libunibilium.la PODS=$(wildcard doc/*.pod) MANPAGES=$(addprefix man/,$(notdir $(PODS:.pod=.3.gz))) TOOLS=$(wildcard tools/*.c) TESTS=$(wildcard t/*.c) .PHONY: all all: $(LIBRARY) build-man build-tools build-test %.lo: %.c unibilium.h $(LIBTOOL) --mode=compile --tag=CC $(CC) -I. -Wall -std=c99 $(CFLAGS) $(CFLAGS_DEBUG) -o $@ -c $< uniutil.lo: uniutil.c unibilium.h $(LIBTOOL) --mode=compile --tag=CC $(CC) -I. -DTERMINFO_DIRS='$(TERMINFO_DIRS)' -Wall -std=c99 $(CFLAGS) $(CFLAGS_DEBUG) -o $@ -c $< $(LIBRARY): $(OBJECTS) $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -rpath '$(LIBDIR)' -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -o $@ $^ tools/%: $(LIBRARY) tools/%.lo $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -o $@ $^ %.t: $(LIBRARY) %.lo $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -o $@ $^ .PHONY: build-tools build-tools: $(TOOLS:.c=) .PHONY: build-test build-test: $(TESTS:.c=.t) .PHONY: test test: build-test $(PROVE) .PHONY: clean clean: $(LIBTOOL) --mode=clean rm -f $(OBJECTS) $(LIBRARY) $(MANPAGES) $(LIBTOOL) --mode=clean rm -f tools/.libs/* t/.libs/* # XXX there has to be a better way $(LIBTOOL) --mode=clean rm -f $(TOOLS:.c=) $(TOOLS:.c=.o) $(TESTS:.c=.t) $(TESTS:.c=.o) .PHONY: install install: install-inc install-lib install-man $(LIBTOOL) --mode=finish '$(DESTDIR)$(LIBDIR)' .PHONY: install-inc install-inc: mkdir -p '$(DESTDIR)$(INCDIR)' install -m644 unibilium.h '$(DESTDIR)$(INCDIR)' mkdir -p '$(DESTDIR)$(LIBDIR)/pkgconfig' sed 's,@VERSION@,$(PKG_VERSION),;s,@LIBDIR@,$(LIBDIR),;s,@INCDIR@,$(INCDIR),' '$(DESTDIR)$(LIBDIR)/pkgconfig/unibilium.pc' .PHONY: install-lib install-lib: mkdir -p '$(DESTDIR)$(LIBDIR)' $(LIBTOOL) --mode=install cp $(LIBRARY) '$(DESTDIR)$(LIBDIR)/$(LIBRARY)' .PHONY: install-man install-man: build-man mkdir -p '$(DESTDIR)$(MAN3DIR)' install -m644 $(MANPAGES) '$(DESTDIR)$(MAN3DIR)' .PHONY: build-man build-man: $(MANPAGES) man/%.3.gz: doc/%.pod $(POD2MAN) $(POD2MAN_OPTS) $< | gzip > $@ unibilium-1.2.0/README000066400000000000000000000012321256345053500143750ustar00rootroot00000000000000Unibilium is a very basic terminfo library. It doesn't depend on curses or any other library. It also doesn't use global variables, so it should be thread-safe. Basic documentation is in the doc/ directory. To use it, compile unibilium.c, uninames.c, and uniutil.c into a library. Include "unibilium.h" in your code. Alternatively use the provided Makefile: make PREFIX=/usr/local && make install PREFIX=/usr/local Other variables that can be set on the command line include CFLAGS (C compiler options) and DESTDIR (build for installation into $PREFIX but copy the built files into $DESTDIR/$PREFIX instead). See the LICENSE file for licensing information. unibilium-1.2.0/doc/000077500000000000000000000000001256345053500142645ustar00rootroot00000000000000unibilium-1.2.0/doc/unibi_add_ext_bool.pod000066400000000000000000000016331256345053500206040ustar00rootroot00000000000000=pod =head1 NAME unibi_add_ext_bool, unibi_add_ext_num, unibi_add_ext_str - add extended capabilities to a terminal object =head1 SYNOPSIS #include size_t unibi_add_ext_bool(unibi_term *ut, const char *t, int b); size_t unibi_add_ext_num(unibi_term *ut, const char *t, short v); size_t unibi_add_ext_str(unibi_term *ut, const char *t, const char *s); =head1 DESCRIPTION Add an extended boolean, numeric, or string capability with the specified name and value. Note that these functions simply store any pointers they are given. They will not free I or I or copy any strings. =head1 RETURN VALUE The return value is the index of the new capability, which can be used in L, L, etc. If an error occurs, C is returned. =head1 SEE ALSO L, L, L, L =cut unibilium-1.2.0/doc/unibi_add_ext_num.pod000066400000000000000000000016331256345053500204500ustar00rootroot00000000000000=pod =head1 NAME unibi_add_ext_bool, unibi_add_ext_num, unibi_add_ext_str - add extended capabilities to a terminal object =head1 SYNOPSIS #include size_t unibi_add_ext_bool(unibi_term *ut, const char *t, int b); size_t unibi_add_ext_num(unibi_term *ut, const char *t, short v); size_t unibi_add_ext_str(unibi_term *ut, const char *t, const char *s); =head1 DESCRIPTION Add an extended boolean, numeric, or string capability with the specified name and value. Note that these functions simply store any pointers they are given. They will not free I or I or copy any strings. =head1 RETURN VALUE The return value is the index of the new capability, which can be used in L, L, etc. If an error occurs, C is returned. =head1 SEE ALSO L, L, L, L =cut unibilium-1.2.0/doc/unibi_add_ext_str.pod000066400000000000000000000016331256345053500204610ustar00rootroot00000000000000=pod =head1 NAME unibi_add_ext_bool, unibi_add_ext_num, unibi_add_ext_str - add extended capabilities to a terminal object =head1 SYNOPSIS #include size_t unibi_add_ext_bool(unibi_term *ut, const char *t, int b); size_t unibi_add_ext_num(unibi_term *ut, const char *t, short v); size_t unibi_add_ext_str(unibi_term *ut, const char *t, const char *s); =head1 DESCRIPTION Add an extended boolean, numeric, or string capability with the specified name and value. Note that these functions simply store any pointers they are given. They will not free I or I or copy any strings. =head1 RETURN VALUE The return value is the index of the new capability, which can be used in L, L, etc. If an error occurs, C is returned. =head1 SEE ALSO L, L, L, L =cut unibilium-1.2.0/doc/unibi_count_ext_bool.pod000066400000000000000000000010511256345053500211760ustar00rootroot00000000000000=pod =head1 NAME unibi_count_ext_bool, unibi_count_ext_num, unibi_count_ext_str - count extended terminal capabilities =head1 SYNOPSIS #include size_t unibi_count_ext_bool(const unibi_term *ut); size_t unibi_count_ext_num(const unibi_term *ut); size_t unibi_count_ext_str(const unibi_term *ut); =head1 DESCRIPTION These functions count the number of extended (i.e. user specified) capabilities of the respective type in I. =head1 RETURN VALUE The number of extended capabilities. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_count_ext_num.pod000066400000000000000000000010511256345053500210420ustar00rootroot00000000000000=pod =head1 NAME unibi_count_ext_bool, unibi_count_ext_num, unibi_count_ext_str - count extended terminal capabilities =head1 SYNOPSIS #include size_t unibi_count_ext_bool(const unibi_term *ut); size_t unibi_count_ext_num(const unibi_term *ut); size_t unibi_count_ext_str(const unibi_term *ut); =head1 DESCRIPTION These functions count the number of extended (i.e. user specified) capabilities of the respective type in I. =head1 RETURN VALUE The number of extended capabilities. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_count_ext_str.pod000066400000000000000000000010511256345053500210530ustar00rootroot00000000000000=pod =head1 NAME unibi_count_ext_bool, unibi_count_ext_num, unibi_count_ext_str - count extended terminal capabilities =head1 SYNOPSIS #include size_t unibi_count_ext_bool(const unibi_term *ut); size_t unibi_count_ext_num(const unibi_term *ut); size_t unibi_count_ext_str(const unibi_term *ut); =head1 DESCRIPTION These functions count the number of extended (i.e. user specified) capabilities of the respective type in I. =head1 RETURN VALUE The number of extended capabilities. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_del_ext_bool.pod000066400000000000000000000013001256345053500206070ustar00rootroot00000000000000=pod =head1 NAME unibi_del_ext_bool, unibi_del_ext_num, unibi_del_ext_str - remove extended capabilities from a terminal object =head1 SYNOPSIS #include void unibi_del_ext_bool(unibi_term *ut, size_t i); void unibi_del_ext_num(unibi_term *ut, size_t i); void unibi_del_ext_str(unibi_term *ut, size_t i); =head1 DESCRIPTION Remove an extended boolean, numeric, or string capability. I is the index of the extended capability to act on; it must be less than C, C, or C, respectively. =head1 SEE ALSO L, L, L, L =cut unibilium-1.2.0/doc/unibi_destroy.pod000066400000000000000000000005101256345053500176430ustar00rootroot00000000000000=pod =head1 NAME unibi_destroy - free a terminal object =head1 SYNOPSIS #include void unibi_destroy(unibi_term *ut); =head1 DESCRIPTION This function frees a terminal object created by C or C. =head1 SEE ALSO L, L, L =cut unibilium-1.2.0/doc/unibi_dummy.pod000066400000000000000000000010121256345053500173030ustar00rootroot00000000000000=pod =head1 NAME unibi_dummy - construct a dummy terminal object =head1 SYNOPSIS #include unibi_term *unibi_dummy(void); =head1 DESCRIPTION If you want to create a terminfo entry from scratch, use this function to create a dummy C. Set its capabilities with the various C functions, get the terminfo representation with C, and free it with C. =head1 SEE ALSO L, L, L, L =cut unibilium-1.2.0/doc/unibi_dump.pod000066400000000000000000000016071256345053500171270ustar00rootroot00000000000000=pod =head1 NAME unibi_dump - convert a terminal object to compiled terminfo data =head1 SYNOPSIS #include size_t unibi_dump(const unibi_term *ut, char *p, size_t n); =head1 DESCRIPTION This function creates a compiled terminfo entry from I. The output is written to I

, which must have room for at least I bytes. =head1 RETURN VALUE C returns the number of bytes required to store the terminfo data. If this exceeds I, nothing is written to I

. If the terminal object can't be represented in terminfo format (e.g. because the string table would be too large), the return value is C. =head1 ERRORS =over =item C I can't be converted to terminfo format. =item C The resulting terminfo entry would be longer than I bytes. =back =head1 SEE ALSO L, L, L =cut unibilium-1.2.0/doc/unibi_format.pod000066400000000000000000000044401256345053500174500ustar00rootroot00000000000000=pod =head1 NAME unibi_format, unibi_run - interpret a terminfo format string =head1 SYNOPSIS #include void unibi_format( unibi_var_t var_dyn[26], unibi_var_t var_static[26], const char *fmt, unibi_var_t param[9], void (*out)(void *, const char *, size_t), void *ctx1, void (*pad)(void *, size_t, int, int), void *ctx2 ); size_t unibi_run(const char *fmt, unibi_var_t param[9], char *p, size_t n); =head1 DESCRIPTION C takes a format string I and executes it. All output is done by (possibly repeated) calls to I. In the calls to I the first argument is always I, the second argument is a pointer to a chunk of data, and the third argument is a count specifying the size of the chunk in bytes. I is used when the format string contains C<< $<...> >> padding instructions. In the calls to I the first argument is always I, the second argument is the delay in tenths of milliseconds, the third argument is a boolean flag indicating whether C<*> (proportional delay) was specified in the format string, and the fourth argument is a boolean flag indicating whether C (forced padding) was specified in the format string. Thus a format string of C<< $<5/> >> would translate into C. You may pass a null pointer for I; in that case padding instructions are silently skipped. The values of I are used for the format codes C<%p1> .. C<%p9>; the values of I and I are used for the so-called dynamic/static variables C<%Pa> .. C<%Pz> and C<%PA> .. C<%PZ>, respectively. C is a wrapper around C. It passes two arrays (each initialized to 26 zeroes) as I and I. I and I are passed on unchanged. It ignores padding and places all normal output in the buffer pointed to by I

. I is the size of the buffer; at most I bytes will be written to I

. =head1 RETURN VALUE C returns the number of bytes that would have been written if the buffer was big enough. Thus the number of valid bytes in I

after a call to C is the minimum of I and the return value of C. =head1 SEE ALSO L, L, L =cut unibilium-1.2.0/doc/unibi_from_env.pod000066400000000000000000000006241256345053500177730ustar00rootroot00000000000000=pod =head1 NAME unibi_from_env - read the terminfo entry specified by TERM =head1 SYNOPSIS #include unibi_term *unibi_from_env(void); =head1 DESCRIPTION This function calls C with the value of the environment variable C. =head1 RETURN VALUE See L. =head1 SEE ALSO L, L, L =cut unibilium-1.2.0/doc/unibi_from_fd.pod000066400000000000000000000006111256345053500175700ustar00rootroot00000000000000=pod =head1 NAME unibi_from_fd - read a terminfo entry from a file descriptor =head1 SYNOPSIS #include unibi_term *unibi_from_fd(int fd); =head1 DESCRIPTION This function reads up to 4096 bytes from I, then calls C. =head1 RETURN VALUE See L. =head1 SEE ALSO L, L, L =cut unibilium-1.2.0/doc/unibi_from_file.pod000066400000000000000000000005651256345053500201260ustar00rootroot00000000000000=pod =head1 NAME unibi_from_file - read a terminfo entry from a file =head1 SYNOPSIS #include unibi_term *unibi_from_file(const char *file); =head1 DESCRIPTION This function opens I, then calls C. =head1 RETURN VALUE See L. =head1 SEE ALSO L, L, L =cut unibilium-1.2.0/doc/unibi_from_fp.pod000066400000000000000000000006021256345053500176040ustar00rootroot00000000000000=pod =head1 NAME unibi_from_fp - read a terminfo entry from a FILE * =head1 SYNOPSIS #include unibi_term *unibi_from_fp(FILE *fp); =head1 DESCRIPTION This function reads up to 4096 bytes from I, then calls C. =head1 RETURN VALUE See L. =head1 SEE ALSO L, L, L =cut unibilium-1.2.0/doc/unibi_from_mem.pod000066400000000000000000000016021256345053500177560ustar00rootroot00000000000000=pod =head1 NAME unibi_from_mem - construct a terminal object from a compiled terminfo entry =head1 SYNOPSIS #include unibi_term *unibi_from_mem(const char *p, size_t n); =head1 DESCRIPTION This function parses a compiled terminfo entry that starts at I

and is I bytes long and constructs a C object from it. When you're done with it, you should call C to free it. =head1 RETURN VALUE A pointer to a new C. In case of failure, C is returned and C is set. =head1 ERRORS =over =item C The passed bytes don't look like a valid terminfo entry. =item C I is too small for a valid terminfo entry. =back =head1 SEE ALSO L, L, L, L, L, L, L, L =cut unibilium-1.2.0/doc/unibi_from_term.pod000066400000000000000000000016411256345053500201520ustar00rootroot00000000000000=pod =head1 NAME unibi_from_term - read a terminfo entry for a named terminal =head1 SYNOPSIS #include unibi_term *unibi_from_term(const char *name); =head1 DESCRIPTION This function locates the terminfo file for I, then calls C. It looks in the following places: =over =item 1. If the environment variable C is set, it is interpreted as the name of the directory to search. No other directory is used. =item 2. Otherwise, C<$HOME/.terminfo> is tried. =item 3. If that was not successful and C is set, it is interpreted as a colon-separated list of directories to search. =item 4. If C is not set, a compiled-in fallback (C) is used instead. =back =head1 RETURN VALUE See L. =head1 SEE ALSO L, L, L, L =cut unibilium-1.2.0/doc/unibi_get_aliases.pod000066400000000000000000000022001256345053500204300ustar00rootroot00000000000000=pod =head1 NAME unibi_get_aliases, unibi_set_aliases - access the aliases of a terminal object =head1 SYNOPSIS #include const char **unibi_get_aliases(const unibi_term *ut); void unibi_set_aliases(unibi_term *ut, const char **v); =head1 DESCRIPTION C returns the list of aliases from I; C sets it to I. The format of this list is like C: a null-terminated vector of strings. The contents of this list come from the ('|'-separated) name section in terminfo entries. It's supposed to be a list of lowercase words or abbreviations that refer to this terminal, the first one being the most common name. The last part of the name section can be more verbose and is not stored in the aliases list; it can be accessed with C. Note that C simply stores the pointer it is given; it will not free I or make a copy of it (or any of the strings it points to). =head1 RETURN VALUE C returns a pointer to a null-terminated vector of strings. =head1 SEE ALSO L, L, L =cut unibilium-1.2.0/doc/unibi_get_bool.pod000066400000000000000000000016551256345053500177570ustar00rootroot00000000000000=pod =head1 NAME unibi_get_bool, unibi_set_bool, unibi_get_num, unibi_set_num, unibi_get_str, unibi_set_str - access the capabilities of a terminal object =head1 SYNOPSIS #include int unibi_get_bool(const unibi_term *ut, enum unibi_boolean b); void unibi_set_bool(unibi_term *ut, enum unibi_boolean b, int x); short unibi_get_num(const unibi_term *ut, enum unibi_numeric n); void unibi_set_num(unibi_term *ut, enum unibi_numeric n, short x); const char *unibi_get_str(const unibi_term *ut, enum unibi_string s); void unibi_set_str(unibi_term *ut, enum unibi_string s, const char *x); =head1 DESCRIPTION Get/set boolean, numeric, and string capabilities. Absent numeric capabilities are represented as C<-1>, absent string capabilities as C. Note that C simply stores the pointer it is given; it will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_get_ext_bool.pod000066400000000000000000000020001256345053500206200ustar00rootroot00000000000000=pod =head1 NAME unibi_get_ext_bool, unibi_set_ext_bool, unibi_get_ext_num, unibi_set_ext_num, unibi_get_ext_str, unibi_set_ext_str - access the extended capabilities of a terminal object =head1 SYNOPSIS #include int unibi_get_ext_bool(const unibi_term *ut, size_t i); short unibi_get_ext_num(const unibi_term *ut, size_t i); const char *unibi_get_ext_str(const unibi_term *ut, size_t i); void unibi_set_ext_bool(unibi_term *ut, size_t i, int b); void unibi_set_ext_num(unibi_term *ut, size_t i, short v); void unibi_set_ext_str(unibi_term *ut, size_t i, const char *s); =head1 DESCRIPTION Get/set extended boolean, numeric, and string capabilities. I is the index of the extended capability to act on; it must be less than C, C, or C, respectively. Note that C simply stores the pointer it is given; it will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_get_ext_bool_name.pod000066400000000000000000000022621256345053500216320ustar00rootroot00000000000000=pod =head1 NAME unibi_get_ext_bool_name, unibi_set_ext_bool_name, unibi_get_ext_num_name, unibi_set_ext_num_name, unibi_get_ext_str_name, unibi_set_ext_str_name - access the names of extended capabilities of a terminal object =head1 SYNOPSIS #include const char *unibi_get_ext_bool_name(const unibi_term *ut, size_t i); const char *unibi_get_ext_num_name(const unibi_term *ut, size_t i); const char *unibi_get_ext_str_name(const unibi_term *ut, size_t i); void unibi_set_ext_bool_name(unibi_term *ut, size_t i, const char *s); void unibi_set_ext_num_name(unibi_term *ut, size_t i, const char *s); void unibi_set_ext_str_name(unibi_term *ut, size_t i, const char *s); =head1 DESCRIPTION Get/set the names of extended boolean, numeric, and string capabilities. I is the index of the extended capability to act on; it must be less than C, C, or C, respectively. Note that C, C, and C simply store the pointer they are given; they will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_get_ext_num.pod000066400000000000000000000020001256345053500204640ustar00rootroot00000000000000=pod =head1 NAME unibi_get_ext_bool, unibi_set_ext_bool, unibi_get_ext_num, unibi_set_ext_num, unibi_get_ext_str, unibi_set_ext_str - access the extended capabilities of a terminal object =head1 SYNOPSIS #include int unibi_get_ext_bool(const unibi_term *ut, size_t i); short unibi_get_ext_num(const unibi_term *ut, size_t i); const char *unibi_get_ext_str(const unibi_term *ut, size_t i); void unibi_set_ext_bool(unibi_term *ut, size_t i, int b); void unibi_set_ext_num(unibi_term *ut, size_t i, short v); void unibi_set_ext_str(unibi_term *ut, size_t i, const char *s); =head1 DESCRIPTION Get/set extended boolean, numeric, and string capabilities. I is the index of the extended capability to act on; it must be less than C, C, or C, respectively. Note that C simply stores the pointer it is given; it will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_get_ext_num_name.pod000066400000000000000000000022621256345053500214760ustar00rootroot00000000000000=pod =head1 NAME unibi_get_ext_bool_name, unibi_set_ext_bool_name, unibi_get_ext_num_name, unibi_set_ext_num_name, unibi_get_ext_str_name, unibi_set_ext_str_name - access the names of extended capabilities of a terminal object =head1 SYNOPSIS #include const char *unibi_get_ext_bool_name(const unibi_term *ut, size_t i); const char *unibi_get_ext_num_name(const unibi_term *ut, size_t i); const char *unibi_get_ext_str_name(const unibi_term *ut, size_t i); void unibi_set_ext_bool_name(unibi_term *ut, size_t i, const char *s); void unibi_set_ext_num_name(unibi_term *ut, size_t i, const char *s); void unibi_set_ext_str_name(unibi_term *ut, size_t i, const char *s); =head1 DESCRIPTION Get/set the names of extended boolean, numeric, and string capabilities. I is the index of the extended capability to act on; it must be less than C, C, or C, respectively. Note that C, C, and C simply store the pointer they are given; they will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_get_ext_str.pod000066400000000000000000000020001256345053500204750ustar00rootroot00000000000000=pod =head1 NAME unibi_get_ext_bool, unibi_set_ext_bool, unibi_get_ext_num, unibi_set_ext_num, unibi_get_ext_str, unibi_set_ext_str - access the extended capabilities of a terminal object =head1 SYNOPSIS #include int unibi_get_ext_bool(const unibi_term *ut, size_t i); short unibi_get_ext_num(const unibi_term *ut, size_t i); const char *unibi_get_ext_str(const unibi_term *ut, size_t i); void unibi_set_ext_bool(unibi_term *ut, size_t i, int b); void unibi_set_ext_num(unibi_term *ut, size_t i, short v); void unibi_set_ext_str(unibi_term *ut, size_t i, const char *s); =head1 DESCRIPTION Get/set extended boolean, numeric, and string capabilities. I is the index of the extended capability to act on; it must be less than C, C, or C, respectively. Note that C simply stores the pointer it is given; it will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_get_ext_str_name.pod000066400000000000000000000022621256345053500215070ustar00rootroot00000000000000=pod =head1 NAME unibi_get_ext_bool_name, unibi_set_ext_bool_name, unibi_get_ext_num_name, unibi_set_ext_num_name, unibi_get_ext_str_name, unibi_set_ext_str_name - access the names of extended capabilities of a terminal object =head1 SYNOPSIS #include const char *unibi_get_ext_bool_name(const unibi_term *ut, size_t i); const char *unibi_get_ext_num_name(const unibi_term *ut, size_t i); const char *unibi_get_ext_str_name(const unibi_term *ut, size_t i); void unibi_set_ext_bool_name(unibi_term *ut, size_t i, const char *s); void unibi_set_ext_num_name(unibi_term *ut, size_t i, const char *s); void unibi_set_ext_str_name(unibi_term *ut, size_t i, const char *s); =head1 DESCRIPTION Get/set the names of extended boolean, numeric, and string capabilities. I is the index of the extended capability to act on; it must be less than C, C, or C, respectively. Note that C, C, and C simply store the pointer they are given; they will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_get_name.pod000066400000000000000000000013751256345053500177430ustar00rootroot00000000000000=pod =head1 NAME unibi_get_name, unibi_set_name - access the name of a terminal object =head1 SYNOPSIS #include const char *unibi_get_name(const unibi_term *ut); void unibi_set_name(unibi_term *ut, const char *s); =head1 DESCRIPTION C gets the name from I; C sets the name to I. Note that C simply stores the pointer it is given; it will not free I or make a copy of the string. =head1 RETURN VALUE C returns a pointer to the name of the terminal; this either comes from a terminfo entry (the part after the last '|' in the name section) or was set by C. =head1 SEE ALSO L, L, L =cut unibilium-1.2.0/doc/unibi_get_num.pod000066400000000000000000000016551256345053500176230ustar00rootroot00000000000000=pod =head1 NAME unibi_get_bool, unibi_set_bool, unibi_get_num, unibi_set_num, unibi_get_str, unibi_set_str - access the capabilities of a terminal object =head1 SYNOPSIS #include int unibi_get_bool(const unibi_term *ut, enum unibi_boolean b); void unibi_set_bool(unibi_term *ut, enum unibi_boolean b, int x); short unibi_get_num(const unibi_term *ut, enum unibi_numeric n); void unibi_set_num(unibi_term *ut, enum unibi_numeric n, short x); const char *unibi_get_str(const unibi_term *ut, enum unibi_string s); void unibi_set_str(unibi_term *ut, enum unibi_string s, const char *x); =head1 DESCRIPTION Get/set boolean, numeric, and string capabilities. Absent numeric capabilities are represented as C<-1>, absent string capabilities as C. Note that C simply stores the pointer it is given; it will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_get_str.pod000066400000000000000000000016551256345053500176340ustar00rootroot00000000000000=pod =head1 NAME unibi_get_bool, unibi_set_bool, unibi_get_num, unibi_set_num, unibi_get_str, unibi_set_str - access the capabilities of a terminal object =head1 SYNOPSIS #include int unibi_get_bool(const unibi_term *ut, enum unibi_boolean b); void unibi_set_bool(unibi_term *ut, enum unibi_boolean b, int x); short unibi_get_num(const unibi_term *ut, enum unibi_numeric n); void unibi_set_num(unibi_term *ut, enum unibi_numeric n, short x); const char *unibi_get_str(const unibi_term *ut, enum unibi_string s); void unibi_set_str(unibi_term *ut, enum unibi_string s, const char *x); =head1 DESCRIPTION Get/set boolean, numeric, and string capabilities. Absent numeric capabilities are represented as C<-1>, absent string capabilities as C. Note that C simply stores the pointer it is given; it will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_int_from_var.pod000066400000000000000000000016411256345053500206450ustar00rootroot00000000000000=pod =head1 NAME unibi_num_from_var, unibi_str_from_var, unibi_var_from_num, unibi_var_from_str - create and inspect unibi_var_t values =head1 SYNOPSIS #include int unibi_num_from_var(unibi_var_t v); const char *unibi_str_from_var(unibi_var_t v); unibi_var_t unibi_var_from_num(int i); unibi_var_t unibi_var_from_str(char *s); =head1 DESCRIPTION C and C wrap the given int or string in a C object for use in L and L. C returns the number stored in I, which must have been constructed by C. C returns the string stored in I, which must have been constructed by C. It is an error to pass a wrapped string to C or a wrapped number to C. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_name_bool.pod000066400000000000000000000020021256345053500201030ustar00rootroot00000000000000=pod =head1 NAME unibi_name_bool, unibi_name_num, unibi_name_str, unibi_short_name_bool, unibit_short_name_num, unibi_short_name_str - translate capability enums to names =head1 SYNOPSIS #include const char *unibi_name_bool(enum unibi_boolean b); const char *unibi_name_num(enum unibi_numeric n); const char *unibi_name_str(enum unibi_string s); const char *unibi_short_name_bool(enum unibi_boolean b); const char *unibi_short_name_num(enum unibi_numeric n); const char *unibi_short_name_str(enum unibi_string s); =head1 DESCRIPTION These functions return the names of capabilities as strings. By default long names ("variable names") are returned; the C variants use the shorter "capnames". =head1 EXAMPLE #include #include int main(void) { printf("%s - %s\n", unibi_name_bool(unibi_has_status_line), unibi_short_name_bool(unibi_has_status_line)); /* Output: has_status_line - hs */ } =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_name_num.pod000066400000000000000000000020021256345053500177470ustar00rootroot00000000000000=pod =head1 NAME unibi_name_bool, unibi_name_num, unibi_name_str, unibi_short_name_bool, unibit_short_name_num, unibi_short_name_str - translate capability enums to names =head1 SYNOPSIS #include const char *unibi_name_bool(enum unibi_boolean b); const char *unibi_name_num(enum unibi_numeric n); const char *unibi_name_str(enum unibi_string s); const char *unibi_short_name_bool(enum unibi_boolean b); const char *unibi_short_name_num(enum unibi_numeric n); const char *unibi_short_name_str(enum unibi_string s); =head1 DESCRIPTION These functions return the names of capabilities as strings. By default long names ("variable names") are returned; the C variants use the shorter "capnames". =head1 EXAMPLE #include #include int main(void) { printf("%s - %s\n", unibi_name_bool(unibi_has_status_line), unibi_short_name_bool(unibi_has_status_line)); /* Output: has_status_line - hs */ } =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_name_str.pod000066400000000000000000000020021256345053500177600ustar00rootroot00000000000000=pod =head1 NAME unibi_name_bool, unibi_name_num, unibi_name_str, unibi_short_name_bool, unibit_short_name_num, unibi_short_name_str - translate capability enums to names =head1 SYNOPSIS #include const char *unibi_name_bool(enum unibi_boolean b); const char *unibi_name_num(enum unibi_numeric n); const char *unibi_name_str(enum unibi_string s); const char *unibi_short_name_bool(enum unibi_boolean b); const char *unibi_short_name_num(enum unibi_numeric n); const char *unibi_short_name_str(enum unibi_string s); =head1 DESCRIPTION These functions return the names of capabilities as strings. By default long names ("variable names") are returned; the C variants use the shorter "capnames". =head1 EXAMPLE #include #include int main(void) { printf("%s - %s\n", unibi_name_bool(unibi_has_status_line), unibi_short_name_bool(unibi_has_status_line)); /* Output: has_status_line - hs */ } =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_num_from_var.pod000066400000000000000000000017061256345053500206540ustar00rootroot00000000000000=pod =head1 NAME unibi_num_from_var, unibi_str_from_var, unibi_var_from_num, unibi_var_from_str - create and inspect unibi_var_t values =head1 SYNOPSIS #include int unibi_num_from_var(unibi_var_t v); const char *unibi_str_from_var(unibi_var_t v); unibi_var_t unibi_var_from_num(int i); unibi_var_t unibi_var_from_str(char *s); =head1 DESCRIPTION C and C wrap the given int or string in a C object for use in L and L. C returns the number stored in I, which must have been constructed by C. C returns the string stored in I, which must have been constructed by C. It is an error to pass a wrapped string to C or a wrapped number to C. =head1 SEE ALSO L, L, L =cut unibilium-1.2.0/doc/unibi_run.pod000066400000000000000000000044401256345053500167640ustar00rootroot00000000000000=pod =head1 NAME unibi_format, unibi_run - interpret a terminfo format string =head1 SYNOPSIS #include void unibi_format( unibi_var_t var_dyn[26], unibi_var_t var_static[26], const char *fmt, unibi_var_t param[9], void (*out)(void *, const char *, size_t), void *ctx1, void (*pad)(void *, size_t, int, int), void *ctx2 ); size_t unibi_run(const char *fmt, unibi_var_t param[9], char *p, size_t n); =head1 DESCRIPTION C takes a format string I and executes it. All output is done by (possibly repeated) calls to I. In the calls to I the first argument is always I, the second argument is a pointer to a chunk of data, and the third argument is a count specifying the size of the chunk in bytes. I is used when the format string contains C<< $<...> >> padding instructions. In the calls to I the first argument is always I, the second argument is the delay in tenths of milliseconds, the third argument is a boolean flag indicating whether C<*> (proportional delay) was specified in the format string, and the fourth argument is a boolean flag indicating whether C (forced padding) was specified in the format string. Thus a format string of C<< $<5/> >> would translate into C. You may pass a null pointer for I; in that case padding instructions are silently skipped. The values of I are used for the format codes C<%p1> .. C<%p9>; the values of I and I are used for the so-called dynamic/static variables C<%Pa> .. C<%Pz> and C<%PA> .. C<%PZ>, respectively. C is a wrapper around C. It passes two arrays (each initialized to 26 zeroes) as I and I. I and I are passed on unchanged. It ignores padding and places all normal output in the buffer pointed to by I

. I is the size of the buffer; at most I bytes will be written to I

. =head1 RETURN VALUE C returns the number of bytes that would have been written if the buffer was big enough. Thus the number of valid bytes in I

after a call to C is the minimum of I and the return value of C. =head1 SEE ALSO L, L, L =cut unibilium-1.2.0/doc/unibi_set_aliases.pod000066400000000000000000000022001256345053500204440ustar00rootroot00000000000000=pod =head1 NAME unibi_get_aliases, unibi_set_aliases - access the aliases of a terminal object =head1 SYNOPSIS #include const char **unibi_get_aliases(const unibi_term *ut); void unibi_set_aliases(unibi_term *ut, const char **v); =head1 DESCRIPTION C returns the list of aliases from I; C sets it to I. The format of this list is like C: a null-terminated vector of strings. The contents of this list come from the ('|'-separated) name section in terminfo entries. It's supposed to be a list of lowercase words or abbreviations that refer to this terminal, the first one being the most common name. The last part of the name section can be more verbose and is not stored in the aliases list; it can be accessed with C. Note that C simply stores the pointer it is given; it will not free I or make a copy of it (or any of the strings it points to). =head1 RETURN VALUE C returns a pointer to a null-terminated vector of strings. =head1 SEE ALSO L, L, L =cut unibilium-1.2.0/doc/unibi_set_bool.pod000066400000000000000000000016551256345053500177730ustar00rootroot00000000000000=pod =head1 NAME unibi_get_bool, unibi_set_bool, unibi_get_num, unibi_set_num, unibi_get_str, unibi_set_str - access the capabilities of a terminal object =head1 SYNOPSIS #include int unibi_get_bool(const unibi_term *ut, enum unibi_boolean b); void unibi_set_bool(unibi_term *ut, enum unibi_boolean b, int x); short unibi_get_num(const unibi_term *ut, enum unibi_numeric n); void unibi_set_num(unibi_term *ut, enum unibi_numeric n, short x); const char *unibi_get_str(const unibi_term *ut, enum unibi_string s); void unibi_set_str(unibi_term *ut, enum unibi_string s, const char *x); =head1 DESCRIPTION Get/set boolean, numeric, and string capabilities. Absent numeric capabilities are represented as C<-1>, absent string capabilities as C. Note that C simply stores the pointer it is given; it will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_set_ext_bool.pod000066400000000000000000000020001256345053500206340ustar00rootroot00000000000000=pod =head1 NAME unibi_get_ext_bool, unibi_set_ext_bool, unibi_get_ext_num, unibi_set_ext_num, unibi_get_ext_str, unibi_set_ext_str - access the extended capabilities of a terminal object =head1 SYNOPSIS #include int unibi_get_ext_bool(const unibi_term *ut, size_t i); short unibi_get_ext_num(const unibi_term *ut, size_t i); const char *unibi_get_ext_str(const unibi_term *ut, size_t i); void unibi_set_ext_bool(unibi_term *ut, size_t i, int b); void unibi_set_ext_num(unibi_term *ut, size_t i, short v); void unibi_set_ext_str(unibi_term *ut, size_t i, const char *s); =head1 DESCRIPTION Get/set extended boolean, numeric, and string capabilities. I is the index of the extended capability to act on; it must be less than C, C, or C, respectively. Note that C simply stores the pointer it is given; it will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_set_ext_bool_name.pod000066400000000000000000000022621256345053500216460ustar00rootroot00000000000000=pod =head1 NAME unibi_get_ext_bool_name, unibi_set_ext_bool_name, unibi_get_ext_num_name, unibi_set_ext_num_name, unibi_get_ext_str_name, unibi_set_ext_str_name - access the names of extended capabilities of a terminal object =head1 SYNOPSIS #include const char *unibi_get_ext_bool_name(const unibi_term *ut, size_t i); const char *unibi_get_ext_num_name(const unibi_term *ut, size_t i); const char *unibi_get_ext_str_name(const unibi_term *ut, size_t i); void unibi_set_ext_bool_name(unibi_term *ut, size_t i, const char *s); void unibi_set_ext_num_name(unibi_term *ut, size_t i, const char *s); void unibi_set_ext_str_name(unibi_term *ut, size_t i, const char *s); =head1 DESCRIPTION Get/set the names of extended boolean, numeric, and string capabilities. I is the index of the extended capability to act on; it must be less than C, C, or C, respectively. Note that C, C, and C simply store the pointer they are given; they will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_set_ext_num.pod000066400000000000000000000020001256345053500205000ustar00rootroot00000000000000=pod =head1 NAME unibi_get_ext_bool, unibi_set_ext_bool, unibi_get_ext_num, unibi_set_ext_num, unibi_get_ext_str, unibi_set_ext_str - access the extended capabilities of a terminal object =head1 SYNOPSIS #include int unibi_get_ext_bool(const unibi_term *ut, size_t i); short unibi_get_ext_num(const unibi_term *ut, size_t i); const char *unibi_get_ext_str(const unibi_term *ut, size_t i); void unibi_set_ext_bool(unibi_term *ut, size_t i, int b); void unibi_set_ext_num(unibi_term *ut, size_t i, short v); void unibi_set_ext_str(unibi_term *ut, size_t i, const char *s); =head1 DESCRIPTION Get/set extended boolean, numeric, and string capabilities. I is the index of the extended capability to act on; it must be less than C, C, or C, respectively. Note that C simply stores the pointer it is given; it will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_set_ext_num_name.pod000066400000000000000000000022621256345053500215120ustar00rootroot00000000000000=pod =head1 NAME unibi_get_ext_bool_name, unibi_set_ext_bool_name, unibi_get_ext_num_name, unibi_set_ext_num_name, unibi_get_ext_str_name, unibi_set_ext_str_name - access the names of extended capabilities of a terminal object =head1 SYNOPSIS #include const char *unibi_get_ext_bool_name(const unibi_term *ut, size_t i); const char *unibi_get_ext_num_name(const unibi_term *ut, size_t i); const char *unibi_get_ext_str_name(const unibi_term *ut, size_t i); void unibi_set_ext_bool_name(unibi_term *ut, size_t i, const char *s); void unibi_set_ext_num_name(unibi_term *ut, size_t i, const char *s); void unibi_set_ext_str_name(unibi_term *ut, size_t i, const char *s); =head1 DESCRIPTION Get/set the names of extended boolean, numeric, and string capabilities. I is the index of the extended capability to act on; it must be less than C, C, or C, respectively. Note that C, C, and C simply store the pointer they are given; they will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_set_ext_str.pod000066400000000000000000000020001256345053500205110ustar00rootroot00000000000000=pod =head1 NAME unibi_get_ext_bool, unibi_set_ext_bool, unibi_get_ext_num, unibi_set_ext_num, unibi_get_ext_str, unibi_set_ext_str - access the extended capabilities of a terminal object =head1 SYNOPSIS #include int unibi_get_ext_bool(const unibi_term *ut, size_t i); short unibi_get_ext_num(const unibi_term *ut, size_t i); const char *unibi_get_ext_str(const unibi_term *ut, size_t i); void unibi_set_ext_bool(unibi_term *ut, size_t i, int b); void unibi_set_ext_num(unibi_term *ut, size_t i, short v); void unibi_set_ext_str(unibi_term *ut, size_t i, const char *s); =head1 DESCRIPTION Get/set extended boolean, numeric, and string capabilities. I is the index of the extended capability to act on; it must be less than C, C, or C, respectively. Note that C simply stores the pointer it is given; it will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_set_ext_str_name.pod000066400000000000000000000022621256345053500215230ustar00rootroot00000000000000=pod =head1 NAME unibi_get_ext_bool_name, unibi_set_ext_bool_name, unibi_get_ext_num_name, unibi_set_ext_num_name, unibi_get_ext_str_name, unibi_set_ext_str_name - access the names of extended capabilities of a terminal object =head1 SYNOPSIS #include const char *unibi_get_ext_bool_name(const unibi_term *ut, size_t i); const char *unibi_get_ext_num_name(const unibi_term *ut, size_t i); const char *unibi_get_ext_str_name(const unibi_term *ut, size_t i); void unibi_set_ext_bool_name(unibi_term *ut, size_t i, const char *s); void unibi_set_ext_num_name(unibi_term *ut, size_t i, const char *s); void unibi_set_ext_str_name(unibi_term *ut, size_t i, const char *s); =head1 DESCRIPTION Get/set the names of extended boolean, numeric, and string capabilities. I is the index of the extended capability to act on; it must be less than C, C, or C, respectively. Note that C, C, and C simply store the pointer they are given; they will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_set_name.pod000066400000000000000000000013751256345053500177570ustar00rootroot00000000000000=pod =head1 NAME unibi_get_name, unibi_set_name - access the name of a terminal object =head1 SYNOPSIS #include const char *unibi_get_name(const unibi_term *ut); void unibi_set_name(unibi_term *ut, const char *s); =head1 DESCRIPTION C gets the name from I; C sets the name to I. Note that C simply stores the pointer it is given; it will not free I or make a copy of the string. =head1 RETURN VALUE C returns a pointer to the name of the terminal; this either comes from a terminfo entry (the part after the last '|' in the name section) or was set by C. =head1 SEE ALSO L, L, L =cut unibilium-1.2.0/doc/unibi_set_num.pod000066400000000000000000000016551256345053500176370ustar00rootroot00000000000000=pod =head1 NAME unibi_get_bool, unibi_set_bool, unibi_get_num, unibi_set_num, unibi_get_str, unibi_set_str - access the capabilities of a terminal object =head1 SYNOPSIS #include int unibi_get_bool(const unibi_term *ut, enum unibi_boolean b); void unibi_set_bool(unibi_term *ut, enum unibi_boolean b, int x); short unibi_get_num(const unibi_term *ut, enum unibi_numeric n); void unibi_set_num(unibi_term *ut, enum unibi_numeric n, short x); const char *unibi_get_str(const unibi_term *ut, enum unibi_string s); void unibi_set_str(unibi_term *ut, enum unibi_string s, const char *x); =head1 DESCRIPTION Get/set boolean, numeric, and string capabilities. Absent numeric capabilities are represented as C<-1>, absent string capabilities as C. Note that C simply stores the pointer it is given; it will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_set_str.pod000066400000000000000000000016551256345053500176500ustar00rootroot00000000000000=pod =head1 NAME unibi_get_bool, unibi_set_bool, unibi_get_num, unibi_set_num, unibi_get_str, unibi_set_str - access the capabilities of a terminal object =head1 SYNOPSIS #include int unibi_get_bool(const unibi_term *ut, enum unibi_boolean b); void unibi_set_bool(unibi_term *ut, enum unibi_boolean b, int x); short unibi_get_num(const unibi_term *ut, enum unibi_numeric n); void unibi_set_num(unibi_term *ut, enum unibi_numeric n, short x); const char *unibi_get_str(const unibi_term *ut, enum unibi_string s); void unibi_set_str(unibi_term *ut, enum unibi_string s, const char *x); =head1 DESCRIPTION Get/set boolean, numeric, and string capabilities. Absent numeric capabilities are represented as C<-1>, absent string capabilities as C. Note that C simply stores the pointer it is given; it will not free I or make a copy of the string. =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_short_name_bool.pod000066400000000000000000000020021256345053500213220ustar00rootroot00000000000000=pod =head1 NAME unibi_name_bool, unibi_name_num, unibi_name_str, unibi_short_name_bool, unibit_short_name_num, unibi_short_name_str - translate capability enums to names =head1 SYNOPSIS #include const char *unibi_name_bool(enum unibi_boolean b); const char *unibi_name_num(enum unibi_numeric n); const char *unibi_name_str(enum unibi_string s); const char *unibi_short_name_bool(enum unibi_boolean b); const char *unibi_short_name_num(enum unibi_numeric n); const char *unibi_short_name_str(enum unibi_string s); =head1 DESCRIPTION These functions return the names of capabilities as strings. By default long names ("variable names") are returned; the C variants use the shorter "capnames". =head1 EXAMPLE #include #include int main(void) { printf("%s - %s\n", unibi_name_bool(unibi_has_status_line), unibi_short_name_bool(unibi_has_status_line)); /* Output: has_status_line - hs */ } =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_short_name_num.pod000066400000000000000000000020021256345053500211660ustar00rootroot00000000000000=pod =head1 NAME unibi_name_bool, unibi_name_num, unibi_name_str, unibi_short_name_bool, unibit_short_name_num, unibi_short_name_str - translate capability enums to names =head1 SYNOPSIS #include const char *unibi_name_bool(enum unibi_boolean b); const char *unibi_name_num(enum unibi_numeric n); const char *unibi_name_str(enum unibi_string s); const char *unibi_short_name_bool(enum unibi_boolean b); const char *unibi_short_name_num(enum unibi_numeric n); const char *unibi_short_name_str(enum unibi_string s); =head1 DESCRIPTION These functions return the names of capabilities as strings. By default long names ("variable names") are returned; the C variants use the shorter "capnames". =head1 EXAMPLE #include #include int main(void) { printf("%s - %s\n", unibi_name_bool(unibi_has_status_line), unibi_short_name_bool(unibi_has_status_line)); /* Output: has_status_line - hs */ } =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_short_name_str.pod000066400000000000000000000020021256345053500211770ustar00rootroot00000000000000=pod =head1 NAME unibi_name_bool, unibi_name_num, unibi_name_str, unibi_short_name_bool, unibit_short_name_num, unibi_short_name_str - translate capability enums to names =head1 SYNOPSIS #include const char *unibi_name_bool(enum unibi_boolean b); const char *unibi_name_num(enum unibi_numeric n); const char *unibi_name_str(enum unibi_string s); const char *unibi_short_name_bool(enum unibi_boolean b); const char *unibi_short_name_num(enum unibi_numeric n); const char *unibi_short_name_str(enum unibi_string s); =head1 DESCRIPTION These functions return the names of capabilities as strings. By default long names ("variable names") are returned; the C variants use the shorter "capnames". =head1 EXAMPLE #include #include int main(void) { printf("%s - %s\n", unibi_name_bool(unibi_has_status_line), unibi_short_name_bool(unibi_has_status_line)); /* Output: has_status_line - hs */ } =head1 SEE ALSO L =cut unibilium-1.2.0/doc/unibi_str_from_var.pod000066400000000000000000000017061256345053500206650ustar00rootroot00000000000000=pod =head1 NAME unibi_num_from_var, unibi_str_from_var, unibi_var_from_num, unibi_var_from_str - create and inspect unibi_var_t values =head1 SYNOPSIS #include int unibi_num_from_var(unibi_var_t v); const char *unibi_str_from_var(unibi_var_t v); unibi_var_t unibi_var_from_num(int i); unibi_var_t unibi_var_from_str(char *s); =head1 DESCRIPTION C and C wrap the given int or string in a C object for use in L and L. C returns the number stored in I, which must have been constructed by C. C returns the string stored in I, which must have been constructed by C. It is an error to pass a wrapped string to C or a wrapped number to C. =head1 SEE ALSO L, L, L =cut unibilium-1.2.0/doc/unibi_terminfo_dirs.pod000066400000000000000000000005411256345053500210220ustar00rootroot00000000000000=pod =head1 NAME unibi_terminfo_dirs - fallback terminfo search path =head1 SYNOPSIS #include extern const char *const unibi_terminfo_dirs; =head1 DESCRIPTION A colon-separated list of directories that is used by C if C is not set. =head1 SEE ALSO L, L =cut unibilium-1.2.0/doc/unibi_var_from_num.pod000066400000000000000000000017061256345053500206540ustar00rootroot00000000000000=pod =head1 NAME unibi_num_from_var, unibi_str_from_var, unibi_var_from_num, unibi_var_from_str - create and inspect unibi_var_t values =head1 SYNOPSIS #include int unibi_num_from_var(unibi_var_t v); const char *unibi_str_from_var(unibi_var_t v); unibi_var_t unibi_var_from_num(int i); unibi_var_t unibi_var_from_str(char *s); =head1 DESCRIPTION C and C wrap the given int or string in a C object for use in L and L. C returns the number stored in I, which must have been constructed by C. C returns the string stored in I, which must have been constructed by C. It is an error to pass a wrapped string to C or a wrapped number to C. =head1 SEE ALSO L, L, L =cut unibilium-1.2.0/doc/unibi_var_from_str.pod000066400000000000000000000017061256345053500206650ustar00rootroot00000000000000=pod =head1 NAME unibi_num_from_var, unibi_str_from_var, unibi_var_from_num, unibi_var_from_str - create and inspect unibi_var_t values =head1 SYNOPSIS #include int unibi_num_from_var(unibi_var_t v); const char *unibi_str_from_var(unibi_var_t v); unibi_var_t unibi_var_from_num(int i); unibi_var_t unibi_var_from_str(char *s); =head1 DESCRIPTION C and C wrap the given int or string in a C object for use in L and L. C returns the number stored in I, which must have been constructed by C. C returns the string stored in I, which must have been constructed by C. It is an error to pass a wrapped string to C or a wrapped number to C. =head1 SEE ALSO L, L, L =cut unibilium-1.2.0/doc/unibilium.h.pod000066400000000000000000000427561256345053500172310ustar00rootroot00000000000000=pod =head1 NAME unibilium.h - terminfo parser and utility functions =head1 SYNOPSIS #include =head1 DESCRIPTION This library provides functions and types to access terminal descriptions in the terminfo database. It can parse compiled terminfo entries from memory or files, access and modify their capabilities, and generate new terminfo entries. =head2 Types The following types are provided: =over =item unibi_term The main type. It represents a terminfo entry. Most functions take a pointer to this structure. =item unibi_var_t A type that represents the values in format string operations, which are either integers or strings. It is currently implemented as a union of two members, C and C, but direct use of these is discouraged as the representation may change in the future. See L, L, L, L instead. However, it is guaranteed that zero-initializing a C is equivalent to C. =item enum unibi_boolean An enumeration of boolean capabilities. It has the following elements: =over 1 =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =back The special values C and C are provided to make it easier for programs to loop over all boolean capabilities. All of the enum values listed above are greater than C and less than C. =item enum unibi_numeric An enumeration of numeric capabilities. It has the following elements: =over 1 =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =back The special values C and C are provided to make it easier for programs to loop over all numeric capabilities. All of the enum values listed above are greater than C and less than C. =item enum unibi_string An enumeration of string capabilities. It has the following elements: =over 1 =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =item C =back The special values C and C are provided to make it easier for programs to loop over all string capabilities. All of the enum values listed above are greater than C and less than C. =back =head1 SEE ALSO L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L =cut unibilium-1.2.0/maint.mk000066400000000000000000000005371256345053500151650ustar00rootroot00000000000000CFLAGS=-std=gnu99 -pedantic -Wall -Wextra -Wno-missing-field-initializers -Wundef -Wshadow -Wbad-function-cast -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -O2 -pipe -fstack-protector-all -fsanitize=address -fsanitize=undefined LDFLAGS=-fsanitize=address -fsanitize=undefined unibilium-1.2.0/man/000077500000000000000000000000001256345053500142725ustar00rootroot00000000000000unibilium-1.2.0/man/.gitignore000066400000000000000000000000071256345053500162570ustar00rootroot00000000000000*.3.gz unibilium-1.2.0/secret/000077500000000000000000000000001256345053500150045ustar00rootroot00000000000000unibilium-1.2.0/secret/terminfo.pod000066400000000000000000000121741256345053500173400ustar00rootroot00000000000000=pod =head1 The I file format (as used by ncurses) In the following description, these data type representations are assumed: =over =item byte An 8-bit quantity. Synonymous with "octet". =item bool A single byte that's either 0 (I) or 1 (I). =item int Two bytes representing a 16-bit integer in little endian format. The value must be either a non-negative 15-bit value or the special value -1 (stored as C). =item string data Character data is stored as NUL-terminated ASCII strings. =back =head2 Standard capabilities =head3 Header A terminfo file starts with a 12 byte header, consisting of 6 ints: =over =item MAGIC The number 282 (stored in the file as C<1A 01>). =item NAME_SIZE The size (in bytes) of the name section. =item BOOL_COUNT The number of entries in the bool section. =item NUM_COUNT The number of entries in the num section. =item STRING_COUNT The number of entries in the string section. =item TABLE_SIZE The size (in bytes) of the string table. =back =head3 Data To make sense of the stored data, you need to know that there is a fixed number of bool/num/string capabilities each, and that they have a fixed order. So if a terminfo file wanted to set the third num capability to 4 and leave the first/second num capabilities unspecified, it would fill its num section with C<{ -1, -1, 4 }>. B: Document the names/order of all capabilities. =over =item The name section The name section contains a (NUL-terminated) string with one or more parts separated by C<|> (pipe). The first part is the primary name of the terminal; the last part is a human-readable description. The middle parts should be other names for the terminal. All parts except for the last should contain lowercase letters only. =item The bool section The bool section consists of I bytes, each representing a boolean value. =item Interlude: padding If I + I is not an even number, a padding byte is inserted here. =item The num section The num section consists of I ints. A value of -1 indicates that the corresponding numeric capability is missing. =item The string section The string section consists of I ints. A value of -1 indicates that the corresponding string capability is missing. Any other value is an offset from the beginning of the string table. =item The string table The string table consists of I bytes. It stores the data for string capabilities. Each entry in the string section specifies the byte at which the corresponding string starts; the end of a string is marked by a NUL byte. =back =head2 Extended capabilities In addition to the standard capabilities described above, ncurses supports user-defined capabilities with arbitrary names. If any of these are present, instead of the end of the file an extended header follows after the main data. =head3 Header The extended header consists of possibly a padding byte and 5 ints. =over =item Interlude: padding If the standard part of the file contains an odd number of bytes, a padding byte is inserted here. =item EXT_BOOL_COUNT The number of entries in the extended bool section. =item EXT_NUM_COUNT The number of entries in the extended num section. =item EXT_STRING_COUNT The number of entries in the extended string section. =item EXT_OFFSET_COUNT The number of entries in the string table. NB: The ncurses code for writing terminfo files calculates this as I + I + I + I (one entry for each capability name plus one entry for each string value). The ncurses code for reading terminfo files ignores this field. NB: L (part of ncurses) misdocuments this field as "size of the extended string table in bytes". This is wrong. =item EXT_TABLE_SIZE The size (in bytes) of the extended string table. NB: L (part of ncurses) misdocuments this field as "last offset of the extended string table". This is wrong. =back =head3 Data =over =item The extended bool section The extended bool section consists of I bytes, each representing a boolean value. =item Interlude: padding If I is not an even number, a padding byte is inserted here. =item The extended num section The extended num section consists of I ints. =item The extended string section The extended string section consists of I ints that are offsets from the beginning of the extended string table. =item The extended string section 2: Electric boogaloo The extended string section 2 consists of I + I + I ints that are offsets from the middle (see below) of the extended string table. =item The extended string table The extended string table consists of I bytes. The first half of the extended string table stores the data for extended string capabilities. The second half of the string table stores the names of all extended capabilities. The start of the second half (what I call the "middle") must be computed dynamically from the number (I) and size of the strings in the first half. =back =cut unibilium-1.2.0/t/000077500000000000000000000000001256345053500137625ustar00rootroot00000000000000unibilium-1.2.0/t/00_load.c000066400000000000000000000004301256345053500153410ustar00rootroot00000000000000#include #include int main(void) { setvbuf(stdout, NULL, _IOLBF, 0); puts("1..2"); unibi_term *ut = unibi_dummy(); puts("ok 1 - create dummy terminal"); unibi_destroy(ut); puts("ok 2 - destroy dummy terminal"); return 0; } unibilium-1.2.0/t/if-then-else.c000066400000000000000000000102121256345053500164020ustar00rootroot00000000000000#include #include #include "test-simple.c.inc" struct wlog { size_t used; char buf[1024]; }; static size_t smin(size_t a, size_t b) { return a < b ? a : b; } static void is_zu(size_t a, size_t b, const char *d, const char *file, unsigned line) { if (ok(a == b, "%s length", d)) { return; } fputc('\n', stderr); diag(" Failed test '%s length'", d); diag(" at %s line %u.", file, line); diag(" got: %zu", a); diag(" expected: %zu", b); } #define is_zu(A, B, D) is_zu(A, B, D, __FILE__, __LINE__) static void is_ms(const char *pa, size_t na, const char *pb, const char *d, const char *file, unsigned line) { const size_t nb = strlen(pb), n = smin(na, nb); (is_zu)(na, nb, d, file, line); if (ok(memcmp(pa, pb, n) == 0, "%s contents", d)) { return; } fputc('\n', stderr); diag(" Failed test '%s contents'", d); diag(" at %s line %u.", file, line); diag(" got: \"%.*s\"", (int)na, pa); diag(" expected: \"%s\"", pb); } #define is_ms(AP, AN, BP, D) is_ms(AP, AN, BP, D, __FILE__, __LINE__) static void out(void *ctx, const char *p, size_t n) { struct wlog *wlog = ctx; size_t m = smin(n, sizeof wlog->buf - wlog->used); memcpy(wlog->buf + wlog->used, p, m); wlog->used += m; } int main(void) { unibi_var_t var_dyn [26] = {0}; unibi_var_t var_static[26] = {0}; unibi_var_t param[9] = {0}; struct wlog wlog; plan(8); wlog.used = 0; unibi_format( var_dyn, var_static, "A" "%?%{0}%t" "B" "%?%{0}%t" "C" "%e" "D" "%;" "E" "%;" "F" , param, out, &wlog, NULL, NULL ); is_ms(wlog.buf, wlog.used, "AF", "nested then/if"); wlog.used = 0; unibi_format( var_dyn, var_static, "A" "%?%{0}%t" "B" "%?%{0}%t" "C" "%e" "D" "%;" "E" "%e" "F" "%?%{1}%t" "G" "%e" "H" "%;" "I" "%;" "J" , param, out, &wlog, NULL, NULL ); is_ms(wlog.buf, wlog.used, "AFGIJ", "nested then/if/else"); wlog.used = 0; unibi_format( var_dyn, var_static, "A" "%?%{0}%t" "B" "%e%{0}%t" "%?%{0}%t" "C" "%e" "D" "%;" "E" "%e%{42}%t" "F" "%?%{0}%t" "G" "%e" "H" "%;" "I" "%e" "J" "%;" "K" , param, out, &wlog, NULL, NULL ); is_ms(wlog.buf, wlog.used, "AFHIK", "else-if"); param[0] = unibi_var_from_num(26); param[1] = unibi_var_from_str((char *)"ducks"); wlog.used = 0; unibi_format( var_dyn, var_static, "[0;" "%?%p1%{11}%<%t" "%{58}" "%e" "%?%p1%{13}%<%t" "%{122}" "%e" "%?%p1%{23}%<%t" "%{71}" "%e" "%?%p1%{25}%<%t" "%{112}" "%e" "%?%p1%{35}%<%t" "%{69}" "%e" "%?%p1%{37}%<%t" "%{102}" "%e" "%?%p1%{47}%<%t" "%{67}" "%e" "%{92}" "%;" "%;" "%;" "%;" "%;" "%;" "%;" "%p1%+%d;" "%p2\"%s\"p" , param, out, &wlog, NULL, NULL ); is_ms(wlog.buf, wlog.used, "[0;95;\"ducks\"p", "ansi-pfkey"); return 0; } unibilium-1.2.0/t/static_screen-256color.c000066400000000000000000001751521256345053500203400ustar00rootroot00000000000000#include #include #include #include "test-simple.c.inc" const char terminfo[] = { 26, 1, 43, 0, 43, 0, 15, 0, 105, 1, -43, 2, 115, 99, 114, 101, 101, 110, 45, 50, 53, 54, 99, 111, 108, 111, 114, 124, 71, 78, 85, 32, 83, 99, 114, 101, 101, 110, 32, 119, 105, 116, 104, 32, 50, 53, 54, 32, 99, 111, 108, 111, 114, 115, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 80, 0, 8, 0, 24, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, -1, 127, 0, 0, 4, 0, 6, 0, 8, 0, 25, 0, 30, 0, 37, 0, 41, 0, -1, -1, -1, -1, 45, 0, 62, 0, 64, 0, 68, 0, 75, 0, -1, -1, 77, 0, 89, 0, -1, -1, 93, 0, 96, 0, 102, 0, 106, 0, -1, -1, -1, -1, 110, 0, 112, 0, 117, 0, 122, 0, -1, -1, -1, -1, -125, 0, -1, -1, -1, -1, -120, 0, -115, 0, -110, 0, -1, -1, -105, 0, -103, 0, -98, 0, -1, -1, -89, 0, -84, 0, -78, 0, -72, 0, -1, -1, -1, -1, -1, -1, -69, 0, -1, -1, -1, -1, -1, -1, -65, 0, -1, -1, -61, 0, -1, -1, -1, -1, -1, -1, -59, 0, -1, -1, -54, 0, -1, -1, -1, -1, -1, -1, -1, -1, -50, 0, -46, 0, -40, 0, -36, 0, -32, 0, -28, 0, -22, 0, -16, 0, -10, 0, -4, 0, 2, 1, 7, 1, -1, -1, 12, 1, -1, -1, 16, 1, 21, 1, 26, 1, -1, -1, -1, -1, -1, -1, 30, 1, 34, 1, 42, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 50, 1, -1, -1, 53, 1, 62, 1, 71, 1, 80, 1, -1, -1, 89, 1, 98, 1, 107, 1, -1, -1, 116, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 125, 1, -1, -1, -1, -1, -114, 1, -1, -1, -111, 1, -108, 1, -106, 1, -103, 1, -30, 1, -1, -1, -27, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -25, 1, -1, -1, 40, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 56, 2, 62, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, 2, -1, -1, -1, -1, -1, -1, 86, 2, -107, 2, 27, 91, 90, 0, 7, 0, 13, 0, 27, 91, 37, 105, 37, 112, 49, 37, 100, 59, 37, 112, 50, 37, 100, 114, 0, 27, 91, 51, 103, 0, 27, 91, 72, 27, 91, 74, 0, 27, 91, 75, 0, 27, 91, 74, 0, 27, 91, 37, 105, 37, 112, 49, 37, 100, 59, 37, 112, 50, 37, 100, 72, 0, 10, 0, 27, 91, 72, 0, 27, 91, 63, 50, 53, 108, 0, 8, 0, 27, 91, 51, 52, 104, 27, 91, 63, 50, 53, 104, 0, 27, 91, 67, 0, 27, 77, 0, 27, 91, 51, 52, 108, 0, 27, 91, 80, 0, 27, 91, 77, 0, 14, 0, 27, 91, 53, 109, 0, 27, 91, 49, 109, 0, 27, 91, 63, 49, 48, 52, 57, 104, 0, 27, 91, 52, 104, 0, 27, 91, 55, 109, 0, 27, 91, 51, 109, 0, 27, 91, 52, 109, 0, 15, 0, 27, 91, 109, 15, 0, 27, 91, 63, 49, 48, 52, 57, 108, 0, 27, 91, 52, 108, 0, 27, 91, 50, 51, 109, 0, 27, 91, 50, 52, 109, 0, 27, 103, 0, 27, 41, 48, 0, 27, 91, 76, 0, 8, 0, 27, 91, 51, 126, 0, 27, 79, 66, 0, 27, 79, 80, 0, 27, 91, 50, 49, 126, 0, 27, 79, 81, 0, 27, 79, 82, 0, 27, 79, 83, 0, 27, 91, 49, 53, 126, 0, 27, 91, 49, 55, 126, 0, 27, 91, 49, 56, 126, 0, 27, 91, 49, 57, 126, 0, 27, 91, 50, 48, 126, 0, 27, 91, 49, 126, 0, 27, 91, 50, 126, 0, 27, 79, 68, 0, 27, 91, 54, 126, 0, 27, 91, 53, 126, 0, 27, 79, 67, 0, 27, 79, 65, 0, 27, 91, 63, 49, 108, 27, 62, 0, 27, 91, 63, 49, 104, 27, 61, 0, 27, 69, 0, 27, 91, 37, 112, 49, 37, 100, 80, 0, 27, 91, 37, 112, 49, 37, 100, 77, 0, 27, 91, 37, 112, 49, 37, 100, 66, 0, 27, 91, 37, 112, 49, 37, 100, 64, 0, 27, 91, 37, 112, 49, 37, 100, 76, 0, 27, 91, 37, 112, 49, 37, 100, 68, 0, 27, 91, 37, 112, 49, 37, 100, 67, 0, 27, 91, 37, 112, 49, 37, 100, 65, 0, 27, 99, 27, 91, 63, 49, 48, 48, 48, 108, 27, 91, 63, 50, 53, 104, 0, 27, 56, 0, 27, 55, 0, 10, 0, 27, 77, 0, 27, 91, 48, 37, 63, 37, 112, 54, 37, 116, 59, 49, 37, 59, 37, 63, 37, 112, 49, 37, 116, 59, 51, 37, 59, 37, 63, 37, 112, 50, 37, 116, 59, 52, 37, 59, 37, 63, 37, 112, 51, 37, 116, 59, 55, 37, 59, 37, 63, 37, 112, 52, 37, 116, 59, 53, 37, 59, 109, 37, 63, 37, 112, 57, 37, 116, 14, 37, 101, 15, 37, 59, 0, 27, 72, 0, 9, 0, 43, 43, 44, 44, 45, 45, 46, 46, 48, 48, 96, 96, 97, 97, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 0, 27, 91, 90, 0, 27, 40, 66, 27, 41, 48, 0, 27, 91, 52, 126, 0, 27, 91, 50, 51, 126, 0, 27, 91, 50, 52, 126, 0, 27, 91, 49, 75, 0, 27, 91, 51, 57, 59, 52, 57, 109, 0, 27, 91, 77, 0, 27, 91, 37, 63, 37, 112, 49, 37, 123, 56, 125, 37, 60, 37, 116, 51, 37, 112, 49, 37, 100, 37, 101, 37, 112, 49, 37, 123, 49, 54, 125, 37, 60, 37, 116, 57, 37, 112, 49, 37, 123, 56, 125, 37, 45, 37, 100, 37, 101, 51, 56, 59, 53, 59, 37, 112, 49, 37, 100, 37, 59, 109, 0, 27, 91, 37, 63, 37, 112, 49, 37, 123, 56, 125, 37, 60, 37, 116, 52, 37, 112, 49, 37, 100, 37, 101, 37, 112, 49, 37, 123, 49, 54, 125, 37, 60, 37, 116, 49, 48, 37, 112, 49, 37, 123, 56, 125, 37, 45, 37, 100, 37, 101, 52, 56, 59, 53, 59, 37, 112, 49, 37, 100, 37, 59, 109, 0, 0, 3, 0, 1, 0, 24, 0, 52, 0, -112, 0, 1, 1, 0, 0, 1, 0, 0, 0, 4, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 3, 0, 6, 0, 9, 0, 12, 0, 15, 0, 18, 0, 23, 0, 28, 0, 32, 0, 37, 0, 43, 0, 49, 0, 55, 0, 61, 0, 66, 0, 71, 0, 77, 0, 83, 0, 89, 0, 95, 0, 101, 0, 107, 0, 111, 0, 116, 0, 120, 0, 124, 0, -128, 0, 27, 40, 66, 0, 27, 40, 37, 112, 49, 37, 99, 0, 65, 88, 0, 71, 48, 0, 88, 84, 0, 85, 56, 0, 69, 48, 0, 83, 48, 0, 107, 68, 67, 53, 0, 107, 68, 67, 54, 0, 107, 68, 78, 0, 107, 68, 78, 53, 0, 107, 69, 78, 68, 53, 0, 107, 69, 78, 68, 54, 0, 107, 72, 79, 77, 53, 0, 107, 72, 79, 77, 54, 0, 107, 73, 67, 53, 0, 107, 73, 67, 54, 0, 107, 76, 70, 84, 53, 0, 107, 78, 88, 84, 53, 0, 107, 78, 88, 84, 54, 0, 107, 80, 82, 86, 53, 0, 107, 80, 82, 86, 54, 0, 107, 82, 73, 84, 53, 0, 107, 85, 80, 0, 107, 85, 80, 53, 0, 107, 97, 50, 0, 107, 98, 49, 0, 107, 98, 51, 0, 107, 99, 50, 0 }; static void setup(void); int main(void) { int e; unibi_term *dt; setup(); dt = unibi_dummy(); e = errno; ok(dt != NULL, "dummy constructed"); if (!dt) { bail_out(strerror(e)); } unibi_term *ut = unibi_from_mem(terminfo, sizeof terminfo); e = errno; ok(ut != NULL, "terminfo loaded"); if (!ut) { bail_out(strerror(e)); } note("terminal name"); ok(strcmp(unibi_get_name(ut), "GNU Screen with 256 colors") == 0, "terminal name = \"%s\"", "GNU Screen with 256 colors"); unibi_set_name(dt, "GNU Screen with 256 colors"); { static const char *def_aliases[] = {"screen-256color", NULL}; const char **aliases = unibi_get_aliases(ut); ok(strcmp(aliases[0], def_aliases[0]) == 0, "terminal alias #0 = \"%s\"", "screen-256color"); ok(aliases[1] == NULL, "terminal alias #1 = null"); unibi_set_aliases(dt, def_aliases); } note("boolean capabilities"); ok(unibi_get_bool(ut, unibi_auto_left_margin) == 0, "auto_left_margin = false"); ok(unibi_get_bool(ut, unibi_auto_right_margin) == 1, "auto_right_margin = true"); unibi_set_bool(dt, unibi_auto_right_margin, 1); ok(unibi_get_bool(ut, unibi_no_esc_ctlc) == 0, "no_esc_ctlc = false"); ok(unibi_get_bool(ut, unibi_ceol_standout_glitch) == 0, "ceol_standout_glitch = false"); ok(unibi_get_bool(ut, unibi_eat_newline_glitch) == 1, "eat_newline_glitch = true"); unibi_set_bool(dt, unibi_eat_newline_glitch, 1); ok(unibi_get_bool(ut, unibi_erase_overstrike) == 0, "erase_overstrike = false"); ok(unibi_get_bool(ut, unibi_generic_type) == 0, "generic_type = false"); ok(unibi_get_bool(ut, unibi_hard_copy) == 0, "hard_copy = false"); ok(unibi_get_bool(ut, unibi_has_meta_key) == 1, "has_meta_key = true"); unibi_set_bool(dt, unibi_has_meta_key, 1); ok(unibi_get_bool(ut, unibi_has_status_line) == 0, "has_status_line = false"); ok(unibi_get_bool(ut, unibi_insert_null_glitch) == 0, "insert_null_glitch = false"); ok(unibi_get_bool(ut, unibi_memory_above) == 0, "memory_above = false"); ok(unibi_get_bool(ut, unibi_memory_below) == 0, "memory_below = false"); ok(unibi_get_bool(ut, unibi_move_insert_mode) == 1, "move_insert_mode = true"); unibi_set_bool(dt, unibi_move_insert_mode, 1); ok(unibi_get_bool(ut, unibi_move_standout_mode) == 1, "move_standout_mode = true"); unibi_set_bool(dt, unibi_move_standout_mode, 1); ok(unibi_get_bool(ut, unibi_over_strike) == 0, "over_strike = false"); ok(unibi_get_bool(ut, unibi_status_line_esc_ok) == 0, "status_line_esc_ok = false"); ok(unibi_get_bool(ut, unibi_dest_tabs_magic_smso) == 0, "dest_tabs_magic_smso = false"); ok(unibi_get_bool(ut, unibi_tilde_glitch) == 0, "tilde_glitch = false"); ok(unibi_get_bool(ut, unibi_transparent_underline) == 0, "transparent_underline = false"); ok(unibi_get_bool(ut, unibi_xon_xoff) == 0, "xon_xoff = false"); ok(unibi_get_bool(ut, unibi_needs_xon_xoff) == 0, "needs_xon_xoff = false"); ok(unibi_get_bool(ut, unibi_prtr_silent) == 0, "prtr_silent = false"); ok(unibi_get_bool(ut, unibi_hard_cursor) == 0, "hard_cursor = false"); ok(unibi_get_bool(ut, unibi_non_rev_rmcup) == 0, "non_rev_rmcup = false"); ok(unibi_get_bool(ut, unibi_no_pad_char) == 0, "no_pad_char = false"); ok(unibi_get_bool(ut, unibi_non_dest_scroll_region) == 0, "non_dest_scroll_region = false"); ok(unibi_get_bool(ut, unibi_can_change) == 0, "can_change = false"); ok(unibi_get_bool(ut, unibi_back_color_erase) == 0, "back_color_erase = false"); ok(unibi_get_bool(ut, unibi_hue_lightness_saturation) == 0, "hue_lightness_saturation = false"); ok(unibi_get_bool(ut, unibi_col_addr_glitch) == 0, "col_addr_glitch = false"); ok(unibi_get_bool(ut, unibi_cr_cancels_micro_mode) == 0, "cr_cancels_micro_mode = false"); ok(unibi_get_bool(ut, unibi_has_print_wheel) == 0, "has_print_wheel = false"); ok(unibi_get_bool(ut, unibi_row_addr_glitch) == 0, "row_addr_glitch = false"); ok(unibi_get_bool(ut, unibi_semi_auto_right_margin) == 0, "semi_auto_right_margin = false"); ok(unibi_get_bool(ut, unibi_cpi_changes_res) == 0, "cpi_changes_res = false"); ok(unibi_get_bool(ut, unibi_lpi_changes_res) == 0, "lpi_changes_res = false"); ok(unibi_get_bool(ut, unibi_backspaces_with_bs) == 1, "backspaces_with_bs = true"); unibi_set_bool(dt, unibi_backspaces_with_bs, 1); ok(unibi_get_bool(ut, unibi_crt_no_scrolling) == 0, "crt_no_scrolling = false"); ok(unibi_get_bool(ut, unibi_no_correctly_working_cr) == 0, "no_correctly_working_cr = false"); ok(unibi_get_bool(ut, unibi_gnu_has_meta_key) == 0, "gnu_has_meta_key = false"); ok(unibi_get_bool(ut, unibi_linefeed_is_newline) == 0, "linefeed_is_newline = false"); ok(unibi_get_bool(ut, unibi_has_hardware_tabs) == 1, "has_hardware_tabs = true"); unibi_set_bool(dt, unibi_has_hardware_tabs, 1); ok(unibi_get_bool(ut, unibi_return_does_clr_eol) == 0, "return_does_clr_eol = false"); note("numeric capabilities"); ok(unibi_get_num(ut, unibi_columns) == 80, "columns = 80"); unibi_set_num(dt, unibi_columns, 80); ok(unibi_get_num(ut, unibi_init_tabs) == 8, "init_tabs = 8"); unibi_set_num(dt, unibi_init_tabs, 8); ok(unibi_get_num(ut, unibi_lines) == 24, "lines = 24"); unibi_set_num(dt, unibi_lines, 24); ok(unibi_get_num(ut, unibi_lines_of_memory) == -1, "lines_of_memory = -1"); ok(unibi_get_num(ut, unibi_magic_cookie_glitch) == -1, "magic_cookie_glitch = -1"); ok(unibi_get_num(ut, unibi_padding_baud_rate) == -1, "padding_baud_rate = -1"); ok(unibi_get_num(ut, unibi_virtual_terminal) == -1, "virtual_terminal = -1"); ok(unibi_get_num(ut, unibi_width_status_line) == -1, "width_status_line = -1"); ok(unibi_get_num(ut, unibi_num_labels) == -1, "num_labels = -1"); ok(unibi_get_num(ut, unibi_label_height) == -1, "label_height = -1"); ok(unibi_get_num(ut, unibi_label_width) == -1, "label_width = -1"); ok(unibi_get_num(ut, unibi_max_attributes) == -1, "max_attributes = -1"); ok(unibi_get_num(ut, unibi_maximum_windows) == -1, "maximum_windows = -1"); ok(unibi_get_num(ut, unibi_max_colors) == 256, "max_colors = 256"); unibi_set_num(dt, unibi_max_colors, 256); ok(unibi_get_num(ut, unibi_max_pairs) == 32767, "max_pairs = 32767"); unibi_set_num(dt, unibi_max_pairs, 32767); ok(unibi_get_num(ut, unibi_no_color_video) == -1, "no_color_video = -1"); ok(unibi_get_num(ut, unibi_buffer_capacity) == -1, "buffer_capacity = -1"); ok(unibi_get_num(ut, unibi_dot_vert_spacing) == -1, "dot_vert_spacing = -1"); ok(unibi_get_num(ut, unibi_dot_horz_spacing) == -1, "dot_horz_spacing = -1"); ok(unibi_get_num(ut, unibi_max_micro_address) == -1, "max_micro_address = -1"); ok(unibi_get_num(ut, unibi_max_micro_jump) == -1, "max_micro_jump = -1"); ok(unibi_get_num(ut, unibi_micro_col_size) == -1, "micro_col_size = -1"); ok(unibi_get_num(ut, unibi_micro_line_size) == -1, "micro_line_size = -1"); ok(unibi_get_num(ut, unibi_number_of_pins) == -1, "number_of_pins = -1"); ok(unibi_get_num(ut, unibi_output_res_char) == -1, "output_res_char = -1"); ok(unibi_get_num(ut, unibi_output_res_line) == -1, "output_res_line = -1"); ok(unibi_get_num(ut, unibi_output_res_horz_inch) == -1, "output_res_horz_inch = -1"); ok(unibi_get_num(ut, unibi_output_res_vert_inch) == -1, "output_res_vert_inch = -1"); ok(unibi_get_num(ut, unibi_print_rate) == -1, "print_rate = -1"); ok(unibi_get_num(ut, unibi_wide_char_size) == -1, "wide_char_size = -1"); ok(unibi_get_num(ut, unibi_buttons) == -1, "buttons = -1"); ok(unibi_get_num(ut, unibi_bit_image_entwining) == -1, "bit_image_entwining = -1"); ok(unibi_get_num(ut, unibi_bit_image_type) == -1, "bit_image_type = -1"); ok(unibi_get_num(ut, unibi_magic_cookie_glitch_ul) == -1, "magic_cookie_glitch_ul = -1"); ok(unibi_get_num(ut, unibi_carriage_return_delay) == -1, "carriage_return_delay = -1"); ok(unibi_get_num(ut, unibi_new_line_delay) == -1, "new_line_delay = -1"); ok(unibi_get_num(ut, unibi_backspace_delay) == -1, "backspace_delay = -1"); ok(unibi_get_num(ut, unibi_horizontal_tab_delay) == -1, "horizontal_tab_delay = -1"); ok(unibi_get_num(ut, unibi_number_of_function_keys) == -1, "number_of_function_keys = -1"); note("string capabilities"); ok(strcmp(unibi_get_str(ut, unibi_back_tab), "\033[Z") == 0, "back_tab = \"%s\"", "\\033[Z"); unibi_set_str(dt, unibi_back_tab, "\033[Z"); ok(strcmp(unibi_get_str(ut, unibi_bell), "\007") == 0, "bell = \"%s\"", "\\007"); unibi_set_str(dt, unibi_bell, "\007"); ok(strcmp(unibi_get_str(ut, unibi_carriage_return), "\015") == 0, "carriage_return = \"%s\"", "\\015"); unibi_set_str(dt, unibi_carriage_return, "\015"); ok(strcmp(unibi_get_str(ut, unibi_change_scroll_region), "\033[%i%p1%d;%p2%dr") == 0, "change_scroll_region = \"%s\"", "\\033[%i%p1%d;%p2%dr"); unibi_set_str(dt, unibi_change_scroll_region, "\033[%i%p1%d;%p2%dr"); ok(strcmp(unibi_get_str(ut, unibi_clear_all_tabs), "\033[3g") == 0, "clear_all_tabs = \"%s\"", "\\033[3g"); unibi_set_str(dt, unibi_clear_all_tabs, "\033[3g"); ok(strcmp(unibi_get_str(ut, unibi_clear_screen), "\033[H\033[J") == 0, "clear_screen = \"%s\"", "\\033[H\\033[J"); unibi_set_str(dt, unibi_clear_screen, "\033[H\033[J"); ok(strcmp(unibi_get_str(ut, unibi_clr_eol), "\033[K") == 0, "clr_eol = \"%s\"", "\\033[K"); unibi_set_str(dt, unibi_clr_eol, "\033[K"); ok(strcmp(unibi_get_str(ut, unibi_clr_eos), "\033[J") == 0, "clr_eos = \"%s\"", "\\033[J"); unibi_set_str(dt, unibi_clr_eos, "\033[J"); ok(unibi_get_str(ut, unibi_column_address) == NULL, "column_address = null"); ok(unibi_get_str(ut, unibi_command_character) == NULL, "command_character = null"); ok(strcmp(unibi_get_str(ut, unibi_cursor_address), "\033[%i%p1%d;%p2%dH") == 0, "cursor_address = \"%s\"", "\\033[%i%p1%d;%p2%dH"); unibi_set_str(dt, unibi_cursor_address, "\033[%i%p1%d;%p2%dH"); ok(strcmp(unibi_get_str(ut, unibi_cursor_down), "\012") == 0, "cursor_down = \"%s\"", "\\012"); unibi_set_str(dt, unibi_cursor_down, "\012"); ok(strcmp(unibi_get_str(ut, unibi_cursor_home), "\033[H") == 0, "cursor_home = \"%s\"", "\\033[H"); unibi_set_str(dt, unibi_cursor_home, "\033[H"); ok(strcmp(unibi_get_str(ut, unibi_cursor_invisible), "\033[?25l") == 0, "cursor_invisible = \"%s\"", "\\033[?25l"); unibi_set_str(dt, unibi_cursor_invisible, "\033[?25l"); ok(strcmp(unibi_get_str(ut, unibi_cursor_left), "\010") == 0, "cursor_left = \"%s\"", "\\010"); unibi_set_str(dt, unibi_cursor_left, "\010"); ok(unibi_get_str(ut, unibi_cursor_mem_address) == NULL, "cursor_mem_address = null"); ok(strcmp(unibi_get_str(ut, unibi_cursor_normal), "\033[34h\033[?25h") == 0, "cursor_normal = \"%s\"", "\\033[34h\\033[?25h"); unibi_set_str(dt, unibi_cursor_normal, "\033[34h\033[?25h"); ok(strcmp(unibi_get_str(ut, unibi_cursor_right), "\033[C") == 0, "cursor_right = \"%s\"", "\\033[C"); unibi_set_str(dt, unibi_cursor_right, "\033[C"); ok(unibi_get_str(ut, unibi_cursor_to_ll) == NULL, "cursor_to_ll = null"); ok(strcmp(unibi_get_str(ut, unibi_cursor_up), "\033M") == 0, "cursor_up = \"%s\"", "\\033M"); unibi_set_str(dt, unibi_cursor_up, "\033M"); ok(strcmp(unibi_get_str(ut, unibi_cursor_visible), "\033[34l") == 0, "cursor_visible = \"%s\"", "\\033[34l"); unibi_set_str(dt, unibi_cursor_visible, "\033[34l"); ok(strcmp(unibi_get_str(ut, unibi_delete_character), "\033[P") == 0, "delete_character = \"%s\"", "\\033[P"); unibi_set_str(dt, unibi_delete_character, "\033[P"); ok(strcmp(unibi_get_str(ut, unibi_delete_line), "\033[M") == 0, "delete_line = \"%s\"", "\\033[M"); unibi_set_str(dt, unibi_delete_line, "\033[M"); ok(unibi_get_str(ut, unibi_dis_status_line) == NULL, "dis_status_line = null"); ok(unibi_get_str(ut, unibi_down_half_line) == NULL, "down_half_line = null"); ok(strcmp(unibi_get_str(ut, unibi_enter_alt_charset_mode), "\016") == 0, "enter_alt_charset_mode = \"%s\"", "\\016"); unibi_set_str(dt, unibi_enter_alt_charset_mode, "\016"); ok(strcmp(unibi_get_str(ut, unibi_enter_blink_mode), "\033[5m") == 0, "enter_blink_mode = \"%s\"", "\\033[5m"); unibi_set_str(dt, unibi_enter_blink_mode, "\033[5m"); ok(strcmp(unibi_get_str(ut, unibi_enter_bold_mode), "\033[1m") == 0, "enter_bold_mode = \"%s\"", "\\033[1m"); unibi_set_str(dt, unibi_enter_bold_mode, "\033[1m"); ok(strcmp(unibi_get_str(ut, unibi_enter_ca_mode), "\033[?1049h") == 0, "enter_ca_mode = \"%s\"", "\\033[?1049h"); unibi_set_str(dt, unibi_enter_ca_mode, "\033[?1049h"); ok(unibi_get_str(ut, unibi_enter_delete_mode) == NULL, "enter_delete_mode = null"); ok(unibi_get_str(ut, unibi_enter_dim_mode) == NULL, "enter_dim_mode = null"); ok(strcmp(unibi_get_str(ut, unibi_enter_insert_mode), "\033[4h") == 0, "enter_insert_mode = \"%s\"", "\\033[4h"); unibi_set_str(dt, unibi_enter_insert_mode, "\033[4h"); ok(unibi_get_str(ut, unibi_enter_secure_mode) == NULL, "enter_secure_mode = null"); ok(unibi_get_str(ut, unibi_enter_protected_mode) == NULL, "enter_protected_mode = null"); ok(strcmp(unibi_get_str(ut, unibi_enter_reverse_mode), "\033[7m") == 0, "enter_reverse_mode = \"%s\"", "\\033[7m"); unibi_set_str(dt, unibi_enter_reverse_mode, "\033[7m"); ok(strcmp(unibi_get_str(ut, unibi_enter_standout_mode), "\033[3m") == 0, "enter_standout_mode = \"%s\"", "\\033[3m"); unibi_set_str(dt, unibi_enter_standout_mode, "\033[3m"); ok(strcmp(unibi_get_str(ut, unibi_enter_underline_mode), "\033[4m") == 0, "enter_underline_mode = \"%s\"", "\\033[4m"); unibi_set_str(dt, unibi_enter_underline_mode, "\033[4m"); ok(unibi_get_str(ut, unibi_erase_chars) == NULL, "erase_chars = null"); ok(strcmp(unibi_get_str(ut, unibi_exit_alt_charset_mode), "\017") == 0, "exit_alt_charset_mode = \"%s\"", "\\017"); unibi_set_str(dt, unibi_exit_alt_charset_mode, "\017"); ok(strcmp(unibi_get_str(ut, unibi_exit_attribute_mode), "\033[m\017") == 0, "exit_attribute_mode = \"%s\"", "\\033[m\\017"); unibi_set_str(dt, unibi_exit_attribute_mode, "\033[m\017"); ok(strcmp(unibi_get_str(ut, unibi_exit_ca_mode), "\033[?1049l") == 0, "exit_ca_mode = \"%s\"", "\\033[?1049l"); unibi_set_str(dt, unibi_exit_ca_mode, "\033[?1049l"); ok(unibi_get_str(ut, unibi_exit_delete_mode) == NULL, "exit_delete_mode = null"); ok(strcmp(unibi_get_str(ut, unibi_exit_insert_mode), "\033[4l") == 0, "exit_insert_mode = \"%s\"", "\\033[4l"); unibi_set_str(dt, unibi_exit_insert_mode, "\033[4l"); ok(strcmp(unibi_get_str(ut, unibi_exit_standout_mode), "\033[23m") == 0, "exit_standout_mode = \"%s\"", "\\033[23m"); unibi_set_str(dt, unibi_exit_standout_mode, "\033[23m"); ok(strcmp(unibi_get_str(ut, unibi_exit_underline_mode), "\033[24m") == 0, "exit_underline_mode = \"%s\"", "\\033[24m"); unibi_set_str(dt, unibi_exit_underline_mode, "\033[24m"); ok(strcmp(unibi_get_str(ut, unibi_flash_screen), "\033g") == 0, "flash_screen = \"%s\"", "\\033g"); unibi_set_str(dt, unibi_flash_screen, "\033g"); ok(unibi_get_str(ut, unibi_form_feed) == NULL, "form_feed = null"); ok(unibi_get_str(ut, unibi_from_status_line) == NULL, "from_status_line = null"); ok(unibi_get_str(ut, unibi_init_1string) == NULL, "init_1string = null"); ok(strcmp(unibi_get_str(ut, unibi_init_2string), "\033)0") == 0, "init_2string = \"%s\"", "\\033)0"); unibi_set_str(dt, unibi_init_2string, "\033)0"); ok(unibi_get_str(ut, unibi_init_3string) == NULL, "init_3string = null"); ok(unibi_get_str(ut, unibi_init_file) == NULL, "init_file = null"); ok(unibi_get_str(ut, unibi_insert_character) == NULL, "insert_character = null"); ok(strcmp(unibi_get_str(ut, unibi_insert_line), "\033[L") == 0, "insert_line = \"%s\"", "\\033[L"); unibi_set_str(dt, unibi_insert_line, "\033[L"); ok(unibi_get_str(ut, unibi_insert_padding) == NULL, "insert_padding = null"); ok(strcmp(unibi_get_str(ut, unibi_key_backspace), "\010") == 0, "key_backspace = \"%s\"", "\\010"); unibi_set_str(dt, unibi_key_backspace, "\010"); ok(unibi_get_str(ut, unibi_key_catab) == NULL, "key_catab = null"); ok(unibi_get_str(ut, unibi_key_clear) == NULL, "key_clear = null"); ok(unibi_get_str(ut, unibi_key_ctab) == NULL, "key_ctab = null"); ok(strcmp(unibi_get_str(ut, unibi_key_dc), "\033[3~") == 0, "key_dc = \"%s\"", "\\033[3~"); unibi_set_str(dt, unibi_key_dc, "\033[3~"); ok(unibi_get_str(ut, unibi_key_dl) == NULL, "key_dl = null"); ok(strcmp(unibi_get_str(ut, unibi_key_down), "\033OB") == 0, "key_down = \"%s\"", "\\033OB"); unibi_set_str(dt, unibi_key_down, "\033OB"); ok(unibi_get_str(ut, unibi_key_eic) == NULL, "key_eic = null"); ok(unibi_get_str(ut, unibi_key_eol) == NULL, "key_eol = null"); ok(unibi_get_str(ut, unibi_key_eos) == NULL, "key_eos = null"); ok(unibi_get_str(ut, unibi_key_f0) == NULL, "key_f0 = null"); ok(strcmp(unibi_get_str(ut, unibi_key_f1), "\033OP") == 0, "key_f1 = \"%s\"", "\\033OP"); unibi_set_str(dt, unibi_key_f1, "\033OP"); ok(strcmp(unibi_get_str(ut, unibi_key_f10), "\033[21~") == 0, "key_f10 = \"%s\"", "\\033[21~"); unibi_set_str(dt, unibi_key_f10, "\033[21~"); ok(strcmp(unibi_get_str(ut, unibi_key_f2), "\033OQ") == 0, "key_f2 = \"%s\"", "\\033OQ"); unibi_set_str(dt, unibi_key_f2, "\033OQ"); ok(strcmp(unibi_get_str(ut, unibi_key_f3), "\033OR") == 0, "key_f3 = \"%s\"", "\\033OR"); unibi_set_str(dt, unibi_key_f3, "\033OR"); ok(strcmp(unibi_get_str(ut, unibi_key_f4), "\033OS") == 0, "key_f4 = \"%s\"", "\\033OS"); unibi_set_str(dt, unibi_key_f4, "\033OS"); ok(strcmp(unibi_get_str(ut, unibi_key_f5), "\033[15~") == 0, "key_f5 = \"%s\"", "\\033[15~"); unibi_set_str(dt, unibi_key_f5, "\033[15~"); ok(strcmp(unibi_get_str(ut, unibi_key_f6), "\033[17~") == 0, "key_f6 = \"%s\"", "\\033[17~"); unibi_set_str(dt, unibi_key_f6, "\033[17~"); ok(strcmp(unibi_get_str(ut, unibi_key_f7), "\033[18~") == 0, "key_f7 = \"%s\"", "\\033[18~"); unibi_set_str(dt, unibi_key_f7, "\033[18~"); ok(strcmp(unibi_get_str(ut, unibi_key_f8), "\033[19~") == 0, "key_f8 = \"%s\"", "\\033[19~"); unibi_set_str(dt, unibi_key_f8, "\033[19~"); ok(strcmp(unibi_get_str(ut, unibi_key_f9), "\033[20~") == 0, "key_f9 = \"%s\"", "\\033[20~"); unibi_set_str(dt, unibi_key_f9, "\033[20~"); ok(strcmp(unibi_get_str(ut, unibi_key_home), "\033[1~") == 0, "key_home = \"%s\"", "\\033[1~"); unibi_set_str(dt, unibi_key_home, "\033[1~"); ok(strcmp(unibi_get_str(ut, unibi_key_ic), "\033[2~") == 0, "key_ic = \"%s\"", "\\033[2~"); unibi_set_str(dt, unibi_key_ic, "\033[2~"); ok(unibi_get_str(ut, unibi_key_il) == NULL, "key_il = null"); ok(strcmp(unibi_get_str(ut, unibi_key_left), "\033OD") == 0, "key_left = \"%s\"", "\\033OD"); unibi_set_str(dt, unibi_key_left, "\033OD"); ok(unibi_get_str(ut, unibi_key_ll) == NULL, "key_ll = null"); ok(strcmp(unibi_get_str(ut, unibi_key_npage), "\033[6~") == 0, "key_npage = \"%s\"", "\\033[6~"); unibi_set_str(dt, unibi_key_npage, "\033[6~"); ok(strcmp(unibi_get_str(ut, unibi_key_ppage), "\033[5~") == 0, "key_ppage = \"%s\"", "\\033[5~"); unibi_set_str(dt, unibi_key_ppage, "\033[5~"); ok(strcmp(unibi_get_str(ut, unibi_key_right), "\033OC") == 0, "key_right = \"%s\"", "\\033OC"); unibi_set_str(dt, unibi_key_right, "\033OC"); ok(unibi_get_str(ut, unibi_key_sf) == NULL, "key_sf = null"); ok(unibi_get_str(ut, unibi_key_sr) == NULL, "key_sr = null"); ok(unibi_get_str(ut, unibi_key_stab) == NULL, "key_stab = null"); ok(strcmp(unibi_get_str(ut, unibi_key_up), "\033OA") == 0, "key_up = \"%s\"", "\\033OA"); unibi_set_str(dt, unibi_key_up, "\033OA"); ok(strcmp(unibi_get_str(ut, unibi_keypad_local), "\033[?1l\033>") == 0, "keypad_local = \"%s\"", "\\033[?1l\\033>"); unibi_set_str(dt, unibi_keypad_local, "\033[?1l\033>"); ok(strcmp(unibi_get_str(ut, unibi_keypad_xmit), "\033[?1h\033=") == 0, "keypad_xmit = \"%s\"", "\\033[?1h\\033="); unibi_set_str(dt, unibi_keypad_xmit, "\033[?1h\033="); ok(unibi_get_str(ut, unibi_lab_f0) == NULL, "lab_f0 = null"); ok(unibi_get_str(ut, unibi_lab_f1) == NULL, "lab_f1 = null"); ok(unibi_get_str(ut, unibi_lab_f10) == NULL, "lab_f10 = null"); ok(unibi_get_str(ut, unibi_lab_f2) == NULL, "lab_f2 = null"); ok(unibi_get_str(ut, unibi_lab_f3) == NULL, "lab_f3 = null"); ok(unibi_get_str(ut, unibi_lab_f4) == NULL, "lab_f4 = null"); ok(unibi_get_str(ut, unibi_lab_f5) == NULL, "lab_f5 = null"); ok(unibi_get_str(ut, unibi_lab_f6) == NULL, "lab_f6 = null"); ok(unibi_get_str(ut, unibi_lab_f7) == NULL, "lab_f7 = null"); ok(unibi_get_str(ut, unibi_lab_f8) == NULL, "lab_f8 = null"); ok(unibi_get_str(ut, unibi_lab_f9) == NULL, "lab_f9 = null"); ok(unibi_get_str(ut, unibi_meta_off) == NULL, "meta_off = null"); ok(unibi_get_str(ut, unibi_meta_on) == NULL, "meta_on = null"); ok(strcmp(unibi_get_str(ut, unibi_newline), "\033E") == 0, "newline = \"%s\"", "\\033E"); unibi_set_str(dt, unibi_newline, "\033E"); ok(unibi_get_str(ut, unibi_pad_char) == NULL, "pad_char = null"); ok(strcmp(unibi_get_str(ut, unibi_parm_dch), "\033[%p1%dP") == 0, "parm_dch = \"%s\"", "\\033[%p1%dP"); unibi_set_str(dt, unibi_parm_dch, "\033[%p1%dP"); ok(strcmp(unibi_get_str(ut, unibi_parm_delete_line), "\033[%p1%dM") == 0, "parm_delete_line = \"%s\"", "\\033[%p1%dM"); unibi_set_str(dt, unibi_parm_delete_line, "\033[%p1%dM"); ok(strcmp(unibi_get_str(ut, unibi_parm_down_cursor), "\033[%p1%dB") == 0, "parm_down_cursor = \"%s\"", "\\033[%p1%dB"); unibi_set_str(dt, unibi_parm_down_cursor, "\033[%p1%dB"); ok(strcmp(unibi_get_str(ut, unibi_parm_ich), "\033[%p1%d@") == 0, "parm_ich = \"%s\"", "\\033[%p1%d@"); unibi_set_str(dt, unibi_parm_ich, "\033[%p1%d@"); ok(unibi_get_str(ut, unibi_parm_index) == NULL, "parm_index = null"); ok(strcmp(unibi_get_str(ut, unibi_parm_insert_line), "\033[%p1%dL") == 0, "parm_insert_line = \"%s\"", "\\033[%p1%dL"); unibi_set_str(dt, unibi_parm_insert_line, "\033[%p1%dL"); ok(strcmp(unibi_get_str(ut, unibi_parm_left_cursor), "\033[%p1%dD") == 0, "parm_left_cursor = \"%s\"", "\\033[%p1%dD"); unibi_set_str(dt, unibi_parm_left_cursor, "\033[%p1%dD"); ok(strcmp(unibi_get_str(ut, unibi_parm_right_cursor), "\033[%p1%dC") == 0, "parm_right_cursor = \"%s\"", "\\033[%p1%dC"); unibi_set_str(dt, unibi_parm_right_cursor, "\033[%p1%dC"); ok(unibi_get_str(ut, unibi_parm_rindex) == NULL, "parm_rindex = null"); ok(strcmp(unibi_get_str(ut, unibi_parm_up_cursor), "\033[%p1%dA") == 0, "parm_up_cursor = \"%s\"", "\\033[%p1%dA"); unibi_set_str(dt, unibi_parm_up_cursor, "\033[%p1%dA"); ok(unibi_get_str(ut, unibi_pkey_key) == NULL, "pkey_key = null"); ok(unibi_get_str(ut, unibi_pkey_local) == NULL, "pkey_local = null"); ok(unibi_get_str(ut, unibi_pkey_xmit) == NULL, "pkey_xmit = null"); ok(unibi_get_str(ut, unibi_print_screen) == NULL, "print_screen = null"); ok(unibi_get_str(ut, unibi_prtr_off) == NULL, "prtr_off = null"); ok(unibi_get_str(ut, unibi_prtr_on) == NULL, "prtr_on = null"); ok(unibi_get_str(ut, unibi_repeat_char) == NULL, "repeat_char = null"); ok(unibi_get_str(ut, unibi_reset_1string) == NULL, "reset_1string = null"); ok(strcmp(unibi_get_str(ut, unibi_reset_2string), "\033c\033[?1000l\033[?25h") == 0, "reset_2string = \"%s\"", "\\033c\\033[?1000l\\033[?25h"); unibi_set_str(dt, unibi_reset_2string, "\033c\033[?1000l\033[?25h"); ok(unibi_get_str(ut, unibi_reset_3string) == NULL, "reset_3string = null"); ok(unibi_get_str(ut, unibi_reset_file) == NULL, "reset_file = null"); ok(strcmp(unibi_get_str(ut, unibi_restore_cursor), "\0338") == 0, "restore_cursor = \"%s\"", "\\0338"); unibi_set_str(dt, unibi_restore_cursor, "\0338"); ok(unibi_get_str(ut, unibi_row_address) == NULL, "row_address = null"); ok(strcmp(unibi_get_str(ut, unibi_save_cursor), "\0337") == 0, "save_cursor = \"%s\"", "\\0337"); unibi_set_str(dt, unibi_save_cursor, "\0337"); ok(strcmp(unibi_get_str(ut, unibi_scroll_forward), "\012") == 0, "scroll_forward = \"%s\"", "\\012"); unibi_set_str(dt, unibi_scroll_forward, "\012"); ok(strcmp(unibi_get_str(ut, unibi_scroll_reverse), "\033M") == 0, "scroll_reverse = \"%s\"", "\\033M"); unibi_set_str(dt, unibi_scroll_reverse, "\033M"); ok(strcmp(unibi_get_str(ut, unibi_set_attributes), "\033[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;") == 0, "set_attributes = \"%s\"", "\\033[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\\016%e\\017%;"); unibi_set_str(dt, unibi_set_attributes, "\033[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;"); ok(strcmp(unibi_get_str(ut, unibi_set_tab), "\033H") == 0, "set_tab = \"%s\"", "\\033H"); unibi_set_str(dt, unibi_set_tab, "\033H"); ok(unibi_get_str(ut, unibi_set_window) == NULL, "set_window = null"); ok(strcmp(unibi_get_str(ut, unibi_tab), "\011") == 0, "tab = \"%s\"", "\\011"); unibi_set_str(dt, unibi_tab, "\011"); ok(unibi_get_str(ut, unibi_to_status_line) == NULL, "to_status_line = null"); ok(unibi_get_str(ut, unibi_underline_char) == NULL, "underline_char = null"); ok(unibi_get_str(ut, unibi_up_half_line) == NULL, "up_half_line = null"); ok(unibi_get_str(ut, unibi_init_prog) == NULL, "init_prog = null"); ok(unibi_get_str(ut, unibi_key_a1) == NULL, "key_a1 = null"); ok(unibi_get_str(ut, unibi_key_a3) == NULL, "key_a3 = null"); ok(unibi_get_str(ut, unibi_key_b2) == NULL, "key_b2 = null"); ok(unibi_get_str(ut, unibi_key_c1) == NULL, "key_c1 = null"); ok(unibi_get_str(ut, unibi_key_c3) == NULL, "key_c3 = null"); ok(unibi_get_str(ut, unibi_prtr_non) == NULL, "prtr_non = null"); ok(unibi_get_str(ut, unibi_char_padding) == NULL, "char_padding = null"); ok(strcmp(unibi_get_str(ut, unibi_acs_chars), "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~") == 0, "acs_chars = \"%s\"", "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"); unibi_set_str(dt, unibi_acs_chars, "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"); ok(unibi_get_str(ut, unibi_plab_norm) == NULL, "plab_norm = null"); ok(strcmp(unibi_get_str(ut, unibi_key_btab), "\033[Z") == 0, "key_btab = \"%s\"", "\\033[Z"); unibi_set_str(dt, unibi_key_btab, "\033[Z"); ok(unibi_get_str(ut, unibi_enter_xon_mode) == NULL, "enter_xon_mode = null"); ok(unibi_get_str(ut, unibi_exit_xon_mode) == NULL, "exit_xon_mode = null"); ok(unibi_get_str(ut, unibi_enter_am_mode) == NULL, "enter_am_mode = null"); ok(unibi_get_str(ut, unibi_exit_am_mode) == NULL, "exit_am_mode = null"); ok(unibi_get_str(ut, unibi_xon_character) == NULL, "xon_character = null"); ok(unibi_get_str(ut, unibi_xoff_character) == NULL, "xoff_character = null"); ok(strcmp(unibi_get_str(ut, unibi_ena_acs), "\033(B\033)0") == 0, "ena_acs = \"%s\"", "\\033(B\\033)0"); unibi_set_str(dt, unibi_ena_acs, "\033(B\033)0"); ok(unibi_get_str(ut, unibi_label_on) == NULL, "label_on = null"); ok(unibi_get_str(ut, unibi_label_off) == NULL, "label_off = null"); ok(unibi_get_str(ut, unibi_key_beg) == NULL, "key_beg = null"); ok(unibi_get_str(ut, unibi_key_cancel) == NULL, "key_cancel = null"); ok(unibi_get_str(ut, unibi_key_close) == NULL, "key_close = null"); ok(unibi_get_str(ut, unibi_key_command) == NULL, "key_command = null"); ok(unibi_get_str(ut, unibi_key_copy) == NULL, "key_copy = null"); ok(unibi_get_str(ut, unibi_key_create) == NULL, "key_create = null"); ok(strcmp(unibi_get_str(ut, unibi_key_end), "\033[4~") == 0, "key_end = \"%s\"", "\\033[4~"); unibi_set_str(dt, unibi_key_end, "\033[4~"); ok(unibi_get_str(ut, unibi_key_enter) == NULL, "key_enter = null"); ok(unibi_get_str(ut, unibi_key_exit) == NULL, "key_exit = null"); ok(unibi_get_str(ut, unibi_key_find) == NULL, "key_find = null"); ok(unibi_get_str(ut, unibi_key_help) == NULL, "key_help = null"); ok(unibi_get_str(ut, unibi_key_mark) == NULL, "key_mark = null"); ok(unibi_get_str(ut, unibi_key_message) == NULL, "key_message = null"); ok(unibi_get_str(ut, unibi_key_move) == NULL, "key_move = null"); ok(unibi_get_str(ut, unibi_key_next) == NULL, "key_next = null"); ok(unibi_get_str(ut, unibi_key_open) == NULL, "key_open = null"); ok(unibi_get_str(ut, unibi_key_options) == NULL, "key_options = null"); ok(unibi_get_str(ut, unibi_key_previous) == NULL, "key_previous = null"); ok(unibi_get_str(ut, unibi_key_print) == NULL, "key_print = null"); ok(unibi_get_str(ut, unibi_key_redo) == NULL, "key_redo = null"); ok(unibi_get_str(ut, unibi_key_reference) == NULL, "key_reference = null"); ok(unibi_get_str(ut, unibi_key_refresh) == NULL, "key_refresh = null"); ok(unibi_get_str(ut, unibi_key_replace) == NULL, "key_replace = null"); ok(unibi_get_str(ut, unibi_key_restart) == NULL, "key_restart = null"); ok(unibi_get_str(ut, unibi_key_resume) == NULL, "key_resume = null"); ok(unibi_get_str(ut, unibi_key_save) == NULL, "key_save = null"); ok(unibi_get_str(ut, unibi_key_suspend) == NULL, "key_suspend = null"); ok(unibi_get_str(ut, unibi_key_undo) == NULL, "key_undo = null"); ok(unibi_get_str(ut, unibi_key_sbeg) == NULL, "key_sbeg = null"); ok(unibi_get_str(ut, unibi_key_scancel) == NULL, "key_scancel = null"); ok(unibi_get_str(ut, unibi_key_scommand) == NULL, "key_scommand = null"); ok(unibi_get_str(ut, unibi_key_scopy) == NULL, "key_scopy = null"); ok(unibi_get_str(ut, unibi_key_screate) == NULL, "key_screate = null"); ok(unibi_get_str(ut, unibi_key_sdc) == NULL, "key_sdc = null"); ok(unibi_get_str(ut, unibi_key_sdl) == NULL, "key_sdl = null"); ok(unibi_get_str(ut, unibi_key_select) == NULL, "key_select = null"); ok(unibi_get_str(ut, unibi_key_send) == NULL, "key_send = null"); ok(unibi_get_str(ut, unibi_key_seol) == NULL, "key_seol = null"); ok(unibi_get_str(ut, unibi_key_sexit) == NULL, "key_sexit = null"); ok(unibi_get_str(ut, unibi_key_sfind) == NULL, "key_sfind = null"); ok(unibi_get_str(ut, unibi_key_shelp) == NULL, "key_shelp = null"); ok(unibi_get_str(ut, unibi_key_shome) == NULL, "key_shome = null"); ok(unibi_get_str(ut, unibi_key_sic) == NULL, "key_sic = null"); ok(unibi_get_str(ut, unibi_key_sleft) == NULL, "key_sleft = null"); ok(unibi_get_str(ut, unibi_key_smessage) == NULL, "key_smessage = null"); ok(unibi_get_str(ut, unibi_key_smove) == NULL, "key_smove = null"); ok(unibi_get_str(ut, unibi_key_snext) == NULL, "key_snext = null"); ok(unibi_get_str(ut, unibi_key_soptions) == NULL, "key_soptions = null"); ok(unibi_get_str(ut, unibi_key_sprevious) == NULL, "key_sprevious = null"); ok(unibi_get_str(ut, unibi_key_sprint) == NULL, "key_sprint = null"); ok(unibi_get_str(ut, unibi_key_sredo) == NULL, "key_sredo = null"); ok(unibi_get_str(ut, unibi_key_sreplace) == NULL, "key_sreplace = null"); ok(unibi_get_str(ut, unibi_key_sright) == NULL, "key_sright = null"); ok(unibi_get_str(ut, unibi_key_srsume) == NULL, "key_srsume = null"); ok(unibi_get_str(ut, unibi_key_ssave) == NULL, "key_ssave = null"); ok(unibi_get_str(ut, unibi_key_ssuspend) == NULL, "key_ssuspend = null"); ok(unibi_get_str(ut, unibi_key_sundo) == NULL, "key_sundo = null"); ok(unibi_get_str(ut, unibi_req_for_input) == NULL, "req_for_input = null"); ok(strcmp(unibi_get_str(ut, unibi_key_f11), "\033[23~") == 0, "key_f11 = \"%s\"", "\\033[23~"); unibi_set_str(dt, unibi_key_f11, "\033[23~"); ok(strcmp(unibi_get_str(ut, unibi_key_f12), "\033[24~") == 0, "key_f12 = \"%s\"", "\\033[24~"); unibi_set_str(dt, unibi_key_f12, "\033[24~"); ok(unibi_get_str(ut, unibi_key_f13) == NULL, "key_f13 = null"); ok(unibi_get_str(ut, unibi_key_f14) == NULL, "key_f14 = null"); ok(unibi_get_str(ut, unibi_key_f15) == NULL, "key_f15 = null"); ok(unibi_get_str(ut, unibi_key_f16) == NULL, "key_f16 = null"); ok(unibi_get_str(ut, unibi_key_f17) == NULL, "key_f17 = null"); ok(unibi_get_str(ut, unibi_key_f18) == NULL, "key_f18 = null"); ok(unibi_get_str(ut, unibi_key_f19) == NULL, "key_f19 = null"); ok(unibi_get_str(ut, unibi_key_f20) == NULL, "key_f20 = null"); ok(unibi_get_str(ut, unibi_key_f21) == NULL, "key_f21 = null"); ok(unibi_get_str(ut, unibi_key_f22) == NULL, "key_f22 = null"); ok(unibi_get_str(ut, unibi_key_f23) == NULL, "key_f23 = null"); ok(unibi_get_str(ut, unibi_key_f24) == NULL, "key_f24 = null"); ok(unibi_get_str(ut, unibi_key_f25) == NULL, "key_f25 = null"); ok(unibi_get_str(ut, unibi_key_f26) == NULL, "key_f26 = null"); ok(unibi_get_str(ut, unibi_key_f27) == NULL, "key_f27 = null"); ok(unibi_get_str(ut, unibi_key_f28) == NULL, "key_f28 = null"); ok(unibi_get_str(ut, unibi_key_f29) == NULL, "key_f29 = null"); ok(unibi_get_str(ut, unibi_key_f30) == NULL, "key_f30 = null"); ok(unibi_get_str(ut, unibi_key_f31) == NULL, "key_f31 = null"); ok(unibi_get_str(ut, unibi_key_f32) == NULL, "key_f32 = null"); ok(unibi_get_str(ut, unibi_key_f33) == NULL, "key_f33 = null"); ok(unibi_get_str(ut, unibi_key_f34) == NULL, "key_f34 = null"); ok(unibi_get_str(ut, unibi_key_f35) == NULL, "key_f35 = null"); ok(unibi_get_str(ut, unibi_key_f36) == NULL, "key_f36 = null"); ok(unibi_get_str(ut, unibi_key_f37) == NULL, "key_f37 = null"); ok(unibi_get_str(ut, unibi_key_f38) == NULL, "key_f38 = null"); ok(unibi_get_str(ut, unibi_key_f39) == NULL, "key_f39 = null"); ok(unibi_get_str(ut, unibi_key_f40) == NULL, "key_f40 = null"); ok(unibi_get_str(ut, unibi_key_f41) == NULL, "key_f41 = null"); ok(unibi_get_str(ut, unibi_key_f42) == NULL, "key_f42 = null"); ok(unibi_get_str(ut, unibi_key_f43) == NULL, "key_f43 = null"); ok(unibi_get_str(ut, unibi_key_f44) == NULL, "key_f44 = null"); ok(unibi_get_str(ut, unibi_key_f45) == NULL, "key_f45 = null"); ok(unibi_get_str(ut, unibi_key_f46) == NULL, "key_f46 = null"); ok(unibi_get_str(ut, unibi_key_f47) == NULL, "key_f47 = null"); ok(unibi_get_str(ut, unibi_key_f48) == NULL, "key_f48 = null"); ok(unibi_get_str(ut, unibi_key_f49) == NULL, "key_f49 = null"); ok(unibi_get_str(ut, unibi_key_f50) == NULL, "key_f50 = null"); ok(unibi_get_str(ut, unibi_key_f51) == NULL, "key_f51 = null"); ok(unibi_get_str(ut, unibi_key_f52) == NULL, "key_f52 = null"); ok(unibi_get_str(ut, unibi_key_f53) == NULL, "key_f53 = null"); ok(unibi_get_str(ut, unibi_key_f54) == NULL, "key_f54 = null"); ok(unibi_get_str(ut, unibi_key_f55) == NULL, "key_f55 = null"); ok(unibi_get_str(ut, unibi_key_f56) == NULL, "key_f56 = null"); ok(unibi_get_str(ut, unibi_key_f57) == NULL, "key_f57 = null"); ok(unibi_get_str(ut, unibi_key_f58) == NULL, "key_f58 = null"); ok(unibi_get_str(ut, unibi_key_f59) == NULL, "key_f59 = null"); ok(unibi_get_str(ut, unibi_key_f60) == NULL, "key_f60 = null"); ok(unibi_get_str(ut, unibi_key_f61) == NULL, "key_f61 = null"); ok(unibi_get_str(ut, unibi_key_f62) == NULL, "key_f62 = null"); ok(unibi_get_str(ut, unibi_key_f63) == NULL, "key_f63 = null"); ok(strcmp(unibi_get_str(ut, unibi_clr_bol), "\033[1K") == 0, "clr_bol = \"%s\"", "\\033[1K"); unibi_set_str(dt, unibi_clr_bol, "\033[1K"); ok(unibi_get_str(ut, unibi_clear_margins) == NULL, "clear_margins = null"); ok(unibi_get_str(ut, unibi_set_left_margin) == NULL, "set_left_margin = null"); ok(unibi_get_str(ut, unibi_set_right_margin) == NULL, "set_right_margin = null"); ok(unibi_get_str(ut, unibi_label_format) == NULL, "label_format = null"); ok(unibi_get_str(ut, unibi_set_clock) == NULL, "set_clock = null"); ok(unibi_get_str(ut, unibi_display_clock) == NULL, "display_clock = null"); ok(unibi_get_str(ut, unibi_remove_clock) == NULL, "remove_clock = null"); ok(unibi_get_str(ut, unibi_create_window) == NULL, "create_window = null"); ok(unibi_get_str(ut, unibi_goto_window) == NULL, "goto_window = null"); ok(unibi_get_str(ut, unibi_hangup) == NULL, "hangup = null"); ok(unibi_get_str(ut, unibi_dial_phone) == NULL, "dial_phone = null"); ok(unibi_get_str(ut, unibi_quick_dial) == NULL, "quick_dial = null"); ok(unibi_get_str(ut, unibi_tone) == NULL, "tone = null"); ok(unibi_get_str(ut, unibi_pulse) == NULL, "pulse = null"); ok(unibi_get_str(ut, unibi_flash_hook) == NULL, "flash_hook = null"); ok(unibi_get_str(ut, unibi_fixed_pause) == NULL, "fixed_pause = null"); ok(unibi_get_str(ut, unibi_wait_tone) == NULL, "wait_tone = null"); ok(unibi_get_str(ut, unibi_user0) == NULL, "user0 = null"); ok(unibi_get_str(ut, unibi_user1) == NULL, "user1 = null"); ok(unibi_get_str(ut, unibi_user2) == NULL, "user2 = null"); ok(unibi_get_str(ut, unibi_user3) == NULL, "user3 = null"); ok(unibi_get_str(ut, unibi_user4) == NULL, "user4 = null"); ok(unibi_get_str(ut, unibi_user5) == NULL, "user5 = null"); ok(unibi_get_str(ut, unibi_user6) == NULL, "user6 = null"); ok(unibi_get_str(ut, unibi_user7) == NULL, "user7 = null"); ok(unibi_get_str(ut, unibi_user8) == NULL, "user8 = null"); ok(unibi_get_str(ut, unibi_user9) == NULL, "user9 = null"); ok(strcmp(unibi_get_str(ut, unibi_orig_pair), "\033[39;49m") == 0, "orig_pair = \"%s\"", "\\033[39;49m"); unibi_set_str(dt, unibi_orig_pair, "\033[39;49m"); ok(unibi_get_str(ut, unibi_orig_colors) == NULL, "orig_colors = null"); ok(unibi_get_str(ut, unibi_initialize_color) == NULL, "initialize_color = null"); ok(unibi_get_str(ut, unibi_initialize_pair) == NULL, "initialize_pair = null"); ok(unibi_get_str(ut, unibi_set_color_pair) == NULL, "set_color_pair = null"); ok(unibi_get_str(ut, unibi_set_foreground) == NULL, "set_foreground = null"); ok(unibi_get_str(ut, unibi_set_background) == NULL, "set_background = null"); ok(unibi_get_str(ut, unibi_change_char_pitch) == NULL, "change_char_pitch = null"); ok(unibi_get_str(ut, unibi_change_line_pitch) == NULL, "change_line_pitch = null"); ok(unibi_get_str(ut, unibi_change_res_horz) == NULL, "change_res_horz = null"); ok(unibi_get_str(ut, unibi_change_res_vert) == NULL, "change_res_vert = null"); ok(unibi_get_str(ut, unibi_define_char) == NULL, "define_char = null"); ok(unibi_get_str(ut, unibi_enter_doublewide_mode) == NULL, "enter_doublewide_mode = null"); ok(unibi_get_str(ut, unibi_enter_draft_quality) == NULL, "enter_draft_quality = null"); ok(unibi_get_str(ut, unibi_enter_italics_mode) == NULL, "enter_italics_mode = null"); ok(unibi_get_str(ut, unibi_enter_leftward_mode) == NULL, "enter_leftward_mode = null"); ok(unibi_get_str(ut, unibi_enter_micro_mode) == NULL, "enter_micro_mode = null"); ok(unibi_get_str(ut, unibi_enter_near_letter_quality) == NULL, "enter_near_letter_quality = null"); ok(unibi_get_str(ut, unibi_enter_normal_quality) == NULL, "enter_normal_quality = null"); ok(unibi_get_str(ut, unibi_enter_shadow_mode) == NULL, "enter_shadow_mode = null"); ok(unibi_get_str(ut, unibi_enter_subscript_mode) == NULL, "enter_subscript_mode = null"); ok(unibi_get_str(ut, unibi_enter_superscript_mode) == NULL, "enter_superscript_mode = null"); ok(unibi_get_str(ut, unibi_enter_upward_mode) == NULL, "enter_upward_mode = null"); ok(unibi_get_str(ut, unibi_exit_doublewide_mode) == NULL, "exit_doublewide_mode = null"); ok(unibi_get_str(ut, unibi_exit_italics_mode) == NULL, "exit_italics_mode = null"); ok(unibi_get_str(ut, unibi_exit_leftward_mode) == NULL, "exit_leftward_mode = null"); ok(unibi_get_str(ut, unibi_exit_micro_mode) == NULL, "exit_micro_mode = null"); ok(unibi_get_str(ut, unibi_exit_shadow_mode) == NULL, "exit_shadow_mode = null"); ok(unibi_get_str(ut, unibi_exit_subscript_mode) == NULL, "exit_subscript_mode = null"); ok(unibi_get_str(ut, unibi_exit_superscript_mode) == NULL, "exit_superscript_mode = null"); ok(unibi_get_str(ut, unibi_exit_upward_mode) == NULL, "exit_upward_mode = null"); ok(unibi_get_str(ut, unibi_micro_column_address) == NULL, "micro_column_address = null"); ok(unibi_get_str(ut, unibi_micro_down) == NULL, "micro_down = null"); ok(unibi_get_str(ut, unibi_micro_left) == NULL, "micro_left = null"); ok(unibi_get_str(ut, unibi_micro_right) == NULL, "micro_right = null"); ok(unibi_get_str(ut, unibi_micro_row_address) == NULL, "micro_row_address = null"); ok(unibi_get_str(ut, unibi_micro_up) == NULL, "micro_up = null"); ok(unibi_get_str(ut, unibi_order_of_pins) == NULL, "order_of_pins = null"); ok(unibi_get_str(ut, unibi_parm_down_micro) == NULL, "parm_down_micro = null"); ok(unibi_get_str(ut, unibi_parm_left_micro) == NULL, "parm_left_micro = null"); ok(unibi_get_str(ut, unibi_parm_right_micro) == NULL, "parm_right_micro = null"); ok(unibi_get_str(ut, unibi_parm_up_micro) == NULL, "parm_up_micro = null"); ok(unibi_get_str(ut, unibi_select_char_set) == NULL, "select_char_set = null"); ok(unibi_get_str(ut, unibi_set_bottom_margin) == NULL, "set_bottom_margin = null"); ok(unibi_get_str(ut, unibi_set_bottom_margin_parm) == NULL, "set_bottom_margin_parm = null"); ok(unibi_get_str(ut, unibi_set_left_margin_parm) == NULL, "set_left_margin_parm = null"); ok(unibi_get_str(ut, unibi_set_right_margin_parm) == NULL, "set_right_margin_parm = null"); ok(unibi_get_str(ut, unibi_set_top_margin) == NULL, "set_top_margin = null"); ok(unibi_get_str(ut, unibi_set_top_margin_parm) == NULL, "set_top_margin_parm = null"); ok(unibi_get_str(ut, unibi_start_bit_image) == NULL, "start_bit_image = null"); ok(unibi_get_str(ut, unibi_start_char_set_def) == NULL, "start_char_set_def = null"); ok(unibi_get_str(ut, unibi_stop_bit_image) == NULL, "stop_bit_image = null"); ok(unibi_get_str(ut, unibi_stop_char_set_def) == NULL, "stop_char_set_def = null"); ok(unibi_get_str(ut, unibi_subscript_characters) == NULL, "subscript_characters = null"); ok(unibi_get_str(ut, unibi_superscript_characters) == NULL, "superscript_characters = null"); ok(unibi_get_str(ut, unibi_these_cause_cr) == NULL, "these_cause_cr = null"); ok(unibi_get_str(ut, unibi_zero_motion) == NULL, "zero_motion = null"); ok(unibi_get_str(ut, unibi_char_set_names) == NULL, "char_set_names = null"); ok(strcmp(unibi_get_str(ut, unibi_key_mouse), "\033[M") == 0, "key_mouse = \"%s\"", "\\033[M"); unibi_set_str(dt, unibi_key_mouse, "\033[M"); ok(unibi_get_str(ut, unibi_mouse_info) == NULL, "mouse_info = null"); ok(unibi_get_str(ut, unibi_req_mouse_pos) == NULL, "req_mouse_pos = null"); ok(unibi_get_str(ut, unibi_get_mouse) == NULL, "get_mouse = null"); ok(strcmp(unibi_get_str(ut, unibi_set_a_foreground), "\033[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m") == 0, "set_a_foreground = \"%s\"", "\\033[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m"); unibi_set_str(dt, unibi_set_a_foreground, "\033[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m"); ok(strcmp(unibi_get_str(ut, unibi_set_a_background), "\033[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m") == 0, "set_a_background = \"%s\"", "\\033[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m"); unibi_set_str(dt, unibi_set_a_background, "\033[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m"); ok(unibi_get_str(ut, unibi_pkey_plab) == NULL, "pkey_plab = null"); ok(unibi_get_str(ut, unibi_device_type) == NULL, "device_type = null"); ok(unibi_get_str(ut, unibi_code_set_init) == NULL, "code_set_init = null"); ok(unibi_get_str(ut, unibi_set0_des_seq) == NULL, "set0_des_seq = null"); ok(unibi_get_str(ut, unibi_set1_des_seq) == NULL, "set1_des_seq = null"); ok(unibi_get_str(ut, unibi_set2_des_seq) == NULL, "set2_des_seq = null"); ok(unibi_get_str(ut, unibi_set3_des_seq) == NULL, "set3_des_seq = null"); ok(unibi_get_str(ut, unibi_set_lr_margin) == NULL, "set_lr_margin = null"); ok(unibi_get_str(ut, unibi_set_tb_margin) == NULL, "set_tb_margin = null"); ok(unibi_get_str(ut, unibi_bit_image_repeat) == NULL, "bit_image_repeat = null"); ok(unibi_get_str(ut, unibi_bit_image_newline) == NULL, "bit_image_newline = null"); ok(unibi_get_str(ut, unibi_bit_image_carriage_return) == NULL, "bit_image_carriage_return = null"); ok(unibi_get_str(ut, unibi_color_names) == NULL, "color_names = null"); ok(unibi_get_str(ut, unibi_define_bit_image_region) == NULL, "define_bit_image_region = null"); ok(unibi_get_str(ut, unibi_end_bit_image_region) == NULL, "end_bit_image_region = null"); ok(unibi_get_str(ut, unibi_set_color_band) == NULL, "set_color_band = null"); ok(unibi_get_str(ut, unibi_set_page_length) == NULL, "set_page_length = null"); ok(unibi_get_str(ut, unibi_display_pc_char) == NULL, "display_pc_char = null"); ok(unibi_get_str(ut, unibi_enter_pc_charset_mode) == NULL, "enter_pc_charset_mode = null"); ok(unibi_get_str(ut, unibi_exit_pc_charset_mode) == NULL, "exit_pc_charset_mode = null"); ok(unibi_get_str(ut, unibi_enter_scancode_mode) == NULL, "enter_scancode_mode = null"); ok(unibi_get_str(ut, unibi_exit_scancode_mode) == NULL, "exit_scancode_mode = null"); ok(unibi_get_str(ut, unibi_pc_term_options) == NULL, "pc_term_options = null"); ok(unibi_get_str(ut, unibi_scancode_escape) == NULL, "scancode_escape = null"); ok(unibi_get_str(ut, unibi_alt_scancode_esc) == NULL, "alt_scancode_esc = null"); ok(unibi_get_str(ut, unibi_enter_horizontal_hl_mode) == NULL, "enter_horizontal_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_left_hl_mode) == NULL, "enter_left_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_low_hl_mode) == NULL, "enter_low_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_right_hl_mode) == NULL, "enter_right_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_top_hl_mode) == NULL, "enter_top_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_vertical_hl_mode) == NULL, "enter_vertical_hl_mode = null"); ok(unibi_get_str(ut, unibi_set_a_attributes) == NULL, "set_a_attributes = null"); ok(unibi_get_str(ut, unibi_set_pglen_inch) == NULL, "set_pglen_inch = null"); ok(unibi_get_str(ut, unibi_termcap_init2) == NULL, "termcap_init2 = null"); ok(unibi_get_str(ut, unibi_termcap_reset) == NULL, "termcap_reset = null"); ok(unibi_get_str(ut, unibi_linefeed_if_not_lf) == NULL, "linefeed_if_not_lf = null"); ok(unibi_get_str(ut, unibi_backspace_if_not_bs) == NULL, "backspace_if_not_bs = null"); ok(unibi_get_str(ut, unibi_other_non_function_keys) == NULL, "other_non_function_keys = null"); ok(unibi_get_str(ut, unibi_arrow_key_map) == NULL, "arrow_key_map = null"); ok(unibi_get_str(ut, unibi_acs_ulcorner) == NULL, "acs_ulcorner = null"); ok(unibi_get_str(ut, unibi_acs_llcorner) == NULL, "acs_llcorner = null"); ok(unibi_get_str(ut, unibi_acs_urcorner) == NULL, "acs_urcorner = null"); ok(unibi_get_str(ut, unibi_acs_lrcorner) == NULL, "acs_lrcorner = null"); ok(unibi_get_str(ut, unibi_acs_ltee) == NULL, "acs_ltee = null"); ok(unibi_get_str(ut, unibi_acs_rtee) == NULL, "acs_rtee = null"); ok(unibi_get_str(ut, unibi_acs_btee) == NULL, "acs_btee = null"); ok(unibi_get_str(ut, unibi_acs_ttee) == NULL, "acs_ttee = null"); ok(unibi_get_str(ut, unibi_acs_hline) == NULL, "acs_hline = null"); ok(unibi_get_str(ut, unibi_acs_vline) == NULL, "acs_vline = null"); ok(unibi_get_str(ut, unibi_acs_plus) == NULL, "acs_plus = null"); ok(unibi_get_str(ut, unibi_memory_lock) == NULL, "memory_lock = null"); ok(unibi_get_str(ut, unibi_memory_unlock) == NULL, "memory_unlock = null"); ok(unibi_get_str(ut, unibi_box_chars_1) == NULL, "box_chars_1 = null"); note("extended boolean capabilities"); { const size_t n_ext = unibi_count_ext_bool(ut); ok(n_ext == 3, "#ext_bool = 3"); ok(0 < n_ext && unibi_get_ext_bool(ut, 0) == 1, "ext_bool[0].value = 1"); ok(0 < n_ext && strcmp(unibi_get_ext_bool_name(ut, 0), "AX") == 0, "ext_bool[0].name = \"%s\"", "AX"); unibi_add_ext_bool(dt, "AX", 1); ok(1 < n_ext && unibi_get_ext_bool(ut, 1) == 1, "ext_bool[1].value = 1"); ok(1 < n_ext && strcmp(unibi_get_ext_bool_name(ut, 1), "G0") == 0, "ext_bool[1].name = \"%s\"", "G0"); unibi_add_ext_bool(dt, "G0", 1); ok(2 < n_ext && unibi_get_ext_bool(ut, 2) == 0, "ext_bool[2].value = 0"); ok(2 < n_ext && strcmp(unibi_get_ext_bool_name(ut, 2), "XT") == 0, "ext_bool[2].name = \"%s\"", "XT"); unibi_add_ext_bool(dt, "XT", 0); } note("extended numeric capabilities"); { const size_t n_ext = unibi_count_ext_num(ut); ok(n_ext == 1, "#ext_num = 1"); ok(0 < n_ext && unibi_get_ext_num(ut, 0) == 1, "ext_num[0].value = 1"); ok(0 < n_ext && strcmp(unibi_get_ext_num_name(ut, 0), "U8") == 0, "ext_num[0].name = \"%s\"", "U8"); unibi_add_ext_num(dt, "U8", 1); } note("extended string capabilities"); { const size_t n_ext = unibi_count_ext_str(ut); ok(n_ext == 24, "#ext_str = 24"); ok(0 < n_ext && strcmp(unibi_get_ext_str(ut, 0), "\033(B") == 0, "ext_str[0].value = \"%s\"", "\\033(B"); unibi_add_ext_str(dt, "E0", "\033(B"); ok(0 < n_ext && strcmp(unibi_get_ext_str_name(ut, 0), "E0") == 0, "ext_str[0].name = \"%s\"", "E0"); ok(1 < n_ext && strcmp(unibi_get_ext_str(ut, 1), "\033(%p1%c") == 0, "ext_str[1].value = \"%s\"", "\\033(%p1%c"); unibi_add_ext_str(dt, "S0", "\033(%p1%c"); ok(1 < n_ext && strcmp(unibi_get_ext_str_name(ut, 1), "S0") == 0, "ext_str[1].name = \"%s\"", "S0"); ok(2 < n_ext && unibi_get_ext_str(ut, 2) == NULL, "ext_str[2].value = null"); unibi_add_ext_str(dt, "kDC5", NULL); ok(2 < n_ext && strcmp(unibi_get_ext_str_name(ut, 2), "kDC5") == 0, "ext_str[2].name = \"%s\"", "kDC5"); ok(3 < n_ext && unibi_get_ext_str(ut, 3) == NULL, "ext_str[3].value = null"); unibi_add_ext_str(dt, "kDC6", NULL); ok(3 < n_ext && strcmp(unibi_get_ext_str_name(ut, 3), "kDC6") == 0, "ext_str[3].name = \"%s\"", "kDC6"); ok(4 < n_ext && unibi_get_ext_str(ut, 4) == NULL, "ext_str[4].value = null"); unibi_add_ext_str(dt, "kDN", NULL); ok(4 < n_ext && strcmp(unibi_get_ext_str_name(ut, 4), "kDN") == 0, "ext_str[4].name = \"%s\"", "kDN"); ok(5 < n_ext && unibi_get_ext_str(ut, 5) == NULL, "ext_str[5].value = null"); unibi_add_ext_str(dt, "kDN5", NULL); ok(5 < n_ext && strcmp(unibi_get_ext_str_name(ut, 5), "kDN5") == 0, "ext_str[5].name = \"%s\"", "kDN5"); ok(6 < n_ext && unibi_get_ext_str(ut, 6) == NULL, "ext_str[6].value = null"); unibi_add_ext_str(dt, "kEND5", NULL); ok(6 < n_ext && strcmp(unibi_get_ext_str_name(ut, 6), "kEND5") == 0, "ext_str[6].name = \"%s\"", "kEND5"); ok(7 < n_ext && unibi_get_ext_str(ut, 7) == NULL, "ext_str[7].value = null"); unibi_add_ext_str(dt, "kEND6", NULL); ok(7 < n_ext && strcmp(unibi_get_ext_str_name(ut, 7), "kEND6") == 0, "ext_str[7].name = \"%s\"", "kEND6"); ok(8 < n_ext && unibi_get_ext_str(ut, 8) == NULL, "ext_str[8].value = null"); unibi_add_ext_str(dt, "kHOM5", NULL); ok(8 < n_ext && strcmp(unibi_get_ext_str_name(ut, 8), "kHOM5") == 0, "ext_str[8].name = \"%s\"", "kHOM5"); ok(9 < n_ext && unibi_get_ext_str(ut, 9) == NULL, "ext_str[9].value = null"); unibi_add_ext_str(dt, "kHOM6", NULL); ok(9 < n_ext && strcmp(unibi_get_ext_str_name(ut, 9), "kHOM6") == 0, "ext_str[9].name = \"%s\"", "kHOM6"); ok(10 < n_ext && unibi_get_ext_str(ut, 10) == NULL, "ext_str[10].value = null"); unibi_add_ext_str(dt, "kIC5", NULL); ok(10 < n_ext && strcmp(unibi_get_ext_str_name(ut, 10), "kIC5") == 0, "ext_str[10].name = \"%s\"", "kIC5"); ok(11 < n_ext && unibi_get_ext_str(ut, 11) == NULL, "ext_str[11].value = null"); unibi_add_ext_str(dt, "kIC6", NULL); ok(11 < n_ext && strcmp(unibi_get_ext_str_name(ut, 11), "kIC6") == 0, "ext_str[11].name = \"%s\"", "kIC6"); ok(12 < n_ext && unibi_get_ext_str(ut, 12) == NULL, "ext_str[12].value = null"); unibi_add_ext_str(dt, "kLFT5", NULL); ok(12 < n_ext && strcmp(unibi_get_ext_str_name(ut, 12), "kLFT5") == 0, "ext_str[12].name = \"%s\"", "kLFT5"); ok(13 < n_ext && unibi_get_ext_str(ut, 13) == NULL, "ext_str[13].value = null"); unibi_add_ext_str(dt, "kNXT5", NULL); ok(13 < n_ext && strcmp(unibi_get_ext_str_name(ut, 13), "kNXT5") == 0, "ext_str[13].name = \"%s\"", "kNXT5"); ok(14 < n_ext && unibi_get_ext_str(ut, 14) == NULL, "ext_str[14].value = null"); unibi_add_ext_str(dt, "kNXT6", NULL); ok(14 < n_ext && strcmp(unibi_get_ext_str_name(ut, 14), "kNXT6") == 0, "ext_str[14].name = \"%s\"", "kNXT6"); ok(15 < n_ext && unibi_get_ext_str(ut, 15) == NULL, "ext_str[15].value = null"); unibi_add_ext_str(dt, "kPRV5", NULL); ok(15 < n_ext && strcmp(unibi_get_ext_str_name(ut, 15), "kPRV5") == 0, "ext_str[15].name = \"%s\"", "kPRV5"); ok(16 < n_ext && unibi_get_ext_str(ut, 16) == NULL, "ext_str[16].value = null"); unibi_add_ext_str(dt, "kPRV6", NULL); ok(16 < n_ext && strcmp(unibi_get_ext_str_name(ut, 16), "kPRV6") == 0, "ext_str[16].name = \"%s\"", "kPRV6"); ok(17 < n_ext && unibi_get_ext_str(ut, 17) == NULL, "ext_str[17].value = null"); unibi_add_ext_str(dt, "kRIT5", NULL); ok(17 < n_ext && strcmp(unibi_get_ext_str_name(ut, 17), "kRIT5") == 0, "ext_str[17].name = \"%s\"", "kRIT5"); ok(18 < n_ext && unibi_get_ext_str(ut, 18) == NULL, "ext_str[18].value = null"); unibi_add_ext_str(dt, "kUP", NULL); ok(18 < n_ext && strcmp(unibi_get_ext_str_name(ut, 18), "kUP") == 0, "ext_str[18].name = \"%s\"", "kUP"); ok(19 < n_ext && unibi_get_ext_str(ut, 19) == NULL, "ext_str[19].value = null"); unibi_add_ext_str(dt, "kUP5", NULL); ok(19 < n_ext && strcmp(unibi_get_ext_str_name(ut, 19), "kUP5") == 0, "ext_str[19].name = \"%s\"", "kUP5"); ok(20 < n_ext && unibi_get_ext_str(ut, 20) == NULL, "ext_str[20].value = null"); unibi_add_ext_str(dt, "ka2", NULL); ok(20 < n_ext && strcmp(unibi_get_ext_str_name(ut, 20), "ka2") == 0, "ext_str[20].name = \"%s\"", "ka2"); ok(21 < n_ext && unibi_get_ext_str(ut, 21) == NULL, "ext_str[21].value = null"); unibi_add_ext_str(dt, "kb1", NULL); ok(21 < n_ext && strcmp(unibi_get_ext_str_name(ut, 21), "kb1") == 0, "ext_str[21].name = \"%s\"", "kb1"); ok(22 < n_ext && unibi_get_ext_str(ut, 22) == NULL, "ext_str[22].value = null"); unibi_add_ext_str(dt, "kb3", NULL); ok(22 < n_ext && strcmp(unibi_get_ext_str_name(ut, 22), "kb3") == 0, "ext_str[22].name = \"%s\"", "kb3"); ok(23 < n_ext && unibi_get_ext_str(ut, 23) == NULL, "ext_str[23].value = null"); unibi_add_ext_str(dt, "kc2", NULL); ok(23 < n_ext && strcmp(unibi_get_ext_str_name(ut, 23), "kc2") == 0, "ext_str[23].name = \"%s\"", "kc2"); } { char buf[sizeof terminfo]; size_t r = unibi_dump(ut, buf, sizeof buf); ok(r == sizeof terminfo, "redump size == orig size"); ok(memcmp(terminfo, buf, sizeof buf) == 0, "redump == orig"); } { char buf[sizeof terminfo]; size_t r = unibi_dump(dt, buf, sizeof buf); ok(r == sizeof terminfo, "dummy redump size == orig size"); ok(memcmp(terminfo, buf, sizeof buf) == 0, "dummy redump == orig"); } unibi_destroy(ut); ok(1, "object destroyed"); unibi_destroy(dt); ok(1, "dummy object destroyed"); return 0; } static void setup(void) { plan(567); } unibilium-1.2.0/t/static_screen.c000066400000000000000000001613351256345053500167650ustar00rootroot00000000000000#include #include #include #include "test-simple.c.inc" const char terminfo[] = { 26, 1, 42, 0, 43, 0, 15, 0, 105, 1, 106, 2, 115, 99, 114, 101, 101, 110, 124, 86, 84, 32, 49, 48, 48, 47, 65, 78, 83, 73, 32, 88, 51, 46, 54, 52, 32, 118, 105, 114, 116, 117, 97, 108, 32, 116, 101, 114, 109, 105, 110, 97, 108, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 80, 0, 8, 0, 24, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 0, 64, 0, 0, 0, 4, 0, 6, 0, 8, 0, 25, 0, 30, 0, 37, 0, 41, 0, -1, -1, -1, -1, 45, 0, 62, 0, 64, 0, 68, 0, 75, 0, -1, -1, 77, 0, 89, 0, -1, -1, 93, 0, 96, 0, 102, 0, 106, 0, -1, -1, -1, -1, 110, 0, 112, 0, 117, 0, 122, 0, -1, -1, -1, -1, -125, 0, -1, -1, -1, -1, -120, 0, -115, 0, -110, 0, -1, -1, -105, 0, -103, 0, -98, 0, -1, -1, -89, 0, -84, 0, -78, 0, -72, 0, -1, -1, -1, -1, -1, -1, -69, 0, -1, -1, -1, -1, -1, -1, -65, 0, -1, -1, -61, 0, -1, -1, -1, -1, -1, -1, -59, 0, -1, -1, -54, 0, -1, -1, -1, -1, -1, -1, -1, -1, -50, 0, -46, 0, -40, 0, -36, 0, -32, 0, -28, 0, -22, 0, -16, 0, -10, 0, -4, 0, 2, 1, 7, 1, -1, -1, 12, 1, -1, -1, 16, 1, 21, 1, 26, 1, -1, -1, -1, -1, -1, -1, 30, 1, 34, 1, 42, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 50, 1, -1, -1, 53, 1, 62, 1, 71, 1, 80, 1, -1, -1, 89, 1, 98, 1, 107, 1, -1, -1, 116, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 125, 1, -1, -1, -1, -1, -114, 1, -1, -1, -111, 1, -108, 1, -106, 1, -103, 1, -30, 1, -1, -1, -27, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -25, 1, -1, -1, 40, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 56, 2, 62, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, 2, -1, -1, -1, -1, -1, -1, 86, 2, 96, 2, 27, 91, 90, 0, 7, 0, 13, 0, 27, 91, 37, 105, 37, 112, 49, 37, 100, 59, 37, 112, 50, 37, 100, 114, 0, 27, 91, 51, 103, 0, 27, 91, 72, 27, 91, 74, 0, 27, 91, 75, 0, 27, 91, 74, 0, 27, 91, 37, 105, 37, 112, 49, 37, 100, 59, 37, 112, 50, 37, 100, 72, 0, 10, 0, 27, 91, 72, 0, 27, 91, 63, 50, 53, 108, 0, 8, 0, 27, 91, 51, 52, 104, 27, 91, 63, 50, 53, 104, 0, 27, 91, 67, 0, 27, 77, 0, 27, 91, 51, 52, 108, 0, 27, 91, 80, 0, 27, 91, 77, 0, 14, 0, 27, 91, 53, 109, 0, 27, 91, 49, 109, 0, 27, 91, 63, 49, 48, 52, 57, 104, 0, 27, 91, 52, 104, 0, 27, 91, 55, 109, 0, 27, 91, 51, 109, 0, 27, 91, 52, 109, 0, 15, 0, 27, 91, 109, 15, 0, 27, 91, 63, 49, 48, 52, 57, 108, 0, 27, 91, 52, 108, 0, 27, 91, 50, 51, 109, 0, 27, 91, 50, 52, 109, 0, 27, 103, 0, 27, 41, 48, 0, 27, 91, 76, 0, 8, 0, 27, 91, 51, 126, 0, 27, 79, 66, 0, 27, 79, 80, 0, 27, 91, 50, 49, 126, 0, 27, 79, 81, 0, 27, 79, 82, 0, 27, 79, 83, 0, 27, 91, 49, 53, 126, 0, 27, 91, 49, 55, 126, 0, 27, 91, 49, 56, 126, 0, 27, 91, 49, 57, 126, 0, 27, 91, 50, 48, 126, 0, 27, 91, 49, 126, 0, 27, 91, 50, 126, 0, 27, 79, 68, 0, 27, 91, 54, 126, 0, 27, 91, 53, 126, 0, 27, 79, 67, 0, 27, 79, 65, 0, 27, 91, 63, 49, 108, 27, 62, 0, 27, 91, 63, 49, 104, 27, 61, 0, 27, 69, 0, 27, 91, 37, 112, 49, 37, 100, 80, 0, 27, 91, 37, 112, 49, 37, 100, 77, 0, 27, 91, 37, 112, 49, 37, 100, 66, 0, 27, 91, 37, 112, 49, 37, 100, 64, 0, 27, 91, 37, 112, 49, 37, 100, 76, 0, 27, 91, 37, 112, 49, 37, 100, 68, 0, 27, 91, 37, 112, 49, 37, 100, 67, 0, 27, 91, 37, 112, 49, 37, 100, 65, 0, 27, 99, 27, 91, 63, 49, 48, 48, 48, 108, 27, 91, 63, 50, 53, 104, 0, 27, 56, 0, 27, 55, 0, 10, 0, 27, 77, 0, 27, 91, 48, 37, 63, 37, 112, 54, 37, 116, 59, 49, 37, 59, 37, 63, 37, 112, 49, 37, 116, 59, 51, 37, 59, 37, 63, 37, 112, 50, 37, 116, 59, 52, 37, 59, 37, 63, 37, 112, 51, 37, 116, 59, 55, 37, 59, 37, 63, 37, 112, 52, 37, 116, 59, 53, 37, 59, 109, 37, 63, 37, 112, 57, 37, 116, 14, 37, 101, 15, 37, 59, 0, 27, 72, 0, 9, 0, 43, 43, 44, 44, 45, 45, 46, 46, 48, 48, 96, 96, 97, 97, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 0, 27, 91, 90, 0, 27, 40, 66, 27, 41, 48, 0, 27, 91, 52, 126, 0, 27, 91, 50, 51, 126, 0, 27, 91, 50, 52, 126, 0, 27, 91, 49, 75, 0, 27, 91, 51, 57, 59, 52, 57, 109, 0, 27, 91, 77, 0, 27, 91, 51, 37, 112, 49, 37, 100, 109, 0, 27, 91, 52, 37, 112, 49, 37, 100, 109, 0, 3, 0, 1, 0, 6, 0, 16, 0, 46, 0, 1, 1, 0, 0, 1, 0, 0, 0, 4, 0, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 3, 0, 6, 0, 9, 0, 12, 0, 15, 0, 18, 0, 22, 0, 26, 0, 30, 0, 27, 40, 66, 0, 27, 40, 37, 112, 49, 37, 99, 0, 65, 88, 0, 71, 48, 0, 88, 84, 0, 85, 56, 0, 69, 48, 0, 83, 48, 0, 107, 97, 50, 0, 107, 98, 49, 0, 107, 98, 51, 0, 107, 99, 50, 0 }; static void setup(void); int main(void) { int e; unibi_term *dt; setup(); dt = unibi_dummy(); e = errno; ok(dt != NULL, "dummy constructed"); if (!dt) { bail_out(strerror(e)); } unibi_term *ut = unibi_from_mem(terminfo, sizeof terminfo); e = errno; ok(ut != NULL, "terminfo loaded"); if (!ut) { bail_out(strerror(e)); } note("terminal name"); ok(strcmp(unibi_get_name(ut), "VT 100/ANSI X3.64 virtual terminal") == 0, "terminal name = \"%s\"", "VT 100/ANSI X3.64 virtual terminal"); unibi_set_name(dt, "VT 100/ANSI X3.64 virtual terminal"); { static const char *def_aliases[] = {"screen", NULL}; const char **aliases = unibi_get_aliases(ut); ok(strcmp(aliases[0], def_aliases[0]) == 0, "terminal alias #0 = \"%s\"", "screen"); ok(aliases[1] == NULL, "terminal alias #1 = null"); unibi_set_aliases(dt, def_aliases); } note("boolean capabilities"); ok(unibi_get_bool(ut, unibi_auto_left_margin) == 0, "auto_left_margin = false"); ok(unibi_get_bool(ut, unibi_auto_right_margin) == 1, "auto_right_margin = true"); unibi_set_bool(dt, unibi_auto_right_margin, 1); ok(unibi_get_bool(ut, unibi_no_esc_ctlc) == 0, "no_esc_ctlc = false"); ok(unibi_get_bool(ut, unibi_ceol_standout_glitch) == 0, "ceol_standout_glitch = false"); ok(unibi_get_bool(ut, unibi_eat_newline_glitch) == 1, "eat_newline_glitch = true"); unibi_set_bool(dt, unibi_eat_newline_glitch, 1); ok(unibi_get_bool(ut, unibi_erase_overstrike) == 0, "erase_overstrike = false"); ok(unibi_get_bool(ut, unibi_generic_type) == 0, "generic_type = false"); ok(unibi_get_bool(ut, unibi_hard_copy) == 0, "hard_copy = false"); ok(unibi_get_bool(ut, unibi_has_meta_key) == 1, "has_meta_key = true"); unibi_set_bool(dt, unibi_has_meta_key, 1); ok(unibi_get_bool(ut, unibi_has_status_line) == 0, "has_status_line = false"); ok(unibi_get_bool(ut, unibi_insert_null_glitch) == 0, "insert_null_glitch = false"); ok(unibi_get_bool(ut, unibi_memory_above) == 0, "memory_above = false"); ok(unibi_get_bool(ut, unibi_memory_below) == 0, "memory_below = false"); ok(unibi_get_bool(ut, unibi_move_insert_mode) == 1, "move_insert_mode = true"); unibi_set_bool(dt, unibi_move_insert_mode, 1); ok(unibi_get_bool(ut, unibi_move_standout_mode) == 1, "move_standout_mode = true"); unibi_set_bool(dt, unibi_move_standout_mode, 1); ok(unibi_get_bool(ut, unibi_over_strike) == 0, "over_strike = false"); ok(unibi_get_bool(ut, unibi_status_line_esc_ok) == 0, "status_line_esc_ok = false"); ok(unibi_get_bool(ut, unibi_dest_tabs_magic_smso) == 0, "dest_tabs_magic_smso = false"); ok(unibi_get_bool(ut, unibi_tilde_glitch) == 0, "tilde_glitch = false"); ok(unibi_get_bool(ut, unibi_transparent_underline) == 0, "transparent_underline = false"); ok(unibi_get_bool(ut, unibi_xon_xoff) == 0, "xon_xoff = false"); ok(unibi_get_bool(ut, unibi_needs_xon_xoff) == 0, "needs_xon_xoff = false"); ok(unibi_get_bool(ut, unibi_prtr_silent) == 0, "prtr_silent = false"); ok(unibi_get_bool(ut, unibi_hard_cursor) == 0, "hard_cursor = false"); ok(unibi_get_bool(ut, unibi_non_rev_rmcup) == 0, "non_rev_rmcup = false"); ok(unibi_get_bool(ut, unibi_no_pad_char) == 0, "no_pad_char = false"); ok(unibi_get_bool(ut, unibi_non_dest_scroll_region) == 0, "non_dest_scroll_region = false"); ok(unibi_get_bool(ut, unibi_can_change) == 0, "can_change = false"); ok(unibi_get_bool(ut, unibi_back_color_erase) == 0, "back_color_erase = false"); ok(unibi_get_bool(ut, unibi_hue_lightness_saturation) == 0, "hue_lightness_saturation = false"); ok(unibi_get_bool(ut, unibi_col_addr_glitch) == 0, "col_addr_glitch = false"); ok(unibi_get_bool(ut, unibi_cr_cancels_micro_mode) == 0, "cr_cancels_micro_mode = false"); ok(unibi_get_bool(ut, unibi_has_print_wheel) == 0, "has_print_wheel = false"); ok(unibi_get_bool(ut, unibi_row_addr_glitch) == 0, "row_addr_glitch = false"); ok(unibi_get_bool(ut, unibi_semi_auto_right_margin) == 0, "semi_auto_right_margin = false"); ok(unibi_get_bool(ut, unibi_cpi_changes_res) == 0, "cpi_changes_res = false"); ok(unibi_get_bool(ut, unibi_lpi_changes_res) == 0, "lpi_changes_res = false"); ok(unibi_get_bool(ut, unibi_backspaces_with_bs) == 1, "backspaces_with_bs = true"); unibi_set_bool(dt, unibi_backspaces_with_bs, 1); ok(unibi_get_bool(ut, unibi_crt_no_scrolling) == 0, "crt_no_scrolling = false"); ok(unibi_get_bool(ut, unibi_no_correctly_working_cr) == 0, "no_correctly_working_cr = false"); ok(unibi_get_bool(ut, unibi_gnu_has_meta_key) == 0, "gnu_has_meta_key = false"); ok(unibi_get_bool(ut, unibi_linefeed_is_newline) == 0, "linefeed_is_newline = false"); ok(unibi_get_bool(ut, unibi_has_hardware_tabs) == 1, "has_hardware_tabs = true"); unibi_set_bool(dt, unibi_has_hardware_tabs, 1); ok(unibi_get_bool(ut, unibi_return_does_clr_eol) == 0, "return_does_clr_eol = false"); note("numeric capabilities"); ok(unibi_get_num(ut, unibi_columns) == 80, "columns = 80"); unibi_set_num(dt, unibi_columns, 80); ok(unibi_get_num(ut, unibi_init_tabs) == 8, "init_tabs = 8"); unibi_set_num(dt, unibi_init_tabs, 8); ok(unibi_get_num(ut, unibi_lines) == 24, "lines = 24"); unibi_set_num(dt, unibi_lines, 24); ok(unibi_get_num(ut, unibi_lines_of_memory) == -1, "lines_of_memory = -1"); ok(unibi_get_num(ut, unibi_magic_cookie_glitch) == -1, "magic_cookie_glitch = -1"); ok(unibi_get_num(ut, unibi_padding_baud_rate) == -1, "padding_baud_rate = -1"); ok(unibi_get_num(ut, unibi_virtual_terminal) == -1, "virtual_terminal = -1"); ok(unibi_get_num(ut, unibi_width_status_line) == -1, "width_status_line = -1"); ok(unibi_get_num(ut, unibi_num_labels) == -1, "num_labels = -1"); ok(unibi_get_num(ut, unibi_label_height) == -1, "label_height = -1"); ok(unibi_get_num(ut, unibi_label_width) == -1, "label_width = -1"); ok(unibi_get_num(ut, unibi_max_attributes) == -1, "max_attributes = -1"); ok(unibi_get_num(ut, unibi_maximum_windows) == -1, "maximum_windows = -1"); ok(unibi_get_num(ut, unibi_max_colors) == 8, "max_colors = 8"); unibi_set_num(dt, unibi_max_colors, 8); ok(unibi_get_num(ut, unibi_max_pairs) == 64, "max_pairs = 64"); unibi_set_num(dt, unibi_max_pairs, 64); ok(unibi_get_num(ut, unibi_no_color_video) == -1, "no_color_video = -1"); ok(unibi_get_num(ut, unibi_buffer_capacity) == -1, "buffer_capacity = -1"); ok(unibi_get_num(ut, unibi_dot_vert_spacing) == -1, "dot_vert_spacing = -1"); ok(unibi_get_num(ut, unibi_dot_horz_spacing) == -1, "dot_horz_spacing = -1"); ok(unibi_get_num(ut, unibi_max_micro_address) == -1, "max_micro_address = -1"); ok(unibi_get_num(ut, unibi_max_micro_jump) == -1, "max_micro_jump = -1"); ok(unibi_get_num(ut, unibi_micro_col_size) == -1, "micro_col_size = -1"); ok(unibi_get_num(ut, unibi_micro_line_size) == -1, "micro_line_size = -1"); ok(unibi_get_num(ut, unibi_number_of_pins) == -1, "number_of_pins = -1"); ok(unibi_get_num(ut, unibi_output_res_char) == -1, "output_res_char = -1"); ok(unibi_get_num(ut, unibi_output_res_line) == -1, "output_res_line = -1"); ok(unibi_get_num(ut, unibi_output_res_horz_inch) == -1, "output_res_horz_inch = -1"); ok(unibi_get_num(ut, unibi_output_res_vert_inch) == -1, "output_res_vert_inch = -1"); ok(unibi_get_num(ut, unibi_print_rate) == -1, "print_rate = -1"); ok(unibi_get_num(ut, unibi_wide_char_size) == -1, "wide_char_size = -1"); ok(unibi_get_num(ut, unibi_buttons) == -1, "buttons = -1"); ok(unibi_get_num(ut, unibi_bit_image_entwining) == -1, "bit_image_entwining = -1"); ok(unibi_get_num(ut, unibi_bit_image_type) == -1, "bit_image_type = -1"); ok(unibi_get_num(ut, unibi_magic_cookie_glitch_ul) == -1, "magic_cookie_glitch_ul = -1"); ok(unibi_get_num(ut, unibi_carriage_return_delay) == -1, "carriage_return_delay = -1"); ok(unibi_get_num(ut, unibi_new_line_delay) == -1, "new_line_delay = -1"); ok(unibi_get_num(ut, unibi_backspace_delay) == -1, "backspace_delay = -1"); ok(unibi_get_num(ut, unibi_horizontal_tab_delay) == -1, "horizontal_tab_delay = -1"); ok(unibi_get_num(ut, unibi_number_of_function_keys) == -1, "number_of_function_keys = -1"); note("string capabilities"); ok(strcmp(unibi_get_str(ut, unibi_back_tab), "\033[Z") == 0, "back_tab = \"%s\"", "\\033[Z"); unibi_set_str(dt, unibi_back_tab, "\033[Z"); ok(strcmp(unibi_get_str(ut, unibi_bell), "\007") == 0, "bell = \"%s\"", "\\007"); unibi_set_str(dt, unibi_bell, "\007"); ok(strcmp(unibi_get_str(ut, unibi_carriage_return), "\015") == 0, "carriage_return = \"%s\"", "\\015"); unibi_set_str(dt, unibi_carriage_return, "\015"); ok(strcmp(unibi_get_str(ut, unibi_change_scroll_region), "\033[%i%p1%d;%p2%dr") == 0, "change_scroll_region = \"%s\"", "\\033[%i%p1%d;%p2%dr"); unibi_set_str(dt, unibi_change_scroll_region, "\033[%i%p1%d;%p2%dr"); ok(strcmp(unibi_get_str(ut, unibi_clear_all_tabs), "\033[3g") == 0, "clear_all_tabs = \"%s\"", "\\033[3g"); unibi_set_str(dt, unibi_clear_all_tabs, "\033[3g"); ok(strcmp(unibi_get_str(ut, unibi_clear_screen), "\033[H\033[J") == 0, "clear_screen = \"%s\"", "\\033[H\\033[J"); unibi_set_str(dt, unibi_clear_screen, "\033[H\033[J"); ok(strcmp(unibi_get_str(ut, unibi_clr_eol), "\033[K") == 0, "clr_eol = \"%s\"", "\\033[K"); unibi_set_str(dt, unibi_clr_eol, "\033[K"); ok(strcmp(unibi_get_str(ut, unibi_clr_eos), "\033[J") == 0, "clr_eos = \"%s\"", "\\033[J"); unibi_set_str(dt, unibi_clr_eos, "\033[J"); ok(unibi_get_str(ut, unibi_column_address) == NULL, "column_address = null"); ok(unibi_get_str(ut, unibi_command_character) == NULL, "command_character = null"); ok(strcmp(unibi_get_str(ut, unibi_cursor_address), "\033[%i%p1%d;%p2%dH") == 0, "cursor_address = \"%s\"", "\\033[%i%p1%d;%p2%dH"); unibi_set_str(dt, unibi_cursor_address, "\033[%i%p1%d;%p2%dH"); ok(strcmp(unibi_get_str(ut, unibi_cursor_down), "\012") == 0, "cursor_down = \"%s\"", "\\012"); unibi_set_str(dt, unibi_cursor_down, "\012"); ok(strcmp(unibi_get_str(ut, unibi_cursor_home), "\033[H") == 0, "cursor_home = \"%s\"", "\\033[H"); unibi_set_str(dt, unibi_cursor_home, "\033[H"); ok(strcmp(unibi_get_str(ut, unibi_cursor_invisible), "\033[?25l") == 0, "cursor_invisible = \"%s\"", "\\033[?25l"); unibi_set_str(dt, unibi_cursor_invisible, "\033[?25l"); ok(strcmp(unibi_get_str(ut, unibi_cursor_left), "\010") == 0, "cursor_left = \"%s\"", "\\010"); unibi_set_str(dt, unibi_cursor_left, "\010"); ok(unibi_get_str(ut, unibi_cursor_mem_address) == NULL, "cursor_mem_address = null"); ok(strcmp(unibi_get_str(ut, unibi_cursor_normal), "\033[34h\033[?25h") == 0, "cursor_normal = \"%s\"", "\\033[34h\\033[?25h"); unibi_set_str(dt, unibi_cursor_normal, "\033[34h\033[?25h"); ok(strcmp(unibi_get_str(ut, unibi_cursor_right), "\033[C") == 0, "cursor_right = \"%s\"", "\\033[C"); unibi_set_str(dt, unibi_cursor_right, "\033[C"); ok(unibi_get_str(ut, unibi_cursor_to_ll) == NULL, "cursor_to_ll = null"); ok(strcmp(unibi_get_str(ut, unibi_cursor_up), "\033M") == 0, "cursor_up = \"%s\"", "\\033M"); unibi_set_str(dt, unibi_cursor_up, "\033M"); ok(strcmp(unibi_get_str(ut, unibi_cursor_visible), "\033[34l") == 0, "cursor_visible = \"%s\"", "\\033[34l"); unibi_set_str(dt, unibi_cursor_visible, "\033[34l"); ok(strcmp(unibi_get_str(ut, unibi_delete_character), "\033[P") == 0, "delete_character = \"%s\"", "\\033[P"); unibi_set_str(dt, unibi_delete_character, "\033[P"); ok(strcmp(unibi_get_str(ut, unibi_delete_line), "\033[M") == 0, "delete_line = \"%s\"", "\\033[M"); unibi_set_str(dt, unibi_delete_line, "\033[M"); ok(unibi_get_str(ut, unibi_dis_status_line) == NULL, "dis_status_line = null"); ok(unibi_get_str(ut, unibi_down_half_line) == NULL, "down_half_line = null"); ok(strcmp(unibi_get_str(ut, unibi_enter_alt_charset_mode), "\016") == 0, "enter_alt_charset_mode = \"%s\"", "\\016"); unibi_set_str(dt, unibi_enter_alt_charset_mode, "\016"); ok(strcmp(unibi_get_str(ut, unibi_enter_blink_mode), "\033[5m") == 0, "enter_blink_mode = \"%s\"", "\\033[5m"); unibi_set_str(dt, unibi_enter_blink_mode, "\033[5m"); ok(strcmp(unibi_get_str(ut, unibi_enter_bold_mode), "\033[1m") == 0, "enter_bold_mode = \"%s\"", "\\033[1m"); unibi_set_str(dt, unibi_enter_bold_mode, "\033[1m"); ok(strcmp(unibi_get_str(ut, unibi_enter_ca_mode), "\033[?1049h") == 0, "enter_ca_mode = \"%s\"", "\\033[?1049h"); unibi_set_str(dt, unibi_enter_ca_mode, "\033[?1049h"); ok(unibi_get_str(ut, unibi_enter_delete_mode) == NULL, "enter_delete_mode = null"); ok(unibi_get_str(ut, unibi_enter_dim_mode) == NULL, "enter_dim_mode = null"); ok(strcmp(unibi_get_str(ut, unibi_enter_insert_mode), "\033[4h") == 0, "enter_insert_mode = \"%s\"", "\\033[4h"); unibi_set_str(dt, unibi_enter_insert_mode, "\033[4h"); ok(unibi_get_str(ut, unibi_enter_secure_mode) == NULL, "enter_secure_mode = null"); ok(unibi_get_str(ut, unibi_enter_protected_mode) == NULL, "enter_protected_mode = null"); ok(strcmp(unibi_get_str(ut, unibi_enter_reverse_mode), "\033[7m") == 0, "enter_reverse_mode = \"%s\"", "\\033[7m"); unibi_set_str(dt, unibi_enter_reverse_mode, "\033[7m"); ok(strcmp(unibi_get_str(ut, unibi_enter_standout_mode), "\033[3m") == 0, "enter_standout_mode = \"%s\"", "\\033[3m"); unibi_set_str(dt, unibi_enter_standout_mode, "\033[3m"); ok(strcmp(unibi_get_str(ut, unibi_enter_underline_mode), "\033[4m") == 0, "enter_underline_mode = \"%s\"", "\\033[4m"); unibi_set_str(dt, unibi_enter_underline_mode, "\033[4m"); ok(unibi_get_str(ut, unibi_erase_chars) == NULL, "erase_chars = null"); ok(strcmp(unibi_get_str(ut, unibi_exit_alt_charset_mode), "\017") == 0, "exit_alt_charset_mode = \"%s\"", "\\017"); unibi_set_str(dt, unibi_exit_alt_charset_mode, "\017"); ok(strcmp(unibi_get_str(ut, unibi_exit_attribute_mode), "\033[m\017") == 0, "exit_attribute_mode = \"%s\"", "\\033[m\\017"); unibi_set_str(dt, unibi_exit_attribute_mode, "\033[m\017"); ok(strcmp(unibi_get_str(ut, unibi_exit_ca_mode), "\033[?1049l") == 0, "exit_ca_mode = \"%s\"", "\\033[?1049l"); unibi_set_str(dt, unibi_exit_ca_mode, "\033[?1049l"); ok(unibi_get_str(ut, unibi_exit_delete_mode) == NULL, "exit_delete_mode = null"); ok(strcmp(unibi_get_str(ut, unibi_exit_insert_mode), "\033[4l") == 0, "exit_insert_mode = \"%s\"", "\\033[4l"); unibi_set_str(dt, unibi_exit_insert_mode, "\033[4l"); ok(strcmp(unibi_get_str(ut, unibi_exit_standout_mode), "\033[23m") == 0, "exit_standout_mode = \"%s\"", "\\033[23m"); unibi_set_str(dt, unibi_exit_standout_mode, "\033[23m"); ok(strcmp(unibi_get_str(ut, unibi_exit_underline_mode), "\033[24m") == 0, "exit_underline_mode = \"%s\"", "\\033[24m"); unibi_set_str(dt, unibi_exit_underline_mode, "\033[24m"); ok(strcmp(unibi_get_str(ut, unibi_flash_screen), "\033g") == 0, "flash_screen = \"%s\"", "\\033g"); unibi_set_str(dt, unibi_flash_screen, "\033g"); ok(unibi_get_str(ut, unibi_form_feed) == NULL, "form_feed = null"); ok(unibi_get_str(ut, unibi_from_status_line) == NULL, "from_status_line = null"); ok(unibi_get_str(ut, unibi_init_1string) == NULL, "init_1string = null"); ok(strcmp(unibi_get_str(ut, unibi_init_2string), "\033)0") == 0, "init_2string = \"%s\"", "\\033)0"); unibi_set_str(dt, unibi_init_2string, "\033)0"); ok(unibi_get_str(ut, unibi_init_3string) == NULL, "init_3string = null"); ok(unibi_get_str(ut, unibi_init_file) == NULL, "init_file = null"); ok(unibi_get_str(ut, unibi_insert_character) == NULL, "insert_character = null"); ok(strcmp(unibi_get_str(ut, unibi_insert_line), "\033[L") == 0, "insert_line = \"%s\"", "\\033[L"); unibi_set_str(dt, unibi_insert_line, "\033[L"); ok(unibi_get_str(ut, unibi_insert_padding) == NULL, "insert_padding = null"); ok(strcmp(unibi_get_str(ut, unibi_key_backspace), "\010") == 0, "key_backspace = \"%s\"", "\\010"); unibi_set_str(dt, unibi_key_backspace, "\010"); ok(unibi_get_str(ut, unibi_key_catab) == NULL, "key_catab = null"); ok(unibi_get_str(ut, unibi_key_clear) == NULL, "key_clear = null"); ok(unibi_get_str(ut, unibi_key_ctab) == NULL, "key_ctab = null"); ok(strcmp(unibi_get_str(ut, unibi_key_dc), "\033[3~") == 0, "key_dc = \"%s\"", "\\033[3~"); unibi_set_str(dt, unibi_key_dc, "\033[3~"); ok(unibi_get_str(ut, unibi_key_dl) == NULL, "key_dl = null"); ok(strcmp(unibi_get_str(ut, unibi_key_down), "\033OB") == 0, "key_down = \"%s\"", "\\033OB"); unibi_set_str(dt, unibi_key_down, "\033OB"); ok(unibi_get_str(ut, unibi_key_eic) == NULL, "key_eic = null"); ok(unibi_get_str(ut, unibi_key_eol) == NULL, "key_eol = null"); ok(unibi_get_str(ut, unibi_key_eos) == NULL, "key_eos = null"); ok(unibi_get_str(ut, unibi_key_f0) == NULL, "key_f0 = null"); ok(strcmp(unibi_get_str(ut, unibi_key_f1), "\033OP") == 0, "key_f1 = \"%s\"", "\\033OP"); unibi_set_str(dt, unibi_key_f1, "\033OP"); ok(strcmp(unibi_get_str(ut, unibi_key_f10), "\033[21~") == 0, "key_f10 = \"%s\"", "\\033[21~"); unibi_set_str(dt, unibi_key_f10, "\033[21~"); ok(strcmp(unibi_get_str(ut, unibi_key_f2), "\033OQ") == 0, "key_f2 = \"%s\"", "\\033OQ"); unibi_set_str(dt, unibi_key_f2, "\033OQ"); ok(strcmp(unibi_get_str(ut, unibi_key_f3), "\033OR") == 0, "key_f3 = \"%s\"", "\\033OR"); unibi_set_str(dt, unibi_key_f3, "\033OR"); ok(strcmp(unibi_get_str(ut, unibi_key_f4), "\033OS") == 0, "key_f4 = \"%s\"", "\\033OS"); unibi_set_str(dt, unibi_key_f4, "\033OS"); ok(strcmp(unibi_get_str(ut, unibi_key_f5), "\033[15~") == 0, "key_f5 = \"%s\"", "\\033[15~"); unibi_set_str(dt, unibi_key_f5, "\033[15~"); ok(strcmp(unibi_get_str(ut, unibi_key_f6), "\033[17~") == 0, "key_f6 = \"%s\"", "\\033[17~"); unibi_set_str(dt, unibi_key_f6, "\033[17~"); ok(strcmp(unibi_get_str(ut, unibi_key_f7), "\033[18~") == 0, "key_f7 = \"%s\"", "\\033[18~"); unibi_set_str(dt, unibi_key_f7, "\033[18~"); ok(strcmp(unibi_get_str(ut, unibi_key_f8), "\033[19~") == 0, "key_f8 = \"%s\"", "\\033[19~"); unibi_set_str(dt, unibi_key_f8, "\033[19~"); ok(strcmp(unibi_get_str(ut, unibi_key_f9), "\033[20~") == 0, "key_f9 = \"%s\"", "\\033[20~"); unibi_set_str(dt, unibi_key_f9, "\033[20~"); ok(strcmp(unibi_get_str(ut, unibi_key_home), "\033[1~") == 0, "key_home = \"%s\"", "\\033[1~"); unibi_set_str(dt, unibi_key_home, "\033[1~"); ok(strcmp(unibi_get_str(ut, unibi_key_ic), "\033[2~") == 0, "key_ic = \"%s\"", "\\033[2~"); unibi_set_str(dt, unibi_key_ic, "\033[2~"); ok(unibi_get_str(ut, unibi_key_il) == NULL, "key_il = null"); ok(strcmp(unibi_get_str(ut, unibi_key_left), "\033OD") == 0, "key_left = \"%s\"", "\\033OD"); unibi_set_str(dt, unibi_key_left, "\033OD"); ok(unibi_get_str(ut, unibi_key_ll) == NULL, "key_ll = null"); ok(strcmp(unibi_get_str(ut, unibi_key_npage), "\033[6~") == 0, "key_npage = \"%s\"", "\\033[6~"); unibi_set_str(dt, unibi_key_npage, "\033[6~"); ok(strcmp(unibi_get_str(ut, unibi_key_ppage), "\033[5~") == 0, "key_ppage = \"%s\"", "\\033[5~"); unibi_set_str(dt, unibi_key_ppage, "\033[5~"); ok(strcmp(unibi_get_str(ut, unibi_key_right), "\033OC") == 0, "key_right = \"%s\"", "\\033OC"); unibi_set_str(dt, unibi_key_right, "\033OC"); ok(unibi_get_str(ut, unibi_key_sf) == NULL, "key_sf = null"); ok(unibi_get_str(ut, unibi_key_sr) == NULL, "key_sr = null"); ok(unibi_get_str(ut, unibi_key_stab) == NULL, "key_stab = null"); ok(strcmp(unibi_get_str(ut, unibi_key_up), "\033OA") == 0, "key_up = \"%s\"", "\\033OA"); unibi_set_str(dt, unibi_key_up, "\033OA"); ok(strcmp(unibi_get_str(ut, unibi_keypad_local), "\033[?1l\033>") == 0, "keypad_local = \"%s\"", "\\033[?1l\\033>"); unibi_set_str(dt, unibi_keypad_local, "\033[?1l\033>"); ok(strcmp(unibi_get_str(ut, unibi_keypad_xmit), "\033[?1h\033=") == 0, "keypad_xmit = \"%s\"", "\\033[?1h\\033="); unibi_set_str(dt, unibi_keypad_xmit, "\033[?1h\033="); ok(unibi_get_str(ut, unibi_lab_f0) == NULL, "lab_f0 = null"); ok(unibi_get_str(ut, unibi_lab_f1) == NULL, "lab_f1 = null"); ok(unibi_get_str(ut, unibi_lab_f10) == NULL, "lab_f10 = null"); ok(unibi_get_str(ut, unibi_lab_f2) == NULL, "lab_f2 = null"); ok(unibi_get_str(ut, unibi_lab_f3) == NULL, "lab_f3 = null"); ok(unibi_get_str(ut, unibi_lab_f4) == NULL, "lab_f4 = null"); ok(unibi_get_str(ut, unibi_lab_f5) == NULL, "lab_f5 = null"); ok(unibi_get_str(ut, unibi_lab_f6) == NULL, "lab_f6 = null"); ok(unibi_get_str(ut, unibi_lab_f7) == NULL, "lab_f7 = null"); ok(unibi_get_str(ut, unibi_lab_f8) == NULL, "lab_f8 = null"); ok(unibi_get_str(ut, unibi_lab_f9) == NULL, "lab_f9 = null"); ok(unibi_get_str(ut, unibi_meta_off) == NULL, "meta_off = null"); ok(unibi_get_str(ut, unibi_meta_on) == NULL, "meta_on = null"); ok(strcmp(unibi_get_str(ut, unibi_newline), "\033E") == 0, "newline = \"%s\"", "\\033E"); unibi_set_str(dt, unibi_newline, "\033E"); ok(unibi_get_str(ut, unibi_pad_char) == NULL, "pad_char = null"); ok(strcmp(unibi_get_str(ut, unibi_parm_dch), "\033[%p1%dP") == 0, "parm_dch = \"%s\"", "\\033[%p1%dP"); unibi_set_str(dt, unibi_parm_dch, "\033[%p1%dP"); ok(strcmp(unibi_get_str(ut, unibi_parm_delete_line), "\033[%p1%dM") == 0, "parm_delete_line = \"%s\"", "\\033[%p1%dM"); unibi_set_str(dt, unibi_parm_delete_line, "\033[%p1%dM"); ok(strcmp(unibi_get_str(ut, unibi_parm_down_cursor), "\033[%p1%dB") == 0, "parm_down_cursor = \"%s\"", "\\033[%p1%dB"); unibi_set_str(dt, unibi_parm_down_cursor, "\033[%p1%dB"); ok(strcmp(unibi_get_str(ut, unibi_parm_ich), "\033[%p1%d@") == 0, "parm_ich = \"%s\"", "\\033[%p1%d@"); unibi_set_str(dt, unibi_parm_ich, "\033[%p1%d@"); ok(unibi_get_str(ut, unibi_parm_index) == NULL, "parm_index = null"); ok(strcmp(unibi_get_str(ut, unibi_parm_insert_line), "\033[%p1%dL") == 0, "parm_insert_line = \"%s\"", "\\033[%p1%dL"); unibi_set_str(dt, unibi_parm_insert_line, "\033[%p1%dL"); ok(strcmp(unibi_get_str(ut, unibi_parm_left_cursor), "\033[%p1%dD") == 0, "parm_left_cursor = \"%s\"", "\\033[%p1%dD"); unibi_set_str(dt, unibi_parm_left_cursor, "\033[%p1%dD"); ok(strcmp(unibi_get_str(ut, unibi_parm_right_cursor), "\033[%p1%dC") == 0, "parm_right_cursor = \"%s\"", "\\033[%p1%dC"); unibi_set_str(dt, unibi_parm_right_cursor, "\033[%p1%dC"); ok(unibi_get_str(ut, unibi_parm_rindex) == NULL, "parm_rindex = null"); ok(strcmp(unibi_get_str(ut, unibi_parm_up_cursor), "\033[%p1%dA") == 0, "parm_up_cursor = \"%s\"", "\\033[%p1%dA"); unibi_set_str(dt, unibi_parm_up_cursor, "\033[%p1%dA"); ok(unibi_get_str(ut, unibi_pkey_key) == NULL, "pkey_key = null"); ok(unibi_get_str(ut, unibi_pkey_local) == NULL, "pkey_local = null"); ok(unibi_get_str(ut, unibi_pkey_xmit) == NULL, "pkey_xmit = null"); ok(unibi_get_str(ut, unibi_print_screen) == NULL, "print_screen = null"); ok(unibi_get_str(ut, unibi_prtr_off) == NULL, "prtr_off = null"); ok(unibi_get_str(ut, unibi_prtr_on) == NULL, "prtr_on = null"); ok(unibi_get_str(ut, unibi_repeat_char) == NULL, "repeat_char = null"); ok(unibi_get_str(ut, unibi_reset_1string) == NULL, "reset_1string = null"); ok(strcmp(unibi_get_str(ut, unibi_reset_2string), "\033c\033[?1000l\033[?25h") == 0, "reset_2string = \"%s\"", "\\033c\\033[?1000l\\033[?25h"); unibi_set_str(dt, unibi_reset_2string, "\033c\033[?1000l\033[?25h"); ok(unibi_get_str(ut, unibi_reset_3string) == NULL, "reset_3string = null"); ok(unibi_get_str(ut, unibi_reset_file) == NULL, "reset_file = null"); ok(strcmp(unibi_get_str(ut, unibi_restore_cursor), "\0338") == 0, "restore_cursor = \"%s\"", "\\0338"); unibi_set_str(dt, unibi_restore_cursor, "\0338"); ok(unibi_get_str(ut, unibi_row_address) == NULL, "row_address = null"); ok(strcmp(unibi_get_str(ut, unibi_save_cursor), "\0337") == 0, "save_cursor = \"%s\"", "\\0337"); unibi_set_str(dt, unibi_save_cursor, "\0337"); ok(strcmp(unibi_get_str(ut, unibi_scroll_forward), "\012") == 0, "scroll_forward = \"%s\"", "\\012"); unibi_set_str(dt, unibi_scroll_forward, "\012"); ok(strcmp(unibi_get_str(ut, unibi_scroll_reverse), "\033M") == 0, "scroll_reverse = \"%s\"", "\\033M"); unibi_set_str(dt, unibi_scroll_reverse, "\033M"); ok(strcmp(unibi_get_str(ut, unibi_set_attributes), "\033[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;") == 0, "set_attributes = \"%s\"", "\\033[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\\016%e\\017%;"); unibi_set_str(dt, unibi_set_attributes, "\033[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;"); ok(strcmp(unibi_get_str(ut, unibi_set_tab), "\033H") == 0, "set_tab = \"%s\"", "\\033H"); unibi_set_str(dt, unibi_set_tab, "\033H"); ok(unibi_get_str(ut, unibi_set_window) == NULL, "set_window = null"); ok(strcmp(unibi_get_str(ut, unibi_tab), "\011") == 0, "tab = \"%s\"", "\\011"); unibi_set_str(dt, unibi_tab, "\011"); ok(unibi_get_str(ut, unibi_to_status_line) == NULL, "to_status_line = null"); ok(unibi_get_str(ut, unibi_underline_char) == NULL, "underline_char = null"); ok(unibi_get_str(ut, unibi_up_half_line) == NULL, "up_half_line = null"); ok(unibi_get_str(ut, unibi_init_prog) == NULL, "init_prog = null"); ok(unibi_get_str(ut, unibi_key_a1) == NULL, "key_a1 = null"); ok(unibi_get_str(ut, unibi_key_a3) == NULL, "key_a3 = null"); ok(unibi_get_str(ut, unibi_key_b2) == NULL, "key_b2 = null"); ok(unibi_get_str(ut, unibi_key_c1) == NULL, "key_c1 = null"); ok(unibi_get_str(ut, unibi_key_c3) == NULL, "key_c3 = null"); ok(unibi_get_str(ut, unibi_prtr_non) == NULL, "prtr_non = null"); ok(unibi_get_str(ut, unibi_char_padding) == NULL, "char_padding = null"); ok(strcmp(unibi_get_str(ut, unibi_acs_chars), "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~") == 0, "acs_chars = \"%s\"", "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"); unibi_set_str(dt, unibi_acs_chars, "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"); ok(unibi_get_str(ut, unibi_plab_norm) == NULL, "plab_norm = null"); ok(strcmp(unibi_get_str(ut, unibi_key_btab), "\033[Z") == 0, "key_btab = \"%s\"", "\\033[Z"); unibi_set_str(dt, unibi_key_btab, "\033[Z"); ok(unibi_get_str(ut, unibi_enter_xon_mode) == NULL, "enter_xon_mode = null"); ok(unibi_get_str(ut, unibi_exit_xon_mode) == NULL, "exit_xon_mode = null"); ok(unibi_get_str(ut, unibi_enter_am_mode) == NULL, "enter_am_mode = null"); ok(unibi_get_str(ut, unibi_exit_am_mode) == NULL, "exit_am_mode = null"); ok(unibi_get_str(ut, unibi_xon_character) == NULL, "xon_character = null"); ok(unibi_get_str(ut, unibi_xoff_character) == NULL, "xoff_character = null"); ok(strcmp(unibi_get_str(ut, unibi_ena_acs), "\033(B\033)0") == 0, "ena_acs = \"%s\"", "\\033(B\\033)0"); unibi_set_str(dt, unibi_ena_acs, "\033(B\033)0"); ok(unibi_get_str(ut, unibi_label_on) == NULL, "label_on = null"); ok(unibi_get_str(ut, unibi_label_off) == NULL, "label_off = null"); ok(unibi_get_str(ut, unibi_key_beg) == NULL, "key_beg = null"); ok(unibi_get_str(ut, unibi_key_cancel) == NULL, "key_cancel = null"); ok(unibi_get_str(ut, unibi_key_close) == NULL, "key_close = null"); ok(unibi_get_str(ut, unibi_key_command) == NULL, "key_command = null"); ok(unibi_get_str(ut, unibi_key_copy) == NULL, "key_copy = null"); ok(unibi_get_str(ut, unibi_key_create) == NULL, "key_create = null"); ok(strcmp(unibi_get_str(ut, unibi_key_end), "\033[4~") == 0, "key_end = \"%s\"", "\\033[4~"); unibi_set_str(dt, unibi_key_end, "\033[4~"); ok(unibi_get_str(ut, unibi_key_enter) == NULL, "key_enter = null"); ok(unibi_get_str(ut, unibi_key_exit) == NULL, "key_exit = null"); ok(unibi_get_str(ut, unibi_key_find) == NULL, "key_find = null"); ok(unibi_get_str(ut, unibi_key_help) == NULL, "key_help = null"); ok(unibi_get_str(ut, unibi_key_mark) == NULL, "key_mark = null"); ok(unibi_get_str(ut, unibi_key_message) == NULL, "key_message = null"); ok(unibi_get_str(ut, unibi_key_move) == NULL, "key_move = null"); ok(unibi_get_str(ut, unibi_key_next) == NULL, "key_next = null"); ok(unibi_get_str(ut, unibi_key_open) == NULL, "key_open = null"); ok(unibi_get_str(ut, unibi_key_options) == NULL, "key_options = null"); ok(unibi_get_str(ut, unibi_key_previous) == NULL, "key_previous = null"); ok(unibi_get_str(ut, unibi_key_print) == NULL, "key_print = null"); ok(unibi_get_str(ut, unibi_key_redo) == NULL, "key_redo = null"); ok(unibi_get_str(ut, unibi_key_reference) == NULL, "key_reference = null"); ok(unibi_get_str(ut, unibi_key_refresh) == NULL, "key_refresh = null"); ok(unibi_get_str(ut, unibi_key_replace) == NULL, "key_replace = null"); ok(unibi_get_str(ut, unibi_key_restart) == NULL, "key_restart = null"); ok(unibi_get_str(ut, unibi_key_resume) == NULL, "key_resume = null"); ok(unibi_get_str(ut, unibi_key_save) == NULL, "key_save = null"); ok(unibi_get_str(ut, unibi_key_suspend) == NULL, "key_suspend = null"); ok(unibi_get_str(ut, unibi_key_undo) == NULL, "key_undo = null"); ok(unibi_get_str(ut, unibi_key_sbeg) == NULL, "key_sbeg = null"); ok(unibi_get_str(ut, unibi_key_scancel) == NULL, "key_scancel = null"); ok(unibi_get_str(ut, unibi_key_scommand) == NULL, "key_scommand = null"); ok(unibi_get_str(ut, unibi_key_scopy) == NULL, "key_scopy = null"); ok(unibi_get_str(ut, unibi_key_screate) == NULL, "key_screate = null"); ok(unibi_get_str(ut, unibi_key_sdc) == NULL, "key_sdc = null"); ok(unibi_get_str(ut, unibi_key_sdl) == NULL, "key_sdl = null"); ok(unibi_get_str(ut, unibi_key_select) == NULL, "key_select = null"); ok(unibi_get_str(ut, unibi_key_send) == NULL, "key_send = null"); ok(unibi_get_str(ut, unibi_key_seol) == NULL, "key_seol = null"); ok(unibi_get_str(ut, unibi_key_sexit) == NULL, "key_sexit = null"); ok(unibi_get_str(ut, unibi_key_sfind) == NULL, "key_sfind = null"); ok(unibi_get_str(ut, unibi_key_shelp) == NULL, "key_shelp = null"); ok(unibi_get_str(ut, unibi_key_shome) == NULL, "key_shome = null"); ok(unibi_get_str(ut, unibi_key_sic) == NULL, "key_sic = null"); ok(unibi_get_str(ut, unibi_key_sleft) == NULL, "key_sleft = null"); ok(unibi_get_str(ut, unibi_key_smessage) == NULL, "key_smessage = null"); ok(unibi_get_str(ut, unibi_key_smove) == NULL, "key_smove = null"); ok(unibi_get_str(ut, unibi_key_snext) == NULL, "key_snext = null"); ok(unibi_get_str(ut, unibi_key_soptions) == NULL, "key_soptions = null"); ok(unibi_get_str(ut, unibi_key_sprevious) == NULL, "key_sprevious = null"); ok(unibi_get_str(ut, unibi_key_sprint) == NULL, "key_sprint = null"); ok(unibi_get_str(ut, unibi_key_sredo) == NULL, "key_sredo = null"); ok(unibi_get_str(ut, unibi_key_sreplace) == NULL, "key_sreplace = null"); ok(unibi_get_str(ut, unibi_key_sright) == NULL, "key_sright = null"); ok(unibi_get_str(ut, unibi_key_srsume) == NULL, "key_srsume = null"); ok(unibi_get_str(ut, unibi_key_ssave) == NULL, "key_ssave = null"); ok(unibi_get_str(ut, unibi_key_ssuspend) == NULL, "key_ssuspend = null"); ok(unibi_get_str(ut, unibi_key_sundo) == NULL, "key_sundo = null"); ok(unibi_get_str(ut, unibi_req_for_input) == NULL, "req_for_input = null"); ok(strcmp(unibi_get_str(ut, unibi_key_f11), "\033[23~") == 0, "key_f11 = \"%s\"", "\\033[23~"); unibi_set_str(dt, unibi_key_f11, "\033[23~"); ok(strcmp(unibi_get_str(ut, unibi_key_f12), "\033[24~") == 0, "key_f12 = \"%s\"", "\\033[24~"); unibi_set_str(dt, unibi_key_f12, "\033[24~"); ok(unibi_get_str(ut, unibi_key_f13) == NULL, "key_f13 = null"); ok(unibi_get_str(ut, unibi_key_f14) == NULL, "key_f14 = null"); ok(unibi_get_str(ut, unibi_key_f15) == NULL, "key_f15 = null"); ok(unibi_get_str(ut, unibi_key_f16) == NULL, "key_f16 = null"); ok(unibi_get_str(ut, unibi_key_f17) == NULL, "key_f17 = null"); ok(unibi_get_str(ut, unibi_key_f18) == NULL, "key_f18 = null"); ok(unibi_get_str(ut, unibi_key_f19) == NULL, "key_f19 = null"); ok(unibi_get_str(ut, unibi_key_f20) == NULL, "key_f20 = null"); ok(unibi_get_str(ut, unibi_key_f21) == NULL, "key_f21 = null"); ok(unibi_get_str(ut, unibi_key_f22) == NULL, "key_f22 = null"); ok(unibi_get_str(ut, unibi_key_f23) == NULL, "key_f23 = null"); ok(unibi_get_str(ut, unibi_key_f24) == NULL, "key_f24 = null"); ok(unibi_get_str(ut, unibi_key_f25) == NULL, "key_f25 = null"); ok(unibi_get_str(ut, unibi_key_f26) == NULL, "key_f26 = null"); ok(unibi_get_str(ut, unibi_key_f27) == NULL, "key_f27 = null"); ok(unibi_get_str(ut, unibi_key_f28) == NULL, "key_f28 = null"); ok(unibi_get_str(ut, unibi_key_f29) == NULL, "key_f29 = null"); ok(unibi_get_str(ut, unibi_key_f30) == NULL, "key_f30 = null"); ok(unibi_get_str(ut, unibi_key_f31) == NULL, "key_f31 = null"); ok(unibi_get_str(ut, unibi_key_f32) == NULL, "key_f32 = null"); ok(unibi_get_str(ut, unibi_key_f33) == NULL, "key_f33 = null"); ok(unibi_get_str(ut, unibi_key_f34) == NULL, "key_f34 = null"); ok(unibi_get_str(ut, unibi_key_f35) == NULL, "key_f35 = null"); ok(unibi_get_str(ut, unibi_key_f36) == NULL, "key_f36 = null"); ok(unibi_get_str(ut, unibi_key_f37) == NULL, "key_f37 = null"); ok(unibi_get_str(ut, unibi_key_f38) == NULL, "key_f38 = null"); ok(unibi_get_str(ut, unibi_key_f39) == NULL, "key_f39 = null"); ok(unibi_get_str(ut, unibi_key_f40) == NULL, "key_f40 = null"); ok(unibi_get_str(ut, unibi_key_f41) == NULL, "key_f41 = null"); ok(unibi_get_str(ut, unibi_key_f42) == NULL, "key_f42 = null"); ok(unibi_get_str(ut, unibi_key_f43) == NULL, "key_f43 = null"); ok(unibi_get_str(ut, unibi_key_f44) == NULL, "key_f44 = null"); ok(unibi_get_str(ut, unibi_key_f45) == NULL, "key_f45 = null"); ok(unibi_get_str(ut, unibi_key_f46) == NULL, "key_f46 = null"); ok(unibi_get_str(ut, unibi_key_f47) == NULL, "key_f47 = null"); ok(unibi_get_str(ut, unibi_key_f48) == NULL, "key_f48 = null"); ok(unibi_get_str(ut, unibi_key_f49) == NULL, "key_f49 = null"); ok(unibi_get_str(ut, unibi_key_f50) == NULL, "key_f50 = null"); ok(unibi_get_str(ut, unibi_key_f51) == NULL, "key_f51 = null"); ok(unibi_get_str(ut, unibi_key_f52) == NULL, "key_f52 = null"); ok(unibi_get_str(ut, unibi_key_f53) == NULL, "key_f53 = null"); ok(unibi_get_str(ut, unibi_key_f54) == NULL, "key_f54 = null"); ok(unibi_get_str(ut, unibi_key_f55) == NULL, "key_f55 = null"); ok(unibi_get_str(ut, unibi_key_f56) == NULL, "key_f56 = null"); ok(unibi_get_str(ut, unibi_key_f57) == NULL, "key_f57 = null"); ok(unibi_get_str(ut, unibi_key_f58) == NULL, "key_f58 = null"); ok(unibi_get_str(ut, unibi_key_f59) == NULL, "key_f59 = null"); ok(unibi_get_str(ut, unibi_key_f60) == NULL, "key_f60 = null"); ok(unibi_get_str(ut, unibi_key_f61) == NULL, "key_f61 = null"); ok(unibi_get_str(ut, unibi_key_f62) == NULL, "key_f62 = null"); ok(unibi_get_str(ut, unibi_key_f63) == NULL, "key_f63 = null"); ok(strcmp(unibi_get_str(ut, unibi_clr_bol), "\033[1K") == 0, "clr_bol = \"%s\"", "\\033[1K"); unibi_set_str(dt, unibi_clr_bol, "\033[1K"); ok(unibi_get_str(ut, unibi_clear_margins) == NULL, "clear_margins = null"); ok(unibi_get_str(ut, unibi_set_left_margin) == NULL, "set_left_margin = null"); ok(unibi_get_str(ut, unibi_set_right_margin) == NULL, "set_right_margin = null"); ok(unibi_get_str(ut, unibi_label_format) == NULL, "label_format = null"); ok(unibi_get_str(ut, unibi_set_clock) == NULL, "set_clock = null"); ok(unibi_get_str(ut, unibi_display_clock) == NULL, "display_clock = null"); ok(unibi_get_str(ut, unibi_remove_clock) == NULL, "remove_clock = null"); ok(unibi_get_str(ut, unibi_create_window) == NULL, "create_window = null"); ok(unibi_get_str(ut, unibi_goto_window) == NULL, "goto_window = null"); ok(unibi_get_str(ut, unibi_hangup) == NULL, "hangup = null"); ok(unibi_get_str(ut, unibi_dial_phone) == NULL, "dial_phone = null"); ok(unibi_get_str(ut, unibi_quick_dial) == NULL, "quick_dial = null"); ok(unibi_get_str(ut, unibi_tone) == NULL, "tone = null"); ok(unibi_get_str(ut, unibi_pulse) == NULL, "pulse = null"); ok(unibi_get_str(ut, unibi_flash_hook) == NULL, "flash_hook = null"); ok(unibi_get_str(ut, unibi_fixed_pause) == NULL, "fixed_pause = null"); ok(unibi_get_str(ut, unibi_wait_tone) == NULL, "wait_tone = null"); ok(unibi_get_str(ut, unibi_user0) == NULL, "user0 = null"); ok(unibi_get_str(ut, unibi_user1) == NULL, "user1 = null"); ok(unibi_get_str(ut, unibi_user2) == NULL, "user2 = null"); ok(unibi_get_str(ut, unibi_user3) == NULL, "user3 = null"); ok(unibi_get_str(ut, unibi_user4) == NULL, "user4 = null"); ok(unibi_get_str(ut, unibi_user5) == NULL, "user5 = null"); ok(unibi_get_str(ut, unibi_user6) == NULL, "user6 = null"); ok(unibi_get_str(ut, unibi_user7) == NULL, "user7 = null"); ok(unibi_get_str(ut, unibi_user8) == NULL, "user8 = null"); ok(unibi_get_str(ut, unibi_user9) == NULL, "user9 = null"); ok(strcmp(unibi_get_str(ut, unibi_orig_pair), "\033[39;49m") == 0, "orig_pair = \"%s\"", "\\033[39;49m"); unibi_set_str(dt, unibi_orig_pair, "\033[39;49m"); ok(unibi_get_str(ut, unibi_orig_colors) == NULL, "orig_colors = null"); ok(unibi_get_str(ut, unibi_initialize_color) == NULL, "initialize_color = null"); ok(unibi_get_str(ut, unibi_initialize_pair) == NULL, "initialize_pair = null"); ok(unibi_get_str(ut, unibi_set_color_pair) == NULL, "set_color_pair = null"); ok(unibi_get_str(ut, unibi_set_foreground) == NULL, "set_foreground = null"); ok(unibi_get_str(ut, unibi_set_background) == NULL, "set_background = null"); ok(unibi_get_str(ut, unibi_change_char_pitch) == NULL, "change_char_pitch = null"); ok(unibi_get_str(ut, unibi_change_line_pitch) == NULL, "change_line_pitch = null"); ok(unibi_get_str(ut, unibi_change_res_horz) == NULL, "change_res_horz = null"); ok(unibi_get_str(ut, unibi_change_res_vert) == NULL, "change_res_vert = null"); ok(unibi_get_str(ut, unibi_define_char) == NULL, "define_char = null"); ok(unibi_get_str(ut, unibi_enter_doublewide_mode) == NULL, "enter_doublewide_mode = null"); ok(unibi_get_str(ut, unibi_enter_draft_quality) == NULL, "enter_draft_quality = null"); ok(unibi_get_str(ut, unibi_enter_italics_mode) == NULL, "enter_italics_mode = null"); ok(unibi_get_str(ut, unibi_enter_leftward_mode) == NULL, "enter_leftward_mode = null"); ok(unibi_get_str(ut, unibi_enter_micro_mode) == NULL, "enter_micro_mode = null"); ok(unibi_get_str(ut, unibi_enter_near_letter_quality) == NULL, "enter_near_letter_quality = null"); ok(unibi_get_str(ut, unibi_enter_normal_quality) == NULL, "enter_normal_quality = null"); ok(unibi_get_str(ut, unibi_enter_shadow_mode) == NULL, "enter_shadow_mode = null"); ok(unibi_get_str(ut, unibi_enter_subscript_mode) == NULL, "enter_subscript_mode = null"); ok(unibi_get_str(ut, unibi_enter_superscript_mode) == NULL, "enter_superscript_mode = null"); ok(unibi_get_str(ut, unibi_enter_upward_mode) == NULL, "enter_upward_mode = null"); ok(unibi_get_str(ut, unibi_exit_doublewide_mode) == NULL, "exit_doublewide_mode = null"); ok(unibi_get_str(ut, unibi_exit_italics_mode) == NULL, "exit_italics_mode = null"); ok(unibi_get_str(ut, unibi_exit_leftward_mode) == NULL, "exit_leftward_mode = null"); ok(unibi_get_str(ut, unibi_exit_micro_mode) == NULL, "exit_micro_mode = null"); ok(unibi_get_str(ut, unibi_exit_shadow_mode) == NULL, "exit_shadow_mode = null"); ok(unibi_get_str(ut, unibi_exit_subscript_mode) == NULL, "exit_subscript_mode = null"); ok(unibi_get_str(ut, unibi_exit_superscript_mode) == NULL, "exit_superscript_mode = null"); ok(unibi_get_str(ut, unibi_exit_upward_mode) == NULL, "exit_upward_mode = null"); ok(unibi_get_str(ut, unibi_micro_column_address) == NULL, "micro_column_address = null"); ok(unibi_get_str(ut, unibi_micro_down) == NULL, "micro_down = null"); ok(unibi_get_str(ut, unibi_micro_left) == NULL, "micro_left = null"); ok(unibi_get_str(ut, unibi_micro_right) == NULL, "micro_right = null"); ok(unibi_get_str(ut, unibi_micro_row_address) == NULL, "micro_row_address = null"); ok(unibi_get_str(ut, unibi_micro_up) == NULL, "micro_up = null"); ok(unibi_get_str(ut, unibi_order_of_pins) == NULL, "order_of_pins = null"); ok(unibi_get_str(ut, unibi_parm_down_micro) == NULL, "parm_down_micro = null"); ok(unibi_get_str(ut, unibi_parm_left_micro) == NULL, "parm_left_micro = null"); ok(unibi_get_str(ut, unibi_parm_right_micro) == NULL, "parm_right_micro = null"); ok(unibi_get_str(ut, unibi_parm_up_micro) == NULL, "parm_up_micro = null"); ok(unibi_get_str(ut, unibi_select_char_set) == NULL, "select_char_set = null"); ok(unibi_get_str(ut, unibi_set_bottom_margin) == NULL, "set_bottom_margin = null"); ok(unibi_get_str(ut, unibi_set_bottom_margin_parm) == NULL, "set_bottom_margin_parm = null"); ok(unibi_get_str(ut, unibi_set_left_margin_parm) == NULL, "set_left_margin_parm = null"); ok(unibi_get_str(ut, unibi_set_right_margin_parm) == NULL, "set_right_margin_parm = null"); ok(unibi_get_str(ut, unibi_set_top_margin) == NULL, "set_top_margin = null"); ok(unibi_get_str(ut, unibi_set_top_margin_parm) == NULL, "set_top_margin_parm = null"); ok(unibi_get_str(ut, unibi_start_bit_image) == NULL, "start_bit_image = null"); ok(unibi_get_str(ut, unibi_start_char_set_def) == NULL, "start_char_set_def = null"); ok(unibi_get_str(ut, unibi_stop_bit_image) == NULL, "stop_bit_image = null"); ok(unibi_get_str(ut, unibi_stop_char_set_def) == NULL, "stop_char_set_def = null"); ok(unibi_get_str(ut, unibi_subscript_characters) == NULL, "subscript_characters = null"); ok(unibi_get_str(ut, unibi_superscript_characters) == NULL, "superscript_characters = null"); ok(unibi_get_str(ut, unibi_these_cause_cr) == NULL, "these_cause_cr = null"); ok(unibi_get_str(ut, unibi_zero_motion) == NULL, "zero_motion = null"); ok(unibi_get_str(ut, unibi_char_set_names) == NULL, "char_set_names = null"); ok(strcmp(unibi_get_str(ut, unibi_key_mouse), "\033[M") == 0, "key_mouse = \"%s\"", "\\033[M"); unibi_set_str(dt, unibi_key_mouse, "\033[M"); ok(unibi_get_str(ut, unibi_mouse_info) == NULL, "mouse_info = null"); ok(unibi_get_str(ut, unibi_req_mouse_pos) == NULL, "req_mouse_pos = null"); ok(unibi_get_str(ut, unibi_get_mouse) == NULL, "get_mouse = null"); ok(strcmp(unibi_get_str(ut, unibi_set_a_foreground), "\033[3%p1%dm") == 0, "set_a_foreground = \"%s\"", "\\033[3%p1%dm"); unibi_set_str(dt, unibi_set_a_foreground, "\033[3%p1%dm"); ok(strcmp(unibi_get_str(ut, unibi_set_a_background), "\033[4%p1%dm") == 0, "set_a_background = \"%s\"", "\\033[4%p1%dm"); unibi_set_str(dt, unibi_set_a_background, "\033[4%p1%dm"); ok(unibi_get_str(ut, unibi_pkey_plab) == NULL, "pkey_plab = null"); ok(unibi_get_str(ut, unibi_device_type) == NULL, "device_type = null"); ok(unibi_get_str(ut, unibi_code_set_init) == NULL, "code_set_init = null"); ok(unibi_get_str(ut, unibi_set0_des_seq) == NULL, "set0_des_seq = null"); ok(unibi_get_str(ut, unibi_set1_des_seq) == NULL, "set1_des_seq = null"); ok(unibi_get_str(ut, unibi_set2_des_seq) == NULL, "set2_des_seq = null"); ok(unibi_get_str(ut, unibi_set3_des_seq) == NULL, "set3_des_seq = null"); ok(unibi_get_str(ut, unibi_set_lr_margin) == NULL, "set_lr_margin = null"); ok(unibi_get_str(ut, unibi_set_tb_margin) == NULL, "set_tb_margin = null"); ok(unibi_get_str(ut, unibi_bit_image_repeat) == NULL, "bit_image_repeat = null"); ok(unibi_get_str(ut, unibi_bit_image_newline) == NULL, "bit_image_newline = null"); ok(unibi_get_str(ut, unibi_bit_image_carriage_return) == NULL, "bit_image_carriage_return = null"); ok(unibi_get_str(ut, unibi_color_names) == NULL, "color_names = null"); ok(unibi_get_str(ut, unibi_define_bit_image_region) == NULL, "define_bit_image_region = null"); ok(unibi_get_str(ut, unibi_end_bit_image_region) == NULL, "end_bit_image_region = null"); ok(unibi_get_str(ut, unibi_set_color_band) == NULL, "set_color_band = null"); ok(unibi_get_str(ut, unibi_set_page_length) == NULL, "set_page_length = null"); ok(unibi_get_str(ut, unibi_display_pc_char) == NULL, "display_pc_char = null"); ok(unibi_get_str(ut, unibi_enter_pc_charset_mode) == NULL, "enter_pc_charset_mode = null"); ok(unibi_get_str(ut, unibi_exit_pc_charset_mode) == NULL, "exit_pc_charset_mode = null"); ok(unibi_get_str(ut, unibi_enter_scancode_mode) == NULL, "enter_scancode_mode = null"); ok(unibi_get_str(ut, unibi_exit_scancode_mode) == NULL, "exit_scancode_mode = null"); ok(unibi_get_str(ut, unibi_pc_term_options) == NULL, "pc_term_options = null"); ok(unibi_get_str(ut, unibi_scancode_escape) == NULL, "scancode_escape = null"); ok(unibi_get_str(ut, unibi_alt_scancode_esc) == NULL, "alt_scancode_esc = null"); ok(unibi_get_str(ut, unibi_enter_horizontal_hl_mode) == NULL, "enter_horizontal_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_left_hl_mode) == NULL, "enter_left_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_low_hl_mode) == NULL, "enter_low_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_right_hl_mode) == NULL, "enter_right_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_top_hl_mode) == NULL, "enter_top_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_vertical_hl_mode) == NULL, "enter_vertical_hl_mode = null"); ok(unibi_get_str(ut, unibi_set_a_attributes) == NULL, "set_a_attributes = null"); ok(unibi_get_str(ut, unibi_set_pglen_inch) == NULL, "set_pglen_inch = null"); ok(unibi_get_str(ut, unibi_termcap_init2) == NULL, "termcap_init2 = null"); ok(unibi_get_str(ut, unibi_termcap_reset) == NULL, "termcap_reset = null"); ok(unibi_get_str(ut, unibi_linefeed_if_not_lf) == NULL, "linefeed_if_not_lf = null"); ok(unibi_get_str(ut, unibi_backspace_if_not_bs) == NULL, "backspace_if_not_bs = null"); ok(unibi_get_str(ut, unibi_other_non_function_keys) == NULL, "other_non_function_keys = null"); ok(unibi_get_str(ut, unibi_arrow_key_map) == NULL, "arrow_key_map = null"); ok(unibi_get_str(ut, unibi_acs_ulcorner) == NULL, "acs_ulcorner = null"); ok(unibi_get_str(ut, unibi_acs_llcorner) == NULL, "acs_llcorner = null"); ok(unibi_get_str(ut, unibi_acs_urcorner) == NULL, "acs_urcorner = null"); ok(unibi_get_str(ut, unibi_acs_lrcorner) == NULL, "acs_lrcorner = null"); ok(unibi_get_str(ut, unibi_acs_ltee) == NULL, "acs_ltee = null"); ok(unibi_get_str(ut, unibi_acs_rtee) == NULL, "acs_rtee = null"); ok(unibi_get_str(ut, unibi_acs_btee) == NULL, "acs_btee = null"); ok(unibi_get_str(ut, unibi_acs_ttee) == NULL, "acs_ttee = null"); ok(unibi_get_str(ut, unibi_acs_hline) == NULL, "acs_hline = null"); ok(unibi_get_str(ut, unibi_acs_vline) == NULL, "acs_vline = null"); ok(unibi_get_str(ut, unibi_acs_plus) == NULL, "acs_plus = null"); ok(unibi_get_str(ut, unibi_memory_lock) == NULL, "memory_lock = null"); ok(unibi_get_str(ut, unibi_memory_unlock) == NULL, "memory_unlock = null"); ok(unibi_get_str(ut, unibi_box_chars_1) == NULL, "box_chars_1 = null"); note("extended boolean capabilities"); { const size_t n_ext = unibi_count_ext_bool(ut); ok(n_ext == 3, "#ext_bool = 3"); ok(0 < n_ext && unibi_get_ext_bool(ut, 0) == 1, "ext_bool[0].value = 1"); ok(0 < n_ext && strcmp(unibi_get_ext_bool_name(ut, 0), "AX") == 0, "ext_bool[0].name = \"%s\"", "AX"); unibi_add_ext_bool(dt, "AX", 1); ok(1 < n_ext && unibi_get_ext_bool(ut, 1) == 1, "ext_bool[1].value = 1"); ok(1 < n_ext && strcmp(unibi_get_ext_bool_name(ut, 1), "G0") == 0, "ext_bool[1].name = \"%s\"", "G0"); unibi_add_ext_bool(dt, "G0", 1); ok(2 < n_ext && unibi_get_ext_bool(ut, 2) == 0, "ext_bool[2].value = 0"); ok(2 < n_ext && strcmp(unibi_get_ext_bool_name(ut, 2), "XT") == 0, "ext_bool[2].name = \"%s\"", "XT"); unibi_add_ext_bool(dt, "XT", 0); } note("extended numeric capabilities"); { const size_t n_ext = unibi_count_ext_num(ut); ok(n_ext == 1, "#ext_num = 1"); ok(0 < n_ext && unibi_get_ext_num(ut, 0) == 1, "ext_num[0].value = 1"); ok(0 < n_ext && strcmp(unibi_get_ext_num_name(ut, 0), "U8") == 0, "ext_num[0].name = \"%s\"", "U8"); unibi_add_ext_num(dt, "U8", 1); } note("extended string capabilities"); { const size_t n_ext = unibi_count_ext_str(ut); ok(n_ext == 6, "#ext_str = 6"); ok(0 < n_ext && strcmp(unibi_get_ext_str(ut, 0), "\033(B") == 0, "ext_str[0].value = \"%s\"", "\\033(B"); unibi_add_ext_str(dt, "E0", "\033(B"); ok(0 < n_ext && strcmp(unibi_get_ext_str_name(ut, 0), "E0") == 0, "ext_str[0].name = \"%s\"", "E0"); ok(1 < n_ext && strcmp(unibi_get_ext_str(ut, 1), "\033(%p1%c") == 0, "ext_str[1].value = \"%s\"", "\\033(%p1%c"); unibi_add_ext_str(dt, "S0", "\033(%p1%c"); ok(1 < n_ext && strcmp(unibi_get_ext_str_name(ut, 1), "S0") == 0, "ext_str[1].name = \"%s\"", "S0"); ok(2 < n_ext && unibi_get_ext_str(ut, 2) == NULL, "ext_str[2].value = null"); unibi_add_ext_str(dt, "ka2", NULL); ok(2 < n_ext && strcmp(unibi_get_ext_str_name(ut, 2), "ka2") == 0, "ext_str[2].name = \"%s\"", "ka2"); ok(3 < n_ext && unibi_get_ext_str(ut, 3) == NULL, "ext_str[3].value = null"); unibi_add_ext_str(dt, "kb1", NULL); ok(3 < n_ext && strcmp(unibi_get_ext_str_name(ut, 3), "kb1") == 0, "ext_str[3].name = \"%s\"", "kb1"); ok(4 < n_ext && unibi_get_ext_str(ut, 4) == NULL, "ext_str[4].value = null"); unibi_add_ext_str(dt, "kb3", NULL); ok(4 < n_ext && strcmp(unibi_get_ext_str_name(ut, 4), "kb3") == 0, "ext_str[4].name = \"%s\"", "kb3"); ok(5 < n_ext && unibi_get_ext_str(ut, 5) == NULL, "ext_str[5].value = null"); unibi_add_ext_str(dt, "kc2", NULL); ok(5 < n_ext && strcmp(unibi_get_ext_str_name(ut, 5), "kc2") == 0, "ext_str[5].name = \"%s\"", "kc2"); } { char buf[sizeof terminfo]; size_t r = unibi_dump(ut, buf, sizeof buf); ok(r == sizeof terminfo, "redump size == orig size"); ok(memcmp(terminfo, buf, sizeof buf) == 0, "redump == orig"); } { char buf[sizeof terminfo]; size_t r = unibi_dump(dt, buf, sizeof buf); ok(r == sizeof terminfo, "dummy redump size == orig size"); ok(memcmp(terminfo, buf, sizeof buf) == 0, "dummy redump == orig"); } unibi_destroy(ut); ok(1, "object destroyed"); unibi_destroy(dt); ok(1, "dummy object destroyed"); return 0; } static void setup(void) { plan(531); } unibilium-1.2.0/t/static_tmux.c000066400000000000000000001554461256345053500165110ustar00rootroot00000000000000#include #include #include #include "test-simple.c.inc" const char terminfo[] = { 26, 1, 56, 0, 15, 0, 15, 0, 105, 1, -48, 2, 116, 109, 117, 120, 124, 86, 84, 32, 49, 48, 48, 47, 65, 78, 83, 73, 32, 88, 51, 46, 54, 52, 32, 118, 105, 114, 116, 117, 97, 108, 32, 116, 101, 114, 109, 105, 110, 97, 108, 32, 119, 105, 116, 104, 32, 50, 53, 54, 32, 99, 111, 108, 111, 114, 115, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 80, 0, 8, 0, 24, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, -1, 127, 0, 0, 4, 0, 6, 0, 8, 0, 25, 0, 30, 0, 37, 0, 41, 0, -1, -1, -1, -1, 45, 0, 62, 0, 64, 0, 68, 0, 75, 0, -1, -1, 77, 0, 89, 0, -1, -1, 93, 0, 96, 0, 102, 0, 106, 0, -1, -1, -1, -1, 110, 0, 112, 0, 117, 0, 122, 0, -1, -1, -1, -1, 123, 0, -1, -1, -1, -1, -128, 0, -123, 0, -118, 0, -1, -1, -113, 0, -111, 0, -106, 0, -1, -1, -105, 0, -100, 0, -94, 0, -88, 0, -1, -1, -1, -1, -1, -1, -85, 0, -1, -1, -1, -1, -1, -1, -81, 0, -1, -1, -77, 0, -1, -1, -1, -1, -1, -1, -75, 0, -1, -1, -70, 0, -1, -1, -1, -1, -1, -1, -1, -1, -66, 0, -62, 0, -56, 0, -52, 0, -48, 0, -44, 0, -38, 0, -32, 0, -26, 0, -20, 0, -14, 0, -9, 0, -1, -1, -4, 0, -1, -1, 0, 1, 5, 1, 10, 1, -1, -1, -1, -1, -1, -1, 14, 1, 18, 1, 26, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, 1, -1, -1, 37, 1, 46, 1, 55, 1, 64, 1, -1, -1, 73, 1, 82, 1, 91, 1, -1, -1, 100, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 109, 1, -1, -1, -1, -1, 126, 1, -1, -1, -127, 1, -124, 1, -122, 1, -119, 1, -46, 1, -1, -1, -43, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -41, 1, -1, -1, 24, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 35, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 2, 46, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 57, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 66, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 77, 2, -1, -1, -1, -1, -1, -1, 81, 2, -112, 2, 27, 91, 90, 0, 7, 0, 13, 0, 27, 91, 37, 105, 37, 112, 49, 37, 100, 59, 37, 112, 50, 37, 100, 114, 0, 27, 91, 51, 103, 0, 27, 91, 72, 27, 91, 74, 0, 27, 91, 75, 0, 27, 91, 74, 0, 27, 91, 37, 105, 37, 112, 49, 37, 100, 59, 37, 112, 50, 37, 100, 72, 0, 10, 0, 27, 91, 72, 0, 27, 91, 63, 50, 53, 108, 0, 8, 0, 27, 91, 51, 52, 104, 27, 91, 63, 50, 53, 104, 0, 27, 91, 67, 0, 27, 77, 0, 27, 91, 51, 52, 108, 0, 27, 91, 80, 0, 27, 91, 77, 0, 14, 0, 27, 91, 53, 109, 0, 27, 91, 49, 109, 0, 0, 27, 91, 52, 104, 0, 27, 91, 55, 109, 0, 27, 91, 55, 109, 0, 27, 91, 52, 109, 0, 15, 0, 27, 91, 109, 15, 0, 0, 27, 91, 52, 108, 0, 27, 91, 50, 55, 109, 0, 27, 91, 50, 52, 109, 0, 27, 103, 0, 27, 41, 48, 0, 27, 91, 76, 0, 8, 0, 27, 91, 51, 126, 0, 27, 79, 66, 0, 27, 79, 80, 0, 27, 91, 50, 49, 126, 0, 27, 79, 81, 0, 27, 79, 82, 0, 27, 79, 83, 0, 27, 91, 49, 53, 126, 0, 27, 91, 49, 55, 126, 0, 27, 91, 49, 56, 126, 0, 27, 91, 49, 57, 126, 0, 27, 91, 50, 48, 126, 0, 27, 91, 49, 126, 0, 27, 91, 50, 126, 0, 27, 79, 68, 0, 27, 91, 54, 126, 0, 27, 91, 53, 126, 0, 27, 79, 67, 0, 27, 79, 65, 0, 27, 91, 63, 49, 108, 27, 62, 0, 27, 91, 63, 49, 104, 27, 61, 0, 27, 69, 0, 27, 91, 37, 112, 49, 37, 100, 80, 0, 27, 91, 37, 112, 49, 37, 100, 77, 0, 27, 91, 37, 112, 49, 37, 100, 66, 0, 27, 91, 37, 112, 49, 37, 100, 64, 0, 27, 91, 37, 112, 49, 37, 100, 76, 0, 27, 91, 37, 112, 49, 37, 100, 68, 0, 27, 91, 37, 112, 49, 37, 100, 67, 0, 27, 91, 37, 112, 49, 37, 100, 65, 0, 27, 99, 27, 91, 63, 49, 48, 48, 48, 108, 27, 91, 63, 50, 53, 104, 0, 27, 56, 0, 27, 55, 0, 10, 0, 27, 77, 0, 27, 91, 48, 37, 63, 37, 112, 54, 37, 116, 59, 49, 37, 59, 37, 63, 37, 112, 49, 37, 116, 59, 55, 37, 59, 37, 63, 37, 112, 50, 37, 116, 59, 52, 37, 59, 37, 63, 37, 112, 51, 37, 116, 59, 55, 37, 59, 37, 63, 37, 112, 52, 37, 116, 59, 53, 37, 59, 109, 37, 63, 37, 112, 57, 37, 116, 14, 37, 101, 15, 37, 59, 0, 27, 72, 0, 9, 0, 43, 43, 44, 44, 45, 45, 46, 46, 48, 48, 96, 96, 97, 97, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 0, 27, 91, 90, 0, 27, 40, 66, 27, 41, 48, 0, 27, 91, 52, 126, 0, 27, 91, 50, 51, 126, 0, 27, 91, 50, 52, 126, 0, 27, 91, 49, 75, 0, 27, 91, 51, 57, 59, 52, 57, 109, 0, 27, 91, 51, 109, 0, 27, 91, 50, 51, 109, 0, 27, 91, 77, 0, 27, 91, 37, 63, 37, 112, 49, 37, 123, 56, 125, 37, 60, 37, 116, 51, 37, 112, 49, 37, 100, 37, 101, 37, 112, 49, 37, 123, 49, 54, 125, 37, 60, 37, 116, 57, 37, 112, 49, 37, 123, 56, 125, 37, 45, 37, 100, 37, 101, 51, 56, 59, 53, 59, 37, 112, 49, 37, 100, 37, 59, 109, 0, 27, 91, 37, 63, 37, 112, 49, 37, 123, 56, 125, 37, 60, 37, 116, 52, 37, 112, 49, 37, 100, 37, 101, 37, 112, 49, 37, 123, 49, 54, 125, 37, 60, 37, 116, 49, 48, 37, 112, 49, 37, 123, 56, 125, 37, 45, 37, 100, 37, 101, 52, 56, 59, 53, 59, 37, 112, 49, 37, 100, 37, 59, 109, 0 }; static void setup(void); int main(void) { int e; unibi_term *dt; setup(); dt = unibi_dummy(); e = errno; ok(dt != NULL, "dummy constructed"); if (!dt) { bail_out(strerror(e)); } unibi_term *ut = unibi_from_mem(terminfo, sizeof terminfo); e = errno; ok(ut != NULL, "terminfo loaded"); if (!ut) { bail_out(strerror(e)); } note("terminal name"); ok(strcmp(unibi_get_name(ut), "VT 100/ANSI X3.64 virtual terminal with 256 colors") == 0, "terminal name = \"%s\"", "VT 100/ANSI X3.64 virtual terminal with 256 colors"); unibi_set_name(dt, "VT 100/ANSI X3.64 virtual terminal with 256 colors"); { static const char *def_aliases[] = {"tmux", NULL}; const char **aliases = unibi_get_aliases(ut); ok(strcmp(aliases[0], def_aliases[0]) == 0, "terminal alias #0 = \"%s\"", "tmux"); ok(aliases[1] == NULL, "terminal alias #1 = null"); unibi_set_aliases(dt, def_aliases); } note("boolean capabilities"); ok(unibi_get_bool(ut, unibi_auto_left_margin) == 0, "auto_left_margin = false"); ok(unibi_get_bool(ut, unibi_auto_right_margin) == 1, "auto_right_margin = true"); unibi_set_bool(dt, unibi_auto_right_margin, 1); ok(unibi_get_bool(ut, unibi_no_esc_ctlc) == 0, "no_esc_ctlc = false"); ok(unibi_get_bool(ut, unibi_ceol_standout_glitch) == 0, "ceol_standout_glitch = false"); ok(unibi_get_bool(ut, unibi_eat_newline_glitch) == 1, "eat_newline_glitch = true"); unibi_set_bool(dt, unibi_eat_newline_glitch, 1); ok(unibi_get_bool(ut, unibi_erase_overstrike) == 0, "erase_overstrike = false"); ok(unibi_get_bool(ut, unibi_generic_type) == 0, "generic_type = false"); ok(unibi_get_bool(ut, unibi_hard_copy) == 0, "hard_copy = false"); ok(unibi_get_bool(ut, unibi_has_meta_key) == 1, "has_meta_key = true"); unibi_set_bool(dt, unibi_has_meta_key, 1); ok(unibi_get_bool(ut, unibi_has_status_line) == 0, "has_status_line = false"); ok(unibi_get_bool(ut, unibi_insert_null_glitch) == 0, "insert_null_glitch = false"); ok(unibi_get_bool(ut, unibi_memory_above) == 0, "memory_above = false"); ok(unibi_get_bool(ut, unibi_memory_below) == 0, "memory_below = false"); ok(unibi_get_bool(ut, unibi_move_insert_mode) == 1, "move_insert_mode = true"); unibi_set_bool(dt, unibi_move_insert_mode, 1); ok(unibi_get_bool(ut, unibi_move_standout_mode) == 1, "move_standout_mode = true"); unibi_set_bool(dt, unibi_move_standout_mode, 1); ok(unibi_get_bool(ut, unibi_over_strike) == 0, "over_strike = false"); ok(unibi_get_bool(ut, unibi_status_line_esc_ok) == 0, "status_line_esc_ok = false"); ok(unibi_get_bool(ut, unibi_dest_tabs_magic_smso) == 0, "dest_tabs_magic_smso = false"); ok(unibi_get_bool(ut, unibi_tilde_glitch) == 0, "tilde_glitch = false"); ok(unibi_get_bool(ut, unibi_transparent_underline) == 0, "transparent_underline = false"); ok(unibi_get_bool(ut, unibi_xon_xoff) == 0, "xon_xoff = false"); ok(unibi_get_bool(ut, unibi_needs_xon_xoff) == 0, "needs_xon_xoff = false"); ok(unibi_get_bool(ut, unibi_prtr_silent) == 0, "prtr_silent = false"); ok(unibi_get_bool(ut, unibi_hard_cursor) == 0, "hard_cursor = false"); ok(unibi_get_bool(ut, unibi_non_rev_rmcup) == 0, "non_rev_rmcup = false"); ok(unibi_get_bool(ut, unibi_no_pad_char) == 0, "no_pad_char = false"); ok(unibi_get_bool(ut, unibi_non_dest_scroll_region) == 0, "non_dest_scroll_region = false"); ok(unibi_get_bool(ut, unibi_can_change) == 0, "can_change = false"); ok(unibi_get_bool(ut, unibi_back_color_erase) == 0, "back_color_erase = false"); ok(unibi_get_bool(ut, unibi_hue_lightness_saturation) == 0, "hue_lightness_saturation = false"); ok(unibi_get_bool(ut, unibi_col_addr_glitch) == 0, "col_addr_glitch = false"); ok(unibi_get_bool(ut, unibi_cr_cancels_micro_mode) == 0, "cr_cancels_micro_mode = false"); ok(unibi_get_bool(ut, unibi_has_print_wheel) == 0, "has_print_wheel = false"); ok(unibi_get_bool(ut, unibi_row_addr_glitch) == 0, "row_addr_glitch = false"); ok(unibi_get_bool(ut, unibi_semi_auto_right_margin) == 0, "semi_auto_right_margin = false"); ok(unibi_get_bool(ut, unibi_cpi_changes_res) == 0, "cpi_changes_res = false"); ok(unibi_get_bool(ut, unibi_lpi_changes_res) == 0, "lpi_changes_res = false"); ok(unibi_get_bool(ut, unibi_backspaces_with_bs) == 0, "backspaces_with_bs = false"); ok(unibi_get_bool(ut, unibi_crt_no_scrolling) == 0, "crt_no_scrolling = false"); ok(unibi_get_bool(ut, unibi_no_correctly_working_cr) == 0, "no_correctly_working_cr = false"); ok(unibi_get_bool(ut, unibi_gnu_has_meta_key) == 0, "gnu_has_meta_key = false"); ok(unibi_get_bool(ut, unibi_linefeed_is_newline) == 0, "linefeed_is_newline = false"); ok(unibi_get_bool(ut, unibi_has_hardware_tabs) == 0, "has_hardware_tabs = false"); ok(unibi_get_bool(ut, unibi_return_does_clr_eol) == 0, "return_does_clr_eol = false"); note("numeric capabilities"); ok(unibi_get_num(ut, unibi_columns) == 80, "columns = 80"); unibi_set_num(dt, unibi_columns, 80); ok(unibi_get_num(ut, unibi_init_tabs) == 8, "init_tabs = 8"); unibi_set_num(dt, unibi_init_tabs, 8); ok(unibi_get_num(ut, unibi_lines) == 24, "lines = 24"); unibi_set_num(dt, unibi_lines, 24); ok(unibi_get_num(ut, unibi_lines_of_memory) == -1, "lines_of_memory = -1"); ok(unibi_get_num(ut, unibi_magic_cookie_glitch) == -1, "magic_cookie_glitch = -1"); ok(unibi_get_num(ut, unibi_padding_baud_rate) == -1, "padding_baud_rate = -1"); ok(unibi_get_num(ut, unibi_virtual_terminal) == -1, "virtual_terminal = -1"); ok(unibi_get_num(ut, unibi_width_status_line) == -1, "width_status_line = -1"); ok(unibi_get_num(ut, unibi_num_labels) == -1, "num_labels = -1"); ok(unibi_get_num(ut, unibi_label_height) == -1, "label_height = -1"); ok(unibi_get_num(ut, unibi_label_width) == -1, "label_width = -1"); ok(unibi_get_num(ut, unibi_max_attributes) == -1, "max_attributes = -1"); ok(unibi_get_num(ut, unibi_maximum_windows) == -1, "maximum_windows = -1"); ok(unibi_get_num(ut, unibi_max_colors) == 256, "max_colors = 256"); unibi_set_num(dt, unibi_max_colors, 256); ok(unibi_get_num(ut, unibi_max_pairs) == 32767, "max_pairs = 32767"); unibi_set_num(dt, unibi_max_pairs, 32767); ok(unibi_get_num(ut, unibi_no_color_video) == -1, "no_color_video = -1"); ok(unibi_get_num(ut, unibi_buffer_capacity) == -1, "buffer_capacity = -1"); ok(unibi_get_num(ut, unibi_dot_vert_spacing) == -1, "dot_vert_spacing = -1"); ok(unibi_get_num(ut, unibi_dot_horz_spacing) == -1, "dot_horz_spacing = -1"); ok(unibi_get_num(ut, unibi_max_micro_address) == -1, "max_micro_address = -1"); ok(unibi_get_num(ut, unibi_max_micro_jump) == -1, "max_micro_jump = -1"); ok(unibi_get_num(ut, unibi_micro_col_size) == -1, "micro_col_size = -1"); ok(unibi_get_num(ut, unibi_micro_line_size) == -1, "micro_line_size = -1"); ok(unibi_get_num(ut, unibi_number_of_pins) == -1, "number_of_pins = -1"); ok(unibi_get_num(ut, unibi_output_res_char) == -1, "output_res_char = -1"); ok(unibi_get_num(ut, unibi_output_res_line) == -1, "output_res_line = -1"); ok(unibi_get_num(ut, unibi_output_res_horz_inch) == -1, "output_res_horz_inch = -1"); ok(unibi_get_num(ut, unibi_output_res_vert_inch) == -1, "output_res_vert_inch = -1"); ok(unibi_get_num(ut, unibi_print_rate) == -1, "print_rate = -1"); ok(unibi_get_num(ut, unibi_wide_char_size) == -1, "wide_char_size = -1"); ok(unibi_get_num(ut, unibi_buttons) == -1, "buttons = -1"); ok(unibi_get_num(ut, unibi_bit_image_entwining) == -1, "bit_image_entwining = -1"); ok(unibi_get_num(ut, unibi_bit_image_type) == -1, "bit_image_type = -1"); ok(unibi_get_num(ut, unibi_magic_cookie_glitch_ul) == -1, "magic_cookie_glitch_ul = -1"); ok(unibi_get_num(ut, unibi_carriage_return_delay) == -1, "carriage_return_delay = -1"); ok(unibi_get_num(ut, unibi_new_line_delay) == -1, "new_line_delay = -1"); ok(unibi_get_num(ut, unibi_backspace_delay) == -1, "backspace_delay = -1"); ok(unibi_get_num(ut, unibi_horizontal_tab_delay) == -1, "horizontal_tab_delay = -1"); ok(unibi_get_num(ut, unibi_number_of_function_keys) == -1, "number_of_function_keys = -1"); note("string capabilities"); ok(strcmp(unibi_get_str(ut, unibi_back_tab), "\033[Z") == 0, "back_tab = \"%s\"", "\\033[Z"); unibi_set_str(dt, unibi_back_tab, "\033[Z"); ok(strcmp(unibi_get_str(ut, unibi_bell), "\007") == 0, "bell = \"%s\"", "\\007"); unibi_set_str(dt, unibi_bell, "\007"); ok(strcmp(unibi_get_str(ut, unibi_carriage_return), "\015") == 0, "carriage_return = \"%s\"", "\\015"); unibi_set_str(dt, unibi_carriage_return, "\015"); ok(strcmp(unibi_get_str(ut, unibi_change_scroll_region), "\033[%i%p1%d;%p2%dr") == 0, "change_scroll_region = \"%s\"", "\\033[%i%p1%d;%p2%dr"); unibi_set_str(dt, unibi_change_scroll_region, "\033[%i%p1%d;%p2%dr"); ok(strcmp(unibi_get_str(ut, unibi_clear_all_tabs), "\033[3g") == 0, "clear_all_tabs = \"%s\"", "\\033[3g"); unibi_set_str(dt, unibi_clear_all_tabs, "\033[3g"); ok(strcmp(unibi_get_str(ut, unibi_clear_screen), "\033[H\033[J") == 0, "clear_screen = \"%s\"", "\\033[H\\033[J"); unibi_set_str(dt, unibi_clear_screen, "\033[H\033[J"); ok(strcmp(unibi_get_str(ut, unibi_clr_eol), "\033[K") == 0, "clr_eol = \"%s\"", "\\033[K"); unibi_set_str(dt, unibi_clr_eol, "\033[K"); ok(strcmp(unibi_get_str(ut, unibi_clr_eos), "\033[J") == 0, "clr_eos = \"%s\"", "\\033[J"); unibi_set_str(dt, unibi_clr_eos, "\033[J"); ok(unibi_get_str(ut, unibi_column_address) == NULL, "column_address = null"); ok(unibi_get_str(ut, unibi_command_character) == NULL, "command_character = null"); ok(strcmp(unibi_get_str(ut, unibi_cursor_address), "\033[%i%p1%d;%p2%dH") == 0, "cursor_address = \"%s\"", "\\033[%i%p1%d;%p2%dH"); unibi_set_str(dt, unibi_cursor_address, "\033[%i%p1%d;%p2%dH"); ok(strcmp(unibi_get_str(ut, unibi_cursor_down), "\012") == 0, "cursor_down = \"%s\"", "\\012"); unibi_set_str(dt, unibi_cursor_down, "\012"); ok(strcmp(unibi_get_str(ut, unibi_cursor_home), "\033[H") == 0, "cursor_home = \"%s\"", "\\033[H"); unibi_set_str(dt, unibi_cursor_home, "\033[H"); ok(strcmp(unibi_get_str(ut, unibi_cursor_invisible), "\033[?25l") == 0, "cursor_invisible = \"%s\"", "\\033[?25l"); unibi_set_str(dt, unibi_cursor_invisible, "\033[?25l"); ok(strcmp(unibi_get_str(ut, unibi_cursor_left), "\010") == 0, "cursor_left = \"%s\"", "\\010"); unibi_set_str(dt, unibi_cursor_left, "\010"); ok(unibi_get_str(ut, unibi_cursor_mem_address) == NULL, "cursor_mem_address = null"); ok(strcmp(unibi_get_str(ut, unibi_cursor_normal), "\033[34h\033[?25h") == 0, "cursor_normal = \"%s\"", "\\033[34h\\033[?25h"); unibi_set_str(dt, unibi_cursor_normal, "\033[34h\033[?25h"); ok(strcmp(unibi_get_str(ut, unibi_cursor_right), "\033[C") == 0, "cursor_right = \"%s\"", "\\033[C"); unibi_set_str(dt, unibi_cursor_right, "\033[C"); ok(unibi_get_str(ut, unibi_cursor_to_ll) == NULL, "cursor_to_ll = null"); ok(strcmp(unibi_get_str(ut, unibi_cursor_up), "\033M") == 0, "cursor_up = \"%s\"", "\\033M"); unibi_set_str(dt, unibi_cursor_up, "\033M"); ok(strcmp(unibi_get_str(ut, unibi_cursor_visible), "\033[34l") == 0, "cursor_visible = \"%s\"", "\\033[34l"); unibi_set_str(dt, unibi_cursor_visible, "\033[34l"); ok(strcmp(unibi_get_str(ut, unibi_delete_character), "\033[P") == 0, "delete_character = \"%s\"", "\\033[P"); unibi_set_str(dt, unibi_delete_character, "\033[P"); ok(strcmp(unibi_get_str(ut, unibi_delete_line), "\033[M") == 0, "delete_line = \"%s\"", "\\033[M"); unibi_set_str(dt, unibi_delete_line, "\033[M"); ok(unibi_get_str(ut, unibi_dis_status_line) == NULL, "dis_status_line = null"); ok(unibi_get_str(ut, unibi_down_half_line) == NULL, "down_half_line = null"); ok(strcmp(unibi_get_str(ut, unibi_enter_alt_charset_mode), "\016") == 0, "enter_alt_charset_mode = \"%s\"", "\\016"); unibi_set_str(dt, unibi_enter_alt_charset_mode, "\016"); ok(strcmp(unibi_get_str(ut, unibi_enter_blink_mode), "\033[5m") == 0, "enter_blink_mode = \"%s\"", "\\033[5m"); unibi_set_str(dt, unibi_enter_blink_mode, "\033[5m"); ok(strcmp(unibi_get_str(ut, unibi_enter_bold_mode), "\033[1m") == 0, "enter_bold_mode = \"%s\"", "\\033[1m"); unibi_set_str(dt, unibi_enter_bold_mode, "\033[1m"); ok(strcmp(unibi_get_str(ut, unibi_enter_ca_mode), "") == 0, "enter_ca_mode = \"%s\"", ""); unibi_set_str(dt, unibi_enter_ca_mode, ""); ok(unibi_get_str(ut, unibi_enter_delete_mode) == NULL, "enter_delete_mode = null"); ok(unibi_get_str(ut, unibi_enter_dim_mode) == NULL, "enter_dim_mode = null"); ok(strcmp(unibi_get_str(ut, unibi_enter_insert_mode), "\033[4h") == 0, "enter_insert_mode = \"%s\"", "\\033[4h"); unibi_set_str(dt, unibi_enter_insert_mode, "\033[4h"); ok(unibi_get_str(ut, unibi_enter_secure_mode) == NULL, "enter_secure_mode = null"); ok(unibi_get_str(ut, unibi_enter_protected_mode) == NULL, "enter_protected_mode = null"); ok(strcmp(unibi_get_str(ut, unibi_enter_reverse_mode), "\033[7m") == 0, "enter_reverse_mode = \"%s\"", "\\033[7m"); unibi_set_str(dt, unibi_enter_reverse_mode, "\033[7m"); ok(strcmp(unibi_get_str(ut, unibi_enter_standout_mode), "\033[7m") == 0, "enter_standout_mode = \"%s\"", "\\033[7m"); unibi_set_str(dt, unibi_enter_standout_mode, "\033[7m"); ok(strcmp(unibi_get_str(ut, unibi_enter_underline_mode), "\033[4m") == 0, "enter_underline_mode = \"%s\"", "\\033[4m"); unibi_set_str(dt, unibi_enter_underline_mode, "\033[4m"); ok(unibi_get_str(ut, unibi_erase_chars) == NULL, "erase_chars = null"); ok(strcmp(unibi_get_str(ut, unibi_exit_alt_charset_mode), "\017") == 0, "exit_alt_charset_mode = \"%s\"", "\\017"); unibi_set_str(dt, unibi_exit_alt_charset_mode, "\017"); ok(strcmp(unibi_get_str(ut, unibi_exit_attribute_mode), "\033[m\017") == 0, "exit_attribute_mode = \"%s\"", "\\033[m\\017"); unibi_set_str(dt, unibi_exit_attribute_mode, "\033[m\017"); ok(strcmp(unibi_get_str(ut, unibi_exit_ca_mode), "") == 0, "exit_ca_mode = \"%s\"", ""); unibi_set_str(dt, unibi_exit_ca_mode, ""); ok(unibi_get_str(ut, unibi_exit_delete_mode) == NULL, "exit_delete_mode = null"); ok(strcmp(unibi_get_str(ut, unibi_exit_insert_mode), "\033[4l") == 0, "exit_insert_mode = \"%s\"", "\\033[4l"); unibi_set_str(dt, unibi_exit_insert_mode, "\033[4l"); ok(strcmp(unibi_get_str(ut, unibi_exit_standout_mode), "\033[27m") == 0, "exit_standout_mode = \"%s\"", "\\033[27m"); unibi_set_str(dt, unibi_exit_standout_mode, "\033[27m"); ok(strcmp(unibi_get_str(ut, unibi_exit_underline_mode), "\033[24m") == 0, "exit_underline_mode = \"%s\"", "\\033[24m"); unibi_set_str(dt, unibi_exit_underline_mode, "\033[24m"); ok(strcmp(unibi_get_str(ut, unibi_flash_screen), "\033g") == 0, "flash_screen = \"%s\"", "\\033g"); unibi_set_str(dt, unibi_flash_screen, "\033g"); ok(unibi_get_str(ut, unibi_form_feed) == NULL, "form_feed = null"); ok(unibi_get_str(ut, unibi_from_status_line) == NULL, "from_status_line = null"); ok(unibi_get_str(ut, unibi_init_1string) == NULL, "init_1string = null"); ok(strcmp(unibi_get_str(ut, unibi_init_2string), "\033)0") == 0, "init_2string = \"%s\"", "\\033)0"); unibi_set_str(dt, unibi_init_2string, "\033)0"); ok(unibi_get_str(ut, unibi_init_3string) == NULL, "init_3string = null"); ok(unibi_get_str(ut, unibi_init_file) == NULL, "init_file = null"); ok(unibi_get_str(ut, unibi_insert_character) == NULL, "insert_character = null"); ok(strcmp(unibi_get_str(ut, unibi_insert_line), "\033[L") == 0, "insert_line = \"%s\"", "\\033[L"); unibi_set_str(dt, unibi_insert_line, "\033[L"); ok(unibi_get_str(ut, unibi_insert_padding) == NULL, "insert_padding = null"); ok(strcmp(unibi_get_str(ut, unibi_key_backspace), "\010") == 0, "key_backspace = \"%s\"", "\\010"); unibi_set_str(dt, unibi_key_backspace, "\010"); ok(unibi_get_str(ut, unibi_key_catab) == NULL, "key_catab = null"); ok(unibi_get_str(ut, unibi_key_clear) == NULL, "key_clear = null"); ok(unibi_get_str(ut, unibi_key_ctab) == NULL, "key_ctab = null"); ok(strcmp(unibi_get_str(ut, unibi_key_dc), "\033[3~") == 0, "key_dc = \"%s\"", "\\033[3~"); unibi_set_str(dt, unibi_key_dc, "\033[3~"); ok(unibi_get_str(ut, unibi_key_dl) == NULL, "key_dl = null"); ok(strcmp(unibi_get_str(ut, unibi_key_down), "\033OB") == 0, "key_down = \"%s\"", "\\033OB"); unibi_set_str(dt, unibi_key_down, "\033OB"); ok(unibi_get_str(ut, unibi_key_eic) == NULL, "key_eic = null"); ok(unibi_get_str(ut, unibi_key_eol) == NULL, "key_eol = null"); ok(unibi_get_str(ut, unibi_key_eos) == NULL, "key_eos = null"); ok(unibi_get_str(ut, unibi_key_f0) == NULL, "key_f0 = null"); ok(strcmp(unibi_get_str(ut, unibi_key_f1), "\033OP") == 0, "key_f1 = \"%s\"", "\\033OP"); unibi_set_str(dt, unibi_key_f1, "\033OP"); ok(strcmp(unibi_get_str(ut, unibi_key_f10), "\033[21~") == 0, "key_f10 = \"%s\"", "\\033[21~"); unibi_set_str(dt, unibi_key_f10, "\033[21~"); ok(strcmp(unibi_get_str(ut, unibi_key_f2), "\033OQ") == 0, "key_f2 = \"%s\"", "\\033OQ"); unibi_set_str(dt, unibi_key_f2, "\033OQ"); ok(strcmp(unibi_get_str(ut, unibi_key_f3), "\033OR") == 0, "key_f3 = \"%s\"", "\\033OR"); unibi_set_str(dt, unibi_key_f3, "\033OR"); ok(strcmp(unibi_get_str(ut, unibi_key_f4), "\033OS") == 0, "key_f4 = \"%s\"", "\\033OS"); unibi_set_str(dt, unibi_key_f4, "\033OS"); ok(strcmp(unibi_get_str(ut, unibi_key_f5), "\033[15~") == 0, "key_f5 = \"%s\"", "\\033[15~"); unibi_set_str(dt, unibi_key_f5, "\033[15~"); ok(strcmp(unibi_get_str(ut, unibi_key_f6), "\033[17~") == 0, "key_f6 = \"%s\"", "\\033[17~"); unibi_set_str(dt, unibi_key_f6, "\033[17~"); ok(strcmp(unibi_get_str(ut, unibi_key_f7), "\033[18~") == 0, "key_f7 = \"%s\"", "\\033[18~"); unibi_set_str(dt, unibi_key_f7, "\033[18~"); ok(strcmp(unibi_get_str(ut, unibi_key_f8), "\033[19~") == 0, "key_f8 = \"%s\"", "\\033[19~"); unibi_set_str(dt, unibi_key_f8, "\033[19~"); ok(strcmp(unibi_get_str(ut, unibi_key_f9), "\033[20~") == 0, "key_f9 = \"%s\"", "\\033[20~"); unibi_set_str(dt, unibi_key_f9, "\033[20~"); ok(strcmp(unibi_get_str(ut, unibi_key_home), "\033[1~") == 0, "key_home = \"%s\"", "\\033[1~"); unibi_set_str(dt, unibi_key_home, "\033[1~"); ok(strcmp(unibi_get_str(ut, unibi_key_ic), "\033[2~") == 0, "key_ic = \"%s\"", "\\033[2~"); unibi_set_str(dt, unibi_key_ic, "\033[2~"); ok(unibi_get_str(ut, unibi_key_il) == NULL, "key_il = null"); ok(strcmp(unibi_get_str(ut, unibi_key_left), "\033OD") == 0, "key_left = \"%s\"", "\\033OD"); unibi_set_str(dt, unibi_key_left, "\033OD"); ok(unibi_get_str(ut, unibi_key_ll) == NULL, "key_ll = null"); ok(strcmp(unibi_get_str(ut, unibi_key_npage), "\033[6~") == 0, "key_npage = \"%s\"", "\\033[6~"); unibi_set_str(dt, unibi_key_npage, "\033[6~"); ok(strcmp(unibi_get_str(ut, unibi_key_ppage), "\033[5~") == 0, "key_ppage = \"%s\"", "\\033[5~"); unibi_set_str(dt, unibi_key_ppage, "\033[5~"); ok(strcmp(unibi_get_str(ut, unibi_key_right), "\033OC") == 0, "key_right = \"%s\"", "\\033OC"); unibi_set_str(dt, unibi_key_right, "\033OC"); ok(unibi_get_str(ut, unibi_key_sf) == NULL, "key_sf = null"); ok(unibi_get_str(ut, unibi_key_sr) == NULL, "key_sr = null"); ok(unibi_get_str(ut, unibi_key_stab) == NULL, "key_stab = null"); ok(strcmp(unibi_get_str(ut, unibi_key_up), "\033OA") == 0, "key_up = \"%s\"", "\\033OA"); unibi_set_str(dt, unibi_key_up, "\033OA"); ok(strcmp(unibi_get_str(ut, unibi_keypad_local), "\033[?1l\033>") == 0, "keypad_local = \"%s\"", "\\033[?1l\\033>"); unibi_set_str(dt, unibi_keypad_local, "\033[?1l\033>"); ok(strcmp(unibi_get_str(ut, unibi_keypad_xmit), "\033[?1h\033=") == 0, "keypad_xmit = \"%s\"", "\\033[?1h\\033="); unibi_set_str(dt, unibi_keypad_xmit, "\033[?1h\033="); ok(unibi_get_str(ut, unibi_lab_f0) == NULL, "lab_f0 = null"); ok(unibi_get_str(ut, unibi_lab_f1) == NULL, "lab_f1 = null"); ok(unibi_get_str(ut, unibi_lab_f10) == NULL, "lab_f10 = null"); ok(unibi_get_str(ut, unibi_lab_f2) == NULL, "lab_f2 = null"); ok(unibi_get_str(ut, unibi_lab_f3) == NULL, "lab_f3 = null"); ok(unibi_get_str(ut, unibi_lab_f4) == NULL, "lab_f4 = null"); ok(unibi_get_str(ut, unibi_lab_f5) == NULL, "lab_f5 = null"); ok(unibi_get_str(ut, unibi_lab_f6) == NULL, "lab_f6 = null"); ok(unibi_get_str(ut, unibi_lab_f7) == NULL, "lab_f7 = null"); ok(unibi_get_str(ut, unibi_lab_f8) == NULL, "lab_f8 = null"); ok(unibi_get_str(ut, unibi_lab_f9) == NULL, "lab_f9 = null"); ok(unibi_get_str(ut, unibi_meta_off) == NULL, "meta_off = null"); ok(unibi_get_str(ut, unibi_meta_on) == NULL, "meta_on = null"); ok(strcmp(unibi_get_str(ut, unibi_newline), "\033E") == 0, "newline = \"%s\"", "\\033E"); unibi_set_str(dt, unibi_newline, "\033E"); ok(unibi_get_str(ut, unibi_pad_char) == NULL, "pad_char = null"); ok(strcmp(unibi_get_str(ut, unibi_parm_dch), "\033[%p1%dP") == 0, "parm_dch = \"%s\"", "\\033[%p1%dP"); unibi_set_str(dt, unibi_parm_dch, "\033[%p1%dP"); ok(strcmp(unibi_get_str(ut, unibi_parm_delete_line), "\033[%p1%dM") == 0, "parm_delete_line = \"%s\"", "\\033[%p1%dM"); unibi_set_str(dt, unibi_parm_delete_line, "\033[%p1%dM"); ok(strcmp(unibi_get_str(ut, unibi_parm_down_cursor), "\033[%p1%dB") == 0, "parm_down_cursor = \"%s\"", "\\033[%p1%dB"); unibi_set_str(dt, unibi_parm_down_cursor, "\033[%p1%dB"); ok(strcmp(unibi_get_str(ut, unibi_parm_ich), "\033[%p1%d@") == 0, "parm_ich = \"%s\"", "\\033[%p1%d@"); unibi_set_str(dt, unibi_parm_ich, "\033[%p1%d@"); ok(unibi_get_str(ut, unibi_parm_index) == NULL, "parm_index = null"); ok(strcmp(unibi_get_str(ut, unibi_parm_insert_line), "\033[%p1%dL") == 0, "parm_insert_line = \"%s\"", "\\033[%p1%dL"); unibi_set_str(dt, unibi_parm_insert_line, "\033[%p1%dL"); ok(strcmp(unibi_get_str(ut, unibi_parm_left_cursor), "\033[%p1%dD") == 0, "parm_left_cursor = \"%s\"", "\\033[%p1%dD"); unibi_set_str(dt, unibi_parm_left_cursor, "\033[%p1%dD"); ok(strcmp(unibi_get_str(ut, unibi_parm_right_cursor), "\033[%p1%dC") == 0, "parm_right_cursor = \"%s\"", "\\033[%p1%dC"); unibi_set_str(dt, unibi_parm_right_cursor, "\033[%p1%dC"); ok(unibi_get_str(ut, unibi_parm_rindex) == NULL, "parm_rindex = null"); ok(strcmp(unibi_get_str(ut, unibi_parm_up_cursor), "\033[%p1%dA") == 0, "parm_up_cursor = \"%s\"", "\\033[%p1%dA"); unibi_set_str(dt, unibi_parm_up_cursor, "\033[%p1%dA"); ok(unibi_get_str(ut, unibi_pkey_key) == NULL, "pkey_key = null"); ok(unibi_get_str(ut, unibi_pkey_local) == NULL, "pkey_local = null"); ok(unibi_get_str(ut, unibi_pkey_xmit) == NULL, "pkey_xmit = null"); ok(unibi_get_str(ut, unibi_print_screen) == NULL, "print_screen = null"); ok(unibi_get_str(ut, unibi_prtr_off) == NULL, "prtr_off = null"); ok(unibi_get_str(ut, unibi_prtr_on) == NULL, "prtr_on = null"); ok(unibi_get_str(ut, unibi_repeat_char) == NULL, "repeat_char = null"); ok(unibi_get_str(ut, unibi_reset_1string) == NULL, "reset_1string = null"); ok(strcmp(unibi_get_str(ut, unibi_reset_2string), "\033c\033[?1000l\033[?25h") == 0, "reset_2string = \"%s\"", "\\033c\\033[?1000l\\033[?25h"); unibi_set_str(dt, unibi_reset_2string, "\033c\033[?1000l\033[?25h"); ok(unibi_get_str(ut, unibi_reset_3string) == NULL, "reset_3string = null"); ok(unibi_get_str(ut, unibi_reset_file) == NULL, "reset_file = null"); ok(strcmp(unibi_get_str(ut, unibi_restore_cursor), "\0338") == 0, "restore_cursor = \"%s\"", "\\0338"); unibi_set_str(dt, unibi_restore_cursor, "\0338"); ok(unibi_get_str(ut, unibi_row_address) == NULL, "row_address = null"); ok(strcmp(unibi_get_str(ut, unibi_save_cursor), "\0337") == 0, "save_cursor = \"%s\"", "\\0337"); unibi_set_str(dt, unibi_save_cursor, "\0337"); ok(strcmp(unibi_get_str(ut, unibi_scroll_forward), "\012") == 0, "scroll_forward = \"%s\"", "\\012"); unibi_set_str(dt, unibi_scroll_forward, "\012"); ok(strcmp(unibi_get_str(ut, unibi_scroll_reverse), "\033M") == 0, "scroll_reverse = \"%s\"", "\\033M"); unibi_set_str(dt, unibi_scroll_reverse, "\033M"); ok(strcmp(unibi_get_str(ut, unibi_set_attributes), "\033[0%?%p6%t;1%;%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;") == 0, "set_attributes = \"%s\"", "\\033[0%?%p6%t;1%;%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\\016%e\\017%;"); unibi_set_str(dt, unibi_set_attributes, "\033[0%?%p6%t;1%;%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;"); ok(strcmp(unibi_get_str(ut, unibi_set_tab), "\033H") == 0, "set_tab = \"%s\"", "\\033H"); unibi_set_str(dt, unibi_set_tab, "\033H"); ok(unibi_get_str(ut, unibi_set_window) == NULL, "set_window = null"); ok(strcmp(unibi_get_str(ut, unibi_tab), "\011") == 0, "tab = \"%s\"", "\\011"); unibi_set_str(dt, unibi_tab, "\011"); ok(unibi_get_str(ut, unibi_to_status_line) == NULL, "to_status_line = null"); ok(unibi_get_str(ut, unibi_underline_char) == NULL, "underline_char = null"); ok(unibi_get_str(ut, unibi_up_half_line) == NULL, "up_half_line = null"); ok(unibi_get_str(ut, unibi_init_prog) == NULL, "init_prog = null"); ok(unibi_get_str(ut, unibi_key_a1) == NULL, "key_a1 = null"); ok(unibi_get_str(ut, unibi_key_a3) == NULL, "key_a3 = null"); ok(unibi_get_str(ut, unibi_key_b2) == NULL, "key_b2 = null"); ok(unibi_get_str(ut, unibi_key_c1) == NULL, "key_c1 = null"); ok(unibi_get_str(ut, unibi_key_c3) == NULL, "key_c3 = null"); ok(unibi_get_str(ut, unibi_prtr_non) == NULL, "prtr_non = null"); ok(unibi_get_str(ut, unibi_char_padding) == NULL, "char_padding = null"); ok(strcmp(unibi_get_str(ut, unibi_acs_chars), "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~") == 0, "acs_chars = \"%s\"", "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"); unibi_set_str(dt, unibi_acs_chars, "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"); ok(unibi_get_str(ut, unibi_plab_norm) == NULL, "plab_norm = null"); ok(strcmp(unibi_get_str(ut, unibi_key_btab), "\033[Z") == 0, "key_btab = \"%s\"", "\\033[Z"); unibi_set_str(dt, unibi_key_btab, "\033[Z"); ok(unibi_get_str(ut, unibi_enter_xon_mode) == NULL, "enter_xon_mode = null"); ok(unibi_get_str(ut, unibi_exit_xon_mode) == NULL, "exit_xon_mode = null"); ok(unibi_get_str(ut, unibi_enter_am_mode) == NULL, "enter_am_mode = null"); ok(unibi_get_str(ut, unibi_exit_am_mode) == NULL, "exit_am_mode = null"); ok(unibi_get_str(ut, unibi_xon_character) == NULL, "xon_character = null"); ok(unibi_get_str(ut, unibi_xoff_character) == NULL, "xoff_character = null"); ok(strcmp(unibi_get_str(ut, unibi_ena_acs), "\033(B\033)0") == 0, "ena_acs = \"%s\"", "\\033(B\\033)0"); unibi_set_str(dt, unibi_ena_acs, "\033(B\033)0"); ok(unibi_get_str(ut, unibi_label_on) == NULL, "label_on = null"); ok(unibi_get_str(ut, unibi_label_off) == NULL, "label_off = null"); ok(unibi_get_str(ut, unibi_key_beg) == NULL, "key_beg = null"); ok(unibi_get_str(ut, unibi_key_cancel) == NULL, "key_cancel = null"); ok(unibi_get_str(ut, unibi_key_close) == NULL, "key_close = null"); ok(unibi_get_str(ut, unibi_key_command) == NULL, "key_command = null"); ok(unibi_get_str(ut, unibi_key_copy) == NULL, "key_copy = null"); ok(unibi_get_str(ut, unibi_key_create) == NULL, "key_create = null"); ok(strcmp(unibi_get_str(ut, unibi_key_end), "\033[4~") == 0, "key_end = \"%s\"", "\\033[4~"); unibi_set_str(dt, unibi_key_end, "\033[4~"); ok(unibi_get_str(ut, unibi_key_enter) == NULL, "key_enter = null"); ok(unibi_get_str(ut, unibi_key_exit) == NULL, "key_exit = null"); ok(unibi_get_str(ut, unibi_key_find) == NULL, "key_find = null"); ok(unibi_get_str(ut, unibi_key_help) == NULL, "key_help = null"); ok(unibi_get_str(ut, unibi_key_mark) == NULL, "key_mark = null"); ok(unibi_get_str(ut, unibi_key_message) == NULL, "key_message = null"); ok(unibi_get_str(ut, unibi_key_move) == NULL, "key_move = null"); ok(unibi_get_str(ut, unibi_key_next) == NULL, "key_next = null"); ok(unibi_get_str(ut, unibi_key_open) == NULL, "key_open = null"); ok(unibi_get_str(ut, unibi_key_options) == NULL, "key_options = null"); ok(unibi_get_str(ut, unibi_key_previous) == NULL, "key_previous = null"); ok(unibi_get_str(ut, unibi_key_print) == NULL, "key_print = null"); ok(unibi_get_str(ut, unibi_key_redo) == NULL, "key_redo = null"); ok(unibi_get_str(ut, unibi_key_reference) == NULL, "key_reference = null"); ok(unibi_get_str(ut, unibi_key_refresh) == NULL, "key_refresh = null"); ok(unibi_get_str(ut, unibi_key_replace) == NULL, "key_replace = null"); ok(unibi_get_str(ut, unibi_key_restart) == NULL, "key_restart = null"); ok(unibi_get_str(ut, unibi_key_resume) == NULL, "key_resume = null"); ok(unibi_get_str(ut, unibi_key_save) == NULL, "key_save = null"); ok(unibi_get_str(ut, unibi_key_suspend) == NULL, "key_suspend = null"); ok(unibi_get_str(ut, unibi_key_undo) == NULL, "key_undo = null"); ok(unibi_get_str(ut, unibi_key_sbeg) == NULL, "key_sbeg = null"); ok(unibi_get_str(ut, unibi_key_scancel) == NULL, "key_scancel = null"); ok(unibi_get_str(ut, unibi_key_scommand) == NULL, "key_scommand = null"); ok(unibi_get_str(ut, unibi_key_scopy) == NULL, "key_scopy = null"); ok(unibi_get_str(ut, unibi_key_screate) == NULL, "key_screate = null"); ok(unibi_get_str(ut, unibi_key_sdc) == NULL, "key_sdc = null"); ok(unibi_get_str(ut, unibi_key_sdl) == NULL, "key_sdl = null"); ok(unibi_get_str(ut, unibi_key_select) == NULL, "key_select = null"); ok(unibi_get_str(ut, unibi_key_send) == NULL, "key_send = null"); ok(unibi_get_str(ut, unibi_key_seol) == NULL, "key_seol = null"); ok(unibi_get_str(ut, unibi_key_sexit) == NULL, "key_sexit = null"); ok(unibi_get_str(ut, unibi_key_sfind) == NULL, "key_sfind = null"); ok(unibi_get_str(ut, unibi_key_shelp) == NULL, "key_shelp = null"); ok(unibi_get_str(ut, unibi_key_shome) == NULL, "key_shome = null"); ok(unibi_get_str(ut, unibi_key_sic) == NULL, "key_sic = null"); ok(unibi_get_str(ut, unibi_key_sleft) == NULL, "key_sleft = null"); ok(unibi_get_str(ut, unibi_key_smessage) == NULL, "key_smessage = null"); ok(unibi_get_str(ut, unibi_key_smove) == NULL, "key_smove = null"); ok(unibi_get_str(ut, unibi_key_snext) == NULL, "key_snext = null"); ok(unibi_get_str(ut, unibi_key_soptions) == NULL, "key_soptions = null"); ok(unibi_get_str(ut, unibi_key_sprevious) == NULL, "key_sprevious = null"); ok(unibi_get_str(ut, unibi_key_sprint) == NULL, "key_sprint = null"); ok(unibi_get_str(ut, unibi_key_sredo) == NULL, "key_sredo = null"); ok(unibi_get_str(ut, unibi_key_sreplace) == NULL, "key_sreplace = null"); ok(unibi_get_str(ut, unibi_key_sright) == NULL, "key_sright = null"); ok(unibi_get_str(ut, unibi_key_srsume) == NULL, "key_srsume = null"); ok(unibi_get_str(ut, unibi_key_ssave) == NULL, "key_ssave = null"); ok(unibi_get_str(ut, unibi_key_ssuspend) == NULL, "key_ssuspend = null"); ok(unibi_get_str(ut, unibi_key_sundo) == NULL, "key_sundo = null"); ok(unibi_get_str(ut, unibi_req_for_input) == NULL, "req_for_input = null"); ok(strcmp(unibi_get_str(ut, unibi_key_f11), "\033[23~") == 0, "key_f11 = \"%s\"", "\\033[23~"); unibi_set_str(dt, unibi_key_f11, "\033[23~"); ok(strcmp(unibi_get_str(ut, unibi_key_f12), "\033[24~") == 0, "key_f12 = \"%s\"", "\\033[24~"); unibi_set_str(dt, unibi_key_f12, "\033[24~"); ok(unibi_get_str(ut, unibi_key_f13) == NULL, "key_f13 = null"); ok(unibi_get_str(ut, unibi_key_f14) == NULL, "key_f14 = null"); ok(unibi_get_str(ut, unibi_key_f15) == NULL, "key_f15 = null"); ok(unibi_get_str(ut, unibi_key_f16) == NULL, "key_f16 = null"); ok(unibi_get_str(ut, unibi_key_f17) == NULL, "key_f17 = null"); ok(unibi_get_str(ut, unibi_key_f18) == NULL, "key_f18 = null"); ok(unibi_get_str(ut, unibi_key_f19) == NULL, "key_f19 = null"); ok(unibi_get_str(ut, unibi_key_f20) == NULL, "key_f20 = null"); ok(unibi_get_str(ut, unibi_key_f21) == NULL, "key_f21 = null"); ok(unibi_get_str(ut, unibi_key_f22) == NULL, "key_f22 = null"); ok(unibi_get_str(ut, unibi_key_f23) == NULL, "key_f23 = null"); ok(unibi_get_str(ut, unibi_key_f24) == NULL, "key_f24 = null"); ok(unibi_get_str(ut, unibi_key_f25) == NULL, "key_f25 = null"); ok(unibi_get_str(ut, unibi_key_f26) == NULL, "key_f26 = null"); ok(unibi_get_str(ut, unibi_key_f27) == NULL, "key_f27 = null"); ok(unibi_get_str(ut, unibi_key_f28) == NULL, "key_f28 = null"); ok(unibi_get_str(ut, unibi_key_f29) == NULL, "key_f29 = null"); ok(unibi_get_str(ut, unibi_key_f30) == NULL, "key_f30 = null"); ok(unibi_get_str(ut, unibi_key_f31) == NULL, "key_f31 = null"); ok(unibi_get_str(ut, unibi_key_f32) == NULL, "key_f32 = null"); ok(unibi_get_str(ut, unibi_key_f33) == NULL, "key_f33 = null"); ok(unibi_get_str(ut, unibi_key_f34) == NULL, "key_f34 = null"); ok(unibi_get_str(ut, unibi_key_f35) == NULL, "key_f35 = null"); ok(unibi_get_str(ut, unibi_key_f36) == NULL, "key_f36 = null"); ok(unibi_get_str(ut, unibi_key_f37) == NULL, "key_f37 = null"); ok(unibi_get_str(ut, unibi_key_f38) == NULL, "key_f38 = null"); ok(unibi_get_str(ut, unibi_key_f39) == NULL, "key_f39 = null"); ok(unibi_get_str(ut, unibi_key_f40) == NULL, "key_f40 = null"); ok(unibi_get_str(ut, unibi_key_f41) == NULL, "key_f41 = null"); ok(unibi_get_str(ut, unibi_key_f42) == NULL, "key_f42 = null"); ok(unibi_get_str(ut, unibi_key_f43) == NULL, "key_f43 = null"); ok(unibi_get_str(ut, unibi_key_f44) == NULL, "key_f44 = null"); ok(unibi_get_str(ut, unibi_key_f45) == NULL, "key_f45 = null"); ok(unibi_get_str(ut, unibi_key_f46) == NULL, "key_f46 = null"); ok(unibi_get_str(ut, unibi_key_f47) == NULL, "key_f47 = null"); ok(unibi_get_str(ut, unibi_key_f48) == NULL, "key_f48 = null"); ok(unibi_get_str(ut, unibi_key_f49) == NULL, "key_f49 = null"); ok(unibi_get_str(ut, unibi_key_f50) == NULL, "key_f50 = null"); ok(unibi_get_str(ut, unibi_key_f51) == NULL, "key_f51 = null"); ok(unibi_get_str(ut, unibi_key_f52) == NULL, "key_f52 = null"); ok(unibi_get_str(ut, unibi_key_f53) == NULL, "key_f53 = null"); ok(unibi_get_str(ut, unibi_key_f54) == NULL, "key_f54 = null"); ok(unibi_get_str(ut, unibi_key_f55) == NULL, "key_f55 = null"); ok(unibi_get_str(ut, unibi_key_f56) == NULL, "key_f56 = null"); ok(unibi_get_str(ut, unibi_key_f57) == NULL, "key_f57 = null"); ok(unibi_get_str(ut, unibi_key_f58) == NULL, "key_f58 = null"); ok(unibi_get_str(ut, unibi_key_f59) == NULL, "key_f59 = null"); ok(unibi_get_str(ut, unibi_key_f60) == NULL, "key_f60 = null"); ok(unibi_get_str(ut, unibi_key_f61) == NULL, "key_f61 = null"); ok(unibi_get_str(ut, unibi_key_f62) == NULL, "key_f62 = null"); ok(unibi_get_str(ut, unibi_key_f63) == NULL, "key_f63 = null"); ok(strcmp(unibi_get_str(ut, unibi_clr_bol), "\033[1K") == 0, "clr_bol = \"%s\"", "\\033[1K"); unibi_set_str(dt, unibi_clr_bol, "\033[1K"); ok(unibi_get_str(ut, unibi_clear_margins) == NULL, "clear_margins = null"); ok(unibi_get_str(ut, unibi_set_left_margin) == NULL, "set_left_margin = null"); ok(unibi_get_str(ut, unibi_set_right_margin) == NULL, "set_right_margin = null"); ok(unibi_get_str(ut, unibi_label_format) == NULL, "label_format = null"); ok(unibi_get_str(ut, unibi_set_clock) == NULL, "set_clock = null"); ok(unibi_get_str(ut, unibi_display_clock) == NULL, "display_clock = null"); ok(unibi_get_str(ut, unibi_remove_clock) == NULL, "remove_clock = null"); ok(unibi_get_str(ut, unibi_create_window) == NULL, "create_window = null"); ok(unibi_get_str(ut, unibi_goto_window) == NULL, "goto_window = null"); ok(unibi_get_str(ut, unibi_hangup) == NULL, "hangup = null"); ok(unibi_get_str(ut, unibi_dial_phone) == NULL, "dial_phone = null"); ok(unibi_get_str(ut, unibi_quick_dial) == NULL, "quick_dial = null"); ok(unibi_get_str(ut, unibi_tone) == NULL, "tone = null"); ok(unibi_get_str(ut, unibi_pulse) == NULL, "pulse = null"); ok(unibi_get_str(ut, unibi_flash_hook) == NULL, "flash_hook = null"); ok(unibi_get_str(ut, unibi_fixed_pause) == NULL, "fixed_pause = null"); ok(unibi_get_str(ut, unibi_wait_tone) == NULL, "wait_tone = null"); ok(unibi_get_str(ut, unibi_user0) == NULL, "user0 = null"); ok(unibi_get_str(ut, unibi_user1) == NULL, "user1 = null"); ok(unibi_get_str(ut, unibi_user2) == NULL, "user2 = null"); ok(unibi_get_str(ut, unibi_user3) == NULL, "user3 = null"); ok(unibi_get_str(ut, unibi_user4) == NULL, "user4 = null"); ok(unibi_get_str(ut, unibi_user5) == NULL, "user5 = null"); ok(unibi_get_str(ut, unibi_user6) == NULL, "user6 = null"); ok(unibi_get_str(ut, unibi_user7) == NULL, "user7 = null"); ok(unibi_get_str(ut, unibi_user8) == NULL, "user8 = null"); ok(unibi_get_str(ut, unibi_user9) == NULL, "user9 = null"); ok(strcmp(unibi_get_str(ut, unibi_orig_pair), "\033[39;49m") == 0, "orig_pair = \"%s\"", "\\033[39;49m"); unibi_set_str(dt, unibi_orig_pair, "\033[39;49m"); ok(unibi_get_str(ut, unibi_orig_colors) == NULL, "orig_colors = null"); ok(unibi_get_str(ut, unibi_initialize_color) == NULL, "initialize_color = null"); ok(unibi_get_str(ut, unibi_initialize_pair) == NULL, "initialize_pair = null"); ok(unibi_get_str(ut, unibi_set_color_pair) == NULL, "set_color_pair = null"); ok(unibi_get_str(ut, unibi_set_foreground) == NULL, "set_foreground = null"); ok(unibi_get_str(ut, unibi_set_background) == NULL, "set_background = null"); ok(unibi_get_str(ut, unibi_change_char_pitch) == NULL, "change_char_pitch = null"); ok(unibi_get_str(ut, unibi_change_line_pitch) == NULL, "change_line_pitch = null"); ok(unibi_get_str(ut, unibi_change_res_horz) == NULL, "change_res_horz = null"); ok(unibi_get_str(ut, unibi_change_res_vert) == NULL, "change_res_vert = null"); ok(unibi_get_str(ut, unibi_define_char) == NULL, "define_char = null"); ok(unibi_get_str(ut, unibi_enter_doublewide_mode) == NULL, "enter_doublewide_mode = null"); ok(unibi_get_str(ut, unibi_enter_draft_quality) == NULL, "enter_draft_quality = null"); ok(strcmp(unibi_get_str(ut, unibi_enter_italics_mode), "\033[3m") == 0, "enter_italics_mode = \"%s\"", "\\033[3m"); unibi_set_str(dt, unibi_enter_italics_mode, "\033[3m"); ok(unibi_get_str(ut, unibi_enter_leftward_mode) == NULL, "enter_leftward_mode = null"); ok(unibi_get_str(ut, unibi_enter_micro_mode) == NULL, "enter_micro_mode = null"); ok(unibi_get_str(ut, unibi_enter_near_letter_quality) == NULL, "enter_near_letter_quality = null"); ok(unibi_get_str(ut, unibi_enter_normal_quality) == NULL, "enter_normal_quality = null"); ok(unibi_get_str(ut, unibi_enter_shadow_mode) == NULL, "enter_shadow_mode = null"); ok(unibi_get_str(ut, unibi_enter_subscript_mode) == NULL, "enter_subscript_mode = null"); ok(unibi_get_str(ut, unibi_enter_superscript_mode) == NULL, "enter_superscript_mode = null"); ok(unibi_get_str(ut, unibi_enter_upward_mode) == NULL, "enter_upward_mode = null"); ok(unibi_get_str(ut, unibi_exit_doublewide_mode) == NULL, "exit_doublewide_mode = null"); ok(strcmp(unibi_get_str(ut, unibi_exit_italics_mode), "\033[23m") == 0, "exit_italics_mode = \"%s\"", "\\033[23m"); unibi_set_str(dt, unibi_exit_italics_mode, "\033[23m"); ok(unibi_get_str(ut, unibi_exit_leftward_mode) == NULL, "exit_leftward_mode = null"); ok(unibi_get_str(ut, unibi_exit_micro_mode) == NULL, "exit_micro_mode = null"); ok(unibi_get_str(ut, unibi_exit_shadow_mode) == NULL, "exit_shadow_mode = null"); ok(unibi_get_str(ut, unibi_exit_subscript_mode) == NULL, "exit_subscript_mode = null"); ok(unibi_get_str(ut, unibi_exit_superscript_mode) == NULL, "exit_superscript_mode = null"); ok(unibi_get_str(ut, unibi_exit_upward_mode) == NULL, "exit_upward_mode = null"); ok(unibi_get_str(ut, unibi_micro_column_address) == NULL, "micro_column_address = null"); ok(unibi_get_str(ut, unibi_micro_down) == NULL, "micro_down = null"); ok(unibi_get_str(ut, unibi_micro_left) == NULL, "micro_left = null"); ok(unibi_get_str(ut, unibi_micro_right) == NULL, "micro_right = null"); ok(unibi_get_str(ut, unibi_micro_row_address) == NULL, "micro_row_address = null"); ok(unibi_get_str(ut, unibi_micro_up) == NULL, "micro_up = null"); ok(unibi_get_str(ut, unibi_order_of_pins) == NULL, "order_of_pins = null"); ok(unibi_get_str(ut, unibi_parm_down_micro) == NULL, "parm_down_micro = null"); ok(unibi_get_str(ut, unibi_parm_left_micro) == NULL, "parm_left_micro = null"); ok(unibi_get_str(ut, unibi_parm_right_micro) == NULL, "parm_right_micro = null"); ok(unibi_get_str(ut, unibi_parm_up_micro) == NULL, "parm_up_micro = null"); ok(unibi_get_str(ut, unibi_select_char_set) == NULL, "select_char_set = null"); ok(unibi_get_str(ut, unibi_set_bottom_margin) == NULL, "set_bottom_margin = null"); ok(unibi_get_str(ut, unibi_set_bottom_margin_parm) == NULL, "set_bottom_margin_parm = null"); ok(unibi_get_str(ut, unibi_set_left_margin_parm) == NULL, "set_left_margin_parm = null"); ok(unibi_get_str(ut, unibi_set_right_margin_parm) == NULL, "set_right_margin_parm = null"); ok(unibi_get_str(ut, unibi_set_top_margin) == NULL, "set_top_margin = null"); ok(unibi_get_str(ut, unibi_set_top_margin_parm) == NULL, "set_top_margin_parm = null"); ok(unibi_get_str(ut, unibi_start_bit_image) == NULL, "start_bit_image = null"); ok(unibi_get_str(ut, unibi_start_char_set_def) == NULL, "start_char_set_def = null"); ok(unibi_get_str(ut, unibi_stop_bit_image) == NULL, "stop_bit_image = null"); ok(unibi_get_str(ut, unibi_stop_char_set_def) == NULL, "stop_char_set_def = null"); ok(unibi_get_str(ut, unibi_subscript_characters) == NULL, "subscript_characters = null"); ok(unibi_get_str(ut, unibi_superscript_characters) == NULL, "superscript_characters = null"); ok(unibi_get_str(ut, unibi_these_cause_cr) == NULL, "these_cause_cr = null"); ok(unibi_get_str(ut, unibi_zero_motion) == NULL, "zero_motion = null"); ok(unibi_get_str(ut, unibi_char_set_names) == NULL, "char_set_names = null"); ok(strcmp(unibi_get_str(ut, unibi_key_mouse), "\033[M") == 0, "key_mouse = \"%s\"", "\\033[M"); unibi_set_str(dt, unibi_key_mouse, "\033[M"); ok(unibi_get_str(ut, unibi_mouse_info) == NULL, "mouse_info = null"); ok(unibi_get_str(ut, unibi_req_mouse_pos) == NULL, "req_mouse_pos = null"); ok(unibi_get_str(ut, unibi_get_mouse) == NULL, "get_mouse = null"); ok(strcmp(unibi_get_str(ut, unibi_set_a_foreground), "\033[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m") == 0, "set_a_foreground = \"%s\"", "\\033[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m"); unibi_set_str(dt, unibi_set_a_foreground, "\033[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m"); ok(strcmp(unibi_get_str(ut, unibi_set_a_background), "\033[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m") == 0, "set_a_background = \"%s\"", "\\033[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m"); unibi_set_str(dt, unibi_set_a_background, "\033[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m"); ok(unibi_get_str(ut, unibi_pkey_plab) == NULL, "pkey_plab = null"); ok(unibi_get_str(ut, unibi_device_type) == NULL, "device_type = null"); ok(unibi_get_str(ut, unibi_code_set_init) == NULL, "code_set_init = null"); ok(unibi_get_str(ut, unibi_set0_des_seq) == NULL, "set0_des_seq = null"); ok(unibi_get_str(ut, unibi_set1_des_seq) == NULL, "set1_des_seq = null"); ok(unibi_get_str(ut, unibi_set2_des_seq) == NULL, "set2_des_seq = null"); ok(unibi_get_str(ut, unibi_set3_des_seq) == NULL, "set3_des_seq = null"); ok(unibi_get_str(ut, unibi_set_lr_margin) == NULL, "set_lr_margin = null"); ok(unibi_get_str(ut, unibi_set_tb_margin) == NULL, "set_tb_margin = null"); ok(unibi_get_str(ut, unibi_bit_image_repeat) == NULL, "bit_image_repeat = null"); ok(unibi_get_str(ut, unibi_bit_image_newline) == NULL, "bit_image_newline = null"); ok(unibi_get_str(ut, unibi_bit_image_carriage_return) == NULL, "bit_image_carriage_return = null"); ok(unibi_get_str(ut, unibi_color_names) == NULL, "color_names = null"); ok(unibi_get_str(ut, unibi_define_bit_image_region) == NULL, "define_bit_image_region = null"); ok(unibi_get_str(ut, unibi_end_bit_image_region) == NULL, "end_bit_image_region = null"); ok(unibi_get_str(ut, unibi_set_color_band) == NULL, "set_color_band = null"); ok(unibi_get_str(ut, unibi_set_page_length) == NULL, "set_page_length = null"); ok(unibi_get_str(ut, unibi_display_pc_char) == NULL, "display_pc_char = null"); ok(unibi_get_str(ut, unibi_enter_pc_charset_mode) == NULL, "enter_pc_charset_mode = null"); ok(unibi_get_str(ut, unibi_exit_pc_charset_mode) == NULL, "exit_pc_charset_mode = null"); ok(unibi_get_str(ut, unibi_enter_scancode_mode) == NULL, "enter_scancode_mode = null"); ok(unibi_get_str(ut, unibi_exit_scancode_mode) == NULL, "exit_scancode_mode = null"); ok(unibi_get_str(ut, unibi_pc_term_options) == NULL, "pc_term_options = null"); ok(unibi_get_str(ut, unibi_scancode_escape) == NULL, "scancode_escape = null"); ok(unibi_get_str(ut, unibi_alt_scancode_esc) == NULL, "alt_scancode_esc = null"); ok(unibi_get_str(ut, unibi_enter_horizontal_hl_mode) == NULL, "enter_horizontal_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_left_hl_mode) == NULL, "enter_left_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_low_hl_mode) == NULL, "enter_low_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_right_hl_mode) == NULL, "enter_right_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_top_hl_mode) == NULL, "enter_top_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_vertical_hl_mode) == NULL, "enter_vertical_hl_mode = null"); ok(unibi_get_str(ut, unibi_set_a_attributes) == NULL, "set_a_attributes = null"); ok(unibi_get_str(ut, unibi_set_pglen_inch) == NULL, "set_pglen_inch = null"); ok(unibi_get_str(ut, unibi_termcap_init2) == NULL, "termcap_init2 = null"); ok(unibi_get_str(ut, unibi_termcap_reset) == NULL, "termcap_reset = null"); ok(unibi_get_str(ut, unibi_linefeed_if_not_lf) == NULL, "linefeed_if_not_lf = null"); ok(unibi_get_str(ut, unibi_backspace_if_not_bs) == NULL, "backspace_if_not_bs = null"); ok(unibi_get_str(ut, unibi_other_non_function_keys) == NULL, "other_non_function_keys = null"); ok(unibi_get_str(ut, unibi_arrow_key_map) == NULL, "arrow_key_map = null"); ok(unibi_get_str(ut, unibi_acs_ulcorner) == NULL, "acs_ulcorner = null"); ok(unibi_get_str(ut, unibi_acs_llcorner) == NULL, "acs_llcorner = null"); ok(unibi_get_str(ut, unibi_acs_urcorner) == NULL, "acs_urcorner = null"); ok(unibi_get_str(ut, unibi_acs_lrcorner) == NULL, "acs_lrcorner = null"); ok(unibi_get_str(ut, unibi_acs_ltee) == NULL, "acs_ltee = null"); ok(unibi_get_str(ut, unibi_acs_rtee) == NULL, "acs_rtee = null"); ok(unibi_get_str(ut, unibi_acs_btee) == NULL, "acs_btee = null"); ok(unibi_get_str(ut, unibi_acs_ttee) == NULL, "acs_ttee = null"); ok(unibi_get_str(ut, unibi_acs_hline) == NULL, "acs_hline = null"); ok(unibi_get_str(ut, unibi_acs_vline) == NULL, "acs_vline = null"); ok(unibi_get_str(ut, unibi_acs_plus) == NULL, "acs_plus = null"); ok(unibi_get_str(ut, unibi_memory_lock) == NULL, "memory_lock = null"); ok(unibi_get_str(ut, unibi_memory_unlock) == NULL, "memory_unlock = null"); ok(unibi_get_str(ut, unibi_box_chars_1) == NULL, "box_chars_1 = null"); note("extended boolean capabilities"); { const size_t n_ext = unibi_count_ext_bool(ut); ok(n_ext == 0, "#ext_bool = 0"); } note("extended numeric capabilities"); { const size_t n_ext = unibi_count_ext_num(ut); ok(n_ext == 0, "#ext_num = 0"); } note("extended string capabilities"); { const size_t n_ext = unibi_count_ext_str(ut); ok(n_ext == 0, "#ext_str = 0"); } { char buf[sizeof terminfo]; size_t r = unibi_dump(ut, buf, sizeof buf); ok(r == sizeof terminfo, "redump size == orig size"); ok(memcmp(terminfo, buf, sizeof buf) == 0, "redump == orig"); } { char buf[sizeof terminfo]; size_t r = unibi_dump(dt, buf, sizeof buf); ok(r == sizeof terminfo, "dummy redump size == orig size"); ok(memcmp(terminfo, buf, sizeof buf) == 0, "dummy redump == orig"); } unibi_destroy(ut); ok(1, "object destroyed"); unibi_destroy(dt); ok(1, "dummy object destroyed"); return 0; } static void setup(void) { plan(511); } unibilium-1.2.0/t/static_xterm.c000066400000000000000000002532221256345053500166420ustar00rootroot00000000000000#include #include #include #include "test-simple.c.inc" const char terminfo[] = { 26, 1, 48, 0, 38, 0, 15, 0, -99, 1, 108, 5, 120, 116, 101, 114, 109, 124, 120, 116, 101, 114, 109, 32, 116, 101, 114, 109, 105, 110, 97, 108, 32, 101, 109, 117, 108, 97, 116, 111, 114, 32, 40, 88, 32, 87, 105, 110, 100, 111, 119, 32, 83, 121, 115, 116, 101, 109, 41, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 80, 0, 8, 0, 24, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 0, 64, 0, 0, 0, 4, 0, 6, 0, 8, 0, 25, 0, 30, 0, 38, 0, 42, 0, 46, 0, -1, -1, 57, 0, 74, 0, 76, 0, 80, 0, 87, 0, -1, -1, 89, 0, 102, 0, -1, -1, 106, 0, 110, 0, 120, 0, 124, 0, -1, -1, -1, -1, -128, 0, -124, 0, -119, 0, -114, 0, -1, -1, -1, -1, -105, 0, -100, 0, -1, -1, -95, 0, -90, 0, -85, 0, -80, 0, -71, 0, -67, 0, -60, 0, -1, -1, -51, 0, -46, 0, -40, 0, -34, 0, -1, -1, -1, -1, -1, -1, -16, 0, -1, -1, -1, -1, -1, -1, 2, 1, -1, -1, 6, 1, -1, -1, -1, -1, -1, -1, 8, 1, -1, -1, 13, 1, -1, -1, -1, -1, -1, -1, -1, -1, 17, 1, 21, 1, 27, 1, 31, 1, 35, 1, 39, 1, 45, 1, 51, 1, 57, 1, 63, 1, 69, 1, 73, 1, -1, -1, 78, 1, -1, -1, 82, 1, 87, 1, 92, 1, 96, 1, 103, 1, -1, -1, 110, 1, 114, 1, 122, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -126, 1, -117, 1, -1, -1, -1, -1, -108, 1, -99, 1, -90, 1, -81, 1, -72, 1, -63, 1, -54, 1, -45, 1, -36, 1, -27, 1, -1, -1, -1, -1, -1, -1, -18, 1, -14, 1, -9, 1, -1, -1, -4, 1, -1, 1, -1, -1, -1, -1, 17, 2, 20, 2, 31, 2, 34, 2, 36, 2, 39, 2, 121, 2, -1, -1, 124, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 126, 2, -1, -1, -1, -1, -1, -1, -1, -1, -126, 2, -1, -1, -73, 2, -1, -1, -1, -1, -69, 2, -63, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -57, 2, -53, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -49, 2, -1, -1, -1, -1, -42, 2, -1, -1, -1, -1, -1, -1, -1, -1, -35, 2, -28, 2, -21, 2, -1, -1, -1, -1, -14, 2, -1, -1, -7, 2, -1, -1, -1, -1, -1, -1, 0, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 3, 13, 3, 19, 3, 26, 3, 33, 3, 40, 3, 47, 3, 55, 3, 63, 3, 71, 3, 79, 3, 87, 3, 95, 3, 103, 3, 111, 3, 118, 3, 125, 3, -124, 3, -117, 3, -109, 3, -101, 3, -93, 3, -85, 3, -77, 3, -69, 3, -61, 3, -53, 3, -46, 3, -39, 3, -32, 3, -25, 3, -17, 3, -9, 3, -1, 3, 7, 4, 15, 4, 23, 4, 31, 4, 39, 4, 46, 4, 53, 4, 60, 4, 67, 4, 75, 4, 83, 4, 91, 4, 99, 4, 107, 4, 115, 4, 123, 4, -125, 4, -118, 4, -111, 4, -104, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -99, 4, -88, 4, -83, 4, -75, 4, -71, 4, -1, -1, -1, -1, -1, -1, -1, -1, -62, 4, 8, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, 5, -1, -1, -1, -1, -1, -1, 82, 5, 92, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 102, 5, 105, 5, 27, 91, 90, 0, 7, 0, 13, 0, 27, 91, 37, 105, 37, 112, 49, 37, 100, 59, 37, 112, 50, 37, 100, 114, 0, 27, 91, 51, 103, 0, 27, 91, 72, 27, 91, 50, 74, 0, 27, 91, 75, 0, 27, 91, 74, 0, 27, 91, 37, 105, 37, 112, 49, 37, 100, 71, 0, 27, 91, 37, 105, 37, 112, 49, 37, 100, 59, 37, 112, 50, 37, 100, 72, 0, 10, 0, 27, 91, 72, 0, 27, 91, 63, 50, 53, 108, 0, 8, 0, 27, 91, 63, 49, 50, 108, 27, 91, 63, 50, 53, 104, 0, 27, 91, 67, 0, 27, 91, 65, 0, 27, 91, 63, 49, 50, 59, 50, 53, 104, 0, 27, 91, 80, 0, 27, 91, 77, 0, 27, 40, 48, 0, 27, 91, 53, 109, 0, 27, 91, 49, 109, 0, 27, 91, 63, 49, 48, 52, 57, 104, 0, 27, 91, 52, 104, 0, 27, 91, 56, 109, 0, 27, 91, 55, 109, 0, 27, 91, 55, 109, 0, 27, 91, 52, 109, 0, 27, 91, 37, 112, 49, 37, 100, 88, 0, 27, 40, 66, 0, 27, 40, 66, 27, 91, 109, 0, 27, 91, 63, 49, 48, 52, 57, 108, 0, 27, 91, 52, 108, 0, 27, 91, 50, 55, 109, 0, 27, 91, 50, 52, 109, 0, 27, 91, 63, 53, 104, 36, 60, 49, 48, 48, 47, 62, 27, 91, 63, 53, 108, 0, 27, 91, 33, 112, 27, 91, 63, 51, 59, 52, 108, 27, 91, 52, 108, 27, 62, 0, 27, 91, 76, 0, 8, 0, 27, 91, 51, 126, 0, 27, 79, 66, 0, 27, 79, 80, 0, 27, 91, 50, 49, 126, 0, 27, 79, 81, 0, 27, 79, 82, 0, 27, 79, 83, 0, 27, 91, 49, 53, 126, 0, 27, 91, 49, 55, 126, 0, 27, 91, 49, 56, 126, 0, 27, 91, 49, 57, 126, 0, 27, 91, 50, 48, 126, 0, 27, 79, 72, 0, 27, 91, 50, 126, 0, 27, 79, 68, 0, 27, 91, 54, 126, 0, 27, 91, 53, 126, 0, 27, 79, 67, 0, 27, 91, 49, 59, 50, 66, 0, 27, 91, 49, 59, 50, 65, 0, 27, 79, 65, 0, 27, 91, 63, 49, 108, 27, 62, 0, 27, 91, 63, 49, 104, 27, 61, 0, 27, 91, 63, 49, 48, 51, 52, 108, 0, 27, 91, 63, 49, 48, 51, 52, 104, 0, 27, 91, 37, 112, 49, 37, 100, 80, 0, 27, 91, 37, 112, 49, 37, 100, 77, 0, 27, 91, 37, 112, 49, 37, 100, 66, 0, 27, 91, 37, 112, 49, 37, 100, 64, 0, 27, 91, 37, 112, 49, 37, 100, 83, 0, 27, 91, 37, 112, 49, 37, 100, 76, 0, 27, 91, 37, 112, 49, 37, 100, 68, 0, 27, 91, 37, 112, 49, 37, 100, 67, 0, 27, 91, 37, 112, 49, 37, 100, 84, 0, 27, 91, 37, 112, 49, 37, 100, 65, 0, 27, 91, 105, 0, 27, 91, 52, 105, 0, 27, 91, 53, 105, 0, 27, 99, 0, 27, 91, 33, 112, 27, 91, 63, 51, 59, 52, 108, 27, 91, 52, 108, 27, 62, 0, 27, 56, 0, 27, 91, 37, 105, 37, 112, 49, 37, 100, 100, 0, 27, 55, 0, 10, 0, 27, 77, 0, 37, 63, 37, 112, 57, 37, 116, 27, 40, 48, 37, 101, 27, 40, 66, 37, 59, 27, 91, 48, 37, 63, 37, 112, 54, 37, 116, 59, 49, 37, 59, 37, 63, 37, 112, 50, 37, 116, 59, 52, 37, 59, 37, 63, 37, 112, 49, 37, 112, 51, 37, 124, 37, 116, 59, 55, 37, 59, 37, 63, 37, 112, 52, 37, 116, 59, 53, 37, 59, 37, 63, 37, 112, 55, 37, 116, 59, 56, 37, 59, 109, 0, 27, 72, 0, 9, 0, 27, 79, 69, 0, 96, 96, 97, 97, 102, 102, 103, 103, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 0, 27, 91, 90, 0, 27, 91, 63, 55, 104, 0, 27, 91, 63, 55, 108, 0, 27, 79, 70, 0, 27, 79, 77, 0, 27, 91, 51, 59, 50, 126, 0, 27, 91, 49, 59, 50, 70, 0, 27, 91, 49, 59, 50, 72, 0, 27, 91, 50, 59, 50, 126, 0, 27, 91, 49, 59, 50, 68, 0, 27, 91, 54, 59, 50, 126, 0, 27, 91, 53, 59, 50, 126, 0, 27, 91, 49, 59, 50, 67, 0, 27, 91, 50, 51, 126, 0, 27, 91, 50, 52, 126, 0, 27, 91, 49, 59, 50, 80, 0, 27, 91, 49, 59, 50, 81, 0, 27, 91, 49, 59, 50, 82, 0, 27, 91, 49, 59, 50, 83, 0, 27, 91, 49, 53, 59, 50, 126, 0, 27, 91, 49, 55, 59, 50, 126, 0, 27, 91, 49, 56, 59, 50, 126, 0, 27, 91, 49, 57, 59, 50, 126, 0, 27, 91, 50, 48, 59, 50, 126, 0, 27, 91, 50, 49, 59, 50, 126, 0, 27, 91, 50, 51, 59, 50, 126, 0, 27, 91, 50, 52, 59, 50, 126, 0, 27, 91, 49, 59, 53, 80, 0, 27, 91, 49, 59, 53, 81, 0, 27, 91, 49, 59, 53, 82, 0, 27, 91, 49, 59, 53, 83, 0, 27, 91, 49, 53, 59, 53, 126, 0, 27, 91, 49, 55, 59, 53, 126, 0, 27, 91, 49, 56, 59, 53, 126, 0, 27, 91, 49, 57, 59, 53, 126, 0, 27, 91, 50, 48, 59, 53, 126, 0, 27, 91, 50, 49, 59, 53, 126, 0, 27, 91, 50, 51, 59, 53, 126, 0, 27, 91, 50, 52, 59, 53, 126, 0, 27, 91, 49, 59, 54, 80, 0, 27, 91, 49, 59, 54, 81, 0, 27, 91, 49, 59, 54, 82, 0, 27, 91, 49, 59, 54, 83, 0, 27, 91, 49, 53, 59, 54, 126, 0, 27, 91, 49, 55, 59, 54, 126, 0, 27, 91, 49, 56, 59, 54, 126, 0, 27, 91, 49, 57, 59, 54, 126, 0, 27, 91, 50, 48, 59, 54, 126, 0, 27, 91, 50, 49, 59, 54, 126, 0, 27, 91, 50, 51, 59, 54, 126, 0, 27, 91, 50, 52, 59, 54, 126, 0, 27, 91, 49, 59, 51, 80, 0, 27, 91, 49, 59, 51, 81, 0, 27, 91, 49, 59, 51, 82, 0, 27, 91, 49, 59, 51, 83, 0, 27, 91, 49, 53, 59, 51, 126, 0, 27, 91, 49, 55, 59, 51, 126, 0, 27, 91, 49, 56, 59, 51, 126, 0, 27, 91, 49, 57, 59, 51, 126, 0, 27, 91, 50, 48, 59, 51, 126, 0, 27, 91, 50, 49, 59, 51, 126, 0, 27, 91, 50, 51, 59, 51, 126, 0, 27, 91, 50, 52, 59, 51, 126, 0, 27, 91, 49, 59, 52, 80, 0, 27, 91, 49, 59, 52, 81, 0, 27, 91, 49, 59, 52, 82, 0, 27, 91, 49, 75, 0, 27, 91, 37, 105, 37, 100, 59, 37, 100, 82, 0, 27, 91, 54, 110, 0, 27, 91, 63, 49, 59, 50, 99, 0, 27, 91, 99, 0, 27, 91, 51, 57, 59, 52, 57, 109, 0, 27, 91, 51, 37, 63, 37, 112, 49, 37, 123, 49, 125, 37, 61, 37, 116, 52, 37, 101, 37, 112, 49, 37, 123, 51, 125, 37, 61, 37, 116, 54, 37, 101, 37, 112, 49, 37, 123, 52, 125, 37, 61, 37, 116, 49, 37, 101, 37, 112, 49, 37, 123, 54, 125, 37, 61, 37, 116, 51, 37, 101, 37, 112, 49, 37, 100, 37, 59, 109, 0, 27, 91, 52, 37, 63, 37, 112, 49, 37, 123, 49, 125, 37, 61, 37, 116, 52, 37, 101, 37, 112, 49, 37, 123, 51, 125, 37, 61, 37, 116, 54, 37, 101, 37, 112, 49, 37, 123, 52, 125, 37, 61, 37, 116, 49, 37, 101, 37, 112, 49, 37, 123, 54, 125, 37, 61, 37, 116, 51, 37, 101, 37, 112, 49, 37, 100, 37, 59, 109, 0, 27, 91, 77, 0, 27, 91, 51, 37, 112, 49, 37, 100, 109, 0, 27, 91, 52, 37, 112, 49, 37, 100, 109, 0, 27, 108, 0, 27, 109, 0, 2, 0, 1, 0, 57, 0, 117, 0, -88, 2, 1, 0, -1, -1, -1, -1, 0, 0, 7, 0, 14, 0, 21, 0, 28, 0, 35, 0, 42, 0, 49, 0, 56, 0, 63, 0, 70, 0, 77, 0, 84, 0, 91, 0, 98, 0, 105, 0, 112, 0, 119, 0, 126, 0, -123, 0, -116, 0, -109, 0, -102, 0, -95, 0, -88, 0, -81, 0, -74, 0, -67, 0, -60, 0, -53, 0, -46, 0, -39, 0, -32, 0, -25, 0, -18, 0, -11, 0, -4, 0, 3, 1, 10, 1, 17, 1, 24, 1, 31, 1, 38, 1, 45, 1, 52, 1, 59, 1, 66, 1, 73, 1, 80, 1, 87, 1, 94, 1, 101, 1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 3, 0, 6, 0, 9, 0, 12, 0, 17, 0, 22, 0, 27, 0, 32, 0, 37, 0, 41, 0, 46, 0, 51, 0, 56, 0, 61, 0, 66, 0, 72, 0, 78, 0, 84, 0, 90, 0, 96, 0, 102, 0, 108, 0, 114, 0, 120, 0, 126, 0, -125, 0, -120, 0, -115, 0, -110, 0, -105, 0, -99, 0, -93, 0, -87, 0, -81, 0, -75, 0, -69, 0, -63, 0, -57, 0, -51, 0, -45, 0, -39, 0, -33, 0, -27, 0, -21, 0, -15, 0, -9, 0, -3, 0, 3, 1, 9, 1, 15, 1, 19, 1, 24, 1, 29, 1, 34, 1, 39, 1, 44, 1, 48, 1, 52, 1, 56, 1, 27, 91, 51, 59, 51, 126, 0, 27, 91, 51, 59, 52, 126, 0, 27, 91, 51, 59, 53, 126, 0, 27, 91, 51, 59, 54, 126, 0, 27, 91, 51, 59, 55, 126, 0, 27, 91, 49, 59, 50, 66, 0, 27, 91, 49, 59, 51, 66, 0, 27, 91, 49, 59, 52, 66, 0, 27, 91, 49, 59, 53, 66, 0, 27, 91, 49, 59, 54, 66, 0, 27, 91, 49, 59, 55, 66, 0, 27, 91, 49, 59, 51, 70, 0, 27, 91, 49, 59, 52, 70, 0, 27, 91, 49, 59, 53, 70, 0, 27, 91, 49, 59, 54, 70, 0, 27, 91, 49, 59, 55, 70, 0, 27, 91, 49, 59, 51, 72, 0, 27, 91, 49, 59, 52, 72, 0, 27, 91, 49, 59, 53, 72, 0, 27, 91, 49, 59, 54, 72, 0, 27, 91, 49, 59, 55, 72, 0, 27, 91, 50, 59, 51, 126, 0, 27, 91, 50, 59, 52, 126, 0, 27, 91, 50, 59, 53, 126, 0, 27, 91, 50, 59, 54, 126, 0, 27, 91, 50, 59, 55, 126, 0, 27, 91, 49, 59, 51, 68, 0, 27, 91, 49, 59, 52, 68, 0, 27, 91, 49, 59, 53, 68, 0, 27, 91, 49, 59, 54, 68, 0, 27, 91, 49, 59, 55, 68, 0, 27, 91, 54, 59, 51, 126, 0, 27, 91, 54, 59, 52, 126, 0, 27, 91, 54, 59, 53, 126, 0, 27, 91, 54, 59, 54, 126, 0, 27, 91, 54, 59, 55, 126, 0, 27, 91, 53, 59, 51, 126, 0, 27, 91, 53, 59, 52, 126, 0, 27, 91, 53, 59, 53, 126, 0, 27, 91, 53, 59, 54, 126, 0, 27, 91, 53, 59, 55, 126, 0, 27, 91, 49, 59, 51, 67, 0, 27, 91, 49, 59, 52, 67, 0, 27, 91, 49, 59, 53, 67, 0, 27, 91, 49, 59, 54, 67, 0, 27, 91, 49, 59, 55, 67, 0, 27, 91, 49, 59, 50, 65, 0, 27, 91, 49, 59, 51, 65, 0, 27, 91, 49, 59, 52, 65, 0, 27, 91, 49, 59, 53, 65, 0, 27, 91, 49, 59, 54, 65, 0, 27, 91, 49, 59, 55, 65, 0, 65, 88, 0, 88, 84, 0, 85, 56, 0, 88, 77, 0, 107, 68, 67, 51, 0, 107, 68, 67, 52, 0, 107, 68, 67, 53, 0, 107, 68, 67, 54, 0, 107, 68, 67, 55, 0, 107, 68, 78, 0, 107, 68, 78, 51, 0, 107, 68, 78, 52, 0, 107, 68, 78, 53, 0, 107, 68, 78, 54, 0, 107, 68, 78, 55, 0, 107, 69, 78, 68, 51, 0, 107, 69, 78, 68, 52, 0, 107, 69, 78, 68, 53, 0, 107, 69, 78, 68, 54, 0, 107, 69, 78, 68, 55, 0, 107, 72, 79, 77, 51, 0, 107, 72, 79, 77, 52, 0, 107, 72, 79, 77, 53, 0, 107, 72, 79, 77, 54, 0, 107, 72, 79, 77, 55, 0, 107, 73, 67, 51, 0, 107, 73, 67, 52, 0, 107, 73, 67, 53, 0, 107, 73, 67, 54, 0, 107, 73, 67, 55, 0, 107, 76, 70, 84, 51, 0, 107, 76, 70, 84, 52, 0, 107, 76, 70, 84, 53, 0, 107, 76, 70, 84, 54, 0, 107, 76, 70, 84, 55, 0, 107, 78, 88, 84, 51, 0, 107, 78, 88, 84, 52, 0, 107, 78, 88, 84, 53, 0, 107, 78, 88, 84, 54, 0, 107, 78, 88, 84, 55, 0, 107, 80, 82, 86, 51, 0, 107, 80, 82, 86, 52, 0, 107, 80, 82, 86, 53, 0, 107, 80, 82, 86, 54, 0, 107, 80, 82, 86, 55, 0, 107, 82, 73, 84, 51, 0, 107, 82, 73, 84, 52, 0, 107, 82, 73, 84, 53, 0, 107, 82, 73, 84, 54, 0, 107, 82, 73, 84, 55, 0, 107, 85, 80, 0, 107, 85, 80, 51, 0, 107, 85, 80, 52, 0, 107, 85, 80, 53, 0, 107, 85, 80, 54, 0, 107, 85, 80, 55, 0, 107, 97, 50, 0, 107, 98, 49, 0, 107, 98, 51, 0, 107, 99, 50, 0 }; static void setup(void); int main(void) { int e; unibi_term *dt; setup(); dt = unibi_dummy(); e = errno; ok(dt != NULL, "dummy constructed"); if (!dt) { bail_out(strerror(e)); } unibi_term *ut = unibi_from_mem(terminfo, sizeof terminfo); e = errno; ok(ut != NULL, "terminfo loaded"); if (!ut) { bail_out(strerror(e)); } note("terminal name"); ok(strcmp(unibi_get_name(ut), "xterm terminal emulator (X Window System)") == 0, "terminal name = \"%s\"", "xterm terminal emulator (X Window System)"); unibi_set_name(dt, "xterm terminal emulator (X Window System)"); { static const char *def_aliases[] = {"xterm", NULL}; const char **aliases = unibi_get_aliases(ut); ok(strcmp(aliases[0], def_aliases[0]) == 0, "terminal alias #0 = \"%s\"", "xterm"); ok(aliases[1] == NULL, "terminal alias #1 = null"); unibi_set_aliases(dt, def_aliases); } note("boolean capabilities"); ok(unibi_get_bool(ut, unibi_auto_left_margin) == 0, "auto_left_margin = false"); ok(unibi_get_bool(ut, unibi_auto_right_margin) == 1, "auto_right_margin = true"); unibi_set_bool(dt, unibi_auto_right_margin, 1); ok(unibi_get_bool(ut, unibi_no_esc_ctlc) == 0, "no_esc_ctlc = false"); ok(unibi_get_bool(ut, unibi_ceol_standout_glitch) == 0, "ceol_standout_glitch = false"); ok(unibi_get_bool(ut, unibi_eat_newline_glitch) == 1, "eat_newline_glitch = true"); unibi_set_bool(dt, unibi_eat_newline_glitch, 1); ok(unibi_get_bool(ut, unibi_erase_overstrike) == 0, "erase_overstrike = false"); ok(unibi_get_bool(ut, unibi_generic_type) == 0, "generic_type = false"); ok(unibi_get_bool(ut, unibi_hard_copy) == 0, "hard_copy = false"); ok(unibi_get_bool(ut, unibi_has_meta_key) == 1, "has_meta_key = true"); unibi_set_bool(dt, unibi_has_meta_key, 1); ok(unibi_get_bool(ut, unibi_has_status_line) == 0, "has_status_line = false"); ok(unibi_get_bool(ut, unibi_insert_null_glitch) == 0, "insert_null_glitch = false"); ok(unibi_get_bool(ut, unibi_memory_above) == 0, "memory_above = false"); ok(unibi_get_bool(ut, unibi_memory_below) == 0, "memory_below = false"); ok(unibi_get_bool(ut, unibi_move_insert_mode) == 1, "move_insert_mode = true"); unibi_set_bool(dt, unibi_move_insert_mode, 1); ok(unibi_get_bool(ut, unibi_move_standout_mode) == 1, "move_standout_mode = true"); unibi_set_bool(dt, unibi_move_standout_mode, 1); ok(unibi_get_bool(ut, unibi_over_strike) == 0, "over_strike = false"); ok(unibi_get_bool(ut, unibi_status_line_esc_ok) == 0, "status_line_esc_ok = false"); ok(unibi_get_bool(ut, unibi_dest_tabs_magic_smso) == 0, "dest_tabs_magic_smso = false"); ok(unibi_get_bool(ut, unibi_tilde_glitch) == 0, "tilde_glitch = false"); ok(unibi_get_bool(ut, unibi_transparent_underline) == 0, "transparent_underline = false"); ok(unibi_get_bool(ut, unibi_xon_xoff) == 0, "xon_xoff = false"); ok(unibi_get_bool(ut, unibi_needs_xon_xoff) == 0, "needs_xon_xoff = false"); ok(unibi_get_bool(ut, unibi_prtr_silent) == 1, "prtr_silent = true"); unibi_set_bool(dt, unibi_prtr_silent, 1); ok(unibi_get_bool(ut, unibi_hard_cursor) == 0, "hard_cursor = false"); ok(unibi_get_bool(ut, unibi_non_rev_rmcup) == 0, "non_rev_rmcup = false"); ok(unibi_get_bool(ut, unibi_no_pad_char) == 1, "no_pad_char = true"); unibi_set_bool(dt, unibi_no_pad_char, 1); ok(unibi_get_bool(ut, unibi_non_dest_scroll_region) == 0, "non_dest_scroll_region = false"); ok(unibi_get_bool(ut, unibi_can_change) == 0, "can_change = false"); ok(unibi_get_bool(ut, unibi_back_color_erase) == 1, "back_color_erase = true"); unibi_set_bool(dt, unibi_back_color_erase, 1); ok(unibi_get_bool(ut, unibi_hue_lightness_saturation) == 0, "hue_lightness_saturation = false"); ok(unibi_get_bool(ut, unibi_col_addr_glitch) == 0, "col_addr_glitch = false"); ok(unibi_get_bool(ut, unibi_cr_cancels_micro_mode) == 0, "cr_cancels_micro_mode = false"); ok(unibi_get_bool(ut, unibi_has_print_wheel) == 0, "has_print_wheel = false"); ok(unibi_get_bool(ut, unibi_row_addr_glitch) == 0, "row_addr_glitch = false"); ok(unibi_get_bool(ut, unibi_semi_auto_right_margin) == 0, "semi_auto_right_margin = false"); ok(unibi_get_bool(ut, unibi_cpi_changes_res) == 0, "cpi_changes_res = false"); ok(unibi_get_bool(ut, unibi_lpi_changes_res) == 0, "lpi_changes_res = false"); ok(unibi_get_bool(ut, unibi_backspaces_with_bs) == 1, "backspaces_with_bs = true"); unibi_set_bool(dt, unibi_backspaces_with_bs, 1); ok(unibi_get_bool(ut, unibi_crt_no_scrolling) == 0, "crt_no_scrolling = false"); ok(unibi_get_bool(ut, unibi_no_correctly_working_cr) == 0, "no_correctly_working_cr = false"); ok(unibi_get_bool(ut, unibi_gnu_has_meta_key) == 0, "gnu_has_meta_key = false"); ok(unibi_get_bool(ut, unibi_linefeed_is_newline) == 0, "linefeed_is_newline = false"); ok(unibi_get_bool(ut, unibi_has_hardware_tabs) == 0, "has_hardware_tabs = false"); ok(unibi_get_bool(ut, unibi_return_does_clr_eol) == 0, "return_does_clr_eol = false"); note("numeric capabilities"); ok(unibi_get_num(ut, unibi_columns) == 80, "columns = 80"); unibi_set_num(dt, unibi_columns, 80); ok(unibi_get_num(ut, unibi_init_tabs) == 8, "init_tabs = 8"); unibi_set_num(dt, unibi_init_tabs, 8); ok(unibi_get_num(ut, unibi_lines) == 24, "lines = 24"); unibi_set_num(dt, unibi_lines, 24); ok(unibi_get_num(ut, unibi_lines_of_memory) == -1, "lines_of_memory = -1"); ok(unibi_get_num(ut, unibi_magic_cookie_glitch) == -1, "magic_cookie_glitch = -1"); ok(unibi_get_num(ut, unibi_padding_baud_rate) == -1, "padding_baud_rate = -1"); ok(unibi_get_num(ut, unibi_virtual_terminal) == -1, "virtual_terminal = -1"); ok(unibi_get_num(ut, unibi_width_status_line) == -1, "width_status_line = -1"); ok(unibi_get_num(ut, unibi_num_labels) == -1, "num_labels = -1"); ok(unibi_get_num(ut, unibi_label_height) == -1, "label_height = -1"); ok(unibi_get_num(ut, unibi_label_width) == -1, "label_width = -1"); ok(unibi_get_num(ut, unibi_max_attributes) == -1, "max_attributes = -1"); ok(unibi_get_num(ut, unibi_maximum_windows) == -1, "maximum_windows = -1"); ok(unibi_get_num(ut, unibi_max_colors) == 8, "max_colors = 8"); unibi_set_num(dt, unibi_max_colors, 8); ok(unibi_get_num(ut, unibi_max_pairs) == 64, "max_pairs = 64"); unibi_set_num(dt, unibi_max_pairs, 64); ok(unibi_get_num(ut, unibi_no_color_video) == -1, "no_color_video = -1"); ok(unibi_get_num(ut, unibi_buffer_capacity) == -1, "buffer_capacity = -1"); ok(unibi_get_num(ut, unibi_dot_vert_spacing) == -1, "dot_vert_spacing = -1"); ok(unibi_get_num(ut, unibi_dot_horz_spacing) == -1, "dot_horz_spacing = -1"); ok(unibi_get_num(ut, unibi_max_micro_address) == -1, "max_micro_address = -1"); ok(unibi_get_num(ut, unibi_max_micro_jump) == -1, "max_micro_jump = -1"); ok(unibi_get_num(ut, unibi_micro_col_size) == -1, "micro_col_size = -1"); ok(unibi_get_num(ut, unibi_micro_line_size) == -1, "micro_line_size = -1"); ok(unibi_get_num(ut, unibi_number_of_pins) == -1, "number_of_pins = -1"); ok(unibi_get_num(ut, unibi_output_res_char) == -1, "output_res_char = -1"); ok(unibi_get_num(ut, unibi_output_res_line) == -1, "output_res_line = -1"); ok(unibi_get_num(ut, unibi_output_res_horz_inch) == -1, "output_res_horz_inch = -1"); ok(unibi_get_num(ut, unibi_output_res_vert_inch) == -1, "output_res_vert_inch = -1"); ok(unibi_get_num(ut, unibi_print_rate) == -1, "print_rate = -1"); ok(unibi_get_num(ut, unibi_wide_char_size) == -1, "wide_char_size = -1"); ok(unibi_get_num(ut, unibi_buttons) == -1, "buttons = -1"); ok(unibi_get_num(ut, unibi_bit_image_entwining) == -1, "bit_image_entwining = -1"); ok(unibi_get_num(ut, unibi_bit_image_type) == -1, "bit_image_type = -1"); ok(unibi_get_num(ut, unibi_magic_cookie_glitch_ul) == -1, "magic_cookie_glitch_ul = -1"); ok(unibi_get_num(ut, unibi_carriage_return_delay) == -1, "carriage_return_delay = -1"); ok(unibi_get_num(ut, unibi_new_line_delay) == -1, "new_line_delay = -1"); ok(unibi_get_num(ut, unibi_backspace_delay) == -1, "backspace_delay = -1"); ok(unibi_get_num(ut, unibi_horizontal_tab_delay) == -1, "horizontal_tab_delay = -1"); ok(unibi_get_num(ut, unibi_number_of_function_keys) == -1, "number_of_function_keys = -1"); note("string capabilities"); ok(strcmp(unibi_get_str(ut, unibi_back_tab), "\033[Z") == 0, "back_tab = \"%s\"", "\\033[Z"); unibi_set_str(dt, unibi_back_tab, "\033[Z"); ok(strcmp(unibi_get_str(ut, unibi_bell), "\007") == 0, "bell = \"%s\"", "\\007"); unibi_set_str(dt, unibi_bell, "\007"); ok(strcmp(unibi_get_str(ut, unibi_carriage_return), "\015") == 0, "carriage_return = \"%s\"", "\\015"); unibi_set_str(dt, unibi_carriage_return, "\015"); ok(strcmp(unibi_get_str(ut, unibi_change_scroll_region), "\033[%i%p1%d;%p2%dr") == 0, "change_scroll_region = \"%s\"", "\\033[%i%p1%d;%p2%dr"); unibi_set_str(dt, unibi_change_scroll_region, "\033[%i%p1%d;%p2%dr"); ok(strcmp(unibi_get_str(ut, unibi_clear_all_tabs), "\033[3g") == 0, "clear_all_tabs = \"%s\"", "\\033[3g"); unibi_set_str(dt, unibi_clear_all_tabs, "\033[3g"); ok(strcmp(unibi_get_str(ut, unibi_clear_screen), "\033[H\033[2J") == 0, "clear_screen = \"%s\"", "\\033[H\\033[2J"); unibi_set_str(dt, unibi_clear_screen, "\033[H\033[2J"); ok(strcmp(unibi_get_str(ut, unibi_clr_eol), "\033[K") == 0, "clr_eol = \"%s\"", "\\033[K"); unibi_set_str(dt, unibi_clr_eol, "\033[K"); ok(strcmp(unibi_get_str(ut, unibi_clr_eos), "\033[J") == 0, "clr_eos = \"%s\"", "\\033[J"); unibi_set_str(dt, unibi_clr_eos, "\033[J"); ok(strcmp(unibi_get_str(ut, unibi_column_address), "\033[%i%p1%dG") == 0, "column_address = \"%s\"", "\\033[%i%p1%dG"); unibi_set_str(dt, unibi_column_address, "\033[%i%p1%dG"); ok(unibi_get_str(ut, unibi_command_character) == NULL, "command_character = null"); ok(strcmp(unibi_get_str(ut, unibi_cursor_address), "\033[%i%p1%d;%p2%dH") == 0, "cursor_address = \"%s\"", "\\033[%i%p1%d;%p2%dH"); unibi_set_str(dt, unibi_cursor_address, "\033[%i%p1%d;%p2%dH"); ok(strcmp(unibi_get_str(ut, unibi_cursor_down), "\012") == 0, "cursor_down = \"%s\"", "\\012"); unibi_set_str(dt, unibi_cursor_down, "\012"); ok(strcmp(unibi_get_str(ut, unibi_cursor_home), "\033[H") == 0, "cursor_home = \"%s\"", "\\033[H"); unibi_set_str(dt, unibi_cursor_home, "\033[H"); ok(strcmp(unibi_get_str(ut, unibi_cursor_invisible), "\033[?25l") == 0, "cursor_invisible = \"%s\"", "\\033[?25l"); unibi_set_str(dt, unibi_cursor_invisible, "\033[?25l"); ok(strcmp(unibi_get_str(ut, unibi_cursor_left), "\010") == 0, "cursor_left = \"%s\"", "\\010"); unibi_set_str(dt, unibi_cursor_left, "\010"); ok(unibi_get_str(ut, unibi_cursor_mem_address) == NULL, "cursor_mem_address = null"); ok(strcmp(unibi_get_str(ut, unibi_cursor_normal), "\033[?12l\033[?25h") == 0, "cursor_normal = \"%s\"", "\\033[?12l\\033[?25h"); unibi_set_str(dt, unibi_cursor_normal, "\033[?12l\033[?25h"); ok(strcmp(unibi_get_str(ut, unibi_cursor_right), "\033[C") == 0, "cursor_right = \"%s\"", "\\033[C"); unibi_set_str(dt, unibi_cursor_right, "\033[C"); ok(unibi_get_str(ut, unibi_cursor_to_ll) == NULL, "cursor_to_ll = null"); ok(strcmp(unibi_get_str(ut, unibi_cursor_up), "\033[A") == 0, "cursor_up = \"%s\"", "\\033[A"); unibi_set_str(dt, unibi_cursor_up, "\033[A"); ok(strcmp(unibi_get_str(ut, unibi_cursor_visible), "\033[?12;25h") == 0, "cursor_visible = \"%s\"", "\\033[?12;25h"); unibi_set_str(dt, unibi_cursor_visible, "\033[?12;25h"); ok(strcmp(unibi_get_str(ut, unibi_delete_character), "\033[P") == 0, "delete_character = \"%s\"", "\\033[P"); unibi_set_str(dt, unibi_delete_character, "\033[P"); ok(strcmp(unibi_get_str(ut, unibi_delete_line), "\033[M") == 0, "delete_line = \"%s\"", "\\033[M"); unibi_set_str(dt, unibi_delete_line, "\033[M"); ok(unibi_get_str(ut, unibi_dis_status_line) == NULL, "dis_status_line = null"); ok(unibi_get_str(ut, unibi_down_half_line) == NULL, "down_half_line = null"); ok(strcmp(unibi_get_str(ut, unibi_enter_alt_charset_mode), "\033(0") == 0, "enter_alt_charset_mode = \"%s\"", "\\033(0"); unibi_set_str(dt, unibi_enter_alt_charset_mode, "\033(0"); ok(strcmp(unibi_get_str(ut, unibi_enter_blink_mode), "\033[5m") == 0, "enter_blink_mode = \"%s\"", "\\033[5m"); unibi_set_str(dt, unibi_enter_blink_mode, "\033[5m"); ok(strcmp(unibi_get_str(ut, unibi_enter_bold_mode), "\033[1m") == 0, "enter_bold_mode = \"%s\"", "\\033[1m"); unibi_set_str(dt, unibi_enter_bold_mode, "\033[1m"); ok(strcmp(unibi_get_str(ut, unibi_enter_ca_mode), "\033[?1049h") == 0, "enter_ca_mode = \"%s\"", "\\033[?1049h"); unibi_set_str(dt, unibi_enter_ca_mode, "\033[?1049h"); ok(unibi_get_str(ut, unibi_enter_delete_mode) == NULL, "enter_delete_mode = null"); ok(unibi_get_str(ut, unibi_enter_dim_mode) == NULL, "enter_dim_mode = null"); ok(strcmp(unibi_get_str(ut, unibi_enter_insert_mode), "\033[4h") == 0, "enter_insert_mode = \"%s\"", "\\033[4h"); unibi_set_str(dt, unibi_enter_insert_mode, "\033[4h"); ok(strcmp(unibi_get_str(ut, unibi_enter_secure_mode), "\033[8m") == 0, "enter_secure_mode = \"%s\"", "\\033[8m"); unibi_set_str(dt, unibi_enter_secure_mode, "\033[8m"); ok(unibi_get_str(ut, unibi_enter_protected_mode) == NULL, "enter_protected_mode = null"); ok(strcmp(unibi_get_str(ut, unibi_enter_reverse_mode), "\033[7m") == 0, "enter_reverse_mode = \"%s\"", "\\033[7m"); unibi_set_str(dt, unibi_enter_reverse_mode, "\033[7m"); ok(strcmp(unibi_get_str(ut, unibi_enter_standout_mode), "\033[7m") == 0, "enter_standout_mode = \"%s\"", "\\033[7m"); unibi_set_str(dt, unibi_enter_standout_mode, "\033[7m"); ok(strcmp(unibi_get_str(ut, unibi_enter_underline_mode), "\033[4m") == 0, "enter_underline_mode = \"%s\"", "\\033[4m"); unibi_set_str(dt, unibi_enter_underline_mode, "\033[4m"); ok(strcmp(unibi_get_str(ut, unibi_erase_chars), "\033[%p1%dX") == 0, "erase_chars = \"%s\"", "\\033[%p1%dX"); unibi_set_str(dt, unibi_erase_chars, "\033[%p1%dX"); ok(strcmp(unibi_get_str(ut, unibi_exit_alt_charset_mode), "\033(B") == 0, "exit_alt_charset_mode = \"%s\"", "\\033(B"); unibi_set_str(dt, unibi_exit_alt_charset_mode, "\033(B"); ok(strcmp(unibi_get_str(ut, unibi_exit_attribute_mode), "\033(B\033[m") == 0, "exit_attribute_mode = \"%s\"", "\\033(B\\033[m"); unibi_set_str(dt, unibi_exit_attribute_mode, "\033(B\033[m"); ok(strcmp(unibi_get_str(ut, unibi_exit_ca_mode), "\033[?1049l") == 0, "exit_ca_mode = \"%s\"", "\\033[?1049l"); unibi_set_str(dt, unibi_exit_ca_mode, "\033[?1049l"); ok(unibi_get_str(ut, unibi_exit_delete_mode) == NULL, "exit_delete_mode = null"); ok(strcmp(unibi_get_str(ut, unibi_exit_insert_mode), "\033[4l") == 0, "exit_insert_mode = \"%s\"", "\\033[4l"); unibi_set_str(dt, unibi_exit_insert_mode, "\033[4l"); ok(strcmp(unibi_get_str(ut, unibi_exit_standout_mode), "\033[27m") == 0, "exit_standout_mode = \"%s\"", "\\033[27m"); unibi_set_str(dt, unibi_exit_standout_mode, "\033[27m"); ok(strcmp(unibi_get_str(ut, unibi_exit_underline_mode), "\033[24m") == 0, "exit_underline_mode = \"%s\"", "\\033[24m"); unibi_set_str(dt, unibi_exit_underline_mode, "\033[24m"); ok(strcmp(unibi_get_str(ut, unibi_flash_screen), "\033[?5h$<100/>\033[?5l") == 0, "flash_screen = \"%s\"", "\\033[?5h$<100/>\\033[?5l"); unibi_set_str(dt, unibi_flash_screen, "\033[?5h$<100/>\033[?5l"); ok(unibi_get_str(ut, unibi_form_feed) == NULL, "form_feed = null"); ok(unibi_get_str(ut, unibi_from_status_line) == NULL, "from_status_line = null"); ok(unibi_get_str(ut, unibi_init_1string) == NULL, "init_1string = null"); ok(strcmp(unibi_get_str(ut, unibi_init_2string), "\033[!p\033[?3;4l\033[4l\033>") == 0, "init_2string = \"%s\"", "\\033[!p\\033[?3;4l\\033[4l\\033>"); unibi_set_str(dt, unibi_init_2string, "\033[!p\033[?3;4l\033[4l\033>"); ok(unibi_get_str(ut, unibi_init_3string) == NULL, "init_3string = null"); ok(unibi_get_str(ut, unibi_init_file) == NULL, "init_file = null"); ok(unibi_get_str(ut, unibi_insert_character) == NULL, "insert_character = null"); ok(strcmp(unibi_get_str(ut, unibi_insert_line), "\033[L") == 0, "insert_line = \"%s\"", "\\033[L"); unibi_set_str(dt, unibi_insert_line, "\033[L"); ok(unibi_get_str(ut, unibi_insert_padding) == NULL, "insert_padding = null"); ok(strcmp(unibi_get_str(ut, unibi_key_backspace), "\010") == 0, "key_backspace = \"%s\"", "\\010"); unibi_set_str(dt, unibi_key_backspace, "\010"); ok(unibi_get_str(ut, unibi_key_catab) == NULL, "key_catab = null"); ok(unibi_get_str(ut, unibi_key_clear) == NULL, "key_clear = null"); ok(unibi_get_str(ut, unibi_key_ctab) == NULL, "key_ctab = null"); ok(strcmp(unibi_get_str(ut, unibi_key_dc), "\033[3~") == 0, "key_dc = \"%s\"", "\\033[3~"); unibi_set_str(dt, unibi_key_dc, "\033[3~"); ok(unibi_get_str(ut, unibi_key_dl) == NULL, "key_dl = null"); ok(strcmp(unibi_get_str(ut, unibi_key_down), "\033OB") == 0, "key_down = \"%s\"", "\\033OB"); unibi_set_str(dt, unibi_key_down, "\033OB"); ok(unibi_get_str(ut, unibi_key_eic) == NULL, "key_eic = null"); ok(unibi_get_str(ut, unibi_key_eol) == NULL, "key_eol = null"); ok(unibi_get_str(ut, unibi_key_eos) == NULL, "key_eos = null"); ok(unibi_get_str(ut, unibi_key_f0) == NULL, "key_f0 = null"); ok(strcmp(unibi_get_str(ut, unibi_key_f1), "\033OP") == 0, "key_f1 = \"%s\"", "\\033OP"); unibi_set_str(dt, unibi_key_f1, "\033OP"); ok(strcmp(unibi_get_str(ut, unibi_key_f10), "\033[21~") == 0, "key_f10 = \"%s\"", "\\033[21~"); unibi_set_str(dt, unibi_key_f10, "\033[21~"); ok(strcmp(unibi_get_str(ut, unibi_key_f2), "\033OQ") == 0, "key_f2 = \"%s\"", "\\033OQ"); unibi_set_str(dt, unibi_key_f2, "\033OQ"); ok(strcmp(unibi_get_str(ut, unibi_key_f3), "\033OR") == 0, "key_f3 = \"%s\"", "\\033OR"); unibi_set_str(dt, unibi_key_f3, "\033OR"); ok(strcmp(unibi_get_str(ut, unibi_key_f4), "\033OS") == 0, "key_f4 = \"%s\"", "\\033OS"); unibi_set_str(dt, unibi_key_f4, "\033OS"); ok(strcmp(unibi_get_str(ut, unibi_key_f5), "\033[15~") == 0, "key_f5 = \"%s\"", "\\033[15~"); unibi_set_str(dt, unibi_key_f5, "\033[15~"); ok(strcmp(unibi_get_str(ut, unibi_key_f6), "\033[17~") == 0, "key_f6 = \"%s\"", "\\033[17~"); unibi_set_str(dt, unibi_key_f6, "\033[17~"); ok(strcmp(unibi_get_str(ut, unibi_key_f7), "\033[18~") == 0, "key_f7 = \"%s\"", "\\033[18~"); unibi_set_str(dt, unibi_key_f7, "\033[18~"); ok(strcmp(unibi_get_str(ut, unibi_key_f8), "\033[19~") == 0, "key_f8 = \"%s\"", "\\033[19~"); unibi_set_str(dt, unibi_key_f8, "\033[19~"); ok(strcmp(unibi_get_str(ut, unibi_key_f9), "\033[20~") == 0, "key_f9 = \"%s\"", "\\033[20~"); unibi_set_str(dt, unibi_key_f9, "\033[20~"); ok(strcmp(unibi_get_str(ut, unibi_key_home), "\033OH") == 0, "key_home = \"%s\"", "\\033OH"); unibi_set_str(dt, unibi_key_home, "\033OH"); ok(strcmp(unibi_get_str(ut, unibi_key_ic), "\033[2~") == 0, "key_ic = \"%s\"", "\\033[2~"); unibi_set_str(dt, unibi_key_ic, "\033[2~"); ok(unibi_get_str(ut, unibi_key_il) == NULL, "key_il = null"); ok(strcmp(unibi_get_str(ut, unibi_key_left), "\033OD") == 0, "key_left = \"%s\"", "\\033OD"); unibi_set_str(dt, unibi_key_left, "\033OD"); ok(unibi_get_str(ut, unibi_key_ll) == NULL, "key_ll = null"); ok(strcmp(unibi_get_str(ut, unibi_key_npage), "\033[6~") == 0, "key_npage = \"%s\"", "\\033[6~"); unibi_set_str(dt, unibi_key_npage, "\033[6~"); ok(strcmp(unibi_get_str(ut, unibi_key_ppage), "\033[5~") == 0, "key_ppage = \"%s\"", "\\033[5~"); unibi_set_str(dt, unibi_key_ppage, "\033[5~"); ok(strcmp(unibi_get_str(ut, unibi_key_right), "\033OC") == 0, "key_right = \"%s\"", "\\033OC"); unibi_set_str(dt, unibi_key_right, "\033OC"); ok(strcmp(unibi_get_str(ut, unibi_key_sf), "\033[1;2B") == 0, "key_sf = \"%s\"", "\\033[1;2B"); unibi_set_str(dt, unibi_key_sf, "\033[1;2B"); ok(strcmp(unibi_get_str(ut, unibi_key_sr), "\033[1;2A") == 0, "key_sr = \"%s\"", "\\033[1;2A"); unibi_set_str(dt, unibi_key_sr, "\033[1;2A"); ok(unibi_get_str(ut, unibi_key_stab) == NULL, "key_stab = null"); ok(strcmp(unibi_get_str(ut, unibi_key_up), "\033OA") == 0, "key_up = \"%s\"", "\\033OA"); unibi_set_str(dt, unibi_key_up, "\033OA"); ok(strcmp(unibi_get_str(ut, unibi_keypad_local), "\033[?1l\033>") == 0, "keypad_local = \"%s\"", "\\033[?1l\\033>"); unibi_set_str(dt, unibi_keypad_local, "\033[?1l\033>"); ok(strcmp(unibi_get_str(ut, unibi_keypad_xmit), "\033[?1h\033=") == 0, "keypad_xmit = \"%s\"", "\\033[?1h\\033="); unibi_set_str(dt, unibi_keypad_xmit, "\033[?1h\033="); ok(unibi_get_str(ut, unibi_lab_f0) == NULL, "lab_f0 = null"); ok(unibi_get_str(ut, unibi_lab_f1) == NULL, "lab_f1 = null"); ok(unibi_get_str(ut, unibi_lab_f10) == NULL, "lab_f10 = null"); ok(unibi_get_str(ut, unibi_lab_f2) == NULL, "lab_f2 = null"); ok(unibi_get_str(ut, unibi_lab_f3) == NULL, "lab_f3 = null"); ok(unibi_get_str(ut, unibi_lab_f4) == NULL, "lab_f4 = null"); ok(unibi_get_str(ut, unibi_lab_f5) == NULL, "lab_f5 = null"); ok(unibi_get_str(ut, unibi_lab_f6) == NULL, "lab_f6 = null"); ok(unibi_get_str(ut, unibi_lab_f7) == NULL, "lab_f7 = null"); ok(unibi_get_str(ut, unibi_lab_f8) == NULL, "lab_f8 = null"); ok(unibi_get_str(ut, unibi_lab_f9) == NULL, "lab_f9 = null"); ok(strcmp(unibi_get_str(ut, unibi_meta_off), "\033[?1034l") == 0, "meta_off = \"%s\"", "\\033[?1034l"); unibi_set_str(dt, unibi_meta_off, "\033[?1034l"); ok(strcmp(unibi_get_str(ut, unibi_meta_on), "\033[?1034h") == 0, "meta_on = \"%s\"", "\\033[?1034h"); unibi_set_str(dt, unibi_meta_on, "\033[?1034h"); ok(unibi_get_str(ut, unibi_newline) == NULL, "newline = null"); ok(unibi_get_str(ut, unibi_pad_char) == NULL, "pad_char = null"); ok(strcmp(unibi_get_str(ut, unibi_parm_dch), "\033[%p1%dP") == 0, "parm_dch = \"%s\"", "\\033[%p1%dP"); unibi_set_str(dt, unibi_parm_dch, "\033[%p1%dP"); ok(strcmp(unibi_get_str(ut, unibi_parm_delete_line), "\033[%p1%dM") == 0, "parm_delete_line = \"%s\"", "\\033[%p1%dM"); unibi_set_str(dt, unibi_parm_delete_line, "\033[%p1%dM"); ok(strcmp(unibi_get_str(ut, unibi_parm_down_cursor), "\033[%p1%dB") == 0, "parm_down_cursor = \"%s\"", "\\033[%p1%dB"); unibi_set_str(dt, unibi_parm_down_cursor, "\033[%p1%dB"); ok(strcmp(unibi_get_str(ut, unibi_parm_ich), "\033[%p1%d@") == 0, "parm_ich = \"%s\"", "\\033[%p1%d@"); unibi_set_str(dt, unibi_parm_ich, "\033[%p1%d@"); ok(strcmp(unibi_get_str(ut, unibi_parm_index), "\033[%p1%dS") == 0, "parm_index = \"%s\"", "\\033[%p1%dS"); unibi_set_str(dt, unibi_parm_index, "\033[%p1%dS"); ok(strcmp(unibi_get_str(ut, unibi_parm_insert_line), "\033[%p1%dL") == 0, "parm_insert_line = \"%s\"", "\\033[%p1%dL"); unibi_set_str(dt, unibi_parm_insert_line, "\033[%p1%dL"); ok(strcmp(unibi_get_str(ut, unibi_parm_left_cursor), "\033[%p1%dD") == 0, "parm_left_cursor = \"%s\"", "\\033[%p1%dD"); unibi_set_str(dt, unibi_parm_left_cursor, "\033[%p1%dD"); ok(strcmp(unibi_get_str(ut, unibi_parm_right_cursor), "\033[%p1%dC") == 0, "parm_right_cursor = \"%s\"", "\\033[%p1%dC"); unibi_set_str(dt, unibi_parm_right_cursor, "\033[%p1%dC"); ok(strcmp(unibi_get_str(ut, unibi_parm_rindex), "\033[%p1%dT") == 0, "parm_rindex = \"%s\"", "\\033[%p1%dT"); unibi_set_str(dt, unibi_parm_rindex, "\033[%p1%dT"); ok(strcmp(unibi_get_str(ut, unibi_parm_up_cursor), "\033[%p1%dA") == 0, "parm_up_cursor = \"%s\"", "\\033[%p1%dA"); unibi_set_str(dt, unibi_parm_up_cursor, "\033[%p1%dA"); ok(unibi_get_str(ut, unibi_pkey_key) == NULL, "pkey_key = null"); ok(unibi_get_str(ut, unibi_pkey_local) == NULL, "pkey_local = null"); ok(unibi_get_str(ut, unibi_pkey_xmit) == NULL, "pkey_xmit = null"); ok(strcmp(unibi_get_str(ut, unibi_print_screen), "\033[i") == 0, "print_screen = \"%s\"", "\\033[i"); unibi_set_str(dt, unibi_print_screen, "\033[i"); ok(strcmp(unibi_get_str(ut, unibi_prtr_off), "\033[4i") == 0, "prtr_off = \"%s\"", "\\033[4i"); unibi_set_str(dt, unibi_prtr_off, "\033[4i"); ok(strcmp(unibi_get_str(ut, unibi_prtr_on), "\033[5i") == 0, "prtr_on = \"%s\"", "\\033[5i"); unibi_set_str(dt, unibi_prtr_on, "\033[5i"); ok(unibi_get_str(ut, unibi_repeat_char) == NULL, "repeat_char = null"); ok(strcmp(unibi_get_str(ut, unibi_reset_1string), "\033c") == 0, "reset_1string = \"%s\"", "\\033c"); unibi_set_str(dt, unibi_reset_1string, "\033c"); ok(strcmp(unibi_get_str(ut, unibi_reset_2string), "\033[!p\033[?3;4l\033[4l\033>") == 0, "reset_2string = \"%s\"", "\\033[!p\\033[?3;4l\\033[4l\\033>"); unibi_set_str(dt, unibi_reset_2string, "\033[!p\033[?3;4l\033[4l\033>"); ok(unibi_get_str(ut, unibi_reset_3string) == NULL, "reset_3string = null"); ok(unibi_get_str(ut, unibi_reset_file) == NULL, "reset_file = null"); ok(strcmp(unibi_get_str(ut, unibi_restore_cursor), "\0338") == 0, "restore_cursor = \"%s\"", "\\0338"); unibi_set_str(dt, unibi_restore_cursor, "\0338"); ok(strcmp(unibi_get_str(ut, unibi_row_address), "\033[%i%p1%dd") == 0, "row_address = \"%s\"", "\\033[%i%p1%dd"); unibi_set_str(dt, unibi_row_address, "\033[%i%p1%dd"); ok(strcmp(unibi_get_str(ut, unibi_save_cursor), "\0337") == 0, "save_cursor = \"%s\"", "\\0337"); unibi_set_str(dt, unibi_save_cursor, "\0337"); ok(strcmp(unibi_get_str(ut, unibi_scroll_forward), "\012") == 0, "scroll_forward = \"%s\"", "\\012"); unibi_set_str(dt, unibi_scroll_forward, "\012"); ok(strcmp(unibi_get_str(ut, unibi_scroll_reverse), "\033M") == 0, "scroll_reverse = \"%s\"", "\\033M"); unibi_set_str(dt, unibi_scroll_reverse, "\033M"); ok(strcmp(unibi_get_str(ut, unibi_set_attributes), "%?%p9%t\033(0%e\033(B%;\033[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m") == 0, "set_attributes = \"%s\"", "%?%p9%t\\033(0%e\\033(B%;\\033[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m"); unibi_set_str(dt, unibi_set_attributes, "%?%p9%t\033(0%e\033(B%;\033[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m"); ok(strcmp(unibi_get_str(ut, unibi_set_tab), "\033H") == 0, "set_tab = \"%s\"", "\\033H"); unibi_set_str(dt, unibi_set_tab, "\033H"); ok(unibi_get_str(ut, unibi_set_window) == NULL, "set_window = null"); ok(strcmp(unibi_get_str(ut, unibi_tab), "\011") == 0, "tab = \"%s\"", "\\011"); unibi_set_str(dt, unibi_tab, "\011"); ok(unibi_get_str(ut, unibi_to_status_line) == NULL, "to_status_line = null"); ok(unibi_get_str(ut, unibi_underline_char) == NULL, "underline_char = null"); ok(unibi_get_str(ut, unibi_up_half_line) == NULL, "up_half_line = null"); ok(unibi_get_str(ut, unibi_init_prog) == NULL, "init_prog = null"); ok(unibi_get_str(ut, unibi_key_a1) == NULL, "key_a1 = null"); ok(unibi_get_str(ut, unibi_key_a3) == NULL, "key_a3 = null"); ok(strcmp(unibi_get_str(ut, unibi_key_b2), "\033OE") == 0, "key_b2 = \"%s\"", "\\033OE"); unibi_set_str(dt, unibi_key_b2, "\033OE"); ok(unibi_get_str(ut, unibi_key_c1) == NULL, "key_c1 = null"); ok(unibi_get_str(ut, unibi_key_c3) == NULL, "key_c3 = null"); ok(unibi_get_str(ut, unibi_prtr_non) == NULL, "prtr_non = null"); ok(unibi_get_str(ut, unibi_char_padding) == NULL, "char_padding = null"); ok(strcmp(unibi_get_str(ut, unibi_acs_chars), "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~") == 0, "acs_chars = \"%s\"", "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"); unibi_set_str(dt, unibi_acs_chars, "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"); ok(unibi_get_str(ut, unibi_plab_norm) == NULL, "plab_norm = null"); ok(strcmp(unibi_get_str(ut, unibi_key_btab), "\033[Z") == 0, "key_btab = \"%s\"", "\\033[Z"); unibi_set_str(dt, unibi_key_btab, "\033[Z"); ok(unibi_get_str(ut, unibi_enter_xon_mode) == NULL, "enter_xon_mode = null"); ok(unibi_get_str(ut, unibi_exit_xon_mode) == NULL, "exit_xon_mode = null"); ok(strcmp(unibi_get_str(ut, unibi_enter_am_mode), "\033[?7h") == 0, "enter_am_mode = \"%s\"", "\\033[?7h"); unibi_set_str(dt, unibi_enter_am_mode, "\033[?7h"); ok(strcmp(unibi_get_str(ut, unibi_exit_am_mode), "\033[?7l") == 0, "exit_am_mode = \"%s\"", "\\033[?7l"); unibi_set_str(dt, unibi_exit_am_mode, "\033[?7l"); ok(unibi_get_str(ut, unibi_xon_character) == NULL, "xon_character = null"); ok(unibi_get_str(ut, unibi_xoff_character) == NULL, "xoff_character = null"); ok(unibi_get_str(ut, unibi_ena_acs) == NULL, "ena_acs = null"); ok(unibi_get_str(ut, unibi_label_on) == NULL, "label_on = null"); ok(unibi_get_str(ut, unibi_label_off) == NULL, "label_off = null"); ok(unibi_get_str(ut, unibi_key_beg) == NULL, "key_beg = null"); ok(unibi_get_str(ut, unibi_key_cancel) == NULL, "key_cancel = null"); ok(unibi_get_str(ut, unibi_key_close) == NULL, "key_close = null"); ok(unibi_get_str(ut, unibi_key_command) == NULL, "key_command = null"); ok(unibi_get_str(ut, unibi_key_copy) == NULL, "key_copy = null"); ok(unibi_get_str(ut, unibi_key_create) == NULL, "key_create = null"); ok(strcmp(unibi_get_str(ut, unibi_key_end), "\033OF") == 0, "key_end = \"%s\"", "\\033OF"); unibi_set_str(dt, unibi_key_end, "\033OF"); ok(strcmp(unibi_get_str(ut, unibi_key_enter), "\033OM") == 0, "key_enter = \"%s\"", "\\033OM"); unibi_set_str(dt, unibi_key_enter, "\033OM"); ok(unibi_get_str(ut, unibi_key_exit) == NULL, "key_exit = null"); ok(unibi_get_str(ut, unibi_key_find) == NULL, "key_find = null"); ok(unibi_get_str(ut, unibi_key_help) == NULL, "key_help = null"); ok(unibi_get_str(ut, unibi_key_mark) == NULL, "key_mark = null"); ok(unibi_get_str(ut, unibi_key_message) == NULL, "key_message = null"); ok(unibi_get_str(ut, unibi_key_move) == NULL, "key_move = null"); ok(unibi_get_str(ut, unibi_key_next) == NULL, "key_next = null"); ok(unibi_get_str(ut, unibi_key_open) == NULL, "key_open = null"); ok(unibi_get_str(ut, unibi_key_options) == NULL, "key_options = null"); ok(unibi_get_str(ut, unibi_key_previous) == NULL, "key_previous = null"); ok(unibi_get_str(ut, unibi_key_print) == NULL, "key_print = null"); ok(unibi_get_str(ut, unibi_key_redo) == NULL, "key_redo = null"); ok(unibi_get_str(ut, unibi_key_reference) == NULL, "key_reference = null"); ok(unibi_get_str(ut, unibi_key_refresh) == NULL, "key_refresh = null"); ok(unibi_get_str(ut, unibi_key_replace) == NULL, "key_replace = null"); ok(unibi_get_str(ut, unibi_key_restart) == NULL, "key_restart = null"); ok(unibi_get_str(ut, unibi_key_resume) == NULL, "key_resume = null"); ok(unibi_get_str(ut, unibi_key_save) == NULL, "key_save = null"); ok(unibi_get_str(ut, unibi_key_suspend) == NULL, "key_suspend = null"); ok(unibi_get_str(ut, unibi_key_undo) == NULL, "key_undo = null"); ok(unibi_get_str(ut, unibi_key_sbeg) == NULL, "key_sbeg = null"); ok(unibi_get_str(ut, unibi_key_scancel) == NULL, "key_scancel = null"); ok(unibi_get_str(ut, unibi_key_scommand) == NULL, "key_scommand = null"); ok(unibi_get_str(ut, unibi_key_scopy) == NULL, "key_scopy = null"); ok(unibi_get_str(ut, unibi_key_screate) == NULL, "key_screate = null"); ok(strcmp(unibi_get_str(ut, unibi_key_sdc), "\033[3;2~") == 0, "key_sdc = \"%s\"", "\\033[3;2~"); unibi_set_str(dt, unibi_key_sdc, "\033[3;2~"); ok(unibi_get_str(ut, unibi_key_sdl) == NULL, "key_sdl = null"); ok(unibi_get_str(ut, unibi_key_select) == NULL, "key_select = null"); ok(strcmp(unibi_get_str(ut, unibi_key_send), "\033[1;2F") == 0, "key_send = \"%s\"", "\\033[1;2F"); unibi_set_str(dt, unibi_key_send, "\033[1;2F"); ok(unibi_get_str(ut, unibi_key_seol) == NULL, "key_seol = null"); ok(unibi_get_str(ut, unibi_key_sexit) == NULL, "key_sexit = null"); ok(unibi_get_str(ut, unibi_key_sfind) == NULL, "key_sfind = null"); ok(unibi_get_str(ut, unibi_key_shelp) == NULL, "key_shelp = null"); ok(strcmp(unibi_get_str(ut, unibi_key_shome), "\033[1;2H") == 0, "key_shome = \"%s\"", "\\033[1;2H"); unibi_set_str(dt, unibi_key_shome, "\033[1;2H"); ok(strcmp(unibi_get_str(ut, unibi_key_sic), "\033[2;2~") == 0, "key_sic = \"%s\"", "\\033[2;2~"); unibi_set_str(dt, unibi_key_sic, "\033[2;2~"); ok(strcmp(unibi_get_str(ut, unibi_key_sleft), "\033[1;2D") == 0, "key_sleft = \"%s\"", "\\033[1;2D"); unibi_set_str(dt, unibi_key_sleft, "\033[1;2D"); ok(unibi_get_str(ut, unibi_key_smessage) == NULL, "key_smessage = null"); ok(unibi_get_str(ut, unibi_key_smove) == NULL, "key_smove = null"); ok(strcmp(unibi_get_str(ut, unibi_key_snext), "\033[6;2~") == 0, "key_snext = \"%s\"", "\\033[6;2~"); unibi_set_str(dt, unibi_key_snext, "\033[6;2~"); ok(unibi_get_str(ut, unibi_key_soptions) == NULL, "key_soptions = null"); ok(strcmp(unibi_get_str(ut, unibi_key_sprevious), "\033[5;2~") == 0, "key_sprevious = \"%s\"", "\\033[5;2~"); unibi_set_str(dt, unibi_key_sprevious, "\033[5;2~"); ok(unibi_get_str(ut, unibi_key_sprint) == NULL, "key_sprint = null"); ok(unibi_get_str(ut, unibi_key_sredo) == NULL, "key_sredo = null"); ok(unibi_get_str(ut, unibi_key_sreplace) == NULL, "key_sreplace = null"); ok(strcmp(unibi_get_str(ut, unibi_key_sright), "\033[1;2C") == 0, "key_sright = \"%s\"", "\\033[1;2C"); unibi_set_str(dt, unibi_key_sright, "\033[1;2C"); ok(unibi_get_str(ut, unibi_key_srsume) == NULL, "key_srsume = null"); ok(unibi_get_str(ut, unibi_key_ssave) == NULL, "key_ssave = null"); ok(unibi_get_str(ut, unibi_key_ssuspend) == NULL, "key_ssuspend = null"); ok(unibi_get_str(ut, unibi_key_sundo) == NULL, "key_sundo = null"); ok(unibi_get_str(ut, unibi_req_for_input) == NULL, "req_for_input = null"); ok(strcmp(unibi_get_str(ut, unibi_key_f11), "\033[23~") == 0, "key_f11 = \"%s\"", "\\033[23~"); unibi_set_str(dt, unibi_key_f11, "\033[23~"); ok(strcmp(unibi_get_str(ut, unibi_key_f12), "\033[24~") == 0, "key_f12 = \"%s\"", "\\033[24~"); unibi_set_str(dt, unibi_key_f12, "\033[24~"); ok(strcmp(unibi_get_str(ut, unibi_key_f13), "\033[1;2P") == 0, "key_f13 = \"%s\"", "\\033[1;2P"); unibi_set_str(dt, unibi_key_f13, "\033[1;2P"); ok(strcmp(unibi_get_str(ut, unibi_key_f14), "\033[1;2Q") == 0, "key_f14 = \"%s\"", "\\033[1;2Q"); unibi_set_str(dt, unibi_key_f14, "\033[1;2Q"); ok(strcmp(unibi_get_str(ut, unibi_key_f15), "\033[1;2R") == 0, "key_f15 = \"%s\"", "\\033[1;2R"); unibi_set_str(dt, unibi_key_f15, "\033[1;2R"); ok(strcmp(unibi_get_str(ut, unibi_key_f16), "\033[1;2S") == 0, "key_f16 = \"%s\"", "\\033[1;2S"); unibi_set_str(dt, unibi_key_f16, "\033[1;2S"); ok(strcmp(unibi_get_str(ut, unibi_key_f17), "\033[15;2~") == 0, "key_f17 = \"%s\"", "\\033[15;2~"); unibi_set_str(dt, unibi_key_f17, "\033[15;2~"); ok(strcmp(unibi_get_str(ut, unibi_key_f18), "\033[17;2~") == 0, "key_f18 = \"%s\"", "\\033[17;2~"); unibi_set_str(dt, unibi_key_f18, "\033[17;2~"); ok(strcmp(unibi_get_str(ut, unibi_key_f19), "\033[18;2~") == 0, "key_f19 = \"%s\"", "\\033[18;2~"); unibi_set_str(dt, unibi_key_f19, "\033[18;2~"); ok(strcmp(unibi_get_str(ut, unibi_key_f20), "\033[19;2~") == 0, "key_f20 = \"%s\"", "\\033[19;2~"); unibi_set_str(dt, unibi_key_f20, "\033[19;2~"); ok(strcmp(unibi_get_str(ut, unibi_key_f21), "\033[20;2~") == 0, "key_f21 = \"%s\"", "\\033[20;2~"); unibi_set_str(dt, unibi_key_f21, "\033[20;2~"); ok(strcmp(unibi_get_str(ut, unibi_key_f22), "\033[21;2~") == 0, "key_f22 = \"%s\"", "\\033[21;2~"); unibi_set_str(dt, unibi_key_f22, "\033[21;2~"); ok(strcmp(unibi_get_str(ut, unibi_key_f23), "\033[23;2~") == 0, "key_f23 = \"%s\"", "\\033[23;2~"); unibi_set_str(dt, unibi_key_f23, "\033[23;2~"); ok(strcmp(unibi_get_str(ut, unibi_key_f24), "\033[24;2~") == 0, "key_f24 = \"%s\"", "\\033[24;2~"); unibi_set_str(dt, unibi_key_f24, "\033[24;2~"); ok(strcmp(unibi_get_str(ut, unibi_key_f25), "\033[1;5P") == 0, "key_f25 = \"%s\"", "\\033[1;5P"); unibi_set_str(dt, unibi_key_f25, "\033[1;5P"); ok(strcmp(unibi_get_str(ut, unibi_key_f26), "\033[1;5Q") == 0, "key_f26 = \"%s\"", "\\033[1;5Q"); unibi_set_str(dt, unibi_key_f26, "\033[1;5Q"); ok(strcmp(unibi_get_str(ut, unibi_key_f27), "\033[1;5R") == 0, "key_f27 = \"%s\"", "\\033[1;5R"); unibi_set_str(dt, unibi_key_f27, "\033[1;5R"); ok(strcmp(unibi_get_str(ut, unibi_key_f28), "\033[1;5S") == 0, "key_f28 = \"%s\"", "\\033[1;5S"); unibi_set_str(dt, unibi_key_f28, "\033[1;5S"); ok(strcmp(unibi_get_str(ut, unibi_key_f29), "\033[15;5~") == 0, "key_f29 = \"%s\"", "\\033[15;5~"); unibi_set_str(dt, unibi_key_f29, "\033[15;5~"); ok(strcmp(unibi_get_str(ut, unibi_key_f30), "\033[17;5~") == 0, "key_f30 = \"%s\"", "\\033[17;5~"); unibi_set_str(dt, unibi_key_f30, "\033[17;5~"); ok(strcmp(unibi_get_str(ut, unibi_key_f31), "\033[18;5~") == 0, "key_f31 = \"%s\"", "\\033[18;5~"); unibi_set_str(dt, unibi_key_f31, "\033[18;5~"); ok(strcmp(unibi_get_str(ut, unibi_key_f32), "\033[19;5~") == 0, "key_f32 = \"%s\"", "\\033[19;5~"); unibi_set_str(dt, unibi_key_f32, "\033[19;5~"); ok(strcmp(unibi_get_str(ut, unibi_key_f33), "\033[20;5~") == 0, "key_f33 = \"%s\"", "\\033[20;5~"); unibi_set_str(dt, unibi_key_f33, "\033[20;5~"); ok(strcmp(unibi_get_str(ut, unibi_key_f34), "\033[21;5~") == 0, "key_f34 = \"%s\"", "\\033[21;5~"); unibi_set_str(dt, unibi_key_f34, "\033[21;5~"); ok(strcmp(unibi_get_str(ut, unibi_key_f35), "\033[23;5~") == 0, "key_f35 = \"%s\"", "\\033[23;5~"); unibi_set_str(dt, unibi_key_f35, "\033[23;5~"); ok(strcmp(unibi_get_str(ut, unibi_key_f36), "\033[24;5~") == 0, "key_f36 = \"%s\"", "\\033[24;5~"); unibi_set_str(dt, unibi_key_f36, "\033[24;5~"); ok(strcmp(unibi_get_str(ut, unibi_key_f37), "\033[1;6P") == 0, "key_f37 = \"%s\"", "\\033[1;6P"); unibi_set_str(dt, unibi_key_f37, "\033[1;6P"); ok(strcmp(unibi_get_str(ut, unibi_key_f38), "\033[1;6Q") == 0, "key_f38 = \"%s\"", "\\033[1;6Q"); unibi_set_str(dt, unibi_key_f38, "\033[1;6Q"); ok(strcmp(unibi_get_str(ut, unibi_key_f39), "\033[1;6R") == 0, "key_f39 = \"%s\"", "\\033[1;6R"); unibi_set_str(dt, unibi_key_f39, "\033[1;6R"); ok(strcmp(unibi_get_str(ut, unibi_key_f40), "\033[1;6S") == 0, "key_f40 = \"%s\"", "\\033[1;6S"); unibi_set_str(dt, unibi_key_f40, "\033[1;6S"); ok(strcmp(unibi_get_str(ut, unibi_key_f41), "\033[15;6~") == 0, "key_f41 = \"%s\"", "\\033[15;6~"); unibi_set_str(dt, unibi_key_f41, "\033[15;6~"); ok(strcmp(unibi_get_str(ut, unibi_key_f42), "\033[17;6~") == 0, "key_f42 = \"%s\"", "\\033[17;6~"); unibi_set_str(dt, unibi_key_f42, "\033[17;6~"); ok(strcmp(unibi_get_str(ut, unibi_key_f43), "\033[18;6~") == 0, "key_f43 = \"%s\"", "\\033[18;6~"); unibi_set_str(dt, unibi_key_f43, "\033[18;6~"); ok(strcmp(unibi_get_str(ut, unibi_key_f44), "\033[19;6~") == 0, "key_f44 = \"%s\"", "\\033[19;6~"); unibi_set_str(dt, unibi_key_f44, "\033[19;6~"); ok(strcmp(unibi_get_str(ut, unibi_key_f45), "\033[20;6~") == 0, "key_f45 = \"%s\"", "\\033[20;6~"); unibi_set_str(dt, unibi_key_f45, "\033[20;6~"); ok(strcmp(unibi_get_str(ut, unibi_key_f46), "\033[21;6~") == 0, "key_f46 = \"%s\"", "\\033[21;6~"); unibi_set_str(dt, unibi_key_f46, "\033[21;6~"); ok(strcmp(unibi_get_str(ut, unibi_key_f47), "\033[23;6~") == 0, "key_f47 = \"%s\"", "\\033[23;6~"); unibi_set_str(dt, unibi_key_f47, "\033[23;6~"); ok(strcmp(unibi_get_str(ut, unibi_key_f48), "\033[24;6~") == 0, "key_f48 = \"%s\"", "\\033[24;6~"); unibi_set_str(dt, unibi_key_f48, "\033[24;6~"); ok(strcmp(unibi_get_str(ut, unibi_key_f49), "\033[1;3P") == 0, "key_f49 = \"%s\"", "\\033[1;3P"); unibi_set_str(dt, unibi_key_f49, "\033[1;3P"); ok(strcmp(unibi_get_str(ut, unibi_key_f50), "\033[1;3Q") == 0, "key_f50 = \"%s\"", "\\033[1;3Q"); unibi_set_str(dt, unibi_key_f50, "\033[1;3Q"); ok(strcmp(unibi_get_str(ut, unibi_key_f51), "\033[1;3R") == 0, "key_f51 = \"%s\"", "\\033[1;3R"); unibi_set_str(dt, unibi_key_f51, "\033[1;3R"); ok(strcmp(unibi_get_str(ut, unibi_key_f52), "\033[1;3S") == 0, "key_f52 = \"%s\"", "\\033[1;3S"); unibi_set_str(dt, unibi_key_f52, "\033[1;3S"); ok(strcmp(unibi_get_str(ut, unibi_key_f53), "\033[15;3~") == 0, "key_f53 = \"%s\"", "\\033[15;3~"); unibi_set_str(dt, unibi_key_f53, "\033[15;3~"); ok(strcmp(unibi_get_str(ut, unibi_key_f54), "\033[17;3~") == 0, "key_f54 = \"%s\"", "\\033[17;3~"); unibi_set_str(dt, unibi_key_f54, "\033[17;3~"); ok(strcmp(unibi_get_str(ut, unibi_key_f55), "\033[18;3~") == 0, "key_f55 = \"%s\"", "\\033[18;3~"); unibi_set_str(dt, unibi_key_f55, "\033[18;3~"); ok(strcmp(unibi_get_str(ut, unibi_key_f56), "\033[19;3~") == 0, "key_f56 = \"%s\"", "\\033[19;3~"); unibi_set_str(dt, unibi_key_f56, "\033[19;3~"); ok(strcmp(unibi_get_str(ut, unibi_key_f57), "\033[20;3~") == 0, "key_f57 = \"%s\"", "\\033[20;3~"); unibi_set_str(dt, unibi_key_f57, "\033[20;3~"); ok(strcmp(unibi_get_str(ut, unibi_key_f58), "\033[21;3~") == 0, "key_f58 = \"%s\"", "\\033[21;3~"); unibi_set_str(dt, unibi_key_f58, "\033[21;3~"); ok(strcmp(unibi_get_str(ut, unibi_key_f59), "\033[23;3~") == 0, "key_f59 = \"%s\"", "\\033[23;3~"); unibi_set_str(dt, unibi_key_f59, "\033[23;3~"); ok(strcmp(unibi_get_str(ut, unibi_key_f60), "\033[24;3~") == 0, "key_f60 = \"%s\"", "\\033[24;3~"); unibi_set_str(dt, unibi_key_f60, "\033[24;3~"); ok(strcmp(unibi_get_str(ut, unibi_key_f61), "\033[1;4P") == 0, "key_f61 = \"%s\"", "\\033[1;4P"); unibi_set_str(dt, unibi_key_f61, "\033[1;4P"); ok(strcmp(unibi_get_str(ut, unibi_key_f62), "\033[1;4Q") == 0, "key_f62 = \"%s\"", "\\033[1;4Q"); unibi_set_str(dt, unibi_key_f62, "\033[1;4Q"); ok(strcmp(unibi_get_str(ut, unibi_key_f63), "\033[1;4R") == 0, "key_f63 = \"%s\"", "\\033[1;4R"); unibi_set_str(dt, unibi_key_f63, "\033[1;4R"); ok(strcmp(unibi_get_str(ut, unibi_clr_bol), "\033[1K") == 0, "clr_bol = \"%s\"", "\\033[1K"); unibi_set_str(dt, unibi_clr_bol, "\033[1K"); ok(unibi_get_str(ut, unibi_clear_margins) == NULL, "clear_margins = null"); ok(unibi_get_str(ut, unibi_set_left_margin) == NULL, "set_left_margin = null"); ok(unibi_get_str(ut, unibi_set_right_margin) == NULL, "set_right_margin = null"); ok(unibi_get_str(ut, unibi_label_format) == NULL, "label_format = null"); ok(unibi_get_str(ut, unibi_set_clock) == NULL, "set_clock = null"); ok(unibi_get_str(ut, unibi_display_clock) == NULL, "display_clock = null"); ok(unibi_get_str(ut, unibi_remove_clock) == NULL, "remove_clock = null"); ok(unibi_get_str(ut, unibi_create_window) == NULL, "create_window = null"); ok(unibi_get_str(ut, unibi_goto_window) == NULL, "goto_window = null"); ok(unibi_get_str(ut, unibi_hangup) == NULL, "hangup = null"); ok(unibi_get_str(ut, unibi_dial_phone) == NULL, "dial_phone = null"); ok(unibi_get_str(ut, unibi_quick_dial) == NULL, "quick_dial = null"); ok(unibi_get_str(ut, unibi_tone) == NULL, "tone = null"); ok(unibi_get_str(ut, unibi_pulse) == NULL, "pulse = null"); ok(unibi_get_str(ut, unibi_flash_hook) == NULL, "flash_hook = null"); ok(unibi_get_str(ut, unibi_fixed_pause) == NULL, "fixed_pause = null"); ok(unibi_get_str(ut, unibi_wait_tone) == NULL, "wait_tone = null"); ok(unibi_get_str(ut, unibi_user0) == NULL, "user0 = null"); ok(unibi_get_str(ut, unibi_user1) == NULL, "user1 = null"); ok(unibi_get_str(ut, unibi_user2) == NULL, "user2 = null"); ok(unibi_get_str(ut, unibi_user3) == NULL, "user3 = null"); ok(unibi_get_str(ut, unibi_user4) == NULL, "user4 = null"); ok(unibi_get_str(ut, unibi_user5) == NULL, "user5 = null"); ok(strcmp(unibi_get_str(ut, unibi_user6), "\033[%i%d;%dR") == 0, "user6 = \"%s\"", "\\033[%i%d;%dR"); unibi_set_str(dt, unibi_user6, "\033[%i%d;%dR"); ok(strcmp(unibi_get_str(ut, unibi_user7), "\033[6n") == 0, "user7 = \"%s\"", "\\033[6n"); unibi_set_str(dt, unibi_user7, "\033[6n"); ok(strcmp(unibi_get_str(ut, unibi_user8), "\033[?1;2c") == 0, "user8 = \"%s\"", "\\033[?1;2c"); unibi_set_str(dt, unibi_user8, "\033[?1;2c"); ok(strcmp(unibi_get_str(ut, unibi_user9), "\033[c") == 0, "user9 = \"%s\"", "\\033[c"); unibi_set_str(dt, unibi_user9, "\033[c"); ok(strcmp(unibi_get_str(ut, unibi_orig_pair), "\033[39;49m") == 0, "orig_pair = \"%s\"", "\\033[39;49m"); unibi_set_str(dt, unibi_orig_pair, "\033[39;49m"); ok(unibi_get_str(ut, unibi_orig_colors) == NULL, "orig_colors = null"); ok(unibi_get_str(ut, unibi_initialize_color) == NULL, "initialize_color = null"); ok(unibi_get_str(ut, unibi_initialize_pair) == NULL, "initialize_pair = null"); ok(unibi_get_str(ut, unibi_set_color_pair) == NULL, "set_color_pair = null"); ok(strcmp(unibi_get_str(ut, unibi_set_foreground), "\033[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m") == 0, "set_foreground = \"%s\"", "\\033[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m"); unibi_set_str(dt, unibi_set_foreground, "\033[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m"); ok(strcmp(unibi_get_str(ut, unibi_set_background), "\033[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m") == 0, "set_background = \"%s\"", "\\033[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m"); unibi_set_str(dt, unibi_set_background, "\033[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m"); ok(unibi_get_str(ut, unibi_change_char_pitch) == NULL, "change_char_pitch = null"); ok(unibi_get_str(ut, unibi_change_line_pitch) == NULL, "change_line_pitch = null"); ok(unibi_get_str(ut, unibi_change_res_horz) == NULL, "change_res_horz = null"); ok(unibi_get_str(ut, unibi_change_res_vert) == NULL, "change_res_vert = null"); ok(unibi_get_str(ut, unibi_define_char) == NULL, "define_char = null"); ok(unibi_get_str(ut, unibi_enter_doublewide_mode) == NULL, "enter_doublewide_mode = null"); ok(unibi_get_str(ut, unibi_enter_draft_quality) == NULL, "enter_draft_quality = null"); ok(unibi_get_str(ut, unibi_enter_italics_mode) == NULL, "enter_italics_mode = null"); ok(unibi_get_str(ut, unibi_enter_leftward_mode) == NULL, "enter_leftward_mode = null"); ok(unibi_get_str(ut, unibi_enter_micro_mode) == NULL, "enter_micro_mode = null"); ok(unibi_get_str(ut, unibi_enter_near_letter_quality) == NULL, "enter_near_letter_quality = null"); ok(unibi_get_str(ut, unibi_enter_normal_quality) == NULL, "enter_normal_quality = null"); ok(unibi_get_str(ut, unibi_enter_shadow_mode) == NULL, "enter_shadow_mode = null"); ok(unibi_get_str(ut, unibi_enter_subscript_mode) == NULL, "enter_subscript_mode = null"); ok(unibi_get_str(ut, unibi_enter_superscript_mode) == NULL, "enter_superscript_mode = null"); ok(unibi_get_str(ut, unibi_enter_upward_mode) == NULL, "enter_upward_mode = null"); ok(unibi_get_str(ut, unibi_exit_doublewide_mode) == NULL, "exit_doublewide_mode = null"); ok(unibi_get_str(ut, unibi_exit_italics_mode) == NULL, "exit_italics_mode = null"); ok(unibi_get_str(ut, unibi_exit_leftward_mode) == NULL, "exit_leftward_mode = null"); ok(unibi_get_str(ut, unibi_exit_micro_mode) == NULL, "exit_micro_mode = null"); ok(unibi_get_str(ut, unibi_exit_shadow_mode) == NULL, "exit_shadow_mode = null"); ok(unibi_get_str(ut, unibi_exit_subscript_mode) == NULL, "exit_subscript_mode = null"); ok(unibi_get_str(ut, unibi_exit_superscript_mode) == NULL, "exit_superscript_mode = null"); ok(unibi_get_str(ut, unibi_exit_upward_mode) == NULL, "exit_upward_mode = null"); ok(unibi_get_str(ut, unibi_micro_column_address) == NULL, "micro_column_address = null"); ok(unibi_get_str(ut, unibi_micro_down) == NULL, "micro_down = null"); ok(unibi_get_str(ut, unibi_micro_left) == NULL, "micro_left = null"); ok(unibi_get_str(ut, unibi_micro_right) == NULL, "micro_right = null"); ok(unibi_get_str(ut, unibi_micro_row_address) == NULL, "micro_row_address = null"); ok(unibi_get_str(ut, unibi_micro_up) == NULL, "micro_up = null"); ok(unibi_get_str(ut, unibi_order_of_pins) == NULL, "order_of_pins = null"); ok(unibi_get_str(ut, unibi_parm_down_micro) == NULL, "parm_down_micro = null"); ok(unibi_get_str(ut, unibi_parm_left_micro) == NULL, "parm_left_micro = null"); ok(unibi_get_str(ut, unibi_parm_right_micro) == NULL, "parm_right_micro = null"); ok(unibi_get_str(ut, unibi_parm_up_micro) == NULL, "parm_up_micro = null"); ok(unibi_get_str(ut, unibi_select_char_set) == NULL, "select_char_set = null"); ok(unibi_get_str(ut, unibi_set_bottom_margin) == NULL, "set_bottom_margin = null"); ok(unibi_get_str(ut, unibi_set_bottom_margin_parm) == NULL, "set_bottom_margin_parm = null"); ok(unibi_get_str(ut, unibi_set_left_margin_parm) == NULL, "set_left_margin_parm = null"); ok(unibi_get_str(ut, unibi_set_right_margin_parm) == NULL, "set_right_margin_parm = null"); ok(unibi_get_str(ut, unibi_set_top_margin) == NULL, "set_top_margin = null"); ok(unibi_get_str(ut, unibi_set_top_margin_parm) == NULL, "set_top_margin_parm = null"); ok(unibi_get_str(ut, unibi_start_bit_image) == NULL, "start_bit_image = null"); ok(unibi_get_str(ut, unibi_start_char_set_def) == NULL, "start_char_set_def = null"); ok(unibi_get_str(ut, unibi_stop_bit_image) == NULL, "stop_bit_image = null"); ok(unibi_get_str(ut, unibi_stop_char_set_def) == NULL, "stop_char_set_def = null"); ok(unibi_get_str(ut, unibi_subscript_characters) == NULL, "subscript_characters = null"); ok(unibi_get_str(ut, unibi_superscript_characters) == NULL, "superscript_characters = null"); ok(unibi_get_str(ut, unibi_these_cause_cr) == NULL, "these_cause_cr = null"); ok(unibi_get_str(ut, unibi_zero_motion) == NULL, "zero_motion = null"); ok(unibi_get_str(ut, unibi_char_set_names) == NULL, "char_set_names = null"); ok(strcmp(unibi_get_str(ut, unibi_key_mouse), "\033[M") == 0, "key_mouse = \"%s\"", "\\033[M"); unibi_set_str(dt, unibi_key_mouse, "\033[M"); ok(unibi_get_str(ut, unibi_mouse_info) == NULL, "mouse_info = null"); ok(unibi_get_str(ut, unibi_req_mouse_pos) == NULL, "req_mouse_pos = null"); ok(unibi_get_str(ut, unibi_get_mouse) == NULL, "get_mouse = null"); ok(strcmp(unibi_get_str(ut, unibi_set_a_foreground), "\033[3%p1%dm") == 0, "set_a_foreground = \"%s\"", "\\033[3%p1%dm"); unibi_set_str(dt, unibi_set_a_foreground, "\033[3%p1%dm"); ok(strcmp(unibi_get_str(ut, unibi_set_a_background), "\033[4%p1%dm") == 0, "set_a_background = \"%s\"", "\\033[4%p1%dm"); unibi_set_str(dt, unibi_set_a_background, "\033[4%p1%dm"); ok(unibi_get_str(ut, unibi_pkey_plab) == NULL, "pkey_plab = null"); ok(unibi_get_str(ut, unibi_device_type) == NULL, "device_type = null"); ok(unibi_get_str(ut, unibi_code_set_init) == NULL, "code_set_init = null"); ok(unibi_get_str(ut, unibi_set0_des_seq) == NULL, "set0_des_seq = null"); ok(unibi_get_str(ut, unibi_set1_des_seq) == NULL, "set1_des_seq = null"); ok(unibi_get_str(ut, unibi_set2_des_seq) == NULL, "set2_des_seq = null"); ok(unibi_get_str(ut, unibi_set3_des_seq) == NULL, "set3_des_seq = null"); ok(unibi_get_str(ut, unibi_set_lr_margin) == NULL, "set_lr_margin = null"); ok(unibi_get_str(ut, unibi_set_tb_margin) == NULL, "set_tb_margin = null"); ok(unibi_get_str(ut, unibi_bit_image_repeat) == NULL, "bit_image_repeat = null"); ok(unibi_get_str(ut, unibi_bit_image_newline) == NULL, "bit_image_newline = null"); ok(unibi_get_str(ut, unibi_bit_image_carriage_return) == NULL, "bit_image_carriage_return = null"); ok(unibi_get_str(ut, unibi_color_names) == NULL, "color_names = null"); ok(unibi_get_str(ut, unibi_define_bit_image_region) == NULL, "define_bit_image_region = null"); ok(unibi_get_str(ut, unibi_end_bit_image_region) == NULL, "end_bit_image_region = null"); ok(unibi_get_str(ut, unibi_set_color_band) == NULL, "set_color_band = null"); ok(unibi_get_str(ut, unibi_set_page_length) == NULL, "set_page_length = null"); ok(unibi_get_str(ut, unibi_display_pc_char) == NULL, "display_pc_char = null"); ok(unibi_get_str(ut, unibi_enter_pc_charset_mode) == NULL, "enter_pc_charset_mode = null"); ok(unibi_get_str(ut, unibi_exit_pc_charset_mode) == NULL, "exit_pc_charset_mode = null"); ok(unibi_get_str(ut, unibi_enter_scancode_mode) == NULL, "enter_scancode_mode = null"); ok(unibi_get_str(ut, unibi_exit_scancode_mode) == NULL, "exit_scancode_mode = null"); ok(unibi_get_str(ut, unibi_pc_term_options) == NULL, "pc_term_options = null"); ok(unibi_get_str(ut, unibi_scancode_escape) == NULL, "scancode_escape = null"); ok(unibi_get_str(ut, unibi_alt_scancode_esc) == NULL, "alt_scancode_esc = null"); ok(unibi_get_str(ut, unibi_enter_horizontal_hl_mode) == NULL, "enter_horizontal_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_left_hl_mode) == NULL, "enter_left_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_low_hl_mode) == NULL, "enter_low_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_right_hl_mode) == NULL, "enter_right_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_top_hl_mode) == NULL, "enter_top_hl_mode = null"); ok(unibi_get_str(ut, unibi_enter_vertical_hl_mode) == NULL, "enter_vertical_hl_mode = null"); ok(unibi_get_str(ut, unibi_set_a_attributes) == NULL, "set_a_attributes = null"); ok(unibi_get_str(ut, unibi_set_pglen_inch) == NULL, "set_pglen_inch = null"); ok(unibi_get_str(ut, unibi_termcap_init2) == NULL, "termcap_init2 = null"); ok(unibi_get_str(ut, unibi_termcap_reset) == NULL, "termcap_reset = null"); ok(unibi_get_str(ut, unibi_linefeed_if_not_lf) == NULL, "linefeed_if_not_lf = null"); ok(unibi_get_str(ut, unibi_backspace_if_not_bs) == NULL, "backspace_if_not_bs = null"); ok(unibi_get_str(ut, unibi_other_non_function_keys) == NULL, "other_non_function_keys = null"); ok(unibi_get_str(ut, unibi_arrow_key_map) == NULL, "arrow_key_map = null"); ok(unibi_get_str(ut, unibi_acs_ulcorner) == NULL, "acs_ulcorner = null"); ok(unibi_get_str(ut, unibi_acs_llcorner) == NULL, "acs_llcorner = null"); ok(unibi_get_str(ut, unibi_acs_urcorner) == NULL, "acs_urcorner = null"); ok(unibi_get_str(ut, unibi_acs_lrcorner) == NULL, "acs_lrcorner = null"); ok(unibi_get_str(ut, unibi_acs_ltee) == NULL, "acs_ltee = null"); ok(unibi_get_str(ut, unibi_acs_rtee) == NULL, "acs_rtee = null"); ok(unibi_get_str(ut, unibi_acs_btee) == NULL, "acs_btee = null"); ok(unibi_get_str(ut, unibi_acs_ttee) == NULL, "acs_ttee = null"); ok(unibi_get_str(ut, unibi_acs_hline) == NULL, "acs_hline = null"); ok(unibi_get_str(ut, unibi_acs_vline) == NULL, "acs_vline = null"); ok(unibi_get_str(ut, unibi_acs_plus) == NULL, "acs_plus = null"); ok(strcmp(unibi_get_str(ut, unibi_memory_lock), "\033l") == 0, "memory_lock = \"%s\"", "\\033l"); unibi_set_str(dt, unibi_memory_lock, "\033l"); ok(strcmp(unibi_get_str(ut, unibi_memory_unlock), "\033m") == 0, "memory_unlock = \"%s\"", "\\033m"); unibi_set_str(dt, unibi_memory_unlock, "\033m"); ok(unibi_get_str(ut, unibi_box_chars_1) == NULL, "box_chars_1 = null"); note("extended boolean capabilities"); { const size_t n_ext = unibi_count_ext_bool(ut); ok(n_ext == 2, "#ext_bool = 2"); ok(0 < n_ext && unibi_get_ext_bool(ut, 0) == 1, "ext_bool[0].value = 1"); ok(0 < n_ext && strcmp(unibi_get_ext_bool_name(ut, 0), "AX") == 0, "ext_bool[0].name = \"%s\"", "AX"); unibi_add_ext_bool(dt, "AX", 1); ok(1 < n_ext && unibi_get_ext_bool(ut, 1) == 0, "ext_bool[1].value = 0"); ok(1 < n_ext && strcmp(unibi_get_ext_bool_name(ut, 1), "XT") == 0, "ext_bool[1].name = \"%s\"", "XT"); unibi_add_ext_bool(dt, "XT", 0); } note("extended numeric capabilities"); { const size_t n_ext = unibi_count_ext_num(ut); ok(n_ext == 1, "#ext_num = 1"); ok(0 < n_ext && unibi_get_ext_num(ut, 0) == -1, "ext_num[0].value = -1"); ok(0 < n_ext && strcmp(unibi_get_ext_num_name(ut, 0), "U8") == 0, "ext_num[0].name = \"%s\"", "U8"); unibi_add_ext_num(dt, "U8", -1); } note("extended string capabilities"); { const size_t n_ext = unibi_count_ext_str(ut); ok(n_ext == 57, "#ext_str = 57"); ok(0 < n_ext && unibi_get_ext_str(ut, 0) == NULL, "ext_str[0].value = null"); unibi_add_ext_str(dt, "XM", NULL); ok(0 < n_ext && strcmp(unibi_get_ext_str_name(ut, 0), "XM") == 0, "ext_str[0].name = \"%s\"", "XM"); ok(1 < n_ext && strcmp(unibi_get_ext_str(ut, 1), "\033[3;3~") == 0, "ext_str[1].value = \"%s\"", "\\033[3;3~"); unibi_add_ext_str(dt, "kDC3", "\033[3;3~"); ok(1 < n_ext && strcmp(unibi_get_ext_str_name(ut, 1), "kDC3") == 0, "ext_str[1].name = \"%s\"", "kDC3"); ok(2 < n_ext && strcmp(unibi_get_ext_str(ut, 2), "\033[3;4~") == 0, "ext_str[2].value = \"%s\"", "\\033[3;4~"); unibi_add_ext_str(dt, "kDC4", "\033[3;4~"); ok(2 < n_ext && strcmp(unibi_get_ext_str_name(ut, 2), "kDC4") == 0, "ext_str[2].name = \"%s\"", "kDC4"); ok(3 < n_ext && strcmp(unibi_get_ext_str(ut, 3), "\033[3;5~") == 0, "ext_str[3].value = \"%s\"", "\\033[3;5~"); unibi_add_ext_str(dt, "kDC5", "\033[3;5~"); ok(3 < n_ext && strcmp(unibi_get_ext_str_name(ut, 3), "kDC5") == 0, "ext_str[3].name = \"%s\"", "kDC5"); ok(4 < n_ext && strcmp(unibi_get_ext_str(ut, 4), "\033[3;6~") == 0, "ext_str[4].value = \"%s\"", "\\033[3;6~"); unibi_add_ext_str(dt, "kDC6", "\033[3;6~"); ok(4 < n_ext && strcmp(unibi_get_ext_str_name(ut, 4), "kDC6") == 0, "ext_str[4].name = \"%s\"", "kDC6"); ok(5 < n_ext && strcmp(unibi_get_ext_str(ut, 5), "\033[3;7~") == 0, "ext_str[5].value = \"%s\"", "\\033[3;7~"); unibi_add_ext_str(dt, "kDC7", "\033[3;7~"); ok(5 < n_ext && strcmp(unibi_get_ext_str_name(ut, 5), "kDC7") == 0, "ext_str[5].name = \"%s\"", "kDC7"); ok(6 < n_ext && strcmp(unibi_get_ext_str(ut, 6), "\033[1;2B") == 0, "ext_str[6].value = \"%s\"", "\\033[1;2B"); unibi_add_ext_str(dt, "kDN", "\033[1;2B"); ok(6 < n_ext && strcmp(unibi_get_ext_str_name(ut, 6), "kDN") == 0, "ext_str[6].name = \"%s\"", "kDN"); ok(7 < n_ext && strcmp(unibi_get_ext_str(ut, 7), "\033[1;3B") == 0, "ext_str[7].value = \"%s\"", "\\033[1;3B"); unibi_add_ext_str(dt, "kDN3", "\033[1;3B"); ok(7 < n_ext && strcmp(unibi_get_ext_str_name(ut, 7), "kDN3") == 0, "ext_str[7].name = \"%s\"", "kDN3"); ok(8 < n_ext && strcmp(unibi_get_ext_str(ut, 8), "\033[1;4B") == 0, "ext_str[8].value = \"%s\"", "\\033[1;4B"); unibi_add_ext_str(dt, "kDN4", "\033[1;4B"); ok(8 < n_ext && strcmp(unibi_get_ext_str_name(ut, 8), "kDN4") == 0, "ext_str[8].name = \"%s\"", "kDN4"); ok(9 < n_ext && strcmp(unibi_get_ext_str(ut, 9), "\033[1;5B") == 0, "ext_str[9].value = \"%s\"", "\\033[1;5B"); unibi_add_ext_str(dt, "kDN5", "\033[1;5B"); ok(9 < n_ext && strcmp(unibi_get_ext_str_name(ut, 9), "kDN5") == 0, "ext_str[9].name = \"%s\"", "kDN5"); ok(10 < n_ext && strcmp(unibi_get_ext_str(ut, 10), "\033[1;6B") == 0, "ext_str[10].value = \"%s\"", "\\033[1;6B"); unibi_add_ext_str(dt, "kDN6", "\033[1;6B"); ok(10 < n_ext && strcmp(unibi_get_ext_str_name(ut, 10), "kDN6") == 0, "ext_str[10].name = \"%s\"", "kDN6"); ok(11 < n_ext && strcmp(unibi_get_ext_str(ut, 11), "\033[1;7B") == 0, "ext_str[11].value = \"%s\"", "\\033[1;7B"); unibi_add_ext_str(dt, "kDN7", "\033[1;7B"); ok(11 < n_ext && strcmp(unibi_get_ext_str_name(ut, 11), "kDN7") == 0, "ext_str[11].name = \"%s\"", "kDN7"); ok(12 < n_ext && strcmp(unibi_get_ext_str(ut, 12), "\033[1;3F") == 0, "ext_str[12].value = \"%s\"", "\\033[1;3F"); unibi_add_ext_str(dt, "kEND3", "\033[1;3F"); ok(12 < n_ext && strcmp(unibi_get_ext_str_name(ut, 12), "kEND3") == 0, "ext_str[12].name = \"%s\"", "kEND3"); ok(13 < n_ext && strcmp(unibi_get_ext_str(ut, 13), "\033[1;4F") == 0, "ext_str[13].value = \"%s\"", "\\033[1;4F"); unibi_add_ext_str(dt, "kEND4", "\033[1;4F"); ok(13 < n_ext && strcmp(unibi_get_ext_str_name(ut, 13), "kEND4") == 0, "ext_str[13].name = \"%s\"", "kEND4"); ok(14 < n_ext && strcmp(unibi_get_ext_str(ut, 14), "\033[1;5F") == 0, "ext_str[14].value = \"%s\"", "\\033[1;5F"); unibi_add_ext_str(dt, "kEND5", "\033[1;5F"); ok(14 < n_ext && strcmp(unibi_get_ext_str_name(ut, 14), "kEND5") == 0, "ext_str[14].name = \"%s\"", "kEND5"); ok(15 < n_ext && strcmp(unibi_get_ext_str(ut, 15), "\033[1;6F") == 0, "ext_str[15].value = \"%s\"", "\\033[1;6F"); unibi_add_ext_str(dt, "kEND6", "\033[1;6F"); ok(15 < n_ext && strcmp(unibi_get_ext_str_name(ut, 15), "kEND6") == 0, "ext_str[15].name = \"%s\"", "kEND6"); ok(16 < n_ext && strcmp(unibi_get_ext_str(ut, 16), "\033[1;7F") == 0, "ext_str[16].value = \"%s\"", "\\033[1;7F"); unibi_add_ext_str(dt, "kEND7", "\033[1;7F"); ok(16 < n_ext && strcmp(unibi_get_ext_str_name(ut, 16), "kEND7") == 0, "ext_str[16].name = \"%s\"", "kEND7"); ok(17 < n_ext && strcmp(unibi_get_ext_str(ut, 17), "\033[1;3H") == 0, "ext_str[17].value = \"%s\"", "\\033[1;3H"); unibi_add_ext_str(dt, "kHOM3", "\033[1;3H"); ok(17 < n_ext && strcmp(unibi_get_ext_str_name(ut, 17), "kHOM3") == 0, "ext_str[17].name = \"%s\"", "kHOM3"); ok(18 < n_ext && strcmp(unibi_get_ext_str(ut, 18), "\033[1;4H") == 0, "ext_str[18].value = \"%s\"", "\\033[1;4H"); unibi_add_ext_str(dt, "kHOM4", "\033[1;4H"); ok(18 < n_ext && strcmp(unibi_get_ext_str_name(ut, 18), "kHOM4") == 0, "ext_str[18].name = \"%s\"", "kHOM4"); ok(19 < n_ext && strcmp(unibi_get_ext_str(ut, 19), "\033[1;5H") == 0, "ext_str[19].value = \"%s\"", "\\033[1;5H"); unibi_add_ext_str(dt, "kHOM5", "\033[1;5H"); ok(19 < n_ext && strcmp(unibi_get_ext_str_name(ut, 19), "kHOM5") == 0, "ext_str[19].name = \"%s\"", "kHOM5"); ok(20 < n_ext && strcmp(unibi_get_ext_str(ut, 20), "\033[1;6H") == 0, "ext_str[20].value = \"%s\"", "\\033[1;6H"); unibi_add_ext_str(dt, "kHOM6", "\033[1;6H"); ok(20 < n_ext && strcmp(unibi_get_ext_str_name(ut, 20), "kHOM6") == 0, "ext_str[20].name = \"%s\"", "kHOM6"); ok(21 < n_ext && strcmp(unibi_get_ext_str(ut, 21), "\033[1;7H") == 0, "ext_str[21].value = \"%s\"", "\\033[1;7H"); unibi_add_ext_str(dt, "kHOM7", "\033[1;7H"); ok(21 < n_ext && strcmp(unibi_get_ext_str_name(ut, 21), "kHOM7") == 0, "ext_str[21].name = \"%s\"", "kHOM7"); ok(22 < n_ext && strcmp(unibi_get_ext_str(ut, 22), "\033[2;3~") == 0, "ext_str[22].value = \"%s\"", "\\033[2;3~"); unibi_add_ext_str(dt, "kIC3", "\033[2;3~"); ok(22 < n_ext && strcmp(unibi_get_ext_str_name(ut, 22), "kIC3") == 0, "ext_str[22].name = \"%s\"", "kIC3"); ok(23 < n_ext && strcmp(unibi_get_ext_str(ut, 23), "\033[2;4~") == 0, "ext_str[23].value = \"%s\"", "\\033[2;4~"); unibi_add_ext_str(dt, "kIC4", "\033[2;4~"); ok(23 < n_ext && strcmp(unibi_get_ext_str_name(ut, 23), "kIC4") == 0, "ext_str[23].name = \"%s\"", "kIC4"); ok(24 < n_ext && strcmp(unibi_get_ext_str(ut, 24), "\033[2;5~") == 0, "ext_str[24].value = \"%s\"", "\\033[2;5~"); unibi_add_ext_str(dt, "kIC5", "\033[2;5~"); ok(24 < n_ext && strcmp(unibi_get_ext_str_name(ut, 24), "kIC5") == 0, "ext_str[24].name = \"%s\"", "kIC5"); ok(25 < n_ext && strcmp(unibi_get_ext_str(ut, 25), "\033[2;6~") == 0, "ext_str[25].value = \"%s\"", "\\033[2;6~"); unibi_add_ext_str(dt, "kIC6", "\033[2;6~"); ok(25 < n_ext && strcmp(unibi_get_ext_str_name(ut, 25), "kIC6") == 0, "ext_str[25].name = \"%s\"", "kIC6"); ok(26 < n_ext && strcmp(unibi_get_ext_str(ut, 26), "\033[2;7~") == 0, "ext_str[26].value = \"%s\"", "\\033[2;7~"); unibi_add_ext_str(dt, "kIC7", "\033[2;7~"); ok(26 < n_ext && strcmp(unibi_get_ext_str_name(ut, 26), "kIC7") == 0, "ext_str[26].name = \"%s\"", "kIC7"); ok(27 < n_ext && strcmp(unibi_get_ext_str(ut, 27), "\033[1;3D") == 0, "ext_str[27].value = \"%s\"", "\\033[1;3D"); unibi_add_ext_str(dt, "kLFT3", "\033[1;3D"); ok(27 < n_ext && strcmp(unibi_get_ext_str_name(ut, 27), "kLFT3") == 0, "ext_str[27].name = \"%s\"", "kLFT3"); ok(28 < n_ext && strcmp(unibi_get_ext_str(ut, 28), "\033[1;4D") == 0, "ext_str[28].value = \"%s\"", "\\033[1;4D"); unibi_add_ext_str(dt, "kLFT4", "\033[1;4D"); ok(28 < n_ext && strcmp(unibi_get_ext_str_name(ut, 28), "kLFT4") == 0, "ext_str[28].name = \"%s\"", "kLFT4"); ok(29 < n_ext && strcmp(unibi_get_ext_str(ut, 29), "\033[1;5D") == 0, "ext_str[29].value = \"%s\"", "\\033[1;5D"); unibi_add_ext_str(dt, "kLFT5", "\033[1;5D"); ok(29 < n_ext && strcmp(unibi_get_ext_str_name(ut, 29), "kLFT5") == 0, "ext_str[29].name = \"%s\"", "kLFT5"); ok(30 < n_ext && strcmp(unibi_get_ext_str(ut, 30), "\033[1;6D") == 0, "ext_str[30].value = \"%s\"", "\\033[1;6D"); unibi_add_ext_str(dt, "kLFT6", "\033[1;6D"); ok(30 < n_ext && strcmp(unibi_get_ext_str_name(ut, 30), "kLFT6") == 0, "ext_str[30].name = \"%s\"", "kLFT6"); ok(31 < n_ext && strcmp(unibi_get_ext_str(ut, 31), "\033[1;7D") == 0, "ext_str[31].value = \"%s\"", "\\033[1;7D"); unibi_add_ext_str(dt, "kLFT7", "\033[1;7D"); ok(31 < n_ext && strcmp(unibi_get_ext_str_name(ut, 31), "kLFT7") == 0, "ext_str[31].name = \"%s\"", "kLFT7"); ok(32 < n_ext && strcmp(unibi_get_ext_str(ut, 32), "\033[6;3~") == 0, "ext_str[32].value = \"%s\"", "\\033[6;3~"); unibi_add_ext_str(dt, "kNXT3", "\033[6;3~"); ok(32 < n_ext && strcmp(unibi_get_ext_str_name(ut, 32), "kNXT3") == 0, "ext_str[32].name = \"%s\"", "kNXT3"); ok(33 < n_ext && strcmp(unibi_get_ext_str(ut, 33), "\033[6;4~") == 0, "ext_str[33].value = \"%s\"", "\\033[6;4~"); unibi_add_ext_str(dt, "kNXT4", "\033[6;4~"); ok(33 < n_ext && strcmp(unibi_get_ext_str_name(ut, 33), "kNXT4") == 0, "ext_str[33].name = \"%s\"", "kNXT4"); ok(34 < n_ext && strcmp(unibi_get_ext_str(ut, 34), "\033[6;5~") == 0, "ext_str[34].value = \"%s\"", "\\033[6;5~"); unibi_add_ext_str(dt, "kNXT5", "\033[6;5~"); ok(34 < n_ext && strcmp(unibi_get_ext_str_name(ut, 34), "kNXT5") == 0, "ext_str[34].name = \"%s\"", "kNXT5"); ok(35 < n_ext && strcmp(unibi_get_ext_str(ut, 35), "\033[6;6~") == 0, "ext_str[35].value = \"%s\"", "\\033[6;6~"); unibi_add_ext_str(dt, "kNXT6", "\033[6;6~"); ok(35 < n_ext && strcmp(unibi_get_ext_str_name(ut, 35), "kNXT6") == 0, "ext_str[35].name = \"%s\"", "kNXT6"); ok(36 < n_ext && strcmp(unibi_get_ext_str(ut, 36), "\033[6;7~") == 0, "ext_str[36].value = \"%s\"", "\\033[6;7~"); unibi_add_ext_str(dt, "kNXT7", "\033[6;7~"); ok(36 < n_ext && strcmp(unibi_get_ext_str_name(ut, 36), "kNXT7") == 0, "ext_str[36].name = \"%s\"", "kNXT7"); ok(37 < n_ext && strcmp(unibi_get_ext_str(ut, 37), "\033[5;3~") == 0, "ext_str[37].value = \"%s\"", "\\033[5;3~"); unibi_add_ext_str(dt, "kPRV3", "\033[5;3~"); ok(37 < n_ext && strcmp(unibi_get_ext_str_name(ut, 37), "kPRV3") == 0, "ext_str[37].name = \"%s\"", "kPRV3"); ok(38 < n_ext && strcmp(unibi_get_ext_str(ut, 38), "\033[5;4~") == 0, "ext_str[38].value = \"%s\"", "\\033[5;4~"); unibi_add_ext_str(dt, "kPRV4", "\033[5;4~"); ok(38 < n_ext && strcmp(unibi_get_ext_str_name(ut, 38), "kPRV4") == 0, "ext_str[38].name = \"%s\"", "kPRV4"); ok(39 < n_ext && strcmp(unibi_get_ext_str(ut, 39), "\033[5;5~") == 0, "ext_str[39].value = \"%s\"", "\\033[5;5~"); unibi_add_ext_str(dt, "kPRV5", "\033[5;5~"); ok(39 < n_ext && strcmp(unibi_get_ext_str_name(ut, 39), "kPRV5") == 0, "ext_str[39].name = \"%s\"", "kPRV5"); ok(40 < n_ext && strcmp(unibi_get_ext_str(ut, 40), "\033[5;6~") == 0, "ext_str[40].value = \"%s\"", "\\033[5;6~"); unibi_add_ext_str(dt, "kPRV6", "\033[5;6~"); ok(40 < n_ext && strcmp(unibi_get_ext_str_name(ut, 40), "kPRV6") == 0, "ext_str[40].name = \"%s\"", "kPRV6"); ok(41 < n_ext && strcmp(unibi_get_ext_str(ut, 41), "\033[5;7~") == 0, "ext_str[41].value = \"%s\"", "\\033[5;7~"); unibi_add_ext_str(dt, "kPRV7", "\033[5;7~"); ok(41 < n_ext && strcmp(unibi_get_ext_str_name(ut, 41), "kPRV7") == 0, "ext_str[41].name = \"%s\"", "kPRV7"); ok(42 < n_ext && strcmp(unibi_get_ext_str(ut, 42), "\033[1;3C") == 0, "ext_str[42].value = \"%s\"", "\\033[1;3C"); unibi_add_ext_str(dt, "kRIT3", "\033[1;3C"); ok(42 < n_ext && strcmp(unibi_get_ext_str_name(ut, 42), "kRIT3") == 0, "ext_str[42].name = \"%s\"", "kRIT3"); ok(43 < n_ext && strcmp(unibi_get_ext_str(ut, 43), "\033[1;4C") == 0, "ext_str[43].value = \"%s\"", "\\033[1;4C"); unibi_add_ext_str(dt, "kRIT4", "\033[1;4C"); ok(43 < n_ext && strcmp(unibi_get_ext_str_name(ut, 43), "kRIT4") == 0, "ext_str[43].name = \"%s\"", "kRIT4"); ok(44 < n_ext && strcmp(unibi_get_ext_str(ut, 44), "\033[1;5C") == 0, "ext_str[44].value = \"%s\"", "\\033[1;5C"); unibi_add_ext_str(dt, "kRIT5", "\033[1;5C"); ok(44 < n_ext && strcmp(unibi_get_ext_str_name(ut, 44), "kRIT5") == 0, "ext_str[44].name = \"%s\"", "kRIT5"); ok(45 < n_ext && strcmp(unibi_get_ext_str(ut, 45), "\033[1;6C") == 0, "ext_str[45].value = \"%s\"", "\\033[1;6C"); unibi_add_ext_str(dt, "kRIT6", "\033[1;6C"); ok(45 < n_ext && strcmp(unibi_get_ext_str_name(ut, 45), "kRIT6") == 0, "ext_str[45].name = \"%s\"", "kRIT6"); ok(46 < n_ext && strcmp(unibi_get_ext_str(ut, 46), "\033[1;7C") == 0, "ext_str[46].value = \"%s\"", "\\033[1;7C"); unibi_add_ext_str(dt, "kRIT7", "\033[1;7C"); ok(46 < n_ext && strcmp(unibi_get_ext_str_name(ut, 46), "kRIT7") == 0, "ext_str[46].name = \"%s\"", "kRIT7"); ok(47 < n_ext && strcmp(unibi_get_ext_str(ut, 47), "\033[1;2A") == 0, "ext_str[47].value = \"%s\"", "\\033[1;2A"); unibi_add_ext_str(dt, "kUP", "\033[1;2A"); ok(47 < n_ext && strcmp(unibi_get_ext_str_name(ut, 47), "kUP") == 0, "ext_str[47].name = \"%s\"", "kUP"); ok(48 < n_ext && strcmp(unibi_get_ext_str(ut, 48), "\033[1;3A") == 0, "ext_str[48].value = \"%s\"", "\\033[1;3A"); unibi_add_ext_str(dt, "kUP3", "\033[1;3A"); ok(48 < n_ext && strcmp(unibi_get_ext_str_name(ut, 48), "kUP3") == 0, "ext_str[48].name = \"%s\"", "kUP3"); ok(49 < n_ext && strcmp(unibi_get_ext_str(ut, 49), "\033[1;4A") == 0, "ext_str[49].value = \"%s\"", "\\033[1;4A"); unibi_add_ext_str(dt, "kUP4", "\033[1;4A"); ok(49 < n_ext && strcmp(unibi_get_ext_str_name(ut, 49), "kUP4") == 0, "ext_str[49].name = \"%s\"", "kUP4"); ok(50 < n_ext && strcmp(unibi_get_ext_str(ut, 50), "\033[1;5A") == 0, "ext_str[50].value = \"%s\"", "\\033[1;5A"); unibi_add_ext_str(dt, "kUP5", "\033[1;5A"); ok(50 < n_ext && strcmp(unibi_get_ext_str_name(ut, 50), "kUP5") == 0, "ext_str[50].name = \"%s\"", "kUP5"); ok(51 < n_ext && strcmp(unibi_get_ext_str(ut, 51), "\033[1;6A") == 0, "ext_str[51].value = \"%s\"", "\\033[1;6A"); unibi_add_ext_str(dt, "kUP6", "\033[1;6A"); ok(51 < n_ext && strcmp(unibi_get_ext_str_name(ut, 51), "kUP6") == 0, "ext_str[51].name = \"%s\"", "kUP6"); ok(52 < n_ext && strcmp(unibi_get_ext_str(ut, 52), "\033[1;7A") == 0, "ext_str[52].value = \"%s\"", "\\033[1;7A"); unibi_add_ext_str(dt, "kUP7", "\033[1;7A"); ok(52 < n_ext && strcmp(unibi_get_ext_str_name(ut, 52), "kUP7") == 0, "ext_str[52].name = \"%s\"", "kUP7"); ok(53 < n_ext && unibi_get_ext_str(ut, 53) == NULL, "ext_str[53].value = null"); unibi_add_ext_str(dt, "ka2", NULL); ok(53 < n_ext && strcmp(unibi_get_ext_str_name(ut, 53), "ka2") == 0, "ext_str[53].name = \"%s\"", "ka2"); ok(54 < n_ext && unibi_get_ext_str(ut, 54) == NULL, "ext_str[54].value = null"); unibi_add_ext_str(dt, "kb1", NULL); ok(54 < n_ext && strcmp(unibi_get_ext_str_name(ut, 54), "kb1") == 0, "ext_str[54].name = \"%s\"", "kb1"); ok(55 < n_ext && unibi_get_ext_str(ut, 55) == NULL, "ext_str[55].value = null"); unibi_add_ext_str(dt, "kb3", NULL); ok(55 < n_ext && strcmp(unibi_get_ext_str_name(ut, 55), "kb3") == 0, "ext_str[55].name = \"%s\"", "kb3"); ok(56 < n_ext && unibi_get_ext_str(ut, 56) == NULL, "ext_str[56].value = null"); unibi_add_ext_str(dt, "kc2", NULL); ok(56 < n_ext && strcmp(unibi_get_ext_str_name(ut, 56), "kc2") == 0, "ext_str[56].name = \"%s\"", "kc2"); } { char buf[sizeof terminfo]; size_t r = unibi_dump(ut, buf, sizeof buf); ok(r == sizeof terminfo, "redump size == orig size"); ok(memcmp(terminfo, buf, sizeof buf) == 0, "redump == orig"); } { char buf[sizeof terminfo]; size_t r = unibi_dump(dt, buf, sizeof buf); ok(r == sizeof terminfo, "dummy redump size == orig size"); ok(memcmp(terminfo, buf, sizeof buf) == 0, "dummy redump == orig"); } unibi_destroy(ut); ok(1, "object destroyed"); unibi_destroy(dt); ok(1, "dummy object destroyed"); return 0; } static void setup(void) { plan(631); } unibilium-1.2.0/t/test-simple.c.inc000066400000000000000000000042001256345053500171400ustar00rootroot00000000000000/* This file (it has no associated documentation) is under the MIT license: Copyright (c) 2015 Lukas Mai Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #ifdef __GNUC__ #define ATTR_UNUSED __attribute__((__unused__)) #else #define ATTR_UNUSED #endif static unsigned test_counter; static void plan(unsigned n) { setvbuf(stdout, NULL, _IOLBF, 0); test_counter = 1; printf("1..%u\n", n); } ATTR_UNUSED static int ok(int b, const char *fmt, ...) { va_list ap; printf("%sok %u - ", b ? "" : "not ", test_counter++); va_start(ap, fmt); vprintf(fmt, ap); va_end(ap); printf("\n"); return b; } ATTR_UNUSED static void bail_out(const char *s) { printf("Bail out! %s\n", s); exit(EXIT_FAILURE); } ATTR_UNUSED static void diag(const char *fmt, ...) { va_list ap; fprintf(stderr, "# "); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, "\n"); } ATTR_UNUSED static void note(const char *fmt, ...) { va_list ap; printf("# "); va_start(ap, fmt); vprintf(fmt, ap); va_end(ap); printf("\n"); } /* vi: set ft=c: */ unibilium-1.2.0/tools/000077500000000000000000000000001256345053500146575ustar00rootroot00000000000000unibilium-1.2.0/tools/gen-static-test.c000066400000000000000000000256221256345053500200450ustar00rootroot00000000000000/* This file (it has no associated documentation) is under the MIT license: Copyright (c) 2012, 2015 Lukas Mai Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include #include #include static void say(const char *s) { puts(s); } static void say_(const char *s) { fputs(s, stdout); } static void print_str_esc(const char *s, int twice) { for (unsigned char c; (c = *s); s++) { if (isprint(c)) { putchar(c); } else { printf("%s\\%03o", twice ? "\\" : "", (unsigned)c); } } } int main(void) { unibi_term *ut = unibi_from_fp(stdin); if (!ut) { perror("unibi_from_fp(stdin)"); return EXIT_FAILURE; } char buf[4096]; size_t r = unibi_dump(ut, buf, sizeof buf); if (r > sizeof buf) { perror("unibi_dump()"); return EXIT_FAILURE; } unsigned test_counter = 0; say("#include "); say("#include "); say("#include "); say("#include \"test-simple.c.inc\""); say(""); say_("const char terminfo[] = {"); for (size_t i = 0; i < r; i++) { if (i) { printf(","); } printf("%s", i % 20 ? " " : "\n "); printf("%d", (int)buf[i]); } say("\n};"); say(""); say("static void setup(void);"); say(""); say("int main(void) {"); say(" int e;"); say(" unibi_term *dt;"); say(""); say(" setup();"); say(""); say(" dt = unibi_dummy();"); say(" e = errno;"); say(" ok(dt != NULL, \"dummy constructed\");"); test_counter++; say(" if (!dt) {"); say(" bail_out(strerror(e));"); say(" }"); say(" unibi_term *ut = unibi_from_mem(terminfo, sizeof terminfo);"); say(" e = errno;"); say(" ok(ut != NULL, \"terminfo loaded\");"); test_counter++; say(" if (!ut) {"); say(" bail_out(strerror(e));"); say(" }"); say(""); say(" note(\"terminal name\");"); { const char *name = unibi_get_name(ut); printf(" ok(strcmp(unibi_get_name(ut), \""); print_str_esc(name, 0); printf("\") == 0, \"terminal name = \\\"%%s\\\"\", \""); print_str_esc(name, 1); printf("\");\n"); test_counter++; printf(" unibi_set_name(dt, \""); print_str_esc(name, 0); printf("\");\n"); } { size_t i; const char **aliases = unibi_get_aliases(ut); say(" {"); say_(" static const char *def_aliases[] = {"); for (i = 0; aliases[i]; i++) { if (i) { say_(", "); } say_("\""); print_str_esc(aliases[i], 0); say_("\""); } if (i) { say_(", "); } say("NULL};"); say(" const char **aliases = unibi_get_aliases(ut);"); for (i = 0; aliases[i]; i++) { printf(" ok(strcmp(aliases[%zu], def_aliases[%zu]) == 0, \"terminal alias #%zu = \\\"%%s\\\"\", \"", i, i, i); print_str_esc(aliases[i], 0); printf("\");\n"); test_counter++; } printf(" ok(aliases[%zu] == NULL, \"terminal alias #%zu = null\");\n", i, i); test_counter++; say(" unibi_set_aliases(dt, def_aliases);"); say(" }"); } say(""); say(" note(\"boolean capabilities\");"); for (enum unibi_boolean i = unibi_boolean_begin_ + 1; i < unibi_boolean_end_; i++) { int b = unibi_get_bool(ut, i); const char *c = unibi_name_bool(i); printf(" ok(unibi_get_bool(ut, unibi_%s) == %d, \"%s = %s\");\n", c, b, c, b ? "true" : "false"); test_counter++; if (b) { printf(" unibi_set_bool(dt, unibi_%s, 1);\n", c); } } say(""); say(" note(\"numeric capabilities\");"); for (enum unibi_numeric i = unibi_numeric_begin_ + 1; i < unibi_numeric_end_; i++) { short v = unibi_get_num(ut, i); const char *c = unibi_name_num(i); printf(" ok(unibi_get_num(ut, unibi_%s) == %hd, \"%s = %hd\");\n", c, v, c, v); test_counter++; if (v >= 0) { printf(" unibi_set_num(dt, unibi_%s, %hd);\n", c, v); } } say(""); say(" note(\"string capabilities\");"); for (enum unibi_string i = unibi_string_begin_ + 1; i < unibi_string_end_; i++) { const char *s = unibi_get_str(ut, i); const char *c = unibi_name_str(i); if (s) { printf(" ok(strcmp(unibi_get_str(ut, unibi_%s), \"", c); print_str_esc(s, 0); printf("\") == 0, \"%s = \\\"%%s\\\"\", \"", c); print_str_esc(s, 1); printf("\");\n"); printf(" unibi_set_str(dt, unibi_%s, \"", c); print_str_esc(s, 0); printf("\");\n"); } else { printf(" ok(unibi_get_str(ut, unibi_%s) == NULL, \"%s = null\");\n", c, c); } test_counter++; } say(""); say(" note(\"extended boolean capabilities\");"); { const size_t n_ext = unibi_count_ext_bool(ut); say(" {"); say(" const size_t n_ext = unibi_count_ext_bool(ut);"); printf(" ok(n_ext == %zu, \"#ext_bool = %zu\");\n", n_ext, n_ext); test_counter++; for (size_t i = 0; i < n_ext; i++) { int b = unibi_get_ext_bool(ut, i); const char *c = unibi_get_ext_bool_name(ut, i); printf(" ok(%zu < n_ext && unibi_get_ext_bool(ut, %zu) == %d, \"ext_bool[%zu].value = %d\");\n", i, i, b, i, b); test_counter++; printf(" ok(%zu < n_ext && strcmp(unibi_get_ext_bool_name(ut, %zu), \"", i, i); test_counter++; print_str_esc(c, 0); printf("\") == 0, \"ext_bool[%zu].name = \\\"%%s\\\"\", \"", i); print_str_esc(c, 1); printf("\");\n"); printf(" unibi_add_ext_bool(dt, \""); print_str_esc(c, 0); printf("\", %d);\n", b); } say(" }"); } say(""); say(" note(\"extended numeric capabilities\");"); { const size_t n_ext = unibi_count_ext_num(ut); say(" {"); say(" const size_t n_ext = unibi_count_ext_num(ut);"); printf(" ok(n_ext == %zu, \"#ext_num = %zu\");\n", n_ext, n_ext); test_counter++; for (size_t i = 0; i < n_ext; i++) { short v = unibi_get_ext_num(ut, i); const char *c = unibi_get_ext_num_name(ut, i); printf(" ok(%zu < n_ext && unibi_get_ext_num(ut, %zu) == %hd, \"ext_num[%zu].value = %hd\");\n", i, i, v, i, v); test_counter++; printf(" ok(%zu < n_ext && strcmp(unibi_get_ext_num_name(ut, %zu), \"", i, i); test_counter++; print_str_esc(c, 0); printf("\") == 0, \"ext_num[%zu].name = \\\"%%s\\\"\", \"", i); print_str_esc(c, 1); printf("\");\n"); printf(" unibi_add_ext_num(dt, \""); print_str_esc(c, 0); printf("\", %hd);\n", v); } say(" }"); } say(""); say(" note(\"extended string capabilities\");"); { const size_t n_ext = unibi_count_ext_str(ut); say(" {"); say(" const size_t n_ext = unibi_count_ext_str(ut);"); printf(" ok(n_ext == %zu, \"#ext_str = %zu\");\n", n_ext, n_ext); test_counter++; for (size_t i = 0; i < n_ext; i++) { const char *s = unibi_get_ext_str(ut, i); const char *c = unibi_get_ext_str_name(ut, i); printf(" ok(%zu < n_ext && ", i); if (s) { printf("strcmp(unibi_get_ext_str(ut, %zu), \"", i); print_str_esc(s, 0); printf("\") == 0, \"ext_str[%zu].value = \\\"%%s\\\"\", \"", i); print_str_esc(s, 1); printf("\");\n"); printf(" unibi_add_ext_str(dt, \""); print_str_esc(c, 0); printf("\", \""); print_str_esc(s, 0); printf("\");\n"); } else { printf("unibi_get_ext_str(ut, %zu) == NULL, \"ext_str[%zu].value = null\");\n", i, i); printf(" unibi_add_ext_str(dt, \""); print_str_esc(c, 0); printf("\", NULL);\n"); } test_counter++; printf(" ok(%zu < n_ext && strcmp(unibi_get_ext_str_name(ut, %zu), \"", i, i); test_counter++; print_str_esc(c, 0); printf("\") == 0, \"ext_str[%zu].name = \\\"%%s\\\"\", \"", i); print_str_esc(c, 1); printf("\");\n"); } say(" }"); } say(""); say(" {"); say(" char buf[sizeof terminfo];"); say(" size_t r = unibi_dump(ut, buf, sizeof buf);"); say(" ok(r == sizeof terminfo, \"redump size == orig size\");"); test_counter++; say(" ok(memcmp(terminfo, buf, sizeof buf) == 0, \"redump == orig\");"); test_counter++; say(" }"); say(""); say(" {"); say(" char buf[sizeof terminfo];"); say(" size_t r = unibi_dump(dt, buf, sizeof buf);"); say(" ok(r == sizeof terminfo, \"dummy redump size == orig size\");"); test_counter++; say(" ok(memcmp(terminfo, buf, sizeof buf) == 0, \"dummy redump == orig\");"); test_counter++; say(" }"); say(""); say(" unibi_destroy(ut);"); say(" ok(1, \"object destroyed\");"); test_counter++; say(""); say(" unibi_destroy(dt);"); say(" ok(1, \"dummy object destroyed\");"); test_counter++; say(""); say(" return 0;"); say("}"); unibi_destroy(ut); say(""); say("static void setup(void) {"); printf(" plan(%u);\n", test_counter); say("}"); return 0; } unibilium-1.2.0/tools/unibi-dump.c000066400000000000000000000106121256345053500170740ustar00rootroot00000000000000/* Sample program to demonstrate basic unibilium features. */ /* This file (it has no associated documentation) is under the MIT license: Copyright (c) 2012 Lukas Mai Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "unibilium.h" #include #include static void print_str_esc(const char *s) { if (!s) { printf("(null)"); return; } for (unsigned char c; (c = *s); s++) { switch (c) { case '\a': printf("\\a"); break; case '\b': printf("\\b"); break; case '\f': printf("\\f"); break; case '\n': printf("\\n"); break; case '\r': printf("\\r"); break; case '\t': printf("\\t"); break; case '\v': printf("\\v"); break; case '\033': printf("\\e"); break; default: if (isprint(c)) { printf("%c", c); } else { printf("\\%03o", c); } break; } } } int main(void) { unibi_term *const ut = unibi_from_env(); if (!ut) { perror("unibi_from_env"); return 1; } printf("Terminal name: %s\n", unibi_get_name(ut)); { const char **a = unibi_get_aliases(ut); if (*a) { printf("Aliases: "); do { printf("%s%s", *a, a[1] ? " | " : ""); a++; } while (*a); printf("\n"); } } printf("\n"); printf("Boolean capabilities:\n"); for (enum unibi_boolean i = unibi_boolean_begin_ + 1; i < unibi_boolean_end_; i++) { if (unibi_get_bool(ut, i)) { printf(" %-25s / %s\n", unibi_name_bool(i), unibi_short_name_bool(i)); } } printf("\n"); printf("Numeric capabilities:\n"); for (enum unibi_numeric i = unibi_numeric_begin_ + 1; i < unibi_numeric_end_; i++) { short n = unibi_get_num(ut, i); if (n != -1) { printf(" %-25s / %-10s = %hd\n", unibi_name_num(i), unibi_short_name_num(i), n); } } printf("\n"); printf("String capabilities:\n"); for (enum unibi_string i = unibi_string_begin_ + 1; i < unibi_string_end_; i++) { const char *s = unibi_get_str(ut, i); if (s) { /* Most of these strings will contain escape sequences */ printf(" %-25s / %-10s = ", unibi_name_str(i), unibi_short_name_str(i)); print_str_esc(s); printf("\n"); } } printf("\n"); if (unibi_count_ext_bool(ut)) { printf("Extended boolean capabilities:\n"); for (size_t i = 0; i < unibi_count_ext_bool(ut); i++) { printf(" %-25s = %s\n", unibi_get_ext_bool_name(ut, i), unibi_get_ext_bool(ut, i) ? "true" : "false"); } printf("\n"); } if (unibi_count_ext_num(ut)) { printf("Extended numeric capabilities:\n"); for (size_t i = 0; i < unibi_count_ext_num(ut); i++) { printf(" %-25s = %hd\n", unibi_get_ext_num_name(ut, i), unibi_get_ext_num(ut, i)); } printf("\n"); } if (unibi_count_ext_str(ut)) { printf("Extended string capabilities:\n"); for (size_t i = 0; i < unibi_count_ext_str(ut); i++) { printf(" %-25s = ", unibi_get_ext_str_name(ut, i)); print_str_esc(unibi_get_ext_str(ut, i)); printf("\n"); } printf("\n"); } unibi_destroy(ut); return 0; } unibilium-1.2.0/tools/unibi-put.c000066400000000000000000000103201256345053500167330ustar00rootroot00000000000000/* This file (it has no associated documentation) is under the MIT license: Copyright (c) 2011 Lukas Mai Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "unibilium.h" #include #include #include #include int main(int argc, char **argv) { if (argc < 2) { fprintf(stderr, "Usage: %s CAPNAME [PARAM...]\n", argv[0]); return 2; } unibi_term *t = unibi_from_env(); if (!t) { fprintf(stderr, "%s: %s: %s\n", argv[0], getenv("TERM"), strerror(errno)); return 3; } if (strcmp(argv[1], "longname") == 0) { printf("%s\n", unibi_get_name(t)); return 0; } for (enum unibi_boolean i = unibi_boolean_begin_ + 1; i < unibi_boolean_end_; ++i) { if ( strcmp(argv[1], unibi_name_bool(i)) == 0 || strcmp(argv[1], unibi_short_name_bool(i)) == 0 ) { if (unibi_get_bool(t, i)) { return 0; } else { return 1; } } } for (enum unibi_numeric i = unibi_numeric_begin_ + 1; i < unibi_numeric_end_; ++i) { if ( strcmp(argv[1], unibi_name_num(i)) == 0 || strcmp(argv[1], unibi_short_name_num(i)) == 0 ) { printf("%hd\n", unibi_get_num(t, i)); return 0; } } for (enum unibi_string i = unibi_string_begin_ + 1; i < unibi_string_end_; ++i) { if ( strcmp(argv[1], unibi_name_str(i)) == 0 || strcmp(argv[1], unibi_short_name_str(i)) == 0 ) { const char *fmt = unibi_get_str(t, i); if (!fmt) { return 1; } if (argc < 3) { fputs(fmt, stdout); return 0; } unibi_var_t vars[9] = {{0}}; switch (i) { #define REQ(N) do { if (argc - 2 < (N)) { fprintf(stderr, "%s: %s: missing argument\n", argv[0], argv[1]); return 4; } } while (0) case unibi_dial_phone: case unibi_quick_dial: REQ(1); vars[0] = unibi_var_from_str(argv[2]); break; case unibi_pkey_key: case unibi_pkey_local: case unibi_pkey_xmit: case unibi_plab_norm: REQ(2); vars[0] = unibi_var_from_num(atoi(argv[2])); vars[1] = unibi_var_from_str(argv[3]); break; case unibi_pkey_plab: REQ(3); vars[0] = unibi_var_from_num(atoi(argv[2])); vars[1] = unibi_var_from_str(argv[3]); vars[2] = unibi_var_from_str(argv[4]); break; default: { for (int k = 0; k + 2 < argc; ++k) { vars[k] = unibi_var_from_num(atoi(argv[k + 2])); } break; #undef REQ } } char buf[1024]; size_t r = unibi_run(fmt, vars, buf, sizeof buf); fwrite(buf, 1, r, stdout); return 0; } } fprintf(stderr, "%s: %s: unknown terminfo capability\n", argv[0], argv[1]); return 5; } unibilium-1.2.0/unibilium.c000066400000000000000000001061141256345053500156630ustar00rootroot00000000000000/* Copyright 2008, 2010, 2012, 2013, 2015 Lukas Mai. This file is part of unibilium. Unibilium is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Unibilium 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with unibilium. If not, see . */ #include "unibilium.h" #include #include #include #include #include #include #include #define ASSERT_RETURN(COND, VAL) do { \ assert(COND); \ if (!(COND)) return VAL; \ } while (0) #define ASSERT_RETURN_(COND) ASSERT_RETURN(COND, ) #define COUNTOF(a) (sizeof (a) / sizeof *(a)) #define NCONTAINERS(n, csize) (((n) - 1) / (csize) + 1u) #define SIZE_ERR ((size_t)-1) #define MAX15BITS 0x7fff #define DYNARR(W, X) DynArr_ ## W ## _ ## X #define DYNARR_T(W) DYNARR(W, t) #define DEFDYNARRAY(T, W) \ typedef struct { T (*data); size_t used, size; } DYNARR_T(W); \ static void DYNARR(W, init)(DYNARR_T(W) *const d) { \ d->data = NULL; \ d->used = d->size = 0; \ } \ static void DYNARR(W, free)(DYNARR_T(W) *const d) { \ free(d->data); \ DYNARR(W, init)(d); \ } \ static int DYNARR(W, ensure_slots)(DYNARR_T(W) *const d, const size_t n) { \ size_t k = d->size; \ while (d->used + n > k) { \ k = next_alloc(k); \ } \ if (k > d->size) { \ T (*const p) = realloc(d->data, k * sizeof *p); \ if (!p) { \ return 0; \ } \ d->data = p; \ d->size = k; \ } \ return 1; \ } \ static int DYNARR(W, ensure_slot)(DYNARR_T(W) *const d) { \ return DYNARR(W, ensure_slots)(d, 1); \ } \ static void DYNARR(W, init)(DYNARR_T(W) *) static size_t next_alloc(size_t n) { return n * 3 / 2 + 5; } DEFDYNARRAY(unsigned char, bool); DEFDYNARRAY(short, num); DEFDYNARRAY(const char *, str); enum {MAGIC = 0432}; struct unibi_term { const char *name; const char **aliases; unsigned char bools[NCONTAINERS(unibi_boolean_end_ - unibi_boolean_begin_ - 1, CHAR_BIT)]; short nums[unibi_numeric_end_ - unibi_numeric_begin_ - 1]; const char *strs[unibi_string_end_ - unibi_string_begin_ - 1]; char *alloc; DYNARR_T(bool) ext_bools; DYNARR_T(num) ext_nums; DYNARR_T(str) ext_strs; DYNARR_T(str) ext_names; char *ext_alloc; }; #define ASSERT_EXT_NAMES(X) assert((X)->ext_names.used == (X)->ext_bools.used + (X)->ext_nums.used + (X)->ext_strs.used) static unsigned short get_ushort(const char *p) { const unsigned char *q = (const unsigned char *)p; return q[0] + q[1] * 256; } static short get_short(const char *p) { unsigned short n = get_ushort(p); return n <= MAX15BITS ? n : -1; } static void fill_1(short *p, size_t n) { while (n--) { *p++ = -1; } } static void fill_null(const char **p, size_t n) { while (n--) { *p++ = NULL; } } static const char *off_of(const char *p, size_t n, short i) { return i < 0 || (size_t)i >= n ? NULL : p + i; } unibi_term *unibi_dummy(void) { unibi_term *t; if (!(t = malloc(sizeof *t))) { return NULL; } if (!(t->alloc = malloc(2 * sizeof *t->aliases))) { free(t); return NULL; } t->aliases = (const char **)t->alloc; t->name = "unibilium dummy terminal"; t->aliases[0] = "null"; t->aliases[1] = NULL; memset(t->bools, '\0', sizeof t->bools); fill_1(t->nums, COUNTOF(t->nums)); fill_null(t->strs, COUNTOF(t->strs)); DYNARR(bool, init)(&t->ext_bools); DYNARR(num, init)(&t->ext_nums); DYNARR(str, init)(&t->ext_strs); DYNARR(str, init)(&t->ext_names); t->ext_alloc = NULL; ASSERT_EXT_NAMES(t); return t; } static size_t mcount(const char *p, size_t n, char c) { size_t r = 0; while (n--) { if (*p++ == c) { r++; } } return r; } static size_t size_max(size_t a, size_t b) { return a >= b ? a : b; } #define FAIL_IF_(c, e, f) do { if (c) { f; errno = (e); return NULL; } } while (0) #define FAIL_IF(c, e) FAIL_IF_(c, e, (void)0) #define DEL_FAIL_IF(c, e, x) FAIL_IF_(c, e, unibi_destroy(x)) unibi_term *unibi_from_mem(const char *p, size_t n) { unibi_term *t = NULL; unsigned short magic, namlen, boollen, numlen, strslen, tablsz; char *strp, *namp; size_t namco; size_t i; FAIL_IF(n < 12, EFAULT); magic = get_ushort(p + 0); FAIL_IF(magic != MAGIC, EINVAL); namlen = get_ushort(p + 2); boollen = get_ushort(p + 4); numlen = get_ushort(p + 6); strslen = get_ushort(p + 8); tablsz = get_ushort(p + 10); p += 12; n -= 12; FAIL_IF(n < namlen, EFAULT); namco = mcount(p, namlen, '|') + 1; if (!(t = malloc(sizeof *t))) { return NULL; } if (!(t->alloc = malloc(namco * sizeof *t->aliases + tablsz + namlen + 1))) { free(t); return NULL; } t->aliases = (const char **)t->alloc; strp = t->alloc + namco * sizeof *t->aliases; namp = strp + tablsz; memcpy(namp, p, namlen); namp[namlen] = '\0'; p += namlen; n -= namlen; { size_t k = 0; char *a, *z; a = namp; while ((z = strchr(a, '|'))) { *z = '\0'; t->aliases[k++] = a; a = z + 1; } assert(k < namco); t->aliases[k] = NULL; t->name = a; } DYNARR(bool, init)(&t->ext_bools); DYNARR(num, init)(&t->ext_nums); DYNARR(str, init)(&t->ext_strs); DYNARR(str, init)(&t->ext_names); t->ext_alloc = NULL; DEL_FAIL_IF(n < boollen, EFAULT, t); memset(t->bools, '\0', sizeof t->bools); for (i = 0; i < boollen && i / CHAR_BIT < COUNTOF(t->bools); i++) { if (p[i]) { t->bools[i / CHAR_BIT] |= 1 << i % CHAR_BIT; } } p += boollen; n -= boollen; if ((namlen + boollen) % 2 && n > 0) { p += 1; n -= 1; } DEL_FAIL_IF(n < numlen * 2u, EFAULT, t); for (i = 0; i < numlen && i < COUNTOF(t->nums); i++) { t->nums[i] = get_short(p + i * 2); } fill_1(t->nums + i, COUNTOF(t->nums) - i); p += numlen * 2; n -= numlen * 2; DEL_FAIL_IF(n < strslen * 2u, EFAULT, t); for (i = 0; i < strslen && i < COUNTOF(t->strs); i++) { t->strs[i] = off_of(strp, tablsz, get_short(p + i * 2)); } fill_null(t->strs + i, COUNTOF(t->strs) - i); p += strslen * 2; n -= strslen * 2; DEL_FAIL_IF(n < tablsz, EFAULT, t); memcpy(strp, p, tablsz); if (tablsz) { strp[tablsz - 1] = '\0'; } p += tablsz; n -= tablsz; if (tablsz % 2 && n > 0) { p += 1; n -= 1; } if (n >= 10) { unsigned short extboollen, extnumlen, extstrslen, extofflen, exttablsz; size_t extalllen; extboollen = get_ushort(p + 0); extnumlen = get_ushort(p + 2); extstrslen = get_ushort(p + 4); extofflen = get_ushort(p + 6); exttablsz = get_ushort(p + 8); if ( extboollen <= MAX15BITS && extnumlen <= MAX15BITS && extstrslen <= MAX15BITS && extofflen <= MAX15BITS && exttablsz <= MAX15BITS ) { p += 10; n -= 10; extalllen = 0; extalllen += extboollen; extalllen += extnumlen; extalllen += extstrslen; DEL_FAIL_IF(extofflen != extalllen + extstrslen, EINVAL, t); DEL_FAIL_IF( n < extboollen + extboollen % 2 + extnumlen * 2 + extstrslen * 2 + extalllen * 2 + exttablsz, EFAULT, t ); DEL_FAIL_IF( !DYNARR(bool, ensure_slots)(&t->ext_bools, extboollen) || !DYNARR(num, ensure_slots)(&t->ext_nums, extnumlen) || !DYNARR(str, ensure_slots)(&t->ext_strs, extstrslen) || !DYNARR(str, ensure_slots)(&t->ext_names, extalllen) || (exttablsz && !(t->ext_alloc = malloc(exttablsz))), ENOMEM, t ); for (i = 0; i < extboollen; i++) { t->ext_bools.data[i] = !!p[i]; } t->ext_bools.used = extboollen; p += extboollen; n -= extboollen; if (extboollen % 2) { p += 1; n -= 1; } for (i = 0; i < extnumlen; i++) { t->ext_nums.data[i] = get_short(p + i * 2); } t->ext_nums.used = extnumlen; p += extnumlen * 2; n -= extnumlen * 2; { char *ext_alloc2; size_t tblsz2; const char *const tbl1 = p + extstrslen * 2 + extalllen * 2; size_t s_max = 0, s_sum = 0; for (i = 0; i < extstrslen; i++) { const short v = get_short(p + i * 2); if (v < 0 || (unsigned short)v >= exttablsz) { t->ext_strs.data[i] = NULL; } else { const char *start = tbl1 + v; const char *end = memchr(start, '\0', exttablsz - v); if (end) { end++; } else { end = tbl1 + exttablsz; } s_sum += end - start; s_max = size_max(s_max, end - tbl1); t->ext_strs.data[i] = t->ext_alloc + v; } } t->ext_strs.used = extstrslen; p += extstrslen * 2; n -= extstrslen * 2; DEL_FAIL_IF(s_max != s_sum, EINVAL, t); ext_alloc2 = t->ext_alloc + s_sum; tblsz2 = exttablsz - s_sum; for (i = 0; i < extalllen; i++) { const short v = get_short(p + i * 2); DEL_FAIL_IF(v < 0 || (unsigned short)v >= tblsz2, EINVAL, t); t->ext_names.data[i] = ext_alloc2 + v; } t->ext_names.used = extalllen; p += extalllen * 2; n -= extalllen * 2; assert(p == tbl1); if (exttablsz) { memcpy(t->ext_alloc, p, exttablsz); t->ext_alloc[exttablsz - 1] = '\0'; p += exttablsz; n -= exttablsz; } } } } ASSERT_EXT_NAMES(t); return t; } #undef FAIL_IF #undef FAIL_IF_ #undef DEL_FAIL_IF void unibi_destroy(unibi_term *t) { DYNARR(bool, free)(&t->ext_bools); DYNARR(num, free)(&t->ext_nums); DYNARR(str, free)(&t->ext_strs); DYNARR(str, free)(&t->ext_names); free(t->ext_alloc); t->ext_alloc = (char *)">_>"; t->aliases = NULL; free(t->alloc); t->alloc = (char *)":-O"; free(t); } static void put_ushort(char *p, unsigned short n) { unsigned char *q = (unsigned char *)p; q[0] = n % 256; q[1] = n / 256 % 256; } static void put_short(char *p, short n) { put_ushort( p, n < 0 #if MAX15BITS < SHRT_MAX || n > MAX15BITS #endif ? 0xffffU : (unsigned short)n ); } #define FAIL_INVAL_IF(c) if (c) { errno = EINVAL; return SIZE_ERR; } else (void)0 size_t unibi_dump(const unibi_term *t, char *ptr, size_t n) { size_t req, i; size_t namlen, boollen, numlen, strslen, tablsz; size_t ext_count, ext_tablsz1, ext_tablsz2; char *p; ASSERT_EXT_NAMES(t); p = ptr; req = 2 + 5 * 2; namlen = strlen(t->name) + 1; for (i = 0; t->aliases[i]; i++) { namlen += strlen(t->aliases[i]) + 1; } req += namlen; for (i = unibi_boolean_end_ - unibi_boolean_begin_ - 1; i--; ) { if (t->bools[i / CHAR_BIT] >> i % CHAR_BIT & 1) { break; } } i++; boollen = i; req += boollen; if (req % 2) { req += 1; } for (i = COUNTOF(t->nums); i--; ) { if (t->nums[i] >= 0) { break; } } i++; numlen = i; req += numlen * 2; for (i = COUNTOF(t->strs); i--; ) { if (t->strs[i]) { break; } } i++; strslen = i; req += strslen * 2; tablsz = 0; while (i--) { if (t->strs[i]) { tablsz += strlen(t->strs[i]) + 1; } } req += tablsz; FAIL_INVAL_IF(tablsz > MAX15BITS); FAIL_INVAL_IF(t->ext_bools.used > MAX15BITS); FAIL_INVAL_IF(t->ext_nums.used > MAX15BITS); FAIL_INVAL_IF(t->ext_strs.used > MAX15BITS); ext_tablsz1 = ext_tablsz2 = 0; ext_count = t->ext_bools.used + t->ext_nums.used + t->ext_strs.used; assert(ext_count == t->ext_names.used); if (ext_count) { if (req % 2) { req += 1; } req += 5 * 2; req += t->ext_bools.used; if (req % 2) { req += 1; } req += t->ext_nums.used * 2; req += t->ext_strs.used * 2; req += ext_count * 2; for (i = 0; i < t->ext_strs.used; i++) { if (t->ext_strs.data[i]) { ext_tablsz1 += strlen(t->ext_strs.data[i]) + 1; } } FAIL_INVAL_IF(ext_tablsz1 > MAX15BITS); req += ext_tablsz1; for (i = 0; i < t->ext_names.used; i++) { ext_tablsz2 += strlen(t->ext_names.data[i]) + 1; } FAIL_INVAL_IF(ext_tablsz2 > MAX15BITS); req += ext_tablsz2; FAIL_INVAL_IF(ext_tablsz1 + ext_tablsz2 > MAX15BITS); } if (req > n) { errno = EFAULT; return req; } put_ushort(p + 0, MAGIC); put_ushort(p + 2, namlen); put_ushort(p + 4, boollen); put_ushort(p + 6, numlen); put_ushort(p + 8, strslen); put_ushort(p + 10, tablsz); p += 12; for (i = 0; t->aliases[i]; i++) { size_t k = strlen(t->aliases[i]); memcpy(p, t->aliases[i], k); p += k; *p++ = '|'; } { size_t k = strlen(t->name) + 1; memcpy(p, t->name, k); p += k; } for (i = 0; i < boollen; i++) { *p++ = t->bools[i / CHAR_BIT] >> i % CHAR_BIT & 1; } if ((namlen + boollen) % 2) { *p++ = '\0'; } for (i = 0; i < numlen; i++) { put_short(p, t->nums[i]); p += 2; } { char *const tbl = p + strslen * 2; size_t off = 0; for (i = 0; i < strslen; i++) { if (!t->strs[i]) { put_short(p, -1); p += 2; } else { size_t k = strlen(t->strs[i]) + 1; assert(off < MAX15BITS); put_short(p, (short)off); p += 2; memcpy(tbl + off, t->strs[i], k); off += k; } } assert(off == tablsz); assert(p == tbl); p += off; } if (ext_count) { if ((p - ptr) % 2) { *p++ = '\0'; } put_ushort(p + 0, t->ext_bools.used); put_ushort(p + 2, t->ext_nums.used); put_ushort(p + 4, t->ext_strs.used); put_ushort(p + 6, t->ext_strs.used + ext_count); put_ushort(p + 8, ext_tablsz1 + ext_tablsz2); p += 10; memcpy(p, t->ext_bools.data, t->ext_bools.used); p += t->ext_bools.used; if (t->ext_bools.used % 2) { *p++ = '\0'; } for (i = 0; i < t->ext_nums.used; i++) { put_short(p, t->ext_nums.data[i]); p += 2; } { char *const tbl1 = p + (t->ext_strs.used + ext_count) * 2; char *const tbl2 = tbl1 + ext_tablsz1; size_t off = 0; for (i = 0; i < t->ext_strs.used; i++) { const char *const s = t->ext_strs.data[i]; if (!s) { put_short(p, -1); } else { const size_t k = strlen(s) + 1; assert(off < MAX15BITS); put_ushort(p, off); memcpy(tbl1 + off, s, k); off += k; } p += 2; } assert(off == ext_tablsz1); assert(p + ext_count * 2 == tbl1); off = 0; for (i = 0; i < t->ext_names.used; i++) { const char *const s = t->ext_names.data[i]; const size_t k = strlen(s) + 1; assert(off < MAX15BITS); put_ushort(p, off); p += 2; memcpy(tbl2 + off, s, k); off += k; } assert(off == ext_tablsz2); assert(p == tbl1); p += ext_tablsz1 + ext_tablsz2; } } assert((size_t)(p - ptr) == req); return req; } const char *unibi_get_name(const unibi_term *t) { return t->name; } void unibi_set_name(unibi_term *t, const char *s) { t->name = s; } const char **unibi_get_aliases(const unibi_term *t) { return t->aliases; } void unibi_set_aliases(unibi_term *t, const char **a) { t->aliases = a; } int unibi_get_bool(const unibi_term *t, enum unibi_boolean v) { size_t i; ASSERT_RETURN(v > unibi_boolean_begin_ && v < unibi_boolean_end_, -1); i = v - unibi_boolean_begin_ - 1; return t->bools[i / CHAR_BIT] >> i % CHAR_BIT & 1; } void unibi_set_bool(unibi_term *t, enum unibi_boolean v, int x) { size_t i; ASSERT_RETURN_(v > unibi_boolean_begin_ && v < unibi_boolean_end_); i = v - unibi_boolean_begin_ - 1; if (x) { t->bools[i / CHAR_BIT] |= 1 << i % CHAR_BIT; } else { t->bools[i / CHAR_BIT] &= ~(1 << i % CHAR_BIT); } } short unibi_get_num(const unibi_term *t, enum unibi_numeric v) { size_t i; ASSERT_RETURN(v > unibi_numeric_begin_ && v < unibi_numeric_end_, -2); i = v - unibi_numeric_begin_ - 1; return t->nums[i]; } void unibi_set_num(unibi_term *t, enum unibi_numeric v, short x) { size_t i; ASSERT_RETURN_(v > unibi_numeric_begin_ && v < unibi_numeric_end_); i = v - unibi_numeric_begin_ - 1; t->nums[i] = x; } const char *unibi_get_str(const unibi_term *t, enum unibi_string v) { size_t i; ASSERT_RETURN(v > unibi_string_begin_ && v < unibi_string_end_, NULL); i = v - unibi_string_begin_ - 1; return t->strs[i]; } void unibi_set_str(unibi_term *t, enum unibi_string v, const char *x) { size_t i; ASSERT_RETURN_(v > unibi_string_begin_ && v < unibi_string_end_); i = v - unibi_string_begin_ - 1; t->strs[i] = x; } size_t unibi_count_ext_bool(const unibi_term *t) { return t->ext_bools.used; } size_t unibi_count_ext_num(const unibi_term *t) { return t->ext_nums.used; } size_t unibi_count_ext_str(const unibi_term *t) { return t->ext_strs.used; } int unibi_get_ext_bool(const unibi_term *t, size_t i) { ASSERT_RETURN(i < t->ext_bools.used, -1); return t->ext_bools.data[i] ? 1 : 0; } const char *unibi_get_ext_bool_name(const unibi_term *t, size_t i) { ASSERT_EXT_NAMES(t); ASSERT_RETURN(i < t->ext_bools.used, NULL); return t->ext_names.data[i]; } short unibi_get_ext_num(const unibi_term *t, size_t i) { ASSERT_RETURN(i < t->ext_nums.used, -2); return t->ext_nums.data[i]; } const char *unibi_get_ext_num_name(const unibi_term *t, size_t i) { ASSERT_EXT_NAMES(t); ASSERT_RETURN(i < t->ext_nums.used, NULL); return t->ext_names.data[t->ext_bools.used + i]; } const char *unibi_get_ext_str(const unibi_term *t, size_t i) { ASSERT_RETURN(i < t->ext_strs.used, NULL); return t->ext_strs.data[i]; } const char *unibi_get_ext_str_name(const unibi_term *t, size_t i) { ASSERT_EXT_NAMES(t); ASSERT_RETURN(i < t->ext_strs.used, NULL); return t->ext_names.data[t->ext_bools.used + t->ext_nums.used + i]; } void unibi_set_ext_bool(unibi_term *t, size_t i, int v) { ASSERT_RETURN_(i < t->ext_bools.used); t->ext_bools.data[i] = !!v; } void unibi_set_ext_bool_name(unibi_term *t, size_t i, const char *c) { ASSERT_EXT_NAMES(t); ASSERT_RETURN_(i < t->ext_bools.used); t->ext_names.data[i] = c; } void unibi_set_ext_num(unibi_term *t, size_t i, short v) { ASSERT_RETURN_(i < t->ext_nums.used); t->ext_nums.data[i] = v; } void unibi_set_ext_num_name(unibi_term *t, size_t i, const char *c) { ASSERT_EXT_NAMES(t); ASSERT_RETURN_(i < t->ext_nums.used); t->ext_names.data[t->ext_bools.used + i] = c; } void unibi_set_ext_str(unibi_term *t, size_t i, const char *v) { ASSERT_RETURN_(i < t->ext_strs.used); t->ext_strs.data[i] = v; } void unibi_set_ext_str_name(unibi_term *t, size_t i, const char *c) { ASSERT_EXT_NAMES(t); ASSERT_RETURN_(i < t->ext_strs.used); t->ext_names.data[t->ext_bools.used + t->ext_nums.used + i] = c; } size_t unibi_add_ext_bool(unibi_term *t, const char *c, int v) { size_t r; ASSERT_EXT_NAMES(t); if ( !DYNARR(bool, ensure_slot)(&t->ext_bools) || !DYNARR(str, ensure_slot)(&t->ext_names) ) { return SIZE_ERR; } { const char **const p = t->ext_names.data + t->ext_bools.used; memmove(p + 1, p, (t->ext_names.used - t->ext_bools.used) * sizeof *t->ext_names.data); *p = c; t->ext_names.used++; } r = t->ext_bools.used++; t->ext_bools.data[r] = !!v; return r; } size_t unibi_add_ext_num(unibi_term *t, const char *c, short v) { size_t r; ASSERT_EXT_NAMES(t); if ( !DYNARR(num, ensure_slot)(&t->ext_nums) || !DYNARR(str, ensure_slot)(&t->ext_names) ) { return SIZE_ERR; } { const char **const p = t->ext_names.data + t->ext_bools.used + t->ext_nums.used; memmove(p + 1, p, (t->ext_names.used - t->ext_bools.used - t->ext_nums.used) * sizeof *t->ext_names.data); *p = c; t->ext_names.used++; } r = t->ext_nums.used++; t->ext_nums.data[r] = v; return r; } size_t unibi_add_ext_str(unibi_term *t, const char *c, const char *v) { size_t r; ASSERT_EXT_NAMES(t); if ( !DYNARR(str, ensure_slot)(&t->ext_strs) || !DYNARR(str, ensure_slot)(&t->ext_names) ) { return SIZE_ERR; } t->ext_names.data[t->ext_names.used++] = c; r = t->ext_strs.used++; t->ext_strs.data[r] = v; return r; } void unibi_del_ext_bool(unibi_term *t, size_t i) { ASSERT_EXT_NAMES(t); ASSERT_RETURN_(i < t->ext_bools.used); { unsigned char *const p = t->ext_bools.data + i; memmove(p, p + 1, (t->ext_bools.used - i - 1) * sizeof *t->ext_bools.data); t->ext_bools.used--; } { const char **const p = t->ext_names.data + i; memmove(p, p + 1, (t->ext_names.used - i - 1) * sizeof *t->ext_names.data); t->ext_names.used--; } } void unibi_del_ext_num(unibi_term *t, size_t i) { ASSERT_EXT_NAMES(t); ASSERT_RETURN_(i < t->ext_nums.used); { short *const p = t->ext_nums.data + i; memmove(p, p + 1, (t->ext_nums.used - i - 1) * sizeof *t->ext_nums.data); t->ext_nums.used--; } { const char **const p = t->ext_names.data + t->ext_bools.used + i; memmove(p, p + 1, (t->ext_names.used - i - 1) * sizeof *t->ext_names.data); t->ext_names.used--; } } void unibi_del_ext_str(unibi_term *t, size_t i) { ASSERT_EXT_NAMES(t); ASSERT_RETURN_(i < t->ext_strs.used); { const char **const p = t->ext_strs.data + i; memmove(p, p + 1, (t->ext_strs.used - i - 1) * sizeof *t->ext_strs.data); t->ext_strs.used--; } { const char **const p = t->ext_names.data + t->ext_bools.used + t->ext_nums.used + i; memmove(p, p + 1, (t->ext_names.used - i - 1) * sizeof *t->ext_names.data); t->ext_names.used--; } } unibi_var_t unibi_var_from_num(int i) { unibi_var_t v; v.i = i; return v; } unibi_var_t unibi_var_from_str(char *p) { unibi_var_t v; assert(p != NULL); v.p = p; return v; } int unibi_num_from_var(unibi_var_t v) { return v.i; } const char *unibi_str_from_var(unibi_var_t v) { return v.p; } static void dput( char t, const char *fmt, int w, int p, unibi_var_t x, void (*out)(void *, const char *, size_t), void *ctx ) { char buf[512]; buf[0] = '\0'; #define BITTY(A, B, C) (!!(A) << 0 | !!(B) << 1 | !!(C) << 2) switch (BITTY(t == 's', w != -1, p != -1)) { case BITTY(0, 0, 0): snprintf(buf, sizeof buf, fmt, unibi_num_from_var(x)); break; case BITTY(0, 0, 1): snprintf(buf, sizeof buf, fmt, p, unibi_num_from_var(x)); break; case BITTY(0, 1, 0): snprintf(buf, sizeof buf, fmt, w, unibi_num_from_var(x)); break; case BITTY(0, 1, 1): snprintf(buf, sizeof buf, fmt, w, p, unibi_num_from_var(x)); break; case BITTY(1, 0, 0): snprintf(buf, sizeof buf, fmt, unibi_str_from_var(x)); break; case BITTY(1, 0, 1): snprintf(buf, sizeof buf, fmt, p, unibi_str_from_var(x)); break; case BITTY(1, 1, 0): snprintf(buf, sizeof buf, fmt, w, unibi_str_from_var(x)); break; case BITTY(1, 1, 1): snprintf(buf, sizeof buf, fmt, w, p, unibi_str_from_var(x)); break; } #undef BITTY out(ctx, buf, strlen(buf)); } static long cstrtol(const char *s, const char **pp) { long r; char *tmp; r = strtol(s, &tmp, 10); *pp = tmp; return r; } void unibi_format( unibi_var_t var_dyn[26], unibi_var_t var_static[26], const char *fmt, unibi_var_t param[9], void (*out)(void *, const char *, size_t), void *ctx1, void (*pad)(void *, size_t, int, int), void *ctx2 ) { const unibi_var_t zero = {0}; unibi_var_t stack[123] = {{0}}; size_t sp = 0; #define UC(F, C) (F((unsigned char)(C))) #define POP() (sp ? stack[--sp] : zero) #define PUSH(X) do { if (sp < COUNTOF(stack)) { stack[sp++] = (X); } } while (0) #define PUSHi(N) do { unibi_var_t tmp_ = unibi_var_from_num(N); PUSH(tmp_); } while (0) while (*fmt) { { size_t r = strcspn(fmt, "%$"); if (r) { out(ctx1, fmt, r); fmt += r; if (!*fmt) { break; } } } if (*fmt == '$') { ++fmt; if (*fmt == '<' && UC(isdigit, fmt[1])) { int scale = 0, force = 0; const char *v = fmt + 1; size_t n = cstrtol(v, &v); n *= 10; if (*v == '.') { ++v; } if (UC(isdigit, *v)) { n += *v++ - '0'; } if (*v == '/') { ++v; force = 1; if (*v == '*') { ++v; scale = 1; } } else if (*v == '*') { ++v; scale = 1; if (*v == '/') { ++v; force = 1; } } if (*v == '>') { fmt = v + 1; if (pad) { pad(ctx2, n, scale, force); } } else { out(ctx1, fmt - 1, 1); } } else { out(ctx1, fmt - 1, 1); } continue; } assert(*fmt == '%'); ++fmt; if (UC(isdigit, *fmt) || (*fmt && strchr(":# .doxX", *fmt))) { enum { FlagAlt = 1, FlagSpc = 2, FlagSgn = 4, FlagLft = 8, FlagZro = 16 }; int flags = 0, width = -1, prec = -1; const char *v = fmt; if (*v == ':') { ++v; } while (1) { switch (*v++) { case '#': flags |= FlagAlt; continue; case ' ': flags |= FlagSpc; continue; case '0': flags |= FlagZro; continue; case '+': flags |= FlagSgn; continue; case '-': flags |= FlagLft; continue; } --v; break; } if (UC(isdigit, *v)) { width = cstrtol(v, &v); } if (*v == '.' && UC(isdigit, v[1])) { ++v; prec = cstrtol(v, &v); } if (*v && strchr("doxXs", *v)) { char gen[sizeof "%# +-0*.*d"], *g = gen; *g++ = '%'; if (flags & FlagAlt) { *g++ = '#'; } if (flags & FlagSpc) { *g++ = ' '; } if (flags & FlagSgn) { *g++ = '+'; } if (flags & FlagLft) { *g++ = '-'; } if (flags & FlagZro) { *g++ = '0'; } if (width != -1) { *g++ = '*'; } if (prec != -1) { *g++ = '.'; *g++ = '*'; } *g++ = *v; *g = '\0'; dput(*v, gen, width, prec, POP(), out, ctx1); fmt = v; } else { out(ctx1, fmt - 1, 2); } ++fmt; continue; } switch (*fmt++) { default: out(ctx1, fmt - 2, 2); break; case '\0': --fmt; out(ctx1, "%", 1); break; case '%': out(ctx1, "%", 1); break; case 'c': { unsigned char c; c = unibi_num_from_var(POP()); out(ctx1, (const char *)&c, 1); break; } case 's': { const char *s; s = unibi_str_from_var(POP()); out(ctx1, s, strlen(s)); break; } case 'p': if (*fmt >= '1' && *fmt <= '9') { size_t n = *fmt++ - '1'; PUSH(param[n]); } else { out(ctx1, fmt - 2, 2); } break; case 'P': if (*fmt >= 'a' && *fmt <= 'z') { var_dyn[*fmt - 'a'] = POP(); fmt++; } else if (*fmt >= 'A' && *fmt <= 'Z') { var_static[*fmt - 'A'] = POP(); fmt++; } else { out(ctx1, fmt - 2, 2); } break; case 'g': if (*fmt >= 'a' && *fmt <= 'z') { PUSH(var_dyn[*fmt - 'a']); fmt++; } else if (*fmt >= 'A' && *fmt <= 'Z') { PUSH(var_static[*fmt - 'A']); fmt++; } else { out(ctx1, fmt - 2, 2); } break; case '\'': if (*fmt && fmt[1] == '\'') { PUSHi((unsigned char)*fmt); fmt += 2; } else { out(ctx1, fmt - 2, 2); } break; case '{': { size_t r = strspn(fmt, "0123456789"); if (r && fmt[r] == '}') { PUSHi(atoi(fmt)); fmt += r + 1; } else { out(ctx1, fmt - 2, 2); } break; } case 'l': PUSHi(strlen(unibi_str_from_var(POP()))); break; case 'i': param[0] = unibi_var_from_num(unibi_num_from_var(param[0]) + 1); param[1] = unibi_var_from_num(unibi_num_from_var(param[1]) + 1); break; case '?': break; case 't': { int c = unibi_num_from_var(POP()); if (!c) { size_t nesting = 0; for (; *fmt; ++fmt) { if (*fmt == '%') { ++fmt; if (*fmt == '?') { ++nesting; } else if (*fmt == ';') { if (!nesting) { ++fmt; break; } --nesting; } else if (*fmt == 'e' && !nesting) { ++fmt; break; } else if (!*fmt) { break; } } } } break; } case 'e': { size_t nesting = 0; for (; *fmt; ++fmt) { if (*fmt == '%') { ++fmt; if (*fmt == '?') { ++nesting; } else if (*fmt == ';') { if (!nesting) { ++fmt; break; } --nesting; } else if (!*fmt) { break; } } } break; } case ';': break; #define ARITH2(C, O) \ case (C): { \ unibi_var_t x, y; \ y = POP(); \ x = POP(); \ PUSHi(unibi_num_from_var(x) O unibi_num_from_var(y)); \ } break ARITH2('+', +); ARITH2('-', -); ARITH2('*', *); ARITH2('/', /); ARITH2('m', %); ARITH2('&', &); ARITH2('|', |); ARITH2('^', ^); ARITH2('=', ==); ARITH2('<', <); ARITH2('>', >); ARITH2('A', &&); ARITH2('O', ||); #undef ARITH2 #define ARITH1(C, O) \ case (C): \ PUSHi(O unibi_num_from_var(POP())); \ break ARITH1('!', !); ARITH1('~', ~); #undef ARITH1 } } #undef PUSHi #undef PUSH #undef POP #undef UC } typedef struct { char *p; size_t n, w; } run_ctx_t; static size_t xmin(size_t a, size_t b) { return a < b ? a : b; } static void out(void *vctx, const char *p, size_t n) { run_ctx_t *ctx = vctx; size_t k = xmin(n, ctx->n); ctx->w += n; memcpy(ctx->p, p, k); ctx->p += k; ctx->n -= k; } size_t unibi_run(const char *fmt, unibi_var_t param[9], char *p, size_t n) { unibi_var_t vars[26 + 26] = {{0}}; run_ctx_t ctx; ctx.p = p; ctx.n = n; ctx.w = 0; unibi_format(vars, vars + 26, fmt, param, out, &ctx, NULL, NULL); return ctx.w; } unibilium-1.2.0/unibilium.h000066400000000000000000000372241256345053500156750ustar00rootroot00000000000000#ifndef GUARD_UNIBILIUM_H_ #define GUARD_UNIBILIUM_H_ /* Copyright 2008, 2010-2013, 2015 Lukas Mai. This file is part of unibilium. Unibilium is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Unibilium 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with unibilium. If not, see . */ #include enum unibi_boolean { unibi_boolean_begin_, unibi_auto_left_margin, unibi_auto_right_margin, unibi_no_esc_ctlc, unibi_ceol_standout_glitch, unibi_eat_newline_glitch, unibi_erase_overstrike, unibi_generic_type, unibi_hard_copy, unibi_has_meta_key, unibi_has_status_line, unibi_insert_null_glitch, unibi_memory_above, unibi_memory_below, unibi_move_insert_mode, unibi_move_standout_mode, unibi_over_strike, unibi_status_line_esc_ok, unibi_dest_tabs_magic_smso, unibi_tilde_glitch, unibi_transparent_underline, unibi_xon_xoff, unibi_needs_xon_xoff, unibi_prtr_silent, unibi_hard_cursor, unibi_non_rev_rmcup, unibi_no_pad_char, unibi_non_dest_scroll_region, unibi_can_change, unibi_back_color_erase, unibi_hue_lightness_saturation, unibi_col_addr_glitch, unibi_cr_cancels_micro_mode, unibi_has_print_wheel, unibi_row_addr_glitch, unibi_semi_auto_right_margin, unibi_cpi_changes_res, unibi_lpi_changes_res, unibi_backspaces_with_bs, unibi_crt_no_scrolling, unibi_no_correctly_working_cr, unibi_gnu_has_meta_key, unibi_linefeed_is_newline, unibi_has_hardware_tabs, unibi_return_does_clr_eol, unibi_boolean_end_ }; enum unibi_numeric { unibi_numeric_begin_ = unibi_boolean_end_, unibi_columns, unibi_init_tabs, unibi_lines, unibi_lines_of_memory, unibi_magic_cookie_glitch, unibi_padding_baud_rate, unibi_virtual_terminal, unibi_width_status_line, unibi_num_labels, unibi_label_height, unibi_label_width, unibi_max_attributes, unibi_maximum_windows, unibi_max_colors, unibi_max_pairs, unibi_no_color_video, unibi_buffer_capacity, unibi_dot_vert_spacing, unibi_dot_horz_spacing, unibi_max_micro_address, unibi_max_micro_jump, unibi_micro_col_size, unibi_micro_line_size, unibi_number_of_pins, unibi_output_res_char, unibi_output_res_line, unibi_output_res_horz_inch, unibi_output_res_vert_inch, unibi_print_rate, unibi_wide_char_size, unibi_buttons, unibi_bit_image_entwining, unibi_bit_image_type, unibi_magic_cookie_glitch_ul, unibi_carriage_return_delay, unibi_new_line_delay, unibi_backspace_delay, unibi_horizontal_tab_delay, unibi_number_of_function_keys, unibi_numeric_end_ }; enum unibi_string { unibi_string_begin_ = unibi_numeric_end_, unibi_back_tab, unibi_bell, unibi_carriage_return, unibi_change_scroll_region, unibi_clear_all_tabs, unibi_clear_screen, unibi_clr_eol, unibi_clr_eos, unibi_column_address, unibi_command_character, unibi_cursor_address, unibi_cursor_down, unibi_cursor_home, unibi_cursor_invisible, unibi_cursor_left, unibi_cursor_mem_address, unibi_cursor_normal, unibi_cursor_right, unibi_cursor_to_ll, unibi_cursor_up, unibi_cursor_visible, unibi_delete_character, unibi_delete_line, unibi_dis_status_line, unibi_down_half_line, unibi_enter_alt_charset_mode, unibi_enter_blink_mode, unibi_enter_bold_mode, unibi_enter_ca_mode, unibi_enter_delete_mode, unibi_enter_dim_mode, unibi_enter_insert_mode, unibi_enter_secure_mode, unibi_enter_protected_mode, unibi_enter_reverse_mode, unibi_enter_standout_mode, unibi_enter_underline_mode, unibi_erase_chars, unibi_exit_alt_charset_mode, unibi_exit_attribute_mode, unibi_exit_ca_mode, unibi_exit_delete_mode, unibi_exit_insert_mode, unibi_exit_standout_mode, unibi_exit_underline_mode, unibi_flash_screen, unibi_form_feed, unibi_from_status_line, unibi_init_1string, unibi_init_2string, unibi_init_3string, unibi_init_file, unibi_insert_character, unibi_insert_line, unibi_insert_padding, unibi_key_backspace, unibi_key_catab, unibi_key_clear, unibi_key_ctab, unibi_key_dc, unibi_key_dl, unibi_key_down, unibi_key_eic, unibi_key_eol, unibi_key_eos, unibi_key_f0, unibi_key_f1, unibi_key_f10, unibi_key_f2, unibi_key_f3, unibi_key_f4, unibi_key_f5, unibi_key_f6, unibi_key_f7, unibi_key_f8, unibi_key_f9, unibi_key_home, unibi_key_ic, unibi_key_il, unibi_key_left, unibi_key_ll, unibi_key_npage, unibi_key_ppage, unibi_key_right, unibi_key_sf, unibi_key_sr, unibi_key_stab, unibi_key_up, unibi_keypad_local, unibi_keypad_xmit, unibi_lab_f0, unibi_lab_f1, unibi_lab_f10, unibi_lab_f2, unibi_lab_f3, unibi_lab_f4, unibi_lab_f5, unibi_lab_f6, unibi_lab_f7, unibi_lab_f8, unibi_lab_f9, unibi_meta_off, unibi_meta_on, unibi_newline, unibi_pad_char, unibi_parm_dch, unibi_parm_delete_line, unibi_parm_down_cursor, unibi_parm_ich, unibi_parm_index, unibi_parm_insert_line, unibi_parm_left_cursor, unibi_parm_right_cursor, unibi_parm_rindex, unibi_parm_up_cursor, unibi_pkey_key, unibi_pkey_local, unibi_pkey_xmit, unibi_print_screen, unibi_prtr_off, unibi_prtr_on, unibi_repeat_char, unibi_reset_1string, unibi_reset_2string, unibi_reset_3string, unibi_reset_file, unibi_restore_cursor, unibi_row_address, unibi_save_cursor, unibi_scroll_forward, unibi_scroll_reverse, unibi_set_attributes, unibi_set_tab, unibi_set_window, unibi_tab, unibi_to_status_line, unibi_underline_char, unibi_up_half_line, unibi_init_prog, unibi_key_a1, unibi_key_a3, unibi_key_b2, unibi_key_c1, unibi_key_c3, unibi_prtr_non, unibi_char_padding, unibi_acs_chars, unibi_plab_norm, unibi_key_btab, unibi_enter_xon_mode, unibi_exit_xon_mode, unibi_enter_am_mode, unibi_exit_am_mode, unibi_xon_character, unibi_xoff_character, unibi_ena_acs, unibi_label_on, unibi_label_off, unibi_key_beg, unibi_key_cancel, unibi_key_close, unibi_key_command, unibi_key_copy, unibi_key_create, unibi_key_end, unibi_key_enter, unibi_key_exit, unibi_key_find, unibi_key_help, unibi_key_mark, unibi_key_message, unibi_key_move, unibi_key_next, unibi_key_open, unibi_key_options, unibi_key_previous, unibi_key_print, unibi_key_redo, unibi_key_reference, unibi_key_refresh, unibi_key_replace, unibi_key_restart, unibi_key_resume, unibi_key_save, unibi_key_suspend, unibi_key_undo, unibi_key_sbeg, unibi_key_scancel, unibi_key_scommand, unibi_key_scopy, unibi_key_screate, unibi_key_sdc, unibi_key_sdl, unibi_key_select, unibi_key_send, unibi_key_seol, unibi_key_sexit, unibi_key_sfind, unibi_key_shelp, unibi_key_shome, unibi_key_sic, unibi_key_sleft, unibi_key_smessage, unibi_key_smove, unibi_key_snext, unibi_key_soptions, unibi_key_sprevious, unibi_key_sprint, unibi_key_sredo, unibi_key_sreplace, unibi_key_sright, unibi_key_srsume, unibi_key_ssave, unibi_key_ssuspend, unibi_key_sundo, unibi_req_for_input, unibi_key_f11, unibi_key_f12, unibi_key_f13, unibi_key_f14, unibi_key_f15, unibi_key_f16, unibi_key_f17, unibi_key_f18, unibi_key_f19, unibi_key_f20, unibi_key_f21, unibi_key_f22, unibi_key_f23, unibi_key_f24, unibi_key_f25, unibi_key_f26, unibi_key_f27, unibi_key_f28, unibi_key_f29, unibi_key_f30, unibi_key_f31, unibi_key_f32, unibi_key_f33, unibi_key_f34, unibi_key_f35, unibi_key_f36, unibi_key_f37, unibi_key_f38, unibi_key_f39, unibi_key_f40, unibi_key_f41, unibi_key_f42, unibi_key_f43, unibi_key_f44, unibi_key_f45, unibi_key_f46, unibi_key_f47, unibi_key_f48, unibi_key_f49, unibi_key_f50, unibi_key_f51, unibi_key_f52, unibi_key_f53, unibi_key_f54, unibi_key_f55, unibi_key_f56, unibi_key_f57, unibi_key_f58, unibi_key_f59, unibi_key_f60, unibi_key_f61, unibi_key_f62, unibi_key_f63, unibi_clr_bol, unibi_clear_margins, unibi_set_left_margin, unibi_set_right_margin, unibi_label_format, unibi_set_clock, unibi_display_clock, unibi_remove_clock, unibi_create_window, unibi_goto_window, unibi_hangup, unibi_dial_phone, unibi_quick_dial, unibi_tone, unibi_pulse, unibi_flash_hook, unibi_fixed_pause, unibi_wait_tone, unibi_user0, unibi_user1, unibi_user2, unibi_user3, unibi_user4, unibi_user5, unibi_user6, unibi_user7, unibi_user8, unibi_user9, unibi_orig_pair, unibi_orig_colors, unibi_initialize_color, unibi_initialize_pair, unibi_set_color_pair, unibi_set_foreground, unibi_set_background, unibi_change_char_pitch, unibi_change_line_pitch, unibi_change_res_horz, unibi_change_res_vert, unibi_define_char, unibi_enter_doublewide_mode, unibi_enter_draft_quality, unibi_enter_italics_mode, unibi_enter_leftward_mode, unibi_enter_micro_mode, unibi_enter_near_letter_quality, unibi_enter_normal_quality, unibi_enter_shadow_mode, unibi_enter_subscript_mode, unibi_enter_superscript_mode, unibi_enter_upward_mode, unibi_exit_doublewide_mode, unibi_exit_italics_mode, unibi_exit_leftward_mode, unibi_exit_micro_mode, unibi_exit_shadow_mode, unibi_exit_subscript_mode, unibi_exit_superscript_mode, unibi_exit_upward_mode, unibi_micro_column_address, unibi_micro_down, unibi_micro_left, unibi_micro_right, unibi_micro_row_address, unibi_micro_up, unibi_order_of_pins, unibi_parm_down_micro, unibi_parm_left_micro, unibi_parm_right_micro, unibi_parm_up_micro, unibi_select_char_set, unibi_set_bottom_margin, unibi_set_bottom_margin_parm, unibi_set_left_margin_parm, unibi_set_right_margin_parm, unibi_set_top_margin, unibi_set_top_margin_parm, unibi_start_bit_image, unibi_start_char_set_def, unibi_stop_bit_image, unibi_stop_char_set_def, unibi_subscript_characters, unibi_superscript_characters, unibi_these_cause_cr, unibi_zero_motion, unibi_char_set_names, unibi_key_mouse, unibi_mouse_info, unibi_req_mouse_pos, unibi_get_mouse, unibi_set_a_foreground, unibi_set_a_background, unibi_pkey_plab, unibi_device_type, unibi_code_set_init, unibi_set0_des_seq, unibi_set1_des_seq, unibi_set2_des_seq, unibi_set3_des_seq, unibi_set_lr_margin, unibi_set_tb_margin, unibi_bit_image_repeat, unibi_bit_image_newline, unibi_bit_image_carriage_return, unibi_color_names, unibi_define_bit_image_region, unibi_end_bit_image_region, unibi_set_color_band, unibi_set_page_length, unibi_display_pc_char, unibi_enter_pc_charset_mode, unibi_exit_pc_charset_mode, unibi_enter_scancode_mode, unibi_exit_scancode_mode, unibi_pc_term_options, unibi_scancode_escape, unibi_alt_scancode_esc, unibi_enter_horizontal_hl_mode, unibi_enter_left_hl_mode, unibi_enter_low_hl_mode, unibi_enter_right_hl_mode, unibi_enter_top_hl_mode, unibi_enter_vertical_hl_mode, unibi_set_a_attributes, unibi_set_pglen_inch, unibi_termcap_init2, unibi_termcap_reset, unibi_linefeed_if_not_lf, unibi_backspace_if_not_bs, unibi_other_non_function_keys, unibi_arrow_key_map, unibi_acs_ulcorner, unibi_acs_llcorner, unibi_acs_urcorner, unibi_acs_lrcorner, unibi_acs_ltee, unibi_acs_rtee, unibi_acs_btee, unibi_acs_ttee, unibi_acs_hline, unibi_acs_vline, unibi_acs_plus, unibi_memory_lock, unibi_memory_unlock, unibi_box_chars_1, unibi_string_end_ }; typedef struct unibi_term unibi_term; unibi_term *unibi_dummy(void); unibi_term *unibi_from_mem(const char *, size_t); void unibi_destroy(unibi_term *); size_t unibi_dump(const unibi_term *, char *, size_t); const char *unibi_get_name(const unibi_term *); void unibi_set_name(unibi_term *, const char *); const char **unibi_get_aliases(const unibi_term *); void unibi_set_aliases(unibi_term *, const char **); int unibi_get_bool(const unibi_term *, enum unibi_boolean); void unibi_set_bool(unibi_term *, enum unibi_boolean, int); short unibi_get_num(const unibi_term *, enum unibi_numeric); void unibi_set_num(unibi_term *, enum unibi_numeric, short); const char *unibi_get_str(const unibi_term *, enum unibi_string); void unibi_set_str(unibi_term *, enum unibi_string, const char *); unibi_term *unibi_from_fp(FILE *); unibi_term *unibi_from_fd(int); unibi_term *unibi_from_file(const char *); unibi_term *unibi_from_term(const char *); unibi_term *unibi_from_env(void); extern const char *const unibi_terminfo_dirs; const char *unibi_name_bool(enum unibi_boolean); const char *unibi_short_name_bool(enum unibi_boolean); const char *unibi_name_num(enum unibi_numeric); const char *unibi_short_name_num(enum unibi_numeric); const char *unibi_name_str(enum unibi_string); const char *unibi_short_name_str(enum unibi_string); size_t unibi_count_ext_bool(const unibi_term *); size_t unibi_count_ext_num(const unibi_term *); size_t unibi_count_ext_str(const unibi_term *); int unibi_get_ext_bool(const unibi_term *, size_t); short unibi_get_ext_num(const unibi_term *, size_t); const char *unibi_get_ext_str(const unibi_term *, size_t); void unibi_set_ext_bool(unibi_term *, size_t, int); void unibi_set_ext_num(unibi_term *, size_t, short); void unibi_set_ext_str(unibi_term *, size_t, const char *); const char *unibi_get_ext_bool_name(const unibi_term *, size_t); const char *unibi_get_ext_num_name(const unibi_term *, size_t); const char *unibi_get_ext_str_name(const unibi_term *, size_t); void unibi_set_ext_bool_name(unibi_term *, size_t, const char *); void unibi_set_ext_num_name(unibi_term *, size_t, const char *); void unibi_set_ext_str_name(unibi_term *, size_t, const char *); size_t unibi_add_ext_bool(unibi_term *, const char *, int); size_t unibi_add_ext_num(unibi_term *, const char *, short); size_t unibi_add_ext_str(unibi_term *, const char *, const char *); void unibi_del_ext_bool(unibi_term *, size_t); void unibi_del_ext_num(unibi_term *, size_t); void unibi_del_ext_str(unibi_term *, size_t); typedef union { int i; char *p; } unibi_var_t; unibi_var_t unibi_var_from_num(int); unibi_var_t unibi_var_from_str(char *); int unibi_num_from_var(unibi_var_t); const char *unibi_str_from_var(unibi_var_t); void unibi_format( unibi_var_t [26], unibi_var_t [26], const char *, unibi_var_t [9], void (*)(void *, const char *, size_t), void *, void (*)(void *, size_t, int, int), void * ); size_t unibi_run(const char *, unibi_var_t [9], char *, size_t); #endif /* GUARD_UNIBILIUM_H_ */ unibilium-1.2.0/unibilium.pc.in000066400000000000000000000003041256345053500164420ustar00rootroot00000000000000libdir=@LIBDIR@ includedir=@INCDIR@ version=@VERSION@ Name: unibilium Description: terminfo parser and utility functions Version: ${version} Libs: -L${libdir} -lunibilium Cflags: -I${includedir} unibilium-1.2.0/uninames.c000066400000000000000000000474301256345053500155120ustar00rootroot00000000000000/* Copyright 2008, 2011 Lukas Mai. This file is part of unibilium. Unibilium is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Unibilium 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with unibilium. If not, see . */ #include "unibilium.h" #include static const char *names_bool[][2] = { { "bw" , "auto_left_margin" }, { "am" , "auto_right_margin" }, { "xsb" , "no_esc_ctlc" }, { "xhp" , "ceol_standout_glitch" }, { "xenl" , "eat_newline_glitch" }, { "eo" , "erase_overstrike" }, { "gn" , "generic_type" }, { "hc" , "hard_copy" }, { "km" , "has_meta_key" }, { "hs" , "has_status_line" }, { "in" , "insert_null_glitch" }, { "da" , "memory_above" }, { "db" , "memory_below" }, { "mir" , "move_insert_mode" }, { "msgr" , "move_standout_mode" }, { "os" , "over_strike" }, { "eslok" , "status_line_esc_ok" }, { "xt" , "dest_tabs_magic_smso" }, { "hz" , "tilde_glitch" }, { "ul" , "transparent_underline" }, { "xon" , "xon_xoff" }, { "nxon" , "needs_xon_xoff" }, { "mc5i" , "prtr_silent" }, { "chts" , "hard_cursor" }, { "nrrmc" , "non_rev_rmcup" }, { "npc" , "no_pad_char" }, { "ndscr" , "non_dest_scroll_region" }, { "ccc" , "can_change" }, { "bce" , "back_color_erase" }, { "hls" , "hue_lightness_saturation" }, { "xhpa" , "col_addr_glitch" }, { "crxm" , "cr_cancels_micro_mode" }, { "daisy" , "has_print_wheel" }, { "xvpa" , "row_addr_glitch" }, { "sam" , "semi_auto_right_margin" }, { "cpix" , "cpi_changes_res" }, { "lpix" , "lpi_changes_res" }, { "OTbs" , "backspaces_with_bs" }, { "OTns" , "crt_no_scrolling" }, { "OTnc" , "no_correctly_working_cr" }, { "OTMT" , "gnu_has_meta_key" }, { "OTNL" , "linefeed_is_newline" }, { "OTpt" , "has_hardware_tabs" }, { "OTxr" , "return_does_clr_eol" } }; static const char *unibi_x_name_bool(enum unibi_boolean v, int long_name) { size_t i; assert(v > unibi_boolean_begin_ && v < unibi_boolean_end_); if (v <= unibi_boolean_begin_ || v >= unibi_boolean_end_) { return NULL; } i = v - unibi_boolean_begin_ - 1; return names_bool[i][long_name ? 1 : 0]; } const char *unibi_name_bool(enum unibi_boolean v) { return unibi_x_name_bool(v, 1); } const char *unibi_short_name_bool(enum unibi_boolean v) { return unibi_x_name_bool(v, 0); } static const char *names_num[][2] = { { "cols" , "columns" }, { "it" , "init_tabs" }, { "lines" , "lines" }, { "lm" , "lines_of_memory" }, { "xmc" , "magic_cookie_glitch" }, { "pb" , "padding_baud_rate" }, { "vt" , "virtual_terminal" }, { "wsl" , "width_status_line" }, { "nlab" , "num_labels" }, { "lh" , "label_height" }, { "lw" , "label_width" }, { "ma" , "max_attributes" }, { "wnum" , "maximum_windows" }, { "colors" , "max_colors" }, { "pairs" , "max_pairs" }, { "ncv" , "no_color_video" }, { "bufsz" , "buffer_capacity" }, { "spinv" , "dot_vert_spacing" }, { "spinh" , "dot_horz_spacing" }, { "maddr" , "max_micro_address" }, { "mjump" , "max_micro_jump" }, { "mcs" , "micro_col_size" }, { "mls" , "micro_line_size" }, { "npins" , "number_of_pins" }, { "orc" , "output_res_char" }, { "orl" , "output_res_line" }, { "orhi" , "output_res_horz_inch" }, { "orvi" , "output_res_vert_inch" }, { "cps" , "print_rate" }, { "widcs" , "wide_char_size" }, { "btns" , "buttons" }, { "bitwin" , "bit_image_entwining" }, { "bitype" , "bit_image_type" }, { "OTug" , "magic_cookie_glitch_ul" }, { "OTdC" , "carriage_return_delay" }, { "OTdN" , "new_line_delay" }, { "OTdB" , "backspace_delay" }, { "OTdT" , "horizontal_tab_delay" }, { "OTkn" , "number_of_function_keys" } }; static const char *unibi_x_name_num(enum unibi_numeric v, int long_name) { size_t i; assert(v > unibi_numeric_begin_ && v < unibi_numeric_end_); if (v <= unibi_numeric_begin_ || v >= unibi_numeric_end_) { return NULL; } i = v - unibi_numeric_begin_ - 1; return names_num[i][long_name ? 1 : 0]; } const char *unibi_name_num(enum unibi_numeric v) { return unibi_x_name_num(v, 1); } const char *unibi_short_name_num(enum unibi_numeric v) { return unibi_x_name_num(v, 0); } static const char *names_str[][2] = { { "cbt" , "back_tab" }, { "bel" , "bell" }, { "cr" , "carriage_return" }, { "csr" , "change_scroll_region" }, { "tbc" , "clear_all_tabs" }, { "clear" , "clear_screen" }, { "el" , "clr_eol" }, { "ed" , "clr_eos" }, { "hpa" , "column_address" }, { "cmdch" , "command_character" }, { "cup" , "cursor_address" }, { "cud1" , "cursor_down" }, { "home" , "cursor_home" }, { "civis" , "cursor_invisible" }, { "cub1" , "cursor_left" }, { "mrcup" , "cursor_mem_address" }, { "cnorm" , "cursor_normal" }, { "cuf1" , "cursor_right" }, { "ll" , "cursor_to_ll" }, { "cuu1" , "cursor_up" }, { "cvvis" , "cursor_visible" }, { "dch1" , "delete_character" }, { "dl1" , "delete_line" }, { "dsl" , "dis_status_line" }, { "hd" , "down_half_line" }, { "smacs" , "enter_alt_charset_mode" }, { "blink" , "enter_blink_mode" }, { "bold" , "enter_bold_mode" }, { "smcup" , "enter_ca_mode" }, { "smdc" , "enter_delete_mode" }, { "dim" , "enter_dim_mode" }, { "smir" , "enter_insert_mode" }, { "invis" , "enter_secure_mode" }, { "prot" , "enter_protected_mode" }, { "rev" , "enter_reverse_mode" }, { "smso" , "enter_standout_mode" }, { "smul" , "enter_underline_mode" }, { "ech" , "erase_chars" }, { "rmacs" , "exit_alt_charset_mode" }, { "sgr0" , "exit_attribute_mode" }, { "rmcup" , "exit_ca_mode" }, { "rmdc" , "exit_delete_mode" }, { "rmir" , "exit_insert_mode" }, { "rmso" , "exit_standout_mode" }, { "rmul" , "exit_underline_mode" }, { "flash" , "flash_screen" }, { "ff" , "form_feed" }, { "fsl" , "from_status_line" }, { "is1" , "init_1string" }, { "is2" , "init_2string" }, { "is3" , "init_3string" }, { "if" , "init_file" }, { "ich1" , "insert_character" }, { "il1" , "insert_line" }, { "ip" , "insert_padding" }, { "kbs" , "key_backspace" }, { "ktbc" , "key_catab" }, { "kclr" , "key_clear" }, { "kctab" , "key_ctab" }, { "kdch1" , "key_dc" }, { "kdl1" , "key_dl" }, { "kcud1" , "key_down" }, { "krmir" , "key_eic" }, { "kel" , "key_eol" }, { "ked" , "key_eos" }, { "kf0" , "key_f0" }, { "kf1" , "key_f1" }, { "kf10" , "key_f10" }, { "kf2" , "key_f2" }, { "kf3" , "key_f3" }, { "kf4" , "key_f4" }, { "kf5" , "key_f5" }, { "kf6" , "key_f6" }, { "kf7" , "key_f7" }, { "kf8" , "key_f8" }, { "kf9" , "key_f9" }, { "khome" , "key_home" }, { "kich1" , "key_ic" }, { "kil1" , "key_il" }, { "kcub1" , "key_left" }, { "kll" , "key_ll" }, { "knp" , "key_npage" }, { "kpp" , "key_ppage" }, { "kcuf1" , "key_right" }, { "kind" , "key_sf" }, { "kri" , "key_sr" }, { "khts" , "key_stab" }, { "kcuu1" , "key_up" }, { "rmkx" , "keypad_local" }, { "smkx" , "keypad_xmit" }, { "lf0" , "lab_f0" }, { "lf1" , "lab_f1" }, { "lf10" , "lab_f10" }, { "lf2" , "lab_f2" }, { "lf3" , "lab_f3" }, { "lf4" , "lab_f4" }, { "lf5" , "lab_f5" }, { "lf6" , "lab_f6" }, { "lf7" , "lab_f7" }, { "lf8" , "lab_f8" }, { "lf9" , "lab_f9" }, { "rmm" , "meta_off" }, { "smm" , "meta_on" }, { "nel" , "newline" }, { "pad" , "pad_char" }, { "dch" , "parm_dch" }, { "dl" , "parm_delete_line" }, { "cud" , "parm_down_cursor" }, { "ich" , "parm_ich" }, { "indn" , "parm_index" }, { "il" , "parm_insert_line" }, { "cub" , "parm_left_cursor" }, { "cuf" , "parm_right_cursor" }, { "rin" , "parm_rindex" }, { "cuu" , "parm_up_cursor" }, { "pfkey" , "pkey_key" }, { "pfloc" , "pkey_local" }, { "pfx" , "pkey_xmit" }, { "mc0" , "print_screen" }, { "mc4" , "prtr_off" }, { "mc5" , "prtr_on" }, { "rep" , "repeat_char" }, { "rs1" , "reset_1string" }, { "rs2" , "reset_2string" }, { "rs3" , "reset_3string" }, { "rf" , "reset_file" }, { "rc" , "restore_cursor" }, { "vpa" , "row_address" }, { "sc" , "save_cursor" }, { "ind" , "scroll_forward" }, { "ri" , "scroll_reverse" }, { "sgr" , "set_attributes" }, { "hts" , "set_tab" }, { "wind" , "set_window" }, { "ht" , "tab" }, { "tsl" , "to_status_line" }, { "uc" , "underline_char" }, { "hu" , "up_half_line" }, { "iprog" , "init_prog" }, { "ka1" , "key_a1" }, { "ka3" , "key_a3" }, { "kb2" , "key_b2" }, { "kc1" , "key_c1" }, { "kc3" , "key_c3" }, { "mc5p" , "prtr_non" }, { "rmp" , "char_padding" }, { "acsc" , "acs_chars" }, { "pln" , "plab_norm" }, { "kcbt" , "key_btab" }, { "smxon" , "enter_xon_mode" }, { "rmxon" , "exit_xon_mode" }, { "smam" , "enter_am_mode" }, { "rmam" , "exit_am_mode" }, { "xonc" , "xon_character" }, { "xoffc" , "xoff_character" }, { "enacs" , "ena_acs" }, { "smln" , "label_on" }, { "rmln" , "label_off" }, { "kbeg" , "key_beg" }, { "kcan" , "key_cancel" }, { "kclo" , "key_close" }, { "kcmd" , "key_command" }, { "kcpy" , "key_copy" }, { "kcrt" , "key_create" }, { "kend" , "key_end" }, { "kent" , "key_enter" }, { "kext" , "key_exit" }, { "kfnd" , "key_find" }, { "khlp" , "key_help" }, { "kmrk" , "key_mark" }, { "kmsg" , "key_message" }, { "kmov" , "key_move" }, { "knxt" , "key_next" }, { "kopn" , "key_open" }, { "kopt" , "key_options" }, { "kprv" , "key_previous" }, { "kprt" , "key_print" }, { "krdo" , "key_redo" }, { "kref" , "key_reference" }, { "krfr" , "key_refresh" }, { "krpl" , "key_replace" }, { "krst" , "key_restart" }, { "kres" , "key_resume" }, { "ksav" , "key_save" }, { "kspd" , "key_suspend" }, { "kund" , "key_undo" }, { "kBEG" , "key_sbeg" }, { "kCAN" , "key_scancel" }, { "kCMD" , "key_scommand" }, { "kCPY" , "key_scopy" }, { "kCRT" , "key_screate" }, { "kDC" , "key_sdc" }, { "kDL" , "key_sdl" }, { "kslt" , "key_select" }, { "kEND" , "key_send" }, { "kEOL" , "key_seol" }, { "kEXT" , "key_sexit" }, { "kFND" , "key_sfind" }, { "kHLP" , "key_shelp" }, { "kHOM" , "key_shome" }, { "kIC" , "key_sic" }, { "kLFT" , "key_sleft" }, { "kMSG" , "key_smessage" }, { "kMOV" , "key_smove" }, { "kNXT" , "key_snext" }, { "kOPT" , "key_soptions" }, { "kPRV" , "key_sprevious" }, { "kPRT" , "key_sprint" }, { "kRDO" , "key_sredo" }, { "kRPL" , "key_sreplace" }, { "kRIT" , "key_sright" }, { "kRES" , "key_srsume" }, { "kSAV" , "key_ssave" }, { "kSPD" , "key_ssuspend" }, { "kUND" , "key_sundo" }, { "rfi" , "req_for_input" }, { "kf11" , "key_f11" }, { "kf12" , "key_f12" }, { "kf13" , "key_f13" }, { "kf14" , "key_f14" }, { "kf15" , "key_f15" }, { "kf16" , "key_f16" }, { "kf17" , "key_f17" }, { "kf18" , "key_f18" }, { "kf19" , "key_f19" }, { "kf20" , "key_f20" }, { "kf21" , "key_f21" }, { "kf22" , "key_f22" }, { "kf23" , "key_f23" }, { "kf24" , "key_f24" }, { "kf25" , "key_f25" }, { "kf26" , "key_f26" }, { "kf27" , "key_f27" }, { "kf28" , "key_f28" }, { "kf29" , "key_f29" }, { "kf30" , "key_f30" }, { "kf31" , "key_f31" }, { "kf32" , "key_f32" }, { "kf33" , "key_f33" }, { "kf34" , "key_f34" }, { "kf35" , "key_f35" }, { "kf36" , "key_f36" }, { "kf37" , "key_f37" }, { "kf38" , "key_f38" }, { "kf39" , "key_f39" }, { "kf40" , "key_f40" }, { "kf41" , "key_f41" }, { "kf42" , "key_f42" }, { "kf43" , "key_f43" }, { "kf44" , "key_f44" }, { "kf45" , "key_f45" }, { "kf46" , "key_f46" }, { "kf47" , "key_f47" }, { "kf48" , "key_f48" }, { "kf49" , "key_f49" }, { "kf50" , "key_f50" }, { "kf51" , "key_f51" }, { "kf52" , "key_f52" }, { "kf53" , "key_f53" }, { "kf54" , "key_f54" }, { "kf55" , "key_f55" }, { "kf56" , "key_f56" }, { "kf57" , "key_f57" }, { "kf58" , "key_f58" }, { "kf59" , "key_f59" }, { "kf60" , "key_f60" }, { "kf61" , "key_f61" }, { "kf62" , "key_f62" }, { "kf63" , "key_f63" }, { "el1" , "clr_bol" }, { "mgc" , "clear_margins" }, { "smgl" , "set_left_margin" }, { "smgr" , "set_right_margin" }, { "fln" , "label_format" }, { "sclk" , "set_clock" }, { "dclk" , "display_clock" }, { "rmclk" , "remove_clock" }, { "cwin" , "create_window" }, { "wingo" , "goto_window" }, { "hup" , "hangup" }, { "dial" , "dial_phone" }, { "qdial" , "quick_dial" }, { "tone" , "tone" }, { "pulse" , "pulse" }, { "hook" , "flash_hook" }, { "pause" , "fixed_pause" }, { "wait" , "wait_tone" }, { "u0" , "user0" }, { "u1" , "user1" }, { "u2" , "user2" }, { "u3" , "user3" }, { "u4" , "user4" }, { "u5" , "user5" }, { "u6" , "user6" }, { "u7" , "user7" }, { "u8" , "user8" }, { "u9" , "user9" }, { "op" , "orig_pair" }, { "oc" , "orig_colors" }, { "initc" , "initialize_color" }, { "initp" , "initialize_pair" }, { "scp" , "set_color_pair" }, { "setf" , "set_foreground" }, { "setb" , "set_background" }, { "cpi" , "change_char_pitch" }, { "lpi" , "change_line_pitch" }, { "chr" , "change_res_horz" }, { "cvr" , "change_res_vert" }, { "defc" , "define_char" }, { "swidm" , "enter_doublewide_mode" }, { "sdrfq" , "enter_draft_quality" }, { "sitm" , "enter_italics_mode" }, { "slm" , "enter_leftward_mode" }, { "smicm" , "enter_micro_mode" }, { "snlq" , "enter_near_letter_quality" }, { "snrmq" , "enter_normal_quality" }, { "sshm" , "enter_shadow_mode" }, { "ssubm" , "enter_subscript_mode" }, { "ssupm" , "enter_superscript_mode" }, { "sum" , "enter_upward_mode" }, { "rwidm" , "exit_doublewide_mode" }, { "ritm" , "exit_italics_mode" }, { "rlm" , "exit_leftward_mode" }, { "rmicm" , "exit_micro_mode" }, { "rshm" , "exit_shadow_mode" }, { "rsubm" , "exit_subscript_mode" }, { "rsupm" , "exit_superscript_mode" }, { "rum" , "exit_upward_mode" }, { "mhpa" , "micro_column_address" }, { "mcud1" , "micro_down" }, { "mcub1" , "micro_left" }, { "mcuf1" , "micro_right" }, { "mvpa" , "micro_row_address" }, { "mcuu1" , "micro_up" }, { "porder" , "order_of_pins" }, { "mcud" , "parm_down_micro" }, { "mcub" , "parm_left_micro" }, { "mcuf" , "parm_right_micro" }, { "mcuu" , "parm_up_micro" }, { "scs" , "select_char_set" }, { "smgb" , "set_bottom_margin" }, { "smgbp" , "set_bottom_margin_parm" }, { "smglp" , "set_left_margin_parm" }, { "smgrp" , "set_right_margin_parm" }, { "smgt" , "set_top_margin" }, { "smgtp" , "set_top_margin_parm" }, { "sbim" , "start_bit_image" }, { "scsd" , "start_char_set_def" }, { "rbim" , "stop_bit_image" }, { "rcsd" , "stop_char_set_def" }, { "subcs" , "subscript_characters" }, { "supcs" , "superscript_characters" }, { "docr" , "these_cause_cr" }, { "zerom" , "zero_motion" }, { "csnm" , "char_set_names" }, { "kmous" , "key_mouse" }, { "minfo" , "mouse_info" }, { "reqmp" , "req_mouse_pos" }, { "getm" , "get_mouse" }, { "setaf" , "set_a_foreground" }, { "setab" , "set_a_background" }, { "pfxl" , "pkey_plab" }, { "devt" , "device_type" }, { "csin" , "code_set_init" }, { "s0ds" , "set0_des_seq" }, { "s1ds" , "set1_des_seq" }, { "s2ds" , "set2_des_seq" }, { "s3ds" , "set3_des_seq" }, { "smglr" , "set_lr_margin" }, { "smgtb" , "set_tb_margin" }, { "birep" , "bit_image_repeat" }, { "binel" , "bit_image_newline" }, { "bicr" , "bit_image_carriage_return" }, { "colornm" , "color_names" }, { "defbi" , "define_bit_image_region" }, { "endbi" , "end_bit_image_region" }, { "setcolor", "set_color_band" }, { "slines" , "set_page_length" }, { "dispc" , "display_pc_char" }, { "smpch" , "enter_pc_charset_mode" }, { "rmpch" , "exit_pc_charset_mode" }, { "smsc" , "enter_scancode_mode" }, { "rmsc" , "exit_scancode_mode" }, { "pctrm" , "pc_term_options" }, { "scesc" , "scancode_escape" }, { "scesa" , "alt_scancode_esc" }, { "ehhlm" , "enter_horizontal_hl_mode" }, { "elhlm" , "enter_left_hl_mode" }, { "elohlm" , "enter_low_hl_mode" }, { "erhlm" , "enter_right_hl_mode" }, { "ethlm" , "enter_top_hl_mode" }, { "evhlm" , "enter_vertical_hl_mode" }, { "sgr1" , "set_a_attributes" }, { "slength" , "set_pglen_inch" }, { "OTi2" , "termcap_init2" }, { "OTrs" , "termcap_reset" }, { "OTnl" , "linefeed_if_not_lf" }, { "OTbc" , "backspace_if_not_bs" }, { "OTko" , "other_non_function_keys" }, { "OTma" , "arrow_key_map" }, { "OTG2" , "acs_ulcorner" }, { "OTG3" , "acs_llcorner" }, { "OTG1" , "acs_urcorner" }, { "OTG4" , "acs_lrcorner" }, { "OTGR" , "acs_ltee" }, { "OTGL" , "acs_rtee" }, { "OTGU" , "acs_btee" }, { "OTGD" , "acs_ttee" }, { "OTGH" , "acs_hline" }, { "OTGV" , "acs_vline" }, { "OTGC" , "acs_plus" }, { "meml" , "memory_lock" }, { "memu" , "memory_unlock" }, { "box1" , "box_chars_1" } }; static const char *unibi_x_name_str(enum unibi_string v, int long_name) { size_t i; assert(v > unibi_string_begin_ && v < unibi_string_end_); if (v <= unibi_string_begin_ || v >= unibi_string_end_) { return NULL; } i = v - unibi_string_begin_ - 1; return names_str[i][long_name ? 1 : 0]; } const char *unibi_name_str(enum unibi_string v) { return unibi_x_name_str(v, 1); } const char *unibi_short_name_str(enum unibi_string v) { return unibi_x_name_str(v, 0); } unibilium-1.2.0/uniutil.c000066400000000000000000000112171256345053500153560ustar00rootroot00000000000000/* Copyright 2008, 2010, 2012 Lukas Mai. This file is part of unibilium. Unibilium is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Unibilium 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with unibilium. If not, see . */ #include "unibilium.h" #include #include #include #include #include #include #include #include #ifndef TERMINFO_DIRS #error "internal error: TERMINFO_DIRS is not defined" #endif enum {MAX_BUF = 4096}; const char *const unibi_terminfo_dirs = TERMINFO_DIRS; unibi_term *unibi_from_fp(FILE *fp) { char buf[MAX_BUF]; size_t n, r; for (n = 0; n < sizeof buf && (r = fread(buf + n, 1, sizeof buf - n, fp)) > 0; ) { n += r; if (feof(fp)) { break; } } if (ferror(fp)) { return NULL; } return unibi_from_mem(buf, n); } unibi_term *unibi_from_fd(int fd) { char buf[MAX_BUF]; size_t n; ssize_t r; for (n = 0; n < sizeof buf && (r = read(fd, buf + n, sizeof buf - n)) > 0; ) { n += r; } if (r < 0) { return NULL; } return unibi_from_mem(buf, n); } unibi_term *unibi_from_file(const char *file) { int fd; unibi_term *ut; if ((fd = open(file, O_RDONLY)) < 0) { return NULL; } ut = unibi_from_fd(fd); close(fd); return ut; } static int add_overflowed(size_t *dst, size_t src) { *dst += src; return *dst < src; } static unibi_term *from_dir(const char *dir_begin, const char *dir_end, const char *mid, const char *term) { char *path; unibi_term *ut; size_t dir_len, mid_len, term_len, path_size; dir_len = dir_end ? (size_t)(dir_end - dir_begin) : strlen(dir_begin); mid_len = mid ? strlen(mid) + 1 : 0; term_len = strlen(term); path_size = 0; if ( add_overflowed(&path_size, dir_len) || add_overflowed(&path_size, mid_len) || add_overflowed(&path_size, term_len) || add_overflowed(&path_size, 1 + 2 + 1 + 1) /* / (%c | %02x) / \0 */ ) { /* overflow */ errno = ENOMEM; return NULL; } if (!(path = malloc(path_size))) { return NULL; } memcpy(path, dir_begin, dir_len); sprintf(path + dir_len, "/" "%s" "%s" "%c" "/" "%s", mid ? mid : "", mid ? "/" : "", term[0], term); errno = 0; ut = unibi_from_file(path); if (!ut && errno == ENOENT) { /* OS X likes to use /usr/share/terminfo//name instead of the first letter */ sprintf(path + dir_len + 1 + mid_len, "%02x/%s", (unsigned int)((unsigned char)term[0] & 0xff), term); ut = unibi_from_file(path); } free(path); return ut; } static unibi_term *from_dirs(const char *list, const char *term) { const char *a, *z; if (list[0] == '\0') { errno = ENOENT; return NULL; } a = list; for (;;) { unibi_term *ut; while (*a == ':') { ++a; } if (*a == '\0') { break; } z = strchr(a, ':'); ut = from_dir(a, z, NULL, term); if (ut) { return ut; } if (!z) { break; } a = z + 1; } errno = ENOENT; return NULL; } unibi_term *unibi_from_term(const char *term) { unibi_term *ut; const char *env; if (term[0] == '\0' || term[0] == '.' || strchr(term, '/')) { errno = EINVAL; return NULL; } if ((env = getenv("TERMINFO"))) { return from_dir(env, NULL, NULL, term); } if ((env = getenv("HOME"))) { ut = from_dir(env, NULL, ".terminfo", term); if (ut) { return ut; } } if ((env = getenv("TERMINFO_DIRS"))) { return from_dirs(env, term); } return from_dirs(unibi_terminfo_dirs, term); } unibi_term *unibi_from_env(void) { const char *term = getenv("TERM"); if (!term) { errno = ENOENT; return NULL; } return unibi_from_term(term); }