mirror of
https://github.com/reactos/reactos.git
synced 2024-10-19 07:28:18 +00:00
Fix status output
svn path=/trunk/; revision=29655
This commit is contained in:
parent
66f59d880b
commit
f0b2c954e0
|
@ -38,6 +38,27 @@ CBindStatusCallback_Destroy(CBindStatusCallback *This)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
write_status(LPCTSTR lpFmt, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
/* FIXME: Determine line length! */
|
||||||
|
TCHAR szTxt[80];
|
||||||
|
int c;
|
||||||
|
|
||||||
|
va_start(args, lpFmt);
|
||||||
|
_vstprintf(szTxt, lpFmt, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
c = _tcslen(szTxt);
|
||||||
|
while (c < (sizeof(szTxt) / sizeof(szTxt[0])) - 1)
|
||||||
|
szTxt[c++] = _T(' ');
|
||||||
|
szTxt[c] = _T('\0');
|
||||||
|
|
||||||
|
_tprintf(_T("\r%.79s"), szTxt);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CBindStatusCallback_UpdateProgress(CBindStatusCallback *This)
|
CBindStatusCallback_UpdateProgress(CBindStatusCallback *This)
|
||||||
{
|
{
|
||||||
|
@ -50,12 +71,12 @@ CBindStatusCallback_UpdateProgress(CBindStatusCallback *This)
|
||||||
if (Percentage > 99)
|
if (Percentage > 99)
|
||||||
Percentage = 99;
|
Percentage = 99;
|
||||||
|
|
||||||
_tprintf(_T("\r%2d%% (%I64u bytes downloaded)"), Percentage, This->Progress);
|
write_status(_T("%2d%% (%I64u bytes downloaded)"), Percentage, This->Progress);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Unknown size */
|
/* Unknown size */
|
||||||
_tprintf(_T("\r%I64u bytes downloaded"), This->Progress);
|
write_status(_T("%I64u bytes downloaded"), This->Progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +235,8 @@ CBindStatusCallback_OnProgress(IBindStatusCallback *iface,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BINDSTATUS_ENDDOWNLOADDATA:
|
case BINDSTATUS_ENDDOWNLOADDATA:
|
||||||
_tprintf(_T("\rFile saved.\n"));
|
write_status(_T("File saved."));
|
||||||
|
_tprintf(_T("\n"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BINDSTATUS_DOWNLOADINGDATA:
|
case BINDSTATUS_DOWNLOADINGDATA:
|
||||||
|
@ -415,6 +437,8 @@ download_file(IN LPCTSTR pszUrl,
|
||||||
static int
|
static int
|
||||||
print_err(int iErr)
|
print_err(int iErr)
|
||||||
{
|
{
|
||||||
|
write_status(_T(""));
|
||||||
|
|
||||||
if (iErr == DWNL_E_LASTERROR)
|
if (iErr == DWNL_E_LASTERROR)
|
||||||
{
|
{
|
||||||
if (GetLastError() == ERROR_SUCCESS)
|
if (GetLastError() == ERROR_SUCCESS)
|
||||||
|
|
Loading…
Reference in a new issue