Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ascii for openSUSE:Factory checked in at 2026-03-29 20:01:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ascii (Old) and /work/SRC/openSUSE:Factory/.ascii.new.8177 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ascii" Sun Mar 29 20:01:21 2026 rev:2 rq:1343465 version:3.32 Changes: -------- --- /work/SRC/openSUSE:Factory/ascii/ascii.changes 2025-10-14 18:11:09.113982460 +0200 +++ /work/SRC/openSUSE:Factory/.ascii.new.8177/ascii.changes 2026-03-29 20:01:57.376556561 +0200 @@ -1,0 +2,10 @@ +Sun Mar 29 15:39:56 UTC 2026 - Andrea Manzini <[email protected]> + +- update to version 3.32 + * Allow packagers to pass in hardening flags. + * Allow -d/-o/-x/-b to force the output radix. + +- update to version 3.31 + * ChatGPT 5.2 patches to hrden code against UB. Manual page is now spellchecked. + +------------------------------------------------------------------- Old: ---- ascii-3.30.tar.gz New: ---- ascii-3.32.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ascii.spec ++++++ --- /var/tmp/diff_new_pack.uM0qLl/_old 2026-03-29 20:01:58.000582269 +0200 +++ /var/tmp/diff_new_pack.uM0qLl/_new 2026-03-29 20:01:58.004582434 +0200 @@ -2,6 +2,7 @@ # spec file for package ascii # # Copyright (c) 2025 Andreas Stieger <[email protected]> +# Copyright (c) 2026 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,13 +18,14 @@ Name: ascii -Version: 3.30 +Version: 3.32 Release: 0 Summary: List ASCII idiomatic names and octal/decimal code-point form License: BSD-2-Clause URL: http://www.catb.org/~esr/ascii/ Source: http://www.catb.org/~esr/ascii/%{name}-%{version}.tar.gz Source2: ascii-rpmlintrc +BuildRequires: ruby4.0-rubygem-asciidoctor %description Provides easy conversion between various byte representations and the American @@ -47,12 +49,14 @@ PREFIX=%{_prefix} \ %{nil} +chmod -x %{buildroot}%{_mandir}/man1/* + %check %{buildroot}%{_bindir}/ascii %files %license COPYING -%doc NEWS.adoc README +%doc NEWS.adoc README.adoc %{_bindir}/ascii %{_mandir}/man1/ascii.1%{?ext_man} ++++++ ascii-3.30.tar.gz -> ascii-3.32.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ascii-3.30/Makefile new/ascii-3.32/Makefile --- old/ascii-3.30/Makefile 2024-02-13 19:44:47.000000000 +0100 +++ new/ascii-3.32/Makefile 2026-03-01 22:50:47.000000000 +0100 @@ -3,19 +3,37 @@ # SPDX-FileCopyrightText: (C) Eric S. Raymond <[email protected]> # SPDX-License-Identifier: BSD-2-Clause -VERS=$(shell sed -n <NEWS.adoc '/^[0-9]/s/:.*//p' | head -1) +PREFIX ?= /usr/local +BINDIR ?= $(PREFIX)/bin +DATADIR ?= $(PREFIX)/share +MANDIR ?= $(DATADIR)/man -CFLAGS = -O +CFLAGS += -O -Wall -Wextra -Werror -PREFIX = /usr/local +VERSION=$(shell sed -n <NEWS.adoc '/^[0-9]/s/:.*//p' | head -1) -.PHONY: all clean format cppcheck splint install uninstall - version dist release refresh +# Rules + +# Note: to suppress the footers with timestamps being generated in HTML, +# we use "-a nofooter". +# To debug asciidoc problems, you may need to run "xmllint --nonet --noout --valid" +# on the intermediate XML that throws an error. +.SUFFIXES: .html .adoc .1 + +.adoc.1: + asciidoctor -D. -a nofooter -b manpage $< +.adoc.html: + asciidoctor -D. -a nofooter -a webfonts! $< + +.PHONY: all clean check cppcheck spellcheck reflow +.PHONY: install uninstall version dist release refresh + +# Build all: ascii ascii.1 ascii: ascii.c splashscreen.h nametable.h - $(CC) $(CFLAGS) -DREVISION='"$(VERS)"' ascii.c -o ascii + $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -DREVISION='"$(VERSION)"' ascii.c -o ascii splashscreen.h: splashscreen sed <splashscreen >splashscreen.h \ @@ -29,57 +47,59 @@ -e 's/^[A-Za-z ]*: */ /' \ -e 's/%%/ }, {/' -# Note: to suppress the footers with timestamps being generated in HTML, -# we use "-a nofooter". -# To debug asciidoc problems, you may need to run "xmllint --nonet --noout --valid" -# on the intermediate XML that throws an error. -.SUFFIXES: .html .adoc .1 - -.adoc.1: - asciidoctor -D. -a nofooter -b manpage $< -.adoc.html: - asciidoctor -D. -a nofooter -a webfonts! $< - clean: rm -f ascii ascii.o splashscreen.h nametable.h - rm -f *.rpm *.tar.gz MANIFEST *.1 *.html + rm -f *.tar.gz *.1 *.html -reflow: - @clang-format --style="{IndentWidth: 8, UseTab: ForIndentation}" -i $$(find . -name "*.[ch]") +# Validate + +check: cppcheck CPPCHECKOPTS = cppcheck: nametable.h splashscreen.h - cppcheck -DREVISION='"$(VERS)"' $(CPPCHECKOPTS) ascii.c + @cppcheck --quiet -DREVISION='"$(VERSION)"' $(CPPCHECKOPTS) ascii.c + +spellcheck: + spellcheck ascii.adoc + +reflow: + @clang-format --style="{IndentWidth: 8, UseTab: ForIndentation}" -i $$(find . -name "*.[ch]") + +# Install/uninstall -SPLINT_SUPPRESSIONS = -boolops -nullret -initallelements +charintliteral -splint: nametable.h splashscreen.h - splint +quiet +posixlib $(SPLINT_SUPPRESSIONS) ascii.c - -install: ascii ascii.1 - cp ascii $(DESTDIR)$(PREFIX)/bin/ascii - cp ascii.1 $(DESTDIR)$(PREFIX)/share/man/man1 +install: + install -d $(DESTDIR)$(BINDIR) + install -m 755 ascii $(DESTDIR)$(BINDIR)/ascii + install -d $(DESTDIR)$(MANDIR) + install -d $(DESTDIR)$(MANDIR)/man1 + install ascii.1 $(DESTDIR)$(MANDIR)/man1/ascii.1 uninstall: - rm $(DESTDIR)$(PREFIX)/bin/ascii - rm $(DESTDIR)$(PREFIX)/share/man/man1/ascii.1 + rm -f $(DESTDIR)$(BINDIR)/ascii + rm -f $(DESTDIR)$(MANDIR)/man1/ascii.1 + +# Export SOURCES = \ - README COPYING NEWS.adoc control Makefile \ + README.adoc COPYING NEWS.adoc control Makefile \ ascii.c ascii.adoc splashscreen nametable version: - @echo $(VERS) + @echo $(VERSION) -ascii-$(VERS).tar.gz: $(SOURCES) ascii.1 - @ls $(SOURCES) ascii.1 | sed s:^:ascii-$(VERS)/: >MANIFEST - @(cd ..; ln -s ascii ascii-$(VERS)) - (cd ..; tar -czvf ascii/ascii-$(VERS).tar.gz `cat ascii/MANIFEST`) - @(cd ..; rm ascii-$(VERS)) +ascii-$(VERSION).tar.gz: $(SOURCES) + mkdir ascii-$(VERSION) + cp -r $(SOURCES) ascii-$(VERSION) + tar -czf ascii-$(VERSION).tar.gz ascii-$(VERSION) + rm -fr ascii-$(VERSION) + ls -l ascii-$(VERSION).tar.gz -dist: ascii-$(VERS).tar.gz +dist: ascii-$(VERSION).tar.gz -release: ascii-$(VERS).tar.gz ascii.html - shipper version=$(VERS) | sh -e -x +release: ascii-$(VERSION).tar.gz ascii.html + shipper version=$(VERSION) | sh -e -x refresh: ascii.html - shipper -N -w version=$(VERS) | sh -e -x + shipper -N -w version=$(VERSION) | sh -e -x + +# end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ascii-3.30/NEWS.adoc new/ascii-3.32/NEWS.adoc --- old/ascii-3.30/NEWS.adoc 2024-05-27 18:30:16.000000000 +0200 +++ new/ascii-3.32/NEWS.adoc 2026-03-01 22:50:47.000000000 +0100 @@ -1,5 +1,13 @@ ascii project news +3.32: 2026-03-01:: + Allow packagers to pass in hardening flags. + Allow -d/-o/-x/-b to force the output radix. + +3.31: 2026-02-07:: + ChatGPT 5.2 patches to hrden code against UB. + Manual page is now spellchecked. + 3.30: 2024-05-27:: Back out mistaken correction of "Start of Heading." Markup fix. @@ -55,7 +63,7 @@ 3.6: 2004-01-11:: Fix brown-paper-bag bug in the Space entry. -3.5: 2003-12-28 2003 +3.5: 2003-12-28:: Source RPMs no longer require myversion to be defined. 3.4: 2003-12-24:: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ascii-3.30/README new/ascii-3.32/README --- old/ascii-3.30/README 2019-10-26 16:51:57.000000000 +0200 +++ new/ascii-3.32/README 1970-01-01 01:00:00.000000000 +0100 @@ -1,13 +0,0 @@ - ascii - -This is a handy little utility that recognizes many different ways of -naming an ASCII character (hex, octal, binary, decimal, C escape, ISO -character table pair, slang names, and others) and prints out all the -equivalents. - -The latest sources for this utility live at - - http://www.catb.org/~esr/ascii/ - - Eric S. Raymond - [email protected] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ascii-3.30/README.adoc new/ascii-3.32/README.adoc --- old/ascii-3.30/README.adoc 1970-01-01 01:00:00.000000000 +0100 +++ new/ascii-3.32/README.adoc 2026-03-01 22:50:47.000000000 +0100 @@ -0,0 +1,11 @@ + = ascii + +This is a handy little utility that recognizes many different ways of +naming an ASCII character (hex, octal, binary, decimal, C escape, ISO +character table pair, slang names, and others) and prints out all the +equivalents. + +This code is commonly packaged as "ascii". + +image:https://repology.org/badge/vertical-allrepos/ascii.svg[Repology +package status] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ascii-3.30/ascii.1 new/ascii-3.32/ascii.1 --- old/ascii-3.30/ascii.1 2024-05-27 18:28:50.000000000 +0200 +++ new/ascii-3.32/ascii.1 1970-01-01 01:00:00.000000000 +0100 @@ -1,297 +0,0 @@ -'\" t -.\" Title: ascii -.\" Author: [see the "AUTHOR(S)" section] -.\" Generator: Asciidoctor 2.0.16 -.\" Date: 2024-05-27 -.\" Manual: \ \& -.\" Source: \ \& -.\" Language: English -.\" -.TH "ASCII" "1" "2024-05-27" "\ \&" "\ \&" -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.ss \n[.ss] 0 -.nh -.ad l -.de URL -\fI\\$2\fP <\\$1>\\$3 -.. -.als MTO URL -.if \n[.g] \{\ -. mso www.tmac -. am URL -. ad l -. . -. am MTO -. ad l -. . -. LINKSTYLE blue R < > -.\} -.SH "NAME" -ascii \- report character aliases -.SH "SYNOPSIS" -.sp -\fBascii\fP [\-d] [\-x] [\-o] [\-h] [\-v] [char\-alias] -.SH "OPTIONS" -.sp -Called with no options, ascii behaves like -"ascii \-h". Options are as follows: -.sp -\-t -.RS 4 -Script\-friendly mode, emits only ISO/decimal/hex/octal/binary -encodings of the character. -.RE -.sp -\-s -.RS 4 -Parse multiple characters. Convenient way of parsing strings. -.RE -.sp -\-a -.RS 4 -Print in vertical aspect (4 columns by 16 rows) rather than -16x4. This option combines only with \-d \-o \-x \-b and must precede them. -.RE -.sp -\-d -.RS 4 -Ascii table in decimal. -.RE -.sp -\-x -.RS 4 -Ascii table in hex. -.RE -.sp -\-o -.RS 4 -Ascii table in octal. -.RE -.sp -\-b -.RS 4 -Ascii table in binary. -.RE -.sp -\-h, \-? -.RS 4 -Show summary of options and a simple ASCII table. -.RE -.sp -\-v -.RS 4 -Show version of program. -.RE -.SH "DESCRIPTION" -.sp -Characters in the ASCII set can have many aliases, depending on -context. A character\(cqs possible names include: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -. sp -1 -. IP \(bu 2.3 -.\} -Its bit pattern (binary representation). -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -. sp -1 -. IP \(bu 2.3 -.\} -Its hex, decimal and octal representations. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -. sp -1 -. IP \(bu 2.3 -.\} -Its teletype mnemonic and caret\-notation form (for control -chars). -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -. sp -1 -. IP \(bu 2.3 -.\} -Its backlash\-escape form in C (for some control chars). -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -. sp -1 -. IP \(bu 2.3 -.\} -Its printed form (for printables). -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -. sp -1 -. IP \(bu 2.3 -.\} -Its full ISO official name in English. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -. sp -1 -. IP \(bu 2.3 -.\} -Its ISO/ECMA code table reference. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -. sp -1 -. IP \(bu 2.3 -.\} -Its name as an HTML/SGML entity. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -. sp -1 -. IP \(bu 2.3 -.\} -Slang and other names in wide use for it among hackers. -.RE -.sp -This utility accepts command\-line strings and tries to interpret them -as one of the above. When it finds a value, it prints \fIall\fP of the -names of the character. The constructs in the following list can be -used to specify character values. If an argument could be interpreted -in two or more ways, names for all the different characters it might -be are dumped. -.sp -\fIcharacter\fP -.RS 4 -Any character not described by one of the following conventions -represents the character itself. -.RE -.sp -^\fIcharacter\fP -.RS 4 -A caret followed by a character. -.RE -.sp -\(rs[abfnrtv0]: -A backslash followed by certain special characters (abfnrtv). -.sp -\fImnemonic\fP -.RS 4 -An ASCII teletype mnemonic. -.RE -.sp -\fIhexadecimal\fP -.RS 4 -A hexadecimal (hex) sequence consists of one or two -case\-insensitive hex digit characters (01234567890abcdef). To ensure -hex interpretation use one of the prefixws h, 0x, x, or \(rsx. -.RE -.sp -\fIdecimal\fP -.RS 4 -A decimal sequence consists of one, two or three decimal digit -characters (0123456789). To ensure decimal interpretation use one of -the prefixes d, 0d, or \(rsd. -.RE -.sp -\fIoctal\fP -.RS 4 -An octal sequence consists of one, two or three octal digit -characters (01234567). To ensure octal interpretation use one of -the prefixes 0o, o, or \(rso. -.RE -.sp -\fIbit pattern\fP -.RS 4 -A bit pattern (binary) sequence consists of one to eight binary -digit characters (01). To ensure bit interpretation use one of the -prefxes 0bm b, or \(rsb. -.RE -.sp -\fIISO/ECMA code\fP -.RS 4 -An ISO/ECMA code sequence consists of one or two decimal digit -characters, a slash, and one or two decimal digit characters. -.RE -.sp -\fIname\fP -.RS 4 -An official ASCII or (unofficial) slang name. -.RE -.sp -:\fIclass\fP: -.RS 4 -A named POSIX character class. -.RE -.sp -The slang names recognized and printed out are from a rather -comprehensive list that first appeared on USENET in early 1990 and has -been continuously updated since. Mnemonics recognized and printed -include the official ASCII set, some official ISO names (where those -differ) and a few common\-use alternatives (such as NL for LF). -HTML/SGML entity names are also printed when applicable. All -comparisons are case\-insensitive, and dashes are mapped to spaces. -Any unrecognized arguments or out of range values are silently -ignored. Note that the <option>\-s</option> option will not recognize -"long" names, as it cannot differentiate them from other parts of the -string. -.sp -For correct results, be careful to stringize or quote shell -metacharacters in arguments (especially backslash). -.sp -This utility is particularly handy for interpreting cc(1)\*(Aqs ugly -octal "invalid\-character" messages, or when coding anything to do with -serial communications. As a side effect it serves as a handy -base\-converter for random 8\-bit values. -.SH "AUTHOR" -.sp -Eric S. Raymond \c -.MTO "esr\(atthyrsus.com" "" ";" -November 1990 (home page at -\c -.URL "http://www.catb.org/~esr/" "" ")." -Ioannis E. Tambouras < -.MTO "ioannis\(atdebian.org" "" "" -added command options and minor enhancements. Brian J. Ginsbach -\c -.MTO "ginsbach\(atsgi.com" "" "" -fixed several bugs and expanded the man page. -David N. Welton \c -.MTO "davidw\(atefn.org" "" "" -added the <option>\-s</option> option. -Matej Vela corrected the ISO names. Dave Capella contributed the idea -of listing HTML/SGML entities. \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ascii-3.30/ascii.adoc new/ascii-3.32/ascii.adoc --- old/ascii-3.30/ascii.adoc 2024-05-27 16:29:44.000000000 +0200 +++ new/ascii-3.32/ascii.adoc 2026-03-01 22:50:47.000000000 +0100 @@ -1,6 +1,9 @@ = ascii(1) = :doctype: manpage +//spellcheck: add encodings printables ECMA POSIX stringize +//spellcheck: add metacharacters LF + == NAME == ascii - report character aliases @@ -20,13 +23,17 @@ Print in vertical aspect (4 columns by 16 rows) rather than 16x4. This option combines only with -d -o -x -b and must precede them. -d:: - Ascii table in decimal. + Ascii table in decimal. If arguments follow, interpret them as + decimal values and print only the corresponding character records. -x:: - Ascii table in hex. + Ascii table in hex. If arguments follow, interpret them as + hexadecimal values and print only the corresponding character records. -o:: - Ascii table in octal. + Ascii table in octal. If arguments follow, interpret them as + octal values and print only the corresponding character records. -b:: - Ascii table in binary. + Ascii table in binary. If arguments follow, interpret them as + binary values and print only the corresponding character records. -h, -?:: Show summary of options and a simple ASCII table. -v:: @@ -70,16 +77,18 @@ ^__character__:: A caret followed by a character. +// spellcheck: add abfnrtv \[abfnrtv0]: A backslash followed by certain special characters (abfnrtv). __mnemonic__:: An ASCII teletype mnemonic. +// spellcheck: add abcdef __hexadecimal__:: A hexadecimal (hex) sequence consists of one or two case-insensitive hex digit characters (01234567890abcdef). To ensure - hex interpretation use one of the prefixws h, 0x, x, or \x. + hex interpretation use one of the prefixes h, 0x, x, or \x. __decimal__:: A decimal sequence consists of one, two or three decimal digit @@ -91,10 +100,11 @@ characters (01234567). To ensure octal interpretation use one of the prefixes 0o, o, or \o. +// spellcheck: add bm __bit pattern__:: A bit pattern (binary) sequence consists of one to eight binary digit characters (01). To ensure bit interpretation use one of the - prefxes 0bm b, or \b. + prefixes 0bm b, or \b. __ISO/ECMA code__:: An ISO/ECMA code sequence consists of one or two decimal digit @@ -129,6 +139,7 @@ [[author]] == AUTHOR == +// spellcheck: off Eric S. Raymond <[email protected]>; November 1990 (home page at <http://www.catb.org/~esr/). Ioannis E. Tambouras <[email protected]> added command options and minor enhancements. Brian J. Ginsbach @@ -136,5 +147,6 @@ David N. Welton <[email protected]> added the <option>-s</option> option. Matej Vela corrected the ISO names. Dave Capella contributed the idea of listing HTML/SGML entities. +// spellcheck: on // end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ascii-3.30/ascii.c new/ascii-3.32/ascii.c --- old/ascii-3.30/ascii.c 2024-02-16 14:41:51.000000000 +0100 +++ new/ascii-3.32/ascii.c 2026-03-01 22:50:47.000000000 +0100 @@ -59,6 +59,7 @@ static bool vertical = false; static bool terse = false; static bool line = false; +static unsigned int forced_radix = 0; static const char *cnames[128][16] = {{ #include "nametable.h" @@ -80,7 +81,8 @@ /* Case-blind string compare */ static int stricmp(const char *s, const char *t) { - while (*s != '\0' && (tolower(*s) == tolower(*t))) { + while (*s != '\0' && + (tolower((unsigned char)*s) == tolower((unsigned char)*t))) { s++, t++; } return (int)(*t - *s); @@ -147,7 +149,7 @@ } static void mark(unsigned int ch) { - if (ch != UINT_MAX) { + if (ch != UINT_MAX && ch < 256) { char_mask_table[ch] |= MASK_MARKED; } } @@ -177,7 +179,8 @@ } val = 0; for (; *s != '\0'; s++) { - if ((digitp = strchr(digits, tolower(*s))) == NULL) { + if ((digitp = strchr(digits, tolower((unsigned char)*s))) == + NULL) { break; } if ((digit = digitp - digits) >= radix) { @@ -250,6 +253,51 @@ } } +static void parse_and_mark_radix(const char *s, unsigned int radix) { + unsigned int val; + + if (s[0] == '\\') { + s++; + } + + if ((radix == 16) && (s[0] == '0') && (s[1] == 'x' || s[1] == 'X')) { + s += 2; + } else if ((radix == 8) && (s[0] == '0') && (s[1] == 'o' || s[1] == 'O')) { + s += 2; + } else if ((radix == 10) && (s[0] == '0') && (s[1] == 'd' || s[1] == 'D')) { + s += 2; + } else if ((radix == 2) && (s[0] == '0') && (s[1] == 'b' || s[1] == 'B')) { + s += 2; + } else { + switch (radix) { + case 16: + if (s[0] == 'x' || s[0] == 'X' || s[0] == 'h' || + s[0] == 'H') { + s++; + } + break; + case 8: + if (s[0] == 'o' || s[0] == 'O') { + s++; + } + break; + case 10: + if (s[0] == 'd' || s[0] == 'D') { + s++; + } + break; + case 2: + if (s[0] == 'b' || s[0] == 'B') { + s++; + } + break; + } + } + + val = parse_digits(s, radix); + mark(val); +} + static void parse_and_mark(const char *str) { int ch; unsigned int mask; @@ -260,13 +308,13 @@ /* interpret single characters as themselves */ if (len == 1) { - mark(str[0]); + mark((unsigned char)str[0]); } /* process multiple letters */ if (line == 1) { for (i = 0; i < len; i++) { - mark(str[i]); + mark((unsigned char)str[i]); } return; } @@ -308,7 +356,7 @@ if (stricmp(str, "BL") == 0) { mark(' '); return; - } else if (isalpha(str[0])) { + } else if (isalpha((unsigned char)str[0])) { for (ch = 0; ch <= 32; ch++) { if (!stricmp(str, cnames[ch][0]) || !strcmp(str, cnames[ch][1])) { @@ -323,28 +371,40 @@ parse_and_mark_number(str); mark(parse_hi_lo(str)); - if ((len > 1) && isalpha(str[0])) { + if ((len > 1) && isalpha((unsigned char)str[0])) { /* try to match long names */ char canbuf[BUFSIZ], *ep; + size_t canbuf_len; + size_t copy_len; /* map dashes and other junk to spaces */ - for (i = 0; i <= len; i++) { - if (str[i] == '-' || isspace(str[i])) { + copy_len = len; + if (copy_len >= sizeof(canbuf)) { + copy_len = sizeof(canbuf) - 1; + } + for (i = 0; i < copy_len; i++) { + if (str[i] == '-' || + isspace((unsigned char)str[i])) { canbuf[i] = ' '; } else { canbuf[i] = str[i]; } } + canbuf[copy_len] = '\0'; /* strip `sign' or `Sign' suffix */ - ep = canbuf + strlen(canbuf) - 4; - if (!strcmp(ep, "sign") || !strcmp(ep, "Sign")) { - *ep = '\0'; + canbuf_len = strlen(canbuf); + if (canbuf_len >= 4) { + ep = canbuf + canbuf_len - 4; + if (!strcmp(ep, "sign") || !strcmp(ep, "Sign")) { + *ep = '\0'; + canbuf_len = strlen(canbuf); + } } /* remove any trailing whitespace */ - while (canbuf[strlen(canbuf) - 1] == ' ') { - canbuf[strlen(canbuf) - 1] = '\0'; + while (canbuf_len > 0 && canbuf[canbuf_len - 1] == ' ') { + canbuf[--canbuf_len] = '\0'; } /* look through all long names for a match */ @@ -376,7 +436,7 @@ ch &= ~0x80; if (ch == 0x7f) { printf("meta-^?\n"); - } else if (isprint((int)ch)) { + } else if (isprint((unsigned char)ch)) { printf("meta-%c\n", (char)ch); } else { printf("meta-^%c\n", '@' + (ch & 0x1f)); @@ -384,15 +444,17 @@ return; } - if (isprint((int)ch)) { + if (isprint((unsigned char)ch)) { printf("prints as `%s'\n", *ptr++); - } else if (iscntrl((char)ch) || ch == 0x7f) { + } else if (iscntrl((unsigned char)ch) || ch == 0x7f) { if (ch == 0x7f) { printf("called ^?"); } else { printf("called ^%c", '@' + (ch & 0x1f)); } - for (; strlen(*ptr) < 4 && isupper(**ptr); ptr++) { + for (; strlen(*ptr) < 4 && + isupper((unsigned char)**ptr); + ptr++) { printf(", %s", *ptr); } putchar('\n'); @@ -525,6 +587,34 @@ if (mode & MODE_VERSION) { return MODE_VERSION; } + switch (mode) { + case 0: + break; + case MODE_BTABLE: + forced_radix = 2; + break; + case MODE_OTABLE: + forced_radix = 8; + break; + case MODE_DTABLE: + forced_radix = 10; + break; + case MODE_XTABLE: + forced_radix = 16; + break; + default: + usage(); + } + if (forced_radix != 0 && optind < argc) { + if (vertical) { + fprintf(stderr, "ascii: -a option only applies to table output.\n"); + exit(1); + } + while (optind < argc) { + parse_and_mark_radix(argv[optind++], forced_radix); + } + return MODE_CHARS; + } if (mode && (terse || line)) { usage(); } @@ -536,25 +626,18 @@ fprintf(stderr, "ascii: -a option must be followed by one of -b -d -o -x.\n"); exit(1); } - switch (mode) { - case 0: - break; - case MODE_BTABLE: - return mode; - case MODE_OTABLE: - return mode; - case MODE_DTABLE: + if (forced_radix != 0) { return mode; - case MODE_XTABLE: - return mode; - default: - usage(); } if (argc == optind) { return MODE_HELP; } while (optind < argc) { - parse_and_mark(argv[optind++]); + if (forced_radix != 0) { + parse_and_mark_radix(argv[optind++], forced_radix); + } else { + parse_and_mark(argv[optind++]); + } } return MODE_CHARS; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ascii-3.30/control new/ascii-3.32/control --- old/ascii-3.30/control 2024-01-29 10:42:54.000000000 +0100 +++ new/ascii-3.32/control 2026-03-01 22:50:47.000000000 +0100 @@ -19,6 +19,8 @@ Homepage: http://www.catb.org/~esr/ascii +XBS-Packaged-As: ascii + XBS-HTML-Target: index.html XBS-Repository-URL: https://gitlab.com/esr/ascii @@ -28,3 +30,5 @@ #XBS-Project-Tags: ASCII XBS-VC-Tag-Template: %(version)s + +XBS-Validate: make check spellcheck
