char *x11_init(Socket * s, char *display, void *c, void *auth, const char *peeraddr, int peerport, const Config *cfg)
const char *x11_init(Socket * s, char *display, void *c, void *auth, const char *peeraddr, int peerport, const Config *cfg)
char *x11_init(Socket * s, char *display, void *c, void *auth,	       const char *peeraddr, int peerport, const Config *cfg){    static const struct plug_function_table fn_table = {	x11_closing,	x11_receive,	x11_sent,	NULL    };    SockAddr addr;    int port;    char *err, *dummy_realhost;    char host[128];    int n, displaynum;    struct X11Private *pr;    /*     * Split up display name into host and display-number parts.     */    n = strcspn(display, ":");    if (display[n])	displaynum = atoi(display + n + 1);    else	displaynum = 0;		       /* sensible default */    if (n > sizeof(host) - 1)	n = sizeof(host) - 1;    if (n > 0) {	strncpy(host, display, n);	host[n] = '\0';    } else {	/*	 * Local display numbers, particularly on Unix, often omit	 * the display part completely.	 */	strcpy(host, "localhost");    }    port = 6000 + displaynum;    /*     * Try to find host.     */    addr = name_lookup(host, port, &dummy_realhost, cfg);    if ((err = sk_addr_error(addr)) != NULL)	return err;    /*     * Open socket.     */    pr = snew(struct X11Private);    pr->fn = &fn_table;    pr->auth_protocol = NULL;    pr->auth = (struct X11Auth *)auth;    pr->verified = 0;    pr->data_read = 0;    pr->throttled = pr->throttle_override = 0;    pr->c = c;    pr->s = *s = new_connection(addr, dummy_realhost, port,				0, 1, 0, (Plug) pr, cfg);    if ((err = sk_socket_error(*s)) != NULL) {	sfree(pr);	return err;    }    /*     * See if we can make sense of the peer address we were given.     */    {	int i[4];	if (peeraddr &&	    4 == sscanf(peeraddr, "%d.%d.%d.%d", i+0, i+1, i+2, i+3)) {	    pr->peer_ip = (i[0] << 24) | (i[1] << 16) | (i[2] << 8) | i[3];	    pr->peer_port = peerport;	} else {	    pr->peer_ip = 0;	    pr->peer_port = -1;	}    }    sk_set_private_ptr(*s, pr);    sk_addr_free(addr);    return NULL;}