sbase, branch HEADsuckless unix tools
c1341583c96307cb0e6152c963ed23c4d56a42782026-04-03T10:01:52Z2026-04-06T09:10:50ZLICENSE: Update my email addressQuentin Rameauquinq@fifth.spacecommit c1341583c96307cb0e6152c963ed23c4d56a4278
parent 26761aa4fb825ab9de45d71a1281fbd5b581f19b
Author: Quentin Rameau <quinq@fifth.space>
Date: Fri, 3 Apr 2026 12:01:52 +0200
LICENSE: Update my email address
26761aa4fb825ab9de45d71a1281fbd5b581f19b2026-04-02T21:50:07Z2026-04-06T09:10:50Zcrypt: Cosmetically improve error messageQuentin Rameauquinq@fifth.spacecommit 26761aa4fb825ab9de45d71a1281fbd5b581f19b
parent 3c7df37bc636538d024937e891d0959a28c370f7
Author: Quentin Rameau <quinq@fifth.space>
Date: Thu, 2 Apr 2026 23:50:07 +0200
crypt: Cosmetically improve error message
3c7df37bc636538d024937e891d0959a28c370f72026-04-02T21:48:05Z2026-04-06T09:10:50Zcrypt: Fix hash line format compatibilityQuentin Rameauquinq@fifth.spacecommit 3c7df37bc636538d024937e891d0959a28c370f7
parent 6bb5d0b24b807fa77efc79f72bc8c2a2285713c9
Author: Quentin Rameau <quinq@fifth.space>
Date: Thu, 2 Apr 2026 23:48:05 +0200
crypt: Fix hash line format compatibility
According to the coreutils implementation man-page (of sha512sum),
> The sums are computed as described in FIPS-180-2. When checking, the
> input should be a former output of this program. The default mode is
> to print a line with: checksum, a space, a character indicating input
> mode ('*' for binary, ' ' for text or where binary is insignificant),
> and name for each FILE.
6bb5d0b24b807fa77efc79f72bc8c2a2285713c92026-04-02T21:45:53Z2026-04-06T09:10:50Zcrypt: Improve hash length verificationQuentin Rameauquinq@fifth.spacecommit 6bb5d0b24b807fa77efc79f72bc8c2a2285713c9
parent 8b842c789c63b376f054d65163d7c7cc279e147c
Author: Quentin Rameau <quinq@fifth.space>
Date: Thu, 2 Apr 2026 23:45:53 +0200
crypt: Improve hash length verification
The current version would not detect incorrect hashes
of one more character than expected.
8b842c789c63b376f054d65163d7c7cc279e147c2026-03-11T14:57:23Z2026-03-18T11:44:52ZUpdate my e-mail addressMattias Andréem@maandree.secommit 8b842c789c63b376f054d65163d7c7cc279e147c
parent 20e44f4bcc2bda061dc801c820345628e05b5900
Author: Mattias Andrée <m@maandree.se>
Date: Wed, 11 Mar 2026 15:57:23 +0100
Update my e-mail address
Signed-off-by: Mattias Andrée <m@maandree.se>
20e44f4bcc2bda061dc801c820345628e05b59002026-03-17T09:38:51Z2026-03-17T09:48:28Ztar: avoid unnecessary VLAMichael Forneymforney@mforney.orgcommit 20e44f4bcc2bda061dc801c820345628e05b5900
parent 35bad530f5318c4d256be192b17b09d8608b1404
Author: Michael Forney <mforney@mforney.org>
Date: Tue, 17 Mar 2026 02:38:51 -0700
tar: avoid unnecessary VLA
An assignment expression is not a constant expression, so while the
length of fname is always constant, it becomes a VLA.
The `l` variable never changes, so just use `sizeof fname` for
clarity.
35bad530f5318c4d256be192b17b09d8608b14042026-03-17T09:35:30Z2026-03-17T09:48:28ZPass CFLAGS and CPPFLAGS when building makeMichael Forneymforney@mforney.orgcommit 35bad530f5318c4d256be192b17b09d8608b1404
parent 23160db9e0b545cead16ac48f23dc31eff2f1b1b
Author: Michael Forney <mforney@mforney.org>
Date: Tue, 17 Mar 2026 02:35:30 -0700
Pass CFLAGS and CPPFLAGS when building make
23160db9e0b545cead16ac48f23dc31eff2f1b1b2026-03-17T08:09:29Z2026-03-17T09:16:45Ztouch: prevent file creation race between utimensat() and open()Michael Forneymforney@mforney.orgcommit 23160db9e0b545cead16ac48f23dc31eff2f1b1b
parent 004a51426e42d42150a746dc113ad86fb3fbed3c
Author: Michael Forney <mforney@mforney.org>
Date: Tue, 17 Mar 2026 01:09:29 -0700
touch: prevent file creation race between utimensat() and open()
If another process creates the file after we determined it was
missing, touch would fail on open() due to O_EXCL. This failure
doesn't serve any purpose; we want to update the mtime either way.
004a51426e42d42150a746dc113ad86fb3fbed3c2026-01-30T13:21:08Z2026-01-30T13:21:08Zed: Minor whitespace changeRoberto E. Vargas Caballerok0ga@shike2.netcommit 004a51426e42d42150a746dc113ad86fb3fbed3c
parent 1871a3578059a836c3aa1817ba9030f7f50c5e9b
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Fri, 30 Jan 2026 14:21:08 +0100
ed: Minor whitespace change
1871a3578059a836c3aa1817ba9030f7f50c5e9b2026-01-30T12:10:55Z2026-01-30T12:44:08Zed: Regex fixesSanttu Lakkalainz@inz.ficommit 1871a3578059a836c3aa1817ba9030f7f50c5e9b
parent 611fb5b365d5a07d59c00db99d692850a7aa3c30
Author: Santtu Lakkala <inz@inz.fi>
Date: Fri, 30 Jan 2026 14:10:55 +0200
ed: Regex fixes
Fix somewhat broken beginning and end of line handling using REG_NOEOL
flag of regexec().
Also force progress with zero-width matches by re-running regexec at
next position if a zero-width match is found at the current position.
611fb5b365d5a07d59c00db99d692850a7aa3c302026-01-30T11:21:00Z2026-01-30T12:00:23Zed: Implement command expansion for io commandsSanttu Lakkalainz@inz.ficommit 611fb5b365d5a07d59c00db99d692850a7aa3c30
parent e9577cde96b603adc73731a24d0fd331b02019f1
Author: Santtu Lakkala <inz@inz.fi>
Date: Fri, 30 Jan 2026 13:21:00 +0200
ed: Implement command expansion for io commands
Split command expansion functionality from execsh() for reuse in the
read and write commands. Adjust getfname() to leave the command in the
input buffer for extraction by the new expandcmd().
e9577cde96b603adc73731a24d0fd331b02019f12026-01-30T11:58:02Z2026-01-30T11:58:02Zbc: Simplify writeoutRoberto E. Vargas Caballerok0ga@shike2.netcommit e9577cde96b603adc73731a24d0fd331b02019f1
parent b343ded0be4defafb709945117d79dab4e70a242
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Fri, 30 Jan 2026 12:58:02 +0100
bc: Simplify writeout
b343ded0be4defafb709945117d79dab4e70a2422026-01-27T15:37:06Z2026-01-27T15:37:06Ztests/grep: Add faulting test caseRoberto E. Vargas Caballerok0ga@shike2.netcommit b343ded0be4defafb709945117d79dab4e70a242
parent 1bb5a34dfe299c759d4542d9fe2ac816aca14897
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 27 Jan 2026 16:37:06 +0100
tests/grep: Add faulting test case
1bb5a34dfe299c759d4542d9fe2ac816aca148972026-01-22T11:09:06Z2026-01-22T11:40:34Zdc: Use scale for number of digits in multiplicationRoberto E. Vargas Caballerok0ga@shike2.netcommit 1bb5a34dfe299c759d4542d9fe2ac816aca14897
parent 74096de403e3fd43bae726c45d9087b47d92f19b
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Thu, 22 Jan 2026 12:09:06 +0100
dc: Use scale for number of digits in multiplication
The scale factor has to be considered in the multiplication because
many algorithms will depend of the precision configured in the scale,
that, until now, was considered only for division. BSD and Plan9
dc differ about how to handle this, and plan9 always use only the
scale factor, while BSD uses the maximun of the scale factor or the
bigger scale of the operands. The second seems more sensible and
produces output that user would expect, for example 0k 0.5 0.5*p would
produce 0.2 with the BSD criteria, but it would generate 0 with the
plan9 criteria.
74096de403e3fd43bae726c45d9087b47d92f19b2026-01-22T10:26:18Z2026-01-22T10:26:18Zbc: Fix typoRoberto E. Vargas Caballerok0ga@shike2.netcommit 74096de403e3fd43bae726c45d9087b47d92f19b
parent 02db7b173a56839fbb69a0d861c731fb987df4df
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Thu, 22 Jan 2026 11:26:18 +0100
bc: Fix typo
02db7b173a56839fbb69a0d861c731fb987df4df2026-01-22T10:10:19Z2026-01-22T10:10:19Ztests: Be deterministic about stderrRoberto E. Vargas Caballerok0ga@shike2.netcommit 02db7b173a56839fbb69a0d861c731fb987df4df
parent c5bfe949dca7001f5e1d456b0c6aebef8fbe07c8
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Thu, 22 Jan 2026 11:10:19 +0100
tests: Be deterministic about stderr
Different libcsuse different criteria about buffering stderr
and it created problems in tests merging stdout and stderr.
To avoid the problem just redirect stderr to a different file
and merge them later using cat in a subshell.
c5bfe949dca7001f5e1d456b0c6aebef8fbe07c82026-01-20T15:31:13Z2026-01-20T15:31:13Zbc: Add support for long namesRoberto E. Vargas Caballerok0ga@shike2.netcommit c5bfe949dca7001f5e1d456b0c6aebef8fbe07c8
parent 759ef4f504aec455083582f18431127d7cdf8e73
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 20 Jan 2026 16:31:13 +0100
bc: Add support for long names
As dc supports extended identifiers and we already had
the option -s in bc that modifies the standard behaviour
we can extend bc in the -s mode to support longer names.
The lower case restriction is maintained just for
simplicity but it is possible to extend bc to support
full utf8 identifers.
759ef4f504aec455083582f18431127d7cdf8e732026-01-20T15:13:41Z2026-01-20T15:13:41Ztests/bc: Fix values in 0010-bc.shRoberto E. Vargas Caballerok0ga@shike2.netcommit 759ef4f504aec455083582f18431127d7cdf8e73
parent b7e30e59700d9af15a83ce9dc06a05b4f7926332
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 20 Jan 2026 16:13:41 +0100
tests/bc: Fix values in 0010-bc.sh
Several typos and different criteria.
b7e30e59700d9af15a83ce9dc06a05b4f79263322026-01-20T15:00:33Z2026-01-20T15:00:33Zdc: Don't use negative numbers in divscale()Roberto E. Vargas Caballerok0ga@shike2.netcommit b7e30e59700d9af15a83ce9dc06a05b4f7926332
parent a2940adeba5293032f6ceb7d218dc9f09d6de984
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 20 Jan 2026 16:00:33 +0100
dc: Don't use negative numbers in divscale()
Divscale uses the function muln() that is not prepared to handle
negative numbers. The solution is to convert them to positive
numbers and handle the sign in divnum() and modnum(). We don't
need a copy of the parameters because they are used directly
with values from the stack, or from the expnum() function that
discards the input parameters when it calls divnum().
a2940adeba5293032f6ceb7d218dc9f09d6de9842026-01-19T17:49:42Z2026-01-19T17:49:42Zdc: Don't trash val next pointerRoberto E. Vargas Caballerok0ga@shike2.netcommit a2940adeba5293032f6ceb7d218dc9f09d6de984
parent 40a4999b60355a8e498f1d228469aeca17f9a698
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 19 Jan 2026 18:49:42 +0100
dc: Don't trash val next pointer
When a value was assigned to a register using the 's'
command we were assigning the full value from execution
stack, overwriting the next pointer of the register
stack with the next pointer of the execution stack.
40a4999b60355a8e498f1d228469aeca17f9a6982026-01-19T15:25:04Z2026-01-19T15:25:04Ztests: Minor modifications and fixesRoberto E. Vargas Caballerok0ga@shike2.netcommit 40a4999b60355a8e498f1d228469aeca17f9a698
parent 6edd9510c2321fe4198c7d5a41db4a692a38c252
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 19 Jan 2026 16:25:04 +0100
tests: Minor modifications and fixes
6edd9510c2321fe4198c7d5a41db4a692a38c2522026-01-19T12:42:40Z2026-01-19T12:42:40Ztests/bc: Improve output in 0010-bc.shRoberto E. Vargas Caballerok0ga@shike2.netcommit 6edd9510c2321fe4198c7d5a41db4a692a38c252
parent 1fbc996c41f9e82b2379bc10a9a0084b7d6cb347
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 19 Jan 2026 13:42:40 +0100
tests/bc: Improve output in 0010-bc.sh
1fbc996c41f9e82b2379bc10a9a0084b7d6cb3472026-01-19T10:51:24Z2026-01-19T10:51:24Ztests/ed: Fix test comparationRoberto E. Vargas Caballerok0ga@shike2.netcommit 1fbc996c41f9e82b2379bc10a9a0084b7d6cb347
parent dc8a781c16c467c4540e001721725c6ff444d664
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 19 Jan 2026 11:51:24 +0100
tests/ed: Fix test comparation
The string equality operator in test is = not ==.
dc8a781c16c467c4540e001721725c6ff444d6642026-01-19T08:42:23Z2026-01-19T08:42:23Zbc: Remove leftover from c00921aRoberto E. Vargas Caballerok0ga@shike2.netcommit dc8a781c16c467c4540e001721725c6ff444d664
parent 9b4e1dd6d4f2705ad47d644efa330ed37b713df3
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 19 Jan 2026 09:42:23 +0100
bc: Remove leftover from c00921a
The commit c00921a fixed a segfault happening when no parameters
or auto variables happened, moving the initialization of the
unwind string to the moment when the macro is initialized, but
a dummy initialization remained for every declaration making that
variables were not poped (and of course a memory leak).
9b4e1dd6d4f2705ad47d644efa330ed37b713df32026-01-19T08:35:41Z2026-01-19T08:35:41Zbc: Fix minor typo using EARGFRoberto E. Vargas Caballerok0ga@shike2.netcommit 9b4e1dd6d4f2705ad47d644efa330ed37b713df3
parent c00921a3a3eabb3f908fc22eff9189c756274742
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 19 Jan 2026 09:35:41 +0100
bc: Fix minor typo using EARGF
c00921a3a3eabb3f908fc22eff9189c7562747422026-01-18T10:26:26Z2026-01-18T16:52:37Zbc: Force a unwind string in every functionRoberto E. Vargas Caballerok0ga@shike2.netcommit c00921a3a3eabb3f908fc22eff9189c756274742
parent 1c79098178db0f6c26bf4459902000b81c098dd0
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sun, 18 Jan 2026 11:26:26 +0100
bc: Force a unwind string in every function
The code in funcode() assumes that the string unwind has a
value but it didn't happen in the case of a function without
parameters or local variables.
1c79098178db0f6c26bf4459902000b81c098dd02026-01-17T16:00:46Z2026-01-17T20:16:35Zdc: prevent segfaults by cleaning up dataElie Le Vaillanteolien55@disroot.orgcommit 1c79098178db0f6c26bf4459902000b81c098dd0
parent 46c00d58d59b9be55c4dcdb11605a90baa60d310
Author: Elie Le Vaillant <eolien55@disroot.org>
Date: Sat, 17 Jan 2026 17:00:46 +0100
dc: prevent segfaults by cleaning up data
Without these changes, dc can undergo segfaults in a variety of
situations (list of cases that segfault, one for changed line):
1. echo 'e(5)' | bc -lc | dc
2. echo 'la sa sa sa' | dc
3. echo '5p' > a.dc; dc a.dc
46c00d58d59b9be55c4dcdb11605a90baa60d3102026-01-17T15:46:56Z2026-01-17T20:16:35Zbc: small fixes regarding bc.libraryElie Le Vaillanteolien55@disroot.orgcommit 46c00d58d59b9be55c4dcdb11605a90baa60d310
parent 41883950c9421cdb8fac18f5dd3dab8f7e2463e5
Author: Elie Le Vaillant <eolien55@disroot.org>
Date: Sat, 17 Jan 2026 16:46:56 +0100
bc: small fixes regarding bc.library
41883950c9421cdb8fac18f5dd3dab8f7e2463e52026-01-17T17:09:57Z2026-01-17T18:10:28Zbc: Add -p to change the dc executableRoberto E. Vargas Caballerok0ga@shike2.netcommit 41883950c9421cdb8fac18f5dd3dab8f7e2463e5
parent 2544b70216bb71aec663a9657142e13ad0c6ac41
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 17 Jan 2026 18:09:57 +0100
bc: Add -p to change the dc executable
This option is mainly added to make easier testing and enabling
using bc with custom dc versions.
2544b70216bb71aec663a9657142e13ad0c6ac412026-01-17T09:57:43Z2026-01-17T09:57:43Zdc: Relax tail call optimizationRoberto E. Vargas Caballerok0ga@shike2.netcommit 2544b70216bb71aec663a9657142e13ad0c6ac41
parent 9439e85c041626dfac86d3011d9f8392823dd768
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 17 Jan 2026 10:57:43 +0100
dc: Relax tail call optimization
Classical dc implementations only apply tail recursion optimization
but we were applying tail call recursion, removing one frame even
when no recursion was involved. This creates problems with bc that
does not track this optimization and it generates values for the Q
command without caring about this optimization.
9439e85c041626dfac86d3011d9f8392823dd7682026-01-17T09:07:18Z2026-01-17T09:07:18ZIgnore dcRoberto E. Vargas Caballerok0ga@shike2.netcommit 9439e85c041626dfac86d3011d9f8392823dd768
parent 53e147613abd376cba8f9ec510d81d190ecdff64
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 17 Jan 2026 10:07:18 +0100
Ignore dc
53e147613abd376cba8f9ec510d81d190ecdff642026-01-15T09:11:20Z2026-01-15T19:26:35Ztr: Allow combining classes and setsSanttu Lakkalainz@inz.ficommit 53e147613abd376cba8f9ec510d81d190ecdff64
parent 860737f897218ffe123c4749ca9cf8998eecf17d
Author: Santtu Lakkala <inz@inz.fi>
Date: Thu, 15 Jan 2026 11:11:20 +0200
tr: Allow combining classes and sets
Allow combining chracter classes and mixing with ranges and sets.
860737f897218ffe123c4749ca9cf8998eecf17d2026-01-14T20:30:02Z2026-01-14T20:30:02Zdc: Don't use truncate()Roberto E. Vargas Caballerok0ga@shike2.netcommit 860737f897218ffe123c4749ca9cf8998eecf17d
parent 9f27b727a20b65145b872cad55205460a31b4f96
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 14 Jan 2026 21:30:02 +0100
dc: Don't use truncate()
Truncate() is a function since POSIX 2008, and even it should
be exposed only if unistd.h is included, OpenBSD exposes it
even when we are using only c90 headers. Renamed to numtrunc()
to avoid the name collision.
9f27b727a20b65145b872cad55205460a31b4f962026-01-14T17:26:11Z2026-01-14T17:26:11Zdc: Remove lower case hexa digitsRoberto E. Vargas Caballerok0ga@shike2.netcommit 9f27b727a20b65145b872cad55205460a31b4f96
parent 608f88f08fcb049f30a1963f2bc72e429a63ba42
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 14 Jan 2026 18:26:11 +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.
608f88f08fcb049f30a1963f2bc72e429a63ba422025-12-15T15:01:56Z2026-01-14T11:49:01Zdc: Add initial versionRoberto E. Vargas Caballerok0ga@shike2.netcommit 608f88f08fcb049f30a1963f2bc72e429a63ba42
parent a1bf3adbc5f69f236319b99bd0a6aab6138c0014
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 15 Dec 2025 16:01:56 +0100
dc: Add initial version
This is the initial version of dc already tested in deep and
with a considerable good set of tests.
a1bf3adbc5f69f236319b99bd0a6aab6138c00142026-01-13T14:31:46Z2026-01-13T14:31:46Ztests: Merge stderr and stdout in 0002-printf.shRoberto E. Vargas Caballerok0ga@shike2.netcommit a1bf3adbc5f69f236319b99bd0a6aab6138c0014
parent c02bf1a70d8dc1e0e7fb3e1a691c012d594ac322
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 13 Jan 2026 15:31:46 +0100
tests: Merge stderr and stdout in 0002-printf.sh
It simplifies the test shell script.
c02bf1a70d8dc1e0e7fb3e1a691c012d594ac3222026-01-13T11:11:16Z2026-01-13T11:11:16Ztests: USE $EXEC and fix ed pathRoberto E. Vargas Caballerok0ga@shike2.netcommit c02bf1a70d8dc1e0e7fb3e1a691c012d594ac322
parent 59f7e452709216715949d90bc9ba1872c33bc6b9
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 13 Jan 2026 12:11:16 +0100
tests: USE $EXEC and fix ed path
Using an EXEC variable for every test make easy to run tools to
debug issues like for example using EXEC=valgrind ./0025-ed.sh.
Some tests for ed had a wrong path to the ed binary and they
were not testing the actual ed but the system one.
59f7e452709216715949d90bc9ba1872c33bc6b92026-01-05T21:29:57Z2026-01-05T21:29:57Ztests: Use exit in signal trapsRoberto E. Vargas Caballerok0ga@shike2.netcommit 59f7e452709216715949d90bc9ba1872c33bc6b9
parent ead2c4616a171a905dd0822be111e08947559d90
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 5 Jan 2026 22:29:57 +0100
tests: Use exit in signal traps
It avoids duplicating the cleaning actions and keep the correct exit
status.
ead2c4616a171a905dd0822be111e08947559d902025-12-31T15:15:53Z2025-12-31T15:15:53Zbuild: Remove all .o in cleanRoberto E. Vargas Caballerok0ga@shike2.netcommit ead2c4616a171a905dd0822be111e08947559d90
parent f7f69125cf296bfd50a483c976f0991ec6e9ffe1
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 31 Dec 2025 16:15:53 +0100
build: Remove all .o in clean
Sometimes the OBJ variable gets out of sync with the object
files in the file system, and using a wildcard does a better
job in this regard.
f7f69125cf296bfd50a483c976f0991ec6e9ffe12025-12-31T14:31:21Z2025-12-31T14:31:21Zmake: Synchronize with sccRoberto E. Vargas Caballerok0ga@shike2.netcommit f7f69125cf296bfd50a483c976f0991ec6e9ffe1
parent f8d39b2329be259e46efd019091e6061de5fbe4b
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 31 Dec 2025 15:31:21 +0100
make: Synchronize with scc
Scc fixed a race condition hapenning while forking and execing the command
and receiving a signal that could keep make waiting forever. Signals
are correctly masked now to avoid this problems.
f8d39b2329be259e46efd019091e6061de5fbe4b2025-12-31T14:25:57Z2025-12-31T14:25:57Zbc: Improve man pageRoberto E. Vargas Caballerok0ga@shike2.netcommit f8d39b2329be259e46efd019091e6061de5fbe4b
parent 79bc44c1849938925fe05d6fdc81093a85f50215
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 31 Dec 2025 15:25:57 +0100
bc: Improve man page
79bc44c1849938925fe05d6fdc81093a85f502152025-12-31T12:19:34Z2025-12-31T12:19:34Zed: Correct behaviour of shell escape in r and wRoberto E. Vargas Caballerok0ga@shike2.netcommit 79bc44c1849938925fe05d6fdc81093a85f50215
parent dae48911d223022deb96408a65ed910f82a2ef30
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 31 Dec 2025 13:19:34 +0100
ed: Correct behaviour of shell escape in r and w
Shell escapes in these commands do not print a ! after its execution
but it prints the number of bytes read/write.
dae48911d223022deb96408a65ed910f82a2ef302025-12-31T12:08:52Z2025-12-31T12:08:52Zed: Update man page and TODORoberto E. Vargas Caballerok0ga@shike2.netcommit dae48911d223022deb96408a65ed910f82a2ef30
parent 4bc4a1d030dead3308020db6fdddf4b042a83a7e
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 31 Dec 2025 13:08:52 +0100
ed: Update man page and TODO
4bc4a1d030dead3308020db6fdddf4b042a83a7e2025-12-31T11:38:39Z2025-12-31T11:38:39Zed: Use the variable LINES for zRoberto E. Vargas Caballerok0ga@shike2.netcommit 4bc4a1d030dead3308020db6fdddf4b042a83a7e
parent 60d9f7a5a9f0b55660915b06fdc73db6811a9f9d
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 31 Dec 2025 12:38:39 +0100
ed: Use the variable LINES for z
Some shells keep a variable LINES with the number of lines of the terminal
updated in every SIGWINCH. Using that variable makes easier to get a
full listing.
60d9f7a5a9f0b55660915b06fdc73db6811a9f9d2025-12-16T15:59:21Z2025-12-30T09:21:33Zed: Fix multiline commandsSanttu Lakkalainz@inz.ficommit 60d9f7a5a9f0b55660915b06fdc73db6811a9f9d
parent c11a21f426d661f4c20a19c4769f7de42668435d
Author: Santtu Lakkala <inz@inz.fi>
Date: Tue, 16 Dec 2025 17:59:21 +0200
ed: Fix multiline commands
Fix command line parsing escape handling. Further process all
commands on the command line.
c11a21f426d661f4c20a19c4769f7de42668435d2025-12-13T15:06:45Z2025-12-13T15:06:45Zbuild: Install bc libraryRoberto E. Vargas Caballerok0ga@shike2.netcommit c11a21f426d661f4c20a19c4769f7de42668435d
parent 85721b5a334484e2da0d8c21e343e5aaf7082d61
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 13 Dec 2025 16:06:45 +0100
build: Install bc library
85721b5a334484e2da0d8c21e343e5aaf7082d612025-12-13T15:03:58Z2025-12-13T15:03:58Zbc: Add man pageRoberto E. Vargas Caballerok0ga@shike2.netcommit 85721b5a334484e2da0d8c21e343e5aaf7082d61
parent 42ebd643f6628ed4b0ef21f77d98368a2b0deab6
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 13 Dec 2025 16:03:58 +0100
bc: Add man page
42ebd643f6628ed4b0ef21f77d98368a2b0deab62025-12-13T15:03:34Z2025-12-13T15:03:34Zbc: Fix path of the bc libraryRoberto E. Vargas Caballerok0ga@shike2.netcommit 42ebd643f6628ed4b0ef21f77d98368a2b0deab6
parent 8ceddc568dcfae458ed9cb2c5b9421cf4b612db1
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 13 Dec 2025 16:03:34 +0100
bc: Fix path of the bc library
8ceddc568dcfae458ed9cb2c5b9421cf4b612db12025-12-13T14:37:08Z2025-12-13T14:37:08Zbc: Increment the number of nestting to 32Roberto E. Vargas Caballerok0ga@shike2.netcommit 8ceddc568dcfae458ed9cb2c5b9421cf4b612db1
parent 54f1f935c0024550d1715b173d662e9bf9ee2eb4
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 13 Dec 2025 15:37:08 +0100
bc: Increment the number of nestting to 32
The number of 10 nested control flow data structures was too
low, and a value of 32 would work for almost any bc program.
54f1f935c0024550d1715b173d662e9bf9ee2eb42025-12-13T12:29:17Z2025-12-13T12:29:17Zed: Update TODO error listRoberto E. Vargas Caballerok0ga@shike2.netcommit 54f1f935c0024550d1715b173d662e9bf9ee2eb4
parent 77f8d7e5934c146d047c6c38b97067ae046268d9
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 13 Dec 2025 13:29:17 +0100
ed: Update TODO error list
77f8d7e5934c146d047c6c38b97067ae046268d92025-12-13T11:51:11Z2025-12-13T11:57:33Zed: Add the x and X commandsRoberto E. Vargas Caballerok0ga@shike2.netcommit 77f8d7e5934c146d047c6c38b97067ae046268d9
parent 5765a6e6b434ce692a15ed2e64bc2ea0d1c5a2e1
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 13 Dec 2025 12:51:11 +0100
ed: Add the x and X commands
These are extensions to the POSIX standard but very useful
in situations like writing a commit message where the exit
status can discard the full edit session.
5765a6e6b434ce692a15ed2e64bc2ea0d1c5a2e12025-12-13T11:05:39Z2025-12-13T11:57:29Zed: Implement non truncate writesRoberto E. Vargas Caballerok0ga@shike2.netcommit 5765a6e6b434ce692a15ed2e64bc2ea0d1c5a2e1
parent 08b8c73ddaf92727f8e9a93f2c0d60eb0183caa4
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 13 Dec 2025 12:05:39 +0100
ed: Implement non truncate writes
The trunc parameter of dowrite() was ignored, making no difference
between the w and W commands.
08b8c73ddaf92727f8e9a93f2c0d60eb0183caa42025-12-13T10:52:32Z2025-12-13T10:52:32Zed: Don't clear modflag in shell escapesRoberto E. Vargas Caballerok0ga@shike2.netcommit 08b8c73ddaf92727f8e9a93f2c0d60eb0183caa4
parent 5364863516ace9b153ba5508c07baacef86127bc
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 13 Dec 2025 11:52:32 +0100
ed: Don't clear modflag in shell escapes
The function dowrite() is used for normal writes and for shell
escapes and in the second case we don't have the actual file
saved to disk.
5364863516ace9b153ba5508c07baacef86127bc2025-12-13T09:42:51Z2025-12-13T10:48:06Zed: Don't clear modflag until is safeRoberto E. Vargas Caballerok0ga@shike2.netcommit 5364863516ace9b153ba5508c07baacef86127bc
parent daec4db8a3611927158611f3b0cbc082b4673e28
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 13 Dec 2025 10:42:51 +0100
ed: Don't clear modflag until is safe
Setting modflag unconditionally in the Q command could
produce that after an error happening dealing with the Q
command then unsaved files were silently ignored.
daec4db8a3611927158611f3b0cbc082b4673e282025-12-13T10:14:15Z2025-12-13T10:14:15Zed: Improve man pageRoberto E. Vargas Caballerok0ga@shike2.netcommit daec4db8a3611927158611f3b0cbc082b4673e28
parent 8227fbab2e1209bf68125e19d366ffacdc2071d2
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 13 Dec 2025 11:14:15 +0100
ed: Improve man page
Add missing z command, give more bibliography and clarify
some of the commands.
8227fbab2e1209bf68125e19d366ffacdc2071d22025-12-13T09:42:51Z2025-12-13T09:42:51Zed: Don't clear modflag until is safeRoberto E. Vargas Caballerok0ga@shike2.netcommit 8227fbab2e1209bf68125e19d366ffacdc2071d2
parent 9a0d04fcf9ac486a4056a3641ecb098a227166af
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 13 Dec 2025 10:42:51 +0100
ed: Don't clear modflag until is safe
Setting modflag unconditionally in the E command could
produce that after an error happening dealing with the E
command then unsaved files were silently ignored.
9a0d04fcf9ac486a4056a3641ecb098a227166af2025-12-13T09:29:17Z2025-12-13T09:29:17Zed: Accept shell escapes in r, e and E commandsRoberto E. Vargas Caballerok0ga@shike2.netcommit 9a0d04fcf9ac486a4056a3641ecb098a227166af
parent 8adf85e686e8b95d00879e2882b2d925dbdbd681
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 13 Dec 2025 10:29:17 +0100
ed: Accept shell escapes in r, e and E commands
8adf85e686e8b95d00879e2882b2d925dbdbd6812025-12-12T19:36:03Z2025-12-12T19:36:03Ztests/ed: Fix 0008-ed.sh and 0009-ed.shRoberto E. Vargas Caballerok0ga@shike2.netcommit 8adf85e686e8b95d00879e2882b2d925dbdbd681
parent 325953bd2cd1e1fd43a8cf8f9e1b49c32e5b818b
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Fri, 12 Dec 2025 20:36:03 +0100
tests/ed: Fix 0008-ed.sh and 0009-ed.sh
325953bd2cd1e1fd43a8cf8f9e1b49c32e5b818b2025-12-12T19:34:56Z2025-12-12T19:34:56Ztests/bc: Add test cases for the bc libraryRoberto E. Vargas Caballerok0ga@shike2.netcommit 325953bd2cd1e1fd43a8cf8f9e1b49c32e5b818b
parent 1106076d535f8c9e93694a0343e5508865df9a4b
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Fri, 12 Dec 2025 20:34:56 +0100
tests/bc: Add test cases for the bc library
These tests cover a big portion of the code because they
execute complex functions suing many of the features of
bc.
1106076d535f8c9e93694a0343e5508865df9a4b2025-12-12T11:14:21Z2025-12-12T11:14:21Zbc: Simplify loading internal libraryRoberto E. Vargas Caballerok0ga@shike2.netcommit 1106076d535f8c9e93694a0343e5508865df9a4b
parent d898b61ed22e7d7ced081cbf2f646c82cbf88f00
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Fri, 12 Dec 2025 12:14:21 +0100
bc: Simplify loading internal library
Testing can be done using directly the path to the bc.library
file, and get rid of the ugly function that we had to build
dynamically the path to the library.
d898b61ed22e7d7ced081cbf2f646c82cbf88f002025-12-11T20:55:06Z2025-12-11T20:55:06Zbc: Don't pop value from body in whileRoberto E. Vargas Caballerok0ga@shike2.netcommit d898b61ed22e7d7ced081cbf2f646c82cbf88f00
parent 9febd6d57c98d8d29c6d9abac3839b1614dcae15
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Thu, 11 Dec 2025 21:55:06 +0100
bc: Don't pop value from body in while
Statements already deal with the cleaning of the stack, but the
init and increment part of for loops are expressions without the
cleaning, and for that reason we have to care about the stack.
9febd6d57c98d8d29c6d9abac3839b1614dcae152025-12-11T11:45:35Z2025-12-11T11:45:35Zbc: Add a space after relationalsRoberto E. Vargas Caballerok0ga@shike2.netcommit 9febd6d57c98d8d29c6d9abac3839b1614dcae15
parent c6cbb33ef02075c21b519bb59e1c69f74ff8470f
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Thu, 11 Dec 2025 12:45:35 +0100
bc: Add a space after relationals
Some dc implementations fail if the macro name is contiguous
to the ] that finalizes the string.
c6cbb33ef02075c21b519bb59e1c69f74ff8470f2025-12-11T11:43:42Z2025-12-11T11:43:42Zbc: Unify local() and param()Roberto E. Vargas Caballerok0ga@shike2.netcommit c6cbb33ef02075c21b519bb59e1c69f74ff8470f
parent ec8218c93bb19777f212addf94544ac01c3012c2
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Thu, 11 Dec 2025 12:43:42 +0100
bc: Unify local() and param()
These functions only differentiate in a single letter, so it
was a good opportunity to merge them. Also, it was a good idea
to add the values in reverse order to make the output more
similar to other bc implementations.
ec8218c93bb19777f212addf94544ac01c3012c22025-12-11T07:52:47Z2025-12-11T07:57:02Zbc: Keep happy the compilerRoberto E. Vargas Caballerok0ga@shike2.netcommit ec8218c93bb19777f212addf94544ac01c3012c2
parent 301f018935abc4a61f37e126085c2824ebc49257
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Thu, 11 Dec 2025 08:52:47 +0100
bc: Keep happy the compiler
301f018935abc4a61f37e126085c2824ebc492572025-12-11T07:46:17Z2025-12-11T07:57:02Zbc: Fix relational operatorsRoberto E. Vargas Caballerok0ga@shike2.netcommit 301f018935abc4a61f37e126085c2824ebc49257
parent fbc4b4252455a126c552e6b4b35adb643ff1135c
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Thu, 11 Dec 2025 08:46:17 +0100
bc: Fix relational operators
The order of the operands was wrong and it produced the
inverse operation.
fbc4b4252455a126c552e6b4b35adb643ff1135c2025-12-08T17:20:07Z2025-12-08T17:20:07Ztests: Fix 0007-ed.shRoberto E. Vargas Caballerok0ga@shike2.netcommit fbc4b4252455a126c552e6b4b35adb643ff1135c
parent 7ff51bffd1c7fa34429b6c063fac1d4f7db85d9d
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 8 Dec 2025 18:20:07 +0100
tests: Fix 0007-ed.sh
7ff51bffd1c7fa34429b6c063fac1d4f7db85d9d2025-12-08T17:13:14Z2025-12-08T17:19:29Zsbase-box: Reduce bss size using dynamic memoryRoberto E. Vargas Caballerok0ga@shike2.netcommit 7ff51bffd1c7fa34429b6c063fac1d4f7db85d9d
parent 13db2e48d4b7899c04d7fdbc88cab29397b3f44b
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 8 Dec 2025 18:13:14 +0100
sbase-box: Reduce bss size using dynamic memory
There are several big buffers that consume a lot of bss
memory even when the applications are not used. This patch
removes several of them using dynamic memory instead.
13db2e48d4b7899c04d7fdbc88cab29397b3f44b2025-12-08T17:11:19Z2025-12-08T17:19:29Ztests: Minor improvements to 0006-ed.shRoberto E. Vargas Caballerok0ga@shike2.netcommit 13db2e48d4b7899c04d7fdbc88cab29397b3f44b
parent 96b9a71acfa88f613980cfc39054577e0e63be47
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 8 Dec 2025 18:11:19 +0100
tests: Minor improvements to 0006-ed.sh
96b9a71acfa88f613980cfc39054577e0e63be472025-12-08T17:03:44Z2025-12-08T17:19:25Zed: Accept no address in k commandRoberto E. Vargas Caballerok0ga@shike2.netcommit 96b9a71acfa88f613980cfc39054577e0e63be47
parent 284e154a278134f910ba54e9a0b7cfac1d6748fe
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 8 Dec 2025 18:03:44 +0100
ed: Accept no address in k command
284e154a278134f910ba54e9a0b7cfac1d6748fe2025-12-08T16:54:10Z2025-12-08T17:19:04Zed: Restore newlines in match()Roberto E. Vargas Caballerok0ga@shike2.netcommit 284e154a278134f910ba54e9a0b7cfac1d6748fe
parent a45474cfbb2de4a16592bf4fa7e19345cab03c5c
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 8 Dec 2025 17:54:10 +0100
ed: Restore newlines in match()
Match was removing the trailing newline to fix some problems
in regex, but this modified the content of the line making
that the output file had embedded NUL characters (and obviously
no newlines).
a45474cfbb2de4a16592bf4fa7e19345cab03c5c2025-12-08T17:03:44Z2025-12-08T17:03:44Zed: Accept no address in k commandRoberto E. Vargas Caballerok0ga@shike2.netcommit a45474cfbb2de4a16592bf4fa7e19345cab03c5c
parent f6a1fbb9b1c6b5058371daeeb903a7e7a3643bbd
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 8 Dec 2025 18:03:44 +0100
ed: Accept no address in k command
f6a1fbb9b1c6b5058371daeeb903a7e7a3643bbd2025-12-08T16:54:10Z2025-12-08T16:54:10Zed: Restore newlines in match()Roberto E. Vargas Caballerok0ga@shike2.netcommit f6a1fbb9b1c6b5058371daeeb903a7e7a3643bbd
parent beb6a2fa2aeaa9791738510097231e7e9da45f47
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 8 Dec 2025 17:54:10 +0100
ed: Restore newlines in match()
Match was removing the trailing newline to fix some problems
in regex, but this modified the content of the line making
that the output file had embedded NUL characters (and obviously
no newlines).
beb6a2fa2aeaa9791738510097231e7e9da45f472025-12-08T16:32:38Z2025-12-08T16:47:35Zed: Detect correctly end of file in gettxt()Roberto E. Vargas Caballerok0ga@shike2.netcommit beb6a2fa2aeaa9791738510097231e7e9da45f47
parent c63dd6d49941778ad99fb1f2834f97626a511ccb
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 8 Dec 2025 17:32:38 +0100
ed: Detect correctly end of file in gettxt()
The function gettxt() is basically a repeat loop where it loops
until it arrives to the end of the file when it doesn't find a
newline, but the condition to detect the end of file was wrong
and it looped forever in a file without newline.
c63dd6d49941778ad99fb1f2834f97626a511ccb2025-12-08T16:30:50Z2025-12-08T16:30:50Ztests: Remove cleanup functionsRoberto E. Vargas Caballerok0ga@shike2.netcommit c63dd6d49941778ad99fb1f2834f97626a511ccb
parent ae50e31d532df74e97d2e0525d0f282cf3377142
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 8 Dec 2025 17:30:50 +0100
tests: Remove cleanup functions
ae50e31d532df74e97d2e0525d0f282cf33771422025-12-08T16:01:30Z2025-12-08T16:13:25Zed: Allow z commands with no addressRoberto E. Vargas Caballerok0ga@shike2.netcommit ae50e31d532df74e97d2e0525d0f282cf3377142
parent 0190f5e7bf8985af3ed768f7d17d192c23beb5d1
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 8 Dec 2025 17:01:30 +0100
ed: Allow z commands with no address
When a single z commit is executed then nlines == 0, and
we don't have a value for the line where scroll and this
is why we have to call deflines() to setup the default
value.
0190f5e7bf8985af3ed768f7d17d192c23beb5d12025-12-01T15:02:51Z2025-12-02T08:23:47Zed: Split testsSanttu Lakkalainz@inz.ficommit 0190f5e7bf8985af3ed768f7d17d192c23beb5d1
parent afa8975960633104311f9d81bf478171e950e26d
Author: Santtu Lakkala <inz@inz.fi>
Date: Mon, 1 Dec 2025 17:02:51 +0200
ed: Split tests
Use multiple separate test scripts for ed to make it more obvious which
test failed.
afa8975960633104311f9d81bf478171e950e26d2025-11-30T20:11:22Z2025-11-30T20:11:22Zbc: Unwind after calculating return expressionRoberto E. Vargas Caballerok0ga@shike2.netcommit afa8975960633104311f9d81bf478171e950e26d
parent b95368aa433853d7f9fd160add78be5835f561ef
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sun, 30 Nov 2025 21:11:22 +0100
bc: Unwind after calculating return expression
The locals can be used to compute the return value, and
for that reason we cannot get rid of them until we know
that they will not be used anymore.
b95368aa433853d7f9fd160add78be5835f561ef2025-11-28T14:50:07Z2025-11-28T14:50:07Zbc: Add prototypes for param() and local()Roberto E. Vargas Caballerok0ga@shike2.netcommit b95368aa433853d7f9fd160add78be5835f561ef
parent 98923f69a1bb852d7fcbf2146dec4a084874bf80
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Fri, 28 Nov 2025 15:50:07 +0100
bc: Add prototypes for param() and local()
98923f69a1bb852d7fcbf2146dec4a084874bf802025-11-28T11:34:55Z2025-11-28T11:34:55Zbc: Unwind the stack in every returnRoberto E. Vargas Caballerok0ga@shike2.netcommit 98923f69a1bb852d7fcbf2146dec4a084874bf80
parent 6edcf9948848793f67f04458a72c7825fe9e4138
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Fri, 28 Nov 2025 12:34:55 +0100
bc: Unwind the stack in every return
When we return from a function we have to unwind the stack and
pop all the locals of that function. That requires to create
a string with all the pop information to be used in every return.
6edcf9948848793f67f04458a72c7825fe9e41382025-11-27T18:02:33Z2025-11-27T18:02:33Zbc: Don't reuse ids from functionsRoberto E. Vargas Caballerok0ga@shike2.netcommit 6edcf9948848793f67f04458a72c7825fe9e4138
parent 26cc48e028bd53f8cdc7ba7c564babcc7958aa4b
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Thu, 27 Nov 2025 19:02:33 +0100
bc: Don't reuse ids from functions
When a function has control flow structures they live forever
because the function can be called at any moment. But when
they are in the top level context (in home) then we can reuse
the ids because they cannot be used after being added to the
system.
26cc48e028bd53f8cdc7ba7c564babcc7958aa4b2025-11-27T08:49:03Z2025-11-27T11:22:04Zbc: Make funcode() return a stringRoberto E. Vargas Caballerok0ga@shike2.netcommit 26cc48e028bd53f8cdc7ba7c564babcc7958aa4b
parent 328295370ab688b83ce56034131a44f2f9426244
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Thu, 27 Nov 2025 09:49:03 +0100
bc: Make funcode() return a string
Having a writeout hidden in funcode when it was not actually
needed made the code a bit more obscure and it is better to
print in the rule reduction.
328295370ab688b83ce56034131a44f2f94262442025-11-26T08:17:41Z2025-11-26T08:17:41Zbc: Improve print extensionRoberto E. Vargas Caballerok0ga@shike2.netcommit 328295370ab688b83ce56034131a44f2f9426244
parent a360af6355f49472654954f5f6ddb43c1b3f1a17
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 26 Nov 2025 09:17:41 +0100
bc: Improve print extension
While debugging bc programs it is very convinient to be able to
print a string in the same line than an expression, in the same
way that printing strings alone.
a360af6355f49472654954f5f6ddb43c1b3f1a172025-11-26T07:55:10Z2025-11-26T08:16:52Zbc: Add leading space to explicit returnRoberto E. Vargas Caballerok0ga@shike2.netcommit a360af6355f49472654954f5f6ddb43c1b3f1a17
parent 69d08810f5633d4dd1ac2b486fa96f29123b0a37
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 26 Nov 2025 08:55:10 +0100
bc: Add leading space to explicit return
Without this space we cannot guarantee that the 0 is appended
to any other previous token.
69d08810f5633d4dd1ac2b486fa96f29123b0a372025-11-26T07:54:02Z2025-11-26T08:16:52Zbc: Use strdup for STRINGRoberto E. Vargas Caballerok0ga@shike2.netcommit 69d08810f5633d4dd1ac2b486fa96f29123b0a37
parent e43f97dba453bde1833e5c25a9af2d2b0eaf2e0c
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 26 Nov 2025 08:54:02 +0100
bc: Use strdup for STRING
The attribute of the STRING terminal symbol was a constant string
that couldn't be passed to free().
e43f97dba453bde1833e5c25a9af2d2b0eaf2e0c2025-11-26T07:47:56Z2025-11-26T07:47:56Zbc: Obey POSIX about handling newlinesRoberto E. Vargas Caballerok0ga@shike2.netcommit e43f97dba453bde1833e5c25a9af2d2b0eaf2e0c
parent 4d7926403e6860a915d2f3de5f6fe2b297ebb2e4
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 26 Nov 2025 08:47:56 +0100
bc: Obey POSIX about handling newlines
POIX has strict rules about when operations should be performed
and even when we were already matching this due to the line
buffering of stdin it makes more sense to make it more explicit.
In an interactive invocation of bc, each time a <newline>
is read that satisfies the grammatical production:
input_item : semicolon_list NEWLINE
the sequential list of statements making up the semicolon_list
shall be executed immediately and any output produced by
that execution shall be written without any delay due to
buffering.
4d7926403e6860a915d2f3de5f6fe2b297ebb2e42025-11-25T20:10:49Z2025-11-25T20:10:49Zbc: Read stdin after a list of filesRoberto E. Vargas Caballerok0ga@shike2.netcommit 4d7926403e6860a915d2f3de5f6fe2b297ebb2e4
parent 2cf8559bad6eef27f2f4279afb0282f678a95c09
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 25 Nov 2025 21:10:49 +0100
bc: Read stdin after a list of files
POSIX mandates "It shall take input from any files given, then read
from the standard input."
2cf8559bad6eef27f2f4279afb0282f678a95c092025-11-25T16:14:35Z2025-11-25T16:25:53Zbc: Fix indentation in bc.libraryRoberto E. Vargas Caballerok0ga@shike2.netcommit 2cf8559bad6eef27f2f4279afb0282f678a95c09
parent 2e9d76d21711d3c8f62d350e5cf9e68deda78031
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 25 Nov 2025 17:14:35 +0100
bc: Fix indentation in bc.library
2e9d76d21711d3c8f62d350e5cf9e68deda780312025-11-25T15:54:04Z2025-11-25T16:25:53Zbc: Use dynamic memory for stringsRoberto E. Vargas Caballerok0ga@shike2.netcommit 2e9d76d21711d3c8f62d350e5cf9e68deda78031
parent 10ad90244eca21f033d59f808b45edf69060f5eb
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 25 Nov 2025 16:54:04 +0100
bc: Use dynamic memory for strings
Until now bc was using a clever mechanism that built all the strings
in a single buffer that makes very easy handling them because no
free was required. but it had a big problem because the size of the
space used in this buffer grew exponentially because new strings
were containing previous strings and all of them were living in memory
at the same time. This new mechanism implements a printf alike
and when strings are used as parameters it frees them, but it implies
that we cannot use anymore constants as parameters and in some specific
cases we have to free them manually.
10ad90244eca21f033d59f808b45edf69060f5eb2025-11-25T15:18:37Z2025-11-25T15:18:37Zbc: Fix modulo operationRoberto E. Vargas Caballerok0ga@shike2.netcommit 10ad90244eca21f033d59f808b45edf69060f5eb
parent 974179ce006d118086cb91a4c3176d05a60daa60
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 25 Nov 2025 16:18:37 +0100
bc: Fix modulo operation
As we use % for the placeholders we have to protect it using two
of them in the case of the modulo operation that is implemented
in dc with %.
974179ce006d118086cb91a4c3176d05a60daa602025-11-25T15:08:58Z2025-11-25T15:08:58Zbc: Don't use freopen()Roberto E. Vargas Caballerok0ga@shike2.netcommit 974179ce006d118086cb91a4c3176d05a60daa60
parent c759756d2e47cf2737949d0007937e467a4825eb
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 25 Nov 2025 16:08:58 +0100
bc: Don't use freopen()
If we use freopen() in bc() then after loading the math library
we cannot recover the original stdin because it previously closed.
While we can still use fdopen(), it is better to just don't close
stdin and use a variable to change the input stream.
c759756d2e47cf2737949d0007937e467a4825eb2025-11-25T10:21:47Z2025-11-25T10:21:47Zbc: Implement the . operandRoberto E. Vargas Caballerok0ga@shike2.netcommit c759756d2e47cf2737949d0007937e467a4825eb
parent fee2f025d0e921966786fc8b0212f55674d35469
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 25 Nov 2025 11:21:47 +0100
bc: Implement the . operand
While it is not specified in POSIX, all the bc implementations since
70's store the last expression in the dot variable which can be used
in later experssions.
fee2f025d0e921966786fc8b0212f55674d354692025-11-25T10:01:39Z2025-11-25T10:01:39Zbc: Implement plan9 print extensionRoberto E. Vargas Caballerok0ga@shike2.netcommit fee2f025d0e921966786fc8b0212f55674d35469
parent 721e8bb7e608fdadebbb780bfde127a699e3bc5c
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 25 Nov 2025 11:01:39 +0100
bc: Implement plan9 print extension
This extension used in combination with the s flag allows a better
control over what is printed.
721e8bb7e608fdadebbb780bfde127a699e3bc5c2025-11-25T09:31:11Z2025-11-25T09:31:11Zbc: Rewrite macros to implement break and returnRoberto E. Vargas Caballerok0ga@shike2.netcommit 721e8bb7e608fdadebbb780bfde127a699e3bc5c
parent e656b3773023a7a1c60d0573bb326e40d450e8cc
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 25 Nov 2025 10:31:11 +0100
bc: Rewrite macros to implement break and return
The macros as implemented didn't allow correct tracking of the control
flow structures, and knowing he nesting level for return or break was
difficult. The tokens IF, WHILE and FOR were redirected to on terminal
symbols to be sure that the macro was already pushed before the rest
of the statement was parsed (including the global nested).
e656b3773023a7a1c60d0573bb326e40d450e8cc2025-11-24T11:27:12Z2025-11-24T11:33:48Zbc: Create of stack of macrosRoberto E. Vargas Caballerok0ga@shike2.netcommit e656b3773023a7a1c60d0573bb326e40d450e8cc
parent 9290ec59d5b94cf01c880e8c5538eaca8d6b55ba
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 24 Nov 2025 12:27:12 +0100
bc: Create of stack of macros
Macros were created ad hoc when they were needed, but this made
impossible to track the different execution contexts in a specific
moment. Having a stack makes possible to run until the top of the
stack and check for loops or functions.
9290ec59d5b94cf01c880e8c5538eaca8d6b55ba2025-11-23T19:34:34Z2025-11-23T19:34:34Zbc: Implement return statementsRoberto E. Vargas Caballerok0ga@shike2.netcommit 9290ec59d5b94cf01c880e8c5538eaca8d6b55ba
parent 276256e9c67680bb7e1c7e2c882d449f502e62e7
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sun, 23 Nov 2025 20:34:34 +0100
bc: Implement return statements
When a return is found we have to go out of all the nested contexts
and _ideally_ that number should be in nested, but we are including
the function contexts here. Also, this makes clear that the
implementation of break was wrong, because we have to find the nesting
level of the previous loop to break it. Also, at this moment no
semantic check is done to vaalidate that we are in a loop or even
in a function, and it means that weird things can happen if we put
a return out of a function scope.
276256e9c67680bb7e1c7e2c882d449f502e62e72025-11-23T19:06:17Z2025-11-23T19:06:17ZRevert "bc: set used = 0 in writeout"Roberto E. Vargas Caballerok0ga@shike2.netcommit 276256e9c67680bb7e1c7e2c882d449f502e62e7
parent f0438f7a70b1df3b2ac642af5312b138e9899681
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sun, 23 Nov 2025 20:06:17 +0100
Revert "bc: set used = 0 in writeout"
This reverts commit 0850438f93155902b6a062c94786fa99e4269715.
There intermixed clls to writeout(), so we cannot reset
the memory in writeout. At this moment is clear that we have
to use a better memory allocation mecanism.
f0438f7a70b1df3b2ac642af5312b138e98996812025-11-23T16:09:14Z2025-11-23T16:09:14Zbc: Begin line count in 1Roberto E. Vargas Caballerok0ga@shike2.netcommit f0438f7a70b1df3b2ac642af5312b138e9899681
parent d0750d57c5478e579d91f7a44bd0a9456a0a29e9
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sun, 23 Nov 2025 17:09:14 +0100
bc: Begin line count in 1
d0750d57c5478e579d91f7a44bd0a9456a0a29e92025-11-23T16:01:18Z2025-11-23T16:01:18Zbc: Accept digits beginning with .Roberto E. Vargas Caballerok0ga@shike2.netcommit d0750d57c5478e579d91f7a44bd0a9456a0a29e9
parent d92ba69e98303ee78c81106d1cae82af806cff81
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sun, 23 Nov 2025 17:01:18 +0100
bc: Accept digits beginning with .
d92ba69e98303ee78c81106d1cae82af806cff812025-11-23T13:52:20Z2025-11-23T13:52:20Zbc: Build correctly local listRoberto E. Vargas Caballerok0ga@shike2.netcommit d92ba69e98303ee78c81106d1cae82af806cff81
parent bda3c885596c445a3f181c3935eabd953b455486
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sun, 23 Nov 2025 14:52:20 +0100
bc: Build correctly local list
Code receives format string as first parameter and passing $1 just
discards the second parameter.
bda3c885596c445a3f181c3935eabd953b4554862025-11-23T11:31:30Z2025-11-23T11:31:30Zbc: Fix comment parsingRoberto E. Vargas Caballerok0ga@shike2.netcommit bda3c885596c445a3f181c3935eabd953b455486
parent 4e3d54e231f17d851ee58031d8e2becf75b81302
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sun, 23 Nov 2025 12:31:30 +0100
bc: Fix comment parsing
The function comment was misparsing comments, because it ate always
the character after a *, invalidating sequences like **/. Also, as it
didn't count new line characters error messages were misleading.