aboutsummaryrefslogtreecommitdiff
path: root/lib/update.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/update.c')
-rw-r--r--lib/update.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/update.c b/lib/update.c
index f510861..6dd14d2 100644
--- a/lib/update.c
+++ b/lib/update.c
@@ -36,6 +36,7 @@
const char *TGebURL = "www.billiger-telefonieren.de";
const char *TGebGET = "GET /downloads/tgeb/tarife_%.4i%.2i%.2i.zip HTTP/1.0\n\n";
+extern char *__progname;
static void unzip(void);
@@ -52,6 +53,9 @@ tgeb_update(struct tm * tm)
int filelen;
int offset = 0;
+ printf("%s: updating database ", __progname);
+ fflush(stdout);
+
if (!(he = gethostbyname(TGebURL)))
err(1, "gethostbyname");
@@ -85,7 +89,10 @@ tgeb_update(struct tm * tm)
offset += block;
if (!(buf = realloc(buf, offset + BUF_SIZ)))
err(1, "malloc");
+ putchar('.');
+ fflush(stdout);
}
+ putchar('\n');
close(sockfd);
file = strstr(buf, "\r\n\r\n") + 4;
filelen = offset + buf - file;
@@ -120,6 +127,8 @@ unzip(void)
for (i = 0; i < gi.number_entry; i++) {
unzGetCurrentFileInfo(unzfd, &fi, FileName, sizeof(FileName),
NULL, 0, NULL, 0);
+ printf("extract %s ...", FileName);
+ fflush(stdout);
unzOpenCurrentFile(unzfd);
if (!(fd = fopen(FileName, "wb")))
err(1, "fopen %s", FileName);
@@ -127,6 +136,7 @@ unzip(void)
fwrite(buf, len, 1, fd);
}
fclose(fd);
+ printf(" done\n");
unzGoToNextFile(unzfd);
}
free(buf);