nwos.c 2.7 KB

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