bc: Implement plan9 print extension - sbase - suckless unix tools
 (HTM) git clone git://git.suckless.org/sbase
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit fee2f025d0e921966786fc8b0212f55674d35469
 (DIR) parent 721e8bb7e608fdadebbb780bfde127a699e3bc5c
 (HTM) 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.
       
       Diffstat:
         M bc.y                                |       3 +++
       
       1 file changed, 3 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/bc.y b/bc.y
       @@ -87,6 +87,7 @@ int cflag, dflag, lflag, sflag;
        %token IBASE
        %token OBASE
        %token AUTO
       +%token PRINT
        
        %type <str> assign nexpr expr exprstat rel stat ary statlst cond
        %type <str> autolst arglst parlst
       @@ -125,6 +126,7 @@ statlst :                       {$$ = code("");}
                ;
        
        stat    : exprstat
       +        | PRINT expr            {$$ = code("%sps.", $2);}
                | STRING                {$$ = code("[%s]P", $1);}
                | BREAK                 {$$ = brkcode();}
                | QUIT                  {quit();}
       @@ -446,6 +448,7 @@ iden(int ch)
                        {"ibase", IBASE},
                        {"obase", OBASE},
                        {"auto", AUTO},
       +                {"print", PRINT},
                        {NULL}
                };
                struct keyword *p;