1 /* ------------------------------------------------------------------------ */
3 /* indicator.c -- put indicator */
5 /* Modified Nobutaka Watazaki */
7 /* Ver. 1.14 Source All chagned 1995.01.14 N.Watazaki */
8 /* Separated from append.c 2003.07.21 Koji Arai */
9 /* ------------------------------------------------------------------------ */
12 #define MAX_INDICATOR_COUNT 64
14 static size_t reading_size;
16 #ifdef NEED_INCREMENTAL_INDICATOR
17 static size_t indicator_count;
18 static long indicator_threshold;
22 start_indicator(name, size, msg, def_indicator_threshold)
26 long def_indicator_threshold;
28 #ifdef NEED_INCREMENTAL_INDICATOR
36 #ifdef NEED_INCREMENTAL_INDICATOR
39 m = MAX_INDICATOR_COUNT - strlen(name);
40 if (m < 1) /* Bug Fixed by N.Watazaki */
42 printf("\r%s\t- %s : ", name, msg);
44 ((size + (m * def_indicator_threshold - 1)) /
45 (m * def_indicator_threshold) *
46 def_indicator_threshold);
47 if (indicator_threshold)
48 i = ((size + (indicator_threshold - 1)) / indicator_threshold);
54 printf("\r%s\t- %s : ", name, msg);
57 printf("\r%s :", name);
61 printf("%s\t- ", name);
67 #ifdef NEED_INCREMENTAL_INDICATOR
72 reading_size += count;
73 if (!quiet && indicator_threshold) {
74 while (reading_size > indicator_count) {
77 indicator_count += indicator_threshold;
84 finish_indicator2(name, msg, pcnt)
93 pcnt = 100; /* (^_^) */
94 #ifdef NEED_INCREMENTAL_INDICATOR
95 printf("\r%s\t- %s(%d%%)\n", name, msg, pcnt);
103 finish_indicator(name, msg)
110 #ifdef NEED_INCREMENTAL_INDICATOR
111 printf("\r%s\t- %s\n", name, msg);