pax_global_header00006660000000000000000000000064147770207510014524gustar00rootroot0000000000000052 comment=df595a3c71ac9df8b50855e4f90e86b2d2f769a9 kbtin-2.3/000077500000000000000000000000001477702075100124775ustar00rootroot00000000000000kbtin-2.3/.builds/000077500000000000000000000000001477702075100140375ustar00rootroot00000000000000kbtin-2.3/.builds/alpine.yml000066400000000000000000000006241477702075100160340ustar00rootroot00000000000000image: alpine/edge packages: - cmake - perl - gnutls-dev - zlib-dev - vectorscan-dev sources: - https://git.sr.ht/~kilobyte/kbtin tasks: - configure: cd kbtin && cmake . - build: cd kbtin && make -j$(getconf _NPROCESSORS_ONLN) - test: cd kbtin && ctest -j$(getconf _NPROCESSORS_ONLN) --output-on-failure triggers: - action: email condition: failure to: kilobyte@angband.pl kbtin-2.3/.cirrus.yml000066400000000000000000000050301477702075100146050ustar00rootroot00000000000000freebsd_13_task: freebsd_instance: image: freebsd-13-2-release-amd64 install_script: pkg install -y cmake gnutls perl5 build_script: - cmake . - make -j$(getconf _NPROCESSORS_ONLN) test_script: # run tests as user "cirrus" instead of root - pw useradd cirrus -m - chown -R cirrus:cirrus . - ctest -j$(getconf _NPROCESSORS_ONLN) --output-on-failure macos_x_task: macos_instance: image: ghcr.io/cirruslabs/macos-ventura-base:latest install_script: - brew update - brew install cmake gnutls zlib build_script: - cmake . - make -j$(getconf _NPROCESSORS_ONLN) test_script: ctest -j$(getconf _NPROCESSORS_ONLN) --output-on-failure ubuntu_amd64_task: container: image: ubuntu:jammy install_script: - apt-get update - DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade - DEBIAN_FRONTEND=noninteractive apt-get -y install cmake libgnutls28-dev libz-dev libhyperscan-dev valgrind build_script: - cmake . - make -j$(getconf _NPROCESSORS_ONLN) test_script: ctest -j$(getconf _NPROCESSORS_ONLN) --output-on-failure debian_i386_task: container: image: debian:bookworm install_script: - dpkg --add-architecture i386 - apt-get update - DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade - DEBIAN_FRONTEND=noninteractive apt-get -y install cmake gcc-i686-linux-gnu libc6:i386 libgnutls28-dev:i386 libz-dev:i386 build_script: - cmake -DCMAKE_C_COMPILER=i686-linux-gnu-gcc . - make -j$(getconf _NPROCESSORS_ONLN) test_script: ctest -j$(getconf _NPROCESSORS_ONLN) --output-on-failure ubuntu_arm64_task: arm_container: image: ubuntu:jammy install_script: - apt-get update - DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade - DEBIAN_FRONTEND=noninteractive apt-get -y install cmake libgnutls28-dev libz-dev valgrind libvectorscan-dev build_script: - cmake . - make -j$(getconf _NPROCESSORS_ONLN) test_script: ctest -j$(getconf _NPROCESSORS_ONLN) --output-on-failure #ubuntu_armhf_task: # arm_container: # image: ubuntu:jammy # install_script: # - dpkg --add-architecture armhf # - apt-get update # - DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade # - DEBIAN_FRONTEND=noninteractive apt-get -y install cmake gcc-arm-linux-gnueabihf libc6:armhf libgnutls28-dev:armhf libz-dev:armhf # build_script: # - cmake -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc . # - make -j$(getconf _NPROCESSORS_ONLN) # test_script: # ctest -j$(getconf _NPROCESSORS_ONLN) --output-on-failure kbtin-2.3/.gitattributes000066400000000000000000000000251477702075100153670ustar00rootroot00000000000000VERSION export-subst kbtin-2.3/.github/000077500000000000000000000000001477702075100140375ustar00rootroot00000000000000kbtin-2.3/.github/workflows/000077500000000000000000000000001477702075100160745ustar00rootroot00000000000000kbtin-2.3/.github/workflows/codeql.yml000066400000000000000000000046521477702075100200750ustar00rootroot00000000000000name: "CodeQL" on: push: branches: [ "master" ] pull_request: # The branches below must be a subset of the branches above branches: [ "master" ] schedule: - cron: '29 11 * * 4' jobs: analyze: name: Analyze runs-on: ubuntu-latest permissions: actions: read contents: read security-events: write strategy: fail-fast: false matrix: language: [ 'cpp' ] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - name: Checkout repository uses: actions/checkout@v3 - name: Install B-Deps run: | sudo apt-get update sudo apt-get -y install cmake libgnutls28-dev libz-dev libhyperscan-dev # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. # By default, queries listed here will override any specified in a config file. # Prefix the list here with "+" to use these queries and those in the config file. # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # queries: security-extended,security-and-quality # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild uses: github/codeql-action/autobuild@v2 # ℹ️ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun # If the Autobuild fails above, remove it and uncomment the following three lines. # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. # - run: | # echo "Run, Build Application using script" # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 with: category: "/language:${{matrix.language}}" kbtin-2.3/.github/workflows/coverity.yml000066400000000000000000000012171477702075100204640ustar00rootroot00000000000000name: Coverity scan on: push: branches: [coverity] jobs: coverity: runs-on: ubuntu-latest steps: - name: Update apt run: sudo apt-get update -qq - name: Install dependencies run: sudo apt-get install -y cmake libgnutls28-dev libz-dev libhyperscan-dev - uses: actions/checkout@v3 - name: cmake run: cmake -B ${{github.workspace}}/build - uses: vapier/coverity-scan-action@v1 with: email: ${{ secrets.COVERITY_SCAN_EMAIL }} token: ${{ secrets.COVERITY_SCAN_TOKEN }} command: make -C ${{github.workspace}}/build kbtin-2.3/.github/workflows/email.yml000066400000000000000000000017761477702075100177210ustar00rootroot00000000000000on: check_suite: type: ['completed'] name: Email about Cirrus CI failures jobs: continue: name: After Cirrus CI Failure if: github.event.check_suite.app.name == 'Cirrus CI' && github.event.check_suite.conclusion != 'success' runs-on: ubuntu-latest steps: - uses: octokit/request-action@v2.x id: get_failed_check_run with: route: GET /repos/${{ github.repository }}/check-suites/${{ github.event.check_suite.id }}/check-runs?status=completed mediaType: '{"previews": ["antiope"]}' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | echo "Cirrus CI ${{ github.event.check_suite.conclusion }} on ${{ github.event.check_suite.head_branch }} branch!" echo "SHA ${{ github.event.check_suite.head_sha }}" echo $MESSAGE echo "##[error]See $CHECK_RUN_URL for details" && false env: CHECK_RUN_URL: ${{ fromJson(steps.get_failed_check_run.outputs.data).check_runs[0].html_url }} kbtin-2.3/.gitignore000066400000000000000000000006611477702075100144720ustar00rootroot00000000000000.#* *~ *.gcov *.o *.orig CMakeCache.txt CMakeFiles/ CTestTestfile.cmake KBtin KBtin_help.gz Makefile Testing/ VERSION cmake_install.cmake commands.h config.h kbtin kbtin-*.tar.xz load_commands.h manual.html protos protos.h tests/get-utf8 tests/kbitr tests/ttyrec2ansi valgrind.* ################################################## # put packaging ignores below to avoid conflicts # ################################################## kbtin-2.3/AUTHORS000066400000000000000000000011061477702075100135450ustar00rootroot00000000000000Original author: Peter Unold Older coders: Bill Reiss David A. Wagner Joann Ellsworth Jeremy C. Jack Ulan@GrimneMUD David Hedbor (neotron@lysator.liu.se) Sverre Norman Branched to KBtin: Adam Borowski (kilobyte@angband.pl) Porting code from HappyTin: Jakub Narębski Current developer: Adam Borowski -- and this is where bug reports, ideas, beer and peanuts should go. kbtin-2.3/BUGS000066400000000000000000000010541477702075100131620ustar00rootroot00000000000000* spawned pseudoterminal (on #run) is not checked for echo on/off * undocumented feature: ~-1~ -- document it? remove at all? change? * --More-- kludge -- do it in a non-kludgy way * need a README * {#var color ~7~;#var color} shows {} -- it shouldn't get interpreted * TELNET negotiations of echo can break either Genesis and Arkadia MUDs when done one way, or real telnet servers when done the other one. Hrm. * tintin's messages should use ~7~, not the previous colour, while still preserving whatever the colour was * no bidi support kbtin-2.3/CMakeLists.txt000066400000000000000000000121451477702075100152420ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.8.12...3.27) if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12) cmake_policy(SET CMP0075 NEW) # hush the warning, either option works endif() if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19) cmake_policy(SET CMP0110 NEW) endif() project(kbtin C) include(CheckIncludeFiles) include(CheckLibraryExists) include(CheckFunctionExists) include(CheckSymbolExists) include(FindIconv) include(FindGnuTLS) include(GNUInstallDirs) unset(VERSION) execute_process(COMMAND ./get_version OUTPUT_VARIABLE SRCVERSION WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_STRIP_TRAILING_WHITESPACE ) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "RelWithDebInfo") endif (NOT CMAKE_BUILD_TYPE) option(MCCP "MCCP compression via zlib" ON) option(SSL "SSL encryption via gnutls" ON) set(DATA_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/kbtin" CACHE PATH "Directory for data (currently help file)") set(CMAKE_C_FLAGS "-Wall -Werror=format-security ${CMAKE_C_FLAGS}") set(libs m) CHECK_INCLUDE_FILES(pty.h HAVE_PTY_H) CHECK_INCLUDE_FILES(libutil.h HAVE_LIBUTIL_H) CHECK_INCLUDE_FILES(util.h HAVE_UTIL_H) CHECK_LIBRARY_EXISTS(util openpty "" HAVE_LIB_UTIL) if (HAVE_LIB_UTIL) set(CMAKE_REQUIRED_LIBRARIES util) set(libs ${libs} util) endif() CHECK_LIBRARY_EXISTS(hs hs_compile "" HAVE_HS) option(SIMD "fast pattern matching via hyperscan" ${HAVE_HS}) CHECK_INCLUDE_FILES(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H) CHECK_INCLUDE_FILES(termios.h HAVE_TERMIOS_H) CHECK_INCLUDE_FILES(stropts.h HAVE_STROPTS_H) CHECK_FUNCTION_EXISTS(openpty HAVE_OPENPTY) CHECK_FUNCTION_EXISTS(regcomp HAVE_REGCOMP) CHECK_FUNCTION_EXISTS(grantpt HAVE_GRANTPT) CHECK_FUNCTION_EXISTS(getpt HAVE_GETPT) CHECK_FUNCTION_EXISTS(ptsname HAVE_PTSNAME) CHECK_FUNCTION_EXISTS(forkpty HAVE_FORKPTY) CHECK_FUNCTION_EXISTS(cfmakeraw HAVE_CFMAKERAW) CHECK_FUNCTION_EXISTS(_getpty HAVE__GETPTY) CHECK_FUNCTION_EXISTS(posix_openpt HAVE_POSIX_OPENPT) CHECK_FUNCTION_EXISTS(strlcpy HAVE_STRLCPY) CHECK_FUNCTION_EXISTS(wcwidth HAVE_WCWIDTH) CHECK_SYMBOL_EXISTS(getentropy "unistd.h" HAVE_GETENTROPY) if(Iconv_FOUND) include_directories(SYSTEM ${Iconv_INCLUDE_DIRS}) set(libs ${libs} ${Iconv_LIBRARY}) else() message(FATAL_ERROR "libiconv is required") endif() if (MCCP) CHECK_LIBRARY_EXISTS(z gzread "" HAVE_LIB_ZLIB) if (NOT HAVE_LIB_ZLIB) message(FATAL_ERROR "MCCP compression requires zlib ('cmake . -DMCCP=off' to disable)") endif() set(HAVE_ZLIB 1) set(libs ${libs} z) else() unset(HAVE_ZLIB) endif() if (SSL) if (NOT GNUTLS_FOUND) message(FATAL_ERROR "SSL encryption requires libgnutls ('cmake . -DSSL=off' to disable") endif() set(HAVE_GNUTLS 1) include_directories(SYSTEM ${GNUTLS_INCLUDE_DIR}) set(libs ${libs} ${GNUTLS_LIBRARIES}) else() unset(HAVE_GNUTLS) endif() if (SIMD) if (NOT HAVE_HS) message(FATAL_ERROR "SIMD requires hyperscan/vectorscan") endif() set(CMAKE_REQUIRED_LIBRARIES hs) set(libs ${libs} hs) set(HAVE_SIMD 1) else() unset(HAVE_SIMD) endif() configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h) include_directories(${CMAKE_BINARY_DIR}) set(KBtin_sources action.c alias.c antisub.c files.c glob.c help.c highlight.c history.c eval.c main.c misc.c net.c parse.c path.c session.c substitute.c ticks.c utils.c string.c events.c user.c run.c colors.c routes.c bind.c telnet.c hash.c regexp.c hooks.c unicode.c user_pipe.c user_tty.c wcwidth.c chinese.c print.c ssl.c pty.c globals.c math.c slist.c lists.c vars.c tlist.c mudcolors.c ratelimit.c ) set(protos ${KBtin_sources}) list(TRANSFORM protos REPLACE "([^;]*)\\.c" "${CMAKE_BINARY_DIR}/protos/\\1.h") add_custom_command(OUTPUT ${protos} COMMAND ${CMAKE_SOURCE_DIR}/make_protos ${CMAKE_SOURCE_DIR} ${KBtin_sources} DEPENDS make_protos ${KBtin_sources} COMMENT "PROTOS") add_custom_target(protos DEPENDS ${protos}) add_custom_command(OUTPUT commands.h load_commands.h COMMAND ${CMAKE_SOURCE_DIR}/make_commands <${CMAKE_SOURCE_DIR}/commands DEPENDS commands make_commands COMMENT "COMMANDS") add_custom_target(gen_commands DEPENDS commands.h load_commands.h) add_executable(KBtin ${KBtin_sources}) add_dependencies(KBtin protos gen_commands) target_link_libraries(KBtin ${libs}) add_custom_command(OUTPUT manual.html DEPENDS KBtin_help COMMAND ${CMAKE_SOURCE_DIR}/help2ansi <${CMAKE_SOURCE_DIR}/KBtin_help|${CMAKE_SOURCE_DIR}/a2html|${CMAKE_SOURCE_DIR}/fixmanual >manual.html COMMENT "HTML MANUAL") add_custom_target(manual ALL DEPENDS manual.html) add_custom_command(OUTPUT KBtin_help.gz DEPENDS KBtin_help COMMAND gzip -9 <${CMAKE_SOURCE_DIR}/KBtin_help >KBtin_help.gz COMMENT "GZIP HELP") add_custom_target(helpgz ALL DEPENDS KBtin_help.gz) add_custom_command(OUTPUT kbtin DEPENDS KBtin COMMAND ln -s KBtin kbtin COMMENT "SYMLINK KBTIN") add_custom_target(symlink_kbtin ALL DEPENDS kbtin) install(TARGETS KBtin DESTINATION bin) install(FILES KBtin.6 kbtin.6 DESTINATION ${CMAKE_INSTALL_MANDIR}/man6) install(FILES ${CMAKE_BINARY_DIR}/KBtin_help.gz DESTINATION ${DATA_PATH}) install(FILES ${CMAKE_BINARY_DIR}/manual.html DESTINATION ${CMAKE_INSTALL_DOCDIR}) install(FILES ${CMAKE_BINARY_DIR}/kbtin DESTINATION bin) enable_testing() add_subdirectory(tests) kbtin-2.3/COPYING000066400000000000000000000431051477702075100135350ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin St, 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 Library 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. GNU GENERAL PUBLIC LICENSE 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 St, 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 Library General Public License instead of this License. kbtin-2.3/ChangeLog000066400000000000000000000525411477702075100142600ustar00rootroot000000000000002.3: * reworked SSL security, requiring validly signed certs. For the old model, append "save". * time-based commands accept compound units like {1h 20m 10.5s} * periodic #delay * labelled #delay auto-removes previous instances * #inputcolor allows configuring the input bar * #ratelimit * #stretch 2.2: * #colorize/#highlight can apply partial changes (like, setting background without altering foreground, underline, etc) * remote charset defaults to #UTF-8 * tabs are allowed in places where spaces are expected * .bz3 logging * #deleteitems allows multiple patterns * #unroute with a single argument to delete both ways * display something in a new session before some text comes * use MPTCP if available * #strwidth (#strlen that ignores color codes) * #info shows session duration * #mudcolors ANSI * bugfix: #mudcolors affected all sessions * #colorize {} for canonicalizing color codes * bugfix: file descriptor exhaustion if a session fails to connect over a thousand times * bugfix: some #substitute messaging * bugfix: input bar was sometimes brightened * bugfix: lock-up on unary minus * #shift 2.1: * bugfix: patterns with %1$ and matching an empty string * reworked action matching code, speedup w/ many priorities 2.0: * MASSIVE increase of speed of substs/actions/highlights * [COMPAT BREAK] substs/actions apply variables immediately * new optional dep: hyperscan/vectorscan * new optional dep: valgrind * (inline) #abs * (inline) #round * (command) #reverselist * (command) #findevents * (command) #findvariables * (hook) logclose * log files are locked while in use * bugfix: promptactions were not saved * #tickon can take an offset * no limit on route locations * control characters are caught and shown as Unicode symbols 1.0.26: * fix tests on ancient cmake * support key codes on Zutty * #sqrt * fix #condump * bugfixes for math issues 1.0.25: * CMake based build system * #zap * #trim * colors behave as attributes not text in #substr #prepad #postpad * #stty * avoid wasting a line if there's no partial-line prompt * lots of bugfixes * lots of code reorg to add new bugs 1.0.24: * 256-color support (instead of shoehorning to 16) * auto-set #char only on first read * #ifaliasexists * fractional math * // for fractional division * % for modulo * sub-second time handling * make $_time work as documented * $TIME, $STARTTIME, $TIMETOTICK, $RANDOM, $LINENUM, $USERIFLE * drop #profile * free everything if running on valgrind * use a faster data structure, for #antisub only for now * trigonometry: #sin #cos #angle * bugfix: an expression with >100 tokens * #bold * bugfix: key codes were misinterpreted inside "screen" * #unvar on multiple variables 1.0.23: * display error message for why a connection was dropped * support bright background colors user-side * protect against unpaired/underflowing {} in $1 type variables * allow anchoring the end of an action/substitute match (^foo$) * documentation improvements * internal: don't replace malloc anymore (glib is actually slower now) * internal: drop a lot of obsolete autoconfage 1.0.22: * bugfix: user-after-free after #zap inside a hook * bugfix: positional %vars were broken 1.0.21: * logging to .zstd * #hook tick, pretick * #unvar {var1 var2 var3} * #firstlower * more keys recognized by #bind (esp. Alt-key) * skip no-change statusbar updates * drop #news 1.0.20: * speed up some string operations * fix accessing files via ~user * recognize MidArrow on some terminals * fix cross-building * move the homepage from SourceForge to GitHub 1.0.19: * fix way too bright handling of 256-color codes * fix a crash on interrupted-by-signal writes * don't bother advertising #news * fix building from git on MacOS X 1.0.18: * lots of internal cleanups * idle/serveridle in #info * assorted minor fixes * password star-out doesn't stay for multiple lines * log-handling tools have been split out 1.0.17: * pipetty, a new tool to fool isatty() * 256/24-bit color support, full in ansi2html, shoehorned to 16/8 colors in KBtin * ansi2html: massively improved support for other attributes * ansi2html -n (headerless), -w (on white) * ansi2html: unhandled control characters get Unicode placeholders * support for overstrike as ~8::~ * #hook title * #sendchar * $SERVERIDLE pseudovar * portability fixes on *BSD and Hurd 1.0.16: * #initvar * bugfix: xterm titles were ignored * processing speed in #info * bugfix: proper F1-F4 and KpadMinus on xterm/gnome-terminal/konsole * TCP keepalives every 30 seconds rather than 5 minutes * bugfix: ansi2html rendered white as black * dropped support for non-GNU make 1.0.15: * #loginputformat * TCP keepalives * bugfix: crashes when resizing the terminal window 1.0.14: * logging to .xz * proper handling of long lines when screen width changes * don't include soft line wrapping in #condump * omit the greeting message (credits, etc) in #condump 1.0.13: * handle broken terminals which report screen size of 0x0 a bit better * increase several fixed limits * bugfix: crash if a session is closed from an event or tick * drop support for single byte only compilation * yTin's pseudovars: _random, _time, _clock, _msec, HOME * #ctoi for Chinese numbers, taken from yTin * start month and yday from 1, not 0 (#localtime, #gmtime) * fix compilation without zlib. Fail such compilation with a help message if --disable-mccp is not given. * auto-remake function prototypes * bugfix: UTF-8 chars split by a packet boundary were mangled in the log. * SSL support (#sslsession). 1.0.12: * #localtime, #gmtime * bugfix: segfault on MCCP end (not exploitable) * bugfix: active session changes inside of compound commands didn't propagate properly * another stab at gnome-terminal and blue lines... * ansi2html: skip a character on unknown codes * necrocomputing -- support for BSD's iconv brain damage. Hey, guys, it's 2008, even _SCO_ does basic POSIX. * new BSD has grantpt() but no getpt() or /dev/ptmx, handle this 1.0.11: * bugfix: don't double the asterisks when typing in a password * turn PARTIAL_LINE_MARKER into a variable (not settable yet) * bugfix: -r starting with a non-letter * work around gnome-terminal's blue lines 1.0.10: * more transliterations, mostly for line-drawing characters * support for Form Feed and ANSI CLS * support for CJK double-width chars (TTY driver) * TTY driver: combining chars on output, still buggy on input * CJK and combining chars in #substr, #postpad and #prepad * bugfix: #prepad took the end not start of the string, as opposed to what the documentation said * use glib's g_slice instead of malloc if it's installed, it's insanely faster * allow "weeks" in #time * re-written from scratch ansi2html, using CSS instead of tables * bugfix: input and #logcomment were mangled in ttyrec logs * new #mess type: logging 1.0.9: * #ord as inline * MCCP compression * workaround for a gnome-terminal bug * 'make bin' target 1.0.8: * in the dumb terminal mode, "assphrase:" will trigger password protection as well * bare \r will turn the line into a draft, and thus cause it to be cleared when some new text appears * bugfix: pathologic action priorities were ordered wrong * #doactions, #dopromptactions * #chr, #ord, #hexord, bugfixes in UTF-8 parsing * bugfix: #textin with an empty line 1.0.7: * end-of-file ends KBtin when in non-fullscreen UI and no sessions are left * explicit -q or #verbose 0 hushes #read * UTF-8 support; likely to be buggy and/or incomplete (massive change) * IPv6 support * UI drivers support (specify -p or -i on command line) * some basic regression tests * #read ignores #! on the first line * history is no longer local to a session 1.0.6a: * bugfix: variables were not resolved in #log 1.0.6: * made commands case-insensitive, so #ALIAS works * bugfix: the priority of "6a" is supposed to come before "60" * made KBtin a more responsive to keyboard input when under a heavy load * #gagthis * made "#system something &" actually work * intelligent use of TCP_NODELAY * add a hook for closing KBtin for sessions started with -r/-s which didn't make any use of #hook * bugfix: #listlength * logging by >, >> and | * #condump won't insert unneeded background colour codes anymore * logging to .bz2 * #logtype * bugfix: highlights prevented prompts from being recognized as such * moved to automake1.9 1.0.5: * added a symlink kbtin -> KBtin to avoid mixed-case executable name while retaining old name as well * \e[39m, \e[49m * manual.html (just a converted version of the online help) * commands that don't work on an architecture are no longer accessible * outgoing 0xff bytes are sent as IAC IAC telnet sequences * the terminal string will cycle between "KBtin", "hardcopy", "unknown" and "KBtin-1.0.4" (conforming to RFC 1091) * if you undefine UI_FULLSCREEN in tintin.h, KBtin will be pipe- friendly; for use as a scripting language or for regression tests * telnet EOR sequences are allowed and treated as GAs * bugfix: unterminated TELNET IAC SB subnegotiations no longer cause a buffer overflow * bugfix: sometimes TELNET sequences were not carried properly over a packet boundary * cleaned up command line parsing, added -q, -c, -s and -r * a (too short) manpage added * axed the old BSD license with advertising clause from acinclude.m4, the only snippet we use is in public domain * window title in xterms * #undelay as an alias for #remove=#unevent * bugfix: \e[K and \e[D used to swallow some text * core dumps will now be properly generated when appropriate * #pretick * some tintin++ 1.86 compatibility: * #ifexists * #ifstrequal (=#strcmp) * #show_pretick (=#pretick) * bugfix: no more corrupted logs when KBtin gets killed by a SIGINT (^C) or a SIGHUP (disconnect) * \e[J clears the current line (\e[1J and \e[2J still don't work ok) * bugfix: #grep's regexp can now contain variables * terminal size data is now passed to the pseudo-terminals * bugfix: hangup if >29 sessions (oh well... :p) * bugfix: #act {blah} {#unact *} no longer causes an infinite loop * inlines: #grep, #match, #strcmp * pty handling code changed * consider \r to be an end-of-line char in #read, for M$-DOS files * workaround for dorky bg color handling in PuTTY and screen. Will slow down innocent xterm users, too :( * information about logging in #info * the echo for player's input has its own color (#define ECHO_COLOR) * #collate * #expand * #hook/#unhook * all (?) flags are saved by #write and #writesession * You can use #delay with a delay of 0. * log only commands explicitly typed by the player * #logcomment * Use exec when invoking something using /bin/sh 1.0.4: * changes needed to compile on Tru64: * no "extern inline" * \e -> \033 * autoconf checks to test whether the code for inlined functions is actually generated * changes needed to compile on Cygwin: * checking for stropts.h Note: As opposed to UNIX systems, which all enjoy the whole functionality, KBtin is crippled on Win32 systems. Basically, while the core functionality works, #run, #system, #shell, #keypad, #suspend, gzip logging and COMPRESSED_HELP are broken. Hell, it won't even compile from the sources without your manipulation right now (no autoconf check to disable COMPRESSED_HELP). * #grep * #retain 1.0.3: * bugfix: color codes in programs spawned by #systems work correctly once again * removed Esc from editing keys * made it possible to #bind sequences containing Alt * added Alt-{<,>,B,F,L,U,C,Backspace,T} to the editing keys * #gauge renamed to #timecommand, and documented * bugfix: don't use pclose(), as we're not using real popen() * bugfix: #reverse 1.0.2: * bugfix: #send with no session * #gauge * #debuglog (not officially introduced as it's not finished yet) * bugfix: some commands ignored variables * proper handling of IAC IAC sequences * bugfix: '# {command}' sent verbatim {}s. * bugfix: #message types were not propagated correctly to new sessions, that could crash KBtin * Nazi protection against too deep recursion. * bugfix: #path did something completely different than the docs said * added italic and underline as valid "colors" * when a session is started, it will inherit all settings from the currently active session instead of the null session 1.0.1: * a slight change of the logic of highlights being suppressed before/after alphanumeric characters * don't disagree when a server tells us they want to turn on echo, some MUDs take offense if we do * IRIX64 has no snprintf, cope with that 1.0.0: * first public release * the message prompting to read #news is disabled for this version 0.4.5: * man pages for ansi2txt and ansi2html * added ^P, ^N and ^U to the editing keys * $IDLETIME * #change * added tab as a valid separator between command and its arguments * changed all(?) error messages to use tintin_eprintf() instead of tintin_printf(). If "#message error" is on, eprintf will pierce even the !#verbose gag. * added ^A, ^E, ^F, ^B, ^T, ^K, ^W and ^Y, changed behavior of ^D on non-empty lines * bugfix: undefined non-alphabetic variables no longer cause expressions to fail * #send added in place of #verbatim , so no #verbatim is not overloaded any longer * bugfix: resizing the window or using #status no longer screws up the display on SunOS * proper signal handling for systems where signals follow System V semantics * added support for BSD-style pseudoterminals, needed for run.c to compile on BSD systems 0.4.4: * #dogoto * bugfix: #ticksize 0, #ticksize 123blah * bugfix: #gag with invalid syntax was handled incorrectly * removed #strip, it was completely useless * bugfix: {* /}, {+ -}, {<= < > >=} evaluate correctly now * renamed log2{html,txt} to ansi2{html,txt} and actually bundled them with KBtin 0.4.3: * action/promptaction priorities are sorted in a semi-lexicographic order, so numbers sort properly * new #message type: error (to show error messages even if they would be otherwise hidden) * #verbose * the following flags are now local to sessions: verbose, verbatim, blank, echo, speedwalk, togglesub, presub and the #message toggles * shell-style "!!" history commands will now obey #verbatim 0.4.2: * bugfix: #writeses doesn't forget about pathdirs anymore * bugfix: #killall doesn't forget about binds (+plus a memory leak) * hash tables instead of lists for: variables, aliases, binds and pathdirs * #unpathdir * bugfix: lines of background color no longer appear on the screen * the list of commands is no longer hardcoded as a looong list of is_abrev()s; we use a generated hash table of code pointers instead * KBtin_help is now distributed in uncompressed form * protection against division by zero in #math and friends 0.4.1: * bugfix: #cr doesn't send two lines instead of one any longer * #atoi * #verbatim * #strcmp 0.4.0: * TELNET protocol support. KBtin understands the following options: - ECHO (we attempt to turn off their echo) - SUPPRESS GO AHEAD - TERMINAL-TYPE (type sent is "KBtin") - NAWS (window size updated every SIGWINCH) * catching SIGCONT to redraw screen after being stopped * --More-- kludge. We now hide the input line by default once the remote end tells us to turn echo off, to protect passwords on non-English MUDs. * "make install" will install NEWS and KBtin_help.gz * TERM environment option in #run passed as "KBtin" 0.3.9: * multiple config files given from command-line when invoking KBtin * #sub {a} {b} works as old #sub {%1a%2} {%1b%2} * substitutes can trigger multiple times in a single line (#sub {a} {b} on "hahahaha" -> "hbhbhbhb") * bugfix: #action no longer segfaults * bugfix: changing the routes while in #goto won't crash KBtin anymore (we use the old data) * we send \r\n instead of \n, for compatibility with the telnet protocol (only for real sockets, of course) * the NEWS file is statted to tell if KBtin was updated since the last time you read it. BUG: the check will fail if several users share the same copy of KBtin 0.3.8: * changed tintin_puts2 to tintin_printf through the whole source * more verbose error messages in most cases * bugfix: #verbatim can be used in the middle of an alias * incomplete lines are no longer considered prompts if the background color is non-black at the end * promptactions fire on "blank" with nothing but spaces and colorcodes only if they're complete -- to prevent expensive processing of highlights and substituties * optimized set_variable * buffer-overflow checks in most functions * aborting commands in case of a buffer overflow (incomplete!) * #match doesn't substitute old values of variables in its command anymore (use $$1 to get them) * bugfix: #delay can be called from events without events disappearing * bugfix: write errors while logging no longer crash KBtin * #condump can dump log to a .gz file * changed configure.in to work with newer versions of autoconf * ESC[m properly recognized as ESC[0m * #shell * bugfix: \line before creating a session was improperly echoed * bugfix: tab (ASCII 09) characters no longer screw up linewrap * help.c now uses mypopen instead of popen to hide "Broken pipe" messages * workaround for systems with no *n*printf * ignoring errors on ioctl(TIOCSWINSZ) 0.3.7: * & added to the list of possible prompt chars * #sortlist * bugfix: no more segfaults in #write * #match * messages from successful calls of #system can be disabled by #mess #system * lines are joined together in #read only in case of a tintin-command * #decolorize 0.3.6: * parse.c didn't check for #unpromptaction! Aargh! * #char now accepts also ASCII characters >127 * all bindable keys scroll screen to the bottom of output * #gag and #ungag no longer touch regular substitutes * promptactions fire on complete lines as well * a quirk in VT100 standard: \n as 81th character in line should be ignored * bugfix: ${varname} with positional variables in varname * #dosubstitutes * #dohighlights * incomplete lines ending with one of: ?:>.*$#] are considered prompts and left there if the user types something * local echo shows color codes intact instead of changing color text * #run now sets the pseudo-terminal modes correctly. This means no double-echoing unless a stupid program like telnet changes the modes. * bugfix: #zap doesn't (hopefully) leave zombie processes anymore * tilde conversion in filenames: "~/" = home dir, "~user/" = user's home dir * #if substituted variables in its command part too early 0.3.5: * most commands substitute variables in their args * #help checks also the dir where KBtin binary resides * #removeevent can be used to remove #delays * #event and #unevent as other names for #delay and #remove * bugfix: #foreach no longer prepends space to implicit arguments 0.3.4: * KBtin now compiles with -Wall with almost no warnings (save for those related to ioctl and pseudo-terminals) * delayed variable substitution - FINALLY!!! * #foreach can now use positional parameters instead of simple append * spaces between the command and first argument are not ignored if it's a MUD command * statistics from multiple #reads are combined into one * split-line in #read * #map works again only on #pathdirs * bugfix: cannot delete the same action twice * bugfix: deleting an alias being executed 0.3.3: * $COLS and $LINES pseudovariables will give you the terminal size * >place as a shortcut for $loc>place * spaces before the command are no longer ignored * #strlen command and inline * #map now doesn't ignore commands which are not among #pathdirs * #log now works properly if already logging * variable names can now contain digits and underscores * events no longer ignore '#message events' turned off (duh!) * #explode and #implode commands * #substr instead of #index * $PATH pseudovariable * help file added 0.3.2: * #index uses now 1-based indices (for consistency with other commands) * #select and old #foreach removed - variable names shouldn't be used for storing values! * #foreach command: iterating through a list * bugfix: #suspend now deals properly with terminal settings * bugfix: #system no longer screws up display if the command writes anything to the screen * #boss - removed, the input line will give you away anyway * #write and #writesession now write #gag instead of #substitute {-gag-} * bugfix: ~~ is no longer considered a color code 0.3.1: * ~fg:bg:blink~ color codes * ESC[nC * #promptaction command added * splitting long lines coming from MUD to prevent buffer overflows 0.3.0: * background and blink color codes (0..255) * rewriting last line of output to make actions guaranteed * more flexible time format * portable implementation of run.c 0.2.9: * #margin command added * actions, delays and binds ignore #verbatim * bugfix: ^D now works ok in #verbatim mode * #bind command added * bugfix: #blank should now work properly, fixing this bug improved KBtin's speed about twice BTW :-) * incoming ~n~ codes are changed to `n~ instead of working as a colorcode * unused listnode->pr fields now use 0 instead of allocating a string just to put "0" there (that was a waste of memory) 0.2.8a: * gz-logging 0.2.8: * bugfix: [Esc] works again * #write and #writesession now support routes * #writesession now writes also changed aliases/actions/whatsoever * multi-color highlights 0.2.7: * KBtin no longer uses the ncurses library! (major rewrite of user.c) 0.2.6: * fixed bug in simplify_list when an item is a single character Ex.: #splitlist head tail {a b c d} * fixed bug if an argument of an alias has embedded braces Ex.: #alias aa {#showme $1} aa {{a b} c d} * bugfix: #verbatim no longer crashes KBtin * no longer removing braces from the tail of the list in #splitlist Ex.: iterating through list 'a {b c} d e {f g}' * #deleteitems command added kbtin-2.3/FAQ000066400000000000000000000027271477702075100130410ustar00rootroot00000000000000Q: Is there a Windows version? A: Not officially. While KBtin is known to work on CygWin, that's not an officially supported platform, and don't expect KBtin to be as functional, fast and stable as on real UNIX systems. Your mileage may wary, but executing KBtin from an already running CygWin shell tends to give the best effects. Features that are known to cause problems are #keypad, #suspend, COMPRESSED_HELP, and (when running as a standalone process) #run, #system, #shell and .gz logging. Q: Will MXP or be implemented? A: No. While these protocols can be used for interesting stuff, they suffer from several design flaws that make it possible on MUDs which don't implement these protocols to crash any clients that use them. Believe me, you don't want to see someone crashing you (or even worse, taking over control!) by simply sending you a specially crafted tell. Q: Why KBtin doesn't auto-save my aliases and other things? A: Without some form of GUI, your settings would be pretty unmanageable if dumped all together into a single file in a random order. It is a lot better to have your scripts edited with a text editor outside KBtin and then read using #read. Once you have more than a bunch of aliases/actions/whatever, you will probably want to modularize by #reading multiple files from a master file. Or, you can ignore the above, and simply: #hook close {#write myconfig} kbtin-2.3/KBtin.6000066400000000000000000000042551477702075100136030ustar00rootroot00000000000000.TH KBtin 6 2007-09-04 KBtin KBtin .SH NAME KBtin \- a MUD client and an environment for line-based programs .SH SYNOPSIS .B KBtin [ .I -v ] [ .I scriptfile [ .I scriptfile2 \&... ]] .SH DESCRIPTION .B KBtin is a MUD client based on the venerable .B tintin++ ; however it has uses beyond playing MUDs. .br A few commands (try #help for the full list): .TP .BI #session " " sesname " " hostname " " port Starts a new session. The .I sesname is a nickname of the new session, and doesn't play any important role. KBtin will open a telnet connection to the given .I hostname : .IR port . .TP .BI #run " " sesname " " command Starts a new session by running a local command. In particular, you can use it to start an encrypted connection by .IR "#run foo ssh foo.bar.baz" . .TP .BI #help " " command Gives you the help on .IR command. .TP .B #verbatim Disables all input parsing, making all text pass as-is. Features such as scrollback, highlights, logging, keybindings or actions continue to work. .TP .B #end Exits KBtin and returns you to your shell. .SH OPTIONS .TP .B -v Shows the processing done by all subsequent uses of .IR #read . Equivalent to .IR "#verbose 1" . .TP .B -q Turns off the output from .IR #read . Equivalent to .IR "#verbose 0" . .TP .I "scriptname" Processes the commands in .IR scriptname , using .IR "#read scriptname" . .TP .BI -c " " "command" Executes a single command. (Note: beware of the evil shell and escape '#'s!) .TP .BI -s " " "host" " " "port" Starts a new session by opening a TELNET connection to the given host on the given port. KBtin will make up a session name for you. .TP .BI -S " " "host" " " "port" Same, except that SSL encryption will be used. .TP .BI -r " " "shell_command" Starts a new session by starting a local process. The process will be opened in a pseudo-terminal, making it interactive. The session name will be made up by KBtin. .TP .BI -p Selects the "pipe" driver (default if stdin or stdout is not a terminal). .TP .BI -i Selects the full interactive tty driver (usual default). .TP .BI --no-simd Disables accelerated pattern matching even if supported; you should never have a need to specify this option. .SH "SEE ALSO" .BR ansi2txt , .BR ansi2html . kbtin-2.3/KBtin_help000066400000000000000000002177051477702075100144550ustar00rootroot00000000000000 ******************************************** *********** KBtin commands ************* ******************************************** System commands: end suspend system shell Session management: session run zap all snoop sslsession Input/output: verbatim char echo history cr mudcolors blank speedwalk showme status margins bell send sendchar charset bold inputcolor Aliases: alias unalias ifaliasexists shift Triggers: action unaction ignore promptaction unpromptaction hook unhook doactions dopromptactions Substitutions: substitute unsubstitute antisubstitute unantisubstitute highlight unhighlight gag ungag togglesub presub dosubstitutes dohighlights change gagthis Information: help info messages version Input: bind unbind keypad retain Control statements: if loop foreach match strcmp grep ifexists Files: condump deathlog log logtype logcomment logcharset unlink read textin verbose write writesession loginputformat Comments: nop remark Variables: math random variable unvariable initvariable sin cos angle sqrt abs round findvariables Text variables: firstupper firstlower tolower toupper decolorize substring prepad postpad reverse strlen strwidth atoi chr ord hexord trim colorize Time: ctime time localtime gmtime Lists: finditem deleteitems foreach getitem isatom listlength splitlist implode explode sortlist collate expand reverselist stretch Tickers: tick tickon tickoff ticksize pretick Events: delay=event remove=unevent=undelay findevents Rate limiting: ratelimit unratelimit Routes: goto > route unroute dogoto Misc: killall timecommand Paths: map mark path unmap pathdir return savepath unpathdir General info topics (not commands): syntax colorcodes keys Scroll back using PgUp/PgDn to read the whole help index. For help on specific command, #help ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~H General syntax ~syntax Tin-Tin parses the text you type in the following way: 1. a line of text is divided on ";" marks. This way, you can do more than one thing at once in actions, etc. 2. variables ($something) are substituted 3. if the first character of a line is #, the line is a command. If not, the line is sent to the MUD. You can change # to something else using the #char command. 4. Arguments for the command are separated by spaces. You can enclose an argument in curly brackets ("{" and "}") to ignore spaces or semicolons. Special characters: ; - command separator \ on the beginning - pass the whole line verbatim to the MUD \ before a char - quote next char. Examples: \;, \$ # on the beginning - the line is a tintin command, not a MUD one "" - prevents spaces from working as separators. Doesn't prevent ;s and $s from working - use \; and \$. {} - the best way to enclose arguments and list items %1 .. %9 - raw positional variables (arguments to an alias/match) $1 .. $9 - positional vars with ; and unpaired {} censored Note: use #verbatim to turn all parsing off. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~H Color codes ~colorcodes The color codes for KBtin are enclosed by tilde (~) chars. The general syntax is: ~foreground[:background[:attr]]~ Foreground and ~0:7~background~-1~ colors (using your terminal's palette): 0 - ~0~black~-1~ 4 - ~4~red~-1~ 8 - ~8~dark gray~-1~ 12 - ~12~lt. red~-1~ 1 - ~1~blue~-1~ 5 - ~5~magenta~-1~ 9 - ~9~lt. blue~-1~ 13 - ~13~pink~-1~ 2 - ~2~green~-1~ 6 - ~6~brown~-1~ 10 - ~10~lt. green~-1~ 14 - ~14~yellow~-1~ 3 - ~3~cyan~-1~ 7 - ~7~lt. gray~-1~ 11 - ~11~aqua~-1~ 15 - ~15~white~-1~ Absolute colors: ~rgb~ where r,g,b are 0..5: 530 is ~530~orange~-1~, 555 - ~555~white~-1~ Attributes: 0 - normal text 1 - ~::1~blinking~-1~ 2 - ~::2~italic~-1~ 4 - ~::4~underline~-1~ 8 - ~::8~overstrike~-1~ or a sum of the above: 15 for ~::15~blinking, italic, underlined and overstruck~-1~ text While color codes are supported on all post-1980 terminals, the support for extended attributes varies. For example, only text console and rxvt provide blink, while italic and underlining is available on some xterms. You can omit a field to retain the old color, for example: ::1 turns blinking on without affecting neither foreground nor background, and 4: changes foreground color to red leaving the background unchanged. When KBtin translates the ANSI codes coming from MUD, it uses the shortest possible code, without omitting any fields. That is: ~2~2~-1~, ~0:7~0:7~-1~ or ~12:0:1~12:0:1~-1~. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~H keys ~keys ~keyboard Editing keys: Backspace, ^H - erase character left from cursor Del - erase character at cursor left/right arrows, ^B/^F - move cursor Alt-B/Alt-F - move cursor to the last/next word Home, ^A - place cursor at the beginning of the input line End, ^E - place cursor at the end of the input line ^U/^K - delete input line before/after cursor ^W - delete "word" until whitespace behind cursor ^T/Alt-T - transpose characters/words at cursor Alt-D/Alt-Backpace - delete word backwards/forward ^Y - paste last deleted text Alt-L/Alt-U/Alt-C - lowercase/uppercase/capitalize current word Ctrl-Tab, Alt-Tab - switch input buffers up/down arrows, ^P/^N - recall a line from the history Scrollback: PgUp/PgDn - scroll back/forward The "Ctrl-Tab" key needs some explanation. Let's assume you are typing in a very long tell, and something which requires your immediate attention happened. You could use "^U" to clear your input, however that would forfeit your tell. Solution: press "Ctrl-Tab" to switch input lines, do whatever you need, then press "Ctrl-Tab" again and continue your tell. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ # switches to session # executes in session Note: the "unconnected" pseudo-session created when KBtin starts can be accessed as 'main'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~all #all executes in all sessions Example: #all shout I'm multiplaying! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~snoop #snoop toggles snooping of the active session Text from snooped sessions is displayed even if they're not the active session. Any output is prefixed with "%". ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~finditem #finditem {haystack} searches for in the list . If found, is set to the index of found item, if not - becomes 0. may include asterisks which glob an arbitrary substring. Finditem can be used also as an inline in expressions: (#finditem {haystack}) Examples: #finditem result d {a b c d e} -> result = 4 #find result a*b {db ac akb afgh} -> result = 3 #math result {5+2*#find g {a b c}} -> result = 5 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~deleteitems #deleteitem {list} [ ...] removes from {list} all items matching s and stores result in Example: #delete result {ab b ac cad k} a* -> result = {b cad k} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~foreach ~forall #foreach {list} Executes for each item of {list}. Examples: #foreach {a b c d} {#showme Letter:} #foreach {1.drow 2.drow 3.drow 4.drow} {bash $0;stand} The substitution of arguments to the uses the same rules if it was an alias, this means that: #foreach {a {b c d} {e f}} {#showme 0:[$0] 1:[$1] 2:[$2] 3:[$3]} will yield: 0:[a] 1:[a] 2:[] 3:[] 0:[b c d] 1:[b] 2:[c] 3:[d] 0:[e f] 1:[e] 2:[f] 3:[] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~getitem #getitem {list} Returns th item from the {list} and stores it into . If not found, becomes empty. The index is 1-based. Example: #getitem result 3 {a b c d e} -> result = "c" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~isatom #isatom inline in expressions: #isatom Checks if is neither a list with length>1 nor something enclosed in curly braces. #isatom {a} -> 1 #isatom {{a}} -> 0 #isatom {a b} -> 0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~listlength #listlength {list} inline #listlength {list} Calculates the number of items in {list} and stores it into . Items can be separated by spaces or enclosed in curly brackets ({}). Examples: #listl a {a b c} -> a=3 #math a {#listl {a {b c} d}} -> a=3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~splitlist #splitlist {list} [] Divides {list} into two parts, storing items 1.. into and the rest into . If is not specified, it is assumed to be 1. If one of is an explicit {}, that assignment is skipped. Example: #split head tail {smile {say Hi} {bounce a}} 2 head = "smile {say Hi}" tail = "{bounce a}" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~implode #implode {list} Stuffs the {list} into , separating items by . Example: #implode result , {a {b c d} e f} -> result = "a,b c d,e,f" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~explode #explode Divides into pieces separated by and stores the resulting list into . Example #explode result , {2n,5w,se} -> result = "2n 5w se" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~sortlist #sortlist {list} Sorts the {list} in asciibetical order and saves the result into . Example: #sortlist result {c a b} -> result = "a b c" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~collate #collate {list} Replaces repeating sequences of {list} elements by a single one, prefixed by the number of occurrences. If an element is already prefixed by a number x, it is considered to be x already collated elements. Example: #collate result {n n n n n} -> result = "5n" #collate result {2n n ne e} -> result = "3n ne e" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~expand #expand {list} Replaces all elements of {list} prefixed by a number by that element repeated the given number of times. Hint: you may use #explode to convert a comma- semicolon-separated path to a space-separated list before using #expand. Example: #expand result {10n} -> result = "n n n n n n n n n n" #expand result {3n e 2s} -> result = "n n n e s s" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~verbatim #verbatim Turns off all input parsing. In this mode, everything you type is sent directly to the MUD, without substituting variables, dividing lines on ";"s, parsing commands, etc. To resume normal work, type #verbatim again. Notes: - in normal mode you can prefix a line with "\" to pass it without parsing, as in #verbatim mode - #verbatim is the only command which can be abbreviated to just "#" (or whatever your tintin-char is) - since KBtin-0.2.9, actions and binds ignore #verbatim. Especially useful for immortals who spend most time with parsing turned off. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~send #send Passes to the MUD without almost any parsing, with just variables substituted. Useful for overriding KBtin aliases, like: #alias w {#math x {$x-1};#send w} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~sendchar #sendchar Passes one or more to the MUD without any parsing, and currently without logging (this may change). Not even a newline is added. Valid codes: - ^C Ctrl-letter - \a C-like escapes - \033 octal codes - \x1b hex codes - U+1234 an Unicode character ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~char #char Sets the tintin-char to punctuation character . The tintin-char is the symbol you use to prefix commands. An implied #char is done the first time a #read file starts with a punctuation character, avoiding a chicken-or-egg problem. Example: #char ~ -> commands are now "~char", etc instead of "#char" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~cr #cr Echoes a new-line character to the MUD. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~echo #echo [] Toggles the local echo. With echo on, the commands you type are being copied to the current output window as if they were part of the text which came from the MUD or as output from TinTin's commands. Note: some programs have their own echo which cannot be disabled. This can cause double echoing if #echo is on. Valid boolean values: 0 no false off yes true on ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~history #history Displays last 30 commands typed in this session. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~mudcolors This command controls how TinTin should translate colors codes (~n~) found in the text being sent to the MUD. #mudcolors OFF #mudcolors 0 The color codes will be sent verbatim. #mudcolors ANSI Color codes will be sent as ANSI (ESC [ m). #mudcolors {} Color codes will be ignored. #mudcolors c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 Initializes the color translation table to {c0..c15}. Color numbers: 0 - ~0~black~-1~ 4 - ~4~red~-1~ 8 - ~8~dark gray~-1~ 12 - ~12~lt. red~-1~ 1 - ~1~blue~-1~ 5 - ~5~magenta~-1~ 9 - ~9~lt. blue~-1~ 13 - ~13~pink~-1~ 2 - ~2~green~-1~ 6 - ~6~brown~-1~ 10 - ~10~lt. green~-1~ 14 - ~14~yellow~-1~ 3 - ~3~cyan~-1~ 7 - ~7~lt. gray~-1~ 11 - ~11~aqua~-1~ 15 - ~15~white~-1~ This command doesn't support background colors and blink (yet?). Example (color table for T2T): #mudcolors ~0:7~$0$~7~ ~1~$BLU$~7~ ~2~$GRN$~7~ ~3~$CYN$~7~ ~4~$RED$~7~ ~5~$MAG$~7~ ~6~$YEL$~7~ $0$ ~8~$HIK$~7~ ~9~$HIB$~7~ ~10~$HIG$~7~ ~11~$HIC$~7~ ~12~$HIR$~7~ ~13~$HIM$~7~ ~14~$HIY$~7~ ~15~$BOLD$~7~ (for Duris): #mudc ~0:7~&+l~7~ ~1~&+b~7~ ~2~&+g~7~ ~3~&+c~7~ ~4~&+r~7~ ~5~&+m~7~ ~6~&+y~7~ &n ~8~&+L~7~ ~9~&+B~7~ ~10~&+G~7~ ~11~&+C~7~ ~12~&+R~7~ ~13~&+M~7~ ~14~&+Y~7~ ~15~&+W~7~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~bold Some terminals make bright colors wide-stroked as well. You can use this command to try to disable this behaviour. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~inputcolor #inputcolor ~~7~7:1~ Set the color of the input bar to the given code. The default is ~~7~7:1~. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~showme #show Echoes to the user. #example #show {Terminal size: $COLSx$LINES} #action {%1's mighty bash sends you sprawling} {#show =======BASHED========} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~charset #charset Displays the currently set remote charset. #charset Sets the conversion of the current connection and/or all subsequent ones. KBtin will make an attempt to replace unrepresentable letters with an ASCII equivalent if possible, dropping accents/umlauts when needed. Only characters sets which are upward compatible with ASCII are supported -- there is no support for UTF-16 or EBCDIC at all. The list of available charsets depends on your system; GNU systems will typically know anything reasonable, but on Windows or ancient Unices only UTF-8, ISO-8859-1 and ASCII are guaranteed to work. All simple scripts like greek, cyrillic or hebrew are supported, although no transliteration is attempted for non-latin ones. Scripts which are more complex work in a spotty way at best at this moment. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~speedwalk #speedwalk [] Toggles the "speedwalk" function. Speedwalks are usable only on MUDs which use only the 6 basic directions: ~15~n~-1~, ~15~w~-1~, ~15~s~-1~, ~15~e~-1~, ~15~u~-1~, ~15~d~-1~. Speedwalking allows typing for example "nw4neun" as a shortcut for "n;w;n;n;n;n;e;u;n". Notes: - if your MUD sometimes uses diagonal directions (nw, ne, sw, se) but they happen ~15::4~very~-1~ rarely (Duris for example), you can still use speedwalks. Just type "\nw" in case such an exit happens. - the "news" command found on some MUDs accidentally happens to consist of only legal speedwalking letters... Again, you have to type "\news". ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~action #action [] Lists all actions matching (or all if no pattern given). #action [] Sets a trigger on to execute . The action is guaranteed to fire exactly once for a single line of text, but won't be triggered for incomplete lines (compare #promptaction). The priority affects the order in which matching actions will be executed, however all actions which match will fire. The can contain "%0", "%1" .. "%9" symbols, which match any substring. You can then use "$1" or "%1" in the , which will be substituted by the substring which matched "%1" in . Example: #action {You are attacked by %1!} {#tolower victim $1} The difference between %n and $n is that $n removes all semicolons. It's often a good thing because semicolons can wreak havoc on many commands. An example: #action {says in %0 'target=%1'} {kill %1} Butthead says in common 'target=;#sys rm -rf ~/*'. The whole line which triggered the action can be accessed through $_. Actions don't ignore color codes!!! In other words, an action "Illithid enters" won't trigger on: "~13~An Illithid~7~ enters~-1~" - you have to use the color code (#action {Illithid~15~~~14~7~15~~~-1~ enters}). This may seem cumbersome, however after a while you will realize this a very powerful feature, allowing you to completely ignore people emoting things to fool your triggers. If "^" is the first character of , the action will trigger only if the text is found on the beginning of a line. Likewise, use "$" for the end. Example: #action {^Your studies are complete.} {stand} Your studies are complete. -> match Butthead says in common 'Your studies are complete.' -> no match Note: beware of prompts and color codes! To be able to specify the priority, you have to enclose your in curly brackets. This may seem a bug, however because of rare use of priorities you don't have to use brackets as often. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~unaction #unaction Removes all actions matching . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ignore #ignore [] Toggles ignoring the actions. The "ignore" command allows you to temporarily disable all actions and promptactions. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~promptaction #promptaction [] Shows all prompt-actions matching . #promptaction [] Adds a prompt-action on to execute . Prompt-actions are actions which work on incomplete lines as well, as opposed to normal actions which are postponed until the end-of-line character is received. Example: #prompt {HP:%1 EP:%2 >} {#var hp $1;#var ep $2} Note: since promptactions are checked every time a piece of text comes from the MUD, a single prompt-action can trigger several times even for the same line of text. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~unpromptaction #unpromptaction Removes all prompt-actions matching . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~hook #hook [] Shows all hooks, or the hook for . #hook Tells KBtin to do whenever an internal happens. You can hook the following events: open This session has just started close Session is being closed zap Session is being aborted (called before close) end KBtin shuts down send %1 just got sent to the MUD activate Session is being switched to deactivate Session is being switched from title The MUD tried to set window title to %1 tick The ticker fired (once per #ticksize seconds) pretick It's #pretick seconds before tick. logclose A log file has been closed; %1 is filename. Examples: #hook close {#write myconfig} -- will make your configuration be automatically saved ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~unhook #unhook Removes the hook from . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~doactions #doactions Performs all actions on as if it had been received from the MUD. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~dopromptactions #dopromptactions Performs all prompt actions on as if it had been received from the MUD. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~alias #alias [] Lists all aliases matching . #alias Defines a new alias . Arguments substitution rules: 1. if the is a simple alias (that is, without any semicolons or variables of any type), any arguments found are appended to the command. Example: #alias fh cast 'full heal' fh aethia -> "cast 'full heal' aethia" 2. if any positional variables are found, their meaning is: $0 - all arguments given (whole command line except the alias name) $1 - first word/braces after the alias name $2 - second argument $3 - third argument ... $9 - ninth argument. That is, if "blargh" is an alias, typing "blargh a {b c} d" means: $0 = "a {b c} d" $1 = "a" $2 = "b c" $3 = "d" $4=$5=$6=$7=$8=$9 = "" 3. As elsewhere $1 removes ; and unpaired {}, % lets them through. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~unalias #unalias Removes all aliases whose name matches . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ifaliasexists #ifaliasexists [#elif/#else ...] Queries whether has been defined; if yes, the is executed. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~shift #shift [] Reassigns positional variables: moves $2 to $1, $3 to $2, ..., clears $9. If is given, shifts by that many positions. $0 is updated to drop first arguments. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~substitute #substitute [] Lists all substitutes and gags matching the pattern. #substitute Defines a substitution for text incoming from the MUD. It can be used to highlight stuff, remind you about items stats, etc. can include positional variables %0..%9, which can be used in as well. Use ^ and $ to anchor to the beginning or end of a line. Note: substitutions, similarly to actions, do NOT ignore color codes. Examples: #sub {Your mighty bash sends %1 sprawling.} {~~-1~15:1~BASH SUCCESS: [$1]~~-1~7~} #sub {%1 the %2 Master Assassin (%3} {%1 the %2 ass18 (Master Assassin) (%3} #sub {%1 the %2 Lady Death (%3} {%1 the %2 ass19 (Lady Death) (%3} #sub {%1 the %2 Deathmaster (%3} {%1 the %2 ass19 (Deathmaster) (%3} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~unsubstitute #unsubstitute Removes all substitutes and gags matching . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~antisubstitute #antisubstitute Inhibits substitutions and gags on any lines containing . Examples: #antisub {Rank: Lord (male)} #sub {%1 Lord (%2} {%1 civ16 (Lord) (%2} This way, immortal title "Lord" won't be confused with civilian 16 title "Lord". ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~unantisubstitute #unantisubstitute Removes all antisubs matching . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~highlight #highlight Lists all highlights. #highlight list Shows all available color names. #highlight From now, all occurrences of will be colored . can contain * as wildcards (not %n as it was the case with substitutes). Highlight is ~15::4~the only~-1~ KBtin command which ignores color codes in the input text. This means, you can highlight "~6~le~2~av~10~es~6~-co~10~ve~6~re~2~d~-1~" by typing "#hi leaves-covered". You can use standard KBtin color-codes (without the ~s), or english color names (type "#highlight list" to get the list). Highlights which start or end inside a word will be ignored, that is, "ash" inside "Bashgeroy" will not be highlighted. Words consist of alphanumeric characters (letters and digits). Color patterns are allowed as well; separate colors in your pattern with '/'s. For example, using 4/6 as the highlight color will make your text look ~4~l~6~i~4~k~6~e~4~ ~6~t~4~h~6~i~4~s~-1~. Examples: #hi 10 {A young lad trudges off to war} #hi 10 {A worried merchant flees off to safety} #foreach {$SoU} #hi 4 #hi 13:2 {* swiches targets..} #hi 13:2 {* is enveloped by * as * tries to pass through the shimmering wall.} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~unhighlight #unhighlight You got it, this command removes all highlights matching . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~colorize #colorize Applies to , storing the result into . All ways to express a color known to #highlight are allowed, including patterns. You probably want to use color codes with incomplete fields, that is, ~~-1~::~ is no-op, ~~-1~:4:~ sets background to red without changing foreground or flags, etc. Note that a field that's missing entirely rather than empty defaults to ~~-1~7:0:0~ rather than to ~~-1~::~. Referring to a color by name rather than code has been changed as of KBtin 2.2 to mean ~~-1~2::~ rather than ~~-1~2:0:0~ as before. Likewise, named flags don't clear other attributes. #colorize {} Canonicalizes color codes inside (getting rid of multiple codes in a row as produced by some MUDs, eliding redundant changing color to same, resolving empty mask fields, etc). There's no visual change. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~presub #presub [] This toggle decides whether actions and promptactions should be performed on the raw text which came from the MUD, or after all substitutes/gags have been done. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~gag #gag Completely hides any line containing from your view. If #presub is not on, any matching actions will still be done. Examples: #gag {Do: starting commands.} #gag {Do: commands completed.} #gag {Rauko tells you:} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ungag #ungag Removes all gags matching . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~togglesub #togglesub [] Toggles whether substitutions/gags/highlights should be done at all. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~dosubstitutes #dosubstitutes Does all substitutes on just as if it was text which came from the MUD, and stores the result into . Note: It may be tempting to use this command to do some text-processing -- but that's a bad idea because that would clutter up the substitutions used for processing incoming text. Use this command only for text which will end up displayed by #showme, #status or the like. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~dohighlights #dohighlights Passes the through highlights as if came from the MUD, then stores the result into . As a side effect, unneeded color codes from will be removed, retaining the same visual effect. Example: ~~-1~3~bl~~-1~7~~~-1~2~ah -> ~~-1~3~bl~~-1~2~ah ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~changeto #change Replaces the current line of text from the MUD by . Think of it as an one-time #substitution. This command makes any sense only inside an action or promptaction. Note: the current implementation doesn't obey #presub, and all following actions will use the new text instead of old one. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~gagthis #gagthis Prevents the current line from being shown -- just an one-time #gag. Can be used only inside an action or promptaction. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~bell #bell Beeps. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~bind #bind [] Lists all binds or those matching . #bind Binds the key whose code is to . If you are not sure about the keycode (they can differ across various systems, too), press the key in question. For binding the arrow keys, read the help for #keypad first. Examples: #bind F1 {k galdor} #bind F2 {#loop 1,$nhorses {mount horse $0};spur;k elven scout} #bind F3 {whoa;dismount horse;#loop 1,$nhorses {get all from corpse into panniers $0}} #bind ^L {ed $cwf;1,10000d;i;#text $cwf;I;x;update} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~unbind #unbind Unbinds all keys matching . For all you quakers out here, the command to nuke all keybindings is "#unbind *", not "#unbindall" :P ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~keypad #keypad [] Switches the keypad (rightmost part of keyboard) between the "normal" mode (where it works as either arrow keys or numbers, depending on NumLock state) and the application mode, where it can be used for keybindings. You will prefer the latter mode if you enjoy walking using the keypad keys. NOTE: The support for this command is broken on some terminals which don't implement vt100 codes properly. Ones that do work correctly include the Linux console, PuTTY, aterm, rxvt, xterm, zutty. Example: #keypad on #bind Kpad7 nw #bind Kpad8 n #bind Kpad9 ne #bind Kpad4 w #bind Kpad5 out #bind Kpad6 e #bind Kpad1 sw #bind Kpad2 s #bind Kpad3 se #bind KpadMinus u #bind KpadPlus d ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~retain #retain [] (toggle) Causes the input box to keep the last line typed, zMud style. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~blank #blank [] Toggles whether blank lines incoming from the MUD should be displayed or not. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~condump #condump Dumps all your scrollback buffer into file . The dumped log will contain ANSI color codes, you will probably want to pipe it through the ansi2txt utility (bundled with KBtin) to get plain text log, or through ansi2html to get a nice log to put on your web page. Note: the text dumped is not the real log, but only the text you have in your scrollback. This means, all your gags, substitutions, #showmes and the like will take effect on the log. Use #log if you want exactly the text you received from the MUD. You can use all the modifiers available in #log. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~deathlog #deathlog Appends a single line of text to . Example: #action {You killed %1.} {#deathlog kills {$1}} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~log #log Turns logging on. #log Disables logging. The log produced by this command is exactly what came from the MUD to you. No gags, no substitutions, no spam generated by TinTin. The log includes even the ANSI color codes -- if you want a plain-text log, pipe it through ansi2txt, ansi2html or similar. If the ends in ".gz", ".bz2", ".xz" or ".zst", the log will get compressed on the fly, as long as you have gzip, bzip2, xz, or zstd installed. You may prefix with one of the following symbols: > just write (no-op except that it disallows compression) >> appends to the file | opens a pipe None of the above symbols will heed ".gz" or ".bz2". ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~logtype #logtype Sets the logging mode to . Valid modes are: * raw Everything as-is. * lf ANSI with cr/lf converted to lf [default]. * ttyrec ANSI with timing information, in a format compatible with ttyrec(1). You can change the logtype at any moment -- however, changing it in the middle of a log is usually a bad idea. You can convert the log post-factum using `ttyrec2ansi`, `ansi2txt` or `ansi2html`, bundled with KBtin. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~logcharset #logcharset Prints the currently set log charset. #logcharset local Makes KBtin log using currently set locale [recommended]. #logcharset remote Makes KBtin log as received, without any conversion. #logcharset Forces the logging charset to a given value. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~logcomment #logcomment Puts a line of into the log at the current position. Useful for timestamping, automatically writing some comments, etc. Example: #ctime NOW;#logcomment {==== Time mark: $NOW ====} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~loginputformat #loginputprefix Braces every line of keyboard input with and . This allows telling them apart from the MUD's output. Example: #loginputformat « » ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~read #read Reads in a file, as if you typed in its contents. The text gets then processed by TinTin, so you can use this command to read in your config files containing aliases, actions, etc. If you prefer to get your file sent directly to the MUD, use #textin instead. The first character in file, if it is a valid tintin-char, it becomes one. That is, a #char command is implied. This is done only once. You can split long lines -- any line that begins with whitespace is assumed to be the continuation of the last line -- as long as the result is no longer than 1024 characters. Example: #alias abc { #showme {First few squares:}; #loop 1,5 { #math sqr {$0*$0}; #prepad sqr 2 {$sqr}; #showme { $0: $sqr} } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~verbose #verbose [] Toggles whether #read should hide the loading process. Equivalent to -v specified from command line at startup. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~textin #textin Reads in a file, passing it verbatim to the MUD. No variable substitutions, alias parsing, not even color-code substitution is done. This command is useful to prevent TinTin from garbling your descriptions, mails, etc you painstakingly formatted. For reading a bunch of TinTin commands, use #read instead. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~unlink #unlink Deletes a file. This command cannot be abbreviated, you have to type its whole name. The command does the same work as "#sys rm -f ", however it doesn't support wildcards (which can be good). ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~write #write Writes all your current TinTin aliases, actions, substitutes, antisubs, gags, variables, pathdirs, routes and binds to a file. Use this command to save your config as one file. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~writesession #writesession Writes all aliases, actions, substitutions, antisubs, gags, variables, pathdirs, routes and binds you added since the current session have been started. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ctime #ctime Prints the current time in human-readable form. #ctime Sets to the current time, in human-readable form. #ctime