diff options
-rw-r--r-- | Xtrans.c | 128 | ||||
-rw-r--r-- | Xtransint.h | 100 | ||||
-rw-r--r-- | Xtranslcl.c | 306 | ||||
-rw-r--r-- | Xtranssock.c | 304 | ||||
-rw-r--r-- | Xtranstli.c | 283 | ||||
-rw-r--r-- | Xtransutil.c | 55 |
6 files changed, 569 insertions, 607 deletions
@@ -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); @@ -156,7 +156,7 @@ TRANS(SelectTransport) (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 @@ -207,7 +207,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **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 +404,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 +418,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 +426,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 +460,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 +503,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 +516,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 +542,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 +573,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 +586,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 +599,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 +612,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 +625,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 +633,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 +673,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. @@ -767,8 +767,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 +801,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 +825,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 +840,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 +907,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 +922,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 +944,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 +964,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 +1040,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 +1067,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 +1096,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 +1109,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 +1122,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 +1132,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 +1164,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 +1179,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 +1200,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 +1213,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/Xtransint.h b/Xtransint.h index 47d98ba..bfd79d6 100644 --- a/Xtransint.h +++ b/Xtransint.h @@ -374,55 +374,61 @@ 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 */ diff --git a/Xtranslcl.c b/Xtranslcl.c index b95a341..24c43e5 100644 --- a/Xtranslcl.c +++ b/Xtranslcl.c @@ -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; } @@ -315,10 +314,10 @@ 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 ) { @@ -337,7 +336,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 +346,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 +357,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 +390,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 +424,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 +436,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 +461,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 +483,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 +495,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 +507,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 +515,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 +546,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 +566,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 +584,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 +599,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 +612,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 +622,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 +665,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 +682,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 +701,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 +712,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,7 +732,7 @@ TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, char *port) static int TRANS(NAMEDOpenPipe)(const char *server_path) { - PRMSG(2,"NAMEDOpenPipe(%s)\n", server_path, 0,0 ); + prmsg(2,"NAMEDOpenPipe(%s)\n", server_path); int fd, pipefd[2]; struct stat sbuf; @@ -748,42 +744,42 @@ TRANS(NAMEDOpenPipe)(const char *server_path) 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 +797,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 +826,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; } @@ -848,7 +844,7 @@ TRANS(NAMEDResetListener) (XtransConnInfo ciptr) 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 +853,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 +871,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(%x->%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 +885,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 +896,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 +1009,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 +1045,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 +1069,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 +1095,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 +1112,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 +1121,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 +1137,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 +1150,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 +1179,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 +1196,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 +1223,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 +1237,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,10 +1268,10 @@ 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 ) { @@ -1294,8 +1286,7 @@ TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, char *port) 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; } @@ -1316,10 +1307,10 @@ TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd, char *port) 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 ) { @@ -1334,8 +1325,7 @@ TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd, char *port) 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 +1346,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 +1362,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; } @@ -1672,7 +1662,7 @@ static void TRANS(LocalInitTransports)(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 +1684,7 @@ static void TRANS(LocalEndTransports)(void) { - PRMSG(3,"LocalEndTransports()\n", 0,0,0 ); + prmsg(3,"LocalEndTransports()\n"); xfree(freeXLOCAL); } @@ -1709,7 +1699,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 +1779,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 +1791,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 +1812,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,%d) failed\n", + sizeof(struct _XtransConnInfo)); return NULL; } @@ -1845,14 +1835,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; @@ -1884,7 +1873,7 @@ TRANS(LocalOpenServer)(int type, char *protocol, char *host, 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 +1886,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,%d) failed\n", + sizeof(struct _XtransConnInfo)); return NULL; } @@ -1910,9 +1899,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 +1909,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 +1936,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,%d) failed\n", + sizeof(struct _XtransConnInfo)); return NULL; } @@ -1968,8 +1956,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 ) { @@ -1998,7 +1986,7 @@ TRANS(LocalOpenCOTSClient)(Xtransport *thistrans, 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 +2005,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 +2027,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; } @@ -2057,7 +2045,7 @@ TRANS(LocalOpenCLTSClient)(Xtransport *thistrans, 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); } @@ -2072,7 +2060,7 @@ TRANS(LocalOpenCLTSServer)(Xtransport *thistrans, 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 +2076,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 +2100,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 +2126,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; } @@ -2150,7 +2138,7 @@ static int TRANS(LocalCreateListener)(XtransConnInfo ciptr, char *port, unsigned int flags) { - PRMSG(2,"LocalCreateListener(%x->%d,%s)\n",ciptr,ciptr->fd,port); + prmsg(2,"LocalCreateListener(%x->%d,%s)\n",ciptr,ciptr->fd,port); return 0; } @@ -2161,7 +2149,7 @@ TRANS(LocalResetListener)(XtransConnInfo ciptr) { LOCALtrans2dev *transptr; - PRMSG(2,"LocalResetListener(%x)\n",ciptr,0,0); + prmsg(2,"LocalResetListener(%x)\n",ciptr); transptr=(LOCALtrans2dev *)ciptr->priv; if (transptr->devreset != NULL) { @@ -2178,14 +2166,14 @@ TRANS(LocalAccept)(XtransConnInfo ciptr, int *status) XtransConnInfo newciptr; LOCALtrans2dev *transptr; - PRMSG(2,"LocalAccept(%x->%d)\n", ciptr, ciptr->fd,0); + prmsg(2,"LocalAccept(%x->%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,%d) failed\n", + sizeof(struct _XtransConnInfo)); *status = TRANS_ACCEPT_BAD_MALLOC; return NULL; } @@ -2215,7 +2203,7 @@ static int TRANS(LocalConnect)(XtransConnInfo ciptr, char *host, char *port) { - PRMSG(2,"LocalConnect(%x->%d,%s)\n", ciptr, ciptr->fd, port); + prmsg(2,"LocalConnect(%x->%d,%s)\n", ciptr, ciptr->fd, port); return 0; } @@ -2227,7 +2215,7 @@ static int TRANS(LocalBytesReadable)(XtransConnInfo ciptr, BytesReadable_t *pend ) { - PRMSG(2,"LocalBytesReadable(%x->%d,%x)\n", ciptr, ciptr->fd, pend); + prmsg(2,"LocalBytesReadable(%x->%d,%x)\n", ciptr, ciptr->fd, pend); #if defined(SCO325) return ioctl(ciptr->fd, I_NREAD, (char *)pend); @@ -2240,7 +2228,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,%x,%d)\n", ciptr->fd, buf, size ); return read(ciptr->fd,buf,size); } @@ -2249,7 +2237,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,%x,%d)\n", ciptr->fd, buf, size ); return write(ciptr->fd,buf,size); } @@ -2258,7 +2246,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,%x,%d)\n", ciptr->fd, buf, size ); return READV(ciptr,buf,size); } @@ -2267,7 +2255,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,%x,%d)\n", ciptr->fd, buf, size ); return WRITEV(ciptr,buf,size); } @@ -2276,7 +2264,7 @@ static int TRANS(LocalDisconnect)(XtransConnInfo ciptr) { - PRMSG(2,"LocalDisconnect(%x->%d)\n", ciptr, ciptr->fd, 0); + prmsg(2,"LocalDisconnect(%x->%d)\n", ciptr, ciptr->fd); return 0; } @@ -2288,7 +2276,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(%x->%d)\n", ciptr, ciptr->fd ); ret=close(ciptr->fd); @@ -2310,7 +2298,7 @@ TRANS(LocalCloseForCloning)(XtransConnInfo ciptr) { int ret; - PRMSG(2,"LocalCloseForCloning(%x->%d)\n", ciptr, ciptr->fd ,0); + prmsg(2,"LocalCloseForCloning(%x->%d)\n", ciptr, ciptr->fd ); /* Don't unlink path */ diff --git a/Xtranssock.c b/Xtranssock.c index c2f3fac..c57a117 100644 --- a/Xtranssock.c +++ b/Xtranssock.c @@ -259,7 +259,7 @@ TRANS(SocketSelectFamily) (int first, 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; @@ -462,23 +460,23 @@ TRANS(SocketReopen) (int i, int type, int fd, char *port) 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; @@ -546,7 +544,7 @@ TRANS(SocketOpenCOTSClientBase) (char *transname, char *protocol, 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; } @@ -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(%x,%p)\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 /* @@ -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); @@ -1446,7 +1435,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port) 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) { @@ -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,8 +1660,8 @@ 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); @@ -1686,8 +1672,8 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port) 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); diff --git a/Xtranstli.c b/Xtranstli.c index f35214c..8601c13 100644 --- a/Xtranstli.c +++ b/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/Xtransutil.c b/Xtransutil.c index 56f0158..d44dbe9 100644 --- a/Xtransutil.c +++ b/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,%x)\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; } @@ -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; |