Lines Matching refs:bar
71 static void fly(struct ProgressData *bar, bool moved) in fly() argument
75 int check = bar->width - 2; in fly()
78 DEBUGASSERT(bar->width <= MAX_BARLENGTH); in fly()
80 memset(&buf[1], ' ', bar->width); in fly()
81 buf[bar->width + 1] = '\0'; in fly()
83 memcpy(&buf[bar->bar + 1], "-=O=-", 5); in fly()
85 pos = sinus[bar->tick%200] / (1000000 / check) + 1; in fly()
87 pos = sinus[(bar->tick + 5)%200] / (1000000 / check) + 1; in fly()
89 pos = sinus[(bar->tick + 10)%200] / (1000000 / check) + 1; in fly()
91 pos = sinus[(bar->tick + 15)%200] / (1000000 / check) + 1; in fly()
94 fputs(buf, bar->out); in fly()
95 bar->tick += 2; in fly()
96 if(bar->tick >= 200) in fly()
97 bar->tick -= 200; in fly()
99 bar->bar += (moved ? bar->barmove : 0); in fly()
100 if(bar->bar >= (bar->width - 6)) { in fly()
101 bar->barmove = -1; in fly()
102 bar->bar = bar->width - 6; in fly()
104 else if(bar->bar < 0) { in fly()
105 bar->barmove = 1; in fly()
106 bar->bar = 0; in fly()
121 static void update_width(struct ProgressData *bar) in update_width() argument
125 bar->width = MAX_BARLENGTH; in update_width()
127 bar->width = (int)cols; in update_width()
129 bar->width = MIN_BARLENGTH; in update_width()
139 struct ProgressData *bar = &per->progressbar; in tool_progress_cb() local
145 if(bar->initial_size < 0) { in tool_progress_cb()
151 else if((CURL_OFF_T_MAX - bar->initial_size) < (dltotal + ultotal)) in tool_progress_cb()
154 total = dltotal + ultotal + bar->initial_size; in tool_progress_cb()
158 if(bar->initial_size < 0) { in tool_progress_cb()
164 else if((CURL_OFF_T_MAX - bar->initial_size) < (dlnow + ulnow)) in tool_progress_cb()
167 point = dlnow + ulnow + bar->initial_size; in tool_progress_cb()
169 if(bar->calls) { in tool_progress_cb()
173 if(bar->prev == point) in tool_progress_cb()
176 else if((tvdiff(now, bar->prevtime) < 100L) && point < total) in tool_progress_cb()
182 if(tvdiff(now, bar->prevtime) < 100L) in tool_progress_cb()
185 update_width(bar); in tool_progress_cb()
186 fly(bar, point != bar->prev); in tool_progress_cb()
191 bar->calls++; in tool_progress_cb()
193 update_width(bar); in tool_progress_cb()
194 if((total > 0) && (point != bar->prev)) { in tool_progress_cb()
207 barwidth = bar->width - 7; in tool_progress_cb()
218 fprintf(bar->out, format, line, percent); in tool_progress_cb()
223 fflush(bar->out); in tool_progress_cb()
224 bar->prev = point; in tool_progress_cb()
225 bar->prevtime = now; in tool_progress_cb()
235 void progressbarinit(struct ProgressData *bar, in progressbarinit() argument
238 memset(bar, 0, sizeof(struct ProgressData)); in progressbarinit()
243 bar->initial_size = config->resume_from; in progressbarinit()
245 update_width(bar); in progressbarinit()
247 bar->out = tool_stderr; in progressbarinit()
248 bar->tick = 150; in progressbarinit()
249 bar->barmove = 1; in progressbarinit()