version.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*****************************************************************************
  2. * _ _ ____ _
  3. * Project ___| | | | _ \| |
  4. * / __| | | | |_) | |
  5. * | (__| |_| | _ <| |___
  6. * \___|\___/|_| \_\_____|
  7. *
  8. * Copyright (C) 2002, Daniel Stenberg, <[email protected]>, et al.
  9. *
  10. * In order to be useful for every potential user, curl and libcurl are
  11. * dual-licensed under the MPL and the MIT/X-derivate licenses.
  12. *
  13. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  14. * copies of the Software, and permit persons to whom the Software is
  15. * furnished to do so, under the terms of the MPL or the MIT/X-derivate
  16. * licenses. You may pick one of these licenses.
  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. #include "setup.h"
  24. #include <string.h>
  25. #include <stdio.h>
  26. #include <curl/curl.h>
  27. #include "urldata.h"
  28. char *curl_version(void)
  29. {
  30. static char version[200];
  31. char *ptr;
  32. strcpy(version, LIBCURL_NAME " " LIBCURL_VERSION );
  33. ptr=strchr(version, '\0');
  34. #ifdef USE_SSLEAY
  35. #if (SSLEAY_VERSION_NUMBER >= 0x905000)
  36. {
  37. char sub[2];
  38. unsigned long ssleay_value;
  39. sub[1]='\0';
  40. ssleay_value=SSLeay();
  41. if(ssleay_value < 0x906000) {
  42. ssleay_value=SSLEAY_VERSION_NUMBER;
  43. sub[0]='\0';
  44. }
  45. else {
  46. if(ssleay_value&0xff0) {
  47. sub[0]=((ssleay_value>>4)&0xff) + 'a' -1;
  48. }
  49. else
  50. sub[0]='\0';
  51. }
  52. sprintf(ptr, " (OpenSSL %lx.%lx.%lx%s)",
  53. (ssleay_value>>28)&0xf,
  54. (ssleay_value>>20)&0xff,
  55. (ssleay_value>>12)&0xff,
  56. sub);
  57. }
  58. #else
  59. #if (SSLEAY_VERSION_NUMBER >= 0x900000)
  60. sprintf(ptr, " (SSL %lx.%lx.%lx)",
  61. (SSLEAY_VERSION_NUMBER>>28)&0xff,
  62. (SSLEAY_VERSION_NUMBER>>20)&0xff,
  63. (SSLEAY_VERSION_NUMBER>>12)&0xf);
  64. #else
  65. {
  66. char sub[2];
  67. sub[1]='\0';
  68. if(SSLEAY_VERSION_NUMBER&0x0f) {
  69. sub[0]=(SSLEAY_VERSION_NUMBER&0x0f) + 'a' -1;
  70. }
  71. else
  72. sub[0]='\0';
  73. sprintf(ptr, " (SSL %x.%x.%x%s)",
  74. (SSLEAY_VERSION_NUMBER>>12)&0xff,
  75. (SSLEAY_VERSION_NUMBER>>8)&0xf,
  76. (SSLEAY_VERSION_NUMBER>>4)&0xf, sub);
  77. }
  78. #endif
  79. #endif
  80. ptr=strchr(ptr, '\0');
  81. #endif
  82. #if defined(KRB4) || defined(ENABLE_IPV6)
  83. strcat(ptr, " (");
  84. ptr+=2;
  85. #ifdef KRB4
  86. sprintf(ptr, "krb4 ");
  87. ptr += strlen(ptr);
  88. #endif
  89. #ifdef ENABLE_IPV6
  90. sprintf(ptr, "ipv6 ");
  91. ptr += strlen(ptr);
  92. #endif
  93. sprintf(ptr, "enabled)");
  94. ptr += strlen(ptr);
  95. #endif
  96. #ifdef USE_ZLIB
  97. sprintf(ptr, " (zlib %s)", zlibVersion());
  98. ptr += strlen(ptr);
  99. #endif
  100. return version;
  101. }
  102. /*
  103. * local variables:
  104. * eval: (load-file "../curl-mode.el")
  105. * end:
  106. * vim600: fdm=marker
  107. * vim: et sw=2 ts=2 sts=2 tw=78
  108. */