Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!decvax!ucbvax!ucbcad!nike!sri-spam!rutgers!caip!clyde!cbatt!cbosgd!soma!soma.bcm.tmc.edu!sob From: sob@soma.bcm.tmc.edu.bcm.tmc.edu (Stan Barber) Newsgroups: mod.computers.masscomp Subject: detecting a graphics terminal in a program Message-ID: <1130@soma.bcm.tmc.edu> Date: Fri, 17-Oct-86 16:24:01 EDT Article-I.D.: soma.1130 Posted: Fri Oct 17 16:24:01 1986 Date-Received: Sat, 18-Oct-86 15:31:22 EDT Sender: masscomp@soma.bcm.tmc.edu Organization: Masscomp Users' Society Lines: 44 Approved: masscomp@soma.uucp Have you ever wondered how a program can detect if the user is at a graphics terminal? It's really easy.... Here is a sample of how to do it with a fortran callable function written in C: /* is this a graphics device that I am on? */ /* $Header: isgraphics.c,v 1.1 86/10/16 16:19:02 lab Exp $ * By Stan Barber * $Log: isgraphics.c,v $ * Revision 1.1 86/10/16 16:19:02 lab * Initial revision * * */ #include #include isgraphics_() { WINDOWDATA WD; int i; i=ioctl(fileno(stdout),WIOCGETD,&WD); if (i == 0) return(1); return(0); } This will return a 1 if you are on a graphics terminal and 0 if not. I would like to make this a logical, but the documentation is not specific on how to do this...Maybe a Westford person can tell us... Here is a sample program to use to test this: program testidgr integer j j = isgraphics(0) print *,j end The compiler command to use is: f77 -o testidgr testidgr.f isgraphics.c If anyone has any more shorts to contribute, please feel free.