Mercurial > pidgin
comparison libpurple/protocols/zephyr/ZOpenPort.c @ 31086:a8cc50c2279f
Remove trailing whitespace
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Tue, 04 Jan 2011 06:55:30 +0000 |
parents | 5fe8042783c1 |
children |
comparison
equal
deleted
inserted
replaced
31085:44f53d3fc54f | 31086:a8cc50c2279f |
---|---|
3 * | 3 * |
4 * Created by: Robert French | 4 * Created by: Robert French |
5 * | 5 * |
6 * Copyright (c) 1987 by the Massachusetts Institute of Technology. | 6 * Copyright (c) 1987 by the Massachusetts Institute of Technology. |
7 * For copying and distribution information, see the file | 7 * For copying and distribution information, see the file |
8 * "mit-copyright.h". | 8 * "mit-copyright.h". |
9 */ | 9 */ |
10 | 10 |
11 #include "internal.h" | 11 #include "internal.h" |
12 #ifdef WIN32 | 12 #ifdef WIN32 |
13 #include <winsock2.h> | 13 #include <winsock2.h> |
18 Code_t ZOpenPort(port) | 18 Code_t ZOpenPort(port) |
19 unsigned short *port; | 19 unsigned short *port; |
20 { | 20 { |
21 struct sockaddr_in bindin; | 21 struct sockaddr_in bindin; |
22 socklen_t len; | 22 socklen_t len; |
23 | 23 |
24 (void) ZClosePort(); | 24 (void) ZClosePort(); |
25 | 25 |
26 if ((__Zephyr_fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { | 26 if ((__Zephyr_fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { |
27 __Zephyr_fd = -1; | 27 __Zephyr_fd = -1; |
28 return (errno); | 28 return (errno); |
30 | 30 |
31 #ifdef SO_BSDCOMPAT | 31 #ifdef SO_BSDCOMPAT |
32 { | 32 { |
33 int on = 1; | 33 int on = 1; |
34 | 34 |
35 setsockopt(__Zephyr_fd, SOL_SOCKET, SO_BSDCOMPAT, (char *)&on, | 35 setsockopt(__Zephyr_fd, SOL_SOCKET, SO_BSDCOMPAT, (char *)&on, |
36 sizeof(on)); | 36 sizeof(on)); |
37 } | 37 } |
38 #endif | 38 #endif |
39 | 39 |
40 bindin.sin_family = AF_INET; | 40 bindin.sin_family = AF_INET; |
56 if (!bindin.sin_port) { | 56 if (!bindin.sin_port) { |
57 len = sizeof(bindin); | 57 len = sizeof(bindin); |
58 if (getsockname(__Zephyr_fd, (struct sockaddr *)&bindin, &len)) | 58 if (getsockname(__Zephyr_fd, (struct sockaddr *)&bindin, &len)) |
59 return (errno); | 59 return (errno); |
60 } | 60 } |
61 | 61 |
62 __Zephyr_port = bindin.sin_port; | 62 __Zephyr_port = bindin.sin_port; |
63 __Zephyr_open = 1; | 63 __Zephyr_open = 1; |
64 | 64 |
65 if (port) | 65 if (port) |
66 *port = bindin.sin_port; | 66 *port = bindin.sin_port; |