Fix a problem if CFLAGS is too long cversion.c fails to compile when config
[openssl.git] / crypto / cversion.c
index 4e823be52f9c1db3352a9e0ad0f225a4cc429c96..0336adaa578482ecb2492c973b5a679920fbdf8e 100644 (file)
  * [including the GNU Public Licence.]
  */
 
-#include <stdio.h>
-#include <string.h>
 #include "cryptlib.h"
-#include "crypto.h"
-#include "date.h"
 
-char *SSLeay_version(t)
-int t;
+#ifndef NO_WINDOWS_BRAINDEATH
+#include "buildinf.h"
+#endif
+
+const char *SSLeay_version(int t)
        {
        if (t == SSLEAY_VERSION)
-               return("SSLeay 0.9.0b 29-Jun-1998");
+               return OPENSSL_VERSION_TEXT;
        if (t == SSLEAY_BUILT_ON)
                {
 #ifdef DATE
-               static char buf[sizeof(DATE)+10];
-
-               sprintf(buf,"built on %s",DATE);
-               return(buf);
+               return(DATE);
 #else
-               return("build date not available");
+               return("built on: date not available");
 #endif
                }
        if (t == SSLEAY_CFLAGS)
                {
 #ifdef CFLAGS
-               static char buf[sizeof(CFLAGS)+10];
-
-               sprintf(buf,"C flags:%s",CFLAGS);
-               return(buf);
+               return(cflags);
+#else
+               return("compiler: information not available");
+#endif
+               }
+       if (t == SSLEAY_PLATFORM)
+               {
+#ifdef PLATFORM
+               return(PLATFORM);
+#else
+               return("platform: information not available");
+#endif
+               }
+       if (t == SSLEAY_DIR)
+               {
+#ifdef OPENSSLDIR
+               return "OPENSSLDIR: \"" OPENSSLDIR "\"";
 #else
-               return("C flags not available");
+               return "OPENSSLDIR: N/A";
 #endif
                }
        return("not available");
        }
 
-unsigned long SSLeay()
+unsigned long SSLeay(void)
        {
        return(SSLEAY_VERSION_NUMBER);
        }