sbase, branch HEAD suckless unix tools 53e147613abd376cba8f9ec510d81d190ecdff64 2026-01-15T09:11:20Z 2026-01-15T19:26:35Z tr: Allow combining classes and sets Santtu Lakkala inz@inz.fi commit 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. 860737f897218ffe123c4749ca9cf8998eecf17d 2026-01-14T20:30:02Z 2026-01-14T20:30:02Z dc: Don't use truncate() Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 9f27b727a20b65145b872cad55205460a31b4f96 2026-01-14T17:26:11Z 2026-01-14T17:26:11Z dc: Remove lower case hexa digits Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 608f88f08fcb049f30a1963f2bc72e429a63ba42 2025-12-15T15:01:56Z 2026-01-14T11:49:01Z dc: Add initial version Roberto E. Vargas Caballero k0ga@shike2.net commit 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. a1bf3adbc5f69f236319b99bd0a6aab6138c0014 2026-01-13T14:31:46Z 2026-01-13T14:31:46Z tests: Merge stderr and stdout in 0002-printf.sh Roberto E. Vargas Caballero k0ga@shike2.net commit 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. c02bf1a70d8dc1e0e7fb3e1a691c012d594ac322 2026-01-13T11:11:16Z 2026-01-13T11:11:16Z tests: USE $EXEC and fix ed path Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 59f7e452709216715949d90bc9ba1872c33bc6b9 2026-01-05T21:29:57Z 2026-01-05T21:29:57Z tests: Use exit in signal traps Roberto E. Vargas Caballero k0ga@shike2.net commit 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. ead2c4616a171a905dd0822be111e08947559d90 2025-12-31T15:15:53Z 2025-12-31T15:15:53Z build: Remove all .o in clean Roberto E. Vargas Caballero k0ga@shike2.net commit 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. f7f69125cf296bfd50a483c976f0991ec6e9ffe1 2025-12-31T14:31:21Z 2025-12-31T14:31:21Z make: Synchronize with scc Roberto E. Vargas Caballero k0ga@shike2.net commit 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. f8d39b2329be259e46efd019091e6061de5fbe4b 2025-12-31T14:25:57Z 2025-12-31T14:25:57Z bc: Improve man page Roberto E. Vargas Caballero k0ga@shike2.net commit f8d39b2329be259e46efd019091e6061de5fbe4b parent 79bc44c1849938925fe05d6fdc81093a85f50215 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Wed, 31 Dec 2025 15:25:57 +0100 bc: Improve man page 79bc44c1849938925fe05d6fdc81093a85f50215 2025-12-31T12:19:34Z 2025-12-31T12:19:34Z ed: Correct behaviour of shell escape in r and w Roberto E. Vargas Caballero k0ga@shike2.net commit 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. dae48911d223022deb96408a65ed910f82a2ef30 2025-12-31T12:08:52Z 2025-12-31T12:08:52Z ed: Update man page and TODO Roberto E. Vargas Caballero k0ga@shike2.net commit 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 4bc4a1d030dead3308020db6fdddf4b042a83a7e 2025-12-31T11:38:39Z 2025-12-31T11:38:39Z ed: Use the variable LINES for z Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 60d9f7a5a9f0b55660915b06fdc73db6811a9f9d 2025-12-16T15:59:21Z 2025-12-30T09:21:33Z ed: Fix multiline commands Santtu Lakkala inz@inz.fi commit 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. c11a21f426d661f4c20a19c4769f7de42668435d 2025-12-13T15:06:45Z 2025-12-13T15:06:45Z build: Install bc library Roberto E. Vargas Caballero k0ga@shike2.net commit c11a21f426d661f4c20a19c4769f7de42668435d parent 85721b5a334484e2da0d8c21e343e5aaf7082d61 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Sat, 13 Dec 2025 16:06:45 +0100 build: Install bc library 85721b5a334484e2da0d8c21e343e5aaf7082d61 2025-12-13T15:03:58Z 2025-12-13T15:03:58Z bc: Add man page Roberto E. Vargas Caballero k0ga@shike2.net commit 85721b5a334484e2da0d8c21e343e5aaf7082d61 parent 42ebd643f6628ed4b0ef21f77d98368a2b0deab6 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Sat, 13 Dec 2025 16:03:58 +0100 bc: Add man page 42ebd643f6628ed4b0ef21f77d98368a2b0deab6 2025-12-13T15:03:34Z 2025-12-13T15:03:34Z bc: Fix path of the bc library Roberto E. Vargas Caballero k0ga@shike2.net commit 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 8ceddc568dcfae458ed9cb2c5b9421cf4b612db1 2025-12-13T14:37:08Z 2025-12-13T14:37:08Z bc: Increment the number of nestting to 32 Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 54f1f935c0024550d1715b173d662e9bf9ee2eb4 2025-12-13T12:29:17Z 2025-12-13T12:29:17Z ed: Update TODO error list Roberto E. Vargas Caballero k0ga@shike2.net commit 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 77f8d7e5934c146d047c6c38b97067ae046268d9 2025-12-13T11:51:11Z 2025-12-13T11:57:33Z ed: Add the x and X commands Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 5765a6e6b434ce692a15ed2e64bc2ea0d1c5a2e1 2025-12-13T11:05:39Z 2025-12-13T11:57:29Z ed: Implement non truncate writes Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 08b8c73ddaf92727f8e9a93f2c0d60eb0183caa4 2025-12-13T10:52:32Z 2025-12-13T10:52:32Z ed: Don't clear modflag in shell escapes Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 5364863516ace9b153ba5508c07baacef86127bc 2025-12-13T09:42:51Z 2025-12-13T10:48:06Z ed: Don't clear modflag until is safe Roberto E. Vargas Caballero k0ga@shike2.net commit 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. daec4db8a3611927158611f3b0cbc082b4673e28 2025-12-13T10:14:15Z 2025-12-13T10:14:15Z ed: Improve man page Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 8227fbab2e1209bf68125e19d366ffacdc2071d2 2025-12-13T09:42:51Z 2025-12-13T09:42:51Z ed: Don't clear modflag until is safe Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 9a0d04fcf9ac486a4056a3641ecb098a227166af 2025-12-13T09:29:17Z 2025-12-13T09:29:17Z ed: Accept shell escapes in r, e and E commands Roberto E. Vargas Caballero k0ga@shike2.net commit 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 8adf85e686e8b95d00879e2882b2d925dbdbd681 2025-12-12T19:36:03Z 2025-12-12T19:36:03Z tests/ed: Fix 0008-ed.sh and 0009-ed.sh Roberto E. Vargas Caballero k0ga@shike2.net commit 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 325953bd2cd1e1fd43a8cf8f9e1b49c32e5b818b 2025-12-12T19:34:56Z 2025-12-12T19:34:56Z tests/bc: Add test cases for the bc library Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 1106076d535f8c9e93694a0343e5508865df9a4b 2025-12-12T11:14:21Z 2025-12-12T11:14:21Z bc: Simplify loading internal library Roberto E. Vargas Caballero k0ga@shike2.net commit 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. d898b61ed22e7d7ced081cbf2f646c82cbf88f00 2025-12-11T20:55:06Z 2025-12-11T20:55:06Z bc: Don't pop value from body in while Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 9febd6d57c98d8d29c6d9abac3839b1614dcae15 2025-12-11T11:45:35Z 2025-12-11T11:45:35Z bc: Add a space after relationals Roberto E. Vargas Caballero k0ga@shike2.net commit 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. c6cbb33ef02075c21b519bb59e1c69f74ff8470f 2025-12-11T11:43:42Z 2025-12-11T11:43:42Z bc: Unify local() and param() Roberto E. Vargas Caballero k0ga@shike2.net commit 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. ec8218c93bb19777f212addf94544ac01c3012c2 2025-12-11T07:52:47Z 2025-12-11T07:57:02Z bc: Keep happy the compiler Roberto E. Vargas Caballero k0ga@shike2.net commit 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 301f018935abc4a61f37e126085c2824ebc49257 2025-12-11T07:46:17Z 2025-12-11T07:57:02Z bc: Fix relational operators Roberto E. Vargas Caballero k0ga@shike2.net commit 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. fbc4b4252455a126c552e6b4b35adb643ff1135c 2025-12-08T17:20:07Z 2025-12-08T17:20:07Z tests: Fix 0007-ed.sh Roberto E. Vargas Caballero k0ga@shike2.net commit 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 7ff51bffd1c7fa34429b6c063fac1d4f7db85d9d 2025-12-08T17:13:14Z 2025-12-08T17:19:29Z sbase-box: Reduce bss size using dynamic memory Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 13db2e48d4b7899c04d7fdbc88cab29397b3f44b 2025-12-08T17:11:19Z 2025-12-08T17:19:29Z tests: Minor improvements to 0006-ed.sh Roberto E. Vargas Caballero k0ga@shike2.net commit 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 96b9a71acfa88f613980cfc39054577e0e63be47 2025-12-08T17:03:44Z 2025-12-08T17:19:25Z ed: Accept no address in k command Roberto E. Vargas Caballero k0ga@shike2.net commit 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 284e154a278134f910ba54e9a0b7cfac1d6748fe 2025-12-08T16:54:10Z 2025-12-08T17:19:04Z ed: Restore newlines in match() Roberto E. Vargas Caballero k0ga@shike2.net commit 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). a45474cfbb2de4a16592bf4fa7e19345cab03c5c 2025-12-08T17:03:44Z 2025-12-08T17:03:44Z ed: Accept no address in k command Roberto E. Vargas Caballero k0ga@shike2.net commit 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 f6a1fbb9b1c6b5058371daeeb903a7e7a3643bbd 2025-12-08T16:54:10Z 2025-12-08T16:54:10Z ed: Restore newlines in match() Roberto E. Vargas Caballero k0ga@shike2.net commit 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). beb6a2fa2aeaa9791738510097231e7e9da45f47 2025-12-08T16:32:38Z 2025-12-08T16:47:35Z ed: Detect correctly end of file in gettxt() Roberto E. Vargas Caballero k0ga@shike2.net commit 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. c63dd6d49941778ad99fb1f2834f97626a511ccb 2025-12-08T16:30:50Z 2025-12-08T16:30:50Z tests: Remove cleanup functions Roberto E. Vargas Caballero k0ga@shike2.net commit c63dd6d49941778ad99fb1f2834f97626a511ccb parent ae50e31d532df74e97d2e0525d0f282cf3377142 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Mon, 8 Dec 2025 17:30:50 +0100 tests: Remove cleanup functions ae50e31d532df74e97d2e0525d0f282cf3377142 2025-12-08T16:01:30Z 2025-12-08T16:13:25Z ed: Allow z commands with no address Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 0190f5e7bf8985af3ed768f7d17d192c23beb5d1 2025-12-01T15:02:51Z 2025-12-02T08:23:47Z ed: Split tests Santtu Lakkala inz@inz.fi commit 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. afa8975960633104311f9d81bf478171e950e26d 2025-11-30T20:11:22Z 2025-11-30T20:11:22Z bc: Unwind after calculating return expression Roberto E. Vargas Caballero k0ga@shike2.net commit 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. b95368aa433853d7f9fd160add78be5835f561ef 2025-11-28T14:50:07Z 2025-11-28T14:50:07Z bc: Add prototypes for param() and local() Roberto E. Vargas Caballero k0ga@shike2.net commit 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() 98923f69a1bb852d7fcbf2146dec4a084874bf80 2025-11-28T11:34:55Z 2025-11-28T11:34:55Z bc: Unwind the stack in every return Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 6edcf9948848793f67f04458a72c7825fe9e4138 2025-11-27T18:02:33Z 2025-11-27T18:02:33Z bc: Don't reuse ids from functions Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 26cc48e028bd53f8cdc7ba7c564babcc7958aa4b 2025-11-27T08:49:03Z 2025-11-27T11:22:04Z bc: Make funcode() return a string Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 328295370ab688b83ce56034131a44f2f9426244 2025-11-26T08:17:41Z 2025-11-26T08:17:41Z bc: Improve print extension Roberto E. Vargas Caballero k0ga@shike2.net commit 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. a360af6355f49472654954f5f6ddb43c1b3f1a17 2025-11-26T07:55:10Z 2025-11-26T08:16:52Z bc: Add leading space to explicit return Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 69d08810f5633d4dd1ac2b486fa96f29123b0a37 2025-11-26T07:54:02Z 2025-11-26T08:16:52Z bc: Use strdup for STRING Roberto E. Vargas Caballero k0ga@shike2.net commit 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(). e43f97dba453bde1833e5c25a9af2d2b0eaf2e0c 2025-11-26T07:47:56Z 2025-11-26T07:47:56Z bc: Obey POSIX about handling newlines Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 4d7926403e6860a915d2f3de5f6fe2b297ebb2e4 2025-11-25T20:10:49Z 2025-11-25T20:10:49Z bc: Read stdin after a list of files Roberto E. Vargas Caballero k0ga@shike2.net commit 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." 2cf8559bad6eef27f2f4279afb0282f678a95c09 2025-11-25T16:14:35Z 2025-11-25T16:25:53Z bc: Fix indentation in bc.library Roberto E. Vargas Caballero k0ga@shike2.net commit 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 2e9d76d21711d3c8f62d350e5cf9e68deda78031 2025-11-25T15:54:04Z 2025-11-25T16:25:53Z bc: Use dynamic memory for strings Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 10ad90244eca21f033d59f808b45edf69060f5eb 2025-11-25T15:18:37Z 2025-11-25T15:18:37Z bc: Fix modulo operation Roberto E. Vargas Caballero k0ga@shike2.net commit 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 %. 974179ce006d118086cb91a4c3176d05a60daa60 2025-11-25T15:08:58Z 2025-11-25T15:08:58Z bc: Don't use freopen() Roberto E. Vargas Caballero k0ga@shike2.net commit 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. c759756d2e47cf2737949d0007937e467a4825eb 2025-11-25T10:21:47Z 2025-11-25T10:21:47Z bc: Implement the . operand Roberto E. Vargas Caballero k0ga@shike2.net commit 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. fee2f025d0e921966786fc8b0212f55674d35469 2025-11-25T10:01:39Z 2025-11-25T10:01:39Z bc: Implement plan9 print extension Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 721e8bb7e608fdadebbb780bfde127a699e3bc5c 2025-11-25T09:31:11Z 2025-11-25T09:31:11Z bc: Rewrite macros to implement break and return Roberto E. Vargas Caballero k0ga@shike2.net commit 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). e656b3773023a7a1c60d0573bb326e40d450e8cc 2025-11-24T11:27:12Z 2025-11-24T11:33:48Z bc: Create of stack of macros Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 9290ec59d5b94cf01c880e8c5538eaca8d6b55ba 2025-11-23T19:34:34Z 2025-11-23T19:34:34Z bc: Implement return statements Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 276256e9c67680bb7e1c7e2c882d449f502e62e7 2025-11-23T19:06:17Z 2025-11-23T19:06:17Z Revert "bc: set used = 0 in writeout" Roberto E. Vargas Caballero k0ga@shike2.net commit 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. f0438f7a70b1df3b2ac642af5312b138e9899681 2025-11-23T16:09:14Z 2025-11-23T16:09:14Z bc: Begin line count in 1 Roberto E. Vargas Caballero k0ga@shike2.net commit 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 d0750d57c5478e579d91f7a44bd0a9456a0a29e9 2025-11-23T16:01:18Z 2025-11-23T16:01:18Z bc: Accept digits beginning with . Roberto E. Vargas Caballero k0ga@shike2.net commit 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 . d92ba69e98303ee78c81106d1cae82af806cff81 2025-11-23T13:52:20Z 2025-11-23T13:52:20Z bc: Build correctly local list Roberto E. Vargas Caballero k0ga@shike2.net commit 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. bda3c885596c445a3f181c3935eabd953b455486 2025-11-23T11:31:30Z 2025-11-23T11:31:30Z bc: Fix comment parsing Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 4e3d54e231f17d851ee58031d8e2becf75b81302 2025-11-23T10:53:26Z 2025-11-23T10:53:26Z bc: Don't prepend bc in eprintf() Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 56b93ad91becdb1370523190f0e1645f8286a524 2025-11-23T10:42:10Z 2025-11-23T10:42:10Z bc: Add support for the bc library Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 0850438f93155902b6a062c94786fa99e4269715 2025-11-23T08:45:57Z 2025-11-23T08:45:57Z bc: set used = 0 in writeout Roberto E. Vargas Caballero k0ga@shike2.net commit 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. b39fe92a7ba9ec2ffbdeaced9398a7945de7d4cb 2025-11-23T08:43:45Z 2025-11-23T08:43:45Z bc: Fix <= relational operator Roberto E. Vargas Caballero k0ga@shike2.net commit 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 <=. a49b87f927866a08d7cedbebed2f64dcd346afb9 2025-11-22T18:29:56Z 2025-11-22T18:29:56Z bc: Add support for multi files Roberto E. Vargas Caballero k0ga@shike2.net commit 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. abce467a9d5f61d41957f435cec34f28d1c5e1dc 2025-11-22T11:04:36Z 2025-11-22T11:04:36Z build: Fix .c and bc: rules Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 14796edb26a2cdfa29cb78b0f934d620d5fd11dd 2025-11-22T10:52:02Z 2025-11-22T10:54:31Z bc: Adapt sbase style Roberto E. Vargas Caballero k0ga@shike2.net commit 14796edb26a2cdfa29cb78b0f934d620d5fd11dd parent 33ac9371b8f5ef9c3d80c443f91ea42c5a8778d4 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Sat, 22 Nov 2025 11:52:02 +0100 bc: Adapt sbase style 33ac9371b8f5ef9c3d80c443f91ea42c5a8778d4 2025-11-21T22:00:34Z 2025-11-22T10:54:31Z bc: Initial version Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 9c9da834c37dbab7780f3307bfc367862d35e8cd 2025-11-20T15:51:01Z 2025-11-20T17:31:59Z printf: Fix string format string length calculation Santtu Lakkala inz@inz.fi commit 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 eedc7522976945476fb4dbf9165d2c6057226c14 2025-11-20T15:47:11Z 2025-11-20T15:47:11Z tests: Use heredoc for diff Roberto E. Vargas Caballero k0ga@shike2.net commit 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. b3c479298c7cdba3213ec9ea17a99c64c51e25f8 2025-11-20T13:27:54Z 2025-11-20T14:49:35Z ed: Add tests Santtu Lakkala inz@inz.fi commit 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. 9aa43e6808e231d365c52c1d590078e5de3b23e5 2025-11-20T13:27:53Z 2025-11-20T14:49:31Z ed: Fix double-free in join Santtu Lakkala inz@inz.fi commit 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. 6bc2a3a18fda73247a254b30a1509a51fe0fc534 2025-11-20T13:27:52Z 2025-11-20T14:49:25Z ed: doread() minor refactoring Santtu Lakkala inz@inz.fi commit 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. 7d1e7ae620f30e40f8863b6e653dbbf86eafb1f6 2025-11-20T13:27:51Z 2025-11-20T14:49:19Z ed: Fix regex matching and no end-of-line files Santtu Lakkala inz@inz.fi commit 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. c15aa18ff3958f4f72137dc8139744c5f028e83f 2025-11-20T14:01:30Z 2025-11-20T14:01:30Z tests: Use tmp. prefix in 0002-printf Roberto E. Vargas Caballero k0ga@shike2.net commit 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. f64db1fa07393ef80a489e49ab926712795ac716 2025-11-13T11:44:52Z 2025-11-13T11:44:52Z doc: Remove fixed printf(1) bug Roberto E. Vargas Caballero k0ga@shike2.net commit 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 7a83a5355444e5e444c23ddaea2ff6aed5e52923 2025-11-13T11:44:25Z 2025-11-13T11:44:25Z sbase-box: Don't show xinstall in the usage Roberto E. Vargas Caballero k0ga@shike2.net commit 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 d77328ca4d1a7aab1905a85faea8bacdcb0cb293 2025-11-12T15:49:54Z 2025-11-12T16:03:54Z printf: Fix multiple flags and read overflow Santtu Lakkala inz@inz.fi commit 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. 4593bfb3596df8e69a178329283c9d07ed0eddbd 2025-11-05T17:41:15Z 2025-11-10T08:12:00Z tests: Add initial support for tests Roberto E. Vargas Caballero k0ga@shike2.net commit 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 931eb042009af6d402a9a80f3d03e37f5dfa6749 2025-11-07T10:22:02Z 2025-11-07T10:39:48Z grep: Minor stylistic changes Santtu Lakkala inz@inz.fi commit 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. 1c444555b8c9530a15ea84cd94e4b8de4d8e6019 2025-11-06T13:24:08Z 2025-11-06T14:14:01Z grep: Fix -x, simplify addpattern Santtu Lakkala inz@inz.fi commit 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. 314a2d20cba0a92f7b0494056c27895169675ca0 2025-11-05T18:05:28Z 2025-11-06T07:09:47Z basename: fix case: basename "" "" Hiltjo Posthuma hiltjo@codemadness.org commit 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 "." b93f0c750d9e76d5498724e64ea0e44bf500ab8f 2025-11-05T18:04:39Z 2025-11-06T07:09:47Z tr: improving checking flags and allowed number of arguments Hiltjo Posthuma hiltjo@codemadness.org commit 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 ee7ff4fb9583a15b89c54002a5b0000c7fe38746 2025-11-05T13:45:04Z 2025-11-05T13:45:04Z grep: Fix typo Roberto E. Vargas Caballero k0ga@shike2.net commit ee7ff4fb9583a15b89c54002a5b0000c7fe38746 parent ae7bfda8f6f1b3f1951e8e69b8910d5171bf6236 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Wed, 5 Nov 2025 14:45:04 +0100 grep: Fix typo ae7bfda8f6f1b3f1951e8e69b8910d5171bf6236 2025-11-05T08:59:44Z 2025-11-05T13:07:14Z grep: Don't modify constant strings Roberto E. Vargas Caballero k0ga@shike2.net commit 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> 87f4755cd09eecdab7c750a347143cc6fb3b262d 2025-11-03T15:46:05Z 2025-11-03T18:01:03Z libutil: Fix buffer overflows in 224-bit SHA Santtu Lakkala inz@inz.fi commit 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. 1bae669f236b9612eacd64554cfb39733157ef43 2025-11-03T17:52:11Z 2025-11-03T17:52:11Z rm: fix confirmation for deleting files and add question mark Hiltjo Posthuma hiltjo@codemadness.org commit 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. 61b58e3c2731966a8fa4d60e33a724a27e722f76 2025-11-03T15:10:31Z 2025-11-03T15:13:05Z basename: Ignore suffix when its an empty string Carlos J. Torres vlaadbrain@gmail.com commit 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. fdcca1be51cad2c0b53d41d829830c1a7070def0 2025-08-28T15:26:20Z 2025-11-03T15:12:47Z Makefile: copy scripts in dist recipe Eduardo Santos eduardo.experimental@gmail.com commit 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> 0ae546333bdbf9f489f8a9508711bf5081bff1cc 2025-11-03T12:06:56Z 2025-11-03T12:06:56Z ed: Validate better range for k and z Roberto E. Vargas Caballero k0ga@shike2.net commit 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. 54ccddd2e752372b98e85fce355d0d28e7621f75 2025-11-03T12:04:55Z 2025-11-03T12:04:55Z ed: Increase mark array Roberto E. Vargas Caballero k0ga@shike2.net commit 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.