NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/46189: wsfb/genfb red and blue colours are reversed on bit depths 15 16 24 and 32



The following reply was made to PR kern/46189; it has been noted by GNATS.

From: Nat Sloss <nathanialsloss%yahoo.com.au@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/46189: wsfb/genfb red and blue colours are reversed on bit 
depths 15 16 24 and 32
Date: Mon, 30 Apr 2012 20:52:44 +1000

 Hi.
 
 Here is a patch to my colour bar programme, so that it no longer core dumps on 
 an unknown terminal type and displays an error message and exits for non 
 colour capable terminals.
 
 --- colourtest.c.orig   2012-04-30 20:37:20.000000000 +1000
 +++ colourtest.c        2012-04-30 20:43:26.000000000 +1000
 @@ -24,13 +24,24 @@
         int numcolours = 8;
         int labelwidth = 8;
 
 -       initscr();
 +       if (!(initscr())) {
 +               printf("Unknown terminal type.\n");
 +               return;
 +       }
 +
         colourOK = has_colors();
         spacing = COLS / numcolours;
         offsetx = (COLS - (spacing * numcolours)) / 2;
         labeloffsetx = spacing / 2;
         labeloffsety = (LINES - 1 - labelwidth) / 2;
 
 +       if (!colourOK) {
 +               endwin();
 +               printf("\nTerminal must be colour capable.");
 +               printf("\n");
 +               return;
 +       }
 +
         if (COLS < 45 || LINES < 10) {
                 endwin();
                 printf("\nTerminal size must be at least 45x10.");
 
 Regards,
 
 Nat.
 


Home | Main Index | Thread Index | Old Index