aboutsummaryrefslogtreecommitdiff
path: root/desiredata/src
diff options
context:
space:
mode:
authorN.N. <matju@users.sourceforge.net>2009-05-28 04:50:33 +0000
committerN.N. <matju@users.sourceforge.net>2009-05-28 04:50:33 +0000
commit53d632ecef1dc6ad1077f91dcc60daff21c1c2a3 (patch)
tree1d04c1fbd985c3a910eef6be180a9d360e8b73be /desiredata/src
parent578f91f3b8d8ebef9f518b220a6a17f11f0e3c44 (diff)
reformat
svn path=/trunk/; revision=11542
Diffstat (limited to 'desiredata/src')
-rw-r--r--desiredata/src/u_pdsend.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/desiredata/src/u_pdsend.c b/desiredata/src/u_pdsend.c
index 82eb2c59..8bcf8880 100644
--- a/desiredata/src/u_pdsend.c
+++ b/desiredata/src/u_pdsend.c
@@ -45,32 +45,15 @@ int main(int argc, char **argv) {
#ifdef MSW
if (WSAStartup(version, &nobby)) sockerror("WSAstartup");
#endif
-
sockfd = socket(AF_INET, protocol, 0);
- if (sockfd < 0) {
- sockerror("socket()");
- return 1;
- }
+ if (sockfd < 0) {sockerror("socket()"); return 1;}
/* connect socket using hostname provided in command line */
server.sin_family = AF_INET;
hp = gethostbyname(hostname);
- if (hp == 0) {
- fprintf(stderr, "%s: unknown host\n", hostname);
- x_closesocket(sockfd);
- return 1;
- }
+ if (!hp) {fprintf(stderr, "%s: unknown host\n", hostname); x_closesocket(sockfd); return 1;}
memcpy((char *)&server.sin_addr, (char *)hp->h_addr, hp->h_length);
-
- /* assign client port number */
server.sin_port = htons((unsigned short)portno);
-
- /* try to connect. */
- if (connect(sockfd, (struct sockaddr *) &server, sizeof (server)) < 0) {
- sockerror("connect");
- x_closesocket(sockfd);
- return 1;
- }
-
+ if (connect(sockfd, (struct sockaddr *)&server, sizeof(server))<0) {sockerror("connect"); x_closesocket(sockfd); return 1;}
/* now loop reading stdin and sending it to socket */
while (1) {
char buf[BUFSIZE], *bp;