sbase, branch HEADsuckless unix tools
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.
4e3d54e231f17d851ee58031d8e2becf75b813022025-11-23T10:53:26Z2025-11-23T10:53:26Zbc: Don't prepend bc in eprintf()Roberto E. Vargas Caballerok0ga@shike2.netcommit 4e3d54e231f17d851ee58031d8e2becf75b81302
parent 56b93ad91becdb1370523190f0e1645f8286a524
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sun, 23 Nov 2025 11:53:26 +0100
bc: Don't prepend bc in eprintf()
Eprintf() currently prepends agrv0 generating a double print
of argv0.
56b93ad91becdb1370523190f0e1645f8286a5242025-11-23T10:42:10Z2025-11-23T10:42:10Zbc: Add support for the bc libraryRoberto E. Vargas Caballerok0ga@shike2.netcommit 56b93ad91becdb1370523190f0e1645f8286a524
parent 0850438f93155902b6a062c94786fa99e4269715
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sun, 23 Nov 2025 11:42:10 +0100
bc: Add support for the bc library
This library was imported from the BSD 4.4 source code but it is a
portion of code with ownership from AT&T and it can be used under
the Caldera open source license.
0850438f93155902b6a062c94786fa99e42697152025-11-23T08:45:57Z2025-11-23T08:45:57Zbc: set used = 0 in writeoutRoberto E. Vargas Caballerok0ga@shike2.netcommit 0850438f93155902b6a062c94786fa99e4269715
parent b39fe92a7ba9ec2ffbdeaced9398a7945de7d4cb
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sun, 23 Nov 2025 09:45:57 +0100
bc: set used = 0 in writeout
When we call writeou we do know that the temporary string built in
buff is not going to be used anymore, and it is a good moment to
reset it.
b39fe92a7ba9ec2ffbdeaced9398a7945de7d4cb2025-11-23T08:43:45Z2025-11-23T08:43:45Zbc: Fix <= relational operatorRoberto E. Vargas Caballerok0ga@shike2.netcommit b39fe92a7ba9ec2ffbdeaced9398a7945de7d4cb
parent a49b87f927866a08d7cedbebed2f64dcd346afb9
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sun, 23 Nov 2025 09:43:45 +0100
bc: Fix <= relational operator
It was implementing != instead of <=.
a49b87f927866a08d7cedbebed2f64dcd346afb92025-11-22T18:29:56Z2025-11-22T18:29:56Zbc: Add support for multi filesRoberto E. Vargas Caballerok0ga@shike2.netcommit a49b87f927866a08d7cedbebed2f64dcd346afb9
parent abce467a9d5f61d41957f435cec34f28d1c5e1dc
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 22 Nov 2025 19:29:56 +0100
bc: Add support for multi files
Bc was supporting only reading programs from stdin, and this patch uses
freopen() to redirect input files (if any) to stdin.
abce467a9d5f61d41957f435cec34f28d1c5e1dc2025-11-22T11:04:36Z2025-11-22T11:04:36Zbuild: Fix .c and bc: rulesRoberto E. Vargas Caballerok0ga@shike2.netcommit abce467a9d5f61d41957f435cec34f28d1c5e1dc
parent 14796edb26a2cdfa29cb78b0f934d620d5fd11dd
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 22 Nov 2025 12:04:36 +0100
build: Fix .c and bc: rules
These rules were not adding the proper flags in every case
resulting in the lost of some important flags in some
cases.
14796edb26a2cdfa29cb78b0f934d620d5fd11dd2025-11-22T10:52:02Z2025-11-22T10:54:31Zbc: Adapt sbase styleRoberto E. Vargas Caballerok0ga@shike2.netcommit 14796edb26a2cdfa29cb78b0f934d620d5fd11dd
parent 33ac9371b8f5ef9c3d80c443f91ea42c5a8778d4
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 22 Nov 2025 11:52:02 +0100
bc: Adapt sbase style
33ac9371b8f5ef9c3d80c443f91ea42c5a8778d42025-11-21T22:00:34Z2025-11-22T10:54:31Zbc: Initial versionRoberto E. Vargas Caballerok0ga@shike2.netcommit 33ac9371b8f5ef9c3d80c443f91ea42c5a8778d4
parent 9c9da834c37dbab7780f3307bfc367862d35e8cd
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Fri, 21 Nov 2025 23:00:34 +0100
bc: Initial version
This version is almost finished, but it does not implements the return
keyword (it is ignored) and it does not include the default bc library
(the option to load it is silently ignored). It also lack tests.
9c9da834c37dbab7780f3307bfc367862d35e8cd2025-11-20T15:51:01Z2025-11-20T17:31:59Zprintf: Fix string format string length calculationSanttu Lakkalainz@inz.ficommit 9c9da834c37dbab7780f3307bfc367862d35e8cd
parent eedc7522976945476fb4dbf9165d2c6057226c14
Author: Santtu Lakkala <inz@inz.fi>
Date: Thu, 20 Nov 2025 17:51:01 +0200
printf: Fix string format string length calculation
eedc7522976945476fb4dbf9165d2c6057226c142025-11-20T15:47:11Z2025-11-20T15:47:11Ztests: Use heredoc for diffRoberto E. Vargas Caballerok0ga@shike2.netcommit eedc7522976945476fb4dbf9165d2c6057226c14
parent b3c479298c7cdba3213ec9ea17a99c64c51e25f8
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Thu, 20 Nov 2025 16:47:11 +0100
tests: Use heredoc for diff
This simplifies the logic because it avoids the use of an additional
temporary file. The cleanup function is added only to EXIT because
in the way that it is written it works also in the case of signals.
b3c479298c7cdba3213ec9ea17a99c64c51e25f82025-11-20T13:27:54Z2025-11-20T14:49:35Zed: Add testsSanttu Lakkalainz@inz.ficommit b3c479298c7cdba3213ec9ea17a99c64c51e25f8
parent 9aa43e6808e231d365c52c1d590078e5de3b23e5
Author: Santtu Lakkala <inz@inz.fi>
Date: Thu, 20 Nov 2025 15:27:54 +0200
ed: Add tests
Add tests for some cases fixed by previous changes, and also generic
usage.
9aa43e6808e231d365c52c1d590078e5de3b23e52025-11-20T13:27:53Z2025-11-20T14:49:31Zed: Fix double-free in joinSanttu Lakkalainz@inz.ficommit 9aa43e6808e231d365c52c1d590078e5de3b23e5
parent 6bc2a3a18fda73247a254b30a1509a51fe0fc534
Author: Santtu Lakkala <inz@inz.fi>
Date: Thu, 20 Nov 2025 15:27:53 +0200
ed: Fix double-free in join
Skip calling free() on s.str in join() to avoid double-free by string()
in next invocation.
6bc2a3a18fda73247a254b30a1509a51fe0fc5342025-11-20T13:27:52Z2025-11-20T14:49:25Zed: doread() minor refactoringSanttu Lakkalainz@inz.ficommit 6bc2a3a18fda73247a254b30a1509a51fe0fc534
parent 7d1e7ae620f30e40f8863b6e653dbbf86eafb1f6
Author: Santtu Lakkala <inz@inz.fi>
Date: Thu, 20 Nov 2025 15:27:52 +0200
ed: doread() minor refactoring
Swap n and len local variable names for clarity and matching getline()
documentation.
7d1e7ae620f30e40f8863b6e653dbbf86eafb1f62025-11-20T13:27:51Z2025-11-20T14:49:19Zed: Fix regex matching and no end-of-line filesSanttu Lakkalainz@inz.ficommit 7d1e7ae620f30e40f8863b6e653dbbf86eafb1f6
parent c15aa18ff3958f4f72137dc8139744c5f028e83f
Author: Santtu Lakkala <inz@inz.fi>
Date: Thu, 20 Nov 2025 15:27:51 +0200
ed: Fix regex matching and no end-of-line files
Remove trailing newline from lines before passing them to regexec to
avoid false-positive matches for ^$ (or similar).
Also fix handling of files not ending in newline by appending the
newline instead of replacing the last character.
c15aa18ff3958f4f72137dc8139744c5f028e83f2025-11-20T14:01:30Z2025-11-20T14:01:30Ztests: Use tmp. prefix in 0002-printfRoberto E. Vargas Caballerok0ga@shike2.netcommit c15aa18ff3958f4f72137dc8139744c5f028e83f
parent f64db1fa07393ef80a489e49ab926712795ac716
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Thu, 20 Nov 2025 15:01:30 +0100
tests: Use tmp. prefix in 0002-printf
The clear rule of the Makefile only knows about files
that begin with tmp, and having files with the prefix
exp can produce dirty workcopies even after running
make clean.
f64db1fa07393ef80a489e49ab926712795ac7162025-11-13T11:44:52Z2025-11-13T11:44:52Zdoc: Remove fixed printf(1) bugRoberto E. Vargas Caballerok0ga@shike2.netcommit f64db1fa07393ef80a489e49ab926712795ac716
parent 7a83a5355444e5e444c23ddaea2ff6aed5e52923
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Thu, 13 Nov 2025 12:44:52 +0100
doc: Remove fixed printf(1) bug
7a83a5355444e5e444c23ddaea2ff6aed5e529232025-11-13T11:44:25Z2025-11-13T11:44:25Zsbase-box: Don't show xinstall in the usageRoberto E. Vargas Caballerok0ga@shike2.netcommit 7a83a5355444e5e444c23ddaea2ff6aed5e52923
parent d77328ca4d1a7aab1905a85faea8bacdcb0cb293
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Thu, 13 Nov 2025 12:44:25 +0100
sbase-box: Don't show xinstall in the usage
d77328ca4d1a7aab1905a85faea8bacdcb0cb2932025-11-12T15:49:54Z2025-11-12T16:03:54Zprintf: Fix multiple flags and read overflowSanttu Lakkalainz@inz.ficommit d77328ca4d1a7aab1905a85faea8bacdcb0cb293
parent 4593bfb3596df8e69a178329283c9d07ed0eddbd
Author: Santtu Lakkala <inz@inz.fi>
Date: Wed, 12 Nov 2025 17:49:54 +0200
printf: Fix multiple flags and read overflow
Support having multiple flags for a single conversion; at least '+'/'#' and
'0' are not exclusive.
Further use strspn() instead of inlined version for correct handling of
string ending with allowed characters.
4593bfb3596df8e69a178329283c9d07ed0eddbd2025-11-05T17:41:15Z2025-11-10T08:12:00Ztests: Add initial support for testsRoberto E. Vargas Caballerok0ga@shike2.netcommit 4593bfb3596df8e69a178329283c9d07ed0eddbd
parent 931eb042009af6d402a9a80f3d03e37f5dfa6749
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 5 Nov 2025 18:41:15 +0100
tests: Add initial support for tests
931eb042009af6d402a9a80f3d03e37f5dfa67492025-11-07T10:22:02Z2025-11-07T10:39:48Zgrep: Minor stylistic changesSanttu Lakkalainz@inz.ficommit 931eb042009af6d402a9a80f3d03e37f5dfa6749
parent 1c444555b8c9530a15ea84cd94e4b8de4d8e6019
Author: Santtu Lakkala <inz@inz.fi>
Date: Fri, 7 Nov 2025 12:22:02 +0200
grep: Minor stylistic changes
Use a flexible array member for pattern string to simplify addpattern()
Remove two redundant length checks; both already checked in loop
conditional.
1c444555b8c9530a15ea84cd94e4b8de4d8e60192025-11-06T13:24:08Z2025-11-06T14:14:01Zgrep: Fix -x, simplify addpatternSanttu Lakkalainz@inz.ficommit 1c444555b8c9530a15ea84cd94e4b8de4d8e6019
parent 314a2d20cba0a92f7b0494056c27895169675ca0
Author: Santtu Lakkala <inz@inz.fi>
Date: Thu, 6 Nov 2025 15:24:08 +0200
grep: Fix -x, simplify addpattern
Use grouping for -x to make \| / | work correctly; as a bonus beginning
and end of line anchors hold their special meaning inside a group,
removing the need for special handling of them.
Further, as this makes -w and -x only differ in anchors used, use the
same code for both.
314a2d20cba0a92f7b0494056c27895169675ca02025-11-05T18:05:28Z2025-11-06T07:09:47Zbasename: fix case: basename "" ""Hiltjo Posthumahiltjo@codemadness.orgcommit 314a2d20cba0a92f7b0494056c27895169675ca0
parent b93f0c750d9e76d5498724e64ea0e44bf500ab8f
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 5 Nov 2025 19:05:28 +0100
basename: fix case: basename "" ""
This should return "", not "."
b93f0c750d9e76d5498724e64ea0e44bf500ab8f2025-11-05T18:04:39Z2025-11-06T07:09:47Ztr: improving checking flags and allowed number of argumentsHiltjo Posthumahiltjo@codemadness.orgcommit b93f0c750d9e76d5498724e64ea0e44bf500ab8f
parent ee7ff4fb9583a15b89c54002a5b0000c7fe38746
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 5 Nov 2025 19:04:39 +0100
tr: improving checking flags and allowed number of arguments
ee7ff4fb9583a15b89c54002a5b0000c7fe387462025-11-05T13:45:04Z2025-11-05T13:45:04Zgrep: Fix typoRoberto E. Vargas Caballerok0ga@shike2.netcommit ee7ff4fb9583a15b89c54002a5b0000c7fe38746
parent ae7bfda8f6f1b3f1951e8e69b8910d5171bf6236
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 5 Nov 2025 14:45:04 +0100
grep: Fix typo
ae7bfda8f6f1b3f1951e8e69b8910d5171bf62362025-11-05T08:59:44Z2025-11-05T13:07:14Zgrep: Don't modify constant stringsRoberto E. Vargas Caballerok0ga@shike2.netcommit ae7bfda8f6f1b3f1951e8e69b8910d5171bf6236
parent 87f4755cd09eecdab7c750a347143cc6fb3b262d
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 5 Nov 2025 09:59:44 +0100
grep: Don't modify constant strings
The pattern pointer was assigned to a constant string and later it was
modified, which is UB. But even worse, as we were trusting the patlen
parameter received, patlen was meaningless after that assignment.
The addpattern() had many problems because it trusted the patlen
parameter, but in some places it used string functions that depend of
having a NUL character creating many problems when embedded NUL characters
were found in the pattern. As mandated by POSIX in [1]:
The interfaces specified in POSIX.1-2017 do not permit the
inclusion of a NUL character in an RE or in the string to be
matched. If during the operation of a standard utility a NUL
is included in the text designated to be matched, that NUL may
designate the end of the text string for the purposes of matching.
so, the simples solution is just discard the patlen parameter and call
strlen() in addpattern() and use that as size of the pattern.
[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html
Co-authored-by: Santtu Lakkala <inz@inz.fi>
87f4755cd09eecdab7c750a347143cc6fb3b262d2025-11-03T15:46:05Z2025-11-03T18:01:03Zlibutil: Fix buffer overflows in 224-bit SHASanttu Lakkalainz@inz.ficommit 87f4755cd09eecdab7c750a347143cc6fb3b262d
parent 1bae669f236b9612eacd64554cfb39733157ef43
Author: Santtu Lakkala <inz@inz.fi>
Date: Mon, 3 Nov 2025 17:46:05 +0200
libutil: Fix buffer overflows in 224-bit SHA
Adjust buffer sizes for both SHA-256 and SHA-512 based 224-bit SHA
checksums.
Use a temporary buffer for SHA-512/224, as 224 is not multiple of 64-bit
internal state array of SHA-512.
1bae669f236b9612eacd64554cfb39733157ef432025-11-03T17:52:11Z2025-11-03T17:52:11Zrm: fix confirmation for deleting files and add question markHiltjo Posthumahiltjo@codemadness.orgcommit 1bae669f236b9612eacd64554cfb39733157ef43
parent 61b58e3c2731966a8fa4d60e33a724a27e722f76
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 3 Nov 2025 18:52:11 +0100
rm: fix confirmation for deleting files and add question mark
Answering 'y' to rm -i will now delete the file.
61b58e3c2731966a8fa4d60e33a724a27e722f762025-11-03T15:10:31Z2025-11-03T15:13:05Zbasename: Ignore suffix when its an empty stringCarlos J. Torresvlaadbrain@gmail.comcommit 61b58e3c2731966a8fa4d60e33a724a27e722f76
parent fdcca1be51cad2c0b53d41d829830c1a7070def0
Author: Carlos J. Torres <vlaadbrain@gmail.com>
Date: Mon, 3 Nov 2025 10:10:31 -0500
basename: Ignore suffix when its an empty string
basename(3) manual states if path is a null pointer or emtpy
string, a pointer to "." is returned. We shouldn't attempt
to modify it because its const.
fdcca1be51cad2c0b53d41d829830c1a7070def02025-08-28T15:26:20Z2025-11-03T15:12:47ZMakefile: copy scripts in dist recipeEduardo Santoseduardo.experimental@gmail.comcommit fdcca1be51cad2c0b53d41d829830c1a7070def0
parent 0ae546333bdbf9f489f8a9508711bf5081bff1cc
Author: Eduardo Santos <eduardo.experimental@gmail.com>
Date: Thu, 28 Aug 2025 12:26:20 -0300
Makefile: copy scripts in dist recipe
Building from the tarball fails:
curl --no-progress-meter https://dl.suckless.org/sbase/sbase-0.1.tar.gz \
| tar -xz --strip-components=1 \
&& make >/dev/null
ar: creating libutf.a
ar: creating libutil.a
/bin/sh: line 1: scripts/getconf.sh: No such file or directory
make: *** [Makefile:221: getconf.h] Error 127
The scripts contained in the script directory are required
for several make targets (including all, install, uninstall,
sbase-box and maybe some others).
Signed-off-by: Eduardo Santos <eduardo.experimental@gmail.com>
0ae546333bdbf9f489f8a9508711bf5081bff1cc2025-11-03T12:06:56Z2025-11-03T12:06:56Zed: Validate better range for k and zRoberto E. Vargas Caballerok0ga@shike2.netcommit 0ae546333bdbf9f489f8a9508711bf5081bff1cc
parent 54ccddd2e752372b98e85fce355d0d28e7621f75
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 3 Nov 2025 13:06:56 +0100
ed: Validate better range for k and z
The k and z commands require 1 and only one address
so checking for != 1 catches the unsual case when
nlines == 0, that only can happen when we are editing
an empty file.
54ccddd2e752372b98e85fce355d0d28e7621f752025-11-03T12:04:55Z2025-11-03T12:04:55Zed: Increase mark arrayRoberto E. Vargas Caballerok0ga@shike2.netcommit 54ccddd2e752372b98e85fce355d0d28e7621f75
parent 17447ec767e3968704e6e24e3b533d46ab5bcae2
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 3 Nov 2025 13:04:55 +0100
ed: Increase mark array
The mark array had an incorrect size because it lacked a +1
so it didn't have space for the last character of the range.