/*1* tkUnix.c --2*3* This file contains procedures that are UNIX/X-specific, and4* will probably have to be written differently for Windows or5* Macintosh platforms.6*7* Copyright (c) 1995 Sun Microsystems, Inc.8*9* See the file "license.terms" for information on usage and redistribution10* of this file, and for a DISCLAIMER OF ALL WARRANTIES.11*12* SCCS: @(#) tkUnix.c 1.3 96/02/15 18:55:1813*/1415#include <tkInt.h>1617/*18*----------------------------------------------------------------------19*20* TkGetServerInfo --21*22* Given a window, this procedure returns information about23* the window server for that window. This procedure provides24* the guts of the "winfo server" command.25*26* Results:27* None.28*29* Side effects:30* None.31*32*----------------------------------------------------------------------33*/3435void36TkGetServerInfo(interp, tkwin)37Tcl_Interp *interp; /* The server information is returned in38* this interpreter's result. */39Tk_Window tkwin; /* Token for window; this selects a40* particular display and server. */41{42char buffer[50], buffer2[50];4344sprintf(buffer, "X%dR%d ", ProtocolVersion(Tk_Display(tkwin)),45ProtocolRevision(Tk_Display(tkwin)));46sprintf(buffer2, " %d", VendorRelease(Tk_Display(tkwin)));47Tcl_AppendResult(interp, buffer, ServerVendor(Tk_Display(tkwin)),48buffer2, (char *) NULL);49}5051/*52*----------------------------------------------------------------------53*54* TkGetDefaultScreenName --55*56* Returns the name of the screen that Tk should use during57* initialization.58*59* Results:60* Returns the argument or a string that should not be freed by61* the caller.62*63* Side effects:64* None.65*66*----------------------------------------------------------------------67*/6869char *70TkGetDefaultScreenName(interp, screenName)71Tcl_Interp *interp; /* Interp used to find environment variables. */72char *screenName; /* Screen name from command line, or NULL. */73{74if ((screenName == NULL) || (screenName[0] == '\0')) {75screenName = Tcl_GetVar2(interp, "env", "DISPLAY", TCL_GLOBAL_ONLY);76}77return screenName;78}798081