Commit 7c8e0be6 7c8e0be62eecb7e8bbc46fd9eee50172a0d3c29b by Sergey Poznyakoff

(imap4d_mainloop): Changed proto following that of pop3.

1 parent 3784bb2b
...@@ -75,10 +75,9 @@ static const char *imap4d_capa[] = { ...@@ -75,10 +75,9 @@ static const char *imap4d_capa[] = {
75 NULL 75 NULL
76 }; 76 };
77 77
78 static int imap4d_mainloop __P ((int, int));
79 static void imap4d_daemon_init __P ((void)); 78 static void imap4d_daemon_init __P ((void));
80 static void imap4d_daemon __P ((unsigned int, unsigned int)); 79 static void imap4d_daemon __P ((unsigned int, unsigned int));
81 static int imap4d_mainloop __P ((int, int)); 80 static int imap4d_mainloop __P ((int, FILE *, FILE *));
82 81
83 static error_t 82 static error_t
84 imap4d_parse_opt (int key, char *arg, struct argp_state *state) 83 imap4d_parse_opt (int key, char *arg, struct argp_state *state)
...@@ -198,7 +197,7 @@ main (int argc, char **argv) ...@@ -198,7 +197,7 @@ main (int argc, char **argv)
198 imap4d_daemon (daemon_param.maxchildren, daemon_param.port); 197 imap4d_daemon (daemon_param.maxchildren, daemon_param.port);
199 /* exit (0) -- no way out of daemon except a signal. */ 198 /* exit (0) -- no way out of daemon except a signal. */
200 else 199 else
201 status = imap4d_mainloop (fileno (stdin), fileno (stdout)); 200 status = imap4d_mainloop (fileno (stdin), stdin, stdout);
202 201
203 /* Close the syslog connection and exit. */ 202 /* Close the syslog connection and exit. */
204 closelog (); 203 closelog ();
...@@ -207,7 +206,7 @@ main (int argc, char **argv) ...@@ -207,7 +206,7 @@ main (int argc, char **argv)
207 } 206 }
208 207
209 static int 208 static int
210 imap4d_mainloop (int infile, int outfile) 209 imap4d_mainloop (int fd, FILE *infile, FILE *outfile)
211 { 210 {
212 char *text; 211 char *text;
213 212
...@@ -225,7 +224,7 @@ imap4d_mainloop (int infile, int outfile) ...@@ -225,7 +224,7 @@ imap4d_mainloop (int infile, int outfile)
225 int len = sizeof cs; 224 int len = sizeof cs;
226 225
227 syslog (LOG_INFO, _("Incoming connection opened")); 226 syslog (LOG_INFO, _("Incoming connection opened"));
228 if (getpeername (infile, (struct sockaddr *) &cs, &len) < 0) 227 if (getpeername (fd, (struct sockaddr *) &cs, &len) < 0)
229 syslog (LOG_ERR, _("can't obtain IP address of client: %s"), 228 syslog (LOG_ERR, _("can't obtain IP address of client: %s"),
230 strerror (errno)); 229 strerror (errno));
231 else 230 else
...@@ -348,7 +347,9 @@ imap4d_daemon (unsigned int maxchildren, unsigned int port) ...@@ -348,7 +347,9 @@ imap4d_daemon (unsigned int maxchildren, unsigned int port)
348 { 347 {
349 int status; 348 int status;
350 close (listenfd); 349 close (listenfd);
351 status = imap4d_mainloop (connfd, connfd); 350 status = imap4d_mainloop (connfd,
351 fdopen (connfd, "r"),
352 fdopen (connfd, "w"));
352 closelog (); 353 closelog ();
353 exit (status); 354 exit (status);
354 } 355 }
......