pax_global_header00006660000000000000000000000064134476741160014527gustar00rootroot0000000000000052 comment=a5856a023b42d3fa8c1198571e395da11d009bf3 smenu-0.9.15/000077500000000000000000000000001344767411600127525ustar00rootroot00000000000000smenu-0.9.15/.clang-format000066400000000000000000000025751344767411600153360ustar00rootroot00000000000000SortIncludes: 'false' BasedOnStyle: Mozilla AlignAfterOpenBracket: 'true' AlignConsecutiveAssignments: 'true' AlignConsecutiveDeclarations: 'true' AlignOperands: 'true' AlignEscapedNewlinesLeft: 'true' AlignOperands: 'true' AlignTrailingComments: 'true' ReflowComments: 'true' AllowAllParametersOfDeclarationOnNextLine: 'false' AllowShortBlocksOnASingleLine: 'false' AllowShortCaseLabelsOnASingleLine: 'false' AllowShortFunctionsOnASingleLine: None AllowShortIfStatementsOnASingleLine: 'false' AllowShortLoopsOnASingleLine: 'false' AlwaysBreakBeforeMultilineStrings: 'false' BinPackArguments: 'true' BinPackParameters: 'true' BreakBeforeBraces: Allman BreakBeforeBinaryOperators: NonAssignment BreakBeforeTernaryOperators: 'true' BreakConstructorInitializersBeforeComma: 'false' ColumnLimit: '80' ContinuationIndentWidth: '2' DerivePointerAlignment: 'false' IndentCaseLabels: 'true' IndentWidth: '2' KeepEmptyLinesAtTheStartOfBlocks: 'true' Language: Cpp MaxEmptyLinesToKeep: '1' PointerAlignment: Middle SpaceAfterCStyleCast: 'false' SpaceBeforeAssignmentOperators: 'true' SpaceBeforeParens: Never SpaceBeforeParens: ControlStatements SpaceInEmptyParentheses: 'false' SpacesBeforeTrailingComments: '1' SpacesInCStyleCastParentheses: 'false' SpacesInParentheses: 'false' SpacesInSquareBrackets: 'false' TabWidth: '2' UseTab: Never PenaltyBreakBeforeFirstCallParameter: '100' PenaltyBreakAssignment: '150' smenu-0.9.15/COPYRIGHT000066400000000000000000000000731344767411600142450ustar00rootroot00000000000000(c) Pierre Gentile (p.gen.progs@gmail.com) License: GPLv2 smenu-0.9.15/ChangeLog000066400000000000000000000200031344767411600145170ustar00rootroot00000000000000- Version 0.9.15 * Bug fixes: + An ending pattern search was not correctly highlighted + An highlighting issue when hitting the HOME key during a search in numbered mode has been fixed + The PgUp/PgDn moves have been fixed and improved in the presence of excluded words + The height of the windows when a message is present is now correctly calculated + The SIGINT signal handling is working properly now + A vt100 terminal is assumed when the environment variable TERM is unset * Improvements: + The 'o' sub-option of the -D option has been enhanced + The documentation has been improved and enhanced + An example of a hierarchical menu interpreter has been added + The message (title) appearance can now be changed with the -a option + An empty line has been added after the message (title) for clarity + The .spec file has been updated to support older SUSE/RH versions + An issue opening /dev/tty is now clearly signaled + The argument of the -n option is now optional and defaults to 0 (full height) + It is now possible to directly move the cursor to the start/end of the current line * Misc: + The code has been split into several files + The pull request #15 from sumbach/patch-1 has been merged + The pull request #12 from jonnydubowsky/patch-1 has been merged + More tests for the automatic regressions checking have been added + UTF-8 string length processing has been optimized + Help and usage messages are now printed on stdout + A FAQ has been added + Compiler warnings have been silenced - Version 0.9.14 * Rework the search system (major change) + Add a substring and a fuzzy (fzf inspired) search mode + Enlighten the current search pattern in the matching words + Remove the search mode timeout + Introduce ENTER/ESC as a way to exit search mode + Add the prefix/suffix affinity when searching + Allow to tag/un-tag all the matching words + add a -/ option to affect a search method to the / command + Add 'T' and 'U' commands to tag/un-tag all the matching words * Improve the direct access mechanism + [-D] Add a 's' (start) sub-option + [-D] Add a 'h' (head) sub-option * Add a "full window" option value to -n * Improve the test system and add tests * Improve the documentation * Update the README.rst file and mention the wiki on GitHub * Fix an OpenBSD compatibility issue * Fix and improve the color mechanism * Fix the cursor display after an ESC hit * Fix the tag attribute display * Fix some compilation warnings * Fix a missing message when the terminal is too small * Fix a lot of other small and not-so-small bugs - Version 0.9.13 * Add the first roll of an automated testing system * Fix a FreeBSD compatibility issue * Update the .spec file to create a '-test' RPM subpackage * [-a] Add a missing setting for cursor_on_tag (ct) * [-b] Fix a bug about non-printable characters * [-V] Output the version tag on standard output * [-D] Add a 'decorate' directive * [-D] Handle multiple instances of the same directive * Fix a logic error in the direct access code * Fix an horizontal scrolling issue when going to the last word * Clean up the allocated gutter array before leaving in case of error * Understand some more terminfo sequences * Fix the right margin and add a degraded method to display it * Improve the manual * Various other small bug fixes Apr 08 18:32 UTC 2018 - p.gen.progs@gmail.com - Version 0.9.12 * Fix the cursor restoration * Fix a Solaris incompatibility * Fix italic handling * Fix the replacement of subexpressions (-S,-I,-E) * Fix a bug in the columns inclusion logic * Fix the impossibility to use the letter 't' in search mode * Fix possible display errors when the terminal is resized * Make sure that the timers does not alter the redrawing of the window * Add word numbering to allow direct access through their number (-N,-U,-F,-D) * Improve The manual * Allow the \u notation for UTF-8 characters in more places * Improve the -T option and add the related -P option * Add the -p for use with the -P and -T options * The gutter option (-g) now accepts a parameter * Adopt the NO_COLOR standard (http://no-color.org) * Improve the navigation by understanding more keys and key combinations * Understand CTRL+L to redraws the window in case of corruption * Exit from search mode when a direction key is hit * Adjust some values of timers * Remove deprecated directives in -C and -L * Various other small fixes and improvments Jan 26 12:35 UTC 2018 - p.gen.progs@gmail.com - Version 0.9.11 * Introduce the new \u notation for UTF-8 hex sequences * Non-printable characters with an escape form are expanded * Keep non selectable blank words to allow special effects * Fix the wide option when in column or tabulation mode * The last word is always the last of its line (-g) * Improve message (-m) placement in centered mode * Manage substitutions leading to empty strings * Hopefully fix the placement of the scroll bar in all cases * The gutter can now be displayed in column mode * Various other small fixes Jul 29 16:30:00 UTC 2017 - p.gen.progs@gmail.com - Bump to version 0.9.10 * The words acquisition is rewritten and splitted in multiple phases * Add the capacity to (de)select rows an columns containing regexes * -i, -e, -C and -R can be used more than once and have a cumulative effect * Bugfix: -s is able to jump to non selectable words * Bugfix: The attributes are not overloaded when reading configuration files * Bugfix: the right bar is too far right in some cases. * Bugfix: the right shift indicator is omitted in some cases * Add a -x|-X option to set a timeout in seconds * Add a -f option to select an alternative configuration file * Add a -a option to set the attributes of the displayed elements * Add more controls in the selection parser * smenu can now read words directly from a file given as parameter * Rewrite the replace function used by -S/-I/-E with a more sed-like one * Searches should always consider the visual aspect of words (-S/-I/-E) Thu Dec 22 20:48:17 UTC 2016 - p.gen.progs@gmail.com - Version 0.9.9 * New UTF8 validation routine * Man page cleanup * Code cleanup and improvement * Improved configuration process * Add code to detect the host system at compile time * Compilation is now possible on BSD system derivatives * Bug fix: ignore EOF when a scancode contains an escape sequence. * Fix the cursor appearance on tagged words Sun Dec 11 20:00:20 UTC 2016 - p.gen.progs@gmail.com - Version 0.9.8 * Change the cursor aspect when the selected word is tagged * Add a small animated gif demo * Fix a potential infinite loop * Use custom fgetc/ungetc to be able to safely push back more than one byte * Add libtinfo in the searched libraries an regenerate configure * Manage conflicts between -C, -R, -c, -l, and -t * Improve and fix the help line display * Add a -T option to enable a tagging (multi-selections) mode * Add the -? option to only display the synopsys * Adjust the code so that it can be compiled with an ansi compiler * Put the searched line in the middle of the displayed window if possible * Add a -k option to prevent trimming spaces * Fix the -s option * When not in search mode, any key except '?' should quit the help mode * Add a new example: yesno * Fix an off-by-one error when using -c and -w together * And many other minor changes and fixes ------------------------------------------------------------------- Sun Mar 13 09:28:52 UTC 2016 - p.gen.progs@gmail.com - Version 0.9.1 * Use the GNU autotools * Fix a lot of small and not so small bugs * Change the -s option semantic * Improve help and man page * Introduce some new options - see the man page for more * Also rework some options - see the man page for more * Add more configurable colors * Add the notion of non-selectable words * Add the notion of special words * Add a (de)selection by rows and/or columns * Interpret quotations in the input stream and ignore empty words * Add an option to center the output window * And many other minor changes ------------------------------------------------------------------- Sun Aug 9 23:00:59 UTC 2015 - p.gen.progs@gmail.com - Initial version - 0.9 smenu-0.9.15/FAQ000066400000000000000000000014731344767411600133110ustar00rootroot00000000000000Q: What is smenu? A: smenu is a selection tool which acts as a filter that takes words from the standard input or a file and presents them on the screen in various ways in a scrolling window. A cursor that you can easily move allows you to select one or more of them. The selected words are printed on the standard output. -------- Q: Why smenu tells me: "The length of a word has reached the limit of 512 characters." but there is no such word in my entry? A: There is a good chance you have an unbalanced quote, single or double, somewhere. smenu uses quotation marks to be able to have spaces in 'words', and these quotation marks that do not serve as delimiters must be protected. You can use something like: sed -e "s/'/\\\'/g" -e 's/"/\\"/g' to pre-process the input in such a case. smenu-0.9.15/LICENSE.rst000066400000000000000000000432261344767411600145750ustar00rootroot00000000000000GNU General Public License ========================== *Version 2, June 1991* *Copyright © 1989, 1991 Free Software Foundation, Inc.* *51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA* Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble ~~~~~~~~ The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) 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 this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. 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. We protect your rights with two steps: **(1)** copyright the software, and **(2)** offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **0.** This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. **1.** You may copy and distribute 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 and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. **2.** You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: * **a)** You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. * **b)** You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. * **c)** If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. **3.** You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: * **a)** Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, * **b)** Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, * **c)** Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. **4.** You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. **5.** You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. **6.** Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. **7.** If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. **8.** If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. **9.** The Free Software Foundation may publish revised and/or new versions of the 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 a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. **10.** If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY ~~~~~~~~~~~ **11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. **12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE 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. *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 convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. 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 2 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w`. This is free software, and you are welcome to redistribute it under certain conditions; type `show c` for details. The hypothetical commands `show w` and `show c` should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c`; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision` (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This 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. smenu-0.9.15/Makefile.am000066400000000000000000000015511344767411600150100ustar00rootroot00000000000000bin_PROGRAMS = smenu smenu_SOURCES = smenu.c smenu.h list.c list.h xmalloc.c xmalloc.h \ index.c index.h utf8.c utf8.h fgetc.c fgetc.h \ utils.c utils.h getopt.c getopt.h usage.c usage.h dist_man_MANS = smenu.1 EXTRA_DIST = smenu.spec.in smenu.spec ChangeLog build.sh version \ COPYRIGHT LICENSE.rst README.rst examples build-aux tests \ FAQ dist-hook: @chmod u+rw $(distdir)/tests; \ cd $(distdir)/tests ; \ find * -name 'data*' -o \ -name '*.in' -o \ -name '*.tst' -o \ -name '*.bl' -o \ -name '*.good' \ | cpio -o > tests.cpio 2>/dev/null @gzip -f9 $(distdir)/tests/tests.cpio @find $(distdir)/tests/* -type d \ -exec rm -rf {} + smenu-0.9.15/Makefile.in000066400000000000000000000677511344767411600150370ustar00rootroot00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = smenu$(EXEEXT) subdir = . DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \ $(srcdir)/config.h.in $(srcdir)/smenu.spec.in \ $(top_srcdir)/build-aux/depcomp $(dist_man_MANS) ChangeLog \ TODO build-aux/compile build-aux/config.guess \ build-aux/config.sub build-aux/depcomp build-aux/install-sh \ build-aux/missing $(top_srcdir)/build-aux/config.guess \ $(top_srcdir)/build-aux/config.sub \ $(top_srcdir)/build-aux/install-sh \ $(top_srcdir)/build-aux/missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = smenu.spec CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" PROGRAMS = $(bin_PROGRAMS) am_smenu_OBJECTS = smenu.$(OBJEXT) list.$(OBJEXT) xmalloc.$(OBJEXT) \ index.$(OBJEXT) utf8.$(OBJEXT) fgetc.$(OBJEXT) utils.$(OBJEXT) \ getopt.$(OBJEXT) usage.$(OBJEXT) smenu_OBJECTS = $(am_smenu_OBJECTS) smenu_LDADD = $(LDADD) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(smenu_SOURCES) DIST_SOURCES = $(smenu_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 NROFF = nroff MANS = $(dist_man_MANS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope AM_RECURSIVE_TARGETS = cscope DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) GZIP_ENV = --best DIST_ARCHIVES = $(distdir).tar.bz2 DIST_TARGETS = dist-bzip2 distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ smenu_SOURCES = smenu.c smenu.h list.c list.h xmalloc.c xmalloc.h \ index.c index.h utf8.c utf8.h fgetc.c fgetc.h \ utils.c utils.h getopt.c getopt.h usage.c usage.h dist_man_MANS = smenu.1 EXTRA_DIST = smenu.spec.in smenu.spec ChangeLog build.sh version \ COPYRIGHT LICENSE.rst README.rst examples build-aux tests \ FAQ all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .o .obj am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 smenu.spec: $(top_builddir)/config.status $(srcdir)/smenu.spec.in cd $(top_builddir) && $(SHELL) ./config.status $@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) smenu$(EXEEXT): $(smenu_OBJECTS) $(smenu_DEPENDENCIES) $(EXTRA_smenu_DEPENDENCIES) @rm -f smenu$(EXEEXT) $(AM_V_CCLD)$(LINK) $(smenu_OBJECTS) $(smenu_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fgetc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/index.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smenu.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usage.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` install-man1: $(dist_man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(dist_man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(MANS) config.h installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-man uninstall-man: uninstall-man1 .MAKE: all install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-am clean \ clean-binPROGRAMS clean-cscope clean-generic cscope \ cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \ dist-zip distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-tags distcleancheck \ distdir distuninstallcheck dvi dvi-am html html-am info \ info-am install install-am install-binPROGRAMS install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-man1 install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-binPROGRAMS uninstall-man \ uninstall-man1 dist-hook: @chmod u+rw $(distdir)/tests; \ cd $(distdir)/tests ; \ find * -name 'data*' -o \ -name '*.in' -o \ -name '*.tst' -o \ -name '*.bl' -o \ -name '*.good' \ | cpio -o > tests.cpio 2>/dev/null @gzip -f9 $(distdir)/tests/tests.cpio @find $(distdir)/tests/* -type d \ -exec rm -rf {} + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: smenu-0.9.15/README.rst000066400000000000000000000100531344767411600144400ustar00rootroot00000000000000.. image:: smenu.gif What is it? =========== **smenu** is a selection filter just like ``sed`` is an editing filter. This tool takes words from standard input or from a file and presents them on the screen in different layouts in a scrolling window. A cursor that you can easily move lets you select one or more of them. Note that the screen is not previously cleared when the scrolling window of **smenu** is displayed. I tried to make its use as simple as possible. It supports the ``UTF-8`` encoding and should work on all terminals managed by the ``terminfo`` database. Please use the included man page to learn more about this little program. The wiki (https://github.com/p-gen/smenu/wiki) contains screenshots and animations that detail some of the concepts and features of **smenu**. How to build it? ================ **smenu** can be built on any system on which a working ``terminfo`` development platform is available. This includes every Unix and Unix-like system I am aware of. Please use the provided ``build.sh`` to build the executable. This script accepts the same arguments as ``configure``, type ``build.sh --help`` to see them. The script ``autogen.sh`` is also provided if you need to generate a new ``configure`` script from ``configure.ac`` and ``Makefile.am``. The GNU **autotools** will need to be installed for this script to work. How to install it? ================== Once the build process has finished, a simple ``make install`` with the appropriate privileges will do it Some examples. ============== Linux example. -------------- This program should work on most Unix but if you are using Linux, try to type the following line at a shell prompt (here: ``"$ "`` ): :: $ R=$(grep Vm /proc/$$/status \ | smenu -n20 -W $':\t\n' -q -c -b -g -s /VmH) $ echo $R Something like this should now be displayed with the program waiting for commands: (numbers are mine, yours will be different) :: VmPeak¦ 23840 kB VmSize¦ 23836 kB VmLck ¦ 0 kB VmHWM ¦ 2936 kB VmRSS ¦ 2936 kB VmData¦ 1316 kB VmStk ¦ 136 kB VmExe ¦ 28 kB VmLib ¦ 3956 kB VmPTE ¦ 64 kB VmSwap¦ 0 kB A cursor should be under ``"VmHWM "``. After having moved the cursor to ``" 136 kB"`` and ended the program with ````, the shell variable R should contain: ``" 136 kB"``. Unix example. ------------- The following command, which is Unix brand agnostic, should give you a scrolling window if you have more than 10 accounts on your Unix with a UID lower than 100: :: $ R=$(awk -F: '$3 < 100 {print $1,$3,$4,$NF}' /etc/passwd \ | smenu -n10 -c) $ echo $R On mine (``LANG`` and ``LC_ALL`` set to ``POSIX``) it displays: :: at 25 25 /bin/bash \ sys 0 3 /usr/bin/ksh + bin 1 1 /bin/bash | daemon 2 2 /bin/bash | ftp 40 49 /bin/bash | games 12 100 /bin/bash | lp 4 7 /bin/bash | mail 8 12 /bin/false | named 44 44 /bin/false | ntp 74 108 /bin/false v Note the presence of a scrollbar. Testing and reporting. ---------------------- The included testing system is relatively young, please be indulgent. **IMPORTANT** the testing system has some dependencies, please read the ``test/README.rst`` before going further. **WARNING** running all the tests by running ``./tests.sh`` in the ``tests`` directory will take some time (around 15 min for now). **NOTE** on some systems like \*BSD some tests may fail. This can be explained by differences in posix/libc/... implementations. This can notably occur when some specific regular expressions or uncommon ``UTF-8`` byte sequences are used. If a test fails for unknown reason, then please send me its directory name and the relevant ``.bad`` file. If you are hit by a bug that no test covers, then you can create a new test in the ``tests`` directory in an existing or new directory: read the ``tests/README.rst`` file, use an existing test as model, create an ``.in`` file and a ``.tst`` file and send them to me as well as the produced files. smenu-0.9.15/SUMMARY000066400000000000000000000003021344767411600140250ustar00rootroot00000000000000Terminal utility that allows you to use words coming from the standard input to create a nice selection window just below the cursor. Once done, your selection will be sent to standard output. smenu-0.9.15/TODO000066400000000000000000000002471344767411600134450ustar00rootroot00000000000000# B: Bugs to fix, I: possible Improvements # ========================================. I: Improve configure.ac I: Improve the checking of system/library calls returns smenu-0.9.15/aclocal.m4000066400000000000000000001116131344767411600146150ustar00rootroot00000000000000# generated automatically by aclocal 1.13.4 -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.13' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.13.4], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.13.4])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR smenu-0.9.15/autogen.sh000077500000000000000000001344321344767411600147620ustar00rootroot00000000000000#!/bin/sh # a u t o g e n . s h # # Copyright (c) 2005-2009 United States Government as represented by # the U.S. Army Research Laboratory. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # # 3. The name of the author may not be used to endorse or promote # products derived from this software without specific prior written # permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # ### # # Script for automatically preparing the sources for compilation by # performing the myriad of necessary steps. The script attempts to # detect proper version support, and outputs warnings about particular # systems that have autotool peculiarities. # # Basically, if everything is set up and installed correctly, the # script will validate that minimum versions of the GNU Build System # tools are installed, account for several common configuration # issues, and then simply run autoreconf for you. # # If autoreconf fails, which can happen for many valid configurations, # this script proceeds to run manual preparation steps effectively # providing a POSIX shell script (mostly complete) reimplementation of # autoreconf. # # The AUTORECONF, AUTOCONF, AUTOMAKE, LIBTOOLIZE, ACLOCAL, AUTOHEADER # environment variables and corresponding _OPTIONS variables (e.g. # AUTORECONF_OPTIONS) may be used to override the default automatic # detection behaviors. Similarly the _VERSION variables will override # the minimum required version numbers. # # Examples: # # To obtain help on usage: # ./autogen.sh --help # # To obtain verbose output: # ./autogen.sh --verbose # # To skip autoreconf and prepare manually: # AUTORECONF=false ./autogen.sh # # To verbosely try running with an older (unsupported) autoconf: # AUTOCONF_VERSION=2.50 ./autogen.sh --verbose # # Author: # Christopher Sean Morrison # # Patches: # Sebastian Pipping # ###################################################################### # set to minimum acceptable version of autoconf if [ "x$AUTOCONF_VERSION" = "x" ] ; then AUTOCONF_VERSION=2.52 fi # set to minimum acceptable version of automake if [ "x$AUTOMAKE_VERSION" = "x" ] ; then AUTOMAKE_VERSION=1.6.0 fi # set to minimum acceptable version of libtool if [ "x$LIBTOOL_VERSION" = "x" ] ; then LIBTOOL_VERSION=1.4.2 fi ################## # ident function # ################## ident ( ) { # extract copyright from header __copyright="`grep Copyright $AUTOGEN_SH | head -${HEAD_N}1 | awk '{print $4}'`" if [ "x$__copyright" = "x" ] ; then __copyright="`date +%Y`" fi # extract version from CVS Id string __id="$Id: autogen.sh 33925 2009-03-01 23:27:06Z brlcad $" __version="`echo $__id | sed 's/.*\([0-9][0-9][0-9][0-9]\)[-\/]\([0-9][0-9]\)[-\/]\([0-9][0-9]\).*/\1\2\3/'`" if [ "x$__version" = "x" ] ; then __version="" fi echo "autogen.sh build preparation script by Christopher Sean Morrison" echo " + config.guess download patch by Sebastian Pipping (2008-12-03)" echo "revised 3-clause BSD-style license, copyright (c) $__copyright" echo "script version $__version, ISO/IEC 9945 POSIX shell script" } ################## # USAGE FUNCTION # ################## usage ( ) { echo "Usage: $AUTOGEN_SH [-h|--help] [-v|--verbose] [-q|--quiet] [-d|--download] [--version]" echo " --help Help on $NAME_OF_AUTOGEN usage" echo " --verbose Verbose progress output" echo " --quiet Quiet suppressed progress output" echo " --download Download the latest config.guess from gnulib" echo " --version Only perform GNU Build System version checks" echo echo "Description: This script will validate that minimum versions of the" echo "GNU Build System tools are installed and then run autoreconf for you." echo "Should autoreconf fail, manual preparation steps will be run" echo "potentially accounting for several common preparation issues. The" echo "AUTORECONF, AUTOCONF, AUTOMAKE, LIBTOOLIZE, ACLOCAL, AUTOHEADER," echo "PROJECT, & CONFIGURE environment variables and corresponding _OPTIONS" echo "variables (e.g. AUTORECONF_OPTIONS) may be used to override the" echo "default automatic detection behavior." echo ident return 0 } ########################## # VERSION_ERROR FUNCTION # ########################## version_error ( ) { if [ "x$1" = "x" ] ; then echo "INTERNAL ERROR: version_error was not provided a version" exit 1 fi if [ "x$2" = "x" ] ; then echo "INTERNAL ERROR: version_error was not provided an application name" exit 1 fi $ECHO $ECHO "ERROR: To prepare the ${PROJECT} build system from scratch," $ECHO " at least version $1 of $2 must be installed." $ECHO $ECHO "$NAME_OF_AUTOGEN does not need to be run on the same machine that will" $ECHO "run configure or make. Either the GNU Autotools will need to be installed" $ECHO "or upgraded on this system, or $NAME_OF_AUTOGEN must be run on the source" $ECHO "code on another system and then transferred to here. -- Cheers!" $ECHO } ########################## # VERSION_CHECK FUNCTION # ########################## version_check ( ) { if [ "x$1" = "x" ] ; then echo "INTERNAL ERROR: version_check was not provided a minimum version" exit 1 fi _min="$1" if [ "x$2" = "x" ] ; then echo "INTERNAL ERROR: version check was not provided a comparison version" exit 1 fi _cur="$2" # needed to handle versions like 1.10 and 1.4-p6 _min="`echo ${_min}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`" _cur="`echo ${_cur}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`" _min_major="`echo $_min | cut -d. -f1`" _min_minor="`echo $_min | cut -d. -f2`" _min_patch="`echo $_min | cut -d. -f3`" _cur_major="`echo $_cur | cut -d. -f1`" _cur_minor="`echo $_cur | cut -d. -f2`" _cur_patch="`echo $_cur | cut -d. -f3`" if [ "x$_min_major" = "x" ] ; then _min_major=0 fi if [ "x$_min_minor" = "x" ] ; then _min_minor=0 fi if [ "x$_min_patch" = "x" ] ; then _min_patch=0 fi if [ "x$_cur_minor" = "x" ] ; then _cur_major=0 fi if [ "x$_cur_minor" = "x" ] ; then _cur_minor=0 fi if [ "x$_cur_patch" = "x" ] ; then _cur_patch=0 fi $VERBOSE_ECHO "Checking if ${_cur_major}.${_cur_minor}.${_cur_patch} is greater than ${_min_major}.${_min_minor}.${_min_patch}" if [ $_min_major -lt $_cur_major ] ; then return 0 elif [ $_min_major -eq $_cur_major ] ; then if [ $_min_minor -lt $_cur_minor ] ; then return 0 elif [ $_min_minor -eq $_cur_minor ] ; then if [ $_min_patch -lt $_cur_patch ] ; then return 0 elif [ $_min_patch -eq $_cur_patch ] ; then return 0 fi fi fi return 1 } ###################################### # LOCATE_CONFIGURE_TEMPLATE FUNCTION # ###################################### locate_configure_template ( ) { _pwd="`pwd`" if test -f "./configure.ac" ; then echo "./configure.ac" elif test -f "./configure.in" ; then echo "./configure.in" elif test -f "$_pwd/configure.ac" ; then echo "$_pwd/configure.ac" elif test -f "$_pwd/configure.in" ; then echo "$_pwd/configure.in" elif test -f "$PATH_TO_AUTOGEN/configure.ac" ; then echo "$PATH_TO_AUTOGEN/configure.ac" elif test -f "$PATH_TO_AUTOGEN/configure.in" ; then echo "$PATH_TO_AUTOGEN/configure.in" fi } ################## # argument check # ################## ARGS="$*" PATH_TO_AUTOGEN="`dirname $0`" NAME_OF_AUTOGEN="`basename $0`" AUTOGEN_SH="$PATH_TO_AUTOGEN/$NAME_OF_AUTOGEN" LIBTOOL_M4="${PATH_TO_AUTOGEN}/misc/libtool.m4" if [ "x$HELP" = "x" ] ; then HELP=no fi if [ "x$QUIET" = "x" ] ; then QUIET=no fi if [ "x$VERBOSE" = "x" ] ; then VERBOSE=no fi if [ "x$VERSION_ONLY" = "x" ] ; then VERSION_ONLY=no fi if [ "x$DOWNLOAD" = "x" ] ; then DOWNLOAD=no fi if [ "x$AUTORECONF_OPTIONS" = "x" ] ; then AUTORECONF_OPTIONS="-i -f" fi if [ "x$AUTOCONF_OPTIONS" = "x" ] ; then AUTOCONF_OPTIONS="-f" fi if [ "x$AUTOMAKE_OPTIONS" = "x" ] ; then AUTOMAKE_OPTIONS="-a -c -f" fi ALT_AUTOMAKE_OPTIONS="-a -c" if [ "x$LIBTOOLIZE_OPTIONS" = "x" ] ; then LIBTOOLIZE_OPTIONS="--automake -c -f" fi ALT_LIBTOOLIZE_OPTIONS="--automake --copy --force" if [ "x$ACLOCAL_OPTIONS" = "x" ] ; then ACLOCAL_OPTIONS="" fi if [ "x$AUTOHEADER_OPTIONS" = "x" ] ; then AUTOHEADER_OPTIONS="" fi if [ "x$CONFIG_GUESS_URL" = "x" ] ; then CONFIG_GUESS_URL="http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=build-aux/config.guess;hb=HEAD" fi for arg in $ARGS ; do case "x$arg" in x--help) HELP=yes ;; x-[hH]) HELP=yes ;; x--quiet) QUIET=yes ;; x-[qQ]) QUIET=yes ;; x--verbose) VERBOSE=yes ;; x-[dD]) DOWNLOAD=yes ;; x--download) DOWNLOAD=yes ;; x-[vV]) VERBOSE=yes ;; x--version) VERSION_ONLY=yes ;; *) echo "Unknown option: $arg" echo usage exit 1 ;; esac done ##################### # environment check # ##################### # sanity check before recursions potentially begin if [ ! -f "$AUTOGEN_SH" ] ; then echo "INTERNAL ERROR: $AUTOGEN_SH does not exist" if [ ! "x$0" = "x$AUTOGEN_SH" ] ; then echo "INTERNAL ERROR: dirname/basename inconsistency: $0 != $AUTOGEN_SH" fi exit 1 fi # force locale setting to C so things like date output as expected LC_ALL=C # commands that this script expects for __cmd in echo head tail pwd ; do echo "test" | $__cmd > /dev/null 2>&1 if [ $? != 0 ] ; then echo "INTERNAL ERROR: '${__cmd}' command is required" exit 2 fi done echo "test" | grep "test" > /dev/null 2>&1 if test ! x$? = x0 ; then echo "INTERNAL ERROR: grep command is required" exit 1 fi echo "test" | sed "s/test/test/" > /dev/null 2>&1 if test ! x$? = x0 ; then echo "INTERNAL ERROR: sed command is required" exit 1 fi # determine the behavior of echo case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac # determine the behavior of head case "x`echo 'head' | head -n 1 2>&1`" in *xhead*) HEAD_N="n " ;; *) HEAD_N="" ;; esac # determine the behavior of tail case "x`echo 'tail' | tail -n 1 2>&1`" in *xtail*) TAIL_N="n " ;; *) TAIL_N="" ;; esac VERBOSE_ECHO=: ECHO=: if [ "x$QUIET" = "xyes" ] ; then if [ "x$VERBOSE" = "xyes" ] ; then echo "Verbose output quelled by quiet option. Further output disabled." fi else ECHO=echo if [ "x$VERBOSE" = "xyes" ] ; then echo "Verbose output enabled" VERBOSE_ECHO=echo fi fi # allow a recursive run to disable further recursions if [ "x$RUN_RECURSIVE" = "x" ] ; then RUN_RECURSIVE=yes fi ################################################ # check for help arg and bypass version checks # ################################################ if [ "x`echo $ARGS | sed 's/.*[hH][eE][lL][pP].*/help/'`" = "xhelp" ] ; then HELP=yes fi if [ "x$HELP" = "xyes" ] ; then usage $ECHO "---" $ECHO "Help was requested. No preparation or configuration will be performed." exit 0 fi ####################### # set up signal traps # ####################### untrap_abnormal ( ) { for sig in 1 2 13 15; do trap - $sig done } # do this cleanup whenever we exit. trap ' # start from the root if test -d "$START_PATH" ; then cd "$START_PATH" fi # restore/delete backup files if test "x$PFC_INIT" = "x1" ; then recursive_restore fi ' 0 # trap SIGHUP (1), SIGINT (2), SIGPIPE (13), SIGTERM (15) for sig in 1 2 13 15; do trap ' $ECHO "" $ECHO "Aborting $NAME_OF_AUTOGEN: caught signal '$sig'" # start from the root if test -d "$START_PATH" ; then cd "$START_PATH" fi # clean up on abnormal exit $VERBOSE_ECHO "rm -rf autom4te.cache" rm -rf autom4te.cache if test -f "acinclude.m4.$$.backup" ; then $VERBOSE_ECHO "cat acinclude.m4.$$.backup > acinclude.m4" chmod u+w acinclude.m4 cat acinclude.m4.$$.backup > acinclude.m4 $VERBOSE_ECHO "rm -f acinclude.m4.$$.backup" rm -f acinclude.m4.$$.backup fi { (exit 1); exit 1; } ' $sig done ############################# # look for a configure file # ############################# if [ "x$CONFIGURE" = "x" ] ; then CONFIGURE="`locate_configure_template`" if [ ! "x$CONFIGURE" = "x" ] ; then $VERBOSE_ECHO "Found a configure template: $CONFIGURE" fi else $ECHO "Using CONFIGURE environment variable override: $CONFIGURE" fi if [ "x$CONFIGURE" = "x" ] ; then if [ "x$VERSION_ONLY" = "xyes" ] ; then CONFIGURE=/dev/null else $ECHO $ECHO "A configure.ac or configure.in file could not be located implying" $ECHO "that the GNU Build System is at least not used in this directory. In" $ECHO "any case, there is nothing to do here without one of those files." $ECHO $ECHO "ERROR: No configure.in or configure.ac file found in `pwd`" exit 1 fi fi #################### # get project name # #################### if [ "x$PROJECT" = "x" ] ; then PROJECT="`grep AC_INIT $CONFIGURE | grep -v '.*#.*AC_INIT' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_INIT(\([^,)]*\).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" if [ "x$PROJECT" = "xAC_INIT" ] ; then # projects might be using the older/deprecated arg-less AC_INIT .. look for AM_INIT_AUTOMAKE instead PROJECT="`grep AM_INIT_AUTOMAKE $CONFIGURE | grep -v '.*#.*AM_INIT_AUTOMAKE' | tail -${TAIL_N}1 | sed 's/^[ ]*AM_INIT_AUTOMAKE(\([^,)]*\).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" fi if [ "x$PROJECT" = "xAM_INIT_AUTOMAKE" ] ; then PROJECT="project" fi if [ "x$PROJECT" = "x" ] ; then PROJECT="project" fi else $ECHO "Using PROJECT environment variable override: $PROJECT" fi $ECHO "Preparing the $PROJECT build system...please wait" $ECHO ######################## # check for autoreconf # ######################## HAVE_AUTORECONF=no if [ "x$AUTORECONF" = "x" ] ; then for AUTORECONF in autoreconf ; do $VERBOSE_ECHO "Checking autoreconf version: $AUTORECONF --version" $AUTORECONF --version > /dev/null 2>&1 if [ $? = 0 ] ; then HAVE_AUTORECONF=yes break fi done else HAVE_AUTORECONF=yes $ECHO "Using AUTORECONF environment variable override: $AUTORECONF" fi ########################## # autoconf version check # ########################## _acfound=no if [ "x$AUTOCONF" = "x" ] ; then for AUTOCONF in autoconf ; do $VERBOSE_ECHO "Checking autoconf version: $AUTOCONF --version" $AUTOCONF --version > /dev/null 2>&1 if [ $? = 0 ] ; then _acfound=yes break fi done else _acfound=yes $ECHO "Using AUTOCONF environment variable override: $AUTOCONF" fi _report_error=no if [ ! "x$_acfound" = "xyes" ] ; then $ECHO "ERROR: Unable to locate GNU Autoconf." _report_error=yes else _version="`$AUTOCONF --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`" if [ "x$_version" = "x" ] ; then _version="0.0.0" fi $ECHO "Found GNU Autoconf version $_version" version_check "$AUTOCONF_VERSION" "$_version" if [ $? -ne 0 ] ; then _report_error=yes fi fi if [ "x$_report_error" = "xyes" ] ; then version_error "$AUTOCONF_VERSION" "GNU Autoconf" exit 1 fi ########################## # automake version check # ########################## _amfound=no if [ "x$AUTOMAKE" = "x" ] ; then for AUTOMAKE in automake ; do $VERBOSE_ECHO "Checking automake version: $AUTOMAKE --version" $AUTOMAKE --version > /dev/null 2>&1 if [ $? = 0 ] ; then _amfound=yes break fi done else _amfound=yes $ECHO "Using AUTOMAKE environment variable override: $AUTOMAKE" fi _report_error=no if [ ! "x$_amfound" = "xyes" ] ; then $ECHO $ECHO "ERROR: Unable to locate GNU Automake." _report_error=yes else _version="`$AUTOMAKE --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`" if [ "x$_version" = "x" ] ; then _version="0.0.0" fi $ECHO "Found GNU Automake version $_version" version_check "$AUTOMAKE_VERSION" "$_version" if [ $? -ne 0 ] ; then _report_error=yes fi fi if [ "x$_report_error" = "xyes" ] ; then version_error "$AUTOMAKE_VERSION" "GNU Automake" exit 1 fi ######################## # check for libtoolize # ######################## HAVE_LIBTOOLIZE=yes HAVE_ALT_LIBTOOLIZE=no _ltfound=no if [ "x$LIBTOOLIZE" = "x" ] ; then LIBTOOLIZE=libtoolize $VERBOSE_ECHO "Checking libtoolize version: $LIBTOOLIZE --version" $LIBTOOLIZE --version > /dev/null 2>&1 if [ ! $? = 0 ] ; then HAVE_LIBTOOLIZE=no $ECHO if [ "x$HAVE_AUTORECONF" = "xno" ] ; then $ECHO "Warning: libtoolize does not appear to be available." else $ECHO "Warning: libtoolize does not appear to be available. This means that" $ECHO "the automatic build preparation via autoreconf will probably not work." $ECHO "Preparing the build by running each step individually, however, should" $ECHO "work and will be done automatically for you if autoreconf fails." fi # look for some alternates for tool in glibtoolize libtoolize15 libtoolize14 libtoolize13 ; do $VERBOSE_ECHO "Checking libtoolize alternate: $tool --version" _glibtoolize="`$tool --version > /dev/null 2>&1`" if [ $? = 0 ] ; then $VERBOSE_ECHO "Found $tool --version" _glti="`which $tool`" if [ "x$_glti" = "x" ] ; then $VERBOSE_ECHO "Cannot find $tool with which" continue; fi if test ! -f "$_glti" ; then $VERBOSE_ECHO "Cannot use $tool, $_glti is not a file" continue; fi _gltidir="`dirname $_glti`" if [ "x$_gltidir" = "x" ] ; then $VERBOSE_ECHO "Cannot find $tool path with dirname of $_glti" continue; fi if test ! -d "$_gltidir" ; then $VERBOSE_ECHO "Cannot use $tool, $_gltidir is not a directory" continue; fi HAVE_ALT_LIBTOOLIZE=yes LIBTOOLIZE="$tool" $ECHO $ECHO "Fortunately, $tool was found which means that your system may simply" $ECHO "have a non-standard or incomplete GNU Autotools install. If you have" $ECHO "sufficient system access, it may be possible to quell this warning by" $ECHO "running:" $ECHO sudo -V > /dev/null 2>&1 if [ $? = 0 ] ; then $ECHO " sudo ln -s $_glti $_gltidir/libtoolize" $ECHO else $ECHO " ln -s $_glti $_gltidir/libtoolize" $ECHO $ECHO "Run that as root or with proper permissions to the $_gltidir directory" $ECHO fi _ltfound=yes break fi done else _ltfound=yes fi else _ltfound=yes $ECHO "Using LIBTOOLIZE environment variable override: $LIBTOOLIZE" fi ############################ # libtoolize version check # ############################ _report_error=no if [ ! "x$_ltfound" = "xyes" ] ; then $ECHO $ECHO "ERROR: Unable to locate GNU Libtool." _report_error=yes else _version="`$LIBTOOLIZE --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`" if [ "x$_version" = "x" ] ; then _version="0.0.0" fi $ECHO "Found GNU Libtool version $_version" version_check "$LIBTOOL_VERSION" "$_version" if [ $? -ne 0 ] ; then _report_error=yes fi fi if [ "x$_report_error" = "xyes" ] ; then version_error "$LIBTOOL_VERSION" "GNU Libtool" exit 1 fi ##################### # check for aclocal # ##################### if [ "x$ACLOCAL" = "x" ] ; then for ACLOCAL in aclocal ; do $VERBOSE_ECHO "Checking aclocal version: $ACLOCAL --version" $ACLOCAL --version > /dev/null 2>&1 if [ $? = 0 ] ; then break fi done else $ECHO "Using ACLOCAL environment variable override: $ACLOCAL" fi ######################## # check for autoheader # ######################## if [ "x$AUTOHEADER" = "x" ] ; then for AUTOHEADER in autoheader ; do $VERBOSE_ECHO "Checking autoheader version: $AUTOHEADER --version" $AUTOHEADER --version > /dev/null 2>&1 if [ $? = 0 ] ; then break fi done else $ECHO "Using AUTOHEADER environment variable override: $AUTOHEADER" fi ######################### # check if version only # ######################### $VERBOSE_ECHO "Checking whether to only output version information" if [ "x$VERSION_ONLY" = "xyes" ] ; then $ECHO ident $ECHO "---" $ECHO "Version requested. No preparation or configuration will be performed." exit 0 fi ################################# # PROTECT_FROM_CLOBBER FUNCTION # ################################# protect_from_clobber ( ) { PFC_INIT=1 # protect COPYING & INSTALL from overwrite by automake. the # automake force option will (inappropriately) ignore the existing # contents of a COPYING and/or INSTALL files (depending on the # version) instead of just forcing *missing* files like it does # for AUTHORS, NEWS, and README. this is broken but extremely # prevalent behavior, so we protect against it by keeping a backup # of the file that can later be restored. for file in COPYING INSTALL ; do if test -f ${file} ; then if test -f ${file}.$$.protect_from_automake.backup ; then $VERBOSE_ECHO "Already backed up ${file} in `pwd`" else $VERBOSE_ECHO "Backing up ${file} in `pwd`" $VERBOSE_ECHO "cp -p ${file} ${file}.$$.protect_from_automake.backup" cp -p ${file} ${file}.$$.protect_from_automake.backup fi fi done } ############################## # RECURSIVE_PROTECT FUNCTION # ############################## recursive_protect ( ) { # for projects using recursive configure, run the build # preparation steps for the subdirectories. this function assumes # START_PATH was set to pwd before recursion begins so that # relative paths work. # git 'r done, protect COPYING and INSTALL from being clobbered protect_from_clobber if test -d autom4te.cache ; then $VERBOSE_ECHO "Found an autom4te.cache directory, deleting it" $VERBOSE_ECHO "rm -rf autom4te.cache" rm -rf autom4te.cache fi # find configure template _configure="`locate_configure_template`" if [ "x$_configure" = "x" ] ; then return fi # $VERBOSE_ECHO "Looking for configure template found `pwd`/$_configure" # look for subdirs # $VERBOSE_ECHO "Looking for subdirs in `pwd`" _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $_configure | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" CHECK_DIRS="" for dir in $_det_config_subdirs ; do if test -d "`pwd`/$dir" ; then CHECK_DIRS="$CHECK_DIRS \"`pwd`/$dir\"" fi done # process subdirs if [ ! "x$CHECK_DIRS" = "x" ] ; then $VERBOSE_ECHO "Recursively scanning the following directories:" $VERBOSE_ECHO " $CHECK_DIRS" for dir in $CHECK_DIRS ; do $VERBOSE_ECHO "Protecting files from automake in $dir" cd "$START_PATH" eval "cd $dir" # recursively git 'r done recursive_protect done fi } # end of recursive_protect ############################# # RESTORE_CLOBBERED FUNCION # ############################# restore_clobbered ( ) { # The automake (and autoreconf by extension) -f/--force-missing # option may overwrite COPYING and INSTALL even if they do exist. # Here we restore the files if necessary. spacer=no for file in COPYING INSTALL ; do if test -f ${file}.$$.protect_from_automake.backup ; then if test -f ${file} ; then # compare entire content, restore if needed if test "x`cat ${file}`" != "x`cat ${file}.$$.protect_from_automake.backup`" ; then if test "x$spacer" = "xno" ; then $VERBOSE_ECHO spacer=yes fi # restore the backup $VERBOSE_ECHO "Restoring ${file} from backup (automake -f likely clobbered it)" $VERBOSE_ECHO "rm -f ${file}" rm -f ${file} $VERBOSE_ECHO "mv ${file}.$$.protect_from_automake.backup ${file}" mv ${file}.$$.protect_from_automake.backup ${file} fi # check contents elif test -f ${file}.$$.protect_from_automake.backup ; then $VERBOSE_ECHO "mv ${file}.$$.protect_from_automake.backup ${file}" mv ${file}.$$.protect_from_automake.backup ${file} fi # -f ${file} # just in case $VERBOSE_ECHO "rm -f ${file}.$$.protect_from_automake.backup" rm -f ${file}.$$.protect_from_automake.backup fi # -f ${file}.$$.protect_from_automake.backup done CONFIGURE="`locate_configure_template`" if [ "x$CONFIGURE" = "x" ] ; then return fi _aux_dir="`grep AC_CONFIG_AUX_DIR $CONFIGURE | grep -v '.*#.*AC_CONFIG_AUX_DIR' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_CONFIG_AUX_DIR(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" if test ! -d "$_aux_dir" ; then _aux_dir=. fi for file in config.guess config.sub ltmain.sh ; do if test -f "${_aux_dir}/${file}" ; then $VERBOSE_ECHO "rm -f \"${_aux_dir}/${file}.backup\"" rm -f "${_aux_dir}/${file}.backup" fi done } # end of restore_clobbered ############################## # RECURSIVE_RESTORE FUNCTION # ############################## recursive_restore ( ) { # restore COPYING and INSTALL from backup if they were clobbered # for each directory recursively. # git 'r undone restore_clobbered # find configure template _configure="`locate_configure_template`" if [ "x$_configure" = "x" ] ; then return fi # look for subdirs _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $_configure | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" CHECK_DIRS="" for dir in $_det_config_subdirs ; do if test -d "`pwd`/$dir" ; then CHECK_DIRS="$CHECK_DIRS \"`pwd`/$dir\"" fi done # process subdirs if [ ! "x$CHECK_DIRS" = "x" ] ; then $VERBOSE_ECHO "Recursively scanning the following directories:" $VERBOSE_ECHO " $CHECK_DIRS" for dir in $CHECK_DIRS ; do $VERBOSE_ECHO "Checking files for automake damage in $dir" cd "$START_PATH" eval "cd $dir" # recursively git 'r undone recursive_restore done fi } # end of recursive_restore ####################### # INITIALIZE FUNCTION # ####################### initialize ( ) { # this routine performs a variety of directory-specific # initializations. some are sanity checks, some are preventive, # and some are necessary setup detection. # # this function sets: # CONFIGURE # SEARCH_DIRS # CONFIG_SUBDIRS ################################## # check for a configure template # ################################## CONFIGURE="`locate_configure_template`" if [ "x$CONFIGURE" = "x" ] ; then $ECHO $ECHO "A configure.ac or configure.in file could not be located implying" $ECHO "that the GNU Build System is at least not used in this directory. In" $ECHO "any case, there is nothing to do here without one of those files." $ECHO $ECHO "ERROR: No configure.in or configure.ac file found in `pwd`" exit 1 fi ##################### # detect an aux dir # ##################### _aux_dir="`grep AC_CONFIG_AUX_DIR $CONFIGURE | grep -v '.*#.*AC_CONFIG_AUX_DIR' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_CONFIG_AUX_DIR(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" if test ! -d "$_aux_dir" ; then _aux_dir=. else $VERBOSE_ECHO "Detected auxillary directory: $_aux_dir" fi ################################ # detect a recursive configure # ################################ CONFIG_SUBDIRS="" _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $CONFIGURE | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" for dir in $_det_config_subdirs ; do if test -d "`pwd`/$dir" ; then $VERBOSE_ECHO "Detected recursive configure directory: `pwd`/$dir" CONFIG_SUBDIRS="$CONFIG_SUBDIRS `pwd`/$dir" fi done ########################################################### # make sure certain required files exist for GNU projects # ########################################################### _marker_found="" _marker_found_message_intro='Detected non-GNU marker "' _marker_found_message_mid='" in ' for marker in foreign cygnus ; do _marker_found_message=${_marker_found_message_intro}${marker}${_marker_found_message_mid} _marker_found="`grep 'AM_INIT_AUTOMAKE.*'${marker} $CONFIGURE`" if [ ! "x$_marker_found" = "x" ] ; then $VERBOSE_ECHO "${_marker_found_message}`basename \"$CONFIGURE\"`" break fi if test -f "`dirname \"$CONFIGURE\"/Makefile.am`" ; then _marker_found="`grep 'AUTOMAKE_OPTIONS.*'${marker} Makefile.am`" if [ ! "x$_marker_found" = "x" ] ; then $VERBOSE_ECHO "${_marker_found_message}Makefile.am" break fi fi done if [ "x${_marker_found}" = "x" ] ; then _suggest_foreign=no for file in AUTHORS COPYING ChangeLog INSTALL NEWS README ; do if [ ! -f $file ] ; then $VERBOSE_ECHO "Touching ${file} since it does not exist" _suggest_foreign=yes touch $file fi done if [ "x${_suggest_foreign}" = "xyes" ] ; then $ECHO $ECHO "Warning: Several files expected of projects that conform to the GNU" $ECHO "coding standards were not found. The files were automatically added" $ECHO "for you since you do not have a 'foreign' declaration specified." $ECHO $ECHO "Considered adding 'foreign' to AM_INIT_AUTOMAKE in `basename \"$CONFIGURE\"`" if test -f "`dirname \"$CONFIGURE\"/Makefile.am`" ; then $ECHO "or to AUTOMAKE_OPTIONS in your top-level Makefile.am file." fi $ECHO fi fi ################################################## # make sure certain generated files do not exist # ################################################## for file in config.guess config.sub ltmain.sh ; do if test -f "${_aux_dir}/${file}" ; then $VERBOSE_ECHO "mv -f \"${_aux_dir}/${file}\" \"${_aux_dir}/${file}.backup\"" mv -f "${_aux_dir}/${file}" "${_aux_dir}/${file}.backup" fi done ############################ # search alternate m4 dirs # ############################ SEARCH_DIRS="" for dir in m4 ; do if [ -d $dir ] ; then $VERBOSE_ECHO "Found extra aclocal search directory: $dir" SEARCH_DIRS="$SEARCH_DIRS -I $dir" fi done ###################################### # remove any previous build products # ###################################### if test -d autom4te.cache ; then $VERBOSE_ECHO "Found an autom4te.cache directory, deleting it" $VERBOSE_ECHO "rm -rf autom4te.cache" rm -rf autom4te.cache fi # tcl/tk (and probably others) have a customized aclocal.m4, so can't delete it # if test -f aclocal.m4 ; then # $VERBOSE_ECHO "Found an aclocal.m4 file, deleting it" # $VERBOSE_ECHO "rm -f aclocal.m4" # rm -f aclocal.m4 # fi } # end of initialize() ############## # initialize # ############## # stash path START_PATH="`pwd`" # Before running autoreconf or manual steps, some prep detection work # is necessary or useful. Only needs to occur once per directory, but # does need to traverse the entire subconfigure hierarchy to protect # files from being clobbered even by autoreconf. recursive_protect # start from where we started cd "$START_PATH" # get ready to process initialize ######################################### # DOWNLOAD_GNULIB_CONFIG_GUESS FUNCTION # ######################################### # TODO - should make sure wget/curl exist and/or work before trying to # use them. download_gnulib_config_guess () { # abuse gitweb to download gnulib's latest config.guess via HTTP config_guess_temp="config.guess.$$.download" ret=1 for __cmd in wget curl fetch ; do $VERBOSE_ECHO "Checking for command ${__cmd}" ${__cmd} --version > /dev/null 2>&1 ret=$? if [ ! $ret = 0 ] ; then continue fi __cmd_version=`${__cmd} --version | head -n 1 | sed -e 's/^[^0-9]\+//' -e 's/ .*//'` $VERBOSE_ECHO "Found ${__cmd} ${__cmd_version}" opts="" case ${__cmd} in wget) opts="-O" ;; curl) opts="-o" ;; fetch) opts="-t 5 -f" ;; esac $VERBOSE_ECHO "Running $__cmd \"${CONFIG_GUESS_URL}\" $opts \"${config_guess_temp}\"" eval "$__cmd \"${CONFIG_GUESS_URL}\" $opts \"${config_guess_temp}\"" > /dev/null 2>&1 if [ $? = 0 ] ; then mv -f "${config_guess_temp}" ${_aux_dir}/config.guess ret=0 break fi done if [ ! $ret = 0 ] ; then $ECHO "Warning: config.guess download failed from: $CONFIG_GUESS_URL" rm -f "${config_guess_temp}" fi } ############################## # LIBTOOLIZE_NEEDED FUNCTION # ############################## libtoolize_needed () { ret=1 # means no, don't need libtoolize for feature in AC_PROG_LIBTOOL AM_PROG_LIBTOOL LT_INIT ; do $VERBOSE_ECHO "Searching for $feature in $CONFIGURE" found="`grep \"^$feature.*\" $CONFIGURE`" if [ ! "x$found" = "x" ] ; then ret=0 # means yes, need to run libtoolize break fi done return ${ret} } ############################################ # prepare build via autoreconf or manually # ############################################ reconfigure_manually=no if [ "x$HAVE_AUTORECONF" = "xyes" ] ; then $ECHO $ECHO $ECHO_N "Automatically preparing build ... $ECHO_C" $VERBOSE_ECHO "$AUTORECONF $SEARCH_DIRS $AUTORECONF_OPTIONS" autoreconf_output="`$AUTORECONF $SEARCH_DIRS $AUTORECONF_OPTIONS 2>&1`" ret=$? $VERBOSE_ECHO "$autoreconf_output" if [ ! $ret = 0 ] ; then if [ "x$HAVE_ALT_LIBTOOLIZE" = "xyes" ] ; then if [ ! "x`echo \"$autoreconf_output\" | grep libtoolize | grep \"No such file or directory\"`" = "x" ] ; then $ECHO $ECHO "Warning: autoreconf failed but due to what is usually a common libtool" $ECHO "misconfiguration issue. This problem is encountered on systems that" $ECHO "have installed libtoolize under a different name without providing a" $ECHO "symbolic link or without setting the LIBTOOLIZE environment variable." $ECHO $ECHO "Restarting the preparation steps with LIBTOOLIZE set to $LIBTOOLIZE" export LIBTOOLIZE RUN_RECURSIVE=no export RUN_RECURSIVE untrap_abnormal $VERBOSE_ECHO sh $AUTOGEN_SH "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" sh "$AUTOGEN_SH" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" exit $? fi fi $ECHO "Warning: $AUTORECONF failed" if test -f ltmain.sh ; then $ECHO "libtoolize being run by autoreconf is not creating ltmain.sh in the auxillary directory like it should" fi $ECHO "Attempting to run the preparation steps individually" reconfigure_manually=yes else if [ "x$DOWNLOAD" = "xyes" ] ; then if libtoolize_needed ; then download_gnulib_config_guess fi fi fi else reconfigure_manually=yes fi ############################ # LIBTOOL_FAILURE FUNCTION # ############################ libtool_failure ( ) { # libtool is rather error-prone in comparison to the other # autotools and this routine attempts to compensate for some # common failures. the output after a libtoolize failure is # parsed for an error related to AC_PROG_LIBTOOL and if found, we # attempt to inject a project-provided libtool.m4 file. _autoconf_output="$1" if [ "x$RUN_RECURSIVE" = "xno" ] ; then # we already tried the libtool.m4, don't try again return 1 fi if test -f "$LIBTOOL_M4" ; then found_libtool="`$ECHO $_autoconf_output | grep AC_PROG_LIBTOOL`" if test ! "x$found_libtool" = "x" ; then if test -f acinclude.m4 ; then rm -f acinclude.m4.$$.backup $VERBOSE_ECHO "cat acinclude.m4 > acinclude.m4.$$.backup" cat acinclude.m4 > acinclude.m4.$$.backup fi $VERBOSE_ECHO "cat \"$LIBTOOL_M4\" >> acinclude.m4" chmod u+w acinclude.m4 cat "$LIBTOOL_M4" >> acinclude.m4 # don't keep doing this RUN_RECURSIVE=no export RUN_RECURSIVE untrap_abnormal $ECHO $ECHO "Restarting the preparation steps with libtool macros in acinclude.m4" $VERBOSE_ECHO sh $AUTOGEN_SH "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" sh "$AUTOGEN_SH" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" exit $? fi fi } ########################### # MANUAL_AUTOGEN FUNCTION # ########################### manual_autogen ( ) { ################################################## # Manual preparation steps taken are as follows: # # aclocal [-I m4] # # libtoolize --automake -c -f # # aclocal [-I m4] # # autoconf -f # # autoheader # # automake -a -c -f # ################################################## ########### # aclocal # ########### $VERBOSE_ECHO "$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS" aclocal_output="`$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS 2>&1`" ret=$? $VERBOSE_ECHO "$aclocal_output" if [ ! $ret = 0 ] ; then $ECHO "ERROR: $ACLOCAL failed" && exit 2 ; fi ############## # libtoolize # ############## if libtoolize_needed ; then if [ "x$HAVE_LIBTOOLIZE" = "xyes" ] ; then $VERBOSE_ECHO "$LIBTOOLIZE $LIBTOOLIZE_OPTIONS" libtoolize_output="`$LIBTOOLIZE $LIBTOOLIZE_OPTIONS 2>&1`" ret=$? $VERBOSE_ECHO "$libtoolize_output" if [ ! $ret = 0 ] ; then $ECHO "ERROR: $LIBTOOLIZE failed" && exit 2 ; fi else if [ "x$HAVE_ALT_LIBTOOLIZE" = "xyes" ] ; then $VERBOSE_ECHO "$LIBTOOLIZE $ALT_LIBTOOLIZE_OPTIONS" libtoolize_output="`$LIBTOOLIZE $ALT_LIBTOOLIZE_OPTIONS 2>&1`" ret=$? $VERBOSE_ECHO "$libtoolize_output" if [ ! $ret = 0 ] ; then $ECHO "ERROR: $LIBTOOLIZE failed" && exit 2 ; fi fi fi ########### # aclocal # ########### # re-run again as instructed by libtoolize $VERBOSE_ECHO "$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS" aclocal_output="`$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS 2>&1`" ret=$? $VERBOSE_ECHO "$aclocal_output" # libtoolize might put ltmain.sh in the wrong place if test -f ltmain.sh ; then if test ! -f "${_aux_dir}/ltmain.sh" ; then $ECHO $ECHO "Warning: $LIBTOOLIZE is creating ltmain.sh in the wrong directory" $ECHO $ECHO "Fortunately, the problem can be worked around by simply copying the" $ECHO "file to the appropriate location (${_aux_dir}/). This has been done for you." $ECHO $VERBOSE_ECHO "cp -p ltmain.sh \"${_aux_dir}/ltmain.sh\"" cp -p ltmain.sh "${_aux_dir}/ltmain.sh" $ECHO $ECHO_N "Continuing build preparation ... $ECHO_C" fi fi # ltmain.sh if [ "x$DOWNLOAD" = "xyes" ] ; then download_gnulib_config_guess fi fi # libtoolize_needed ############ # autoconf # ############ $VERBOSE_ECHO $VERBOSE_ECHO "$AUTOCONF $AUTOCONF_OPTIONS" autoconf_output="`$AUTOCONF $AUTOCONF_OPTIONS 2>&1`" ret=$? $VERBOSE_ECHO "$autoconf_output" if [ ! $ret = 0 ] ; then # retry without the -f and check for usage of macros that are too new ac2_59_macros="AC_C_RESTRICT AC_INCLUDES_DEFAULT AC_LANG_ASSERT AC_LANG_WERROR AS_SET_CATFILE" ac2_55_macros="AC_COMPILER_IFELSE AC_FUNC_MBRTOWC AC_HEADER_STDBOOL AC_LANG_CONFTEST AC_LANG_SOURCE AC_LANG_PROGRAM AC_LANG_CALL AC_LANG_FUNC_TRY_LINK AC_MSG_FAILURE AC_PREPROC_IFELSE" ac2_54_macros="AC_C_BACKSLASH_A AC_CONFIG_LIBOBJ_DIR AC_GNU_SOURCE AC_PROG_EGREP AC_PROG_FGREP AC_REPLACE_FNMATCH AC_FUNC_FNMATCH_GNU AC_FUNC_REALLOC AC_TYPE_MBSTATE_T" macros_to_search="" ac_major="`echo ${AUTOCONF_VERSION}. | cut -d. -f1 | sed 's/[^0-9]//g'`" ac_minor="`echo ${AUTOCONF_VERSION}. | cut -d. -f2 | sed 's/[^0-9]//g'`" if [ $ac_major -lt 2 ] ; then macros_to_search="$ac2_59_macros $ac2_55_macros $ac2_54_macros" else if [ $ac_minor -lt 54 ] ; then macros_to_search="$ac2_59_macros $ac2_55_macros $ac2_54_macros" elif [ $ac_minor -lt 55 ] ; then macros_to_search="$ac2_59_macros $ac2_55_macros" elif [ $ac_minor -lt 59 ] ; then macros_to_search="$ac2_59_macros" fi fi configure_ac_macros=__none__ for feature in $macros_to_search ; do $VERBOSE_ECHO "Searching for $feature in $CONFIGURE" found="`grep \"^$feature.*\" $CONFIGURE`" if [ ! "x$found" = "x" ] ; then if [ "x$configure_ac_macros" = "x__none__" ] ; then configure_ac_macros="$feature" else configure_ac_macros="$feature $configure_ac_macros" fi fi done if [ ! "x$configure_ac_macros" = "x__none__" ] ; then $ECHO $ECHO "Warning: Unsupported macros were found in $CONFIGURE" $ECHO $ECHO "The `basename \"$CONFIGURE\"` file was scanned in order to determine if any" $ECHO "unsupported macros are used that exceed the minimum version" $ECHO "settings specified within this file. As such, the following macros" $ECHO "should be removed from configure.ac or the version numbers in this" $ECHO "file should be increased:" $ECHO $ECHO "$configure_ac_macros" $ECHO $ECHO $ECHO_N "Ignorantly continuing build preparation ... $ECHO_C" fi ################### # autoconf, retry # ################### $VERBOSE_ECHO $VERBOSE_ECHO "$AUTOCONF" autoconf_output="`$AUTOCONF 2>&1`" ret=$? $VERBOSE_ECHO "$autoconf_output" if [ ! $ret = 0 ] ; then # test if libtool is busted libtool_failure "$autoconf_output" # let the user know what went wrong cat <. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` ;; esac case "${UNAME_MACHINE}" in i?86) test -z "$VENDOR" && VENDOR=pc ;; *) test -z "$VENDOR" && VENDOR=unknown ;; esac test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-${VENDOR}-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-${VENDOR}-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-${VENDOR}-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-${VENDOR}-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-${VENDOR}-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-${VENDOR}-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-${VENDOR}-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-${VENDOR}-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-${VENDOR}-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-${VENDOR}-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-${VENDOR}-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-${VENDOR}-osf1mk else echo ${UNAME_MACHINE}-${VENDOR}-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-${VENDOR}-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-${VENDOR}-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-${VENDOR}-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-${VENDOR}-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-${VENDOR}-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-${VENDOR}-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-${VENDOR}-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-${VENDOR}-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-${VENDOR}-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-${LIBC}"; exit; } ;; or1k:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-${VENDOR}-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-${VENDOR}-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-${VENDOR}-linux-${LIBC} ;; PA8*) echo hppa2.0-${VENDOR}-linux-${LIBC} ;; *) echo hppa-${VENDOR}-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-${VENDOR}-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-${VENDOR}-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-${VENDOR}-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-${VENDOR}-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-${VENDOR}-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-${VENDOR}-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-${VENODR}-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-${VENDOR}-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-${VENODR}-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-${VENDOR}-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-${VENDOR}-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-${VENDOR}-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-${VENDOR}-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-${VENDOR}-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-${VENDOR}-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-${VENDOR}-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-${VENDOR}-tops10 exit ;; *:TENEX:*:*) echo pdp10-${VENDOR}-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-${VENDOR}-tops20 exit ;; *:ITS:*:*) echo pdp10-${VENDOR}-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-${VENDOR}-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-${VENDOR}-esx exit ;; esac eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: smenu-0.9.15/build-aux/config.sub000077500000000000000000001053011344767411600166270ustar00rootroot00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-04-24' # This file 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 . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or1k-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: smenu-0.9.15/build-aux/depcomp000077500000000000000000000560161344767411600162310ustar00rootroot00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2013 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, 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 . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: smenu-0.9.15/build-aux/install-sh000077500000000000000000000332551344767411600166600ustar00rootroot00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-11-20.07; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # 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 # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: smenu-0.9.15/build-aux/missing000077500000000000000000000153311344767411600162460ustar00rootroot00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2012-06-26.16; # UTC # Copyright (C) 1996-2013 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, 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 . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'automa4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: smenu-0.9.15/build.sh000077500000000000000000000012111344767411600144030ustar00rootroot00000000000000#!/bin/sh # Manage --help option # """""""""""""""""""" if echo "$@" | grep -- "--help"; then ./configure --help | sed s/configure/build.sh/g exit 1 fi # Ensure that aclocal wont' be called # """"""""""""""""""""""""""""""""""" touch aclocal.m4 touch Makefile.in configure config.h.in # Create the Makefile # """"""""""""""""""" ./configure "$@" # Add the git version if this is a git clone # """""""""""""""""""""""""""""""""""""""""" [ -d .git ] && V=`git log -1 --pretty=format:-%h` || V="" sed "/VERSION/s/\$/ \"$V\"/" config.h > /tmp/config.h$$ mv /tmp/config.h$$ config.h # Create the executable # """"""""""""""""""""" make exit 0 smenu-0.9.15/config.h.in000066400000000000000000000100301344767411600147670ustar00rootroot00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_LANGINFO_H /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC /* Define to 1 if you have the `mblen' function. */ #undef HAVE_MBLEN /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define to 1 if you have the `nl_langinfo' function. */ #undef HAVE_NL_LANGINFO /* Define to 1 if you have the `pathconf' function. */ #undef HAVE_PATHCONF /* Define to 1 if your system has a GNU libc compatible `realloc' function, and to 0 otherwise. */ #undef HAVE_REALLOC /* Define to 1 if you have the `regcomp' function. */ #undef HAVE_REGCOMP /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define to 1 if you have the `strspn' function. */ #undef HAVE_STRSPN /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the header file. */ #undef HAVE_WCHAR_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Version number of package */ #undef VERSION /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc /* Define to rpl_realloc if the replacement function should be used. */ #undef realloc /* Define to `unsigned int' if does not define. */ #undef size_t smenu-0.9.15/configure000077500000000000000000005605471344767411600147020ustar00rootroot00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for smenu 0.9.15. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: p.gen.progs@gmail.com about your system, including any $0: error possibly output before this message. Then install $0: a modern shell, or manually run the script under such a $0: shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='smenu' PACKAGE_TARNAME='smenu' PACKAGE_VERSION='0.9.15' PACKAGE_STRING='smenu 0.9.15' PACKAGE_BUGREPORT='p.gen.progs@gmail.com' PACKAGE_URL='' ac_unique_file="smenu.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBOBJS LN_S EGREP GREP CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures smenu 0.9.15 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/smenu] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of smenu 0.9.15:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF smenu configure 0.9.15 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ------------------------------------ ## ## Report this to p.gen.progs@gmail.com ## ## ------------------------------------ ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by smenu $as_me 0.9.15, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" ac_aux_dir= for ac_dir in build-aux "$srcdir"/build-aux; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in build-aux \"$srcdir\"/build-aux" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. am__api_version='1.13' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='smenu' VERSION='0.9.15' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' # Checks for programs. DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= fi if test "$MINIX" = yes; then $as_echo "#define _POSIX_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h $as_echo "#define _MINIX 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_safe_to_define___extensions__=yes else ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h $as_echo "#define _ALL_SOURCE 1" >>confdefs.h $as_echo "#define _GNU_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done case $ac_cv_prog_cc_stdc in #( no) : ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #( *) : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 $as_echo_n "checking for $CC option to accept ISO C99... " >&6; } if ${ac_cv_prog_cc_c99+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include #include // Check varargs macros. These examples are taken from C99 6.10.3.5. #define debug(...) fprintf (stderr, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK your preprocessor is broken; #endif #if BIG_OK #else your preprocessor is broken; #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\0'; ++i) continue; return 0; } // Check varargs and va_copy. static void test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str; int number; float fnumber; while (*format) { switch (*format++) { case 's': // string str = va_arg (args_copy, const char *); break; case 'd': // int number = va_arg (args_copy, int); break; case 'f': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); } int main () { // Check bool. _Bool success = false; // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. test_varargs ("s, d' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' || dynamic_array[ni.number - 1] != 543); ; return 0; } _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c99" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c99" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 $as_echo "$ac_cv_prog_cc_c99" >&6; } ;; esac if test "x$ac_cv_prog_cc_c99" != xno; then : ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 else ac_cv_prog_cc_stdc=no fi fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5 $as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; } if ${ac_cv_prog_cc_stdc+:} false; then : $as_echo_n "(cached) " >&6 fi case $ac_cv_prog_cc_stdc in #( no) : { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; #( '') : { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; #( *) : { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5 $as_echo "$ac_cv_prog_cc_stdc" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5 $as_echo_n "checking for library containing tgetent... " >&6; } if ${ac_cv_search_tgetent+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tgetent (); int main () { return tgetent (); ; return 0; } _ACEOF for ac_lib in '' tinfo curses ncursesw ncurses; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_tgetent=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_tgetent+:} false; then : break fi done if ${ac_cv_search_tgetent+:} false; then : else ac_cv_search_tgetent=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_tgetent" >&5 $as_echo "$ac_cv_search_tgetent" >&6; } ac_res=$ac_cv_search_tgetent if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" HAVE_CURSES=True fi # Checks for libraries. # Checks for header files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi for ac_header in fcntl.h limits.h langinfo.h locale.h stdint.h stdlib.h \ string.h sys/ioctl.h sys/time.h termios.h unistd.h wchar.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Checks for typedefs, structures, and compiler characteristics. ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi # Checks for library functions. for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 $as_echo_n "checking for GNU libc compatible realloc... " >&6; } if ${ac_cv_func_realloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_realloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *realloc (); #endif int main () { return ! realloc (0, 0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_realloc_0_nonnull=yes else ac_cv_func_realloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 $as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } if test $ac_cv_func_realloc_0_nonnull = yes; then : $as_echo "#define HAVE_REALLOC 1" >>confdefs.h else $as_echo "#define HAVE_REALLOC 0" >>confdefs.h case " $LIBOBJS " in *" realloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;; esac $as_echo "#define realloc rpl_realloc" >>confdefs.h fi for ac_func in mblen memset nl_langinfo pathconf regcomp setlocale do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in strchr strrchr strspn strcasecmp do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # OS-specific tests case "${host_os}" in *freebsd*|*dragonfly*) CPPFLAGS="-D__BSD_VISIBLE $CPPFLAGS" ;; *darwin*) CPPFLAGS="-D_DARWIN_C_SOURCE $CPPFLAGS" ;; *netbsd*) CPPFLAGS="-D_NETBSD_SOURCE $CPPFLAGS" ;; *openbsd*|*bitrig*) CPPFLAGS="-D_BSD_SOURCE $CPPFLAGS" ;; esac ac_config_files="$ac_config_files Makefile" ac_config_files="$ac_config_files smenu.spec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by smenu $as_me 0.9.15, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ smenu config.status 0.9.15 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "smenu.spec") CONFIG_FILES="$CONFIG_FILES smenu.spec" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi smenu-0.9.15/configure.ac000066400000000000000000000027211344767411600152420ustar00rootroot00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. m4_define(my_version, [m4_esyscmd([tr -d '\n' < version])]) AC_PREREQ([2.69]) AC_INIT([smenu], [my_version], [p.gen.progs@gmail.com]) AC_CONFIG_SRCDIR([smenu.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([no-dist-gzip dist-bzip2 foreign -Wall]) AM_SILENT_RULES([yes]) # Checks for programs. AC_USE_SYSTEM_EXTENSIONS AC_PROG_AWK AC_PROG_CC_STDC AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_SEARCH_LIBS([tgetent], [tinfo curses ncursesw ncurses], [HAVE_CURSES=True]) # Checks for libraries. # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([fcntl.h limits.h langinfo.h locale.h stdint.h stdlib.h \ string.h sys/ioctl.h sys/time.h termios.h unistd.h wchar.h]) # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T # Checks for library functions. AC_FUNC_MALLOC AC_FUNC_REALLOC AC_CHECK_FUNCS([mblen memset nl_langinfo pathconf regcomp setlocale]) AC_CHECK_FUNCS([strchr strrchr strspn strcasecmp]) AC_CANONICAL_HOST # OS-specific tests case "${host_os}" in *freebsd*|*dragonfly*) CPPFLAGS="-D__BSD_VISIBLE $CPPFLAGS" ;; *darwin*) CPPFLAGS="-D_DARWIN_C_SOURCE $CPPFLAGS" ;; *netbsd*) CPPFLAGS="-D_NETBSD_SOURCE $CPPFLAGS" ;; *openbsd*|*bitrig*) CPPFLAGS="-D_BSD_SOURCE $CPPFLAGS" ;; esac AC_CONFIG_FILES([Makefile]) AC_OUTPUT([smenu.spec]) smenu-0.9.15/examples/000077500000000000000000000000001344767411600145705ustar00rootroot00000000000000smenu-0.9.15/examples/lvm_menu/000077500000000000000000000000001344767411600164125ustar00rootroot00000000000000smenu-0.9.15/examples/lvm_menu/README000066400000000000000000000006701344767411600172750ustar00rootroot00000000000000This is an example of bash tool to build a customized LVM management menu. First, make sure to make menu.sh and lvm_menu.sh executable: (chmod +x menu.sh lvm_menu.sh). menu.sh is used to create a generic menu with smenu lvm_menu.sh uses menu.sh to create a specialized menu to manage LVM objects Running lvm_menu.sh -i should display something similar to the screenshot provided. In this screenshot the user is about to delete a LV. smenu-0.9.15/examples/lvm_menu/lvm_menu.sh000066400000000000000000000022001344767411600205620ustar00rootroot00000000000000#!/usr/bin/env bash # ==================== # # Fatal error function # # ==================== # function error { echo $* >&2 exit 1 } # Check for the presence of smenu # """"""""""""""""""""""""""""""" SMENU=$(which smenu 2>/dev/null) [[ -x "$SMENU" ]] || error "smenu is not in the PATH or not executable." MENU+="\ 'Create' 'Delete' 'Extend' 'Shrink' 'VGC VG' 'VGD VG' 'VGE VG' 'VGS VG' 'LVC LV' 'LVD LV' 'LVE LV' 'LVS LV' 'PVC PV' 'PVD PV' # 'L List' # 'Quit Exit menu'" trap "exit 1" INT while true do clear echo "Executing ${0##*/}" echo MESSAGE="LVM management" read REP <<< $(echo "$MENU" | ./menu.sh -p $SMENU -i "$MESSAGE" "-Re1") case $REP in ABORT) exit 1 ;; QUIT) exit 0 ;; L) echo List ;; VGC) echo VG create ;; VGD) echo VG delete ;; VGE) echo VG expand ;; VGS) echo VG shrink ;; LVC) echo LV create ;; LVD) echo LV delete ;; LVE) echo LV expand ;; LVS) echo LV shrink ;; PVC) echo PV create ;; PVD) echo PV delete ;; esac echo echo -n "Press to continue" read done exit 0 smenu-0.9.15/examples/lvm_menu/menu.sh000066400000000000000000000042211344767411600177110ustar00rootroot00000000000000#!/usr/bin/env bash # ################################################################ # # Frontend to smenu to display a nice menu # # # # FLAGS: -p The path of the smenu program # # -i (optional) add some help in the title # # # # ARGS: $1 (required) must contain a string which will become # # the menu title # # $2... (optional) adds more options passed to smenu # # # # RC: 0 OK # # 1 KO # # ################################################################ # # ============== # # usage function # # ============== # function usage { echo "menu.sh [-i] title [smenu options]" exit 1 } declare integer INFO=0 # Option processing # """"""""""""""""" while getopts p:ih OPT 2>/dev/null do case ${OPT} in p) SMENU=${OPTARG} ;; i) INFO=1 ;; h|*) usage exit 1 ;; esac done shift $((${OPTIND} - 1)) # Menu title generation # """"""""""""""""""""" if [[ $1 ]]; then MESSAGE="$1" (( INFO )) && MESSAGE+=$'\n'"[ q=quit arrows=move ?=help ]" TITLE="-m" TITLE+=$MESSAGE$'\n' shift else TITLE="-m " fi # Menu display # """""""""""" REP=$($SMENU "$TITLE" \ -s /Exit \ -q -d -M -n 30 -c -w \ -U "Exit menu" \ -a da:3,b \ -e '^#' -E '/(^#)+(.*)$/ \2/v' \ -1 'Exit' 2,r \ -I '/([^ ]+) (.*)/\2/v' \ $1 \ || echo Abort) read KEY DUMMY <<< $REP # Action processing # """"""""""""""""" case $KEY in Abort) echo ABORT ;; ""|Quit) echo QUIT ;; *) echo $KEY ;; esac # Normal exit # """"""""""" exit 0 smenu-0.9.15/examples/lvm_menu/screenshot.png000066400000000000000000000113061344767411600212760ustar00rootroot00000000000000PNG  IHDR>ZPLTE @` @ @ @@@ @@ @@@@@`@` @``` `@`` ```````@ @@`@ߟ߿@߿@߿߿@```SIDATx흋ZJ@k}1xb3:tL$;lN݀v+ kE$@TRR&"x5"I؏)Gy-AD1Nl|+Mƹ/q7esL}I^ŕ _=4ò#iB_ڨ ?,iuAܮ>2Il܍{2>W ʿoxàg>8-JD:kXnWA~6L`;La`٢问z/ҫ=w{)ҩ7oi2"˃GC>Vz_:qS7 r4bNoHp >j|hW6Yx L]ۏ p0 9'^N=-MGW&9^S/ ]6M98) 8ήO"tѩa. œIԜX}DSwg*Ԝ}G"X4c|ȸ} tVñ=tקrԛ4z>kҘӧien vkw->i>K98Ϸ)Pv󆦩f}D~FAߧ,K=)g'ɶqOyKS}j|^%4V#UJ~T3cWrH|K㖚;DJ޼噑WO>_ȟ3v g~ Ÿ$In_8dkW=m >~Y/=>_z9R}DO\%+O..̶Jd vwYy^zsخfoKd>M9"[q;Zx[Rd*򈇩8OOxʿqRl1k6i{xY_lk/P Ib}fVSlk6mp 4_g%l#hIXQ>v1.j^+S[xk}}WLŷUھ򽤪OmG8 ؤuSU7zs]Vn)݊ؑZkE.UUڑ~>6pONV>>o>J膪 WQS'*y|t}|!j- 'O}b?>S R%UK}W#MSŲVz=#ɮɅ͋4(kٞO ^^SQz>.q&}>jM}"lObBp(|b&yS-"9p#c'c'_|醩ޱ+UUÅu>ϯ{ԏ>X~P}OOWK1g{vNfn"v<Ǚ |ڏ~v}\ufIz{:￙@4lsQ\S>C F]j7Fy3He}#RߦYgoVSU$|O% A{9=3kafJ}2p74{on,fo$G;Op8 .}?*O-a3H,#Hd#>.Sbn0wa5(}EOGp]*{Ӆ8x=wCO#0 @@@@A@@@@s~7;oڸh1b>Q_$tyQe9#c]7r_IzV}h}TG=s~wRM-~\NSM/x}@ 'EtH%QMZﲕ'+ml\gZ\hFd;-ܤ[ 4WQ>W^]97E]6}r!F- A>.wɷ'pn;NtJI/bRc~iK0ƻ>F㕏Z_;(?َ>yb 7)NnIu^TK2 tW.n׹xV :KWy^RUj;Ϩ={EPk}KO3p[8$O)vYq}}d{'rnF&̟|{p[8$#J}Fw9}秬sMOY!) NL^߻/yxd6{ǁ&ͨٲ#`Y>bsL!Wmv@;}HuuhLn>f=+4LȼX47>r$#ؚ@C}< ~?3eЪ*F&M/9ڙ>#0LL[/w>MQ9ٛ=nWe$I{v~}lF^[Xv)Br4t}&۪2:]ۮs9L&<ܻ"[xf}~#GYhx/.{_;U @m} [v1n~foY&dzy'oC0y1|y1|^ѷN'5VDFj[  hE{3E;/곹U&،۹+ݏ#\7POMZGg=H`hkJVlع+pf2}vx}qY3@ fO9w&DׁZt-.G}GA7^gJV20sWa? 3cۮs ;4^y6I"MCȝJAyN'9L,"А>v.c:|ӂ>=Nc:ԧi8ݐke|Ayx2;&IhmҊ <A,7{pt֤ B:Ф@п>{ V&LQZI}iqGޤ:f7{])mMZ,w]gۣޤqu >|F6ZL,7.'󦧉E}{)8=M,Qw˖& +c }D̎A74a|R`v < >oAd}Z~)*'>=Eu_J%AZ&7;_JU}~VY~)UWz,mx\ ӧ/kM>ӤxF }^]\3~NG6+c.S;揙(}VǧO>eJ}:b!|) AA@@@@@@x|}\0AAx}ԯυόsDaOه/sH{?O>g}_tosW$>mrL/A\R;G|?r0SR$A:;Ic)/`c\K& }PQ}>_}j}dXTvzJ>}Ў2}9>VN>^޴@c}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}( @@@@@@@@@@@@@@}"eO>*}?AiˠyNKIENDB`smenu-0.9.15/examples/simple_menu/000077500000000000000000000000001344767411600171055ustar00rootroot00000000000000smenu-0.9.15/examples/simple_menu/README000066400000000000000000000030021344767411600177600ustar00rootroot00000000000000This example presents a simple hierarchical menu interpreter. Each menu and submenu are in a file suffixed by .mnu and is constituted by directives and menu entries/preudo-entries. Each of them are in its proper line. Comment lines are allowed and are introduced by a '#' in the first column The directives are: .columns: Set the number of columns in the menu .centered: Tell if the menu must be centered .eraseafter: Tell if the menu window must be destroyed after the selection and the old cursor location restored. .title: Set the menu tittle. The item lines has at least two fields: a tag and a menu item which will be displayed. The tag is normally the returned value when an item is selected but may also be part of a pseudo-entry. These special tags are: >xxx : Loads the submenu file xxx.mnu and interprets it. < : Reload the previous menu file and interprets it --- : Inserts an empty item in the menu === : Inserts an empty line in the menu (useful when there is more than 1 column) EXIT : Exits the menu without outputting anything. As usual, 'ENTER' triggers the selection and 'q' quits the menu without outputting anything. To launch the demo, first, make sure to make simple_menu.sh executable (chmod +x simple_menu.sh actions.sh) and enter: ./simple_menu.sh main.mnu ./actions.sh The first argument is the main menu file and the second one is the path of the program which will be called each time a selection is made. This program will be given the selected tag as argument. smenu-0.9.15/examples/simple_menu/actions.sh000066400000000000000000000002151344767411600210770ustar00rootroot00000000000000#!/usr/bin/env bash (( $# != 1 )) && exit 0 ACTION=$1 case $ACTION in *) echo "Tag $ACTION selected." sleep 1 ;; esac exit 0 smenu-0.9.15/examples/simple_menu/main.mnu000066400000000000000000000007321344767411600205540ustar00rootroot00000000000000# Directives # .columns: Number of columns in the menu # .centered: The menu will be centered # .eraseafter: The menu window will be destroyed after the selection # .title: The menu tittle .columns 2 .title Simple menu ITEM1 First item >sub1 First submenu ITEM3 Third item >sub2 Second submenu === ITEM5 Fifth item ITEM6 Sixth item ITEM7 Seventh item ITEM8 Eighth item ITEM9 Ninth item ITEM10 Tenth item === EXIT Exit without selection smenu-0.9.15/examples/simple_menu/simple_menu.sh000066400000000000000000000155661344767411600217730ustar00rootroot00000000000000#!/usr/bin/env bash # Variables # """"""""" PROG=${0#*/} typeset -a MENU_STACK # A stack of MENUS to store the previously visited menus # Array of menu characteristics for caching purpose # ''''''''''''''''''''''''''''''''''''''''''''''''' typeset -A MENU_ARRAY typeset -A COL_ARRAY typeset -A CENTERING_ARRAY typeset -A TITLE_ARRAY typeset -A ERASE_ARRAY SEL= # The selection SMENU= # The smenu path will be stored here # ============================ # # Usage function, always fails # # ============================ # function usage { echo "Usage: $PROG menu_file[.mnu] user_program," >&2 echo " read the README for an example" >&2 exit 1 } # ==================== # # Fatal error function # # ==================== # function error { echo $* >&2 exit 1 } # The script expects exactly one argument (the filename of the root menu). # """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" (( $# != 2 )) && usage USER_PROGRAM=$2 # ======================================================================= # # Parse a level in the menu hierarchy and call process with the selection # # (possibly empty). # # ======================================================================= # function process_menu { TITLE=$'\n'"[ENTER: select, q: abort]" # Untitled by default CENTERING="-M" # Is the menu centered in the screen ?, defaults to yes ERASE="-d" # Destroy the selection window after use. Defaults to yes MENU_FILE=$1 MENU= # Make sure the working area is empty # If the menu has already been seen, read its characteristics from the cache # else construct them. # """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" if [[ -z ${MENU_ARRAY[$MENU_FILE]} ]]; then COL=1 # Parse the directives embedded in the menu file # """""""""""""""""""""""""""""""""""""""""""""" MENU_DIRECIVES=$(grep '^\.' $MENU_FILE) while read DIRECTIVE VALUE; do case $DIRECTIVE in .columns) # Number of columns of the menu COL=$VALUE (( COL < 1 || COL > 15 )) && error "$DIRECTIVE, bad value" ;; .centered) # Is the menu centered? [[ $VALUE == no ]] && CENTERING="" ;; .eraseafter) # Will the space used by the menu be reclaimed? [[ $VALUE == no ]] && ERASE="" ;; .title) # The menu title TITLE="$VALUE"$'\n'$TITLE ;; *) error "bad directive $DIRECTIVE" ;; esac done <<< "$MENU_DIRECIVES" # Build the menu entries in the working area # """""""""""""""""""""""""""""""""""""""""" MENU_LINES=$(grep -v -e '^\.' -e '^#' -e '^[ \t]*$' $MENU_FILE) # The special tag "---" creates an empty entry (a hole in a column) # The special tag "===" create an empty line # The special tag "EXIT" permit to exit the menu # ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' while read TAG VALUE; do ITEMS_TO_ADD=1 # By default, only one iteration of the tag is taken # into account (( ${#TAG} > 30 )) \ && error "Menu tag \"${TAG}\" too long (max 30 characters)." [[ $TAG == --- ]] && VALUE=@@@ [[ $TAG == === ]] && VALUE=@@@ && ITEMS_TO_ADD=COL [[ -z $VALUE ]] && error "Empty menu entry for $TAG" [[ $TAG == EXIT ]] && TAG="@EXIT@xxxxxxxxxxxxxxxxxxxxxxxx00" [[ $TAG == "<"* ]] && TAG=" 0 )); do MENU+="'$TAG $FINAL_VALUE'"$'\n' done done <<< "$MENU_LINES" # Feed the cache # """""""""""""" MENU_ARRAY[$MENU_FILE]="$MENU" COL_ARRAY[$MENU_FILE]=$COL CENTERING_ARRAY[$MENU_FILE]=$CENTERING TITLE_ARRAY[$MENU_FILE]=$TITLE ERASE_ARRAY[$MENU_FILE]=$ERASE else # Read from the cache # """"""""""""""""""" MENU="${MENU_ARRAY[$MENU_FILE]}" COL=${COL_ARRAY[$MENU_FILE]} CENTERING=${CENTERING_ARRAY[$MENU_FILE]} TITLE=${TITLE_ARRAY[$MENU_FILE]} ERASE=${ERASE_ARRAY[$MENU_FILE]} fi # Display the menu and get the selection # """""""""""""""""""""""""""""""""""""" SEL=$(echo "$MENU" | $SMENU \ $CENTERING \ $ERASE \ -N \ -F -D o:30 i:0 n:2 \ -n \ -a m:0/6 \ -m "$TITLE" \ -t $COL \ -S'/@@@/ /' \ -S'/^[^ ]+ //v' \ -e @@@) SEL=${SEL%% *} } # Check for the presence of smenu # """"""""""""""""""""""""""""""" SMENU=$(which smenu 2>/dev/null) [[ -x "$SMENU" ]] || error "smenu is not in the PATH or not executable." # Initialize the menu stack with the argument # """"""""""""""""""""""""""""""""""""""""""" MENU_STACK+=(${1%.mnu}.mnu) # And process the main menu # """"""""""""""""""""""""" process_menu ${1%.mnu}.mnu # According to the selection, navigate in the submenus or return # the tag associated with the selected menu entry. # """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" while true; do if [[ $SEL == "<"* ]]; then # Back to the previous menu # ''''''''''''''''''''''''' if (( ${#MENU_STACK[*]} == 1 )); then process_menu ${MENU_STACK[-1]} else # Unstack the newly found submenu # ''''''''''''''''''''''''''''''' unset MENU_STACK[-1] # And generate the previous menu # '''''''''''''''''''''''''''''' process_menu ${MENU_STACK[-1]} fi elif [[ $SEL == ">"* ]]; then # Enter the selected submenu # '''''''''''''''''''''''''' SMENU_FILE=${SEL#>} SMENU_FILE=${SMENU_FILE%.mnu}.mnu [[ -f $SMENU_FILE ]] || error "The file $SMENU_FILE was not found/readable." # Stack the newly found submenu # ''''''''''''''''''''''''''''' MENU_STACK+=($SMENU_FILE) # And generate the submenu # '''''''''''''''''''''''' process_menu $SMENU_FILE else # An empty selection means than q or ^C has been hit # '''''''''''''''''''''''''''''''''''''''''''''''''' [[ -z $SEL ]] && exit 0 # Output the selected menu tag or exit the menu without outputting # anything. # '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' [[ $SEL == @EXIT@* ]] && exit 0 # Lauch the user action which has the responsibility to act according # to the tag passed as argument. # ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' $USER_PROGRAM $SEL # And re-generate the current menu # '''''''''''''''''''''''''''''''' process_menu ${MENU_STACK[-1]} fi done smenu-0.9.15/examples/simple_menu/sub1.mnu000066400000000000000000000002271344767411600205010ustar00rootroot00000000000000.columns 1 .title First submenu SUB1ITEM1 First item of the first submenu SUB1ITEM2 Second item of the first submenu === < Previous Menu smenu-0.9.15/examples/simple_menu/sub2.mnu000066400000000000000000000002321344767411600204760ustar00rootroot00000000000000.columns 2 .title Second submenu SUB2ITEM1 First item of the second submenu SUB2ITEM2 Second item of the second submenu === < Previous Menu smenu-0.9.15/examples/yesno/000077500000000000000000000000001344767411600157255ustar00rootroot00000000000000smenu-0.9.15/examples/yesno/README000066400000000000000000000005351344767411600166100ustar00rootroot00000000000000With this example you will discover how easily you can ask a user to confirm a previous choice First, make sure to make yesno.sh executable (chmod +x yesno.sh) and enter: ./yesno.sh The screenshot shows three use cases, one when just hitting 'Enter', one when moving the cursor to YES before hitting 'Enter' and the last one when just hitting 'q' smenu-0.9.15/examples/yesno/screenshot.png000066400000000000000000000105741344767411600206170ustar00rootroot00000000000000PNG  IHDRI/% pHYs  tIME >'[PLTE!!!$$$(((***+++,,,...///000111222444666777999:::;;;<<<===>==>>=>>>???@@@AAABAABBABBBBCBCBBCCBCCCEEEFFFGGGIIIJJJLKKLLKLLLMMMNNNOOOQQQSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___aaadddeeeggghhhjjjlllmmmooopppqqqrrrsssttt|||~~~U½ü9je tRNS@fbKGDWIDATx흉G@QBD6DD7$ފLD%Q#^DDd#YNQU]5;;fz/_}U]`A8@y$_Pĥ1HPJHPJ ڳ&ymk!uO|b&&%/]-}{oKfp_Z%-n >a1ixE9>rf7Y&EmᬃDk[o,&|տC?^Yk& g@3iw8XX\5_a1i'k/ȏZ\upz@3i8?Qeh-OZ[Qv+sVI{Y5LcT+&MbWZG겕+ᬒ'uʓyÎ<W^7*mNm}Qm6qr뭷}oHUIWe=nxSOvf=Z````ˤ]ę魓 [τa`z.\ٙz4&AI6xfN:y6adRIn$g&=tlR1IV)&yb̖S9\/՗Tfŵ&,n:3ɡb2ԃ$.`w>ϻD$kKI0]/T,&i&ŕVn3Im}[_ʓ~v\3׶=ؘII"ֲYA.Id܄@ $I0IIt4?0 0 lR3@$¸S-c[$Y\d71% E^I0 IIG5$$[l Pֱ(0[;hI$b@",m© b&Y*7!3I`TjPYL$$9!I7ۨb0꯼,m̩IYJ&}se+&;J^Mۦ I駸54#IZ"ͮutnj"Oɤ|&Ijiz,41Iu@`\|D6"&Q`q2&A}L'3T OB0IkviV$!),Ja4iPI04&誷I 0 0 Fۤ [? 7YkgڹSV$}{8 8~$IjȤDX+ڧlv%L6&aˤ觳I&a1"~vGH3)KȂQIPII$`&5)D dڟ$<ݟ e'e}܀IIP30 0 jhRJ]gzԤ[$EW,mi[Aҭ>x5HLȤBO#<$?ՃI6?$ +Ҥڶ&)5bRݤltRIzь$IT$2IJL$k˸,Wچ]+r"yRmM$$$$LLL?Ls*InI$ OnI'&&&```` Xf%aMf_Z?jdQvS[:Ӽ6E5µԫ3)M'XsW4 q$1Ij RnXIKL2L*$L5O[ITIs9$h0F6fLjm\! L$Lk&a`&&T&o!$YsLn)ĸ%]O`dLI_ =̓m$;&i&iOL"Od'`mvl$)1 ,IRHD`&Y*7!3I`TjPYL$$9!I7ۨb0꯼,m̩IYJ&}se+&;J^Mۦ I駸54#IZ"ͮutnj"Oɤ|&Ijiz,41Iu@`\|D6"&Q`q2&A}L'3T OB0IkviV$!),Ja4iPI04&$ILL1!W#DIշ%鶂 &+i ӤX&MDdR[T+ڧlvk0ILI.jRIfFBɏ4IIJ%O_ۭa1 *7)I:$L¤&6haHFO҅2| 2 }܀IIP?0 0 F֤m _dUdɮ;Ӽ+I?*5Ss!5I*Msӗ{ҰwMVo;ؙIkp$1i=H~IYT'f=a,,2ioN n{7Zۑ$n>*N5I0i^O^ȼ_pF````fcIMbT'ILb'm7$JIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIL&} g?M7n$(oEn?я````&&&&` Τ7` n@L$$$$LLLL$$$I U0IP֤K\ySg0 ʛtfN:y1LLL-8&A&sv9IПI~W9OL~sGv&2 exit 1 } # Check for the presence of smenu # """"""""""""""""""""""""""""""" SMENU=$(which smenu 2>/dev/null) [[ -x "$SMENU" ]] || error "smenu is not in the PATH or not executable." RES=$( $SMENU -2 ^Y -1 ^N -3 ^C -s /^N -x cur 10 \ -m "Please confirm your choice:" \ <<< "YES NO CANCEL" ) [[ -z "$RES" ]] && echo "'q' was hit, exiting without selecting anything" \ || echo "You selected: $RES" exit 0 smenu-0.9.15/fgetc.c000066400000000000000000000023721344767411600142120ustar00rootroot00000000000000/* ########################################################### */ /* This Software is licensed under the GPL licensed Version 2, */ /* please read http://www.gnu.org/copyleft/gpl.html */ /* ########################################################### */ /* ************************************************************************ */ /* Custom fgetc/ungetc implementation able to unget more than one character */ /* ************************************************************************ */ #include #include "fgetc.h" enum { GETC_BUFF_SIZE = 16 }; static char getc_buffer[GETC_BUFF_SIZE] = { '\0' }; static long next_buffer_pos = 0; /* next free position in the getc buffer */ /* ====================================== */ /* Get a (possibly pushed-back) character */ /* ====================================== */ int my_fgetc(FILE * input) { return (next_buffer_pos > 0) ? getc_buffer[--next_buffer_pos] : fgetc(input); } /* ============================ */ /* Push character back on input */ /* ============================ */ void my_ungetc(int c) { if (next_buffer_pos >= GETC_BUFF_SIZE) fprintf(stderr, "Error: cannot push back more than %d characters\n", GETC_BUFF_SIZE); else getc_buffer[next_buffer_pos++] = c; } smenu-0.9.15/fgetc.h000066400000000000000000000005461344767411600142200ustar00rootroot00000000000000/* ########################################################### */ /* This Software is licensed under the GPL licensed Version 2, */ /* please read http://www.gnu.org/copyleft/gpl.html */ /* ########################################################### */ #ifndef FGETC_H #define FGETC_H int my_fgetc(FILE * input); void my_ungetc(int c); #endif smenu-0.9.15/getopt.c000066400000000000000000000157131344767411600144270ustar00rootroot00000000000000/* egetopt.c -- Extended 'getopt'. * * A while back, a public-domain version of getopt() was posted to the * net. A bit later, a gentleman by the name of Keith Bostic made some * enhancements and reposted it. * * In recent weeks (i.e., early-to-mid 1988) there's been some * heated discussion in comp.lang.c about the merits and drawbacks * of getopt(), especially with regard to its handling of '?'. * * In light of this, I have taken Mr. Bostic's public-domain getopt() * and have made some changes that I hope will be considered to be * improvements. I call this routine 'egetopt' ("Extended getopt"). * The default behavior of this routine is the same as that of getopt(), * but it has some optional features that make it more useful. These * options are controlled by the settings of some global variables. * By not setting any of these extra global variables, you will have * the same functionality as getopt(), which should satisfy those * purists who believe getopt() is perfect and can never be improved. * If, on the other hand, you are someone who isn't satisfied with the * status quo, egetopt() may very well give you the added capabilities * you want. * * Look at the enclosed README file for a description of egetopt()'s * new features. * * The code was originally posted to the net as getopt.c by ... * * Keith Bostic * ARPA: keith@seismo * UUCP: seismo!keith * * Current version: added enhancements and comments, reformatted code. * * Lloyd Zusman * Master Byte Software * Los Gatos, California * Internet: ljz@fx.com * UUCP: ...!ames!fxgrp!ljz * * May, 1988 * * This version is slightly adapted for use by smenu. */ #include #include #include #include #include "getopt.h" /* Here are all the pertinent global variables. */ /* """""""""""""""""""""""""""""""""""""""""""" */ int eopterr = 1; /* if true, output error message */ int eoptind = 1; /* index into parent argv vector */ int eoptopt; /* character checked for validity */ int eoptbad = BADCH; /* character returned on error */ int eoptchar = 0; /* character that begins returned option */ int eoptneed = NEEDSEP; /* flag for mandatory argument */ int eoptmaybe = MAYBESEP; /* flag for optional argument */ int eopterrfd = ERRFD; /* file descriptor for error text */ char * eoptarg = NULL; /* argument associated with option */ char * eoptstart = START; /* list of characters that start options */ /* Here it is: */ /* """"""""""" */ int egetopt(int nargc, char ** nargv, char * ostr) { static char * place = EMSG; /* option letter processing */ register char * oli; /* option letter list index */ register char * osi = NULL; /* option start list index */ if (nargv == (char **)NULL) return (EOF); if (nargc <= eoptind || nargv[eoptind] == NULL) return (EOF); if (place == NULL) place = EMSG; /* Update scanning pointer. */ /* """""""""""""""""""""""" */ if (*place == '\0') { place = nargv[eoptind]; if (place == NULL) return (EOF); else if (*place == '\0') return (EOF); osi = strchr(eoptstart, *place); if (osi != NULL) eoptchar = (int)*osi; if (eoptind >= nargc || osi == NULL || *++place == '\0') return (EOF); /* Two adjacent, identical flag characters were found. */ /* This takes care of "--", for example. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""" */ if (*place == place[-1]) { ++eoptind; return (EOF); } } /* If the option is a separator or the option isn't in the list, */ /* we've got an error. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ eoptopt = (int)*place++; oli = strchr(ostr, eoptopt); if (eoptopt == eoptneed || eoptopt == (int)eoptmaybe || oli == NULL) { /* If we're at the end of the current argument, bump the */ /* argument index. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""" */ if (*place == '\0') ++eoptind; TELL("Illegal option -- "); /* bye bye */ return (eoptbad); } /* If there is no argument indicator, then we don't even try to */ /* return an argument. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ ++oli; if (*oli == '\0' || (*oli != (char)eoptneed && *oli != (char)eoptmaybe)) { /* If we're at the end of the current argument, bump the */ /* argument index. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""" */ if (*place == '\0') ++eoptind; eoptarg = NULL; } /* If we're here, there's an argument indicator. It's handled */ /* differently depending on whether it's a mandatory or an */ /* optional argument. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ else { /* If there's no white space, use the rest of the */ /* string as the argument. In this case, it doesn't */ /* matter if the argument is mandatory or optional. */ /* """"""""""""""""""""""""""""""""""""""""""""""""" */ if (*place != '\0') eoptarg = place; /* If we're here, there's whitespace after the option. */ /* */ /* Is it a mandatory argument? If so, return the */ /* next command-line argument if there is one. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""" */ else if (*oli == (char)eoptneed) { /* If we're at the end of the argument list, there */ /* isn't an argument and hence we have an error. */ /* Otherwise, make 'eoptarg' point to the argument. */ /* """""""""""""""""""""""""""""""""""""""""""""""" */ if (nargc <= ++eoptind) { place = EMSG; TELL("Option requires an argument -- "); return (eoptbad); } else eoptarg = nargv[eoptind]; } /* If we're here it must have been an optional argument. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""" */ else { if (nargc <= ++eoptind) { place = EMSG; eoptarg = NULL; } else { eoptarg = nargv[eoptind]; if (eoptarg == NULL) place = EMSG; /* If the next item begins with a flag */ /* character, we treat it like a new */ /* argument. This is accomplished by */ /* decrementing 'eoptind' and returning */ /* a null argument. */ /* """""""""""""""""""""""""""""""""""" */ else if (strchr(eoptstart, *eoptarg) != NULL) { --eoptind; eoptarg = NULL; } } } place = EMSG; ++eoptind; } /* Return option letter. */ /* """"""""""""""""""""" */ return (eoptopt); } smenu-0.9.15/getopt.h000066400000000000000000000024171344767411600144310ustar00rootroot00000000000000#ifndef GETOPT_H #define GETOPT_H /* None of these constants are referenced in the executable portion of */ /* the code ... their sole purpose is to initialize global variables. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ #define BADCH (int)'@' #define NEEDSEP (int)':' #define MAYBESEP (int)'%' #define ERRFD 2 #define EMSG "" #define START "-" /* Conditionally print out an error message and return (depends on the */ /* setting of 'opterr' and 'opterrfd'). Note that this version of */ /* TELL() doesn't require the existence of stdio.h. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ #define TELL(S) \ { \ if (eopterr && eopterrfd >= 0) \ { \ char option = (char)eoptopt; \ if (write(eopterrfd, (S), strlen(S))) \ ; \ if (write(eopterrfd, &option, 1)) \ ; \ if (write(eopterrfd, "\n", 1)) \ ; \ } \ } int egetopt(int nargc, char ** nargv, char * ostr); #endif smenu-0.9.15/index.c000066400000000000000000000207631344767411600142350ustar00rootroot00000000000000/* ########################################################### */ /* This Software is licensed under the GPL licensed Version 2, */ /* please read http://www.gnu.org/copyleft/gpl.html */ /* ########################################################### */ /* Ternary Search Tree and sorted array creation functions */ /* Inspired by: https://www.cs.princeton.edu/~rs/strings/tstdemo.c */ /* *************************************************************** */ #include #include #include #include #include "xmalloc.h" #include "list.h" #include "index.h" /* List of words matching the current search */ /* """"""""""""""""""""""""""""""""""""""""" */ ll_t * tst_search_list; /* Must be initialized by ll_new() before use */ /* ====================================== */ /* Ternary search tree insertion function */ /* ====================================== */ tst_node_t * tst_insert(tst_node_t * p, wchar_t * w, void * data) { if (p == NULL) { p = (tst_node_t *)xmalloc(sizeof(tst_node_t)); p->splitchar = *w; p->lokid = p->eqkid = p->hikid = NULL; p->data = NULL; } if (*w < p->splitchar) p->lokid = tst_insert(p->lokid, w, data); else if (*w == p->splitchar) { if (*w == L'\0') { p->data = data; p->eqkid = NULL; } else p->eqkid = tst_insert(p->eqkid, ++w, data); } else p->hikid = tst_insert(p->hikid, w, data); return (p); } /* ===================================== */ /* Ternary search tree deletion function */ /* user data area not cleaned */ /* ===================================== */ void tst_cleanup(tst_node_t * p) { if (p) { tst_cleanup(p->lokid); if (p->splitchar) tst_cleanup(p->eqkid); tst_cleanup(p->hikid); free(p); } } /* ========================================================== */ /* Recursive traversal of a ternary tree. A callback function */ /* is also called when a complete string is found */ /* returns 1 if the callback function succeed (returned 1) at */ /* least once */ /* the first_call argument is for initializing the static */ /* variable */ /* ========================================================== */ int tst_traverse(tst_node_t * p, int (*callback)(void *), int first_call) { static int rc; if (first_call) rc = 0; if (!p) return 0; tst_traverse(p->lokid, callback, 0); if (p->splitchar != L'\0') tst_traverse(p->eqkid, callback, 0); else rc += (*callback)(p->data); tst_traverse(p->hikid, callback, 0); return !!rc; } /* ======================================================================= */ /* Traverse the word tst looking for a wchar and build a list of pointers */ /* containing all the sub-tst * nodes after these node potentially leading */ /* to words containing the next wchar os the search string */ /* ======================================================================= */ int tst_substring_traverse(tst_node_t * p, int (*callback)(void *), int first_call, wchar_t w) { static int rc; if (first_call) rc = 0; if (!p) return 0; if (p->splitchar == w) { ll_node_t * node; sub_tst_t * sub_tst_data; node = tst_search_list->tail; sub_tst_data = (sub_tst_t *)(node->data); if (p->eqkid) insert_sorted_ptr(&(sub_tst_data->array), &(sub_tst_data->size), &(sub_tst_data->count), p->eqkid); rc = 1; } tst_substring_traverse(p->lokid, callback, 0, w); if (p->splitchar != L'\0') tst_substring_traverse(p->eqkid, callback, 0, w); else if (callback != NULL) rc += (*callback)(p->data); tst_substring_traverse(p->hikid, callback, 0, w); return !!rc; } /* ======================================================================= */ /* Traverse the word tst looking for a wchar and build a list of pointers */ /* containing all the sub-tst * nodes after these node potentially leading */ /* to words containing the next wchar os the search string */ /* ======================================================================= */ int tst_fuzzy_traverse(tst_node_t * p, int (*callback)(void *), int first_call, wchar_t w) { static int rc; wchar_t w1s[2]; wchar_t w2s[2]; w1s[1] = w2s[1] = L'\0'; if (first_call) rc = 0; if (!p) return 0; w1s[0] = p->splitchar; w2s[0] = w; if (wcscasecmp(w1s, w2s) == 0) { ll_node_t * node; sub_tst_t * sub_tst_data; node = tst_search_list->tail; sub_tst_data = (sub_tst_t *)(node->data); if (p->eqkid != NULL) insert_sorted_ptr(&(sub_tst_data->array), &(sub_tst_data->size), &(sub_tst_data->count), p->eqkid); rc += 1; } tst_fuzzy_traverse(p->lokid, callback, 0, w); if (p->splitchar != L'\0') tst_fuzzy_traverse(p->eqkid, callback, 0, w); else if (callback != NULL) rc += (*callback)(p->data); tst_fuzzy_traverse(p->hikid, callback, 0, w); return !!rc; } /* ==================================================================== */ /* Search a complete string in a ternary tree starting from a root node */ /* ==================================================================== */ void * tst_search(tst_node_t * root, wchar_t * w) { tst_node_t * p; p = root; while (p) { if (*w < p->splitchar) p = p->lokid; else if (*w == p->splitchar) { if (*w++ == L'\0') return p->data; p = p->eqkid; } else p = p->hikid; } return NULL; } /* =============================================================== */ /* Search all strings beginning with the same prefix */ /* the callback function will be applied to each of theses strings */ /* returns NULL if no string matched the prefix */ /* =============================================================== */ void * tst_prefix_search(tst_node_t * root, wchar_t * w, int (*callback)(void *)) { tst_node_t * p = root; size_t len = wcslen(w); size_t rc; while (p) { if (*w < p->splitchar) p = p->lokid; else if (*w == p->splitchar) { len--; if (*w++ == L'\0') return p->data; if (len == 0) { rc = tst_traverse(p->eqkid, callback, 1); return (void *)(long)rc; } p = p->eqkid; } else p = p->hikid; } return NULL; } /* ========================================================= */ /* Insertion of an integer in a already sorted integer array */ /* without duplications. */ /* ========================================================= */ void insert_sorted_index(long ** array, long * size, long * nb, long value) { long pos = *nb; long left = 0, right = *nb, middle; if (*nb > 0) { /* bisection search */ /* """""""""""""""" */ while (left < right) { middle = (left + right) / 2; if ((*array)[middle] == value) return; /* Value already in array */ if (value < (*array)[middle]) right = middle; else left = middle + 1; } pos = left; } if (*nb == *size) { *size += 64; *array = xrealloc(*array, *size * sizeof(long)); } if (*nb > pos) memmove((*array) + pos + 1, (*array) + pos, sizeof(value) * (*nb - pos)); (*nb)++; (*array)[pos] = value; } /* ========================================================= */ /* Insertion of an pointer in a already sorted pointer array */ /* without duplications. */ /* ========================================================= */ void insert_sorted_ptr(tst_node_t *** array, unsigned long long * size, unsigned long long * nb, tst_node_t * ptr) { unsigned long long pos = *nb; unsigned long long left = 0, right = *nb, middle; if (*nb > 0) { /* bisection search */ /* """""""""""""""" */ while (left < right) { middle = (left + right) / 2; if ((intptr_t)((*array)[middle]) == (intptr_t)ptr) return; /* Value already in array */ if ((intptr_t)ptr < (intptr_t)((*array)[middle])) right = middle; else left = middle + 1; } pos = left; } if (*nb == *size) { *size += 64; *array = xrealloc(*array, *size * sizeof(long)); } if (*nb > pos) memmove((*array) + pos + 1, (*array) + pos, sizeof(ptr) * (*nb - pos)); (*nb)++; (*array)[pos] = ptr; } smenu-0.9.15/index.h000066400000000000000000000035121344767411600142330ustar00rootroot00000000000000/* ########################################################### */ /* This Software is licensed under the GPL licensed Version 2, */ /* please read http://www.gnu.org/copyleft/gpl.html */ /* ########################################################### */ #ifndef INDEX_H #define INDEX_H /* *************************************** */ /* Ternary Search Tree specific structures */ /* *************************************** */ typedef struct tst_node_s tst_node_t; typedef struct sub_tst_s sub_tst_t; #if 0 /* here for coherency but not used. */ void tst_cleanup(tst_node_t * p); #endif tst_node_t * tst_insert(tst_node_t * p, wchar_t * w, void * data); void * tst_prefix_search(tst_node_t * root, wchar_t * w, int (*callback)(void *)); void * tst_search(tst_node_t * root, wchar_t * w); int tst_traverse(tst_node_t * p, int (*callback)(void *), int first_call); int tst_substring_traverse(tst_node_t * p, int (*callback)(void *), int first_call, wchar_t w); int tst_fuzzy_traverse(tst_node_t * p, int (*callback)(void *), int first_call, wchar_t w); sub_tst_t * sub_tst_new(void); void insert_sorted_index(long ** array, long * size, long * filled, long value); void insert_sorted_ptr(tst_node_t *** array, unsigned long long * size, unsigned long long * filled, tst_node_t * ptr); /* Ternary node structure */ /* """""""""""""""""""""" */ struct tst_node_s { wchar_t splitchar; tst_node_t *lokid, *eqkid, *hikid; void * data; }; /* Structure to contain data and metadata attached to a fuzzy/substring. */ /* search step. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ struct sub_tst_s { tst_node_t ** array; unsigned long long size; unsigned long long count; }; #endif smenu-0.9.15/list.c000066400000000000000000000173351344767411600141020ustar00rootroot00000000000000/* ########################################################### */ /* This Software is licensed under the GPL licensed Version 2, */ /* please read http://www.gnu.org/copyleft/gpl.html */ /* ########################################################### */ /* ********************************************************************* */ /* Tiny linked list implementation. */ /* */ /* Each node contain a void pointer to some opaque data, these functions */ /* will not try to allocate or free this data pointer. */ /* */ /* Also accessors are not provided, the user has to directly manipulate */ /* the structure members (head, tail, len, data, prev, next) */ /* ********************************************************************* */ #include #include #include #include #include #include "xmalloc.h" #include "list.h" /* ======================== */ /* Create a new linked list */ /* ======================== */ ll_t * ll_new(void) { ll_t * ret = xmalloc(sizeof(ll_t)); ll_init(ret); return ret; } /* ======================== */ /* Initialize a linked list */ /* ======================== */ void ll_init(ll_t * list) { list->head = NULL; list->tail = NULL; list->len = 0; } /* ==================================================== */ /* Allocate the space for a new node in the linked list */ /* ==================================================== */ ll_node_t * ll_new_node(void) { ll_node_t * ret = xmalloc(sizeof(ll_node_t)); if (ret == NULL) errno = ENOMEM; return ret; } /* ==================================================================== */ /* Append a new node filled with its data at the end of the linked list */ /* The user is responsible for the memory management of the data */ /* ==================================================================== */ int ll_append(ll_t * const list, void * const data) { int ret = 1; ll_node_t * node; if (list) { node = ll_new_node(); if (node) { node->data = data; node->next = NULL; node->prev = list->tail; if (list->tail) list->tail->next = node; else list->head = node; list->tail = node; ++list->len; ret = 0; } } return ret; } /* =================================================================== */ /* Put a new node filled with its data at the beginning of the linked */ /* list. The user is responsible for the memory management of the data */ /* =================================================================== */ int ll_prepend(ll_t * const list, void * const data) { int ret = 1; ll_node_t * node; if (list) { node = ll_new_node(); if (node) { node->data = data; node->prev = NULL; node->next = list->head; if (list->head) list->head->prev = node; else list->tail = node; list->head = node; ++list->len; ret = 0; } } return ret; } /* ======================================================= */ /* Insert a new node before the specified node in the list */ /* TODO test it */ /* ======================================================= */ void ll_insert_before(ll_t * const list, ll_node_t * node, void * const data) { ll_node_t * new_node; if (list) { if (node->prev == NULL) ll_prepend(list, data); else { new_node = ll_new_node(); if (new_node) { new_node->data = data; new_node->next = node; new_node->prev = node->prev; node->prev->next = new_node; ++list->len; } } } } /* ====================================================== */ /* Insert a new node after the specified node in the list */ /* TODO test it */ /* ====================================================== */ void ll_insert_after(ll_t * const list, ll_node_t * node, void * const data) { ll_node_t * new_node; if (list) { if (node->next == NULL) ll_append(list, data); else { new_node = ll_new_node(); if (new_node) { new_node->data = data; new_node->prev = node; new_node->next = node->next; node->next->prev = new_node; ++list->len; } } } } /* ====================================================== */ /* Partition code for the quicksort function */ /* Based on code found here: */ /* http://www.geeksforgeeks.org/quicksort-for-linked-list */ /* ====================================================== */ ll_node_t * ll_partition(ll_node_t * l, ll_node_t * h, int (*comp)(void *, void *), void (*swap)(void *, void *)) { /* Considers last element as pivot, places the pivot element at its */ /* correct position in sorted array, and places all smaller (smaller than */ /* pivot) to left of pivot and all greater elements to right of pivot */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ /* Set pivot as h element */ /* """""""""""""""""""""" */ void * x = h->data; ll_node_t * i = l->prev; ll_node_t * j; for (j = l; j != h; j = j->next) { if (comp(j->data, x) < 1) { i = (i == NULL) ? l : i->next; swap(i->data, j->data); } } i = (i == NULL) ? l : i->next; swap(i->data, h->data); return i; } /* ======================================================= */ /* A recursive implementation of quicksort for linked list */ /* ======================================================= */ void ll_quicksort(ll_node_t * l, ll_node_t * h, int (*comp)(void *, void *), void (*swap)(void * a, void *)) { if (h != NULL && l != h && l != h->next) { ll_node_t * p = ll_partition(l, h, comp, swap); ll_quicksort(l, p->prev, comp, swap); ll_quicksort(p->next, h, comp, swap); } } /* =========================== */ /* A linked list sort function */ /* =========================== */ void ll_sort(ll_t * list, int (*comp)(void *, void *), void (*swap)(void * a, void *)) { /* Call the recursive ll_quicksort function */ /* """""""""""""""""""""""""""""""""""""""" */ ll_quicksort(list->head, list->tail, comp, swap); } /* ================================ */ /* Remove a node from a linked list */ /* ================================ */ int ll_delete(ll_t * const list, ll_node_t * node) { if (list->head == list->tail) { if (list->head != NULL) list->head = list->tail = NULL; else return 0; } else if (node->prev == NULL) { list->head = node->next; list->head->prev = NULL; } else if (node->next == NULL) { list->tail = node->prev; list->tail->next = NULL; } else { node->next->prev = node->prev; node->prev->next = node->next; } free(node); --list->len; return 1; } /* =========================================================================*/ /* Find a node in the list containing data. Return the node pointer or NULL */ /* if not found. */ /* A comparison function must be provided to compare a and b (strcmp like). */ /* =========================================================================*/ ll_node_t * ll_find(ll_t * const list, void * const data, int (*cmpfunc)(const void * a, const void * b)) { ll_node_t * node; if (NULL == (node = list->head)) return NULL; do { if (0 == cmpfunc(node->data, data)) return node; } while (NULL != (node = node->next)); return NULL; } smenu-0.9.15/list.h000066400000000000000000000031351344767411600141000ustar00rootroot00000000000000/* ########################################################### */ /* This Software is licensed under the GPL licensed Version 2, */ /* please read http://www.gnu.org/copyleft/gpl.html */ /* ########################################################### */ #ifndef LIST_H #define LIST_H typedef struct ll_node_s ll_node_t; typedef struct ll_s ll_t; /* ******************************* */ /* Linked list specific structures */ /* ******************************* */ /* Linked list node structure */ /* """""""""""""""""""""""""" */ struct ll_node_s { void * data; struct ll_node_s * next; struct ll_node_s * prev; }; /* Linked List structure */ /* """"""""""""""""""""" */ struct ll_s { ll_node_t * head; ll_node_t * tail; long len; }; int ll_append(ll_t * const list, void * const data); int ll_prepend(ll_t * const list, void * const data); void ll_insert_before(ll_t * const list, ll_node_t * node, void * const data); void ll_insert_after(ll_t * const list, ll_node_t * node, void * const data); ll_node_t * ll_partition(ll_node_t * l, ll_node_t * h, int (*comp)(void *, void *), void (*swap)(void *, void *)); void ll_quicksort(ll_node_t * l, ll_node_t * h, int (*comp)(void *, void *), void (*swap)(void * a, void *)); void ll_sort(ll_t * list, int (*comp)(void *, void *), void (*swap)(void * a, void *)); int ll_delete(ll_t * const list, ll_node_t * node); ll_node_t * ll_find(ll_t * const, void * const, int (*)(const void *, const void *)); void ll_init(ll_t * list); ll_node_t * ll_new_node(void); ll_t * ll_new(void); #endif smenu-0.9.15/smenu.1000066400000000000000000001303041344767411600141640ustar00rootroot00000000000000.TH smenu 1 "2015" "beta" .SH NAME smenu - filter that allows one to interactively select a word from stdin and outputs the selection to stdout. .SH SYNOPSIS .nf \f(CRsmenu [\fB-h\fP|\fB-?\fP] [\fB-f\fP \fIconfiguration_file\fP] \\ [\fB-n\fP [\fIlines\fP]] [\fB-t\fP [\fIcols\fP]] [\fB-k\fP] \\ [\fB-s\fP \fIpattern\fP] [\fB-m\fP \fImessage\fP] [\fB-w\fP] \\ [\fB-d\fP] [\fB-M\fP] [\fB-c\fP] [\fB-l\fP] [\fB-r\fP] [\fB-b\fP] \\ [\fB-a\fP \ (i|e|c|b|si|m|t|ct|sf|st|mf|mt|sfe|ste|mfe|mte|da):\fIATTR\fP]... \\ [\fB-i\fP \fIregex\fP] [\fB-e\fP \fIregex\fP] \\ [\fB-C\fP \ [\fIi\fP|\fIe\fP]] \\ [\fB-R\fP \ [\fIi\fP|\fIe\fP]] \\ [\fB-S\fP \fI/regex/string/\fP[\fIg\fP][\fIv\fP][\fIs\fP][\fIi\fP]] \\ [\fB-I\fP \fI/regex/string/\fP[\fIg\fP][\fIv\fP][\fIs\fP][\fIi\fP]] \\ [\fB-E\fP \fI/regex/string/\fP[\fIg\fP][\fIv\fP][\fIs\fP][\fIi\fP]] \\ [\fB-A\fP \fIregex\fP] [\fB-Z\fP \fIregex\fP] \\ [\fB-N\fP [\fIregex\fP]] [\fB-U\fP [\fIregex\fP]] [\fB-F\fP] \ [\fB-D\fP \fIsub-option\fP...] \\ [\fB-1\fP \fIregex\fP [\fIATTR\fP]] \ [\fB-2\fP \fIregex\fP [\fIATTR\fP]] ... \ [\fB-5\fP \fIregex\fP [\fIATTR\fP]] \\ [\fB-g\fP [\fIstring\fP]] [\fB-q\fP] \ [\fB-W\fP \fIbytes\fP] [\fB-L\fP \fIbytes\fP] \\ [\fB-T\fP [\fIseparator\fP]] [\fB-P\fP [\fIseparator\fP]] [\fB-p\fP] \\ [\fB-V\fP] [\fB-x\fP|\fB-X\fP \fItype\fP [\fIword\fP] \fIdelay\fP] \ [\fB-/\fP \fIprefix\fP|\fIsubstring\fP|\fIfuzzy\fP] \\ [input_file] ::= \fIcol1\fP[-\fIcol2\fP],...|\fI\fP,... ::= \fIcol1\fP[-\fIcol2\fP],...|\fI\fP,... ::= [l|r:]|[a:left|right]|[p:included|all| [w:]|[f:yes|no]|[o:[+]]|[n:]| [i:]|[d:]|[s:]|[h:trim|cut|keep] ::= [fg][/bg][,style] ::= \fB\fIregex\fB\fR and can be freely mixed. The parameters of -a and -D must be delimited by blanks. .fi .SH DESCRIPTION This small utility acts as a filter when no input file is given (reads from stdin and writes to stdout) or takes its inputs from that file. All read words are presented in a scrolling window on the terminal \fBat\fP the current cursor position without clearing the screen before. .PP The selection cursor is initially positioned on the first selectable word by default. .PP Options exists to explicitly or implicitly include or exclude some words by using extended regular expressions. Notice that when some words are explicitly excluded they can no more be re-included after. .PP Excluded words are skipped when the selection cursor is moved and cannot be searched for. .PP The \fB-W\fP option can be used to set the characters (or multibyte sequences) which will be used to delimit the input words. The default delimiters are: \fISPACE\fP, \fI\\t\fP and \fI\\n\fP. .PP The \fB-L\fP has a similar meaning for lines. Special character sequences formed by a \fI\\\fP followed by one of the characters \fIa\fP \fIb\fP \fIt\fP \fIn\fP \fIv\fP \fIf\fP \fIr\fP and \fI\\\fP are understood and have their traditional meanings. UTF-8 sequences introduced by \fI\\u\fP are also understood. \fI\\u\fP can be followed by 2,4,6 or 8 hexadecimal characters. An invalid UTF-8 sequence will be replaced by a dot (\fI.\fP), see also below. Example: \fI\\uc3a9\fP means latin small letter e with acute. .PP Note that with most shells, the \fI\\\fP before the \fIu\fP need to be protected or escaped. .PP Quotations (single and double) in the input stream can be used to ignore the word separators so that a group of words are taken as a single entity. .PP Non printable characters in words that are not delimiters are converted to their traditional form (\fI\\n\fP for end-of-line, \fI\\t\fP for tabulation...) by default. A single dot (\fI.\fP) is also used as a placeholder otherwise. .PP Words containing only spaces, entered directly or resulting from a substitution, are also rejected unless they are not selectable. This allows special effects like creating blank lines for example. These words are also kept in column mode, selectable or not. .PP \fBWarning\fP, \fBUTF-8\fP encoded codepoints are quietly converted into dots (\fI.\fP) when the user locale is not \fBUTF-8\fP aware like \fBPOSIX\fP or \fBC\fP by example. .PP .SS "Moving among words" The cursor can be moved in every direction by using the keyboard arrow keys (\fB\(<-\fP,\fB\(da\fP,\fB\(ua\fP,\fB\(->\fP) or the \fIvi\fP direction keys (\fBh\fP, \fBj\fP, \fBk\fP and \fBl\fP). \fBHOME\fP, \fBEND\fP, \fBPgDn\fP and \fBPgUp\fP can also be used, if available, and have the following meanings: .TS tab(@); l l. \fB\(<-\fP, \fBh\fP@Previous word \fBCTRL\ \(<-\fP, \fBH\fP@Start of line \fB\(ua\fP, \fBk\fP@Previous line \fBPgUp\fP, \fBK\fP@Previous page \fBHOME\fP@First word of the window \fBCTRL\ HOME\fP, \fBSHIFT\ HOME\fP, \fBCTRL\ K\fP@First word \fB\(->\fP, \fBl\fP@Next word \fBCTRL\ \(->\fP, \fBL\fP@End of line \fB\(da\fP, \fBj\fP@Next line \fBPgDn\fP, \fBJ\fP@Next page \fBEND\fP@Last word of the window \fBCTRL\ END\fP, \fBSHIFT\ END\fP, \fBCTRL\ J\fP@Last word .TE \fBCTRL\ \(<-\fP/\fBH\fP (resp. \fBCTRL\ \(->\fP/\fBL\fP) places the cursor so that a maximum number of words (selectable or not) are visible to the left (reps. right) side of the window. If \fB-N\fP, \fB-U\fP or \fB-F\fP are used, then it becomes possible to directly access a word by entering its number. The numbering created using these option is done \fBbefore\fP any words substitution done using \fB-S\fP, \fB-I\fP or \fB-E\fP. Using a combination of these options, it is easy to control which words will be numbered by adding a special symbol in it before using smenu and removing it (substituted by nothing) afterward using \fB-I\fP by example. \fB-E\fP gives another way to do that, see below or more. .SS "Searching for words" A word can be searched using different algorithms: \fIprefix\fP, \fIsubstring\fP of \fIfuzzy\fP. .TP \fIprefix\fP (keys \fB^\fP or \fB=\fP): The sequence of characters entered must match the beginning of a word. .TP \fIsubstring\fP (keys \fB"\fP or \fB'\fP): The sequence of characters entered must match a substring in a word. .TP \fIfuzzy\fP (keys \fB~\fP or \fB*\fP): All the characters in the entered sequence must appear in the same order in a word, but need not be consecutive. The case is also ignored. The cursor is placed, if possible, on the first matching word having the minimum number of gaps between the first and last matching character, see the difference between the actions of the \fBs\fP/\fBS\fP and \fBn\fP/\fBN\fP keys below. This method also tolerates intermediate symbols not appearing in the words which will be ignored. If this is the case, the attributes of the approximatively matching words are changed into an error versions of them to warn the user to this situation. The erroneous symbols will \fInot\fP be inserted in the search buffer. For example: if the word \fBabcdef\fP is present in the standard input, then entering \f(CBabxcdye\fP puts \fBabcdef\fP in the search buffer and the word is added to the list of matching words and displayed with an error attribute (in red by default). This special state will persist until all the symbols following the first erroneous one are deleted (using backspace) or if \fBESC\fP is pressed. .PP During a search session, the cursor changes and each character entered is added in (or removed from) the search buffer. The display is refreshed after each change in this buffer. .PP The slash key (fB/\fP) can also be used instead of any of these keys. By default it is is programmed to do a \fIfuzzy\fP search but this can be changed by using the command line option (\fB-/\fP) or by tuning a configuration file, see below. .PP All the words matching the current search buffer are enhanced: The characters present in the current search buffer are highlighted in one way and the other characters in another way. Both of these highlighting methods are configurable. .PP If the user has entered the search sequence: \fBo\fP, \fBs\fP, then the matching word "words" will be displayed as \fBw\fP\fIo\fP\fBrd\fP\fIs\fP when the \fIfuzzy\fP algorithm is in use depending of the display attributes configured. .PP \fBESC\fP can be used anytime to abort the current search session. \fBENTER\fP and all cursor moves also terminate the search session but do not clear the list of the matchng words. .PP The user can then use the \fBn\fP/\fBs\fP/\fBSPACE\fP keys (forward) and the \fBN\fP/\fBS\fP keys (backward) to navigate in the list of matching words, In \fIfuzzy\fP search mode, the \fBs\fP/\fBS\fP keys attempt to move the cursor to the next/previous word whose matching part forms a substring of this word. If no such matches exist, \fBs\fP/\fBS\fP and \fBn\fP/\fBN\fP do the same things. To move the cursor to the next/previous fuzzy match, use the \fBn\fP/\fBN\fP/\fBSPACE\fP keys. \fBs\fP means next \fPs\fPubstring match in this context while \fBn\fP just means \fBn\fPext match. .PP If the user hits the \fBHOME\fP or \fBEND\fP key during a search session then the list of matching words is reduced to the words starting (respectively) ending with the current search pattern and the window is refreshed. For those who consider \fBHOME\fP and \fBEND\fP as non-intuitive, the \fBCTRL\ A\fP and \fBCTRL\ Z\fP keys are also available in search mode as an alternative. This behaviour is persistent until the user hit the \fBESC\fP or \fBENTER\fP key. For example, if the search pattern in substring mode is \f(CBsh\fP and the user hits \fBEND\fP, then only the words \fIending\fP with \f(CBsh\fP will be added in the searched word list and enhanced. Note that when a matching word is selected, its enhanced characters only show one of the multiple matching possibilities. When not in a search session \fBESC\fP can be also used to clear the list of matching words and to reset the search buffer. .PP In summary, here is the meaning of the special keys in search mode: .TS tab(@); lb s s l l c ^ ^ l l lw(6c) c . Keys which clear the list of matching words. Key@Meaning@Closes @@the @@search @@session _ Esc@Cancel search@Yes _ .T& lb s s l l l ^ ^ l l lw(6c) c . Keys which keep or update the list of matching words. Key@Meaning@Closes @@the @@search @@session _ \fB\(<-\fP@Previous word@Yes \fB\(ua\fP@Previous line@Yes \fBCTRL\ \(<-\fP@Start of line@Yes \fBPgUp\fP@Previous page@Yes \fBCTRL\ HOME\fP, \fBSHIFT\ HOME\fP, \fBCTRL\ K\fP@First word@Yes \fB\(->\fP@Next word@Yes \fB\(da\fP@Next line@Yes \fBCTRL\ \(->\fP@END of line@Yes \fBPgDn\fP@Next pages@Yes \fBCTRL\ END\fP, \fBSHIFT\ END\fP, \fBCTRL\ J\fP@Last word@Yes \fBHOME\fP, \fBCTRL\ A\fP@T{ Only keep the words starting with the search pattern T}@No \fBEND\fP, \fBCTRL\ Z\fP@T{ Only keep the words ending with the search pattern T}@No \fBINS\fP@Tag word@No \fBDEL\fP@Untag word@No _ .TE .PP Note that the search buffer is persistent as long as the same search algorithm is used and \fBESC\fP has not been pressed. .SS "Selection and Exit" Pressing \fBq\fP gives the possibility to exit without selecting anything. .PP By default, \fBENTER\fP writes the selected word to stdout when not in search mode otherwise it exits from this mode and does nothing more. If you want to be able to select a word \fIeven\fP when in search mode, use the \fB-r\fP option to change this behavior. .SS "Tagging (multiple selections)" When the tagging is activated by using the command line \fB-T\fP or \fB-P\fP option, then the keys \fBt\fP, \fBT\fP, \fBINS\fP and \fBDEL\fP can be used to tag/untag some words. These tagged words will then be output on the standard output when \fBENTER\fP is pressed. .TP \fBt\fP Tag/untag or Pin/unpin the word under the cursor (toggle). .TP \fBT\fP Tag or pin the matching words if any. .TP \fBU\fP Untag or unpin the matching words if any. .TP \fBINS\fP Tag or pin the word under the cursor. .TP \fBDEL\fP Untag or unpin the word under the cursor. .SS Help A small help message can be displayed when hitting \fB?\fP. This display will last for 10s or until a valid key or \fBESC\fP is pressed. .SS Scroll bar A scroll bar is displayed at the right of the scrolling window. Its appearance is meant to be classical but it has some particularities: .IP * 2 The scroll bar is not displayed if all the input words fit on only one line. .IP * 2 Otherwise, the scroll bar is always displayed except when the \fB-q\fP option is set. This option completely disables the scroll bar display. .IP * 2 When the scrolling window has only one line, the scroll bar has only 3 states: .RS 2 .IP - 2 \fBv\fP when on all but the last line, indicating that you can go down to see more. .IP - 2 \fB^\fP when on the last line. .IP - 2 \fB|\fP otherwise. .RE .IP * 2 When there is more than one line to display, \fB/\fP means that the window displays the first line, \fB\\\fP the last line. \fB|\fP is used to fill the gap, see below the different possible configurations. .TS tab(@); l l l l l l l l l l l l l l . \\@\\@^@^@\\ @Do not remove this trailing space! |@|@|@|@/ /@v@/@v .TE .PP A \fB+\fP can also appear in the scroll bar in lieu of the vertical bar, giving the relative position of the cursor line in the bunch of input words. .SS "Terminal resizing (also see BUGS/LIMITATIONS)" The windows is redrawn if the terminal is resized. The redrawing is actually done only 1s after the end of the resizing to avoid artefacts on screen. The cursor will remain on the current selected word but may be displayed at another place in the window. .SS Unicode support This utility is Unicode aware and should be able to display correctly any Unicode character (even double-width ones) as long as the current encoding is \fBUTF-8\fP (\fBUTF-8\fP in the output of the \fIlocale\fP command). .SS Configuration If a file with adequate permissions and the same name as the executable but prefixed with a dot is present in the current directory or in the user's home directory, then it will be parsed as a \fIini\fP file. The values read from the file in the home directory will be overridden by the ones read from the local directory (if it is present). Missing and bad keywords are silently skipped. The values read, if valid, override the default hard-coded ones. If a value is invalid an error message is shown and the program terminates. The values of the timers must be given in units of \fB1/10\fP of a second. Here is an example giving the syntax and the names of the keywords allowed: .PP .nf \f(CR--8<------------------------------------------------------------------ [colors] ; The terminal must have at least 8 colors and/or have attributes like bold ; and reverse for this to be useful ; if not the following settings will be ignored. method=ansi ; classic | ansi (default) cursor=0/2 ; cursor attributes cursor_on_tag=0/2,u ; cursor on tag attributes shift=6,b ; shift symbol attributes message=0/3 ; message (title) attributes bar = 7/4,b ; scroll bar attributes search_field = 0/6 ; search field attributes search_text = 7,bu ; search text attributes match_field = 1,b ; matching words field attributes match_text = 7,bu ; matching words text attributes search_err_field = 1 ; approximate search field attributes search_err_text = 1,r ; approximate search text attributes ; match_err_field = 3 ; approximate matching words field attributes match_err_text = 1 ; approximate matching words text attributes ; include = b ; selectable color attributes exclude = 4/0,u ; non-selectable color attributes tag = 0/5 ; tagged (selected) attributes daccess = 3,b ; direct access tag attributes special1 = 7/4,b ; attributes for the special level 1 special2 = bu ; attributes for the special level 2 special3 = /3,b ; attributes for the special level 3 special4 = 7/4 ; attributes for the special level 4 special5 = 7/2,b ; attributes for the special level 5 [window] lines = 7 ; default number of lines of the window [limits] word_length = 1024 ; arbitrary max length of input words (int) words = 32767 ; arbitrary max number of allowed input ; words (int) columns = 128 ; arbitrary max number of columns (int) [timers] search = 60 ; search timers in 1/10 s help = 150 ; duration of the help message in 1/10 s window = 7 ; delay before redrawing if the size of the ; terminal's window change in 1/10 s direct_access = 6 ; duration allowed to add a new digit to ; the direct word access number in 1/10 s [misc] default_search_method = substring --8<------------------------------------------------------------------ \fP .fi .IP * 2 The \fBmethod\fP keyword can take the two possible values displayed above and determines if you want to use the native method (limited to 8 colors) of the \fBansi\fP method (ISO 8613-6) if your terminal supports more than 8 colors. The default value corresponds to \fBansi\fP. The attributes syntax is [fg][/bg][,toggles] where \fBfg\fP and \fBbg\fP are numbers representing the foreground and background color and \fBtoggles\fP is a strings which can contain the characters \fIb\fP, \fId\fP, \fIr\fP, \fIs\fP, \fIu\fP and \fIi\fP standing for \fIb\fPold, \fId\fPim, \fIr\fPeverse, \fIs\fPtandout, \fIu\fPnderline and \fIi\fPtalic. .IP * 2 Spaces are allowed anywhere in the lines and between them, even around the \fB=\fP. .IP * 2 Everything following a \fB;\fP is ignored. .IP * 2 When undefined, the default limits are: .TS tab(@); l l . words@32767 word_length@512 columns@256 .TE .SH OPTIONS .IP "\fB-h\fP or \fB-?\fP" Displays a long (\fB-h\fP) or short (\fB-?\fP) help message and exits. .IP "\fB-f\fP \fIconfiguration_file\fB" This option gives the possibility to select an alternative configuration file. If the given file doesn't exist or is not readable then the default values will be used. The \fB.smenu\fP files in the user's home directory and in the current directory, if present, will be ignored when this option is used. .IP "\fB-n\fP \fI[lines\fB]" Gives the maximum number of lines in the scrolling selection window. If \fB-n\fP is not present the number of lines will be set to \fI5\fP. If \fB-n\fP is present without argument, then the height of the terminal will be used to determine the number of lines. This remains true even if the terminal is resized. If \fB-n\fP is present with a numerical argument, this value will be used to determine the number of lines. .IP "\fB-t\fP [\fIcolumns\fP]" This option sets the tabulation mode and, if a number is specified, attents to set the number of displayed columns to that number. In this mode, embedded line separators are ignored. The options \fB-A\fP and \fB-Z\fP can nevertheless be used to force words to appear in the first (respectively last) position of the displayed line. .PP .RS Note that the number of requested columns will be automatically reduced if a word does not fit in the calculated column size. .PP In this mode each column has the same width. .RE .IP \fB-k\fP By default, the spaces surrounding the output string will be deleted. This option forces them to be retained. .IP \fB-v\fP By default, when searching, an alarm is produced by the terminal when the user enters a character or makes a move which lead to no result or to an error condition. This argument make this beep visual by briefly showing the cursor. .IP "\fB-s\fP \fIpattern\fP" Place the cursor on the first word corresponding to the specified pattern. \fIpattern\fP can be: .RS .IP * 2 A \fB#\fP immediately followed by a \fBnumber\fP giving the initial position of the cursor (counting from 0). If the word at this position is excluded, then the first previous non excluded word is selected if it exists, otherwise the first non excluded word is selected. If this number if greater than the number of words, the cursor will be set on the latest selectable position. .IP * 2 A single \fB#\fP or the string \fB#last\fP to set the initial cursor position to the latest selectable word position. .IP * 2 A string starting with a \fB/\fP indicating that we want the cursor to be set to the first word matching the given regular expression. .IP * 2 A \fBprefix\fP string indicating that we want the cursor to be set on the first word matching the string given (\fBa\fP will match \fBCancel\fP by example). .PP Warning, when searching for a prefix or a regular expression, smenu only looks for them after an eventual modification, so for example, the command: \f(CBsmenu -I/c/x/ -s/c <<< "a b c d"\fP won't find c and put the cursor on \fBa\fP but \f(CBsmenu -I/c/x/v -s/c <<< "a b c d"\fP will find it and put the cursor on the \fBx\fP substituting the \fBc\fP on screen only \fI\\u\fP sequences can be used in the pattern. .RE .IP "\fB-m\fP \fImessage\fP" Displays a message above the window. If the current locale is not \fIUTF-8\fP, then all \fIUTF-8\fP characters in it will be converted into a dot. \fI\\u\fP sequences can be used in the message. Note that the message will be truncated if it does not fit on a terminal line. .IP "\fB-w\fP" When \fB-t\fP is followed by a number of columns, the default is to compact the columns so that they use the less terminal width as possible. This option enlarges the columns in order to use the whole terminal width. When in column mode, \fB-w\fP can be used to force all the columns to have the same size (the largest one). See option \fB-c\fP below. .PP .RS Note that the column's size is only calculated once when the words are displayed for the first time. A terminal resize will not update this value. This choice enables a faster display. .RE .PP .IP \fB-d\fP Tells the program to clean up the display before quitting by removing the selection window after use as if it was never displayed. .IP \fB-M\fP Centers the display if possible. .IP \fB-c\fP Sets the column mode. In this mode the lines of words do not wrap when the right border of the terminal is reached but only when a special character is read. Some words will not be displayed without an horizontal scrolling. If such a scrolling is needed, some indications may appear on the left and right edge of the window to help the user to reach the unseen words. In this mode, the width of each column is minimal to keep the maximum information visible on the terminal. .IP \fB-l\fP Sets the line mode. This mode is the same as column mode but without any column alignment. .IP \fB-r\fP Enables \fBENTER\fP to validate the selection even in search mode. .IP \fB-b\fP Replaces all non-printable characters by a blank. If this results in a blank word, it will be potentially deleted. .IP "\fB-a \fIPREFIX:ATTR\fP [\fIPREFIX:ATTR\fP...]" Sets the display attributes of the elements displayed and the cursor. At least one attribute prefixed attribute must be given. \fIPREFIX\fP can take the following values: .RS .IP \fIi\fP included words. .IP \fIe\fP excluded words. .IP \fIc\fP cursor. .IP \fIb\fP scroll bar. .IP \fIs\fP shift indicator. .IP \fIm\fP message (title). .IP \fIt\fP tagged words. .IP \fIct\fP cursor on tagged words. .IP \fIsf\fP search field. .IP \fIst\fP search text. .IP \fIsfe\fP approximate search field with error. .IP \fIste\fP approximate search text with error. .IP \fImf\fP matching words field. .IP \fImt\fP matching words text. .IP \fImfe\fP matching words field with error. .IP \fImte\fP matching words text with error. .IP \fIda\fP direct access tag. .RE If more than one attribute is given, then they must be separated by spaces. See the \fB-1\fP option for the \fIATTR\fP syntax. .IP "\fB-i\fP \fIregex\fP" Sets the \fBi\fPnclude filter to match the selectable words. All the other words will become implicitly non-selectable (excluded) \fB-i\fP can be used more than once with cumulative effect. \fI\\u\fP sequences can also be used in the regexp. .IP "\fB-e\fP \fIregex\fP" Sets the \fBe\fPxclude filter to match the non-selectable words. All the other selectable words will become implicitly selectable (included) \fB-e\fP can be used more than once with cumulative effect. This filter has a higher priority than the include filter. The \fIregex\fP selections made using \fB-i\fP and/or \fB-e\fP are done before the possible words alterations made by \fB-I\fP or \fB-E\fP (see below). \fI\\u\fP sequences can also be used in the regexp. .IP "\fB-C\fP [\fIi\fP|\fIe\fP] \ <\fIcol selectors\fP>" These letters are case independent so \fII\fP can be used in place of \fIi\fP per example. In column mode, this option allows one to restrict the previous selections or de-selections to some columns. If no selection is given via \fB-i\fP and \fB-e\fP this option gives the possibility to select entire columns by giving their numbers (1 based) of extended regular expressions. \fIi\fP or nothing select the specified ranges of columns. \fIe\fP select all but the specified ranges of columns. The words in the selected columns will be considered as \fBi\fPncluded And the others \fBe\fPxcluded. A selection by regular expressions means that a column containing a word matching one of these expression will be included or excluded according to the letter given after the option. Regular expressions and column numbers can be freely mixed. Regular expression in \fB-C\fP and \fB-R\fP can contain \fIUTF-8\fP characters either directly or by using the \fI\\u\fP notation. Example of columns selection: \f(CB-Ci2,3,/X./,5-7\fP forces the cursor to only navigate in columns \fB2\fP,\fB3\fP,\fB5\fP,\fB6\fP and \fB7\fP and those containing a two characters word starting with '\fBX\fP'. If \fIe\fP was used in place of \fIi\fP, all the columns would have been selected \fBexcept\fP the columns \fB2\fP,\fB3\fP,\fB5\fP,\fB6\fP,\fB7\fP and those matching the extended regular expression '\f(CBX.\fP'. Spaces are allowed in the selection string if they are protected. The column mode is forced when this option is selected. .IP "\fB-R\fP [\fIi\fP|\fIe\fP] \ <\fIrow selectors\fP>" Similar to \fB-C\fP but for the rows. One difference though: this is the line mode which is forced by this option NOT the column mode. \fB-C\fP and \fB-R\fP can be used more than once in a cumulative manner: The selection mode (selection or de-selection) is given by the first occurrence of the options, the other occurrences will only update the selected or de-selected ranges. .IP "\fB-S\fP /\fIregex\fP/replacement string/[\fIg\fP][\fIv\fP][\fIs\fP]" Post-processes the words by applying a regular expression based substitution. The argument must be formatted as in the \fBsed\fP editor. This option can be used more than once. Each substitution will be applied in sequence on each word. This sequence can be stopped if a \fBstop\fP flag is encountered. .RS \fBflags:\fP .IP * 2 The optional trailing \fBg\fP (for \fIg\fPlobal) means that all matching occurrences shall be replaced and not only the first one. .IP * 2 The optional trailing \fBv\fP (for \fIv\fPisual) means that the altered words will only be used for display and search. The modifications will \fInot\fP be reflected in the returned word. .IP * 2 The optional trailing \fBs\fP (for \fIs\fPtop) means that no more substitution will be allowed on this word even if another \fB-S\fP is used. .IP * 2 The optional trailing \fBi\fP (for \fIi\fPgnore case) means that the string search operation should ignore the case for this pattern. Small example: \f(CBR=$(echo a b c | smenu -S /b/B/)\fP will display \f(CR"a B c"\fP and \f(CBR\fP will contain \fIB\fP if \fI B\fP is selected meanwhile \f(CBR=$(echo a b c | smenu -S /b/B/\fBv\fP)\fR will display the same as above but \f(CBR\fP will contain the original word \fIb\fP if \fIB\fP is selected. In both cases, only the word \fIB\fP will be searchable and not \fIb\fP. .RE .IP "\fB-I\fP /\fIregex\fP/replacement string/[\fIg\fP][\fIv\fP][\fIs\fP]" Post-processes the \fBselectable\fP words by applying a regular expression based substitution (see \fB-S\fP for details). .IP "\fB-E\fP /\fIregex\fP/replacement string/[\fIg\fP][\fIv\fP][\fIs\fP]" Post-processes the \fBexcluded\fP (or \fBnon-selectable\fP) words by applying a regular expression based substitution (see \fB-S\fP for details). .PP .RS The \fB/\fP separator that \fB-I\fP and \fB-E\fP are using above can be substituted by any other character except \fISPACE\fP, \fI\\t\fP, \fI\\f\fP, \fI\\n\fP, \fI\\r\fP and \fI\\v\fP. .PP In the three previous options, \fIregex\fP is a \fBPOSIX\fP \fBE\fPxtended \fBR\fPegular \fBE\fPxpression. For details, please refer to the \fBregex\fP manual page. .PP Additionally \fI\\u\fP sequences can also be used in the regexp. .PP .RE If a post-processing action (\fB-S\fP/\fB-I\fP/\fB-E\fP) results in an empty (length 0) word, then we have two cases: .RS .IP "in column mode:" Substitutions involving empty words can lead to misalignments, so it is necessary to prohibit them and terminate the program. These substitutions have to be made with other tools before using this utility. .IP "otherwise:" The word is simply removed. .RE .IP "\fB-A\fP \fIregex\fP" In column mode, forces all words matching the given regular expression to be the first one in the displayed line. If you want to only rely on this method to build the lines, just specify an empty \fBregex\fP to set the end-of-line separator with \fI-L ''\fP) .PP .RS \fI\\u\fP sequences can also be used in the regexp after \fB-A\fP. .RE .IP "\fB-Z\fP \fIregex\fP" Similar to \fB-A\fP but forces the word to be the latest of its line. The same trick with \fB-L\fP can also be used. .PP .RS \fI\\u\fP sequences can also be used in the regexp after \fB-Z\fP. .RE .IP "\fB-N\fP [\fIregex\fP]" This option allows one to number the selectable words matching a specific regular expression. These numbers are numbered starting from 1 and provides a direct access to the words. To use this functionality, the user must enter the number which corresponds to the desired entry digit per digit. Each new digit must be added in a time frame of 1/2 seconds (per default) otherwise the number is considered complete and a newly entered digit will start a new number. If the number does not exists, then the cursor is restored to it's initial position. The sub-options of the \fB-D\fP option described below can change the way \fB-N\fP sets and formats the numbers. This option can be used more than once with cumulative effects. \fB-N\fP, \fB-U\fP and \fB-F\fP can be mixed. .IP "\fB-U\fP [\fIregex\fP]" This option allows one to un-number words. If placed after a previous \fB-N\fP, it can be used to remove the numbering of selected words. If placed before, the word which doesn't match its regular expression will be numbered by default. This mechanism is similar to to the inclusion/exclusion of words by \fB-i\fP and \fB-e\fP. This option can be used more than once with cumulative effects. \fB-U\fP, \fB-N\fP and \fB-F\fP can be mixed. .IP "\fB-F\fP" This option is similar to \fB-N\fP but does not generate a continuous flow of numbers but extracts them from the word itself. With this option you can take full control of the numbering of the displayed word. Note that the numbering does not need to be ordered. The resulting word after the extraction of the number must be non empty. Some sub-option are required, see the \fB-D\fP option described below. \fBNotice\fP that for this option to work correctly, all the embedded numbers must have the same number of digits. To get that, a preprocessing may be necessary on the words before using this program. \fB-F\fP, \fB-N\fP and \fB-U\fP can be mixed. .IP "\fB-D\fP [\fIparameters\fP]" This option allows one to change the default behaviour of the \fB-N\fP, \fB-U\fP and \fB-F\fP options. Its optional parameters are called sub-options and must respect the format \fBx\fP:\fBy\fP where \fBx\fP can be: .RS .TP \f(CBl\fP (\fB-F\fP, \fB-N\fP and \fB-U\fP options) Here \fBy\fP is the UTF-8 character (in native or \fI\\u\fP form) to print before the number. The default is a single space. . .TP \f(CBr\fP (\fB-F\fP, \fB-N\fP and \fB-U\fP options) Here \fBy\fP is the UTF-8 character (in native or \fI\\u\fP form) to print after the number. The default is \f(CB)\fP. . .TP \f(CBa\fP (\fB-F\fP, \fB-N\fP and \fB-U\fP options) Here \fBy\fP is '\f(CBleft\fP' (or one of its prefixes) if the number must be \fIleft\fP aligned, or '\f(CBright\fP' (or one of its prefixes) if it must be \fIright\fP aligned. The default is \f(CBright\fP. . .TP \f(CBp\fP (\fB-F\fP, \fB-N\fP and \fB-U\fP options) Here \fBy\fP is '\f(CBincluded\fP' (or one of its prefixes) or '\f(CBall\fP' (or one of its prefixes) for the initial \fIp\fPadding of the non numbered words. '\f(CBincluded\fP' means that only \fIincluded\fP word will be padded while '\f(CBall\fP' means pad \fIall\fP words. The default is \f(CBall\fP. . .TP \f(CBw\fP (\fB-F\fP, \fB-N\fP and \fB-U\fP options) Here \fBy\fP is the \fIw\fPidth of the number between 1 and 5 included. . .TP \f(CBf\fP (\fB-F\fP, \fB-N\fP and \fB-U\fP options) Here \fBy\fP controls if the numbering must \fIf\fPollow the last extracted number (defaults to \f(CByes\fP) or if it must remain independent. . .TP \f(CBh\fP (\fB-F\fP option) Tells what to do with the characters present before the embedded number if any. The allowed directives are: '\f(CBtrim\fP' which discads them if they form an empty word (only made of spaces and tabulations), '\f(CBcut\fP' which unconditionnaly discards them and '\f(CBkeep\fP' which places them at the beginning of the resulting word. The default value for this directive is '\f(CBkeep\fP'. . .TP \f(CBo\fP (\fB-F\fP option) Here \fBy\fP is the \fIo\fPffset of the first multibyte character of the number to extract from the word (defaults to \f(CB0\fP). If this offset if immediately followed by the character '\f(CB+\fP', then the parser will look for the first number (if any) after the given offset instead of using its absolute value to extract the number. Note that when the '\f(CB+\fP' is used, it is necessary that the length of all the numbers to extract have the same size as the algorithm looks for a digit to identify the beginning of the number to extract. Hence, for example, \fB1\fP should appear as \fB01\fP in the input is \f(CBn\fP is set to \f(CB2\fP. . .TP \f(CBn\fP (\fB-F\fP option) Here \fBy\fP is the \fIn\fPumber of multibyte characters to extract from the word starting at the offset given by the \f(CBo\fP sub-option. . .TP \f(CBi\fP (\fB-F\fP option) Here \fBy\fP is number of multibyte characters to \fIi\fPgnore after the extracted number . .TP \f(CBd\fP (\fB-F\fP, \fB-N\fP and \fB-U\fP options) Here \fBy\fP is a multibyte separator. When present, this directive instructs smenu to output the selected numbered word(s) \fIprefixed\fP by its(their) direct access number(s) and the given separator. Only the numbered word(s) will be prefixed. \f(CBd\fP stands for \fBd\fPecorate. This directive can be useful when you want to post-process the output according to its direct access number. . .TP \f(CBs\fP (\fB-F\fP, \fB-N\fP and \fB-U\fP options) Here \fBy\fP is the direct access number that will be set for the first numbered word. Its value is \fB1\fP by default, a value of \fB0\fP is possible. .P Example: \f(CWr:\\> l:\\< a:l d:_ \fP To number all words with the default parameters, use the syntax: "\f(CW-N .\fP" which is a shortcut for: "\f(CW-N . l:' ' r:')' a:r p:a\fP" The \fIpadding\fP sub-option specifies whether spaces must also be added in front of excluded words or not to improve compactness. When the \f(CBw\fP sub-option is not given the width of the numbers is determined automatically but if \fB-F\fP is set and the value of the \f(CBn\fP sub-option is given then this value is used. .RE .IP "\fB-1\fP ... \fB-5\fP \fIregex\fP [\fIATTR\fP]" Allows one to give a special display color to up to 5 classes of words specified by regular expressions. They are called \fBspecial levels\fP. Only selectable words will be considered. By default, the 5 special levels have their foreground color set to red, green, brown/yellow, purple and cyan. All these colors also can be set or modified permanently in the configuration files. See the example file above for an example. The optional second argument (\fIATTR\fP) can be used to override the default or configured attributes of each class. Its syntax is the same as the one used in the configuration file: .nf [\fIfg\fP][/\fIbg\fP][,{\fIb\fP|\fId\fP|\fIr\fP|\fIs\fP|\fIu\fP|\fIi\fP}] \ | [{\fIb\fP|\fId\fP|\fIr\fP|\fIs\fP|\fIu\fP|\fIi\fP}] .fi Examples of possible attributes are: .nf \f(CB2/0,bu \fPgreen on black bold underline \f(CB/2 \fPgreen background \f(CB5 \fPtext in purple \f(CBrb \fPreverse bold .fi \fI\\u\fP sequences can be used in the pattern. .IP "\fB-g\fP [\fIstring\fP]" Replaces the blank after each words in column or tabular mode by a column separator. This separator is extracted from the \fIstring\fP argument and each of its (multibyte) character is used one after the other to fill the gutter. If there are more columns that gutter characters then the last character is used for the remaining columns. When not given, the separator defaults to a vertical bar \fI|\fP (or a full height vertical bar if the locale is set to UTF-8). Each character can be given in normal or \fI\\u\fP form in the \fIstring\fP argument. Example: "\f(CB|- \fP" will allow one to separate the first two columns with '\f(CB|\fP', then '\f(CB-\fP' will be used and '\f(CB \fP' will separate the remaining columns if any. .IP \fB-q\fP Prevents the display of the scroll bar. .IP "\fB-W\fP \fIbytes\fP" This option can be used to specify the characters (or multibyte sequences) which will be used to delimit the input words. Multibyte sequences (UTF-8) can be natives of using the same ASCII representation used in words (a leading \fI\\u\fP following by up to 8 hexadecimal characters). Non-printable characters in arguments should be given using the standard \fI$''\fP representation. \fI$'\\t'\fP stands for the tabulation character for example. The default delimiters are: \fISPACE\fP, \fI$'\\t'\fP and \fI$'\\n'\fP. .IP "\fB-L\fP \fIbytes\fP" This option can be used to specify the characters (or multibyte sequences) which will be used to delimit the lines in the input stream. Multibyte sequences (UTF-8) can be natives of using the same ASCII representation used in words (a leading \fI\\u\fP following by up to 8 hexadecimal characters). Non-printable characters in arguments should be given using the standard $'' representation. $'\\n' stands for the newline character for example. The default delimiter is: \fI$'\\n'\fP. This option is only useful when the \fB-c\fP or \fB-l\fP option is also set. The characters (or multibyte sequences) passed to \fB-L\fP are automatically added to the list of word delimiters as if \fB-W\fP was also used. \fI\\u\fP sequences can also be used here. .IP "\fB-T\fP [\fIseparator\fP]" Enables the multiple selections or tag mode. In this mode, several selectable words can be selected without leaving the program. The current word can be automatically tagged when the \fBENTER\fP key is pressed to complete the selection process if the \fB-p\fP option is also set or if no word has been tagged. All the tagged words (and possibly the world under the cursor) will be sent to stdout separated by the optional argument given after the option \fB-T\fP. Note than this \fIseparator\fP can have more than one character, contain UTF-8 characters (in native or \fI\\u\fP form) and can even contain control character as in \f(CB$'\\n'\fP. A space is used as the default separator if none is given. \fBCaution\fP: To get exactly the same behavior as in version 0.9.11 and earlier, you must also use the \fB-p\fP option. .IP "\fB-P\fP [\fIseparator\fP]" Works like \fB-T\fP but, unlike \fB-T\fP, the output depends on the order in which the words were tagged. In other words, the first tagged word comes first in the output, the second tagged word comes next, and so on. \fB-P\fP stands for "Pin". .IP \fB-p\fP This option modifies the default behavior of the \fB-T\fP and \fB-P\fP options. An untagged word under the cursor will be automatically tagged when \fBENTER\fP is pressed. .IP \fB-V\fP Displays the current version and quits. .TP \fB-x \fItype\fP [\fIword\fP] \fIdelay\fP .TQ \fB-X \fItype\fP [\fIword\fP] \fIdelay\fP Sets a timeout. Three types of timeout are possible: .RS .TP 10 current: At the timeout, the word under the cursor and/or the tagged words are sent to the standard output if the \fBENTER\fP key has been pressed .TP 10 quit: At the timeout, nothing is selected as if the \fBq\fP key has been pressed .TP 10 word: At the timeout, the word given after the type is selected. Note that this word doesn't need to be part of the words coming from the standard input. .PP Each type can be be shortened as a prefix of its full name ("cur" for "current" of "q" for "quit" per example). The delay must be set in seconds and cannot be above 99999 seconds. The remaining time (in seconds) is added at the end of the message displayed above the selection window and is updated in real time each second. Each key press except \fBENTER\fP, \fBq\fP, \fBQ\fP and \fB^C\fP resets the timer to its initial value. The \fB-X\fP version works like \fB-x\fP but no periodic remaining messages is displayed above the selection window. .RE .IP "\fB-/\fP \fIsearch_method\fP" Affects the '\fB/\fP' key to a search method. By default '\fB/\fP' is affected to '\fIfuzzy\fP' but the argument can be any prefix of '\fIprefix\fP', '\fIsubstring\fP' or '\fIfuzzy\fP'. .SH NOTES If tabulators (\fI\\t\fP) are embedded in the input, there is no way to replace them with the original number of spaces. In this case use another filter (like \fIexpand\fR) to pre-process the data. .SH EXAMPLES .SS 1 Simple Yes/No/Cancel request with "No" as default choice: .PP .nf \f(CRIn \fBbash\fP: \f(CBread R <<< $(echo "Yes No Cancel" \\ | smenu -d -m "Please choose:" -s /N)\fP or \f(CBR=$(echo "Yes No Cancel" \\ | smenu -d -m "Please choose:" -s /N)\fP In \fBksh\fP: \f(CBprint "Yes No Cancel" \\ | smenu -d -m "Please choose:" -s /N \\ | read R\fP \fP .fi .SS 2 Get a 3 columns report about VM statistics for the current process in \fBbash\fP/\fBksh\fP on Linux: .PP .nf \f(CBR=$(grep Vm /proc/$$/status | expand | smenu -b -W$'\\n' -t3 -g -d)\fB .PP \fP .fi .SS 3 Create a one column selection window containing the list of the first 20 LVM physical volumes. At the end, the selection window will be erased. This example is written in \fBksh\fP). .PP .nf \f(CB pvs -a -o pv_name --noheadings \\ | smenu -m "PV list" -n20 -t1 -d -s //dev/root \\ | read R \fP .fi The display will have a look similar to the following with the cursor set on the word \fI/dev/root\fP: .nf \f(CRPV list /dev/md126 \\ /dev/md127 | /dev/root | <- cursor here. /dev/sda2 | /dev/sdb2 | /dev/sdc1 | /dev/sdc2 | /dev/system/homevol / \fP .fi .SS "4 (advanced)" Imagine a file named \fBsample.mnu\fP with the following content: .nf \f(CR--8<--------------------------------- "1 First Entry" "3 Third entry" "2 Second entry" "4 Fourth entry" @@@ "5 Fifth entry" @@@ "0 Exit menu" --8<--------------------------------- \fP .fi Then this quite esoteric command will render it (centered on the screen) as: .nf \f(CR+----------------------------------+ | Test menu | | | | 1) First Entry 3) Third entry | | 2) Second entry 4) Fourth entry | | 5) Fifth entry | | | | 0) Exit menu | +----------------------------------+ \fP .fi with the cursor on \fIQuit\fP and only the numbers and "Quit" selectable. \f(CBR=$(smenu R=$(./smenu -q -d -s/Exit -M -n 30 -c \\ -e "@+" -E '/@+/ /' \\ -F -D n:1 i:1 \\ -m "Test menu"$'\n' < sample.mnu) The selected entry will be available in \f(CBR\fP Try to understand it as an exercise. .SH ENVIRONMENT \fINO_COLOR\fP: force a monochrome terminal when set. .SH BUGS/LIMITATIONS Some terminal emulators, those notably based on VTE version later than 0.35 (see https://github.com/GNOME/vte/commit/01380d), have a new feature that gives them the possibility to wrap/unwrap already displayed lines when resizing the window. As far as I known, there is no terminfo entry to disable that. On these types of terminals, the automatic re-display of the output of smenu will be disturbed and some artifacts may appear on the screen if the terminal window is resized. .SH AUTHORS \(co 2015 Pierre Gentile (p.gen.progs@gmail.com) smenu-0.9.15/smenu.c000066400000000000000000012134321344767411600142530ustar00rootroot00000000000000/* ################################################################### */ /* Copyright 2015 - Pierre Gentile */ /* */ /* This Software is licensed under the GPL licensed Version 2, */ /* please read http://www.gnu.org/copyleft/gpl.html */ /* */ /* you can redistribute it and/or modify it under the terms of the GNU */ /* General Public License as published by the Free Software */ /* Foundation; either version 2 of the License. */ /* */ /* This software 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. */ /* ################################################################### */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #if defined(__sun) && defined(__SVR4) #include #endif #include #include #include #include #include #include #include #include #include "xmalloc.h" #include "list.h" #include "index.h" #include "utf8.h" #include "fgetc.h" #include "utils.h" #include "getopt.h" #include "usage.h" #include "smenu.h" /* **************** */ /* Extern variables */ /* **************** */ extern ll_t * tst_search_list; extern char * eoptarg; extern char * eopterr; extern int eoptind; extern int eoptopt; extern int eoptbad; extern int eopterrfd; /* **************** */ /* Global variables */ /* **************** */ word_t * word_a; /* array containing words data (size: count) */ long count = 0; /* number of words read from stdin */ long current; /* index the current selection under the cursor) */ long new_current; /* final current position, (used in search function) */ long prev_current; /* previous position stored when using direct access */ long * line_nb_of_word_a; /* array containing the line number (from 0) * * of each word read */ long * first_word_in_line_a; /* array containing the index of the first * * word of each lines */ search_mode_t search_mode = NONE; search_mode_t old_search_mode = NONE; int help_mode = 0; /* 1 if help is displayed else 0 */ char * word_buffer; int (*my_isprint)(int); /* UTF-8 useful symbols */ /* """""""""""""""""""" */ char * left_arrow = "\xe2\x86\x90"; char * up_arrow = "\xe2\x86\x91"; char * right_arrow = "\xe2\x86\x92"; char * down_arrow = "\xe2\x86\x93"; char * vertical_bar = "\xe2\x94\x82"; /* box drawings light vertical */ char * shift_left_sym = "\xe2\x86\x90"; /* leftwards_arrow */ char * shift_right_sym = "\xe2\x86\x92"; /* rightwards_arrow */ char * sbar_line = "\xe2\x94\x82"; /* box_drawings_light_vertical */ char * sbar_top = "\xe2\x94\x90"; /* box_drawings_light_down_and_left */ char * sbar_down = "\xe2\x94\x98"; /* box_drawings_light_up_and_left */ char * sbar_curs = "\xe2\x95\x91"; /* box_drawings_double_vertical */ char * sbar_arr_up = "\xe2\x96\xb2"; /* black_up_pointing_triangle */ char * sbar_arr_down = "\xe2\x96\xbc"; /* black_down_pointing_triangle */ /* Variables used to manage the direct access entries */ /* """""""""""""""""""""""""""""""""""""""""""""""""" */ daccess_t daccess; char * daccess_stack; int daccess_stack_head; /* Variables used for fuzzy and substring searching */ /* """""""""""""""""""""""""""""""""""""""""""""""" */ long * matching_words_a; long matching_words_a_size; long matches_count; long * best_matching_words_a; long best_matching_words_a_size; long best_matches_count; long * alt_matching_words_a = NULL; long alt_matches_count; /* Variables used in signal handlers */ /* """"""""""""""""""""""""""""""""" */ volatile sig_atomic_t got_winch = 0; volatile sig_atomic_t got_winch_alrm = 0; volatile sig_atomic_t got_help_alrm = 0; volatile sig_atomic_t got_daccess_alrm = 0; volatile sig_atomic_t got_timeout_tick = 0; volatile sig_atomic_t got_sigsegv = 0; volatile sig_atomic_t got_sigterm = 0; volatile sig_atomic_t got_sighup = 0; /* Variables used when a timeout is set (option -x) */ /* """""""""""""""""""""""""""""""""""""""""""""""" */ timeout_t timeout; char * timeout_word; /* printed word when the timeout type is WORD. */ char * timeout_seconds; /* string containing the number of remaining * * seconds. */ int quiet_timeout = 0; /* 1 when we want no message to be displayed. */ /* ************** */ /* Help functions */ /* ************** */ /* ==================== */ /* Help message display */ /* ==================== */ void help(win_t * win, term_t * term, long last_line, toggle_t * toggle) { int index; /* used to identify the objects long the help line */ int line = 0; /* number of windows lines used by the help line */ int len = 0; /* length of the help line */ int offset = 0; /* offset from the first column of the terminal to * * the start of the help line */ int entries_nb; /* number of help entries to display */ int help_len; /* total length of the help line */ struct entry_s { char attr; /* r=reverse, n=normal, b=bold */ char * str; /* string to be displayed for an object in the help line */ int len; /* length of one of these objects */ }; char * arrows = concat(left_arrow, up_arrow, right_arrow, down_arrow, NULL); struct entry_s entries[] = { { 'n', "Move:", 5 }, { 'b', arrows, 4 }, { 'n', "|", 1 }, { 'b', "h", 1 }, { 'b', "j", 1 }, { 'b', "k", 1 }, { 'b', "l", 1 }, { 'n', ",", 1 }, { 'b', "PgUp", 4 }, { 'n', "/", 1 }, { 'b', "PgDn", 4 }, { 'n', "/", 1 }, { 'b', "Home", 4 }, { 'n', "/", 1 }, { 'b', "End", 3 }, { 'n', " ", 1 }, { 'n', "Abort:", 6 }, { 'b', "q", 1 }, { 'n', " ", 1 }, { 'n', "Find:", 5 }, { 'b', "/", 1 }, { 'n', "|", 1 }, { 'b', "\"\'", 2 }, { 'n', "|", 1 }, { 'b', "~*", 2 }, { 'n', "|", 1 }, { 'b', "=^", 2 }, { 'n', ",", 1 }, { 'b', "SP", 2 }, { 'n', "|", 1 }, { 'b', "nN", 2 }, { 'n', " ", 1 }, { 'n', "Select:", 7 }, { 'b', "CR", 2 }, { 'n', "|", 1 }, { 'b', "tTU", 3 } }; entries_nb = sizeof(entries) / sizeof(struct entry_s); /* Remove the last two entries if tagging is not enabled */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""" */ if (!toggle->taggable) entries_nb -= 2; /* Get the total length of the help line */ /* """"""""""""""""""""""""""""""""""""" */ help_len = 0; for (index = 0; index < entries_nb; index++) help_len += entries[index].len; /* Save the position of the terminal cursor so that it can be */ /* put back there after printing of the help line */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ tputs(TPARM1(save_cursor), 1, outch); /* Center the help line if the -M (Middle option is set. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""" */ if (win->offset > 0) if ((offset = win->offset + win->max_width / 2 - help_len / 2) > 0) { int i; for (i = 0; i < offset; i++) fputc(' ', stdout); } /* Print the different objects forming the help line */ /* """"""""""""""""""""""""""""""""""""""""""""""""" */ for (index = 0; index < entries_nb; index++) { if ((len += entries[index].len) >= term->ncolumns - 1) { line++; if (line > last_line || line == win->max_lines) break; len = entries[index].len; fputc('\n', stdout); } switch (entries[index].attr) { case 'b': if (term->has_bold) tputs(TPARM1(enter_bold_mode), 1, outch); break; case 'r': if (term->has_reverse) tputs(TPARM1(enter_reverse_mode), 1, outch); else if (term->has_standout) tputs(TPARM1(enter_standout_mode), 1, outch); break; case 'n': tputs(TPARM1(exit_attribute_mode), 1, outch); break; } fputs(entries[index].str, stdout); } tputs(TPARM1(exit_attribute_mode), 1, outch); tputs(TPARM1(clr_eol), 1, outch); /* Relocate the cursor to its saved position */ /* """"""""""""""""""""""""""""""""""""""""" */ tputs(TPARM1(restore_cursor), 1, outch); } /* ********************************** */ /* Attributes string parsing function */ /* ********************************** */ /* ================================ */ /* Decode attributes toggles if any */ /* b -> bold */ /* d -> dim */ /* r -> reverse */ /* s -> standout */ /* u -> underline */ /* i -> italic */ /* */ /* Returns 0 if some unexpected */ /* toggle is found else 0 */ /* ================================ */ int decode_attr_toggles(char * s, attr_t * attr) { int rc = 1; attr->bold = attr->dim = attr->reverse = 0; attr->standout = attr->underline = attr->italic = 0; while (*s != '\0') { switch (*s) { case 'b': attr->bold = 1; attr->is_set = SET; break; case 'd': attr->dim = 1; attr->is_set = SET; break; case 'r': attr->reverse = 1; attr->is_set = SET; break; case 's': attr->standout = 1; attr->is_set = SET; break; case 'u': attr->underline = 1; attr->is_set = SET; break; case 'i': attr->italic = 1; attr->is_set = SET; break; default: rc = 0; break; } s++; } return rc; } /* =========================================================*/ /* Parse attributes in str in the form [fg][/bg][,toggles] */ /* where: */ /* fg and bg are short representing a color value */ /* toggles is an array of toggles (see decode_attr_toggles) */ /* Returns 1 on success else 0 */ /* attr will be filled by the function */ /* =========================================================*/ int parse_attr(char * str, attr_t * attr, short max_color) { int n; char * pos; char s1[12] = { 0 }; char s2[7] = { 0 }; short d1 = -1, d2 = -1; int rc = 1; n = sscanf(str, "%11[^,],%6s", s1, s2); if (n == 0) return 0; if ((pos = strchr(s1, '/'))) { if (pos == s1) /* s1 starts with a / */ { d1 = -1; if (sscanf(s1 + 1, "%hd", &d2) == 0) { d2 = -1; if (n == 1) return 0; } } else if (sscanf(s1, "%hd/%hd", &d1, &d2) < 2) { d1 = d2 = -1; if (n == 1) return 0; } } else /* no / in the first string */ { d2 = -1; if (sscanf(s1, "%hd", &d1) == 0) { d1 = -1; if (n == 2 || decode_attr_toggles(s1, attr) == 0) return 0; } } if (d1 < -1 || d2 < -1) return 0; if (max_color == 0) { attr->fg = -1; attr->bg = -1; } else { attr->fg = d1; attr->bg = d2; } if (n == 2) rc = decode_attr_toggles(s2, attr); return rc; } /* ============================================= */ /* Set the terminal attributes according to attr */ /* ============================================= */ void apply_attr(term_t * term, attr_t attr) { if (attr.fg >= 0) set_foreground_color(term, attr.fg); if (attr.bg >= 0) set_background_color(term, attr.bg); if (attr.bold > 0) tputs(TPARM1(enter_bold_mode), 1, outch); if (attr.dim > 0) tputs(TPARM1(enter_dim_mode), 1, outch); if (attr.reverse > 0) tputs(TPARM1(enter_reverse_mode), 1, outch); if (attr.standout > 0) tputs(TPARM1(enter_standout_mode), 1, outch); if (attr.underline > 0) tputs(TPARM1(enter_underline_mode), 1, outch); if (attr.italic > 0) tputs(TPARM1(enter_italics_mode), 1, outch); } /* ******************** */ /* ini parsing function */ /* ******************** */ /* ===================================================== */ /* Callback function called when parsing each non-header */ /* line of the ini file. */ /* Returns 0 if OK, 1 if not. */ /* ===================================================== */ int ini_cb(win_t * win, term_t * term, limits_t * limits, timers_t * timers, misc_t * misc, const char * section, const char * name, char * value) { int error = 0; int has_colors = (term->colors > 7); if (strcmp(section, "colors") == 0) { attr_t v = { UNSET, -1, -1, -1, -1, -1, -1, -1, -1 }; #define CHECK_ATTR(x) \ else if (strcmp(name, #x) == 0) \ { \ error = !parse_attr(value, &v, term->colors); \ if (error) \ goto out; \ else \ { \ if (win->x##_attr.is_set != FORCED) \ { \ win->x##_attr.is_set = SET; \ if (v.fg >= 0) \ win->x##_attr.fg = v.fg; \ if (v.bg >= 0) \ win->x##_attr.bg = v.bg; \ if (v.bold >= 0) \ win->x##_attr.bold = v.bold; \ if (v.dim >= 0) \ win->x##_attr.dim = v.dim; \ if (v.reverse >= 0) \ win->x##_attr.reverse = v.reverse; \ if (v.standout >= 0) \ win->x##_attr.standout = v.standout; \ if (v.underline >= 0) \ win->x##_attr.underline = v.underline; \ if (v.italic >= 0) \ win->x##_attr.italic = v.italic; \ } \ } \ } #define CHECK_ATT_ATTR(x, y) \ else if (strcmp(name, #x #y) == 0) \ { \ error = !parse_attr(value, &v, term->colors); \ if (error) \ goto out; \ else \ { \ if (win->x##_attr[y - 1].is_set != FORCED) \ { \ win->x##_attr[y - 1].is_set = SET; \ if (v.fg >= 0) \ win->x##_attr[y - 1].fg = v.fg; \ if (v.bg >= 0) \ win->x##_attr[y - 1].bg = v.bg; \ if (v.bold >= 0) \ win->x##_attr[y - 1].bold = v.bold; \ if (v.dim >= 0) \ win->x##_attr[y - 1].dim = v.dim; \ if (v.reverse >= 0) \ win->x##_attr[y - 1].reverse = v.reverse; \ if (v.standout >= 0) \ win->x##_attr[y - 1].standout = v.standout; \ if (v.underline >= 0) \ win->x##_attr[y - 1].underline = v.underline; \ if (v.italic >= 0) \ win->x##_attr[y - 1].italic = v.italic; \ } \ } \ } /* [colors] section */ /* """""""""""""""" */ if (has_colors) { if (strcmp(name, "method") == 0) { if (strcmp(value, "classic") == 0) term->color_method = 0; else if (strcmp(value, "ansi") == 0) term->color_method = 1; else { error = 1; goto out; } } /* clang-format off */ CHECK_ATTR(cursor) CHECK_ATTR(bar) CHECK_ATTR(shift) CHECK_ATTR(message) CHECK_ATTR(search_field) CHECK_ATTR(search_text) CHECK_ATTR(match_field) CHECK_ATTR(match_text) CHECK_ATTR(match_err_field) CHECK_ATTR(match_err_text) CHECK_ATTR(include) CHECK_ATTR(exclude) CHECK_ATTR(tag) CHECK_ATTR(cursor_on_tag) CHECK_ATTR(daccess) CHECK_ATT_ATTR(special, 1) CHECK_ATT_ATTR(special, 2) CHECK_ATT_ATTR(special, 3) CHECK_ATT_ATTR(special, 4) CHECK_ATT_ATTR(special, 5) /* clang-format on */ } } else if (strcmp(section, "window") == 0) { int v; /* [window] section */ /* """""""""""""""" */ if (strcmp(name, "lines") == 0) { if ((error = !(sscanf(value, "%d", &v) == 1 && v >= 0))) goto out; else win->asked_max_lines = v; } } else if (strcmp(section, "limits") == 0) { int v; /* [limits] section */ /* """""""""""""""" */ if (strcmp(name, "word_length") == 0) { if ((error = !(sscanf(value, "%d", &v) == 1 && v > 0))) goto out; else limits->word_length = v; } else if (strcmp(name, "words") == 0) { if ((error = !(sscanf(value, "%d", &v) == 1 && v > 0))) goto out; else limits->words = v; } else if (strcmp(name, "columns") == 0) { if ((error = !(sscanf(value, "%d", &v) == 1 && v > 0))) goto out; else limits->cols = v; } } else if (strcmp(section, "timers") == 0) { int v; /* [timers] section */ /* """""""""""""""" */ if (strcmp(name, "help") == 0) { if ((error = !(sscanf(value, "%d", &v) == 1 && v > 0))) goto out; else timers->help = v; } else if (strcmp(name, "window") == 0) { if ((error = !(sscanf(value, "%d", &v) == 1 && v > 0))) goto out; else timers->winch = v; } else if (strcmp(name, "direct_access") == 0) { if ((error = !(sscanf(value, "%d", &v) == 1 && v > 0))) goto out; else timers->direct_access = v; } } else if (strcmp(section, "misc") == 0) { /* [misc] section */ /* """""""""""""""" */ if (strcmp(name, "default_search_method") == 0) if (misc->default_search_method == NONE) { if (strcmp(value, "prefix") == 0) misc->default_search_method = PREFIX; else if (strcmp(value, "fuzzy") == 0) misc->default_search_method = FUZZY; else if (strcmp(value, "substring") == 0) misc->default_search_method = SUBSTRING; } } out: return error; } /* ======================================================================== */ /* Load an .ini format file */ /* filename - path to a file */ /* report - callback can return non-zero to stop, the callback error code */ /* returned from this function. */ /* return - return 0 on success */ /* */ /* This function is public domain. No copyright is claimed. */ /* Jon Mayo April 2011 */ /* ======================================================================== */ int ini_load(const char * filename, win_t * win, term_t * term, limits_t * limits, timers_t * timers, misc_t * misc, int (*report)(win_t * win, term_t * term, limits_t * limits, timers_t * timers, misc_t * misc, const char * section, const char * name, char * value)) { char name[64] = ""; char value[256] = ""; char section[128] = ""; char * s; FILE * f; int cnt; int error; /* If the filename is empty we skip this phase and use the default values */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (filename == NULL) return 1; /* We do that if the file is not readable as well */ /* """""""""""""""""""""""""""""""""""""""""""""" */ f = fopen(filename, "r"); if (!f) return 0; /* Returns success as the presence of this file is optional */ error = 0; /* Skip blank lines */ /* """""""""""""""" */ while (fscanf(f, "%*[\n]") == 1) { } while (!feof(f)) { if (fscanf(f, "[%127[^];\n]]", section) == 1) { /* Do nothing */ /* """""""""" */ } else if ((cnt = fscanf(f, " %63[^=;\n] = %255[^;\n]", name, value))) { if (cnt == 1) *value = 0; for (s = name + strlen(name) - 1; s > name && isspace(*s); s--) *s = 0; for (s = value + strlen(value) - 1; s > value && isspace(*s); s--) *s = 0; /* Callback function calling */ /* """"""""""""""""""""""""" */ error = report(win, term, limits, timers, misc, section, name, value); if (error) goto out; } if (fscanf(f, " ;%*[^\n]")) { /* To silence the compiler about unused results */ } /* Skip blank lines */ /* """""""""""""""" */ while (fscanf(f, "%*[\n]") == 1) { /* Do nothing */ /* """""""""" */ } } out: fclose(f); if (error) fprintf(stderr, "Invalid entry found: %s=%s in %s.\n", name, value, filename); return error; } /* ======================================================= */ /* Return the full path on the configuration file supposed */ /* to be in the home directory of the user. */ /* NULL is returned if the built path is too large. */ /* ======================================================= */ char * make_ini_path(char * name, char * base) { char * path; char * home; long path_max; long len; char * conf; /* Set the prefix of the path from the environment */ /* base can be "HOME" or "PWD". */ /* """"""""""""""""""""""""""""""""""""""""""""""" */ home = getenv(base); if (home == NULL) home = ""; path_max = pathconf(".", _PC_PATH_MAX); len = strlen(home) + strlen(name) + 3; if (path_max < 0) path_max = 4096; /* POSIX minimal value */ if (len <= path_max) { path = xmalloc(len); conf = strrchr(name, '/'); if (conf != NULL) conf++; else conf = name; snprintf(path, 4096, "%s/.%s", home, conf); } else path = NULL; return path; } /* ******************************** */ /* Functions used when sorting tags */ /* ******************************** */ /* =========================================================== */ /* Compare the pin order of two pinned word in the output list */ /* =========================================================== */ int tag_comp(void * a, void * b) { output_t * oa = (output_t *)a; output_t * ob = (output_t *)b; if (oa->order == ob->order) return 0; return (oa->order < ob->order) ? -1 : 1; } /* ======================================================== */ /* Swap the values of two selected words in the output list */ /* ======================================================== */ void tag_swap(void * a, void * b) { output_t * oa = (output_t *)a; output_t * ob = (output_t *)b; char * tmp_str; long tmp_order; tmp_str = oa->output_str; oa->output_str = ob->output_str; ob->output_str = tmp_str; tmp_order = oa->order; oa->order = ob->order; ob->order = tmp_order; } /* ***************** */ /* Utility functions */ /* ***************** */ /* =================================================================== */ /* Create a new element to be added to the tst_search_list used by the */ /* search mechanism. */ /* =================================================================== */ sub_tst_t * sub_tst_new(void) { sub_tst_t * elem = xmalloc(sizeof(sub_tst_t)); elem->size = 64; elem->count = 0; elem->array = xmalloc(elem->size * sizeof(tst_node_t)); return elem; } /* ======================================== */ /* Emit a small (visual) beep warn the user */ /* ======================================== */ void beep(toggle_t * toggle) { struct timespec ts, rem; int rc; if (!toggle->visual_bell) fputc('\a', stdout); else { tputs(TPARM1(cursor_visible), 1, outch); ts.tv_sec = 0; ts.tv_nsec = 200000000; errno = 0; rc = nanosleep(&ts, &rem); while (rc < 0 && errno == EINTR) { errno = 0; rc = nanosleep(&rem, &rem); } tputs(TPARM1(cursor_invisible), 1, outch); } } /* ======================================================================== */ /* Update the bitmap associated with a word. This bitmap indicates the */ /* positions of the UFT-8 glyphs of the search buffer in each word. */ /* The disp_word function will use it to display these special characters. */ /* ======================================================================== */ void update_bitmaps(search_mode_t mode, search_data_t * data, bitmap_affinity_t affinity) { long i, j, n; /* work variables */ long lmg; /* position of the last matching glyph of the search buffer * * in a word */ long sg; /* index going from lmg backward to 0 of the tested glyphs * * of the search buffer (searched glyph) */ long bm_len; /* number of chars taken by the bitmask */ char * start; /* pointer on the position of the matching position * * of the last search buffer glyph in the word */ char * bm; /* the word's current bitmap */ char * str; /* copy of the current word put in lower case */ char * str_orig; /* oiginal version of the word */ char * first_glyph; char * sb_orig = data->buf; /* sb: search buffer */ char * sb; long * o = data->utf8_off_a; /* array of the offsets of the search * * buffer glyphs */ long * l = data->utf8_len_a; /* array of the lengths in bytes of the * * search buffer glyphs */ long last = data->utf8_len - 1; /* offset of the last glyph in the * * search buffer */ long badness = 0; /* number of 0s between two 1s */ best_matches_count = 0; if (mode == FUZZY || mode == SUBSTRING) { first_glyph = xmalloc(5); if (mode == FUZZY) { sb = xstrdup(sb_orig); utf8_strtolower(sb, sb_orig); } else sb = sb_orig; for (i = 0; i < matches_count; i++) { n = matching_words_a[i]; str_orig = xstrdup(word_a[n].str + daccess.flength); /* We need to remove the trailing spaces to use the */ /* following algorithm */ /* .len holds the original length in bytes of the word */ /* """""""""""""""""""""""""""""""""""""""""""""""""""" */ str_orig[word_a[n].len] = '\0'; bm_len = (word_a[n].mb - daccess.flength) / CHAR_BIT + 1; bm = word_a[n].bitmap; /* In fuzzy search mode str is converted in lowercases */ /* for comparison reason. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""" */ if (mode == FUZZY) { str = xstrdup(str_orig); utf8_strtolower(str, str_orig); } else str = str_orig; start = str; lmg = 0; /* starts points to the first UTF-8 glyph og the word */ /* """""""""""""""""""""""""""""""""""""""""""""""""" */ while ((size_t)(start - str) < word_a[n].len - daccess.flength) { /* Reset the bitmap */ /* """""""""""""""" */ memset(bm, '\0', bm_len); /* Compare the glyph pointed to by start to the last glyph of */ /* the search buffer, the aim is to pinte to the first */ /* occurrence of the last glyph of it. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (memcmp(start, sb + o[last], l[last]) == 0) { char * p; /* Pointer to the beginning of an UTF-8 glyph in * * the potential lowercase version of the word */ if (last == 0) { /* There is only one glyph in the search buffer, we can */ /* stop here. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""" */ BIT_ON(bm, lmg); if (affinity != END_AFFINITY) break; } /* If the search buffer contains more than one glyph, we need */ /* to search the first combination which match the buffer in */ /* the word. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ p = start; j = last; /* j counts the number of glyphs in the search buffer * * not found in the word */ /* Proceed backwards from the position of last glyph of the search */ /* to check if all the previous glyphs can be fond before in the */ /* word. If not try to find the next position of this last glyph */ /* in the word. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ sg = lmg; while (j > 0 && (p = utf8_prev(str, p)) != NULL) { if (memcmp(p, sb + o[j - 1], l[j - 1]) == 0) { BIT_ON(bm, sg - 1); j--; } else if (mode == SUBSTRING) break; sg--; } /* All the glyphs have been found */ /* """""""""""""""""""""""""""""" */ if (j == 0) { BIT_ON(bm, lmg); if (affinity != END_AFFINITY) break; } } lmg++; start = utf8_next(start); } if (mode == FUZZY) { size_t utf8_index; free(str); /* We know that the first glyph is part of the pattern, so */ /* highlight it if it is not and un-highlight the next occurrence */ /* that must be here because this word has already been filtered */ /* by select_starting_pattern() */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (affinity == START_AFFINITY) { char *ptr1, *ptr2; long i = 1; long utf8_len; first_glyph = utf8_strprefix(first_glyph, word_a[n].str, 1, &utf8_len); if (!BIT_ISSET(word_a[n].bitmap, 0)) { BIT_ON(word_a[n].bitmap, 0); ptr1 = word_a[n].str; while ((ptr2 = utf8_next(ptr1)) != NULL) { if (memcmp(ptr2, first_glyph, utf8_len) == 0) { if (BIT_ISSET(word_a[n].bitmap, i)) { BIT_OFF(word_a[n].bitmap, i); break; } else ptr1 = ptr2; } else ptr1 = ptr2; i++; } } } /* Compute the number of 'holes' in the bitmap to determine the */ /* badness of a match. Th goal is to put the cursor on the word */ /* with the smallest badness. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ utf8_index = 0; j = 0; badness = 0; while (utf8_index < word_a[n].mb && !BIT_ISSET(word_a[n].bitmap, utf8_index)) utf8_index++; while (utf8_index < word_a[n].mb) { if (!BIT_ISSET(word_a[n].bitmap, utf8_index)) badness++; else j++; /* Stop here if all the possible bits has been checked as they */ /* cannot be more numerous than the number of UTF-8 glyphs in */ /* the search buffer. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (j == data->utf8_len) break; utf8_index++; } } free(str_orig); if (search_mode == FUZZY) { /* When the badness is zero (best match), add the word position. */ /* at the end of a special array which will be used to move the. */ /* cursor among this category of words. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (badness == 0) { if (best_matches_count == best_matching_words_a_size) { best_matching_words_a = xrealloc(best_matching_words_a, (best_matching_words_a_size + 16) * sizeof(long)); best_matching_words_a_size += 16; } best_matching_words_a[best_matches_count] = n; best_matches_count++; } } } if (mode == FUZZY) free(sb); free(first_glyph); } else if (mode == PREFIX) { for (i = 0; i < matches_count; i++) { n = matching_words_a[i]; bm = word_a[n].bitmap; bm_len = (word_a[n].mb - daccess.flength) / CHAR_BIT + 1; memset(bm, '\0', bm_len); for (j = 0; j <= last; j++) BIT_ON(bm, j); } } } /* ====================================================== */ /* Find the next word index in the list of matching words */ /* returns -1 of not found. */ /* ====================================================== */ long find_next_matching_word(long * array, long nb, long value, long * index) { long left = 0, right = nb, middle; /* Use the cached value when possible */ /* """""""""""""""""""""""""""""""""" */ if (*index >= 0 && *index < nb - 1 && array[*index] == value) return (array[++(*index)]); if (nb > 0) { /* bisection search */ /* """""""""""""""" */ while (left < right) { middle = (left + right) / 2; if (value < array[middle]) right = middle; else left = middle + 1; } if (left < nb - 1) { *index = left; return array[*index]; } else { if (value > array[nb - 1]) { *index = -1; return *index; } else { *index = nb - 1; return array[*index]; } } } else { *index = -1; return *index; } } /* ========================================================== */ /* Find the previous word index in the list of matching words */ /* returns -1 of not found. */ /* ========================================================== */ long find_prev_matching_word(long * array, long nb, long value, long * index) { long left = 0, right = nb, middle; /* Use the cached value when possible */ /* """""""""""""""""""""""""""""""""" */ if (*index > 0 && array[*index] == value) return (array[--(*index)]); if (nb > 0) { /* bisection search */ /* """""""""""""""" */ while (left < right) { middle = (left + right) / 2; if (array[middle] == value) { if (middle > 0) { *index = middle - 1; return array[*index]; } else { *index = -1; return *index; } } if (value < array[middle]) right = middle; else left = middle + 1; } if (left > 0) { *index = left - 1; return array[*index]; } else { *index = -1; return *index; } } else { *index = -1; return *index; } } /* ================================================================ */ /* Remove all traces of the matched words and redisplay the windows */ /* ================================================================ */ void clean_matches(search_data_t * search_data, long size) { sub_tst_t * sub_tst_data; ll_node_t * fuzzy_node; long i; /* Clean the list of lists data-structure containing the search levels */ /* Note that the first element of the list is never deleted. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (tst_search_list) { fuzzy_node = tst_search_list->tail; while (tst_search_list->len > 1) { sub_tst_data = (sub_tst_t *)(fuzzy_node->data); free(sub_tst_data->array); free(sub_tst_data); ll_delete(tst_search_list, tst_search_list->tail); fuzzy_node = tst_search_list->tail; } sub_tst_data = (sub_tst_t *)(fuzzy_node->data); sub_tst_data->count = 0; } search_data->fuzzy_err = 0; /* Clean the search buffer */ /* """"""""""""""""""""""" */ memset(search_data->buf, '\0', size - daccess.flength); search_data->len = 0; search_data->utf8_len = 0; search_data->only_ending = 0; search_data->only_starting = 0; /* Clean the match flags and bitmaps */ /* """"""""""""""""""""""""""""""""" */ for (i = 0; i < matches_count; i++) { long n = matching_words_a[i]; word_a[n].is_matching = 0; memset(word_a[n].bitmap, '\0', (word_a[n].mb - daccess.flength) / CHAR_BIT + 1); } matches_count = 0; } /* ************************** */ /* Terminal utility functions */ /* ************************** */ /* ===================================================================== */ /* outch is a function version of putchar that can be passed to tputs as */ /* a routine to call. */ /* ===================================================================== */ int #ifdef __sun outch(char c) #else outch(int c) #endif { putchar(c); return 1; } /* =============================================== */ /* Set the terminal in non echo/non canonical mode */ /* wait for at least one byte, no timeout. */ /* =============================================== */ void setup_term(int const fd) { /* Save the terminal parameters and configure it in row mode */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""" */ tcgetattr(fd, &old_in_attrs); new_in_attrs.c_iflag = 0; new_in_attrs.c_oflag = old_in_attrs.c_oflag; new_in_attrs.c_cflag = old_in_attrs.c_cflag; new_in_attrs.c_lflag = old_in_attrs.c_lflag & ~(ICANON | ECHO | ISIG); new_in_attrs.c_cc[VMIN] = 1; /* wait for at least 1 byte */ new_in_attrs.c_cc[VTIME] = 0; /* no timeout */ tcsetattr(fd, TCSANOW, &new_in_attrs); } /* ===================================== */ /* Set the terminal in its previous mode */ /* ===================================== */ void restore_term(int const fd) { tcsetattr(fd, TCSANOW, &old_in_attrs); } /* ============================================== */ /* Get the terminal numbers of lines and columns */ /* Assume that the TIOCGWINSZ, ioctl is available */ /* Defaults to 80x24 */ /* ============================================== */ void get_terminal_size(int * const r, int * const c) { struct winsize ws; if (ioctl(0, TIOCGWINSZ, &ws) == 0) { *r = ws.ws_row; *c = ws.ws_col; } else { *r = tigetnum("lines"); *c = tigetnum("cols"); if (*r < 0 || *c < 0) { *r = 80; *c = 24; } } } /* ====================================================== */ /* Get cursor position the terminal */ /* Assume that the Escape sequence ESC [ 6 n is available */ /* ====================================================== */ int get_cursor_position(int * const r, int * const c) { char buf[32]; size_t i = 0; /* Report cursor location */ /* """""""""""""""""""""" */ if (write(1, "\x1b[6n", 4) != 4) return -1; /* Read the response: ESC [ rows ; cols R */ /* """""""""""""""""""""""""""""""""""""" */ while (i < sizeof(buf) - 1) { if (read(0, buf + i, 1) != 1) break; if (buf[i] == 'R') break; i++; } buf[i] = '\0'; /* Parse it. */ /* """"""""" */ if (buf[0] != 0x1b || buf[1] != '[') return -1; if (sscanf(buf + 2, "%d;%d", r, c) != 2) return -1; return 1; } /* ===================================================== */ /* Returns 1 if a string is empty or only made of spaces */ /* ===================================================== */ int isempty(const char * s) { while (*s != '\0') { if (my_isprint(*s) && *s != ' ' && *s != '\t') return 0; s++; } return 1; } /* ======================================================================== */ /* Parse a regular expression based selector. */ /* The string to parse is bounded by a delimiter so we must parse something */ /* like: as in /a.*b/ by example. */ /* */ /* str (in) delimited string to parse */ /* filter (in) INCLUDE_FILTER or EXCLUDE_FILTER */ /* inc_regex_list (out) INCLUDE_FILTER or EXCLUDE_FILTER */ /* regular expression if the filter is INCLUDE_FILTER */ /* exc_regex_list (out) INCLUDE_FILTER or EXCLUDE_FILTER */ /* regular expression if the filter is EXCLUDE_FILTER */ /* ======================================================================== */ void parse_regex_selector_part(char * str, filters_t filter, ll_t ** inc_regex_list, ll_t ** exc_regex_list) { regex_t * regex; str[strlen(str) - 1] = '\0'; regex = xmalloc(sizeof(regex_t)); if (regcomp(regex, str + 1, REG_EXTENDED | REG_NOSUB) == 0) { if (filter == INCLUDE_FILTER) { if (*inc_regex_list == NULL) *inc_regex_list = ll_new(); ll_append(*inc_regex_list, regex); } else { if (*exc_regex_list == NULL) *exc_regex_list = ll_new(); ll_append(*exc_regex_list, regex); } } } /* ===================================================================== */ /* Parse a description string */ /* ,,... */ /* is n1-n2 | n1 where n1 starts with 1 */ /* */ /* is a|A|s|S|r|R|u|U where */ /* a|A is for Add */ /* s|S is for Select (same as Add) */ /* r|R is for Remove */ /* d|D is for Deselect (same as Remove) */ /* */ /* str (in) string to parse */ /* filter (out) is INCLUDE_FILTER or EXCLUDE_FILTER according */ /* to */ /* unparsed (out) is empty on success and contains the unparsed */ /* part on failure */ /* inc_interval_list (out) is a list of the interval of elements to */ /* be included. */ /* inc_regex_list (out) is a list of extended regular expressions of */ /* elements to be included. */ /* exc_interval_list (out) is a list of the interval of elements to be */ /* excluded. */ /* exc_regex_list (out) is a list of extended interval of elements to */ /* be excluded. */ /* ===================================================================== */ void parse_selectors(char * str, filters_t * filter, char * unparsed, ll_t ** inc_interval_list, ll_t ** inc_regex_list, ll_t ** exc_interval_list, ll_t ** exc_regex_list, langinfo_t * langinfo) { char mark; /* Value to set */ char c; size_t start = 1; /* column string offset in the parsed string */ size_t first, second; /* range starting and ending values */ char * ptr; /* pointer to the remaining string to parse */ interval_t * interval; /* Replace the UTF-8 ascii representation in the selector by */ /* their binary values. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""" */ utf8_interpret(str, langinfo); /* Get the first character to see if this is */ /* an additive or restrictive operation. */ /* """"""""""""""""""""""""""""""""""""""""" */ if (sscanf(str, "%c", &c) == 0) return; switch (c) { case 'i': case 'I': *filter = INCLUDE_FILTER; mark = INCLUDE_MARK; break; case 'e': case 'E': *filter = EXCLUDE_FILTER; mark = EXCLUDE_MARK; break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': *filter = INCLUDE_FILTER; mark = INCLUDE_MARK; start = 0; break; default: if (!isgraph(c)) return; *filter = INCLUDE_FILTER; mark = INCLUDE_MARK; start = 0; break; } /* Set ptr to the start of the interval list to parse */ /* """""""""""""""""""""""""""""""""""""""""""""""""" */ ptr = str + start; first = second = -1; /* Scan the comma separated ranges */ /* """"""""""""""""""""""""""""""" */ while (*ptr) { size_t swap; int is_range = 0; char delim1, delim2 = '\0'; char * oldptr; oldptr = ptr; while (*ptr && *ptr != ',') { if (*ptr == '-') is_range = 1; ptr++; } /* Forbid the trailing comma (ex: xxx,) */ /* """""""""""""""""""""""""""""""""""" */ if (*ptr == ',' && (*(ptr + 1) == '\0' || *(ptr + 1) == '-')) { my_strcpy(unparsed, ptr); return; } /* Forbid the empty patterns (ex: xxx,,yyy) */ /* """""""""""""""""""""""""""""""""""""""" */ if (oldptr == ptr) { my_strcpy(unparsed, ptr); return; } /* Mark the end of the interval found */ /* """""""""""""""""""""""""""""""""" */ if (*ptr) *ptr++ = '\0'; /* If the regex contains at least three characters then delim1 */ /* and delim2 point to the first and last delimiter of the */ /* regular expression. Ex /abc/ */ /* ^ ^ */ /* | | */ /* delim1 delim2 */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ delim1 = *(str + start); if (*ptr == '\0') delim2 = *(ptr - 1); else if (ptr > str + start + 2) delim2 = *(ptr - 2); /* Check is we have found a well describes regular expression */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (ptr > str + start + 2 && delim1 == delim2 && isgraph(delim1) && isgraph(delim2) && !isdigit(delim1) && !isdigit(delim2)) { /* Process the regex */ /* """"""""""""""""" */ parse_regex_selector_part(str + start, *filter, inc_regex_list, exc_regex_list); /* Adjust the start of the new interval to read in the initial string */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ start = ptr - str; continue; } else if (delim2 != '\0' && (!isdigit(delim1) || !isdigit(delim2))) { /* Both delimiter must be numeric if delim2 exist */ /* """""""""""""""""""""""""""""""""""""""""""""" */ my_strcpy(unparsed, str + start); return; } if (is_range) { int rc; int pos; rc = sscanf(str + start, "%zu-%zu%n", &first, &second, &pos); if (rc != 2 || *(str + start + pos) != '\0') { my_strcpy(unparsed, str + start); return; } if (first < 1 || second < 1) { /* Both interval boundaries must be strictly positive */ /* """""""""""""""""""""""""""""""""""""""""""""""""" */ my_strcpy(unparsed, str + start); return; } /* Ensure that the low bound of the interval is lower or equal */ /* to the high one. Swap them if needed. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ interval = interval_new(); if (first > second) { swap = first; first = second; second = swap; } interval->low = first - 1; interval->high = second - 1; } else { /* Read the number given */ /* """"""""""""""""""""" */ if (sscanf(str + start, "%zu", &first) != 1) { my_strcpy(unparsed, str + start); return; } interval = interval_new(); interval->low = interval->high = first - 1; } /* Adjust the start of the new interval to read in the initial string */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ start = ptr - str; /* Add the new interval to the correct list */ /* """""""""""""""""""""""""""""""""""""""" */ if (mark == EXCLUDE_MARK) { if (*exc_interval_list == NULL) *exc_interval_list = ll_new(); ll_append(*exc_interval_list, interval); } else { if (*inc_interval_list == NULL) *inc_interval_list = ll_new(); ll_append(*inc_interval_list, interval); } } /* If we are here, then all the intervals have be successfully parsed */ /* Ensure that the unparsed string is empty. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ *unparsed = '\0'; } /* ======================================================== */ /* Parse the sed like string passed as argument to -S/-I/-E */ /* ======================================================== */ int parse_sed_like_string(sed_t * sed) { char sep; char * first_sep_pos; char * last_sep_pos; char * buf; long index; int icase; char c; if (strlen(sed->pattern) < 4) return 0; /* Get the separator (the 1st character) */ /* """"""""""""""""""""""""""""""""""""" */ buf = xstrdup(sed->pattern); sep = buf[0]; /* Space like separators are not permitted */ /* """"""""""""""""""""""""""""""""""""""" */ if (isspace(sep)) goto err; /* Get the extended regular expression */ /* """"""""""""""""""""""""""""""""""" */ if ((first_sep_pos = strchr(buf + 1, sep)) == NULL) goto err; *first_sep_pos = '\0'; /* Get the substitution string */ /* """"""""""""""""""""""""""" */ if ((last_sep_pos = strchr(first_sep_pos + 1, sep)) == NULL) goto err; *last_sep_pos = '\0'; sed->substitution = xstrdup(first_sep_pos + 1); /* Get the global indicator (trailing g) */ /* and the visual indicator (trailing v) */ /* and the stop indicator (trailing s) */ /* """"""""""""""""""""""""""""""""""""" */ sed->global = sed->visual = icase = 0; index = 1; while ((c = *(last_sep_pos + index)) != '\0') { if (c == 'g') sed->global = 1; else if (c == 'v') sed->visual = 1; else if (c == 's') sed->stop = 1; else if (c == 'i') icase = 1; else goto err; index++; } /* Empty regular expression ? */ /* """""""""""""""""""""""""" */ if (*(buf + 1) == '\0') goto err; /* Compile the regular expression and abort on failure */ /* """"""""""""""""""""""""""""""""""""""""""""""""""" */ if (regcomp(&(sed->re), buf + 1, !icase ? REG_EXTENDED : (REG_EXTENDED | REG_ICASE)) != 0) goto err; free(buf); return 1; err: free(buf); return 0; } /* ===================================================================== */ /* Utility function used by replace to expand the replacement string */ /* IN: */ /* orig: matching part of the original string to be replaced */ /* repl: string containing the replacement directives */ /* subs_a: array of ranges containing the start and end offset */ /* of the remembered parts of the strings referenced by */ /* the sequence \n where n is in [1,10] */ /* match_start/end: offset in orig for the current matched string */ /* subs_nb: number of elements containing significant values in */ /* the array described above */ /* match: current match number in the original string */ /* */ /* OUT: */ /* The modified string according to the content of repl */ /* ===================================================================== */ char * build_repl_string(char * orig, char * repl, long match_start, long match_end, range_t * subs_a, long subs_nb, long match) { size_t rsize = 0; size_t allocated = 16; char * str = xmalloc(allocated); int special = 0; long offset = match * subs_nb; /* offset of the 1st sub * * corresponding to the match */ if (*repl == '\0') str = xstrdup(""); else while (*repl) { switch (*repl) { case '\\': if (special) { if (allocated == rsize) str = xrealloc(str, allocated += 16); str[rsize] = '\\'; rsize++; str[rsize] = '\0'; special = 0; } else special = 1; break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (special) { if ((*repl) - '0' <= subs_nb) { long index = (*repl) - '0' - 1 + offset; long delta = subs_a[index].end - subs_a[index].start; if (allocated <= rsize + delta) str = xrealloc(str, allocated += (delta + 16)); memcpy(str + rsize, orig + subs_a[index].start, delta); rsize += delta; str[rsize] = '\0'; } special = 0; } else { if (allocated == rsize) str = xrealloc(str, allocated += 16); str[rsize] = *repl; rsize++; str[rsize] = '\0'; } break; case '&': if (!special) { long delta = match_end - match_start; if (allocated <= rsize + delta) str = xrealloc(str, allocated += (delta + 16)); memcpy(str + rsize, orig + match_start, delta); rsize += delta; str[rsize] = '\0'; break; } /* No break here, '&' must be treated as a normal */ /* character when protected. */ /* '''''''''''''''''''''''''''''''''''''''''''''' */ default: special = 0; if (allocated == rsize) str = xrealloc(str, allocated += 16); str[rsize] = *repl; rsize++; str[rsize] = '\0'; } repl++; } return str; } /* ====================================================================== */ /* Replace the part of a string matched by an extender regular expression */ /* by the substitution string */ /* The regex used must have been previously compiled */ /* */ /* orig: original string */ /* sed: composite variable containing the regular expression, a */ /* substitution string and various other informations. */ /* output: destination buffer */ /* */ /* RC: */ /* return 1 if the replacement has been successful else 0 */ /* */ /* NOTE: */ /* uses the global variable word_buffer */ /* ====================================================================== */ int replace(char * orig, sed_t * sed) { size_t match_nb = 0; /* number of matches in the original string */ int sub_nb = 0; /* number of remembered matches in the * * original sting */ size_t target_len = 0; /* length of the resulting string */ size_t subs_max = 0; if (*orig == '\0') return 1; range_t * matches_a = xmalloc(strlen(orig) * sizeof(range_t)); range_t * subs_a = xmalloc(10 * sizeof(range_t)); const char * p = orig; /* points to the end of the previous match. */ regmatch_t m[10]; /* array containing the start/end offsets * * of the matches found. */ while (1) { size_t i = 0; size_t match; /* current match index */ size_t index = 0; /* current char index in the original string */ int nomatch = 0; /* equals to 1 when there is no more matching */ char * exp_repl; /* expanded replacement string */ if (*p == '\0') nomatch = 1; else nomatch = regexec(&sed->re, p, 10, m, 0); if (nomatch) { if (match_nb > 0) { for (index = 0; index < matches_a[0].start; index++) word_buffer[target_len++] = orig[index]; for (match = 0; match < match_nb; match++) { size_t len; size_t end; exp_repl = build_repl_string(orig, sed->substitution, matches_a[match].start, matches_a[match].end, subs_a, subs_max, match); len = strlen(exp_repl); my_strcpy(word_buffer + target_len, exp_repl); target_len += len; free(exp_repl); index += matches_a[match].end - matches_a[match].start; if (match < match_nb - 1 && sed->global) end = matches_a[match + 1].start; else end = strlen(orig); while (index < end) word_buffer[target_len++] = orig[index++]; word_buffer[target_len] = '\0'; if (!sed->global) break; } } else { my_strcpy(word_buffer, orig); return 0; } return nomatch; } subs_max = 0; for (i = 0; i < 10; i++) { size_t start; size_t finish; if (m[i].rm_so == -1) break; start = m[i].rm_so + (p - orig); finish = m[i].rm_eo + (p - orig); if (i == 0) { matches_a[match_nb].start = start; matches_a[match_nb].end = finish; match_nb++; if (match_nb > utf8_strlen(orig)) goto fail; } else { subs_a[sub_nb].start = start; subs_a[sub_nb].end = finish; sub_nb++; subs_max++; } } if (m[0].rm_eo > 0) p += m[0].rm_eo; else p++; /* Empty match */ } fail: return 0; } /* ============================================================ */ /* Remove all ANSI color codes from s and puts the result in d. */ /* Memory space for d must have been allocated before. */ /* ============================================================ */ void strip_ansi_color(char * s, toggle_t * toggle) { char * p = s; long len = strlen(s); while (*s != '\0') { /* Remove a sequence of \x1b[...m from s */ /* """"""""""""""""""""""""""""""""""""" */ if ((*s == 0x1b) && (*(s + 1) == '[')) { while ((*s != '\0') && (*s++ != 'm')) { /* Do nothing */ } } /* Convert a single \x1b in '.' */ /* """""""""""""""""""""""""""" */ else if (*s == 0x1b) { if (toggle->blank_nonprintable && len > 1) *s++ = ' '; else *s++ = '.'; p++; } /* No ESC char, we can move on */ /* """"""""""""""""""""""""""" */ else *p++ = *s++; } *p = '\0'; } /* ================================================================ */ /* Callback to add a word index in the sorted list of matched words */ /* ================================================================ */ int set_matching_flag(void * elem) { ll_t * list = (ll_t *)elem; ll_node_t * node = list->head; while (node) { size_t pos; pos = *(size_t *)(node->data); if (word_a[pos].is_selectable) word_a[pos].is_matching = 1; insert_sorted_index(&matching_words_a, &matching_words_a_size, &matches_count, pos); node = node->next; } return 1; } /* ======================================================================= */ /* Callback function used by tst_traverse */ /* Iterate the linked list attached to the string containing the index of */ /* the words in the input flow. Each page number is then added in a sorted */ /* array avoiding duplications keeping the array sorted. */ /* Mark the identified words as a matching word. */ /* ======================================================================= */ int tst_cb(void * elem) { /* The data attached to the string in the tst is a linked list of position */ /* of the string in the input flow, This list is naturally sorted */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ ll_t * list = (ll_t *)elem; ll_node_t * node = list->head; while (node) { size_t pos; pos = *(long *)(node->data); word_a[pos].is_matching = 1; insert_sorted_index(&matching_words_a, &matching_words_a_size, &matches_count, pos); node = node->next; } return 1; } /* ======================================================================= */ /* Callback function used by tst_traverse */ /* Iterate the linked list attached to the string containing the index of */ /* the words in the input flow. Each page number is then used to determine */ /* the lower page greater than the cursor position */ /* ----------------------------------------------------------------------- */ /* This is a special version of tst_cb which permit to find the first word */ /* ----------------------------------------------------------------------- */ /* Require new_current to be set to count - 1 at start */ /* Update new_current to the smallest greater position than current */ /* ======================================================================= */ int tst_cb_cli(void * elem) { long n = 0; int rc = 0; /* The data attached to the string in the tst is a linked list of position */ /* of the string in the input flow, This list is naturally sorted */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ ll_t * list = (ll_t *)elem; ll_node_t * node = list->head; while (n++ < list->len) { long pos; pos = *(long *)(node->data); word_a[pos].is_matching = 1; insert_sorted_index(&matching_words_a, &matching_words_a_size, &matches_count, pos); /* We already are at the last word, report the finding */ /* """"""""""""""""""""""""""""""""""""""""""""""""""" */ if (pos == count - 1) return 1; /* Only consider the indexes above the current cursor position */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (pos >= current) /* Enable the search of the current word */ { /* As the future new current index has been set to the highest possible */ /* value, each new possible position can only improve the estimation */ /* we set rc to 1 to mark that */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (pos < new_current) { new_current = pos; rc = 1; } } node = node->next; } return rc; } /* *************** */ /* Input functions */ /* *************** */ /* =============================================== */ /* Non delay reading of a scancode. */ /* Update a scancodes buffer and return its length */ /* in bytes. */ /* =============================================== */ int get_scancode(unsigned char * s, size_t max) { int c; size_t i = 1; struct termios original_ts, nowait_ts; if ((c = my_fgetc(stdin)) == EOF) return 0; /* Initialize the string with the first byte */ /* """"""""""""""""""""""""""""""""""""""""" */ memset(s, '\0', max); s[0] = c; /* 0x1b (ESC) has been found, proceed to check if additional codes */ /* are available */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (c == 0x1b || c > 0x80) { /* Save the terminal parameters and configure getchar() */ /* to return immediately */ /* """""""""""""""""""""""""""""""""""""""""""""""""""" */ tcgetattr(0, &original_ts); nowait_ts = original_ts; nowait_ts.c_lflag &= ~ISIG; nowait_ts.c_cc[VMIN] = 0; nowait_ts.c_cc[VTIME] = 0; tcsetattr(0, TCSADRAIN, &nowait_ts); /* Check if additional code is available after 0x1b */ /* """""""""""""""""""""""""""""""""""""""""""""""" */ if ((c = my_fgetc(stdin)) != EOF) { s[1] = c; i = 2; while (i < max && (c = my_fgetc(stdin)) != EOF) s[i++] = c; } else { /* There isn't a new code, this mean 0x1b came from ESC key */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""" */ } /* Restore the save terminal parameters */ /* """""""""""""""""""""""""""""""""""" */ tcsetattr(0, TCSADRAIN, &original_ts); /* Ignore EOF when a scancode contains an escape sequence. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""" */ clearerr(stdin); } return i; } /* ===================================================================== */ /* Get bytes from stdin. If the first byte is the leading character of a */ /* UTF-8 glyph, the following ones are also read. */ /* The utf8_get_length function is used to get the number of bytes of */ /* the character. */ /* ===================================================================== */ int get_bytes(FILE * input, char * utf8_buffer, langinfo_t * langinfo) { int byte; int last = 0; int n; /* Read the first byte */ /* """"""""""""""""""" */ byte = my_fgetc(input); if (byte == EOF) return EOF; utf8_buffer[last++] = byte; /* Check if we need to read more bytes to form a sequence */ /* and put the number of bytes of the sequence in last. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (langinfo->utf8 && ((n = utf8_get_length(byte)) > 1)) { while (last < n && (byte = my_fgetc(input)) != EOF && (byte & 0xc0) == 0x80) utf8_buffer[last++] = byte; if (byte == EOF) return EOF; } utf8_buffer[last] = '\0'; /* Replace an invalid UTF-8 byte sequence by a single dot. */ /* In this case the original sequence is lost (unsupported */ /* encoding). */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (langinfo->utf8 && !utf8_validate(utf8_buffer, last)) { byte = utf8_buffer[0] = '.'; utf8_buffer[1] = '\0'; } return byte; } /* ==========================================================================*/ /* Expand the string str by replacing all its embedded special characters by */ /* their corresponding escape sequence */ /* dest must be long enough to contain the expanded string */ /* ========================================================================= */ size_t expand(char * src, char * dest, langinfo_t * langinfo, toggle_t * toggle) { char c; int n; int all_spaces = 1; char * ptr = dest; size_t len = 0; while ((c = *(src++))) { /* UTF-8 codepoints take more than on character */ /* """""""""""""""""""""""""""""""""""""""""""" */ if ((n = utf8_get_length(c)) > 1) { all_spaces = 0; if (langinfo->utf8) /* If the locale is UTF-8 aware, copy src into ptr. */ /* """""""""""""""""""""""""""""""""""""""""""""""" */ do { *(ptr++) = c; len++; } while (--n && (c = *(src++))); else { /* If not, ignore the bytes composing the UTF-8 */ /* glyph and replace them with a single '.'. */ /* """""""""""""""""""""""""""""""""""""""""""" */ do { /* Skip this byte. */ /* ''''''''''''''' */ } while (--n && ('\0' != *(src++))); *(ptr++) = '.'; len++; } } else /* This is not an UTF-8 glyph */ /* """""""""""""""""""""""""" */ switch (c) { case '\a': *(ptr++) = '\\'; *(ptr++) = 'a'; len += 2; all_spaces = 0; break; case '\b': *(ptr++) = '\\'; *(ptr++) = 'b'; len += 2; all_spaces = 0; break; case '\t': *(ptr++) = '\\'; *(ptr++) = 't'; len += 2; all_spaces = 0; break; case '\n': *(ptr++) = '\\'; *(ptr++) = 'n'; len += 2; all_spaces = 0; break; case '\v': *(ptr++) = '\\'; *(ptr++) = 'v'; len += 2; all_spaces = 0; break; case '\f': *(ptr++) = '\\'; *(ptr++) = 'f'; len += 2; all_spaces = 0; break; case '\r': *(ptr++) = '\\'; *(ptr++) = 'r'; len += 2; all_spaces = 0; break; case '\\': *(ptr++) = '\\'; *(ptr++) = '\\'; len += 2; all_spaces = 0; break; default: if (my_isprint(c)) { *(ptr++) = c; all_spaces = 0; } else { if (toggle->blank_nonprintable) *(ptr++) = ' '; else { *(ptr++) = '.'; all_spaces = 0; } } len++; } } /* If the word contains only spaces, replace them */ /* by underscores so that it can be seen */ /* """""""""""""""""""""""""""""""""""""""""""""" */ if (all_spaces) memset(dest, ' ', len); *ptr = '\0'; /* Ensure that dest has a nul terminator */ return len; } /* ===================================================================== */ /* get_word(input): return a char pointer to the next word (as a string) */ /* Accept: a FILE * for the input stream */ /* Return: a char * */ /* On Success: the return value will point to a nul-terminated string */ /* On Failure: the return value will be set to NULL */ /* ===================================================================== */ char * get_word(FILE * input, ll_t * word_delims_list, ll_t * record_delims_list, char * utf8_buffer, unsigned char * is_last, toggle_t * toggle, langinfo_t * langinfo, win_t * win, limits_t * limits) { char * temp = NULL; int byte; long utf8_count = 0; /* count chars used in current allocation */ long wordsize; /* size of current allocation in chars */ int is_dquote; /* double quote presence indicator */ int is_squote; /* single quote presence indicator */ int is_special; /* a character is special after a \ */ /* Skip leading delimiters */ /* """"""""""""""""""""""" */ byte = get_bytes(input, utf8_buffer, langinfo); while (byte == EOF || ll_find(word_delims_list, utf8_buffer, delims_cmp) != NULL) { if (byte == EOF) return NULL; byte = get_bytes(input, utf8_buffer, langinfo); } /* Allocate initial word storage space */ /* """"""""""""""""""""""""""""""""""" */ temp = xmalloc(wordsize = CHARSCHUNK); /* Start stashing bytes. Stop when we meet a non delimiter or EOF */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ utf8_count = 0; is_dquote = 0; is_squote = 0; is_special = 0; while (byte != EOF) { size_t i = 0; if (utf8_count >= limits->word_length) { fprintf(stderr, "The length of a word has reached the limit of " "%ld characters.\n", limits->word_length); exit(EXIT_FAILURE); } if (byte == '\\' && !is_special) { is_special = 1; goto next; } /* Parse special characters */ /* """""""""""""""""""""""" */ if (is_special) switch (byte) { case 'a': utf8_buffer[0] = byte = '\a'; utf8_buffer[1] = '\0'; break; case 'b': utf8_buffer[0] = byte = '\b'; utf8_buffer[1] = '\0'; break; case 't': utf8_buffer[0] = byte = '\t'; utf8_buffer[1] = '\0'; break; case 'n': utf8_buffer[0] = byte = '\n'; utf8_buffer[1] = '\0'; break; case 'v': utf8_buffer[0] = byte = '\v'; utf8_buffer[1] = '\0'; break; case 'f': utf8_buffer[0] = byte = '\f'; utf8_buffer[1] = '\0'; break; case 'r': utf8_buffer[0] = byte = '\r'; utf8_buffer[1] = '\0'; break; case 'u': utf8_buffer[0] = '\\'; utf8_buffer[1] = 'u'; utf8_buffer[2] = '\0'; break; case '\\': utf8_buffer[0] = byte = '\\'; utf8_buffer[1] = '\0'; break; } else { /* Manage double quotes */ /* """""""""""""""""""" */ if (byte == '"' && !is_squote) is_dquote = !is_dquote; /* Manage single quotes */ /* """""""""""""""""""" */ if (byte == '\'' && !is_dquote) is_squote = !is_squote; } /* Only consider delimiters when outside quotations */ /* """""""""""""""""""""""""""""""""""""""""""""""" */ if ((!is_dquote && !is_squote) && ll_find(word_delims_list, utf8_buffer, delims_cmp) != NULL) break; /* We no dot count the significant quotes */ /* """""""""""""""""""""""""""""""""""""" */ if (!is_special && ((byte == '"' && !is_squote) || (byte == '\'' && !is_dquote))) { is_special = 0; goto next; } /* Feed temp with the content of utf8_buffer */ /* """"""""""""""""""""""""""""""""""""""""" */ while (utf8_buffer[i] != '\0') { if (utf8_count >= wordsize - 1) temp = xrealloc(temp, wordsize += (utf8_count / CHARSCHUNK + 1) * CHARSCHUNK); *(temp + utf8_count++) = utf8_buffer[i]; i++; } is_special = 0; next: byte = get_bytes(input, utf8_buffer, langinfo); } /* Nul-terminate the word to make it a string */ /* """""""""""""""""""""""""""""""""""""""""" */ *(temp + utf8_count) = '\0'; /* Replace the UTF-8 ASCII representations in the word just */ /* read by their binary values. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""" */ utf8_interpret(temp, langinfo); /* Skip all field delimiters before a record delimiter */ /* """"""""""""""""""""""""""""""""""""""""""""""""""" */ if (ll_find(record_delims_list, utf8_buffer, delims_cmp) == NULL) { byte = get_bytes(input, utf8_buffer, langinfo); while (byte != EOF && ll_find(word_delims_list, utf8_buffer, delims_cmp) != NULL && ll_find(record_delims_list, utf8_buffer, delims_cmp) == NULL) byte = get_bytes(input, utf8_buffer, langinfo); if (langinfo->utf8 && utf8_get_length(utf8_buffer[0]) > 1) { size_t pos; pos = strlen(utf8_buffer); while (pos > 0) my_ungetc(utf8_buffer[--pos]); } else my_ungetc(byte); } /* Mark it as the last word of a record if its sequence matches a */ /* record delimiter except in tab mode */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (byte == EOF || ((win->col_mode || win->line_mode) && ll_find(record_delims_list, utf8_buffer, delims_cmp) != NULL)) *is_last = 1; else *is_last = 0; /* Remove the ANSI color escape sequences from the word */ /* """""""""""""""""""""""""""""""""""""""""""""""""""" */ strip_ansi_color(temp, toggle); return temp; } /* ========================================================= */ /* Set a foreground color according to terminal capabilities */ /* ========================================================= */ void set_foreground_color(term_t * term, short color) { if (term->color_method == 0 && term->has_setf) tputs(TPARM2(set_foreground, color), 1, outch); else if (term->color_method == 1 && term->has_setaf) tputs(TPARM2(set_a_foreground, color), 1, outch); } /* ========================================================= */ /* Set a background color according to terminal capabilities */ /* ========================================================= */ void set_background_color(term_t * term, short color) { if (term->color_method == 0 && term->has_setb) tputs(TPARM2(set_background, color), 1, outch); else if (term->color_method == 1 && term->has_setab) tputs(TPARM2(set_a_background, color), 1, outch); } /* ====================================================== */ /* Put a scrolling symbol at the first column of the line */ /* ====================================================== */ void left_margin_putp(char * s, term_t * term, win_t * win) { apply_attr(term, win->shift_attr); /* We won't print this symbol when not in column mode */ /* """""""""""""""""""""""""""""""""""""""""""""""""" */ if (*s != '\0') fputs(s, stdout); tputs(TPARM1(exit_attribute_mode), 1, outch); } /* ===================================================== */ /* Put a scrolling symbol at the last column of the line */ /* ===================================================== */ void right_margin_putp(char * s1, char * s2, langinfo_t * langinfo, term_t * term, win_t * win, long line, long offset) { apply_attr(term, win->bar_attr); if (term->has_hpa) tputs(TPARM2(column_address, offset + win->max_width + 1), 1, outch); else if (term->has_cursor_address) tputs(TPARM3(cursor_address, term->curs_line + line - 2, offset + win->max_width + 1), 1, outch); else if (term->has_parm_right_cursor) { fputc('\r', stdout); tputs(TPARM2(parm_right_cursor, offset + win->max_width + 1), 1, outch); } else { long i; fputc('\r', stdout); for (i = 0; i < offset + win->max_width + 1; i++) tputs(TPARM1(cursor_right), 1, outch); } if (langinfo->utf8) fputs(s1, stdout); else fputs(s2, stdout); tputs(TPARM1(exit_attribute_mode), 1, outch); } /* ************** */ /* Core functions */ /* ************** */ /* ============================================================== */ /* Split the lines of the message given to -m to a linked list of */ /* lines. */ /* Also fill the maximum screen width and the maximum number */ /* of bytes of the longest line */ /* ============================================================== */ void get_message_lines(char * message, ll_t * message_lines_list, long * message_max_width, long * message_max_len) { char * str; char * ptr; char * cr_ptr; long n; wchar_t * w = NULL; *message_max_width = 0; *message_max_len = 0; ptr = message; /* For each line terminated with a EOL character */ /* """"""""""""""""""""""""""""""""""""""""""""" */ while (*ptr != '\0' && (cr_ptr = strchr(ptr, '\n')) != NULL) { if (cr_ptr > ptr) { str = xmalloc(cr_ptr - ptr + 1); str[cr_ptr - ptr] = '\0'; memcpy(str, ptr, cr_ptr - ptr); } else str = xstrdup(""); ll_append(message_lines_list, str); /* If needed, update the message maximum width */ /* """"""""""""""""""""""""""""""""""""""""""" */ n = wcswidth((w = utf8_strtowcs(str)), utf8_strlen(str)); free(w); if (n > *message_max_width) *message_max_width = n; /* If needed, update the message maximum number */ /* of bytes used by the longest line */ /* """""""""""""""""""""""""""""""""""""""""""" */ if ((n = (long)strlen(str)) > *message_max_len) *message_max_len = n; ptr = cr_ptr + 1; } /* For the last line */ /* """"""""""""""""" */ if (*ptr != '\0') { ll_append(message_lines_list, xstrdup(ptr)); n = wcswidth((w = utf8_strtowcs(ptr)), utf8_strlen(ptr)); free(w); if (n > *message_max_width) *message_max_width = n; /* If needed, update the message maximum number */ /* of bytes used by the longest line */ /* """""""""""""""""""""""""""""""""""""""""""" */ if ((n = (long)strlen(ptr)) > *message_max_len) *message_max_len = n; } else ll_append(message_lines_list, xstrdup("")); } /* =================================================================== */ /* Set the new start and the new end of the window structure according */ /* to the current cursor position. */ /* =================================================================== */ void set_win_start_end(win_t * win, long current, long last) { long cur_line, end_line; cur_line = line_nb_of_word_a[current]; if (cur_line == last) win->end = count - 1; else { /* In help mode we must not modify the windows start/end position as */ /* It must be redrawn exactly as it was before. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (!help_mode) { if (cur_line + win->max_lines / 2 + 1 <= last) win->end = first_word_in_line_a[cur_line + win->max_lines / 2 + 1] - 1; else win->end = first_word_in_line_a[last]; } } end_line = line_nb_of_word_a[win->end]; if (end_line < win->max_lines) win->start = 0; else win->start = first_word_in_line_a[end_line - win->max_lines + 1]; } /* ========================================================================= */ /* Set the metadata associated with a word, its starting and ending position */ /* the line in which it is put and so on. */ /* Set win.start win.end and the starting and ending position of each word. */ /* This function is only called initially, when resizing the terminal and */ /* potentially when the search function is used. */ /* ========================================================================= */ long build_metadata(term_t * term, long count, win_t * win) { long i = 0; long word_len; long len = 0; long last = 0; long word_width; long tab_count; /* Current number of words in the line, * * used in tab_mode */ wchar_t * w; line_nb_of_word_a[0] = 0; first_word_in_line_a[0] = 0; /* In column mode we need to calculate win->max_width, first initialize */ /* it to 0 and increment it later in the loop */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (!win->col_mode) win->max_width = 0; tab_count = 0; while (i < count) { /* Determine the number of screen positions used by the word */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""" */ word_len = mbstowcs(NULL, word_a[i].str, 0); word_width = wcswidth((w = utf8_strtowcs(word_a[i].str)), word_len); /* Manage the case where the word is larger than the terminal width */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (word_width >= term->ncolumns - 2) { /* Shorten the word until it fits */ /* """""""""""""""""""""""""""""" */ do { word_width = wcswidth(w, word_len--); } while (word_len > 0 && word_width >= term->ncolumns - 2); } free(w); /* Look if there is enough remaining place on the line when not in column */ /* mode. Force a break if the 'is_last' flag is set in all modes or if we */ /* hit the max number of allowed columns in tab mode */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if ((!win->col_mode && !win->line_mode && (len + word_width + 1) >= term->ncolumns - 1) || ((win->col_mode || win->line_mode || win->tab_mode) && i > 0 && word_a[i - 1].is_last) || (win->tab_mode && win->max_cols > 0 && tab_count >= win->max_cols)) { /* We must build another line */ /* """""""""""""""""""""""""" */ line_nb_of_word_a[i] = ++last; first_word_in_line_a[last] = i; word_a[i].start = 0; len = word_width + 1; /* Resets the current line length */ tab_count = 1; /* Resets the current number of words * * in the line */ word_a[i].end = word_width - 1; word_a[i].mb = word_len; } else { word_a[i].start = len; word_a[i].end = word_a[i].start + word_width - 1; word_a[i].mb = word_len; line_nb_of_word_a[i] = last; len += word_width + 1; /* Increase line length */ tab_count++; /* We've seen another word in the line */ } /* If not in column mode, we need to calculate win->(real_)max_width */ /* as it hasn't been already done */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (len > win->max_width) { if (len > term->ncolumns) win->max_width = term->ncolumns - 2; else win->max_width = len; } if (len > win->real_max_width) win->real_max_width = len; i++; } if (!win->center || win->max_width > term->ncolumns - 2) win->offset = 0; else win->offset = (term->ncolumns - 2 - win->max_width) / 2; /* We need to recalculate win->start and win->end here */ /* because of a possible terminal resizing */ /* """"""""""""""""""""""""""""""""""""""""""""""""""" */ set_win_start_end(win, current, last); return last; } /* ==================================================================== */ /* Helper function used by disp_word to print a matching word under the */ /* cursor when not in search mode with the matching characters of the */ /* word highlighted. */ /* ==================================================================== */ void disp_cursor_word(long pos, win_t * win, term_t * term, int err) { size_t i; int att_set = 0; char * p = word_a[pos].str + daccess.flength; char * np; /* Set the cursor attribute */ /* """""""""""""""""""""""" */ tputs(TPARM1(exit_attribute_mode), 1, outch); tputs(TPARM1(exit_attribute_mode), 1, outch); if (word_a[pos].is_tagged) apply_attr(term, win->cursor_on_tag_attr); else apply_attr(term, win->cursor_attr); for (i = 0; i < word_a[pos].mb - daccess.flength; i++) { if (BIT_ISSET(word_a[pos].bitmap, i)) { if (!att_set) { att_set = 1; /* Set the buffer display attribute */ /* """""""""""""""""""""""""""""""" */ tputs(TPARM1(exit_attribute_mode), 1, outch); if (err) apply_attr(term, win->match_err_text_attr); else apply_attr(term, win->match_text_attr); if (word_a[pos].is_tagged) apply_attr(term, win->cursor_on_tag_attr); else apply_attr(term, win->cursor_attr); } } else { if (att_set) { att_set = 0; /* Set the search cursor attribute */ /* """"""""""""""""""""""""""""""" */ tputs(TPARM1(exit_attribute_mode), 1, outch); if (word_a[pos].is_tagged) apply_attr(term, win->cursor_on_tag_attr); else apply_attr(term, win->cursor_attr); } } np = utf8_next(p); if (np == NULL) fputs(p, stdout); else printf("%.*s", (int)(np - p), p); p = np; } } /* ==================================================================== */ /* Helper function used by disp_word to print a matching word NOT under */ /* the cursor with the matching characters of the word highlighted. */ /* ==================================================================== */ void disp_matching_word(long pos, win_t * win, term_t * term, int is_cursor, int err) { size_t i; int att_set = 0; char * p = word_a[pos].str + daccess.flength; char * np; /* Set the search cursor attribute */ /* """"""""""""""""""""""""""""""" */ tputs(TPARM1(exit_attribute_mode), 1, outch); if (is_cursor) { if (err) apply_attr(term, win->match_err_field_attr); else apply_attr(term, win->match_field_attr); } else { if (err) apply_attr(term, win->search_err_field_attr); else apply_attr(term, win->search_field_attr); } if (word_a[pos].is_tagged) apply_attr(term, win->tag_attr); for (i = 0; i < word_a[pos].mb - daccess.flength; i++) { if (BIT_ISSET(word_a[pos].bitmap, i)) { if (!att_set) { att_set = 1; /* Set the buffer display attribute */ /* """""""""""""""""""""""""""""""" */ tputs(TPARM1(exit_attribute_mode), 1, outch); if (is_cursor) { if (err) apply_attr(term, win->match_err_text_attr); else apply_attr(term, win->match_text_attr); } else apply_attr(term, win->search_text_attr); if (word_a[pos].is_tagged) apply_attr(term, win->tag_attr); } } else { if (att_set) { att_set = 0; /* Set the search cursor attribute */ /* """"""""""""""""""""""""""""""" */ tputs(TPARM1(exit_attribute_mode), 1, outch); if (is_cursor) { if (err) apply_attr(term, win->match_err_field_attr); else apply_attr(term, win->match_field_attr); } else { if (err) apply_attr(term, win->search_err_field_attr); else apply_attr(term, win->search_field_attr); } if (word_a[pos].is_tagged) apply_attr(term, win->tag_attr); } } np = utf8_next(p); if (np == NULL) fputs(p, stdout); else printf("%.*s", (int)(np - p), p); p = np; } } /* ====================================================================== */ /* Display a word in, the windows. Manages the following different cases: */ /* - Search mode display */ /* - Cursor display */ /* - Normal display */ /* - Color or mono display */ /* ====================================================================== */ void disp_word(long pos, search_mode_t search_mode, search_data_t * search_data, term_t * term, win_t * win, char * tmp_word) { long s = word_a[pos].start; long e = word_a[pos].end; long p; char * buffer = search_data->buf; if (pos == current) { if (search_mode != NONE) { utf8_strprefix(tmp_word, word_a[pos].str, (long)word_a[pos].mb, &p); if (word_a[pos].is_numbered) { /* Set the direct access number attribute */ /* """""""""""""""""""""""""""""""""""""" */ apply_attr(term, win->daccess_attr); /* And print it */ /* """""""""""" */ fputs(daccess.left, stdout); printf("%.*s", daccess.length, tmp_word + 1); fputs(daccess.right, stdout); tputs(TPARM1(exit_attribute_mode), 1, outch); fputc(' ', stdout); } else if (daccess.length > 0) { /* prints the leading spaces */ /* """"""""""""""""""""""""" */ tputs(TPARM1(exit_attribute_mode), 1, outch); printf("%.*s", daccess.flength, tmp_word); } /* Set the search cursor attribute */ /* """"""""""""""""""""""""""""""" */ if (search_data->fuzzy_err) apply_attr(term, win->search_err_field_attr); else apply_attr(term, win->search_field_attr); /* The tab attribute must complete the attributes already set */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (word_a[pos].is_tagged) apply_attr(term, win->tag_attr); /* Print the word part */ /* """"""""""""""""""" */ fputs(tmp_word + daccess.flength, stdout); if (buffer[0] != '\0') { long i = 0; /* Put the cursor at the beginning of the word */ /* """"""""""""""""""""""""""""""""""""""""""" */ for (i = 0; i < e - s + 1 - daccess.flength; i++) tputs(TPARM1(cursor_left), 1, outch); tputs(TPARM1(exit_attribute_mode), 1, outch); /* Set the search cursor attribute */ /* """"""""""""""""""""""""""""""" */ if (search_data->fuzzy_err) apply_attr(term, win->search_err_field_attr); else apply_attr(term, win->search_field_attr); disp_matching_word(pos, win, term, 0, search_data->fuzzy_err); } } else { if (daccess.length > 0) { /* If this word is not numbered, reset the display */ /* attributes before printing the leading spaces. */ /* """"""""""""""""""""""""""""""""""""""""""""""" */ if (!word_a[pos].is_numbered) { /* Print the non significant part of the word */ /* """""""""""""""""""""""""""""""""""""""""" */ tputs(TPARM1(exit_attribute_mode), 1, outch); printf("%.*s", daccess.flength - 1, word_a[pos].str); tputs(TPARM1(exit_attribute_mode), 1, outch); fputc(' ', stdout); } else { apply_attr(term, win->daccess_attr); /* Print the non significant part of the word */ /* """""""""""""""""""""""""""""""""""""""""" */ fputs(daccess.left, stdout); printf("%.*s", daccess.length, word_a[pos].str + 1); fputs(daccess.right, stdout); tputs(TPARM1(exit_attribute_mode), 1, outch); fputc(' ', stdout); } } /* If we are not in search mode, display a normal cursor */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""" */ utf8_strprefix(tmp_word, word_a[pos].str, (long)word_a[pos].mb, &p); if (word_a[pos].is_matching) disp_cursor_word(pos, win, term, search_data->fuzzy_err); else { if (word_a[pos].is_tagged) apply_attr(term, win->cursor_on_tag_attr); else apply_attr(term, win->cursor_attr); fputs(tmp_word + daccess.flength, stdout); } } tputs(TPARM1(exit_attribute_mode), 1, outch); } else { /* Display a normal word without any attribute */ /* """"""""""""""""""""""""""""""""""""""""""" */ utf8_strprefix(tmp_word, word_a[pos].str, (long)word_a[pos].mb, &p); /* If words are numbered, emphasis their numbers */ /* """"""""""""""""""""""""""""""""""""""""""""" */ if (word_a[pos].is_numbered) { apply_attr(term, win->daccess_attr); fputs(daccess.left, stdout); printf("%.*s", daccess.length, tmp_word + 1); fputs(daccess.right, stdout); tputs(TPARM1(exit_attribute_mode), 1, outch); fputc(' ', stdout); } else if (daccess.length > 0) { long i; /* Insert leading spaces if the word is non numbered and */ /* padding for all words is set */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""" */ tputs(TPARM1(exit_attribute_mode), 1, outch); if (daccess.padding == 'a') for (i = 0; i < daccess.flength; i++) fputc(' ', stdout); } if (!word_a[pos].is_selectable) apply_attr(term, win->exclude_attr); else if (word_a[pos].special_level > 0) { long level = word_a[pos].special_level - 1; apply_attr(term, win->special_attr[level]); } else apply_attr(term, win->include_attr); if (word_a[pos].is_matching) disp_matching_word(pos, win, term, 1, search_data->fuzzy_err); else { if (word_a[pos].is_tagged) apply_attr(term, win->tag_attr); if ((daccess.length > 0 && daccess.padding == 'a') || word_a[pos].is_numbered) fputs(tmp_word + daccess.flength, stdout); else fputs(tmp_word, stdout); } tputs(TPARM1(exit_attribute_mode), 1, outch); } } /* ======================================= */ /* Display a message line above the window */ /* ======================================= */ void disp_message(ll_t * message_lines_list, long message_max_width, long message_max_len, term_t * term, win_t * win) { ll_node_t * node; char * line; char * buf; size_t len; long size; long offset; wchar_t * w; win->message_lines = 0; /* Disarm the periodic timer to prevent the interruptions to corrupt */ /* screen by altering the timing of the decoding of the terminfo */ /* capabilities de */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ periodic_itv.it_value.tv_sec = 0; periodic_itv.it_value.tv_usec = 0; periodic_itv.it_interval.tv_sec = 0; periodic_itv.it_interval.tv_usec = 0; setitimer(ITIMER_REAL, &periodic_itv, NULL); /* Do nothing if there is no message to display */ /* """""""""""""""""""""""""""""""""""""""""""" */ if (message_lines_list == NULL) return; node = message_lines_list->head; buf = xmalloc(message_max_len + 1); /* Follow the message lines list and display each line */ /* """"""""""""""""""""""""""""""""""""""""""""""""""" */ while (node != NULL) { long i; line = node->data; len = utf8_strlen(line); w = utf8_strtowcs(line); /* Adjust size and len if the terminal is not large enough */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""" */ size = wcswidth(w, len); while (len > 0 && size > term->ncolumns) size = wcswidth(w, --len); free(w); /* Compute the offset from the left screen border if -M option is set */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ offset = (term->ncolumns - message_max_width - 3) / 2; if (win->center && offset > 0) for (i = 0; i < offset; i++) fputc(' ', stdout); apply_attr(term, win->message_attr); /* Only print the start of a line if the screen width if too small */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ utf8_strprefix(buf, line, len, &size); /* Print the line without the ending \n */ /* '''''''''''''''''''''''''''''''''''' */ printf("%s", buf); /* Complete the short line with spaces until it reach the */ /* message max size */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''''' */ for (i = size; i < message_max_width; i++) { if (i + (offset < 0 ? 0 : offset) >= term->ncolumns) break; fputc(' ', stdout); } /* Drop the attributes and print a \n */ /* '''''''''''''''''''''''''''''''''' */ tputs(TPARM1(exit_attribute_mode), 1, outch); puts(""); node = node->next; win->message_lines++; } /* Add an empty line without attribute to separate the menu title */ /* and the menu content. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ puts(""); win->message_lines++; free(buf); /* Re-arm the periodic timer */ /* """"""""""""""""""""""""" */ periodic_itv.it_value.tv_sec = 0; periodic_itv.it_value.tv_usec = TICK; periodic_itv.it_interval.tv_sec = 0; periodic_itv.it_interval.tv_usec = TICK; setitimer(ITIMER_REAL, &periodic_itv, NULL); } /* ============================ */ /* Display the selection window */ /* ============================ */ long disp_lines(win_t * win, toggle_t * toggle, long current, long count, search_mode_t search_mode, search_data_t * search_data, term_t * term, long last_line, char * tmp_word, langinfo_t * langinfo) { long lines_disp; long i; char scroll_symbol[5]; long len; long display_bar; /* Disarm the periodic timer to prevent the interruptions to corrupt */ /* screen by altering the timing of the decoding of the terminfo */ /* capabilities de */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ periodic_itv.it_value.tv_sec = 0; periodic_itv.it_value.tv_usec = 0; periodic_itv.it_interval.tv_sec = 0; periodic_itv.it_interval.tv_usec = 0; setitimer(ITIMER_REAL, &periodic_itv, NULL); scroll_symbol[0] = ' '; scroll_symbol[1] = '\0'; lines_disp = 1; tputs(TPARM1(save_cursor), 1, outch); i = win->start; /* Modify the max number of displayed lines if we do not have */ /* enough place */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (win->max_lines > term->nlines - win->message_lines) win->max_lines = term->nlines - win->message_lines; if (last_line >= win->max_lines) display_bar = 1; else display_bar = 0; if (win->col_mode || win->line_mode) len = term->ncolumns - 3; else len = term->ncolumns - 2; /* If in column mode and the sum of the columns sizes + gutters is */ /* greater than the terminal width, then prepend a space to be able to */ /* display the left arrow indicating that the first displayed column */ /* is not the first one. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (len > 1 && ((win->col_mode || win->line_mode) && win->real_max_width > term->ncolumns - 2)) { if (win->first_column > 0) { if (langinfo->utf8) strcpy(scroll_symbol, shift_left_sym); else strcpy(scroll_symbol, "<"); } } else scroll_symbol[0] = '\0'; /* Center the display ? */ /* """""""""""""""""""" */ if (win->offset > 0) { long i; for (i = 0; i < win->offset; i++) fputc(' ', stdout); } left_margin_putp(scroll_symbol, term, win); while (len > 1 && i <= count - 1) { /* Display one word and the space or symbol following it */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""" */ if (word_a[i].start >= win->first_column && word_a[i].end < len + win->first_column) { disp_word(i, search_mode, search_data, term, win, tmp_word); /* If there are more element to be displayed after the right margin */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if ((win->col_mode || win->line_mode) && i < count - 1 && word_a[i + 1].end >= len + win->first_column) { apply_attr(term, win->shift_attr); if (langinfo->utf8) fputs(shift_right_sym, stdout); else fputc('>', stdout); tputs(TPARM1(exit_attribute_mode), 1, outch); } /* If we want to display the gutter */ /* """""""""""""""""""""""""""""""" */ else if (!word_a[i].is_last && win->col_sep && (win->tab_mode || win->col_mode)) { long pos; /* Make sure that we are using the right gutter character even */ /* if the first displayed word is * not the first of its line */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ pos = i - first_word_in_line_a[line_nb_of_word_a[i]]; if (pos >= win->gutter_nb) /* Use the last gutter character */ fputs(win->gutter_a[win->gutter_nb - 1], stdout); else fputs(win->gutter_a[pos], stdout); } else /* Else just display a space */ /* """"""""""""""""""""""""" */ fputc(' ', stdout); } /* Mark the line as the current line, the line containing the cursor */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (i == current) win->cur_line = lines_disp; /* Check if we must start a new line */ /* """"""""""""""""""""""""""""""""" */ if (i == count - 1 || word_a[i + 1].start == 0) { tputs(TPARM1(clr_eol), 1, outch); if (lines_disp < win->max_lines) { /* If we have more than one line to display */ /* """""""""""""""""""""""""""""""""""""""" */ if (display_bar && !toggle->no_scrollbar && (lines_disp > 1 || i < count - 1)) { /* Display the next element of the scrollbar */ /* """"""""""""""""""""""""""""""""""""""""" */ if (line_nb_of_word_a[i] == 0) { if (win->max_lines > 1) right_margin_putp(sbar_top, "\\", langinfo, term, win, lines_disp, win->offset); else right_margin_putp(sbar_arr_down, "^", langinfo, term, win, lines_disp, win->offset); } else if (lines_disp == 1) right_margin_putp(sbar_arr_up, "^", langinfo, term, win, lines_disp, win->offset); else if (line_nb_of_word_a[i] == last_line) { if (win->max_lines > 1) right_margin_putp(sbar_down, "/", langinfo, term, win, lines_disp, win->offset); else right_margin_putp(sbar_arr_up, "^", langinfo, term, win, lines_disp, win->offset); } else if (last_line + 1 > win->max_lines && (long)((float)(line_nb_of_word_a[current]) / (last_line + 1) * (win->max_lines - 2) + 2) == lines_disp) right_margin_putp(sbar_curs, "+", langinfo, term, win, lines_disp, win->offset); else right_margin_putp(sbar_line, "|", langinfo, term, win, lines_disp, win->offset); } /* Print a newline character if we are not at the end of */ /* the input nor at the end of the window */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""" */ if (i < count - 1 && lines_disp < win->max_lines) { fputc('\n', stdout); if (win->offset > 0) { long i; for (i = 0; i < win->offset; i++) fputc(' ', stdout); } left_margin_putp(scroll_symbol, term, win); } /* We do not increment the number of lines seen after */ /* a premature end of input */ /* """""""""""""""""""""""""""""""""""""""""""""""""" */ if (i < count - 1) lines_disp++; if (win->max_lines == 1) break; } else if (i <= count - 1 && lines_disp == win->max_lines) { /* The last line of the window has been displayed */ /* """""""""""""""""""""""""""""""""""""""""""""" */ if (display_bar && line_nb_of_word_a[i] == last_line) { if (!toggle->no_scrollbar) { if (win->max_lines > 1) right_margin_putp(sbar_down, "/", langinfo, term, win, lines_disp, win->offset); else right_margin_putp(sbar_arr_up, "^", langinfo, term, win, lines_disp, win->offset); } } else { if (display_bar && !toggle->no_scrollbar) right_margin_putp(sbar_arr_down, "v", langinfo, term, win, lines_disp, win->offset); break; } } else /* These lines were not in the widows and so we have nothing to do */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ break; } /* Next word */ /* """"""""" */ i++; } /* Update win->end, this is necessary because we only */ /* call build_metadata on start and on terminal resize */ /* """"""""""""""""""""""""""""""""""""""""""""""""""" */ if (i == count) win->end = i - 1; else win->end = i; /* We restore the cursor position saved before the display of the window */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ tputs(TPARM1(restore_cursor), 1, outch); /* Re-arm the periodic timer */ /* """"""""""""""""""""""""" */ periodic_itv.it_value.tv_sec = 0; periodic_itv.it_value.tv_usec = TICK; periodic_itv.it_interval.tv_sec = 0; periodic_itv.it_interval.tv_usec = TICK; setitimer(ITIMER_REAL, &periodic_itv, NULL); return lines_disp; } /* ============================================ */ /* Signal handler. Manages SIGWINCH and SIGALRM */ /* ============================================ */ void sig_handler(int s) { switch (s) { /* Standard termination signals */ /* """""""""""""""""""""""""""" */ case SIGSEGV: got_sigsegv = 1; break; case SIGTERM: got_sigterm = 1; break; case SIGHUP: got_sighup = 1; break; /* Terminal resize */ /* """"""""""""""" */ case SIGWINCH: got_winch = 1; break; /* Alarm triggered, This signal is used by the search mechanism to */ /* forces a window refresh. */ /* The help mechanism uses it to clear the message */ /* It is also used to redisplay the window after the end of a terminal */ /* resizing. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ case SIGALRM: if (timeout.initial_value > 0) got_timeout_tick = 1; if (help_timer > 0) help_timer--; if (daccess_timer > 0) daccess_timer--; if (help_timer == 0 && help_mode) got_help_alrm = 1; if (daccess_timer == 0) got_daccess_alrm = 1; if (winch_timer > 0) winch_timer--; if (winch_timer == 0) { got_winch = 0; got_help_alrm = 0; got_winch_alrm = 1; } break; } } /* =========================================================== */ /* Helper function to compare to delimiters for use by ll_find */ /* =========================================================== */ int delims_cmp(const void * a, const void * b) { return strcmp((const char *)a, (const char *)b); } /* ========================================================= */ /* Set new first column to display when horizontal scrolling */ /* Alter win->first_column */ /* ========================================================= */ void set_new_first_column(win_t * win, term_t * term) { long pos; if (word_a[current].start < win->first_column) { pos = current; while (win->first_column > 0 && word_a[current].start < win->first_column) { win->first_column = word_a[pos].start; pos--; } } else if (word_a[current].end - win->first_column >= term->ncolumns - 3) { pos = first_word_in_line_a[line_nb_of_word_a[current]]; while (!word_a[pos].is_last && word_a[current].end - win->first_column >= term->ncolumns - 3) { pos++; win->first_column = word_a[pos].start; } } } /* ==================================================== */ /* Restrict the matches to word ending with the pattern */ /* ==================================================== */ void select_ending_matches(win_t * win, term_t * term, search_data_t * search_data, long * last_line) { if (matches_count > 0) { long i; long j = 0; long index; long nb; long * tmp; char * ptr; char * last_glyph; int utf8_len; /* Creation of an alternate array which will */ /* contain only the candidates having potentially */ /* an ending pattern, if this array becomes non */ /* empty then it will replace the original array. */ /* """""""""""""""""""""""""""""""""""""""""""""" */ alt_matching_words_a = xrealloc(alt_matching_words_a, matches_count * (sizeof(long))); for (i = 0; i < matches_count; i++) { index = matching_words_a[i]; long len = word_a[index].len; char * str = word_a[index].str; /* count the trailing blanks non counted in the bitmap */ /* """"""""""""""""""""""""""""""""""""""""""""""""""" */ ptr = str + strlen(str); nb = 0; while ((ptr = utf8_prev(str, ptr)) != NULL && isblank(*ptr)) if (ptr - str + 1 > len) nb++; else break; /* Check the bit corresponding to the last non blank glyph */ /* If set we add the index to an alternate array, if not we */ /* clear the bitmap of the corresponding word */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (BIT_ISSET(word_a[index].bitmap, word_a[index].mb - nb - daccess.flength - 1)) alt_matching_words_a[j++] = index; else { /* Look if the end of the word potentially contain an */ /* ending pattern. */ /* """""""""""""""""""""""""""""""""""""""""""""""""" */ if (search_mode == FUZZY) { utf8_len = mblen(ptr, 4); last_glyph = search_data->buf + search_data->len - utf8_len; /* in fuzzy search mode we only look the last glyph */ /* """""""""""""""""""""""""""""""""""""""""""""""" */ if (memcmp(ptr, last_glyph, utf8_len) == 0) alt_matching_words_a[j++] = index; else memset(word_a[index].bitmap, '\0', (word_a[index].mb - daccess.flength) / CHAR_BIT + 1); } else { /* in not fuzzy search mode use all the pattern */ /* """""""""""""""""""""""""""""""""""""""""""" */ for (nb = 0; nb < search_data->utf8_len - 1; nb++) ptr = utf8_prev(str, ptr); if (memcmp(ptr, search_data->buf, search_data->len) == 0) alt_matching_words_a[j++] = index; else memset(word_a[index].bitmap, '\0', (word_a[index].mb - daccess.flength) / CHAR_BIT + 1); } } } /* Swap the normal and alt array */ /* """"""""""""""""""""""""""""" */ matches_count = j; matching_words_a_size = j; tmp = matching_words_a; matching_words_a = alt_matching_words_a; alt_matching_words_a = tmp; if (j > 0) { /* Adjust the bitmap to the ending version */ /* """"""""""""""""""""""""""""""""""""""" */ update_bitmaps(search_mode, search_data, END_AFFINITY); current = matching_words_a[0]; if (current < win->start || current > win->end) *last_line = build_metadata(term, count, win); /* Set new first column to display */ /* """"""""""""""""""""""""""""""" */ set_new_first_column(win, term); } } } /* ====================================================== */ /* Restrict the matches to word starting with the pattern */ /* ====================================================== */ void select_starting_matches(win_t * win, term_t * term, search_data_t * search_data, long * last_line) { if (matches_count > 0) { long i; long j = 0; long index; long * tmp; long pos; char * first_glyph; int utf8_len; alt_matching_words_a = xrealloc(alt_matching_words_a, matches_count * (sizeof(long))); first_glyph = xmalloc(5); for (i = 0; i < matches_count; i++) { index = matching_words_a[i]; if (BIT_ISSET(word_a[index].bitmap, 0)) alt_matching_words_a[j++] = index; else { if (search_mode == FUZZY) { first_glyph = utf8_strprefix(first_glyph, word_a[index].str + daccess.flength, 1, &pos); utf8_len = pos; /* in fuzzy search mode we only look the first glyph */ /* """"""""""""""""""""""""""""""""""""""""""""""""" */ if (memcmp(search_data->buf, first_glyph, utf8_len) == 0) alt_matching_words_a[j++] = index; else memset(word_a[index].bitmap, '\0', (word_a[index].mb - daccess.flength) / CHAR_BIT + 1); } else { /* in not fuzzy search mode use all the pattern */ /* """""""""""""""""""""""""""""""""""""""""""" */ if (memcmp(search_data->buf, word_a[index].str, search_data->len) == 0) alt_matching_words_a[j++] = index; else memset(word_a[index].bitmap, '\0', (word_a[index].mb - daccess.flength) / CHAR_BIT + 1); } } } free(first_glyph); matches_count = j; matching_words_a_size = j; tmp = matching_words_a; matching_words_a = alt_matching_words_a; alt_matching_words_a = tmp; if (j > 0) { /* Adjust the bitmap to the ending version */ /* """"""""""""""""""""""""""""""""""""""" */ update_bitmaps(search_mode, search_data, START_AFFINITY); current = matching_words_a[0]; if (current < win->start || current > win->end) *last_line = build_metadata(term, count, win); /* Set new first column to display */ /* """"""""""""""""""""""""""""""" */ set_new_first_column(win, term); } } } /* ====================== */ /* Moves the cursor left */ /* ====================== */ void move_left(win_t * win, term_t * term, toggle_t * toggle, search_data_t * search_data, langinfo_t * langinfo, long * nl, long last_line, char * tmp_word) { long old_current = current; long old_start = win->start; long old_first_column = win->first_column; long wi; /* word index */ do { if (current > 0) { if (current == win->start) if (win->start > 0) { for (wi = win->start - 1; wi >= 0 && word_a[wi].start != 0; wi--) { } win->start = wi; if (word_a[wi].str != NULL) win->start = wi; if (win->end < count - 1) { for (wi = win->end + 2; wi < count - 1 && word_a[wi].start != 0; wi++) { } if (word_a[wi].str != NULL) win->end = wi; } } /* In column mode we need to take care of the */ /* horizontal scrolling */ /* """""""""""""""""""""""""""""""""""""""""" */ if (win->col_mode || win->line_mode) { long pos; if (word_a[current].start == 0) { long len; len = term->ncolumns - 3; pos = first_word_in_line_a[line_nb_of_word_a[current - 1]]; while (word_a[current - 1].end - win->first_column >= len) { win->first_column += word_a[pos].end - word_a[pos].start + 2; pos++; } } else if (word_a[current - 1].start < win->first_column) win->first_column = word_a[current - 1].start; } current--; } else break; } while (current != old_current && !word_a[current].is_selectable); if (!word_a[current].is_selectable) { current = old_current; win->start = old_start; if (win->col_mode || win->line_mode) win->first_column = old_first_column; } if (current != old_current) *nl = disp_lines(win, toggle, current, count, search_mode, search_data, term, last_line, tmp_word, langinfo); } /* ====================== */ /* Moves the cursor right */ /* ====================== */ void move_right(win_t * win, term_t * term, toggle_t * toggle, search_data_t * search_data, langinfo_t * langinfo, long * nl, long last_line, char * tmp_word) { long old_current = current; long old_start = win->start; long old_first_column = win->first_column; long wi; /* word index */ do { if (current < count - 1) { if (current == win->end) if (win->start < count - 1 && win->end != count - 1) { for (wi = win->start + 1; wi < count - 1 && word_a[wi].start != 0; wi++) { } if (word_a[wi].str != NULL) win->start = wi; if (win->end < count - 1) { for (wi = win->end + 2; wi < count - 1 && word_a[wi].start != 0; wi++) { } if (word_a[wi].str != NULL) win->end = wi; } } /* In column mode we need to take care of the */ /* horizontal scrolling */ /* """""""""""""""""""""""""""""""""""""""""" */ if (win->col_mode || win->line_mode) { if (word_a[current].is_last) win->first_column = 0; else { long pos; long len; len = term->ncolumns - 3; if (word_a[current + 1].end >= len + win->first_column) { /* Find the first word to be displayed in this line */ /* """""""""""""""""""""""""""""""""""""""""""""""" */ pos = first_word_in_line_a[line_nb_of_word_a[current]]; while (word_a[pos].start <= win->first_column) pos++; pos--; /* If the new current word cannot be displayed, search */ /* the first word in the line that can be displayed by */ /* iterating on pos. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""" */ while (word_a[current + 1].end - word_a[pos].start >= len) pos++; if (word_a[pos].start > 0) win->first_column = word_a[pos].start; } } } current++; } else break; } while (current != old_current && !word_a[current].is_selectable); if (!word_a[current].is_selectable) { current = old_current; win->start = old_start; if (win->col_mode || win->line_mode) win->first_column = old_first_column; } if (current != old_current) *nl = disp_lines(win, toggle, current, count, search_mode, search_data, term, last_line, tmp_word, langinfo); } /* ================================================================== */ /* Get the last word of a line after it has been formed to fit in the */ /* terminal. */ /* ================================================================== */ long get_line_last_word(long line, long last_line) { if (line == last_line) return count - 1; else return first_word_in_line_a[line + 1] - 1; } /* ==================================================================== */ /* Try to locate the best word in the target line when trying to move */ /* the cursor upward. */ /* returns 1 if a word has been found else 0. */ /* This function has the side effect to potentially change the value of */ /* the variable 'current' if an adequate word is found. */ /* ==================================================================== */ int find_best_word_upward(long last_word, long s, long e) { int found = 0; long index; long cursor; /* Look for the first word whose start position in the line is */ /* less or equal to the source word starting position */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ cursor = last_word; while (word_a[cursor].start > s) cursor--; /* In case no word is eligible, keep the cursor on */ /* the last word */ /* """"""""""""""""""""""""""""""""""""""""""""""" */ if (cursor == last_word && word_a[cursor].start > 0) cursor--; /* Try to guess the best choice if we have multiple choices */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (word_a[cursor].end >= s && word_a[cursor].end - s >= e - word_a[cursor + 1].start) current = cursor; else { if (cursor < last_word) current = cursor + 1; else current = cursor; } /* If the word is not selectable, try to find a selectable word */ /* in the line */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (!word_a[current].is_selectable) { index = 0; while (word_a[current - index].start > 0 && !word_a[current - index].is_selectable) index++; if (word_a[current - index].is_selectable) { current -= index; found = 1; } else { index = 0; while (current + index < last_word && !word_a[current + index].is_selectable) index++; if (word_a[current + index].is_selectable) { current += index; found = 1; } } } else found = 1; return found; } /* ==================================================================== */ /* Try to locate the best word in the target line when trying to move */ /* the cursor downward. */ /* returns 1 if a word has been found else 0. */ /* This function has the side effect to potentially change the value of */ /* the variable 'current' if an adequate word is found. */ /* ==================================================================== */ int find_best_word_downward(long last_word, long s, long e) { int found = 0; long index; long cursor; /* Look for the first word whose start position in the line is */ /* less or equal than the source word starting position */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ cursor = last_word; while (word_a[cursor].start > s) cursor--; /* In case no word is eligible, keep the cursor on */ /* the last word */ /* """"""""""""""""""""""""""""""""""""""""""""""" */ if (cursor == last_word && word_a[cursor].start > 0) cursor--; /* Try to guess the best choice if we have multiple choices */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (cursor < count - 1 && word_a[cursor].end - s >= e - word_a[cursor + 1].start) current = cursor; else { if (cursor < count - 1) { if (cursor < last_word) current = cursor + 1; else current = cursor; } else current = count - 1; } /* If the word is not selectable, try to find a selectable word */ /* in ts line */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (!word_a[current].is_selectable) { index = 0; while (word_a[current - index].start > 0 && !word_a[current - index].is_selectable) index++; if (word_a[current - index].is_selectable) { current -= index; found = 1; } else { index = 0; while (current + index < last_word && !word_a[current + index].is_selectable) index++; if (word_a[current + index].is_selectable) { current += index; found = 1; } } } else found = 1; return found; } /* =================== */ /* Moves the cursor up */ /* =================== */ void move_up(win_t * win, term_t * term, toggle_t * toggle, search_data_t * search_data, langinfo_t * langinfo, long * nl, long page, long first_selectable, long last_line, char * tmp_word) { long line; /* The line being processed (the target line) */ long start_line; /* The first line of the window */ long cur_line; /* The line of the cursor */ long nlines; /* Number of line in the window */ long first_selectable_line; /* the line containing the first * * selectable word */ long lines_skipped; /* The number of line between the target line and the * * first line containing a selectable word in case of * * exclusions. */ long last_word; /* The last word on the target line */ long s, e; /* Starting and ending terminal position of a word */ int found; /* 1 if a line could be fond else 0 */ /* Store the initial starting and ending positions of */ /* the word under the cursor */ /* """""""""""""""""""""""""""""""""""""""""""""""""" */ s = word_a[current].start; e = word_a[current].end; /* Identify the line number of the first window's line */ /* and the line number of the current line */ /* """"""""""""""""""""""""""""""""""""""""""""""""""" */ start_line = line_nb_of_word_a[win->start]; cur_line = line_nb_of_word_a[current]; first_selectable_line = line_nb_of_word_a[first_selectable]; lines_skipped = 0; found = 0; nlines = win->max_lines < last_line + 1 ? win->max_lines : last_line + 1; /* initialise the target line */ /* """""""""""""""""""""""""" */ line = cur_line; /* Special case if the cursor is already in the line containing the */ /* first selectable word. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (line == first_selectable_line) { /* we can't move the cursor up but we still can try to show the */ /* more non selectable words as we can. */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' */ if (line <= start_line + nlines - 1 - page) { /* We are scrolling one line at a time and the cursor is not in */ /* the last line of the window. */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' */ if (start_line - page > 0) /* There is enough remaining line to fill a window. */ /* '''''''''''''''''''''''''''''''''''''''''''''''' */ start_line -= page; else /* We cannot scroll further */ /* '''''''''''''''''''''''' */ start_line = 0; } else { /* The cursor is already in the last line of the windows. */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''''' */ if (line >= nlines) /* There is enough remaining line to fill a window. */ /* '''''''''''''''''''''''''''''''''''''''''''''''' */ start_line = line - nlines + 1; else /* We cannot scroll further */ /* '''''''''''''''''''''''' */ start_line = 0; } } else { if (line - page < 0) { /* Trivial case, we are already on the first page */ /* just jump to the first selectable line */ /* """""""""""""""""""""""""""""""""""""""""""""" */ line = first_selectable_line; last_word = get_line_last_word(line, last_line); find_best_word_upward(last_word, s, e); } else { /* Temporarily move up one page */ /* """""""""""""""""""""""""""" */ line -= page; /* The target line cannot be before the line containing the first */ /* selectable word. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (line < first_selectable_line) { line = first_selectable_line; last_word = get_line_last_word(line, last_line); find_best_word_upward(last_word, s, e); } else { /* If this is not the case, search upward for the line with a */ /* selectable word. This line is guaranteed to exist. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ while (line >= first_selectable_line) { last_word = get_line_last_word(line, last_line); if (find_best_word_upward(last_word, s, e)) { found = 1; break; } line--; lines_skipped++; } } } } /* Look if we need to adjust the window to follow the cursor */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (!found && start_line - page >= 0) { /* We are on the first line containing a selectable word and */ /* There is enough place to scroll up a page but only scrolls */ /* up if the cursor remains in the window */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (start_line + nlines - line > page) start_line -= page; } else if (line < start_line) { /* The target line is above the windows */ /* """""""""""""""""""""""""""""""""""" */ if (start_line - page - lines_skipped < 0) /* There isn't enough remaining lines to scroll up */ /* a page size. */ /* """"""""""""""""""""""""""""""""""""""""""""""" */ start_line = 0; else start_line -= page + lines_skipped; } /* And set the new value of the starting word of the window */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""" */ win->start = first_word_in_line_a[start_line]; /* Set the new first column to display */ /* """"""""""""""""""""""""""""""""""" */ set_new_first_column(win, term); /* Redisplay the window */ /* """""""""""""""""""" */ *nl = disp_lines(win, toggle, current, count, search_mode, search_data, term, last_line, tmp_word, langinfo); } /* ===================== */ /* Moves the cursor down */ /* ===================== */ void move_down(win_t * win, term_t * term, toggle_t * toggle, search_data_t * search_data, langinfo_t * langinfo, long * nl, long page, long last_selectable, long last_line, char * tmp_word) { long line; /* The line being processed (the target line) */ long start_line; /* The first line of the window */ long cur_line; /* The line of the cursor */ long nlines; /* Number of line in the window */ long last_selectable_line; /* the line containing the last * * selectable word */ long lines_skipped; /* The number of line between the target line and the * * first line containing a selectable word in case of * * exclusions. */ long last_word; /* The last word on the target line */ long s, e; /* Starting and ending terminal position of a word */ int found; /* 1 if a line could be fond in the next page else 0 */ /* Store the initial starting and ending positions of */ /* the word under the cursor */ /* """""""""""""""""""""""""""""""""""""""""""""""""" */ s = word_a[current].start; e = word_a[current].end; /* Identify the line number of the first window's line */ /* and the line number of the current line */ /* """"""""""""""""""""""""""""""""""""""""""""""""""" */ start_line = line_nb_of_word_a[win->start]; cur_line = line_nb_of_word_a[current]; last_selectable_line = line_nb_of_word_a[last_selectable]; lines_skipped = 0; found = 0; nlines = win->max_lines < last_line + 1 ? win->max_lines : last_line + 1; /* initialise the target line */ /* """""""""""""""""""""""""" */ line = cur_line; /* Special case if the cursor is already in the line containing the */ /* last selectable word. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (line == last_selectable_line) { /* we can't move the cursor down but we still can try to show the */ /* more non selectable words as we can. */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' */ if (line >= start_line + page) { /* We are scrolling one line at a time and the cursor is not in */ /* the first line of the window. */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' */ if (start_line + page + nlines - 1 <= last_line) /* There is enough remaining line to fill a window. */ /* '''''''''''''''''''''''''''''''''''''''''''''''' */ start_line += page; else /* We cannot scroll further */ /* '''''''''''''''''''''''' */ start_line = last_line - nlines + 1; } else { /* The cursor is already in the first line of the windows. */ /* ''''''''''''''''''''''''''''''''''''''''''''''''''''''' */ if (last_line - line + 1 > nlines) /* There is enough remaining line to fill a window. */ /* '''''''''''''''''''''''''''''''''''''''''''''''' */ start_line = line; else /* We cannot scroll further */ /* '''''''''''''''''''''''' */ start_line = last_line - nlines + 1; } } else { /* The cursor is above the line containing the last selectable word. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (last_line - line - page < 0) { /* Trivial case, we are already on the last page */ /* just jump to the last selectable line */ /* """""""""""""""""""""""""""""""""""""""""""""" */ line = last_selectable_line; last_word = get_line_last_word(line, last_line); find_best_word_downward(last_word, s, e); } else { /* Temporarily move down one page */ /* """""""""""""""""""""""""""""" */ line += page; /* The target line cannot be before the line containing the first */ /* selectable word. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (line > last_selectable_line) { line = last_selectable_line; last_word = get_line_last_word(line, last_line); find_best_word_downward(last_word, s, e); } else { /* If this is not the case, search upward for the line with a */ /* selectable word. This line is guaranteed to exist. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ while (line <= last_selectable_line) { last_word = get_line_last_word(line, last_line); if (find_best_word_downward(last_word, s, e)) { found = 1; break; } line++; lines_skipped++; } } } /* Look if we need to adjust the window to follow the cursor */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (!found && start_line + nlines - 1 + page <= last_line) { /* We are on the last line containing a selectable word and */ /* There is enough place to scroll down a page but only scrolls */ /* down if the cursor remains in the window */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (line - start_line >= page) start_line += page; } else if (line > start_line + nlines - 1) { /* The target line is below the windows */ /* """""""""""""""""""""""""""""""""""" */ if (start_line + nlines + page + lines_skipped - 1 > last_line) /* There isn't enough remaining lines to scroll down */ /* a page size. */ /* """"""""""""""""""""""""""""""""""""""""""""""""" */ start_line = last_line - nlines + 1; else start_line += page + lines_skipped; } } /* And set the new value of the starting word of the window */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""" */ win->start = first_word_in_line_a[start_line]; /* Set the new first column to display */ /* """"""""""""""""""""""""""""""""""" */ set_new_first_column(win, term); /* Redisplay the window */ /* """""""""""""""""""" */ *nl = disp_lines(win, toggle, current, count, search_mode, search_data, term, last_line, tmp_word, langinfo); } /* ================ */ /* Main entry point */ /* ================ */ int main(int argc, char * argv[]) { /* Mapping of supported charsets and the number of bits used in them */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ charsetinfo_t all_supported_charsets[] = { { "UTF-8", 8 }, { "ANSI_X3.4-1968", 7 }, { "ANSI_X3.4-1986", 7 }, { "646", 7 }, { "ASCII", 7 }, { "CP367", 7 }, { "IBM367", 7 }, { "ISO_646.BASIC", 7 }, { "ISO_646.IRV:1991", 7 }, { "ISO_646.IRV", 7 }, { "ISO646-US", 7 }, { "ISO-IR-6", 7 }, { "US", 7 }, { "US-ASCII", 7 }, { "hp-roman8", 8 }, { "roman8", 8 }, { "r8", 8 }, { "ISO-8859-1", 8 }, { "ISO-IR-100", 8 }, { "ISO_8859-1:1987", 8 }, { "ISO_8859-1", 8 }, { "LATIN1", 8 }, { "L1", 8 }, { "IBM819", 8 }, { "CP819", 8 }, { "ISO-8859-2", 8 }, { "ISO-IR-101", 8 }, { "ISO_8859-2:1987", 8 }, { "ISO_8859-2", 8 }, { "LATIN2", 8 }, { "L2", 8 }, { "CP28592", 8 }, { "ISO-8859-3", 8 }, { "ISO-IR-109", 8 }, { "ISO_8859-3:1988", 8 }, { "ISO_8859-3", 8 }, { "LATIN3", 8 }, { "L3", 8 }, { "CP28593", 8 }, { "ISO-8859-4", 8 }, { "ISO-IR-110", 8 }, { "ISO_8859-4:1988", 8 }, { "LATIN4", 8 }, { "L4", 8 }, { "CP28594", 8 }, { "ISO-8859-5", 8 }, { "ISO-IR-144", 8 }, { "ISO_8859-5:1988", 8 }, { "CYRILLIC", 8 }, { "CP28595", 8 }, { "KOI8-R", 8 }, { "KOI8-RU", 8 }, { "KOI8-U", 8 }, { "ISO-8859-6", 8 }, { "ISO-IR-127", 8 }, { "ISO_8859-6:1987", 8 }, { "ECMA-114", 8 }, { "ASMO-708", 8 }, { "ARABIC", 8 }, { "CP28596", 8 }, { "ISO-8859-7", 8 }, { "ISO-IR-126", 8 }, { "ISO_8859-7:2003", 8 }, { "ISO_8859-7:1987", 8 }, { "ELOT_928", 8 }, { "ECMA-118", 8 }, { "GREEK", 8 }, { "GREEK8", 8 }, { "CP28597", 8 }, { "ISO-8859-8", 8 }, { "ISO-IR-138", 8 }, { "ISO_8859-8:1988", 8 }, { "HEBREW", 8 }, { "CP28598", 8 }, { "ISO-8859-9", 8 }, { "ISO-IR-148", 8 }, { "ISO_8859-9:1989", 8 }, { "LATIN5", 8 }, { "L5", 8 }, { "CP28599", 8 }, { "ISO-8859-10", 8 }, { "ISO-IR-157", 8 }, { "ISO_8859-10:1992", 8 }, { "LATIN6", 8 }, { "L6", 8 }, { "CP28600", 8 }, { "ISO-8859-11", 8 }, { "ISO-8859-11:2001", 8 }, { "ISO-IR-166", 8 }, { "CP474", 8 }, { "TIS-620", 8 }, { "TIS620", 8 }, { "TIS620-0", 8 }, { "TIS620.2529-1", 8 }, { "TIS620.2533-0", 8 }, /* ISO-8859-12 was abandoned in 1997 */ /* """"""""""""""""""""""""""""""""" */ { "ISO-8859-13", 8 }, { "ISO-IR-179", 8 }, { "LATIN7", 8 }, { "L7", 8 }, { "CP28603", 8 }, { "ISO-8859-14", 8 }, { "LATIN8", 8 }, { "L8", 8 }, { "ISO-8859-15", 8 }, { "LATIN-9", 8 }, { "CP28605", 8 }, { "ISO-8859-16", 8 }, { "ISO-IR-226", 8 }, { "ISO_8859-16:2001", 8 }, { "LATIN10", 8 }, { "L10", 8 }, { "CP1250", 8 }, { "CP1251", 8 }, { "CP1252", 8 }, { "MS-ANSI", 8 }, { NULL, 0 } }; char * message = NULL; /* message to be displayed above the selection * * window */ ll_t * message_lines_list = NULL; /* list of the lines in the message to * * be displayed */ long message_max_width = 0; /* total width of the message (longest line) */ long message_max_len = 0; /* max number of bytes taken by a message * * line */ FILE * input_file; /* The name of the file passed as argument if any */ long index; /* generic counter */ long daccess_index = 1; /* First index of the numbered words */ char * daccess_np = NULL; /* direct access numbered pattern */ regex_t daccess_np_re; /* variable to store the compiled direct access * * pattern (-N) RE */ char * daccess_up = NULL; /* direct access un-numbered pattern */ regex_t daccess_up_re; /* variable to store the compiled direct access * * pattern (-U) RE */ char * include_pattern = NULL; char * exclude_pattern = NULL; int pattern_def_include = -1; /* Set to -1 until an -i or -e option is * * specified, This variable remembers if * * the words not matched will be included * * (value 1) or excluded (value 0) by * * default. */ regex_t include_re; /* variable to store the compiled include (-i) REs */ regex_t exclude_re; /* variable to store the compiled exclude (-e) REs */ ll_t * sed_list = NULL; /* List of sed like string representation * * of regex given after (-S) */ ll_t * include_sed_list = NULL; /* idem for -I */ ll_t * exclude_sed_list = NULL; /* idem for -E */ ll_t * inc_col_interval_list = NULL; /* list of included or */ ll_t * exc_col_interval_list = NULL; /* excluded numerical intervals */ ll_t * inc_row_interval_list = NULL; /* for lines and columns */ ll_t * exc_row_interval_list = NULL; ll_t * inc_col_regex_list = NULL; /* same for lines and columns specified */ ll_t * exc_col_regex_list = NULL; /* by regular expressions */ ll_t * inc_row_regex_list = NULL; ll_t * exc_row_regex_list = NULL; filters_t rows_filter_type = UNKNOWN_FILTER; char * first_word_pattern = NULL; /* used by -A/-Z */ char * last_word_pattern = NULL; regex_t first_word_re; regex_t last_word_re; char * special_pattern[5] = { NULL, NULL, NULL, NULL, NULL }; /* -1 .. -5 */ regex_t special_re[5]; int include_visual_only = 0; /* If set to 1, the original word which is * * read from stdin will be output even if its */ int exclude_visual_only = 0; /* visual representation was modified via * * -S/-I/-E */ ll_t * cols_selector_list = NULL; char * cols_selector = NULL; ll_t * rows_selector_list = NULL; char * rows_selector = NULL; long wi; /* word index */ term_t term; /* Terminal structure */ tst_node_t * tst_word = NULL; /* TST used by the search function */ tst_node_t * tst_daccess = NULL; /* TST used by the direct access system */ long page; /* Step for the vertical cursor moves */ char * word; /* Temporary variable to work on words */ char * tmp_word; /* Temporary variable able to contain the beginning of * * the word to be displayed */ long last_line = 0; /* last logical line number (from 0) */ long opt; win_t win; limits_t limits; /* set of various limitations */ timers_t timers; /* timers contents */ misc_t misc; /* misc contents */ toggle_t toggle; /* set of binary indicators */ int old_fd1; /* backups of the old stdout file descriptor */ FILE * old_stdout; /* The selected word will go there */ long nl; /* Number of lines displayed in the window */ long offset; /* Used to correctly put the cursor at the start of the * * selection window, even after a terminal vertical scroll */ long first_selectable; /* Index of the first selectable word in the input * * stream */ long last_selectable; /* Index of the last selectable word in the input * * stream */ long min_size; /* Minimum screen width of a column in tabular mode */ long tab_max_size; /* Maximum screen width of a column in tabular * * mode */ long tab_real_max_size; /* Maximum size in bytes of a column in tabular * * mode */ long * col_real_max_size = NULL; /* Array of maximum sizes (bytes) of each */ /* column in column mode */ long * col_max_size = NULL; /* Array of maximum sizes of each column */ /* in column mode */ long word_real_max_size = 0; /* size of the longer word after expansion */ long cols_real_max_size = 0; /* Max real width of all columns used when * * -w and -c are both set */ long cols_max_size = 0; /* Same as above for the columns widths */ long col_index = 0; /* Index of the current column when reading words,i * * used in column mode */ long cols_number = 0; /* Number of columns in column mode */ char * pre_selection_index = NULL; /* pattern used to set the initial * * cursor position */ unsigned char * buffer = xmalloc(16); /* Input buffer */ search_data_t search_data; search_data.buf = NULL; /* Search buffer */ search_data.len = 0; /* Current position in the search buffer */ search_data.utf8_len = 0; /* Current position in the search buffer in * * UTF-8 units */ search_data.fuzzy_err = 0; /* reset the error indicator */ search_data.fuzzy_err_pos = -1; /* no last error position in search buffer */ long matching_word_cur_index = -1; /* cache for the next/previous moves * * in the matching words array */ struct sigaction sa; /* Signal structure */ char * iws = NULL, *ils = NULL; ll_t * word_delims_list = NULL; ll_t * record_delims_list = NULL; char utf8_buffer[5]; /* buffer to store the bytes of a UTF-8 glyph * * (4 chars max) */ unsigned char is_last; char * charset; char * custom_ini_file = NULL; /* init file full path */ char * home_ini_file; /* init file full path */ char * local_ini_file; /* init file full path */ charsetinfo_t * charset_ptr; langinfo_t langinfo; int is_supported_charset; long line_count = 0; /* Only used when -R is selected */ attr_t init_attr; ll_node_t * inc_interval_node = NULL; /* one node of this list */ ll_node_t * exc_interval_node = NULL; /* one node of this list */ interval_t * inc_interval; /* the data in each node */ interval_t * exc_interval; /* the data in each node */ int row_def_selectable; /* default selectable value */ int line_selected_by_regex = 0; int line_excluded = 0; char * timeout_message; /* Win fields initialization */ /* """"""""""""""""""""""""" */ win.max_lines = 5; win.message_lines = 0; win.asked_max_lines = -1; win.center = 0; win.max_cols = 0; win.col_sep = 0; win.wide = 0; win.tab_mode = 0; win.col_mode = 0; win.line_mode = 0; win.first_column = 0; win.real_max_width = 0; init_attr.is_set = UNSET; init_attr.fg = -1; init_attr.bg = -1; init_attr.bold = -1; init_attr.dim = -1; init_attr.reverse = -1; init_attr.standout = -1; init_attr.underline = -1; init_attr.italic = -1; win.cursor_attr = init_attr; win.cursor_on_tag_attr = init_attr; win.bar_attr = init_attr; win.shift_attr = init_attr; win.message_attr = init_attr; win.search_field_attr = init_attr; win.search_text_attr = init_attr; win.search_err_field_attr = init_attr; win.search_err_text_attr = init_attr; win.match_field_attr = init_attr; win.match_text_attr = init_attr; win.match_err_field_attr = init_attr; win.match_err_text_attr = init_attr; win.include_attr = init_attr; win.exclude_attr = init_attr; win.tag_attr = init_attr; win.daccess_attr = init_attr; win.sel_sep = NULL; for (index = 0; index < 5; index++) win.special_attr[index] = init_attr; /* Default limits initialization */ /* """"""""""""""""""""""""""""" */ limits.words = 32767; limits.cols = 256; limits.word_length = 512; /* Default timers in 1/10 s */ /* """""""""""""""""""""""" */ timers.search = 60 * FREQ / 10; timers.help = 150 * FREQ / 10; timers.winch = 7 * FREQ / 10; timers.direct_access = 6 * FREQ / 10; /* Toggles initialization */ /* """""""""""""""""""""" */ toggle.del_line = 0; toggle.enter_val_in_search = 0; toggle.no_scrollbar = 0; toggle.blank_nonprintable = 0; toggle.keep_spaces = 0; toggle.taggable = 0; toggle.autotag = 0; toggle.pinable = 0; toggle.visual_bell = 0; /* misc default values */ /* """"""""""""""""""" */ misc.default_search_method = NONE; /* direct access variable initialization */ /* """"""""""""""""""""""""""""""""""""" */ daccess_stack = xcalloc(6, 1); daccess_stack_head = 0; /* fuzzy variables initialization */ /* """""""""""""""""""""""""""""" */ tst_search_list = ll_new(); ll_append(tst_search_list, sub_tst_new()); matching_words_a_size = 64; matching_words_a = xmalloc(matching_words_a_size * sizeof(long)); matches_count = 0; best_matching_words_a_size = 16; best_matching_words_a = xmalloc(best_matching_words_a_size * sizeof(long)); best_matches_count = 0; /* Initialize the tag hit number which will permit to sort the */ /* pinned words when displayed. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ long next_tag_nb = 0; /* Columns selection variables */ /* """"""""""""""""""""""""""" */ char * cols_filter = NULL; /* Get the current locale */ /* """""""""""""""""""""" */ setlocale(LC_ALL, ""); charset = nl_langinfo(CODESET); /* Check if the local charset is supported */ /* """"""""""""""""""""""""""""""""""""""" */ is_supported_charset = 0; charset_ptr = all_supported_charsets; /* Count of the words currently tagged */ /* """"""""""""""""""""""""""""""""""" */ long tagged_words = 0; while (charset_ptr->name != NULL) { if (my_strcasecmp(charset, charset_ptr->name) == 0) { is_supported_charset = 1; langinfo.bits = charset_ptr->bits; break; } charset_ptr++; } if (!is_supported_charset) { fprintf(stderr, "%s is not a supported charset.", charset); exit(EXIT_FAILURE); } if (strcmp(charset, "UTF-8") == 0) langinfo.utf8 = 1; else langinfo.utf8 = 0; /* my_isprint is a function pointer that points to the 7 or 8-bit */ /* version of isprint according to the content of UTF-8 */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (langinfo.utf8 || langinfo.bits == 8) my_isprint = isprint8; else my_isprint = isprint7; /* Set terminal in noncanonical, noecho mode and */ /* if TERM is unset or unknown, vt100 is assumed. */ /* """""""""""""""""""""""""""""""""""""""""""""" */ if (getenv("TERM") == NULL) setupterm("vt100", 1, (int *)0); else setupterm((char *)0, 1, (int *)0); /* Get some terminal capabilities */ /* """""""""""""""""""""""""""""" */ if (getenv("NO_COLOR") != NULL) term.colors = 0; else { term.colors = tigetnum("colors"); if (term.colors < 0) term.colors = 0; } /* Set the default timeout to 0: no expiration */ /* """"""""""""""""""""""""""""""""""""""""""" */ timeout.initial_value = 0; timeout.remain = 0; timeout.reached = 0; daccess.mode = DA_TYPE_NONE; daccess.left = xstrdup(" "); daccess.right = xstrdup(")"); daccess.alignment = 'r'; daccess.padding = 'a'; daccess.head = 'k'; /* keep by default */ daccess.length = -2; daccess.flength = 0; daccess.offset = 0; daccess.plus = 0; daccess.size = 0; daccess.ignore = 0; daccess.follow = 'y'; daccess.num_sep = NULL; daccess.def_number = -1; /* Allowed command line options */ /* """""""""""""""""""""""""""" */ static char * optstring = "Vf:h?X:x:qdMba:i:e:S:I:E:A:Z:1:2:3:4:5:C:R:" "kvclwrg%n%t%m:s:W:L:T%P%pN%U%FD:/:"; /* Command line options analysis */ /* """"""""""""""""""""""""""""" */ while ((opt = egetopt(argc, argv, optstring)) != -1) { switch (opt) { case 'V': fputs("Version: " VERSION "\n", stdout); exit(EXIT_SUCCESS); case 'f': if (eoptarg && *eoptarg != '-') custom_ini_file = xstrdup(eoptarg); else { TELL("Option requires an argument -- "); short_usage(1); } break; case 'n': if (eoptarg != NULL) { if (sscanf(eoptarg, "%ld", &(win.asked_max_lines)) != 1) { TELL("Argument must be numeric -- "); short_usage(1); } } else win.asked_max_lines = 0; break; case 'd': toggle.del_line = 1; break; case 'M': win.center = 1; break; case 's': if (eoptarg && *eoptarg != '-') { pre_selection_index = xstrdup(eoptarg); utf8_interpret(pre_selection_index, &langinfo); } else { TELL("Option requires an argument -- "); short_usage(1); } break; case 't': if (eoptarg != NULL) { if (sscanf(eoptarg, "%ld", &(win.max_cols)) != 1) { TELL("Argument must be numeric -- "); short_usage(1); } if (win.max_cols < 1) { TELL("Argument must be at least 1 -- "); short_usage(1); } } win.tab_mode = 1; win.col_mode = 0; win.line_mode = 0; break; case 'k': toggle.keep_spaces = 1; break; case 'v': toggle.visual_bell = 1; break; case 'c': win.tab_mode = 0; win.col_mode = 1; win.line_mode = 0; win.max_cols = 0; break; case 'l': win.line_mode = 1; win.tab_mode = 0; win.col_mode = 0; win.max_cols = 0; break; case 'g': if (win.col_sep) break; if (eoptarg == NULL) { win.gutter_a = xmalloc(1 * sizeof(char *)); if (langinfo.utf8) win.gutter_a[0] = xstrdup(vertical_bar); else win.gutter_a[0] = xstrdup("|"); win.gutter_nb = 1; } else { long n; wchar_t * w; long i, offset; int mblen; char * gutter; gutter = xstrdup(eoptarg); utf8_interpret(gutter, &langinfo); /* Guarantees a well formed * * UTF-8 string */ win.gutter_nb = utf8_strlen(gutter); win.gutter_a = xmalloc(win.gutter_nb * sizeof(char *)); offset = 0; for (i = 0; i < win.gutter_nb; i++) { mblen = utf8_get_length(*(gutter + offset)); win.gutter_a[i] = xcalloc(1, mblen + 1); memcpy(win.gutter_a[i], gutter + offset, mblen); n = wcswidth((w = utf8_strtowcs(win.gutter_a[i])), 1); free(w); if (n > 1) { long j; for (j = 0; j <= i; j++) free(win.gutter_a[j]); free(win.gutter_a); free(gutter); TELL("A multi columns gutter is not allowed -- "); short_usage(1); } offset += mblen; } free(gutter); } win.col_sep = 1; break; case 'w': win.wide = 1; break; case 'm': if (eoptarg && *eoptarg != '-') { message = xstrdup(eoptarg); if (!langinfo.utf8) utf8_sanitize(message); utf8_interpret(message, &langinfo); } else { TELL("Option requires an argument -- "); short_usage(1); } break; case 'r': toggle.enter_val_in_search = 1; break; case 'b': toggle.blank_nonprintable = 1; break; case 'i': if (eoptarg && *eoptarg != '-') { /* Set the default behaviour if not already set */ /* """""""""""""""""""""""""""""""""""""""""""" */ if (pattern_def_include == -1) pattern_def_include = 0; if (include_pattern == NULL) include_pattern = concat("(", eoptarg, ")", NULL); else include_pattern = concat(include_pattern, "|(", eoptarg, ")", NULL); } else { TELL("Option requires an argument -- "); short_usage(1); } break; case 'e': if (eoptarg && *eoptarg != '-') { /* Set the default behaviour if not already set */ /* """""""""""""""""""""""""""""""""""""""""""" */ if (pattern_def_include == -1) pattern_def_include = 1; if (exclude_pattern == NULL) exclude_pattern = concat("(", eoptarg, ")", NULL); else exclude_pattern = concat(exclude_pattern, "|(", eoptarg, ")", NULL); } else { TELL("Option requires an argument -- "); short_usage(1); } break; case 'C': if (eoptarg && *eoptarg != '-') { if (cols_selector_list == NULL) cols_selector_list = ll_new(); ll_append(cols_selector_list, xstrdup(eoptarg)); } else { TELL("Option requires an argument -- "); short_usage(1); } break; case 'R': if (eoptarg && *eoptarg != '-') { if (rows_selector_list == NULL) rows_selector_list = ll_new(); ll_append(rows_selector_list, xstrdup(eoptarg)); win.max_cols = 0; } else { TELL("Option requires an argument -- "); short_usage(1); } break; case 'S': if (eoptarg && *eoptarg != '-') { sed_t * sed_node; if (sed_list == NULL) sed_list = ll_new(); sed_node = xmalloc(sizeof(sed_t)); sed_node->pattern = xstrdup(eoptarg); utf8_interpret(sed_node->pattern, &langinfo); sed_node->stop = 0; ll_append(sed_list, sed_node); } else { TELL("Option requires an argument -- "); short_usage(1); } break; case 'I': if (eoptarg && *eoptarg != '-') { sed_t * sed_node; if (include_sed_list == NULL) include_sed_list = ll_new(); sed_node = xmalloc(sizeof(sed_t)); sed_node->pattern = xstrdup(eoptarg); utf8_interpret(sed_node->pattern, &langinfo); sed_node->stop = 0; ll_append(include_sed_list, sed_node); } else { TELL("Option requires an argument -- "); short_usage(1); } break; case 'E': if (eoptarg && *eoptarg != '-') { sed_t * sed_node; if (exclude_sed_list == NULL) exclude_sed_list = ll_new(); sed_node = xmalloc(sizeof(sed_t)); sed_node->pattern = xstrdup(eoptarg); utf8_interpret(sed_node->pattern, &langinfo); sed_node->stop = 0; ll_append(exclude_sed_list, sed_node); } else { TELL("Option requires an argument -- "); short_usage(1); } break; case '1': case '2': case '3': case '4': case '5': if (eoptarg && *eoptarg != '-') { long count = 1; attr_t attr = init_attr; special_pattern[opt - '1'] = xstrdup(eoptarg); utf8_interpret(special_pattern[opt - '1'], &langinfo); /* Parse optional additional arguments */ /* """"""""""""""""""""""""""""""""""" */ while (argv[eoptind] && *argv[eoptind] != '-') { if (count > 2) { TELL("Too many arguments -- "); short_usage(1); } /* Colors must respect the format: / */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""" */ if (parse_attr(argv[eoptind], &attr, term.colors)) { win.special_attr[opt - '1'].is_set = FORCED; win.special_attr[opt - '1'].fg = attr.fg; win.special_attr[opt - '1'].bg = attr.bg; win.special_attr[opt - '1'].bold = attr.bold; win.special_attr[opt - '1'].dim = attr.dim; win.special_attr[opt - '1'].reverse = attr.reverse; win.special_attr[opt - '1'].standout = attr.standout; win.special_attr[opt - '1'].underline = attr.underline; win.special_attr[opt - '1'].italic = attr.italic; } else { TELL("Bad optional color settings -- "); short_usage(1); } eoptind++; count++; } } else { TELL("Option requires an argument -- "); short_usage(1); } break; case 'a': if (eoptarg && *eoptarg != '-') { long i; /* loop index */ long offset = 0; /* nb of chars to ship to find the attribute * * representation (prefix size) */ attr_t attr; attr_t * attr_to_set = NULL; /* Flags to check if an attribute is already set */ /* """"""""""""""""""""""""""""""""""""""""""""" */ int inc_attr_set = 0; /* included words */ int exc_attr_set = 0; /* excluded words */ int cur_attr_set = 0; /* highlighted word (cursor) */ int bar_attr_set = 0; /* scroll bar */ int shift_attr_set = 0; /* hor. scrolling arrows */ int message_attr_set = 0; /* message (title) */ int tag_attr_set = 0; /* selected (tagged) words */ int cursor_on_tag_attr_set = 0; /* selected words under the cursor */ int sf_attr_set = 0; /* currently searched field color */ int st_attr_set = 0; /* currently searched text color */ int mf_attr_set = 0; /* matching word field color */ int mt_attr_set = 0; /* matching word text color */ int daccess_attr_set = 0; /* Direct access text color */ /* Information relatives to the attributes to be searched and * set */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ struct { attr_t * attr; char * msg; int * flag; char * prefix; int prefix_len; } attr_infos[] = { { &win.exclude_attr, "The exclude attribute is already set -- ", &exc_attr_set, "e:", 2 }, { &win.include_attr, "The include attribute is already set -- ", &inc_attr_set, "i:", 2 }, { &win.cursor_attr, "The cursor attribute is already set -- ", &cur_attr_set, "c:", 2 }, { &win.bar_attr, "The scroll bar attribute is already set -- ", &bar_attr_set, "b:", 2 }, { &win.shift_attr, "The shift attribute is already set -- ", &shift_attr_set, "s:", 2 }, { &win.message_attr, "The message attribute is already set -- ", &message_attr_set, "m:", 2 }, { &win.tag_attr, "The tag attribute is already set -- ", &tag_attr_set, "t:", 2 }, { &win.cursor_on_tag_attr, "The cursor on tagged word attribute is already set -- ", &cursor_on_tag_attr_set, "ct:", 3 }, { &win.search_field_attr, "The search field attribute is already set -- ", &sf_attr_set, "sf:", 3 }, { &win.search_text_attr, "The search text attribute is already set -- ", &st_attr_set, "st:", 3 }, { &win.search_err_field_attr, "The search with error field attribute is already set -- ", &sf_attr_set, "sfe:", 4 }, { &win.search_err_text_attr, "The search text with error attribute is already set -- ", &st_attr_set, "ste:", 4 }, { &win.match_field_attr, "The matching word field attribute is already set -- ", &mf_attr_set, "mf:", 3 }, { &win.match_text_attr, "The matching word text attribute is already set -- ", &mt_attr_set, "mt:", 3 }, { &win.match_err_field_attr, "The matching word with error field attribute is already set " "-- ", &mf_attr_set, "mfe:", 4 }, { &win.match_err_text_attr, "The matching word with error text attribute is already set " "-- ", &mt_attr_set, "mte:", 4 }, { &win.daccess_attr, "The direct access tag attribute is already set -- ", &daccess_attr_set, "da:", 3 }, { NULL, NULL, NULL, NULL, 0 } }; eoptind--; if (*argv[eoptind] == '-') { TELL("A blank is required before the first sub-option -- "); short_usage(1); } /* Parse the arguments arguments */ /* """"""""""""""""""""""""""""" */ while (argv[eoptind] && *argv[eoptind] != '-') { attr = init_attr; if (strlen(argv[eoptind]) < 3) { TELL("Empty attribute value -- "); short_usage(1); } i = 0; while (attr_infos[i].flag != NULL) { if (strncmp(argv[eoptind], attr_infos[i].prefix, attr_infos[i].prefix_len) == 0) { if (*attr_infos[i].flag) { TELL(attr_infos[i].msg); short_usage(1); } attr_to_set = attr_infos[i].attr; *attr_infos[i].flag = 1; offset = attr_infos[i].prefix_len; break; /* We have found a matching prefix, * * no need to continue */ } i++; } if (attr_infos[i].flag == NULL) { TELL("Bad attribute prefix -- "); short_usage(1); } /* Attributes must respect the format: */ /* /, */ /* """"""""""""""""""""""""""""""""""" */ if (parse_attr(argv[eoptind] + offset, &attr, term.colors)) { attr_to_set->is_set = FORCED; attr_to_set->fg = attr.fg; attr_to_set->bg = attr.bg; attr_to_set->bold = attr.bold; attr_to_set->dim = attr.dim; attr_to_set->reverse = attr.reverse; attr_to_set->standout = attr.standout; attr_to_set->underline = attr.underline; attr_to_set->italic = attr.italic; } else { TELL("Bad attribute settings -- "); short_usage(1); } eoptind++; } } else { TELL("Option requires an argument -- "); short_usage(1); } break; case 'X': quiet_timeout = 1; case 'x': if (eoptarg && *eoptarg != '-') { if (strprefix("current", eoptarg)) timeout.mode = CURRENT; else if (strprefix("quit", eoptarg)) timeout.mode = QUIT; else if (strprefix("word", eoptarg)) { if (argv[eoptind] && *argv[eoptind] != '-') { timeout.mode = WORD; timeout_word = argv[eoptind]; utf8_interpret(timeout_word, &langinfo); eoptind++; } else { TELL("Missing timeout word -- "); short_usage(1); } } else { TELL("Invalid timeout type -- "); short_usage(1); } if (argv[eoptind] && *argv[eoptind] != '-') { if (sscanf(argv[eoptind], "%5u", &timeout.initial_value) == 1) { timeout.initial_value *= FREQ; timeout.remain = timeout.initial_value; } else { TELL("Invalid timeout delay -- "); short_usage(1); } } else { TELL("Missing timeout delay -- "); short_usage(1); } eoptind++; } break; case 'q': toggle.no_scrollbar = 1; break; case 'A': if (eoptarg && *eoptarg != '-') { first_word_pattern = xstrdup(eoptarg); utf8_interpret(first_word_pattern, &langinfo); } else { TELL("Option requires an argument -- "); short_usage(1); } break; case 'Z': if (eoptarg && *eoptarg != '-') { last_word_pattern = xstrdup(eoptarg); utf8_interpret(last_word_pattern, &langinfo); } else { TELL("Option requires an argument -- "); short_usage(1); } break; case 'W': if (eoptarg && *eoptarg != '-') { iws = xstrdup(eoptarg); utf8_interpret(iws, &langinfo); } else { TELL("Option requires an argument -- "); short_usage(1); } break; case 'L': if (eoptarg && *eoptarg != '-') { ils = xstrdup(eoptarg); utf8_interpret(ils, &langinfo); } else { TELL("Option requires an argument -- "); short_usage(1); } break; case 'P': toggle.pinable = 1; case 'T': toggle.taggable = 1; if (eoptarg != NULL) { win.sel_sep = xstrdup(eoptarg); utf8_interpret(win.sel_sep, &langinfo); } break; case 'p': toggle.autotag = 1; break; case 'D': if (eoptarg && *eoptarg != '-') { int pos; wchar_t * w; int n; /* Parse optional additional arguments */ /* """"""""""""""""""""""""""""""""""" */ eoptind--; if (*argv[eoptind] == '-') { TELL("A blank is required before the first sub-option -- "); short_usage(1); } while (argv[eoptind] && *argv[eoptind] != '-') { if (argv[eoptind][1] != ':') { TELL("Bad format -- "); short_usage(1); } switch (*(argv[eoptind])) { case 'l': /* left char */ free(daccess.left); daccess.left = xstrdup(argv[eoptind] + 2); utf8_interpret(daccess.left, &langinfo); if (utf8_strlen(daccess.left) != 1) { TELL("Too many characters after l: -- "); short_usage(1); } n = wcswidth((w = utf8_strtowcs(daccess.left)), 1); free(w); if (n > 1) { TELL("A multi columns character is not allowed " "after l: -- "); short_usage(1); } break; case 'r': /* right char */ free(daccess.right); daccess.right = xstrdup(argv[eoptind] + 2); utf8_interpret(daccess.right, &langinfo); if (utf8_strlen(daccess.right) != 1) { TELL("Too many characters after r: -- "); short_usage(1); } n = wcswidth((w = utf8_strtowcs(daccess.right)), 1); free(w); if (n > 1) { TELL("A multi columns character is not allowed " "after r: -- "); short_usage(1); } break; case 'a': /* alignment */ if (strprefix("left", argv[eoptind] + 2)) daccess.alignment = 'l'; else if (strprefix("right", argv[eoptind] + 2)) daccess.alignment = 'r'; else { TELL("Bad format -- "); short_usage(1); } break; case 'p': /* padding */ if (strprefix("all", argv[eoptind] + 2)) daccess.padding = 'a'; else if (strprefix("included", argv[eoptind] + 2)) daccess.padding = 'i'; else { TELL("Bad format -- "); short_usage(1); } break; case 'w': /* width */ if (sscanf(argv[eoptind] + 2, "%d%n", &daccess.length, &pos) != 1) { TELL("Bad format -- "); short_usage(1); } if (argv[eoptind][pos + 2] != '\0') { TELL("Bad format -- "); short_usage(1); } if (daccess.length <= 0 || daccess.length > 5) { TELL("w suboption must be between 1 and 5 -- "); short_usage(1); } break; case 'o': /* start offset */ if (sscanf(argv[eoptind] + 2, "%zu%n+", &daccess.offset, &pos) == 1) { if (argv[eoptind][pos + 2] == '+') { daccess.plus = 1; if (argv[eoptind][pos + 3] != '\0') { TELL("Bad format -- "); short_usage(1); } } else if (argv[eoptind][pos + 2] != '\0') { TELL("Bad format -- "); short_usage(1); } } else { TELL("Bad format -- "); short_usage(1); } break; case 'n': /* number of digits to extract */ if (sscanf(argv[eoptind] + 2, "%d%n", &daccess.size, &pos) != 1) { TELL("Bad format -- "); short_usage(1); } if (argv[eoptind][pos + 2] != '\0') { TELL("Bad format -- "); short_usage(1); } if (daccess.size <= 0 || daccess.size > 5) { TELL("n suboption must be between 1 and 5 -- "); short_usage(1); } break; case 'i': /* Number of UTF-8 glyphs to ignore after the * * selector to extract */ if (sscanf(argv[eoptind] + 2, "%zu%n", &daccess.ignore, &pos) != 1) { TELL("Bad format -- "); short_usage(1); } if (argv[eoptind][pos + 2] != '\0') { TELL("Bad format -- "); short_usage(1); } break; case 'f': /* follow */ if (strprefix("yes", argv[eoptind] + 2)) daccess.follow = 'y'; else if (strprefix("no", argv[eoptind] + 2)) daccess.follow = 'n'; else { TELL("Bad format -- "); short_usage(1); } break; case 'd': /* decorate */ free(daccess.num_sep); daccess.num_sep = xstrdup(argv[eoptind] + 2); utf8_interpret(daccess.num_sep, &langinfo); if (utf8_strlen(daccess.num_sep) != 1) { TELL("Too many characters after d: -- "); short_usage(1); } n = wcswidth((w = utf8_strtowcs(daccess.num_sep)), 1); free(w); if (n > 1) { TELL("A multi columns separator is not allowed " "after d: -- "); short_usage(1); } break; case 's': /* start index */ { long pos; if (sscanf(argv[eoptind] + 2, "%ld%ln", &daccess_index, &pos) == 1) { if (daccess_index < 0 || *(argv[eoptind] + 2 + pos) != '\0') daccess_index = 1; } else { TELL("Invalid first index after s: -- "); short_usage(1); } } break; case 'h': /* head */ if (strprefix("trim", argv[eoptind] + 2)) daccess.head = 't'; else if (strprefix("cut", argv[eoptind] + 2)) daccess.head = 'c'; else if (strprefix("keep", argv[eoptind] + 2)) daccess.head = 'k'; else { TELL("Bad format -- "); short_usage(1); } break; default: { TELL("Bad format -- "); short_usage(1); } } if (daccess.length <= 0 || daccess.length > 5) daccess.length = -2; /* special value -> auto */ eoptind++; } } else { TELL("Option requires an argument -- "); short_usage(1); } break; case 'N': if (eoptarg == NULL) eoptarg = "."; else if (*eoptarg == '\0') eoptarg = "."; if (daccess_np == NULL) { daccess_np = concat("(", eoptarg, ")", NULL); daccess.mode |= DA_TYPE_AUTO; /* auto */ } else daccess_np = concat(daccess_np, "|(", eoptarg, ")", NULL); if (daccess.def_number < 0) daccess.def_number = 0; break; case 'U': if (eoptarg == NULL) eoptarg = "."; else if (*eoptarg == '\0') eoptarg = "."; if (daccess_up == NULL) { daccess_up = concat("(", eoptarg, ")", NULL); daccess.mode |= DA_TYPE_AUTO; /* auto */ } else daccess_up = concat(daccess_up, "|(", eoptarg, ")", NULL); if (daccess.def_number < 0) daccess.def_number = 1; break; case 'F': daccess.mode |= DA_TYPE_POS; break; case '/': if (strprefix("prefix", eoptarg)) misc.default_search_method = PREFIX; else if (strprefix("fuzzy", eoptarg)) misc.default_search_method = FUZZY; else if (strprefix("substring", eoptarg)) misc.default_search_method = SUBSTRING; else { TELL("Bad format -- "); short_usage(1); } break; case '?': short_usage(1); case 'h': usage(); case BADCH: short_usage(1); default: exit(EXIT_FAILURE); } eoptarg = NULL; } if (eoptind < argc) { if (argv[argc - 1][0] == '-') { fprintf(stderr, "Not an option -- %s\n", argv[argc - 1]); short_usage(1); exit(EXIT_FAILURE); } input_file = fopen(argv[argc - 1], "r"); if (input_file == NULL) { fprintf(stderr, "Cannot open \"%s\"\n", argv[argc - 1]); short_usage(1); exit(EXIT_FAILURE); } } else input_file = stdin; /* Replace the UTF-8 ASCII representations by their binary values in */ /* the inclusion and exclusion patterns. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (include_pattern != NULL) utf8_interpret(include_pattern, &langinfo); if (exclude_pattern != NULL) utf8_interpret(exclude_pattern, &langinfo); /* Force the right modes when the -C option is given */ /* """"""""""""""""""""""""""""""""""""""""""""""""" */ if (cols_selector_list) { if (win.tab_mode || win.col_mode || win.line_mode) win.tab_mode = 0; win.col_mode = 1; } /* Force the right modes when the -R option is given */ /* """"""""""""""""""""""""""""""""""""""""""""""""" */ if (rows_selector_list) { if (win.tab_mode) win.tab_mode = 0; if (!win.col_mode && !win.line_mode) win.line_mode = 1; } /* If we did not impose the number of columns, use the whole terminal width */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (win.tab_mode && !win.max_cols) win.wide = 1; /* Disable the wide mode if not in column mode and not in tab mode */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (!win.tab_mode && !win.col_mode) win.wide = 0; win.start = 0; void sig_handler(int s); /* Ignore SIGTTIN and SIGINT */ /* """"""""""""""""""""""""" */ sigset_t sigs, oldsigs; sigemptyset(&sigs); sigaddset(&sigs, SIGTTIN); sigaddset(&sigs, SIGINT); sigprocmask(SIG_BLOCK, &sigs, &oldsigs); sa.sa_handler = sig_handler; sa.sa_flags = 0; sigemptyset(&sa.sa_mask); sigaction(SIGWINCH, &sa, NULL); sigaction(SIGALRM, &sa, NULL); sigaction(SIGTERM, &sa, NULL); sigaction(SIGHUP, &sa, NULL); sigaction(SIGSEGV, &sa, NULL); term.color_method = 1; /* we default to setaf/setbf to set colors */ term.curs_line = term.curs_column = 0; { char * str; str = tigetstr("cuu1"); term.has_cursor_up = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("cud1"); term.has_cursor_down = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("cub1"); term.has_cursor_left = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("cuf1"); term.has_cursor_right = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("cup"); term.has_cursor_address = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("sc"); term.has_save_cursor = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("rc"); term.has_restore_cursor = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("setf"); term.has_setf = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("setb"); term.has_setb = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("setaf"); term.has_setaf = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("setab"); term.has_setab = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("hpa"); term.has_hpa = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("cuf"); term.has_parm_right_cursor = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("bold"); term.has_bold = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("dim"); term.has_dim = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("rev"); term.has_reverse = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("smul"); term.has_underline = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("smso"); term.has_standout = (str == (char *)-1 || str == NULL) ? 0 : 1; str = tigetstr("sitm"); term.has_italic = (str == (char *)-1 || str == NULL) ? 0 : 1; } if (!term.has_cursor_up || !term.has_cursor_down || !term.has_cursor_left || !term.has_cursor_right || !term.has_save_cursor || !term.has_restore_cursor) { fprintf(stderr, "The terminal does not have the required cursor " "management capabilities.\n"); exit(EXIT_FAILURE); } /* Get the number of lines/columns of the terminal */ /* """"""""""""""""""""""""""""""""""""""""""""""" */ get_terminal_size(&term.nlines, &term.ncolumns); if (custom_ini_file != NULL) { if (ini_load(custom_ini_file, &win, &term, &limits, &timers, &misc, ini_cb)) exit(EXIT_FAILURE); } else { /* Build the full path of the .ini file */ /* """""""""""""""""""""""""""""""""""" */ home_ini_file = make_ini_path(argv[0], "HOME"); local_ini_file = make_ini_path(argv[0], "PWD"); /* Set the attributes from the configuration file if possible */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (ini_load(home_ini_file, &win, &term, &limits, &timers, &misc, ini_cb)) exit(EXIT_FAILURE); if (ini_load(local_ini_file, &win, &term, &limits, &timers, &misc, ini_cb)) exit(EXIT_FAILURE); free(home_ini_file); free(local_ini_file); } word_buffer = xcalloc(1, daccess.flength + limits.word_length + 1); /* default_search_method is not set in the command line nor in a config */ /* file, set it to fuzzy. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (misc.default_search_method == NONE) misc.default_search_method = FUZZY; /* If some attributes were not set, set their default values */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (term.colors > 7) { int def_attr[5] = { 1, 2, 3, 5, 6 }; if (!win.cursor_attr.is_set) { if (term.has_reverse) win.cursor_attr.reverse = 1; else if (term.has_standout) win.cursor_attr.standout = 1; else { win.cursor_attr.fg = 0; win.cursor_attr.bg = 1; } win.cursor_attr.is_set = SET; } if (!win.cursor_on_tag_attr.is_set) { if (term.has_reverse) win.cursor_on_tag_attr.reverse = 1; if (term.has_underline) win.cursor_on_tag_attr.underline = 1; else win.cursor_on_tag_attr.fg = 2; win.cursor_on_tag_attr.is_set = SET; } if (!win.bar_attr.is_set) { win.bar_attr.fg = 2; win.bar_attr.is_set = SET; } if (!win.shift_attr.is_set) { if (term.has_bold) win.shift_attr.bold = 1; else win.shift_attr.fg = 4; win.shift_attr.is_set = SET; } if (!win.message_attr.is_set) { if (term.has_bold) win.message_attr.bold = 1; else if (term.has_reverse) win.message_attr.reverse = 1; else { win.message_attr.fg = 0; win.message_attr.bg = 7; } win.message_attr.is_set = SET; } if (!win.search_field_attr.is_set) { win.search_field_attr.bg = 5; win.search_field_attr.is_set = SET; } if (!win.search_text_attr.is_set) { win.search_text_attr.fg = 0; win.search_text_attr.bg = 6; win.search_text_attr.is_set = SET; } if (!win.search_err_field_attr.is_set) { win.search_err_field_attr.bg = 1; win.search_err_field_attr.is_set = SET; } if (!win.search_err_text_attr.is_set) { if (term.has_reverse) win.search_err_text_attr.reverse = 1; win.search_err_text_attr.fg = 1; win.search_err_text_attr.is_set = SET; } if (!win.match_field_attr.is_set) { win.match_field_attr.is_set = SET; } if (!win.match_text_attr.is_set) { win.match_text_attr.fg = 5; win.match_text_attr.is_set = SET; } if (!win.match_err_field_attr.is_set) { win.match_err_field_attr.is_set = SET; } if (!win.match_err_text_attr.is_set) { win.match_err_text_attr.fg = 1; win.match_err_text_attr.is_set = SET; } if (!win.exclude_attr.is_set) { win.exclude_attr.fg = 6; win.exclude_attr.is_set = SET; } /* This attribute should complete the attributes already set */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (!win.tag_attr.is_set) { if (term.has_underline) win.tag_attr.underline = 1; else if (term.has_bold) win.tag_attr.bold = 1; else win.tag_attr.fg = 2; win.tag_attr.is_set = SET; } if (!win.daccess_attr.is_set) { if (term.has_bold) win.daccess_attr.bold = 1; win.daccess_attr.is_set = SET; } for (index = 0; index < 5; index++) { if (!win.special_attr[index].is_set) { win.special_attr[index].fg = def_attr[index]; win.special_attr[index].is_set = SET; } } } else { if (!win.cursor_attr.is_set) { if (term.has_reverse) win.cursor_attr.reverse = 1; win.cursor_attr.is_set = SET; } if (!win.cursor_on_tag_attr.is_set) { if (term.has_reverse) win.cursor_on_tag_attr.reverse = 1; if (term.has_underline) win.cursor_on_tag_attr.underline = 1; else if (term.has_bold) win.cursor_on_tag_attr.bold = 1; win.cursor_on_tag_attr.is_set = SET; } if (!win.bar_attr.is_set) { if (term.has_bold) win.bar_attr.bold = 1; win.bar_attr.is_set = SET; } if (!win.shift_attr.is_set) { if (term.has_reverse) win.shift_attr.reverse = 1; win.shift_attr.is_set = SET; } if (!win.message_attr.is_set) { if (term.has_bold) win.message_attr.bold = 1; else if (term.has_reverse) win.message_attr.reverse = 1; win.message_attr.is_set = SET; } if (!win.search_field_attr.is_set) { if (term.has_reverse) win.search_field_attr.reverse = 1; win.search_field_attr.is_set = SET; } if (!win.search_text_attr.is_set) { if (term.has_bold) win.search_text_attr.bold = 1; win.search_text_attr.is_set = SET; } if (!win.search_err_field_attr.is_set) { if (term.has_bold) win.search_err_field_attr.bold = 1; win.search_err_field_attr.is_set = SET; } if (!win.search_err_text_attr.is_set) { if (term.has_reverse) win.search_err_text_attr.reverse = 1; win.search_err_text_attr.is_set = SET; } if (!win.match_field_attr.is_set) { if (term.has_bold) win.match_field_attr.bold = 1; else if (term.has_reverse) win.match_field_attr.reverse = 1; win.match_field_attr.is_set = SET; } if (!win.match_text_attr.is_set) { if (term.has_reverse) win.match_text_attr.reverse = 1; else if (term.has_bold) win.match_text_attr.bold = 1; win.match_text_attr.is_set = SET; } if (!win.exclude_attr.is_set) { if (term.has_dim) win.exclude_attr.dim = 1; else if (term.has_italic) win.exclude_attr.italic = 1; else if (term.has_bold) win.exclude_attr.bold = 1; win.exclude_attr.is_set = SET; } if (!win.tag_attr.is_set) { if (term.has_underline) win.tag_attr.underline = 1; else if (term.has_standout) win.tag_attr.standout = 1; else if (term.has_reverse) win.tag_attr.reverse = 1; win.tag_attr.is_set = SET; } if (!win.daccess_attr.is_set) { if (term.has_bold) win.daccess_attr.bold = 1; win.daccess_attr.is_set = SET; } for (index = 0; index < 5; index++) { if (!win.special_attr[index].is_set) { if (term.has_bold) win.special_attr[index].bold = 1; else if (term.has_standout) win.special_attr[index].standout = 1; win.special_attr[index].is_set = SET; } } } /* Initialize the timeout message when the x/X option is set */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (!quiet_timeout && timeout.initial_value > 0) { switch (timeout.mode) { case QUIT: timeout_message = xstrdup( "[ s before quitting without selecting anything]"); break; case CURRENT: timeout_message = xstrdup( "[ s before selecting the current highlighted word]"); break; case WORD: timeout_message = xcalloc(1, 4 + strlen( "[ s before selecting the word ") + strlen(timeout_word)); strcpy(timeout_message, "[ s before selecting the word \""); strcat(timeout_message, timeout_word); strcat(timeout_message, "\"]"); break; default: /* The other cases are impossible due to options analysis */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''''' */ timeout_message = xstrdup(" "); /* Just in case. */ } timeout_seconds = xcalloc(1, 6); sprintf(timeout_seconds, "%5u", timeout.initial_value / FREQ); memcpy(timeout_message + 1, timeout_seconds, 5); message_lines_list = ll_new(); if (message) { long len; get_message_lines(message, message_lines_list, &message_max_width, &message_max_len); ll_append(message_lines_list, timeout_message); if ((len = strlen(timeout_message)) > message_max_len) message_max_len = message_max_width = len; } else { ll_append(message_lines_list, timeout_message); message_max_len = message_max_width = strlen(timeout_message); } } else if (message) { message_lines_list = ll_new(); get_message_lines(message, message_lines_list, &message_max_width, &message_max_len); } /* Force the maximum number of window's line if -n is used */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (term.nlines <= win.message_lines) win.max_lines = 0; else if (win.asked_max_lines >= 0) { if (win.asked_max_lines == 0) win.max_lines = term.nlines - win.message_lines; else { if (win.asked_max_lines > term.nlines - win.message_lines) win.max_lines = term.nlines - win.message_lines; else win.max_lines = win.asked_max_lines; } } else win.asked_max_lines = win.max_lines; /* Allocate the memory for our words structures */ /* """""""""""""""""""""""""""""""""""""""""""" */ word_a = xmalloc(WORDSCHUNK * sizeof(word_t)); /* Fill an array of word_t elements obtained from stdin */ /* """""""""""""""""""""""""""""""""""""""""""""""""""" */ tab_real_max_size = 0; tab_max_size = 0; min_size = 0; /* Parse the word separators string (option -W). If it is empty then */ /* the standard delimiters (space, tab and EOL) are used. Each of its */ /* UTF-8 sequences are stored in a linked list. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ word_delims_list = ll_new(); if (iws == NULL) { ll_append(word_delims_list, " "); ll_append(word_delims_list, "\t"); ll_append(word_delims_list, "\n"); } else { int utf8_len; char * iws_ptr = iws; char * tmp; utf8_len = mblen(iws_ptr, 4); while (utf8_len != 0) { tmp = xmalloc(utf8_len + 1); memcpy(tmp, iws_ptr, utf8_len); tmp[utf8_len] = '\0'; ll_append(word_delims_list, tmp); iws_ptr += utf8_len; utf8_len = mblen(iws_ptr, 4); } } /* Parse the line separators string (option -L). If it is empty then */ /* the standard delimiter (newline) is used. Each of its UTF-8 */ /* sequences are stored in a linked list. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ record_delims_list = ll_new(); if (ils == NULL) ll_append(record_delims_list, "\n"); else { int utf8_len; char * ils_ptr = ils; char * tmp; utf8_len = mblen(ils_ptr, 4); while (utf8_len != 0) { tmp = xmalloc(utf8_len + 1); memcpy(tmp, ils_ptr, utf8_len); tmp[utf8_len] = '\0'; ll_append(record_delims_list, tmp); /* Add this record delimiter as a word delimiter */ /* """"""""""""""""""""""""""""""""""""""""""""" */ if (ll_find(word_delims_list, tmp, delims_cmp) == NULL) ll_append(word_delims_list, tmp); ils_ptr += utf8_len; utf8_len = mblen(ils_ptr, 4); } } /* Initialize the first chunks of the arrays which will contain the */ /* maximum length of each column in column mode */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (win.col_mode) { long ci; /* column index */ col_real_max_size = xmalloc(COLSCHUNK * sizeof(long)); col_max_size = xmalloc(COLSCHUNK * sizeof(long)); for (ci = 0; ci < COLSCHUNK; ci++) col_real_max_size[ci] = col_max_size[ci] = 0; col_index = cols_number = 0; } /* Compile the regular expression patterns */ /* """"""""""""""""""""""""""""""""""""""" */ if (daccess_np && regcomp(&daccess_np_re, daccess_np, REG_EXTENDED | REG_NOSUB) != 0) { fprintf(stderr, "Bad regular expression: %s.\n", daccess_np); exit(EXIT_FAILURE); } if (daccess_up && regcomp(&daccess_up_re, daccess_up, REG_EXTENDED | REG_NOSUB) != 0) { fprintf(stderr, "Bad regular expression: %s.\n", daccess_up); exit(EXIT_FAILURE); } if (include_pattern && regcomp(&include_re, include_pattern, REG_EXTENDED | REG_NOSUB) != 0) { fprintf(stderr, "Bad regular expression: %s.\n", include_pattern); exit(EXIT_FAILURE); } if (exclude_pattern && regcomp(&exclude_re, exclude_pattern, REG_EXTENDED | REG_NOSUB) != 0) { fprintf(stderr, "Bad regular expression: %s.\n", exclude_pattern); exit(EXIT_FAILURE); } if (first_word_pattern && regcomp(&first_word_re, first_word_pattern, REG_EXTENDED | REG_NOSUB) != 0) { fprintf(stderr, "Bad regular expression: %s.\n", first_word_pattern); exit(EXIT_FAILURE); } if (last_word_pattern && regcomp(&last_word_re, last_word_pattern, REG_EXTENDED | REG_NOSUB) != 0) { fprintf(stderr, "Bad regular expression: %s.\n", last_word_pattern); exit(EXIT_FAILURE); } for (index = 0; index < 5; index++) { if (special_pattern[index] && regcomp(&special_re[index], special_pattern[index], REG_EXTENDED | REG_NOSUB) != 0) { fprintf(stderr, "Bad regular expression: %s.\n", special_pattern[index]); exit(EXIT_FAILURE); } } /* Parse the post-processing patterns and extract its values */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (sed_list != NULL) { ll_node_t * node = sed_list->head; while (node != NULL) { if (!parse_sed_like_string((sed_t *)(node->data))) { fprintf(stderr, "Bad -S argument. Must be something like: " "/regex/repl_string/[g][v][s][i].\n"); exit(EXIT_FAILURE); } if ((!include_visual_only || !exclude_visual_only) && ((sed_t *)(node->data))->visual) { include_visual_only = 1; exclude_visual_only = 1; } node = node->next; } } if (include_sed_list != NULL) { ll_node_t * node = include_sed_list->head; while (node != NULL) { if (!parse_sed_like_string((sed_t *)(node->data))) { fprintf(stderr, "Bad -I argument. Must be something like: " "/regex/repl_string/[g][v][s][i].\n"); exit(EXIT_FAILURE); } if (!include_visual_only && ((sed_t *)(node->data))->visual) include_visual_only = 1; node = node->next; } } if (exclude_sed_list != NULL) { ll_node_t * node = exclude_sed_list->head; while (node != NULL) { if (!parse_sed_like_string((sed_t *)(node->data))) { fprintf(stderr, "Bad -E argument. Must be something like: " "/regex/repl_string/[g][v][s][i].\n"); exit(EXIT_FAILURE); } if (!exclude_visual_only && ((sed_t *)(node->data))->visual) exclude_visual_only = 1; node = node->next; } } /* Parse the row selection string if any */ /* """"""""""""""""""""""""""""""""""""" */ if (rows_selector_list != NULL) { ll_node_t * node_selector = rows_selector_list->head; filters_t filter_type; rows_filter_type = UNKNOWN_FILTER; while (node_selector != NULL) { rows_selector = node_selector->data; char * unparsed = xstrdup((char *)rows_selector); parse_selectors(rows_selector, &filter_type, unparsed, &inc_row_interval_list, &inc_row_regex_list, &exc_row_interval_list, &exc_row_regex_list, &langinfo); if (*unparsed != '\0') { fprintf(stderr, "Bad -R argument. Unparsed part: %s.\n", unparsed); exit(EXIT_FAILURE); } if (rows_filter_type == UNKNOWN_FILTER) rows_filter_type = filter_type; node_selector = node_selector->next; free(unparsed); } merge_intervals(inc_row_interval_list); merge_intervals(exc_row_interval_list); } /* Parse the column selection string if any */ /* """""""""""""""""""""""""""""""""""""""" */ if (cols_selector_list != NULL) { filters_t filter_type, cols_filter_type; interval_t * data; ll_node_t * node; ll_node_t * node_selector = cols_selector_list->head; cols_filter = xmalloc(limits.cols); cols_filter_type = UNKNOWN_FILTER; while (node_selector != NULL) { cols_selector = node_selector->data; char * unparsed = xstrdup((char *)cols_selector); parse_selectors(cols_selector, &filter_type, unparsed, &inc_col_interval_list, &inc_col_regex_list, &exc_col_interval_list, &exc_col_regex_list, &langinfo); if (*unparsed != '\0') { fprintf(stderr, "Bad -C argument. Unparsed part: %s.\n", unparsed); exit(EXIT_FAILURE); } merge_intervals(inc_col_interval_list); merge_intervals(exc_col_interval_list); free(unparsed); if (cols_filter_type == UNKNOWN_FILTER) cols_filter_type = filter_type; /* Only initialize the whole set when -C is encountered for the */ /* first time. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (cols_filter_type == INCLUDE_FILTER) memset(cols_filter, SOFT_EXCLUDE_MARK, limits.cols); else memset(cols_filter, SOFT_INCLUDE_MARK, limits.cols); /* Process the explicitly included columns intervals */ /* """"""""""""""""""""""""""""""""""""""""""""""""" */ if (inc_col_interval_list != NULL) for (node = inc_col_interval_list->head; node; node = node->next) { data = node->data; if (data->low >= limits.cols) break; if (data->high >= limits.cols) data->high = limits.cols - 1; memset(cols_filter + data->low, INCLUDE_MARK, data->high - data->low + 1); } /* Process the explicitly excluded column intervals */ /* """""""""""""""""""""""""""""""""""""""""""""""" */ if (exc_col_interval_list != NULL) for (node = exc_col_interval_list->head; node; node = node->next) { data = node->data; if (data->low >= limits.cols) break; if (data->high >= limits.cols) data->high = limits.cols - 1; memset(cols_filter + data->low, EXCLUDE_MARK, data->high - data->low + 1); } node_selector = node_selector->next; } } /* Initialize the useful values needed to walk through the rows intervals */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (rows_filter_type == INCLUDE_FILTER) row_def_selectable = SOFT_EXCLUDE_MARK; else if (rows_filter_type == EXCLUDE_FILTER) row_def_selectable = SOFT_INCLUDE_MARK; else { if (pattern_def_include == 0) row_def_selectable = SOFT_EXCLUDE_MARK; else row_def_selectable = SOFT_INCLUDE_MARK; } /* Set the head of the interval list */ /* """"""""""""""""""""""""""""""""" */ if (inc_row_interval_list) inc_interval_node = inc_row_interval_list->head; else inc_interval_node = NULL; if (exc_row_interval_list) exc_interval_node = exc_row_interval_list->head; else exc_interval_node = NULL; /* And get the first interval */ /* """""""""""""""""""""""""" */ if (inc_interval_node) inc_interval = (interval_t *)inc_interval_node->data; else inc_interval = NULL; if (exc_interval_node) exc_interval = (interval_t *)exc_interval_node->data; else exc_interval = NULL; /* First pass: */ /* Get and process the input stream words */ /* In this pass, the different actions will occur: */ /* - A new word is read from stdin */ /* - A new SOL and or EOL is possibly set */ /* - A special level is possibly affected to the word just read */ /* - The -R is taken into account */ /* - The first part of the -C option is done */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ while ( (word = get_word(input_file, word_delims_list, record_delims_list, utf8_buffer, &is_last, &toggle, &langinfo, &win, &limits)) != NULL) { int selectable; int is_first = 0; int special_level; int row_inc_matched = 0; if (*word == '\0') continue; /* Manipulates the is_last flag word indicator to make this word */ /* the first or last one of the current line in column/line/tab mode */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (win.col_mode || win.line_mode || win.tab_mode) { if (first_word_pattern && regexec(&first_word_re, word, (int)0, NULL, 0) == 0) is_first = 1; if (last_word_pattern && !is_last && regexec(&last_word_re, word, (int)0, NULL, 0) == 0) is_last = 1; } /* Check if the word is special */ /* """""""""""""""""""""""""""" */ special_level = 0; for (index = 0; index < 5; index++) { if (special_pattern[index] != NULL && regexec(&special_re[index], word, (int)0, NULL, 0) == 0) { special_level = (int)index + 1; break; } } /* Default selectable state */ /* """""""""""""""""""""""" */ selectable = SOFT_INCLUDE_MARK; /* For each new line check if the line is in the current */ /* interval or if we need to get the next interval if any */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (rows_selector) { if (count > 0 && word_a[count - 1].is_last) { /* We are in a new line, reset the flag indicating that we are on */ /* a line selected by a regular expression and the flag saying */ /* that the whole line has been excluded. */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' */ line_selected_by_regex = 0; line_excluded = 0; /* And also reset the flag telling that the row has been explicitly */ /* removed from the selectable list of words */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' */ row_inc_matched = 0; /* Increment the line counter used to see if we are an include or */ /* exclude set of lines */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' */ line_count++; /* Look if we need to use the next interval of the list */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''' */ if (inc_interval_node && line_count > inc_interval->high) { inc_interval_node = inc_interval_node->next; if (inc_interval_node) inc_interval = (interval_t *)inc_interval_node->data; } if (exc_interval_node && line_count > exc_interval->high) { exc_interval_node = exc_interval_node->next; if (exc_interval_node) exc_interval = (interval_t *)exc_interval_node->data; } } /* Look if the line is in an excluded or included line. */ /* The included line intervals are only checked if the word didn't */ /* belong to an excluded line interval before. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (exc_interval) { if (line_count >= exc_interval->low && line_count <= exc_interval->high) selectable = EXCLUDE_MARK; } if (selectable != EXCLUDE_MARK && inc_interval) { if (line_count >= inc_interval->low && line_count <= inc_interval->high) { selectable = INCLUDE_MARK; /* As the raw has been explicitly selected, record that so than */ /* we can distinguish that from the implicit selection */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' */ row_inc_matched = 1; } } } /* Check if the all the words in the current row must be included or */ /* excluded from the selectable set of words */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (selectable != EXCLUDE_MARK) { /* Look in the excluded list of regular expressions */ /* '''''''''''''''''''''''''''''''''''''''''''''''' */ if (exc_row_regex_list != NULL) { regex_t * row_re; ll_node_t * row_regex_node = exc_row_regex_list->head; while (row_regex_node != NULL) { row_re = row_regex_node->data; if (regexec(row_re, word, (int)0, NULL, 0) == 0) { long c = count - 1; /* Mark all the next words of the line as excluded */ /* ''''''''''''''''''''''''''''''''''''''''''''''' */ line_selected_by_regex = 1; line_excluded = 1; /* Mark all the previous words of the line as excluded */ /* ''''''''''''''''''''''''''''''''''''''''''''''''''' */ while (c >= 0 && !word_a[c].is_last) { word_a[c].is_selectable = EXCLUDE_MARK; c--; } /* Mark the current word as not excluded */ /* ''''''''''''''''''''''''''''''''''''' */ selectable = EXCLUDE_MARK; /* No need to continue as the line is already marked as excluded. */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' */ break; } row_regex_node = row_regex_node->next; } } /* If the line has not yet been excluded and the list of explicitly */ /* include regular expressions is not empty then give them a chance. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (selectable != EXCLUDE_MARK && inc_row_regex_list != NULL) { regex_t * row_re; ll_node_t * row_regex_node = inc_row_regex_list->head; while (row_regex_node != NULL) { row_re = row_regex_node->data; if (regexec(row_re, word, (int)0, NULL, 0) == 0) { long c = count - 1; while (c >= 0 && !word_a[c].is_last) { /* Do not include an already excluded word */ /* """"""""""""""""""""""""""""""""""""""" */ if (word_a[c].is_selectable) word_a[c].is_selectable = INCLUDE_MARK; c--; } /* Mark all the next words of the line as included */ /* ''''''''''''''''''''''''''''''''''''''''''''''' */ line_selected_by_regex = 1; /* Mark all the previous words of the line as included */ /* ''''''''''''''''''''''''''''''''''''''''''''''''''' */ selectable = INCLUDE_MARK; } row_regex_node = row_regex_node->next; } } } /* If the line contains a word that matched a regex which determines */ /* the inclusion of exclusion of this line, then use the regex */ /* selection flag to determine the inclusion/exclusion of the future */ /* words in the line. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (line_excluded) selectable = EXCLUDE_MARK; else { if (line_selected_by_regex) selectable = (row_def_selectable == ROW_REGEX_EXCLUDE) ? SOFT_EXCLUDE_MARK : INCLUDE_MARK; /* Check if the current word is matching an include or exclude */ /* pattern */ /* Only do it if if hasn't be explicitly deselected before. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (selectable != EXCLUDE_MARK) { /* Check if the word will be excluded in the list of selectable */ /* words or not. */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' */ if (exclude_pattern) { if (regexec(&exclude_re, word, (int)0, NULL, 0) == 0) selectable = EXCLUDE_MARK; } if (selectable != 0 && !line_selected_by_regex) { /* Check if the word will be included in the list of selectable */ /* words or not. */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' */ if (include_pattern) { if (regexec(&include_re, word, (int)0, NULL, 0) == 0) selectable = INCLUDE_MARK; else if (!row_inc_matched) selectable = row_def_selectable; } else if (rows_selector && !row_inc_matched) selectable = row_def_selectable; } } } if (win.col_mode) { /* In column mode we must manage the allocation space for some */ /* column's related data structures and check if some limits ave not */ /* been reached. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (is_first) col_index = 1; else { col_index++; if (col_index > cols_number) { /* Check the limits */ /* '''''''''''''''' */ if (col_index == limits.cols) { fprintf(stderr, "The number of columns has reached the limit of %ld.\n", limits.cols); exit(EXIT_FAILURE); } cols_number++; /* Look if we need to enlarge the arrays indexed by the */ /* number of columns. */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''' */ if (cols_number % COLSCHUNK == 0) { long ci; /* column index */ col_real_max_size = xrealloc(col_real_max_size, (cols_number + COLSCHUNK) * sizeof(long)); col_max_size = xrealloc(col_max_size, (cols_number + COLSCHUNK) * sizeof(long)); /* Initialize the max size for the new columns */ /* ''''''''''''''''''''''''''''''''''''''''''' */ for (ci = 0; ci < COLSCHUNK; ci++) { col_real_max_size[cols_number + ci] = 0; col_max_size[cols_number + ci] = 0; } } } } /* We must now check if the word matches a RE that */ /* exclude the whole column. */ /* """"""""""""""""""""""""""""""""""""""""""""""" */ if (cols_selector != NULL) { long ci; /* column index */ regex_t * col_re; if (cols_filter[col_index - 1] == EXCLUDE_MARK) selectable = EXCLUDE_MARK; else { if (exc_col_regex_list != NULL) { /* Some columns must be excluded by regex */ /* '''''''''''''''''''''''''''''''''''''' */ ll_node_t * col_regex_node = exc_col_regex_list->head; while (col_regex_node != NULL) { col_re = col_regex_node->data; if (regexec(col_re, word, (int)0, NULL, 0) == 0) { cols_filter[col_index - 1] = EXCLUDE_MARK; selectable = EXCLUDE_MARK; /* Mark non selectable the items above in the column */ /* ''''''''''''''''''''''''''''''''''''''''''''''''' */ ci = 0; for (wi = 0; wi < count; wi++) { if (ci == col_index - 1) word_a[wi].is_selectable = EXCLUDE_MARK; if (word_a[wi].is_last) ci = 0; else ci++; } break; } col_regex_node = col_regex_node->next; } } if (inc_col_regex_list != NULL) { /* Some columns must be included by regex */ /* '''''''''''''''''''''''''''''''''''''' */ ll_node_t * col_regex_node = inc_col_regex_list->head; while (col_regex_node != NULL) { col_re = col_regex_node->data; if (regexec(col_re, word, (int)0, NULL, 0) == 0) { cols_filter[col_index - 1] = INCLUDE_MARK; break; } col_regex_node = col_regex_node->next; } } } } } /* Store some known values in the current word's structure */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""" */ word_a[count].start = word_a[count].end = 0; word_a[count].str = word; word_a[count].is_selectable = selectable; word_a[count].special_level = special_level; word_a[count].is_matching = 0; word_a[count].is_tagged = 0; word_a[count].is_numbered = 0; word_a[count].tag_order = 0; if (win.col_mode || win.line_mode || win.tab_mode) { /* Set the last word in line indicator when in column/line/tab mode */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' */ if (is_first && count > 0) word_a[count - 1].is_last = 1; word_a[count].is_last = is_last; if (is_last) col_index = 0; } else word_a[count].is_last = 0; /* One more word... */ /* """""""""""""""" */ if (count == limits.words) { fprintf(stderr, "The number of read words has reached the limit of %ld.\n", limits.words); exit(EXIT_FAILURE); } count++; if (count % WORDSCHUNK == 0) word_a = xrealloc(word_a, (count + WORDSCHUNK) * sizeof(word_t)); } /* Early exit if there is no input or if no word is selected */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (count == 0) exit(EXIT_FAILURE); /* The last word is always the last of its line */ /* """""""""""""""""""""""""""""""""""""""""""" */ if (win.col_mode || win.line_mode || win.tab_mode) word_a[count - 1].is_last = 1; /* Second pass to modify the word according to all/include/exclude */ /* regular expressions and the columns settings set in the previous pass. */ /* This must be done separately because in the first pass, some word */ /* could have been marked as excluded before the currently processed word */ /* (second part of the -C option) */ /* In this pass the following actions will also be done: */ /* - Finish the work on columns. */ /* - Possibly modify the word according to -S/-I/-E arguments */ /* - Replace unprintable characters in the word by mnemonics */ /* - Remember the max size of the words/columns/tabs */ /* - Insert the word in a TST (Ternary Search Tree) index to facilitate */ /* word search (each node pf the TST will contain an UTF-8 glyph). */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ col_index = 0; for (wi = 0; wi < count; wi++) { char * unaltered_word; long size; long word_len; wchar_t * tmpw; word_t * word; long s; long len; char * expanded_word; long i; /* If the column section argument is set, then adjust the final */ /* selectable attribute according to the already set words and column */ /* selectable flag contents */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (cols_selector_list != NULL) { if (cols_filter[col_index] == EXCLUDE_MARK) word_a[wi].is_selectable = EXCLUDE_MARK; else if (word_a[wi].is_selectable != EXCLUDE_MARK) { switch (cols_filter[col_index]) { case INCLUDE_MARK: word_a[wi].is_selectable = INCLUDE_MARK; break; case SOFT_EXCLUDE_MARK: if (word_a[wi].is_selectable == SOFT_EXCLUDE_MARK || word_a[wi].is_selectable == SOFT_INCLUDE_MARK) word_a[wi].is_selectable = EXCLUDE_MARK; else word_a[wi].is_selectable = INCLUDE_MARK; break; case SOFT_INCLUDE_MARK: if (word_a[wi].is_selectable == SOFT_EXCLUDE_MARK) word_a[wi].is_selectable = EXCLUDE_MARK; else word_a[wi].is_selectable = INCLUDE_MARK; break; } } } word = &word_a[wi]; /* Make sure that daccess.length >= daccess.size */ /* with DA_TYPE_POS. */ /* """"""""""""""""""""""""""""""""""""""""""""" */ if (daccess.mode != DA_TYPE_NONE) { if (daccess.mode & DA_TYPE_POS) { if (daccess.size > 0) if (daccess.size > daccess.length) daccess.length = daccess.size; } /* Auto determination of the length of the selector */ /* with DA_TYPE_AUTO. */ /* """""""""""""""""""""""""""""""""""""""""""""""" */ if ((daccess.mode & DA_TYPE_AUTO) && daccess.length == -2) { long n = count; daccess.length = 0; while (n) { n /= 10; daccess.length++; } } /* Set the full length of the prefix in case of numbering */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (daccess.length > 0) daccess.flength = 3 + daccess.length; if (word->is_selectable != EXCLUDE_MARK && word->is_selectable != SOFT_EXCLUDE_MARK) { char * selector; char * tmp = xmalloc(strlen(word->str) + 4 + daccess.length); long * word_pos = xmalloc(sizeof(long)); int may_number; if (!isempty(word->str)) { *word_pos = wi; tmp[0] = ' '; /* Check if the word is eligible to the numbering process */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (daccess_up == NULL && daccess_np == NULL) { if (daccess.mode & DA_TYPE_POS) may_number = 1; else may_number = 0; } else { if (daccess_up != NULL && !!regexec(&daccess_up_re, word->str, (int)0, NULL, 0) == 0) may_number = 0; else { if (daccess_np != NULL && !!regexec(&daccess_np_re, word->str, (int)0, NULL, 0) == 0) may_number = 1; else may_number = daccess.def_number; } } /* It is... */ /* """""""" */ if (may_number) { if (daccess.mode & DA_TYPE_POS) { if (!word->is_numbered) { if (daccess.size > 0 && daccess.offset + daccess.size + daccess.ignore <= utf8_strlen(word->str)) { unsigned selector_value; /* numerical value of the * * extracted selector */ long selector_offset; /* offset in byte to the selector * * to extract */ char * ptr; /* points just after the selector * * to extract */ long plus_offset; /* points to the first occurrence * * of a number in word->str after * * the offset given */ selector_offset = utf8_offset(word->str, daccess.offset); if (daccess.plus) { plus_offset = strcspn(word->str + selector_offset, "0123456789"); if (plus_offset + daccess.size + daccess.ignore <= strlen(word->str)) selector_offset += plus_offset; } ptr = word->str + selector_offset; selector = xstrndup(ptr, daccess.size); /* read the embedded number and, if correct, format */ /* it according to daccess.alignment */ /* """""""""""""""""""""""""""""""""""""""""""""""" */ if (sscanf(selector, "%u", &selector_value) == 1) { sprintf(selector, "%u", selector_value); sprintf(tmp + 1, "%*u", daccess.alignment == 'l' ? -daccess.length : daccess.length, selector_value); /* Overwrite the end of the word to erase the selector */ /* """"""""""""""""""""""""""""""""""""""""""""""""""" */ my_strcpy(ptr, ptr + daccess.size + utf8_offset(ptr + daccess.size, daccess.ignore)); /* Modify the word according to the 'h' directive of -D */ /* """""""""""""""""""""""""""""""""""""""""""""""""""" */ if (daccess.head == 'c') /* h:c is present cut the leading characters */ /* before the selector */ /* ''''''''''''''''''''''''''''''''''''''''' */ memmove(word->str, ptr, strlen(ptr) + 1); else if (daccess.head == 't') { /* h:t is present trim the leading characters */ /* before the selector if they are ' ' or '\t' */ /* ''''''''''''''''''''''''''''''''''''''''''' */ char * p = word->str; while (p != ptr && (*p == ' ' || *p == '\t')) p++; if (p == ptr) memmove(word->str, ptr, strlen(ptr) + 1); } ltrim(selector, " "); rtrim(selector, " ", 0); tst_daccess = tst_insert(tst_daccess, utf8_strtowcs(selector), word_pos); if (daccess.follow == 'y') daccess_index = selector_value + 1; word->is_numbered = 1; } free(selector); } } } /* Try to number this word if it is still non numbered and */ /* the -N/-U option is given. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (!word->is_numbered && (daccess.mode & DA_TYPE_AUTO)) { sprintf(tmp + 1, "%*ld", daccess.alignment == 'l' ? -daccess.length : daccess.length, daccess_index); selector = xstrdup(tmp + 1); ltrim(selector, " "); rtrim(selector, " ", 0); /* Insert it in the tst tree containing the selector's */ /* digits. */ /* ''''''''''''''''''''''''''''''''''''''''''''''''''' */ tst_daccess = tst_insert(tst_daccess, utf8_strtowcs(selector), word_pos); daccess_index++; free(selector); word->is_numbered = 1; } } /* Fill the space taken by the numbering by space if the word */ /* is not numbered. */ if (daccess.length > 0 && !word->is_numbered) { for (i = 0; i < daccess.flength; i++) tmp[i] = ' '; } /* Make sure that the 2 character after this placeholder */ /* are initialized. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""" */ if (daccess.length > 0) { tmp[1 + daccess.length] = ' '; tmp[2 + daccess.length] = ' '; } } else if (daccess.length > 0) { /* make sure that the prefix of empty word is blank */ /* as they may be display in column mode * */ /* """""""""""""""""""""""""""""""""""""""""""""""" */ for (i = 0; i < daccess.flength; i++) tmp[i] = ' '; } if (daccess.length > 0) { my_strcpy(tmp + daccess.flength, word->str); free(word->str); word->str = tmp; } else free(tmp); } else { /* Should we also add space at the beginning of excluded words ? */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (daccess.padding == 'a') { char * tmp = xmalloc(strlen(word->str) + 4 + daccess.length); for (i = 0; i < daccess.flength; i++) tmp[i] = ' '; my_strcpy(tmp + daccess.flength, word->str); free(word->str); word->str = tmp; } } } else { daccess.size = 0; daccess.length = 0; } /* Save the original word */ /* """""""""""""""""""""" */ unaltered_word = xstrdup(word->str); /* Possibly modify the word according to -S/-I/-E arguments */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""" */ { ll_node_t * node = NULL; char * tmp; /* Manage the -S case */ /* """""""""""""""""" */ if (sed_list != NULL) { node = sed_list->head; while (node != NULL) { tmp = xstrndup(word->str, daccess.flength); if (replace(word->str + daccess.flength, (sed_t *)(node->data))) { free(word->str); memmove(word_buffer + daccess.flength, word_buffer, strlen(word_buffer) + 1); memmove(word_buffer, tmp, daccess.flength); word->str = xstrdup(word_buffer); if (((sed_t *)(node->data))->stop) break; } *word_buffer = '\0'; node = node->next; free(tmp); } } else { /* Manage the -I/-E case */ /* """""""""""""""""""""" */ if ((word->is_selectable == INCLUDE_MARK || word->is_selectable == SOFT_INCLUDE_MARK) && include_sed_list != NULL) node = include_sed_list->head; else if ((word->is_selectable == EXCLUDE_MARK || word->is_selectable == SOFT_EXCLUDE_MARK) && exclude_sed_list != NULL) node = exclude_sed_list->head; else node = NULL; *word_buffer = '\0'; while (node != NULL) { tmp = xstrndup(word->str, daccess.flength); if (replace(word->str + daccess.flength, (sed_t *)(node->data))) { free(word->str); memmove(word_buffer + daccess.flength, word_buffer, strlen(word_buffer) + 1); memmove(word_buffer, tmp, daccess.flength); word->str = xstrdup(word_buffer); if (((sed_t *)(node->data))->stop) break; } *word_buffer = '\0'; node = node->next; free(tmp); } } } /* A substitution leading to an empty word is invalid in column mode. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (win.col_mode) { if (*(word->str + daccess.flength) == '\0') exit(EXIT_FAILURE); } /* Alter the word just read be replacing special chars by their */ /* escaped equivalents. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ word_len = strlen(word->str); expanded_word = xmalloc(5 * word_len + 1); len = expand(word->str, expanded_word, &langinfo, &toggle); /* Update it if needed */ /* ''''''''''''''''''' */ if (strcmp(expanded_word, word->str) != 0) { word_len = len; free(word->str); word->str = xstrdup(expanded_word); } free(expanded_word); if (win.col_mode) { /* Update the max values of col_real_max_size[col_index] */ /* and col_max_size[col_index] */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""" */ if ((s = (long)word_len) > col_real_max_size[col_index]) { col_real_max_size[col_index] = s; /* Also update the real max size of all columns seen */ /* """"""""""""""""""""""""""""""""""""""""""""""""" */ if (s > cols_real_max_size) cols_real_max_size = s; } s = (long)mbstowcs(NULL, word->str, 0); s = wcswidth((tmpw = utf8_strtowcs(word->str)), s); free(tmpw); if (s > col_max_size[col_index]) { col_max_size[col_index] = s; /* Also update the max size of all columns seen */ /* """""""""""""""""""""""""""""""""""""""""""" */ if (s > cols_max_size) cols_max_size = s; } /* Update the size of the longest expanded word */ /* """""""""""""""""""""""""""""""""""""""""""" */ word_real_max_size = cols_real_max_size; } else if (win.tab_mode) { /* Store the new max number of bytes in a word */ /* and update the size of the longest expanded word */ /* """""""""""""""""""""""""""""""""""""""""""""""" */ if ((size = (long)word_len) > tab_real_max_size) word_real_max_size = tab_real_max_size = (long)word_len; /* Store the new max word width */ /* """""""""""""""""""""""""""" */ size = (long)mbstowcs(NULL, word->str, 0); if ((size = wcswidth((tmpw = utf8_strtowcs(word->str)), size)) > tab_max_size) tab_max_size = size; free(tmpw); } else if (word_real_max_size < word_len) /* Update the size of the longest expanded word */ /* """""""""""""""""""""""""""""""""""""""""""" */ word_real_max_size = word_len; /* When the visual only flag is set, we keep the unaltered word so */ /* that it can be restored even if its visual and searchable */ /* representation may have been altered by the previous code */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ /* Record the length of the word in bytes. This information will be */ /* used if the -k option (keep spaces ) is not set. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ word->len = strlen(word->str); /* Save the non modified word in .orig if it has been altered */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if ((strcmp(word->str, unaltered_word) != 0) && ((word->is_selectable && include_visual_only) || (!word->is_selectable && exclude_visual_only))) { word->orig = unaltered_word; } else { word->orig = NULL; free(unaltered_word); } if (win.col_mode) { if (word_a[wi].is_last) col_index = 0; else col_index++; } } /* Set the minimum width of a column (-w and -t or -c option) */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (win.wide) { if (win.tab_mode) { if (win.max_cols > 0) min_size = (term.ncolumns - 2) / win.max_cols - 1; if (min_size < tab_max_size) min_size = tab_max_size; word_real_max_size = min_size + tab_real_max_size - tab_max_size; } else /* column mode */ { min_size = (term.ncolumns - 2) / cols_number; if (min_size < cols_max_size) min_size = cols_max_size; word_real_max_size = cols_real_max_size; } } /* Third (compress) pass: remove all empty word and words containing */ /* only spaces when not in column mode. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (!win.col_mode) { long offset; offset = 0; for (wi = 0; wi < count; wi++) { while (wi + offset < count && isempty(word_a[wi + offset].str + daccess.flength)) { /* Keep non selectable empty words to allow special effects */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''''''' */ if (word_a[wi + offset].is_selectable == SOFT_EXCLUDE_MARK || word_a[wi + offset].is_selectable == EXCLUDE_MARK) break; offset++; } if (offset > 0) word_a[wi] = word_a[wi + offset]; } count -= offset; } if (count == 0) exit(EXIT_FAILURE); /* Allocate the space for the satellites arrays */ /* """""""""""""""""""""""""""""""""""""""""""" */ line_nb_of_word_a = xmalloc(count * sizeof(long)); first_word_in_line_a = xmalloc(count * sizeof(long)); /* Fourth pass: */ /* When in column or tabulating mode, we need to adjust the length of */ /* all the words by adding the right number of spaces so that they will */ /* be aligned correctly. In column mode the size of each column is */ /* variable; in tabulate mode it is constant. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (win.col_mode) { char * temp; /* Sets all columns to the same size when -w and -c are both set */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (win.wide) for (col_index = 0; col_index < cols_number; col_index++) { col_max_size[col_index] = cols_max_size; col_real_max_size[col_index] = cols_real_max_size; } /* Total space taken by all the columns plus the gutter */ /* """""""""""""""""""""""""""""""""""""""""""""""""""" */ win.max_width = 0; win.real_max_width = 0; for (col_index = 0; col_index < cols_number; col_index++) { if (win.max_width + col_max_size[col_index] + 1 <= term.ncolumns - 2) win.max_width += col_max_size[col_index] + 1; win.real_max_width += col_max_size[col_index] + 1; } col_index = 0; for (wi = 0; wi < count; wi++) { long s1, s2; long word_width; wchar_t * w; s1 = (long)strlen(word_a[wi].str); word_width = mbstowcs(NULL, word_a[wi].str, 0); s2 = wcswidth((w = utf8_strtowcs(word_a[wi].str)), word_width); free(w); temp = xcalloc(1, col_real_max_size[col_index] + s1 - s2 + 1); memset(temp, ' ', col_max_size[col_index] + s1 - s2); memcpy(temp, word_a[wi].str, s1); temp[col_real_max_size[col_index] + s1 - s2] = '\0'; free(word_a[wi].str); word_a[wi].str = temp; if (word_a[wi].is_last) col_index = 0; else col_index++; } } else if (win.tab_mode) { char * temp; if (tab_max_size < min_size) { tab_max_size = min_size; if (tab_max_size > tab_real_max_size) tab_real_max_size = tab_max_size; } for (wi = 0; wi < count; wi++) { long s1, s2; long word_width; wchar_t * w; s1 = (long)strlen(word_a[wi].str); word_width = mbstowcs(NULL, word_a[wi].str, 0); s2 = wcswidth((w = utf8_strtowcs(word_a[wi].str)), word_width); free(w); temp = xcalloc(1, tab_real_max_size + s1 - s2 + 1); memset(temp, ' ', tab_max_size + s1 - s2); memcpy(temp, word_a[wi].str, s1); temp[tab_real_max_size + s1 - s2] = '\0'; free(word_a[wi].str); word_a[wi].str = temp; } } /* Fifth pass: transforms the remaining SOFT_EXCLUDE_MARKs with */ /* EXCLUDE_MARKs. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ for (wi = 0; wi < count; wi++) { long * data; wchar_t * w; ll_t * list; if (word_a[wi].is_selectable == SOFT_EXCLUDE_MARK) word_a[wi].is_selectable = EXCLUDE_MARK; /* If the word is selectable insert it in the TST tree */ /* with its associated index in the input stream. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""" */ if (word_a[wi].is_selectable) { data = xmalloc(sizeof(long)); *data = wi; /* Create a wide characters string from the word screen representation */ /* to be able to store in in the TST. */ /* Note that the direct access selector,if any, is not stored. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (word_a[wi].is_numbered) w = utf8_strtowcs(word_a[wi].str + daccess.flength); else w = utf8_strtowcs(word_a[wi].str); /* If we didn't already encounter this word, then create a new entry in */ /* the TST for it and store its index in its list. */ /* Otherwise, add its index in its index list. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (tst_word && (list = tst_search(tst_word, w)) != NULL) ll_append(list, data); else { list = ll_new(); ll_append(list, data); tst_word = tst_insert(tst_word, w, list); } free(w); } } /* The word after the last one is set to NULL */ /* """""""""""""""""""""""""""""""""""""""""" */ word_a[count].str = NULL; /* We can now allocate the space for our tmp_word work variable */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ tmp_word = xmalloc(word_real_max_size + 1); search_data.utf8_off_a = xmalloc(word_real_max_size * sizeof(long)); search_data.utf8_len_a = xmalloc(word_real_max_size * sizeof(long)); win.start = 0; /* index of the first element in the * * words array to be displayed */ /* We can now build the first metadata */ /* """"""""""""""""""""""""""""""""""" */ last_line = build_metadata(&term, count, &win); /* Index of the selected element in the array words */ /* The string can be: */ /* "last" The string "last" put the cursor on the last word */ /* n a number put the cursor on the word n */ /* /pref /+a regexp put the cursor on the first */ /* word matching the prefix "pref" */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ for (wi = 0; wi < count; wi++) word_a[wi].bitmap = xcalloc(1, (word_a[wi].mb - daccess.flength) / CHAR_BIT + 1); /* Find the first selectable word (if any) in the input stream */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ for (first_selectable = 0; first_selectable < count && !word_a[first_selectable].is_selectable; first_selectable++) ; /* If not found, abort */ /* """"""""""""""""""" */ if (first_selectable == count) { fprintf(stderr, "No selectable word found.\n"); exit(EXIT_FAILURE); } /* Else find the last selectable word in the input stream */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""" */ last_selectable = count - 1; while (last_selectable > 0 && !word_a[last_selectable].is_selectable) last_selectable--; if (pre_selection_index == NULL) /* Option -s was not used */ /* """""""""""""""""""""" */ current = first_selectable; else if (*pre_selection_index == '/') { /* A regular expression is expected */ /* """""""""""""""""""""""""""""""" */ regex_t re; long index; if (regcomp(&re, pre_selection_index + 1, REG_EXTENDED | REG_NOSUB) != 0) { fprintf(stderr, "Invalid regular expression :%s.\n", pre_selection_index); exit(EXIT_FAILURE); } else { int found = 0; char * word; for (index = first_selectable; index <= last_selectable; index++) { if (!word_a[index].is_selectable) continue; if (word_a[index].orig != NULL) word = word_a[index].orig; else word = word_a[index].str; if (regexec(&re, word, (int)0, NULL, 0) == 0) { current = index; found = 1; break; } } if (!found) current = first_selectable; } } else if (*pre_selection_index == '=') /* exact search */ { /* A prefix is expected */ /* """""""""""""""""""" */ wchar_t * w; ll_t * list; ll_node_t * node; list = tst_search(tst_word, w = utf8_strtowcs(pre_selection_index + 1)); if (list != NULL) { node = list->head; current = *(long *)(node->data); } else current = first_selectable; free(w); } else if (*pre_selection_index != '\0') { /* A prefix string or an index is expected */ /* """"""""""""""""""""""""""""""""""""""" */ int len; char * ptr = pre_selection_index; if (*ptr == '#') { /* An index is expected */ /* """""""""""""""""""" */ ptr++; if (sscanf(ptr, "%ld%n", ¤t, &len) == 1 && len == (int)strlen(ptr)) { /* We got an index (numeric value) */ /* """"""""""""""""""""""""""""""" */ if (current < 0) current = first_selectable; if (current >= count) current = count - 1; if (!word_a[current].is_selectable) { if (current > last_selectable) current = last_selectable; else if (current < first_selectable) current = first_selectable; else while (current > first_selectable && !word_a[current].is_selectable) current--; } } else if (*ptr == '\0' || strcmp(ptr, "last") == 0) /* We got a special index (empty or last) */ /* """""""""""""""""""""""""""""""""""""" */ current = last_selectable; else { fprintf(stderr, "Invalid index: %s.\n", ptr); exit(EXIT_FAILURE); } } else { /* A prefix is expected */ /* """""""""""""""""""" */ wchar_t * w; new_current = last_selectable; if (NULL != tst_prefix_search(tst_word, w = utf8_strtowcs(ptr), tst_cb_cli)) current = new_current; else current = first_selectable; free(w); } } else current = first_selectable; /* We now need to adjust the 'start'/'end' fields of the structure 'win' */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ set_win_start_end(&win, current, last_line); /* We've finished reading from stdin */ /* we will now get the inputs from the controlling terminal if any */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ errno = 0; if (freopen("/dev/tty", "r", stdin) == NULL) fprintf(stderr, "/dev/tty: %s\n", strerror(errno)); old_fd1 = dup(1); old_stdout = fdopen(old_fd1, "w"); setbuf(old_stdout, NULL); errno = 0; if (freopen("/dev/tty", "w", stdout) == NULL) fprintf(stderr, "/dev/tty: %s\n", strerror(errno)); setvbuf(stdout, NULL, _IONBF, 0); /* Set the characteristics of the terminal */ /* """"""""""""""""""""""""""""""""""""""" */ setup_term(fileno(stdin)); /* Initialize the search buffer with tab_real_max_size+1 NULs */ /* It will never be reallocated, only cleared. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ search_data.buf = xcalloc(1, word_real_max_size + 1 - daccess.flength); /* Hide the cursor */ /* """"""""""""""" */ tputs(TPARM1(cursor_invisible), 1, outch); /* Force the display to start at a beginning of line */ /* """"""""""""""""""""""""""""""""""""""""""""""""" */ get_cursor_position(&term.curs_line, &term.curs_column); if (term.curs_column > 1) puts(""); /* Display the words window and its title for the first time */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""" */ disp_message(message_lines_list, message_max_width, message_max_len, &term, &win); /* Before displaying the word windows for the first time when in column */ /* or line mode, we need to ensure that the word under the cursor will */ /* be visible by setting the number of the first column to be displayed */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (win.col_mode || win.line_mode) { long pos; long len; len = term.ncolumns - 3; /* Adjust win.first_column if the cursor is not visible */ /* """""""""""""""""""""""""""""""""""""""""""""""""""" */ pos = first_word_in_line_a[line_nb_of_word_a[current]]; while (word_a[current].end - word_a[pos].start >= len) pos++; win.first_column = word_a[pos].start; } /* Save the initial cursor line and column, here only the line is */ /* interesting us. This will tell us if we are in need to compensate */ /* a terminal automatic scrolling */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ get_cursor_position(&term.curs_line, &term.curs_column); nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); /* Determine the number of lines to move the cursor up if the window */ /* display needed a terminal scrolling */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (nl + term.curs_line - 1 > term.nlines) offset = term.curs_line + nl - term.nlines; else offset = 0; /* Set the cursor to the first line of the window */ /* """""""""""""""""""""""""""""""""""""""""""""" */ { long i; /* generic index in this block */ for (i = 1; i < offset; i++) tputs(TPARM1(cursor_up), 1, outch); } /* Save again the cursor current line and column positions so that we */ /* will be able to put the terminal cursor back here */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ get_cursor_position(&term.curs_line, &term.curs_column); /* Arm the periodic timer */ /* """""""""""""""""""""" */ periodic_itv.it_value.tv_sec = 0; periodic_itv.it_value.tv_usec = TICK; periodic_itv.it_interval.tv_sec = 0; periodic_itv.it_interval.tv_usec = TICK; setitimer(ITIMER_REAL, &periodic_itv, NULL); /* Main loop */ /* """"""""" */ while (1) { int sc = 0; /* scancode */ /* Manage a segmentation fault by exiting with failure and restoring */ /* the terminal and the cursor. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (got_sigsegv) { fputs("SIGSEGV received!\n", stderr); tputs(TPARM1(carriage_return), 1, outch); tputs(TPARM1(cursor_normal), 1, outch); restore_term(fileno(stdin)); exit(EXIT_FAILURE); } /* Manage the hangup and termination signal by exiting with failure */ /* and restoring the terminal and the cursor. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (got_sigterm || got_sighup) { fputs("Interrupted!\n", stderr); tputs(TPARM1(carriage_return), 1, outch); tputs(TPARM1(cursor_normal), 1, outch); restore_term(fileno(stdin)); exit(EXIT_FAILURE); } /* If this alarm is triggered, then redisplay the window */ /* to remove the help message and disable this timer. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""" */ if (got_help_alrm) { got_help_alrm = 0; /* Calculate the new metadata and draw the window again */ /* """""""""""""""""""""""""""""""""""""""""""""""""""" */ last_line = build_metadata(&term, count, &win); help_mode = 0; nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } /* Reset the direct access selector if the direct access alarm rang */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (got_daccess_alrm) { got_daccess_alrm = 0; memset(daccess_stack, '\0', 6); daccess_stack_head = 0; daccess_timer = timers.direct_access; } if (got_winch) { got_winch = 0; winch_timer = timers.winch; /* default 7 / FREQ s */ } /* If the timeout is set then decrement its remaining value */ /* Upon expiration of this alarm, we trigger a content update */ /* of the window */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (got_winch_alrm) { long i; /* generic index in this block */ int nlines, ncolumns; int line, column; /* Re-arm the timer */ /* """""""""""""""" */ winch_timer = timers.winch; /* default 7 / FREQ s */ get_terminal_size(&nlines, &ncolumns); got_winch_alrm = 0; if (got_winch || term.nlines != nlines || term.ncolumns != ncolumns) { term.nlines = nlines; term.ncolumns = ncolumns; continue; } winch_timer = -1; /* Reset the number of lines if the terminal has enough lines */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (term.nlines <= win.message_lines) win.max_lines = 0; else if (win.max_lines < term.nlines - win.message_lines) { if (win.asked_max_lines == 0) win.max_lines = term.nlines - win.message_lines; else { if (win.asked_max_lines > term.nlines - win.message_lines) win.max_lines = term.nlines - win.message_lines; else win.max_lines = win.asked_max_lines; } } else win.max_lines = term.nlines - win.message_lines; /* Erase the visible part of the displayed window */ /* """""""""""""""""""""""""""""""""""""""""""""" */ for (i = 0; i < win.message_lines; i++) { tputs(TPARM1(clr_bol), 1, outch); tputs(TPARM1(clr_eol), 1, outch); tputs(TPARM1(cursor_up), 1, outch); } tputs(TPARM1(clr_bol), 1, outch); tputs(TPARM1(clr_eol), 1, outch); tputs(TPARM1(save_cursor), 1, outch); get_cursor_position(&line, &column); for (i = 1; i < nl + win.message_lines; i++) { if (line + i >= nlines) break; /* We have reached the last terminal line */ tputs(TPARM1(cursor_down), 1, outch); tputs(TPARM1(clr_bol), 1, outch); tputs(TPARM1(clr_eol), 1, outch); } tputs(TPARM1(restore_cursor), 1, outch); /* Get new cursor position */ /* """"""""""""""""""""""" */ get_cursor_position(&term.curs_line, &term.curs_column); /* Calculate the new metadata and draw the window again */ /* """""""""""""""""""""""""""""""""""""""""""""""""""" */ last_line = build_metadata(&term, count, &win); if (win.col_mode || win.line_mode) { long pos; long len; len = term.ncolumns - 3; /* Adjust win.first_column if the cursor is no more visible */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""" */ pos = first_word_in_line_a[line_nb_of_word_a[current]]; while (word_a[current].end - word_a[pos].start >= len) pos++; win.first_column = word_a[pos].start; } disp_message(message_lines_list, message_max_width, message_max_len, &term, &win); nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); /* Determine the number of lines to move the cursor up if the window */ /* display needed a terminal scrolling */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (nl + win.message_lines + term.curs_line > term.nlines) offset = term.curs_line + nl + win.message_lines - term.nlines; else offset = 0; /* Set the cursor to the first line of the window */ /* """""""""""""""""""""""""""""""""""""""""""""" */ for (i = 1; i < offset; i++) tputs(TPARM1(cursor_up), 1, outch); /* Get new cursor position */ /* """"""""""""""""""""""" */ get_cursor_position(&term.curs_line, &term.curs_column); /* Short-circuit the loop */ /* """""""""""""""""""""" */ continue; } /* and possibly set its reached value. */ /* The counter is frozen in search and help mode */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (timeout.initial_value && search_mode == NONE && !help_mode) { if (got_timeout_tick) { long i; char * timeout_string; got_timeout_tick = 0; timeout.remain--; if (!quiet_timeout && timeout.remain % FREQ == 0) { sprintf(timeout_seconds, "%5u", timeout.remain / FREQ); timeout_string = (char *)(((ll_node_t *)(message_lines_list->tail))->data); memcpy(timeout_string + 1, timeout_seconds, 5); /* Erase the current window */ /* """""""""""""""""""""""" */ for (i = 0; i < win.message_lines; i++) { tputs(TPARM1(cursor_up), 1, outch); tputs(TPARM1(clr_bol), 1, outch); tputs(TPARM1(clr_eol), 1, outch); } tputs(TPARM1(clr_bol), 1, outch); tputs(TPARM1(clr_eol), 1, outch); /* Display the words window and its title for the first time */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""" */ disp_message(message_lines_list, message_max_width, message_max_len, &term, &win); } /* The timeout has expired */ /* """"""""""""""""""""""" */ if (timeout.remain == 0) timeout.reached = 1; } } if (timeout.reached) { if (timeout.mode == QUIT) goto quit; else if (timeout.mode == CURRENT || timeout.mode == WORD) goto enter; } /* Pressed keys scancodes processing */ /* """"""""""""""""""""""""""""""""" */ page = 1; /* Default number of lines to do down/up * * with PgDn/PgUp */ sc = get_scancode(buffer, 15); if (sc) { if (timeout.initial_value && buffer[0] != 0x0d && buffer[0] != 'q' && buffer[0] != 'Q' && buffer[0] != 3) { long i; char * timeout_string; /* Reset the timeout to its initial value */ /* """""""""""""""""""""""""""""""""""""" */ timeout.remain = timeout.initial_value; if (!quiet_timeout) { sprintf(timeout_seconds, "%5u", timeout.initial_value / FREQ); timeout_string = (char *)(((ll_node_t *)(message_lines_list->tail))->data); memcpy(timeout_string + 1, timeout_seconds, 5); /* Clear the message */ /* """"""""""""""""" */ for (i = 0; i < win.message_lines; i++) { tputs(TPARM1(cursor_up), 1, outch); tputs(TPARM1(clr_bol), 1, outch); tputs(TPARM1(clr_eol), 1, outch); } tputs(TPARM1(clr_bol), 1, outch); tputs(TPARM1(clr_eol), 1, outch); /* Display the words window and its title for the first time */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""" */ disp_message(message_lines_list, message_max_width, message_max_len, &term, &win); } setitimer(ITIMER_REAL, &periodic_itv, NULL); } if (search_mode == NONE) if (help_mode && buffer[0] != '?') { got_help_alrm = 1; continue; } switch (buffer[0]) { case 0x01: /* ^A */ if (search_mode != NONE) goto khome; break; case 0x1a: /* ^Z */ if (search_mode != NONE) goto kend; break; case 0x1b: /* ESC */ /* An escape sequence or a UTF-8 sequence has been pressed */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (memcmp("\x1bOH", buffer, 3) == 0 || memcmp("\x1bk", buffer, 2) == 0 || memcmp("\x1b[H", buffer, 3) == 0 || memcmp("\x1b[1~", buffer, 4) == 0 || memcmp("\x1b[7~", buffer, 4) == 0) { /* HOME key has been pressed */ /* """"""""""""""""""""""""" */ if (search_mode != NONE) { khome: search_data.only_starting = 1; search_data.only_ending = 0; select_starting_matches(&win, &term, &search_data, &last_line); } else { /* Find the first selectable word */ /* """""""""""""""""""""""""""""" */ current = win.start; while (current < win.end && !word_a[current].is_selectable) current++; /* In column mode we need to take care of the */ /* horizontal scrolling */ /* """""""""""""""""""""""""""""""""""""""""" */ if (win.col_mode || win.line_mode) if (word_a[current].end < win.first_column) win.first_column = word_a[current].start; } nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); break; } if (memcmp("\x1b[1;5H", buffer, 6) == 0 || memcmp("\x1b[1;2H", buffer, 6) == 0 || memcmp("\x1b[7^", buffer, 4) == 0) /* SHIFT/CTRL HOME key has been pressed */ /* """""""""""""""""""""""""""""""""""" */ goto kschome; if (memcmp("\x1bOF", buffer, 3) == 0 || memcmp("\x1bj", buffer, 2) == 0 || memcmp("\x1b[F", buffer, 3) == 0 || memcmp("\x1b[4~", buffer, 4) == 0 || memcmp("\x1b[8~", buffer, 4) == 0) { /* END key has been pressed */ /* """""""""""""""""""""""" */ if (search_mode != NONE) { kend: if (matches_count > 0 && search_mode != PREFIX) { search_data.only_starting = 0; search_data.only_ending = 1; select_ending_matches(&win, &term, &search_data, &last_line); } } else { /* Find the last selectable word */ /* """"""""""""""""""""""""""""" */ current = win.end; while (current > win.start && !word_a[current].is_selectable) current--; /* In column mode we need to take care of the */ /* horizontal scrolling */ /* """""""""""""""""""""""""""""""""""""""""" */ if (win.col_mode || win.line_mode) { long pos; long len; len = term.ncolumns - 3; if (word_a[current].end >= len + win.first_column) { /* Find the first word to be displayed in this line */ /* """""""""""""""""""""""""""""""""""""""""""""""" */ pos = first_word_in_line_a[line_nb_of_word_a[current]]; while (word_a[pos].start <= win.first_column) pos++; /* If the new current word cannot be displayed, search */ /* the first word in the line that can be displayed by */ /* iterating on pos. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""" */ pos--; while (word_a[current].end - word_a[pos].start >= len) pos++; if (word_a[pos].start > 0) win.first_column = word_a[pos].start; } } } nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); break; } if (memcmp("\x1b[1;5F", buffer, 6) == 0 || memcmp("\x1b[1;2F", buffer, 6) == 0 || memcmp("\x1b[8^", buffer, 4) == 0) /* SHIFT/CTRL END key has been pressed */ /* """"""""""""""""""""""""""""""""""" */ goto kscend; if (memcmp("\x1bOD", buffer, 3) == 0 || memcmp("\x1b[D", buffer, 3) == 0) /* Left arrow key has been pressed */ /* """"""""""""""""""""""""""""""" */ goto kl; if (memcmp("\x1bOC", buffer, 3) == 0 || memcmp("\x1b[C", buffer, 3) == 0) /* Right arrow key has been pressed */ /* """""""""""""""""""""""""""""""" */ goto kr; if (memcmp("\x1bOA", buffer, 3) == 0 || memcmp("\x1b[A", buffer, 3) == 0) /* Up arrow key has been pressed */ /* """"""""""""""""""""""""""""" */ goto ku; if (memcmp("\x1bOB", buffer, 3) == 0 || memcmp("\x1b[B", buffer, 3) == 0) /* Down arrow key has been pressed */ /* """"""""""""""""""""""""""""""" */ goto kd; if (memcmp("\x1b[I", buffer, 3) == 0 || memcmp("\x1b[5~", buffer, 4) == 0) /* PgUp key has been pressed */ /* """"""""""""""""""""""""" */ goto kpp; if (memcmp("\x1b[G", buffer, 3) == 0 || memcmp("\x1b[6~", buffer, 4) == 0) /* PgDn key has been pressed */ /* """"""""""""""""""""""""" */ goto knp; if (memcmp("\x1b[L", buffer, 3) == 0 || memcmp("\x1b[2~", buffer, 4) == 0) /* Ins key has been pressed */ /* """"""""""""""""""""""""" */ goto kins; if (memcmp("\x1b[3~", buffer, 4) == 0) /* Del key has been pressed */ /* """"""""""""""""""""""""" */ goto kdel; if (memcmp("\x1b[1;5C", buffer, 6) == 0 || memcmp("\x1bOc", buffer, 3) == 0) /* CTRL -> has been pressed */ /* """"""""""""""""""""""""" */ goto keol; if (memcmp("\x1b[1;5D", buffer, 6) == 0 || memcmp("\x1bOd", buffer, 3) == 0) /* CTRL <- key has been pressed */ /* """""""""""""""""""""""""""" */ goto ksol; if (buffer[0] == 0x1b && buffer[1] == '\0') { /* ESC key has been pressed */ /* """""""""""""""""""""""" */ search_mode_t old_search_mode = search_mode; search_data.fuzzy_err = 0; search_data.only_starting = 0; search_data.only_ending = 0; if (help_mode) nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); /* Reset the direct access selector stack */ /* """""""""""""""""""""""""""""""""""""" */ memset(daccess_stack, '\0', 6); daccess_stack_head = 0; daccess_timer = timers.direct_access; /* Clean the potential matching words non empty list */ /* """"""""""""""""""""""""""""""""""""""""""""""""" */ search_mode = NONE; if (matches_count > 0 || old_search_mode != search_mode) { clean_matches(&search_data, word_real_max_size); nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } break; } /* Else ignore key */ break; quit: case 'q': case 'Q': case 3: /* ^C */ /* q or Q of ^C has been pressed */ /* """"""""""""""""""""""""""""" */ if (search_mode != NONE && buffer[0] != 3) goto special_cmds_when_searching; { long i; /* generic index in this block */ for (i = 0; i < win.message_lines; i++) tputs(TPARM1(cursor_up), 1, outch); if (toggle.del_line) { tputs(TPARM1(clr_eol), 1, outch); tputs(TPARM1(clr_bol), 1, outch); tputs(TPARM1(save_cursor), 1, outch); for (i = 1; i < nl + win.message_lines; i++) { tputs(TPARM1(cursor_down), 1, outch); tputs(TPARM1(clr_eol), 1, outch); tputs(TPARM1(clr_bol), 1, outch); } tputs(TPARM1(restore_cursor), 1, outch); } else { for (i = 1; i < nl + win.message_lines; i++) tputs(TPARM1(cursor_down), 1, outch); puts(""); } } tputs(TPARM1(cursor_normal), 1, outch); restore_term(fileno(stdin)); exit(EXIT_SUCCESS); case 0x0c: /* ^L */ if (current < win.start || current > win.end) last_line = build_metadata(&term, count, &win); nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); break; case 'n': case ' ': /* n or the sspace bar has been pressed */ /* """""""""""""""""""""""""""""""""""" */ if (search_mode != NONE) goto special_cmds_when_searching; if (matches_count > 0) { long pos = find_next_matching_word(matching_words_a, matches_count, current, &matching_word_cur_index); if (pos >= 0) current = pos; if (current < win.start || current > win.end) last_line = build_metadata(&term, count, &win); /* Set new first column to display */ /* """"""""""""""""""""""""""""""" */ set_new_first_column(&win, &term); nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } break; case 'N': /* N has been pressed */ /* """""""""""""""""" */ if (search_mode != NONE) goto special_cmds_when_searching; if (matches_count > 0) { long pos = find_prev_matching_word(matching_words_a, matches_count, current, &matching_word_cur_index); if (pos >= 0) current = pos; } if (current < win.start || current > win.end) last_line = build_metadata(&term, count, &win); /* Set new first column to display */ /* """"""""""""""""""""""""""""""" */ set_new_first_column(&win, &term); nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); break; case 's': /* s has been pressed */ /* """""""""""""""""" */ if (search_mode != NONE) goto special_cmds_when_searching; if (matches_count > 0) { long pos; if (best_matches_count > 0) pos = find_next_matching_word(best_matching_words_a, best_matches_count, current, &matching_word_cur_index); else pos = find_next_matching_word(matching_words_a, matches_count, current, &matching_word_cur_index); if (pos >= 0) current = pos; if (current < win.start || current > win.end) last_line = build_metadata(&term, count, &win); /* Set new first column to display */ /* """"""""""""""""""""""""""""""" */ set_new_first_column(&win, &term); nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } break; case 'S': /* S has been pressed */ /* """""""""""""""""" */ if (search_mode != NONE) goto special_cmds_when_searching; if (matches_count > 0) { long pos; if (best_matches_count > 0) pos = find_prev_matching_word(best_matching_words_a, best_matches_count, current, &matching_word_cur_index); else pos = find_prev_matching_word(matching_words_a, matches_count, current, &matching_word_cur_index); if (pos >= 0) current = pos; } if (current < win.start || current > win.end) last_line = build_metadata(&term, count, &win); /* Set new first column to display */ /* """"""""""""""""""""""""""""""" */ set_new_first_column(&win, &term); nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); break; enter: case 0x0d: /* CR */ { /* has been pressed */ /* """""""""""""""""""""""" */ int extra_lines; char * output_str; output_t * output_node; int width = 0; wchar_t * w; long i; /* generic index in this block */ if (help_mode) nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); if (search_mode != NONE) { search_mode = NONE; search_data.only_starting = 0; search_data.only_ending = 0; nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); if (!toggle.enter_val_in_search) break; } /* Erase or jump after the window before printing the */ /* selected string. */ /* """""""""""""""""""""""""""""""""""""""""""""""""" */ if (toggle.del_line) { for (i = 0; i < win.message_lines; i++) tputs(TPARM1(cursor_up), 1, outch); tputs(TPARM1(clr_eol), 1, outch); tputs(TPARM1(clr_bol), 1, outch); tputs(TPARM1(save_cursor), 1, outch); for (i = 1; i < nl + win.message_lines; i++) { tputs(TPARM1(cursor_down), 1, outch); tputs(TPARM1(clr_eol), 1, outch); tputs(TPARM1(clr_bol), 1, outch); } tputs(TPARM1(restore_cursor), 1, outch); } else { for (i = 1; i < nl; i++) tputs(TPARM1(cursor_down), 1, outch); puts(""); } /* When a timeout of type WORD is set, prints the specified word */ /* else prints the current selected entries. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (timeout.initial_value > 0 && timeout.remain == 0 && timeout.mode == WORD) fprintf(old_stdout, "%s", timeout_word); else { char * num_str; char * str; if (toggle.taggable) { ll_t * output_list = ll_new(); ll_node_t * node; /* When using -P, updates the tagging order of this word to */ /* make sure that the output will be correctly sorted. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (toggle.pinable) word_a[current].tag_order = next_tag_nb++; for (wi = 0; wi < count; wi++) { if (word_a[wi].is_tagged || wi == current) { /* If the -p option is not used we do not take into */ /* account an untagged word under the cursor. */ /* """""""""""""""""""""""""""""""""""""""""""""""" */ if (wi == current && tagged_words > 0 && !toggle.autotag && !word_a[wi].is_tagged) continue; /* Chose the original string to print if the current one */ /* has been altered by a possible expansion. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""" */ output_node = xmalloc(sizeof(output_t)); if (word_a[wi].orig != NULL) str = word_a[wi].orig; else str = word_a[wi].str; if (word_a[wi].is_numbered && daccess.num_sep) { num_str = xstrndup(str + 1, daccess.length); ltrim(num_str, " "); rtrim(num_str, " ", 0); output_node->output_str = concat(num_str, daccess.num_sep, str + daccess.flength, NULL); free(num_str); } else output_node->output_str = xstrdup(str + daccess.flength); output_node->order = word_a[wi].tag_order; /* Trim the trailing spaces if -k is given in tabular or */ /* column mode. Leading spaces are always preserved because */ /* I consider their presence intentional as the only way to */ /* have them is to use quotes in the command line. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (!toggle.keep_spaces) { ltrim(output_node->output_str, " \t"); rtrim(output_node->output_str, " \t", 0); } ll_append(output_list, output_node); } } /* If nothing is selected, exist without printing anything */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (output_list->head == NULL) goto exit; /* If -P is in use, then sort the output list */ /* """""""""""""""""""""""""""""""""""""""""" */ if (toggle.pinable) ll_sort(output_list, tag_comp, tag_swap); /* And print them. */ /* """"""""""""""" */ node = output_list->head; while (node->next != NULL) { str = ((output_t *)(node->data))->output_str; fprintf(old_stdout, "%s", str); width += wcswidth((w = utf8_strtowcs(str)), 65535); free(w); free(str); free(node->data); if (win.sel_sep != NULL) { fprintf(old_stdout, "%s", win.sel_sep); width += wcswidth((w = utf8_strtowcs(win.sel_sep)), 65535); free(w); } else { fprintf(old_stdout, " "); width++; } node = node->next; } str = ((output_t *)(node->data))->output_str; fprintf(old_stdout, "%s", str); width += wcswidth((w = utf8_strtowcs(str)), 65535); free(w); free(str); free(node->data); } else { /* Chose the original string to print if the current one has */ /* been altered by a possible expansion. */ /* Once this made, print it. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (word_a[current].orig != NULL) str = word_a[current].orig; else str = word_a[current].str; if (word_a[current].is_numbered && daccess.num_sep) { num_str = xstrndup(str + 1, daccess.length); ltrim(num_str, " "); rtrim(num_str, " ", 0); output_str = concat(num_str, daccess.num_sep, str + daccess.flength, NULL); free(num_str); } else output_str = str + daccess.flength; /* Trim the trailing spaces if -k is given in tabular or */ /* column mode. Leading spaces are always preserved because I */ /* consider their presence intentional as the only way to have */ /* them is to use quotes in the command line. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (!toggle.keep_spaces) { ltrim(output_str, " \t"); rtrim(output_str, " \t", 0); } width = wcswidth((w = utf8_strtowcs(output_str)), 65535); free(w); /* And print it. */ /* """"""""""""" */ fprintf(old_stdout, "%s", output_str); } /* If the output stream is a terminal */ /* """""""""""""""""""""""""""""""""" */ if (isatty(old_fd1)) { /* width is (in term of terminal columns) the size of the */ /* string to be displayed. */ /* */ /* With that information, count the number of terminal lines */ /* printed. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""" */ extra_lines = width / term.ncolumns; /* Clean the printed line and all the extra lines used. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""" */ tputs(TPARM1(delete_line), 1, outch); for (i = 0; i < extra_lines; i++) { tputs(TPARM1(cursor_up), 1, outch); tputs(TPARM1(clr_eol), 1, outch); tputs(TPARM1(clr_bol), 1, outch); } } } exit: /* Restore the visibility of the cursor */ /* """""""""""""""""""""""""""""""""""" */ tputs(TPARM1(cursor_normal), 1, outch); /* Set the cursor at the start on the line an restore the */ /* original terminal state before exiting */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""" */ tputs(TPARM1(carriage_return), 1, outch); restore_term(fileno(stdin)); exit(EXIT_SUCCESS); } ksol: /* Go to the start of the line */ /* """"""""""""""""""""""""""" */ if (search_mode != NONE) search_mode = NONE; case 'H': if (search_mode == NONE) { current = first_word_in_line_a[line_nb_of_word_a[current]]; while (!word_a[current].is_selectable) current++; win.first_column = 0; set_new_first_column(&win, &term); nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } else goto special_cmds_when_searching; break; kl: /* Cursor Left key has been pressed */ /* """""""""""""""""""""""""""""""" */ if (search_mode != NONE) search_mode = NONE; case 'h': if (search_mode == NONE) move_left(&win, &term, &toggle, &search_data, &langinfo, &nl, last_line, tmp_word); else goto special_cmds_when_searching; break; keol: /* Go to the end of the line */ /* """"""""""""""""""""""""" */ if (search_mode != NONE) search_mode = NONE; case 'L': if (search_mode == NONE) { long cur_line = line_nb_of_word_a[current]; current = get_line_last_word(cur_line, last_line); win.first_column = win.real_max_width - 1 - (term.ncolumns - 3); while (!word_a[current].is_selectable) current--; set_new_first_column(&win, &term); nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } else goto special_cmds_when_searching; break; kr: /* Right key has been pressed */ /* """""""""""""""""""""""""" */ if (search_mode != NONE) search_mode = NONE; case 'l': if (search_mode == NONE) move_right(&win, &term, &toggle, &search_data, &langinfo, &nl, last_line, tmp_word); else goto special_cmds_when_searching; break; case 0x0b: /* ^K key has been pressed */ /* """"""""""""""""""""""" */ goto kschome; case 'K': if (search_mode != NONE) goto special_cmds_when_searching; kpp: /* PgUp key has been pressed */ /* """"""""""""""""""""""""" */ page = win.max_lines; ku: /* Cursor Up key has been pressed */ /* """""""""""""""""""""""""""""" */ if (search_mode != NONE) search_mode = NONE; case 'k': if (search_mode == NONE) move_up(&win, &term, &toggle, &search_data, &langinfo, &nl, page, first_selectable, last_line, tmp_word); else goto special_cmds_when_searching; break; kschome: /* Go to the first selectable word. */ /* """""""""""""""""""""""""""""""" */ current = 0; if (search_mode != NONE) search_mode = NONE; /* Find the first selectable word */ /* """""""""""""""""""""""""""""" */ while (!word_a[current].is_selectable) current++; if (current < win.start || current > win.end) last_line = build_metadata(&term, count, &win); /* In column mode we need to take care of the */ /* horizontal scrolling */ /* """""""""""""""""""""""""""""""""""""""""" */ if (win.col_mode || win.line_mode) { long pos; /* Adjust win.first_column if the cursor is no more visible */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""" */ pos = first_word_in_line_a[line_nb_of_word_a[current]]; while (word_a[current].end - word_a[pos].start >= term.ncolumns - 3) pos++; win.first_column = word_a[pos].start; } nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); break; case 0x0a: /* ^J key has been pressed */ /* """"""""""""""""""""""" */ goto kscend; case 'J': if (search_mode != NONE) goto special_cmds_when_searching; knp: /* PgDn key has been pressed */ /* """"""""""""""""""""""""" */ page = win.max_lines; kd: /* Cursor Down key has been pressed */ /* """""""""""""""""""""""""""""""" */ if (search_mode != NONE) search_mode = NONE; case 'j': if (search_mode == NONE) move_down(&win, &term, &toggle, &search_data, &langinfo, &nl, page, last_selectable, last_line, tmp_word); else goto special_cmds_when_searching; break; kscend: /* Go to the last selectable word. */ /* """"""""""""""""""""""""""""""" */ current = count - 1; if (search_mode != NONE) search_mode = NONE; /* Find the first selectable word */ /* """""""""""""""""""""""""""""" */ while (!word_a[current].is_selectable) current--; if (current < win.start || current > win.end) last_line = build_metadata(&term, count, &win); /* In column mode we need to take care of the */ /* horizontal scrolling */ /* """""""""""""""""""""""""""""""""""""""""" */ if (win.col_mode || win.line_mode) { long pos; /* Adjust win.first_column if the cursor is no more visible */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""" */ pos = first_word_in_line_a[line_nb_of_word_a[current]]; while (word_a[current].end - word_a[pos].start >= term.ncolumns - 3) pos++; win.first_column = word_a[pos].start; } nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); break; case '/': /* generic search method according the misc settings */ /* """"""""""""""""""""""""""""""""""""""""""""""""" */ if (misc.default_search_method == PREFIX) goto prefix_method; else if (misc.default_search_method == SUBSTRING) goto substring_method; else if (misc.default_search_method == FUZZY) goto fuzzy_method; break; case '~': case '*': /* ~ or * key has been pressed */ /* (start of a fuzzy search session) */ /* """"""""""""""""""""""""""""""""" */ fuzzy_method: if (search_mode == NONE) { search_mode = FUZZY; if (old_search_mode != FUZZY) { old_search_mode = FUZZY; clean_matches(&search_data, word_real_max_size); } nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } else goto special_cmds_when_searching; break; case '\'': case '\"': /* ' or " key has been pressed */ /* (start of a substring search session) */ /* """"""""""""""""""""""""""""""""""""" */ substring_method: if (search_mode == NONE) { search_mode = SUBSTRING; if (old_search_mode != SUBSTRING) { old_search_mode = SUBSTRING; clean_matches(&search_data, word_real_max_size); } nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } else goto special_cmds_when_searching; break; case '=': case '^': /* ^ or = key has been pressed */ /* (start of a prefix search session) */ /* """""""""""""""""""""""""""""""""" */ prefix_method: if (search_mode == NONE) { search_mode = PREFIX; if (old_search_mode != PREFIX) { old_search_mode = PREFIX; clean_matches(&search_data, word_real_max_size); } nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); break; } else goto special_cmds_when_searching; break; kins: if (toggle.taggable) { if (word_a[current].is_tagged == 0) { tagged_words++; word_a[current].is_tagged = 1; if (toggle.pinable) word_a[current].tag_order = next_tag_nb++; nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } } break; kdel: if (toggle.taggable) { if (word_a[current].is_tagged == 1) { word_a[current].is_tagged = 0; tagged_words--; nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } } break; case 't': if (search_mode == NONE) { if (toggle.taggable) { if (word_a[current].is_tagged) { word_a[current].is_tagged = 0; tagged_words--; } else { word_a[current].is_tagged = 1; tagged_words++; if (toggle.pinable) word_a[current].tag_order = next_tag_nb++; } nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } } else goto special_cmds_when_searching; break; case 'T': if (search_mode == NONE) { if (toggle.taggable) { long i, n; for (i = 0; i < matches_count; i++) { n = matching_words_a[i]; if (!word_a[n].is_tagged) { word_a[n].is_tagged = 1; tagged_words++; if (toggle.pinable) word_a[n].tag_order = next_tag_nb++; } } nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } } else goto special_cmds_when_searching; break; case 'U': if (search_mode == NONE) { if (toggle.taggable) { long i, n; for (i = 0; i < matches_count; i++) { n = matching_words_a[i]; if (word_a[n].is_tagged) { word_a[n].is_tagged = 0; tagged_words--; } } nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } } else goto special_cmds_when_searching; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { if (search_mode == NONE && daccess.mode != DA_TYPE_NONE) { wchar_t * w; long * pos; /* Set prev_current to the initial current word to be */ /* able to return here if the first direct access fails. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""" */ if (daccess_stack_head == 0) prev_current = current; if (daccess_stack_head == daccess.length) break; daccess_stack[daccess_stack_head] = buffer[0]; daccess_stack_head++; w = utf8_strtowcs(daccess_stack); pos = tst_search(tst_daccess, w); free(w); if (pos != NULL) { current = *pos; if (current < win.start || current > win.end) last_line = build_metadata(&term, count, &win); /* Set new first column to display */ /* """"""""""""""""""""""""""""""" */ set_new_first_column(&win, &term); nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } else { if (current != prev_current) { current = prev_current; if (current < win.start || current > win.end) last_line = build_metadata(&term, count, &win); /* Set new first column to display */ /* """"""""""""""""""""""""""""""" */ set_new_first_column(&win, &term); nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } } daccess_timer = timers.direct_access; } else goto special_cmds_when_searching; } break; case 0x08: /* ^H */ case 0x7f: /* BS */ { long i; /* Backspace or CTRL-H */ /* """"""""""""""""""" */ if (daccess_stack_head > 0) daccess_stack[--daccess_stack_head] = '\0'; if (search_mode != NONE) { if (search_data.utf8_len > 0) { char * prev; prev = utf8_prev(search_data.buf, search_data.buf + search_data.len - 1); if (search_data.utf8_len == search_data.fuzzy_err_pos - 1) { search_data.fuzzy_err = 0; search_data.fuzzy_err_pos = -1; } search_data.utf8_len--; if (prev) { *(utf8_next(prev)) = '\0'; search_data.len = prev - search_data.buf + 1; } else { *search_data.buf = '\0'; search_data.len = 0; for (i = 0; i < matches_count; i++) { long n = matching_words_a[i]; word_a[n].is_matching = 0; memset(word_a[n].bitmap, '\0', (word_a[n].mb - daccess.flength) / CHAR_BIT + 1); } matches_count = 0; nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } } else beep(&toggle); if (search_data.utf8_len > 0) goto special_cmds_when_searching; else /* When there is only one glyph in the search list in */ /* FUZZY and SUBSTRING mode then all is already done except */ /* the cleanup of the first level of the tst_search_list. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (search_mode != PREFIX) { sub_tst_t * sub_tst_data; ll_node_t * node; node = tst_search_list->tail; sub_tst_data = (sub_tst_t *)(node->data); search_data.fuzzy_err = 0; sub_tst_data->count = 0; } } } break; case '?': /* Help mode */ /* """"""""" */ if (search_mode == NONE) { help(&win, &term, last_line, &toggle); help_mode = 1; /* Arm the help timer */ /* """""""""""""""""" */ help_timer = timers.help; /* default 15 s */ } else goto special_cmds_when_searching; break; special_cmds_when_searching: default: { int c; /* byte index in the scancode string */ sub_tst_t * sub_tst_data; unsigned long long index; long i; if (search_mode != NONE) { long old_len = search_data.len; long old_utf8_len = search_data.utf8_len; ll_node_t * node; wchar_t * ws; /* Copy all the bytes included in the key press to buffer */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (buffer[0] != 0x08 && buffer[0] != 0x7f) /* Backspace */ { /* The only case where we have to manage backspace hits */ /* here is if the user has entered them in fuzzy search */ /* mode. As the search buffer has already been amended, */ /* we do not have to update the search buffer again. */ /* '''''''''''''''''''''''''''''''''''''''''''''''''''' */ for (c = 0; c < sc && search_data.utf8_len < word_real_max_size - daccess.flength; c++) search_data.buf[search_data.len++] = buffer[c]; /* Update the glyph array with the content of the search buffer */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ if (search_data.utf8_len < word_real_max_size - daccess.flength) { search_data.utf8_off_a[search_data.utf8_len] = old_len; search_data.utf8_len_a[search_data.utf8_len] = search_data.len - old_len; search_data.utf8_len++; } } if (search_mode == PREFIX) { ws = utf8_strtowcs(search_data.buf); /* Purge the matching words list */ /* """"""""""""""""""""""""""""" */ for (i = 0; i < matches_count; i++) { long n = matching_words_a[i]; word_a[n].is_matching = 0; memset(word_a[n].bitmap, '\0', (word_a[n].mb - daccess.flength) / CHAR_BIT + 1); } matches_count = 0; tst_prefix_search(tst_word, ws, tst_cb); /* matches_count is updated by tst_cb */ /* """"""""""""""""""""""""""""""""""""" */ if (matches_count > 0) { if (search_data.len == old_len && matches_count == 1 && buffer[0] != 0x08 && buffer[0] != 0x7f) beep(&toggle); else { /* Adjust the bitmap to the ending version */ /* """"""""""""""""""""""""""""""""""""""" */ update_bitmaps(search_mode, &search_data, NO_AFFINITY); current = matching_words_a[0]; if (current < win.start || current > win.end) last_line = build_metadata(&term, count, &win); /* Set new first column to display */ /* """"""""""""""""""""""""""""""" */ set_new_first_column(&win, &term); nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } } else { beep(&toggle); search_data.len = old_len; search_data.utf8_len = old_utf8_len; search_data.buf[search_data.len] = '\0'; } } else if (search_mode == FUZZY) { /* tst_search_list: [sub_tst_t *] -> [sub_tst_t *]... */ /* ^ ^ */ /* | | */ /* level 1 level_2 */ /* */ /* Each sub_tst_t * points to a data structure including */ /* a sorted array to nodes in the words tst. */ /* Each of these node starts a matching candidate */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""" */ wchar_t * w = utf8_strtowcs(search_data.buf + old_len); /* zero previous matching indicators */ /* """"""""""""""""""""""""""""""""" */ for (i = 0; i < matches_count; i++) { long n = matching_words_a[i]; word_a[n].is_matching = 0; memset(word_a[n].bitmap, '\0', (word_a[n].mb - daccess.flength) / CHAR_BIT + 1); } matches_count = 0; if (buffer[0] == 0x08 || buffer[0] == 0x7f) /* Backspace */ { node = tst_search_list->tail; sub_tst_data = (sub_tst_t *)(node->data); sub_tst_data->count = 0; if (tst_search_list->len > 0) { free(sub_tst_data->array); free(sub_tst_data); ll_delete(tst_search_list, tst_search_list->tail); } if (search_data.utf8_len == search_data.fuzzy_err_pos - 1) { search_data.fuzzy_err = 0; search_data.fuzzy_err_pos = -1; } } else { if (search_data.utf8_len == 1) { /* Search all the sub-tst trees having the searched */ /* character as children, the resulting sub-tst are put */ /* in the sub tst array attached to the currently searched */ /* symbol. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""" */ tst_fuzzy_traverse(tst_word, NULL, 0, w[0]); node = tst_search_list->tail; sub_tst_data = (sub_tst_t *)(node->data); if (sub_tst_data->count == 0) { beep(&toggle); search_data.len = 0; search_data.utf8_len = 0; search_data.buf[0] = '\0'; break; } } else { /* Prevent the list to grow larger than the maximal */ /* word's length. */ /* """""""""""""""""""""""""""""""""""""""""""""""" */ if (tst_search_list->len < word_real_max_size - daccess.flength) { /* use the results in the level n-1 list to build the */ /* level n list */ /* """""""""""""""""""""""""""""""""""""""""""""""""" */ int rc; sub_tst_t * tst_fuzzy_level_data; tst_fuzzy_level_data = sub_tst_new(); ll_append(tst_search_list, tst_fuzzy_level_data); node = tst_search_list->tail->prev; sub_tst_data = (sub_tst_t *)(node->data); rc = 0; for (index = 0; index < sub_tst_data->count; index++) rc += tst_fuzzy_traverse(sub_tst_data->array[index], NULL, 1, w[0]); if (rc == 0) { free(tst_fuzzy_level_data->array); free(tst_fuzzy_level_data); ll_delete(tst_search_list, tst_search_list->tail); search_data.fuzzy_err = 1; if (search_data.fuzzy_err_pos == -1) search_data.fuzzy_err_pos = search_data.utf8_len; beep(&toggle); search_data.len = old_len; search_data.utf8_len = old_utf8_len; search_data.buf[search_data.len] = '\0'; } } else beep(&toggle); } } free(w); /* Process this level to mark the word found as a matching word */ /* if any. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ node = tst_search_list->tail; sub_tst_data = (sub_tst_t *)(node->data); for (index = 0; index < sub_tst_data->count; index++) tst_traverse(sub_tst_data->array[index], set_matching_flag, 0); /* Update the bitmap and re-display the window */ /* """"""""""""""""""""""""""""""""""""""""""" */ if (matches_count > 0) { if (search_data.only_starting) select_starting_matches(&win, &term, &search_data, &last_line); else if (search_data.only_ending) select_ending_matches(&win, &term, &search_data, &last_line); else /* Adjust the bitmap to the ending version */ /* """"""""""""""""""""""""""""""""""""""" */ update_bitmaps(search_mode, &search_data, NO_AFFINITY); current = matching_words_a[0]; if (current < win.start || current > win.end) last_line = build_metadata(&term, count, &win); /* Set new first column to display */ /* """"""""""""""""""""""""""""""" */ set_new_first_column(&win, &term); nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } else beep(&toggle); } else /* SUBSTRING */ { wchar_t * w = utf8_strtowcs(search_data.buf); /* Purge the matching words list */ /* """"""""""""""""""""""""""""" */ for (i = 0; i < matches_count; i++) { long n = matching_words_a[i]; word_a[n].is_matching = 0; memset(word_a[n].bitmap, '\0', (word_a[n].mb - daccess.flength) / CHAR_BIT + 1); } matches_count = 0; if (search_data.utf8_len == 1) { /* Search all the sub-tst trees having the searched */ /* character as children, the resulting sub-tst are put */ /* in the level list corresponding to the letter order. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""" */ tst_substring_traverse(tst_word, NULL, 0, w[0]); node = tst_search_list->tail; sub_tst_data = (sub_tst_t *)(node->data); for (index = 0; index < sub_tst_data->count; index++) tst_traverse(sub_tst_data->array[index], set_matching_flag, 0); } else { /* Search for the rest of the word in all the sub-tst */ /* trees previously found. */ /* """""""""""""""""""""""""""""""""""""""""""""""""" */ node = tst_search_list->tail; sub_tst_data = (sub_tst_t *)(node->data); matches_count = 0; for (index = 0; index < sub_tst_data->count; index++) tst_prefix_search(sub_tst_data->array[index], w + 1, tst_cb); } if (matches_count > 0) { if (search_data.len == old_len && matches_count == 1 && buffer[0] != 0x08 && buffer[0] != 0x7f) beep(&toggle); else { if (search_data.only_starting) select_starting_matches(&win, &term, &search_data, &last_line); else if (search_data.only_ending) select_ending_matches(&win, &term, &search_data, &last_line); else update_bitmaps(search_mode, &search_data, NO_AFFINITY); current = matching_words_a[0]; if (current < win.start || current > win.end) last_line = build_metadata(&term, count, &win); /* Set new first column to display */ /* """"""""""""""""""""""""""""""" */ set_new_first_column(&win, &term); nl = disp_lines(&win, &toggle, current, count, search_mode, &search_data, &term, last_line, tmp_word, &langinfo); } } else { beep(&toggle); search_data.len = old_len; search_data.utf8_len--; search_data.buf[search_data.len] = '\0'; } } } } } } } } smenu-0.9.15/smenu.gif000066400000000000000000002051141344767411600145730ustar00rootroot00000000000000GIF89afff3333ff3f3f3ff3fff33̙ff3f33ffff33̙fff33f! NETSCAPE2.0!,I8ͻ`(dihlp,tmx|0p Ȥrl:PS1JZجvS$ ǂK.贺`||NN8 SP p)m`c` hEz? FE' Ɔ` ϧ֍rbr= H*\ȰÇ#JHŋ3jȱǏ CIɓ(S\ɲ˗0cʜI͛8sɳϟ@ JѣH*]ʴӧPJJիXjʵׯ`ÊKٳhӪ]˶۷pʝKݻx˷߿ LÈ+^̸ǐ#KL˘3k̹ϠCMӨS^ͺװc˞M۸sͻ Nȓ+_μУKNسkνËOӫ_Ͼ˟OϿ(h& 6F(Vhfv ($h(,0(4h8<@)DiH&L6PF)TViXf\v`)dihlp)tix|矀*蠄j衈&袌6裐F*餔Vj饘f馜v駠*ꨤjꩨꪬ꫰*무j뭸뮼+k&6즳F+Vkfv+k覫+k,l' 7G,Wlgw ,$l(,0,4l8<@-DmH'L7PGP!,F A*J7)bPoga`À6A|fG‽>VMZ، GN2 ^ ƅY7! , o!T[!,  3 1A*JBp1yY('!V`_0°?IL!,( /"A 9 3*t_( 斖-J;nlh3 ! ,8 -0`Px< Y.&xBR$!,@ 14ɩpwe`#zi WCצc 3}/$@F(â1!,H o!T[!,P 2 30 R:E |`4b)' P*@mݡt@ @,JC#Q! ,X -!L 9 3VDT3x(-iF 0/$!,` 1 10朼L5r1+BC9RrZ+6A#wBYa@F 0E !,h'4<0B!bC+ϯx lv~ !,p'4<0B!bC+ϯx lv~ ! ,x o!T[!,8R02'+hϲ~0(^V(Yq+@`Gg KgX̥ !, 1@1A*J%pF Z_TXP*:@ ncnA`Hš !, /! 0JPb YRXZhʬ'|K`0r! , 0@1A*J%3;:D~@D )ՠ*|g0BA!, dihlp,tmx&䣑H:PY`0ѬV۰&>((1-JQqP*}򌤢' Ц3+f/\yB:/tk!, 7o#,! ,(&1HA Z1x p . ,]J@,5d2!,77!8ͻ`Mlp,tmx|pH,ȤrltJJլv#wL.&Xzx<~o+~Ci8{hbk !,J *pƈX!,J *pƈX! , J *pƈX!,(J *pƈX!,0J *pƈX!,8J pƈX! ,@J pƈX!,HJ pƈX!,PJ pƈX!,XJ pƈX! ,`A L08ͻ d9!@$!,h? 0C ʹ3 X JWQJ|D|:DB!,pJ pƈX!,x;+2DɩFcRޗI6JAgp,tmόH! ,;<$,0P 2!vπ@3Δ4G8O$#  &^A8NU`!,? 1 3!*JBhdNב# MJ%Alu ˈo[AF!!,? /3A X4 Y[P|4#5]::K. |1C7! ,? .3A Z`"PH hR_F0o`bu*I !,? . 3!*J\3;Ev#06hi*y.s|O@Y0* !,J pƈX!,? -3A X`jEQ ( Fp)zm`19P5(`HD%! ,? 1 3!*J\s Q|"i@\tD@Jc i$$!,? 1H0JRV 2AS!@Q7H,JZ|Kp(!,;8 "00ꓐ P|` jCQ Bq8 3Q2f !,;**#!kT|&,޸ & ! ,? %0L*J53W^ȄH~ɾ0TyB@!,? 1(0JQj2SS B[@J[qs|ӖPH` # !,J pƄ$!,? 5(#1-JpJڄQ]=jFVTWx!+cDl2 ! ,? 03A X`R1Du#!`B"gdY=yLc HO!,? 0(C1-JD{s sNQP8>#{ݢ|ϱ`F@!,? %0L*J53Wd^Z@gȾ0TyB@!,J o1˃(! , ? +30JBR a8fyBG kuKxGMߏ0!,(;6HaGYݬCAW.Dm0Mە&2* R8!,0? /3A BX 539`8LEPA1m+\uP!,8;'*O" Y!˹yhm_.B ! ,@? (30JBR އDQZ]ҬhmP!,H? /3A BX RP$ج'ȠiZ1@j8!,P? #@30Px`(*BӁ%2^#7'!,X;(4 IJ{3+렖}HJAlp,t-C! ,_J JpF6!,g=,0\b q! DP8V&)РJCxZYp(L!,o=+0\b q!BqF@S lBhVcP!,w=,0\b q!BqF@TJCxZp(L! ,J JpF6!,;, #0AɩDqj}%@p,tmx^3Cp(H!,;7"-0PFjq4q!F}3Y̰ݬz_O#He4ZE!,;1 PAi@pVs* ˏHϷڷ#YN$!! ,;8*BACb6ĕó}Au-DLV\z֤rd¬P!!,J *pF$!,;A".QVj:n 68Pf,:)B Ao鸞|lU5̨tȉPbH!,;=J"AP 3BYX,aw9Beyl:3hhX! ,J *pƈX!,;4*/#ltZ|EހB +J•% Ѕoc $!,;9JѢ#(hTdy NXb + 4>!,;@".QVjpe W[ 4v@32]@,:P-D9삐! ,;4*/#!웎9h7.d)AM]*HpL8d!,;3 ̤022@ Q;2L1k$YnBcIH!,;. V^pYٲE Y7w|'@ ( !,;-4Bɩ+RKM}U葊T#p,tm߱0~p( $! ,9;1Zn  %lT /,ÓŞ<ΧZIRCDi.t* $!,J@pH,Ȥrl:ШtJJvzpz|N~|pElsYCXGdfBJOFEO{ƤNegҸCɤBDMɉBE=_%!ua}*!z G%&dR%8iU`2,lz$YVb3,,3{=.jݺ1"6;sQHnrO,PgZk+*=cęN WBoVbKp-ytc8I h%2XdfOH}ߊ%MfeIvscN_*DV1@Q99HBM|'[@u>vtsvGIqHpa΅}svuOlވxu1H!qɦق8`]$:*WsHavaS|̨zoGmskV2W"f:Jv%$(cMoe P]zPjh!N_[MpiRZ_!qVeŸd-ꢚIȇreIVk6XxVkj@ɣI$^c.鷓{"DDH~ɐLS4-1$J(8'XUwW+l_{0$QrH.LX^y +n!„c(KN!2,]1dillPtm,8o9@ 3T*%Pҕ|#'@ p21u3t3Y5iVv0e`b,mZl4Nw]_+2WlrnIFzLZFEmIdVU46spf>:?su[.ПҴ7-Z|ё婪WrtqF 3|Jv1+A:RH"PD$! ,]1ITͻX(VAah:lX4j bH`a`Z~a 8VPZ1WA\ xb@^*a3qYpDW-fS&Va[v^IPi{73utB>wT@^b}Ks%L şǾtz'ӖH`nېhjl@BFv/Oe5d813ƍ !!, ]I diBlp gmE|\F,ȤrXlШn(PR\k e`t=)z^)^|`by4y4wfCsmg{XZ#`)9)O4fs<TUW"'hOge9Ƙ;z^~{)y)e:B\Ҽ=xGؖ#^Nͼvf=o?_&3#Mo-ÇkZQf`FhRh*,SL^1iKIL9&čc/\&hsmJ @N!2iB?ֲ .s#;1x2 , !, ]Idi @lp Em |ҸM+]@axlGA-Z ex5L5K]o^C^fZTf[+]buqejhrldst,wyR#RVeej)cskvV:RY5/^.]i\*#"Z.-ub˔uη$Կ+j],o*QzIꂵS!V1y f)H l~ɐLS4-1$J(8'XUwW+l_{0$QrH.LX^y +n!„c(KN!,]1dillPtm,8o9@ 3T*%Pҕ|#'@ p21u3t3Y5iVv0e`b,mZl4Nw]_+2WlrnIFzLZFEmIdVU46spf>:?su[.ПҴ7-Z|ё婪WrtqF 3|Jv1+A:RH"PD$!,qO :hh*6K40 Ô5@ -&' JԕKeݲUHY\W,#~!,w + A*J@FΙcߑd6hiͺ12.=y*! ,w (Ӣ0*1`OF'V*D0)Anդ*j!, s3"pHb:dgBG]S[iM@Fǡ*@g9J!,(w +ӡ0*1`BJU7|xd#@DUpxБ!,0o1! ,8s$RBɩ4ܘ'DD@lp,t-3C !,@s6!-J0` cΑ@DF1gX~mɵSPPRơr p!,Hw -ӡ0*1`B|#.h~Tdip@ A$!,Pw ,Rɩb}@') A0kmH! ,Xo1!,`w *0J s;dypD0BBz֜|?` !,hw *0J FLicߞ06 } VV|O$#!,ps& 0B8ޜ7"@rk7 +leeC! ,xw ,0J FMicߞ06M`B*12hfe9q@ J!,w '0JhdZąHjrB t5 4V'ĩjA(l:U !,s"c{4.ZNn $ʶ @B!,'I8ͻ`(dihlp,tm8S0G> d_'Ȃdݎ4זO o`q-Je]pV;cTv]cABzV]IKx.gmQlYPCGQmGBlhV[m.Io<T>Kx~A{i:FhQGUh˜qe, e6KbRF&f#*ص֥@7,+HK%_G|!iaS'J++IDE jsK o@A$f'aGQ\{hQssKqtQ:+mÐhG$F[*iTK꫽Bv |Eq)*=z'T"$ :TpbXb\n_`j fxmg!,P dihj&O'4z " eƑ%9xEUdcܶ`43jT\Y[.{+ۣ~?!,9!01 2'Q`& vIl{U5BȉH1P9Pˌ!, L0IE8_–T)hl;!$!, BJ!0U+(^C&xM!^>̷OD)ihP'%(Q)g;$! ,(4K  :2}KG:u*Һdzi s` $!,0 ;@"L*ƨbN1Z(YcP(p]kVgu-B `i0RQ!,8 &@*JF3DTaXj*nHx| <$!,@ 0*/b}#}HJ@ .yOS.'oH,Fx@! ,H 3B0A Jp]*YbZq@0toEy /+CMK!,Po1!,X:! Fh0:-x0Db\ʙ~~  9K $4\:`rjI!,` 1D0J0joJ[]F 'kKپM(lH,J.'! ,ho1!,p3BP!b TÇi'Y愲VH!,x 1B02_A@Ex(# ZuSB[)(|I*\ !, & 01}2 x}HfVB l߲E탐! , -*B0j6=b8!T誖# B+TVLA !, -*B02tGvq@PU:v$!,2BP!a\Ž-5.s L՚k-0WOf˩P!,?* E'(ަxSlC0!x&ėRZ߫J5ȝ,]Q)\oūn4 ! ,@* E'(CԉV81Ըx&WR˫+0ɡ*5L`Y7IG!,2BP!a\†} E.ٹ*0Ujvm8וּǻDp<2R!, ,@"0B1RZYa])K[ @J!,5@!0U^(DiĆ CAjd.ENCiЊ % ! , /@"0B12FȒ1[eBdZ7fŴIZ pH\x!,8@!0U^(BiĦPFdd.GLE0( ZNlFF !, /B$-JU cNQg}`#zYIi) ܖؠn 5pH쎰!, -@"00RZYaaHud_k$· B$! ,oR!,0B j1Wa"1ey) Q-@k ܞt6] N!,0 !jop_惦lkn,tmx|pH,ȤrlΨt:%\Ԭv ܰx"00zyۛ^},i}62_3zcE !, o!T[! , o!T[!,  o!T[!,( o!T[!,00J!0U^IHbYٲá\Ӟ1TpBA! ,8 o!T[!,@ 2 106(r .ayB倦\! [@#@,$"Q!,H 1"A 9 3DqFu_hJZ ׯ`б(vPDc'!,P 4@Ѥ0*1FOQ%Uhi+;@SeWdWlHNsL*! ,X 4!0Ai56P'>*{ں=P2Ih$!,` 3!2 Fh0:-\w9`xfXOeD`H(&(H!,h o!T[!,p 0A+8ͻ`(rKZiB! ,x@1ɩ*΁o0Kv`,lA`k AECw1ĖkʨT ZԪJ!, o!T[!, D0ڋ  B!,82pi zx `:U0 m"Z@[ֆ ,ͦ ! , o!Z!,  I8ͻ&0$! , .#0JX]3m c /*!tO3`  ! ,V 5j#?B@hJ}$Q8R;[m!ݣ1 K5H!C1{%N!)6a }/z u"6.H!, *0b !, +0Ak8ͻ`(fcy&!,@(#1-J spzV} HBf$0r%8cvO)!"Ɠr)!Ş %! , (cHl q [6RDEx!,  eA0,tm" g;xR%([0˥ ުjeào[t5Hn_SnPQ%a)U$P/o*x_W)w1xn7~F'&/i(i%>/_kd{j#Y$]0)P|7͊MhP͐6̹)Ѕ-RxY(MxDEпL S \%+,,lѐ&hJiAu 7{S&ijh:%<Oe8Lr5S *K6c*T "`ڔ$UJLJO+7SF C;50Kj!)!'-ɞ6ZpM\)9@>:.ӥLS51*ĽIy3-3)x336 )$qqQ%{ u$W-ԵËOӫr~ßO󏺯~F`v̥v+pe~>"W~Ac]ap``hW&FW 4j[,`$HGc'*FX=$ڣ\s M uIrZX\@kQ#U:jaQc[o*V]XE<ƐIb [_WxWeb fPd8R9g|yH:V#t7(oD{``#at#sPQɞ S 1Q/SfV8Q XE''a( KG1K:/1FRgbV':VnגZx0 9Xe᝻g#˿¹59LuO*/g`̏ebR? }l@#:(zbYs /BåD_HwtL÷tPtTZ6xEU+ )zu5¡5pݚGRma)8X<0}[jM:iك (7`i8-%& 7E$;v9i ˍMB:ŪFp&o}RkmrGq{NN;Vb34Z0 ۺZ,,FQ)lc 9lrreTLSq{W5߆}w8 `@/p'' aw à-㛛?6JQa ,DV Kh LPυ0,Y gx4H*aC* I0 3PQ06}CC@S8aAe* (no˓g04Z4jXZم 1lLE5"l5G7nd `N&?0ObINb{^.J \cFSfPYlWZK 9ow@$ .],R$`Q0n~C)^>S5bL Ia ˬWMUrh_{t^ūI5lsdj28WlVD2 "H.Q,P ݘz H?Qp`(JWҖ0iFYRB8ͩNgZS4&; PiS+i.ʒ/TwB bJԬ$9^O0!qJӁC)%kX2V!(J9HNpš&(UJ_bP+Lb,d cy=kf֥+:1L hy9miefbU- m?@Z0x Q7]VJ*۟ hnY[e(W\) 2Q502\'ԮT=+>&IA%@iAE,Uύ`ʃ=,}ۂlx-|(3H\H4BN]TYҘ)+m )ӠG=MszjS5 ::KV /8u"`ţ0y&:8* U"6B܌πgFezea;8qtYh^b28jJcSdAvH-bƱ{h#LcNKl2?` µ \P\5r"`T>5c{52wo u> i1BPDFt5'\1p{S)VW)lL&ĎVix 7&'1G{vz XM\J%co7_ 7\J5'#p' u*B9]|CjL{=&sߟym^S|$qC0F*K[dzHl#TgiXᛋf!ݿr 9j+lïTCQlJP2FP\zo]b-7<]1KV ODxT!$W/r!ɀAd10iWp3F(rp!uh#Cb*BKȁrr*Xw,& tL_;(_Q0sUE~tM{ddb8[1Mh[uH8>.'CqV."(mYAhpwrywVc iD:2O~ex7l \р|8B&LJ64gX*)sPPX6UHh3EQ,`|{]{148tEcʸN·z~22N!OaW'hBm93`}b_wW}и N4Poq78p(@ A%X"bvr%F> sxBAS!F:7'J'S5qc_PZ`w(G4aRtU8| ?EڥZF -@GEPI @Ԩ֗'k ZU]A"6@x5%H;"Í1،PÌi5XJsY@2!J2c(z.$uؕX-I3TyhNG gix߸qt""a)_G*k}$7 %a L!;Tc: iTq?XekV):s(0|}y6ZmAËLPd܁{(tzxYjzuk ~9A%;amg}]3za0ut8Q`MGy5 JCFɐ(=D#q(H8Z r% oG["Sɢ 24ډpZګ2t{6W>oЈ u]$%+d1&f#a32"2&鶫̈́OJX}Gb%JD|twd$ 9ʉ-{l9LGl ?KQ b!6@@p_( ';QtUq+1R+ |@kR$.l2Sh!$EGx &=Rk! ,9I8ͻ`hh!ɾp,nbx|pH,$5rl:Ad JZT)z -xL.:^6|N_~uneZ3.-%$*~ö}һ߿yL Ak MiC,_Y 3;XK3\GGIՎ I[ ]H2b<ˣc6s"7 +HH|rΧP}*LB.&5ʶУܾ+XW(*޶zDPzC'q^(Yg ?^5+dӨS^:b#P۸sͻ6ohNokV>w .4( R6ȡ tVsZdԈ Yuѽj.a]ɦ 9vlx͝N:Ұc˞]@!,LI8ͻ`)hlbtmx> H,OBqd&()Z[ԫvr7L9v†xs-< ~ 1 ~zvrmie/*'/2$g͞/kB  A " G=1$*;w.$0q.~6pPB"qFqO',.',qX.}+nPh/t_,D'?*1]>XSқCL,OP?ȶcqAKPo@\0+Ag*\ȰÇ#JHŋ3jȱ CI-D$貦FϦoYf@Gsو;KR-a)b;Ú)c`5.eCNUvV^'`k?Ƣ4YkxG#HјP+4:Oϥ۸sͻuI)Ppݢkq<7 əi{TB껉ջCq%ÌFT_C'J "g!&(|$ā1x$ 6BRAYr DhfvYd0HLH7W3-J>IuRYd6l]LE@# 9`}'Ohv$RB(_ҴXy# %Ǩ%e!aQ*Z*'9{T !UY$<0Ab)Dc,,Q#΂[RHqy-5,+k[E=oH6Qޱp `Y.` gUh<L٤;S 2zŢyoƲ@A2`Af7o&p=3zE/*@CCnH:WL\w`6 }R=@BX` [#%$X T221yxgW;6x`Bz}9pM9i^we-gײCNNu҉A&XC,ϯ?ƃwsb{c_okMfMNvXm,eNƕqZP1AdWƃ+舁y ̠ͅ U탞 GHSJHSZ): }cav 2 7U؁t,be]i`7=1KujX0XzH14I8Q1FnP,|c=he! e _^B5EL!ב3?$t(CIrF@6 "J rf=:,:ȲJ;j MD,)97 qD\tѲlrSX3O5MltH%r:9שt4; H) H>{B P4?)8PAN.c],a`HMdD@qIUFХ-c3~4" ItgDFaF(fZA\z*MT4S/cB&mV0TP4h:P!%*=ĿWC!2pO + wdԞGC4$5sd R64,;3Ysr DD^_v Md[9G`Pn5DmKψ1&& pO Ƹq]S0$ N!PPnɔ @2і9)1ULvWbVws[[9(o lYO0h‡Y V;`|7IAZRnAD +qL_ѡ7iw@SPW7Rzn孞N (VdI$AC -A1ܾ._\޲Lpw>03}Ґ0dt+HEI vf[Rة3Xh'M&M0R1Ci5'y&ñK{4{ZB߃fDәɨ~c0z~ cYW>枼 !!,h"H8kMF0llhM9Hlm@2Mt+/A- FnrDJg-d8z [hDiv s{mon:4|zt k:> lS 2o!_?^^QN/>-0dv׿T _ϫ ̝_I谣]:j@8R)=h` }$b!M`2˔V2fLTm^մ)Ɯ^ǮH*]ʴӧP1F Cթ6TU RgB|pd^&T Kh..~ۧ/F"bDƈޜ}0 + Q8 Vy4.?E_IO/~L!i Z0FLFXy/paӁG-*p#yC[H@Q^'YA?ga@P|y' M"T@~9(P SNKMpaT ($h"↊b38/.3Sp#5ZL:SА J?iȤ2NQLrn(Zc3] fK}i@n!n5 S'!GA{*蠄j\xAq%Q2_}$ g5:uI҂]T:v`en*cfTkQǤ:J,81ᅫBhi(,\:$1e\!k{9mhq*eJ𘷩U ..Bp.t;P.Nn vmI {Є`WFHz57 G/T+(md:i:qT4 r#TBJ!52dԁ)t3fʜ;GkPG-TW=ydlu"|ed[9<Vf+QJ1Dw Gh 4 @keCՀwɃW` wx^|~2d=|Cw]$Wz/ sL0L\KC>5)j=!dRn6඄F@n=1꼸%,G.KmwHSНW@DvclCli3]$[-OA^tDFܑȓ.u5t$*, MANkZ\Лh/9Li ~ D=]jYk$CSS-N`o,Yij]؝(BtrD961JtsXyOIB"bA% ;F6#[&,gcڡ W(EB%TI%"H\%-!)Xʡ3u >?]":<Cq ET*I `fGDir2 NjP1CH9gSqk Y t6*ĠS&"І:)H&Iܼ}{Vw sUBQҕ2|9`PS_3IL/P&xTw)}eRt,PiRqJ͋M2KFLrX+} d[[cv j~H]! ,`CҪ cRt.#ɂ\`適;G!%‘I!6t .")=4=HZG@Dl MMGކh6皃?>r+K6MAnkO z=oDn]X_1-}ߕ]~ޒ(oc Hi'!,t0J 8ͻ$ShlpemCr|L[oH,"0\ҐPME/]%+dA `J'^iON'g-j*qPHlnwWU6|]q4IIGfLuV _QXTlP|(qP(uuPJHqrmM$a¡ŨqsVQp#]ۉ̋nEi3l#vbg^{dV D3*c[b3ˆzK1ilSk=zdZ~0۸sͻ! ,`"d9@)tmx|^ @U Ȥr,)5ج9۰xD %aҢ_@$a(i+PFB@I?]R$=,P$t3#gF#_"p^(jwRф^wBEP-)0U,״փw]iᑂOs7ӻxǰa!v B!@0J**“N7\% 䮖0J`țL'OJ@ "&Χ,DJHCs%x%I@),IPmi y,:!R 丢>'Wdc:*n'RJ>aqm3D[^kG d(ЄY{|A|U s**( qǍ#~ƼУKNz(BQf":1p0Pyc3IH}V3C , zQC  P*!}܁ID_DVYS"4h8<:ETPeXCEЌ8۴D$P0vB 3NΒ7yԠ(8_|7r@r E|)-T'loR#n6$'f'̼c\9P2M&[>9YnCiA&q%eg j=5&s>VҚy`\_Iyט@Zl6ț&@\ECtjr3( 1^Ym6W; $Y%2䤓8I7L mM}>F,Wl':,-Q0pЅÜgmC42 q@2RO%%s602NFH<#qwLVB!֓b,Eݴ $f dtHOQ"-5< zL"ٽs݅ Cc6&c4v1n2F*4Y3,2OF̟9$ލmC3grܶ[aq|7G?R <o=s(_D}3 a۩>N!KgRWo;j0HZgO5Y!`1Ѐ E|Y n $´lH pv*x3 *!J𶶭P#jX/n9AIKy?.]AŤ% 9T@{SK03A!HxD!>$ H:x/4nW܈DYhQ\rddHl2[&H#{2%g=H0'_ܚ$x2$eF&:P~tWCI4y(Q)os CV/j BgP #6VIƛAմE4B1qx M!y\R @K (HъZ jFOgl(HG4"+uhVFexz LŦh\4nGn$Hf;AA N%J4>IUǐ$?c@GB[(kPz"QI^OuuT5e)s-p͂_0tCW ,UZvHFfj>Ydey &QO1CaufߙxvPC;ˮ|; 8[wqY-wmh>TF OPF! ,O9I8ͻ`!IhlƁnmx tnV*Ȥrl:ШtجvBްxLz}^i;NZ}M w13A(V>V+3"'ٸӹ#pj5Tyq)Ѷ*j73;.2 26N1^İw7 "/ E"w8,䆏 (#I9LFLF\#I8( a/,in'&&}!ϞhPt9J˃T/}j~UAq+s,wMՏKMki>?|ub]x \vSNMaCL˘3WN! ,=&pI8I`(dih$tݭx0YmHzȤ d& qz?@lUy2۾82&3M%tvly{~tYRm j wmBqthuwm \fuch|_tuR͢|FKֶlf߅)tQܹţG0!wo~ ,H=ScG2A%IfRe++%:4/o+7o61$`q㾊L0-uO%dx be)W3.Ew;zLa_cYX#vG"kam< \wnoe/hh+JJ,'h-}J/Wf7&>&T%dƺjOG*a{31qwq+X5heǙ yipLWlzȘҼpf&{" L Ԕ͂ѹ(h^#棦8.^b +"BK,f߲fb iԵl+xcmޘI@!2 ,O9I8ͻ`%hhp,ϳKxS6pH,Ȥr$JzͨtJZuzYwL.KyncZ|.x=S~G$~wa;-/p86'.#ؽѽ̓Ի y9 t+&[6l-128l!}۰G#5vh02X0QJcWG?WOIyu8*(y[Zv H* e*Ќ )2iMUZ۵ۘSVK+ \M 0e *sde5lKvCQOtװc˞MYP N7|x_μqx7NstW ůcӵw0?\6G{߯ѫ|6]8X@~N|ADo͗k Q8XvzSEء2E!!1by}ayX*hymKICd4FEMp]K Zc0yՅ-hތi:HK5MNbd5eg~F_%ДJ:;vvNѦt)jngjv ~}gm tGi+,׮D! ,O9I8ͻ`!IhlƁnmx tnV*Ȥrl:ШtجvBްxLz}^i;NZ}M w13A(V>V+3"'ٸӹ#pj5Tyq)Ѷ*j73;.2 26N1^İw7 "/ E"w8,䆏 (#I9LFLF\#I8( a/,in'&&}!ϞhPt9J˃T/}j~UAq+s,wMՏKMki>?|ub]x \vSNMaCL˘3WN! ,=&pI8I`(dih$tݭx0YmHzȤ d& qz?@lUy2۾82&3M%tvly{~tYRm j wmBqthuwm \fuch|_tuR͢|FKֶlf߅)tQܹţG0!wo~ ,H=ScG2A%IfRe++%:4/o+7o61$`q㾊L0-uO%dx be)W3C xF"0 vMӃ?8Y0d\(-(Ɵq0@JtԫVYWaZ|HٳhӪ- l6ԴKݻxu\ nפ|һ}.\p=xr'3b)Sgǧ^\:艇kn`MKVog܀_ ]eJ,9K5L^zXW#Wf[rX!,1'(0.08ͻ%'$Hh x^6큔  ,R)~A%L: S"*L0)WecHov⚬?95qWaKhC;1f`P5pGTBM1>U9@>@K3&D733[h=X`3zmziqduцe|-uH58h8)'{|Dq)_?SfcFA$Loc!1BMCZqL J~%Gqi#y%WOJ`!B4#0y#u59*, @ !AړJ4CgUKO>Dk̕SZ. M|F+԰N"uI˘3k\/! ,8pI8O`(dihzEp,t˩x+IKB@"rJ_B_W(V|oGaww'vaTkX~,jЅa^݇gyJކݑe`pض5rIa*X%,c)RZ 6 !"0v :db$ cUAgy&8s43˾@<@e u( ʸͯLt;bɪqppKݻx7߿ L rT>%$  iX—˒)eYALjA:׍Rcma;f0dGܛ}ZWsHP(U3>ƕ=bNkٗ[6c_odvj˧u^nߠ'`_jՇ]sllS~1``l,Y|v . B`!AX nb~Ȟhˀ])2(M.bc$!] i~=hhU 8) T>RYu)dih)f!, :hhlp,tmx| oH,Ȥr<.tJZ*h0xL.ID|uB~[ lyZ_A< ^ ^ qA\T Q = _Q]%üȪp H*\ȰÇ#JHŋ3jȱǏ CIɓ(Sڪ\ɲ˗0cʜI͛8sɳϟ@ JѣH*]ʴӧPJJիXjʵׯ`ÊKٳhӪ]˶۷pʝKݻx˷߿ LÈ+^̸ǐ#KL˘3k̹ϠCMӨS^ͺװc˞M۸sͻ Nȓ+_μУKNسkνËO裇!, C A5Ude[G]VWtаtcUЁdPFΣBجv ! , P"048 I ,*  aw7^1: 5&PΖ6_vYV)hd $! ,0E D47C1@YJ ڀ, eK K䀀@8@PCd24*jV65@!,@9!0J8j3HOm0`")g[1 XEzm&V2fl:%! ,P'I8ͻ`(di) 0o<[œD1ٚch1@,hHh7%o,+=%Y{IWA+rKdtf4wb(+dxCmgnOD]E)0Ja?m,22JhCdEjsqyR^l~Q-y&0ʃ<FW%{M+=.oF:(7r~2.'9.LCT}*\ȰÇ@(-blA ]$nd GbE TB@V Xڼ8 ! , gP 5 E)JP]LÒJKp̥q<9RՒJ@E% K4@/!9S CyOZ_6-- !,0  :*0*ƨOFqE(X (BW3'P5,EהG!d5ۥH**\oH! ,8  %@B*FmD6@Vቊ+RyrmנA! ,@  RJB Gk88E 0} \ۊ5<ԶL.YŦ%Aq\V)ǹ=_t~/:d!,Po1! ,X  .B0ZLF1ue D ] ]P\0C !,`  8B0J9¸bS=nRd'k+Ci7~]. ##2,_ !,p3DP!b TÇi*roS̊CN Ok)J!,x  1B02_A@Ex(# Z஖ρ/`i'A*\ ! ,  E@jH+#`4   ^`PeF6m(;FH'-0̠v|N~}nwȗ~TC׋TDڑ˽SC@!A  d!@DA \ɂҙXpɔe(:BSN֜I! o kwURG)E:U*ԥV#c4U^kX Zn曛/.Ps"6_> oaƒe""QqF>6Y0ťqQ{rIht~YMɶ!>G_"p;ć/[,ˍ,α.wcvsis3~@,blHE? 390glA5k6#kqɱfT6Hwz cj`[ۗP9۳?/4Έ3]<3*ND6“vclSUFL6P44~&QIM*bx7/xƴL,%1Ċ==}nB&N)ÊW(wI޹kt267$0:ƭ[\8C5KPhF)4Jo>!J^ع݁^=؁yyS%bGB!`TgJh~p#"q/6qo39">y{+`Zty3́d۞hST]'Y'D;p&yՓP+N^,KL{sKBHvT);QMŜZ-΋ir'T PH^DX)tPXJӠ>(Dʏ}U,5BN e&,P{hȊO! b X~D)QC;"E63&XY-Z^-'ʂfU)QyaDoL'::MQ p V=2f` 1mmy]`hk1Iq4(} K)kAٕ%:%ϕi!hЮš M u^IP)~:."vu/DLA# 28lz/K`:Sǃ5LN 9K|D9%jiPݴΡqdjcug-94_gӻ@y/&zi]*j},dMPi6.n| 7~녌 .1rq>D?~K~õ) NŖ:*U9x5$e}Pq=m t %.g7C1HAqc)4Z}Pz!?VfGjlm8^;uOi=|A teǪZa"'q<nrHe<8!AwZda:U-ϊ-%u0<h k=V*e㚮:ڮZd ZZa hگ;[{ ;9ʪX_VuC[ky/:_ x'*8 +?Ѳ4;66189kd%:WAXGpL @{%V(RY QԤBUJPxXYW6&/ !ek6^ۤ薤vqonX)跪B}ʑ <[YU`چp>*0ZvU-58QeW>!uǺ۟פ//zX"N:j1C7qj+OċsH0&LmN*Oh;q;lQK3Wa hk'`kY;MI'gfqsЏS HO:tfo2+h%I]R7x_BW|mp~s2M& ̃R(\QnCh ʯ>i, nuGiv>,`1įtʦ6ɕkzx[LPVyudɂ[W-$,<׷]+Z~?h,-,aj\,zӄ-6_-Txp){∠ХƇJcjG@Z'\'TLw23s7ӿ:|4̐X43Gӄ4,AH|MoHI3LåruȚ-;Ϭ3[ۋoY-N#aŗnل|/;򜧵+M`y5 7H;(m-n ǻȗN1Tn8z)Vതmv'ȣ (v=SvQm&Ϙ5kǎ" )+<:k͚ﻠDƶY:YDzAw=B& )(O(B7.t ,{u2lh7r[kfnIMLOBMO'boX̥MJT5z'()9abJwCy){q(H))D*IٶH=I}a=GivpJ9*Xk|7Qw߉XR/ w06  .O Zgr,\z,+R0u'zAwh8v>=~!Y6^༪CVS@ޑNlw%kVrvi&v5αBsl[riۚVmĭ.):\Zmڀ;lY>;if-108:[/0|<)^^y'/۲' lb|dO=>n8VB%4h!iTr7(5-abz {/ "?$ T(O A!, 'P F訥6PIx|pH,Ȥrl:P"[L/3ZP\:.0:[9=dŨ<3~  UphgY1fT}+zD [hm1#n 'Tg Ȼ!> !ps!SiZȔ?|bCACa' Cg HH*t 4Cĉ %2s¡M&:tq3L^" 4Kc^v&]Ԛɧ/V^ǂ޺MQתfիգ^!@3Z~9.)P~C/q:;/} GKኺb˰౗%V:I t ЧϦP v]iLqk5s[۳63J:url=ϖe87>Se]|:i=SNs[WaHv&+exgˤgdF=@ޔa~E@؝8PFv"":" )22P7₍;z=Jlhd@6L6PF)e dXf\v`)di^~8ܚlp)tix|眻)蠄j衈&'>py嚍RBzfpn)!l^V*w٩ZCPFork[hQ#X0\!u1lFDp)j/d@+!6kڜIA:ó]{."_rn銻e|VkL?N(/:HOr 0mq _2ǜ$어lq2+qEM )n1v'9nL@,(2Huu\(D m:zFo<,jkpvbͰָzpUwE &օr-Kz|7ByWQ" ! ^.s ëz֐ˠS1IH )/PKҚvŇ/ϑ[ӰOfp;,;>|"7VSW1P[.Xް5 ys H`Xjpkݐ- %UC[z66QJx_-x Wl:6%- RcX>_ Qtp,8qursDA6p$V5'p!7/vqủw( U!bfDި,#$+m@TZUkc#cմ#Zϒkd%+XaN_9_$GeY})? pK_OdC15wғ+25"F|L&n`\lZe\H5!?)6,GVO~S63/ ٜ7' $7]P* Ӽ*0 hC vђ6O(@70)eJӚl)NwӞ PJԢHMRԦ:PTJU !,* & dihlp,tmx|pH,0rI "ilFeI;z V&sST7 IlNF]s%{"VM{t"(`M%$){~9O#Nƣ_aҝ_ɏsպ"̹V؄+ȳܘ7l[nhO11TDs{@Еw@2ɅPqe> )DW Dxm\C+X DPNzhꤪ)I$ixD {)_2ݳΉPU7t7ao8b0x{+DjcmXd7H/IDVzM)q6R]1&Gd/:Fr8u`qJ@%|HS*YӘ\r:/8pkΏΛ I?A4QVn@Dc;b ] ($uCyKń0k dRH&77"i H R )`_ c|`![v@ي#´#e&8/Օ5x"sPPX9dIrA`%VQ<5MT{.֧U'E;&P_L-yג?UUsw,+:dw#Sݘh YWM&g#ẏa#_3&p zG~nr~%_R]gaZCC\kZNAʹ,f/_TIRoa'Zoj o' 7G,gw ,$l(s0,4ls.߬<& _#X  M-ʹM#O+}FrqZW=6{ gmV Bbءa`SqacoO^Y *9yΈ7DĥqBCWwOޢc3H;ӡ.Fs3V-=O#fuu{(8ǫcҚ恻l8&nd W;γvd;ǽ,UOl|2eL}Ӯ籽̀L7y 0yO7hm tY'4RH >PBk™:3i#0NHlWdH>bSdb%qWpSM-9ѣHBwCPlD R Ԩ$nhg fNCRJ[!WE̻x領0Bԇq]E*^xU"яjb5a("IGX3gciPbH~Bfb & px2{+_ a "&5uU Zt %8G"}9@fu}bFݖ/v eQ@:etYDAQ6 kK< ĨD^HzfEİ/…DN':k&Ԗb13֔tpҖN`deēe$œ?c=^=DWBg9C}HB Ij3e  2[W']TX*rx^vW34}Rđ1 QXUpW@M$iG{k<XMo$7RzePϾFEpKxk9j#OQPEE߶9-*oof *7eYQ};WNqG$ǁ1CG(J+B{b8_6 clpd}JtJ-, @97=og]n!ż&eMFEg?:?.ý `o_? #L:c Aa  ItAQ}N,#uq ,#BA v3 " p,Bԕzp ${y*ub{9 >+h6:9 SJъZͨF7юz HGJҒ(MJE7d,Gf: ܦ+ua3<φ9m?SR[30S dp+jPX*c(U U =:,ϋ^H6@?qJc** mDq5aӁU `<"JEc&J$/D|e\oU_) X #l88q=:ĒYhLO2__.7ݘDkf5TBoRMcijmu(ߜX % 9y. xH]dڨ .y{|K{Me+/ G}}ե/ ;Bb@&W{M$,xypRfBaA܆*rKR$>w$)ҢwYD2VyZiT1螎tjƠ%d'\\߉>v KL&9[WRfEL<hfDp#y`wNk9+\ɲYV~n7R^C](iLz6V}Ї^i]-(LI+0ùEzRIP* ]`T:{P;KRZjCGzK_bTdXG{tZ.EKn gCi s: 3\T֓(ElV%^E|G~~>j)h۪,:;{1A5!ّ %}PH'WS%^^ %y[jnn8{@JECI0ˀLuPb )e gHFh0xb6$/4W4]Q5L.w}b`~y]\?iiAqpBuh}Hb^AhyʬdКo b?2b}լدs^XҾ~Vy2M⨓qD5LH@  |LY;Q p&6 Ξ?CӣQ//Y8/= (fNy@k(? ;LqΆ3sآs,9L32O@Fae普},V81P{&|$Phغy*と3(U DXW \ܼqޖwe e ˕Άչ5r%nElxЗ9[\FW.eQHQ՜Uq$3:Px1,m!J']MXbhDD~L,͜O!ӓCǞ3Cv[qv^ty9 07&3;Ll2:Q:¼lmx񚣾6MG$^;4d`+י\\*IA "t? 6W-JX 3wfEt:倢)^wF-G! \!eIu6B1O:'%G+͚G&Q#DJ YtF";qH a9DB?E0EtR!ਉtRnJq8:ehLfq%D .'eEA ɲte/y}{1Le)ȉd"$%N4Id &fL#šURJ9LYsn'$zvH=O)гpɀABІ:- jF(B)j[ʫRO\NeK 9#2dB OkNJ6-SjJ(97֢NCPYN!0*P7RZKeJc;M*G)ayԊ,hO  *k"ykMLJ#Lcmp 鴌=OT,aGT.5x)g1 j ٵ5cbrW>[=0}xsdTm\a>MÐt Gf [tEHBMcF*^^+fQQʦ1ꏽp$F뱁Ն+)]= ӀC0~KFm,Ȑoo@U]uOI@ nLY"NAJk]. )RPEUXtRIDqZ_ᵱ$P5h dh ;A-D:sBЇBhHbMZZKB9{ ZʳwHhUS =b5aݫ?)WؔfRySބP@k9,I&!Ψ\`q\<68z ;] '$So((i1'ғ"^/ f,0릧HX>dbX%g,Ap\4lA2oYm1Nţo&u2ٴD1"b@ &ڴ9`6~h;݁#^ǘ'8wd"PЌJv}Mx^,\{-B0hGA֞!]yQ{sXB GEmϳqnΑڋ1vEGx uh<7ϯάa0C ꬰP߃64j"4ؑٺXG2˾ݵm.`Tw'v_&;|3;6ޭ{*$c=b(8".ЄsmOJhlfOQ HL>Q7>\V&o e{QFȢj "kdT=$|&f,eK%},၁-d]Oczz@:dEz_w*ˡjSk`hsuv!t&lP|$Dȷuxt&BH&wJ\s;!(eNqrc'2-`d (*LP>&1b3_QsYGHQl@xUPFU8%?x{"j䊰8X ؋hjppj8X7 8è{TnrUqLCDM0heL*4Oqst`H؍I9 ِrurX  iHɕ Y')ّ c>k7%>IMS!PZ1. \ZIrX^ڃVR73)9wfG_ +8YtXhW”+Ѓ iɞ9Q)!YO2ZZgu}eS# 2;қH8R}@"gaardQ1/WzE 9YM錎 %ё9 ͈LL1` r j N_fd!9Ϸ ]&ɳA)g]:&%!V*g&k#g0n$1Q1֖" HڀFZ S"Ȣ4:JXȐʝ1-I8FtE@ У|qsFQo9ar mknV-sexj"F@?B"j%f>()z0auYJi/ڌ4 WɩIZ[ht0R'c2633B1cR^uf7c(1d*&%)buM}6X 5!H^4*ڭII+٨*Dʃ3몮R,r ~f9:MZ{{&;Ws 35B'ckڒ=%l=892N;FD8O$0[P y3 jxk= !rokE1I{uħ D ԛGG6x z>atQ}wJQPi#* Ɉ'J׺ǷEG*J駅IλJ+!b-C Aj8B@~BY-!8gnڶNC4MC7jq˔EK i)a, K)Zi#a95l/K b=I$J>\6eVk'l<-7`RtHcnb\)ʣIiEg;H;+ENY0LIR'21U (ཚsl8"4Q‘r B"đ'MH#o ٞ܌N\I ̞Tɬ\ʮ,ʯɞl6O K>˾rP|c䐿ܐ%|ʼ&nA<\|؜ڼ̓8FA!,*&`0dihlp,t*x1CpȤrl:͑/ZuzR. .b :StChwkp:{Tg@HpDB9AqUEEsXss7bzs#ɯhY?n:>@́০godq9ZT?Y `[QAn>$qDk]CО"o2ACpE#KwGCX TfXpmB21f xҭ@N[ĘCᝊ ʼnN#i5A)jT?YNu3*&pb EI%yg>YL.xҍJZW5PM-J72mhZͅERhbk/ qWR"hN7f@#yf&ǝ9yt$&JLz9kK-<Q!Dqpr-)x" ~J! wk^;a"‚XKa-d!蠊 0hsTd@TEH2Ǒ|$䓉"e)MiXfTl`)dY&(hplp rix|ɦ~j衈& !$_9HO)šhR.IeɃyx@Bq*G´bjlҙ-*ouJ vɦpԩZ쵠 i ~+qZ ̺-^"{_yދ楮ͩ*'i>S͇Vi%,IBO(.oB]I"0-)4q&hf"-hC;\JW$lZMFlOr:N-jlυ׃s\l҆kP,iO\x{~T/(\:L95.M9vaO͌izբM$Ik' tv<9pg;2" 8GHxs< /=V[o;X=kj7_gLWRߤIUКlmlgٲv.jzlʛ^k-0} 0xQ"_ EPM477J?j{zv ψKٲ0*Ub ElI?ا b;7yB!H:x̣B!,'(0IxC!C9hXm,tm߸mH,ǝhͨt:UPbxjwH ٫ս7[VE]z*b'f$%"g^DjO},]!w>B(q`K<(L(t?Wm+WmZcwJ'$Obtz#tť.Ԗ#OxidaOȅ־x{dt BJX"ʆ 0[3]rJկ@53uΠ@P!ph-y*nf訒L!C%aH(bd͎IV6&($\(]aSj&Mбfז5(m:kaY詖<UժLik_hJ?u(Z2P{u\:KYQ[ +1."Z7DjA2-re'B QLny2Sdkcg"pZ*AJ^a[{|_=|}4~rR"BF,N&(tP,RV]Be2ZBhՔ,0(4h8Ҩx@)=P4H&L6!>JIXf喇WD^B?ߘ )$l &`"tr駞W2A;nrn~G2)C"CґNcd*'vU6#2pQ2a:q>ȨB*j,>N+UڥVj~y(n){lqhg)š,cRdJJ\n2'r*lf;N[CT\{qzL]*h\uȬ)2+2"fuvg$(GV!R2m^ ED3XG C*g!7Hu>SO Nv(׆>ݯE*pt*\Qތ.?K9]S `qw2KK uw9V{=ΪLuлE:*qr^(.ms̭|TW쪈c?df!ȴ~Oky&?n>[<&ʘs(T-9ԿPUj}\%8 ZI.rJMCC{d@,lo0'sI"T:ǭAѣ:*]jebQLd8JɒVM٤P[$:ȚnmYEEʴ;N-QKCy;+]ie Y&Bt5S[~1b&amMTԆˮ][T3],yg;E)r竳{ͽpˡ4CI5JNG|yĐךu~pt#"v%ȋw 6#'V1z[e\B\!2$_~LX :5]R 0)(X#U"Tl@a'0]#c#ev1щ=W`gYtXc4eSc$WhCKG7yb߈9a)ghQ#Y v!pɏ@ AJ@@GLa r1USX̜CSJI\Vc$QM4h\.#Pri?%̶j@[ V묵eD#v; xކ+k覫KH5P"k6AZ[U Z-rߢAi 7byU/ARKzRsy/U%92q:MEJ;&`>$2zD|7qS˸,t"Ptb7u3K;{\jsCg%q0#pWgY'uRW9zTHaK 4yp1q174pZW$ܸ Hmr,-D\`y9M&hJnY5欗.} -?Zy_į"@KVc%Sl7C@o&7.m4w1~͗"'.軄>ko HKY mdy !#Vl@r,xmI2 jLQ(':ӥba6HGt\ON'\g!Dt\ xCq)D;YyJ B-"d*t&vKx6dʎޘ !aֿF,Hr"1fV)"Q2 U`1F0_ #xE[ BmRE" Ն&P*ɨYdUIkM1H2d\aIi#I48m({Lprl2-/5͖U%2*.x34 &E XRfIOJS  "L6Cj8\(dJPoB(}l}ESrH B-QLE߉+ H,AG–N8pH|dgT& !,(V 0@1A*JEbkВ5`C d*@cy[`HHA!,0a o!T[! ,8QB*%02+`!)0XN5 Dḧ́iAW!Mc.'(JE !,@S70J5h3cpE[Ea5BR \֢\+YƣF,20 IA!,aP' dih,Jp,ЬΟG!0__tSU٪^o<̇E XcW+)s]$v%_z0^qUGxX`~6X\"JXX]FM56wbXPU[-YA\j|\eFCJC$+q5Ҍ~`uCUIt>(#uGJk`=x6 V1pl vOZ\ ,Vj Dbzp$ uG>널Uvf%.L$'o٢m 7D%/å3A qիXU0PkMAcӎXYaՎM`XrǶ6oZ;ց[+ؽ*zqdt<|*h;[՜@t13N٩קX3F!!, J1&6!@, [I8 `8a%0 |)͚r,tĢeR(1-)rit5Vjƒ =I=`@T`0!, 1 1#*JE\hpFTӒ#9hi ppE))kp5UN.Zy] K'RM>Mv$= E(9zo }}̭ ;smenu-0.9.15/smenu.h000066400000000000000000000525341344767411600142630ustar00rootroot00000000000000/* ########################################################### */ /* This Software is licensed under the GPL licensed Version 2, */ /* please read http://www.gnu.org/copyleft/gpl.html */ /* ########################################################### */ #ifndef SMENU_H #define SMENU_H #define CHARSCHUNK 8 #define WORDSCHUNK 8 #define COLSCHUNK 16 #define TPARM1(p, ...) tparm(p, 0, 0, 0, 0, 0, 0, 0, 0, 0) #define TPARM2(p, q, ...) tparm(p, q, 0, 0, 0, 0, 0, 0, 0, 0) #define TPARM3(p, q, r, ...) tparm(p, q, r, 0, 0, 0, 0, 0, 0, 0) #define _XOPEN_SOURCE 700 /* Used for timers management */ /* """""""""""""""""""""""""" */ #define SECOND 1000000 #define FREQ 10 #define TICK (SECOND / FREQ) /* Bit array management */ /* """""""""""""""""""" */ #define MASK (CHAR_BIT - 1) #define SHIFT ((CHAR_BIT == 8) ? 3 : (CHAR_BIT == 16) ? 4 : 8) #define BIT_OFF(a, x) ((void)((a)[(x) >> SHIFT] &= ~(1 << ((x)&MASK)))) #define BIT_ON(a, x) ((void)((a)[(x) >> SHIFT] |= (1 << ((x)&MASK)))) #define BIT_FLIP(a, x) ((void)((a)[(x) >> SHIFT] ^= (1 << ((x)&MASK)))) #define BIT_ISSET(a, x) ((a)[(x) >> SHIFT] & (1 << ((x)&MASK))) /* ******** */ /* Typedefs */ /* ******** */ typedef struct charsetinfo_s charsetinfo_t; typedef struct term_s term_t; typedef struct toggle_s toggle_t; typedef struct win_s win_t; typedef struct word_s word_t; typedef struct attr_s attr_t; typedef struct limits_s limits_t; typedef struct timers_s timers_t; typedef struct misc_s misc_t; typedef struct sed_s sed_t; typedef struct timeout_s timeout_t; typedef struct output_s output_t; typedef struct daccess_s daccess_t; typedef struct search_data_s search_data_t; typedef enum filter_types filters_t; typedef enum daccess_modes da_mode_t; typedef enum timeout_modes to_mode_t; typedef enum attribute_settings attr_set_t; typedef enum search_modes search_mode_t; typedef enum bitmap_affinities bitmap_affinity_t; /* ********** */ /* Prototypes */ /* ********** */ void help(win_t * win, term_t * term, long last_line, toggle_t * toggle); int tag_comp(void * a, void * b); void tag_swap(void * a, void * b); int isempty(const char * s); void beep(toggle_t * toggle); int get_cursor_position(int * const r, int * const c); void get_terminal_size(int * const r, int * const c); int #ifdef __sun outch(char c); #else outch(int c); #endif void restore_term(int const fd); void setup_term(int const fd); void strip_ansi_color(char * s, toggle_t * toggle); int tst_cb(void * elem); int tst_cb_cli(void * elem); int ini_load(const char * filename, win_t * win, term_t * term, limits_t * limits, timers_t * timers, misc_t * misc, int (*report)(win_t * win, term_t * term, limits_t * limits, timers_t * timers, misc_t * misc, const char * section, const char * name, char * value)); int ini_cb(win_t * win, term_t * term, limits_t * limits, timers_t * timers, misc_t * misc, const char * section, const char * name, char * value); char * make_ini_path(char * name, char * base); void set_foreground_color(term_t * term, short color); void set_background_color(term_t * term, short color); void set_win_start_end(win_t * win, long current, long last); long build_metadata(term_t * term, long count, win_t * win); long disp_lines(win_t * win, toggle_t * toggle, long current, long count, search_mode_t search_mode, search_data_t * search_data, term_t * term, long last_line, char * tmp_word, langinfo_t * langinfo); void get_message_lines(char * message, ll_t * message_lines_list, long * message_max_width, long * message_max_len); void disp_message(ll_t * message_lines_list, long width, long max_len, term_t * term, win_t * win); void update_bitmaps(search_mode_t search_mode, search_data_t * search_data, bitmap_affinity_t affinity); long find_next_matching_word(long * array, long nb, long value, long * index); long find_prev_matching_word(long * array, long nb, long value, long * index); void clean_matches(search_data_t * search_data, long size); void disp_cursor_word(long pos, win_t * win, term_t * term, int err); void disp_matching_word(long pos, win_t * win, term_t * term, int is_cursor, int err); void disp_word(long pos, search_mode_t search_mode, search_data_t * search_data, term_t * term, win_t * win, char * tmp_word); size_t expand(char * src, char * dest, langinfo_t * langinfo, toggle_t * toggle); int get_bytes(FILE * input, char * utf8_buffer, langinfo_t * langinfo); int get_scancode(unsigned char * s, size_t max); char * get_word(FILE * input, ll_t * word_delims_list, ll_t * record_delims_list, char * utf8_buffer, unsigned char * is_last, toggle_t * toggle, langinfo_t * langinfo, win_t * win, limits_t * limits); void left_margin_putp(char * s, term_t * term, win_t * win); void right_margin_putp(char * s1, char * s2, langinfo_t * langinfo, term_t * term, win_t * win, long line, long offset); void sig_handler(int s); void set_new_first_column(win_t * win, term_t * term); int parse_sed_like_string(sed_t * sed); void parse_selectors(char * str, filters_t * filter, char * unparsed, ll_t ** inc_interval_list, ll_t ** inc_regex_list, ll_t ** exc_interval_list, ll_t ** exc_regex_list, langinfo_t * langinfo); int replace(char * orig, sed_t * sed); int decode_attr_toggles(char * s, attr_t * attr); int parse_attr(char * str, attr_t * attr, short max_color); void apply_attr(term_t * term, attr_t attr); int delims_cmp(const void * a, const void * b); long get_line_last_word(long line, long last_line); void move_left(win_t * win, term_t * term, toggle_t * toggle, search_data_t * search_data, langinfo_t * langinfo, long * nl, long last_line, char * tmp_word); void move_right(win_t * win, term_t * term, toggle_t * toggle, search_data_t * search_data, langinfo_t * langinfo, long * nl, long last_line, char * tmp_word); int find_best_word_upward(long last_word, long s, long e); int find_best_word_downward(long last_word, long s, long e); void move_up(win_t * win, term_t * term, toggle_t * toggle, search_data_t * search_data, langinfo_t * langinfo, long * nl, long page, long first_selectable, long last_line, char * tmp_word); void move_down(win_t * win, term_t * term, toggle_t * toggle, search_data_t * search_data, langinfo_t * langinfo, long * nl, long page, long last_selectable, long last_line, char * tmp_word); /* ***************** */ /* Emums and structs */ /* ***************** */ /* Various filter pseudo constants */ /* """"""""""""""""""""""""""""""" */ enum filter_types { UNKNOWN_FILTER, INCLUDE_FILTER, EXCLUDE_FILTER }; /* Used by the -N -F and -D options */ /* """""""""""""""""""""""""""""""" */ enum daccess_modes { DA_TYPE_NONE = 0, /* must be 0 (boolean value) */ DA_TYPE_AUTO = 1, DA_TYPE_POS = 2 }; /* Used when managing the -R option */ /* """""""""""""""""""""""""""""""" */ enum row_regex_types { ROW_REGEX_EXCLUDE = 0, /* must be 0 (boolean value) */ ROW_REGEX_INCLUDE = 1 }; /* Used when managing the -C option */ /* """""""""""""""""""""""""""""""" */ enum filter_infos { EXCLUDE_MARK = 0, /* must be 0 because used in various tests * * these words cannot be re-included */ INCLUDE_MARK = 1, /* to forcibly include a word, these words can * * be excluded later */ SOFT_EXCLUDE_MARK = 2, /* word with this mark are excluded by default * * but can be included later */ SOFT_INCLUDE_MARK = 3 /* word with this mark are included by default * * but can be excluded later */ }; /* Various timeout mode used by the -x/-X option */ /* """"""""""""""""""""""""""""""""""""""""""""" */ enum timeout_modes { CURRENT, /* on timeout, outputs the selected word */ QUIT, /* on timeout, quit without selecting anything */ WORD /* on timeout , outputs the specified word */ }; /* Constants used to set the color attributes */ /* """""""""""""""""""""""""""""""""""""""""" */ enum attribute_settings { UNSET = 0, /* must be 0 for future testings */ SET, FORCED /* an attribute setting has been given in the command line */ }; /* Constant to distinguish between the various search modes */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""" */ enum search_modes { NONE, PREFIX, FUZZY, SUBSTRING }; /* Constants used in search mode to orient the bit-mask building */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ enum bitmap_affinities { NO_AFFINITY, END_AFFINITY, START_AFFINITY }; /* Used to store the different allowed charsets data */ /* """"""""""""""""""""""""""""""""""""""""""""""""" */ struct charsetinfo_s { char * name; /* canonical name of the allowed charset */ int bits; /* number of bits in this charset */ }; /* Various toggles which can be set with command line options */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ struct toggle_s { int del_line; /* 1 if the clean option is set (-d) else 0 */ int enter_val_in_search; /* 1 if ENTER validates in search mode else 0 */ int no_scrollbar; /* 1 to disable the scrollbar display else 0 */ int blank_nonprintable; /* 1 to try to display non-blanks in * * symbolic form else 0 */ int keep_spaces; /* 1 to keep the trailing spaces in columns * * and tabulate mode. */ int taggable; /* 1 if tagging is enabled */ int pinable; /* 1 if pinning is selected */ int autotag; /* 1 if tagging is selected and pinning is * * not and we do no want an automatic tagging * * when the users presses */ int visual_bell; /* 1 to flash the window, 0 to make a sound */ }; /* Structure to store the default or imposed smenu limits */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""" */ struct limits_s { long word_length; /* maximum number of bytes in a word */ long words; /* maximum number of words */ long cols; /* maximum number of columns */ }; /* Structure to store the default or imposed timers */ /* """""""""""""""""""""""""""""""""""""""""""""""" */ struct timers_s { int search; int help; int winch; int direct_access; }; /* Structure to store miscellaneous informations */ /* """"""""""""""""""""""""""""""""""""""""""""" */ struct misc_s { search_mode_t default_search_method; }; /* Terminal setting variables */ /* """""""""""""""""""""""""" */ struct termios new_in_attrs; struct termios old_in_attrs; /* Interval timers used */ /* """""""""""""""""""" */ struct itimerval periodic_itv; /* refresh rate for the timeout counter */ int help_timer = -1; int winch_timer = -1; int daccess_timer = -1; /* Structure containing the attributes components */ /* """""""""""""""""""""""""""""""""""""""""""""" */ struct attr_s { attr_set_t is_set; short fg; short bg; signed char bold; signed char dim; signed char reverse; signed char standout; signed char underline; signed char italic; }; /* Structure containing some terminal characteristics */ /* """""""""""""""""""""""""""""""""""""""""""""""""" */ struct term_s { int ncolumns; /* number of columns */ int nlines; /* number of lines */ int curs_column; /* current cursor column */ int curs_line; /* current cursor line */ short colors; /* number of available colors */ short color_method; /* color method (0=classic (0-7), 1=ANSI) */ char has_cursor_up; /* has cuu1 terminfo capability */ char has_cursor_down; /* has cud1 terminfo capability */ char has_cursor_left; /* has cub1 terminfo capability */ char has_cursor_right; /* has cuf1 terminfo capability */ char has_parm_right_cursor; /* has cuf terminfo capability */ char has_cursor_address; /* has cup terminfo capability */ char has_save_cursor; /* has sc terminfo capability */ char has_restore_cursor; /* has rc terminfo capability */ char has_setf; /* has set_foreground terminfo capability */ char has_setb; /* has set_background terminfo capability */ char has_setaf; /* idem for set_a_foreground (ANSI) */ char has_setab; /* idem for set_a_background (ANSI) */ char has_hpa; /* has column_address terminfo capability */ char has_bold; /* has bold mode */ char has_dim; /* has dim mode */ char has_reverse; /* has reverse mode */ char has_underline; /* has underline mode */ char has_standout; /* has standout mode */ char has_italic; /* has italic mode */ }; /* Structure describing a word */ /* """"""""""""""""""""""""""" */ struct word_s { long start, end; /* start/end absolute horiz. word positions * * on the screen */ size_t mb; /* number of UTF-8 glyphs to display */ long tag_order; /* each time a word is tagged, this value * * is increased */ size_t special_level; /* can vary from 0 to 5; 0 meaning normal */ char * str; /* display string associated with this word */ size_t len; /* number of bytes of str (for trimming) */ char * orig; /* NULL or original string if is had been * * shortened for being displayed or altered * * by is expansion. */ char * bitmap; /* used to store the the position of the * * currently searched chars in a word. The * * objective is to speed their display */ unsigned char is_matching; unsigned char is_tagged; /* 1 if the word is tagged, 0 if not */ unsigned char is_last; /* 1 if the word is the last of a line */ unsigned char is_selectable; /* word is selectable */ unsigned char is_numbered; /* word has a direct access index */ }; /* Structure describing the window in which the user */ /* will be able to select a word */ /* """"""""""""""""""""""""""""""""""""""""""""""""" */ struct win_s { long start, end; /* index of the first and last word */ long first_column; /* number of the first character displayed */ long cur_line; /* relative number of the cursor line (1+) */ long asked_max_lines; /* requested number of lines in the window */ long max_lines; /* effective number of lines in the window */ long max_cols; /* max number of words in a single line */ long real_max_width; /* max line length. In column, tab or line * * mode it can be greater than the * * terminal width */ long message_lines; /* number of lines taken by the messages * * (updated by disp_message */ long max_width; /* max usable line width or the terminal */ long offset; /* window offset user when centered */ char * sel_sep; /* output separator when tags are enabled */ char ** gutter_a; /* array of UTF-8 gutter glyphs */ long gutter_nb; /* number of UTF-8 gutter glyphs */ unsigned char tab_mode; /* -t */ unsigned char col_mode; /* -c */ unsigned char line_mode; /* -l */ unsigned char col_sep; /* -g */ unsigned char wide; /* -w */ unsigned char center; /* -M */ attr_t cursor_attr; /* current cursor attributes */ attr_t cursor_on_tag_attr; /* current cursor on tag attributes */ attr_t bar_attr; /* scrollbar attributes */ attr_t shift_attr; /* shift indicator attributes */ attr_t message_attr; /* message (title) attributes */ attr_t search_field_attr; /* search mode field attributes */ attr_t search_text_attr; /* search mode text attributes */ attr_t search_err_field_attr; /* bad search mode field attributes */ attr_t search_err_text_attr; /* bad search mode text attributes */ attr_t match_field_attr; /* matching word field attributes */ attr_t match_text_attr; /* matching word text attributes */ attr_t match_err_field_attr; /* bad matching word field attributes */ attr_t match_err_text_attr; /* bad matching word text attributes */ attr_t include_attr; /* selectable words attributes */ attr_t exclude_attr; /* non-selectable words attributes */ attr_t tag_attr; /* non-selectable words attributes */ attr_t daccess_attr; /* direct access tag attributes */ attr_t special_attr[5]; /* special (-1,...) words attributes */ }; /* Sed like node structure */ /* """"""""""""""""""""""" */ struct sed_s { char * pattern; /* pattern to be matched */ char * substitution; /* substitution string */ unsigned char visual; /* visual flag: alterations are only * * visual */ unsigned char global; /* global flag: alterations can * * occur more than once */ unsigned char stop; /* stop flag: only one alteration * * per word is allowed */ regex_t re; /* compiled regular expression */ }; /* Structure used to keep track of the different timeout values */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ struct timeout_s { to_mode_t mode; /* timeout mode: current/quit/word */ unsigned initial_value; /* 0: no timeout else value in sec */ unsigned remain; /* remaining seconds */ unsigned reached; /* 1: timeout has expired, else 0 */ }; /* Structure used during the construction of the pinned words list */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ struct output_s { long order; /* this field is incremented each time a word is pinned */ char * output_str; /* The pinned word itself */ }; /* Structure describing the formating of the automatic direct access entries */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ struct daccess_s { da_mode_t mode; /* DA_TYPE_NONE (0), DA_TYPE_AUTO, DA_TYPE_POS */ char * left; /* character to put before the direct access selector */ char * right; /* character to put after the direct access selector */ char alignment; /* l: left; r: right */ char padding; /* a: all; i: only included words are padded */ char head; /* What to do with chars before the embedded number */ int length; /* selector size (5 max) */ int flength; /* 0 or length + 3 (full prefix lengh */ size_t offset; /* offset to the start of the selector */ int plus; /* 1 if we can look for the number to extract after * * the offset, else 0. (a '+' follows the offset) */ int size; /* size in bytes of the selector to extract */ size_t ignore; /* number of UTF-8 glyphs to ignore after the number */ char follow; /* y: the numbering follows the last nuber set */ char * num_sep; /* character to separate de number and the selection */ int def_number; /* 1: the numbering is on by default 0: it is not */ }; /* Structure used in search mod to store the current buffer and various */ /* related values. */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ struct search_data_s { char * buf; /* search buffer */ long len; /* current position in the search buffer */ long utf8_len; /* current position in the search buffer in * * UTF-8 units */ long * utf8_off_a; /* array of mb offsets in buf */ long * utf8_len_a; /* array of mb lengths in buf */ int fuzzy_err; /* fuzzy match error indicator */ long fuzzy_err_pos; /* last good position in search buffer */ int only_ending; /* only searches giving a result with the * * pattern at the end of the word will be * * selected */ int only_starting; /* same with the pattern at the beginning */ }; #endif smenu-0.9.15/smenu.spec.in000066400000000000000000000035601344767411600153660ustar00rootroot00000000000000# # spec file for package smenu # # Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: smenu Version: @VERSION@ Release: 0 Summary: A standard input word picker License: GPL-2.0-only Group: Productivity/Text/Utilities URL: https://github.com/p-gen/%{name} Source: %{name}-%{version}.tar.bz2 BuildRequires: ncurses-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build %description This tool reads words from a file or standard input, presents them in an interactive window after the current line on the terminal, and writes the selected words, if any, to standard output. %prep %setup -q %build %configure make %{?_smp_mflags} %package tests Summary: Testing system for %{name} Group: Productivity/Text/Utilities %description tests This packages contains some scripts and a number of tests to check the %{name} tool. %install %if 0%{?suse_version} < 1315 make install DESTDIR="%{?buildroot}" %else %make_install %endif %files tests %defattr(-,root,root,-) %doc tests %files %defattr(-,root,root,-) %attr(0755,root,root) %{_bindir}/* %if 0%{?sle_version} < 120300 %doc COPYRIGHT %else %license COPYRIGHT %endif %doc examples README.rst FAQ %{_mandir}/man1/* %changelog smenu-0.9.15/tests/000077500000000000000000000000001344767411600141145ustar00rootroot00000000000000smenu-0.9.15/tests/README.rst000066400000000000000000000064741344767411600156160ustar00rootroot00000000000000WARNING ------- To be able to run these tests, you first need to get two of my other small utilities available here: https://github.com/p-gen. Make sure you have installed the latest git commit of these two utilities before going any further. - The first named **ptylie** is a kind of script without the replay capacity but with a mechanism to inject keystrokes in the keyboard queue of the slave pty running your code. - The second named **hlvt** is a minimalist embryonic headless terminal emulation able to process a typescript like the one generated by **ptylie** or scripts and render it in a virtual screen. The resulting output is the content of the screen after all the typescript content and DEC escape sequences have been interpreted. - For accurate results, please use a terminal using DEC escape sequences for attribute settings (colors, bold...). As most tests are using colors and UTF-8 the terminal and locale in use must support them. Setting and exporting TERM=xterm is a good idea. Files ----- The files present in this directory are: - ``t????.in`` contains the words to feed smenu. - ``t????.good`` is the screen content of the test after a successful run. - ``t????.tst`` contains the keystrokes to pass to smenu. - ``*.bl`` contains the blacklisted tests to ignore for an given OS (one per line). - ``test.sh`` runs a single test. - ``tests.sh`` runs selected or all tests. Usage ----- - Copy the ``tests`` directory to a place where you have write access if it is not already the case. - Go to the ``tests`` directory. - If the packaging is based on the result of ``make dist``, then you may have to get the tests from a gziped cpio archive. In that case: - Decompress the **tests.cpio.gz** archive (``gzip -dv tests.cpio.gz``). - Extract the tests from the **tests.cpio** archive in this directory (``cpio -idv < tests.cpio``). - Make tests.sh and test.sh executable (``chmod u+x tests.sh test.sh``) - Make sure that your terminal has at least a size of 80x84. - Make sure that you have previously built **smenu** with ``build.sh``. - Make sure that **smenu** is (re-)installed as the tests will use the PATH to find it. - if **ptylie** and/or **hlvt** are not in the PATH, then put their base directories in the variables ``PTYLIE_PATH`` and/or ``HLVT_PATH`` and **export** them. - If you want to run all the provided tests, then simply run ``./tests.sh`` else add the subdirectory containing the ``txxxx`` files you want to test as argument. Example: ``./tests.sh spaces``. - An individual test can be performed by going into the ``tests`` directory and by executing the command ``../test.sh`` with the test as argument without extension. Example ``../test.sh t0001``. Note that the script name is ``test.sh`` in this case and **not** ``tests.sh``. The terminal should animate as if you were typing all that stuff yourself. You can do whatever you want with this terminal during the test except close it or reduce its size to less than 80x24. The resulting files (``.log``) should not contain any occurrence of the *BAD* word. The ``tests.sh`` script will show these occurrences, if any, anyway. Note ---- Before reporting a bug due to a failing test, please re-execute is again at least 3 times with ``test.sh`` as you may have found a (timing) bug in **ptylie**/**hlvt** and not in **smenu**. smenu-0.9.15/tests/attributes/000077500000000000000000000000001344767411600163025ustar00rootroot00000000000000smenu-0.9.15/tests/attributes/data1000066400000000000000000000000231344767411600172120ustar00rootroot00000000000000a b c aa bb cc aba smenu-0.9.15/tests/attributes/data2000066400000000000000000000000161344767411600172150ustar00rootroot000000000000001 2 3 4 5 6 7 smenu-0.9.15/tests/attributes/data3000066400000000000000000000007511344767411600172240ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 smenu-0.9.15/tests/attributes/t0001.good000066400000000000000000000002661344767411600177240ustar00rootroot00000000000000$ OUT=$(smenu -a i:7/4,b -ia -- t0001.in) a b c aa bb cc aba 0:01252c 2:24 4:24 6:07 7:07 9:24 10:24 12:24 13:24 15:01252c 16:01252c 17:01252c $ $ echo ":$OUT:" :aa: $ exit 0 smenu-0.9.15/tests/attributes/t0001.in000077700000000000000000000000001344767411600203062data1ustar00rootroot00000000000000smenu-0.9.15/tests/attributes/t0001.tst000066400000000000000000000001571344767411600176050ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -a i:7/4,b -ia -- t0001.in) \S[150]\s[150]l\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/attributes/t0002.good000066400000000000000000000003431344767411600177210ustar00rootroot00000000000000$ OUT=$(smenu -a e:0/6,bu i:0/1,r -ia -- t0002.in) a b c aa bb cc aba 0:071e29 2:01041e2e 4:01041e2e 6:07 7:07 9:01041e2e 10:01041e2e 12:01041e2e 13:01041e2e 15:071e29 16:071e29 17:071e29 $ $ echo ":$OUT:" :aa: $ exit 0 smenu-0.9.15/tests/attributes/t0002.in000077700000000000000000000000001344767411600203072data1ustar00rootroot00000000000000smenu-0.9.15/tests/attributes/t0002.tst000066400000000000000000000001701344767411600176010ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -a e:0/6,bu i:0/1,r -ia -- t0002.in) \S[150]\s[150]l\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/attributes/t0003.good000066400000000000000000000003601344767411600177210ustar00rootroot00000000000000$ OUT=$(smenu -a i:/5 e:4,br b:7/3,rb c:7/2,b -c -R2,4 -- t0003.in) 1 ┐ 0:010722 3:0107252b 2 │ 0:2d 3:0107252b 3 ║ 0:010722 3:0107252b 4 │ 0:01252a 3:0107252b 5 ▼ 0:010722 3:0107252b $ $ echo ":$OUT:" :4: $ exit 0 smenu-0.9.15/tests/attributes/t0003.in000077700000000000000000000000001344767411600203112data2ustar00rootroot00000000000000smenu-0.9.15/tests/attributes/t0003.tst000066400000000000000000000002111344767411600175760ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -a i:/5 e:4,br b:7/3,rb c:7/2,b -c -R2,4 -- t0003.in) \S[150]\s[150]l\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/attributes/t0004.good000066400000000000000000000003121344767411600177170ustar00rootroot00000000000000$ OUT=$(smenu -a e:5,br b:0/6 -R2 -c -- t0004.in) 1 ┐ 0:010723 3:1e2e 2 ║ 0:07 3:1e2e 3 │ 0:010723 3:1e2e 4 │ 0:010723 3:1e2e 5 ▼ 0:010723 3:1e2e $ $ echo ":$OUT:" :2: $ exit 0 smenu-0.9.15/tests/attributes/t0004.in000077700000000000000000000000001344767411600203122data2ustar00rootroot00000000000000smenu-0.9.15/tests/attributes/t0004.tst000066400000000000000000000001671344767411600176110ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -a e:5,br b:0/6 -R2 -c -- t0004.in) \S[150]\s[150]l\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/attributes/t0005.good000066400000000000000000000027571344767411600177370ustar00rootroot00000000000000$ OUT=$(smenu -P -N 0 -a i:6 da:1,b s:5,b -c -- t0005.in) 1 2 3 4 5 6 7 → ┐ 0:0123 7:24 8:24 9:24 17:07 18:07 19:07 27:24 28:24 29:24 37:24 38:24 39:24 47:24 48:24 49:24 57:24 58:24 59:24 67:24 68:24 69:24 70:0123 79:20 32 33 34 35 36 37 38 → ║ 0:0123 7:24 8:24 9:24 17:24 18:24 19:24 27:24 28:24 29:24 37:24 38:24 39:24 47:24 48:24 49:24 57:24 58:24 59:24 67:24 68:24 69:24 70:0123 79:20 61 62 63 64 65 66 67 → │ 0:0123 7:24 8:24 9:24 17:24 18:24 19:24 27:24 28:24 29:24 37:24 38:24 39:24 47:24 48:24 49:24 57:24 58:24 59:24 67:24 68:24 69:24 70:0123 79:20 11) 101 12) 102 13) 103 14) 104 15) 105 16) 106 17) 107→ │ 0:0123 1:011f 2:011f 3:011f 4:011f 5:011f 7:24 8:24 9:24 11:011f 12:011f 13:011f 14:011f 15:011f 17:24 18:24 19:24 21:011f 22:011f 23:011f 24:011f 25:011f 27:24 28:24 29:24 31:011f 32:011f 33:011f 34:011f 35:011f 37:24 38:24 39:24 41:011f 42:011f 43:011f 44:011f 45:011f 47:24 48:24 49:24 51:011f 52:011f 53:011f 54:011f 55:011f 57:24 58:24 59:24 61:011f 62:011f 63:011f 64:011f 65:011f 67:24 68:24 69:24 70:0123 79:20 131 132 133 134 135 136 137→ ▼ 0:0123 7:24 8:24 9:24 17:24 18:24 19:24 27:24 28:24 29:24 37:24 38:24 39:24 47:24 48:24 49:24 57:24 58:24 59:24 67:24 68:24 69:24 70:0123 79:20 $ $ echo ":$OUT:" :2: $ exit 0 smenu-0.9.15/tests/attributes/t0005.in000077700000000000000000000000001344767411600203142data3ustar00rootroot00000000000000smenu-0.9.15/tests/attributes/t0005.tst000066400000000000000000000001771344767411600176130ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -P -N 0 -a i:6 da:1,b s:5,b -c -- t0005.in) \S[150]\s[150]l\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/attributes/t0006.good000066400000000000000000000001701344767411600177230ustar00rootroot00000000000000$ OUT=$(smenu -T -a t:3,b -- t0006.in) a b c aa bb cc aba 2:0407 6:0121 7:0121 $ $ echo ":$OUT:" :b aa: $ exit 0 smenu-0.9.15/tests/attributes/t0006.in000077700000000000000000000000001344767411600203132data1ustar00rootroot00000000000000smenu-0.9.15/tests/attributes/t0006.tst000066400000000000000000000001621344767411600176060ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -T -a t:3,b -- t0006.in) \S[150]\s[150]ltllthh\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/attributes/t0007.good000066400000000000000000000002451344767411600177270ustar00rootroot00000000000000$ OUT=$(smenu -a ct:2/0,rb t:2/0,r -P -- t0007.in) a b c aa bb cc aba 2:072028 6:01072028 7:01072028 12:072028 13:072028 $ $ echo ":$OUT:" :b cc aa: $ exit 0 smenu-0.9.15/tests/attributes/t0007.in000077700000000000000000000000001344767411600203142data1ustar00rootroot00000000000000smenu-0.9.15/tests/attributes/t0007.tst000066400000000000000000000002011344767411600176010ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -a ct:2/0,rb t:2/0,r -P -- t0007.in) \S[150]\s[150]ltllllthht\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/center_window/000077500000000000000000000000001344767411600167635ustar00rootroot00000000000000smenu-0.9.15/tests/center_window/data1000066400000000000000000000000251344767411600176750ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 smenu-0.9.15/tests/center_window/t0001.good000066400000000000000000000001701344767411600203770ustar00rootroot00000000000000$ OUT=$(smenu -M t0001.in) 1 2 3 4 5 6 7 8 9 10 34:07 $ $ echo ":$OUT:" :4: $ exit 0 smenu-0.9.15/tests/center_window/t0001.in000077700000000000000000000000001344767411600207672data1ustar00rootroot00000000000000smenu-0.9.15/tests/center_window/t0001.tst000066400000000000000000000001421344767411600202600ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -M t0001.in) \S[150]\s[150]lll\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/center_window/t0002.good000066400000000000000000000005221344767411600204010ustar00rootroot00000000000000$ OUT=$(smenu -c -M t0002.in) 1 ┐ 41:20 2 ║ 41:20 3 │ 41:20 4 │ 37:07 38:07 41:20 5 ▼ 41:20 $ $ echo ":$OUT:" :4: $ exit 0 smenu-0.9.15/tests/center_window/t0002.in000077700000000000000000000000001344767411600207702data1ustar00rootroot00000000000000smenu-0.9.15/tests/center_window/t0002.tst000066400000000000000000000001451344767411600202640ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -c -M t0002.in) \S[150]\s[150]lll\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/center_window/t0003.good000066400000000000000000000007701344767411600204070ustar00rootroot00000000000000$ OUT=$(smenu -n 10 -c -M t0003.in) 1 2 37:07 38:07 3 4 5 6 7 8 9 10 $ $ echo ":$OUT:" :2: $ exit 0 smenu-0.9.15/tests/center_window/t0003.in000077700000000000000000000000001344767411600207712data1ustar00rootroot00000000000000smenu-0.9.15/tests/center_window/t0003.tst000066400000000000000000000001571344767411600202700ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 10 -c -M t0003.in) \S[150]\s[150]jjjjkkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/center_window/t0004.good000066400000000000000000000014121344767411600204020ustar00rootroot00000000000000$ OUT=$(smenu -N. -n 10 -c -M t0004.in) 1) 1 35:01 36:01 37:01 38:01 2) 2 35:01 36:01 37:01 38:01 40:07 41:07 3) 3 35:01 36:01 37:01 38:01 4) 4 35:01 36:01 37:01 38:01 5) 5 35:01 36:01 37:01 38:01 6) 6 35:01 36:01 37:01 38:01 7) 7 35:01 36:01 37:01 38:01 8) 8 35:01 36:01 37:01 38:01 9) 9 35:01 36:01 37:01 38:01 10) 10 35:01 36:01 37:01 38:01 $ $ echo ":$OUT:" :2: $ exit 0 smenu-0.9.15/tests/center_window/t0004.in000077700000000000000000000000001344767411600207722data1ustar00rootroot00000000000000smenu-0.9.15/tests/center_window/t0004.tst000066400000000000000000000001631344767411600202660ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -N. -n 10 -c -M t0004.in) \S[150]\s[150]jjjjkkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/column_mode/000077500000000000000000000000001344767411600164155ustar00rootroot00000000000000smenu-0.9.15/tests/column_mode/data1000066400000000000000000000001211344767411600173240ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 smenu-0.9.15/tests/column_mode/data2000066400000000000000000000001301344767411600173250ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 xxxxx 13 14 15 16 17 18 19 20 21 22 yyyyyy 24 25 26 27 28 29 30 smenu-0.9.15/tests/column_mode/data3000066400000000000000000000001211344767411600173260ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 smenu-0.9.15/tests/column_mode/t0001.good000066400000000000000000000002701344767411600200320ustar00rootroot00000000000000$ OUT=$(smenu -n 10 -c t0001.in) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 12:07 13:07 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 $ $ echo ":$OUT:" :15: $ exit 0 smenu-0.9.15/tests/column_mode/t0001.in000077700000000000000000000000001344767411600204212data1ustar00rootroot00000000000000smenu-0.9.15/tests/column_mode/t0001.tst000066400000000000000000000001571344767411600177200ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 10 -c t0001.in) \S[150]\s[150]lljjlljjkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/column_mode/t0002.good000066400000000000000000000003421344767411600200330ustar00rootroot00000000000000$ OUT=$(smenu -n 10 -c t0002.in) 1 2 3 4 5 6 7 8 9 10 11 xxxxx 13 14 15 19:07 20:07 16 17 18 19 20 21 22 yyyyyy 24 25 26 27 28 29 30 $ $ echo ":$OUT:" :15: $ exit 0 smenu-0.9.15/tests/column_mode/t0002.in000077700000000000000000000000001344767411600204232data2ustar00rootroot00000000000000smenu-0.9.15/tests/column_mode/t0002.tst000066400000000000000000000001571344767411600177210ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 10 -c t0002.in) \S[150]\s[150]lljjlljjkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/column_mode/t0003.good000066400000000000000000000002721344767411600200360ustar00rootroot00000000000000$ OUT=$(smenu -n 10 -c t0003.in) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3:07 4:07 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 $ $ echo ":$OUT:" :13: $ exit 0 smenu-0.9.15/tests/column_mode/t0003.in000077700000000000000000000000001344767411600204252data3ustar00rootroot00000000000000smenu-0.9.15/tests/column_mode/t0003.tst000066400000000000000000000001571344767411600177220ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 10 -c t0003.in) \S[150]\s[150]lljjlljjkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/column_mode/t0004.good000066400000000000000000000016331344767411600200410ustar00rootroot00000000000000$ OUT=$(smenu -U 3 -n 10 -c t0004.in) 1) 1 2) 2 3 3) 4 4) 5 0:01 1:01 2:01 3:01 8:01 9:01 10:01 11:01 24:01 25:01 26:01 27:01 32:01 33:01 34:01 35:01 5) 6 6) 7 7) 8 8) 9 9) 10 0:01 1:01 2:01 3:01 8:01 9:01 10:01 11:01 16:01 17:01 18:01 19:01 24:01 25:01 26:01 27:01 32:01 33:01 34:01 35:01 10) 11 0:01 1:01 2:01 3:01 11) 12 13 12) 14 13) 15 0:01 1:01 2:01 3:01 13:07 14:07 16:01 17:01 18:01 19:01 24:01 25:01 26:01 27:01 14) 16 15) 17 0:01 1:01 2:01 3:01 8:01 9:01 10:01 11:01 16) 18 17) 19 18) 20 0:01 1:01 2:01 3:01 8:01 9:01 10:01 11:01 16:01 17:01 18:01 19:01 19) 21 20) 22 23 21) 24 0:01 1:01 2:01 3:01 8:01 9:01 10:01 11:01 24:01 25:01 26:01 27:01 22) 25 23) 26 24) 27 25) 28 26) 29 30 0:01 1:01 2:01 3:01 8:01 9:01 10:01 11:01 16:01 17:01 18:01 19:01 24:01 25:01 26:01 27:01 32:01 33:01 34:01 35:01 $ $ echo ":$OUT:" :13: $ exit 0 smenu-0.9.15/tests/column_mode/t0004.in000077700000000000000000000000001344767411600204262data3ustar00rootroot00000000000000smenu-0.9.15/tests/column_mode/t0004.tst000066400000000000000000000001641344767411600177210ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -U 3 -n 10 -c t0004.in) \S[150]\s[150]lljjlljjkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/000077500000000000000000000000001344767411600167075ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/data1000066400000000000000000000000301344767411600176150ustar00rootroot00000000000000a b c d e f g h u j k l smenu-0.9.15/tests/direct_access/data2000066400000000000000000000104511344767411600176260ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 smenu-0.9.15/tests/direct_access/data3000066400000000000000000000000141344767411600176210ustar00rootroot00000000000000"2 a" "1 b" smenu-0.9.15/tests/direct_access/data4000066400000000000000000000001051344767411600176230ustar00rootroot00000000000000"05 a" "04 b" "10 c" d "06 e" "03 f" "11 g" h "07 u" "02 j" "12 k" l smenu-0.9.15/tests/direct_access/data5000066400000000000000000000001051344767411600176240ustar00rootroot00000000000000"05 a" "04 b" "10 c" d "06 e" f "11 g" h "07 u" j "12 k" l smenu-0.9.15/tests/direct_access/data6000066400000000000000000000000411344767411600176240ustar00rootroot00000000000000"abc100 def" " 200 ijk" lmnopq smenu-0.9.15/tests/direct_access/data7000066400000000000000000000001241344767411600176270ustar00rootroot00000000000000"01 item 1" " 10 item 10" " 11 item 11" "02 item 1" " 20 item 20" " 21 item 21" smenu-0.9.15/tests/direct_access/t0001.good000066400000000000000000000006661344767411600203350ustar00rootroot00000000000000$ OUT=$(smenu -N. -- t0001.in) 1) a 2) b 3) c 4) d 5) e 6) f 7) g 8) h 9) u 10) j 11) k 0:01 1:01 2:01 3:01 7:01 8:01 9:01 10:01 14:01 15:01 16:01 17:01 21:01 22:01 23:01 24:01 28:01 29:01 30:01 31:01 35:01 36:01 37:01 38:01 42:01 43:01 44:01 45:01 49:01 50:01 51:01 52:01 56:01 57:01 58:01 59:01 63:01 64:01 65:01 66:01 68:07 70:01 71:01 72:01 73:01 12) l 0:01 1:01 2:01 3:01 $ $ echo ":$OUT:" :j: $ exit 0 smenu-0.9.15/tests/direct_access/t0001.in000077700000000000000000000000001344767411600207132data1ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0001.tst000066400000000000000000000001451344767411600202070ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -N. -- t0001.in) \S[150]\s[150]10\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/t0002.good000066400000000000000000000111371344767411600203310ustar00rootroot00000000000000$ OUT=$(smenu -N. -n 15 -c -e 000 -- t0002.in) ← 955) 955 956) 956 957) 957 958) 958 959) 959 960) 960 ▲ 0:01 1:01 2:01 3:01 4:01 5:01 6:01 13:01 14:01 15:01 16:01 17:01 18:01 25:01 26:01 27:01 28:01 29:01 30:01 37:01 38:01 39:01 40:01 41:01 42:01 49:01 50:01 51:01 52:01 53:01 54:01 61:01 62:01 63:01 64:01 65:01 66:01 79:20 ← 965) 965 966) 966 967) 967 968) 968 969) 969 970) 970 │ 0:01 1:01 2:01 3:01 4:01 5:01 6:01 13:01 14:01 15:01 16:01 17:01 18:01 25:01 26:01 27:01 28:01 29:01 30:01 37:01 38:01 39:01 40:01 41:01 42:01 49:01 50:01 51:01 52:01 53:01 54:01 61:01 62:01 63:01 64:01 65:01 66:01 79:20 ← 975) 975 976) 976 977) 977 978) 978 979) 979 980) 980 │ 0:01 1:01 2:01 3:01 4:01 5:01 6:01 13:01 14:01 15:01 16:01 17:01 18:01 25:01 26:01 27:01 28:01 29:01 30:01 37:01 38:01 39:01 40:01 41:01 42:01 49:01 50:01 51:01 52:01 53:01 54:01 61:01 62:01 63:01 64:01 65:01 66:01 79:20 ← 985) 985 986) 986 987) 987 988) 988 989) 989 990) 990 │ 0:01 1:01 2:01 3:01 4:01 5:01 6:01 13:01 14:01 15:01 16:01 17:01 18:01 25:01 26:01 27:01 28:01 29:01 30:01 37:01 38:01 39:01 40:01 41:01 42:01 49:01 50:01 51:01 52:01 53:01 54:01 61:01 62:01 63:01 64:01 65:01 66:01 79:20 ← 995) 995 996) 996 997) 997 998) 998 999) 999 1000 │ 0:01 1:01 2:01 3:01 4:01 5:01 6:01 13:01 14:01 15:01 16:01 17:01 18:01 25:01 26:01 27:01 28:01 29:01 30:01 37:01 38:01 39:01 40:01 41:01 42:01 49:01 50:01 51:01 52:01 53:01 54:01 68:24 69:24 70:24 71:24 79:20 ← 1004) 1005 1005) 1006 1006) 1007 1007) 1008 1008) 1009 1009) 1010 │ 0:01 1:01 2:01 3:01 4:01 5:01 6:01 13:01 14:01 15:01 16:01 17:01 18:01 25:01 26:01 27:01 28:01 29:01 30:01 37:01 38:01 39:01 40:01 41:01 42:01 49:01 50:01 51:01 52:01 53:01 54:01 61:01 62:01 63:01 64:01 65:01 66:01 79:20 ← 1014) 1015 1015) 1016 1016) 1017 1017) 1018 1018) 1019 1019) 1020 │ 0:01 1:01 2:01 3:01 4:01 5:01 6:01 13:01 14:01 15:01 16:01 17:01 18:01 25:01 26:01 27:01 28:01 29:01 30:01 37:01 38:01 39:01 40:01 41:01 42:01 49:01 50:01 51:01 52:01 53:01 54:01 61:01 62:01 63:01 64:01 65:01 66:01 79:20 ← 1024) 1025 1025) 1026 1026) 1027 1027) 1028 1028) 1029 1029) 1030 │ 0:01 1:01 2:01 3:01 4:01 5:01 6:01 13:01 14:01 15:01 16:01 17:01 18:01 25:01 26:01 27:01 28:01 29:01 30:01 37:01 38:01 39:01 40:01 41:01 42:01 49:01 50:01 51:01 52:01 53:01 54:01 61:01 62:01 63:01 64:01 65:01 66:01 79:20 ← 1034) 1035 1035) 1036 1036) 1037 1037) 1038 1038) 1039 1039) 1040 │ 0:01 1:01 2:01 3:01 4:01 5:01 6:01 13:01 14:01 15:01 16:01 17:01 18:01 25:01 26:01 27:01 28:01 29:01 30:01 37:01 38:01 39:01 40:01 41:01 42:01 49:01 50:01 51:01 52:01 53:01 54:01 61:01 62:01 63:01 64:01 65:01 66:01 79:20 ← 1044) 1045 1045) 1046 1046) 1047 1047) 1048 1048) 1049 1049) 1050 │ 0:01 1:01 2:01 3:01 4:01 5:01 6:01 13:01 14:01 15:01 16:01 17:01 18:01 25:01 26:01 27:01 28:01 29:01 30:01 37:01 38:01 39:01 40:01 41:01 42:01 49:01 50:01 51:01 52:01 53:01 54:01 61:01 62:01 63:01 64:01 65:01 66:01 79:20 ← 1054) 1055 1055) 1056 1056) 1057 1057) 1058 1058) 1059 1059) 1060 │ 0:01 1:01 2:01 3:01 4:01 5:01 6:01 13:01 14:01 15:01 16:01 17:01 18:01 25:01 26:01 27:01 28:01 29:01 30:01 37:01 38:01 39:01 40:01 41:01 42:01 49:01 50:01 51:01 52:01 53:01 54:01 61:01 62:01 63:01 64:01 65:01 66:01 79:20 ← 1064) 1065 1065) 1066 1066) 1067 1067) 1068 1068) 1069 1069) 1070 │ 0:01 1:01 2:01 3:01 4:01 5:01 6:01 13:01 14:01 15:01 16:01 17:01 18:01 25:01 26:01 27:01 28:01 29:01 30:01 37:01 38:01 39:01 40:01 41:01 42:01 49:01 50:01 51:01 52:01 53:01 54:01 61:01 62:01 63:01 64:01 65:01 66:01 79:20 ← 1074) 1075 1075) 1076 1076) 1077 1077) 1078 1078) 1079 1079) 1080 │ 0:01 1:01 2:01 3:01 4:01 5:01 6:01 13:01 14:01 15:01 16:01 17:01 18:01 25:01 26:01 27:01 28:01 29:01 30:01 37:01 38:01 39:01 40:01 41:01 42:01 49:01 50:01 51:01 52:01 53:01 54:01 61:01 62:01 63:01 64:01 65:01 66:01 79:20 ← 1084) 1085 1085) 1086 1086) 1087 1087) 1088 1088) 1089 1089) 1090 ║ 0:01 1:01 2:01 3:01 4:01 5:01 6:01 13:01 14:01 15:01 16:01 17:01 18:01 25:01 26:01 27:01 28:01 29:01 30:01 37:01 38:01 39:01 40:01 41:01 42:01 49:01 50:01 51:01 52:01 53:01 54:01 61:01 62:01 63:01 64:01 65:01 66:01 79:20 ← 1094) 1095 1095) 1096 1096) 1097 1097) 1098 1098) 1099 1099) 1100 ┘ 0:01 1:01 2:01 3:01 4:01 5:01 6:01 13:01 14:01 15:01 16:01 17:01 18:01 25:01 26:01 27:01 28:01 29:01 30:01 37:01 38:01 39:01 40:01 41:01 42:01 49:01 50:01 51:01 52:01 53:01 54:01 56:07 57:07 58:07 59:07 61:01 62:01 63:01 64:01 65:01 66:01 79:20 $ $ echo ":$OUT:" :1099: $ exit 0 smenu-0.9.15/tests/direct_access/t0002.in000077700000000000000000000000001344767411600207152data2ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0002.tst000066400000000000000000000002251344767411600202070ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -N. -n 15 -c -e 000 -- t0002.in) \S[150]\s[250]1080\S[700]10\S[700]800\S[700]1098\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/t0003.good000066400000000000000000000004111344767411600203230ustar00rootroot00000000000000$ OUT=$(smenu -k -N "b|d" -N "a|f" -c t0003.in) 1) a 2) b c 3) d 0:01 1:01 2:01 3:01 5:07 7:01 8:01 9:01 10:01 21:01 22:01 23:01 24:01 e 4) f g h 7:01 8:01 9:01 10:01 u j k l $ $ echo ":$OUT:" :a: $ exit 0 smenu-0.9.15/tests/direct_access/t0003.in000077700000000000000000000000001344767411600207152data1ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0003.tst000066400000000000000000000001641344767411600202120ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -k -N "b|d" -N "a|f" -c t0003.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/t0004.good000066400000000000000000000003151344767411600203270ustar00rootroot00000000000000$ OUT=$(smenu -k -N "b|d" -U "a|f|b" -c t0004.in) a b c 1) d 5:07 21:01 22:01 23:01 24:01 e f g h u j k l $ $ echo ":$OUT:" :a: $ exit 0 smenu-0.9.15/tests/direct_access/t0004.in000077700000000000000000000000001344767411600207162data1ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0004.tst000066400000000000000000000001661344767411600202150ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -k -N "b|d" -U "a|f|b" -c t0004.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/t0005.good000066400000000000000000000006211344767411600203300ustar00rootroot00000000000000$ OUT=$(smenu -k -U "b|d" -N "a|b" -c t0005.in) 1) a b 2) c d 0:01 1:01 2:01 3:01 5:07 14:01 15:01 16:01 17:01 3) e 4) f 5) g 6) h 0:01 1:01 2:01 3:01 7:01 8:01 9:01 10:01 14:01 15:01 16:01 17:01 21:01 22:01 23:01 24:01 7) u 8) j 9) k 10) l 0:01 1:01 2:01 3:01 7:01 8:01 9:01 10:01 14:01 15:01 16:01 17:01 21:01 22:01 23:01 24:01 $ $ echo ":$OUT:" :a: $ exit 0 smenu-0.9.15/tests/direct_access/t0005.in000077700000000000000000000000001344767411600207172data1ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0005.tst000066400000000000000000000001641344767411600202140ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -k -U "b|d" -N "a|b" -c t0005.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/t0006.good000066400000000000000000000002011344767411600203230ustar00rootroot00000000000000$ OUT=$(smenu -k -F -D n:1 i:1 -- t0006.in) 2) a 1) b 0:01 1:01 2:01 4:07 6:01 7:01 8:01 $ $ echo ":$OUT:" :a: $ exit 0 smenu-0.9.15/tests/direct_access/t0006.in000077700000000000000000000000001344767411600207222data3ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0006.tst000066400000000000000000000001601344767411600202110ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -k -F -D n:1 i:1 -- t0006.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/t0007.good000066400000000000000000000002141344767411600203300ustar00rootroot00000000000000$ OUT=$(smenu -k -F -D n:1 i:1 d:'\u7e' -- t0007.in) 2) a 1) b 0:01 1:01 2:01 4:07 6:01 7:01 8:01 $ $ echo ":$OUT:" :2~a: $ exit 0 smenu-0.9.15/tests/direct_access/t0007.in000077700000000000000000000000001344767411600207232data3ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0007.tst000066400000000000000000000001721344767411600202150ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -k -F -D n:1 i:1 d:'\\u7e' -- t0007.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/t0008.good000066400000000000000000000002321344767411600203310ustar00rootroot00000000000000$ OUT=$(smenu -k -F -D n:2 n:1 d:: i:2 d:'\u7e' i:1 -- t0008.in) 2) a 1) b 0:01 1:01 2:01 6:01 7:01 8:01 10:07 $ $ echo ":$OUT:" :1~b: $ exit 0 smenu-0.9.15/tests/direct_access/t0008.in000077700000000000000000000000001344767411600207242data3ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0008.tst000066400000000000000000000002101344767411600202070ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -k -F -D n:2 n:1 d:: i:2 d:'\\u7e' i:1 -- t0008.in) \S[150]\s[150]l\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/t0009.good000066400000000000000000000005731344767411600203420ustar00rootroot00000000000000$ OUT=$(smenu -c -k -F -D f:no n:2 i:1 -- t0009.in) 5) a 4) b 10) c d 0:01 1:01 2:01 3:01 7:01 8:01 9:01 10:01 14:01 15:01 16:01 17:01 6) e 3) f 11) g h 0:01 1:01 2:01 3:01 7:01 8:01 9:01 10:01 14:01 15:01 16:01 17:01 26:07 7) u 2) j 12) k l 0:01 1:01 2:01 3:01 7:01 8:01 9:01 10:01 14:01 15:01 16:01 17:01 $ $ echo ":$OUT:" :h: $ exit 0 smenu-0.9.15/tests/direct_access/t0009.in000077700000000000000000000000001344767411600207262data4ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0009.tst000066400000000000000000000001771344767411600202240ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -c -k -F -D f:no n:2 i:1 -- t0009.in) \S[150]\s[150]lllllll\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/t0010.good000066400000000000000000000005101344767411600203210ustar00rootroot00000000000000$ OUT=$(smenu -c -F -D i:1 n:2 -- t0010.in) 5) a 4) b 10) c d 0:01 1:01 2:01 3:01 5:07 7:01 8:01 9:01 10:01 14:01 15:01 16:01 17:01 6) e f 11) g h 0:01 1:01 2:01 3:01 14:01 15:01 16:01 17:01 7) u j 12) k l 0:01 1:01 2:01 3:01 14:01 15:01 16:01 17:01 $ $ echo ":$OUT:" :a: $ exit 0 smenu-0.9.15/tests/direct_access/t0010.in000077700000000000000000000000001344767411600207172data5ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0010.tst000066400000000000000000000001601344767411600202040ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -c -F -D i:1 n:2 -- t0010.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/t0011.good000066400000000000000000000010331344767411600203230ustar00rootroot00000000000000$ OUT=$(smenu -c -F -N -D i:1 n:2 s:100 w:3 -- t0011.in) 5) a 4) b 10) c 11) d 0:01 1:01 2:01 3:01 4:01 6:07 8:01 9:01 10:01 11:01 12:01 16:01 17:01 18:01 19:01 20:01 24:01 25:01 26:01 27:01 28:01 6) e 7) f 11) g 12) h 0:01 1:01 2:01 3:01 4:01 8:01 9:01 10:01 11:01 12:01 16:01 17:01 18:01 19:01 20:01 24:01 25:01 26:01 27:01 28:01 7) u 8) j 12) k 13) l 0:01 1:01 2:01 3:01 4:01 8:01 9:01 10:01 11:01 12:01 16:01 17:01 18:01 19:01 20:01 24:01 25:01 26:01 27:01 28:01 $ $ echo ":$OUT:" :a: $ exit 0 smenu-0.9.15/tests/direct_access/t0011.in000077700000000000000000000000001344767411600207202data5ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0011.tst000066400000000000000000000001751344767411600202130ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -c -F -N -D i:1 n:2 s:100 w:3 -- t0011.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/t0012.good000066400000000000000000000010371344767411600203300ustar00rootroot00000000000000$ OUT=$(smenu -c -F -N -D i:1 n:2 s:100 f:n w:3 -- t0012.in) 5) a 4) b 10) c 100) d 0:01 1:01 2:01 3:01 4:01 6:07 8:01 9:01 10:01 11:01 12:01 16:01 17:01 18:01 19:01 20:01 24:01 25:01 26:01 27:01 28:01 6) e 101) f 11) g 102) h 0:01 1:01 2:01 3:01 4:01 8:01 9:01 10:01 11:01 12:01 16:01 17:01 18:01 19:01 20:01 24:01 25:01 26:01 27:01 28:01 7) u 103) j 12) k 104) l 0:01 1:01 2:01 3:01 4:01 8:01 9:01 10:01 11:01 12:01 16:01 17:01 18:01 19:01 20:01 24:01 25:01 26:01 27:01 28:01 $ $ echo ":$OUT:" :a: $ exit 0 smenu-0.9.15/tests/direct_access/t0012.in000077700000000000000000000000001344767411600207212data5ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0012.tst000066400000000000000000000002011344767411600202020ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -c -F -N -D i:1 n:2 s:100 f:n w:3 -- t0012.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/t0013.good000066400000000000000000000010321344767411600203240ustar00rootroot00000000000000$ OUT=$(smenu -c -F -N -D i:1 n:2 f:no w:3 -- t0013.in) 5) a 4) b 10) c 1) d 0:01 1:01 2:01 3:01 4:01 6:07 8:01 9:01 10:01 11:01 12:01 16:01 17:01 18:01 19:01 20:01 24:01 25:01 26:01 27:01 28:01 6) e 2) f 11) g 3) h 0:01 1:01 2:01 3:01 4:01 8:01 9:01 10:01 11:01 12:01 16:01 17:01 18:01 19:01 20:01 24:01 25:01 26:01 27:01 28:01 7) u 4) j 12) k 5) l 0:01 1:01 2:01 3:01 4:01 8:01 9:01 10:01 11:01 12:01 16:01 17:01 18:01 19:01 20:01 24:01 25:01 26:01 27:01 28:01 $ $ echo ":$OUT:" :a: $ exit 0 smenu-0.9.15/tests/direct_access/t0013.in000077700000000000000000000000001344767411600207222data5ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0013.tst000066400000000000000000000001741344767411600202140ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -c -F -N -D i:1 n:2 f:no w:3 -- t0013.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/t0014.good000066400000000000000000000003301344767411600203250ustar00rootroot00000000000000$ OUT=$(smenu -l -F -D o:3 n:3 i:1 -- t0014.in) 100) abcdef 0:01 1:01 2:01 3:01 4:01 6:07 7:07 8:07 9:07 10:07 11:07 200) ijk 0:01 1:01 2:01 3:01 4:01 lmnopq $ $ echo ":$OUT:" :abcdef: $ exit 0 smenu-0.9.15/tests/direct_access/t0014.in000077700000000000000000000000001344767411600207242data6ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0014.tst000066400000000000000000000001641344767411600202140ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -l -F -D o:3 n:3 i:1 -- t0014.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/t0015.good000066400000000000000000000003021344767411600203250ustar00rootroot00000000000000$ OUT=$(smenu -l -F -D o:3 n:3 i:1 h:c -- t0015.in) 100) def 0:01 1:01 2:01 3:01 4:01 6:07 7:07 8:07 200) ijk 0:01 1:01 2:01 3:01 4:01 lmnopq $ $ echo ":$OUT:" :def: $ exit 0 smenu-0.9.15/tests/direct_access/t0015.in000077700000000000000000000000001344767411600207252data6ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0015.tst000066400000000000000000000001701344767411600202120ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -l -F -D o:3 n:3 i:1 h:c -- t0015.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/t0016.good000066400000000000000000000003311344767411600203300ustar00rootroot00000000000000$ OUT=$(smenu -l -F -D o:3 n:3 i:1 h:t -- t0016.in) 100) abcdef 0:01 1:01 2:01 3:01 4:01 6:07 7:07 8:07 9:07 10:07 11:07 200) ijk 0:01 1:01 2:01 3:01 4:01 lmnopq $ $ echo ":$OUT:" :abcdef: $ exit 0 smenu-0.9.15/tests/direct_access/t0016.in000077700000000000000000000000001344767411600207262data6ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0016.tst000066400000000000000000000001701344767411600202130ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -l -F -D o:3 n:3 i:1 h:t -- t0016.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/t0017.good000066400000000000000000000003341344767411600203340ustar00rootroot00000000000000$ OUT=$(smenu -l -F -D o:3 n:3 i:1 h:k -- t0017.in) 100) abcdef 0:01 1:01 2:01 3:01 4:01 6:07 7:07 8:07 9:07 10:07 11:07 200) ijk 0:01 1:01 2:01 3:01 4:01 lmnopq $ $ echo ":$OUT:" :abcdef: $ exit 0 smenu-0.9.15/tests/direct_access/t0017.in000077700000000000000000000000001344767411600207272data6ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0017.tst000066400000000000000000000001701344767411600202140ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -l -F -D o:3 n:3 i:1 h:k -- t0017.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/direct_access/t0018.good000066400000000000000000000005671344767411600203450ustar00rootroot00000000000000$ OUT=$(smenu -l -F -D o:0+ i:1 n:2 -- t0018.in) 1) item 1 ┐ 0:01 1:01 2:01 3:01 16:20 10) item 10 │ 0:01 1:01 2:01 3:01 16:20 11) item 11 ║ 0:01 1:01 2:01 3:01 5:07 6:07 7:07 8:07 9:07 10:07 11:07 12:07 13:07 16:20 2) item 1 │ 0:01 1:01 2:01 3:01 16:20 20) item 20 ▼ 0:01 1:01 2:01 3:01 16:20 $ $ echo ":$OUT:" :item 11: $ exit 0 smenu-0.9.15/tests/direct_access/t0018.in000077700000000000000000000000001344767411600207312data7ustar00rootroot00000000000000smenu-0.9.15/tests/direct_access/t0018.tst000066400000000000000000000001671344767411600202230ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -l -F -D o:0+ i:1 n:2 -- t0018.in) \S[150]\s[150]jj\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/do_not_trim_selection/000077500000000000000000000000001344767411600204765ustar00rootroot00000000000000smenu-0.9.15/tests/do_not_trim_selection/data1000066400000000000000000000000251344767411600214100ustar00rootroot00000000000000" 1 2" "3 4 " " 5 6" smenu-0.9.15/tests/do_not_trim_selection/data2000066400000000000000000000000261344767411600214120ustar00rootroot00000000000000" 1 2" "3 4 " " 5 6 " smenu-0.9.15/tests/do_not_trim_selection/t0001.good000066400000000000000000000001471344767411600221160ustar00rootroot00000000000000$ OUT=$(smenu -k t0001.in) 1 2 3 4 5 6 0:07 1:07 2:07 3:07 $ $ echo ":$OUT:" : 1 2: $ exit 0 smenu-0.9.15/tests/do_not_trim_selection/t0001.in000077700000000000000000000000001344767411600225022data1ustar00rootroot00000000000000smenu-0.9.15/tests/do_not_trim_selection/t0001.tst000066400000000000000000000001371344767411600217770ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -k t0001.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/do_not_trim_selection/t0002.good000066400000000000000000000001471344767411600221170ustar00rootroot00000000000000$ OUT=$(smenu -k t0002.in) 1 2 3 4 5 6 5:07 6:07 7:07 8:07 $ $ echo ":$OUT:" :3 4 : $ exit 0 smenu-0.9.15/tests/do_not_trim_selection/t0002.in000077700000000000000000000000001344767411600225032data1ustar00rootroot00000000000000smenu-0.9.15/tests/do_not_trim_selection/t0002.tst000066400000000000000000000001401344767411600217720ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -k t0002.in) \S[150]\s[150]l\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/do_not_trim_selection/t0003.good000066400000000000000000000001631344767411600221160ustar00rootroot00000000000000$ OUT=$(smenu -k t0003.in) 1 2 3 4 5 6 10:07 11:07 12:07 13:07 14:07 $ $ echo ":$OUT:" : 5 6 : $ exit 0 smenu-0.9.15/tests/do_not_trim_selection/t0003.in000077700000000000000000000000001344767411600225052data2ustar00rootroot00000000000000smenu-0.9.15/tests/do_not_trim_selection/t0003.tst000066400000000000000000000001411344767411600217740ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -k t0003.in) \S[150]\s[150]ll\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/do_not_trim_selection/t0004.good000066400000000000000000000002651344767411600221220ustar00rootroot00000000000000$ OUT=$(smenu -N. -k t0004.in) 1) 1 2 2) 3 4 3) 5 6 0:01 1:01 2:01 9:01 10:01 11:01 18:01 19:01 20:01 22:07 23:07 24:07 25:07 26:07 $ $ echo ":$OUT:" : 5 6 : $ exit 0 smenu-0.9.15/tests/do_not_trim_selection/t0004.in000077700000000000000000000000001344767411600225062data2ustar00rootroot00000000000000smenu-0.9.15/tests/do_not_trim_selection/t0004.tst000066400000000000000000000001451344767411600220010ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -N. -k t0004.in) \S[150]\s[150]ll\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/elementary_moves/000077500000000000000000000000001344767411600174725ustar00rootroot00000000000000smenu-0.9.15/tests/elementary_moves/data1000066400000000000000000000000251344767411600204040ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 smenu-0.9.15/tests/elementary_moves/data2000066400000000000000000000000251344767411600204050ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 smenu-0.9.15/tests/elementary_moves/t0001.good000066400000000000000000000001301344767411600211020ustar00rootroot00000000000000$ OUT=$(smenu t0001.in) 1 2 3 4 5 6 7 8 9 10 6:07 $ $ echo ":$OUT:" :4: $ exit 0 smenu-0.9.15/tests/elementary_moves/t0001.in000077700000000000000000000000001344767411600214762data1ustar00rootroot00000000000000smenu-0.9.15/tests/elementary_moves/t0001.tst000066400000000000000000000001371344767411600207730ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu t0001.in) \S[150]\s[150]lll\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/elementary_moves/t0002.good000066400000000000000000000001301344767411600211030ustar00rootroot00000000000000$ OUT=$(smenu t0002.in) 1 2 3 4 5 6 7 8 9 10 0:07 $ $ echo ":$OUT:" :1: $ exit 0 smenu-0.9.15/tests/elementary_moves/t0002.in000077700000000000000000000000001344767411600214772data1ustar00rootroot00000000000000smenu-0.9.15/tests/elementary_moves/t0002.tst000066400000000000000000000001371344767411600207740ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu t0002.in) \S[150]\s[150]hhh\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/elementary_moves/t0003.good000066400000000000000000000001401344767411600211050ustar00rootroot00000000000000$ OUT=$(smenu t0003.in) 1 2 3 4 5 6 7 8 9 10 18:07 19:07 $ $ echo ":$OUT:" :10: $ exit 0 smenu-0.9.15/tests/elementary_moves/t0003.in000077700000000000000000000000001344767411600215002data1ustar00rootroot00000000000000smenu-0.9.15/tests/elementary_moves/t0003.tst000066400000000000000000000001461344767411600207750ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu t0003.in) \S[150]\s[150]llllllllll\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/elementary_moves/t0004.good000066400000000000000000000001301344767411600211050ustar00rootroot00000000000000$ OUT=$(smenu t0004.in) 1 2 3 4 5 6 7 8 9 10 8:07 $ $ echo ":$OUT:" :5: $ exit 0 smenu-0.9.15/tests/elementary_moves/t0004.in000077700000000000000000000000001344767411600215012data1ustar00rootroot00000000000000smenu-0.9.15/tests/elementary_moves/t0004.tst000066400000000000000000000001461344767411600207760ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu t0004.in) \S[150]\s[150]lllhhhllll\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/elementary_moves/t0005.good000066400000000000000000000001351344767411600211130ustar00rootroot00000000000000$ OUT=$(smenu -l t0005.in) 1 2 3 4 5 8:07 6 7 8 9 10 $ $ echo ":$OUT:" :5: $ exit 0 smenu-0.9.15/tests/elementary_moves/t0005.in000077700000000000000000000000001344767411600215032data2ustar00rootroot00000000000000smenu-0.9.15/tests/elementary_moves/t0005.tst000066400000000000000000000001471344767411600210000ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -l t0005.in) \S[150]\s[150]ljlkljlk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/elementary_moves/t0006.good000066400000000000000000000001351344767411600211140ustar00rootroot00000000000000$ OUT=$(smenu -l t0006.in) 1 2 3 4 5 8:07 6 7 8 9 10 $ $ echo ":$OUT:" :5: $ exit 0 smenu-0.9.15/tests/elementary_moves/t0006.in000077700000000000000000000000001344767411600215042data2ustar00rootroot00000000000000smenu-0.9.15/tests/elementary_moves/t0006.tst000066400000000000000000000001531344767411600207760ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -l t0006.in) \S[150]\s[150]ljjlkkljjlkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/elementary_moves/t0007.good000066400000000000000000000001351344767411600211150ustar00rootroot00000000000000$ OUT=$(smenu -l t0007.in) 1 2 3 4 5 8:07 6 7 8 9 10 $ $ echo ":$OUT:" :5: $ exit 0 smenu-0.9.15/tests/elementary_moves/t0007.in000077700000000000000000000000001344767411600215052data2ustar00rootroot00000000000000smenu-0.9.15/tests/elementary_moves/t0007.tst000066400000000000000000000001771344767411600210050ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -l t0007.in) \S[150]\s[150]lljjllkklljjllkkhhjjhhkkhhjjllkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/elementary_moves/t0008.good000066400000000000000000000005661344767411600211260ustar00rootroot00000000000000$ OUT=$(smenu -N. -l t0008.in) 1) 1 2) 2 3) 3 4) 4 5) 5 0:01 1:01 2:01 3:01 7:01 8:01 9:01 10:01 14:01 15:01 16:01 17:01 21:01 22:01 23:01 24:01 28:01 29:01 30:01 31:01 33:07 6) 6 7) 7 8) 8 9) 9 10) 10 0:01 1:01 2:01 3:01 7:01 8:01 9:01 10:01 14:01 15:01 16:01 17:01 21:01 22:01 23:01 24:01 28:01 29:01 30:01 31:01 $ $ echo ":$OUT:" :5: $ exit 0 smenu-0.9.15/tests/elementary_moves/t0008.in000077700000000000000000000000001344767411600215062data2ustar00rootroot00000000000000smenu-0.9.15/tests/elementary_moves/t0008.tst000066400000000000000000000002031344767411600207740ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -N. -l t0008.in) \S[150]\s[150]lljjllkklljjllkkhhjjhhkkhhjjllkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/elementary_moves/t0009.good000066400000000000000000000005371344767411600211250ustar00rootroot00000000000000$ OUT=$(smenu -U 4 -l t0009.in) 1) 1 2) 2 3) 3 4 4) 5 0:01 1:01 2:01 3:01 7:01 8:01 9:01 10:01 14:01 15:01 16:01 17:01 28:01 29:01 30:01 31:01 33:07 5) 6 6) 7 7) 8 8) 9 9) 10 0:01 1:01 2:01 3:01 7:01 8:01 9:01 10:01 14:01 15:01 16:01 17:01 21:01 22:01 23:01 24:01 28:01 29:01 30:01 31:01 $ $ echo ":$OUT:" :5: $ exit 0 smenu-0.9.15/tests/elementary_moves/t0009.in000077700000000000000000000000001344767411600215072data2ustar00rootroot00000000000000smenu-0.9.15/tests/elementary_moves/t0009.tst000066400000000000000000000002041344767411600207760ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -U 4 -l t0009.in) \S[150]\s[150]lljjllkklljjllkkhhjjhhkkhhjjllkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/force_first/000077500000000000000000000000001344767411600164215ustar00rootroot00000000000000smenu-0.9.15/tests/force_first/data1000066400000000000000000000000341344767411600173330ustar00rootroot00000000000000a b c d X e f g h i j X k l smenu-0.9.15/tests/force_first/data2000066400000000000000000000000401344767411600173310ustar00rootroot00000000000000X a b c d Y e f g h i j X k l Y smenu-0.9.15/tests/force_first/t0001.good000066400000000000000000000001531344767411600200360ustar00rootroot00000000000000$ OUT=$(smenu -A X -c t0001.in) a b c d X e f g h i j 4:07 X k l $ $ echo ":$OUT:" :f: $ exit 0 smenu-0.9.15/tests/force_first/t0001.in000077700000000000000000000000001344767411600204252data1ustar00rootroot00000000000000smenu-0.9.15/tests/force_first/t0001.tst000066400000000000000000000001471344767411600177230ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -A X -c t0001.in) \S[150]\s[150]llj\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/force_first/t0002.good000066400000000000000000000001651344767411600200420ustar00rootroot00000000000000$ OUT=$(smenu -A 'X|Y' -c t0002.in) X a b c d Y e f g h i j 4:07 X k l Y $ $ echo ":$OUT:" :f: $ exit 0 smenu-0.9.15/tests/force_first/t0002.in000077700000000000000000000000001344767411600204272data2ustar00rootroot00000000000000smenu-0.9.15/tests/force_first/t0002.tst000066400000000000000000000001531344767411600177210ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -A 'X|Y' -c t0002.in) \S[150]\s[150]llj\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/force_last/000077500000000000000000000000001344767411600162355ustar00rootroot00000000000000smenu-0.9.15/tests/force_last/data1000066400000000000000000000000341344767411600171470ustar00rootroot00000000000000a b c d X e f g h i j X k l smenu-0.9.15/tests/force_last/data2000066400000000000000000000000401344767411600171450ustar00rootroot00000000000000X a b c d Y e f g h i j X k l Y smenu-0.9.15/tests/force_last/t0001.good000066400000000000000000000001531344767411600176520ustar00rootroot00000000000000$ OUT=$(smenu -Z X -c t0001.in) a b c d X e f g h i j X 4:07 k l $ $ echo ":$OUT:" :g: $ exit 0 smenu-0.9.15/tests/force_last/t0001.in000077700000000000000000000000001344767411600202412data1ustar00rootroot00000000000000smenu-0.9.15/tests/force_last/t0001.tst000066400000000000000000000001471344767411600175370ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -Z X -c t0001.in) \S[150]\s[150]llj\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/force_last/t0002.good000066400000000000000000000001651344767411600176560ustar00rootroot00000000000000$ OUT=$(smenu -Z 'X|Y' -c t0002.in) X a b c d Y e f g h i j X 2:07 k l Y $ $ echo ":$OUT:" :f: $ exit 0 smenu-0.9.15/tests/force_last/t0002.in000077700000000000000000000000001344767411600202432data2ustar00rootroot00000000000000smenu-0.9.15/tests/force_last/t0002.tst000066400000000000000000000001531344767411600175350ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -Z 'X|Y' -c t0002.in) \S[150]\s[150]llj\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/full_width/000077500000000000000000000000001344767411600162555ustar00rootroot00000000000000smenu-0.9.15/tests/full_width/data1000066400000000000000000000000441344767411600171700ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 15 smenu-0.9.15/tests/full_width/t0001.good000066400000000000000000000001731344767411600176740ustar00rootroot00000000000000$ OUT=$(smenu -t -w t0001.in) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3:07 4:07 $ $ echo ":$OUT:" :2: $ exit 0 smenu-0.9.15/tests/full_width/t0001.in000077700000000000000000000000001344767411600202612data1ustar00rootroot00000000000000smenu-0.9.15/tests/full_width/t0001.tst000066400000000000000000000001441344767411600175540ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -t -w t0001.in) \S[150]\s[150]lj\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/full_width/t0002.good000066400000000000000000000005771344767411600177050ustar00rootroot00000000000000$ OUT=$(smenu -t 5 -w t0002.in) 1 2 3 4 5 6 7 8 9 10 15:07 16:07 17:07 18:07 19:07 20:07 21:07 22:07 23:07 24:07 25:07 26:07 27:07 28:07 11 12 13 14 15 $ $ echo ":$OUT:" :7: $ exit 0 smenu-0.9.15/tests/full_width/t0002.in000077700000000000000000000000001344767411600202622data1ustar00rootroot00000000000000smenu-0.9.15/tests/full_width/t0002.tst000066400000000000000000000001461344767411600175570ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -t 5 -w t0002.in) \S[150]\s[150]lj\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/gutter/000077500000000000000000000000001344767411600154265ustar00rootroot00000000000000smenu-0.9.15/tests/gutter/data1000066400000000000000000000000411344767411600163360ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 smenu-0.9.15/tests/gutter/data2000066400000000000000000000001371344767411600163450ustar00rootroot00000000000000abcd efgh ijkl mnop qrst vwxy zabc defg hijk lmno pqrs tuvw xyza bcde efgh jklm nopq rstu vwxy smenu-0.9.15/tests/gutter/t0001.good000066400000000000000000000002251344767411600170430ustar00rootroot00000000000000$ OUT=$(smenu -t -g -- t0001.in) 1 │2 │3 │4 │5 │6 │7 │8 │9 │10│11│12│13│14 0:07 1:07 $ $ echo ":$OUT:" :1: $ exit 0 smenu-0.9.15/tests/gutter/t0001.in000077700000000000000000000000001344767411600174322data1ustar00rootroot00000000000000smenu-0.9.15/tests/gutter/t0001.tst000066400000000000000000000001451344767411600167260ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -t -g -- t0001.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/gutter/t0002.good000066400000000000000000000002151344767411600170430ustar00rootroot00000000000000$ OUT=$(smenu -c -g -- t0002.in) 1│2 │3 │4 │5 0:07 6│7 │8 9│10│11│12│13│14 $ $ echo ":$OUT:" :1: $ exit 0 smenu-0.9.15/tests/gutter/t0002.in000077700000000000000000000000001344767411600174332data1ustar00rootroot00000000000000smenu-0.9.15/tests/gutter/t0002.tst000066400000000000000000000001451344767411600167270ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -c -g -- t0002.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/gutter/t0003.good000066400000000000000000000002441344767411600170460ustar00rootroot00000000000000$ OUT=$(smenu -c -g '\ue29483\ue29db1\uF09D8481 ' t0003.in) 1┃2 ❱3 𝄁4 5 0:07 6┃7 ❱8 9┃10❱11𝄁12 13 14 $ $ echo ":$OUT:" :1: $ exit 0 smenu-0.9.15/tests/gutter/t0003.in000077700000000000000000000000001344767411600174342data1ustar00rootroot00000000000000smenu-0.9.15/tests/gutter/t0003.tst000066400000000000000000000002031344767411600167230ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -c -g '\\ue29483\\ue29db1\\uF09D8481 ' t0003.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/gutter/t0004.good000066400000000000000000000002741344767411600170520ustar00rootroot00000000000000$ OUT=$(smenu -c -g '|: ' t0004.in) ←efgh:ijkl mnop qrst vwxy zabc defg hijk lmno pqrs tuvw xyza bcde efgh jklm→ 0:01 1:07 2:07 3:07 4:07 75:01 $ $ echo ":$OUT:" :efgh: $ exit 0 smenu-0.9.15/tests/gutter/t0004.in000077700000000000000000000000001344767411600174362data2ustar00rootroot00000000000000smenu-0.9.15/tests/gutter/t0004.tst000066400000000000000000000002051344767411600167260ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -c -g '|: ' t0004.in) \S[150]\s[150]lllllllllllllllhhhhhhhhhhhhhh\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/gutter/t0005.good000066400000000000000000000002721344767411600170510ustar00rootroot00000000000000$ OUT=$(smenu -c -g '|: ' t0005.in) abcd|efgh:ijkl mnop qrst vwxy zabc defg hijk lmno pqrs tuvw xyza bcde efgh→ 0:01 1:07 2:07 3:07 4:07 75:01 $ $ echo ":$OUT:" :abcd: $ exit 0 smenu-0.9.15/tests/gutter/t0005.in000077700000000000000000000000001344767411600174372data2ustar00rootroot00000000000000smenu-0.9.15/tests/gutter/t0005.tst000066400000000000000000000002061344767411600167300ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -c -g '|: ' t0005.in) \S[150]\s[150]lllllllllllllllhhhhhhhhhhhhhhh\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/in-ex-clusions/000077500000000000000000000000001344767411600167715ustar00rootroot00000000000000smenu-0.9.15/tests/in-ex-clusions/data1000066400000000000000000000000631344767411600177050ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 smenu-0.9.15/tests/in-ex-clusions/t0001.good000066400000000000000000000002301344767411600204020ustar00rootroot00000000000000$ OUT=$(smenu -e2 t0001.in) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2:24 14:07 24:24 25:24 48:24 49:24 $ $ echo ":$OUT:" :8: $ exit 0 smenu-0.9.15/tests/in-ex-clusions/t0001.in000077700000000000000000000000001344767411600207752data1ustar00rootroot00000000000000smenu-0.9.15/tests/in-ex-clusions/t0001.tst000066400000000000000000000001621344767411600202700ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -e2 t0001.in) \S[150]\s[150]llllllllllhhhhhhll\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/in-ex-clusions/t0002.good000066400000000000000000000004411344767411600204070ustar00rootroot00000000000000$ OUT=$(smenu -i[2-3] -e1 t0002.in) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 0:24 2:07 6:24 8:24 10:24 12:24 14:24 16:24 18:24 19:24 21:24 22:24 24:24 25:24 27:24 28:24 30:24 31:24 33:24 34:24 36:24 37:24 39:24 40:24 42:24 43:24 45:24 46:24 $ $ echo ":$OUT:" :2: $ exit 0 smenu-0.9.15/tests/in-ex-clusions/t0002.in000077700000000000000000000000001344767411600207762data1ustar00rootroot00000000000000smenu-0.9.15/tests/in-ex-clusions/t0002.tst000066400000000000000000000001551344767411600202730ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -i[2-3] -e1 t0002.in) \S[150]\s[150]lllhh\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/in-ex-clusions/t0003.good000066400000000000000000000004151344767411600204110ustar00rootroot00000000000000$ OUT=$(smenu -i[2-3] -e3 -i5 t0003.in) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 0:24 4:24 6:24 8:07 10:24 12:24 14:24 16:24 18:24 19:24 21:24 22:24 27:24 28:24 30:24 31:24 36:24 37:24 39:24 40:24 42:24 43:24 45:24 46:24 $ $ echo ":$OUT:" :5: $ exit 0 smenu-0.9.15/tests/in-ex-clusions/t0003.in000077700000000000000000000000001344767411600207772data1ustar00rootroot00000000000000smenu-0.9.15/tests/in-ex-clusions/t0003.tst000066400000000000000000000001611344767411600202710ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -i[2-3] -e3 -i5 t0003.in) \S[150]\s[150]lllhh\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/in-ex-clusions/t0004.good000066400000000000000000000004361344767411600204150ustar00rootroot00000000000000$ OUT=$(smenu -i[2-3] -e3 -i3 t0004.in) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 0:24 2:07 4:24 6:24 8:24 10:24 12:24 14:24 16:24 18:24 19:24 21:24 22:24 27:24 28:24 30:24 31:24 33:24 34:24 36:24 37:24 39:24 40:24 42:24 43:24 45:24 46:24 $ $ echo ":$OUT:" :2: $ exit 0 smenu-0.9.15/tests/in-ex-clusions/t0004.in000077700000000000000000000000001344767411600210002data1ustar00rootroot00000000000000smenu-0.9.15/tests/in-ex-clusions/t0004.tst000066400000000000000000000001611344767411600202720ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -i[2-3] -e3 -i3 t0004.in) \S[150]\s[150]lllhh\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/in-ex-clusions/t0005.good000066400000000000000000000007201344767411600204120ustar00rootroot00000000000000$ OUT=$(smenu -i[2-3] -N '2|4' -e3 -i3 t0005.in) 1 1) 2 3 4 5 6 7 8 9 10 5:24 7:01 8:01 9:01 10:01 12:07 19:24 26:24 33:24 40:24 47:24 54:24 61:24 68:24 69:24 11 2) 12 13 14 15 16 17 18 19 5:24 6:24 8:01 9:01 10:01 11:01 21:24 22:24 29:24 30:24 37:24 38:24 45:24 46:24 53:24 54:24 61:24 62:24 69:24 70:24 3) 20 0:01 1:01 2:01 3:01 $ $ echo ":$OUT:" :2: $ exit 0 smenu-0.9.15/tests/in-ex-clusions/t0005.in000077700000000000000000000000001344767411600210012data1ustar00rootroot00000000000000smenu-0.9.15/tests/in-ex-clusions/t0005.tst000066400000000000000000000001721344767411600202750ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -i[2-3] -N '2|4' -e3 -i3 t0005.in) \S[150]\s[150]lllhh\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/initial_selection/000077500000000000000000000000001344767411600176125ustar00rootroot00000000000000smenu-0.9.15/tests/initial_selection/data1000066400000000000000000000000641344767411600205270ustar00rootroot00000000000000a b c d e f g h i j k l m n o p q r s t u v w x y z smenu-0.9.15/tests/initial_selection/data2000066400000000000000000000000401344767411600205220ustar00rootroot00000000000000aab abb aa ab ba bb aba bab aaa smenu-0.9.15/tests/initial_selection/t0001.good000066400000000000000000000001741344767411600212320ustar00rootroot00000000000000$ OUT=$(smenu -sh t0001.in) a b c d e f g h i j k l m n o p q r s t u v w x y z 14:07 $ $ echo ":$OUT:" :h: $ exit 0 smenu-0.9.15/tests/initial_selection/t0001.in000077700000000000000000000000001344767411600216162data1ustar00rootroot00000000000000smenu-0.9.15/tests/initial_selection/t0001.tst000066400000000000000000000001401344767411600211050ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -sh t0001.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/initial_selection/t0002.good000066400000000000000000000001731344767411600212320ustar00rootroot00000000000000$ OUT=$(smenu -s5 t0002.in) a b c d e f g h i j k l m n o p q r s t u v w x y z 0:07 $ $ echo ":$OUT:" :a: $ exit 0 smenu-0.9.15/tests/initial_selection/t0002.in000077700000000000000000000000001344767411600216172data1ustar00rootroot00000000000000smenu-0.9.15/tests/initial_selection/t0002.tst000066400000000000000000000001401344767411600211060ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -s5 t0002.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/initial_selection/t0003.good000066400000000000000000000002001344767411600212220ustar00rootroot00000000000000$ OUT=$(smenu -s "#5" t0003.in) a b c d e f g h i j k l m n o p q r s t u v w x y z 10:07 $ $ echo ":$OUT:" :f: $ exit 0 smenu-0.9.15/tests/initial_selection/t0003.in000077700000000000000000000000001344767411600216202data1ustar00rootroot00000000000000smenu-0.9.15/tests/initial_selection/t0003.tst000066400000000000000000000001441344767411600211130ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -s "#5" t0003.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/initial_selection/t0004.good000066400000000000000000000001711344767411600212320ustar00rootroot00000000000000$ OUT=$(smenu -s/a.a t0004.in) aab abb aa ab ba bb aba bab aaa 20:07 21:07 22:07 $ $ echo ":$OUT:" :aba: $ exit 0 smenu-0.9.15/tests/initial_selection/t0004.in000077700000000000000000000000001344767411600216222data2ustar00rootroot00000000000000smenu-0.9.15/tests/initial_selection/t0004.tst000066400000000000000000000001431344767411600211130ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -s/a.a t0004.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/initial_selection/t0005.good000066400000000000000000000001651344767411600212360ustar00rootroot00000000000000$ OUT=$(smenu -s/bb t0005.in) aab abb aa ab ba bb aba bab aaa 4:07 5:07 6:07 $ $ echo ":$OUT:" :abb: $ exit 0 smenu-0.9.15/tests/initial_selection/t0005.in000077700000000000000000000000001344767411600216232data2ustar00rootroot00000000000000smenu-0.9.15/tests/initial_selection/t0005.tst000066400000000000000000000001421344767411600211130ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -s/bb t0005.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/initial_selection/t0006.good000066400000000000000000000001601344767411600212320ustar00rootroot00000000000000$ OUT=$(smenu -sbb t0006.in) aab abb aa ab ba bb aba bab aaa 17:07 18:07 $ $ echo ":$OUT:" :bb: $ exit 0 smenu-0.9.15/tests/initial_selection/t0006.in000077700000000000000000000000001344767411600216242data2ustar00rootroot00000000000000smenu-0.9.15/tests/initial_selection/t0006.tst000066400000000000000000000001411344767411600211130ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -sbb t0006.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/initial_selection/t0007.good000066400000000000000000000003301344767411600212320ustar00rootroot00000000000000$ OUT=$(smenu -eb -saa t0007.in) aab abb aa ab ba bb aba bab aaa 0:24 1:24 2:24 4:24 5:24 6:24 8:07 9:07 11:24 12:24 14:24 15:24 17:24 18:24 20:24 21:24 22:24 24:24 25:24 26:24 $ $ echo ":$OUT:" :aa: $ exit 0 smenu-0.9.15/tests/initial_selection/t0007.in000077700000000000000000000000001344767411600216252data2ustar00rootroot00000000000000smenu-0.9.15/tests/initial_selection/t0007.tst000066400000000000000000000001451344767411600211200ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -eb -saa t0007.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/initial_selection/t0008.good000066400000000000000000000002011344767411600212300ustar00rootroot00000000000000$ OUT=$(smenu -s "#30" t0008.in) a b c d e f g h i j k l m n o p q r s t u v w x y z 50:07 $ $ echo ":$OUT:" :z: $ exit 0 smenu-0.9.15/tests/initial_selection/t0008.in000077700000000000000000000000001344767411600216252data1ustar00rootroot00000000000000smenu-0.9.15/tests/initial_selection/t0008.tst000066400000000000000000000001451344767411600211210ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -s "#30" t0008.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/initial_selection/t0009.good000066400000000000000000000002621344767411600212400ustar00rootroot00000000000000$ OUT=$(smenu -iab -s /ba t0009.in) aab abb aa ab ba bb aba bab aaa 8:24 9:24 14:24 15:24 17:24 18:24 20:07 21:07 22:07 28:24 29:24 30:24 $ $ echo ":$OUT:" :aba: $ exit 0 smenu-0.9.15/tests/initial_selection/t0009.in000077700000000000000000000000001344767411600216272data2ustar00rootroot00000000000000smenu-0.9.15/tests/initial_selection/t0009.tst000066400000000000000000000001501344767411600211160ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -iab -s /ba t0009.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/line_mode/000077500000000000000000000000001344767411600160475ustar00rootroot00000000000000smenu-0.9.15/tests/line_mode/data1000066400000000000000000000001211344767411600167560ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 smenu-0.9.15/tests/line_mode/data2000066400000000000000000000001301344767411600167570ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 xxxxx 13 14 15 16 17 18 19 20 21 22 yyyyyy 24 25 26 27 28 29 30 smenu-0.9.15/tests/line_mode/data3000066400000000000000000000001211344767411600167600ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 smenu-0.9.15/tests/line_mode/t0001.good000066400000000000000000000002561344767411600174700ustar00rootroot00000000000000$ OUT=$(smenu -n 10 -l t0001.in) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 9:07 10:07 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 $ $ echo ":$OUT:" :14: $ exit 0 smenu-0.9.15/tests/line_mode/t0001.in000077700000000000000000000000001344767411600200532data1ustar00rootroot00000000000000smenu-0.9.15/tests/line_mode/t0001.tst000066400000000000000000000001571344767411600173520ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 10 -l t0001.in) \S[150]\s[150]lljjlljjkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/line_mode/t0002.good000066400000000000000000000002661344767411600174720ustar00rootroot00000000000000$ OUT=$(smenu -n 10 -l t0002.in) 1 2 3 4 5 6 7 8 9 10 11 xxxxx 13 14 15 12:07 13:07 16 17 18 19 20 21 22 yyyyyy 24 25 26 27 28 29 30 $ $ echo ":$OUT:" :14: $ exit 0 smenu-0.9.15/tests/line_mode/t0002.in000077700000000000000000000000001344767411600200552data2ustar00rootroot00000000000000smenu-0.9.15/tests/line_mode/t0002.tst000066400000000000000000000001571344767411600173530ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 10 -l t0002.in) \S[150]\s[150]lljjlljjkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/line_mode/t0003.good000066400000000000000000000002611344767411600174660ustar00rootroot00000000000000$ OUT=$(smenu -n 10 -l t0003.in) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3:07 4:07 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 $ $ echo ":$OUT:" :13: $ exit 0 smenu-0.9.15/tests/line_mode/t0003.in000077700000000000000000000000001344767411600200572data3ustar00rootroot00000000000000smenu-0.9.15/tests/line_mode/t0003.tst000066400000000000000000000001571344767411600173540ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 10 -l t0003.in) \S[150]\s[150]lljjlljjkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/line_mode/t0004.good000066400000000000000000000016201344767411600174670ustar00rootroot00000000000000$ OUT=$(smenu -U 3 -n 10 -l t0004.in) 1) 1 2) 2 3 3) 4 4) 5 0:01 1:01 2:01 3:01 7:01 8:01 9:01 10:01 21:01 22:01 23:01 24:01 28:01 29:01 30:01 31:01 5) 6 6) 7 7) 8 8) 9 9) 10 0:01 1:01 2:01 3:01 7:01 8:01 9:01 10:01 14:01 15:01 16:01 17:01 21:01 22:01 23:01 24:01 28:01 29:01 30:01 31:01 10) 11 0:01 1:01 2:01 3:01 11) 12 13 12) 14 13) 15 0:01 1:01 2:01 3:01 13:07 14:07 16:01 17:01 18:01 19:01 24:01 25:01 26:01 27:01 14) 16 15) 17 0:01 1:01 2:01 3:01 8:01 9:01 10:01 11:01 16) 18 17) 19 18) 20 0:01 1:01 2:01 3:01 8:01 9:01 10:01 11:01 16:01 17:01 18:01 19:01 19) 21 20) 22 23 21) 24 0:01 1:01 2:01 3:01 8:01 9:01 10:01 11:01 24:01 25:01 26:01 27:01 22) 25 23) 26 24) 27 25) 28 26) 29 30 0:01 1:01 2:01 3:01 8:01 9:01 10:01 11:01 16:01 17:01 18:01 19:01 24:01 25:01 26:01 27:01 32:01 33:01 34:01 35:01 $ $ echo ":$OUT:" :13: $ exit 0 smenu-0.9.15/tests/line_mode/t0004.in000077700000000000000000000000001344767411600200602data3ustar00rootroot00000000000000smenu-0.9.15/tests/line_mode/t0004.tst000066400000000000000000000001641344767411600173530ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -U 3 -n 10 -l t0004.in) \S[150]\s[150]lljjlljjkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/line_separators/000077500000000000000000000000001344767411600173065ustar00rootroot00000000000000smenu-0.9.15/tests/line_separators/data1000066400000000000000000000000701344767411600202200ustar00rootroot00000000000000abc⬇def⬇ghi⬇ ⬇jkl⬇mno⬇pqr ⬇stu⬇vwx⬇yz smenu-0.9.15/tests/line_separators/t0001.good000066400000000000000000000002601344767411600207220ustar00rootroot00000000000000$ OUT=$(smenu -c -L\\ue2ac87 t0001.in) def ▲ 5:20 ghi │ 5:20 jkl ║ 5:20 mno │ 5:20 pqr ▼ 0:07 1:07 2:07 5:20 $ $ printf "%s\n" ":$OUT:" :pqr: $ exit 0 smenu-0.9.15/tests/line_separators/t0001.in000077700000000000000000000000001344767411600213122data1ustar00rootroot00000000000000smenu-0.9.15/tests/line_separators/t0001.tst000066400000000000000000000001661344767411600206110ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -c -L\\\\ue2ac87 t0001.in) \S[150]\s[150]jjjjj\r \s[150]printf "%s\\n" ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/long_lines/000077500000000000000000000000001344767411600162455ustar00rootroot00000000000000smenu-0.9.15/tests/long_lines/data1000066400000000000000000000007511344767411600171650ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 smenu-0.9.15/tests/long_lines/t0001.good000066400000000000000000000010071344767411600176610ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -n 4 -l t0001.in) ←3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ┐ 0:01 79:20 ←34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58→ │ 0:01 75:01 79:20 ←63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87→ ║ 0:01 75:01 79:20 ←102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120→ ▼ 0:01 41:07 42:07 43:07 76:01 79:20 $ $ echo ":$OUT:" :112: $ exit 0 smenu-0.9.15/tests/long_lines/t0001.in000077700000000000000000000000001344767411600202512data1ustar00rootroot00000000000000smenu-0.9.15/tests/long_lines/t0001.tst000066400000000000000000000003021344767411600175400ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -n 4 -l t0001.in) \S[150]\s[150]hhhhhljjhhjjhhkkhhkkhhjjllkklljjhhhhhjjhhjjllkkhhkkhhjjhhhhhkkhhhhjjjhhhhhh\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/long_lines/t0002.good000066400000000000000000000007671344767411600176760ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -n 4 -c t0002.in) ←12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ┐ 0:01 79:20 ←43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 │ 0:01 79:20 ←72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 → ║ 0:01 76:01 79:20 ←112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 ▼ 0:01 37:07 38:07 39:07 79:20 $ $ echo ":$OUT:" :121: $ exit 0 smenu-0.9.15/tests/long_lines/t0002.in000077700000000000000000000000001344767411600202522data1ustar00rootroot00000000000000smenu-0.9.15/tests/long_lines/t0002.tst000066400000000000000000000003021344767411600175410ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -n 4 -c t0002.in) \S[150]\s[150]hhhhhljjhhjjhhkkhhkkhhjjllkklljjhhhhhjjhhjjllkkhhkkhhjjhhhhhkkhhhhjjjhhhhhh\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/long_lines/t0003.good000066400000000000000000000007121344767411600176650ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -t -n 4 t0003.in) 20 21 22 23 24 25 26 27 28 29 30 32 33 34 35 36 37 38 39 ▲ 77:20 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 │ 77:20 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 ║ 77:20 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ▼ 44:07 45:07 46:07 77:20 $ $ echo ":$OUT:" :89: $ exit 0 smenu-0.9.15/tests/long_lines/t0003.in000077700000000000000000000000001344767411600202532data1ustar00rootroot00000000000000smenu-0.9.15/tests/long_lines/t0003.tst000066400000000000000000000003021344767411600175420ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -t -n 4 t0003.in) \S[150]\s[150]hhhhhljjhhjjhhkkhhkkhhjjllkklljjhhhhhjjhhjjllkkhhkkhhjjhhhhhkkhhhhjjjhhhhhh\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/long_lines/t0004.good000066400000000000000000000006231344767411600176670ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -l -n 4 t0004.in) 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77→ ▲ 0:01 51:01 54:20 101 102 103 104 105 106 107 108 109 110 111 112 113→ │ 0:01 45:07 46:07 47:07 52:01 54:20 131 132 133 134 135 136 137 138 139 140 ║ 0:01 54:20 141 142 143 144 145 146 147 148 149 150 ┘ 0:01 54:20 $ $ echo ":$OUT:" :112: $ exit 0 smenu-0.9.15/tests/long_lines/t0004.in000077700000000000000000000000001344767411600202542data1ustar00rootroot00000000000000smenu-0.9.15/tests/long_lines/t0004.tst000066400000000000000000000003671344767411600175560ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -l -n 4 t0004.in) \S[150]\s[150]hhhhhljjhhjjhhkkhhkkhhjjllkklljjhhhhhjjhhjjllkkhhkkhhjjhhhhhkkhhhhjjjhhhhhh\ \W[75x24]\S[2000]\W[45x24]\S[2000]\W[55x24]\S[2000]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/long_lines/t0005.good000066400000000000000000000006331344767411600176710ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -c -n 4 t0005.in) ←69 70 71 72 73 74 75 76 77 78 79 80 81 → ▲ 0:01 52:01 54:20 ←109 110 111 112 113 114 115 116 117 118 119 120 121→ │ 0:01 49:07 50:07 51:07 52:01 54:20 ←139 140 ║ 0:01 54:20 ←149 150 ┘ 0:01 54:20 $ $ echo ":$OUT:" :121: $ exit 0 smenu-0.9.15/tests/long_lines/t0005.in000077700000000000000000000000001344767411600202552data1ustar00rootroot00000000000000smenu-0.9.15/tests/long_lines/t0005.tst000066400000000000000000000003671344767411600175570ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -c -n 4 t0005.in) \S[150]\s[150]hhhhhljjhhjjhhkkhhkkhhjjllkklljjhhhhhjjhhjjllkkhhkkhhjjhhhhhkkhhhhjjjhhhhhh\ \W[75x24]\S[2000]\W[45x24]\S[2000]\W[55x24]\S[2000]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/long_lines/t0006.good000066400000000000000000000005521344767411600176720ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -t -n 4 t0006.in) 67 68 69 70 71 72 73 74 75 76 77 78 79 ▲ 53:20 80 81 82 83 84 85 86 87 88 89 90 91 92 │ 36:07 37:07 38:07 53:20 93 94 95 96 97 98 99 100 101 102 103 104 105 ║ 53:20 106 107 108 109 110 111 112 113 114 115 116 117 118 ▼ 53:20 $ $ echo ":$OUT:" :89: $ exit 0 smenu-0.9.15/tests/long_lines/t0006.in000077700000000000000000000000001344767411600202562data1ustar00rootroot00000000000000smenu-0.9.15/tests/long_lines/t0006.tst000066400000000000000000000003671344767411600175600ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -t -n 4 t0006.in) \S[150]\s[150]hhhhhljjhhjjhhkkhhkkhhjjllkklljjhhhhhjjhhjjllkkhhkkhhjjhhhhhkkhhhhjjjhhhhhh\ \W[75x24]\S[2000]\W[45x24]\S[2000]\W[55x24]\S[2000]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/long_lines/t0007.good000066400000000000000000000005501344767411600176710ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -n 4 t0007.in) 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 ▲ 53:20 105 106 107 108 109 110 111 112 113 114 115 116 117 │ 32:07 33:07 34:07 53:20 118 119 120 121 122 123 124 125 126 127 128 129 130 ║ 53:20 131 132 133 134 135 136 137 138 139 140 141 142 143 ▼ 53:20 $ $ echo ":$OUT:" :113: $ exit 0 smenu-0.9.15/tests/long_lines/t0007.in000077700000000000000000000000001344767411600202572data1ustar00rootroot00000000000000smenu-0.9.15/tests/long_lines/t0007.tst000066400000000000000000000003641344767411600175560ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -n 4 t0007.in) \S[150]\s[150]hhhhhljjhhjjhhkkhhkkhhjjllkklljjhhhhhjjhhjjllkkhhkkhhjjhhhhhkkhhhhjjjhhhhhh\ \W[75x24]\S[2000]\W[45x24]\S[2000]\W[55x24]\S[2000]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/long_lines/t0008.in000077700000000000000000000000001344767411600202602data1ustar00rootroot00000000000000smenu-0.9.15/tests/long_words/000077500000000000000000000000001344767411600162715ustar00rootroot00000000000000smenu-0.9.15/tests/long_words/data1000066400000000000000000000007571344767411600172170ustar00rootroot000000000000001 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890 12345678901 123456789012 1234567890123 12345678901234 123456789012345 1234567890123456 12345678901234567 123456789012345678 1234567890123456789 12345678901234567890 123456789012345678901 1234567890123456789012 12345678901234567890123 123456789012345678901234 1234567890123456789012345 12345678901234567890123456 123456789012345678901234567 1234567890123456789012345678 12345678901234567890123456789 123456789012345678901234567890 smenu-0.9.15/tests/long_words/t0001.good000066400000000000000000000017761344767411600177220ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -n 10 -t 3 t0001.in) 123456789 1234567890 ▲ 63:20 12345678901 123456789012 │ 63:20 1234567890123 12345678901234 │ 63:20 123456789012345 1234567890123456 │ 63:20 12345678901234567 123456789012345678 │ 63:20 1234567890123456789 12345678901234567890 │ 63:20 123456789012345678901 1234567890123456789012 ║ 63:20 12345678901234567890123 123456789012345678901234 │ 0:07 1:07 2:07 3:07 4:07 5:07 6:07 7:07 8:07 9:07 10:07 11:07 12:07 13:07 14:07 15:07 16:07 17:07 18:07 19:07 20:07 21:07 22:07 23:07 24:07 25:07 26:07 27:07 28:07 29:07 63:20 1234567890123456789012345 12345678901234567890123456 │ 63:20 123456789012345678901234567 1234567890123456789012345678 ▼ 63:20 $ $ echo ":$OUT:" :12345678901234567890123: $ exit 0 smenu-0.9.15/tests/long_words/t0001.in000077700000000000000000000000001344767411600202752data1ustar00rootroot00000000000000smenu-0.9.15/tests/long_words/t0001.tst000066400000000000000000000002321344767411600175660ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -n 10 -t 3 t0001.in) \S[150]\s[150]lljlljlljllkkkhhjjlljjllljjjjkkh\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/long_words/t0002.good000066400000000000000000000013021344767411600177040ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -n 10 -t 1 t0002.in) 12345678901 ▲ 32:20 123456789012 │ 32:20 1234567890123 │ 32:20 12345678901234 │ 32:20 123456789012345 │ 32:20 1234567890123456 ║ 32:20 12345678901234567 │ 0:07 1:07 2:07 3:07 4:07 5:07 6:07 7:07 8:07 9:07 10:07 11:07 12:07 13:07 14:07 15:07 16:07 17:07 18:07 19:07 20:07 21:07 22:07 23:07 24:07 25:07 26:07 27:07 28:07 29:07 32:20 123456789012345678 │ 32:20 1234567890123456789 │ 32:20 12345678901234567890 ▼ 32:20 $ $ echo ":$OUT:" :12345678901234567: $ exit 0 smenu-0.9.15/tests/long_words/t0002.in000077700000000000000000000000001344767411600202762data1ustar00rootroot00000000000000smenu-0.9.15/tests/long_words/t0002.tst000066400000000000000000000002321344767411600175670ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -n 10 -t 1 t0002.in) \S[150]\s[150]lljlljlljllkkkhhjjlljjllljjjjkkh\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/long_words/t0003.good000066400000000000000000000010541344767411600177110ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -n 10 -t 1 t0003.in) 1234567890123 ▲ 23:20 12345678901234 │ 23:20 123456789012345 │ 23:20 1234567890123456 │ 23:20 12345678901234567 │ 0:07 1:07 2:07 3:07 4:07 5:07 6:07 7:07 8:07 9:07 10:07 11:07 12:07 13:07 14:07 15:07 16:07 17:07 18:07 19:07 23:20 123456789012345678 ║ 23:20 1234567890123456789 │ 23:20 12345678901234567890 │ 23:20 12345678901234567890 │ 23:20 12345678901234567890 ▼ 23:20 $ $ echo ":$OUT:" :12345678901234567: $ exit 0 smenu-0.9.15/tests/long_words/t0003.in000077700000000000000000000000001344767411600202772data1ustar00rootroot00000000000000smenu-0.9.15/tests/long_words/t0003.tst000066400000000000000000000003711344767411600175740ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -n 10 -t 1 t0003.in) \S[150]\s[150]lljlljlljllkkkhhjjlljjllljjjjkkh\ \W[22x24]\s[1200]\ \W[21x24]\s[1200]\ \W[20x24]\s[1200]\ \W[22x24]\s[1200]\ \W[24x24]\s[1200]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/long_words/t0004.good000066400000000000000000000013421344767411600177120ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -n 10 -t 1 -N. -- t0004.in) 13) 1234567890123 ▲ 0:01 1:01 2:01 3:01 23:20 14) 12345678901234 │ 0:01 1:01 2:01 3:01 23:20 15) 123456789012345 │ 0:01 1:01 2:01 3:01 23:20 16) 123456789012345 │ 0:01 1:01 2:01 3:01 23:20 17) 123456789012345 │ 0:01 1:01 2:01 3:01 5:07 6:07 7:07 8:07 9:07 10:07 11:07 12:07 13:07 14:07 15:07 16:07 17:07 18:07 19:07 23:20 18) 123456789012345 ║ 0:01 1:01 2:01 3:01 23:20 19) 123456789012345 │ 0:01 1:01 2:01 3:01 23:20 20) 123456789012345 │ 0:01 1:01 2:01 3:01 23:20 21) 123456789012345 │ 0:01 1:01 2:01 3:01 23:20 22) 123456789012345 ▼ 0:01 1:01 2:01 3:01 23:20 $ $ echo ":$OUT:" :12345678901234567: $ exit 0 smenu-0.9.15/tests/long_words/t0004.in000077700000000000000000000000001344767411600203002data1ustar00rootroot00000000000000smenu-0.9.15/tests/long_words/t0004.tst000066400000000000000000000004001344767411600175660ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -n 10 -t 1 -N. -- t0004.in) \S[150]\s[150]lljlljlljllkkkhhjjlljjllljjjjkkh\ \W[22x24]\s[1200]\ \W[21x24]\s[1200]\ \W[20x24]\s[1200]\ \W[22x24]\s[1200]\ \W[24x24]\s[1200]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/message/000077500000000000000000000000001344767411600155405ustar00rootroot00000000000000smenu-0.9.15/tests/message/data1000066400000000000000000000000251344767411600164520ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 smenu-0.9.15/tests/message/data2000066400000000000000000000001321344767411600164520ustar00rootroot00000000000000123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 smenu-0.9.15/tests/message/t0001.good000066400000000000000000000002731344767411600171600ustar00rootroot00000000000000$ OUT=$(smenu -m xx -n 10 -M t0001.in) xx 37:01 38:01 1 2 3 4 5 6 7 8 9 10 36:07 $ $ echo ":$OUT:" :5: $ exit 0 smenu-0.9.15/tests/message/t0001.in000077700000000000000000000000001344767411600175442data1ustar00rootroot00000000000000smenu-0.9.15/tests/message/t0001.tst000066400000000000000000000001611344767411600170360ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -m xx -n 10 -M t0001.in) \S[150]\s[150]llllkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/message/t0002.good000066400000000000000000000001741344767411600171610ustar00rootroot00000000000000$ OUT=$(smenu -m test t0002.in) test 0:01 1:01 2:01 3:01 1 2 3 4 5 6 7 8 9 10 0:07 $ $ echo ":$OUT:" :1: $ exit 0 smenu-0.9.15/tests/message/t0002.in000077700000000000000000000000001344767411600175452data1ustar00rootroot00000000000000smenu-0.9.15/tests/message/t0002.tst000066400000000000000000000001441344767411600170400ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -m test t0002.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/message/t0003.good000066400000000000000000000004311344767411600171560ustar00rootroot00000000000000$ OUT=$(smenu -M -l -m test t0003.in) test 36:01 37:01 38:01 39:01 123456789 123456789 123456789 123456789 123456789 123456789 123456789→ 0:01 1:07 2:07 3:07 4:07 5:07 6:07 7:07 8:07 9:07 70:01 $ $ echo ":$OUT:" :123456789: $ exit 0 smenu-0.9.15/tests/message/t0003.in000077700000000000000000000000001344767411600175472data2ustar00rootroot00000000000000smenu-0.9.15/tests/message/t0003.tst000066400000000000000000000001521344767411600170400ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -M -l -m test t0003.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/message/t0004.good000066400000000000000000000004161344767411600171620ustar00rootroot00000000000000$ OUT=$(smenu -M -m 'xx > yyyy' t0004.in) xx 36:01 37:01 38:01 39:01 yyyy 36:01 37:01 38:01 39:01 1 2 3 4 5 6 7 8 9 10 28:07 $ $ echo ":$OUT:" :1: $ exit 0 smenu-0.9.15/tests/message/t0004.in000077700000000000000000000000001344767411600175472data1ustar00rootroot00000000000000smenu-0.9.15/tests/message/t0004.tst000066400000000000000000000001551344767411600170440ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -M -m 'xx\nyyyy' t0004.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/message/t0005.good000066400000000000000000000003041344767411600171570ustar00rootroot00000000000000$ OUT=$(smenu -M -m yyyy t0005.in) yyyy 36:01 37:01 38:01 39:01 1 2 3 4 5 6 7 8 9 10 28:07 $ $ echo ":$OUT:" :1: $ exit 0 smenu-0.9.15/tests/message/t0005.in000077700000000000000000000000001344767411600175502data1ustar00rootroot00000000000000smenu-0.9.15/tests/message/t0005.tst000066400000000000000000000001471344767411600170460ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -M -m yyyy t0005.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/message/t0006.good000066400000000000000000000014151344767411600171640ustar00rootroot00000000000000$ OUT=$(smenu -a m:r -M -m "123456789 123456789 123456789 123456789 \ > 123456789 123456789 123456789 123456789 123456789" t0006.in) 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 0:07 1:07 2:07 3:07 4:07 5:07 6:07 7:07 8:07 9:07 10:07 11:07 12:07 13:07 14:07 15:07 16:07 17:07 18:07 19:07 20:07 21:07 22:07 23:07 24:07 25:07 26:07 27:07 28:07 29:07 30:07 31:07 32:07 33:07 34:07 35:07 36:07 37:07 38:07 39:07 40:07 41:07 42:07 43:07 44:07 45:07 46:07 47:07 48:07 49:07 50:07 51:07 52:07 53:07 54:07 55:07 56:07 57:07 58:07 59:07 60:07 61:07 62:07 63:07 64:07 65:07 66:07 67:07 68:07 69:07 70:07 71:07 72:07 73:07 74:07 75:07 76:07 77:07 78:07 79:07 1 2 3 4 5 6 7 8 9 10 28:07 $ $ echo ":$OUT:" :1: $ exit 0 smenu-0.9.15/tests/message/t0006.in000077700000000000000000000000001344767411600175512data1ustar00rootroot00000000000000smenu-0.9.15/tests/message/t0006.tst000066400000000000000000000003101344767411600170370ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -a m:r -M -m "123456789 123456789 123456789 123456789 \\ 123456789 123456789 123456789 123456789 123456789" t0006.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/message/t0007.good000066400000000000000000000013461344767411600171700ustar00rootroot00000000000000$ OUT=$(smenu -m "123456789 123456789 123456789 123456789 \ > 123456789 123456789 123456789 123456789 123456789" t0007.in) 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 0:01 1:01 2:01 3:01 4:01 5:01 6:01 7:01 8:01 9:01 10:01 11:01 12:01 13:01 14:01 15:01 16:01 17:01 18:01 19:01 20:01 21:01 22:01 23:01 24:01 25:01 26:01 27:01 28:01 29:01 30:01 31:01 32:01 33:01 34:01 35:01 36:01 37:01 38:01 39:01 40:01 41:01 42:01 43:01 44:01 45:01 46:01 47:01 48:01 49:01 50:01 51:01 52:01 53:01 54:01 55:01 56:01 57:01 58:01 59:01 60:01 61:01 62:01 63:01 64:01 65:01 66:01 67:01 68:01 69:01 70:01 71:01 72:01 73:01 74:01 75:01 76:01 77:01 78:01 79:01 1 2 3 4 5 6 7 8 9 10 0:07 $ $ echo ":$OUT:" :1: $ exit 0 smenu-0.9.15/tests/message/t0007.in000077700000000000000000000000001344767411600175522data1ustar00rootroot00000000000000smenu-0.9.15/tests/message/t0007.tst000066400000000000000000000002761344767411600170530ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -m "123456789 123456789 123456789 123456789 \\ 123456789 123456789 123456789 123456789 123456789" t0007.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/message/t0008.good000066400000000000000000000006301344767411600171640ustar00rootroot00000000000000$ OUT=$(smenu -a m:7/5 -M \ > -m '=\uefbcb4\uefbca5\uefbcb3\uefbcb4= > =test=' t0008.in) =TEST= 33:252d 34:252d 35:252d 36:252d 37:252d 38:252d =test= 33:252d 34:252d 35:252d 36:252d 37:252d 38:252d 39:252d 40:252d 41:252d 42:252d 1 2 3 4 5 6 7 8 9 10 28:07 $ $ echo ":$OUT:" :1: $ exit 0 smenu-0.9.15/tests/message/t0008.in000077700000000000000000000000001344767411600175532data1ustar00rootroot00000000000000smenu-0.9.15/tests/message/t0008.tst000066400000000000000000000002371344767411600170510ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -a m:7/5 -M \\ -m '=\\uefbcb4\\uefbca5\\uefbcb3\\uefbcb4=\n=test=' t0008.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/non_printable/000077500000000000000000000000001344767411600167465ustar00rootroot00000000000000smenu-0.9.15/tests/non_printable/data1000066400000000000000000000000301344767411600176540ustar00rootroot000000000000001 \\u062\\u07 \\u05 3 smenu-0.9.15/tests/non_printable/t0001.good000066400000000000000000000001471344767411600203660ustar00rootroot00000000000000$ OUT=$(smenu t0001.in) .1\a .2\a . 3 0:07 1:07 2:07 3:07 $ $ env echo ":$OUT:" :.1\a: $ exit 0 smenu-0.9.15/tests/non_printable/t0001.in000077700000000000000000000000001344767411600207522data1ustar00rootroot00000000000000smenu-0.9.15/tests/non_printable/t0001.tst000066400000000000000000000001321344767411600202420ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu t0001.in) \S[150]\s[150]\r \s[150]env echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/non_printable/t0002.good000066400000000000000000000001471344767411600203670ustar00rootroot00000000000000$ OUT=$(smenu -b t0002.in) 1\a 2\a 3 0:07 1:07 2:07 3:07 $ $ env echo ":$OUT:" :1\a: $ exit 0 smenu-0.9.15/tests/non_printable/t0002.in000077700000000000000000000000001344767411600207532data1ustar00rootroot00000000000000smenu-0.9.15/tests/non_printable/t0002.tst000066400000000000000000000001351344767411600202460ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -b t0002.in) \S[150]\s[150]\r \s[150]env echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/rows_cols_in-ex-clusions/000077500000000000000000000000001344767411600210635ustar00rootroot00000000000000smenu-0.9.15/tests/rows_cols_in-ex-clusions/data1000066400000000000000000000001021344767411600217710ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 smenu-0.9.15/tests/rows_cols_in-ex-clusions/t0001.good000066400000000000000000000004001344767411600224730ustar00rootroot00000000000000$ OUT=$(smenu -n 6 -R2,3 -R5 t0001.in) 1 2 3 4 5 0:24 2:24 4:24 6:24 8:24 6 7 8 9 10 4:07 11 12 13 14 15 16 17 18 19 20 0:24 1:24 3:24 4:24 6:24 7:24 9:24 10:24 12:24 13:24 21 22 23 24 25 0:24 1:24 3:24 4:24 $ $ echo ":$OUT:" :8: $ exit 0 smenu-0.9.15/tests/rows_cols_in-ex-clusions/t0001.in000077700000000000000000000000001344767411600230672data1ustar00rootroot00000000000000smenu-0.9.15/tests/rows_cols_in-ex-clusions/t0001.tst000066400000000000000000000001661344767411600223660ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 6 -R2,3 -R5 t0001.in) \S[150]\s[150]llljljljhkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/rows_cols_in-ex-clusions/t0002.good000066400000000000000000000003261344767411600225030ustar00rootroot00000000000000$ OUT=$(smenu -n 6 -R3-5 -R1 t0002.in) 1 2 3 4 5 6 7 8 9 10 0:24 2:24 4:24 6:24 8:24 9:24 11 12 13 14 15 3:07 4:07 16 17 18 19 20 21 22 23 24 25 0:24 1:24 3:24 4:24 $ $ echo ":$OUT:" :12: $ exit 0 smenu-0.9.15/tests/rows_cols_in-ex-clusions/t0002.in000077700000000000000000000000001344767411600230702data1ustar00rootroot00000000000000smenu-0.9.15/tests/rows_cols_in-ex-clusions/t0002.tst000066400000000000000000000001661344767411600223670ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 6 -R3-5 -R1 t0002.in) \S[150]\s[150]llljljljhkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/rows_cols_in-ex-clusions/t0003.good000066400000000000000000000003241344767411600225020ustar00rootroot00000000000000$ OUT=$(smenu -n 6 -R3-5,1 t0003.in) 1 2 3 4 5 6 7 8 9 10 0:24 2:24 4:24 6:24 8:24 9:24 11 12 13 14 15 3:07 4:07 16 17 18 19 20 21 22 23 24 25 0:24 1:24 3:24 4:24 $ $ echo ":$OUT:" :12: $ exit 0 smenu-0.9.15/tests/rows_cols_in-ex-clusions/t0003.in000077700000000000000000000000001344767411600230712data1ustar00rootroot00000000000000smenu-0.9.15/tests/rows_cols_in-ex-clusions/t0003.tst000066400000000000000000000001641344767411600223660ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 6 -R3-5,1 t0003.in) \S[150]\s[150]llljljljhkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/scrolling/000077500000000000000000000000001344767411600161105ustar00rootroot00000000000000smenu-0.9.15/tests/scrolling/data1000066400000000000000000000001211344767411600170170ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 smenu-0.9.15/tests/scrolling/data2000066400000000000000000000007031344767411600170260ustar00rootroot00000000000000a a a a a a a a a a a a a a a a a a a a a a a a a b b b b b a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a b b b b b smenu-0.9.15/tests/scrolling/data3000066400000000000000000000010461344767411600170300ustar00rootroot00000000000000 0 a a a a a a a a 1 a a a a a a a a 2 a a a a a a a a 3 a a a a a a a a 4 a a a a a a a a 5 a a a a a a a a 6 a a a a a a a a 7 a a a a a a a a 8 a a a a a a a a 9 a a a a a a a a 10 a a a a a a a a 11 a a a a b b b b 12 b b b b b b b b 13 b b b b b b b b 14 b b b b b b b b 15 b b b b a a a a 16 a a a a a a a a 17 a a a a a a a a 18 a a a a a a a a 19 a a a a a a a a 20 a a a a a a a a 21 a a a a a a a a smenu-0.9.15/tests/scrolling/data4000066400000000000000000000004201344767411600170240ustar00rootroot00000000000000 0 a a a a a 1 a a a a a 2 a a a a a 3 b b b a a 4 a a a a a 5 b b b b b 6 b b b b b 7 b b b b b 8 b b b b b 9 a a a a a 10 b b b b b 11 a a a a a 12 a a a a a 13 a a a a a 14 a a a a a 15 a a a a a smenu-0.9.15/tests/scrolling/data5000066400000000000000000000025001344767411600170260ustar00rootroot00000000000000 0 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 1 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 2 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 3 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 4 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 5 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 6 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 7 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 8 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 9 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 10 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 11 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 01 23 45 67 89 smenu-0.9.15/tests/scrolling/data6000066400000000000000000000025011344767411600170300ustar00rootroot00000000000000 0 abcdefghi xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx 1 xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx defghija 2 abcdefghi jabcdefgh ijabcdefg hijbcdefg hijabcdef ghijabcde fghijabcd efghijabc defghija 3 abcdefghi jabcdefgh ijabcdefg hijbcdefg hijabcdef ghijabcde fghijabcd efghijabc defghija 4 abcdefghi jabcdefgh ijabcdefg hijbcdefg hijabcdef ghijabcde fghijabcd efghijabc defghija 5 abcdefghi jabcdefgh ijabcdefg hijbcdefg hijabcdef ghijabcde fghijabcd efghijabc defghija 6 abcdefghi jabcdefgh ijabcdefg hijbcdefg hijabcdef ghijabcde fghijabcd efghijabc defghija 7 xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx defghija 8 abcdefghi jabcdefgh ijabcdefg hijbcdefg hijabcdef ghijabcde fghijabcd efghijabc defghija 9 abcdefghi jabcdefgh ijabcdefg hijbcdefg hijabcdef ghijabcde fghijabcd efghijabc defghija 10 abcdefghi jabcdefgh ijabcdefg hijbcdefg hijabcdef ghijabcde fghijabcd efghijabc defghija 11 abcdefghi jabcdefgh ijabcdefg hijbcdefg hijabcdef ghijabcde fghijabcd efghijabc defghija 12 abcdefghi jabcdefgh ijabcdefg hijbcdefg hijabcdef ghijabcde fghijabcd efghijabc defghija 13 xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx xxxxxxxxx defghija smenu-0.9.15/tests/scrolling/data7000066400000000000000000000005241344767411600170340ustar00rootroot00000000000000 0 a a a a a 1 a a a a a 2 a a a a a 3 a a a a a 4 a a a a a 5 a a a a a 6 b b b a a 7 a a a a a 8 b b b b b 9 b b b b b 10 b b b b b 11 b b b b b 12 a a a a a 13 b b b b b 14 a a a a a 15 a a a a a 16 a a a a a 17 a a a a a 18 a a a a a 19 a a a a a smenu-0.9.15/tests/scrolling/t0001.good000066400000000000000000000003101344767411600175200ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -n 4 -l t0001.in) 1 2 3 4 5 ┐ 6:07 16:20 6 7 8 9 10 ║ 16:20 11 12 13 14 15 │ 16:20 16 17 18 19 20 ▼ 16:20 $ $ echo ":$OUT:" :4: $ exit 0 smenu-0.9.15/tests/scrolling/t0001.in000077700000000000000000000000001344767411600201142data1ustar00rootroot00000000000000smenu-0.9.15/tests/scrolling/t0001.tst000066400000000000000000000002231344767411600174050ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -n 4 -l t0001.in) \S[150]\s[150]lljjlljjhhjjhhkkhhkkhhjjllkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/scrolling/t0002.good000066400000000000000000000002721344767411600175300ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US smenu -n 4 -l t0002.in) 1 2 3 4 5 \ 6:07 16:20 6 7 8 9 10 + 16:20 11 12 13 14 15 | 16:20 16 17 18 19 20 v 16:20 $ $ echo ":$OUT:" :4: $ exit 0 smenu-0.9.15/tests/scrolling/t0002.in000077700000000000000000000000001344767411600201152data1ustar00rootroot00000000000000smenu-0.9.15/tests/scrolling/t0002.tst000066400000000000000000000002151344767411600174070ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US smenu -n 4 -l t0002.in) \S[150]\s[150]lljjlljjhhjjhhkkhhkkhhjjllkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/scrolling/t0003.good000066400000000000000000000002721344767411600175310ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US smenu -n 4 -l t0002.in) 1 2 3 4 5 \ 6:07 16:20 6 7 8 9 10 + 16:20 11 12 13 14 15 | 16:20 16 17 18 19 20 v 16:20 $ $ echo ":$OUT:" :4: $ exit 0 smenu-0.9.15/tests/scrolling/t0003.in000066400000000000000000000007451344767411600172140ustar00rootroot000000000000000 a a a a 1 a a a a 2 a a a a 3 a a a a 4 a a a a 5 b b b b 6 a a a a 7 a a a a 8 a a a a 9 a a a a 10 a a a a 11 a a a a 12 a a a a 13 a a a a 14 a a a a 15 a a a a 16 a a a a 17 a a a a 18 a a a a 19 a a b b 20 b b b b 21 b b b b 22 b b b b 23 b b b b 24 b b b b 25 b b b b 26 b b b b 27 b b b b 28 b b b b 29 b b b b 30 b b b b 31 b b b b 32 b b a a 33 a a a a 34 a a a a 35 a a a a 36 a a a a 37 a a a a 38 a a a a 39 a a a a 40 a a a a 41 a a a a 42 a a a a 43 a a a a 44 b b b b smenu-0.9.15/tests/scrolling/t0003.tst000066400000000000000000000002151344767411600174100ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US smenu -n 4 -l t0002.in) \S[150]\s[150]lljjlljjhhjjhhkkhhkkhhjjllkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/scrolling/t0004.good000066400000000000000000000006221344767411600175310ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US smenu -e [0-9] -e a -c t0004.in) 13 b b b b b b b b ^ 0:24 1:24 9:07 20:20 14 b b b b b b b b | 0:24 1:24 20:20 15 b b b b a a a a + 0:24 1:24 11:24 13:24 15:24 17:24 20:20 16 a a a a a a a a | 0:24 1:24 3:24 5:24 7:24 9:24 11:24 13:24 15:24 17:24 20:20 17 a a a a a a a a v 0:24 1:24 3:24 5:24 7:24 9:24 11:24 13:24 15:24 17:24 20:20 $ $ echo ":$OUT:" :b: $ exit 0 smenu-0.9.15/tests/scrolling/t0004.in000077700000000000000000000000001344767411600201212data3ustar00rootroot00000000000000smenu-0.9.15/tests/scrolling/t0004.tst000066400000000000000000000002141344767411600174100ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US smenu -e [0-9] -e a -c t0004.in) \S[150]\s[150]llkkkkjjjjjjjjjjkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/scrolling/t0005.good000066400000000000000000000005341344767411600175340ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US smenu -R 7,13 -c t0005.in) 11 a a a a a ^ 0:24 1:24 3:24 5:24 7:24 9:24 11:24 14:20 12 a a a a a | 5:07 14:20 13 a a a a a | 0:24 1:24 3:24 5:24 7:24 9:24 11:24 14:20 14 a a a a a + 0:24 1:24 3:24 5:24 7:24 9:24 11:24 14:20 15 a a a a a / 0:24 1:24 3:24 5:24 7:24 9:24 11:24 14:20 $ $ echo ":$OUT:" :a: $ exit 0 smenu-0.9.15/tests/scrolling/t0005.in000077700000000000000000000000001344767411600201232data4ustar00rootroot00000000000000smenu-0.9.15/tests/scrolling/t0005.tst000066400000000000000000000002151344767411600174120ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US smenu -R 7,13 -c t0005.in) \S[150]\s[150]lljjjjjjjkkkkkkkjjjKKJJKJ\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/scrolling/t0006.good000066400000000000000000000007051344767411600175350ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US smenu -R 6,18,20 -c t0006.in) 3 a a a a a a a a ^ 0:24 1:24 3:24 5:24 7:24 9:24 11:24 13:24 15:24 17:24 20:20 4 a a a a a a a a + 0:24 1:24 3:24 5:24 7:24 9:24 11:24 13:24 15:24 17:24 20:20 5 a a a a a a a a | 5:07 20:20 6 a a a a a a a a | 0:24 1:24 3:24 5:24 7:24 9:24 11:24 13:24 15:24 17:24 20:20 7 a a a a a a a a v 0:24 1:24 3:24 5:24 7:24 9:24 11:24 13:24 15:24 17:24 20:20 $ $ echo ":$OUT:" :a: $ exit 0 smenu-0.9.15/tests/scrolling/t0006.in000077700000000000000000000000001344767411600201232data3ustar00rootroot00000000000000smenu-0.9.15/tests/scrolling/t0006.tst000066400000000000000000000002341344767411600174140ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US smenu -R 6,18,20 -c t0006.in) \S[150]\s[150]lljjjjjjjkkkkkkkjjjKKKJJJKJKJjjjkkkJK\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/scrolling/t0007.good000066400000000000000000000007071344767411600175400ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US smenu -R 4,6,11,16 -c t0007.in) 5 a a a a a a a a ^ 5:07 20:20 6 a a a a a a a a + 0:24 1:24 3:24 5:24 7:24 9:24 11:24 13:24 15:24 17:24 20:20 7 a a a a a a a a | 0:24 1:24 3:24 5:24 7:24 9:24 11:24 13:24 15:24 17:24 20:20 8 a a a a a a a a | 0:24 1:24 3:24 5:24 7:24 9:24 11:24 13:24 15:24 17:24 20:20 9 a a a a a a a a v 0:24 1:24 3:24 5:24 7:24 9:24 11:24 13:24 15:24 17:24 20:20 $ $ echo ":$OUT:" :a: $ exit 0 smenu-0.9.15/tests/scrolling/t0007.in000077700000000000000000000000001344767411600201242data3ustar00rootroot00000000000000smenu-0.9.15/tests/scrolling/t0007.tst000066400000000000000000000002361344767411600174170ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US smenu -R 4,6,11,16 -c t0007.in) \S[150]\s[150]lljjjjjjjkkkkkkkjjjKKKJJJKJKJjjjkkkJK\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/scrolling/t0008.good000066400000000000000000000024651344767411600175440ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US smenu -c -e x -e '[0-9]' t0008.in) \ 0:01 1:07 2:07 3:07 4:07 5:07 6:07 7:07 8:07 9:07 11:24 12:24 13:24 14:24 15:24 16:24 17:24 18:24 19:24 21:24 22:24 23:24 24:24 25:24 26:24 27:24 28:24 29:24 31:24 32:24 33:24 34:24 35:24 36:24 37:24 38:24 39:24 41:24 42:24 43:24 44:24 45:24 46:24 47:24 48:24 49:24 51:24 52:24 53:24 54:24 55:24 56:24 57:24 58:24 59:24 61:24 62:24 63:24 64:24 65:24 66:24 67:24 68:24 69:24 70:01 79:20 + 0:01 1:24 2:24 3:24 4:24 5:24 6:24 7:24 8:24 9:24 11:24 12:24 13:24 14:24 15:24 16:24 17:24 18:24 19:24 21:24 22:24 23:24 24:24 25:24 26:24 27:24 28:24 29:24 31:24 32:24 33:24 34:24 35:24 36:24 37:24 38:24 39:24 41:24 42:24 43:24 44:24 45:24 46:24 47:24 48:24 49:24 51:24 52:24 53:24 54:24 55:24 56:24 57:24 58:24 59:24 61:24 62:24 63:24 64:24 65:24 66:24 67:24 68:24 69:24 70:01 79:20 | 0:01 70:01 79:20 | 0:01 70:01 79:20 v 0:01 70:01 79:20 $ $ echo ":$OUT:" :abcdefghi: $ exit 0 smenu-0.9.15/tests/scrolling/t0008.in000077700000000000000000000000001344767411600201302data6ustar00rootroot00000000000000smenu-0.9.15/tests/scrolling/t0008.tst000066400000000000000000000002021344767411600174110ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US smenu -c -e x -e '[0-9]' t0008.in) \S[150]\s[150]JJJKKK\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/scrolling/t0009.good000066400000000000000000000005231344767411600175360ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US smenu -c -Re1,22 -e '[0-9]' t0009.in) 0 a a a a a a a a \ 0:24 1:24 3:24 5:24 7:24 9:24 11:24 13:24 15:24 17:24 20:20 1 a a a a a a a a + 0:24 1:24 3:07 20:20 2 a a a a a a a a | 0:24 1:24 20:20 3 a a a a a a a a | 0:24 1:24 20:20 4 a a a a a a a a v 0:24 1:24 20:20 $ $ echo ":$OUT:" :a: $ exit 0 smenu-0.9.15/tests/scrolling/t0009.in000077700000000000000000000000001344767411600201262data3ustar00rootroot00000000000000smenu-0.9.15/tests/scrolling/t0009.tst000066400000000000000000000002141344767411600174150ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US smenu -c -Re1,22 -e '[0-9]' t0009.in) \S[150]\s[150]jjjjkkkkkJjKK\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/scrolling/t0010.good000066400000000000000000000005241344767411600175270ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US smenu -c -Re1,22 -e '[0-9]' t0010.in) 17 a a a a a a a a ^ 0:24 1:24 20:20 18 a a a a a a a a | 0:24 1:24 20:20 19 a a a a a a a a | 0:24 1:24 20:20 20 a a a a a a a a + 0:24 1:24 17:07 20:20 21 a a a a a a a a / 0:24 1:24 3:24 5:24 7:24 9:24 11:24 13:24 15:24 17:24 20:20 $ $ echo ":$OUT:" :a: $ exit 0 smenu-0.9.15/tests/scrolling/t0010.in000077700000000000000000000000001344767411600201162data3ustar00rootroot00000000000000smenu-0.9.15/tests/scrolling/t0010.tst000066400000000000000000000002171344767411600174100ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US smenu -c -Re1,22 -e '[0-9]' t0010.in) \S[150]\s[150]\CJkkkkjjjjjKkJJ\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/scrolling/t0011.good000066400000000000000000000005711344767411600175320ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US smenu -c -e a -e '[0-9]' t0011.in) 2 a a a a a ^ 0:24 1:24 3:24 5:24 7:24 9:24 11:24 14:20 3 a a a a a + 0:24 1:24 3:24 5:24 7:24 9:24 11:24 14:20 4 a a a a a | 0:24 1:24 3:24 5:24 7:24 9:24 11:24 14:20 5 a a a a a | 0:24 1:24 3:24 5:24 7:24 9:24 11:24 14:20 6 b b b a a v 0:24 1:24 3:07 9:24 11:24 14:20 $ $ echo ":$OUT:" :b: $ exit 0 smenu-0.9.15/tests/scrolling/t0011.in000077700000000000000000000000001344767411600201232data7ustar00rootroot00000000000000smenu-0.9.15/tests/scrolling/t0011.tst000066400000000000000000000002051344767411600174060ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US smenu -c -e a -e '[0-9]' t0011.in) \S[150]\s[150]JJJJKKKKK\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/000077500000000000000000000000001344767411600153615ustar00rootroot00000000000000smenu-0.9.15/tests/search/FreeBSD.bl000066400000000000000000000000141344767411600171050ustar00rootroot00000000000000t0023 t0024 smenu-0.9.15/tests/search/data1000066400000000000000000000000341344767411600162730ustar00rootroot00000000000000abc ab ab abcabc bca ba bac smenu-0.9.15/tests/search/data2000066400000000000000000000011301344767411600162720ustar00rootroot00000000000000abccb aaacc cbaba acbaa baabc cabac ccaac abaca cabac acbac bacbc cacbb acaca bbaaa aabcc acccb abacc cacac bccbc cccaa abcbc bcccc babab cacba bacbb cbcba aaabc bcbba cabbb caaac acacb abbaa acaab ccaab caabc bcacc baabb abaca abaac cccba bccac bbcca bccac caccb cbbab cbacc cccac abaac bbbcb cbbba bcbcb acbac bcbbb caaca accbc bbccc aacca bbcbc cbbcc ccaaa aaacb caacc accaa cabab accca bcbbb babcc ccabb cacba abbaa cbcab caccc ababc babba ccbca abcba aabca acaac accab abacc aabaa aaaca aabaa babcc acbac caacb ccbcc bbacc aabaa aabcb ccaab cbbbb abcab bcaab babbc babab ccbcc accbc aabac cbaab smenu-0.9.15/tests/search/data3000066400000000000000000000016331344767411600163030ustar00rootroot00000000000000"c b bcac" "cabab " "baac" "c" "aaa ab" " a ab " " " " bcaa a bb" "b" "b" "ba" " c" "aa cb" " aaaab aa" "ba" "b" "ab " " aaab" "cbbcaca" "babb" "cabbcaaca" "b" "cba " " babbbbbc" "aababc" "b" "a" "bcabcccc ca ba aca" "a " " " "a ab " " b" "aac bb" "c c" "a a" "b a" "a ba " "acb cabaabcca " "b" "ca" "a" "b" " " "aa" "cbccca a" "a cb" "a" "bb bbbac bbc" "c " "cc" " " "c " "bacb bcacabaa" "ac" "b babaa a a " "cbacac" "a " "a" " aac " "c" " a aaaca bb" "a caa" " " "cba " "b" " b " "abcbb c" "babc" "c a" "c " "b" "b b" "ccca b" " " "ab" "ab ba" "cacc ba" "bcc" "cacbb" " cbba ca" "ca c aaa c cca" " a" "bb" " " " b" "ac" " c" " b" "c" "ca b" " babbc cc a cbab" "baaa cc a" " " "baabbcac" "a" "b" "bbc " "bc" " " "bcbcac" "bba" "bc b" " a b" " cbb" " cbbc" " " "b" "acba " "a" " " "a a " "caabbbbb" "c" "ba" "bcb ca cbccac" " abb" "aba cc bbb" "ba" "cbc cab b" "cbaab " "c b cbb" smenu-0.9.15/tests/search/data4000066400000000000000000000016361344767411600163070ustar00rootroot00000000000000" çàçç" "éùé€ù" "ù€€ùé" "çéççé" "éç退" "ùçàç€" "ç à ç" "à ç" "€à€ à" "ùçùà€" "ùé à€" "€é à€" "ùàààà" "àçé€à" "é€ùàà" "éà€ùé" "çù çç" " ù€çù" "àééùç" "éççàç" "àçç€à" "àùùç " "ùààéé" "ù€çùù" "ùàùùà" "€€ùàà" " €ç à" " €é ç" "ùù退" "€€çùà" "ç€àà " " àééç" "à€ é" "€àé€à" "çà éà" "ç €€" "€àùàç" "ç瀀ç" "ù ùà€" "€ éù€" "€ç€€à" "çàà à" "€€ùùà" " çùùà" " çéùù" "ç éà" "€ç€ é" "à瀀ù" "àà €ç" " ç€é " " ùùçé" "ù ù é" "àùù€ç" "€€çç€" " é " "éù退" "€ùé " "çéé€ù" "é à€à" " ùù é" "àé€ç€" "ààçà " "éàçùç" "ç€ùç€" " € àé" "éàà " "€çéé€" "ù€€ùà" "ç €ù€" " éç€ " smenu-0.9.15/tests/search/data5000066400000000000000000000000511344767411600162760ustar00rootroot00000000000000ab ababab abxab " abab" "abab " " abab " smenu-0.9.15/tests/search/t0001.good000066400000000000000000000002171344767411600167770ustar00rootroot00000000000000$ OUT=$(smenu t0001.in) abc ab ab abcabc bca ba bac 0:0723 1:0723 2:07 4:23 5:23 7:23 8:23 10:23 11:23 $ $ echo ":$OUT:" :abc: $ exit 0 smenu-0.9.15/tests/search/t0001.in000077700000000000000000000000001344767411600173652data1ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0001.tst000066400000000000000000000001411344767411600166550ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu t0001.in) \S[150]\s[150]/ab\r\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0002.good000066400000000000000000000002111344767411600167720ustar00rootroot00000000000000$ OUT=$(smenu t0002.in) abc ab ab abcabc bca ba bac 10:0723 11:0723 12:07 13:07 14:0723 15:07 $ $ echo ":$OUT:" :abcabc: $ exit 0 smenu-0.9.15/tests/search/t0002.in000077700000000000000000000000001344767411600173662data1ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0002.tst000066400000000000000000000001421344767411600166570ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu t0002.in) \S[150]\s[150]/abb\r\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0003.good000066400000000000000000000002231344767411600167760ustar00rootroot00000000000000$ OUT=$(smenu t0003.in) abc ab ab abcabc bca ba bac 0:07 1:0723 2:0723 11:23 12:23 17:23 18:23 24:23 26:23 $ $ echo ":$OUT:" :abc: $ exit 0 smenu-0.9.15/tests/search/t0003.in000077700000000000000000000000001344767411600173672data1ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0003.tst000066400000000000000000000001411344767411600166570ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu t0003.in) \S[150]\s[150]/bc\r\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0004.good000066400000000000000000000002161344767411600170010ustar00rootroot00000000000000$ OUT=$(smenu -/ sub t0004.in) abc ab ab abcabc bca ba bac 0:07 1:0723 2:0723 11:23 12:23 17:23 18:23 $ $ echo ":$OUT:" :abc: $ exit 0 smenu-0.9.15/tests/search/t0004.in000077700000000000000000000000001344767411600173702data1ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0004.tst000066400000000000000000000001501344767411600166600ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -/ sub t0004.in) \S[150]\s[150]/bc\r\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0005.good000066400000000000000000000001711344767411600170020ustar00rootroot00000000000000$ OUT=$(smenu -/ pre t0005.in) abc ab ab abcabc bca ba bac 17:0723 18:0723 19:07 $ $ echo ":$OUT:" :bca: $ exit 0 smenu-0.9.15/tests/search/t0005.in000077700000000000000000000000001344767411600173712data1ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0005.tst000066400000000000000000000001501344767411600166610ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -/ pre t0005.in) \S[150]\s[150]/bc\r\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0006.good000066400000000000000000000001771344767411600170110ustar00rootroot00000000000000$ OUT=$(smenu t0006.in) abc ab ab abcabc bca ba bac 0:07 1:07 2:071f 12:1f 18:1f 26:1f $ $ echo ":$OUT:" :abc: $ exit 0 smenu-0.9.15/tests/search/t0006.in000077700000000000000000000000001344767411600173722data1ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0006.tst000066400000000000000000000001721344767411600166660ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu t0006.in) \S[150]\s[150]/abbbb\b\b\b\b\b\b\bxyzcdddd\r\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0007.good000066400000000000000000000001671344767411600170110ustar00rootroot00000000000000$ OUT=$(smenu t0007.in) abc ab ab abcabc bca ba bac 21:0723 22:0723 24:23 25:23 $ $ echo ":$OUT:" :ba: $ exit 0 smenu-0.9.15/tests/search/t0007.in000077700000000000000000000000001344767411600173732data1ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0007.tst000066400000000000000000000001611344767411600166650ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu t0007.in) \S[150]\s[150]/aba\rll*aba\rll"ba\r\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0008.good000066400000000000000000000001671344767411600170120ustar00rootroot00000000000000$ OUT=$(smenu t0008.in) abc ab ab abcabc bca ba bac 21:0723 22:0723 24:23 25:23 $ $ echo ":$OUT:" :ba: $ exit 0 smenu-0.9.15/tests/search/t0008.in000077700000000000000000000000001344767411600173742data1ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0008.tst000066400000000000000000000001711344767411600166670ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu t0008.in) \S[150]\s[150]/\b\babx\bax\rll*aba\rll"ba\r\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0009.good000066400000000000000000000002171344767411600170070ustar00rootroot00000000000000$ OUT=$(smenu t0009.in) abc ab ab abcabc bca ba bac 10:071f 11:071f 12:071f 13:071f 14:071f 15:071f $ $ echo ":$OUT:" :abcabc: $ exit 0 smenu-0.9.15/tests/search/t0009.in000077700000000000000000000000001344767411600173752data1ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0009.tst000066400000000000000000000001461344767411600166720ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu t0009.in) \S[150]\s[150]/abcxabc\r\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0010.good000066400000000000000000000002071344767411600167760ustar00rootroot00000000000000$ OUT=$(smenu t0010.in) abc ab ab abcabc bca ba bac 0:071f 1:07 2:071f 10:1f 12:1f 25:1f 26:1f $ $ echo ":$OUT:" :abc: $ exit 0 smenu-0.9.15/tests/search/t0010.in000077700000000000000000000000001344767411600173652data1ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0010.tst000066400000000000000000000001421344767411600166560ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu t0010.in) \S[150]\s[150]/axc\r\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0011.good000066400000000000000000000002171344767411600170000ustar00rootroot00000000000000$ OUT=$(smenu t0011.in) abc ab ab abcabc bca ba bac 0:0723 1:07 2:07 4:23 7:23 10:23 19:23 22:23 25:23 $ $ echo ":$OUT:" :abc: $ exit 0 smenu-0.9.15/tests/search/t0011.in000077700000000000000000000000001344767411600173662data1ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0011.tst000066400000000000000000000001441344767411600166610ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu t0011.in) \S[150]\s[150]/axc\b\r\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0012.good000066400000000000000000000002711344767411600170010ustar00rootroot00000000000000$ OUT=$(smenu -T, t0012.in) abc ab ab abcabc bca ba bac 0:23 2:23 4:07 5:07 10:0423 11:04 12:0423 13:04 14:04 15:04 24:04 25:0423 26:0423 $ $ echo ":$OUT:" :abcabc,bac: $ exit 0 smenu-0.9.15/tests/search/t0012.in000077700000000000000000000000001344767411600173672data1ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0012.tst000066400000000000000000000001531344767411600166620ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -T, t0012.in) \S[150]\s[150]/ac\rThhhtl\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0013.good000066400000000000000000000002211344767411600167750ustar00rootroot00000000000000$ OUT=$(smenu -T, t0013.in) abc ab ab abcabc bca ba bac 0:040723 1:0407 2:040723 10:23 12:23 25:23 26:23 $ $ echo ":$OUT:" :abc: $ exit 0 smenu-0.9.15/tests/search/t0013.in000077700000000000000000000000001344767411600173702data1ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0013.tst000066400000000000000000000001551344767411600166650ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -T, t0013.in) \S[150]\s[150]/ac\rthThtUht\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0014.good000066400000000000000000000022261344767411600170050ustar00rootroot00000000000000$ OUT=$(smenu -n 20 -T, t0014.in) abccb aaacc cbaba acbaa baabc cabac ccaac abaca cabac acbac bacbc cacbb acaca 42:040723 43:040723 44:040723 45:040723 46:0407 54:0423 55:04 56:0423 57:0423 58:0423 bbaaa aabcc acccb abacc cacac bccbc cccaa abcbc bcccc babab cacba bacbb cbcba 18:0423 19:0423 20:0423 21:0423 22:04 aaabc bcbba cabbb caaac acacb abbaa acaab ccaab caabc bcacc baabb abaca abaac 66:0423 67:0423 68:0423 69:0423 70:04 72:0423 73:0423 74:04 75:0423 76:0423 cccba bccac bbcca bccac caccb cbbab cbacc cccac abaac bbbcb cbbba bcbcb acbac 48:0423 49:0423 50:04 51:0423 52:0423 72:0423 73:04 74:0423 75:0423 76:0423 bcbbb caaca accbc bbccc aacca bbcbc cbbcc ccaaa aaacb caacc accaa cabab accca bcbbb babcc ccabb cacba abbaa cbcab caccc ababc babba ccbca abcba aabca acaac 42:0423 43:0423 44:0423 45:04 46:0423 accab abacc aabaa aaaca aabaa babcc acbac caacb ccbcc bbacc aabaa aabcb ccaab 6:0423 7:0423 8:0423 9:0423 10:04 36:0423 37:04 38:0423 39:0423 40:0423 cbbbb abcab bcaab babbc babab ccbcc accbc aabac cbaab 42:0423 43:04 44:0423 45:0423 46:0423 $ $ echo ":$OUT:" :abaca,acbac,abacc,abaca,abaac,abaac,acbac,ababc,abacc,acbac,aabac: $ exit 0 smenu-0.9.15/tests/search/t0014.in000077700000000000000000000000001344767411600173722data2ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0014.tst000066400000000000000000000001611344767411600166630ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 20 -T, t0014.in) \S[150]\s[150]~abac\CA\rT\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0015.good000066400000000000000000000022261344767411600170060ustar00rootroot00000000000000$ OUT=$(smenu -n 20 -T, t0015.in) abccb aaacc cbaba acbaa baabc cabac ccaac abaca cabac acbac bacbc cacbb acaca 30:0407 31:040723 32:040723 33:040723 34:040723 48:04 49:0423 50:0423 51:0423 52:0423 54:0423 55:04 56:0423 57:0423 58:0423 bbaaa aabcc acccb abacc cacac bccbc cccaa abcbc bcccc babab cacba bacbb cbcba 18:0423 19:0423 20:0423 21:04 22:0423 aaabc bcbba cabbb caaac acacb abbaa acaab ccaab caabc bcacc baabb abaca abaac 72:0423 73:0423 74:04 75:0423 76:0423 cccba bccac bbcca bccac caccb cbbab cbacc cccac abaac bbbcb cbbba bcbcb acbac 48:0423 49:0423 50:04 51:0423 52:0423 72:0423 73:04 74:0423 75:0423 76:0423 bcbbb caaca accbc bbccc aacca bbcbc cbbcc ccaaa aaacb caacc accaa cabab accca bcbbb babcc ccabb cacba abbaa cbcab caccc ababc babba ccbca abcba aabca acaac 42:0423 43:0423 44:0423 45:04 46:0423 accab abacc aabaa aaaca aabaa babcc acbac caacb ccbcc bbacc aabaa aabcb ccaab 6:0423 7:0423 8:0423 9:04 10:0423 36:0423 37:04 38:0423 39:0423 40:0423 cbbbb abcab bcaab babbc babab ccbcc accbc aabac cbaab 42:04 43:0423 44:0423 45:0423 46:0423 $ $ echo ":$OUT:" :cabac,cabac,acbac,abacc,abaac,abaac,acbac,ababc,abacc,acbac,aabac: $ exit 0 smenu-0.9.15/tests/search/t0015.in000077700000000000000000000000001344767411600173732data2ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0015.tst000066400000000000000000000001611344767411600166640ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 20 -T, t0015.in) \S[150]\s[150]~abac\CZ\rT\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0016.good000066400000000000000000000015421344767411600170070ustar00rootroot00000000000000$ OUT=$(smenu -n 20 -T, t0016.in) abccb aaacc cbaba acbaa baabc cabac ccaac abaca cabac acbac bacbc cacbb acaca 42:040723 43:040723 44:040723 45:040723 46:0407 bbaaa aabcc acccb abacc cacac bccbc cccaa abcbc bcccc babab cacba bacbb cbcba 18:0423 19:0423 20:0423 21:0423 22:04 aaabc bcbba cabbb caaac acacb abbaa acaab ccaab caabc bcacc baabb abaca abaac 66:0423 67:0423 68:0423 69:0423 70:04 cccba bccac bbcca bccac caccb cbbab cbacc cccac abaac bbbcb cbbba bcbcb acbac bcbbb caaca accbc bbccc aacca bbcbc cbbcc ccaaa aaacb caacc accaa cabab accca bcbbb babcc ccabb cacba abbaa cbcab caccc ababc babba ccbca abcba aabca acaac accab abacc aabaa aaaca aabaa babcc acbac caacb ccbcc bbacc aabaa aabcb ccaab 6:0423 7:0423 8:0423 9:0423 10:04 cbbbb abcab bcaab babbc babab ccbcc accbc aabac cbaab $ $ echo ":$OUT:" :abaca,abacc,abaca,abacc: $ exit 0 smenu-0.9.15/tests/search/t0016.in000077700000000000000000000000001344767411600173742data2ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0016.tst000066400000000000000000000001611344767411600166650ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 20 -T, t0016.in) \S[150]\s[150]'abac\CA\rT\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0017.good000066400000000000000000000014721344767411600170120ustar00rootroot00000000000000$ OUT=$(smenu -n 20 -T, t0017.in) abccb aaacc cbaba acbaa baabc cabac ccaac abaca cabac acbac bacbc cacbb acaca 30:0407 31:040723 32:040723 33:040723 34:040723 48:04 49:0423 50:0423 51:0423 52:0423 bbaaa aabcc acccb abacc cacac bccbc cccaa abcbc bcccc babab cacba bacbb cbcba aaabc bcbba cabbb caaac acacb abbaa acaab ccaab caabc bcacc baabb abaca abaac cccba bccac bbcca bccac caccb cbbab cbacc cccac abaac bbbcb cbbba bcbcb acbac bcbbb caaca accbc bbccc aacca bbcbc cbbcc ccaaa aaacb caacc accaa cabab accca bcbbb babcc ccabb cacba abbaa cbcab caccc ababc babba ccbca abcba aabca acaac accab abacc aabaa aaaca aabaa babcc acbac caacb ccbcc bbacc aabaa aabcb ccaab cbbbb abcab bcaab babbc babab ccbcc accbc aabac cbaab 42:04 43:0423 44:0423 45:0423 46:0423 $ $ echo ":$OUT:" :cabac,cabac,aabac: $ exit 0 smenu-0.9.15/tests/search/t0017.in000077700000000000000000000000001344767411600173752data2ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0017.tst000066400000000000000000000001611344767411600166660ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 20 -T, t0017.in) \S[150]\s[150]'abac\CZ\rT\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0018.good000066400000000000000000000017341344767411600170140ustar00rootroot00000000000000$ OUT=$(smenu -n 20 t0018.in) abccb aaacc cbaba acbaa baabc cabac ccaac abaca cabac acbac bacbc cacbb acaca 0:0723 1:07 2:07 3:07 4:0723 67:23 70:23 bbaaa aabcc acccb abacc cacac bccbc cccaa abcbc bcccc babab cacba bacbb cbcba 12:23 16:23 57:23 58:23 67:23 70:23 aaabc bcbba cabbb caaac acacb abbaa acaab ccaab caabc bcacc baabb abaca abaac 13:23 16:23 26:23 28:23 39:23 40:23 45:23 46:23 62:23 64:23 cccba bccac bbcca bccac caccb cbbab cbacc cccac abaac bbbcb cbbba bcbcb acbac 25:23 28:23 33:23 34:23 bcbbb caaca accbc bbccc aacca bbcbc cbbcc ccaaa aaacb caacc accaa cabab accca 50:23 52:23 69:23 70:23 bcbbb babcc ccabb cacba abbaa cbcab caccc ababc babba ccbca abcba aabca acaac 14:23 16:23 33:23 34:23 accab abacc aabaa aaaca aabaa babcc acbac caacb ccbcc bbacc aabaa aabcb ccaab 3:23 4:23 44:23 46:23 67:23 70:23 75:23 76:23 cbbbb abcab bcaab babbc babab ccbcc accbc aabac cbaab 9:23 10:23 15:23 16:23 27:23 28:23 51:23 52:23 $ $ echo ":$OUT:" :abccb: $ exit 0 smenu-0.9.15/tests/search/t0018.in000077700000000000000000000000001344767411600173762data2ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0018.tst000066400000000000000000000001521344767411600166670ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 20 t0018.in) \S[150]\s[150]*ab\CZ\r\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0019.good000066400000000000000000000015211344767411600170070ustar00rootroot00000000000000$ OUT=$(smenu -n 20 t0019.in) abccb aaacc cbaba acbaa baabc cabac ccaac abaca cabac acbac bacbc cacbb acaca bbaaa aabcc acccb abacc cacac bccbc cccaa abcbc bcccc babab cacba bacbb cbcba 54:07 55:07 56:07 57:0723 58:0723 aaabc bcbba cabbb caaac acacb abbaa acaab ccaab caabc bcacc baabb abaca abaac 39:23 40:23 45:23 46:23 cccba bccac bbcca bccac caccb cbbab cbacc cccac abaac bbbcb cbbba bcbcb acbac 33:23 34:23 bcbbb caaca accbc bbccc aacca bbcbc cbbcc ccaaa aaacb caacc accaa cabab accca 69:23 70:23 bcbbb babcc ccabb cacba abbaa cbcab caccc ababc babba ccbca abcba aabca acaac 33:23 34:23 accab abacc aabaa aaaca aabaa babcc acbac caacb ccbcc bbacc aabaa aabcb ccaab 3:23 4:23 75:23 76:23 cbbbb abcab bcaab babbc babab ccbcc accbc aabac cbaab 9:23 10:23 15:23 16:23 27:23 28:23 51:23 52:23 $ $ echo ":$OUT:" :babab: $ exit 0 smenu-0.9.15/tests/search/t0019.in000077700000000000000000000000001344767411600173772data2ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0019.tst000066400000000000000000000001521344767411600166700ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 20 t0019.in) \S[150]\s[150]'ab\CZ\r\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0020.good000066400000000000000000000015271344767411600170050ustar00rootroot00000000000000$ OUT=$(smenu -n 20 t0020.in) abccb aaacc cbaba acbaa baabc cabac ccaac abaca cabac acbac bacbc cacbb acaca 0:0723 1:0723 2:07 3:07 4:07 42:23 43:23 bbaaa aabcc acccb abacc cacac bccbc cccaa abcbc bcccc babab cacba bacbb cbcba 18:23 19:23 42:23 43:23 aaabc bcbba cabbb caaac acacb abbaa acaab ccaab caabc bcacc baabb abaca abaac 30:23 31:23 66:23 67:23 72:23 73:23 cccba bccac bbcca bccac caccb cbbab cbacc cccac abaac bbbcb cbbba bcbcb acbac 48:23 49:23 bcbbb caaca accbc bbccc aacca bbcbc cbbcc ccaaa aaacb caacc accaa cabab accca bcbbb babcc ccabb cacba abbaa cbcab caccc ababc babba ccbca abcba aabca acaac 24:23 25:23 42:23 43:23 60:23 61:23 accab abacc aabaa aaaca aabaa babcc acbac caacb ccbcc bbacc aabaa aabcb ccaab 6:23 7:23 cbbbb abcab bcaab babbc babab ccbcc accbc aabac cbaab 6:23 7:23 $ $ echo ":$OUT:" :abccb: $ exit 0 smenu-0.9.15/tests/search/t0020.in000077700000000000000000000000001344767411600173672data2ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0020.tst000066400000000000000000000001521344767411600166600ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 20 t0020.in) \S[150]\s[150]^ab\CZ\r\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0021.good000066400000000000000000000017371344767411600170110ustar00rootroot00000000000000$ OUT=$(smenu -n 18 t0021.in) c b bcac cabab baac c aaa ab a ab bcaa a bb b b ba c aa cb 24:07 25:07 26:07 27:07 28:0723 29:0723 47:23 51:23 64:23 69:23 aaaab aa ba b ab aaab cbbcaca babb cabbcaaca b cba babbbbbc aababc b a 24:23 25:23 36:23 38:23 bcabcccc ca ba aca a a ab b aac bb c c a a b a a ba acb cabaabcca b 34:23 38:23 ca a b aa cbccca a a cb a bb bbbac bbc c cc c bacb bcacabaa ac 19:23 23:23 b babaa a a cbacac a a aac c a aaaca bb a caa cba b b abcbb c 43:23 46:23 babc c a c b b b ccca b ab ab ba cacc ba bcc cacbb cbba ca 23:23 25:23 27:23 28:23 49:23 52:23 ca c aaa c cca a bb b ac c b c ca b babbc cc a cbab 46:23 48:23 66:23 67:23 baaa cc a baabbcac a b bbc bc bcbcac bba bc b a b cbb cbbc b acba a 50:23 52:23 a a caabbbbb c ba bcb ca cbccac abb aba cc bbb ba cbc cab b cbaab 7:23 12:23 36:23 38:23 42:23 50:23 60:23 63:23 c b cbb $ $ echo ":$OUT:" :aaa ab: $ exit 0 smenu-0.9.15/tests/search/t0021.in000077700000000000000000000000001344767411600173712data3ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0021.tst000066400000000000000000000001521344767411600166610ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 18 t0021.in) \S[150]\s[150]~ab\CZ\r\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0022.good000066400000000000000000000016601344767411600170050ustar00rootroot00000000000000$ OUT=$(smenu -n 18 t0022.in) c b bcac cabab baac c aaa ab a ab bcaa a bb b b ba c aa cb 24:0723 25:07 26:07 27:07 28:07 29:0723 63:23 69:23 aaaab aa ba b ab aaab cbbcaca babb cabbcaaca b cba babbbbbc aababc b a 15:23 16:23 67:23 69:23 bcabcccc ca ba aca a a ab b aac bb c c a a b a a ba acb cabaabcca b 23:23 26:23 33:23 37:23 54:23 56:23 60:23 62:23 ca a b aa cbccca a a cb a bb bbbac bbc c cc c bacb bcacabaa ac 19:23 23:23 b babaa a a cbacac a a aac c a aaaca bb a caa cba b b abcbb c 66:23 67:23 babc c a c b b b ccca b ab ab ba cacc ba bcc cacbb cbba ca 27:23 28:23 30:23 31:23 ca c aaa c cca a bb b ac c b c ca b babbc cc a cbab baaa cc a baabbcac a b bbc bc bcbcac bba bc b a b cbb cbbc b acba a 69:23 71:23 a a caabbbbb c ba bcb ca cbccac abb aba cc bbb ba cbc cab b cbaab 40:23 41:23 c b cbb $ $ echo ":$OUT:" :aaa ab: $ exit 0 smenu-0.9.15/tests/search/t0022.in000077700000000000000000000000001344767411600173722data3ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0022.tst000066400000000000000000000001521344767411600166620ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 18 t0022.in) \S[150]\s[150]~ab\CA\r\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0023.good000066400000000000000000000023341344767411600170050ustar00rootroot00000000000000$ OUT=$(smenu -k -n 18 -T \| t0023.in) çàçç éùé€ù ù€€ùé çéççé éç退 ùçàç€ ç à ç à ç €à€ à ùçùà€ ùé à€ €é à€ ùàààà 24:0407 25:0407 26:040723 27:0407 28:040723 60:04 61:0423 62:04 63:04 64:0423 66:04 67:0423 68:04 69:04 70:0423 àçé€à é€ùàà éà€ùé çù çç ù€çù àééùç éççàç àçç€à àùùç ùààéé ù€çùù ùàùùà €€ùàà €ç à €é ç ùù退 €€çùà ç€àà àééç à€ é €àé€à çà éà ç €€ €àùàç ç瀀ç ù ùà€ 12:04 13:04 14:0423 15:04 16:0423 € éù€ €ç€€à çàà à €€ùùà çùùà çéùù ç éà €ç€ é à瀀ù àà €ç ç€é ùùçé ù ù é 0:04 1:04 2:0423 3:04 4:0423 àùù€ç €€çç€ é éù退 €ùé çéé€ù é à€à ùù é àé€ç€ ààçà éàçùç ç€ùç€ € àé 18:04 19:04 20:0423 21:04 22:0423 48:04 49:0423 50:04 51:04 52:0423 éàà €çéé€ ù€€ùà ç €ù€ éç€ 6:04 7:04 8:04 9:0423 10:0423 $ $ echo ":$OUT:" :éç退|ùé à€|€é à€|ùù退|€ éù€|éù退|àé€ç€|€çéé€: $ exit 0 smenu-0.9.15/tests/search/t0023.in000077700000000000000000000000001344767411600173742data4ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0023.tst000066400000000000000000000001701344767411600166630ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -k -n 18 -T \\| t0023.in) \S[150]\s[150]~é€\CZ\rT\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0024.good000066400000000000000000000021761344767411600170120ustar00rootroot00000000000000$ OUT=$(smenu -k -n 18 -T \| t0024.in) çàçç éùé€ù ù€€ùé çéççé éç退 ùçàç€ ç à ç à ç €à€ à ùçùà€ ùé à€ €é à€ ùàààà 6:040723 7:0407 8:0407 9:040723 10:0407 24:0423 25:04 26:04 27:0423 28:04 àçé€à é€ùàà éà€ùé çù çç ù€çù àééùç éççàç àçç€à àùùç ùààéé ù€çùù ùàùùà €€ùàà 6:0423 7:0423 8:04 9:04 10:04 12:0423 13:04 14:0423 15:04 16:04 €ç à €é ç ùù退 €€çùà ç€àà àééç à€ é €àé€à çà éà ç €€ €àùàç ç瀀ç ù ùà€ € éù€ €ç€€à çàà à €€ùùà çùùà çéùù ç éà €ç€ é à瀀ù àà €ç ç€é ùùçé ù ù é àùù€ç €€çç€ é éù退 €ùé çéé€ù é à€à ùù é àé€ç€ ààçà éàçùç ç€ùç€ € àé 18:0423 19:04 20:04 21:0423 22:04 36:0423 37:04 38:04 39:0423 40:04 éàà €çéé€ ù€€ùà ç €ù€ éç€ $ $ echo ":$OUT:" :éùé€ù|éç退|é€ùàà|éà€ùé|éù退|é à€à: $ exit 0 smenu-0.9.15/tests/search/t0024.in000077700000000000000000000000001344767411600173752data4ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0024.tst000066400000000000000000000001701344767411600166640ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -k -n 18 -T \\| t0024.in) \S[150]\s[150]~é€\CA\rT\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0025.good000066400000000000000000000020741344767411600170100ustar00rootroot00000000000000$ OUT=$(smenu -n 18 t0025.in) c b bcac cabab baac c aaa ab a ab bcaa a bb b b ba c aa cb aaaab aa ba b ab aaab cbbcaca babb cabbcaaca b cba babbbbbc aababc b a 41:23 43:23 44:23 59:23 64:23 65:23 70:23 71:23 72:23 bcabcccc ca ba aca a a ab b aac bb c c a a b a a ba acb cabaabcca b 0:07 1:07 2:0723 3:0723 4:0723 5:07 6:07 7:07 8:07 9:07 10:07 11:07 12:07 13:07 14:07 15:07 16:07 17:07 18:07 60:23 62:23 64:23 ca a b aa cbccca a a cb a bb bbbac bbc c cc c bacb bcacabaa ac 33:23 37:23 38:23 51:23 55:23 56:23 b babaa a a cbacac a a aac c a aaaca bb a caa cba b b abcbb c 66:23 67:23 68:23 babc c a c b b b ccca b ab ab ba cacc ba bcc cacbb cbba ca 1:23 2:23 3:23 ca c aaa c cca a bb b ac c b c ca b babbc cc a cbab 52:23 54:23 55:23 baaa cc a baabbcac a b bbc bc bcbcac bba bc b a b cbb cbbc b acba a 12:23 14:23 15:23 a a caabbbbb c ba bcb ca cbccac abb aba cc bbb ba cbc cab b cbaab 26:23 29:23 30:23 40:23 41:23 45:23 c b cbb $ $ echo ":$OUT:" :bcabcccc ca ba aca: $ exit 0 smenu-0.9.15/tests/search/t0025.in000077700000000000000000000000001344767411600173752data3ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0025.tst000066400000000000000000000001621344767411600166660ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 18 t0025.in) \S[150]\s[150]~abc\rsssssSSSSs\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0026.good000066400000000000000000000004351344767411600170100ustar00rootroot00000000000000$ OUT=$(smenu -n 0 -N -- t0026.in) 1) ab 2) ababab 3) abxab 4) abab 5) abab 6) abab 0:01 1:01 2:01 4:0723 5:0723 7:01 8:01 9:01 15:23 16:23 18:01 19:01 20:01 25:23 26:23 28:01 29:01 30:01 35:23 36:23 38:01 39:01 40:01 48:01 49:01 50:01 $ $ echo ":$OUT:" :ab: $ exit 0 smenu-0.9.15/tests/search/t0026.in000077700000000000000000000000001344767411600174002data5ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0026.tst000066400000000000000000000001601344767411600166650ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 0 -N -- t0026.in) \S[150]\s[150]~ab\CZ\rj\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/search/t0027.good000066400000000000000000000004641344767411600170130ustar00rootroot00000000000000$ OUT=$(smenu -n 0 -N -c t0027.in) 1) ab 0:01 1:01 2:01 4:23 5:23 2) ababab 0:01 1:01 2:01 4:07 5:07 6:07 7:07 8:0723 9:0723 3) abxab 0:01 1:01 2:01 7:23 8:23 4) abab 0:01 1:01 2:01 7:23 8:23 5) abab 0:01 1:01 2:01 6) abab 0:01 1:01 2:01 $ $ echo ":$OUT:" :ababab: $ exit 0 smenu-0.9.15/tests/search/t0027.in000077700000000000000000000000001344767411600174012data5ustar00rootroot00000000000000smenu-0.9.15/tests/search/t0027.tst000066400000000000000000000001601344767411600166660ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -n 0 -N -c t0027.in) \S[150]\s[150]~ab\CZ\rj\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/spaces/000077500000000000000000000000001344767411600153725ustar00rootroot00000000000000smenu-0.9.15/tests/spaces/data1000066400000000000000000000000251344767411600163040ustar00rootroot00000000000000" 1 2" "3 4 " " 5 6" smenu-0.9.15/tests/spaces/t0001.good000066400000000000000000000001431344767411600170060ustar00rootroot00000000000000$ OUT=$(smenu t0001.in) 1 2 3 4 5 6 0:07 1:07 2:07 3:07 $ $ echo ":$OUT:" :1 2: $ exit 0 smenu-0.9.15/tests/spaces/t0001.in000077700000000000000000000000001344767411600173762data1ustar00rootroot00000000000000smenu-0.9.15/tests/spaces/t0001.tst000066400000000000000000000001341344767411600166700ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu t0001.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/spaces/t0002.good000066400000000000000000000001431344767411600170070ustar00rootroot00000000000000$ OUT=$(smenu t0002.in) 1 2 3 4 5 6 5:07 6:07 7:07 8:07 $ $ echo ":$OUT:" :3 4: $ exit 0 smenu-0.9.15/tests/spaces/t0002.in000077700000000000000000000000001344767411600173772data1ustar00rootroot00000000000000smenu-0.9.15/tests/spaces/t0002.tst000066400000000000000000000001351344767411600166720ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu t0002.in) \S[150]\s[150]l\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/spaces/t0003.good000066400000000000000000000001471344767411600170140ustar00rootroot00000000000000$ OUT=$(smenu t0003.in) 1 2 3 4 5 6 10:07 11:07 12:07 13:07 $ $ echo ":$OUT:" :5 6: $ exit 0 smenu-0.9.15/tests/spaces/t0003.in000077700000000000000000000000001344767411600174002data1ustar00rootroot00000000000000smenu-0.9.15/tests/spaces/t0003.tst000066400000000000000000000001361344767411600166740ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu t0003.in) \S[150]\s[150]ll\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/spaces/t0004.good000066400000000000000000000001471344767411600170150ustar00rootroot00000000000000$ OUT=$(smenu -k t0004.in) 1 2 3 4 5 6 0:07 1:07 2:07 3:07 $ $ echo ":$OUT:" : 1 2: $ exit 0 smenu-0.9.15/tests/spaces/t0004.in000077700000000000000000000000001344767411600174012data1ustar00rootroot00000000000000smenu-0.9.15/tests/spaces/t0004.tst000066400000000000000000000001371344767411600166760ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -k t0004.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/spaces/t0005.good000066400000000000000000000001471344767411600170160ustar00rootroot00000000000000$ OUT=$(smenu -k t0005.in) 1 2 3 4 5 6 5:07 6:07 7:07 8:07 $ $ echo ":$OUT:" :3 4 : $ exit 0 smenu-0.9.15/tests/spaces/t0005.in000077700000000000000000000000001344767411600174022data1ustar00rootroot00000000000000smenu-0.9.15/tests/spaces/t0005.tst000066400000000000000000000001401344767411600166710ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -k t0005.in) \S[150]\s[150]l\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/spaces/t0006.good000066400000000000000000000001531344767411600170140ustar00rootroot00000000000000$ OUT=$(smenu -k t0006.in) 1 2 3 4 5 6 10:07 11:07 12:07 13:07 $ $ echo ":$OUT:" : 5 6: $ exit 0 smenu-0.9.15/tests/spaces/t0006.in000077700000000000000000000000001344767411600174032data1ustar00rootroot00000000000000smenu-0.9.15/tests/spaces/t0006.tst000066400000000000000000000001411344767411600166730ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -k t0006.in) \S[150]\s[150]ll\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/special_levels/000077500000000000000000000000001344767411600171065ustar00rootroot00000000000000smenu-0.9.15/tests/special_levels/data1000066400000000000000000000001211344767411600200150ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 smenu-0.9.15/tests/special_levels/t0001.good000066400000000000000000000007141344767411600205260ustar00rootroot00000000000000$ OUT=$(smenu -1 1 -2 2 -3 3 -4 4 -5 5 -c -- t0001.in) 1 2 3 4 5 ┐ 0:1f 1:1f 3:20 4:20 6:21 7:21 9:23 10:23 12:24 13:24 16:20 6 7 8 9 10 ║ 0:07 1:07 12:1f 13:1f 16:20 11 12 13 14 15 │ 0:1f 1:1f 3:1f 4:1f 6:1f 7:1f 9:1f 10:1f 12:1f 13:1f 16:20 16 17 18 19 20 │ 0:1f 1:1f 3:1f 4:1f 6:1f 7:1f 9:1f 10:1f 12:20 13:20 16:20 21 22 23 24 25 ▼ 0:1f 1:1f 3:20 4:20 6:20 7:20 9:20 10:20 12:20 13:20 16:20 $ $ echo ":$OUT:" :6: $ exit 0 smenu-0.9.15/tests/special_levels/t0001.in000077700000000000000000000000001344767411600211122data1ustar00rootroot00000000000000smenu-0.9.15/tests/special_levels/t0001.tst000066400000000000000000000001741344767411600204100ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -1 1 -2 2 -3 3 -4 4 -5 5 -c -- t0001.in) \S[150]\s[150]j\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/special_levels/t0002.good000066400000000000000000000006241344767411600205270ustar00rootroot00000000000000$ OUT=$(smenu -1 '1$' -2 '2$' -3 '3$' -4 4 -5 5 -c -- t0002.in) 1 2 3 4 5 ┐ 0:1f 1:1f 3:20 4:20 6:21 7:21 9:23 10:23 12:24 13:24 16:20 6 7 8 9 10 ║ 0:07 1:07 16:20 11 12 13 14 15 │ 0:1f 1:1f 3:20 4:20 6:21 7:21 9:23 10:23 12:24 13:24 16:20 16 17 18 19 20 │ 16:20 21 22 23 24 25 ▼ 0:1f 1:1f 3:20 4:20 6:21 7:21 9:23 10:23 12:24 13:24 16:20 $ $ echo ":$OUT:" :6: $ exit 0 smenu-0.9.15/tests/special_levels/t0002.in000077700000000000000000000000001344767411600211132data1ustar00rootroot00000000000000smenu-0.9.15/tests/special_levels/t0002.tst000066400000000000000000000002051344767411600204040ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -1 '1$' -2 '2$' -3 '3$' -4 4 -5 5 -c -- t0002.in) \S[150]\s[150]j\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/special_levels/t0003.good000066400000000000000000000004621344767411600205300ustar00rootroot00000000000000$ OUT=$(smenu -1 1 -1 2 -c -- t0003.in) 1 2 3 4 5 ┐ 3:1f 4:1f 16:20 6 7 8 9 10 ║ 0:07 1:07 16:20 11 12 13 14 15 │ 3:1f 4:1f 16:20 16 17 18 19 20 │ 12:1f 13:1f 16:20 21 22 23 24 25 ▼ 0:1f 1:1f 3:1f 4:1f 6:1f 7:1f 9:1f 10:1f 12:1f 13:1f 16:20 $ $ echo ":$OUT:" :6: $ exit 0 smenu-0.9.15/tests/special_levels/t0003.in000077700000000000000000000000001344767411600211142data1ustar00rootroot00000000000000smenu-0.9.15/tests/special_levels/t0003.tst000066400000000000000000000001551344767411600204110ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -1 1 -1 2 -c -- t0003.in) \S[150]\s[150]j\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/special_levels/t0004.good000066400000000000000000000007631344767411600205350ustar00rootroot00000000000000$ OUT=$(smenu -1 '1$' b -2 '2$' 7/1,br -3 '3$' 0/5 \ > -4 4 r -5 5 rb -c -- t0004.in) 1 2 3 4 5 ┐ 0:01 1:01 3:01072529 4:01072529 6:1e2d 7:1e2d 9:07 10:07 12:0107 13:0107 16:20 6 7 8 9 10 ║ 0:07 1:07 16:20 11 12 13 14 15 │ 0:01 1:01 3:01072529 4:01072529 6:1e2d 7:1e2d 9:07 10:07 12:0107 13:0107 16:20 16 17 18 19 20 │ 16:20 21 22 23 24 25 ▼ 0:01 1:01 3:01072529 4:01072529 6:1e2d 7:1e2d 9:07 10:07 12:0107 13:0107 16:20 $ $ echo ":$OUT:" :6: $ exit 0 smenu-0.9.15/tests/special_levels/t0004.in000077700000000000000000000000001344767411600211152data1ustar00rootroot00000000000000smenu-0.9.15/tests/special_levels/t0004.tst000066400000000000000000000002461344767411600204130ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -1 '1$' b -2 '2$' 7/1,br -3 '3$' 0/5 \\ -4 4 r -5 5 rb -c -- t0004.in) \S[150]\s[150]j\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/000077500000000000000000000000001344767411600170535ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/data1000066400000000000000000000007571344767411600200010ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 smenu-0.9.15/tests/substitutions/data2000066400000000000000000000000161344767411600177660ustar00rootroot00000000000000a abc bac bca smenu-0.9.15/tests/substitutions/data3000066400000000000000000000000201344767411600177620ustar00rootroot00000000000000abc ABC Aab AAA smenu-0.9.15/tests/substitutions/t0001.good000066400000000000000000000013671344767411600205000ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/1/(&)/' -n 15 t0001.in) (1) 2 3 4 5 6 7 8 9 (1)0 (1)1 (1)2 (1)3 (1)4 (1)5 (1)6 (1)7 (1)8 (1)9 20 2(1) 0:07 1:07 2:07 22 23 24 25 26 27 28 29 30 32 33 34 35 36 37 38 39 40 4(1) 42 43 44 45 46 47 48 49 50 5(1) 52 53 54 55 56 57 58 59 60 6(1) 62 63 64 65 66 67 68 69 70 7(1) 72 73 74 75 76 77 78 79 80 8(1) 82 83 84 85 86 87 88 89 90 9(1) 92 93 94 95 96 97 98 99 (1)00 (1)01 (1)02 (1)03 (1)04 (1)05 (1)06 (1)07 (1)08 (1)09 (1)10 (1)11 (1)12 (1)13 (1)14 (1)15 (1)16 (1)17 (1)18 (1)19 (1)20 (1)21 (1)22 (1)23 (1)24 (1)25 (1)26 (1)27 (1)28 (1)29 (1)30 (1)31 (1)32 (1)33 (1)34 (1)35 (1)36 (1)37 (1)38 (1)39 (1)40 (1)41 (1)42 (1)43 (1)44 (1)45 (1)46 (1)47 (1)48 (1)49 (1)50 $ $ echo ":$OUT:" :(1): $ exit 0 smenu-0.9.15/tests/substitutions/t0001.in000077700000000000000000000000001344767411600210572data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0001.tst000066400000000000000000000002011344767411600203440ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/1/(&)/' -n 15 t0001.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0002.good000066400000000000000000000016341344767411600204760ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/1*/(&)/' -n 15 t0002.in) (1) ()2 ()3 ()4 ()5 ()6 ()7 ()8 ()9 (1)0 (11) (1)2 (1)3 (1)4 (1)5 (1)6 (1)7 0:07 1:07 2:07 (1)8 (1)9 ()20 ()21 ()22 ()23 ()24 ()25 ()26 ()27 ()28 ()29 ()30 ()32 ()33 ()34 ()35 ()36 ()37 ()38 ()39 ()40 ()41 ()42 ()43 ()44 ()45 ()46 ()47 ()48 ()49 ()50 ()51 ()52 ()53 ()54 ()55 ()56 ()57 ()58 ()59 ()60 ()61 ()62 ()63 ()64 ()65 ()66 ()67 ()68 ()69 ()70 ()71 ()72 ()73 ()74 ()75 ()76 ()77 ()78 ()79 ()80 ()81 ()82 ()83 ()84 ()85 ()86 ()87 ()88 ()89 ()90 ()91 ()92 ()93 ()94 ()95 ()96 ()97 ()98 ()99 (1)00 (1)01 (1)02 (1)03 (1)04 (1)05 (1)06 (1)07 (1)08 (1)09 (11)0 (111) (11)2 (11)3 (11)4 (11)5 (11)6 (11)7 (11)8 (11)9 (1)20 (1)21 (1)22 (1)23 (1)24 (1)25 (1)26 (1)27 (1)28 (1)29 (1)30 (1)31 (1)32 (1)33 (1)34 (1)35 (1)36 (1)37 (1)38 (1)39 (1)40 (1)41 (1)42 (1)43 (1)44 (1)45 (1)46 (1)47 (1)48 (1)49 (1)50 $ $ echo ":$OUT:" :(1): $ exit 0 smenu-0.9.15/tests/substitutions/t0002.in000077700000000000000000000000001344767411600210602data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0002.tst000066400000000000000000000002021344767411600203460ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/1*/(&)/' -n 15 t0002.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0003.good000066400000000000000000000016351344767411600205000ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/1*$/(&)/' -n 15 t0003.in) (1) 2() 3() 4() 5() 6() 7() 8() 9() 10() (11) 12() 13() 14() 15() 16() 17() 0:07 1:07 2:07 18() 19() 20() 2(1) 22() 23() 24() 25() 26() 27() 28() 29() 30() 32() 33() 34() 35() 36() 37() 38() 39() 40() 4(1) 42() 43() 44() 45() 46() 47() 48() 49() 50() 5(1) 52() 53() 54() 55() 56() 57() 58() 59() 60() 6(1) 62() 63() 64() 65() 66() 67() 68() 69() 70() 7(1) 72() 73() 74() 75() 76() 77() 78() 79() 80() 8(1) 82() 83() 84() 85() 86() 87() 88() 89() 90() 9(1) 92() 93() 94() 95() 96() 97() 98() 99() 100() 10(1) 102() 103() 104() 105() 106() 107() 108() 109() 110() (111) 112() 113() 114() 115() 116() 117() 118() 119() 120() 12(1) 122() 123() 124() 125() 126() 127() 128() 129() 130() 13(1) 132() 133() 134() 135() 136() 137() 138() 139() 140() 14(1) 142() 143() 144() 145() 146() 147() 148() 149() 150() $ $ echo ":$OUT:" :(1): $ exit 0 smenu-0.9.15/tests/substitutions/t0003.in000077700000000000000000000000001344767411600210612data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0003.tst000066400000000000000000000002031344767411600203500ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/1*$/(&)/' -n 15 t0003.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0004.good000066400000000000000000000011621344767411600204740ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/^1+$/(&)/' -n 15 t0004.in) (1) 2 3 4 5 6 7 8 9 10 (11) 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 0:07 1:07 2:07 28 29 30 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 (111) 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 $ $ echo ":$OUT:" :(1): $ exit 0 smenu-0.9.15/tests/substitutions/t0004.in000077700000000000000000000000001344767411600210622data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0004.tst000066400000000000000000000002041344767411600203520ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/^1+$/(&)/' -n 15 t0004.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0005.good000066400000000000000000000013511344767411600204750ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/^1+/(&)/' -n 15 t0005.in) (1) 2 3 4 5 6 7 8 9 (1)0 (11) (1)2 (1)3 (1)4 (1)5 (1)6 (1)7 (1)8 (1)9 20 21 0:07 1:07 2:07 22 23 24 25 26 27 28 29 30 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 (1)00 (1)01 (1)02 (1)03 (1)04 (1)05 (1)06 (1)07 (1)08 (1)09 (11)0 (111) (11)2 (11)3 (11)4 (11)5 (11)6 (11)7 (11)8 (11)9 (1)20 (1)21 (1)22 (1)23 (1)24 (1)25 (1)26 (1)27 (1)28 (1)29 (1)30 (1)31 (1)32 (1)33 (1)34 (1)35 (1)36 (1)37 (1)38 (1)39 (1)40 (1)41 (1)42 (1)43 (1)44 (1)45 (1)46 (1)47 (1)48 (1)49 (1)50 $ $ echo ":$OUT:" :(1): $ exit 0 smenu-0.9.15/tests/substitutions/t0005.in000077700000000000000000000000001344767411600210632data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0005.tst000066400000000000000000000002031344767411600203520ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/^1+/(&)/' -n 15 t0005.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0006.good000066400000000000000000000012071344767411600204760ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/1+$/(&)/' -n 15 t0006.in) (1) 2 3 4 5 6 7 8 9 10 (11) 12 13 14 15 16 17 18 19 20 2(1) 22 23 24 25 26 27 0:07 1:07 2:07 28 29 30 32 33 34 35 36 37 38 39 40 4(1) 42 43 44 45 46 47 48 49 50 5(1) 52 53 54 55 56 57 58 59 60 6(1) 62 63 64 65 66 67 68 69 70 7(1) 72 73 74 75 76 77 78 79 80 8(1) 82 83 84 85 86 87 88 89 90 9(1) 92 93 94 95 96 97 98 99 100 10(1) 102 103 104 105 106 107 108 109 110 (111) 112 113 114 115 116 117 118 119 120 12(1) 122 123 124 125 126 127 128 129 130 13(1) 132 133 134 135 136 137 138 139 140 14(1) 142 143 144 145 146 147 148 149 150 $ $ echo ":$OUT:" :(1): $ exit 0 smenu-0.9.15/tests/substitutions/t0006.in000077700000000000000000000000001344767411600210642data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0006.tst000066400000000000000000000002031344767411600203530ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/1+$/(&)/' -n 15 t0006.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0007.good000066400000000000000000000014301344767411600204750ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/1/(&)/g' -n 15 t0007.in) (1) 2 3 4 5 6 7 8 9 (1)0 (1)(1) (1)2 (1)3 (1)4 (1)5 (1)6 (1)7 (1)8 (1)9 20 0:07 1:07 2:07 2(1) 22 23 24 25 26 27 28 29 30 32 33 34 35 36 37 38 39 40 4(1) 42 43 44 45 46 47 48 49 50 5(1) 52 53 54 55 56 57 58 59 60 6(1) 62 63 64 65 66 67 68 69 70 7(1) 72 73 74 75 76 77 78 79 80 8(1) 82 83 84 85 86 87 88 89 90 9(1) 92 93 94 95 96 97 98 99 (1)00 (1)0(1) (1)02 (1)03 (1)04 (1)05 (1)06 (1)07 (1)08 (1)09 (1)(1)0 (1)(1)(1) (1)(1)2 (1)(1)3 (1)(1)4 (1)(1)5 (1)(1)6 (1)(1)7 (1)(1)8 (1)(1)9 (1)20 (1)2(1) (1)22 (1)23 (1)24 (1)25 (1)26 (1)27 (1)28 (1)29 (1)30 (1)3(1) (1)32 (1)33 (1)34 (1)35 (1)36 (1)37 (1)38 (1)39 (1)40 (1)4(1) (1)42 (1)43 (1)44 (1)45 (1)46 (1)47 (1)48 (1)49 (1)50 $ $ echo ":$OUT:" :(1): $ exit 0 smenu-0.9.15/tests/substitutions/t0007.in000077700000000000000000000000001344767411600210652data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0007.tst000066400000000000000000000002021344767411600203530ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/1/(&)/g' -n 15 t0007.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0008.good000066400000000000000000000026721344767411600205070ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/1*/(&)/g' -n 15 t0008.in) (1) ()2 ()3 ()4 ()5 ()6 ()7 ()8 ()9 (1)()0 (11) (1)()2 (1)()3 (1)()4 (1)()5 ┐ 0:07 1:07 2:07 79:20 (1)()6 (1)()7 (1)()8 (1)()9 ()2()0 ()2(1) ()2()2 ()2()3 ()2()4 ()2()5 ()2()6 ║ 79:20 ()2()7 ()2()8 ()2()9 ()3()0 ()3()2 ()3()3 ()3()4 ()3()5 ()3()6 ()3()7 ()3()8 │ 79:20 ()3()9 ()4()0 ()4(1) ()4()2 ()4()3 ()4()4 ()4()5 ()4()6 ()4()7 ()4()8 ()4()9 │ 79:20 ()5()0 ()5(1) ()5()2 ()5()3 ()5()4 ()5()5 ()5()6 ()5()7 ()5()8 ()5()9 ()6()0 │ 79:20 ()6(1) ()6()2 ()6()3 ()6()4 ()6()5 ()6()6 ()6()7 ()6()8 ()6()9 ()7()0 ()7(1) │ 79:20 ()7()2 ()7()3 ()7()4 ()7()5 ()7()6 ()7()7 ()7()8 ()7()9 ()8()0 ()8(1) ()8()2 │ 79:20 ()8()3 ()8()4 ()8()5 ()8()6 ()8()7 ()8()8 ()8()9 ()9()0 ()9(1) ()9()2 ()9()3 │ 79:20 ()9()4 ()9()5 ()9()6 ()9()7 ()9()8 ()9()9 (1)()0()0 (1)()0(1) (1)()0()2 │ 79:20 (1)()0()3 (1)()0()4 (1)()0()5 (1)()0()6 (1)()0()7 (1)()0()8 (1)()0()9 (11)()0 │ 79:20 (111) (11)()2 (11)()3 (11)()4 (11)()5 (11)()6 (11)()7 (11)()8 (11)()9 │ 79:20 (1)()2()0 (1)()2(1) (1)()2()2 (1)()2()3 (1)()2()4 (1)()2()5 (1)()2()6 │ 79:20 (1)()2()7 (1)()2()8 (1)()2()9 (1)()3()0 (1)()3(1) (1)()3()2 (1)()3()3 │ 79:20 (1)()3()4 (1)()3()5 (1)()3()6 (1)()3()7 (1)()3()8 (1)()3()9 (1)()4()0 │ 79:20 (1)()4(1) (1)()4()2 (1)()4()3 (1)()4()4 (1)()4()5 (1)()4()6 (1)()4()7 ▼ 79:20 $ $ echo ":$OUT:" :(1): $ exit 0 smenu-0.9.15/tests/substitutions/t0008.in000077700000000000000000000000001344767411600210662data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0008.tst000066400000000000000000000002031344767411600203550ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/1*/(&)/g' -n 15 t0008.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0009.good000066400000000000000000000016361344767411600205070ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/1*$/(&)/g' -n 15 t0009.in) (1) 2() 3() 4() 5() 6() 7() 8() 9() 10() (11) 12() 13() 14() 15() 16() 17() 0:07 1:07 2:07 18() 19() 20() 2(1) 22() 23() 24() 25() 26() 27() 28() 29() 30() 32() 33() 34() 35() 36() 37() 38() 39() 40() 4(1) 42() 43() 44() 45() 46() 47() 48() 49() 50() 5(1) 52() 53() 54() 55() 56() 57() 58() 59() 60() 6(1) 62() 63() 64() 65() 66() 67() 68() 69() 70() 7(1) 72() 73() 74() 75() 76() 77() 78() 79() 80() 8(1) 82() 83() 84() 85() 86() 87() 88() 89() 90() 9(1) 92() 93() 94() 95() 96() 97() 98() 99() 100() 10(1) 102() 103() 104() 105() 106() 107() 108() 109() 110() (111) 112() 113() 114() 115() 116() 117() 118() 119() 120() 12(1) 122() 123() 124() 125() 126() 127() 128() 129() 130() 13(1) 132() 133() 134() 135() 136() 137() 138() 139() 140() 14(1) 142() 143() 144() 145() 146() 147() 148() 149() 150() $ $ echo ":$OUT:" :(1): $ exit 0 smenu-0.9.15/tests/substitutions/t0009.in000077700000000000000000000000001344767411600210672data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0009.tst000066400000000000000000000002041344767411600203570ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/1*$/(&)/g' -n 15 t0009.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0010.good000066400000000000000000000012501344767411600204670ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/(.)(.)(.)/\3\2\1/g' \ > -s '#150' -n 15 t0010.in) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 001 101 201 301 401 501 601 701 801 901 011 111 211 311 411 511 611 711 811 911 021 121 221 321 421 521 621 721 821 921 031 131 231 331 431 531 631 731 831 931 041 141 241 341 441 541 641 741 841 941 051 24:07 25:07 26:07 $ $ echo ":$OUT:" :051: $ exit 0 smenu-0.9.15/tests/substitutions/t0010.in000077700000000000000000000000001344767411600210572data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0010.tst000066400000000000000000000002761344767411600203600ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/(.)(.)(.)/\\3\\2\\1/g' \\ -s '#150' -n 15 t0010.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0011.good000066400000000000000000000016321344767411600204740ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/(.)(.)(.)/\3<-\2->\1/g' \ > -s '#150' -n 15 t0011.in) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 0<-0->1 1<-0->1 2<-0->1 3<-0->1 4<-0->1 5<-0->1 6<-0->1 7<-0->1 8<-0->1 9<-0->1 0<-1->1 1<-1->1 2<-1->1 3<-1->1 4<-1->1 5<-1->1 6<-1->1 7<-1->1 8<-1->1 9<-1->1 0<-2->1 1<-2->1 2<-2->1 3<-2->1 4<-2->1 5<-2->1 6<-2->1 7<-2->1 8<-2->1 9<-2->1 0<-3->1 1<-3->1 2<-3->1 3<-3->1 4<-3->1 5<-3->1 6<-3->1 7<-3->1 8<-3->1 9<-3->1 0<-4->1 1<-4->1 2<-4->1 3<-4->1 4<-4->1 5<-4->1 6<-4->1 7<-4->1 8<-4->1 9<-4->1 0<-5->1 16:07 17:07 18:07 19:07 20:07 21:07 22:07 $ $ echo ":$OUT:" :0<-5->1: $ exit 0 smenu-0.9.15/tests/substitutions/t0011.in000077700000000000000000000000001344767411600210602data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0011.tst000066400000000000000000000003021344767411600203470ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/(.)(.)(.)/\\3<-\\2->\\1/g' \\ -s '#150' -n 15 t0011.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0012.good000066400000000000000000000026011344767411600204720ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -c -e 2 -I'/(1+)/(\1)/g' -n 15 \ > t0012.in) (1) 2 3 4 5 6 7 8 9 (1)0 (11) 12 → 0:01 1:07 2:07 3:07 4:07 5:07 6:07 7:07 9:24 10:24 11:24 12:24 13:24 71:24 72:24 73:24 74:24 75:24 76:01 28 29 30 32 33 34 35 36 37 38 39 40 → 0:01 1:24 2:24 3:24 4:24 5:24 6:24 7:24 9:24 10:24 11:24 12:24 13:24 21:24 22:24 23:24 24:24 25:24 76:01 53 54 55 56 57 58 59 60 6(1) 62 63 64 → 0:01 59:24 60:24 61:24 62:24 63:24 76:01 77 78 79 80 8(1) 82 83 84 85 86 87 88 → 0:01 35:24 36:24 37:24 38:24 39:24 76:01 (1)0(1) 102 (1)03 (1)04 (1)05 (1)06 (1)07 (1)08 (1)09 (11)0 (111) 112 → 0:01 9:24 10:24 11:24 12:24 13:24 71:24 72:24 73:24 74:24 75:24 76:01 (11)9 120 121 122 123 124 125 126 127 128 129 (1)30→ 0:01 9:24 10:24 11:24 12:24 13:24 15:24 16:24 17:24 18:24 19:24 21:24 22:24 23:24 24:24 25:24 27:24 28:24 29:24 30:24 31:24 32:24 33:24 35:24 36:24 37:24 38:24 39:24 41:24 42:24 43:24 44:24 45:24 47:24 48:24 49:24 50:24 51:24 53:24 54:24 55:24 56:24 57:24 59:24 60:24 61:24 62:24 63:24 65:24 66:24 67:24 68:24 69:24 76:01 (1)37 (1)38 (1)39 (1)40 (1)4(1) 142 (1)43 (1)44 (1)45 (1)46 (1)47 (1)48→ 0:01 35:24 36:24 37:24 38:24 39:24 76:01 $ $ echo ":$OUT:" :(1): $ exit 0 smenu-0.9.15/tests/substitutions/t0012.in000077700000000000000000000000001344767411600210612data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0012.tst000066400000000000000000000002221344767411600203510ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -c -e 2 -I'/(1+)/(\\1)/g' -n 15 \\ t0012.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0013.good000066400000000000000000000053551344767411600205040ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -c -i 2 -I'/(1+)/(\1)/g' -n 15 \ > t0013.in) 1 2 3 4 5 6 7 8 9 10 11 (1)2 13 → 0:01 1:24 2:24 3:24 5:07 6:07 7:07 8:07 9:07 11:24 12:24 13:24 14:24 15:24 16:24 17:24 19:24 20:24 21:24 22:24 23:24 25:24 26:24 27:24 28:24 29:24 31:24 32:24 33:24 34:24 35:24 37:24 38:24 39:24 40:24 41:24 43:24 44:24 45:24 46:24 47:24 49:24 50:24 51:24 52:24 53:24 55:24 56:24 57:24 58:24 59:24 61:24 62:24 63:24 64:24 65:24 73:24 74:24 75:24 76:01 28 29 30 32 33 34 35 36 37 38 39 40 41 → 0:01 11:24 12:24 13:24 14:24 15:24 16:24 17:24 25:24 26:24 27:24 28:24 29:24 31:24 32:24 33:24 34:24 35:24 37:24 38:24 39:24 40:24 41:24 43:24 44:24 45:24 46:24 47:24 49:24 50:24 51:24 52:24 53:24 55:24 56:24 57:24 58:24 59:24 61:24 62:24 63:24 64:24 65:24 67:24 68:24 69:24 70:24 71:24 73:24 74:24 75:24 76:01 53 54 55 56 57 58 59 60 61 62 63 64 65 → 0:01 1:24 2:24 3:24 5:24 6:24 7:24 8:24 9:24 11:24 12:24 13:24 14:24 15:24 16:24 17:24 19:24 20:24 21:24 22:24 23:24 25:24 26:24 27:24 28:24 29:24 31:24 32:24 33:24 34:24 35:24 37:24 38:24 39:24 40:24 41:24 43:24 44:24 45:24 46:24 47:24 49:24 50:24 51:24 52:24 53:24 61:24 62:24 63:24 64:24 65:24 67:24 68:24 69:24 70:24 71:24 73:24 74:24 75:24 76:01 77 78 79 80 81 82 83 84 85 86 87 88 89 → 0:01 1:24 2:24 3:24 5:24 6:24 7:24 8:24 9:24 11:24 12:24 13:24 14:24 15:24 16:24 17:24 19:24 20:24 21:24 22:24 23:24 25:24 26:24 27:24 28:24 29:24 37:24 38:24 39:24 40:24 41:24 43:24 44:24 45:24 46:24 47:24 49:24 50:24 51:24 52:24 53:24 55:24 56:24 57:24 58:24 59:24 61:24 62:24 63:24 64:24 65:24 67:24 68:24 69:24 70:24 71:24 73:24 74:24 75:24 76:01 101 (1)02 103 104 105 106 107 108 109 110 111 (11)2 113→ 0:01 1:24 2:24 3:24 11:24 12:24 13:24 14:24 15:24 16:24 17:24 19:24 20:24 21:24 22:24 23:24 25:24 26:24 27:24 28:24 29:24 31:24 32:24 33:24 34:24 35:24 37:24 38:24 39:24 40:24 41:24 43:24 44:24 45:24 46:24 47:24 49:24 50:24 51:24 52:24 53:24 55:24 56:24 57:24 58:24 59:24 61:24 62:24 63:24 64:24 65:24 73:24 74:24 75:24 76:01 119 (1)20 (1)2(1) (1)22 (1)23 (1)24 (1)25 (1)26 (1)27 (1)28 (1)29 130 131→ 0:01 1:24 2:24 3:24 67:24 68:24 69:24 70:24 71:24 73:24 74:24 75:24 76:01 137 138 139 140 141 (1)42 143 144 145 146 147 148 149→ 0:01 1:24 2:24 3:24 5:24 6:24 7:24 8:24 9:24 11:24 12:24 13:24 14:24 15:24 16:24 17:24 19:24 20:24 21:24 22:24 23:24 25:24 26:24 27:24 28:24 29:24 37:24 38:24 39:24 40:24 41:24 43:24 44:24 45:24 46:24 47:24 49:24 50:24 51:24 52:24 53:24 55:24 56:24 57:24 58:24 59:24 61:24 62:24 63:24 64:24 65:24 67:24 68:24 69:24 70:24 71:24 73:24 74:24 75:24 76:01 $ $ echo ":$OUT:" :2: $ exit 0 smenu-0.9.15/tests/substitutions/t0013.in000077700000000000000000000000001344767411600210622data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0013.tst000066400000000000000000000002221344767411600203520ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -c -i 2 -I'/(1+)/(\\1)/g' -n 15 \\ t0013.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0014.good000066400000000000000000000053671344767411600205100ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -c -i 2 -E'/(1+)/(\1)/g' -n 15 \ > t0014.in) (1) 2 3 4 5 6 7 8 9 (1)0 (11) 12 → 0:01 1:24 2:24 3:24 4:24 5:24 6:24 7:24 9:07 10:07 11:07 12:07 13:07 15:24 16:24 17:24 18:24 19:24 21:24 22:24 23:24 24:24 25:24 27:24 28:24 29:24 30:24 31:24 32:24 33:24 35:24 36:24 37:24 38:24 39:24 41:24 42:24 43:24 44:24 45:24 47:24 48:24 49:24 50:24 51:24 53:24 54:24 55:24 56:24 57:24 59:24 60:24 61:24 62:24 63:24 65:24 66:24 67:24 68:24 69:24 76:01 28 29 30 32 33 34 35 36 37 38 39 40 → 0:01 15:24 16:24 17:24 18:24 19:24 27:24 28:24 29:24 30:24 31:24 32:24 33:24 35:24 36:24 37:24 38:24 39:24 41:24 42:24 43:24 44:24 45:24 47:24 48:24 49:24 50:24 51:24 53:24 54:24 55:24 56:24 57:24 59:24 60:24 61:24 62:24 63:24 65:24 66:24 67:24 68:24 69:24 71:24 72:24 73:24 74:24 75:24 76:01 53 54 55 56 57 58 59 60 6(1) 62 63 64 → 0:01 1:24 2:24 3:24 4:24 5:24 6:24 7:24 9:24 10:24 11:24 12:24 13:24 15:24 16:24 17:24 18:24 19:24 21:24 22:24 23:24 24:24 25:24 27:24 28:24 29:24 30:24 31:24 32:24 33:24 35:24 36:24 37:24 38:24 39:24 41:24 42:24 43:24 44:24 45:24 47:24 48:24 49:24 50:24 51:24 53:24 54:24 55:24 56:24 57:24 65:24 66:24 67:24 68:24 69:24 71:24 72:24 73:24 74:24 75:24 76:01 77 78 79 80 8(1) 82 83 84 85 86 87 88 → 0:01 1:24 2:24 3:24 4:24 5:24 6:24 7:24 9:24 10:24 11:24 12:24 13:24 15:24 16:24 17:24 18:24 19:24 21:24 22:24 23:24 24:24 25:24 27:24 28:24 29:24 30:24 31:24 32:24 33:24 41:24 42:24 43:24 44:24 45:24 47:24 48:24 49:24 50:24 51:24 53:24 54:24 55:24 56:24 57:24 59:24 60:24 61:24 62:24 63:24 65:24 66:24 67:24 68:24 69:24 71:24 72:24 73:24 74:24 75:24 76:01 (1)0(1) 102 (1)03 (1)04 (1)05 (1)06 (1)07 (1)08 (1)09 (11)0 (111) 112 → 0:01 1:24 2:24 3:24 4:24 5:24 6:24 7:24 15:24 16:24 17:24 18:24 19:24 21:24 22:24 23:24 24:24 25:24 27:24 28:24 29:24 30:24 31:24 32:24 33:24 35:24 36:24 37:24 38:24 39:24 41:24 42:24 43:24 44:24 45:24 47:24 48:24 49:24 50:24 51:24 53:24 54:24 55:24 56:24 57:24 59:24 60:24 61:24 62:24 63:24 65:24 66:24 67:24 68:24 69:24 76:01 (11)9 120 121 122 123 124 125 126 127 128 129 (1)30→ 0:01 1:24 2:24 3:24 4:24 5:24 6:24 7:24 71:24 72:24 73:24 74:24 75:24 76:01 (1)37 (1)38 (1)39 (1)40 (1)4(1) 142 (1)43 (1)44 (1)45 (1)46 (1)47 (1)48→ 0:01 1:24 2:24 3:24 4:24 5:24 6:24 7:24 9:24 10:24 11:24 12:24 13:24 15:24 16:24 17:24 18:24 19:24 21:24 22:24 23:24 24:24 25:24 27:24 28:24 29:24 30:24 31:24 32:24 33:24 41:24 42:24 43:24 44:24 45:24 47:24 48:24 49:24 50:24 51:24 53:24 54:24 55:24 56:24 57:24 59:24 60:24 61:24 62:24 63:24 65:24 66:24 67:24 68:24 69:24 71:24 72:24 73:24 74:24 75:24 76:01 $ $ echo ":$OUT:" :2: $ exit 0 smenu-0.9.15/tests/substitutions/t0014.in000077700000000000000000000000001344767411600210632data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0014.tst000066400000000000000000000002221344767411600203530ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -c -i 2 -E'/(1+)/(\\1)/g' -n 15 \\ t0014.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0015.good000066400000000000000000000025071344767411600205020ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -c -e 2 -E'/(1+)/(\1)/g' -n 15 \ > t0015.in) 1 2 3 4 5 6 7 8 9 10 11 (1)2 13 → 0:01 1:07 2:07 3:07 5:24 6:24 7:24 8:24 9:24 67:24 68:24 69:24 70:24 71:24 76:01 28 29 30 32 33 34 35 36 37 38 39 40 41 → 0:01 1:24 2:24 3:24 5:24 6:24 7:24 8:24 9:24 19:24 20:24 21:24 22:24 23:24 76:01 53 54 55 56 57 58 59 60 61 62 63 64 65 → 0:01 55:24 56:24 57:24 58:24 59:24 76:01 77 78 79 80 81 82 83 84 85 86 87 88 89 → 0:01 31:24 32:24 33:24 34:24 35:24 76:01 101 (1)02 103 104 105 106 107 108 109 110 111 (11)2 113→ 0:01 5:24 6:24 7:24 8:24 9:24 67:24 68:24 69:24 70:24 71:24 76:01 119 (1)20 (1)2(1) (1)22 (1)23 (1)24 (1)25 (1)26 (1)27 (1)28 (1)29 130 131→ 0:01 5:24 6:24 7:24 8:24 9:24 11:24 12:24 13:24 14:24 15:24 16:24 17:24 19:24 20:24 21:24 22:24 23:24 25:24 26:24 27:24 28:24 29:24 31:24 32:24 33:24 34:24 35:24 37:24 38:24 39:24 40:24 41:24 43:24 44:24 45:24 46:24 47:24 49:24 50:24 51:24 52:24 53:24 55:24 56:24 57:24 58:24 59:24 61:24 62:24 63:24 64:24 65:24 76:01 137 138 139 140 141 (1)42 143 144 145 146 147 148 149→ 0:01 31:24 32:24 33:24 34:24 35:24 76:01 $ $ echo ":$OUT:" :1: $ exit 0 smenu-0.9.15/tests/substitutions/t0015.in000077700000000000000000000000001344767411600210642data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0015.tst000066400000000000000000000002221344767411600203540ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -c -e 2 -E'/(1+)/(\\1)/g' -n 15 \\ t0015.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0016.good000066400000000000000000000021601344767411600204760ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -c -e 2 -E/1/A/g -I/1/B/g -n 6 \ > t0016.in) B 2 3 4 5 6 7 8 9 B0 BB A2 B3 B4 B5 B6 B7 B8 B9 20→┐ 0:01 1:07 2:07 3:07 5:24 6:24 7:24 45:24 46:24 47:24 76:24 77:24 78:01 79:20 28 29 30 32 33 34 35 36 37 38 39 40 4B 42 43 44 45 46 47 48→║ 0:01 1:24 2:24 3:24 5:24 6:24 7:24 13:24 14:24 15:24 53:24 54:24 55:24 78:01 79:20 53 54 55 56 57 58 59 60 6B 62 63 64 65 66 67 68 69 70 7B 72→│ 0:01 37:24 38:24 39:24 76:24 77:24 78:01 79:20 77 78 79 80 8B 82 83 84 85 86 87 88 89 90 9B 92 93 94 95 96→│ 0:01 21:24 22:24 23:24 61:24 62:24 63:24 78:01 79:20 B0B A02 B03 B04 B05 B06 B07 B08 B09 BB0 BBB AA2 BB3 BB4 BB5 BB6 BB7 BB8 │ 0:01 5:24 6:24 7:24 45:24 46:24 47:24 79:20 BB9 A20 A2A A22 A23 A24 A25 A26 A27 A28 A29 B30 B3B A32 B33 B34 B35 B36 ▼ 0:01 5:24 6:24 7:24 9:24 10:24 11:24 13:24 14:24 15:24 17:24 18:24 19:24 21:24 22:24 23:24 25:24 26:24 27:24 29:24 30:24 31:24 33:24 34:24 35:24 37:24 38:24 39:24 41:24 42:24 43:24 53:24 54:24 55:24 79:20 $ $ echo ":$OUT:" :B: $ exit 0 smenu-0.9.15/tests/substitutions/t0016.in000077700000000000000000000000001344767411600210652data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0016.tst000066400000000000000000000002211344767411600203540ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -c -e 2 -E/1/A/g -I/1/B/g -n 6 \\ t0016.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0017.good000066400000000000000000000044261344767411600205060ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -c -i 2 -E/1/A/g -I/1/B/g -n 6 \ > t0017.in) A 2 3 4 5 6 7 8 9 A0 AA B2 A3 A4 A5 A6 A7 A8 A9 20→┐ 0:01 1:24 2:24 3:24 5:07 6:07 7:07 9:24 10:24 11:24 13:24 14:24 15:24 17:24 18:24 19:24 21:24 22:24 23:24 25:24 26:24 27:24 29:24 30:24 31:24 33:24 34:24 35:24 37:24 38:24 39:24 41:24 42:24 43:24 49:24 50:24 51:24 53:24 54:24 55:24 57:24 58:24 59:24 61:24 62:24 63:24 65:24 66:24 67:24 69:24 70:24 71:24 73:24 74:24 78:01 79:20 28 29 30 32 33 34 35 36 37 38 39 40 4A 42 43 44 45 46 47 48→║ 0:01 9:24 10:24 11:24 17:24 18:24 19:24 21:24 22:24 23:24 25:24 26:24 27:24 29:24 30:24 31:24 33:24 34:24 35:24 37:24 38:24 39:24 41:24 42:24 43:24 45:24 46:24 47:24 49:24 50:24 51:24 57:24 58:24 59:24 61:24 62:24 63:24 65:24 66:24 67:24 69:24 70:24 71:24 73:24 74:24 76:24 77:24 78:01 79:20 53 54 55 56 57 58 59 60 6A 62 63 64 65 66 67 68 69 70 7A 72→│ 0:01 1:24 2:24 3:24 5:24 6:24 7:24 9:24 10:24 11:24 13:24 14:24 15:24 17:24 18:24 19:24 21:24 22:24 23:24 25:24 26:24 27:24 29:24 30:24 31:24 33:24 34:24 35:24 41:24 42:24 43:24 45:24 46:24 47:24 49:24 50:24 51:24 53:24 54:24 55:24 57:24 58:24 59:24 61:24 62:24 63:24 65:24 66:24 67:24 69:24 70:24 71:24 73:24 74:24 78:01 79:20 77 78 79 80 8A 82 83 84 85 86 87 88 89 90 9A 92 93 94 95 96→│ 0:01 1:24 2:24 3:24 5:24 6:24 7:24 9:24 10:24 11:24 13:24 14:24 15:24 17:24 18:24 19:24 25:24 26:24 27:24 29:24 30:24 31:24 33:24 34:24 35:24 37:24 38:24 39:24 41:24 42:24 43:24 45:24 46:24 47:24 49:24 50:24 51:24 53:24 54:24 55:24 57:24 58:24 59:24 65:24 66:24 67:24 69:24 70:24 71:24 73:24 74:24 76:24 77:24 78:01 79:20 A0A B02 A03 A04 A05 A06 A07 A08 A09 AA0 AAA BB2 AA3 AA4 AA5 AA6 AA7 AA8 │ 0:01 1:24 2:24 3:24 9:24 10:24 11:24 13:24 14:24 15:24 17:24 18:24 19:24 21:24 22:24 23:24 25:24 26:24 27:24 29:24 30:24 31:24 33:24 34:24 35:24 37:24 38:24 39:24 41:24 42:24 43:24 49:24 50:24 51:24 53:24 54:24 55:24 57:24 58:24 59:24 61:24 62:24 63:24 65:24 66:24 67:24 69:24 70:24 71:24 79:20 AA9 B20 B2B B22 B23 B24 B25 B26 B27 B28 B29 A30 A3A B32 A33 A34 A35 A36 ▼ 0:01 1:24 2:24 3:24 45:24 46:24 47:24 49:24 50:24 51:24 57:24 58:24 59:24 61:24 62:24 63:24 65:24 66:24 67:24 69:24 70:24 71:24 79:20 $ $ echo ":$OUT:" :2: $ exit 0 smenu-0.9.15/tests/substitutions/t0017.in000077700000000000000000000000001344767411600210662data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0017.tst000066400000000000000000000002211344767411600203550ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -c -i 2 -E/1/A/g -I/1/B/g -n 6 \\ t0017.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0018.good000066400000000000000000000045101344767411600205010ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -c -i 2 -E/1/A/g -I/1/B/g \ > -S/1/C/g -n 6 t0018.in) C 2 3 4 5 6 7 8 9 C0 CC C2 C3 C4 C5 C6 C7 C8 C9 20→┐ 0:01 1:24 2:24 3:24 5:07 6:07 7:07 9:24 10:24 11:24 13:24 14:24 15:24 17:24 18:24 19:24 21:24 22:24 23:24 25:24 26:24 27:24 29:24 30:24 31:24 33:24 34:24 35:24 37:24 38:24 39:24 41:24 42:24 43:24 49:24 50:24 51:24 53:24 54:24 55:24 57:24 58:24 59:24 61:24 62:24 63:24 65:24 66:24 67:24 69:24 70:24 71:24 73:24 74:24 78:01 79:20 28 29 30 32 33 34 35 36 37 38 39 40 4C 42 43 44 45 46 47 48→║ 0:01 9:24 10:24 11:24 17:24 18:24 19:24 21:24 22:24 23:24 25:24 26:24 27:24 29:24 30:24 31:24 33:24 34:24 35:24 37:24 38:24 39:24 41:24 42:24 43:24 45:24 46:24 47:24 49:24 50:24 51:24 57:24 58:24 59:24 61:24 62:24 63:24 65:24 66:24 67:24 69:24 70:24 71:24 73:24 74:24 76:24 77:24 78:01 79:20 53 54 55 56 57 58 59 60 6C 62 63 64 65 66 67 68 69 70 7C 72→│ 0:01 1:24 2:24 3:24 5:24 6:24 7:24 9:24 10:24 11:24 13:24 14:24 15:24 17:24 18:24 19:24 21:24 22:24 23:24 25:24 26:24 27:24 29:24 30:24 31:24 33:24 34:24 35:24 41:24 42:24 43:24 45:24 46:24 47:24 49:24 50:24 51:24 53:24 54:24 55:24 57:24 58:24 59:24 61:24 62:24 63:24 65:24 66:24 67:24 69:24 70:24 71:24 73:24 74:24 78:01 79:20 77 78 79 80 8C 82 83 84 85 86 87 88 89 90 9C 92 93 94 95 96→│ 0:01 1:24 2:24 3:24 5:24 6:24 7:24 9:24 10:24 11:24 13:24 14:24 15:24 17:24 18:24 19:24 25:24 26:24 27:24 29:24 30:24 31:24 33:24 34:24 35:24 37:24 38:24 39:24 41:24 42:24 43:24 45:24 46:24 47:24 49:24 50:24 51:24 53:24 54:24 55:24 57:24 58:24 59:24 65:24 66:24 67:24 69:24 70:24 71:24 73:24 74:24 76:24 77:24 78:01 79:20 C0C C02 C03 C04 C05 C06 C07 C08 C09 CC0 CCC CC2 CC3 CC4 CC5 CC6 CC7 CC8 │ 0:01 1:24 2:24 3:24 9:24 10:24 11:24 13:24 14:24 15:24 17:24 18:24 19:24 21:24 22:24 23:24 25:24 26:24 27:24 29:24 30:24 31:24 33:24 34:24 35:24 37:24 38:24 39:24 41:24 42:24 43:24 49:24 50:24 51:24 53:24 54:24 55:24 57:24 58:24 59:24 61:24 62:24 63:24 65:24 66:24 67:24 69:24 70:24 71:24 79:20 CC9 C20 C2C C22 C23 C24 C25 C26 C27 C28 C29 C30 C3C C32 C33 C34 C35 C36 ▼ 0:01 1:24 2:24 3:24 45:24 46:24 47:24 49:24 50:24 51:24 57:24 58:24 59:24 61:24 62:24 63:24 65:24 66:24 67:24 69:24 70:24 71:24 79:20 $ $ echo ":$OUT:" :2: $ exit 0 smenu-0.9.15/tests/substitutions/t0018.in000077700000000000000000000000001344767411600210672data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0018.tst000066400000000000000000000003031344767411600203570ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -c -i 2 -E/1/A/g -I/1/B/g \\ -S/1/C/g -n 6 t0018.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0019.good000066400000000000000000000005551344767411600205070ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -l -S'/1.*//' -n 4 t0019.in) 2 3 4 5 6 7 8 9 20 2 22 23 24 25 26 27 28 29 30 32 33 34 35 36 37 38 39 40 4 42 43 44 45 46 47 48 49 50 5 52 53 54 55 56 57 58 59 60 6 62 63 64 65 66 67 68 69 70 7 72 73 74 75 76 77 78 79 80 8 82 83 84 85 86 87 88 89 90 9 92 93 94 95 96 97 98 99 35:07 36:07 $ $ echo ":$OUT:" :89: $ exit 0 smenu-0.9.15/tests/substitutions/t0019.in000077700000000000000000000000001344767411600210702data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0019.tst000066400000000000000000000002241344767411600203620ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -l -S'/1.*//' -n 4 t0019.in) \S[150]\s[150]lllllllllljjjlllll\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0020.good000066400000000000000000000005741344767411600205000ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -t -S'/1.*//' -n 4 t0020.in) 2 3 4 5 6 7 8 9 20 2 22 23 24 25 26 27 28 29 30 32 33 34 35 36 37 38 39 40 4 42 43 44 45 46 47 48 49 50 5 52 53 54 55 56 57 58 59 60 6 62 63 64 65 66 67 68 69 70 7 72 73 74 75 76 77 78 79 80 8 82 83 84 85 86 87 88 89 90 45:07 46:07 9 92 93 94 95 96 97 98 99 $ $ echo ":$OUT:" :80: $ exit 0 smenu-0.9.15/tests/substitutions/t0020.in000077700000000000000000000000001344767411600210602data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0020.tst000066400000000000000000000002231344767411600203510ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -t -S'/1.*//' -n 4 t0020.in) \S[150]\s[150]lllllllllljjlllll\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0021.good000066400000000000000000000023731344767411600205000ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/(1)/\[1 \1 \1\]1/g' \ > -n 20 t0021.in) [1 1 1]1 2 3 4 5 6 7 8 9 [1 1 1]10 [1 1 1]1[1 1 1]1 [1 1 1]12 [1 1 1]13 0:07 1:07 2:07 3:07 4:07 5:07 6:07 7:07 [1 1 1]14 [1 1 1]15 [1 1 1]16 [1 1 1]17 [1 1 1]18 [1 1 1]19 20 2[1 1 1]1 22 23 24 25 26 27 28 29 30 32 33 34 35 36 37 38 39 40 4[1 1 1]1 42 43 44 45 46 47 48 49 50 5[1 1 1]1 52 53 54 55 56 57 58 59 60 6[1 1 1]1 62 63 64 65 66 67 68 69 70 7[1 1 1]1 72 73 74 75 76 77 78 79 80 8[1 1 1]1 82 83 84 85 86 87 88 89 90 9[1 1 1]1 92 93 94 95 96 97 98 99 [1 1 1]100 [1 1 1]10[1 1 1]1 [1 1 1]102 [1 1 1]103 [1 1 1]104 [1 1 1]105 [1 1 1]106 [1 1 1]107 [1 1 1]108 [1 1 1]109 [1 1 1]1[1 1 1]10 [1 1 1]1[1 1 1]1[1 1 1]1 [1 1 1]1[1 1 1]12 [1 1 1]1[1 1 1]13 [1 1 1]1[1 1 1]14 [1 1 1]1[1 1 1]15 [1 1 1]1[1 1 1]16 [1 1 1]1[1 1 1]17 [1 1 1]1[1 1 1]18 [1 1 1]1[1 1 1]19 [1 1 1]120 [1 1 1]12[1 1 1]1 [1 1 1]122 [1 1 1]123 [1 1 1]124 [1 1 1]125 [1 1 1]126 [1 1 1]127 [1 1 1]128 [1 1 1]129 [1 1 1]130 [1 1 1]13[1 1 1]1 [1 1 1]132 [1 1 1]133 [1 1 1]134 [1 1 1]135 [1 1 1]136 [1 1 1]137 [1 1 1]138 [1 1 1]139 [1 1 1]140 [1 1 1]14[1 1 1]1 [1 1 1]142 [1 1 1]143 [1 1 1]144 [1 1 1]145 [1 1 1]146 [1 1 1]147 [1 1 1]148 [1 1 1]149 [1 1 1]150 $ $ echo ":$OUT:" :[1 1 1]1: $ exit 0 smenu-0.9.15/tests/substitutions/t0021.in000077700000000000000000000000001344767411600210612data1ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0021.tst000066400000000000000000000002241344767411600203530ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -S'/(1)/\\[1 \\1 \\1\\]1/g' \\ -n 20 t0021.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0022.good000066400000000000000000000001311344767411600204670ustar00rootroot00000000000000$ OUT=$(smenu -S/a// t0022.in) bc bc bc 3:07 4:07 $ $ echo ":$OUT:" :bc: $ exit 0 smenu-0.9.15/tests/substitutions/t0022.in000077700000000000000000000000001344767411600210632data2ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0022.tst000066400000000000000000000001441344767411600203550ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -S/a// t0022.in) \S[150]\s[150]l\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0023.good000066400000000000000000000001111344767411600204660ustar00rootroot00000000000000$ OUT=$(smenu -S/a// -c t0023.in) $ $ $ echo ":$OUT:" :: $ exit 0 smenu-0.9.15/tests/substitutions/t0023.in000077700000000000000000000000001344767411600210642data2ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0023.tst000066400000000000000000000001461344767411600203600ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -S/a// -c t0023.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0024.good000066400000000000000000000001451344767411600204760ustar00rootroot00000000000000$ OUT=$(smenu '-S/a/ /' t0024.in) bc b c bc 4:07 5:07 6:07 $ $ echo ":$OUT:" :b c: $ exit 0 smenu-0.9.15/tests/substitutions/t0024.in000077700000000000000000000000001344767411600210652data2ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0024.tst000066400000000000000000000001471344767411600203620ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu '-S/a/ /' t0024.in) \S[150]\s[150]l\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0025.good000066400000000000000000000001351344767411600204760ustar00rootroot00000000000000$ OUT=$(smenu '-S/a/ /' -c t0025.in) bc b c bc 0:07 $ $ echo ":$OUT:" :: $ exit 0 smenu-0.9.15/tests/substitutions/t0025.in000077700000000000000000000000001344767411600210662data2ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0025.tst000066400000000000000000000001511344767411600203560ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu '-S/a/ /' -c t0025.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0026.good000066400000000000000000000001551344767411600205010ustar00rootroot00000000000000$ OUT=$(smenu '-S/a/X/i' -c t0026.in) Xbc XBC Xab XAA 0:07 1:07 2:07 $ $ echo ":$OUT:" :Xbc: $ exit 0 smenu-0.9.15/tests/substitutions/t0026.in000077700000000000000000000000001344767411600210702data3ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0026.tst000066400000000000000000000001521344767411600203600ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu '-S/a/X/i' -c t0026.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0027.good000066400000000000000000000001561344767411600205030ustar00rootroot00000000000000$ OUT=$(smenu '-S/a/X/iv' -c t0027.in) Xbc XBC Xab XAA 0:07 1:07 2:07 $ $ echo ":$OUT:" :abc: $ exit 0 smenu-0.9.15/tests/substitutions/t0027.in000077700000000000000000000000001344767411600210712data3ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0027.tst000066400000000000000000000001531344767411600203620ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu '-S/a/X/iv' -c t0027.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0028.good000066400000000000000000000001561344767411600205040ustar00rootroot00000000000000$ OUT=$(smenu '-S/a/X/ig' -c t0028.in) Xbc XBC XXb XXX 0:07 1:07 2:07 $ $ echo ":$OUT:" :Xbc: $ exit 0 smenu-0.9.15/tests/substitutions/t0028.in000077700000000000000000000000001344767411600210722data3ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0028.tst000066400000000000000000000001531344767411600203630ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu '-S/a/X/ig' -c t0028.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0029.good000066400000000000000000000001651344767411600205050ustar00rootroot00000000000000$ OUT=$(smenu -S/a/X/isg -S/b/Y/ -c t0029.in) Xbc XBC XXb XXX 0:07 1:07 2:07 $ $ echo ":$OUT:" :Xbc: $ exit 0 smenu-0.9.15/tests/substitutions/t0029.in000077700000000000000000000000001344767411600210732data3ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0029.tst000066400000000000000000000001621344767411600203640ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -S/a/X/isg -S/b/Y/ -c t0029.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0030.good000066400000000000000000000001641344767411600204740ustar00rootroot00000000000000$ OUT=$(smenu -S/a/X/ig -S/b/Y/ -c t0030.in) XYc XBC XXY XXX 0:07 1:07 2:07 $ $ echo ":$OUT:" :XYc: $ exit 0 smenu-0.9.15/tests/substitutions/t0030.in000077700000000000000000000000001344767411600210632data3ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0030.tst000066400000000000000000000001611344767411600203530ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -S/a/X/ig -S/b/Y/ -c t0030.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/substitutions/t0031.good000066400000000000000000000001621344767411600204730ustar00rootroot00000000000000$ OUT=$(smenu -S/a/A/sg -S/A/a/g t0031.in) Abc aBC AAb aaa 0:07 1:07 2:07 $ $ echo ":$OUT:" :Abc: $ exit 0 smenu-0.9.15/tests/substitutions/t0031.in000077700000000000000000000000001344767411600210642data3ustar00rootroot00000000000000smenu-0.9.15/tests/substitutions/t0031.tst000066400000000000000000000001571344767411600203610ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -S/a/A/sg -S/A/a/g t0031.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tabulating_mode/000077500000000000000000000000001344767411600172525ustar00rootroot00000000000000smenu-0.9.15/tests/tabulating_mode/data1000066400000000000000000000000411344767411600201620ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 smenu-0.9.15/tests/tabulating_mode/data2000066400000000000000000000000411344767411600201630ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 smenu-0.9.15/tests/tabulating_mode/data3000066400000000000000000000001121344767411600201630ustar00rootroot00000000000000ab abc éà ùùù €€€€ §§§§ → ↓ ← ¦¦¦ ßßßxßßß smenu-0.9.15/tests/tabulating_mode/data4000066400000000000000000000000411344767411600201650ustar00rootroot000000000000001 2 3 4 5 6 7 8 9 10 11 12 13 14 smenu-0.9.15/tests/tabulating_mode/data5000066400000000000000000000000401344767411600201650ustar00rootroot00000000000000ab abc éà ùùù €€€€ smenu-0.9.15/tests/tabulating_mode/t0001.good000066400000000000000000000007021344767411600206670ustar00rootroot00000000000000$ OUT=$(smenu -t 4 -w t0001.in) 1 2 3 4 5 6 7 8 19:07 20:07 21:07 22:07 23:07 24:07 25:07 26:07 27:07 28:07 29:07 30:07 31:07 32:07 33:07 34:07 35:07 36:07 9 10 11 12 13 14 $ $ echo ":$OUT:" :6: $ exit 0 smenu-0.9.15/tests/tabulating_mode/t0001.in000077700000000000000000000000001344767411600212562data1ustar00rootroot00000000000000smenu-0.9.15/tests/tabulating_mode/t0001.tst000066400000000000000000000001461344767411600205530ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -t 4 -w t0001.in) \S[150]\s[150]lj\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tabulating_mode/t0002.good000066400000000000000000000001751344767411600206740ustar00rootroot00000000000000$ OUT=$(smenu -t 4 t0002.in) 1 2 3 4 5 6 7 8 3:07 4:07 9 10 11 12 13 14 $ $ echo ":$OUT:" :6: $ exit 0 smenu-0.9.15/tests/tabulating_mode/t0002.in000077700000000000000000000000001344767411600212572data1ustar00rootroot00000000000000smenu-0.9.15/tests/tabulating_mode/t0002.tst000066400000000000000000000001431344767411600205510ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -t 4 t0002.in) \S[150]\s[150]lj\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tabulating_mode/t0003.good000066400000000000000000000004021344767411600206660ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -t 10 t0003.in) ab abc éà ùùù €€€€ §§§§ → ↓ ← 40:07 41:07 42:07 43:07 44:07 45:07 46:07 ¦¦¦ ßßßxßßß $ $ echo ":$OUT:" :§§§§: $ exit 0 smenu-0.9.15/tests/tabulating_mode/t0003.in000077700000000000000000000000001344767411600212622data3ustar00rootroot00000000000000smenu-0.9.15/tests/tabulating_mode/t0003.tst000066400000000000000000000001751344767411600205570ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -t 10 t0003.in) \S[150]\s[150]lllllkkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tabulating_mode/t0004.good000066400000000000000000000004051344767411600206720ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -t 10 -w t0004.in) ab abc éà ùùù €€€€ §§§§ → ↓ ← 40:07 41:07 42:07 43:07 44:07 45:07 46:07 ¦¦¦ ßßßxßßß $ $ echo ":$OUT:" :§§§§: $ exit 0 smenu-0.9.15/tests/tabulating_mode/t0004.in000077700000000000000000000000001344767411600212632data3ustar00rootroot00000000000000smenu-0.9.15/tests/tabulating_mode/t0004.tst000066400000000000000000000002001344767411600205450ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -t 10 -w t0004.in) \S[150]\s[150]lllllkkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tabulating_mode/t0005.good000066400000000000000000000006021344767411600206720ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -t 3 -w t0005.in) ab abc éà 26:07 27:07 28:07 29:07 30:07 31:07 32:07 33:07 34:07 35:07 36:07 37:07 38:07 39:07 40:07 41:07 42:07 43:07 44:07 45:07 46:07 47:07 48:07 49:07 50:07 ùùù €€€€ $ $ echo ":$OUT:" :abc: $ exit 0 smenu-0.9.15/tests/tabulating_mode/t0005.in000077700000000000000000000000001344767411600212662data5ustar00rootroot00000000000000smenu-0.9.15/tests/tabulating_mode/t0005.tst000066400000000000000000000001771344767411600205630ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -t 3 -w t0005.in) \S[150]\s[150]lllllkkk\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tabulating_mode/t0010.good000066400000000000000000000001721344767411600206700ustar00rootroot00000000000000$ OUT=$(smenu -t 9 t0010.in) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3:07 4:07 $ $ echo ":$OUT:" :11: $ exit 0 smenu-0.9.15/tests/tabulating_mode/t0010.in000077700000000000000000000000001344767411600212612data4ustar00rootroot00000000000000smenu-0.9.15/tests/tabulating_mode/t0010.tst000066400000000000000000000001431344767411600205500ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -t 9 t0010.in) \S[150]\s[150]lj\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tagging/000077500000000000000000000000001344767411600155345ustar00rootroot00000000000000smenu-0.9.15/tests/tagging/data1000066400000000000000000000000301344767411600164420ustar00rootroot00000000000000a b c d e f g h u j k l smenu-0.9.15/tests/tagging/data2000066400000000000000000000000201344767411600164420ustar00rootroot00000000000000" a " "b " " c" smenu-0.9.15/tests/tagging/t0001.good000066400000000000000000000001761344767411600171560ustar00rootroot00000000000000$ OUT=$(smenu -T " " t0001.in) a b c d e f g h u j k l 2:04 6:04 8:07 10:04 14:04 $ $ echo ":$OUT:" :b d f h: $ exit 0 smenu-0.9.15/tests/tagging/t0001.in000077700000000000000000000000001344767411600175402data1ustar00rootroot00000000000000smenu-0.9.15/tests/tagging/t0001.tst000066400000000000000000000001611344767411600170320ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -T " " t0001.in) \S[150]\s[150]ltlltlltllthhh\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tagging/t0002.good000066400000000000000000000001761344767411600171570ustar00rootroot00000000000000$ OUT=$(smenu -P " " t0002.in) a b c d e f g h u j k l 2:04 6:04 8:07 10:04 14:04 $ $ echo ":$OUT:" :b d f h: $ exit 0 smenu-0.9.15/tests/tagging/t0002.in000077700000000000000000000000001344767411600175412data1ustar00rootroot00000000000000smenu-0.9.15/tests/tagging/t0002.tst000066400000000000000000000001611344767411600170330ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -P " " t0002.in) \S[150]\s[150]ltlltlltllthhh\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tagging/t0003.good000066400000000000000000000001421344767411600171510ustar00rootroot00000000000000$ OUT=$(smenu -T " " t0003.in) a b c d e f g h u j k l 0:07 $ $ echo ":$OUT:" :a: $ exit 0 smenu-0.9.15/tests/tagging/t0003.in000077700000000000000000000000001344767411600175422data1ustar00rootroot00000000000000smenu-0.9.15/tests/tagging/t0003.tst000066400000000000000000000001701344767411600170340ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -T " " t0003.in) \S[150]\s[150]ltlltlltthhthhthhthht\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tagging/t0004.good000066400000000000000000000001421344767411600171520ustar00rootroot00000000000000$ OUT=$(smenu -P " " t0004.in) a b c d e f g h u j k l 0:07 $ $ echo ":$OUT:" :a: $ exit 0 smenu-0.9.15/tests/tagging/t0004.in000077700000000000000000000000001344767411600175432data1ustar00rootroot00000000000000smenu-0.9.15/tests/tagging/t0004.tst000066400000000000000000000001701344767411600170350ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -P " " t0004.in) \S[150]\s[150]ltlltlltthhthhthhthht\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tagging/t0005.good000066400000000000000000000002211344767411600171510ustar00rootroot00000000000000$ OUT=$(smenu -T\\ue296b8 t0005.in) a b c d e f g h u j k l 0:04 2:07 4:04 6:04 8:04 10:04 $ $ echo ":$OUT:" :a▸c▸d▸e▸f: $ exit 0 smenu-0.9.15/tests/tagging/t0005.in000077700000000000000000000000001344767411600175442data1ustar00rootroot00000000000000smenu-0.9.15/tests/tagging/t0005.tst000066400000000000000000000001751344767411600170430ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -T\\\\ue296b8 t0005.in) \S[150]\s[150]ltlltllththhththhtl\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tagging/t0006.good000066400000000000000000000002211344767411600171520ustar00rootroot00000000000000$ OUT=$(smenu -P\\ue296b8 t0006.in) a b c d e f g h u j k l 0:04 2:07 4:04 6:04 8:04 10:04 $ $ echo ":$OUT:" :d▸f▸e▸c▸a: $ exit 0 smenu-0.9.15/tests/tagging/t0006.in000077700000000000000000000000001344767411600175452data1ustar00rootroot00000000000000smenu-0.9.15/tests/tagging/t0006.tst000066400000000000000000000001751344767411600170440ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -P\\\\ue296b8 t0006.in) \S[150]\s[150]ltlltllththhththhtl\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tagging/t0007.good000066400000000000000000000002021344767411600171520ustar00rootroot00000000000000$ OUT=$(smenu -c -P\\ue296b8 t0007.in) a b c d 6:0407 e f g h u j k l 0:04 2:04 $ $ echo ":$OUT:" :u▸j▸d: $ exit 0 smenu-0.9.15/tests/tagging/t0007.in000077700000000000000000000000001344767411600175462data1ustar00rootroot00000000000000smenu-0.9.15/tests/tagging/t0007.tst000066400000000000000000000002041344767411600170360ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -c -P\\\\ue296b8 t0007.in) \S[150]\s[150]lllltllthhtjtlthhhthhht\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tagging/t0008.good000066400000000000000000000001631344767411600171610ustar00rootroot00000000000000$ OUT=$(smenu -k -P: t0008.in) a b c 0:0407 1:0407 2:0407 7:04 8:04 $ $ echo ":$OUT:" : c: a : $ exit 0 smenu-0.9.15/tests/tagging/t0008.in000077700000000000000000000000001344767411600175502data2ustar00rootroot00000000000000smenu-0.9.15/tests/tagging/t0008.tst000066400000000000000000000001561344767411600170450ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -k -P: t0008.in) \S[150]\s[150]llththtlthh\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tagging/t0009.good000066400000000000000000000001741344767411600171640ustar00rootroot00000000000000$ OUT=$(smenu -c -T " " t0009.in) a b c d e f g h 2:07 4:04 6:04 u j k l 0:04 $ $ echo ":$OUT:" :g h u: $ exit 0 smenu-0.9.15/tests/tagging/t0009.in000077700000000000000000000000001344767411600175502data1ustar00rootroot00000000000000smenu-0.9.15/tests/tagging/t0009.tst000066400000000000000000000001561344767411600170460ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -c -T " " t0009.in) \S[150]\s[150]jjththth\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tagging/t0010.good000066400000000000000000000001751344767411600171550ustar00rootroot00000000000000$ OUT=$(smenu -c -T -p t0010.in) a b c d e f g h 2:07 4:04 6:04 u j k l 0:04 $ $ echo ":$OUT:" :f g h u: $ exit 0 smenu-0.9.15/tests/tagging/t0010.in000077700000000000000000000000001344767411600175402data1ustar00rootroot00000000000000smenu-0.9.15/tests/tagging/t0010.tst000066400000000000000000000001551344767411600170350ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -c -T -p t0010.in) \S[150]\s[150]jjththth\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tagging/t0011.good000066400000000000000000000001741344767411600171550ustar00rootroot00000000000000$ OUT=$(smenu -c -P " " t0011.in) a b c d e f g h 2:07 4:04 6:04 u j k l 0:04 $ $ echo ":$OUT:" :u h g: $ exit 0 smenu-0.9.15/tests/tagging/t0011.in000077700000000000000000000000001344767411600175412data1ustar00rootroot00000000000000smenu-0.9.15/tests/tagging/t0011.tst000066400000000000000000000001561344767411600170370ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -c -P " " t0011.in) \S[150]\s[150]jjththth\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tagging/t0012.good000066400000000000000000000001751344767411600171570ustar00rootroot00000000000000$ OUT=$(smenu -c -P -p t0012.in) a b c d e f g h 2:07 4:04 6:04 u j k l 0:04 $ $ echo ":$OUT:" :u h g f: $ exit 0 smenu-0.9.15/tests/tagging/t0012.in000077700000000000000000000000001344767411600175422data1ustar00rootroot00000000000000smenu-0.9.15/tests/tagging/t0012.tst000066400000000000000000000001551344767411600170370ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -c -P -p t0012.in) \S[150]\s[150]jjththth\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/tagging/t0013.good000066400000000000000000000004121344767411600171520ustar00rootroot00000000000000$ OUT=$(smenu -c -P -N'b|d|g' " " t0013.in) a 1) b c 2) d 7:01 8:01 9:01 10:01 21:01 22:01 23:01 24:01 e f 3) g h 12:07 14:01 15:01 16:01 17:01 19:04 26:04 u j k l 5:04 $ $ echo ":$OUT:" :u h g: $ exit 0 smenu-0.9.15/tests/tagging/t0013.in000077700000000000000000000000001344767411600175432data1ustar00rootroot00000000000000smenu-0.9.15/tests/tagging/t0013.tst000066400000000000000000000001701344767411600170350ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -c -P -N'b|d|g' " " t0013.in) \S[150]\s[150]jjththth\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/test.sh000066400000000000000000000043341344767411600154330ustar00rootroot00000000000000#!/usr/bin/env bash # Find backwards for the directory where test.sh is # """"""""""""""""""""""""""""""""""""""""""""""""" upsearch () { slashes=$(echo $PWD | tr -cd \/) directory="$PWD" n=${#slashes} while [ $n -gt 0 ]; do test -e "$directory/$1" && echo "$directory" && return directory="$directory/.." n=$(expr $n - 1) done } [ -z "$DIR" ] && DIR=$(upsearch test.sh) && export DIR if [ ! -f $1.tst ]; then echo "Unknown test $1" exit 1 fi if [ ! -f $1.in ]; then echo "Unknown input file $1" exit 1 fi LOG=${PWD}.log PTYLIE=${PTYLIE_PATH:+${PTYLIE_PATH}/}ptylie HVLT=${HLVT_PATH:+${HLVT_PATH}/}hlvt BL=$(uname -s).bl # Check for the presence of required programs # """"""""""""""""""""""""""""""""""""""""""" if ! which smenu >/dev/null 2>&1; then echo "smenu was not found, please install it. Aborting." exit 1 fi for PROG in $PTYLIE $HLVT; do if ! which $PROG >/dev/null 2>&1; then echo "The required $PROG program was not found, aborting." exit 1 fi done # Ignore blacklisted tests for this OS. # These tests probably need a fixed version of ptylie to work # """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" if [ -f "$BL" ]; then grep $1 $BL >/dev/null 2>&1 && exit 0 fi # Launch the test # """"""""""""""" clear PS1='$ ' $PTYLIE -i $1.tst -l $1.log -w 80 -h 24 sh $HVLT < $1.log | sed '1,/exit 0/!d' > $1.out rm -f $1.log $1.bad [ -f $LOG ] && touch $LOG # Add the new log entry, # If the .good file exists and the .out and the .good files are identical # then remove the .out file and tag the test as GOOD # else if the .good file does not exist then keep the .out file and tag # the test as UNCHECKED in the log # else the test is a failure and tag it as BAD # """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" if [ -e $1.good ]; then if diff -u $1.out $1.good >/dev/null 2>&1; then ATTR="GOOD " rm $1.out else ATTR="BAD " mv $1.out $1.bad fi else ATTR="UNCHECKED " fi if grep "^$1 " $LOG >/dev/null 2>&1; then RES=$(awk -vt=$1 -vattr="$ATTR" \ '$1 == t {$2 = attr; print t,attr}' $LOG) NEWLOG=$(sed "s/^$1 .*/$RES/" $LOG) [ -n "$NEWLOG" ] && echo "$NEWLOG" > $LOG else echo "$1 $ATTR" >> $LOG fi exit 0 smenu-0.9.15/tests/tests.sh000066400000000000000000000045131344767411600156150ustar00rootroot00000000000000#!/usr/bin/env bash # =========================================================================== # Usage: ./tests.sh [test_directory] # # Is a test_directory is given then the automated testings will be restricted # to the given directory tree # =========================================================================== header1() { printf "%-20s %-5s %s %s\n" Directory Tests States } header2() { printf "%-5s %s %s\n" Tests States } [ -z "$1" ] && TESTDIR="." \ || TESTDIR=$1 [ ! -d $TESTDIR ] && echo "$TESTDIR is not a directory" \ && exit 1 export DIR=${PWD} # Remove the existing .log files # """""""""""""""""""""""""""""" [ "$TESTDIR" == "." ] && rm -f *.log || rm -f ${TESTDIR}.log # Build the list of tests to be performed # """"""""""""""""""""""""""""""""""""""" LIST=$( find $TESTDIR -type f -name 't[0-9][0-9][0-9][0-9].tst' \ | sort ) # Perform the testings # """""""""""""""""""" for INDEX in $LIST; do INDEX=${INDEX#./} SUBDIR=${INDEX%/*} [ $SUBDIR != $INDEX ] && cd $SUBDIR TST=${INDEX##*/} $DIR/test.sh ${TST%.tst} || exit 1 [ $SUBDIR != $INDEX ] && cd - done # Display the results # """"""""""""""""""" echo echo -n "Results" [ "$TESTDIR" != "." ] && echo -n " for the tests in the '$TESTDIR' directory" \ || TESTDIR="" echo : clear RESULTS_BAD=$(grep BAD ${TESTDIR:=*}.log) RESULTS_UNC=$(grep UNCHECKED ${TESTDIR:=*}.log) if [ -z "$RESULTS_BAD" ]; then tput smso echo "All validated tests passed successfully !" tput rmso else tput smso echo "Some tests have failed !" tput rmso if [ -z "$TESTDIR" ]; then header1 printf "%-20s %5s %s\n" $(echo "$RESULTS_BAD" | sed 's/.log:/ /') else header2 printf "%5s %s\n" $(echo "$RESULTS_BAD" | sed 's/.log:/ /') fi echo echo "For each BAD, a diff between the corresponding .bad and .good" echo "files in the specified directory will provide more details on" echo "the failure." fi if [ -n "$RESULTS_UNC" ]; then echo echo "But some tests have not been validated, please provide a .good" echo "file for them. Here is the list:" echo if [ -z "$TESTDIR" ]; then header1 printf "%-20s %5s %s\n" $(echo "$RESULTS_UNC" | sed 's/.log:/ /') else header2 printf "%5s %s\n" $(echo "$RESULTS_UNC" | sed 's/.log:/ /') fi fi echo exit 0 smenu-0.9.15/tests/timeout/000077500000000000000000000000001344767411600156025ustar00rootroot00000000000000smenu-0.9.15/tests/timeout/data1000066400000000000000000000000061344767411600165130ustar00rootroot00000000000000a b c smenu-0.9.15/tests/timeout/t0001.good000066400000000000000000000007111344767411600172170ustar00rootroot00000000000000$ OUT=$(smenu -x cur 5 -- t0001.in) [ 0s before selecting the current highlighted word] 0:01 1:01 2:01 3:01 4:01 5:01 6:01 7:01 8:01 9:01 10:01 11:01 12:01 13:01 14:01 15:01 16:01 17:01 18:01 19:01 20:01 21:01 22:01 23:01 24:01 25:01 26:01 27:01 28:01 29:01 30:01 31:01 32:01 33:01 34:01 35:01 36:01 37:01 38:01 39:01 40:01 41:01 42:01 43:01 44:01 45:01 46:01 47:01 48:01 49:01 50:01 51:01 52:01 53:01 a b c 2:07 $ $ echo ":$OUT:" :b: $ exit 0 smenu-0.9.15/tests/timeout/t0001.in000077700000000000000000000000001344767411600176062data1ustar00rootroot00000000000000smenu-0.9.15/tests/timeout/t0001.tst000066400000000000000000000001571344767411600171050ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -x cur 5 -- t0001.in) \S[150]\s[150]l\S[6000] \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/timeout/t0002.good000066400000000000000000000007111344767411600172200ustar00rootroot00000000000000$ OUT=$(smenu -x cur 5 -- t0002.in) [ 0s before selecting the current highlighted word] 0:01 1:01 2:01 3:01 4:01 5:01 6:01 7:01 8:01 9:01 10:01 11:01 12:01 13:01 14:01 15:01 16:01 17:01 18:01 19:01 20:01 21:01 22:01 23:01 24:01 25:01 26:01 27:01 28:01 29:01 30:01 31:01 32:01 33:01 34:01 35:01 36:01 37:01 38:01 39:01 40:01 41:01 42:01 43:01 44:01 45:01 46:01 47:01 48:01 49:01 50:01 51:01 52:01 53:01 a b c 0:07 $ $ echo ":$OUT:" :a: $ exit 0 smenu-0.9.15/tests/timeout/t0002.in000077700000000000000000000000001344767411600176072data1ustar00rootroot00000000000000smenu-0.9.15/tests/timeout/t0002.tst000066400000000000000000000002021344767411600170750ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -x cur 5 -- t0002.in) \S[150]\s[150]l\S[2000]l\S[2000]hh\S[6000] \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/timeout/t0003.good000066400000000000000000000006611344767411600172250ustar00rootroot00000000000000$ OUT=$(smenu -x q 5 -- t0003.in) [ 0s before quitting without selecting anything] 0:01 1:01 2:01 3:01 4:01 5:01 6:01 7:01 8:01 9:01 10:01 11:01 12:01 13:01 14:01 15:01 16:01 17:01 18:01 19:01 20:01 21:01 22:01 23:01 24:01 25:01 26:01 27:01 28:01 29:01 30:01 31:01 32:01 33:01 34:01 35:01 36:01 37:01 38:01 39:01 40:01 41:01 42:01 43:01 44:01 45:01 46:01 47:01 48:01 49:01 50:01 a b c 2:07 $ $ echo ":$OUT:" :: $ exit 0 smenu-0.9.15/tests/timeout/t0003.in000077700000000000000000000000001344767411600176102data1ustar00rootroot00000000000000smenu-0.9.15/tests/timeout/t0003.tst000066400000000000000000000001551344767411600171050ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -x q 5 -- t0003.in) \S[150]\s[150]l\S[6000] \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/timeout/t0004.good000066400000000000000000000006021344767411600172210ustar00rootroot00000000000000$ OUT=$(smenu -x w 'test\u21' 5 -- t0004.in) [ 0s before selecting the word "test!"] 0:01 1:01 2:01 3:01 4:01 5:01 6:01 7:01 8:01 9:01 10:01 11:01 12:01 13:01 14:01 15:01 16:01 17:01 18:01 19:01 20:01 21:01 22:01 23:01 24:01 25:01 26:01 27:01 28:01 29:01 30:01 31:01 32:01 33:01 34:01 35:01 36:01 37:01 38:01 39:01 40:01 41:01 a b c 2:07 $ $ echo ":$OUT:" :test!: $ exit 0 smenu-0.9.15/tests/timeout/t0004.in000077700000000000000000000000001344767411600176112data1ustar00rootroot00000000000000smenu-0.9.15/tests/timeout/t0004.tst000066400000000000000000000001711344767411600171040ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -x w 'test\\u21' 5 -- t0004.in) \S[150]\s[150]l\S[6000] \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/timeout/t0005.good000066400000000000000000000007111344767411600172230ustar00rootroot00000000000000$ OUT=$(smenu -x cur 5 -- t0005.in) [ 3s before selecting the current highlighted word] 0:01 1:01 2:01 3:01 4:01 5:01 6:01 7:01 8:01 9:01 10:01 11:01 12:01 13:01 14:01 15:01 16:01 17:01 18:01 19:01 20:01 21:01 22:01 23:01 24:01 25:01 26:01 27:01 28:01 29:01 30:01 31:01 32:01 33:01 34:01 35:01 36:01 37:01 38:01 39:01 40:01 41:01 42:01 43:01 44:01 45:01 46:01 47:01 48:01 49:01 50:01 51:01 52:01 53:01 a b c 2:07 $ $ echo ":$OUT:" :b: $ exit 0 smenu-0.9.15/tests/timeout/t0005.in000077700000000000000000000000001344767411600176122data1ustar00rootroot00000000000000smenu-0.9.15/tests/timeout/t0005.tst000066400000000000000000000001611344767411600171040ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -x cur 5 -- t0005.in) \S[150]\s[150]l\S[2000]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/timeout/t0006.good000066400000000000000000000001251344767411600172230ustar00rootroot00000000000000$ OUT=$(smenu -X cur 5 -- t0001.in) a b c 2:07 $ $ echo ":$OUT:" :b: $ exit 0 smenu-0.9.15/tests/timeout/t0006.in000077700000000000000000000000001344767411600176132data1ustar00rootroot00000000000000smenu-0.9.15/tests/timeout/t0006.tst000066400000000000000000000001611344767411600171050ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -X cur 5 -- t0001.in) \S[150]\s[150]l\S[3000]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/utf8/000077500000000000000000000000001344767411600150025ustar00rootroot00000000000000smenu-0.9.15/tests/utf8/FreeBSD.bl000066400000000000000000000000061344767411600165270ustar00rootroot00000000000000t0002 smenu-0.9.15/tests/utf8/data1000066400000000000000000000001071344767411600157150ustar00rootroot000000000000000 1 2 3 4 5 6 7 8 9 10 零/〇 一 二 三 四 五 六 七 八 九 十 smenu-0.9.15/tests/utf8/data2000066400000000000000000000002251344767411600157170ustar00rootroot00000000000000*\u3* *\u0a* *\u34* *\u345* *\u3456* *\uc3*4* *\u45* *\u451* *\u4512* *\u45123* *\u45\u46* *\u451\u46* *\uc3\u45* *\uc3a\u45* *\uefb899\uf0908589* smenu-0.9.15/tests/utf8/data3000066400000000000000000000000441344767411600157170ustar00rootroot00000000000000é\uc3a9€ \uc3a9é€ é€\uc3a9 smenu-0.9.15/tests/utf8/data4000066400000000000000000000000241344767411600157160ustar00rootroot00000000000000EéE€ abc\u45defE smenu-0.9.15/tests/utf8/t0001.good000066400000000000000000000002621344767411600164200ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -c t0001.in) 0 1 2 3 4 5 6 7 8 9 10 零/〇 一 二 三 四 五 六 七 八 九 十 14:07 $ $ echo ":$OUT:" :六: $ exit 0 smenu-0.9.15/tests/utf8/t0001.in000077700000000000000000000000001344767411600170062data1ustar00rootroot00000000000000smenu-0.9.15/tests/utf8/t0001.tst000066400000000000000000000001711344767411600163010ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -c t0001.in) \S[150]\s[150]jllllll\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/utf8/t0002.good000066400000000000000000000003301344767411600164150ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -c t0002.in) *. *\n* *4* *45* *456* *.* 0:07 1:07 2:07 3:07 4:07 *E* *E1* *E12* *E123* *EF* *E1F* *.45* *.u45* *︙𐅉* $ $ echo ":$OUT:" :*.: $ exit 0 smenu-0.9.15/tests/utf8/t0002.in000077700000000000000000000000001344767411600170102data2ustar00rootroot00000000000000smenu-0.9.15/tests/utf8/t0002.tst000066400000000000000000000001621344767411600163020ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -c t0002.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/utf8/t0003.good000066400000000000000000000003361344767411600164240ustar00rootroot00000000000000$ OUT=$(LC_ALL=C smenu -M -m «←→» t0003.in) .... 36:01 37:01 38:01 39:01 ... ... ... 33:07 34:07 35:07 $ $ echo ":$OUT:" :...: $ exit 0 smenu-0.9.15/tests/utf8/t0003.in000077700000000000000000000000001344767411600170122data3ustar00rootroot00000000000000smenu-0.9.15/tests/utf8/t0003.tst000066400000000000000000000001671344767411600163100ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=C smenu -M -m «←→» t0003.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/utf8/t0004.good000066400000000000000000000003761344767411600164310ustar00rootroot00000000000000$ OUT=$(LC_ALL=en_US.UTF-8 smenu -M -m «←→» t0003.in) «←→» 36:01 37:01 38:01 39:01 éé€ éé€ é€é 33:07 34:07 35:07 $ $ echo ":$OUT:" :éé€: $ exit 0 smenu-0.9.15/tests/utf8/t0004.in000077700000000000000000000000001344767411600170132data3ustar00rootroot00000000000000smenu-0.9.15/tests/utf8/t0004.tst000066400000000000000000000002011344767411600162760ustar00rootroot00000000000000\S[150]\s[10]OUT=$(LC_ALL=en_US.UTF-8 smenu -M -m «←→» t0003.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/utf8/t0005.good000066400000000000000000000002571344767411600164300ustar00rootroot00000000000000$ OUT=$(smenu '-I/\u45/\ue29782\ue296b8/g' t0005.in) ◂▸é◂▸€ abc◂▸def◂▸ 0:07 1:07 2:07 3:07 4:07 5:07 $ $ echo ":$OUT:" :◂▸é◂▸€: $ exit 0 smenu-0.9.15/tests/utf8/t0005.in000077700000000000000000000000001344767411600170152data4ustar00rootroot00000000000000smenu-0.9.15/tests/utf8/t0005.tst000066400000000000000000000001751344767411600163110ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu '-I/\\u45/\\ue29782\\ue296b8/g' t0005.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/utf8/t0006.good000066400000000000000000000002531344767411600164250ustar00rootroot00000000000000$ OUT=$(smenu '-I/E/\ue29782\ue296b8/g' t0006.in) ◂▸é◂▸€ abc◂▸def◂▸ 0:07 1:07 2:07 3:07 4:07 5:07 $ $ echo ":$OUT:" :◂▸é◂▸€: $ exit 0 smenu-0.9.15/tests/utf8/t0006.in000077700000000000000000000000001344767411600170162data4ustar00rootroot00000000000000smenu-0.9.15/tests/utf8/t0006.tst000066400000000000000000000001701344767411600163050ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu '-I/E/\\ue29782\\ue296b8/g' t0006.in) \S[150]\s[150]\r \S[150]\s[10]echo ":$\s[10]OUT:" exit 0 smenu-0.9.15/tests/word_separators/000077500000000000000000000000001344767411600173325ustar00rootroot00000000000000smenu-0.9.15/tests/word_separators/data1000066400000000000000000000000401344767411600202410ustar00rootroot00000000000000abc»def»ghi» »jkl»mno»pqr smenu-0.9.15/tests/word_separators/t0001.good000066400000000000000000000001661344767411600207530ustar00rootroot00000000000000$ OUT=$(smenu -W» t0001.in) abc def ghi \n jkl mno pqr\n 12:07 13:07 $ $ printf "%s\n" ":$OUT:" :\n: $ exit 0 smenu-0.9.15/tests/word_separators/t0001.in000066400000000000000000000000401344767411600204200ustar00rootroot00000000000000abc»def»ghi» »jkl»mno»pqr smenu-0.9.15/tests/word_separators/t0001.tst000066400000000000000000000001561344767411600206340ustar00rootroot00000000000000\S[150]\s[10]OUT=$(smenu -W» t0001.in) \S[150]\s[150]lll\r \S[150]\s[10]printf "%s\\n" ":$\s[10]OUT:" exit 0 smenu-0.9.15/usage.c000066400000000000000000000166751344767411600142410ustar00rootroot00000000000000/* *************** */ /* Usage functions */ /* *************** */ #include #include #include #include "usage.h" /* =================== */ /* Short usage display */ /* =================== */ void short_usage(int must_exit) { printf("\nUsage: smenu [-h|-?] [-f config_file] [-n [lines]] "); printf("[-t [cols]] [-k] [-v] \\\n"); printf(" [-s pattern] [-m message] [-w] [-d] [-M] [-c] [-l] "); printf("[-r] [-b] \\\n"); printf(" [-a prefix:attr [prefix:attr]...] "); printf("[-i regex] [-e regex] \\\n"); printf(" [-C [i|e]] "); printf("[-R [i|e]] \\\n"); printf(" [-S /regex/repl/[g][v][s][i]] "); printf("[-I /regex/repl/[g][v][s][i]] \\\n"); printf(" [-E /regex/repl/[g][v][s][i]] "); printf("[-A regex] [-Z regex] \\\n"); printf(" [-N [regex]] [-U [regex]] [-F] [-D arg...] "); printf(" \\\n"); printf(" [-1 regex [attr]] [-2 regex [attr]]... "); printf("[-5 regex [attr]] [-g [string]] \\\n"); printf(" [-q] [-W bytes] [-L bytes] [-T [separator]] "); printf("[-P [separator]] [-p] \\\n"); printf(" [-V] [-x|-X current|quit|word [] "); printf("] \\\n"); printf(" [-/ prefix|substring|fuzzy] [--] [input_file]\n\n"); printf(" ::= col1[-col2]...|...\n"); printf(" ::= row1[-row2]...|...\n"); printf(" ::= i|e|c|b|s|m|t|ct|sf|st|mf|mt|"); printf("sfe|ste|mfe|mte|da\n"); printf(" ::= [l|r:]|[a:l|r]|[p:i|a]|"); printf("[w:]|\n"); printf(" [f:y|n]|[o:[+]]|[n:]|"); printf("[i:]|[d:]|\n"); printf(" [s:]|[h:t|c|k]\n"); printf(" Ex: l:'(' a:l\n"); printf(" ::= [fg][/bg][,style] \n"); printf(" Ex: 7/4,bu\n"); printf(" ::= regex \n"); printf(" Ex: /regex/ or :regex:\n\n"); printf(" and can be freely mixed "); printf("when used\n"); printf(" with -C and -R (ex: 2,/x/,4-5).\n\n"); if (must_exit) exit(EXIT_FAILURE); } /* ====================== */ /* Usage display and exit */ /* ====================== */ void usage(void) { short_usage(0); printf("This is a filter that gets words from stdin "); printf("and outputs the selected\n"); printf("words (or nothing) on stdout in a nice selection "); printf("window\n\n"); printf("The selection window appears on /dev/tty "); printf("immediately after the current line\n"); printf("(no clear screen!).\n\n"); printf("The following options are available:\n\n"); printf("-h displays this help.\n"); printf("-f selects an alternative configuration file.\n"); printf("-n sets the number of lines in the selection window.\n"); printf("-t tabulates the items. The number of columns can be limited " "with\n"); printf(" an optional number.\n"); printf("-k does not trim spaces surrounding the output string if any.\n"); printf("-v makes the bell visual (fuzzy search with error).\n"); printf("-s sets the initial cursor position (read the manual for " "more details).\n"); printf("-m displays a one-line message above the window.\n"); printf("-w uses all the terminal width for the columns if their numbers " "is given.\n"); printf("-d deletes the selection window on exit.\n"); printf("-M centers the display if possible.\n"); printf("-c is like -t without argument but respects end of lines.\n"); printf("-l is like -c without column alignments.\n"); printf("-r enables ENTER to validate the selection even in " "search mode.\n"); printf("-b displays the non printable characters as space.\n"); printf("-a sets the attributes for the various displayed "); printf("elements.\n"); printf("-i sets the regex input filter to match the selectable words.\n"); printf("-e sets the regex input filter to match the non-selectable " "words.\n"); printf("-C sets columns restrictions for selections.\n"); printf("-R sets rows restrictions for selections.\n"); printf("-S sets the post-processing action to apply to all words.\n"); printf("-I sets the post-processing action to apply to selectable " "words only.\n"); printf("-E sets the post-processing action to apply to non-selectable " "words only.\n"); printf("-A forces a class of words to be the first of the line they " "appear in.\n"); printf("-Z forces a class of words to be the latest of the line they " "appear in.\n"); printf("-N/-U numbers/un-numbers and provides a direct access to words " "matching\n"); printf(" (or not) a specific regex.\n"); printf("-F numbers and provides a direct access to words by extracting the " "number\n"); printf(" from the words.\n"); printf("-D sets sub-options to modify the behaviour of -N, -U and -F.\n"); printf("-1,-2,...,-5 gives specific colors to up to 5 classes of " "selectable words.\n"); printf("-g separates columns with a character in column or tabulate " "mode.\n"); printf("-q prevents the display of the scroll bar.\n"); printf("-W sets the input words separators.\n"); printf("-L sets the input lines separators.\n"); printf("-T/-P enables the tagging (multi-selections) mode. "); printf("An optional parameter\n"); printf(" sets the separator string between the selected words "); printf("on the output.\n"); printf(" A single space is the default separator.\n"); printf("-p activates the auto-tagging when using -T or -P.\n"); printf("-V displays the current version and quits.\n"); printf("-x|-X sets a timeout and specifies what to do when it expires.\n"); printf("-/ changes the affectation of the / key (default fuzzy search).\n"); printf("\nNavigation keys are:\n"); printf(" - Left/Down/Up/Right arrows or h/j/k/l, H/J/K/L.\n"); printf(" - Home/End, SHIFT|CTRL+Home/End CTRK+J/CTRL+K.\n"); printf(" - Numbers if some words are numbered (-N/-U/-F).\n"); printf(" - SPACE to search for the next match of a previously\n"); printf(" entered search prefix if any, see below.\n\n"); printf("Other useful keys are:\n"); printf(" - Help key (temporary display of a short help line): " "?\n"); printf(" - Exit key without output (do nothing) : " "q\n"); printf(" - Tagging keys: Select/Deselect/Toggle : " "INS/DEL/t\n"); printf(" - Selection key : " "ENTER\n"); printf(" - Cancel key : " "ESC\n"); printf(" - Search key : " "/ or CTRL-F\n\n"); printf("The search key activates a timed search mode in which\n"); printf("you can enter the first letters of the searched word.\n"); printf("When entering this mode you have 7s to start typing\n"); printf("and each entered letter gives you 5 more seconds before\n"); printf("the timeout. After that the search mode is ended.\n\n"); printf("Notes:\n"); printf("- the timer can be cancelled by pressing ESC.\n"); printf("- a bad search letter can be removed with "); printf("CTRL-H or Backspace.\n\n"); printf("(C) Pierre Gentile (2015).\n\n"); exit(EXIT_FAILURE); } smenu-0.9.15/usage.h000066400000000000000000000005461344767411600142340ustar00rootroot00000000000000/* ########################################################### */ /* This Software is licensed under the GPL licensed Version 2, */ /* please read http://www.gnu.org/copyleft/gpl.html */ /* ########################################################### */ #ifndef USAGE_H #define USAGE_H void short_usage(int must_exit); void usage(void); #endif smenu-0.9.15/utf8.c000066400000000000000000000313001344767411600140010ustar00rootroot00000000000000/* ########################################################### */ /* This Software is licensed under the GPL licensed Version 2, */ /* please read http://www.gnu.org/copyleft/gpl.html */ /* ########################################################### */ /* ************************************ */ /* Various UTF-8 manipulation functions */ /* ************************************ */ #include #include #include #include #include #include #include #include "xmalloc.h" #include "utf8.h" /* ======================================================================== */ /* Unicode (UTF-8) ascii representation interpreter. */ /* The string passed will be altered but will not move in memory */ /* All sequence of \uxx, \uxxxx, \uxxxxxx and \uxxxxxxxx will be replace by */ /* the corresponding UTF-8 character. */ /* ======================================================================== */ void utf8_interpret(char * s, langinfo_t * langinfo) { char * utf8_str; /* \uxx... */ size_t utf8_to_eos_len; /* bytes in s starting from the first * * occurrence of \u */ size_t init_len; /* initial lengths of the string to interpret */ size_t utf8_ascii_len; /* 2,4,6 or 8 bytes */ size_t len_to_remove = 0; /* number of bytes to remove after the conversion */ char tmp[9]; /* temporary string */ /* Guard against the case where s is NULL */ /* """""""""""""""""""""""""""""""""""""" */ if (s == NULL) return; init_len = strlen(s); while ((utf8_str = strstr(s, "\\u")) != NULL) { utf8_to_eos_len = strlen(utf8_str); if (utf8_to_eos_len < 4) /* string too short to contain * * a valid UTF-8 char */ { *utf8_str = '.'; *(utf8_str + 1) = '\0'; } else /* s is long enough */ { unsigned byte; char * utf8_seq_offset = utf8_str + 2; /* Get the first 2 utf8 bytes */ *tmp = *utf8_seq_offset; *(tmp + 1) = *(utf8_seq_offset + 1); *(tmp + 2) = '\0'; /* If they are invalid, replace the \u sequence by a dot */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""" */ if (!isxdigit(tmp[0]) || !isxdigit(tmp[1])) { *utf8_str = '.'; if (4 >= utf8_to_eos_len) *(utf8_str + 1) = '\0'; else memmove(utf8_str, utf8_str + 4, utf8_to_eos_len - 4); return; } else { /* They are valid, deduce from them the length of the sequence */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ sscanf(tmp, "%2x", &byte); utf8_ascii_len = utf8_get_length(byte) * 2; /* Check again if the inputs string is long enough */ /* """"""""""""""""""""""""""""""""""""""""""""""" */ if (utf8_to_eos_len - 2 < utf8_ascii_len) { *utf8_str = '.'; *(utf8_str + 1) = '\0'; } else { /* replace the \u sequence by the bytes forming the UTF-8 char */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ size_t i; *tmp = byte; /* Put the bytes in the tmp string */ /* ''''''''''''''''''''''''''''''' */ if (langinfo->utf8) { for (i = 1; i < utf8_ascii_len / 2; i++) { sscanf(utf8_seq_offset + 2 * i, "%2x", &byte); *(tmp + i) = byte; } tmp[utf8_ascii_len / 2] = '\0'; } /* Does they form a valid UTF-8 char? */ /* '''''''''''''''''''''''''''''''''' */ if (langinfo->utf8 && utf8_validate(tmp, utf8_ascii_len / 2)) { /* Put them back in the original string and move */ /* the remaining bytes after them */ /* ''''''''''''''''''''''''''''''''''''''''''''' */ memmove(utf8_str, tmp, utf8_ascii_len / 2); if (utf8_to_eos_len < utf8_ascii_len) *(utf8_str + utf8_ascii_len / 2 + 1) = '\0'; else memmove(utf8_str + utf8_ascii_len / 2, utf8_seq_offset + utf8_ascii_len, utf8_to_eos_len - utf8_ascii_len - 2 + 1); } else { /* The invalid sequence is replaced by a dot */ /* ''''''''''''''''''''''''''''''''''''''''' */ *utf8_str = '.'; if (utf8_to_eos_len < utf8_ascii_len) *(utf8_str + 1) = '\0'; else memmove(utf8_str + 1, utf8_seq_offset + utf8_ascii_len, utf8_to_eos_len - utf8_ascii_len - 2 + 1); utf8_ascii_len = 2; } } /* Update the number of bytes to remove at the end */ /* of the initial string */ /* """"""""""""""""""""""""""""""""""""""""""""""" */ len_to_remove += 2 + utf8_ascii_len / 2; } } } /* Make sure that the string is well terminated */ /* """""""""""""""""""""""""""""""""""""""""""" */ *(s + init_len - len_to_remove) = '\0'; return; } /* ========================================================= */ /* Decode the number of bytes taken by a character (UTF-8) */ /* It is the length of the leading sequence of bits set to 1 */ /* (Count Leading Ones) */ /* ========================================================= */ int utf8_get_length(unsigned char c) { if (c < 0x80) return 1; else if (c < 0xe0) return 2; else if (c < 0xf0) return 3; else return 4; } /* ================================================== */ /* Return the byte offset of the nth UTF-8 glyph in s */ /* ================================================== */ size_t utf8_offset(char * s, size_t n) { size_t i = 0; while (n > 0) { if (s[i++] & 0x80) { (void)(((s[++i] & 0xc0) != 0x80) || ((s[++i] & 0xc0) != 0x80) || ++i); } n--; } return i; } /* ============================================== */ /* Points to the previous UTF-8 glyph in a string */ /* from the given position */ /* ============================================== */ char * utf8_prev(const char * str, const char * p) { while ((*p & 0xc0) == 0x80) p--; for (--p; p >= str; --p) { if ((*p & 0xc0) != 0x80) return (char *)p; } return NULL; } /* ========================================== */ /* Points to the next UTF-8 glyph in a string */ /* from the current position */ /* ========================================== */ char * utf8_next(char * p) { if (*p) { for (++p; (*p & 0xc0) == 0x80; ++p) ; } return (*p == '\0' ? NULL : p); } /* ============================================================ */ /* Replace any UTF-8 glyph present in s by a dot in-place */ /* s will be modified but its address in memory will not change */ /* ============================================================ */ void utf8_sanitize(char * s) { char * p = s; int n; size_t len; len = strlen(s); while (*p) { n = utf8_get_length(*p); if (n > 1) { *p = '.'; memmove(p + 1, p + n, len - (p - s) - n + 1); len -= (n - 1); } p++; } } static const char trailing_bytes_for_utf8[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5 }; /* ================================================================== */ /* UTF-8 validation routine inspired by Jeff Bezanson */ /* placed in the public domain Fall 2005 */ /* (https://github.com/JeffBezanson/cutef8) */ /* */ /* Returns 1 if str contains a valid UTF-8 byte sequence, 0 otherwise */ /* ================================================================== */ int utf8_validate(const char * str, size_t length) { const unsigned char *p, *pend = (const unsigned char *)str + length; unsigned char c; size_t ab; for (p = (const unsigned char *)str; p < pend; p++) { c = *p; if (c < 128) continue; if ((c & 0xc0) != 0xc0) return 0; ab = trailing_bytes_for_utf8[c]; if (length < ab) return 0; length -= ab; p++; /* Check top bits in the second byte */ /* """"""""""""""""""""""""""""""""" */ if ((*p & 0xc0) != 0x80) return 0; /* Check for overlong sequences for each different length */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""" */ switch (ab) { /* Check for xx00 000x */ /* """"""""""""""""""" */ case 1: if ((c & 0x3e) == 0) return 0; continue; /* We know there aren't any more bytes to check */ /* Check for 1110 0000, xx0x xxxx */ /* """""""""""""""""""""""""""""" */ case 2: if (c == 0xe0 && (*p & 0x20) == 0) return 0; break; /* Check for 1111 0000, xx00 xxxx */ /* """""""""""""""""""""""""""""" */ case 3: if (c == 0xf0 && (*p & 0x30) == 0) return 0; break; /* Check for 1111 1000, xx00 0xxx */ /* """""""""""""""""""""""""""""" */ case 4: if (c == 0xf8 && (*p & 0x38) == 0) return 0; break; /* Check for leading 0xfe or 0xff, */ /* and then for 1111 1100, xx00 00xx */ /* """"""""""""""""""""""""""""""""" */ case 5: if (c == 0xfe || c == 0xff || (c == 0xfc && (*p & 0x3c) == 0)) return 0; break; } /* Check for valid bytes after the 2nd, if any; all must start 10 */ /* """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ while (--ab > 0) { if ((*(++p) & 0xc0) != 0x80) return 0; } } return 1; } /* ====================== */ /* Multibyte UTF-8 strlen */ /* ====================== */ size_t utf8_strlen(char * str) { size_t i = 0, j = 0; while (str[i]) { if ((str[i] & 0xc0) != 0x80) j++; i++; } return j; } /* =================================================================== */ /* Multibytes extraction of the prefix of n UTF-8 glyphs from a string */ /* The destination string d must have been allocated before. */ /* pos is updated to reflect the position AFTER the prefix. */ /* =================================================================== */ char * utf8_strprefix(char * d, char * s, long n, long * pos) { long i = 0; long j = 0; *pos = 0; while (s[i] && j < n) { d[i] = s[i]; i++; j++; while (s[i] && (s[i] & 0xC0) == 0x80) { d[i] = s[i]; i++; } } *pos = i; d[i] = '\0'; return d; } /* ================================================ */ /* Convert a UTF-8 glyph string to a wchar_t string */ /* ================================================ */ wchar_t * utf8_strtowcs(char * s) { int converted = 0; unsigned char * ch; wchar_t * wptr, *w; size_t size; size = (long)strlen(s); w = xmalloc((size + 1) * sizeof(wchar_t)); w[0] = L'\0'; wptr = w; for (ch = (unsigned char *)s; *ch; ch += converted) { if ((converted = mbtowc(wptr, (char *)ch, 4)) > 0) wptr++; else { *wptr++ = (wchar_t)*ch; converted = 1; } } *wptr = L'\0'; return w; } /* ============================================================== */ /* Fill dst whi a lowercase ocopy of src whar the character is an */ /* ascci one. dsk must be preallocated before the call. */ /* ============================================================== */ void utf8_strtolower(char * dst, char * src) { unsigned char c; while ((c = *src)) { if (c >= 0x80) *dst = c; else *dst = tolower(c); src++; dst++; } *dst = '\0'; } smenu-0.9.15/utf8.h000066400000000000000000000017371344767411600140210ustar00rootroot00000000000000/* ########################################################### */ /* This Software is licensed under the GPL licensed Version 2, */ /* please read http://www.gnu.org/copyleft/gpl.html */ /* ########################################################### */ #ifndef UTF8_H #define UTF8_H typedef struct langinfo_s langinfo_t; /* Locale informations */ /* """"""""""""""""""" */ struct langinfo_s { int utf8; /* charset is UTF-8 */ int bits; /* number of bits in the charset */ }; int utf8_get_length(unsigned char c); size_t utf8_offset(char *, size_t); char * utf8_strprefix(char * d, char * s, long n, long * pos); size_t utf8_strlen(char * str); wchar_t * utf8_strtowcs(char * s); void utf8_sanitize(char * s); void utf8_interpret(char * s, langinfo_t * langinfo); int utf8_validate(const char * str, size_t length); char * utf8_prev(const char * str, const char * p); char * utf8_next(char * p); void utf8_strtolower(char * dst, char * src); #endif smenu-0.9.15/utils.c000066400000000000000000000145331344767411600142640ustar00rootroot00000000000000/* ########################################################### */ /* This Software is licensed under the GPL licensed Version 2, */ /* please read http://www.gnu.org/copyleft/gpl.html */ /* ########################################################### */ /* ******************************* */ /* Various small utility functions */ /* ******************************* */ #include "config.h" #include #include #include #include #include #include "xmalloc.h" #include "list.h" #include "utils.h" /* ****************** */ /* Interval functions */ /* ****************** */ /* ===================== */ /* Create a new interval */ /* ===================== */ interval_t * interval_new(void) { interval_t * ret = xmalloc(sizeof(interval_t)); return ret; } /* ====================================== */ /* Compare 2 intervals as integer couples */ /* same return values as for strcmp */ /* ====================================== */ int interval_comp(void * a, void * b) { interval_t * ia = (interval_t *)a; interval_t * ib = (interval_t *)b; if (ia->low < ib->low) return -1; if (ia->low > ib->low) return 1; if (ia->high < ib->high) return -1; if (ia->high > ib->high) return 1; return 0; } /* ================================ */ /* Swap the values of two intervals */ /* ================================ */ void interval_swap(void * a, void * b) { interval_t * ia = (interval_t *)a; interval_t * ib = (interval_t *)b; long tmp; tmp = ia->low; ia->low = ib->low; ib->low = tmp; tmp = ia->high; ia->high = ib->high; ib->high = tmp; } /* ===================================================================== */ /* Merge the intervals from an interval list in order to get the minimum */ /* number of intervals to consider. */ /* ===================================================================== */ void merge_intervals(ll_t * list) { ll_node_t * node1, *node2; interval_t *data1, *data2; if (!list || list->len < 2) return; else { /* Step 1: sort the intervals list */ /* """"""""""""""""""""""""""""""" */ ll_sort(list, interval_comp, interval_swap); /* Step 2: merge the list by merging the consecutive intervals */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ node1 = list->head; node2 = node1->next; while (node2) { data1 = (interval_t *)(node1->data); data2 = (interval_t *)(node2->data); if (data1->high >= data2->low - 1) { /* Interval 1 overlaps interval 2 */ /* '''''''''''''''''''''''''''''' */ if (data2->high >= data1->high) data1->high = data2->high; ll_delete(list, node2); free(data2); node2 = node1->next; } else { /* No overlap */ /* '''''''''' */ node1 = node2; node2 = node2->next; } } } } /* ***************** */ /* Strings functions */ /* ***************** */ /* ========================================================================= */ /* Allocate memory and safely concatenate strings. Stolen from a public */ /* domain implementation which can be found here: */ /* http://openwall.info/wiki/people/solar/software/public-domain-source-code */ /* ========================================================================= */ char * concat(const char * s1, ...) { va_list args; const char * s; char * p, *result; size_t l, m, n; m = n = strlen(s1); va_start(args, s1); while ((s = va_arg(args, char *))) { l = strlen(s); if ((m += l) < l) break; } va_end(args); if (s || m >= INT_MAX) return NULL; result = (char *)xmalloc(m + 1); memcpy(p = result, s1, n); p += n; va_start(args, s1); while ((s = va_arg(args, char *))) { l = strlen(s); if ((n += l) < l || n > m) break; memcpy(p, s, l); p += l; } va_end(args); if (s || m != n || p != result + n) { free(result); return NULL; } *p = 0; return result; } /* =============================================== */ /* Is the string str2 a prefix of the string str1? */ /* =============================================== */ int strprefix(char * str1, char * str2) { while (*str1 != '\0' && *str1 == *str2) { str1++; str2++; } return *str2 == '\0'; } /* ======================= */ /* Trim leading characters */ /* ======================= */ void ltrim(char * str, const char * trim_str) { size_t len = strlen(str); size_t begin = strspn(str, trim_str); size_t i; if (begin > 0) for (i = begin; i <= len; ++i) str[i - begin] = str[i]; } /* ================================================= */ /* Trim trailing characters */ /* The resulting string will have at least min bytes */ /* even if trailing spaces remain. */ /* ================================================= */ void rtrim(char * str, const char * trim_str, size_t min) { size_t len = strlen(str); while (len > min && strchr(trim_str, str[len - 1])) str[--len] = '\0'; } /* ========================================= */ /* Case insensitive strcmp */ /* from http://c.snippets.org/code/stricmp.c */ /* ========================================= */ int my_strcasecmp(const char * str1, const char * str2) { #ifdef HAVE_STRCASECMP return strcasecmp(str1, str2); #else int retval = 0; while (1) { retval = tolower(*str1++) - tolower(*str2++); if (retval) break; if (*str1 && *str2) continue; else break; } return retval; #endif } /* =========================================== */ /* memmove based strcpy (tolerates overlaping) */ /* =========================================== */ char * my_strcpy(char * str1, char * str2) { if (str1 == NULL || str2 == NULL) return NULL; memmove(str1, str2, strlen(str2) + 1); return str1; } /* =============================== */ /* 7 bits aware version of isprint */ /* =============================== */ int isprint7(int i) { return (i >= 0x20 && i <= 0x7e); } /* =============================== */ /* 8 bits aware version of isprint */ /* =============================== */ int isprint8(int i) { unsigned char c = i & (unsigned char)0xff; return (c >= 0x20 && c < 0x7f) || (c >= (unsigned char)0xa0); } smenu-0.9.15/utils.h000066400000000000000000000021011344767411600142550ustar00rootroot00000000000000/* ########################################################### */ /* This Software is licensed under the GPL licensed Version 2, */ /* please read http://www.gnu.org/copyleft/gpl.html */ /* ########################################################### */ #ifndef UTILS_H #define UTILS_H typedef struct interval_s interval_t; typedef struct range_s range_t; struct interval_s { long low; long high; }; /* Structure used by the replace function to delimit matches */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""" */ struct range_s { size_t start; size_t end; }; interval_t * interval_new(void); int interval_comp(void * a, void * b); void interval_swap(void * a, void * b); void merge_intervals(ll_t * list); char * concat(const char * str1, ...); int strprefix(char * str1, char * str2); void ltrim(char * str, const char * trim); void rtrim(char * str, const char * trim, size_t min_len); int my_strcasecmp(const char * str1, const char * str2); char * my_strcpy(char * dst, char * src); int isprint7(int i); int isprint8(int i); #endif smenu-0.9.15/version000066400000000000000000000000071344767411600143570ustar00rootroot000000000000000.9.15 smenu-0.9.15/xmalloc.c000066400000000000000000000052711344767411600145620ustar00rootroot00000000000000/* *************************** */ /* Memory management functions */ /* *************************** */ /* Created by Kevin Locke (from numerous canonical examples) */ /* */ /* Adapted for use by smenu */ /* */ /* I hereby place this file in the public domain. It may be freely */ /* reproduced, distributed, used, modified, built upon, or otherwise */ /* employed by anyone for any purpose without restriction. */ /* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */ #include #include #include #include #include "xmalloc.h" /* ================= */ /* Customized malloc */ /* ================= */ void * xmalloc(size_t size) { void * allocated; size_t real_size; real_size = (size > 0) ? size : 1; allocated = malloc(real_size); if (allocated == NULL) { fprintf(stderr, "Error: Insufficient memory (attempt to malloc %lu bytes)\n", (unsigned long int)size); exit(EXIT_FAILURE); } return allocated; } /* ================= */ /* Customized calloc */ /* ================= */ void * xcalloc(size_t n, size_t size) { void * allocated; n = (n > 0) ? n : 1; size = (size > 0) ? size : 1; allocated = calloc(n, size); if (allocated == NULL) { fprintf(stderr, "Error: Insufficient memory (attempt to calloc %lu bytes)\n", (unsigned long int)size); exit(EXIT_FAILURE); } return allocated; } /* ================== */ /* Customized realloc */ /* ================== */ void * xrealloc(void * p, size_t size) { void * allocated; allocated = realloc(p, size); if (allocated == NULL && size > 0) { fprintf(stderr, "Error: Insufficient memory (attempt to xrealloc %lu bytes)\n", (unsigned long int)size); exit(EXIT_FAILURE); } return allocated; } /* =================================== */ /* strdup implementation using xmalloc */ /* =================================== */ char * xstrdup(const char * p) { char * allocated; allocated = xmalloc(strlen(p) + 1); strcpy(allocated, p); return allocated; } /* ================================================== */ /* strndup implementation using xmalloc */ /* This version guarantees that there is a final '\0' */ /* ================================================== */ char * xstrndup(const char * str, size_t len) { char * p; p = memchr(str, '\0', len); if (p) len = p - str; p = xmalloc(len + 1); memcpy(p, str, len); p[len] = '\0'; return p; } smenu-0.9.15/xmalloc.h000066400000000000000000000003601344767411600145610ustar00rootroot00000000000000#ifndef XMALLOC_H #define XMALLOC_H void * xmalloc(size_t size); void * xcalloc(size_t num, size_t size); void * xrealloc(void * ptr, size_t size); char * xstrdup(const char * p); char * xstrndup(const char * str, size_t len); #endif