diff options
Diffstat (limited to 'Xtranslcl.c')
-rw-r--r-- | Xtranslcl.c | 306 |
1 files changed, 147 insertions, 159 deletions
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 */ |