[hackers] [sbase] dc: Remove lower case hexa digits || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Wed, 14 Jan 2026 18:30:01 +0100 (CET)

commit 9f27b727a20b65145b872cad55205460a31b4f96
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.net>
AuthorDate: Wed Jan 14 18:26:11 2026 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.net>
CommitDate: Wed Jan 14 18:26:11 2026 +0100

    dc: Remove lower case hexa digits
    
    The support for lower case hexa digits was introduced to be compatible
    with the plan9 dc as described in the man page, but this was not
    actually implemented because it creates many problems with almost
    everything (and specially with bc) and the man page was not
    updated.

diff --git a/dc.1 b/dc.1
index e28fbc9..21e45de 100644
--- a/dc.1
+++ b/dc.1
_AT_@ -22,9 +22,7 @@ Numbers are arbitrary-precision decimal values.
 Numbers may contain a decimal point and use
 .Ql _
 as a negative sign prefix.
-When the input base is greater than 10, letters A-F or a-f represent digits 10-15.
-A hexadecimal number beginning with a lower case letter
-must be preceded by a zero to distinguish it from the command associated with the letter.
+When the input base is greater than 10, letters A-F represent digits 10-15.
 .Sh OPTIONS
 .Bl -tag -width Ds
 .It Fl i
_AT_@ -252,9 +250,8 @@ The
 .Fl i
 flag,
 .Ic #
-comments,
+comments and
 the
 .Ic ~
-operator, and lowercase hexadecimal digits
-.Pq a-f
+operator
 are extensions to the traditional dc specification.
diff --git a/dc.c b/dc.c
index 3ba20d9..13f988b 100644
--- a/dc.c
+++ b/dc.c
_AT_@ -1100,7 +1100,7 @@ tonum(void)
 
         dot = NULL;
         for (t = s; (ch = *t) > 0 || ch <= UCHAR_MAX; ++t) {
- if (!strchr(digits, toupper(ch)))
+ if (!strchr(digits, ch))
                         break;
                 if (ch == '.') {
                         if (dot)
_AT_@ -1115,7 +1115,7 @@ tonum(void)
          * For each digit: num = num * ibase + digit
          */
         for (t = s; t < (dot ? dot : end); ++t) {
- d = strchr(digits, toupper(*t)) - digits;
+ d = strchr(digits, *t) - digits;
                 muln(num, ibase);
                 addn(num, d);
         }
_AT_@ -1136,7 +1136,7 @@ tonum(void)
         denom = copy(&one);
         numer = copy(&zero);
         for (t = dot + 1; t < end; ++t) {
- d = strchr(digits, toupper(*t)) - digits;
+ d = strchr(digits, *t) - digits;
                 muln(denom, ibase);
                 muln(numer, ibase);
                 addn(numer, d);
Received on Wed Jan 14 2026 - 18:30:01 CET

This archive was generated by hypermail 2.3.0 : Wed Jan 14 2026 - 18:36:11 CET