1 /***************************************************************************
2  *                                  _   _ ____  _
3  *  Project                     ___| | | |  _ \| |
4  *                             / __| | | | |_) | |
5  *                            | (__| |_| |  _ <| |___
6  *                             \___|\___/|_| \_\_____|
7  *
8  * Copyright (C) 1998 - 2016, 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 https://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  ***************************************************************************/
22 
23 #include "curl_setup.h"
24 
25 #ifdef NETWARE /* Novell NetWare */
26 
27 #ifdef __NOVELL_LIBC__
28 /* For native LibC-based NLM we need to do nothing. */
netware_init(void)29 int netware_init(void)
30 {
31   return 0;
32 }
33 
34 #else /* __NOVELL_LIBC__ */
35 
36 /* For native CLib-based NLM we need to initialize the LONG namespace. */
37 #include <nwnspace.h>
38 #include <nwthread.h>
39 #include <nwadv.h>
40 /* Make the CLIB Ctx stuff link */
41 #include <netdb.h>
42 NETDB_DEFINE_CONTEXT
43 /* Make the CLIB Inet stuff link */
44 #include <netinet/in.h>
45 #include <arpa/inet.h>
46 NETINET_DEFINE_CONTEXT
47 
netware_init(void)48 int netware_init(void)
49 {
50   int rc = 0;
51   unsigned int myHandle = GetNLMHandle();
52   /* import UnAugmentAsterisk dynamically for NW4.x compatibility */
53   void (*pUnAugmentAsterisk)(int) = (void(*)(int))
54           ImportSymbol(myHandle, "UnAugmentAsterisk");
55   /* import UseAccurateCaseForPaths dynamically for NW3.x compatibility */
56   void (*pUseAccurateCaseForPaths)(int) = (void(*)(int))
57           ImportSymbol(myHandle, "UseAccurateCaseForPaths");
58   if(pUnAugmentAsterisk)
59     pUnAugmentAsterisk(1);
60   if(pUseAccurateCaseForPaths)
61     pUseAccurateCaseForPaths(1);
62   UnimportSymbol(myHandle, "UnAugmentAsterisk");
63   UnimportSymbol(myHandle, "UseAccurateCaseForPaths");
64   /* set long name space */
65   if((SetCurrentNameSpace(4) == 255)) {
66     rc = 1;
67   }
68   if((SetTargetNameSpace(4) == 255)) {
69     rc = rc + 2;
70   }
71   return rc;
72 }
73 
74 /* dummy function to satisfy newer prelude */
__init_environment(void)75 int __init_environment(void)
76 {
77   return 0;
78 }
79 
80 /* dummy function to satisfy newer prelude */
__deinit_environment(void)81 int __deinit_environment(void)
82 {
83   return 0;
84 }
85 
86 #endif /* __NOVELL_LIBC__ */
87 
88 #endif /* NETWARE */
89