pax_global_header00006660000000000000000000000064144330610750014515gustar00rootroot0000000000000052 comment=17c7cc305aae283c6ee0363924ffedef6b1850b2 ansilove-4.2.0/000077500000000000000000000000001443306107500133405ustar00rootroot00000000000000ansilove-4.2.0/.gitignore000066400000000000000000000010241443306107500153250ustar00rootroot00000000000000#gitignore for AnsiLove/C # Mac OS X Finder .DS_Store # Xcode per user config *.mode1 *.mode1v3 *.mode2v3 *.perspective *.perspectivev3 *.pbxuser # Xcode xcuserdata/ project.xcworkspace/ # AppCode .idea/ # Generated files VersionX-revision.h # build products build/ *.[oa] # Other source repository archive directories .hg .svn CVS # automatic backup files *~.nib *.swp *~ *(Autosaved).rtfd/ Backup[ ]of[ ]*.pages/ Backup[ ]of[ ]*.key/ Backup[ ]of[ ]*.numbers/ # CMake CMakeFiles CMakeCache.txt Makefile cmake_install.cmake ansilove-4.2.0/AUTHORS000066400000000000000000000012561443306107500144140ustar00rootroot00000000000000 _ __ ____ ___________ __________ ____ __ _ .________ //_ ANSilOVE _\\ ._____ ____/\ ___| _/___/\ __ _____. _ ____/\ _| \ ____ / .__\\ \ | _ //___ _)_. \_ |____ \\ | // ___/ / __/ \ \ |__ \/ \ |_ | | \ | \ / __)____ /____| \_|\_____|_________/__ `/ |______ //_______/____/______ / |______/ _ __ __________ \/ _______ \/ ________ __ _ yop \/ Ansilove/C is developed by: Stefan Vogt Brian Cassidy Frederic Cambus ansilove-4.2.0/CMakeLists.txt000066400000000000000000000041131443306107500160770ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.1) set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_EXTENSIONS OFF) project(ansilove C) include(CheckFunctionExists) include(GNUInstallDirs) # Conditional build options set(ENABLE_SECCOMP 0 CACHE BOOL "Enable building with seccomp") # Check if system has pledge and strtonum list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_OPENBSD_SOURCE) check_function_exists(pledge HAVE_PLEDGE) check_function_exists(strtonum HAVE_STRTONUM) if(ENABLE_SECCOMP) # Check if system has seccomp message(STATUS "Looking for seccomp") find_path(SECCOMP NAMES "linux/seccomp.h") if(SECCOMP) message(STATUS "Looking for seccomp - found") add_definitions(-DHAVE_SECCOMP) else() message(STATUS "Looking for seccomp - not found") endif() endif(ENABLE_SECCOMP) # Additional include directories for compat functions include_directories("compat") # Ansilove library find_path(ANSILOVE_INCLUDE_DIRS ansilove.h) find_library(ANSILOVE_LIBRARIES NAMES ansilove REQUIRED) include_directories(${ANSILOVE_INCLUDE_DIRS}) set(SRC src/ansilove.c src/types.c src/strtolower.c src/sauce.c) if(NOT HAVE_PLEDGE) set(SRC ${SRC} compat/pledge.c) endif() if(NOT HAVE_STRTONUM) set(SRC ${SRC} compat/strtonum.c) endif() add_definitions(-D_GNU_SOURCE -Wall -Wextra -pedantic) add_executable(ansilove ${SRC}) target_link_libraries(ansilove ${ANSILOVE_LIBRARIES}) install(TARGETS ansilove DESTINATION ${CMAKE_INSTALL_BINDIR}) install(FILES man/ansilove.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1/) enable_testing() add_test(ansilove ansilove) add_test(ansi ansilove ${PROJECT_SOURCE_DIR}/tests/bs-alove.ans) add_test(artworx ansilove ${PROJECT_SOURCE_DIR}/tests/bs-alove.adf) add_test(bin ansilove -c 80 ${PROJECT_SOURCE_DIR}/tests/bs-alove.bin) add_test(pcboard ansilove ${PROJECT_SOURCE_DIR}/tests/bs-alove.pcb) add_test(tundra ansilove ${PROJECT_SOURCE_DIR}/tests/bs-alove.tnd) add_test(xbin ansilove ${PROJECT_SOURCE_DIR}/tests/bs-alove.xb) add_test(retina ansilove -r ${PROJECT_SOURCE_DIR}/tests/bs-alove.ans) add_test(sauce ansilove -s ${PROJECT_SOURCE_DIR}/tests/sauce.txt) ansilove-4.2.0/ChangeLog000066400000000000000000000254611443306107500151220ustar00rootroot00000000000000AnsiLove/C 4.2.0 (2023-05-23) - Add initial RPM spec file - Add support for the Spleen 8x16 font (requires libansilove >= 1.4.0) AnsiLove/C 4.1.7 (2023-03-30) - Always print processing time on stderr - Move manual page to the man directory AnsiLove/C 4.1.6 (2022-02-10) - Mention experimental seccomp support availability in README - Bump CMake minimum required version to 3.1 - Add SPDX short license identifier in source files - Add a test case for retina output - Add a test case for SAUCE output - Use CMAKE_C_STANDARD instead of hardcoding compiler flags - Stop linking against libm, it's not necessary anymore AnsiLove/C 4.1.5 (2021-02-14) - Stop forcing FORTIFY_SOURCE=2, it should be package builders decision - Remove dead increments for argc and argv - Check strdup() return value when allocating output file name AnsiLove/C 4.1.4 (2020-10-22) - Set CMAKE_BUILD_TYPE to "Release" in CMakeLists.txt - Enable FORTIFY_SOURCE level 2 - Move read_status variable declaration to the top of the function - Check fread() return values in readComments() and add error handling - Introduce the READ_RECORD function-like macro, for fread error handling - Use READ_RECORD in readRecord() to add fread() error handling - Only call memset() if the malloc call succeeds - Check strdup() return value and error out on failed allocation AnsiLove/C 4.1.3 (2020-09-18) - Adjust SAUCE flag output to be binary - Add -S flag to use SAUCE info for rendering hints. Users must now use -S to get iCE color info. This was previously automatically pulled without any extra options. - Document the new -S flag, allowing to use SAUCE info for render options - Add support for seccomp on arm - Add missing test for __NR_mmap, the mmap syscall doesn't exist on arm AnsiLove/C 4.1.2 (2020-07-04) - Define _GNU_SOURCE in CMakeLists.txt to avoid cluttering source files - No need to set HAVE_SECCOMP to 1, defining it is enough - Remove some unneeded seccomp related includes - Validate architectures for seccomp - Add seccomp support on i386, tested on glibc and musl - Remove extraneous underscore in #if defined check - Use __NR_ instead of SYS_ prefix in #if defined checks AnsiLove/C 4.1.1 (2020-05-25) - Various documentation tweaks and improvements - Define timespecsub macro in compat.h if it doesn't exists - Use CLOCK_REALTIME if CLOCK_MONOTONIC is not available - Display processing time on exit. - Fix includes and add forward declarations in various source files AnsiLove/C 4.1.0 (2020-02-17) - Add a new '-t' flag (type), allowing to specify input file type and override file type detection - Various documentation tweaks and improvements AnsiLove/C 4.0.7 (2020-01-18) - Use OpenBSD style(9) for function prototypes and declarations - Replace EXIT_SUCCESS by zero in all SAUCE functions - Do not use typedef for the sauce struct - Set icecolors to true if defined in SAUCE record ANSiFlags - Add test cases for most supported formats, missing an IDF file for now - Sync the description of Retina output capabilities with reality AnsiLove/C 4.0.6 (2019-12-10) - Remove extraneous sauceReadFileName() call, read from existing SAUCE record - Use strdup() when assigning fileName and fext fallback values - Call memset() to set all record struct fields to zero - Free SAUCE record and comments once and for all when exiting the program AnsiLove/C 4.0.5 (2019-11-19) - Add ENABLE_SECCOMP build option, to allow building seccomp support conditionally - Disable seccomp by default, it needs more testing on non !amd64 platforms - Use ${CMAKE_INSTALL_BINDIR} instead of hardcoding 'bin' AnsiLove/C 4.0.4 (2019-10-28) - Add initial seccomp support to Ansilove - Move pledge and seccomp initialization before ansilove_init() - Move conditional includes for 'pledge' and 'strtonum' in compat.h AnsiLove/C 4.0.3 (2019-08-16) - Use errx() for displaying error messages - Print information messages on stdout - Introduce a version() function to display version information - Add a -q flag (quiet) to allow silencing output messages AnsiLove/C 4.0.2 (2019-08-13) - Remove most examples from the repository, they continue to live on the website - Move the remaining examples in per author directories, and add LICENSE files for these artworks, courtesy of their authors AnsiLove/C 4.0.1 (2019-06-25) - Fix a few typos in README and ansilove.1 - Simplify display of default font when no font option is specified - Drop the leading dot when saving input file extension - Fix the check for readComments() return value AnsiLove/C 4.0.0 (2019-01-16) - Switch to using libansilove - Add a new switch (-d) to toggle DOS aspect ratio - Add initial support for PabloDraw 24-bit ANSI sequences - Ansilove now generates only one output file when -r or -R options are used - Display scale factor when -r or -R options are used - Allow to specify the number of columns for ANSI and Tundra files - Restrict maximum allowed number of columns to 4096 - Check asprintf() return value and error if allocation fails - Bugfixes and improvements in the SAUCE parser - Refactor font selection processing - Refactor rendering mode processing - Use OpenBSD style(9) for function prototypes and declaration - Add missing headers and remove unnecessary ones - Remove versionInfo(), simply print the header with version information when invoked with -v - Remove showHelp(), show synopsis instead when invoked with -h - Add a new example ANSi (Thanks Nail) - Remove -e switch, examples are now listed in the man page instead - Make synopsis() only display SYNOPSIS, as it should be. - Add an EXAMPLES section in ansilove.1 - PC fonts for code pages other than cp437 are now named using the cpNNN scheme. Albeit not documented anymore, the previously used names will keep working AnsiLove/C 3.0.9 (2018-06-19) - Add a new example ANSi (Thanks Sylvao) - Do not use -Werror by default - Increment maximum ansi sequences length - Add code to skip PabloDraw 24-bit ANSI sequences AnsiLove/C 3.0.8 (2017-12-20) - Adding new example ANSis (Thanks Burps) - Use asprintf() to create output filenames - Reflect OpenBSD's pledge() changes - Add a -R flag allowing to specify a custom retina scale factor AnsiLove/C 3.0.7 (2017-07-02) - Print messages to to stderr instead of stdout - Ensure binary files have an even size - Better description of supported file formats - Skip erase in line (EL) sequences (issue reported by Bart Dumon, thanks!) - Define palettes in config.h - Use defined palettes instead of hardcoding each color value in the loaders AnsiLove/C 3.0.6 (2017-04-22) - Create an output function to unify the way output files are created - Prevent .png suffix to be appended when using -o flag (*NIX tool convention compatibility) AnsiLove/C 3.0.5 (2017-04-16) - Free memory allocated in the PCBoard loader - Free font data where appropriate - Add a trailing NUL character to inputFileBuffer - Remove the custom substr function, call strndup directly - Free seqGrab where necessary - Use the ternary operator when shitfing cursor position - Use perror when printing errors - Remove SUBSTITUTE_BREAK and WRAP_COLUMN_80 options - Use fstat to get the input file size - Create a retina function instead of duplicating code in all loaders - Fix OpenBSD's style(9) offenders in compat functions AnsiLove/C 3.0.4 (2016-07-28) - Relicensed under the BSD 2-Clause license - Input file is now loaded in main, prior to calling format loaders - Use stat to get input file size instead of custom file size function - Remove now unused file size function - Refactoring bits and columns argument value handling AnsiLove/C 3.0.3 (2016-07-14) - Adding some missing includes - Define _XOPEN_SOURCE macro (for 'strdup' and 'strndup' functions) - Switch back to compiling with -std=c99 instead of -std=gnu99 - Adding cast to fix compilation with GCC on NetBSD [-Werror=char-subscripts] - Use strdup when lowercasing file extension, to avoid modifying input filename - Define _NETBSD_SOURCE macro to make 'strndup' declaration visible on NetBSD AnsiLove/C 3.0.2 (2016-01-21) - Adding a new example XBin (Thanks Enzo) - Adding install target for man page - Removing hardcoded paths in 'CMakeLists.txt' for GD library detection - Add additional include directories for compat functions to avoid using relative path in includes - Refactoring of the ANSI loader, and removed support for drawing bold, italics and underline characters for Amiga fonts, allowing to plot characters directly to the canvas and drop a lot of code - Move SAUCE functions into their own file - Moving all format loaders to their own files + simplifying names - Removed prototype for 'str_replace' which has been pruned - Moving ANSI and PCBoard character structures to their respective loader headers - AnsiLove is now pledged on OpenBSD - Renaming a bunch of files and improving the project structure - Removing all calls to 'atoi' and using OpenBSD's 'strtonum' instead - Fixing regression in the CED mode rendering - Removing 'workbench-transparent' rendering mode, it never made sense - Fixing regression in the Workbench mode rendering - Adding detailed font options in the manual page AnsiLove/C 3.0.1 (2016-01-03) - Initializing some uninitialized variables - Removing some unused variables and assignments - Removing optional filters for PCBoard sequences - Pruning now unused 'str_replace' function - Remove support for configurable diz extensions - Remove support for configurable RGB values for CED + WorkBench modes - Using strncmp instead of strcmp + strndup combo, as strndup is not part of C99 - Added a manual page AnsiLove/C 3.0.0 (2015-12-13) - Switching to getopt for parsing command line options - Removing bits parameters for ADF, IDF, and XBIN loaders - Adding a mode option to specify CED, Workbench and transparent rendering modes - Using mode instead of bits to check for rendering modes to enable - New 'alSelectFont' function returning a structure with font information - Adding a compat directory and importing 'strtonum' function from OpenBSD - Made CMakeList more modular, and linking strtonum conditionally - Remove .diz pre-filtering as it was a remnant of the PHP version - Using 'strtonum' to parse and validate bits and columns parameter value before calling the loaders - Removing unused parameter 'font_size_x' in alDrawChar - Enabling the '-Wextra' and '-Werror' flags in CMakeLists.txt - Group checks for CR + LF in the ANSi and PCBoard loaders - Documentation cleanups and updates AnsiLove/C 2.2.1 (2015-06-28) - Switching to CMake to build the project - Moving source files to the 'src' directory - Removing legacy Ubuntu compilation script - Updated documentation (build requirements + instructions) - Remove MIN macro and use math.h's 'fmin' instead - Adding Ansilove artwork, both ASCII and ANSI as example files - Adding 'AUTHORS', 'FILE_ID.DIZ', and 'THANKS' files - Fixing file extension detection (Close #2) - Fixing the PCB loader to use logical AND as it should ansilove-4.2.0/FILE_ID.DIZ000066400000000000000000000025671443306107500150150ustar00rootroot00000000000000 ____ ____ ________|_ (_ _______ _) _|________ _)) - --|/---\\-----//---\|-- - ((_ | ' ________ ` | : ______ ____\ (_ ______ ___ ___\___ /__ _\_ _\\_ :_\ ___/_____\_(_ _\ __ /_\ \\/ \\____ \_ | \ \: : \\ . :/ | | \\_____\-------------\____|___/------:_ | _) |-----\\ . _______ . )__| | | : \\ (_ : : | .::. .::. |----\_ _/______ . . | ::::::::::: | :/ __\ ____/__ _ | `:::::::' | / \ _\ _/ \ |_ `:::' | _. / \: \_ \\_______\\ ' |--/___/-----\_____// - -----------//______|----------------- - : : | | | Ansilove/C 4.2.0 | | | | ANSi=>PNG converter & library | | | | Supports 7 textmode formats | | ANS/PCB/BiN/ADF/iDF/TND/XBiN! | | | | Supports 14 MS-DOS charsets | | 80x25, 80x50 and Amiga fonts! | |_ Supports SAUCE and iCE colors _| _|/ Small output size (4-bit PNG) \|_ // \\ /____ _____\ ns. ((_ A N S i L O V E _)) ASL ansilove-4.2.0/LICENSE000066400000000000000000000025011443306107500143430ustar00rootroot00000000000000Copyright (c) 2011-2023, Stefan Vogt, Brian Cassidy, and Frederic Cambus All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ansilove-4.2.0/README.md000066400000000000000000000235501443306107500146240ustar00rootroot00000000000000``` _______ ___________ ___ __\___ \_ ____/ /\ /______ ___\_/__ /\ / \| \/ _ \ /--\_____ \\ / /\ / \ _/ | / \ \ |/ / \ \ _ _____/ \_______ \ |_____\____/ / / \____ /\/ / \______| \ \_____/\______ /\ \/ \ /\NSILOVE / C /____ _ \ |_______\__\___ \ \ \ / \___\__/____ \____| /____/\_\/\__ / / __/___ \ /\ ____ \ \ \ / /_/ __ \/ /__\__/ _/ _____ ___ /\ \____\/ / // \ / / / _>/ //__/\ / \ _/ \ // / / / \/ / \__\/ _ _________ / \_______ _ \___ /_______/ / _/ \____ \ / \ / \ \___/\ \_______/\\ \ \______/\/ \/ \_\ \ \_______\ \ \\/ \__\ \ \ \__\/ \______\/ h7/dS!\_____\/ ``` # AnsiLove/C AnsiLove is an ANSI and ASCII art to PNG converter, allowing to convert ANSI and artscene-related file formats into PNG images, supporting ANSI (.ANS), PCBoard (.PCB), Binary (.BIN), Artworx (.ADF), iCE Draw (.IDF), Tundra (.TND) and XBin (.XB) formats. It creates size optimized 4-bit PNG files and supports SAUCE (Standard Architecture for Universal Comment Extensions), 80x25 and 80x50 PC fonts (including all the 14 MS-DOS charsets), Amiga fonts, and iCE colors. This is a complete rewrite of [AnsiLove/PHP][1] in the C programming language. Experimental seccomp support is available for selected architectures and can be enabled by setting the `ENABLE_SECCOMP` variable to `1` when invoking CMake. # Specs AnsiLove/C is strictly using the `C99 standard` to achieve high portability to all major operating systems. Supported compilers are `GCC` and `Clang`, others may work but aren't tested. We use Linux and OpenBSD for AnsiLove/C development. # Why C? There were many reasons, most notably PHP interpreter independence and performance. A solid C foundation is just perfect for creating libraries and it can easily be embedded into applications. We already mentioned portability. What else? We wanted evolution. AnsiLove/C should not be understood as a port. It takes many different approaches (like processing binary font dumps or generating @2x Retina images), it is overall improved and introduces new features. While results tend to be the same, the codebase does not have much in common with it's ancestor. # Dependencies AnsiLove/C uses the `CMake` build system and requires the [libansilove][2] library and header files. # Installing dependencies - OpenBSD: `pkg_add -r cmake` - NetBSD: `pkgin install cmake` - FreeBSD: `pkg install cmake` - macOS: `brew install cmake` - Alpine Linux: `apk add cmake gcc make musl-dev` - Debian / Ubuntu / Mint: `apt-get install build-essential cmake` - Fedora: `dnf install cmake gcc make` - Solus: `eopkg install -c system.devel` Binary packages for `libansilove` are available on OpenBSD, NetBSD, FreeBSD, Debian, Ubuntu, and Solus. On other systems, `libansilove` has to be installed manually. # Compiling mkdir build cd build cmake .. make # Packages Ansilove packages are available for: - [OpenBSD][3] - [NetBSD][4] - [FreeBSD][5] - [Debian][6] - [Ubuntu][7] - [openSUSE][8] - [Solus][9] - [Gentoo][10] - [Homebrew][11] # Features The following formats are supported: - .ANS - ANSi (ANSI escape sequences: ANSI X3.64 standard) - .PCB - PCBoard Bulletin Board System (BBS) own file format - .BIN - Binary format (raw memory copy of text mode video memory) - .ADF - Artworx format, supporting custom character sets and palettes - .IDF - iCE Draw format, supporting custom character sets and palettes - .TND - [TundraDraw][12] format, supporting 24-bit color mode - .XB - The eXtended Binary [XBin][13] format, supporting custom character sets and palettes Files with custom suffix default to the ANSi renderer (e.g. ICE or CIA). AnsiLove/C is capable of processing: - [SAUCE][14] records - DOS and Amiga fonts (embedded binary dump) - iCE colors Even more: - Small output file size (4-bit PNG). - Optionally generates proper Retina @2x (and up to @8x) PNG. - You can use custom options for adjusting output results. - Built-in support for rendering Amiga ASCII. # Documentation ## Synopsis ``` ansilove [-dhiqrsv] [-b bits] [-c columns] [-f font] [-m mode] [-o file] [-R factor] [-t type] file ``` ## Options ``` -b bits Set to 9 to render 9th column of block characters (default: 8). -c columns Adjust number of columns for ANSI, BIN, and TND files. -d Enable DOS aspect ratio. -f font Select font for supported formats. -h Show help. -i Enable iCE colors. -m mode Set rendering mode for ANS files. Valid options are: ced Black on gray, with 78 columns. transparent Render with transparent background. workbench Use Amiga Workbench palette. -o file Specify output filename/path. -q Suppress output messages (quiet). -r Create Retina @2x output file. -R factor Create Retina output file with custom scale factor. -t type Specify input file type. -s Show SAUCE record without generating output. -S If available, use SAUCE info for render options (ex: width). -v Show version information. ``` There are certain cases where you need to set options for proper rendering. However, this is occasionally. Results turn out well with the built-in defaults. ## Fonts We dumped many fonts as binary data right into AnsiLove/C, so the most popular typefaces for rendering ANSi / ASCII art are available at your fingertips. PC fonts can be (all case-sensitive): - `80x25` Default (Code page 437) - `80x50` 80x50 mode (Code page 437) - `cp737` Greek (Code page 737) - `cp775` Baltic (Code page 775) - `cp850` Latin-1 (Code page 850) - `cp852` Latin-2 (Code page 852) - `cp855` Cyrillic (Code page 855) - `cp857` Turkish (Code page 857) - `cp860` Portuguese (Code page 860) - `cp861` Icelandic (Code page 861) - `cp862` Hebrew (Code page 862) - `cp863` French Canadian (Code page 863) - `cp865` Nordic (Code page 865) - `cp866` Russian (Code page 866) - `cp869` Greek (Code page 869) - `terminus` Terminus (Modern font, code page 437) AMIGA fonts can be (all case-sensitive): - `amiga` (alias to Topaz) - `microknight` (Original MicroKnight version) - `microknight+` (Modified MicroKnight version) - `mosoul` (Original mO'sOul font) - `pot-noodle` (Original P0T-NOoDLE font) - `topaz` (Original Topaz Kickstart 2.x version) - `topaz+` (Modified Topaz Kickstart 2.x+ version) - `topaz500` (Original Topaz Kickstart 1.x version) - `topaz500+` (Modified Topaz Kickstart 1.x version) ## Bits `bits` can be: - `8` (8-bit) - `9` (9-bit) Setting the bits to `9` will render the 9th column of block characters, so the output will look like it is displayed in real textmode. See the "Memory Map" section of the [Monochrome Display Adapter notes][15] for more information. ## Rendering Mode `mode` can be (all case-sensitive): - `ced` - `transparent` - `workbench` Setting the mode to `ced` will cause the input file to be rendered in black on gray, and limit the output to 78 columns (only available for `ANS` files). Used together with an Amiga font, the output will look like it is displayed on Amiga. Setting the mode to `workbench` will cause the input file to be rendered using Amiga Workbench colors (only available for `ANS` files). Settings the mode to `transparent` will produce output files with transparent background (only available for `ANS` files). ## iCE Colors iCE colors are disabled by default, and can be enabled by specifying the `-i` option. When an ANSi source was created using iCE colors, it was done with a special mode where the blinking was disabled, and you had 16 background colors available. Basically, you had the same choice for background colors as for foreground colors, that's iCE colors. ## Columns `columns` is only relevant for .ANS, .BIN, .PCB, and .TND files, and is optional. In most cases conversion will work fine if you don't set this flag, the default value is `160` for .BIN files and `80` otherwise. ## SAUCE records It's fine to use AnsiLove/C as SAUCE reader without generating any output, just set option `-s` for this purpose. # Projects using Ansilove - [16colo.rs][16] - ANSI/ASCII art archive - [emacs-ansilove][17] - Display buffers as PNG images using ansilove inside GNU Emacs # License AnsiLove/C is released under the BSD 2-Clause license. See the `LICENSE` file for details. # Authors AnsiLove/C is developed by Stefan Vogt ([@ByteProject][18]), Brian Cassidy ([@bricas][19]) and Frederic Cambus ([@fcambus][20]). # Resources Project homepage: https://www.ansilove.org GitHub: https://github.com/ansilove/ansilove [1]: https://www.ansilove.org [2]: https://github.com/ansilove/libansilove [3]: https://openports.pl/path/graphics/ansilove [4]: https://pkgsrc.se/graphics/ansilove [5]: https://www.freshports.org/graphics/ansilove/ [6]: https://packages.debian.org/search?keywords=ansilove [7]: https://packages.ubuntu.com/search?keywords=ansilove [8]: https://software.opensuse.org/package/ansilove [9]: https://dev.getsol.us/source/ansilove/ [10]: https://packages.gentoo.org/packages/media-gfx/ansilove [11]: https://formulae.brew.sh/formula/ansilove [12]: https://sourceforge.net/projects/tundradraw/ [13]: https://github.com/radman1/xbin [14]: https://github.com/radman1/sauce [15]: https://www.seasip.info/VintagePC/mda.html#memmap [16]: https://16colo.rs [17]: https://gitlab.com/xgqt/emacs-ansilove [18]: https://github.com/ByteProject [19]: https://github.com/bricas [20]: https://github.com/fcambus ansilove-4.2.0/THANKS000066400000000000000000000022511443306107500142530ustar00rootroot00000000000000 _ __ ____ ___________ __________ ____ __ _ .________ //_ ANSilOVE _\\ ._____ ____/\ ___| _/___/\ __ _____. _ ____/\ _| \ ____ / .__\\ \ | _ //___ _)_. \_ |____ \\ | // ___/ / __/ \ \ |__ \/ \ |_ | | \ | \ / __)____ /____| \_|\_____|_________/__ `/ |______ //_______/____/______ / |______/ _ __ __________ \/ _______ \/ ________ __ _ yop \/ Thanks to the following people for helping the Ansilove project <3 Fonts: - dMG of Ascii Arena for his Amiga Fonts (https://www.trueschool.se) - Kosta Kostis (http://www.kostis.net) for his fantastic CPI tools - Dimitar Zhekov for the Terminus font (http://terminus-font.sourceforge.net) Code: - Ted Unangst and Todd Miller for strtonum.c ASCiis logos used in the releases: - H7 for the ansilove documentation logo - Ansichrist for the file_id.diz - Yop for the Ansilove logo used in the ChangeLog, THANKS and AUTHORS files Examples ANSis: - Burps for the bs-alove.ans example ANSi - Burps for the bs-ansilove.ans example ANSi - Nail for the n-silove.ans example ANSi ansilove-4.2.0/ansilove.spec000066400000000000000000000017641443306107500160440ustar00rootroot00000000000000Name: ansilove Version: 4.2.0 Release: 1%{?dist} Summary: ANSI and ASCII art to PNG converter License: BSD-2-Clause URL: https://github.com/ansilove/ansilove Source0: %{url}/releases/download/%{version}/%{name}-%{version}.tar.gz BuildRequires: libansilove-devel BuildRequires: cmake BuildRequires: gcc %description AnsiLove is an ANSI and ASCII art to PNG converter, allowing to convert ANSI and artscene-related file formats into PNG images, supporting ANSI (.ANS), PCBoard (.PCB), Binary (.BIN), Artworx (.ADF), iCE Draw (.IDF), Tundra (.TND) and XBin (.XB) formats. It creates size optimized 4-bit PNG files and supports SAUCE (Standard Architecture for Universal Comment Extentions), 80x25 and 80x50 PC fonts (including all the 14 MS-DOS charsets), Amiga fonts, and iCE colors. %prep %autosetup %build %cmake . %cmake_build %install %cmake_install %check %files %{_bindir}/%{name} %{_mandir}/man1/%{name}.1* %license LICENSE %doc README.md ansilove-4.2.0/compat/000077500000000000000000000000001443306107500146235ustar00rootroot00000000000000ansilove-4.2.0/compat/compat.h000066400000000000000000000011301443306107500162520ustar00rootroot00000000000000#ifndef COMPAT_H #define COMPAT_H #ifndef HAVE_PLEDGE #include "pledge.h" #endif #ifndef HAVE_STRTONUM #include "strtonum.h" #endif /* Use CLOCK_REALTIME if CLOCK_MONOTONIC is not available */ #ifndef CLOCK_MONOTONIC #define CLOCK_MONOTONIC CLOCK_REALTIME #endif #ifndef timespecsub #define timespecsub(tsp, usp, vsp) \ do { \ (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \ (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \ if ((vsp)->tv_nsec < 0) { \ (vsp)->tv_sec--; \ (vsp)->tv_nsec += 1000000000L; \ } \ } while (0) #endif #endif /* COMPAT_H */ ansilove-4.2.0/compat/pledge.c000066400000000000000000000001601443306107500162240ustar00rootroot00000000000000int pledge(const char *promises, const char *execpromises) { (void)promises; (void)execpromises; return 0; } ansilove-4.2.0/compat/pledge.h000066400000000000000000000000501443306107500162270ustar00rootroot00000000000000int pledge(const char *, const char *); ansilove-4.2.0/compat/strtonum.c000066400000000000000000000033501443306107500166630ustar00rootroot00000000000000/* $OpenBSD: strtonum.c,v 1.7 2013/04/17 18:40:58 tedu Exp $ */ /* * Copyright (c) 2004 Ted Unangst and Todd Miller * All rights reserved. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include #include #include #define INVALID 1 #define TOOSMALL 2 #define TOOLARGE 3 long long strtonum(const char *numstr, long long minval, long long maxval, const char **errstrp) { long long ll = 0; int error = 0; char *ep; struct errval { const char *errstr; int err; } ev[4] = { { NULL, 0 }, { "invalid", EINVAL }, { "too small", ERANGE }, { "too large", ERANGE }, }; ev[0].err = errno; errno = 0; if (minval > maxval) { error = INVALID; } else { ll = strtoll(numstr, &ep, 10); if (numstr == ep || *ep != '\0') error = INVALID; else if ((ll == LLONG_MIN && errno == ERANGE) || ll < minval) error = TOOSMALL; else if ((ll == LLONG_MAX && errno == ERANGE) || ll > maxval) error = TOOLARGE; } if (errstrp != NULL) *errstrp = ev[error].errstr; errno = ev[error].err; if (error) ll = 0; return (ll); } ansilove-4.2.0/compat/strtonum.h000066400000000000000000000001071443306107500166650ustar00rootroot00000000000000long long strtonum(const char *, long long, long long, const char **); ansilove-4.2.0/examples/000077500000000000000000000000001443306107500151565ustar00rootroot00000000000000ansilove-4.2.0/examples/burps/000077500000000000000000000000001443306107500163115ustar00rootroot00000000000000ansilove-4.2.0/examples/burps/LICENSE000066400000000000000000000024271443306107500173230ustar00rootroot00000000000000Copyright (c) 2017, Bart Dumon All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ansilove-4.2.0/examples/burps/bs-alove.ans000066400000000000000000000215471443306107500205350ustar00rootroot00000000000000  ܰ   ܲܰ ޲         ܰ߰               ߲             ߰      ܲ     ޲ ߰       ߲   ܱܲ ܲ ߲  ߰  ߱ܲ ܲ      ߲ ߰     ܰ  ޲       ۲ ܲ       ܱ      ۲     ߲߲    ߰    ܰ    ܱ   ܰ ܲ  ܲ     ܲܰ    ߱     ܰ߰    ܰ         ߲   ߰       ߰   ܲ ۲   ܲ     ޲        ߲     ߲  ߰  ߱ܲ ܲ        ߲ ߰      SAUCE00 20171007|P/IBM VGA ݰ   ߲߰ ߲   ܲ          ܰ  ߰  ߲      ߲߲ݰ    ߲            ߲߱  ܰ     ۲           ۲۲            SAUCE00ansilove burps fuel 20171019"P;IBM VGAansilove-4.2.0/examples/burps/bs-ansilove.ans000066400000000000000000000111711443306107500212370ustar00rootroot00000000000000  ansi ߰ݰ  ߲ ߲ ߲     ޱ ܲ ޲  ܲ      ޲   ۲  ܲ  ۲          ߲ ߲      ۲   ۲   ߲        ۱۲      ۲  ޲      ߲ ߲  ߲ ߲    ۲߱  ۲   ܲܰ   ܲ      ޲ ۲       ۲     ۲     ߲߰  ߲   ۲       ۲     ߲             ߰ ܲ۲ ܲ   ۲  bs  love   SAUCE00ansilove burps fuel 20170720PIBM VGAansilove-4.2.0/examples/cleaner/000077500000000000000000000000001443306107500165675ustar00rootroot00000000000000ansilove-4.2.0/examples/cleaner/LICENSE000066400000000000000000000024411443306107500175750ustar00rootroot00000000000000Copyright (c) 2004-2017, Frederic Cambus All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ansilove-4.2.0/examples/cleaner/cl!-al02.ans000066400000000000000000000125461443306107500204750ustar00rootroot00000000000000   ߲          ۲       ۲                                                ۲            ߲            ۲             ۱ܲ          ۰          Cl!                                ܲ                  ߲                 ANSiLOVE۲ Just create your own world,Cleaner(27")  August 2004 for the sake of art...http://cleaner.planet-d.net  A N S i  ansilove-4.2.0/examples/cleaner/cl!-al05.ans000066400000000000000000000152541443306107500204770ustar00rootroot00000000000000                                                                                                                                                                                                                                                                                                                                              Cl!                                                                                                                                                                                                                                             A  N  S  i  L    V  E             SAUCE00Ansilove - September 207 Cleaner Fuel 20170921+PIBM VGAansilove-4.2.0/examples/nail/000077500000000000000000000000001443306107500161015ustar00rootroot00000000000000ansilove-4.2.0/examples/nail/LICENSE000066400000000000000000000024341443306107500171110ustar00rootroot00000000000000Copyright (c) 2018, Björn Odendahl All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ansilove-4.2.0/examples/nail/n-silove.ans000066400000000000000000000146341443306107500203500ustar00rootroot00000000000000  ܲ  ܲ۰ ۲  ۲ ۲ ۲     ܰ           ܲ   ܲ    ߲                          ܰ       ܰ     ܰ߰  ߰   ܲ  ܰ                ۲  ߲۲  ޲   ݲ         ݰ  ܰ ۲        ۲                 ߰                         ߲            ޲                      ۲                  ߲ n!         ۲   ߰     ߲ܲܰ ۲  ۲         ܰ              ܲ          ߲         ߲                  ߰ܲ                    SAUCE00ansilove nail blocktronics 20181209P"IBM VGAansilove-4.2.0/man/000077500000000000000000000000001443306107500141135ustar00rootroot00000000000000ansilove-4.2.0/man/ansilove.1000066400000000000000000000130231443306107500160140ustar00rootroot00000000000000.\" .\" Copyright (c) 2011-2020, Stefan Vogt, Brian Cassidy, and Frederic Cambus .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions are met: .\" .\" * Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" .\" * Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" .\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" .Dd $Mdocdate: August 28 2020 $ .Dt ANSILOVE 1 .Os .Sh NAME .Nm ansilove .Nd ANSI / ASCII art to PNG converter .Sh SYNOPSIS .Nm .Op Fl dhiqrsSv .Op Fl b Ar bits .Op Fl c Ar columns .Op Fl f Ar font .Op Fl m Ar mode .Op Fl o Ar file .Op Fl R Ar factor .Op Fl t Ar type .Ar file .Sh DESCRIPTION .Nm is an ANSI / ASCII art to PNG converter, allowing to convert ANSI and artscene-related file formats into PNG images, supporting ANSI (.ANS), PCBoard (.PCB), Binary (.BIN), Artworx (.ADF), iCE Draw (.IDF), Tundra (.TND) and XBin (.XB) formats. .Pp It creates size optimized 4-bit PNG files and supports SAUCE (Standard Architecture for Universal Comment Extensions), 80x25 and 80x50 PC fonts (including all the 14 MS-DOS charsets), Amiga fonts, and iCE colors. .Pp The options are as follows: .Bl -tag -width 10n .It Fl b Ar bits Set to 9 to render 9th column of block characters (default: 8). .It Fl c Ar columns Adjust number of columns for ANSI, BIN, and TND files. .It Fl d Enable DOS aspect ratio. .It Fl f Ar font Select font for supported formats. .Pp Valid options for PC fonts are: .Bl -tag -width Er .It Ic 80x25 Default (Code page 437) .It Ic 80x50 80x50 mode (Code page 437) .It Ic cp737 Greek (Code page 737) .It Ic cp775 Baltic (Code page 775) .It Ic cp850 Latin1 (Code page 850) .It Ic cp852 Latin2 (Code page 852) .It Ic cp855 Cyrillic (Code page 855) .It Ic cp857 Turkish (Code page 857) .It Ic cp860 Portuguese (Code page 860) .It Ic cp861 Icelandic (Code page 861) .It Ic cp862 Hebrew (Code page 862) .It Ic cp863 French Canadian (Code page 863) .It Ic cp865 Nordic (Code page 865) .It Ic cp866 Russian (Code page 866) .It Ic cp869 Greek (Code page 869) .It Ic terminus Terminus (Modern font, code page 437) .El .Pp Valid options for Amiga fonts are: .Bl -tag -width Er .It Ic amiga Alias to Topaz, see below .It Ic microknight Original MicroKnight version .It Ic microknight+ Modified MicroKnight version .It Ic mosoul Original mO'sOul font .It Ic pot-noodle Original P0T-NOoDLE font .It Ic topaz Original Topaz Kickstart 2.x version .It Ic topaz+ Modified Topaz Kickstart 2.x+ version .It Ic topaz500 Original Topaz Kickstart 1.x version .It Ic topaz500+ Modified Topaz Kickstart 1.x version .El .It Fl h Show help. .It Fl i Enable iCE colors. .It Fl m Ar mode Set rendering mode for ANS files. .Pp Valid options are: .Bl -tag -width Ds .It Ic ced Black on gray, with 78 columns. .It Ic transparent Render with transparent background. .It Ic workbench Use Amiga Workbench palette. .El .It Fl o Ar file Specify output filename/path. .It Fl q Suppress output messages (quiet). .It Fl r Create Retina @2x output file. .It Fl R Ar factor Create Retina output file with custom scale factor. .It Fl t Ar type Specify input file type. .Pp Valid types are: .Bl -tag -width Ds .It Ic ans ANSi (ANSI escape sequences: ANSI X3.64 standard) .It Ic adf Artworx format, supporting custom character sets and palettes .It Ic bin Binary format (raw memory copy of text mode video memory) .It Ic idf iCE Draw format, supporting custom character sets and palettes .It Ic pcb PCBoard Bulletin Board System (BBS) own file format .It Ic tnd TundraDraw format, supporting 24-bit color mode .It Ic xb XBin format, supporting custom character sets and palettes .El .It Fl s Show SAUCE record without generating output. .It Fl S If available, use SAUCE info for render options (ex: width). .It Fl v Show version information. .El .Sh EXAMPLES To render a file with iCE colors enabled: .Pp .Dl $ ansilove -i file.ans .Pp To create a Retina @2x output file: .Pp .Dl $ ansilove -r file.ans .Pp To creates a Retina output file with a custom scale factor: .Pp .Dl $ ansilove -R 3 file.ans .Pp To only display SAUCE record without generating output: .Pp .Dl $ ansilove -s file.ans To render a file with transparent background: .Pp .Dl $ ansilove -m transparent file.ans .Pp To render a file using a custom font: .Pp .Dl $ ansilove -f amiga file.txt .Pp To render a file using a custom font, rendering the 9th column, enabling iCE colors, and using DOS aspect ratio: .Pp .Dl $ ansilove -f 80x50 -b 9 -d -i file.ans .Sh AUTHORS .An -nosplit .Nm was written by .An Stefan Vogt , .An Brian Cassidy , and .An Frederic Cambus . ansilove-4.2.0/src/000077500000000000000000000000001443306107500141275ustar00rootroot00000000000000ansilove-4.2.0/src/ansilove.c000066400000000000000000000265741443306107500161310ustar00rootroot00000000000000/* * ansilove.c * Ansilove 4.2.0 * https://www.ansilove.org * * Copyright (c) 2011-2023 Stefan Vogt, Brian Cassidy, and Frederic Cambus * All rights reserved. * * Ansilove is licensed under the BSD 2-Clause license. * See LICENSE file for details. * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_SECCOMP #include #include #include "seccomp.h" #endif #include "compat.h" #include "config.h" #include "fonts.h" #include "sauce.h" #include "strtolower.h" #include "types.h" /* prototypes */ static void synopsis(void); static void version(void); static void synopsis(void) { fprintf(stdout, "SYNOPSIS\n" " ansilove [-dhiqrsSv] [-b bits] [-c columns] [-f font]" " [-m mode] [-o file]\n" " [-R factor] [-t type] file\n"); } static void version(void) { fprintf(stdout, "AnsiLove/C %s - ANSI / ASCII art to PNG converter\n" "Copyright (c) 2011-2023 Stefan Vogt, Brian Cassidy, and " "Frederic Cambus.\n", VERSION); } int main(int argc, char *argv[]) { FILE *messages = NULL; /* SAUCE record related bool types */ bool justDisplaySAUCE = false; bool fileHasSAUCE = false; bool useSAUCEInfo = false; int opt; char *input = NULL, *output = NULL; char *fileName = NULL; char *font = NULL; char *type = NULL; int filetype = 0; struct timespec begin, end, elapsed; static struct ansilove_ctx ctx; static struct ansilove_options options; const char *errstr; if (pledge("stdio cpath rpath wpath", NULL) == -1) err(EXIT_FAILURE, "pledge"); #ifdef HAVE_SECCOMP if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) { perror("Can't initialize seccomp"); return EXIT_FAILURE; } if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &ansilove)) { perror("Can't load seccomp filter"); return EXIT_FAILURE; } #endif if (ansilove_init(&ctx, &options) == -1) errx(EXIT_FAILURE, "%s", ansilove_error(&ctx)); while ((opt = getopt(argc, argv, "b:c:df:him:o:qrR:sSt:v")) != -1) { switch (opt) { case 'b': options.bits = strtonum(optarg, 8, 9, &errstr); if (errstr) errx(EXIT_FAILURE, "Invalid value for bits (must be 8 or 9)."); break; case 'c': options.columns = strtonum(optarg, 1, 4096, &errstr); if (errstr) errx(EXIT_FAILURE, "\nInvalid value for columns (must range from 1 to 4096)."); break; case 'd': options.dos = true; break; case 'f': font = optarg; break; case 'h': synopsis(); return EXIT_SUCCESS; case 'i': options.icecolors = true; break; case 'm': if (!strcmp(optarg, "ced")) { options.mode = ANSILOVE_MODE_CED; } else if (!strcmp(optarg, "transparent")) { options.mode = ANSILOVE_MODE_TRANSPARENT; } else if (!strcmp(optarg, "workbench")) { options.mode = ANSILOVE_MODE_WORKBENCH; } break; case 'o': output = optarg; break; case 'q': messages = fopen("/dev/null", "w"); break; case 'r': options.scale_factor = 2; break; case 'R': options.scale_factor = strtonum(optarg, 2, 8, &errstr); if (errstr) errx(EXIT_FAILURE, "Invalid value for retina scale factor (must range from 2 to 8)."); break; case 's': justDisplaySAUCE = true; break; case 'S': useSAUCEInfo = true; break; case 't': type = strtolower(optarg); break; case 'v': version(); return EXIT_SUCCESS; } } if (optind < argc) { input = argv[optind]; } else { synopsis(); return EXIT_SUCCESS; } /* if -q flag was not set, default to stdout */ if (!messages) messages = stdout; /* Starting timer */ clock_gettime(CLOCK_MONOTONIC, &begin); /* let's check the file for a valid SAUCE record */ struct sauce *record = sauceReadFileName(input); /* record == NULL also means there is no file, we can stop here */ if (record == NULL) { errx(EXIT_FAILURE, "File %s not found.", input); } else { /* if we find a SAUCE record, update bool flag */ if (!strcmp(record->ID, SAUCE_ID)) { fileHasSAUCE = true; } } if (!justDisplaySAUCE) { /* gather rendering hints from SAUCE */ if (useSAUCEInfo && fileHasSAUCE) { bool usedSAUCE = false; if (record->dataType == 1) { if (record->fileType == 0 || record->fileType == 1 || record->fileType == 2) { options.columns = record->tinfo1; if (record->flags & 1) options.icecolors = true; if ((record->flags & 6) == 4) options.bits = 9; if ((record->flags & 24) == 8) options.dos = true; usedSAUCE = true; } if (record->fileType == 8) { options.columns = record->tinfo1; usedSAUCE = true; } } if (record->dataType == 5) { options.columns = record->tinfo1; usedSAUCE = true; } /* XBIN (dataType == 6) could also use tinfo1 for width, but we trust the XBIN header more */ /* font info */ if ((record->dataType == 1 && (record->fileType == 0 || record->fileType == 1 || record->fileType == 2)) || record->dataType == 5 ) { if (strcmp(record->tinfos, "IBM VGA") == 0) font = "80x25"; if (strcmp(record->tinfos, "IBM VGA50") == 0) font = "80x50"; if (strcmp(record->tinfos, "IBM VGA 437") == 0) font = "80x25"; if (strcmp(record->tinfos, "IBM VGA50 437") == 0) font = "80x50"; if (strcmp(record->tinfos, "IBM VGA 775") == 0) font = "baltic"; if (strcmp(record->tinfos, "IBM VGA50 855") == 0) font = "cyrillic"; if (strcmp(record->tinfos, "IBM VGA 863") == 0) font = "french-canadian"; if (strcmp(record->tinfos, "IBM VGA 737") == 0) font = "greek"; if (strcmp(record->tinfos, "IBM VGA 869") == 0) font = "greek-869"; if (strcmp(record->tinfos, "IBM VGA 862") == 0) font = "hebrew"; if (strcmp(record->tinfos, "IBM VGA 861") == 0) font = "icelandic"; if (strcmp(record->tinfos, "IBM VGA 850") == 0) font = "latin1"; if (strcmp(record->tinfos, "IBM VGA 852") == 0) font = "latin2"; if (strcmp(record->tinfos, "IBM VGA 865") == 0) font = "nordic"; if (strcmp(record->tinfos, "IBM VGA 860") == 0) font = "portuguese"; if (strcmp(record->tinfos, "IBM VGA 866") == 0) font = "russian"; if (strcmp(record->tinfos, "IBM VGA 857") == 0) font = "turkish"; if (strcmp(record->tinfos, "Amiga MicroKnight") == 0) font = "microknight"; if (strcmp(record->tinfos, "Amiga MicroKnight+") == 0) font = "microknight+"; if (strcmp(record->tinfos, "Amiga mOsOul") == 0) font = "mosoul"; if (strcmp(record->tinfos, "Amiga P0T-NOoDLE") == 0) font = "pot-noodle"; if (strcmp(record->tinfos, "Amiga Topaz 1") == 0) font = " topaz500"; if (strcmp(record->tinfos, "Amiga Topaz 1+") == 0) font = "topaz500+"; if (strcmp(record->tinfos, "Amiga Topaz 2") == 0) font = "topaz"; if (strcmp(record->tinfos, "Amiga Topaz 2+") == 0) font = "topaz+"; } if (usedSAUCE) fprintf(messages, "SAUCE info used for rendering hints\n\n"); } if (font) { for (size_t loop = 0; loop < FONTS; loop++) { if (!strcmp(fonts[loop], font)) { options.font = fontsId[loop]; break; } } } /* create output file name if output is not specified */ if (!output) { /* appending ".png" extension to output file name */ if (asprintf(&fileName, "%s%s", input, ".png") == -1) errx(EXIT_FAILURE, "Memory allocation error."); } else { fileName = strdup(output); if (!fileName) errx(EXIT_FAILURE, "Memory allocation error."); } /* display name of input and output files */ fprintf(messages, "Input File: %s\n", input); fprintf(messages, "Output File: %s\n", fileName); /* get file extension */ char *fext = strrchr(input, '.'); fext = fext ? strtolower(strdup(++fext)) : strdup(""); if (!fext) errx(EXIT_FAILURE, "Memory allocation error."); /* check if current file has a .diz extension */ if (!strcmp(fext, "diz")) options.diz = true; if (ansilove_loadfile(&ctx, input) == -1) errx(EXIT_FAILURE, "%s", ansilove_error(&ctx)); /* adjust the file size if file contains a SAUCE record */ if (fileHasSAUCE) ctx.length -= 129 - (record->comments > 0 ? 5 + 64 * record->comments : 0); int (*loader)(struct ansilove_ctx *, struct ansilove_options *) = NULL; /* if type was specified, attempt to find a loader */ if (type) { for (size_t loop = 0; loop < TYPES; loop++) { if (!strcmp(types[loop], type)) { loader = loaders[loop]; filetype = filetypes[loop]; break; } } if (!loader) errx(EXIT_FAILURE, "Unknown file type."); } /* use file extension to find a suitable loader */ if (!loader) { for (size_t loop = 0; loop < TYPES; loop++) { if (!strcmp(types[loop], fext)) { loader = loaders[loop]; filetype = filetypes[loop]; break; } } } /* default to ANSI if file extension is unknown */ if (!loader) { loader = ansilove_ansi; filetype = ANSILOVE_FILETYPE_ANS; } if (loader(&ctx, &options) == -1) errx(EXIT_FAILURE, "%s", ansilove_error(&ctx)); /* create the output file */ if (ansilove_savefile(&ctx, fileName) == -1) errx(EXIT_FAILURE, "%s", ansilove_error(&ctx)); /* gather information and report to the command line */ switch(filetype) { case ANSILOVE_FILETYPE_ANS: case ANSILOVE_FILETYPE_BIN: if (options.icecolors) fprintf(messages, "iCE Colors: enabled\n"); /* FALLTHROUGH */ case ANSILOVE_FILETYPE_PCB: case ANSILOVE_FILETYPE_TND: fprintf(messages, "Font: %s\n", font ? font : "80x25"); fprintf(messages, "Bits: %d\n", options.bits); fprintf(messages, "Columns: %d\n", options.columns); } if (options.scale_factor) fprintf(messages, "Scale factor: %d\n", options.scale_factor); free(fileName); free(fext); } /* either display SAUCE or tell us if there is no record */ if (!fileHasSAUCE) { fprintf(messages, "\nFile %s does not have a SAUCE record.\n", input); } else { fprintf(messages, "\nId: %s v%s\n", record->ID, record->version); fprintf(messages, "Title: %s\n", record->title); fprintf(messages, "Author: %s\n", record->author); fprintf(messages, "Group: %s\n", record->group); fprintf(messages, "Date: %s\n", record->date); fprintf(messages, "Datatype: %d\n", record->dataType); fprintf(messages, "Filetype: %d\n", record->fileType); if (record->flags) fprintf(messages, "Flags: 0b%d%d%d%d%d%d%d%d\n", record->flags >> 7, record->flags >> 6 & 1, record->flags >> 5 & 1, record->flags >> 4 & 1, record->flags >> 3 & 1, record->flags >> 2 & 1, record->flags >> 1 & 1, record->flags & 1); if (record->tinfo1) fprintf(messages, "Tinfo1: %d\n", record->tinfo1); if (record->tinfo2) fprintf(messages, "Tinfo2: %d\n", record->tinfo2); if (record->tinfo3) fprintf(messages, "Tinfo3: %d\n", record->tinfo3); if (record->tinfo4) fprintf(messages, "Tinfo4: %d\n", record->tinfo4); fprintf(messages, "Tinfos: %s\n", record->tinfos); if (record->comments > 0) { fprintf(messages, "Comments: "); for (int32_t i = 0; i < record->comments; i++) fprintf(messages, "%s\n", record->comment_lines[i]); } } /* Stopping timer */ clock_gettime(CLOCK_MONOTONIC, &end); timespecsub(&end, &begin, &elapsed); fprintf(stderr, "Processed in %f seconds.\n", elapsed.tv_sec + elapsed.tv_nsec / 1E9); ansilove_clean(&ctx); free(record->comment_lines); free(record); return EXIT_SUCCESS; } ansilove-4.2.0/src/config.h000066400000000000000000000007261443306107500155520ustar00rootroot00000000000000/* * config.h * Ansilove 4.2.0 * https://www.ansilove.org * * Copyright (c) 2011-2023 Stefan Vogt, Brian Cassidy, and Frederic Cambus * All rights reserved. * * Ansilove is licensed under the BSD 2-Clause license. * See LICENSE file for details. * * SPDX-License-Identifier: BSD-2-Clause */ #ifndef CONFIG_H #define CONFIG_H #include /* configuration defines */ #define VERSION "4.2.0" enum { FONTS = 38, TYPES = 7 }; #endif /* CONFIG_H */ ansilove-4.2.0/src/fonts.h000066400000000000000000000046621443306107500154410ustar00rootroot00000000000000/* * fonts.h * Ansilove 4.2.0 * https://www.ansilove.org * * Copyright (c) 2011-2023 Stefan Vogt, Brian Cassidy, and Frederic Cambus * All rights reserved. * * Ansilove is licensed under the BSD 2-Clause license. * See LICENSE file for details. * * SPDX-License-Identifier: BSD-2-Clause */ #ifndef FONTS_H #define FONTS_H char *fonts[] = { "cp737", /* Greek */ "cp775", /* Baltic */ "cp850", /* Latin 1 */ "cp852", /* Latin 2 */ "cp855", /* Cyrillic */ "cp857", /* Turkish */ "cp860", /* Portuguese */ "cp861", /* Icelandic */ "cp862", /* Hebrew */ "cp863", /* French-canadian */ "cp865", /* Nordic */ "cp866", /* Russian */ "cp869", /* Greek */ "80x25", "80x50", "greek", "baltic", "latin1", "latin2", "cyrillic", "turkish", "portuguese", "icelandic", "hebrew", "french-canadian", "nordic", "russian", "greek-869", "spleen", "terminus", "amiga", "microknight", "microknight+", "mosoul", "pot-noodle", "topaz", "topaz+", "topaz500", "topaz500+" }; int fontsId[] = { ANSILOVE_FONT_CP737, /* Greek */ ANSILOVE_FONT_CP775, /* Baltic */ ANSILOVE_FONT_CP850, /* Latin 1 */ ANSILOVE_FONT_CP852, /* Latin 2 */ ANSILOVE_FONT_CP855, /* Cyrillic */ ANSILOVE_FONT_CP857, /* Turkish */ ANSILOVE_FONT_CP860, /* Portuguese */ ANSILOVE_FONT_CP861, /* Icelandic */ ANSILOVE_FONT_CP862, /* Hebrew */ ANSILOVE_FONT_CP863, /* French-canadian */ ANSILOVE_FONT_CP865, /* Nordic */ ANSILOVE_FONT_CP866, /* Russian */ ANSILOVE_FONT_CP869, /* Greek */ ANSILOVE_FONT_CP437, /* IBM PC 80x25 */ ANSILOVE_FONT_CP437_80x50, /* IBM PC 80x50 */ ANSILOVE_FONT_CP737, /* Greek */ ANSILOVE_FONT_CP775, /* Baltic */ ANSILOVE_FONT_CP850, /* Latin 1 */ ANSILOVE_FONT_CP852, /* Latin 2 */ ANSILOVE_FONT_CP855, /* Cyrillic */ ANSILOVE_FONT_CP857, /* Turkish */ ANSILOVE_FONT_CP860, /* Portuguese */ ANSILOVE_FONT_CP861, /* Icelandic */ ANSILOVE_FONT_CP862, /* Hebrew */ ANSILOVE_FONT_CP863, /* French-canadian */ ANSILOVE_FONT_CP865, /* Nordic */ ANSILOVE_FONT_CP866, /* Russian */ ANSILOVE_FONT_CP869, /* Greek */ ANSILOVE_FONT_SPLEEN, ANSILOVE_FONT_TERMINUS, ANSILOVE_FONT_TOPAZ, /* Alias: amiga */ ANSILOVE_FONT_MICROKNIGHT, ANSILOVE_FONT_MICROKNIGHT_PLUS, ANSILOVE_FONT_MOSOUL, ANSILOVE_FONT_POT_NOODLE, ANSILOVE_FONT_TOPAZ, ANSILOVE_FONT_TOPAZ_PLUS, ANSILOVE_FONT_TOPAZ500, ANSILOVE_FONT_TOPAZ500_PLUS }; #endif /* FONTS_H */ ansilove-4.2.0/src/sauce.c000066400000000000000000000070001443306107500153700ustar00rootroot00000000000000/* * sauce.c * Ansilove 4.2.0 * https://www.ansilove.org * * Copyright (c) 2011-2023 Stefan Vogt, Brian Cassidy, and Frederic Cambus * All rights reserved. * * Ansilove is licensed under the BSD 2-Clause license. * See LICENSE file for details. * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include #include "sauce.h" /* Reads SAUCE via a filename. */ struct sauce * sauceReadFileName(char *fileName) { FILE *file = fopen(fileName, "r"); if (file == NULL) { return NULL; } struct sauce *record = sauceReadFile(file); fclose(file); return record; } /* Read SAUCE via a FILE pointer. */ struct sauce * sauceReadFile(FILE *file) { struct sauce *record; record = malloc(sizeof *record); if (record != NULL) { memset(record, 0, sizeof *record); readRecord(file, record); } return record; } #define READ_RECORD(record, size) \ read_status = fread(record, size, 1, file); \ if (read_status != 1) \ return; void readRecord(FILE *file, struct sauce *record) { size_t read_status; if (fseek(file, 0 - RECORD_SIZE, SEEK_END) != 0) { return; } read_status = fread(record->ID, sizeof (record->ID) - 1, 1, file); record->ID[sizeof (record->ID) - 1] = '\0'; if (read_status != 1 || strcmp(record->ID, SAUCE_ID) != 0) { return; } READ_RECORD(record->version, sizeof(record->version) - 1); record->version[sizeof (record->version) - 1] = '\0'; READ_RECORD(record->title, sizeof(record->title) - 1); record->title[sizeof (record->title) - 1] = '\0'; READ_RECORD(record->author, sizeof(record->author) -1); record->author[sizeof (record->author) - 1] = '\0'; READ_RECORD(record->group, sizeof(record->group) - 1); record->group[sizeof (record->group) - 1] = '\0'; READ_RECORD(record->date, sizeof(record->date) - 1); record->date[sizeof (record->date) - 1] = '\0'; READ_RECORD(&(record->fileSize), sizeof (record->fileSize)); READ_RECORD(&(record->dataType), sizeof (record->dataType)); READ_RECORD(&(record->fileType), sizeof (record->fileType)); READ_RECORD(&(record->tinfo1), sizeof (record->tinfo1)); READ_RECORD(&(record->tinfo2), sizeof (record->tinfo2)); READ_RECORD(&(record->tinfo3), sizeof (record->tinfo3)); READ_RECORD(&(record->tinfo4), sizeof (record->tinfo4)); READ_RECORD(&(record->comments), sizeof (record->comments)); READ_RECORD(&(record->flags), sizeof (record->flags)); READ_RECORD(record->tinfos, sizeof(record->tinfos) - 1); record->tinfos[sizeof (record->tinfos) - 1] = '\0'; if (ferror(file) != 0) { return; } if (record->comments > 0) { record->comment_lines = malloc(record->comments *sizeof (*record->comment_lines)); if (record->comment_lines != NULL) { if (readComments(file, record->comment_lines, record->comments) == -1) { record->comments = 0; } } } } int readComments(FILE *file, char **comment_lines, int32_t comments) { int32_t i; size_t read_status; if (fseek(file, 0 - (RECORD_SIZE + 5 + COMMENT_SIZE *comments), SEEK_END) == 0) { char ID[6]; read_status = fread(ID, sizeof (ID) - 1, 1, file); if (read_status != 1) return -1; ID[sizeof (ID) - 1] = '\0'; if (strcmp(ID, COMMENT_ID) != 0) { return -1; } for (i = 0; i < comments; i++) { char buf[COMMENT_SIZE + 1] = ""; read_status = fread(buf, COMMENT_SIZE, 1, file); if (read_status != 1) return -1; buf[COMMENT_SIZE] = '\0'; if (ferror(file) == 0) { comment_lines[i] = strdup(buf); if (comment_lines[i] == NULL) { return -1; } } else { return -1; } } return 0; } return -1; } ansilove-4.2.0/src/sauce.h000066400000000000000000000020471443306107500154030ustar00rootroot00000000000000/* * sauce.h * Ansilove 4.2.0 * https://www.ansilove.org * * Copyright (c) 2011-2023 Stefan Vogt, Brian Cassidy, and Frederic Cambus * All rights reserved. * * Ansilove is licensed under the BSD 2-Clause license. * See LICENSE file for details. * * SPDX-License-Identifier: BSD-2-Clause */ #ifndef SAUCE_H #define SAUCE_H #include #include /* sauce records */ #define RECORD_SIZE 128 #define COMMENT_SIZE 64 #define SAUCE_ID "SAUCE" #define COMMENT_ID "COMNT" struct sauce { char ID[6]; char version[3]; char title[36]; char author[21]; char group[21]; char date[9]; int32_t fileSize; unsigned char dataType; unsigned char fileType; unsigned short tinfo1; unsigned short tinfo2; unsigned short tinfo3; unsigned short tinfo4; unsigned char comments; unsigned char flags; char tinfos[23]; char **comment_lines; }; struct sauce *sauceReadFileName(char *); struct sauce *sauceReadFile(FILE *); void readRecord(FILE *, struct sauce *); int readComments(FILE *, char **, int32_t); #endif /* SAUCE_H */ ansilove-4.2.0/src/seccomp.h000066400000000000000000000045151443306107500157360ustar00rootroot00000000000000/* * seccomp.h * Ansilove 4.2.0 * https://www.ansilove.org * * Copyright (c) 2019-2023, Frederic Cambus * All rights reserved. * * Ansilove is licensed under the BSD 2-Clause license. * See LICENSE file for details. * * SPDX-License-Identifier: BSD-2-Clause */ #ifndef SECCOMP_H #define SECCOMP_H #include #include #include #include #include #include #include #if defined(__i386__) #define SECCOMP_AUDIT_ARCH AUDIT_ARCH_I386 #elif defined(__x86_64__) #define SECCOMP_AUDIT_ARCH AUDIT_ARCH_X86_64 #elif defined(__arm__) #define SECCOMP_AUDIT_ARCH AUDIT_ARCH_ARM #elif defined(__aarch64__) #define SECCOMP_AUDIT_ARCH AUDIT_ARCH_AARCH64 #else #error "Seccomp is only supported on i386, x86_64, arm, and aarch64 architectures." #endif #define ANSILOVE_SYSCALL_ALLOW(syscall) \ BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, __NR_##syscall, 0, 1), \ BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_ALLOW) static struct sock_filter filter[] = { /* Validate architecture */ BPF_STMT(BPF_LD+BPF_W+BPF_ABS, offsetof(struct seccomp_data, arch)), BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, SECCOMP_AUDIT_ARCH, 1, 0), BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL), /* Load syscall */ BPF_STMT(BPF_LD+BPF_W+BPF_ABS, offsetof(struct seccomp_data, nr)), ANSILOVE_SYSCALL_ALLOW(brk), ANSILOVE_SYSCALL_ALLOW(clock_gettime), /* i386 glibc */ ANSILOVE_SYSCALL_ALLOW(close), ANSILOVE_SYSCALL_ALLOW(exit_group), ANSILOVE_SYSCALL_ALLOW(fstat), #if defined(__NR_fstat64) ANSILOVE_SYSCALL_ALLOW(fstat64), /* i386 glibc */ #endif ANSILOVE_SYSCALL_ALLOW(ioctl), ANSILOVE_SYSCALL_ALLOW(lseek), #if defined(__NR__llseek) ANSILOVE_SYSCALL_ALLOW(_llseek), /* i386 glibc */ #endif #if defined(__NR_open) ANSILOVE_SYSCALL_ALLOW(open), #endif ANSILOVE_SYSCALL_ALLOW(openat), ANSILOVE_SYSCALL_ALLOW(madvise), #if defined(__NR_mmap) ANSILOVE_SYSCALL_ALLOW(mmap), #endif #if defined(__NR_mmap2) ANSILOVE_SYSCALL_ALLOW(mmap2), /* i386 glibc */ #endif ANSILOVE_SYSCALL_ALLOW(mremap), ANSILOVE_SYSCALL_ALLOW(munmap), ANSILOVE_SYSCALL_ALLOW(read), ANSILOVE_SYSCALL_ALLOW(readv), ANSILOVE_SYSCALL_ALLOW(write), ANSILOVE_SYSCALL_ALLOW(writev), BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_KILL) }; struct sock_fprog ansilove = { .len = sizeof(filter)/sizeof(filter[0]), .filter = filter }; #endif /* SECCOMP_H */ ansilove-4.2.0/src/strtolower.c000066400000000000000000000007331443306107500165220ustar00rootroot00000000000000/* * strtolower.c * Ansilove 4.2.0 * https://www.ansilove.org * * Copyright (c) 2011-2023 Stefan Vogt, Brian Cassidy, and Frederic Cambus * All rights reserved. * * Ansilove is licensed under the BSD 2-Clause license. * See LICENSE file for details. * * SPDX-License-Identifier: BSD-2-Clause */ #include #include "strtolower.h" char * strtolower(char *str) { char *p = str; while (*p) { *p = tolower((unsigned char)*p); p++; } return str; } ansilove-4.2.0/src/strtolower.h000066400000000000000000000007231443306107500165260ustar00rootroot00000000000000/* * strtolower.h * Ansilove 4.2.0 * https://www.ansilove.org * * Copyright (c) 2011-2023 Stefan Vogt, Brian Cassidy, and Frederic Cambus * All rights reserved. * * Ansilove is licensed under the BSD 2-Clause license. * See LICENSE file for details. * * SPDX-License-Identifier: BSD-2-Clause */ #ifndef STRTOLOWER_H #define STRTOLOWER_H /* In-place modification of a string to be all lower case. */ char *strtolower(char *); #endif /* STRTOLOWER_H */ ansilove-4.2.0/src/types.c000066400000000000000000000014521443306107500154410ustar00rootroot00000000000000/* * types.c * Ansilove 4.2.0 * https://www.ansilove.org * * Copyright (c) 2011-2023 Stefan Vogt, Brian Cassidy, and Frederic Cambus * All rights reserved. * * Ansilove is licensed under the BSD 2-Clause license. * See LICENSE file for details. * * SPDX-License-Identifier: BSD-2-Clause */ #include "ansilove.h" #include "types.h" char *types[] = { "ans", "adf", "bin", "idf", "pcb", "tnd", "xb", }; int filetypes[] = { ANSILOVE_FILETYPE_ANS, ANSILOVE_FILETYPE_ADF, ANSILOVE_FILETYPE_BIN, ANSILOVE_FILETYPE_IDF, ANSILOVE_FILETYPE_PCB, ANSILOVE_FILETYPE_TND, ANSILOVE_FILETYPE_XB }; int (*loaders[])(struct ansilove_ctx *, struct ansilove_options *) = { ansilove_ansi, ansilove_artworx, ansilove_binary, ansilove_icedraw, ansilove_pcboard, ansilove_tundra, ansilove_xbin }; ansilove-4.2.0/src/types.h000066400000000000000000000013561443306107500154510ustar00rootroot00000000000000/* * types.h * Ansilove 4.2.0 * https://www.ansilove.org * * Copyright (c) 2011-2023 Stefan Vogt, Brian Cassidy, and Frederic Cambus * All rights reserved. * * Ansilove is licensed under the BSD 2-Clause license. * See LICENSE file for details. * * SPDX-License-Identifier: BSD-2-Clause */ #ifndef TYPES_H #define TYPES_H #define ANSILOVE_FILETYPE_ANS 1 #define ANSILOVE_FILETYPE_ADF 2 #define ANSILOVE_FILETYPE_BIN 3 #define ANSILOVE_FILETYPE_IDF 4 #define ANSILOVE_FILETYPE_PCB 5 #define ANSILOVE_FILETYPE_TND 6 #define ANSILOVE_FILETYPE_XB 7 struct ansilove_ctx; struct ansilove_options; extern char *types[]; extern int filetypes[]; extern int (*loaders[])(struct ansilove_ctx *, struct ansilove_options *); #endif /* TYPES_H */ ansilove-4.2.0/tests/000077500000000000000000000000001443306107500145025ustar00rootroot00000000000000ansilove-4.2.0/tests/bs-alove.adf000066400000000000000000000326411443306107500166740ustar00rootroot00000000000000************?**?**?****?*??*****?*?*????**?*?*??****??*?*?**?**?????*?*?*??*??*????*????????????~~~~l|88||8<<<<~~<_/U*U*U*U*U*_UUUUtvTÙ2xx><~~<fffffffff{|`8ll8 |<~~<~<~~< 0``0$ff$88||||88<<<fff$lllllll||| 0`Ɔ8ll8vv000` 000000 0 0f<l8l||||`0||0xv`0v~ x|||~~8ld`````f<ff|bfofff~p0`x |v 08<0`||0`vvffffffv~8ll8|0000`|0`Λ 0fΖ><<<6ll6l6lDDDDDDDDUUUUUUUUwwwwwwww66666666666666666666666666666666666666666666666666666666666666666666666666666667666666666666670??07666666666666666666666666667076666666666666666666666666666666666666666666??66666666666666666666666vvxlllllll`00`~pfffff|``v~ffff<~~~~`0``|```0|~0  0~ 0`0 ~p~vv8ll8 ll<lllllp0`|||||||                                                                                                                                                                                                                                                                                                                                                                                                                                                        ] ]]                LLL                                           ]]   ]       L||| LLL || L            L =]   ]]  LLL |LL LLL LLLLLLL L         ]  ]]      L    L L    L        ]]]   =] ]  ]  ]]   ] ]]  LLL   x   ]  ]]   ]  ] ]  ] =]  xxxx x x ] ]   ]]  ] =]  ]]] ]     xxxxxxxxx xxxxx  ]] ]  ] ]  ]]]  ]]                                                    L                                                                   LL                                                                                                                                                                                                                                                                                                                                                                       xx                                                                                                                                l      x    ]                      x  ]]                    nn~~nnnnxx                   nn xxx  ]]]  x               nnn      xxx   x x             l   x    ] ]] xxx      LLL xx            l    x    ]]   ]       L||| LLL || L                 | Lllxx   L =]   ]]  LLL |LL LLL LLLLLLL L                || lx   ]  ]]      L    L L    L                   lll l    ]]]   =] ]  ]  ]]   ] ]]  LLL                lll   ll   ]  ]]   ]  ] ]  ] =]         n     | l        ] ]   ]]  ] =]  ]]] ]             o   l         ]] ]  ] ]  ]]]  ]]                                          L                                                           LL                                                                                                                                                                                                                                                              SAUCE00                                                                          20171007| P / IBM VGA                                                                                                                                                                   |L |                 ]                        x LLL   }} ]                    |      LL ||    ]  }                L LL  L| |L LL  L x ]]  ]] x                LLL   LLL L  LL  LL   ]                     TLTTL LLLLL  L T  ]E ] ]] }]  ]] ]  ]             T  TTT  LT L TTTT   E ]E] ]]]]              TT TT TTT   ]EEEEEE EE E                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ansilove-4.2.0/tests/bs-alove.ans000066400000000000000000000215471443306107500167260ustar00rootroot00000000000000  ܰ   ܲܰ ޲         ܰ߰               ߲             ߰      ܲ     ޲ ߰       ߲   ܱܲ ܲ ߲  ߰  ߱ܲ ܲ      ߲ ߰     ܰ  ޲       ۲ ܲ       ܱ      ۲     ߲߲    ߰    ܰ    ܱ   ܰ ܲ  ܲ     ܲܰ    ߱     ܰ߰    ܰ         ߲   ߰       ߰   ܲ ۲   ܲ     ޲        ߲     ߲  ߰  ߱ܲ ܲ        ߲ ߰      SAUCE00 20171007|P/IBM VGA ݰ   ߲߰ ߲   ܲ          ܰ  ߰  ߲      ߲߲ݰ    ߲            ߲߱  ܰ     ۲           ۲۲            SAUCE00ansilove burps fuel 20171019"P;IBM VGAansilove-4.2.0/tests/bs-alove.bin000066400000000000000000000223401443306107500167050ustar00rootroot00000000000000                                                                                                                                                                                                                                                                                                                                                                                                                                                        ] ]]                LLL                                           ]]   ]       L||| LLL || L            L =]   ]]  LLL |LL LLL LLLLLLL L         ]  ]]      L    L L    L        ]]]   =] ]  ]  ]]   ] ]]  LLL   x   ]  ]]   ]  ] ]  ] =]  xxxx x x ] ]   ]]  ] =]  ]]] ]     xxxxxxxxx xxxxx  ]] ]  ] ]  ]]]  ]]                                                    L                                                                   LL                                                                                                                                                                                                                                                                                                                                                                       xx                                                                                                                                l      x    ]                      x  ]]                    nn~~nnnnxx                   nn xxx  ]]]  x               nnn      xxx   x x             l   x    ] ]] xxx      LLL xx            l    x    ]]   ]       L||| LLL || L                 | Lllxx   L =]   ]]  LLL |LL LLL LLLLLLL L                || lx   ]  ]]      L    L L    L                   lll l    ]]]   =] ]  ]  ]]   ] ]]  LLL                lll   ll   ]  ]]   ]  ] ]  ] =]         n     | l        ] ]   ]]  ] =]  ]]] ]             o   l         ]] ]  ] ]  ]]]  ]]                                          L                                                           LL                                                                                                                                                                                                                                                              SAUCE00                                                                          20171007| P / IBM VGA                                                                                                                                                                   |L |                 ]                        x LLL   }} ]                    |      LL ||    ]  }                L LL  L| |L LL  L x ]]  ]] x                LLL   LLL L  LL  LL   ]                     TLTTL LLLLL  L T  ]E ] ]] }]  ]] ]  ]             T  TTT  LT L TTTT   E ]E] ]]]]              TT TT TTT   ]EEEEEE EE E                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ansilove-4.2.0/tests/bs-alove.pcb000066400000000000000000000165131443306107500167060ustar00rootroot00000000000000@X07 @X0D@X05 @X07 @X0D@X5D@X0D@X5D@X05@X07 @X04@X0C@X04@X07 @X0C@X04@X0C@X4Cܰ@X04 @X07 @X0F@X07 @X05@X5D@X0F @X04 @X0D@X5D@X05@X07 @X0C@X4C@X7Cܲ@X0C@X4Cܰ@X04@X0C@X7C@X0C@X4C@X04 @X05@X7F޲@X0F@X7F@X07 @X0F@X7F@X0F@X7F@X07 @X05 @X0F@X7F@X0F@X7F@X07 @X0F@X7F@X07 @X0D@X05@X04@X4C@X0F @X3D@X5D@X0F @X04 @X0D@X5D@X0F @X0C@X4Cܰ@X04@X0C@X7C@X4C@X0C@X4C@X0C@X4C߰@X04@X4C@X0C@X4C @X05 @X07@X0F@X7F@X07 @X0F@X7F@X0F@X7F@X07 @X0F@X7F@X07 @X0F@X7F@X07 @X0F@X07 @X05@X0D @X04@X0D@X5D@X05 @X0D@X5D@X05 @X0D@X05 @X4C@X0F @X0D@X05 @X0C@X4C@X0C@X4C@X0C @X0D@X05 @X04߲ @X0C@X4C @X0F @X7F@X0F@X7F@X0F@X7F@X0F @X7F@X0F@X07 @X05@X0F@X7F@X07@X0F@X7F@X0F@X7F@X0F@X07 @X05@X0F@X7F@X07 @X05@X0D@X05@X0D@X5D@X05@X5D@X05 @X0D@X3D@X5D@X0D@X5D@X05 @X5D@X05 @X04 @X5D@X0F @X0D@X5D@X0D@X5D@X05 @X04@X4C߰ @X0F @X7F@X07@X05@X07@X0F@X7F@X0F @X7F@X0F@X07@X05@X0F@X7F@X78@X05 @X07@X0F@X7F@X0F@X7F@X07@X0F@X7F@X08@X04 @X0D@X5D@X05 @X04ܲ@X0D@X5D@X0F @X04 @X0D@X5D@X05 @X0D@X5D@X05@X04@X0D@X5D@X05 @X0D@X5D@X05@X04@X0C @X3D@X5D@X05@X04޲ @X07@X7F߰@X07@X78@X7F@X07@X78@X7F@X07@X05@X07@X7F@X78@X05@X08@X78@X7F@X07 @X7F@X78@X08 @X78@X08@X05@X0D@X5D@X05@X0D@X5D@X05 @X04 @X0D@X5D@X05 @X04 @X05@X5D@X0D@X05@X3D@X5D@X0F @X04@X0D@X5D@X05߲@X5D@X0D@X05@X5D@X05 @X04 @X05 @X07@X78ܱ@X08@X78@X08@X78@X08@X05@X08@X78ܲ@X05 @X08@X78ܲ@X08 @X07@X08@X05@X0D@X5D@X05߲@X5D@X05@X0D@X5D@X0D@X05 @X5D@X05@X0D@X5D@X05 @X04@X0D@X5D߰@X05 @X04 @X05@X5D߱@X05@X0D@X05ܲ @X04ܲ @X07 @X05 @X04 @X05 @X04 @X05 @X04߲@X4C@X0C @X05߰ @X04 @X07 @X04@X4C@X0C @X07 @X04 @X07 @X78@X07 @X7Fܰ@X07@X7F@X07 @X0F@X07 @X0C@X6C@X06@X07 @X78@X7F@X07@X08@X07 @X05@X5D@X05@X7F޲@X0F@X7F@X07 @X0F@X7F@X0F@X7F@X07 @X05 @X0F@X7F@X0F@X7F@X07 @X0F@X7F@X07 @X06@X0E@X06 @X0E@X06@X08@X78@X07@X08 @X07@X7F@X07۲ @X05ܲ@X5D@X05 @X07@X0F@X7F@X07 @X0F@X7F@X0F@X7F@X07 @X0F@X7F@X07 @X0F@X7F@X07 @X0F@X07 @X06@X0E@X6E@X7E@X0E@X6E@X06@X08@X07@X7F@X07@X78@X07@X08@X07 @X05ܱ@X0F@X7F@X0F@X7F@X0F@X7F@X0F @X7F@X0F@X07 @X05@X0F@X7F@X07@X0F@X7F@X0F@X7F@X0F@X07 @X05@X0F@X7F@X07 @X06@X6E@X0E@X6E@X06@X0E @X07@X7F@X07@X08@X78@X07@X78@X07@X08 @X05@X5D@X05۲ @X0F@X7F@X07@X05@X07@X0F@X7F@X0F @X7F@X0F@X07@X05@X0F@X7F@X78@X05 @X07@X0F@X7F@X0F@X7F@X07@X0F@X7F@X08 @X07 @X0C @X06߲@X6E߲@X06@X0E@X06 @X07@X7F@X07 @X08@X07@X08@X07 @X05 @X07@X7F߰@X07@X78@X7F@X07@X78@X7F@X07@X05@X07@X7F@X78@X05@X08@X07 @X7F@X78@X08 @X78@X07@X08 @X07 @X0C@X6C@X0C @X06ܰ @X07@X7F@X07@X08@X78@X07 @X05 @X0D@X5D@X0D@X5D@X05 @X07@X78ܱ@X08 @X04@X0C@X04 @X05@X08@X07 @X0C@X04@X0C@X4Cܰ@X04@X08 @X78ܲ@X08 @X07 @X06@X6C@X06@X0C@X06@X0C @X06ܲ @X08@X07 @X08@X78@X07 @X05@X5D@X0F @X04 @X0D@X5D@X05@X07 @X0C@X4C@X7Cܲ@X0C@X4Cܰ@X04@X0C@X7C@X0C@X4C@X04 @X06 @X08 @X06 @X0C@X7C@X0C@X4C@X6C@X06߱@X78@X08@X07 @X0D@X05@X04@X4C@X0F @X3D@X5D@X0F @X04 @X0D@X5D@X0F @X0C@X4Cܰ@X04@X0C@X7C@X4C@X0C@X4C@X0C@X4C߰@X04@X4C@X0C@X4C @X0F @X06 @X0C@X06 @X0C@X7C@X0C@X6C@X06ܰ@X08@X78@X08 @X05@X0D @X04@X0D@X5D@X05 @X0D@X5D@X05 @X0D@X05 @X4C@X0F @X0D@X05 @X0C@X4C@X0C@X4C@X0C @X0D@X05 @X04߲ @X0C@X4C @X07 @X06 @X0C@X6C߰@X06@X6C@X0C@X6C@X06@X08 @X05@X0D@X05@X0D@X5D@X05@X5D@X05 @X0D@X3D@X5D@X0D@X5D@X05 @X5D@X05 @X04 @X5D@X0F @X0D@X5D@X0D@X5D@X05 @X04@X4C߰ @X0F @X06 @X0C@X6Cܲ@X06 @X0C@X6C@X06۲ @X04 @X0D@X5D@X05 @X04ܲ@X0D@X5D@X0F @X04 @X0D@X5D@X05 @X0D@X5D@X05@X04@X0D@X5D@X05 @X0D@X5D@X05@X04@X0C @X3D@X5D@X05@X04޲ @X6E@X06 @X7C@X0C@X6C@X06 @X08@X07 @X06@X05@X0D@X5D@X05@X0D@X5D@X05 @X04 @X0D@X5D@X05 @X04 @X05@X5D@X0D@X05@X3D@X5D@X0F @X04@X0D@X5D@X05߲@X5D@X0D@X05@X5D@X05 @X04 @X05 @X06@X6F@X06 @X0C@X6C@X06 @X05@X0D@X5D@X05߲@X5D@X05@X0D@X5D@X0D@X05 @X5D@X05@X0D@X5D@X05 @X04@X0D@X5D߰@X05 @X04 @X05@X5D߱@X05@X0D@X05ܲ @X04ܲ @X07 @X06 @X0C @X06@X07 @X05 @X04 @X05 @X04 @X05 @X04߲@X4C@X0C @X05߰ @X04 @X07 @X7F@X07 @X0C @X06@X07 @X04@X4C@X0C @X07 @X04 @X00SAUCE00 20171007| P / IBM VGA @X07 @X0C@X7C@X4C@X0C@X7C@X04ݰ@X07 @X0D@X07 @X0D@X5D@X0D@X05 @X07 @X7F@X0F@X7F@X07 @X04@X0C@X07 @X78@X7F߲@X0F@X7F߰@X07@X0F @X04@X4C߲@X04 @X7F@X0F @X0D@X7D@X0D@X5D@X0D @X7F@X0F@X7Fܲ@X0F @X0D@X05 @X0F@X7F@X0F @X07 @X7F@X07 @X0C@X7C@X0C@X07 @X0C@X07 @X7F@X07 @X0C@X4C@X0C@X7C@X0F @X04 @X07@X7F@X0F@X7F@X0F @X05@X5D@X0D@X08ܰ@X0D@X7D@X0D@X07@X7F@X0F@X7F@X0F@X7F@X0F@X7F @X07 @X04@X0C @X04@X4C@X0C@X08@X4C߰@X04 @X0C@X4C@X7C@X0C @X7C@X4C@X0C@X04@X4C߲@X0C @X08@X0C@X4C@X04 @X78@X7F@X07 @X5D@X0F @X07 @X5D@X0F @X78@X7F߲@X0F@X7F߲@X0F@X7Fݰ @X07 @X08 @X0C@X4C@X04 @X4C@X04@X4C@X0C@X4C@X04 @X4C߲@X0C@X08 @X4C@X04 @X07 @X05 @X5D@X05 @X0D @X07 @X0D @X07 @X0D@X07 @X08 @X04@X54@X05@X04@X4C@X54@X04@X54@X05@X04@X4C@X04 @X4C߱@X04@X4C߲@X0F @X08 @X04@X4C@X0C@X04@X54@X05@X08ܰ @X0D@X05@X5D@X05@X45@X05 @X5D@X0D@X5D@X05 @X7D@X5D@X0F @X0D@X5D@X05@X5D@X0D@X5D@X0D@X08@X0D@X5D@X05 @X07 @X08۲@X05@X54@X0F @X08 @X04@X54@X04@X54@X0F @X08 @X04@X4C@X54@X0F @X04@X4C@X04 @X05@X54@X04@X54@X0F @X08 @X0D@X05@X45@X05 @X08@X05@X5D@X05@X08@X05@X45@X04@X08@X05@X5D@X05 @X5D@X05@X08@X05@X5D@X05@X5D@X05 @X07 @X08۲@X05@X54@X05@X08۲ @X54@X08 @X04@X54@X05 @X08 @X0D@X05@X5D@X05@X45@X04@X05@X45@X04@X05@X45@X04 @X08@X05@X45@X05 @X08@X05@X45@X05@X04@X08 @X07 @X04@X07 @X04 @X07 @X00 @X04 @X00 @X07ansilove-4.2.0/tests/bs-alove.tnd000066400000000000000000000263561443306107500167350ustar00rootroot00000000000000TUNDRA24 W W WW WWWWܰ  W  W WWܲܰWW      WWW W  W WWܰWW߰WW       W W W W WW W WW W  WW     WWW W W  W  WW߰  WWW WWW W ܲW  W WW WWW W WWWWWWWWWWWW WWW WW  W  WW WWW   WWWܱWWW WWWܲ WWWW߲WW WW W߰  WWܲ       WW ߰  WW  WWW   WWWW WWWWWW W     WWW WWWWWWWW  W      WWWWWWWWWWWWWW     WWWWWW WWWWWWWWW W  WWW WWW WW W߲WW߲WWW  WWWWWW  WWWWWWWWWWWW WWW WWW WWW Wܰ WWW  W WWWܱ WW WWW WWWWܰWWW  WWWWWWWWWW W WWW WWW W  W WWܲܰWW W WWW W WWWWWWW WWW W  W WWܰWW߰WW W WWW WWWWWWW W W W W WW W WW W  WW W WWWWWWWWWWWW WWW W W  W  WW߰ W WWWW WWWW  W ܲW  W WW WWW W WWW WWWW WWW WWW  W  WW WWW   WWW WWWW W߲WW WW W߰  WWܲ  W WW W      WW ߰   WW W WW   SAUCE00 20171007|(P(/(IBM VGA WW W   WW WWW߲߰ WW  W  W   WW WW  WW   WWWWW WW WWWWWWW WW WW WWWWW WWW W  W WWW߲߲ݰ WWW WW WWWW WWWWW WW   W W  W  W WWW WWWW WWWW߲ WWW WWWWW WW W W WWWWW WWW WWW  WWW WW WW  WWW W WWWWWWWWWWW WWWWWW WWW۲WWW۲ WWW  WWW WW WWW WWWWWW   ansilove-4.2.0/tests/bs-alove.xb000066400000000000000000000201051443306107500165430ustar00rootroot00000000000000XBINP;***********????????????~~~~l|88||8<<<<~~<<<><~~<fffffffff{|`8ll8 |<~~<~<~~< 0``0(ll(88||||88<<<fff$lllllll||| 0`Ɔ8ll8vv000` 000000 0 0f<l8l||||`0||0xv`0v~ x|||||8ld`````ff<~~~p0`x |v 08<0`||0`vvffffffv~8ll8|0000`|`bfl0`܆ >`bfl0fΚ?<<<6ll6l6lDDDDDDDDUUUUUUUUwwwwwwww66666666666666666666666666666666666666666666666666666666666666666666666666666667666666666666670??07666666666666666666666666667076666666666666666666666666666666666666666666??66666666666666666666666vvxllllll`00`~pffffff|``v~ffff<~~~~`0``|```0|~~0  0~ 0`0 ~p~vv8ll8 ll<l66666