From 51e3883a64ec1d787fb9a50e0aa9294e9b6bc63a Mon Sep 17 00:00:00 2001
From: Petr Oros <poros@redhat.com>
Date: Tue, 16 May 2017 08:27:18 +0200
Subject: [PATCH] Show right version number
Signed-off-by: Petr Oros <poros@redhat.com>
---
src/core/version.cc | 93 ++---------------------------------------------------
1 file changed, 2 insertions(+), 91 deletions(-)
diff --git a/src/core/version.cc b/src/core/version.cc
index c9dc899..9666dd7 100644
--- a/src/core/version.cc
+++ b/src/core/version.cc
@@ -18,102 +18,13 @@
#include <resolv.h>
#include <sys/types.h>
-#ifndef PACKETSZ
-#define PACKETSZ 512
-#endif
-
-
-static char versiontag[] = "@(#) $URL$ >";
-
const char *getpackageversion()
{
- static char * result = NULL;
- char * lastslash = NULL;
-
- if(result)
- return result;
-
- lastslash = strrchr(versiontag, '/');
- if(lastslash)
- *lastslash = '\0'; // cut the basename off
-
- lastslash = strrchr(versiontag, '/');
- if(lastslash)
- *lastslash = '\0'; // cut the basename off
-
- lastslash = strrchr(versiontag, '/');
- if(lastslash)
- *lastslash = '\0'; // cut the basename off
-
- lastslash = strrchr(versiontag, '/');
- if(lastslash)
- result = lastslash+1;
- else
- return "unknown";
-
+ static char result[] = "B.02.18";
return result;
}
-static char *txtquery(const char *name, const char *domain, unsigned int *ttl)
-{
- unsigned char answer[PACKETSZ], *pt;
- char host[128], *txt;
- int len, exp, cttl, size, txtlen, type;
-
- if(res_init() < 0)
- return NULL;
-
- memset(answer, 0, PACKETSZ);
- if((len = res_querydomain(name, domain, C_IN, T_TXT, answer, PACKETSZ)) < 0)
- return NULL;
-
- pt = answer + sizeof(HEADER);
-
- if((exp = dn_expand(answer, answer + len, pt, host, sizeof(host))) < 0)
- return NULL;
-
- pt += exp;
-
- GETSHORT(type, pt);
- if(type != T_TXT)
- return NULL;
-
- pt += INT16SZ; /* class */
-
- if((exp = dn_expand(answer, answer + len, pt, host, sizeof(host))) < 0)
- return NULL;
-
- pt += exp;
- GETSHORT(type, pt);
- if(type != T_TXT)
- return NULL;
-
- pt += INT16SZ; /* class */
- GETLONG(cttl, pt);
- if(ttl)
- *ttl = cttl;
- GETSHORT(size, pt);
- txtlen = *pt;
-
- if(txtlen >= size || !txtlen)
- return NULL;
-
- if(!(txt = (char*)malloc(txtlen + 1)))
- return NULL;
-
- pt++;
- strncpy(txt, (char*)pt, txtlen);
- txt[txtlen] = 0;
-
- return txt;
-}
-
const char * checkupdates()
{
- static char *latest = NULL;
-
- if(!latest)
- latest = txtquery(PACKAGE, "ezix.org", NULL);
-
- return latest;
+ return getpackageversion();
}
--
2.13.0