tno c99 isms - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 14695b90acb1226ee1b137350e6dbbbc73c2f0e7
 (DIR) parent 6bd2526b02d9c05391932097f2a8b71c1a1bdc59
 (HTM) Author: rsc <devnull@localhost>
       Date:   Wed, 31 May 2006 04:55:43 +0000
       
       no c99 isms
       
       Diffstat:
         M src/cmd/graph/graph.c               |      32 ++++++++++++++++++++++---------
       
       1 file changed, 23 insertions(+), 9 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/graph/graph.c b/src/cmd/graph/graph.c
       t@@ -67,16 +67,29 @@ struct z {
        struct {
                char *name;
                int next;
       -} palette[] = {
       -        ['b']        { "blue", 'b' },
       -        ['c']        { "cyan", 'c' },
       -        ['g']        { "green", 'g' },
       -        ['k']        { "kblack", 'k' },
       -        ['m']        { "magenta", 'm' },
       -        ['r']        { "red", 'r' },
       -        ['w']        { "white", 'w' },
       -        ['y']        { "yellow", 'y' }
       +} palette[256];
       +
       +static char* colors[] = {
       +        "blue",
       +        "cyan",
       +        "green",
       +        "kblack",
       +        "magenta",
       +        "red",
       +        "white",
       +        "yellow"
        };
       +static void
       +initpalette(void)
       +{
       +        int i;
       +        
       +        for(i=0; i<nelem(colors); i++){
       +                palette[(uchar)colors[i][0]].name = colors[i];
       +                palette[(uchar)colors[i][0]].next = colors[i][0];
       +        }
       +}
       +
        int pencolor = 'k';
        
        void init(struct xy *);
       t@@ -106,6 +119,7 @@ void axlab(char, struct xy *, char *);
        
        int main(int argc,char *argv[]){
        
       +        initpalette();
                openpl();
                range(0,0,4096,4096);
                init(&xd);