|
|
researchv9-SUN3(old)
/* $Header: /var/lib/cvsd/repos/research/researchv9/X11/src/X.V11R1/lib/X/XDisName.c,v 1.1.1.1 2018/04/24 17:22:00 root Exp $ */
/* XDisplayName.c */
/*
* Returns the name of the display XOpenDisplay would use. This is better
* than just printing the "display" variable in a program because that
* could be NULL and/or there could be an environment variable set.
* This makes it easier for programmers to provide meaningful error
* messages.
*
*
* For example, this is used in XOpenDisplay() as
* strncpy( displaybuf, XDisplayName( display ), sizeof(displaybuf) );
* if ( *displaybuf == '\0' ) return( NULL );
* This check is actually unnecessary because the next thing is an index()
* call looking for a ':' which will fail and we'll return(NULL).
*/
/* Written at Waterloo - JMSellens */
#include <stdio.h>
char *getenv();
char *
XDisplayName( display )
char *display;
{
char *d;
if ( display != (char *)NULL && *display != '\0' )
return( display );
if ( (d = getenv( "DISPLAY" )) != (char *)NULL )
return( d );
return( "" );
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.