imapext-2007

view src/osdep/dos/os_dbw.c @ 0:ada5e610ab86

imap-2007e
author yuuji@gentei.org
date Mon, 14 Sep 2009 15:17:45 +0900
parents
children
line source
1 /* ========================================================================
2 * Copyright 1988-2006 University of Washington
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 *
11 * ========================================================================
12 */
14 /*
15 * Program: Operating-system dependent routines -- MS-DOS (B&W) version
16 *
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
24 *
25 * Date: 11 April 1989
26 * Last Edited: 30 August 2006
27 */
29 /* Private function prototypes */
31 #include "tcp_dos.h" /* must be before osdep includes tcp.h */
32 #include "mail.h"
33 #include "osdep.h"
34 #include <time.h>
35 #include <errno.h>
36 #include <fcntl.h>
37 #include <sys\stat.h>
38 #include <sys\timeb.h>
39 #include "misc.h"
40 #include "stdlib.h"
41 #include "bwtcp.h"
44 #include "fs_dos.c"
45 #include "ftl_dos.c"
46 #include "nl_dos.c"
47 #include "env_dos.c"
48 #undef write
49 #define read soread
50 #define write sowrite
51 #define close soclose
52 #include "tcp_dos.c"
55 /* Return my local host name
56 * Returns: my local host name
57 */
59 char *mylocalhost (void)
60 {
61 char *s;
62 if (!myLocalHost) { /* known yet? */
63 /* get local host name from DISPLAY env var */
64 if (!((s = getenv ("DISPLAY")) || (s = getenv ("display")))) {
65 mm_log ("Environment variable 'DISPLAY' is not set", ERROR);
66 s = "random-pc";
67 }
68 myLocalHost = cpystr (s);
69 }
70 return myLocalHost;
71 }
74 /* Look up host address
75 * Accepts: pointer to pointer to host name
76 * socket address block
77 * Returns: non-zero with host address in socket, official host name in host;
78 * else NIL
79 */
81 long lookuphost (char **host,struct sockaddr_in *sin)
82 {
83 char *s = *host; /* in case of error */
84 sin->sin_addr.s_addr = rhost (host);
85 if (sin->sin_addr.s_addr == -1) {
86 *host = s; /* error, restore old host name */
87 return NIL;
88 }
89 *host = cpystr (*host); /* make permanent copy of name */
90 return T; /* success */
91 }

UW-IMAP'd extensions by yuuji