csopendi.c revision 824
70N/A * (c) Copyright 1990-1994 Adobe Systems Incorporated. 70N/A * Permission to use, copy, modify, distribute, and sublicense this software 70N/A * and its documentation for any purpose and without fee is hereby granted, 70N/A * provided that the above copyright notices appear in all copies and that 70N/A * both those copyright notices and this permission notice appear in 70N/A * supporting documentation and that the name of Adobe Systems Incorporated 70N/A * not be used in advertising or publicity pertaining to distribution of the 70N/A * software without specific, written prior permission. No trademark license 70N/A * to use the Adobe trademarks is hereby granted. If the Adobe trademark 70N/A * "Display PostScript"(tm) is used to describe this software, its 70N/A * functionality or for any other purpose, such use shall be limited to a 70N/A * statement that this software works in conjunction with the Display 70N/A * PostScript system. Proper trademark attribution to reflect Adobe's 70N/A * ownership of the trademark shall be given whenever any such reference to 70N/A * the Display PostScript system is made. 70N/A * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR 70N/A * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. 70N/A * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 70N/A * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 70N/A * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE 70N/A * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL 70N/A * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT, 70N/A * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN 70N/A * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT 70N/A * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE. 70N/A * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems 70N/A * Incorporated which may be registered in certain jurisdictions 493N/A * Portions Copyright Massachusetts Institute of Technology 1985, 1986 70N/A * Permission to use, copy, modify, distribute, and sell this software and its 70N/A * documentation for any purpose is hereby granted without fee, provided that 851N/A * the above copyright notice appear in all copies and that both that 70N/A * copyright notice and this permission notice appear in supporting 911N/A * documentation, and that the name of M.I.T. not be used in advertising or 911N/A * publicity pertaining to distribution of the software without specific, 911N/A * written prior permission. M.I.T. makes no representations about the 911N/A * suitability of this software for any purpose. It is provided "as is" 70N/A * without express or implied warranty. 70N/A * Author: Adobe Systems Incorporated and MIT X Consortium static int lock;
/* get rid of ifdefs when locking implemented */ /* +++ Someday make this common with XDPS.c version */ * First, a routine for setting authorization data static char *
xauth_name =
NULL;
/* NULL means use default mechanism */ if (
namelen > 0) {
/* try to allocate space */ * Connects to a server, creates a Display object and returns a pointer to * the newly created Display back to the caller. * Find an agent to talk to. /* try to start-up an NX? */ /* cons-up an arg. to pass to Agent we are forking */ /* ASSERT: first argument in additionalArgs must be }
else {
/* autoLaunch != True */ /* Free agentHost later */ * Attempt to allocate a display structure. Return NULL if allocation fails. * Call the Connect routine to get the network socket. If -1 is returned, the * connection failed. The connect routine will set fullname to point to the * Look up the authorization protocol name and data if necessary. char dpynumbuf[
40];
/* big enough to hold 2^64 and more */ * build XDM-AUTHORIZATION-1 data * We succeeded at authorization, so let us move the data into /* this field is not present in post X11R5 */ /* Salt away the host:display string for later use. Storage owned by agent, Xmalloc'd by connection /* Set up the output buffers. */ /* Create extension data */ /* Parse names to get true display name */ /* Agent is not on the same host as client, so fix up the stupid abbreviations used for the display, and whoever came up with the syntax should be shot. */ /* OutOfMemory is called if malloc fails. XOpenDisplay returns NULL /* XFreeDisplayStructure frees all the storage associated with a * Display. It is used by XOpenDisplay if it runs out of memory, * and also by XCloseDisplay. It needs to check whether all pointers * are non-NULL before dereferencing them, since it may be called * by XOpenDisplay before the Display structure is fully formed. * XOpenDisplay must be sure to initialize all the pointers to NULL * before the first possible call on this.