aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-download.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-06-21 23:05:54 +0000
committerChristian Grothoff <christian@grothoff.org>2012-06-21 23:05:54 +0000
commit4e7a535cc04df4eef21dc1db39d782a3365e9df1 (patch)
tree572db9632938b5b8db59424af03440b8da36734b /src/fs/gnunet-download.c
parente94ad8771c6ffe61b6ffb53c15567793760e75ca (diff)
downloadgnunet-4e7a535cc04df4eef21dc1db39d782a3365e9df1.tar.gz
gnunet-4e7a535cc04df4eef21dc1db39d782a3365e9df1.zip
-work on #2437, plus misc minor bugfixes
Diffstat (limited to 'src/fs/gnunet-download.c')
-rw-r--r--src/fs/gnunet-download.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c
index 43b306def..2293cedd7 100644
--- a/src/fs/gnunet-download.c
+++ b/src/fs/gnunet-download.c
@@ -52,6 +52,7 @@ static char *filename;
52 52
53static int local_only; 53static int local_only;
54 54
55
55static void 56static void
56cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 57cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
57{ 58{
@@ -63,13 +64,10 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
63static void 64static void
64shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 65shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
65{ 66{
66 struct GNUNET_FS_DownloadContext *d; 67 if (NULL != dc)
67
68 if (dc != NULL)
69 { 68 {
70 d = dc; 69 GNUNET_FS_download_stop (dc, delete_incomplete);
71 dc = NULL; 70 dc = NULL;
72 GNUNET_FS_download_stop (d, delete_incomplete);
73 } 71 }
74} 72}
75 73
@@ -170,6 +168,13 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
170 } 168 }
171 break; 169 break;
172 case GNUNET_FS_STATUS_DOWNLOAD_ERROR: 170 case GNUNET_FS_STATUS_DOWNLOAD_ERROR:
171#if !WINDOWS
172 if (0 != isatty (1))
173 fprintf (stdout, "\n");
174#else
175 if (FILE_TYPE_CHAR == GetFileType (GetStdHandle (STD_OUTPUT_HANDLE)))
176 fprintf (stdout, "\n");
177#endif
173 FPRINTF (stderr, _("Error downloading: %s.\n"), 178 FPRINTF (stderr, _("Error downloading: %s.\n"),
174 info->value.download.specifics.error.message); 179 info->value.download.specifics.error.message);
175 GNUNET_SCHEDULER_shutdown (); 180 GNUNET_SCHEDULER_shutdown ();
@@ -178,6 +183,13 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
178 s = GNUNET_STRINGS_byte_size_fancy (info->value.download.completed * 1000 / 183 s = GNUNET_STRINGS_byte_size_fancy (info->value.download.completed * 1000 /
179 (info->value.download. 184 (info->value.download.
180 duration.rel_value + 1)); 185 duration.rel_value + 1));
186#if !WINDOWS
187 if (0 != isatty (1))
188 fprintf (stdout, "\n");
189#else
190 if (FILE_TYPE_CHAR == GetFileType (GetStdHandle (STD_OUTPUT_HANDLE)))
191 fprintf (stdout, "\n");
192#endif
181 FPRINTF (stdout, _("Downloading `%s' done (%s/s).\n"), 193 FPRINTF (stdout, _("Downloading `%s' done (%s/s).\n"),
182 info->value.download.filename, s); 194 info->value.download.filename, s);
183 GNUNET_free (s); 195 GNUNET_free (s);