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 ***************************************************************************/
22
23#ifdef NETWARE /* Novell NetWare */
24
25#include <stdlib.h>
26
27#ifdef __NOVELL_LIBC__
28/* For native LibC-based NLM we need to do nothing. */
29int 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 <stdio.h>
38#include <nwnspace.h>
39#include <nwthread.h>
40#include <nwadv.h>
41/* Make the CLIB Ctx stuff link */
42#include <netdb.h>
43NETDB_DEFINE_CONTEXT
44/* Make the CLIB Inet stuff link */
45#include <netinet/in.h>
46#include <arpa/inet.h>
47NETINET_DEFINE_CONTEXT
48
49int netware_init ( void )
50{
51    int rc = 0;
52    unsigned int myHandle = GetNLMHandle();
53    /* import UnAugmentAsterisk dynamically for NW4.x compatibility */
54    void (*pUnAugmentAsterisk)(int) = (void(*)(int))
55            ImportSymbol(myHandle, "UnAugmentAsterisk");
56    /* import UseAccurateCaseForPaths dynamically for NW3.x compatibility */
57    void (*pUseAccurateCaseForPaths)(int) = (void(*)(int))
58            ImportSymbol(myHandle, "UseAccurateCaseForPaths");
59    if(pUnAugmentAsterisk)
60        pUnAugmentAsterisk(1);
61    if(pUseAccurateCaseForPaths)
62        pUseAccurateCaseForPaths(1);
63    UnimportSymbol(myHandle, "UnAugmentAsterisk");
64    UnimportSymbol(myHandle, "UseAccurateCaseForPaths");
65    /* set long name space */
66    if((SetCurrentNameSpace(4) == 255)) {
67        rc = 1;
68    }
69    if((SetTargetNameSpace(4) == 255)) {
70        rc = rc + 2;
71    }
72    return rc;
73}
74
75/* dummy function to satisfy newer prelude */
76int __init_environment ( void )
77{
78    return 0;
79}
80
81/* dummy function to satisfy newer prelude */
82int __deinit_environment ( void )
83{
84    return 0;
85}
86
87#endif /* __NOVELL_LIBC__ */
88
89#else /* NETWARE */
90
91#ifdef __POCC__
92#  pragma warn(disable:2024)  /* Disable warning #2024: Empty input file */
93#endif
94
95#endif /* NETWARE */
96