sbase, branch HEAD suckless unix tools c1341583c96307cb0e6152c963ed23c4d56a4278 2026-04-03T10:01:52Z 2026-04-06T09:10:50Z LICENSE: Update my email address Quentin Rameau quinq@fifth.space commit c1341583c96307cb0e6152c963ed23c4d56a4278 parent 26761aa4fb825ab9de45d71a1281fbd5b581f19b Author: Quentin Rameau <quinq@fifth.space> Date: Fri, 3 Apr 2026 12:01:52 +0200 LICENSE: Update my email address 26761aa4fb825ab9de45d71a1281fbd5b581f19b 2026-04-02T21:50:07Z 2026-04-06T09:10:50Z crypt: Cosmetically improve error message Quentin Rameau quinq@fifth.space commit 26761aa4fb825ab9de45d71a1281fbd5b581f19b parent 3c7df37bc636538d024937e891d0959a28c370f7 Author: Quentin Rameau <quinq@fifth.space> Date: Thu, 2 Apr 2026 23:50:07 +0200 crypt: Cosmetically improve error message 3c7df37bc636538d024937e891d0959a28c370f7 2026-04-02T21:48:05Z 2026-04-06T09:10:50Z crypt: Fix hash line format compatibility Quentin Rameau quinq@fifth.space commit 3c7df37bc636538d024937e891d0959a28c370f7 parent 6bb5d0b24b807fa77efc79f72bc8c2a2285713c9 Author: Quentin Rameau <quinq@fifth.space> Date: Thu, 2 Apr 2026 23:48:05 +0200 crypt: Fix hash line format compatibility According to the coreutils implementation man-page (of sha512sum), > The sums are computed as described in FIPS-180-2. When checking, the > input should be a former output of this program. The default mode is > to print a line with: checksum, a space, a character indicating input > mode ('*' for binary, ' ' for text or where binary is insignificant), > and name for each FILE. 6bb5d0b24b807fa77efc79f72bc8c2a2285713c9 2026-04-02T21:45:53Z 2026-04-06T09:10:50Z crypt: Improve hash length verification Quentin Rameau quinq@fifth.space commit 6bb5d0b24b807fa77efc79f72bc8c2a2285713c9 parent 8b842c789c63b376f054d65163d7c7cc279e147c Author: Quentin Rameau <quinq@fifth.space> Date: Thu, 2 Apr 2026 23:45:53 +0200 crypt: Improve hash length verification The current version would not detect incorrect hashes of one more character than expected. 8b842c789c63b376f054d65163d7c7cc279e147c 2026-03-11T14:57:23Z 2026-03-18T11:44:52Z Update my e-mail address Mattias Andrée m@maandree.se commit 8b842c789c63b376f054d65163d7c7cc279e147c parent 20e44f4bcc2bda061dc801c820345628e05b5900 Author: Mattias Andrée <m@maandree.se> Date: Wed, 11 Mar 2026 15:57:23 +0100 Update my e-mail address Signed-off-by: Mattias Andrée <m@maandree.se> 20e44f4bcc2bda061dc801c820345628e05b5900 2026-03-17T09:38:51Z 2026-03-17T09:48:28Z tar: avoid unnecessary VLA Michael Forney mforney@mforney.org commit 20e44f4bcc2bda061dc801c820345628e05b5900 parent 35bad530f5318c4d256be192b17b09d8608b1404 Author: Michael Forney <mforney@mforney.org> Date: Tue, 17 Mar 2026 02:38:51 -0700 tar: avoid unnecessary VLA An assignment expression is not a constant expression, so while the length of fname is always constant, it becomes a VLA. The `l` variable never changes, so just use `sizeof fname` for clarity. 35bad530f5318c4d256be192b17b09d8608b1404 2026-03-17T09:35:30Z 2026-03-17T09:48:28Z Pass CFLAGS and CPPFLAGS when building make Michael Forney mforney@mforney.org commit 35bad530f5318c4d256be192b17b09d8608b1404 parent 23160db9e0b545cead16ac48f23dc31eff2f1b1b Author: Michael Forney <mforney@mforney.org> Date: Tue, 17 Mar 2026 02:35:30 -0700 Pass CFLAGS and CPPFLAGS when building make 23160db9e0b545cead16ac48f23dc31eff2f1b1b 2026-03-17T08:09:29Z 2026-03-17T09:16:45Z touch: prevent file creation race between utimensat() and open() Michael Forney mforney@mforney.org commit 23160db9e0b545cead16ac48f23dc31eff2f1b1b parent 004a51426e42d42150a746dc113ad86fb3fbed3c Author: Michael Forney <mforney@mforney.org> Date: Tue, 17 Mar 2026 01:09:29 -0700 touch: prevent file creation race between utimensat() and open() If another process creates the file after we determined it was missing, touch would fail on open() due to O_EXCL. This failure doesn't serve any purpose; we want to update the mtime either way. 004a51426e42d42150a746dc113ad86fb3fbed3c 2026-01-30T13:21:08Z 2026-01-30T13:21:08Z ed: Minor whitespace change Roberto E. Vargas Caballero k0ga@shike2.net commit 004a51426e42d42150a746dc113ad86fb3fbed3c parent 1871a3578059a836c3aa1817ba9030f7f50c5e9b Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Fri, 30 Jan 2026 14:21:08 +0100 ed: Minor whitespace change 1871a3578059a836c3aa1817ba9030f7f50c5e9b 2026-01-30T12:10:55Z 2026-01-30T12:44:08Z ed: Regex fixes Santtu Lakkala inz@inz.fi commit 1871a3578059a836c3aa1817ba9030f7f50c5e9b parent 611fb5b365d5a07d59c00db99d692850a7aa3c30 Author: Santtu Lakkala <inz@inz.fi> Date: Fri, 30 Jan 2026 14:10:55 +0200 ed: Regex fixes Fix somewhat broken beginning and end of line handling using REG_NOEOL flag of regexec(). Also force progress with zero-width matches by re-running regexec at next position if a zero-width match is found at the current position. 611fb5b365d5a07d59c00db99d692850a7aa3c30 2026-01-30T11:21:00Z 2026-01-30T12:00:23Z ed: Implement command expansion for io commands Santtu Lakkala inz@inz.fi commit 611fb5b365d5a07d59c00db99d692850a7aa3c30 parent e9577cde96b603adc73731a24d0fd331b02019f1 Author: Santtu Lakkala <inz@inz.fi> Date: Fri, 30 Jan 2026 13:21:00 +0200 ed: Implement command expansion for io commands Split command expansion functionality from execsh() for reuse in the read and write commands. Adjust getfname() to leave the command in the input buffer for extraction by the new expandcmd(). e9577cde96b603adc73731a24d0fd331b02019f1 2026-01-30T11:58:02Z 2026-01-30T11:58:02Z bc: Simplify writeout Roberto E. Vargas Caballero k0ga@shike2.net commit e9577cde96b603adc73731a24d0fd331b02019f1 parent b343ded0be4defafb709945117d79dab4e70a242 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Fri, 30 Jan 2026 12:58:02 +0100 bc: Simplify writeout b343ded0be4defafb709945117d79dab4e70a242 2026-01-27T15:37:06Z 2026-01-27T15:37:06Z tests/grep: Add faulting test case Roberto E. Vargas Caballero k0ga@shike2.net commit b343ded0be4defafb709945117d79dab4e70a242 parent 1bb5a34dfe299c759d4542d9fe2ac816aca14897 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Tue, 27 Jan 2026 16:37:06 +0100 tests/grep: Add faulting test case 1bb5a34dfe299c759d4542d9fe2ac816aca14897 2026-01-22T11:09:06Z 2026-01-22T11:40:34Z dc: Use scale for number of digits in multiplication Roberto E. Vargas Caballero k0ga@shike2.net commit 1bb5a34dfe299c759d4542d9fe2ac816aca14897 parent 74096de403e3fd43bae726c45d9087b47d92f19b Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Thu, 22 Jan 2026 12:09:06 +0100 dc: Use scale for number of digits in multiplication The scale factor has to be considered in the multiplication because many algorithms will depend of the precision configured in the scale, that, until now, was considered only for division. BSD and Plan9 dc differ about how to handle this, and plan9 always use only the scale factor, while BSD uses the maximun of the scale factor or the bigger scale of the operands. The second seems more sensible and produces output that user would expect, for example 0k 0.5 0.5*p would produce 0.2 with the BSD criteria, but it would generate 0 with the plan9 criteria. 74096de403e3fd43bae726c45d9087b47d92f19b 2026-01-22T10:26:18Z 2026-01-22T10:26:18Z bc: Fix typo Roberto E. Vargas Caballero k0ga@shike2.net commit 74096de403e3fd43bae726c45d9087b47d92f19b parent 02db7b173a56839fbb69a0d861c731fb987df4df Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Thu, 22 Jan 2026 11:26:18 +0100 bc: Fix typo 02db7b173a56839fbb69a0d861c731fb987df4df 2026-01-22T10:10:19Z 2026-01-22T10:10:19Z tests: Be deterministic about stderr Roberto E. Vargas Caballero k0ga@shike2.net commit 02db7b173a56839fbb69a0d861c731fb987df4df parent c5bfe949dca7001f5e1d456b0c6aebef8fbe07c8 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Thu, 22 Jan 2026 11:10:19 +0100 tests: Be deterministic about stderr Different libcsuse different criteria about buffering stderr and it created problems in tests merging stdout and stderr. To avoid the problem just redirect stderr to a different file and merge them later using cat in a subshell. c5bfe949dca7001f5e1d456b0c6aebef8fbe07c8 2026-01-20T15:31:13Z 2026-01-20T15:31:13Z bc: Add support for long names Roberto E. Vargas Caballero k0ga@shike2.net commit c5bfe949dca7001f5e1d456b0c6aebef8fbe07c8 parent 759ef4f504aec455083582f18431127d7cdf8e73 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Tue, 20 Jan 2026 16:31:13 +0100 bc: Add support for long names As dc supports extended identifiers and we already had the option -s in bc that modifies the standard behaviour we can extend bc in the -s mode to support longer names. The lower case restriction is maintained just for simplicity but it is possible to extend bc to support full utf8 identifers. 759ef4f504aec455083582f18431127d7cdf8e73 2026-01-20T15:13:41Z 2026-01-20T15:13:41Z tests/bc: Fix values in 0010-bc.sh Roberto E. Vargas Caballero k0ga@shike2.net commit 759ef4f504aec455083582f18431127d7cdf8e73 parent b7e30e59700d9af15a83ce9dc06a05b4f7926332 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Tue, 20 Jan 2026 16:13:41 +0100 tests/bc: Fix values in 0010-bc.sh Several typos and different criteria. b7e30e59700d9af15a83ce9dc06a05b4f7926332 2026-01-20T15:00:33Z 2026-01-20T15:00:33Z dc: Don't use negative numbers in divscale() Roberto E. Vargas Caballero k0ga@shike2.net commit b7e30e59700d9af15a83ce9dc06a05b4f7926332 parent a2940adeba5293032f6ceb7d218dc9f09d6de984 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Tue, 20 Jan 2026 16:00:33 +0100 dc: Don't use negative numbers in divscale() Divscale uses the function muln() that is not prepared to handle negative numbers. The solution is to convert them to positive numbers and handle the sign in divnum() and modnum(). We don't need a copy of the parameters because they are used directly with values from the stack, or from the expnum() function that discards the input parameters when it calls divnum(). a2940adeba5293032f6ceb7d218dc9f09d6de984 2026-01-19T17:49:42Z 2026-01-19T17:49:42Z dc: Don't trash val next pointer Roberto E. Vargas Caballero k0ga@shike2.net commit a2940adeba5293032f6ceb7d218dc9f09d6de984 parent 40a4999b60355a8e498f1d228469aeca17f9a698 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Mon, 19 Jan 2026 18:49:42 +0100 dc: Don't trash val next pointer When a value was assigned to a register using the 's' command we were assigning the full value from execution stack, overwriting the next pointer of the register stack with the next pointer of the execution stack. 40a4999b60355a8e498f1d228469aeca17f9a698 2026-01-19T15:25:04Z 2026-01-19T15:25:04Z tests: Minor modifications and fixes Roberto E. Vargas Caballero k0ga@shike2.net commit 40a4999b60355a8e498f1d228469aeca17f9a698 parent 6edd9510c2321fe4198c7d5a41db4a692a38c252 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Mon, 19 Jan 2026 16:25:04 +0100 tests: Minor modifications and fixes 6edd9510c2321fe4198c7d5a41db4a692a38c252 2026-01-19T12:42:40Z 2026-01-19T12:42:40Z tests/bc: Improve output in 0010-bc.sh Roberto E. Vargas Caballero k0ga@shike2.net commit 6edd9510c2321fe4198c7d5a41db4a692a38c252 parent 1fbc996c41f9e82b2379bc10a9a0084b7d6cb347 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Mon, 19 Jan 2026 13:42:40 +0100 tests/bc: Improve output in 0010-bc.sh 1fbc996c41f9e82b2379bc10a9a0084b7d6cb347 2026-01-19T10:51:24Z 2026-01-19T10:51:24Z tests/ed: Fix test comparation Roberto E. Vargas Caballero k0ga@shike2.net commit 1fbc996c41f9e82b2379bc10a9a0084b7d6cb347 parent dc8a781c16c467c4540e001721725c6ff444d664 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Mon, 19 Jan 2026 11:51:24 +0100 tests/ed: Fix test comparation The string equality operator in test is = not ==. dc8a781c16c467c4540e001721725c6ff444d664 2026-01-19T08:42:23Z 2026-01-19T08:42:23Z bc: Remove leftover from c00921a Roberto E. Vargas Caballero k0ga@shike2.net commit dc8a781c16c467c4540e001721725c6ff444d664 parent 9b4e1dd6d4f2705ad47d644efa330ed37b713df3 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Mon, 19 Jan 2026 09:42:23 +0100 bc: Remove leftover from c00921a The commit c00921a fixed a segfault happening when no parameters or auto variables happened, moving the initialization of the unwind string to the moment when the macro is initialized, but a dummy initialization remained for every declaration making that variables were not poped (and of course a memory leak). 9b4e1dd6d4f2705ad47d644efa330ed37b713df3 2026-01-19T08:35:41Z 2026-01-19T08:35:41Z bc: Fix minor typo using EARGF Roberto E. Vargas Caballero k0ga@shike2.net commit 9b4e1dd6d4f2705ad47d644efa330ed37b713df3 parent c00921a3a3eabb3f908fc22eff9189c756274742 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Mon, 19 Jan 2026 09:35:41 +0100 bc: Fix minor typo using EARGF c00921a3a3eabb3f908fc22eff9189c756274742 2026-01-18T10:26:26Z 2026-01-18T16:52:37Z bc: Force a unwind string in every function Roberto E. Vargas Caballero k0ga@shike2.net commit c00921a3a3eabb3f908fc22eff9189c756274742 parent 1c79098178db0f6c26bf4459902000b81c098dd0 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Sun, 18 Jan 2026 11:26:26 +0100 bc: Force a unwind string in every function The code in funcode() assumes that the string unwind has a value but it didn't happen in the case of a function without parameters or local variables. 1c79098178db0f6c26bf4459902000b81c098dd0 2026-01-17T16:00:46Z 2026-01-17T20:16:35Z dc: prevent segfaults by cleaning up data Elie Le Vaillant eolien55@disroot.org commit 1c79098178db0f6c26bf4459902000b81c098dd0 parent 46c00d58d59b9be55c4dcdb11605a90baa60d310 Author: Elie Le Vaillant <eolien55@disroot.org> Date: Sat, 17 Jan 2026 17:00:46 +0100 dc: prevent segfaults by cleaning up data Without these changes, dc can undergo segfaults in a variety of situations (list of cases that segfault, one for changed line): 1. echo 'e(5)' | bc -lc | dc 2. echo 'la sa sa sa' | dc 3. echo '5p' > a.dc; dc a.dc 46c00d58d59b9be55c4dcdb11605a90baa60d310 2026-01-17T15:46:56Z 2026-01-17T20:16:35Z bc: small fixes regarding bc.library Elie Le Vaillant eolien55@disroot.org commit 46c00d58d59b9be55c4dcdb11605a90baa60d310 parent 41883950c9421cdb8fac18f5dd3dab8f7e2463e5 Author: Elie Le Vaillant <eolien55@disroot.org> Date: Sat, 17 Jan 2026 16:46:56 +0100 bc: small fixes regarding bc.library 41883950c9421cdb8fac18f5dd3dab8f7e2463e5 2026-01-17T17:09:57Z 2026-01-17T18:10:28Z bc: Add -p to change the dc executable Roberto E. Vargas Caballero k0ga@shike2.net commit 41883950c9421cdb8fac18f5dd3dab8f7e2463e5 parent 2544b70216bb71aec663a9657142e13ad0c6ac41 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Sat, 17 Jan 2026 18:09:57 +0100 bc: Add -p to change the dc executable This option is mainly added to make easier testing and enabling using bc with custom dc versions. 2544b70216bb71aec663a9657142e13ad0c6ac41 2026-01-17T09:57:43Z 2026-01-17T09:57:43Z dc: Relax tail call optimization Roberto E. Vargas Caballero k0ga@shike2.net commit 2544b70216bb71aec663a9657142e13ad0c6ac41 parent 9439e85c041626dfac86d3011d9f8392823dd768 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Sat, 17 Jan 2026 10:57:43 +0100 dc: Relax tail call optimization Classical dc implementations only apply tail recursion optimization but we were applying tail call recursion, removing one frame even when no recursion was involved. This creates problems with bc that does not track this optimization and it generates values for the Q command without caring about this optimization. 9439e85c041626dfac86d3011d9f8392823dd768 2026-01-17T09:07:18Z 2026-01-17T09:07:18Z Ignore dc Roberto E. Vargas Caballero k0ga@shike2.net commit 9439e85c041626dfac86d3011d9f8392823dd768 parent 53e147613abd376cba8f9ec510d81d190ecdff64 Author: Roberto E. Vargas Caballero <k0ga@shike2.net> Date: Sat, 17 Jan 2026 10:07:18 +0100 Ignore dc 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.