Define TRUNCLEN and explain its issues.
authorEric S. Raymond <esr@thyrsus.com>
Sat, 21 Sep 2024 02:04:16 +0000 (22:04 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Sat, 21 Sep 2024 02:04:16 +0000 (22:04 -0400)
misc.c

diff --git a/misc.c b/misc.c
index 533735b4fc20f8c419a6dc809aac0c2fdcbb28be..af887374d51c7cb0857bdbeb8f8ec03a23c4242c 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -512,9 +512,14 @@ static void tokenize(char *raw, command_t *cmd) {
         * in their tools. On the other, not simulating this misbehavior
         * goes against the goal of making oldstyle as accurate as
         * possible an emulation of the original UI.
+        *
+        * The definition of TRUNCLEN is dubious. It accurately reflects the
+        * FORTRAN, but it's possible that was a bug and the proper definition
+        * is (TOKLEN).
         */
+#define TRUNCLEN (TOKLEN + TOKLEN)
        if (settings.oldstyle) {
-               cmd->word[0].raw[TOKLEN] = cmd->word[1].raw[TOKLEN] = '\0';
+               cmd->word[0].raw[TRUNCLEN] = cmd->word[1].raw[TRUNCLEN] = '\0';
                for (size_t i = 0; i < strlen(cmd->word[0].raw); i++) {
                        cmd->word[0].raw[i] = toupper(cmd->word[0].raw[i]);
                }