399580c829c42cae427aa048747b1396eca466f7
[platform/upstream/curl.git] / lib / nwos.c
1 /***************************************************************************
2  *                                  _   _ ____  _
3  *  Project                     ___| | | |  _ \| |
4  *                             / __| | | | |_) | |
5  *                            | (__| |_| |  _ <| |___
6  *                             \___|\___/|_| \_\_____|
7  *
8  * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
9  *
10  * This software is licensed as described in the file COPYING, which
11  * you should have received as part of this distribution. The terms
12  * are also available at http://curl.haxx.se/docs/copyright.html.
13  *
14  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15  * copies of the Software, and permit persons to whom the Software is
16  * furnished to do so, under the terms of the COPYING file.
17  *
18  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19  * KIND, either express or implied.
20  *
21  * $Id$
22  ***************************************************************************/
23
24 #ifdef NETWARE /* Novell NetWare */
25
26 #include <stdlib.h>
27
28 #ifdef __NOVELL_LIBC__
29 /* For native LibC-based NLM we need to do nothing. */
30 int netware_init ( void )
31 {
32     return 0;
33 }
34
35 #else /* __NOVELL_LIBC__ */
36
37 /* For native CLib-based NLM we need to initialize the LONG namespace. */
38 #include <stdio.h>
39 #include <nwnspace.h>
40 #include <nwthread.h>
41 #include <nwadv.h>
42 /* Make the CLIB Ctx stuff link */
43 #include <netdb.h>
44 NETDB_DEFINE_CONTEXT
45 /* Make the CLIB Inet stuff link */
46 #include <netinet/in.h>
47 #include <arpa/inet.h>
48 NETINET_DEFINE_CONTEXT
49
50 int netware_init ( void )
51 {
52     int rc = 0;
53     unsigned int myHandle = GetNLMHandle();
54     /* import UnAugmentAsterisk dynamically for NW4.x compatibility */
55     void (*pUnAugmentAsterisk)(int) = (void(*)(int))
56             ImportSymbol(myHandle, "UnAugmentAsterisk");
57     /* import UseAccurateCaseForPaths dynamically for NW3.x compatibility */
58     void (*pUseAccurateCaseForPaths)(int) = (void(*)(int))
59             ImportSymbol(myHandle, "UseAccurateCaseForPaths");
60     if(pUnAugmentAsterisk)
61         pUnAugmentAsterisk(1);
62     if(pUseAccurateCaseForPaths)
63         pUseAccurateCaseForPaths(1);
64     UnimportSymbol(myHandle, "UnAugmentAsterisk");
65     UnimportSymbol(myHandle, "UseAccurateCaseForPaths");
66     /* set long name space */
67     if((SetCurrentNameSpace(4) == 255)) {
68         rc = 1;
69     }
70     if((SetTargetNameSpace(4) == 255)) {
71         rc = rc + 2;
72     }
73     return rc;
74 }
75
76 /* dummy function to satisfy newer prelude */
77 int __init_environment ( void )
78 {
79     return 0;
80 }
81
82 /* dummy function to satisfy newer prelude */
83 int __deinit_environment ( void )
84 {
85     return 0;
86 }
87
88 #endif /* __NOVELL_LIBC__ */
89
90 #else /* NETWARE */
91
92 #ifdef __POCC__
93 #  pragma warn(disable:2024)  /* Disable warning #2024: Empty input file */
94 #endif
95
96 #endif /* NETWARE */