aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2005-03-30 06:49:56 +0000
committerDimitri Sokolyuk <demon@dim13.org>2005-03-30 06:49:56 +0000
commitf9b89552c45241e11b69a6108053e347a5d4beb8 (patch)
treec3216e94d390edaba390271dc70724349c64a381
parentf41a204718f506a3aa95505324309a2293743c4e (diff)
cosmetic improvement
-rw-r--r--lib/update.c25
-rw-r--r--src/main.c2
2 files changed, 21 insertions, 6 deletions
diff --git a/lib/update.c b/lib/update.c
index 5d0a497..88fd27b 100644
--- a/lib/update.c
+++ b/lib/update.c
@@ -39,6 +39,7 @@ const char *TGebGET = "GET /downloads/tgeb/tarife_%.4i%.2i%.2i.zip HTTP/1.0\n\n"
extern char *__progname;
static void unzip(void);
+static void twiddle(void);
void
tgeb_update(struct tm * tm)
@@ -89,10 +90,9 @@ tgeb_update(struct tm * tm)
offset += block;
if (!(buf = realloc(buf, offset + BUF_SIZ)))
err(1, "malloc");
- putchar('.');
- fflush(stdout);
+ twiddle();
}
- putchar('\n');
+ printf(" \tdone\n");
close(sockfd);
file = strstr(buf, "\r\n\r\n") + 4;
filelen = offset + buf - file;
@@ -127,16 +127,17 @@ unzip(void)
for (i = 0; i < gi.number_entry; i++) {
unzGetCurrentFileInfo(unzfd, &fi, FileName, sizeof(FileName),
NULL, 0, NULL, 0);
- printf("extract %s ...", FileName);
+ printf("%s: extracting %s ", __progname, FileName);
fflush(stdout);
unzOpenCurrentFile(unzfd);
if (!(fd = fopen(FileName, "wb")))
err(1, "fopen %s", FileName);
while ((len = unzReadCurrentFile(unzfd, buf, BUF_SIZ))) {
fwrite(buf, len, 1, fd);
+ twiddle();
}
fclose(fd);
- printf(" done\n");
+ printf(" \tdone\n");
unzGoToNextFile(unzfd);
}
free(buf);
@@ -144,3 +145,17 @@ unzip(void)
unlink(DATFILE);
return;
}
+
+static const char twiddle_chars[] = "|/-\\";
+static int twiddle_index = 0;
+
+void
+twiddle(void)
+{
+ putchar(twiddle_chars[twiddle_index++]);
+ putchar('\b');
+ fflush(stdout);
+ twiddle_index &= 3;
+}
+
+
diff --git a/src/main.c b/src/main.c
index cb104ad..6f0fbd0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -29,7 +29,7 @@
#include <tgebup.h>
extern char *__progname;
-const char *copyright = "TGeb parasite 0.3 - "
+const char *copyright = "TGeb parasite 0.3.1 - "
"Copyright (c) 2004 demon <demon@vhost.dyndns.org>";
void usage(void);