Browse code

add basic support for incremental directories in printversion()

git-svn: trunk@2401

Tomasz Kojm authored on 2006/10/16 10:10:15
Showing 1 changed files
... ...
@@ -49,6 +49,7 @@
49 49
 #endif
50 50
 
51 51
 
52
+/* TODO: add support for incremental directories */
52 53
 char *freshdbdir(void)
53 54
 {
54 55
 	struct cl_cvd *d1, *d2;
... ...
@@ -90,20 +91,24 @@ char *freshdbdir(void)
90 90
     return retdir;
91 91
 }
92 92
 
93
+/* TODO: add _proper_ support for incremental directories */
93 94
 void print_version(void)
94 95
 {
95 96
 	char *dbdir;
96 97
 	char *path;
97 98
 	struct cl_cvd *daily;
99
+	struct stat foo;
98 100
 
99 101
 
100 102
     dbdir = freshdbdir();
101
-    if(!(path = mmalloc(strlen(dbdir) + 11))) {
103
+    if(!(path = mmalloc(strlen(dbdir) + 30))) {
102 104
 	free(dbdir);
103 105
 	return;
104 106
     }
105 107
 
106 108
     sprintf(path, "%s/daily.cvd", dbdir);
109
+    if(stat(path, &foo) == -1)
110
+	sprintf(path, "%s/daily.inc/daily.info", dbdir);
107 111
     free(dbdir);
108 112
 
109 113
     if((daily = cl_cvdhead(path))) {