[hackers] [sbase] bc: Improve print extension || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Wed, 26 Nov 2025 11:38:16 +0100 (CET)

commit 328295370ab688b83ce56034131a44f2f9426244
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.net>
AuthorDate: Wed Nov 26 09:17:41 2025 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.net>
CommitDate: Wed Nov 26 09:17:41 2025 +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.

diff --git a/bc.y b/bc.y
index d51b5da..51f1596 100644
--- a/bc.y
+++ b/bc.y
_AT_@ -130,6 +130,8 @@ statlst : {$$ = code("");}
 
 stat : exprstat
         | PRINT expr {$$ = code("%sps.", $2);}
+ | PRINT STRING {$$ = code("[%s]P", $2);}
+ | PRINT STRING ',' expr {$$ = code("[%s]P%sps.", $2, $4);}
         | STRING {$$ = code("[%s]P", $1);}
         | BREAK {$$ = brkcode();}
         | QUIT {quit();}
Received on Wed Nov 26 2025 - 11:38:16 CET

This archive was generated by hypermail 2.3.0 : Wed Nov 26 2025 - 11:48:38 CET