* Clean up some function definitions to comply with strict
[alpine.git] / imap / src / osdep / os2 / os_os2.c
blob172b33e8cb557b0a3b72f34df8fb4dee9aaf065b
1 /* ========================================================================
2 * Copyright 1988-2006 University of Washington
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
11 * ========================================================================
15 * Program: Operating-system dependent routines -- OS/2 emx version
17 * Author: Mark Crispin
18 * Networks and Distributed Computing
19 * Computing & Communications
20 * University of Washington
21 * Administration Building, AG-44
22 * Seattle, WA 98195
23 * Internet: MRC@CAC.Washington.EDU
25 * Date: 14 March 1996
26 * Last Edited: 30 August 2006
29 #include <stdio.h>
30 #include <time.h>
31 #include <sys/time.h>
32 #include <sys/types.h>
33 #include <sys/stat.h>
34 #include <sys/socket.h>
35 #include <netinet/in.h>
36 #include <arpa/inet.h>
37 #include <netdb.h>
38 #include <ctype.h>
39 #include <errno.h>
40 #ifndef errno
41 extern int errno; /* just in case */
42 #endif
43 #include "tcp_os2.h" /* must be before osdep includes tcp.h */
44 #include "mail.h"
45 #include "osdep.h"
46 #include "misc.h"
47 #include "fs_os2.c"
48 #include "ftl_os2.c"
49 #include "nl_os2.c"
50 #include "env_os2.c"
51 #include "tcp_os2.c"
53 /* Return my local host name
54 * Returns: my local host name
57 char *mylocalhost (void)
59 if (!myLocalHost) { /* known yet? */
60 char *s,tmp[MAILTMPLEN];
61 struct hostent *he;
62 /* could we get local id? */
63 gethostname (tmp,MAILTMPLEN-1);
64 if (he = gethostbyname (lcase (tmp))) {
65 if (he->h_name) s = he->h_name;
66 else sprintf (s = tmp,"[%i.%i.%i.%i]",he->h_addr[0],he->h_addr[1],
67 he->h_addr[2],he->h_addr[3]);
69 else s = "random-pc";
70 myLocalHost = cpystr (s); /* record for subsequent use */
72 return myLocalHost;
76 /* Look up host address
77 * Accepts: pointer to pointer to host name
78 * socket address block
79 * Returns: non-zero with host address in socket, official host name in host;
80 * else NIL
83 long lookuphost (char **host,struct sockaddr_in *sin)
85 long ret = -1;
86 char tmp[MAILTMPLEN];
87 struct hostent *hn = gethostbyname (lcase (strcpy (tmp,*host)));
88 if (!hn) return NIL; /* got a host name? */
89 *host = cpystr (hn->h_name); /* set official name */
90 /* copy host addresses */
91 memcpy (&sin->sin_addr,hn->h_addr,hn->h_length);
92 return T;
97 * Emulator for BSD syslog() routine.
100 void syslog (int priority,const char *message,...)