Lines Matching refs:bar
81 static void fly(struct ProgressData *bar, bool moved)
85 int check = bar->width - 2;
87 /* bar->width is range checked when assigned */
88 DEBUGASSERT(bar->width <= MAX_BARLENGTH);
89 memset(buf, ' ', bar->width);
90 buf[bar->width] = '\r';
91 buf[bar->width + 1] = '\0';
93 memcpy(&buf[bar->bar], "-=O=-", 5);
95 pos = sinus[bar->tick%200] / (1000000 / check);
97 pos = sinus[(bar->tick + 5)%200] / (1000000 / check);
99 pos = sinus[(bar->tick + 10)%200] / (1000000 / check);
101 pos = sinus[(bar->tick + 15)%200] / (1000000 / check);
104 fputs(buf, bar->out);
105 bar->tick += 2;
106 if(bar->tick >= 200)
107 bar->tick -= 200;
109 bar->bar += (moved?bar->barmove:0);
110 if(bar->bar >= (bar->width - 6)) {
111 bar->barmove = -1;
112 bar->bar = bar->width - 6;
114 else if(bar->bar < 0) {
115 bar->barmove = 1;
116 bar->bar = 0;
138 struct ProgressData *bar = &per->progressbar;
144 if(bar->initial_size < 0) {
150 else if((CURL_OFF_T_MAX - bar->initial_size) < (dltotal + ultotal))
153 total = dltotal + ultotal + bar->initial_size;
157 if(bar->initial_size < 0) {
163 else if((CURL_OFF_T_MAX - bar->initial_size) < (dlnow + ulnow))
166 point = dlnow + ulnow + bar->initial_size;
168 if(bar->calls) {
172 if(bar->prev == point)
175 else if((tvdiff(now, bar->prevtime) < 100L) && point < total)
176 /* limit progress-bar updating to 10 Hz except when we're at 100% */
181 if(tvdiff(now, bar->prevtime) < 100L)
182 /* limit progress-bar updating to 10 Hz */
184 fly(bar, point != bar->prev);
189 bar->calls++;
191 if((total > 0) && (point != bar->prev)) {
204 barwidth = bar->width - 7;
215 fprintf(bar->out, format, line, percent);
220 fflush(bar->out);
221 bar->prev = point;
222 bar->prevtime = now;
232 void progressbarinit(struct ProgressData *bar,
236 memset(bar, 0, sizeof(struct ProgressData));
241 bar->initial_size = config->resume_from;
249 bar->width = (int)num;
253 if(!bar->width) {
281 bar->width = cols;
284 if(!bar->width)
285 bar->width = 79;
286 else if(bar->width > MAX_BARLENGTH)
287 bar->width = MAX_BARLENGTH;
289 bar->out = tool_stderr;
290 bar->tick = 150;
291 bar->barmove = 1;