*** Progress.c Thu Oct 17 02:55:33 1996 --- hacked_progress.c Sat Aug 09 18:36:59 1997 *************** *** 11,16 **** --- 11,22 ---- #include "Bookmark.h" #include "Main.h" + + #if defined(__CYGWIN32__) + void SetTitle(char *title); + void GetTitle(char *title, int maxlen); + #endif + /* NOTE: There is more commentary at the bottom of this source file. */ /* The progress meter the user requested us to use. We may not actually be *************** *** 155,160 **** --- 161,170 ---- static int maxBarLen; str64 spec1, spec3; static string bar; + #if defined(__CYGWIN32__) + static char *init_title = NULL, + *new_title; + #endif int i; int secsLeft, minLeft; *************** *** 186,191 **** --- 196,206 ---- * plus the other stuff. */ EPrintF(spec1, " ", xp->expectedSize); + #if defined(__CYGWIN32__) + init_title = malloc(1024+1); + new_title = malloc(1024+1); + GetTitle(init_title, 1024); + #endif break; case kPrUpdateMsg: /* Compute how much of the bar should be colored in. */ *************** *** 251,260 **** --- 266,289 ---- bar[curBarLen - 1] = '='; bar[curBarLen] = '='; + #if defined(__CYGWIN32__) + sprintf(new_title, "%d%% of %s %s", + perc, + xp->localFileName, + NETREADING(xp) ? "received" : "sent"); + SetTitle(new_title); + #endif + + break; case kPrEndMsg: result = kPrWantStatsMsg; EPrintF("\n"); + #if defined(__CYGWIN32__) + SetTitle(init_title); + free(init_title); + free(new_title); + #endif break; } return result; *************** *** 370,388 **** */ int PrKBytes(XferSpecPtr xp, int mode) { ! int result = 0; switch (mode) { case kPrInitMsg: EPrintF("%s: ", xp->localFileName); break; case kPrUpdateMsg: ! EPrintF("\b\b\b\b\b\b%5ldK", (xp->bytesTransferred + ! xp->startPoint) / 1024); break; case kPrEndMsg: result = kPrWantStatsMsg; EPrintF("\b\b\b\b\b\b"); break; } return result; --- 399,439 ---- */ int PrKBytes(XferSpecPtr xp, int mode) { ! int result = 0, ! kb; ! #if defined(__CYGWIN32__) ! static char *init_title = NULL, ! *new_title; ! #endif switch (mode) { case kPrInitMsg: EPrintF("%s: ", xp->localFileName); + #if defined(__CYGWIN32__) + init_title = malloc(1024+1); + new_title = malloc(1024+1); + GetTitle(init_title, 1024); + #endif break; case kPrUpdateMsg: ! kb = (xp->bytesTransferred + xp->startPoint) / 1024; ! EPrintF("\b\b\b\b\b\b%5ldK", kb); ! #if defined(__CYGWIN32__) ! sprintf(new_title, "%dK of %s %s", ! kb, ! xp->localFileName, ! NETREADING(xp) ? "received" : "sent"); ! SetTitle(new_title); ! #endif break; case kPrEndMsg: result = kPrWantStatsMsg; EPrintF("\b\b\b\b\b\b"); + #if defined(__CYGWIN32__) + SetTitle(init_title); + free(init_title); + free(new_title); + #endif break; } return result; *************** *** 837,839 **** --- 888,906 ---- *****************************************************************************/ /* eof Progress.c */ + + #if defined(__CYGWIN32__) + # undef TRUE + # undef FALSE + # define Beep BB + # include + void SetTitle(char *title) + { + SetConsoleTitle(title); + } + + void GetTitle(char *title, int maxlen) + { + GetConsoleTitle(title, maxlen); + } + #endif