Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Misc. in tcp.c
- X-seq: zsh-workers 16031
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: PATCH: Misc. in tcp.c
- Date: Sun, 14 Oct 2001 01:10:02 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
The only change here that's substantive is un-including <arpa/telnet.h>.
The rest are just long-line foldings and whitespace that I changed while
trying to debug the zftp problems a couple of weeks ago.
Index: Src/Modules/tcp.c
--- zsh-forge/current/Src/Modules/tcp.c Thu Oct 11 08:19:54 2001
+++ zsh-4.0/Src/Modules/tcp.c Thu Oct 11 08:21:47 2001
@@ -35,9 +35,6 @@
*/
#include "tcp.h"
-/* it's a TELNET based protocol, but don't think I like doing this */
-#include <arpa/telnet.h>
-
/*
* We use poll() in preference to select because some subset of manuals says
* that's the thing to do, plus it's a bit less fiddly. I don't actually
@@ -55,8 +52,8 @@
int h_errno;
#endif
-/* We use the RFC 2553 interfaces. If the functions don't exist in the library,
- simulate them. */
+/* We use the RFC 2553 interfaces. If the functions don't exist in the
+ * library, simulate them. */
#ifndef INET_ADDRSTRLEN
# define INET_ADDRSTRLEN 16
@@ -458,7 +455,7 @@
setiparam("REPLY", sess->fd);
- if(verbose)
+ if (verbose)
fprintf(shout, "%d listener is on fd %d\n", ntohs(sess->sock.in.sin_port), sess->fd);
return 0;
@@ -492,7 +489,7 @@
return 1;
}
- if(test) {
+ if (test) {
#if defined(HAVE_POLL) || defined(HAVE_SELECT)
# ifdef HAVE_POLL
struct pollfd pfd;
@@ -500,7 +497,7 @@
pfd.fd = lfd;
pfd.events = POLLIN;
- if((ret = poll(&pfd, 1, 0)) == 0) return 1;
+ if ((ret = poll(&pfd, 1, 0)) == 0) return 1;
else if (ret == -1)
{
zwarnnam(nam, "poll error: %e", NULL, errno);
@@ -516,7 +513,7 @@
tv.tv_sec = 0;
tv.tv_usec = 0;
- if(ret = select(lfd+1, &rfds, NULL, NULL, &tv)) return 1;
+ if (ret = select(lfd+1, &rfds, NULL, NULL, &tv)) return 1;
else if (ret == -1)
{
zwarnnam(nam, "select error: %e", NULL, errno);
@@ -549,12 +546,11 @@
setiparam("REPLY", sess->fd);
- if(verbose)
+ if (verbose)
fprintf(shout, "%d is on fd %d\n", ntohs(sess->peer.in.sin_port), sess->fd);
}
else
{
-
if (!dargs[0]) {
LinkNode node;
for(node = firstnode(ztcp_sessions); node; incnode(node))
@@ -573,7 +569,13 @@
remotename = ztpeer->h_name;
else
remotename = ztrdup(inet_ntoa(sess->sock.in.sin_addr));
- fprintf(shout, "%s:%d %s %s:%d is on fd %d%s\n", localname, ntohs(sess->sock.in.sin_port), (sess->flags & ZTCP_LISTEN) ? "-<" : (sess->flags & ZTCP_INBOUND) ? "<-" : "->", remotename, ntohs(sess->peer.in.sin_port), sess->fd, (sess->flags & ZTCP_ZFTP) ? " ZFTP" : "");
+ fprintf(shout, "%s:%d %s %s:%d is on fd %d%s\n",
+ localname, ntohs(sess->sock.in.sin_port),
+ ((sess->flags & ZTCP_LISTEN) ? "-<" :
+ ((sess->flags & ZTCP_INBOUND) ? "<-" : "->")),
+ remotename, ntohs(sess->peer.in.sin_port),
+ sess->fd,
+ (sess->flags & ZTCP_ZFTP) ? " ZFTP" : "");
}
}
return 0;
@@ -639,14 +641,14 @@
setiparam("REPLY", sess->fd);
if (verbose)
- fprintf(shout, "%s:%d is now on fd %d\n", desthost, destport, sess->fd);
+ fprintf(shout, "%s:%d is now on fd %d\n",
+ desthost, destport, sess->fd);
}
zsfree(desthost);
}
return 0;
-
}
static struct builtin bintab[] = {
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author