nwos.c 2.6 KB

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