aboutsummaryrefslogtreecommitdiff
path: root/X11
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-10-05 17:37:34 +0200
committermarha <marha@users.sourceforge.net>2011-10-05 17:37:34 +0200
commitf7025b4baa1ba35ee796785641f04eac5bedb0a6 (patch)
tree3df62b7b501a478e212397883657a8a8be4db7a3 /X11
parent60adbfdea1ee754341d64454274e7aa83bae8971 (diff)
downloadvcxsrv-f7025b4baa1ba35ee796785641f04eac5bedb0a6.tar.gz
vcxsrv-f7025b4baa1ba35ee796785641f04eac5bedb0a6.tar.bz2
vcxsrv-f7025b4baa1ba35ee796785641f04eac5bedb0a6.zip
mkfontscale pixman xserver xtrans libX11 libXdmcp libxcb libXmu mesa git update 5 oct 2011
Diffstat (limited to 'X11')
-rw-r--r--X11/xtrans/Xtrans.c135
-rw-r--r--X11/xtrans/Xtrans.h20
-rw-r--r--X11/xtrans/Xtransint.h115
-rw-r--r--X11/xtrans/Xtranslcl.c369
-rw-r--r--X11/xtrans/Xtranssock.c336
-rw-r--r--X11/xtrans/Xtranstli.c283
-rw-r--r--X11/xtrans/Xtransutil.c59
-rw-r--r--X11/xtrans/doc/xtrans.xml28
-rw-r--r--X11/xtrans/transport.c3
9 files changed, 664 insertions, 684 deletions
diff --git a/X11/xtrans/Xtrans.c b/X11/xtrans/Xtrans.c
index 58a7875aa..522e543c4 100644
--- a/X11/xtrans/Xtrans.c
+++ b/X11/xtrans/Xtrans.c
@@ -132,7 +132,7 @@ void
TRANS(FreeConnInfo) (XtransConnInfo ciptr)
{
- PRMSG (3,"FreeConnInfo(%p)\n", ciptr, 0, 0);
+ prmsg (3,"FreeConnInfo(%p)\n", ciptr);
if (ciptr->addr)
xfree (ciptr->addr);
@@ -150,13 +150,13 @@ TRANS(FreeConnInfo) (XtransConnInfo ciptr)
#define PROTOBUFSIZE 20
static Xtransport *
-TRANS(SelectTransport) (char *protocol)
+TRANS(SelectTransport) (const char *protocol)
{
char protobuf[PROTOBUFSIZE];
int i;
- PRMSG (3,"SelectTransport(%s)\n", protocol, 0, 0);
+ prmsg (3,"SelectTransport(%s)\n", protocol);
/*
* Force Protocol to be lowercase as a way of doing
@@ -203,11 +203,12 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
*/
char *mybuf, *tmpptr;
- char *_protocol, *_host, *_port;
+ const char *_protocol;
+ char *_host, *_port;
char hostnamebuf[256];
int _host_len;
- PRMSG (3,"ParseAddress(%s)\n", address, 0, 0);
+ prmsg (3,"ParseAddress(%s)\n", address);
/* Copy the string so it can be changed */
@@ -404,12 +405,12 @@ TRANS(Open) (int type, char *address)
XtransConnInfo ciptr = NULL;
Xtransport *thistrans;
- PRMSG (2,"Open(%d,%s)\n", type, address, 0);
+ prmsg (2,"Open(%d,%s)\n", type, address);
#if defined(WIN32) && defined(TCPCONN)
if (TRANS(WSAStartup)())
{
- PRMSG (1,"Open: WSAStartup failed\n", 0, 0, 0);
+ prmsg (1,"Open: WSAStartup failed\n");
return NULL;
}
#endif
@@ -418,7 +419,7 @@ TRANS(Open) (int type, char *address)
if (TRANS(ParseAddress) (address, &protocol, &host, &port) == 0)
{
- PRMSG (1,"Open: Unable to Parse address %s\n", address, 0, 0);
+ prmsg (1,"Open: Unable to Parse address %s\n", address);
return NULL;
}
@@ -426,8 +427,8 @@ TRANS(Open) (int type, char *address)
if ((thistrans = TRANS(SelectTransport) (protocol)) == NULL)
{
- PRMSG (1,"Open: Unable to find transport for %s\n",
- protocol, 0, 0);
+ prmsg (1,"Open: Unable to find transport for %s\n",
+ protocol);
xfree (protocol);
xfree (host);
@@ -460,14 +461,14 @@ TRANS(Open) (int type, char *address)
#endif /* TRANS_SERVER */
break;
default:
- PRMSG (1,"Open: Unknown Open type %d\n", type, 0, 0);
+ prmsg (1,"Open: Unknown Open type %d\n", type);
}
if (ciptr == NULL)
{
if (!(thistrans->flags & TRANS_DISABLED))
{
- PRMSG (1,"Open: transport open failed for %s/%s:%s\n",
+ prmsg (1,"Open: transport open failed for %s/%s:%s\n",
protocol, host, port);
}
xfree (protocol);
@@ -503,7 +504,7 @@ TRANS(Reopen) (int type, int trans_id, int fd, char *port)
char *save_port;
int i;
- PRMSG (2,"Reopen(%d,%d,%s)\n", trans_id, fd, port);
+ prmsg (2,"Reopen(%d,%d,%s)\n", trans_id, fd, port);
/* Determine the transport type */
@@ -516,15 +517,15 @@ TRANS(Reopen) (int type, int trans_id, int fd, char *port)
if (thistrans == NULL)
{
- PRMSG (1,"Reopen: Unable to find transport id %d\n",
- trans_id, 0, 0);
+ prmsg (1,"Reopen: Unable to find transport id %d\n",
+ trans_id);
return NULL;
}
if ((save_port = (char *) xalloc (strlen (port) + 1)) == NULL)
{
- PRMSG (1,"Reopen: Unable to malloc port string\n", 0, 0, 0);
+ prmsg (1,"Reopen: Unable to malloc port string\n");
return NULL;
}
@@ -542,12 +543,12 @@ TRANS(Reopen) (int type, int trans_id, int fd, char *port)
ciptr = thistrans->ReopenCLTSServer(thistrans, fd, port);
break;
default:
- PRMSG (1,"Reopen: Bad Open type %d\n", type, 0, 0);
+ prmsg (1,"Reopen: Bad Open type %d\n", type);
}
if (ciptr == NULL)
{
- PRMSG (1,"Reopen: transport open failed\n", 0, 0, 0);
+ prmsg (1,"Reopen: transport open failed\n");
return NULL;
}
@@ -573,7 +574,7 @@ XtransConnInfo
TRANS(OpenCOTSClient) (char *address)
{
- PRMSG (2,"OpenCOTSClient(%s)\n", address, 0, 0);
+ prmsg (2,"OpenCOTSClient(%s)\n", address);
return TRANS(Open) (XTRANS_OPEN_COTS_CLIENT, address);
}
@@ -586,7 +587,7 @@ XtransConnInfo
TRANS(OpenCOTSServer) (char *address)
{
- PRMSG (2,"OpenCOTSServer(%s)\n", address, 0, 0);
+ prmsg (2,"OpenCOTSServer(%s)\n", address);
return TRANS(Open) (XTRANS_OPEN_COTS_SERVER, address);
}
@@ -599,7 +600,7 @@ XtransConnInfo
TRANS(OpenCLTSClient) (char *address)
{
- PRMSG (2,"OpenCLTSClient(%s)\n", address, 0, 0);
+ prmsg (2,"OpenCLTSClient(%s)\n", address);
return TRANS(Open) (XTRANS_OPEN_CLTS_CLIENT, address);
}
@@ -612,7 +613,7 @@ XtransConnInfo
TRANS(OpenCLTSServer) (char *address)
{
- PRMSG (2,"OpenCLTSServer(%s)\n", address, 0, 0);
+ prmsg (2,"OpenCLTSServer(%s)\n", address);
return TRANS(Open) (XTRANS_OPEN_CLTS_SERVER, address);
}
@@ -625,7 +626,7 @@ XtransConnInfo
TRANS(ReopenCOTSServer) (int trans_id, int fd, char *port)
{
- PRMSG (2,"ReopenCOTSServer(%d, %d, %s)\n", trans_id, fd, port);
+ prmsg (2,"ReopenCOTSServer(%d, %d, %s)\n", trans_id, fd, port);
return TRANS(Reopen) (XTRANS_OPEN_COTS_SERVER, trans_id, fd, port);
}
@@ -633,7 +634,7 @@ XtransConnInfo
TRANS(ReopenCLTSServer) (int trans_id, int fd, char *port)
{
- PRMSG (2,"ReopenCLTSServer(%d, %d, %s)\n", trans_id, fd, port);
+ prmsg (2,"ReopenCLTSServer(%d, %d, %s)\n", trans_id, fd, port);
return TRANS(Reopen) (XTRANS_OPEN_CLTS_SERVER, trans_id, fd, port);
}
@@ -673,7 +674,7 @@ TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg)
int fd = ciptr->fd;
int ret = 0;
- PRMSG (2,"SetOption(%d,%d,%d)\n", fd, option, arg);
+ prmsg (2,"SetOption(%d,%d,%d)\n", fd, option, arg);
/*
* For now, all transport type use the same stuff for setting options.
@@ -759,7 +760,7 @@ TRANS(CreateListener) (XtransConnInfo ciptr, char *port, unsigned int flags)
}
int
-TRANS(NoListen) (char * protocol)
+TRANS(NoListen) (const char * protocol)
{
Xtransport *trans;
@@ -767,8 +768,8 @@ TRANS(NoListen) (char * protocol)
if ((trans = TRANS(SelectTransport)(protocol)) == NULL)
{
- PRMSG (1,"TransNoListen: unable to find transport: %s\n",
- protocol, 0, 0);
+ prmsg (1,"TransNoListen: unable to find transport: %s\n",
+ protocol);
return -1;
}
@@ -801,7 +802,7 @@ TRANS(Accept) (XtransConnInfo ciptr, int *status)
{
XtransConnInfo newciptr;
- PRMSG (2,"Accept(%d)\n", ciptr->fd, 0, 0);
+ prmsg (2,"Accept(%d)\n", ciptr->fd);
newciptr = ciptr->transptr->Accept (ciptr, status);
@@ -825,12 +826,12 @@ TRANS(Connect) (XtransConnInfo ciptr, char *address)
char *port;
int ret;
- PRMSG (2,"Connect(%d,%s)\n", ciptr->fd, address, 0);
+ prmsg (2,"Connect(%d,%s)\n", ciptr->fd, address);
if (TRANS(ParseAddress) (address, &protocol, &host, &port) == 0)
{
- PRMSG (1,"Connect: Unable to Parse address %s\n",
- address, 0, 0);
+ prmsg (1,"Connect: Unable to Parse address %s\n",
+ address);
return -1;
}
@@ -840,8 +841,8 @@ TRANS(Connect) (XtransConnInfo ciptr, char *address)
if (!port || !*port)
{
- PRMSG (1,"Connect: Missing port specification in %s\n",
- address, 0, 0);
+ prmsg (1,"Connect: Missing port specification in %s\n",
+ address);
if (protocol) xfree (protocol);
if (host) xfree (host);
return -1;
@@ -907,7 +908,7 @@ TRANS(Close) (XtransConnInfo ciptr)
{
int ret;
- PRMSG (2,"Close(%d)\n", ciptr->fd, 0, 0);
+ prmsg (2,"Close(%d)\n", ciptr->fd);
ret = ciptr->transptr->Close (ciptr);
@@ -922,7 +923,7 @@ TRANS(CloseForCloning) (XtransConnInfo ciptr)
{
int ret;
- PRMSG (2,"CloseForCloning(%d)\n", ciptr->fd, 0, 0);
+ prmsg (2,"CloseForCloning(%d)\n", ciptr->fd);
ret = ciptr->transptr->CloseForCloning (ciptr);
@@ -944,14 +945,14 @@ TRANS(GetMyAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp,
Xtransaddr **addrp)
{
- PRMSG (2,"GetMyAddr(%d)\n", ciptr->fd, 0, 0);
+ prmsg (2,"GetMyAddr(%d)\n", ciptr->fd);
*familyp = ciptr->family;
*addrlenp = ciptr->addrlen;
if ((*addrp = (Xtransaddr *) xalloc (ciptr->addrlen)) == NULL)
{
- PRMSG (1,"GetMyAddr: malloc failed\n", 0, 0, 0);
+ prmsg (1,"GetMyAddr: malloc failed\n");
return -1;
}
memcpy(*addrp, ciptr->addr, ciptr->addrlen);
@@ -964,14 +965,14 @@ TRANS(GetPeerAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp,
Xtransaddr **addrp)
{
- PRMSG (2,"GetPeerAddr(%d)\n", ciptr->fd, 0, 0);
+ prmsg (2,"GetPeerAddr(%d)\n", ciptr->fd);
*familyp = ciptr->family;
*addrlenp = ciptr->peeraddrlen;
if ((*addrp = (Xtransaddr *) xalloc (ciptr->peeraddrlen)) == NULL)
{
- PRMSG (1,"GetPeerAddr: malloc failed\n", 0, 0, 0);
+ prmsg (1,"GetPeerAddr: malloc failed\n");
return -1;
}
memcpy(*addrp, ciptr->peeraddr, ciptr->peeraddrlen);
@@ -1040,8 +1041,8 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
#if defined(IPv6) && defined(AF_INET6)
int ipv6_succ = 0;
#endif
- PRMSG (2,"MakeAllCOTSServerListeners(%s,%p)\n",
- port ? port : "NULL", ciptrs_ret, 0);
+ prmsg (2,"MakeAllCOTSServerListeners(%s,%p)\n",
+ port ? port : "NULL", ciptrs_ret);
*count_ret = 0;
@@ -1067,17 +1068,17 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
snprintf(buffer, sizeof(buffer), "%s/:%s",
trans->TransName, port ? port : "");
- PRMSG (5,"MakeAllCOTSServerListeners: opening %s\n",
- buffer, 0, 0);
+ prmsg (5,"MakeAllCOTSServerListeners: opening %s\n",
+ buffer);
if ((ciptr = TRANS(OpenCOTSServer(buffer))) == NULL)
{
if (trans->flags & TRANS_DISABLED)
continue;
- PRMSG (1,
+ prmsg (1,
"MakeAllCOTSServerListeners: failed to open listener for %s\n",
- trans->TransName, 0, 0);
+ trans->TransName);
continue;
}
#if defined(IPv6) && defined(AF_INET6)
@@ -1096,9 +1097,8 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
* running at this address, and this function should fail.
*/
- PRMSG (1,
- "MakeAllCOTSServerListeners: server already running\n",
- 0, 0, 0);
+ prmsg (1,
+ "MakeAllCOTSServerListeners: server already running\n");
for (j = 0; j < *count_ret; j++)
TRANS(Close) (temp_ciptrs[j]);
@@ -1110,9 +1110,9 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
}
else
{
- PRMSG (1,
+ prmsg (1,
"MakeAllCOTSServerListeners: failed to create listener for %s\n",
- trans->TransName, 0, 0);
+ trans->TransName);
continue;
}
@@ -1123,9 +1123,9 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
ipv6_succ = 1;
#endif
- PRMSG (5,
+ prmsg (5,
"MakeAllCOTSServerListeners: opened listener for %s, %d\n",
- trans->TransName, ciptr->fd, 0);
+ trans->TransName, ciptr->fd);
temp_ciptrs[*count_ret] = ciptr;
(*count_ret)++;
@@ -1133,7 +1133,7 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
*partial = (*count_ret < complete_network_count());
- PRMSG (5,
+ prmsg (5,
"MakeAllCOTSServerListeners: partial=%d, actual=%d, complete=%d \n",
*partial, *count_ret, complete_network_count());
@@ -1165,8 +1165,8 @@ TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
XtransConnInfo ciptr, temp_ciptrs[NUMTRANS];
int status, i, j;
- PRMSG (2,"MakeAllCLTSServerListeners(%s,%p)\n",
- port ? port : "NULL", ciptrs_ret, 0);
+ prmsg (2,"MakeAllCLTSServerListeners(%s,%p)\n",
+ port ? port : "NULL", ciptrs_ret);
*count_ret = 0;
@@ -1180,14 +1180,14 @@ TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
snprintf(buffer, sizeof(buffer), "%s/:%s",
trans->TransName, port ? port : "");
- PRMSG (5,"MakeAllCLTSServerListeners: opening %s\n",
- buffer, 0, 0);
+ prmsg (5,"MakeAllCLTSServerListeners: opening %s\n",
+ buffer);
if ((ciptr = TRANS(OpenCLTSServer (buffer))) == NULL)
{
- PRMSG (1,
+ prmsg (1,
"MakeAllCLTSServerListeners: failed to open listener for %s\n",
- trans->TransName, 0, 0);
+ trans->TransName);
continue;
}
@@ -1201,9 +1201,8 @@ TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
* running at this address, and this function should fail.
*/
- PRMSG (1,
- "MakeAllCLTSServerListeners: server already running\n",
- 0, 0, 0);
+ prmsg (1,
+ "MakeAllCLTSServerListeners: server already running\n");
for (j = 0; j < *count_ret; j++)
TRANS(Close) (temp_ciptrs[j]);
@@ -1215,24 +1214,24 @@ TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
}
else
{
- PRMSG (1,
+ prmsg (1,
"MakeAllCLTSServerListeners: failed to create listener for %s\n",
- trans->TransName, 0, 0);
+ trans->TransName);
continue;
}
}
- PRMSG (5,
+ prmsg (5,
"MakeAllCLTSServerListeners: opened listener for %s, %d\n",
- trans->TransName, ciptr->fd, 0);
+ trans->TransName, ciptr->fd);
temp_ciptrs[*count_ret] = ciptr;
(*count_ret)++;
}
*partial = (*count_ret < complete_network_count());
- PRMSG (5,
+ prmsg (5,
"MakeAllCLTSServerListeners: partial=%d, actual=%d, complete=%d \n",
*partial, *count_ret, complete_network_count());
diff --git a/X11/xtrans/Xtrans.h b/X11/xtrans/Xtrans.h
index 6f8f909c8..2945b2aba 100644
--- a/X11/xtrans/Xtrans.h
+++ b/X11/xtrans/Xtrans.h
@@ -70,14 +70,14 @@ from The Open Group.
#ifdef X11_t
#define TRANS(func) _X11Trans##func
#ifdef XTRANSDEBUG
-static char* __xtransname = "_X11Trans";
+static const char *__xtransname = "_X11Trans";
#endif
#endif /* X11_t */
#ifdef XSERV_t
#define TRANS(func) _XSERVTrans##func
#ifdef XTRANSDEBUG
-static char* __xtransname = "_XSERVTrans";
+static const char *__xtransname = "_XSERVTrans";
#endif
#define X11_t
#endif /* XSERV_t */
@@ -85,35 +85,35 @@ static char* __xtransname = "_XSERVTrans";
#ifdef XIM_t
#define TRANS(func) _XimXTrans##func
#ifdef XTRANSDEBUG
-static char* __xtransname = "_XimTrans";
+static const char *__xtransname = "_XimTrans";
#endif
#endif /* XIM_t */
#ifdef FS_t
#define TRANS(func) _FSTrans##func
#ifdef XTRANSDEBUG
-static char* __xtransname = "_FSTrans";
+static const char *__xtransname = "_FSTrans";
#endif
#endif /* FS_t */
#ifdef FONT_t
#define TRANS(func) _FontTrans##func
#ifdef XTRANSDEBUG
-static char* __xtransname = "_FontTrans";
+static const char *__xtransname = "_FontTrans";
#endif
#endif /* FONT_t */
#ifdef ICE_t
#define TRANS(func) _IceTrans##func
#ifdef XTRANSDEBUG
-static char* __xtransname = "_IceTrans";
+static const char *__xtransname = "_IceTrans";
#endif
#endif /* ICE_t */
#ifdef TEST_t
#define TRANS(func) _TESTTrans##func
#ifdef XTRANSDEBUG
-static char* __xtransname = "_TESTTrans";
+static const char *__xtransname = "_TESTTrans";
#endif
#endif /* TEST_t */
@@ -121,14 +121,14 @@ static char* __xtransname = "_TESTTrans";
#define TRANS(func) _LBXPROXYTrans##func
#define X11_t /* The server defines this - so should the LBX proxy */
#ifdef XTRANSDEBUG
-static char* __xtransname = "_LBXPROXYTrans";
+static const char *__xtransname = "_LBXPROXYTrans";
#endif
#endif /* LBXPROXY_t */
#if !defined(TRANS)
#define TRANS(func) _XTrans##func
#ifdef XTRANSDEBUG
-static char* __xtransname = "_XTrans";
+static const char *__xtransname = "_XTrans";
#endif
#endif /* !TRANS */
@@ -304,7 +304,7 @@ int TRANS(CreateListener)(
);
int TRANS(NoListen) (
- char* /* protocol*/
+ const char* /* protocol*/
);
int TRANS(ResetListener)(
diff --git a/X11/xtrans/Xtransint.h b/X11/xtrans/Xtransint.h
index 787d72124..3bce8dc6b 100644
--- a/X11/xtrans/Xtransint.h
+++ b/X11/xtrans/Xtransint.h
@@ -68,7 +68,7 @@ from The Open Group.
* message.
*/
-#ifndef XTRANSDEBUG
+#if !defined(XTRANSDEBUG) && defined(XTRANS_TRANSPORT_C)
# define XTRANSDEBUG 1
#endif
@@ -78,6 +78,10 @@ from The Open Group.
#include "Xtrans.h"
+#ifndef _X_UNUSED /* Defined in Xfuncproto.h in xproto >= 7.0.22 */
+# define _X_UNUSED /* */
+#endif
+
#ifdef XTRANSDEBUG
# include <stdio.h>
#endif /* XTRANSDEBUG */
@@ -140,7 +144,7 @@ struct _XtransConnInfo {
typedef struct _Xtransport {
- char *TransName;
+ const char *TransName;
int flags;
#ifdef TRANS_CLIENT
@@ -155,7 +159,7 @@ typedef struct _Xtransport {
#endif /* TRANS_CLIENT */
#ifdef TRANS_SERVER
- char ** nolisten;
+ const char ** nolisten;
XtransConnInfo (*OpenCOTSServer)(
struct _Xtransport *, /* transport */
char *, /* protocol */
@@ -307,6 +311,9 @@ typedef struct _Xtransport_table {
/* Flags to preserve when setting others */
#define TRANS_KEEPFLAGS (TRANS_NOUNLINK|TRANS_ABSTRACT)
+#ifdef XTRANS_TRANSPORT_C /* only provide static function prototypes when
+ building the transport.c file that has them in */
+
#ifdef __clang__
/* Not all clients make use of all provided statics */
#pragma clang diagnostic push
@@ -371,54 +378,62 @@ static int trans_mkdir (
* Some XTRANSDEBUG stuff
*/
-#if defined(XTRANSDEBUG)
-/* add hack to the format string to avoid warnings about extra arguments
- * to fprintf.
+#ifdef XTRANSDEBUG
+#include <stdarg.h>
+
+/*
+ * The X server provides ErrorF() & VErrorF(), for other software that uses
+ * xtrans, we provide our own simple versions.
*/
-#ifdef XTRANSDEBUGTIMESTAMP
-#if defined(XSERV_t) && defined(TRANS_SERVER)
-/* Use ErrorF() for the X server */
-#define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \
- int hack= 0, saveerrno=errno; \
- struct timeval tp;\
- gettimeofday(&tp,0); \
- ErrorF("%s",__xtransname); \
- ErrorF(x+hack,a,b,c); \
- ErrorF("timestamp (ms): %d\n",tp.tv_sec*1000+tp.tv_usec/1000); \
- errno=saveerrno; \
- } else ((void)0)
-#else
-#define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \
- int hack= 0, saveerrno=errno; \
- struct timeval tp;\
- gettimeofday(&tp,0); \
- fprintf(stderr, "%s", __xtransname); fflush(stderr); \
- fprintf(stderr, x+hack,a,b,c); fflush(stderr); \
- fprintf(stderr, "timestamp (ms): %d\n",tp.tv_sec*1000+tp.tv_usec/1000); \
- fflush(stderr); \
- errno=saveerrno; \
- } else ((void)0)
-#endif /* XSERV_t && TRANS_SERVER */
-#else /* XTRANSDEBUGTIMESTAMP */
-#if defined(XSERV_t) && defined(TRANS_SERVER)
-/* Use ErrorF() for the X server */
-#define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \
- int hack= 0, saveerrno=errno; \
- ErrorF("%s",__xtransname); \
- ErrorF(x+hack,a,b,c); \
- errno=saveerrno; \
- } else ((void)0)
-#else
-#define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \
- int hack= 0, saveerrno=errno; \
- fprintf(stderr, "%s", __xtransname); fflush(stderr); \
- fprintf(stderr, x+hack,a,b,c); fflush(stderr); \
- errno=saveerrno; \
- } else ((void)0)
-#endif /* XSERV_t && TRANS_SERVER */
-#endif /* XTRANSDEBUGTIMESTAMP */
-#else
-#define PRMSG(lvl,x,a,b,c) ((void)0)
+# if defined(XSERV_t) && defined(TRANS_SERVER)
+# include "os.h"
+# else
+static inline void _X_ATTRIBUTE_PRINTF(1, 0)
+VErrorF(const char *f, va_list args)
+{
+ vfprintf(stderr, f, args);
+ fflush(stderr);
+}
+
+static inline void _X_ATTRIBUTE_PRINTF(1, 2)
+ErrorF(const char *f, ...)
+{
+ va_list args;
+
+ va_start(args, f);
+ VErrorF(f, args);
+ va_end(args);
+}
+# endif /* xserver */
#endif /* XTRANSDEBUG */
+static inline void _X_ATTRIBUTE_PRINTF(2, 3)
+prmsg(int lvl, const char *f, ...)
+{
+#ifdef XTRANSDEBUG
+ va_list args;
+
+ va_start(args, f);
+ if (lvl <= XTRANSDEBUG) {
+ int saveerrno = errno;
+
+ ErrorF("%s", __xtransname);
+ VErrorF(f, args);
+
+# ifdef XTRANSDEBUGTIMESTAMP
+ {
+ struct timeval tp;
+ gettimeofday(&tp, 0);
+ ErrorF("timestamp (ms): %d\n",
+ tp.tv_sec * 1000 + tp.tv_usec / 1000);
+ }
+# endif
+ errno = saveerrno;
+ }
+ va_end(args);
+#endif /* XTRANSDEBUG */
+}
+
+#endif /* XTRANS_TRANSPORT_C */
+
#endif /* _XTRANSINT_H_ */
diff --git a/X11/xtrans/Xtranslcl.c b/X11/xtrans/Xtranslcl.c
index b95a3411b..8466ddc4c 100644
--- a/X11/xtrans/Xtranslcl.c
+++ b/X11/xtrans/Xtranslcl.c
@@ -123,7 +123,7 @@ static int TRANS(LocalClose)(XtransConnInfo ciptr);
/* Type Not Supported */
static int
-TRANS(OpenFail)(XtransConnInfo ciptr, char *port)
+TRANS(OpenFail)(XtransConnInfo ciptr _X_UNUSED, char *port _X_UNUSED)
{
return -1;
@@ -132,7 +132,7 @@ TRANS(OpenFail)(XtransConnInfo ciptr, char *port)
#ifdef TRANS_REOPEN
static int
-TRANS(ReopenFail)(XtransConnInfo ciptr, int fd, char *port)
+TRANS(ReopenFail)(XtransConnInfo ciptr _X_UNUSED, int fd _X_UNUSED, char *port _X_UNUSED)
{
return 0;
@@ -154,14 +154,14 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path)
if ((sunaddr = (struct sockaddr_un *) xalloc (ciptr->addrlen)) == NULL)
{
- PRMSG(1,"FillAddrInfo: failed to allocate memory for addr\n", 0, 0, 0);
+ prmsg(1,"FillAddrInfo: failed to allocate memory for addr\n");
return 0;
}
sunaddr->sun_family = AF_UNIX;
if (strlen(sun_path) > sizeof(sunaddr->sun_path) - 1) {
- PRMSG(1, "FillAddrInfo: path too long\n", 0, 0, 0);
+ prmsg(1, "FillAddrInfo: path too long\n");
xfree((char *) sunaddr);
return 0;
}
@@ -177,9 +177,8 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path)
if ((p_sunaddr = (struct sockaddr_un *) xalloc (
ciptr->peeraddrlen)) == NULL)
{
- PRMSG(1,
- "FillAddrInfo: failed to allocate memory for peer addr\n",
- 0,0,0);
+ prmsg(1,
+ "FillAddrInfo: failed to allocate memory for peer addr\n");
xfree ((char *) sunaddr);
ciptr->addr = NULL;
@@ -189,7 +188,7 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path)
p_sunaddr->sun_family = AF_UNIX;
if (strlen(peer_sun_path) > sizeof(p_sunaddr->sun_path) - 1) {
- PRMSG(1, "FillAddrInfo: peer path too long\n", 0, 0, 0);
+ prmsg(1, "FillAddrInfo: peer path too long\n");
xfree((char *) p_sunaddr);
return 0;
}
@@ -222,7 +221,7 @@ extern char *ptsname(
int
);
-static void _dummy(int sig)
+static void _dummy(int sig _X_UNUSED)
{
}
@@ -315,20 +314,22 @@ TRANS(PTSOpenClient)(XtransConnInfo ciptr, char *port)
pid_t saved_pid;
#endif
- PRMSG(2,"PTSOpenClient(%s)\n", port, 0,0 );
+ prmsg(2,"PTSOpenClient(%s)\n", port);
#if !defined(PTSNODENAME)
- PRMSG(1,"PTSOpenClient: Protocol is not supported by a pts connection\n", 0,0,0);
+ prmsg(1,"PTSOpenClient: Protocol is not supported by a pts connection\n");
return -1;
#else
if (port && *port ) {
if( *port == '/' ) { /* A full pathname */
- (void) sprintf(server_path, "%s", port);
- } else {
- (void) sprintf(server_path, "%s%s", PTSNODENAME, port);
- }
+ snprintf(server_path, sizeof(server_path), "%s", port);
+ } else {
+ snprintf(server_path, sizeof(server_path), "%s%s",
+ PTSNODENAME, port);
+ }
} else {
- (void) sprintf(server_path, "%s%d", PTSNODENAME, getpid());
+ snprintf(server_path, sizeof(server_path), "%s%d",
+ PTSNODENAME, getpid());
}
@@ -337,7 +338,7 @@ TRANS(PTSOpenClient)(XtransConnInfo ciptr, char *port)
*/
if ((server = open (server_path, O_RDWR)) < 0) {
- PRMSG(1,"PTSOpenClient: failed to open %s\n", server_path, 0,0);
+ prmsg(1,"PTSOpenClient: failed to open %s\n", server_path);
return -1;
}
@@ -347,7 +348,7 @@ TRANS(PTSOpenClient)(XtransConnInfo ciptr, char *port)
*/
if ((fd = open(DEV_PTMX, O_RDWR)) < 0) {
- PRMSG(1,"PTSOpenClient: failed to open %s\n", DEV_PTMX, 0,0);
+ prmsg(1,"PTSOpenClient: failed to open %s\n", DEV_PTMX);
close(server);
return(-1);
}
@@ -358,7 +359,7 @@ TRANS(PTSOpenClient)(XtransConnInfo ciptr, char *port)
slave = ptsname(fd); /* get name */
if( slave == NULL ) {
- PRMSG(1,"PTSOpenClient: failed to get ptsname()\n", 0,0,0);
+ prmsg(1,"PTSOpenClient: failed to get ptsname()\n");
close(fd);
close(server);
return -1;
@@ -391,14 +392,14 @@ TRANS(PTSOpenClient)(XtransConnInfo ciptr, char *port)
if (WIFEXITED(exitval) && WEXITSTATUS(exitval) != 0) {
close(fd);
close(server);
- PRMSG(1, "PTSOpenClient: cannot set the owner of %s\n",
- slave, 0, 0);
+ prmsg(1, "PTSOpenClient: cannot set the owner of %s\n",
+ slave);
return(-1);
}
if (chmod(slave, 0666) < 0) {
close(fd);
close(server);
- PRMSG(1,"PTSOpenClient: Cannot chmod %s\n", slave, 0,0);
+ prmsg(1,"PTSOpenClient: Cannot chmod %s\n", slave);
return(-1);
}
@@ -425,8 +426,8 @@ TRANS(PTSOpenClient)(XtransConnInfo ciptr, char *port)
(void) signal(SIGALRM, savef);
if (ret != 1) {
- PRMSG(1,
- "PTSOpenClient: failed to get acknoledgement from server\n", 0, 0, 0);
+ prmsg(1,
+ "PTSOpenClient: failed to get acknoledgement from server\n");
(void) close(fd);
fd = -1;
}
@@ -437,7 +438,7 @@ TRANS(PTSOpenClient)(XtransConnInfo ciptr, char *port)
if (TRANS(FillAddrInfo) (ciptr, slave, server_path) == 0)
{
- PRMSG(1,"PTSOpenClient: failed to fill in addr info\n", 0, 0, 0);
+ prmsg(1,"PTSOpenClient: failed to fill in addr info\n");
close(fd);
return -1;
}
@@ -462,10 +463,10 @@ TRANS(PTSOpenServer)(XtransConnInfo ciptr, char *port)
int mode;
#endif
- PRMSG(2,"PTSOpenServer(%s)\n", port, 0,0 );
+ prmsg(2,"PTSOpenServer(%s)\n", port);
#if !defined(PTSNODENAME)
- PRMSG(1,"PTSOpenServer: Protocol is not supported by a pts connection\n", 0,0,0);
+ prmsg(1,"PTSOpenServer: Protocol is not supported by a pts connection\n");
return -1;
#else
if (port && *port ) {
@@ -484,8 +485,8 @@ TRANS(PTSOpenServer)(XtransConnInfo ciptr, char *port)
mode = 0777;
#endif
if (trans_mkdir(X_STREAMS_DIR, mode) == -1) {
- PRMSG (1, "PTSOpenServer: mkdir(%s) failed, errno = %d\n",
- X_STREAMS_DIR, errno, 0);
+ prmsg (1, "PTSOpenServer: mkdir(%s) failed, errno = %d\n",
+ X_STREAMS_DIR, errno);
return(-1);
}
@@ -496,8 +497,8 @@ TRANS(PTSOpenServer)(XtransConnInfo ciptr, char *port)
* prevent clients from trying to connect to the in-use PTS (which
* is often in use by something other than another server).
*/
- PRMSG(1, "PTSOpenServer: A server is already running on port %s\n", port, 0,0 );
- PRMSG(1, "PTSOpenServer: Remove %s if this is incorrect.\n", server_path, 0,0 );
+ prmsg(1, "PTSOpenServer: A server is already running on port %s\n", port);
+ prmsg(1, "PTSOpenServer: Remove %s if this is incorrect.\n", server_path);
close(fd);
return(-1);
}
@@ -508,7 +509,7 @@ TRANS(PTSOpenServer)(XtransConnInfo ciptr, char *port)
unlink(server_path);
if( (fd=open(DEV_PTMX, O_RDWR)) < 0) {
- PRMSG(1, "PTSOpenServer: Unable to open %s\n", DEV_PTMX, 0,0 );
+ prmsg(1, "PTSOpenServer: Unable to open %s\n", DEV_PTMX);
return(-1);
}
@@ -516,25 +517,25 @@ TRANS(PTSOpenServer)(XtransConnInfo ciptr, char *port)
unlockpt(fd);
if( (slave=ptsname(fd)) == NULL) {
- PRMSG(1, "PTSOpenServer: Unable to get slave device name\n", 0,0,0 );
+ prmsg(1, "PTSOpenServer: Unable to get slave device name\n");
close(fd);
return(-1);
}
if( link(slave,server_path) < 0 ) {
- PRMSG(1, "PTSOpenServer: Unable to link %s to %s\n", slave, server_path,0 );
+ prmsg(1, "PTSOpenServer: Unable to link %s to %s\n", slave, server_path);
close(fd);
return(-1);
}
if( chmod(server_path, 0666) < 0 ) {
- PRMSG(1, "PTSOpenServer: Unable to chmod %s to 0666\n", server_path,0,0 );
+ prmsg(1, "PTSOpenServer: Unable to chmod %s to 0666\n", server_path);
close(fd);
return(-1);
}
if( (server=open(server_path, O_RDWR)) < 0 ) {
- PRMSG(1, "PTSOpenServer: Unable to open server device %s\n", server_path,0,0 );
+ prmsg(1, "PTSOpenServer: Unable to open server device %s\n", server_path);
close(fd);
return(-1);
}
@@ -547,7 +548,7 @@ TRANS(PTSOpenServer)(XtransConnInfo ciptr, char *port)
if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
{
- PRMSG(1,"PTSOpenServer: failed to fill in addr info\n", 0, 0, 0);
+ prmsg(1,"PTSOpenServer: failed to fill in addr info\n");
close(fd);
return -1;
}
@@ -567,17 +568,17 @@ TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
char buf[256];
struct sockaddr_un *sunaddr;
- PRMSG(2,"PTSAccept(%x->%d)\n",ciptr,ciptr->fd,0);
+ prmsg(2,"PTSAccept(%x->%d)\n",ciptr,ciptr->fd);
if( (in=read(ciptr->fd,&length,1)) <= 0 ){
if( !in ) {
- PRMSG(2,
- "PTSAccept: Incoming connection closed\n",0,0,0);
+ prmsg(2,
+ "PTSAccept: Incoming connection closed\n");
}
else {
- PRMSG(1,
+ prmsg(1,
"PTSAccept: Error reading incoming connection. errno=%d \n",
- errno,0,0);
+ errno);
}
*status = TRANS_ACCEPT_MISC_ERROR;
return -1;
@@ -585,13 +586,13 @@ TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
if( (in=read(ciptr->fd,buf,length)) <= 0 ){
if( !in ) {
- PRMSG(2,
- "PTSAccept: Incoming connection closed\n",0,0,0);
+ prmsg(2,
+ "PTSAccept: Incoming connection closed\n");
}
else {
- PRMSG(1,
+ prmsg(1,
"PTSAccept: Error reading device name for new connection. errno=%d \n",
- errno,0,0);
+ errno);
}
*status = TRANS_ACCEPT_MISC_ERROR;
return -1;
@@ -600,7 +601,7 @@ TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
buf[length] = '\0';
if( (newfd=open(buf,O_RDWR)) < 0 ) {
- PRMSG(1, "PTSAccept: Failed to open %s\n",buf,0,0);
+ prmsg(1, "PTSAccept: Failed to open %s\n",buf);
*status = TRANS_ACCEPT_MISC_ERROR;
return -1;
}
@@ -613,8 +614,7 @@ TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
newciptr->addrlen=ciptr->addrlen;
if( (newciptr->addr=(char *)xalloc(newciptr->addrlen)) == NULL ) {
- PRMSG(1,"PTSAccept: failed to allocate memory for peer addr\n",
- 0,0,0);
+ prmsg(1,"PTSAccept: failed to allocate memory for peer addr\n");
close(newfd);
*status = TRANS_ACCEPT_BAD_MALLOC;
return -1;
@@ -624,8 +624,7 @@ TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
newciptr->peeraddrlen=sizeof(struct sockaddr_un);
if( (sunaddr=(struct sockaddr_un *)xalloc(newciptr->peeraddrlen)) == NULL ) {
- PRMSG(1,"PTSAccept: failed to allocate memory for peer addr\n",
- 0,0,0);
+ prmsg(1,"PTSAccept: failed to allocate memory for peer addr\n");
xfree(newciptr->addr);
close(newfd);
*status = TRANS_ACCEPT_BAD_MALLOC;
@@ -668,10 +667,10 @@ TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, char *port)
# endif
#endif
- PRMSG(2,"NAMEDOpenClient(%s)\n", port, 0,0 );
+ prmsg(2,"NAMEDOpenClient(%s)\n", port);
#if !defined(NAMEDNODENAME)
- PRMSG(1,"NAMEDOpenClient: Protocol is not supported by a NAMED connection\n", 0,0,0);
+ prmsg(1,"NAMEDOpenClient: Protocol is not supported by a NAMED connection\n");
return -1;
#else
if ( port && *port ) {
@@ -685,18 +684,18 @@ TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, char *port)
}
if ((fd = open(server_path, O_RDWR)) < 0) {
- PRMSG(1,"NAMEDOpenClient: Cannot open %s for NAMED connection\n", server_path, 0,0 );
+ prmsg(1,"NAMEDOpenClient: Cannot open %s for NAMED connection\n", server_path);
return -1;
}
if (fstat(fd, &filestat) < 0 ) {
- PRMSG(1,"NAMEDOpenClient: Cannot stat %s for NAMED connection\n", server_path, 0,0 );
+ prmsg(1,"NAMEDOpenClient: Cannot stat %s for NAMED connection\n", server_path);
(void) close(fd);
return -1;
}
if ((filestat.st_mode & S_IFMT) != S_IFIFO) {
- PRMSG(1,"NAMEDOpenClient: Device %s is not a FIFO\n", server_path, 0,0 );
+ prmsg(1,"NAMEDOpenClient: Device %s is not a FIFO\n", server_path);
/* Is this really a failure? */
(void) close(fd);
return -1;
@@ -704,7 +703,7 @@ TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, char *port)
if (isastream(fd) <= 0) {
- PRMSG(1,"NAMEDOpenClient: %s is not a streams device\n", server_path, 0,0 );
+ prmsg(1,"NAMEDOpenClient: %s is not a streams device\n", server_path);
(void) close(fd);
return -1;
}
@@ -715,8 +714,7 @@ TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, char *port)
if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
{
- PRMSG(1,"NAMEDOpenClient: failed to fill in addr info\n",
- 0,0,0);
+ prmsg(1,"NAMEDOpenClient: failed to fill in addr info\n");
close(fd);
return -1;
}
@@ -736,54 +734,54 @@ TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, char *port)
static int
TRANS(NAMEDOpenPipe)(const char *server_path)
{
- PRMSG(2,"NAMEDOpenPipe(%s)\n", server_path, 0,0 );
-
int fd, pipefd[2];
struct stat sbuf;
int mode;
+ prmsg(2,"NAMEDOpenPipe(%s)\n", server_path);
+
#ifdef HAS_STICKY_DIR_BIT
mode = 01777;
#else
mode = 0777;
#endif
if (trans_mkdir(X_STREAMS_DIR, mode) == -1) {
- PRMSG (1, "NAMEDOpenPipe: mkdir(%s) failed, errno = %d\n",
- X_STREAMS_DIR, errno, 0);
+ prmsg (1, "NAMEDOpenPipe: mkdir(%s) failed, errno = %d\n",
+ X_STREAMS_DIR, errno);
return(-1);
}
if(stat(server_path, &sbuf) != 0) {
if (errno == ENOENT) {
if ((fd = creat(server_path, (mode_t)0666)) == -1) {
- PRMSG(1, "NAMEDOpenPipe: Can't open %s\n", server_path, 0,0 );
+ prmsg(1, "NAMEDOpenPipe: Can't open %s\n", server_path);
return(-1);
}
close(fd);
if (chmod(server_path, (mode_t)0666) < 0) {
- PRMSG(1, "NAMEDOpenPipe: Can't open %s\n", server_path, 0,0 );
+ prmsg(1, "NAMEDOpenPipe: Can't open %s\n", server_path);
return(-1);
}
} else {
- PRMSG(1, "NAMEDOpenPipe: stat on %s failed\n", server_path, 0,0 );
+ prmsg(1, "NAMEDOpenPipe: stat on %s failed\n", server_path);
return(-1);
}
}
if( pipe(pipefd) != 0) {
- PRMSG(1, "NAMEDOpenPipe: pipe() failed, errno=%d\n",errno, 0,0 );
+ prmsg(1, "NAMEDOpenPipe: pipe() failed, errno=%d\n",errno);
return(-1);
}
if( ioctl(pipefd[0], I_PUSH, "connld") != 0) {
- PRMSG(1, "NAMEDOpenPipe: ioctl(I_PUSH,\"connld\") failed, errno=%d\n",errno, 0,0 );
+ prmsg(1, "NAMEDOpenPipe: ioctl(I_PUSH,\"connld\") failed, errno=%d\n",errno);
close(pipefd[0]);
close(pipefd[1]);
return(-1);
}
if( fattach(pipefd[0], server_path) != 0) {
- PRMSG(1, "NAMEDOpenPipe: fattach(%s) failed, errno=%d\n", server_path,errno, 0 );
+ prmsg(1, "NAMEDOpenPipe: fattach(%s) failed, errno=%d\n", server_path,errno);
close(pipefd[0]);
close(pipefd[1]);
return(-1);
@@ -801,10 +799,10 @@ TRANS(NAMEDOpenServer)(XtransConnInfo ciptr, char *port)
char server_path[64];
#endif
- PRMSG(2,"NAMEDOpenServer(%s)\n", port, 0,0 );
+ prmsg(2,"NAMEDOpenServer(%s)\n", port);
#if !defined(NAMEDNODENAME)
- PRMSG(1,"NAMEDOpenServer: Protocol is not supported by a NAMED connection\n", 0,0,0);
+ prmsg(1,"NAMEDOpenServer: Protocol is not supported by a NAMED connection\n");
return -1;
#else
if ( port && *port ) {
@@ -830,7 +828,7 @@ TRANS(NAMEDOpenServer)(XtransConnInfo ciptr, char *port)
if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
{
- PRMSG(1,"NAMEDOpenServer: failed to fill in addr info\n", 0,0,0);
+ prmsg(1,"NAMEDOpenServer: failed to fill in addr info\n");
TRANS(LocalClose)(ciptr);
return -1;
}
@@ -844,11 +842,10 @@ static int
TRANS(NAMEDResetListener) (XtransConnInfo ciptr)
{
- int status = TRANS_RESET_NOOP;
struct sockaddr_un *sockname=(struct sockaddr_un *) ciptr->addr;
struct stat statb;
- PRMSG(2,"NAMEDResetListener(%p, %d)\n", ciptr, ciptr->fd, 0 );
+ prmsg(2,"NAMEDResetListener(%p, %d)\n", ciptr, ciptr->fd);
if (ciptr->fd != -1) {
/*
@@ -857,7 +854,7 @@ TRANS(NAMEDResetListener) (XtransConnInfo ciptr)
if (stat (sockname->sun_path, &statb) == -1 ||
(statb.st_mode & S_IFMT) != S_IFIFO) {
- PRMSG(3, "Pipe %s trashed, recreating\n", sockname->sun_path, 0, 0);
+ prmsg(3, "Pipe %s trashed, recreating\n", sockname->sun_path);
TRANS(LocalClose)(ciptr);
ciptr->fd = TRANS(NAMEDOpenPipe)(sockname->sun_path);
if (ciptr->fd >= 0)
@@ -875,10 +872,10 @@ TRANS(NAMEDAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
{
struct strrecvfd str;
- PRMSG(2,"NAMEDAccept(%x->%d)\n", ciptr, ciptr->fd, 0 );
+ prmsg(2,"NAMEDAccept(%p->%d)\n", ciptr, ciptr->fd);
if( ioctl(ciptr->fd, I_RECVFD, &str ) < 0 ) {
- PRMSG(1, "NAMEDAccept: ioctl(I_RECVFD) failed, errno=%d\n", errno, 0,0 );
+ prmsg(1, "NAMEDAccept: ioctl(I_RECVFD) failed, errno=%d\n", errno);
*status = TRANS_ACCEPT_MISC_ERROR;
return(-1);
}
@@ -889,9 +886,8 @@ TRANS(NAMEDAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
newciptr->family=ciptr->family;
newciptr->addrlen=ciptr->addrlen;
if( (newciptr->addr=(char *)xalloc(newciptr->addrlen)) == NULL ) {
- PRMSG(1,
- "NAMEDAccept: failed to allocate memory for pipe addr\n",
- 0,0,0);
+ prmsg(1,
+ "NAMEDAccept: failed to allocate memory for pipe addr\n");
close(str.fd);
*status = TRANS_ACCEPT_BAD_MALLOC;
return -1;
@@ -901,9 +897,8 @@ TRANS(NAMEDAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
newciptr->peeraddrlen=newciptr->addrlen;
if( (newciptr->peeraddr=(char *)xalloc(newciptr->peeraddrlen)) == NULL ) {
- PRMSG(1,
- "NAMEDAccept: failed to allocate memory for peer addr\n",
- 0,0,0);
+ prmsg(1,
+ "NAMEDAccept: failed to allocate memory for peer addr\n");
xfree(newciptr->addr);
close(str.fd);
*status = TRANS_ACCEPT_BAD_MALLOC;
@@ -1015,23 +1010,23 @@ TRANS(SCOOpenClient)(XtransConnInfo ciptr, char *port)
extern int getmsg(), putmsg();
#endif
- PRMSG(2,"SCOOpenClient(%s)\n", port, 0,0 );
+ prmsg(2,"SCOOpenClient(%s)\n", port);
if (!port || !port[0])
port = "0";
#if !defined(SCORNODENAME)
- PRMSG(2,"SCOOpenClient: Protocol is not supported by a SCO connection\n", 0,0,0);
+ prmsg(2,"SCOOpenClient: Protocol is not supported by a SCO connection\n");
return -1;
#else
(void) sprintf(server_path, SCORNODENAME, port);
if ((server = open(server_path, O_RDWR)) < 0) {
- PRMSG(1,"SCOOpenClient: failed to open %s\n", server_path, 0,0 );
+ prmsg(1,"SCOOpenClient: failed to open %s\n", server_path);
return -1;
}
if ((fd = open(DEV_SPX, O_RDWR)) < 0) {
- PRMSG(1,"SCOOpenClient: failed to open %s\n", DEV_SPX, 0,0 );
+ prmsg(1,"SCOOpenClient: failed to open %s\n", DEV_SPX);
close(server);
return -1;
}
@@ -1051,7 +1046,7 @@ TRANS(SCOOpenClient)(XtransConnInfo ciptr, char *port)
(void) signal(SIGALRM, savef);
if (ret < 0) {
- PRMSG(1,"SCOOpenClient: error from getmsg\n", 0,0,0 );
+ prmsg(1,"SCOOpenClient: error from getmsg\n");
close(fd);
close(server);
return -1;
@@ -1075,7 +1070,7 @@ TRANS(SCOOpenClient)(XtransConnInfo ciptr, char *port)
#endif
if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
{
- PRMSG(1,"SCOOpenClient: failed to fill addr info\n", 0, 0, 0);
+ prmsg(1,"SCOOpenClient: failed to fill addr info\n");
close(fd);
return -1;
}
@@ -1101,12 +1096,12 @@ TRANS(SCOOpenServer)(XtransConnInfo ciptr, char *port)
int fds = -1;
#endif
- PRMSG(2,"SCOOpenServer(%s)\n", port, 0,0 );
+ prmsg(2,"SCOOpenServer(%s)\n", port);
if (!port || !port[0])
port = "0";
#if !defined(SCORNODENAME)
- PRMSG(1,"SCOOpenServer: Protocol is not supported by a SCO connection\n", 0,0,0);
+ prmsg(1,"SCOOpenServer: Protocol is not supported by a SCO connection\n");
return -1;
#else
(void) sprintf(serverR_path, SCORNODENAME, port);
@@ -1118,7 +1113,7 @@ TRANS(SCOOpenServer)(XtransConnInfo ciptr, char *port)
if ((fds = open(DEV_SPX, O_RDWR)) < 0 ||
(fdr = open(DEV_SPX, O_RDWR)) < 0 ) {
- PRMSG(1,"SCOOpenServer: failed to open %s\n", DEV_SPX, 0,0 );
+ prmsg(1,"SCOOpenServer: failed to open %s\n", DEV_SPX);
if (fds >= 0)
close(fds);
if (fdr >= 0)
@@ -1127,14 +1122,14 @@ TRANS(SCOOpenServer)(XtransConnInfo ciptr, char *port)
}
if (named_spipe (fds, serverS_path) == -1) {
- PRMSG(1,"SCOOpenServer: failed to create %s\n", serverS_path, 0, 0);
+ prmsg(1,"SCOOpenServer: failed to create %s\n", serverS_path);
close (fdr);
close (fds);
return -1;
}
if (named_spipe (fdr, serverR_path) == -1) {
- PRMSG(1,"SCOOpenServer: failed to create %s\n", serverR_path, 0, 0);
+ prmsg(1,"SCOOpenServer: failed to create %s\n", serverR_path);
close (fdr);
close (fds);
return -1;
@@ -1143,7 +1138,7 @@ TRANS(SCOOpenServer)(XtransConnInfo ciptr, char *port)
fds = open (serverS_path, O_RDWR | O_NDELAY);
if (fds < 0) {
- PRMSG(1,"SCOOpenServer: failed to open %s\n", serverS_path, 0, 0);
+ prmsg(1,"SCOOpenServer: failed to open %s\n", serverS_path);
return -1;
}
@@ -1156,22 +1151,22 @@ TRANS(SCOOpenServer)(XtransConnInfo ciptr, char *port)
mylock.l_start = 0;
mylock.l_len = 0;
if (fcntl (fds, F_SETLK, &mylock) < 0) {
- PRMSG(1,"SCOOpenServer: failed to lock %s\n", serverS_path, 0, 0);
+ prmsg(1,"SCOOpenServer: failed to lock %s\n", serverS_path);
close (fds);
return -1;
}
fdr = open (serverR_path, O_RDWR | O_NDELAY);
if (fdr < 0) {
- PRMSG(1,"SCOOpenServer: failed to open %s\n", serverR_path, 0, 0);
+ prmsg(1,"SCOOpenServer: failed to open %s\n", serverR_path);
close (fds);
return -1;
}
#endif /* X11_t */
if (connect_spipe(fds, fdr)) {
- PRMSG(1,"SCOOpenServer: ioctl(I_FDINSERT) failed on %s\n",
- serverS_path, 0, 0);
+ prmsg(1,"SCOOpenServer: ioctl(I_FDINSERT) failed on %s\n",
+ serverS_path);
close (fdr);
close (fds);
return -1;
@@ -1185,7 +1180,7 @@ TRANS(SCOOpenServer)(XtransConnInfo ciptr, char *port)
ciptr->flags |= TRANS_NOUNLINK;
#endif
if (TRANS(FillAddrInfo) (ciptr, serverS_path, serverR_path) == 0) {
- PRMSG(1,"SCOOpenServer: failed to fill in addr info\n", 0,0,0);
+ prmsg(1,"SCOOpenServer: failed to fill in addr info\n");
close(fds);
close(fdr);
return -1;
@@ -1202,22 +1197,22 @@ TRANS(SCOAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
char c;
int fd;
- PRMSG(2,"SCOAccept(%d)\n", ciptr->fd, 0,0 );
+ prmsg(2,"SCOAccept(%d)\n", ciptr->fd);
if (read(ciptr->fd, &c, 1) < 0) {
- PRMSG(1,"SCOAccept: can't read from client\n",0,0,0);
+ prmsg(1,"SCOAccept: can't read from client\n");
*status = TRANS_ACCEPT_MISC_ERROR;
return(-1);
}
if( (fd = open(DEV_SPX, O_RDWR)) < 0 ) {
- PRMSG(1,"SCOAccept: can't open \"%s\"\n",DEV_SPX, 0,0 );
+ prmsg(1,"SCOAccept: can't open \"%s\"\n",DEV_SPX);
*status = TRANS_ACCEPT_MISC_ERROR;
return(-1);
}
if (connect_spipe (ciptr->fd, fd) < 0) {
- PRMSG(1,"SCOAccept: ioctl(I_FDINSERT) failed\n", 0, 0, 0);
+ prmsg(1,"SCOAccept: ioctl(I_FDINSERT) failed\n");
close (fd);
*status = TRANS_ACCEPT_MISC_ERROR;
return -1;
@@ -1229,9 +1224,8 @@ TRANS(SCOAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
newciptr->addrlen=ciptr->addrlen;
if( (newciptr->addr=(char *)xalloc(newciptr->addrlen)) == NULL ) {
- PRMSG(1,
- "SCOAccept: failed to allocate memory for peer addr\n",
- 0,0,0);
+ prmsg(1,
+ "SCOAccept: failed to allocate memory for peer addr\n");
close(fd);
*status = TRANS_ACCEPT_BAD_MALLOC;
return -1;
@@ -1244,9 +1238,8 @@ TRANS(SCOAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
newciptr->peeraddrlen=newciptr->addrlen;
if( (newciptr->peeraddr=(char *)xalloc(newciptr->peeraddrlen)) == NULL ) {
- PRMSG(1,
- "SCOAccept: failed to allocate memory for peer addr\n",
- 0,0,0);
+ prmsg(1,
+ "SCOAccept: failed to allocate memory for peer addr\n");
xfree(newciptr->addr);
close(fd);
*status = TRANS_ACCEPT_BAD_MALLOC;
@@ -1276,26 +1269,27 @@ TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, char *port)
char server_path[64];
#endif
- PRMSG(2,"PTSReopenServer(%d,%s)\n", fd, port, 0 );
+ prmsg(2,"PTSReopenServer(%d,%s)\n", fd, port);
#if !defined(PTSNODENAME)
- PRMSG(1,"PTSReopenServer: Protocol is not supported by a pts connection\n", 0,0,0);
+ prmsg(1,"PTSReopenServer: Protocol is not supported by a pts connection\n");
return 0;
#else
if (port && *port ) {
if( *port == '/' ) { /* A full pathname */
- (void) sprintf(server_path, "%s", port);
- } else {
- (void) sprintf(server_path, "%s%s", PTSNODENAME, port);
- }
+ snprintf(server_path, sizeof(server_path), "%s", port);
+ } else {
+ snprintf(server_path, sizeof(server_path), "%s%s",
+ PTSNODENAME, port);
+ }
} else {
- (void) sprintf(server_path, "%s%ld", PTSNODENAME, (long)getpid());
+ snprintf(server_path, sizeof(server_path), "%s%ld",
+ PTSNODENAME, (long)getpid());
}
if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
{
- PRMSG(1,"PTSReopenServer: failed to fill in addr info\n",
- 0,0,0);
+ prmsg(1,"PTSReopenServer: failed to fill in addr info\n");
return 0;
}
@@ -1309,33 +1303,34 @@ TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, char *port)
#ifdef LOCAL_TRANS_NAMED
static int
-TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd, char *port)
+TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd _X_UNUSED, char *port)
{
#ifdef NAMEDNODENAME
char server_path[64];
#endif
- PRMSG(2,"NAMEDReopenServer(%s)\n", port, 0,0 );
+ prmsg(2,"NAMEDReopenServer(%s)\n", port);
#if !defined(NAMEDNODENAME)
- PRMSG(1,"NAMEDReopenServer: Protocol is not supported by a NAMED connection\n", 0,0,0);
+ prmsg(1,"NAMEDReopenServer: Protocol is not supported by a NAMED connection\n");
return 0;
#else
if ( port && *port ) {
if( *port == '/' ) { /* A full pathname */
- (void) sprintf(server_path, "%s", port);
+ snprintf(server_path, sizeof(server_path),"%s", port);
} else {
- (void) sprintf(server_path, "%s%s", NAMEDNODENAME, port);
+ snprintf(server_path, sizeof(server_path), "%s%s",
+ NAMEDNODENAME, port);
}
} else {
- (void) sprintf(server_path, "%s%ld", NAMEDNODENAME, (long)getpid());
+ snprintf(server_path, sizeof(server_path), "%s%ld",
+ NAMEDNODENAME, (long)getpid());
}
if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
{
- PRMSG(1,"NAMEDReopenServer: failed to fill in addr info\n",
- 0,0,0);
+ prmsg(1,"NAMEDReopenServer: failed to fill in addr info\n");
return 0;
}
@@ -1356,12 +1351,12 @@ TRANS(SCOReopenServer)(XtransConnInfo ciptr, int fd, char *port)
char serverR_path[64], serverS_path[64];
#endif
- PRMSG(2,"SCOReopenServer(%s)\n", port, 0,0 );
+ prmsg(2,"SCOReopenServer(%s)\n", port);
if (!port || !port[0])
port = "0";
#if !defined(SCORNODENAME)
- PRMSG(2,"SCOReopenServer: Protocol is not supported by a SCO connection\n", 0,0,0);
+ prmsg(2,"SCOReopenServer: Protocol is not supported by a SCO connection\n");
return 0;
#else
(void) sprintf(serverR_path, SCORNODENAME, port);
@@ -1372,7 +1367,7 @@ TRANS(SCOReopenServer)(XtransConnInfo ciptr, int fd, char *port)
#endif
if (TRANS(FillAddrInfo) (ciptr, serverS_path, serverR_path) == 0)
{
- PRMSG(1, "SCOReopenServer: failed to fill in addr info\n", 0,0,0);
+ prmsg(1, "SCOReopenServer: failed to fill in addr info\n");
return 0;
}
@@ -1393,7 +1388,7 @@ TRANS(SCOReopenServer)(XtransConnInfo ciptr, int fd, char *port)
*/
typedef struct _LOCALtrans2dev {
- char *transname;
+ const char *transname;
#ifdef TRANS_CLIENT
@@ -1654,7 +1649,7 @@ static LOCALtrans2dev LOCALtrans2devtab[] = {
#define NUMTRANSPORTS (sizeof(LOCALtrans2devtab)/sizeof(LOCALtrans2dev))
-static char *XLOCAL=NULL;
+static const char *XLOCAL=NULL;
static char *workingXLOCAL=NULL;
static char *freeXLOCAL=NULL;
@@ -1669,10 +1664,10 @@ static char *freeXLOCAL=NULL;
#endif
static void
-TRANS(LocalInitTransports)(char *protocol)
+TRANS(LocalInitTransports)(const char *protocol)
{
- PRMSG(3,"LocalInitTransports(%s)\n", protocol, 0,0 );
+ prmsg(3,"LocalInitTransports(%s)\n", protocol);
if( strcmp(protocol,"local") && strcmp(protocol,"LOCAL") )
{
@@ -1694,7 +1689,7 @@ static void
TRANS(LocalEndTransports)(void)
{
- PRMSG(3,"LocalEndTransports()\n", 0,0,0 );
+ prmsg(3,"LocalEndTransports()\n");
xfree(freeXLOCAL);
}
@@ -1709,7 +1704,7 @@ TRANS(LocalGetNextTransport)(void)
int i,j;
char *typetocheck;
char typebuf[TYPEBUFSIZE];
- PRMSG(3,"LocalGetNextTransport()\n", 0,0,0 );
+ prmsg(3,"LocalGetNextTransport()\n");
while(1)
{
@@ -1789,7 +1784,7 @@ TRANS(LocalOpenClient)(int type, char *protocol, char *host, char *port)
XtransConnInfo ciptr;
int index;
- PRMSG(3,"LocalOpenClient()\n", 0,0,0 );
+ prmsg(3,"LocalOpenClient()\n");
/*
* Make sure 'host' is really local. If not, we return failure.
@@ -1801,9 +1796,9 @@ TRANS(LocalOpenClient)(int type, char *protocol, char *host, char *port)
if (strcmp (host, "unix") != 0 && !HostReallyLocal (host))
{
- PRMSG (1,
+ prmsg (1,
"LocalOpenClient: Cannot connect to non-local host %s\n",
- host, 0, 0);
+ host);
return NULL;
}
@@ -1822,8 +1817,8 @@ TRANS(LocalOpenClient)(int type, char *protocol, char *host, char *port)
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
- PRMSG(1,"LocalOpenClient: calloc(1,%d) failed\n",
- sizeof(struct _XtransConnInfo),0,0 );
+ prmsg(1,"LocalOpenClient: calloc(1,%lu) failed\n",
+ sizeof(struct _XtransConnInfo));
return NULL;
}
@@ -1845,14 +1840,13 @@ TRANS(LocalOpenClient)(int type, char *protocol, char *host, char *port)
break;
case XTRANS_OPEN_COTS_SERVER:
case XTRANS_OPEN_CLTS_SERVER:
- PRMSG(1,
- "LocalOpenClient: Should not be opening a server with this function\n",
- 0,0,0);
+ prmsg(1,
+ "LocalOpenClient: Should not be opening a server with this function\n");
break;
default:
- PRMSG(1,
+ prmsg(1,
"LocalOpenClient: Unknown Open type %d\n",
- type, 0,0 );
+ type);
}
if( ciptr->fd >= 0 )
break;
@@ -1878,13 +1872,13 @@ TRANS(LocalOpenClient)(int type, char *protocol, char *host, char *port)
#ifdef TRANS_SERVER
static XtransConnInfo
-TRANS(LocalOpenServer)(int type, char *protocol, char *host, char *port)
+TRANS(LocalOpenServer)(int type, char *protocol, char *host _X_UNUSED, char *port)
{
int i;
XtransConnInfo ciptr;
- PRMSG(2,"LocalOpenServer(%d,%s,%s)\n", type, protocol, port);
+ prmsg(2,"LocalOpenServer(%d,%s,%s)\n", type, protocol, port);
#if defined(X11_t)
/*
@@ -1897,8 +1891,8 @@ TRANS(LocalOpenServer)(int type, char *protocol, char *host, char *port)
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
- PRMSG(1,"LocalOpenServer: calloc(1,%d) failed\n",
- sizeof(struct _XtransConnInfo),0,0 );
+ prmsg(1,"LocalOpenServer: calloc(1,%lu) failed\n",
+ sizeof(struct _XtransConnInfo));
return NULL;
}
@@ -1910,9 +1904,8 @@ TRANS(LocalOpenServer)(int type, char *protocol, char *host, char *port)
{
case XTRANS_OPEN_COTS_CLIENT:
case XTRANS_OPEN_CLTS_CLIENT:
- PRMSG(1,
- "LocalOpenServer: Should not be opening a client with this function\n",
- 0,0,0);
+ prmsg(1,
+ "LocalOpenServer: Should not be opening a client with this function\n");
break;
case XTRANS_OPEN_COTS_SERVER:
ciptr->fd=LOCALtrans2devtab[i].devcotsopenserver(ciptr,port);
@@ -1921,8 +1914,8 @@ TRANS(LocalOpenServer)(int type, char *protocol, char *host, char *port)
ciptr->fd=LOCALtrans2devtab[i].devcltsopenserver(ciptr,port);
break;
default:
- PRMSG(1,"LocalOpenServer: Unknown Open type %d\n",
- type ,0,0);
+ prmsg(1,"LocalOpenServer: Unknown Open type %d\n",
+ type );
}
if( ciptr->fd >= 0 ) {
ciptr->priv=(char *)&LOCALtrans2devtab[i];
@@ -1948,12 +1941,12 @@ TRANS(LocalReopenServer)(int type, int index, int fd, char *port)
XtransConnInfo ciptr;
int stat = 0;
- PRMSG(2,"LocalReopenServer(%d,%d,%d)\n", type, index, fd);
+ prmsg(2,"LocalReopenServer(%d,%d,%d)\n", type, index, fd);
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
- PRMSG(1,"LocalReopenServer: calloc(1,%d) failed\n",
- sizeof(struct _XtransConnInfo),0,0 );
+ prmsg(1,"LocalReopenServer: calloc(1,%lu) failed\n",
+ sizeof(struct _XtransConnInfo));
return NULL;
}
@@ -1968,8 +1961,8 @@ TRANS(LocalReopenServer)(int type, int index, int fd, char *port)
stat = LOCALtrans2devtab[index].devcltsreopenserver(ciptr,fd,port);
break;
default:
- PRMSG(1,"LocalReopenServer: Unknown Open type %d\n",
- type ,0,0);
+ prmsg(1,"LocalReopenServer: Unknown Open type %d\n",
+ type );
}
if( stat > 0 ) {
@@ -1994,11 +1987,11 @@ TRANS(LocalReopenServer)(int type, int index, int fd, char *port)
#ifdef TRANS_CLIENT
static XtransConnInfo
-TRANS(LocalOpenCOTSClient)(Xtransport *thistrans, char *protocol,
+TRANS(LocalOpenCOTSClient)(Xtransport *thistrans _X_UNUSED, char *protocol,
char *host, char *port)
{
- PRMSG(2,"LocalOpenCOTSClient(%s,%s,%s)\n",protocol,host,port);
+ prmsg(2,"LocalOpenCOTSClient(%s,%s,%s)\n",protocol,host,port);
return TRANS(LocalOpenClient)(XTRANS_OPEN_COTS_CLIENT, protocol, host, port);
}
@@ -2017,7 +2010,7 @@ TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, char *protocol,
int found = 0;
char typebuf[TYPEBUFSIZE];
- PRMSG(2,"LocalOpenCOTSServer(%s,%s,%s)\n",protocol,host,port);
+ prmsg(2,"LocalOpenCOTSServer(%s,%s,%s)\n",protocol,host,port);
/* Check if this local type is in the XLOCAL list */
TRANS(LocalInitTransports)("local");
@@ -2039,7 +2032,7 @@ TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, char *protocol,
TRANS(LocalEndTransports)();
if (!found) {
- PRMSG(3,"LocalOpenCOTSServer: disabling %s\n",thistrans->TransName,0,0);
+ prmsg(3,"LocalOpenCOTSServer: disabling %s\n",thistrans->TransName);
thistrans->flags |= TRANS_DISABLED;
return NULL;
}
@@ -2053,11 +2046,11 @@ TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, char *protocol,
#ifdef TRANS_CLIENT
static XtransConnInfo
-TRANS(LocalOpenCLTSClient)(Xtransport *thistrans, char *protocol,
+TRANS(LocalOpenCLTSClient)(Xtransport *thistrans _X_UNUSED, char *protocol,
char *host, char *port)
{
- PRMSG(2,"LocalOpenCLTSClient(%s,%s,%s)\n",protocol,host,port);
+ prmsg(2,"LocalOpenCLTSClient(%s,%s,%s)\n",protocol,host,port);
return TRANS(LocalOpenClient)(XTRANS_OPEN_CLTS_CLIENT, protocol, host, port);
}
@@ -2068,11 +2061,11 @@ TRANS(LocalOpenCLTSClient)(Xtransport *thistrans, char *protocol,
#ifdef TRANS_SERVER
static XtransConnInfo
-TRANS(LocalOpenCLTSServer)(Xtransport *thistrans, char *protocol,
+TRANS(LocalOpenCLTSServer)(Xtransport *thistrans _X_UNUSED, char *protocol,
char *host, char *port)
{
- PRMSG(2,"LocalOpenCLTSServer(%s,%s,%s)\n",protocol,host,port);
+ prmsg(2,"LocalOpenCLTSServer(%s,%s,%s)\n",protocol,host,port);
return TRANS(LocalOpenServer)(XTRANS_OPEN_CLTS_SERVER, protocol, host, port);
}
@@ -2088,7 +2081,7 @@ TRANS(LocalReopenCOTSServer)(Xtransport *thistrans, int fd, char *port)
{
int index;
- PRMSG(2,"LocalReopenCOTSServer(%d,%s)\n", fd, port, 0);
+ prmsg(2,"LocalReopenCOTSServer(%d,%s)\n", fd, port);
for(index=1;index<NUMTRANSPORTS;index++)
{
@@ -2112,7 +2105,7 @@ TRANS(LocalReopenCLTSServer)(Xtransport *thistrans, int fd, char *port)
{
int index;
- PRMSG(2,"LocalReopenCLTSServer(%d,%s)\n", fd, port, 0);
+ prmsg(2,"LocalReopenCLTSServer(%d,%s)\n", fd, port);
for(index=1;index<NUMTRANSPORTS;index++)
{
@@ -2138,7 +2131,7 @@ static int
TRANS(LocalSetOption)(XtransConnInfo ciptr, int option, int arg)
{
- PRMSG(2,"LocalSetOption(%d,%d,%d)\n",ciptr->fd,option,arg);
+ prmsg(2,"LocalSetOption(%d,%d,%d)\n",ciptr->fd,option,arg);
return -1;
}
@@ -2147,10 +2140,10 @@ TRANS(LocalSetOption)(XtransConnInfo ciptr, int option, int arg)
#ifdef TRANS_SERVER
static int
-TRANS(LocalCreateListener)(XtransConnInfo ciptr, char *port, unsigned int flags)
+TRANS(LocalCreateListener)(XtransConnInfo ciptr, char *port, unsigned int flags _X_UNUSED)
{
- PRMSG(2,"LocalCreateListener(%x->%d,%s)\n",ciptr,ciptr->fd,port);
+ prmsg(2,"LocalCreateListener(%p->%d,%s)\n",ciptr,ciptr->fd,port);
return 0;
}
@@ -2161,7 +2154,7 @@ TRANS(LocalResetListener)(XtransConnInfo ciptr)
{
LOCALtrans2dev *transptr;
- PRMSG(2,"LocalResetListener(%x)\n",ciptr,0,0);
+ prmsg(2,"LocalResetListener(%p)\n",ciptr);
transptr=(LOCALtrans2dev *)ciptr->priv;
if (transptr->devreset != NULL) {
@@ -2178,14 +2171,14 @@ TRANS(LocalAccept)(XtransConnInfo ciptr, int *status)
XtransConnInfo newciptr;
LOCALtrans2dev *transptr;
- PRMSG(2,"LocalAccept(%x->%d)\n", ciptr, ciptr->fd,0);
+ prmsg(2,"LocalAccept(%p->%d)\n", ciptr, ciptr->fd);
transptr=(LOCALtrans2dev *)ciptr->priv;
if( (newciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo)))==NULL )
{
- PRMSG(1,"LocalAccept: calloc(1,%d) failed\n",
- sizeof(struct _XtransConnInfo),0,0 );
+ prmsg(1,"LocalAccept: calloc(1,%lu) failed\n",
+ sizeof(struct _XtransConnInfo));
*status = TRANS_ACCEPT_BAD_MALLOC;
return NULL;
}
@@ -2212,10 +2205,10 @@ TRANS(LocalAccept)(XtransConnInfo ciptr, int *status)
#ifdef TRANS_CLIENT
static int
-TRANS(LocalConnect)(XtransConnInfo ciptr, char *host, char *port)
+TRANS(LocalConnect)(XtransConnInfo ciptr, char *host _X_UNUSED, char *port)
{
- PRMSG(2,"LocalConnect(%x->%d,%s)\n", ciptr, ciptr->fd, port);
+ prmsg(2,"LocalConnect(%p->%d,%s)\n", ciptr, ciptr->fd, port);
return 0;
}
@@ -2227,7 +2220,7 @@ static int
TRANS(LocalBytesReadable)(XtransConnInfo ciptr, BytesReadable_t *pend )
{
- PRMSG(2,"LocalBytesReadable(%x->%d,%x)\n", ciptr, ciptr->fd, pend);
+ prmsg(2,"LocalBytesReadable(%p->%d,%p)\n", ciptr, ciptr->fd, pend);
#if defined(SCO325)
return ioctl(ciptr->fd, I_NREAD, (char *)pend);
@@ -2240,7 +2233,7 @@ static int
TRANS(LocalRead)(XtransConnInfo ciptr, char *buf, int size)
{
- PRMSG(2,"LocalRead(%d,%x,%d)\n", ciptr->fd, buf, size );
+ prmsg(2,"LocalRead(%d,%p,%d)\n", ciptr->fd, buf, size );
return read(ciptr->fd,buf,size);
}
@@ -2249,7 +2242,7 @@ static int
TRANS(LocalWrite)(XtransConnInfo ciptr, char *buf, int size)
{
- PRMSG(2,"LocalWrite(%d,%x,%d)\n", ciptr->fd, buf, size );
+ prmsg(2,"LocalWrite(%d,%p,%d)\n", ciptr->fd, buf, size );
return write(ciptr->fd,buf,size);
}
@@ -2258,7 +2251,7 @@ static int
TRANS(LocalReadv)(XtransConnInfo ciptr, struct iovec *buf, int size)
{
- PRMSG(2,"LocalReadv(%d,%x,%d)\n", ciptr->fd, buf, size );
+ prmsg(2,"LocalReadv(%d,%p,%d)\n", ciptr->fd, buf, size );
return READV(ciptr,buf,size);
}
@@ -2267,7 +2260,7 @@ static int
TRANS(LocalWritev)(XtransConnInfo ciptr, struct iovec *buf, int size)
{
- PRMSG(2,"LocalWritev(%d,%x,%d)\n", ciptr->fd, buf, size );
+ prmsg(2,"LocalWritev(%d,%p,%d)\n", ciptr->fd, buf, size );
return WRITEV(ciptr,buf,size);
}
@@ -2276,7 +2269,7 @@ static int
TRANS(LocalDisconnect)(XtransConnInfo ciptr)
{
- PRMSG(2,"LocalDisconnect(%x->%d)\n", ciptr, ciptr->fd, 0);
+ prmsg(2,"LocalDisconnect(%p->%d)\n", ciptr, ciptr->fd);
return 0;
}
@@ -2288,7 +2281,7 @@ TRANS(LocalClose)(XtransConnInfo ciptr)
struct sockaddr_un *sockname=(struct sockaddr_un *) ciptr->addr;
int ret;
- PRMSG(2,"LocalClose(%x->%d)\n", ciptr, ciptr->fd ,0);
+ prmsg(2,"LocalClose(%p->%d)\n", ciptr, ciptr->fd );
ret=close(ciptr->fd);
@@ -2310,7 +2303,7 @@ TRANS(LocalCloseForCloning)(XtransConnInfo ciptr)
{
int ret;
- PRMSG(2,"LocalCloseForCloning(%x->%d)\n", ciptr, ciptr->fd ,0);
+ prmsg(2,"LocalCloseForCloning(%p->%d)\n", ciptr, ciptr->fd );
/* Don't unlink path */
@@ -2331,7 +2324,7 @@ TRANS(LocalCloseForCloning)(XtransConnInfo ciptr)
*/
#ifdef TRANS_SERVER
-static char * local_aliases[] = {
+static const char * local_aliases[] = {
# ifdef LOCAL_TRANS_PTS
"pts",
# endif
diff --git a/X11/xtrans/Xtranssock.c b/X11/xtrans/Xtranssock.c
index c2f3fac75..955516db3 100644
--- a/X11/xtrans/Xtranssock.c
+++ b/X11/xtrans/Xtranssock.c
@@ -172,7 +172,7 @@ from the copyright holders.
*/
typedef struct _Sockettrans2dev {
- char *transname;
+ const char *transname;
int family;
int devcotsname;
int devcltsname;
@@ -254,12 +254,12 @@ static int TRANS(SocketINETClose) (XtransConnInfo ciptr);
*/
static int
-TRANS(SocketSelectFamily) (int first, char *family)
+TRANS(SocketSelectFamily) (int first, const char *family)
{
int i;
- PRMSG (3,"SocketSelectFamily(%s)\n", family, 0, 0);
+ prmsg (3,"SocketSelectFamily(%s)\n", family);
for (i = first + 1; i < NUMSOCKETFAMILIES;i++)
{
@@ -288,7 +288,7 @@ TRANS(SocketINETGetAddr) (XtransConnInfo ciptr)
void *socknamePtr;
SOCKLEN_T namelen;
- PRMSG (3,"SocketINETGetAddr(%p)\n", ciptr, 0, 0);
+ prmsg (3,"SocketINETGetAddr(%p)\n", ciptr);
#if defined(IPv6) && defined(AF_INET6)
namelen = sizeof(socknamev6);
@@ -306,8 +306,8 @@ TRANS(SocketINETGetAddr) (XtransConnInfo ciptr)
#ifdef WIN32
errno = WSAGetLastError();
#endif
- PRMSG (1,"SocketINETGetAddr: getsockname() failed: %d\n",
- EGET(),0, 0);
+ prmsg (1,"SocketINETGetAddr: getsockname() failed: %d\n",
+ EGET());
return -1;
}
@@ -317,9 +317,8 @@ TRANS(SocketINETGetAddr) (XtransConnInfo ciptr)
if ((ciptr->addr = (char *) xalloc (namelen)) == NULL)
{
- PRMSG (1,
- "SocketINETGetAddr: Can't allocate space for the addr\n",
- 0, 0, 0);
+ prmsg (1,
+ "SocketINETGetAddr: Can't allocate space for the addr\n");
return -1;
}
@@ -366,7 +365,7 @@ TRANS(SocketINETGetPeerAddr) (XtransConnInfo ciptr)
bzero(socknamePtr, namelen);
- PRMSG (3,"SocketINETGetPeerAddr(%p)\n", ciptr, 0, 0);
+ prmsg (3,"SocketINETGetPeerAddr(%p)\n", ciptr);
if (getpeername (ciptr->fd, (struct sockaddr *) socknamePtr,
(void *)&namelen) < 0)
@@ -374,8 +373,8 @@ TRANS(SocketINETGetPeerAddr) (XtransConnInfo ciptr)
#ifdef WIN32
errno = WSAGetLastError();
#endif
- PRMSG (1,"SocketINETGetPeerAddr: getpeername() failed: %d\n",
- EGET(), 0, 0);
+ prmsg (1,"SocketINETGetPeerAddr: getpeername() failed: %d\n",
+ EGET());
return -1;
}
@@ -385,9 +384,8 @@ TRANS(SocketINETGetPeerAddr) (XtransConnInfo ciptr)
if ((ciptr->peeraddr = (char *) xalloc (namelen)) == NULL)
{
- PRMSG (1,
- "SocketINETGetPeerAddr: Can't allocate space for the addr\n",
- 0, 0, 0);
+ prmsg (1,
+ "SocketINETGetPeerAddr: Can't allocate space for the addr\n");
return -1;
}
@@ -404,12 +402,12 @@ TRANS(SocketOpen) (int i, int type)
{
XtransConnInfo ciptr;
- PRMSG (3,"SocketOpen(%d,%d)\n", i, type, 0);
+ prmsg (3,"SocketOpen(%d,%d)\n", i, type);
if ((ciptr = (XtransConnInfo) xcalloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
{
- PRMSG (1, "SocketOpen: malloc failed\n", 0, 0, 0);
+ prmsg (1, "SocketOpen: malloc failed\n");
return NULL;
}
@@ -424,8 +422,8 @@ TRANS(SocketOpen) (int i, int type)
#ifdef WIN32
errno = WSAGetLastError();
#endif
- PRMSG (2, "SocketOpen: socket() failed for %s\n",
- Sockettrans2devtab[i].transname, 0, 0);
+ prmsg (2, "SocketOpen: socket() failed for %s\n",
+ Sockettrans2devtab[i].transname);
xfree ((char *) ciptr);
return NULL;
@@ -455,30 +453,30 @@ TRANS(SocketOpen) (int i, int type)
#ifdef TRANS_REOPEN
static XtransConnInfo
-TRANS(SocketReopen) (int i, int type, int fd, char *port)
+TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, char *port)
{
XtransConnInfo ciptr;
int portlen;
struct sockaddr *addr;
- PRMSG (3,"SocketReopen(%d,%d,%s)\n", type, fd, port);
+ prmsg (3,"SocketReopen(%d,%d,%s)\n", type, fd, port);
if (port == NULL) {
- PRMSG (1, "SocketReopen: port was null!\n", 0, 0, 0);
+ prmsg (1, "SocketReopen: port was null!\n");
return NULL;
}
portlen = strlen(port) + 1; // include space for trailing null
#ifdef SOCK_MAXADDRLEN
if (portlen < 0 || portlen > (SOCK_MAXADDRLEN + 2)) {
- PRMSG (1, "SocketReopen: invalid portlen %d\n", portlen, 0, 0);
+ prmsg (1, "SocketReopen: invalid portlen %d\n", portlen);
return NULL;
}
if (portlen < 14) portlen = 14;
#else
if (portlen < 0 || portlen > 14) {
- PRMSG (1, "SocketReopen: invalid portlen %d\n", portlen, 0, 0);
+ prmsg (1, "SocketReopen: invalid portlen %d\n", portlen);
return NULL;
}
#endif /*SOCK_MAXADDRLEN*/
@@ -486,21 +484,21 @@ TRANS(SocketReopen) (int i, int type, int fd, char *port)
if ((ciptr = (XtransConnInfo) xcalloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
{
- PRMSG (1, "SocketReopen: malloc(ciptr) failed\n", 0, 0, 0);
+ prmsg (1, "SocketReopen: malloc(ciptr) failed\n");
return NULL;
}
ciptr->fd = fd;
if ((addr = (struct sockaddr *) xcalloc (1, portlen + 2)) == NULL) {
- PRMSG (1, "SocketReopen: malloc(addr) failed\n", 0, 0, 0);
+ prmsg (1, "SocketReopen: malloc(addr) failed\n");
return NULL;
}
ciptr->addr = (char *) addr;
ciptr->addrlen = portlen + 2;
if ((ciptr->peeraddr = (char *) xcalloc (1, portlen + 2)) == NULL) {
- PRMSG (1, "SocketReopen: malloc(portaddr) failed\n", 0, 0, 0);
+ prmsg (1, "SocketReopen: malloc(portaddr) failed\n");
return NULL;
}
ciptr->peeraddrlen = portlen + 2;
@@ -540,13 +538,13 @@ TRANS(SocketReopen) (int i, int type, int fd, char *port)
#ifdef TRANS_CLIENT
static XtransConnInfo
-TRANS(SocketOpenCOTSClientBase) (char *transname, char *protocol,
- char *host, char *port, int previndex)
+TRANS(SocketOpenCOTSClientBase) (const char *transname, const char *protocol,
+ const char *host, const char *port, int previndex)
{
XtransConnInfo ciptr;
int i = previndex;
- PRMSG (2, "SocketOpenCOTSClient(%s,%s,%s)\n",
+ prmsg (2, "SocketOpenCOTSClient(%s,%s,%s)\n",
protocol, host, port);
SocketInitOnce();
@@ -562,11 +560,11 @@ TRANS(SocketOpenCOTSClientBase) (char *transname, char *protocol,
}
if (i < 0) {
if (i == -1)
- PRMSG (1,"SocketOpenCOTSClient: Unable to open socket for %s\n",
- transname, 0, 0);
+ prmsg (1,"SocketOpenCOTSClient: Unable to open socket for %s\n",
+ transname);
else
- PRMSG (1,"SocketOpenCOTSClient: Unable to determine socket type for %s\n",
- transname, 0, 0);
+ prmsg (1,"SocketOpenCOTSClient: Unable to determine socket type for %s\n",
+ transname);
return NULL;
}
@@ -595,7 +593,7 @@ TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, char *protocol,
XtransConnInfo ciptr;
int i = -1;
- PRMSG (2,"SocketOpenCOTSServer(%s,%s,%s)\n", protocol, host, port);
+ prmsg (2,"SocketOpenCOTSServer(%s,%s,%s)\n", protocol, host, port);
SocketInitOnce();
@@ -606,11 +604,11 @@ TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, char *protocol,
}
if (i < 0) {
if (i == -1)
- PRMSG (1,"SocketOpenCOTSServer: Unable to open socket for %s\n",
- thistrans->TransName, 0, 0);
+ prmsg (1,"SocketOpenCOTSServer: Unable to open socket for %s\n",
+ thistrans->TransName);
else
- PRMSG (1,"SocketOpenCOTSServer: Unable to determine socket type for %s\n",
- thistrans->TransName, 0, 0);
+ prmsg (1,"SocketOpenCOTSServer: Unable to determine socket type for %s\n",
+ thistrans->TransName);
return NULL;
}
@@ -662,7 +660,7 @@ TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, char *protocol,
XtransConnInfo ciptr;
int i = -1;
- PRMSG (2,"SocketOpenCLTSClient(%s,%s,%s)\n", protocol, host, port);
+ prmsg (2,"SocketOpenCLTSClient(%s,%s,%s)\n", protocol, host, port);
SocketInitOnce();
@@ -673,11 +671,11 @@ TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, char *protocol,
}
if (i < 0) {
if (i == -1)
- PRMSG (1,"SocketOpenCLTSClient: Unable to open socket for %s\n",
- thistrans->TransName, 0, 0);
+ prmsg (1,"SocketOpenCLTSClient: Unable to open socket for %s\n",
+ thistrans->TransName);
else
- PRMSG (1,"SocketOpenCLTSClient: Unable to determine socket type for %s\n",
- thistrans->TransName, 0, 0);
+ prmsg (1,"SocketOpenCLTSClient: Unable to determine socket type for %s\n",
+ thistrans->TransName);
return NULL;
}
@@ -701,7 +699,7 @@ TRANS(SocketOpenCLTSServer) (Xtransport *thistrans, char *protocol,
XtransConnInfo ciptr;
int i = -1;
- PRMSG (2,"SocketOpenCLTSServer(%s,%s,%s)\n", protocol, host, port);
+ prmsg (2,"SocketOpenCLTSServer(%s,%s,%s)\n", protocol, host, port);
SocketInitOnce();
@@ -712,11 +710,11 @@ TRANS(SocketOpenCLTSServer) (Xtransport *thistrans, char *protocol,
}
if (i < 0) {
if (i == -1)
- PRMSG (1,"SocketOpenCLTSServer: Unable to open socket for %s\n",
- thistrans->TransName, 0, 0);
+ prmsg (1,"SocketOpenCLTSServer: Unable to open socket for %s\n",
+ thistrans->TransName);
else
- PRMSG (1,"SocketOpenCLTSServer: Unable to determine socket type for %s\n",
- thistrans->TransName, 0, 0);
+ prmsg (1,"SocketOpenCLTSServer: Unable to determine socket type for %s\n",
+ thistrans->TransName);
return NULL;
}
@@ -746,8 +744,8 @@ TRANS(SocketReopenCOTSServer) (Xtransport *thistrans, int fd, char *port)
XtransConnInfo ciptr;
int i = -1;
- PRMSG (2,
- "SocketReopenCOTSServer(%d, %s)\n", fd, port, 0);
+ prmsg (2,
+ "SocketReopenCOTSServer(%d, %s)\n", fd, port);
SocketInitOnce();
@@ -758,11 +756,11 @@ TRANS(SocketReopenCOTSServer) (Xtransport *thistrans, int fd, char *port)
}
if (i < 0) {
if (i == -1)
- PRMSG (1,"SocketReopenCOTSServer: Unable to open socket for %s\n",
- thistrans->TransName, 0, 0);
+ prmsg (1,"SocketReopenCOTSServer: Unable to open socket for %s\n",
+ thistrans->TransName);
else
- PRMSG (1,"SocketReopenCOTSServer: Unable to determine socket type for %s\n",
- thistrans->TransName, 0, 0);
+ prmsg (1,"SocketReopenCOTSServer: Unable to determine socket type for %s\n",
+ thistrans->TransName);
return NULL;
}
@@ -780,8 +778,8 @@ TRANS(SocketReopenCLTSServer) (Xtransport *thistrans, int fd, char *port)
XtransConnInfo ciptr;
int i = -1;
- PRMSG (2,
- "SocketReopenCLTSServer(%d, %s)\n", fd, port, 0);
+ prmsg (2,
+ "SocketReopenCLTSServer(%d, %s)\n", fd, port);
SocketInitOnce();
@@ -792,11 +790,11 @@ TRANS(SocketReopenCLTSServer) (Xtransport *thistrans, int fd, char *port)
}
if (i < 0) {
if (i == -1)
- PRMSG (1,"SocketReopenCLTSServer: Unable to open socket for %s\n",
- thistrans->TransName, 0, 0);
+ prmsg (1,"SocketReopenCLTSServer: Unable to open socket for %s\n",
+ thistrans->TransName);
else
- PRMSG (1,"SocketReopenCLTSServer: Unable to determine socket type for %s\n",
- thistrans->TransName, 0, 0);
+ prmsg (1,"SocketReopenCLTSServer: Unable to determine socket type for %s\n",
+ thistrans->TransName);
return NULL;
}
@@ -814,7 +812,7 @@ static int
TRANS(SocketSetOption) (XtransConnInfo ciptr, int option, int arg)
{
- PRMSG (2,"SocketSetOption(%d,%d,%d)\n", ciptr->fd, option, arg);
+ prmsg (2,"SocketSetOption(%d,%d,%d)\n", ciptr->fd, option, arg);
return -1;
}
@@ -842,7 +840,7 @@ set_sun_path(const char *port, const char *upath, char *path, int abstract)
if (strlen(port) + strlen(upath) > maxlen)
return -1;
- sprintf(path, "%s%s%s", at, upath, port);
+ snprintf(path, sizeof(s.sun_path), "%s%s%s", at, upath, port);
return 0;
}
#endif
@@ -859,7 +857,7 @@ TRANS(SocketCreateListener) (XtransConnInfo ciptr,
int fd = ciptr->fd;
int retry;
- PRMSG (3, "SocketCreateListener(%x,%p)\n", ciptr, fd, 0);
+ prmsg (3, "SocketCreateListener(%p,%d)\n", ciptr, fd);
if (Sockettrans2devtab[ciptr->index].family == AF_INET
#if defined(IPv6) && defined(AF_INET6)
@@ -880,8 +878,7 @@ TRANS(SocketCreateListener) (XtransConnInfo ciptr,
}
if (retry-- == 0) {
- PRMSG (1, "SocketCreateListener: failed to bind listener\n",
- 0, 0, 0);
+ prmsg (1, "SocketCreateListener: failed to bind listener\n");
close (fd);
return TRANS_CREATE_LISTENER_FAILED;
}
@@ -912,7 +909,7 @@ TRANS(SocketCreateListener) (XtransConnInfo ciptr,
if (listen (fd, BACKLOG) < 0)
{
- PRMSG (1, "SocketCreateListener: listen() failed\n", 0, 0, 0);
+ prmsg (1, "SocketCreateListener: listen() failed\n");
close (fd);
return TRANS_CREATE_LISTENER_FAILED;
}
@@ -947,7 +944,7 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int
char portbuf[PORTBUFSIZE];
#endif
- PRMSG (2, "SocketINETCreateListener(%s)\n", port, 0, 0);
+ prmsg (2, "SocketINETCreateListener(%s)\n", port);
#ifdef X11_t
/*
@@ -963,7 +960,7 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int
{
/* fixup the server port address */
tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10);
- sprintf (portbuf,"%lu", tmpport);
+ snprintf (portbuf, sizeof(portbuf), "%lu", tmpport);
port = portbuf;
}
#endif
@@ -976,9 +973,9 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int
{
if ((servp = _XGetservbyname (port,"tcp",sparams)) == NULL)
{
- PRMSG (1,
+ prmsg (1,
"SocketINETCreateListener: Unable to get service for %s\n",
- port, 0, 0);
+ port);
return TRANS_CREATE_LISTENER_FAILED;
}
/* we trust getservbyname to return a valid number */
@@ -1033,17 +1030,15 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int
if ((status = TRANS(SocketCreateListener) (ciptr,
(struct sockaddr *) &sockname, namelen, flags)) < 0)
{
- PRMSG (1,
- "SocketINETCreateListener: ...SocketCreateListener() failed\n",
- 0, 0, 0);
+ prmsg (1,
+ "SocketINETCreateListener: ...SocketCreateListener() failed\n");
return status;
}
if (TRANS(SocketINETGetAddr) (ciptr) < 0)
{
- PRMSG (1,
- "SocketINETCreateListener: ...SocketINETGetAddr() failed\n",
- 0, 0, 0);
+ prmsg (1,
+ "SocketINETCreateListener: ...SocketINETGetAddr() failed\n");
return TRANS_CREATE_LISTENER_FAILED;
}
@@ -1072,8 +1067,8 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
abstract = ciptr->transptr->flags & TRANS_ABSTRACT;
#endif
- PRMSG (2, "SocketUNIXCreateListener(%s)\n",
- port ? port : "NULL", 0, 0);
+ prmsg (2, "SocketUNIXCreateListener(%s)\n",
+ port ? port : "NULL");
/* Make sure the directory is created */
@@ -1086,8 +1081,8 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
mode = 0777;
#endif
if (!abstract && trans_mkdir(UNIX_DIR, mode) == -1) {
- PRMSG (1, "SocketUNIXCreateListener: mkdir(%s) failed, errno = %d\n",
- UNIX_DIR, errno, 0);
+ prmsg (1, "SocketUNIXCreateListener: mkdir(%s) failed, errno = %d\n",
+ UNIX_DIR, errno);
(void) umask (oldUmask);
return TRANS_CREATE_LISTENER_FAILED;
}
@@ -1101,7 +1096,7 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
port = tmpport;
}
if (set_sun_path(port, UNIX_PATH, sockname.sun_path, abstract) != 0) {
- PRMSG (1, "SocketUNIXCreateListener: path too long\n", 0, 0, 0);
+ prmsg (1, "SocketUNIXCreateListener: path too long\n");
return TRANS_CREATE_LISTENER_FAILED;
}
@@ -1125,9 +1120,8 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
if ((status = TRANS(SocketCreateListener) (ciptr,
(struct sockaddr *) &sockname, namelen, flags)) < 0)
{
- PRMSG (1,
- "SocketUNIXCreateListener: ...SocketCreateListener() failed\n",
- 0, 0, 0);
+ prmsg (1,
+ "SocketUNIXCreateListener: ...SocketCreateListener() failed\n");
(void) umask (oldUmask);
return status;
}
@@ -1143,9 +1137,8 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
if ((ciptr->addr = (char *) xalloc (namelen)) == NULL)
{
- PRMSG (1,
- "SocketUNIXCreateListener: Can't allocate space for the addr\n",
- 0, 0, 0);
+ prmsg (1,
+ "SocketUNIXCreateListener: Can't allocate space for the addr\n");
(void) umask (oldUmask);
return TRANS_CREATE_LISTENER_FAILED;
}
@@ -1180,7 +1173,7 @@ TRANS(SocketUNIXResetListener) (XtransConnInfo ciptr)
abstract = ciptr->transptr->flags & TRANS_ABSTRACT;
#endif
- PRMSG (3, "SocketUNIXResetListener(%p,%d)\n", ciptr, ciptr->fd, 0);
+ prmsg (3, "SocketUNIXResetListener(%p,%d)\n", ciptr, ciptr->fd);
if (!abstract && (
stat (unsock->sun_path, &statb) == -1 ||
@@ -1201,8 +1194,8 @@ TRANS(SocketUNIXResetListener) (XtransConnInfo ciptr)
mode = 0777;
#endif
if (trans_mkdir(UNIX_DIR, mode) == -1) {
- PRMSG (1, "SocketUNIXResetListener: mkdir(%s) failed, errno = %d\n",
- UNIX_DIR, errno, 0);
+ prmsg (1, "SocketUNIXResetListener: mkdir(%s) failed, errno = %d\n",
+ UNIX_DIR, errno);
(void) umask (oldUmask);
return TRANS_RESET_FAILURE;
}
@@ -1254,12 +1247,12 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status)
struct sockaddr_in sockname;
SOCKLEN_T namelen = sizeof(sockname);
- PRMSG (2, "SocketINETAccept(%p,%d)\n", ciptr, ciptr->fd, 0);
+ prmsg (2, "SocketINETAccept(%p,%d)\n", ciptr, ciptr->fd);
if ((newciptr = (XtransConnInfo) xcalloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
{
- PRMSG (1, "SocketINETAccept: malloc failed\n", 0, 0, 0);
+ prmsg (1, "SocketINETAccept: malloc failed\n");
*status = TRANS_ACCEPT_BAD_MALLOC;
return NULL;
}
@@ -1270,7 +1263,7 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status)
#ifdef WIN32
errno = WSAGetLastError();
#endif
- PRMSG (1, "SocketINETAccept: accept() failed\n", 0, 0, 0);
+ prmsg (1, "SocketINETAccept: accept() failed\n");
xfree (newciptr);
*status = TRANS_ACCEPT_FAILED;
return NULL;
@@ -1295,9 +1288,8 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status)
if (TRANS(SocketINETGetAddr) (newciptr) < 0)
{
- PRMSG (1,
- "SocketINETAccept: ...SocketINETGetAddr() failed:\n",
- 0, 0, 0);
+ prmsg (1,
+ "SocketINETAccept: ...SocketINETGetAddr() failed:\n");
close (newciptr->fd);
xfree (newciptr);
*status = TRANS_ACCEPT_MISC_ERROR;
@@ -1306,9 +1298,8 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status)
if (TRANS(SocketINETGetPeerAddr) (newciptr) < 0)
{
- PRMSG (1,
- "SocketINETAccept: ...SocketINETGetPeerAddr() failed:\n",
- 0, 0, 0);
+ prmsg (1,
+ "SocketINETAccept: ...SocketINETGetPeerAddr() failed:\n");
close (newciptr->fd);
if (newciptr->addr) xfree (newciptr->addr);
xfree (newciptr);
@@ -1333,12 +1324,12 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
struct sockaddr_un sockname;
SOCKLEN_T namelen = sizeof sockname;
- PRMSG (2, "SocketUNIXAccept(%p,%d)\n", ciptr, ciptr->fd, 0);
+ prmsg (2, "SocketUNIXAccept(%p,%d)\n", ciptr, ciptr->fd);
if ((newciptr = (XtransConnInfo) xcalloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
{
- PRMSG (1, "SocketUNIXAccept: malloc() failed\n", 0, 0, 0);
+ prmsg (1, "SocketUNIXAccept: malloc() failed\n");
*status = TRANS_ACCEPT_BAD_MALLOC;
return NULL;
}
@@ -1346,7 +1337,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
if ((newciptr->fd = accept (ciptr->fd,
(struct sockaddr *) &sockname, (void *)&namelen)) < 0)
{
- PRMSG (1, "SocketUNIXAccept: accept() failed\n", 0, 0, 0);
+ prmsg (1, "SocketUNIXAccept: accept() failed\n");
xfree (newciptr);
*status = TRANS_ACCEPT_FAILED;
return NULL;
@@ -1360,9 +1351,8 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
if ((newciptr->addr = (char *) xalloc (ciptr->addrlen)) == NULL)
{
- PRMSG (1,
- "SocketUNIXAccept: Can't allocate space for the addr\n",
- 0, 0, 0);
+ prmsg (1,
+ "SocketUNIXAccept: Can't allocate space for the addr\n");
close (newciptr->fd);
xfree (newciptr);
*status = TRANS_ACCEPT_BAD_MALLOC;
@@ -1379,9 +1369,8 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
if ((newciptr->peeraddr = (char *) xalloc (ciptr->addrlen)) == NULL)
{
- PRMSG (1,
- "SocketUNIXAccept: Can't allocate space for the addr\n",
- 0, 0, 0);
+ prmsg (1,
+ "SocketUNIXAccept: Can't allocate space for the addr\n");
close (newciptr->fd);
if (newciptr->addr) xfree (newciptr->addr);
xfree (newciptr);
@@ -1430,23 +1419,23 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
struct addrinfo hints;
char ntopbuf[INET6_ADDRSTRLEN];
int resetonce = 0;
-#endif
+#else
struct sockaddr_in sockname;
+ struct hostent *hostp;
+ struct servent *servp;
+ unsigned long tmpaddr;
+#endif
#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgethostbynameparams hparams;
_Xgetservbynameparams sparams;
#endif
- struct hostent *hostp;
- struct servent *servp;
- unsigned long tmpaddr;
#ifdef X11_t
char portbuf[PORTBUFSIZE];
#endif
- long tmpport;
char hostnamebuf[256]; /* tmp space */
- PRMSG (2,"SocketINETConnect(%d,%s,%s)\n", ciptr->fd, host, port);
+ prmsg (2,"SocketINETConnect(%d,%s,%s)\n", ciptr->fd, host, port);
if (!host)
{
@@ -1467,8 +1456,8 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
if (is_numeric (port))
{
- tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10);
- sprintf (portbuf, "%lu", tmpport);
+ long tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10);
+ snprintf (portbuf, sizeof(portbuf), "%lu", tmpport);
port = portbuf;
}
#endif
@@ -1497,7 +1486,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
res = getaddrinfo(host,port,&hints,&addrlist->firstaddr);
if (res != 0) {
- PRMSG (1, "SocketINETConnect() can't get address "
+ prmsg (1, "SocketINETConnect() can't get address "
"for %s:%s: %s\n", host, port, gai_strerror(res));
ESET(EINVAL);
return TRANS_CONNECT_FAILED;
@@ -1506,7 +1495,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
addrlist->addr ; res++) {
addrlist->addr = addrlist->addr->ai_next;
}
- PRMSG(4,"Got New Address list with %d addresses\n", res, 0, 0);
+ prmsg(4,"Got New Address list with %d addresses\n", res);
res = 0;
addrlist->addr = NULL;
}
@@ -1515,8 +1504,8 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
if (addrlist->addr == NULL) {
if (resetonce) {
/* Already checked entire list - no usable addresses */
- PRMSG (1, "SocketINETConnect() no usable address "
- "for %s:%s\n", host, port, 0);
+ prmsg (1, "SocketINETConnect() no usable address "
+ "for %s:%s\n", host, port);
return TRANS_CONNECT_FAILED;
} else {
/* Go back to beginning of list */
@@ -1531,12 +1520,12 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
if (addrlist->addr->ai_family == AF_INET) {
struct sockaddr_in *sin = (struct sockaddr_in *) socketaddr;
- PRMSG (4,"SocketINETConnect() sockname.sin_addr = %s\n",
+ prmsg (4,"SocketINETConnect() sockname.sin_addr = %s\n",
inet_ntop(addrlist->addr->ai_family,&sin->sin_addr,
- ntopbuf,sizeof(ntopbuf)), 0, 0);
+ ntopbuf,sizeof(ntopbuf)));
- PRMSG (4,"SocketINETConnect() sockname.sin_port = %d\n",
- ntohs(sin->sin_port), 0, 0);
+ prmsg (4,"SocketINETConnect() sockname.sin_port = %d\n",
+ ntohs(sin->sin_port));
if (Sockettrans2devtab[ciptr->index].family == AF_INET6) {
if (strcmp(Sockettrans2devtab[ciptr->index].transname,
@@ -1558,26 +1547,24 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
Sockettrans2devtab[newciptr->index].family !=
AF_INET) {
socketaddr = NULL;
- PRMSG (4,"SocketINETConnect() Cannot get IPv4 "
- " socketfor IPv4 address\n", 0,0,0);
+ prmsg (4,"SocketINETConnect() Cannot get IPv4 "
+ " socketfor IPv4 address\n");
}
if (newciptr)
xfree(newciptr);
} else {
socketaddr = NULL;
- PRMSG (4,"SocketINETConnect Skipping IPv4 address\n",
- 0,0,0);
+ prmsg (4,"SocketINETConnect Skipping IPv4 address\n");
}
}
} else if (addrlist->addr->ai_family == AF_INET6) {
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) socketaddr;
- PRMSG (4,"SocketINETConnect() sockname.sin6_addr = %s\n",
+ prmsg (4,"SocketINETConnect() sockname.sin6_addr = %s\n",
inet_ntop(addrlist->addr->ai_family,
- &sin6->sin6_addr,ntopbuf,sizeof(ntopbuf)),
- 0, 0);
- PRMSG (4,"SocketINETConnect() sockname.sin6_port = %d\n",
- ntohs(sin6->sin6_port), 0, 0);
+ &sin6->sin6_addr,ntopbuf,sizeof(ntopbuf)));
+ prmsg (4,"SocketINETConnect() sockname.sin6_port = %d\n",
+ ntohs(sin6->sin6_port));
if (Sockettrans2devtab[ciptr->index].family == AF_INET) {
if (strcmp(Sockettrans2devtab[ciptr->index].transname,
@@ -1596,8 +1583,8 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
Sockettrans2devtab[newciptr->index].family !=
AF_INET6) {
socketaddr = NULL;
- PRMSG (4,"SocketINETConnect() Cannot get IPv6 "
- "socket for IPv6 address\n", 0,0,0);
+ prmsg (4,"SocketINETConnect() Cannot get IPv6 "
+ "socket for IPv6 address\n");
}
if (newciptr)
xfree(newciptr);
@@ -1605,8 +1592,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
else
{
socketaddr = NULL;
- PRMSG (4,"SocketINETConnect() Skipping IPv6 address\n",
- 0,0,0);
+ prmsg (4,"SocketINETConnect() Skipping IPv6 address\n");
}
}
} else {
@@ -1644,17 +1630,17 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
tmpaddr = INADDR_NONE;
}
- PRMSG (4,"SocketINETConnect() inet_addr(%s) = %x\n", host, tmpaddr, 0);
+ prmsg (4,"SocketINETConnect() inet_addr(%s) = %x\n", host, tmpaddr);
if (tmpaddr == INADDR_NONE) {
if ((hostp = _XGethostbyname(host,hparams)) == NULL) {
- PRMSG (1,"SocketINETConnect: Can't get address for %s\n",
- host, 0, 0);
+ prmsg (1,"SocketINETConnect: Can't get address for %s\n",
+ host);
ESET(EINVAL);
return TRANS_CONNECT_FAILED;
}
if (hostp->h_addrtype != AF_INET) { /* is IP host? */
- PRMSG (1,"SocketINETConnect: not INET host%s\n", host, 0, 0);
+ prmsg (1,"SocketINETConnect: not INET host%s\n", host);
ESET(EPROTOTYPE);
return TRANS_CONNECT_FAILED;
}
@@ -1674,20 +1660,20 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
if (!is_numeric (port)) {
if ((servp = _XGetservbyname (port,"tcp",sparams)) == NULL) {
- PRMSG (1,"SocketINETConnect: can't get service for %s\n",
- port, 0, 0);
+ prmsg (1,"SocketINETConnect: can't get service for %s\n",
+ port);
return TRANS_CONNECT_FAILED;
}
sockname.sin_port = htons (servp->s_port);
} else {
- tmpport = strtol (port, (char**)NULL, 10);
+ long tmpport = strtol (port, (char**)NULL, 10);
if (tmpport < 1024 || tmpport > USHRT_MAX)
return TRANS_CONNECT_FAILED;
sockname.sin_port = htons (((unsigned short) tmpport));
}
- PRMSG (4,"SocketINETConnect: sockname.sin_port = %d\n",
- ntohs(sockname.sin_port), 0, 0);
+ prmsg (4,"SocketINETConnect: sockname.sin_port = %d\n",
+ ntohs(sockname.sin_port));
socketaddr = (struct sockaddr *) &sockname;
socketaddrlen = sizeof(sockname);
}
@@ -1757,8 +1743,8 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
res = TRANS_IN_PROGRESS;
else
{
- PRMSG (2,"SocketINETConnect: Can't connect: errno = %d\n",
- olderrno,0, 0);
+ prmsg (2,"SocketINETConnect: Can't connect: errno = %d\n",
+ olderrno);
res = TRANS_CONNECT_FAILED;
}
@@ -1772,17 +1758,15 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
if (TRANS(SocketINETGetAddr) (ciptr) < 0)
{
- PRMSG (1,
- "SocketINETConnect: ...SocketINETGetAddr() failed:\n",
- 0, 0, 0);
+ prmsg (1,
+ "SocketINETConnect: ...SocketINETGetAddr() failed:\n");
res = TRANS_CONNECT_FAILED;
}
else if (TRANS(SocketINETGetPeerAddr) (ciptr) < 0)
{
- PRMSG (1,
- "SocketINETConnect: ...SocketINETGetPeerAddr() failed:\n",
- 0, 0, 0);
+ prmsg (1,
+ "SocketINETConnect: ...SocketINETGetPeerAddr() failed:\n");
res = TRANS_CONNECT_FAILED;
}
}
@@ -1950,7 +1934,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
abstract = ciptr->transptr->flags & TRANS_ABSTRACT;
#endif
- PRMSG (2,"SocketUNIXConnect(%d,%s,%s)\n", ciptr->fd, host, port);
+ prmsg (2,"SocketUNIXConnect(%d,%s,%s)\n", ciptr->fd, host, port);
/*
* Make sure 'host' is really local. If not, we return failure.
@@ -1962,9 +1946,9 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
if (host && *host && host[0]!='/' && strcmp (host, "unix") != 0 && !UnixHostReallyLocal (host))
{
- PRMSG (1,
+ prmsg (1,
"SocketUNIXConnect: Cannot connect to non-local host %s\n",
- host, 0, 0);
+ host);
return TRANS_CONNECT_FAILED;
}
@@ -1975,8 +1959,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
if (!port || !*port)
{
- PRMSG (1,"SocketUNIXConnect: Missing port specification\n",
- 0, 0, 0);
+ prmsg (1,"SocketUNIXConnect: Missing port specification\n");
return TRANS_CONNECT_FAILED;
}
@@ -1987,7 +1970,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
sockname.sun_family = AF_UNIX;
if (set_sun_path(port, UNIX_PATH, sockname.sun_path, abstract) != 0) {
- PRMSG (1, "SocketUNIXConnect: path too long\n", 0, 0, 0);
+ prmsg (1, "SocketUNIXConnect: path too long\n");
return TRANS_CONNECT_FAILED;
}
@@ -2054,8 +2037,8 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
return TRANS_CONNECT_FAILED;
}
} else {
- PRMSG (2,"SocketUNIXConnect: Can't connect: errno = %d\n",
- EGET(),0, 0);
+ prmsg (2,"SocketUNIXConnect: Can't connect: errno = %d\n",
+ EGET());
return TRANS_CONNECT_FAILED;
}
@@ -2070,9 +2053,8 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
if ((ciptr->addr = (char *) xalloc(namelen)) == NULL ||
(ciptr->peeraddr = (char *) xalloc(namelen)) == NULL)
{
- PRMSG (1,
- "SocketUNIXCreateListener: Can't allocate space for the addr\n",
- 0, 0, 0);
+ prmsg (1,
+ "SocketUNIXCreateListener: Can't allocate space for the addr\n");
return TRANS_CONNECT_FAILED;
}
@@ -2097,7 +2079,7 @@ static int
TRANS(SocketBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend)
{
- PRMSG (2,"SocketBytesReadable(%p,%d,%p)\n",
+ prmsg (2,"SocketBytesReadable(%p,%d,%p)\n",
ciptr, ciptr->fd, pend);
#ifdef WIN32
{
@@ -2119,7 +2101,7 @@ static int
TRANS(SocketRead) (XtransConnInfo ciptr, char *buf, int size)
{
- PRMSG (2,"SocketRead(%d,%p,%d)\n", ciptr->fd, buf, size);
+ prmsg (2,"SocketRead(%d,%p,%d)\n", ciptr->fd, buf, size);
#if defined(WIN32)
{
@@ -2139,7 +2121,7 @@ static int
TRANS(SocketWrite) (XtransConnInfo ciptr, char *buf, int size)
{
- PRMSG (2,"SocketWrite(%d,%p,%d)\n", ciptr->fd, buf, size);
+ prmsg (2,"SocketWrite(%d,%p,%d)\n", ciptr->fd, buf, size);
#if defined(WIN32)
{
@@ -2159,7 +2141,7 @@ static int
TRANS(SocketReadv) (XtransConnInfo ciptr, struct iovec *buf, int size)
{
- PRMSG (2,"SocketReadv(%d,%p,%d)\n", ciptr->fd, buf, size);
+ prmsg (2,"SocketReadv(%d,%p,%d)\n", ciptr->fd, buf, size);
return READV (ciptr, buf, size);
}
@@ -2169,7 +2151,7 @@ static int
TRANS(SocketWritev) (XtransConnInfo ciptr, struct iovec *buf, int size)
{
- PRMSG (2,"SocketWritev(%d,%p,%d)\n", ciptr->fd, buf, size);
+ prmsg (2,"SocketWritev(%d,%p,%d)\n", ciptr->fd, buf, size);
return WRITEV (ciptr, buf, size);
}
@@ -2179,7 +2161,7 @@ static int
TRANS(SocketDisconnect) (XtransConnInfo ciptr)
{
- PRMSG (2,"SocketDisconnect(%p,%d)\n", ciptr, ciptr->fd, 0);
+ prmsg (2,"SocketDisconnect(%p,%d)\n", ciptr, ciptr->fd);
#ifdef WIN32
{
@@ -2198,7 +2180,7 @@ static int
TRANS(SocketINETClose) (XtransConnInfo ciptr)
{
- PRMSG (2,"SocketINETClose(%p,%d)\n", ciptr, ciptr->fd, 0);
+ prmsg (2,"SocketINETClose(%p,%d)\n", ciptr, ciptr->fd);
#ifdef WIN32
{
@@ -2226,7 +2208,7 @@ TRANS(SocketUNIXClose) (XtransConnInfo ciptr)
struct sockaddr_un *sockname = (struct sockaddr_un *) ciptr->addr;
int ret;
- PRMSG (2,"SocketUNIXClose(%p,%d)\n", ciptr, ciptr->fd, 0);
+ prmsg (2,"SocketUNIXClose(%p,%d)\n", ciptr, ciptr->fd);
ret = close(ciptr->fd);
@@ -2253,8 +2235,8 @@ TRANS(SocketUNIXCloseForCloning) (XtransConnInfo ciptr)
int ret;
- PRMSG (2,"SocketUNIXCloseForCloning(%p,%d)\n",
- ciptr, ciptr->fd, 0);
+ prmsg (2,"SocketUNIXCloseForCloning(%p,%d)\n",
+ ciptr, ciptr->fd);
ret = close(ciptr->fd);
@@ -2266,7 +2248,7 @@ TRANS(SocketUNIXCloseForCloning) (XtransConnInfo ciptr)
#ifdef TCPCONN
# ifdef TRANS_SERVER
-static char* tcp_nolisten[] = {
+static const char* tcp_nolisten[] = {
"inet",
#if defined(IPv6) && defined(AF_INET6)
"inet6",
diff --git a/X11/xtrans/Xtranstli.c b/X11/xtrans/Xtranstli.c
index f35214c6f..8601c137b 100644
--- a/X11/xtrans/Xtranstli.c
+++ b/X11/xtrans/Xtranstli.c
@@ -123,7 +123,7 @@ TRANS(TLISelectFamily)(char *family)
{
int i;
- PRMSG(3,"TLISelectFamily(%s)\n", family, 0,0 );
+ prmsg(3,"TLISelectFamily(%s)\n", family);
for(i=0;i<NUMTLIFAMILIES;i++)
{
@@ -146,7 +146,7 @@ TRANS(TLIGetAddr)(XtransConnInfo ciptr)
Xtransaddr sockname;
struct netbuf netbuf;
- PRMSG(3,"TLIGetAddr(%x)\n", ciptr, 0,0 );
+ prmsg(3,"TLIGetAddr(%x)\n", ciptr);
netbuf.buf=(char *)&sockname;
netbuf.len=sizeof(sockname);
@@ -154,13 +154,13 @@ TRANS(TLIGetAddr)(XtransConnInfo ciptr)
if( t_getname(ciptr->fd,&netbuf,LOCALNAME) < 0 )
{
- PRMSG(1,"TLIGetAddr: t_getname(LOCALNAME) failed: %d\n",
- errno, 0,0 );
+ prmsg(1,"TLIGetAddr: t_getname(LOCALNAME) failed: %d\n",
+ errno);
return -1;
}
- PRMSG(4,"TLIGetAddr: got family %d len %d\n",
- ((struct sockaddr *) &sockname)->sa_family ,netbuf.len, 0 );
+ prmsg(4,"TLIGetAddr: got family %d len %d\n",
+ ((struct sockaddr *) &sockname)->sa_family ,netbuf.len);
/*
* Everything looks good: fill in the XtransConnInfo structure.
@@ -171,8 +171,7 @@ TRANS(TLIGetAddr)(XtransConnInfo ciptr)
if( (ciptr->addr=(char *)xalloc(netbuf.len)) == NULL )
{
- PRMSG(1, "TLIGetAddr: Can't allocate space for the addr\n",
- 0,0,0);
+ prmsg(1, "TLIGetAddr: Can't allocate space for the addr\n");
return -1;
}
@@ -196,7 +195,7 @@ TRANS(TLIGetPeerAddr)(XtransConnInfo ciptr)
Xtransaddr sockname;
struct netbuf netbuf;
- PRMSG(3,"TLIGetPeerAddr(%x)\n", ciptr, 0,0 );
+ prmsg(3,"TLIGetPeerAddr(%x)\n", ciptr);
netbuf.buf=(char *)&sockname;
netbuf.len=sizeof(sockname);
@@ -204,13 +203,13 @@ TRANS(TLIGetPeerAddr)(XtransConnInfo ciptr)
if( t_getname(ciptr->fd,&netbuf,REMOTENAME) < 0 )
{
- PRMSG(1,"TLIGetPeerAddr: t_getname(REMOTENAME) failed: %d\n",
- errno, 0,0 );
+ prmsg(1,"TLIGetPeerAddr: t_getname(REMOTENAME) failed: %d\n",
+ errno);
return -1;
}
- PRMSG(4,"TLIGetPeerAddr: got family %d len %d\n",
- ((struct sockaddr *) &sockname)->sa_family ,netbuf.len, 0 );
+ prmsg(4,"TLIGetPeerAddr: got family %d len %d\n",
+ ((struct sockaddr *) &sockname)->sa_family ,netbuf.len);
/*
* Everything looks good: fill in the XtransConnInfo structure.
@@ -221,9 +220,8 @@ TRANS(TLIGetPeerAddr)(XtransConnInfo ciptr)
if( (ciptr->peeraddr=(char *)xalloc(netbuf.len)) == NULL )
{
- PRMSG(1,
- "TLIGetPeerAddr: Can't allocate space for the addr\n",
- 0,0,0);
+ prmsg(1,
+ "TLIGetPeerAddr: Can't allocate space for the addr\n");
return -1;
}
@@ -251,24 +249,22 @@ TRANS(TLITLIBindLocal)(int fd, int family, char *port)
struct sockaddr_un *sunaddr=NULL;
struct t_bind *req=NULL;
- PRMSG(2, "TLITLIBindLocal(%d,%d,%s)\n", fd, family, port);
+ prmsg(2, "TLITLIBindLocal(%d,%d,%s)\n", fd, family, port);
if( family == AF_UNIX )
{
if( (req=(struct t_bind *)t_alloc(fd,T_BIND,0)) == NULL )
{
- PRMSG(1,
- "TLITLIBindLocal() failed to allocate a t_bind\n",
- 0,0,0 );
+ prmsg(1,
+ "TLITLIBindLocal() failed to allocate a t_bind\n");
return -1;
}
if( (sunaddr=(struct sockaddr_un *)
malloc(sizeof(struct sockaddr_un))) == NULL )
{
- PRMSG(1,
- "TLITLIBindLocal: failed to allocate a sockaddr_un\n",
- 0,0,0 );
+ prmsg(1,
+ "TLITLIBindLocal: failed to allocate a sockaddr_un\n");
t_free((char *)req,T_BIND);
return -1;
}
@@ -286,8 +282,8 @@ TRANS(TLITLIBindLocal)(int fd, int family, char *port)
(void) sprintf(sunaddr->sun_path,"%s%d",
TLINODENAME, getpid()^time(NULL) );
- PRMSG(4, "TLITLIBindLocal: binding to %s\n",
- sunaddr->sun_path, 0,0);
+ prmsg(4, "TLITLIBindLocal: binding to %s\n",
+ sunaddr->sun_path);
req->addr.buf=(char *)sunaddr;
req->addr.len=sizeof(*sunaddr);
@@ -296,9 +292,9 @@ TRANS(TLITLIBindLocal)(int fd, int family, char *port)
if( t_bind(fd, req, NULL) < 0 )
{
- PRMSG(1,
+ prmsg(1,
"TLIBindLocal: Unable to bind TLI device to %s\n",
- port, 0,0 );
+ port);
if (sunaddr)
free((char *) sunaddr);
if (req)
@@ -314,17 +310,17 @@ TRANS(TLIOpen)(char *device)
{
XtransConnInfo ciptr;
- PRMSG(3,"TLIOpen(%s)\n", device, 0,0 );
+ prmsg(3,"TLIOpen(%s)\n", device);
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
- PRMSG(1, "TLIOpen: calloc failed\n", 0,0,0 );
+ prmsg(1, "TLIOpen: calloc failed\n");
return NULL;
}
if( (ciptr->fd=t_open( device, O_RDWR, NULL )) < 0 )
{
- PRMSG(1, "TLIOpen: t_open failed for %s\n", device, 0,0 );
+ prmsg(1, "TLIOpen: t_open failed for %s\n", device);
free(ciptr);
return NULL;
}
@@ -341,17 +337,17 @@ TRANS(TLIReopen)(char *device, int fd, char *port)
{
XtransConnInfo ciptr;
- PRMSG(3,"TLIReopen(%s,%d, %s)\n", device, fd, port );
+ prmsg(3,"TLIReopen(%s,%d, %s)\n", device, fd, port );
if (t_sync (fd) < 0)
{
- PRMSG(1, "TLIReopen: t_sync failed\n", 0,0,0 );
+ prmsg(1, "TLIReopen: t_sync failed\n");
return NULL;
}
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
- PRMSG(1, "TLIReopen: calloc failed\n", 0,0,0 );
+ prmsg(1, "TLIReopen: calloc failed\n");
return NULL;
}
@@ -374,7 +370,7 @@ TRANS(TLIAddrToNetbuf)(int tlifamily, char *host, char *port,
void *handlep;
long lport;
- PRMSG(3,"TLIAddrToNetbuf(%d,%s,%s)\n", tlifamily, host, port );
+ prmsg(3,"TLIAddrToNetbuf(%d,%s,%s)\n", tlifamily, host, port );
if( (handlep=setnetconfig()) == NULL )
return -1;
@@ -395,15 +391,14 @@ TRANS(TLIAddrToNetbuf)(int tlifamily, char *host, char *port,
if( strcmp(netconfigp->nc_protofmly,
TLItrans2devtab[tlifamily].protofamily) != 0 )
continue;
- PRMSG(5,"TLIAddrToNetbuf: Trying to resolve %s.%s for %s\n",
+ prmsg(5,"TLIAddrToNetbuf: Trying to resolve %s.%s for %s\n",
host, port, TLItrans2devtab[tlifamily].protofamily );
if( netdir_getbyname(netconfigp,&nd_hostserv, &nd_addrlistp) == 0 )
{
/* we have at least one address to use */
- PRMSG(5, "TLIAddrToNetbuf: found address for %s.%s\n", host, port, 0 );
- PRMSG(5, "TLIAddrToNetbuf: %s\n",taddr2uaddr(netconfigp,nd_addrlistp->n_addrs),
- 0,0 );
+ prmsg(5, "TLIAddrToNetbuf: found address for %s.%s\n", host, port);
+ prmsg(5, "TLIAddrToNetbuf: %s\n",taddr2uaddr(netconfigp,nd_addrlistp->n_addrs));
memcpy(netbufp->buf,nd_addrlistp->n_addrs->buf,
nd_addrlistp->n_addrs->len);
@@ -431,27 +426,27 @@ TRANS(TLIOpenCOTSClient)(Xtransport *thistrans, char *protocol,
XtransConnInfo ciptr;
int i;
- PRMSG(2,"TLIOpenCOTSClient(%s,%s,%s)\n", protocol, host, port );
+ prmsg(2,"TLIOpenCOTSClient(%s,%s,%s)\n", protocol, host, port );
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
- PRMSG(1,"TLIOpenCOTSClient: Unable to determine device for %s\n",
- thistrans->TransName, 0,0 );
+ prmsg(1,"TLIOpenCOTSClient: Unable to determine device for %s\n",
+ thistrans->TransName);
return NULL;
}
if( (ciptr=TRANS(TLIOpen)(TLItrans2devtab[i].devcotsname)) == NULL )
{
- PRMSG(1,"TLIOpenCOTSClient: Unable to open device for %s\n",
- thistrans->TransName, 0,0 );
+ prmsg(1,"TLIOpenCOTSClient: Unable to open device for %s\n",
+ thistrans->TransName);
return NULL;
}
if( TRANS(TLITLIBindLocal)(ciptr->fd,TLItrans2devtab[i].family,port) < 0 )
{
- PRMSG(1,
+ prmsg(1,
"TLIOpenCOTSClient: ...TLITLIBindLocal() failed: %d\n",
- errno, 0,0 );
+ errno);
t_close(ciptr->fd);
xfree(ciptr);
return NULL;
@@ -459,9 +454,9 @@ TRANS(TLIOpenCOTSClient)(Xtransport *thistrans, char *protocol,
if( TRANS(TLIGetAddr)(ciptr) < 0 )
{
- PRMSG(1,
+ prmsg(1,
"TLIOpenCOTSClient: ...TLIGetAddr() failed: %d\n",
- errno, 0,0 );
+ errno);
t_close(ciptr->fd);
xfree(ciptr);
return NULL;
@@ -486,21 +481,21 @@ TRANS(TLIOpenCOTSServer)(Xtransport *thistrans, char *protocol,
XtransConnInfo ciptr;
int i;
- PRMSG(2,"TLIOpenCOTSServer(%s,%s,%s)\n", protocol, host, port );
+ prmsg(2,"TLIOpenCOTSServer(%s,%s,%s)\n", protocol, host, port );
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
- PRMSG(1,
+ prmsg(1,
"TLIOpenCOTSServer: Unable to determine device for %s\n",
- thistrans->TransName, 0,0 );
+ thistrans->TransName);
return NULL;
}
if( (ciptr=TRANS(TLIOpen)(TLItrans2devtab[i].devcotsname)) == NULL )
{
- PRMSG(1,
+ prmsg(1,
"TLIOpenCOTSServer: Unable to open device for %s\n",
- thistrans->TransName, 0,0 );
+ thistrans->TransName);
return NULL;
}
@@ -529,29 +524,29 @@ TRANS(TLIOpenCLTSClient)(Xtransport *thistrans, char *protocol,
XtransConnInfo ciptr;
int i;
- PRMSG(2,"TLIOpenCLTSClient(%s,%s,%s)\n", protocol, host, port );
+ prmsg(2,"TLIOpenCLTSClient(%s,%s,%s)\n", protocol, host, port );
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
- PRMSG(1,
+ prmsg(1,
"TLIOpenCLTSClient: Unable to determine device for %s\n",
- thistrans->TransName, 0,0 );
+ thistrans->TransName);
return NULL;
}
if( (ciptr=TRANS(TLIOpen)(TLItrans2devtab[i].devcltsname)) == NULL )
{
- PRMSG(1,
+ prmsg(1,
"TLIOpenCLTSClient: Unable to open device for %s\n",
- thistrans->TransName, 0,0 );
+ thistrans->TransName);
return NULL;
}
if( TRANS(TLITLIBindLocal)(ciptr->fd,TLItrans2devtab[i].family,port) < 0 )
{
- PRMSG(1,
+ prmsg(1,
"TLIOpenCLTSClient: ...TLITLIBindLocal() failed: %d\n",
- errno, 0,0 );
+ errno);
t_close(ciptr->fd);
xfree(ciptr);
return NULL;
@@ -559,9 +554,9 @@ TRANS(TLIOpenCLTSClient)(Xtransport *thistrans, char *protocol,
if( TRANS(TLIGetAddr)(ciptr) < 0 )
{
- PRMSG(1,
+ prmsg(1,
"TLIOpenCLTSClient: ...TLIGetPeerAddr() failed: %d\n",
- errno, 0,0 );
+ errno);
t_close(ciptr->fd);
xfree(ciptr);
return NULL;
@@ -583,21 +578,21 @@ TRANS(TLIOpenCLTSServer)(Xtransport *thistrans, char *protocol,
XtransConnInfo ciptr;
int i;
- PRMSG(2,"TLIOpenCLTSServer(%s,%s,%s)\n", protocol, host, port );
+ prmsg(2,"TLIOpenCLTSServer(%s,%s,%s)\n", protocol, host, port );
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
- PRMSG(1,
+ prmsg(1,
"TLIOpenCLTSServer: Unable to determine device for %s\n",
- thistrans->TransName, 0,0 );
+ thistrans->TransName);
return NULL;
}
if( (ciptr=TRANS(TLIOpen)(TLItrans2devtab[i].devcltsname)) == NULL )
{
- PRMSG(1,
+ prmsg(1,
"TLIOpenCLTSServer: Unable to open device for %s\n",
- thistrans->TransName, 0,0 );
+ thistrans->TransName);
return NULL;
}
@@ -616,22 +611,22 @@ TRANS(TLIReopenCOTSServer)(Xtransport *thistrans, int fd, char *port)
XtransConnInfo ciptr;
int i;
- PRMSG(2,"TLIReopenCOTSServer(%d, %s)\n", fd, port, 0 );
+ prmsg(2,"TLIReopenCOTSServer(%d, %s)\n", fd, port);
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
- PRMSG(1,
+ prmsg(1,
"TLIReopenCOTSServer: Unable to determine device for %s\n",
- thistrans->TransName, 0,0 );
+ thistrans->TransName);
return NULL;
}
if( (ciptr=TRANS(TLIReopen)(
TLItrans2devtab[i].devcotsname, fd, port)) == NULL )
{
- PRMSG(1,
+ prmsg(1,
"TLIReopenCOTSServer: Unable to open device for %s\n",
- thistrans->TransName, 0,0 );
+ thistrans->TransName);
return NULL;
}
@@ -650,22 +645,22 @@ TRANS(TLIReopenCLTSServer)(Xtransport *thistrans, int fd, char *port)
XtransConnInfo ciptr;
int i;
- PRMSG(2,"TLIReopenCLTSServer(%d, %s)\n", fd, port, 0 );
+ prmsg(2,"TLIReopenCLTSServer(%d, %s)\n", fd, port);
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
- PRMSG(1,
+ prmsg(1,
"TLIReopenCLTSServer: Unable to determine device for %s\n",
- thistrans->TransName, 0,0 );
+ thistrans->TransName);
return NULL;
}
if( (ciptr=TRANS(TLIReopen)(
TLItrans2devtab[i].devcltsname, fd, port)) == NULL )
{
- PRMSG(1,
+ prmsg(1,
"TLIReopenCLTSServer: Unable to open device for %s\n",
- thistrans->TransName, 0,0 );
+ thistrans->TransName);
return NULL;
}
@@ -681,7 +676,7 @@ static int
TRANS(TLISetOption)(XtransConnInfo ciptr, int option, int arg)
{
- PRMSG(2,"TLISetOption(%d,%d,%d)\n", ciptr->fd, option, arg );
+ prmsg(2,"TLISetOption(%d,%d,%d)\n", ciptr->fd, option, arg );
return -1;
}
@@ -695,19 +690,18 @@ TRANS(TLICreateListener)(XtransConnInfo ciptr, struct t_bind *req)
{
struct t_bind *ret;
- PRMSG(2,"TLICreateListener(%x->%d,%x)\n", ciptr, ciptr->fd, req );
+ prmsg(2,"TLICreateListener(%x->%d,%x)\n", ciptr, ciptr->fd, req );
if( (ret=(struct t_bind *)t_alloc(ciptr->fd,T_BIND,T_ALL)) == NULL )
{
- PRMSG(1, "TLICreateListener: failed to allocate a t_bind\n",
- 0,0,0 );
+ prmsg(1, "TLICreateListener: failed to allocate a t_bind\n");
t_free((char *)req,T_BIND);
return TRANS_CREATE_LISTENER_FAILED;
}
if( t_bind(ciptr->fd, req, ret) < 0 )
{
- PRMSG(1, "TLICreateListener: t_bind failed\n", 0,0,0 );
+ prmsg(1, "TLICreateListener: t_bind failed\n");
t_free((char *)req,T_BIND);
t_free((char *)ret,T_BIND);
return TRANS_CREATE_LISTENER_FAILED;
@@ -715,8 +709,8 @@ TRANS(TLICreateListener)(XtransConnInfo ciptr, struct t_bind *req)
if( memcmp(req->addr.buf,ret->addr.buf,req->addr.len) != 0 )
{
- PRMSG(1, "TLICreateListener: unable to bind to %x\n",
- req, 0,0 );
+ prmsg(1, "TLICreateListener: unable to bind to %x\n",
+ req);
t_free((char *)req,T_BIND);
t_free((char *)ret,T_BIND);
return TRANS_ADDR_IN_USE;
@@ -728,9 +722,8 @@ TRANS(TLICreateListener)(XtransConnInfo ciptr, struct t_bind *req)
if( (ciptr->addr=(char *)xalloc(ret->addr.len)) == NULL )
{
- PRMSG(1,
- "TLICreateListener: Unable to allocate space for the address\n",
- 0,0,0 );
+ prmsg(1,
+ "TLICreateListener: Unable to allocate space for the address\n");
t_free((char *)req,T_BIND);
t_free((char *)ret, T_BIND);
return TRANS_CREATE_LISTENER_FAILED;
@@ -755,7 +748,7 @@ TRANS(TLIINETCreateListener)(XtransConnInfo ciptr, char *port, unsigned int flag
struct sockaddr_in *sinaddr;
long tmpport;
- PRMSG(2,"TLIINETCreateListener(%x->%d,%s)\n", ciptr,
+ prmsg(2,"TLIINETCreateListener(%x->%d,%s)\n", ciptr,
ciptr->fd, port ? port : "NULL" );
#ifdef X11_t
@@ -778,18 +771,17 @@ TRANS(TLIINETCreateListener)(XtransConnInfo ciptr, char *port, unsigned int flag
if( (req=(struct t_bind *)t_alloc(ciptr->fd,T_BIND,T_ALL)) == NULL )
{
- PRMSG(1,
- "TLIINETCreateListener: failed to allocate a t_bind\n",
- 0,0,0 );
+ prmsg(1,
+ "TLIINETCreateListener: failed to allocate a t_bind\n");
return TRANS_CREATE_LISTENER_FAILED;
}
if( port && *port ) {
if(TRANS(TLIAddrToNetbuf)(ciptr->index,HOST_SELF,port,&(req->addr)) < 0)
{
- PRMSG(1,
+ prmsg(1,
"TLIINETCreateListener: can't resolve name:HOST_SELF.%s\n",
- port, 0,0 );
+ port);
t_free((char *)req,T_BIND);
return TRANS_CREATE_LISTENER_FAILED;
}
@@ -816,23 +808,21 @@ TRANS(TLITLICreateListener)(XtransConnInfo ciptr, char *port, unsigned int flags
struct sockaddr_un *sunaddr;
int ret_value;
- PRMSG(2,"TLITLICreateListener(%x->%d,%s)\n", ciptr, ciptr->fd,
+ prmsg(2,"TLITLICreateListener(%x->%d,%s)\n", ciptr, ciptr->fd,
port ? port : "NULL");
if( (req=(struct t_bind *)t_alloc(ciptr->fd,T_BIND,0)) == NULL )
{
- PRMSG(1,
- "TLITLICreateListener: failed to allocate a t_bind\n",
- 0,0,0 );
+ prmsg(1,
+ "TLITLICreateListener: failed to allocate a t_bind\n");
return TRANS_CREATE_LISTENER_FAILED;
}
if( (sunaddr=(struct sockaddr_un *)
malloc(sizeof(struct sockaddr_un))) == NULL )
{
- PRMSG(1,
- "TLITLICreateListener: failed to allocate a sockaddr_un\n",
- 0,0,0 );
+ prmsg(1,
+ "TLITLICreateListener: failed to allocate a sockaddr_un\n");
t_free((char *)req,T_BIND);
return TRANS_CREATE_LISTENER_FAILED;
}
@@ -872,11 +862,11 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
XtransConnInfo newciptr;
int i;
- PRMSG(2,"TLIAccept(%x->%d)\n", ciptr, ciptr->fd, 0 );
+ prmsg(2,"TLIAccept(%x->%d)\n", ciptr, ciptr->fd);
if( (call=(struct t_call *)t_alloc(ciptr->fd,T_CALL,T_ALL)) == NULL )
{
- PRMSG(1, "TLIAccept() failed to allocate a t_call\n", 0,0,0 );
+ prmsg(1, "TLIAccept() failed to allocate a t_call\n");
*status = TRANS_ACCEPT_BAD_MALLOC;
return NULL;
}
@@ -885,8 +875,8 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
{
extern char *t_errlist[];
extern int t_errno;
- PRMSG(1, "TLIAccept() t_listen() failed\n", 0,0,0 );
- PRMSG(1, "TLIAccept: %s\n", t_errlist[t_errno], 0,0 );
+ prmsg(1, "TLIAccept() t_listen() failed\n");
+ prmsg(1, "TLIAccept: %s\n", t_errlist[t_errno]);
t_free((char *)call,T_CALL);
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
@@ -900,7 +890,7 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
if( (newciptr=TRANS(TLIOpen)(TLItrans2devtab[i].devcotsname)) == NULL )
{
- PRMSG(1, "TLIAccept() failed to open a new endpoint\n", 0,0,0 );
+ prmsg(1, "TLIAccept() failed to open a new endpoint\n");
t_free((char *)call,T_CALL);
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
@@ -908,9 +898,9 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
if( TRANS(TLITLIBindLocal)(newciptr->fd,TLItrans2devtab[i].family,"") < 0 )
{
- PRMSG(1,
+ prmsg(1,
"TLIAccept: TRANS(TLITLIBindLocal)() failed: %d\n",
- errno, 0,0 );
+ errno);
t_free((char *)call,T_CALL);
t_close(newciptr->fd);
xfree(newciptr);
@@ -923,19 +913,19 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
{
extern char *t_errlist[];
extern int t_errno;
- PRMSG(1, "TLIAccept() t_accept() failed\n", 0,0,0 );
- PRMSG(1, "TLIAccept: %s\n", t_errlist[t_errno], 0,0 );
+ prmsg(1, "TLIAccept() t_accept() failed\n");
+ prmsg(1, "TLIAccept: %s\n", t_errlist[t_errno]);
if( t_errno == TLOOK )
{
int evtype = t_look(ciptr->fd);
- PRMSG(1, "TLIAccept() t_look() returned %d\n", evtype,0,0 );
+ prmsg(1, "TLIAccept() t_look() returned %d\n", evtype);
switch( evtype )
{
case T_DISCONNECT:
if( t_rcvdis(ciptr->fd, NULL) < 0 )
{
- PRMSG(1, "TLIAccept() t_rcvdis() failed\n", 0,0,0 );
- PRMSG(1, "TLIAccept: %s\n", t_errlist[t_errno], 0,0 );
+ prmsg(1, "TLIAccept() t_rcvdis() failed\n");
+ prmsg(1, "TLIAccept: %s\n", t_errlist[t_errno]);
}
break;
default:
@@ -953,9 +943,9 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
if( TRANS(TLIGetAddr)(newciptr) < 0 )
{
- PRMSG(1,
+ prmsg(1,
"TLIAccept: TRANS(TLIGetPeerAddr)() failed: %d\n",
- errno, 0,0 );
+ errno);
t_close(newciptr->fd);
xfree(newciptr);
*status = TRANS_ACCEPT_MISC_ERROR;
@@ -964,9 +954,9 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
if( TRANS(TLIGetPeerAddr)(newciptr) < 0 )
{
- PRMSG(1,
+ prmsg(1,
"TLIAccept: TRANS(TLIGetPeerAddr)() failed: %d\n",
- errno, 0,0 );
+ errno);
t_close(newciptr->fd);
xfree(newciptr->addr);
xfree(newciptr);
@@ -976,8 +966,8 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
if( ioctl(newciptr->fd, I_POP,"timod") < 0 )
{
- PRMSG(1, "TLIAccept() ioctl(I_POP, \"timod\") failed %d\n",
- errno,0,0 );
+ prmsg(1, "TLIAccept() ioctl(I_POP, \"timod\") failed %d\n",
+ errno);
t_close(newciptr->fd);
xfree(newciptr->addr);
xfree(newciptr);
@@ -987,8 +977,8 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
if( ioctl(newciptr->fd, I_PUSH,"tirdwr") < 0 )
{
- PRMSG(1, "TLIAccept() ioctl(I_PUSH,\"tirdwr\") failed %d\n",
- errno,0,0 );
+ prmsg(1, "TLIAccept() ioctl(I_PUSH,\"tirdwr\") failed %d\n",
+ errno);
t_close(newciptr->fd);
xfree(newciptr->addr);
xfree(newciptr);
@@ -1010,14 +1000,14 @@ static int
TRANS(TLIConnect)(XtransConnInfo ciptr, struct t_call *sndcall )
{
- PRMSG(2, "TLIConnect(%x->%d,%x)\n", ciptr, ciptr->fd, sndcall);
+ prmsg(2, "TLIConnect(%x->%d,%x)\n", ciptr, ciptr->fd, sndcall);
if( t_connect(ciptr->fd,sndcall,NULL) < 0 )
{
extern char *t_errlist[];
extern int t_errno;
- PRMSG(1, "TLIConnect() t_connect() failed\n", 0,0,0 );
- PRMSG(1, "TLIConnect: %s\n", t_errlist[t_errno], 0,0 );
+ prmsg(1, "TLIConnect() t_connect() failed\n");
+ prmsg(1, "TLIConnect: %s\n", t_errlist[t_errno]);
t_free((char *)sndcall,T_CALL);
if (t_errno == TLOOK && t_look(ciptr->fd) == T_DISCONNECT)
{
@@ -1036,31 +1026,31 @@ TRANS(TLIConnect)(XtransConnInfo ciptr, struct t_call *sndcall )
if( TRANS(TLIGetAddr)(ciptr) < 0 )
{
- PRMSG(1,
+ prmsg(1,
"TLIConnect: ...TLIGetAddr() failed: %d\n",
- errno, 0,0 );
+ errno);
return TRANS_CONNECT_FAILED;
}
if( TRANS(TLIGetPeerAddr)(ciptr) < 0 )
{
- PRMSG(1,
+ prmsg(1,
"TLIConnect: ...TLIGetPeerAddr() failed: %d\n",
- errno, 0,0 );
+ errno);
return TRANS_CONNECT_FAILED;
}
if( ioctl(ciptr->fd, I_POP,"timod") < 0 )
{
- PRMSG(1, "TLIConnect() ioctl(I_POP,\"timod\") failed %d\n",
- errno,0,0 );
+ prmsg(1, "TLIConnect() ioctl(I_POP,\"timod\") failed %d\n",
+ errno);
return TRANS_CONNECT_FAILED;
}
if( ioctl(ciptr->fd, I_PUSH,"tirdwr") < 0 )
{
- PRMSG(1, "TLIConnect() ioctl(I_PUSH,\"tirdwr\") failed %d\n",
- errno,0,0 );
+ prmsg(1, "TLIConnect() ioctl(I_PUSH,\"tirdwr\") failed %d\n",
+ errno);
return TRANS_CONNECT_FAILED;
}
@@ -1076,7 +1066,7 @@ TRANS(TLIINETConnect)(XtransConnInfo ciptr, char *host, char *port)
struct t_call *sndcall;
long tmpport;
- PRMSG(2, "TLIINETConnect(%s,%s)\n", host, port, 0);
+ prmsg(2, "TLIINETConnect(%s,%s)\n", host, port);
#ifdef X11_t
/*
@@ -1098,14 +1088,14 @@ TRANS(TLIINETConnect)(XtransConnInfo ciptr, char *host, char *port)
if( (sndcall=(struct t_call *)t_alloc(ciptr->fd,T_CALL,T_ALL)) == NULL )
{
- PRMSG(1, "TLIINETConnect() failed to allocate a t_call\n", 0,0,0 );
+ prmsg(1, "TLIINETConnect() failed to allocate a t_call\n");
return TRANS_CONNECT_FAILED;
}
if( TRANS(TLIAddrToNetbuf)(ciptr->index, host, port, &(sndcall->addr) ) < 0 )
{
- PRMSG(1, "TLIINETConnect() unable to resolve name:%s.%s\n",
- host, port, 0 );
+ prmsg(1, "TLIINETConnect() unable to resolve name:%s.%s\n",
+ host, port);
t_free((char *)sndcall,T_CALL);
return TRANS_CONNECT_FAILED;
}
@@ -1122,20 +1112,19 @@ TRANS(TLITLIConnect)(XtransConnInfo ciptr, char *host, char *port)
struct sockaddr_un *sunaddr;
int ret_value;
- PRMSG(2, "TLITLIConnect(%s,%s)\n", host, port, 0);
+ prmsg(2, "TLITLIConnect(%s,%s)\n", host, port);
if( (sndcall=(struct t_call *)t_alloc(ciptr->fd,T_CALL,T_OPT|T_UDATA)) == NULL )
{
- PRMSG(1, "TLITLIConnect() failed to allocate a t_call\n", 0,0,0 );
+ prmsg(1, "TLITLIConnect() failed to allocate a t_call\n");
return TRANS_CONNECT_FAILED;
}
if( (sunaddr=(struct sockaddr_un *)
malloc(sizeof(struct sockaddr_un))) == NULL )
{
- PRMSG(1,
- "TLITLIConnect: failed to allocate a sockaddr_un\n",
- 0,0,0 );
+ prmsg(1,
+ "TLITLIConnect: failed to allocate a sockaddr_un\n");
t_free((char *)sndcall,T_CALL);
return TRANS_CONNECT_FAILED;
}
@@ -1170,7 +1159,7 @@ TRANS(TLIBytesReadable)(XtransConnInfo ciptr, BytesReadable_t *pend)
int ret;
struct pollfd filedes;
- PRMSG(2, "TLIByteReadable(%x->%d,%x)\n", ciptr, ciptr->fd, pend );
+ prmsg(2, "TLIByteReadable(%x->%d,%x)\n", ciptr, ciptr->fd, pend );
/*
* This function should detect hangup conditions. Use poll to check
@@ -1212,7 +1201,7 @@ static int
TRANS(TLIRead)(XtransConnInfo ciptr, char *buf, int size)
{
- PRMSG(2, "TLIRead(%d,%x,%d)\n", ciptr->fd, buf, size );
+ prmsg(2, "TLIRead(%d,%x,%d)\n", ciptr->fd, buf, size );
return read(ciptr->fd,buf,size);
}
@@ -1222,7 +1211,7 @@ static int
TRANS(TLIWrite)(XtransConnInfo ciptr, char *buf, int size)
{
- PRMSG(2, "TLIWrite(%d,%x,%d)\n", ciptr->fd, buf, size );
+ prmsg(2, "TLIWrite(%d,%x,%d)\n", ciptr->fd, buf, size );
return write(ciptr->fd,buf,size);
}
@@ -1232,7 +1221,7 @@ static int
TRANS(TLIReadv)(XtransConnInfo ciptr, struct iovec *buf, int size)
{
- PRMSG(2, "TLIReadv(%d,%x,%d)\n", ciptr->fd, buf, size );
+ prmsg(2, "TLIReadv(%d,%x,%d)\n", ciptr->fd, buf, size );
return READV(ciptr,buf,size);
}
@@ -1242,7 +1231,7 @@ static int
TRANS(TLIWritev)(XtransConnInfo ciptr, struct iovec *buf, int size)
{
- PRMSG(2, "TLIWritev(%d,%x,%d)\n", ciptr->fd, buf, size );
+ prmsg(2, "TLIWritev(%d,%x,%d)\n", ciptr->fd, buf, size );
return WRITEV(ciptr,buf,size);
}
@@ -1252,7 +1241,7 @@ static int
TRANS(TLIDisconnect)(XtransConnInfo ciptr)
{
- PRMSG(2, "TLIDisconnect(%x->%d)\n", ciptr, ciptr->fd, 0 );
+ prmsg(2, "TLIDisconnect(%x->%d)\n", ciptr, ciptr->fd);
/*
* Restore the TLI modules so that the connection can be properly shutdown.
@@ -1272,7 +1261,7 @@ static int
TRANS(TLIClose)(XtransConnInfo ciptr)
{
- PRMSG(2, "TLIClose(%x->%d)\n", ciptr, ciptr->fd, 0 );
+ prmsg(2, "TLIClose(%x->%d)\n", ciptr, ciptr->fd);
t_unbind(ciptr->fd);
@@ -1288,7 +1277,7 @@ TRANS(TLICloseForCloning)(XtransConnInfo ciptr)
* Don't unbind.
*/
- PRMSG(2, "TLICloseForCloning(%x->%d)\n", ciptr, ciptr->fd, 0 );
+ prmsg(2, "TLICloseForCloning(%x->%d)\n", ciptr, ciptr->fd);
return (t_close(ciptr->fd));
}
diff --git a/X11/xtrans/Xtransutil.c b/X11/xtrans/Xtransutil.c
index 56f01583a..5dd245307 100644
--- a/X11/xtrans/Xtransutil.c
+++ b/X11/xtrans/Xtransutil.c
@@ -91,7 +91,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
{
- PRMSG(2,"ConvertAddress(%d,%d,%x)\n",*familyp,*addrlenp,*addrp);
+ prmsg(2,"ConvertAddress(%d,%d,%p)\n",*familyp,*addrlenp,*addrp);
switch( *familyp )
{
@@ -178,8 +178,8 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
#endif
default:
- PRMSG(1,"ConvertAddress: Unknown family type %d\n",
- *familyp, 0,0 );
+ prmsg(1,"ConvertAddress: Unknown family type %d\n",
+ *familyp);
return -1;
}
@@ -242,7 +242,7 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr)
char *addr = ciptr->addr;
char hostnamebuf[256];
char *networkId = NULL;
- char *transName = ciptr->transptr->TransName;
+ const char *transName = ciptr->transptr->TransName;
if (gethostname (hostnamebuf, sizeof (hostnamebuf)) < 0)
{
@@ -316,7 +316,7 @@ int
void
#endif
#endif
-nameserver_lost(int sig)
+nameserver_lost(int sig _X_UNUSED)
{
nameserver_timedout = 1;
longjmp (env, -1);
@@ -437,7 +437,7 @@ TRANS(WSAStartup) (void)
{
static WSADATA wsadata;
- PRMSG (2,"WSAStartup()\n", 0, 0, 0);
+ prmsg (2,"WSAStartup()\n");
if (!wsadata.wVersion && WSAStartup(MAKEWORD(2,2), &wsadata))
return 1;
@@ -485,8 +485,8 @@ trans_mkdir(const char *path, int mode)
if (lstat(path, &buf) != 0) {
if (errno != ENOENT) {
- PRMSG(1, "mkdir: ERROR: (l)stat failed for %s (%d)\n",
- path, errno, 0);
+ prmsg(1, "mkdir: ERROR: (l)stat failed for %s (%d)\n",
+ path, errno);
return -1;
}
/* Dir doesn't exist. Try to create it */
@@ -499,15 +499,15 @@ trans_mkdir(const char *path, int mode)
*/
if (geteuid() != 0) {
if (mode & 01000) {
- PRMSG(1, "mkdir: ERROR: euid != 0,"
+ prmsg(1, "mkdir: ERROR: euid != 0,"
"directory %s will not be created.\n",
- path, 0, 0);
+ path);
#ifdef FAIL_HARD
return -1;
#endif
} else {
- PRMSG(1, "mkdir: Cannot create %s with root ownership\n",
- path, 0, 0);
+ prmsg(1, "mkdir: Cannot create %s with root ownership\n",
+ path);
}
}
#endif
@@ -515,8 +515,8 @@ trans_mkdir(const char *path, int mode)
#ifndef WIN32
if (mkdir(path, mode) == 0) {
if (chmod(path, mode)) {
- PRMSG(1, "mkdir: ERROR: Mode of %s should be set to %04o\n",
- path, mode, 0);
+ prmsg(1, "mkdir: ERROR: Mode of %s should be set to %04o\n",
+ path, mode);
#ifdef FAIL_HARD
return -1;
#endif
@@ -525,8 +525,8 @@ trans_mkdir(const char *path, int mode)
if (mkdir(path) == 0) {
#endif
} else {
- PRMSG(1, "mkdir: ERROR: Cannot create %s\n",
- path, 0, 0);
+ prmsg(1, "mkdir: ERROR: Cannot create %s\n",
+ path);
return -1;
}
@@ -584,8 +584,8 @@ trans_mkdir(const char *path, int mode)
struct stat fbuf;
if ((fd = open(path, O_RDONLY)) != -1) {
if (fstat(fd, &fbuf) == -1) {
- PRMSG(1, "mkdir: ERROR: fstat failed for %s (%d)\n",
- path, errno, 0);
+ prmsg(1, "mkdir: ERROR: fstat failed for %s (%d)\n",
+ path, errno);
return -1;
}
/*
@@ -595,8 +595,8 @@ trans_mkdir(const char *path, int mode)
if (!S_ISDIR(fbuf.st_mode) ||
buf.st_dev != fbuf.st_dev ||
buf.st_ino != fbuf.st_ino) {
- PRMSG(1, "mkdir: ERROR: inode for %s changed\n",
- path, 0, 0);
+ prmsg(1, "mkdir: ERROR: inode for %s changed\n",
+ path);
return -1;
}
if (updateOwner && fchown(fd, 0, 0) == 0)
@@ -611,30 +611,29 @@ trans_mkdir(const char *path, int mode)
if (updateOwner && !updatedOwner) {
#ifdef FAIL_HARD
if (status & FAIL_IF_NOT_ROOT) {
- PRMSG(1, "mkdir: ERROR: Owner of %s must be set to root\n",
- path, 0, 0);
+ prmsg(1, "mkdir: ERROR: Owner of %s must be set to root\n",
+ path);
return -1;
}
#endif
#if !defined(__APPLE_CC__) && !defined(__CYGWIN__)
- PRMSG(1, "mkdir: Owner of %s should be set to root\n",
- path, 0, 0);
+ prmsg(1, "mkdir: Owner of %s should be set to root\n",
+ path);
#endif
}
if (updateMode && !updatedMode) {
#ifdef FAIL_HARD
if (status & FAIL_IF_NOMODE) {
- PRMSG(1, "mkdir: ERROR: Mode of %s must be set to %04o\n",
- path, mode, 0);
+ prmsg(1, "mkdir: ERROR: Mode of %s must be set to %04o\n",
+ path, mode);
return -1;
}
#endif
- PRMSG(1, "mkdir: Mode of %s should be set to %04o\n",
- path, mode, 0);
+ prmsg(1, "mkdir: Mode of %s should be set to %04o\n",
+ path, mode);
if (status & WARN_NO_ACCESS) {
- PRMSG(1, "mkdir: this may cause subsequent errors\n",
- 0, 0, 0);
+ prmsg(1, "mkdir: this may cause subsequent errors\n");
}
}
return 0;
diff --git a/X11/xtrans/doc/xtrans.xml b/X11/xtrans/doc/xtrans.xml
index 5b01b89be..82e95a408 100644
--- a/X11/xtrans/doc/xtrans.xml
+++ b/X11/xtrans/doc/xtrans.xml
@@ -103,7 +103,7 @@ for client vs. server code.
</para></note>
</preface>
-<chapter id='purposes_and_goals'>
+<chapter id='Purposes_and_Goals'>
<title>Purposes and Goals</title>
<para>The X Transport Interface is intended to combine all system and
@@ -121,7 +121,7 @@ FS, and connection-less oriented protocols such as XDMCP.</para>
</chapter>
-<chapter id='overview_of_the_interface'>
+<chapter id='Overview_of_the_Interface'>
<title>Overview of the Interface</title>
<para>
@@ -142,7 +142,7 @@ an interface would affect performance.
</para>
</chapter>
-<chapter id='definition_of_address_specification_format'>
+<chapter id='Definition_of_Address_Specification_Format'>
<title>Definition of Address Specification Format</title>
<para>
@@ -169,14 +169,14 @@ part of an address.
</para>
</chapter>
-<chapter id='internal_data_structures'>
+<chapter id='Internal_Data_Structures'>
<title>Internal Data Structures</title>
<para>
There are two major data structures associated with the transport
independent portion of this interface. Additional data structures
may be used internally by each transport.
</para>
-<sect1 id="xtransport">
+<sect1 id='Xtransport'>
<title>Xtransport</title>
<para>
Each transport supported has an entry in the transport table. The transport
@@ -337,7 +337,7 @@ should not be unlinked.
</para>
</sect1>
-<sect1 id="xtransconninfo">
+<sect1 id='XtransConnInfo'>
<title>XtransConnInfo</title>
<para>
Each connection will have an opaque <structname>XtransConnInfo</structname>
@@ -364,7 +364,7 @@ struct _XtransConnInfo {
</sect1>
</chapter>
-<chapter id='exposed_transport_independent_api'>
+<chapter id='Exposed_Transport_Independent_API'>
<title>Exposed Transport Independent API</title>
<para>
@@ -385,7 +385,7 @@ All failures are considered fatal, and the connection should be closed
and re-established if desired. In most cases, however, the value of
errno will be available for debugging purposes.
</para>
-<sect1 id="core_interface_api">
+<sect1 id='Core_Interface_API'>
<title>Core Interface API</title>
<itemizedlist mark='bullet'>
<listitem>
@@ -659,7 +659,7 @@ is the list of transports.
</itemizedlist>
</sect1>
-<sect1 id="utility_api">
+<sect1 id='Utility_API'>
<title>Utility API</title>
<para>
This section describes a few useful functions that have been implemented on
@@ -681,7 +681,7 @@ FamilyLocal)).
</sect1>
</chapter>
-<chapter id="transport_option_definition">
+<chapter id='Transport_Option_Definition'>
<title>Transport Option Definition</title>
<para>
The following options are defined for the
@@ -715,7 +715,7 @@ connection will not be closed when an exec occurs.
</itemizedlist>
</chapter>
-<chapter id="hidden_transport_dependent_api">
+<chapter id='Hidden_Transport_Dependent_API'>
<title>Hidden Transport Dependent API</title>
<para>
The hidden transport dependent functions are placed in the Xtransport record.
@@ -935,7 +935,7 @@ This function will break the connection, and close the endpoint.
</listitem>
</itemizedlist>
</chapter>
-<chapter id="configuration">
+<chapter id='Configuration'>
<title>Configuration</title>
<para>
@@ -1018,7 +1018,7 @@ In X11R7 modular releases, these flags are set when running
</chapter>
-<chapter id="transport_specific_definitions">
+<chapter id='Transport_Specific_Definitions'>
<title>Transport Specific Definitions</title>
<informaltable pgwide='0' frame='none'>
@@ -1075,7 +1075,7 @@ In X11R7 modular releases, these flags are set when running
</chapter>
-<chapter id="implementation_notes">
+<chapter id='Implementation_Notes'>
<title>Implementation Notes</title>
<para>
This section refers to the prototype implementation that is being developed
diff --git a/X11/xtrans/transport.c b/X11/xtrans/transport.c
index 0013b01d8..c14057dd3 100644
--- a/X11/xtrans/transport.c
+++ b/X11/xtrans/transport.c
@@ -53,6 +53,9 @@ from The Open Group.
#define xrealloc(_ptr,_size) realloc(_ptr,_size)
#define xfree(_ptr) free(_ptr)
+#define XTRANS_TRANSPORT_C /* used to flag Xtransint.h that it's being used
+ here, not just #included in another file */
+
#include "Xtransint.h"
#ifdef __clang__