Mercurial > masqmail
comparison src/libident/id_query.c @ 10:26e34ae9a3e3
changed indention and line wrapping to a more consistent style
author | meillo@marmaro.de |
---|---|
date | Mon, 27 Oct 2008 16:23:10 +0100 |
parents | 08114f7dcc23 |
children |
comparison
equal
deleted
inserted
replaced
9:31cc8a89cb74 | 10:26e34ae9a3e3 |
---|---|
28 | 28 |
29 #ifdef _AIX | 29 #ifdef _AIX |
30 # include <sys/select.h> | 30 # include <sys/select.h> |
31 #endif | 31 #endif |
32 #ifdef VMS | 32 #ifdef VMS |
33 # include <sys/socket.h> /* for fd_set */ | 33 # include <sys/socket.h> /* for fd_set */ |
34 #endif | 34 #endif |
35 #define IN_LIBIDENT_SRC | 35 #define IN_LIBIDENT_SRC |
36 #include "ident.h" | 36 #include "ident.h" |
37 | 37 |
38 | 38 |
39 /* | 39 /* |
40 int id_query __P4(ident_t *, id, | 40 int |
41 int, lport, | 41 id_query __P4(ident_t *, id, int, lport, int, fport, struct timeval *, timeout) |
42 int, fport, | |
43 struct timeval *, timeout) | |
44 */ | 42 */ |
45 | 43 |
46 int id_query __P(( ident_t *id, | 44 int |
47 int lport, | 45 id_query __P((ident_t * id, int lport, int fport, __STRUCT_TIMEVAL_P timeout)) |
48 int fport, | |
49 __STRUCT_TIMEVAL_P timeout)) | |
50 { | 46 { |
51 #ifdef SIGRETURNTYPE | 47 #ifdef SIGRETURNTYPE |
52 SIGRETURNTYPE (*old_sig)(); | 48 SIGRETURNTYPE(*old_sig) (); |
53 #else | 49 #else |
54 void (*old_sig) __P((int)); | 50 void (*old_sig) __P((int)); |
55 #endif | 51 #endif |
56 int res; | 52 int res; |
57 char buf[80]; | 53 char buf[80]; |
58 fd_set ws; | 54 fd_set ws; |
59 | 55 |
60 sprintf(buf, "%d , %d\r\n", lport, fport); | 56 sprintf(buf, "%d , %d\r\n", lport, fport); |
61 | 57 |
62 if (timeout) | 58 if (timeout) { |
63 { | 59 FD_ZERO(&ws); |
64 FD_ZERO(&ws); | 60 FD_SET(id->fd, &ws); |
65 FD_SET(id->fd, &ws); | |
66 | 61 |
67 #ifdef __hpux | 62 #ifdef __hpux |
68 if ((res = select(FD_SETSIZE, (int *)0, (int *)&ws, (int *)0, timeout)) < 0) | 63 if ((res = select(FD_SETSIZE, (int *) 0, (int *) &ws, (int *) 0, timeout)) < 0) |
69 #else | 64 #else |
70 if ((res = select(FD_SETSIZE, (fd_set *)0, &ws, (fd_set *)0, timeout)) < 0) | 65 if ((res = select(FD_SETSIZE, (fd_set *) 0, &ws, (fd_set *) 0, timeout)) < 0) |
71 #endif | 66 #endif |
72 return -1; | 67 return -1; |
73 | 68 |
74 if (res == 0) | 69 if (res == 0) { |
75 { | 70 errno = ETIMEDOUT; |
76 errno = ETIMEDOUT; | 71 return -1; |
77 return -1; | 72 } |
78 } | 73 } |
79 } | |
80 | 74 |
81 old_sig = signal(SIGPIPE, SIG_IGN); | 75 old_sig = signal(SIGPIPE, SIG_IGN); |
82 | 76 |
83 res = write(id->fd, buf, strlen(buf)); | 77 res = write(id->fd, buf, strlen(buf)); |
84 | 78 |
85 signal(SIGPIPE, old_sig); | 79 signal(SIGPIPE, old_sig); |
86 | 80 |
87 return res; | 81 return res; |
88 } | 82 } |