#include <cgidefs.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/file.h>
#include <pixrect/pixrect_hs.h>
#include <errno.h>
#include <sunwindow/win_struct.h>
#include <suntool/tool_hs.h>
#include <suntool/fullscreen.h>
#include<sunwindow/window_hs.h>
#include <signal.h>
#include <fcntl.h>
isitcolor_(isuncl)
int *isuncl;
{
        int fd,depth;
        struct pixwin *pw;
        char win_name[WIN_NAMESIZE];

        if (we_getgfxwindow(win_name) != 0)
        {
             fprintf(stderr,"no graphics window available\n");
             *isuncl=-1;
             return;
        }
        if ((fd=open(win_name,O_RDWR,0)) == -1)
        {
             fprintf(stderr,"could not open window\n");
             *isuncl=-1;
             return;
        }
        if ((pw=pw_open(fd)) != (struct pixwin *) NULL)
             depth=pw->pw_pixrect->pr_depth;
        else
        {
             fprintf(stderr,"could not open pixwin\n");
             *isuncl = -1;
             return;
        }
        close(fd);
        if(depth != 1 && depth != 8)
        {
             *isuncl = -1;
             return;
         }
         if(depth==1)
             *isuncl=0;
         else
             *isuncl=1;
         return;
}
