annotate loadtools/flerase.c @ 1011:6d9b10633f10

etmsync Pirelli IMEI retrieval: fix poor use of printf() Bug reported by Vadim Yanitskiy <fixeria@osmocom.org>: the construct where a static-allocated string was passed to printf() without any format arguments causes newer compilers to report a security problem. Given that formatted output is not needed here, just fixed string output, change printf() to fputs(), and direct the error message to stderr while at it.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 23 May 2024 17:29:57 +0000
parents 185c9bf208d3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
668
cd48bc4c5460 fc-loadtool code: erase command split out into flerase.c
Mychaela Falconia <falcon@freecalypso.org>
parents: 616
diff changeset
2 * Flash erase operations are implemented here
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <sys/types.h>
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdio.h>
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdint.h>
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <string.h>
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <strings.h>
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <stdlib.h>
616
4be92bcd1535 fc-loadtool: added operation time reporting to flash erase
Mychaela Falconia <falcon@freecalypso.org>
parents: 506
diff changeset
11 #include <time.h>
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include "flash.h"
669
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
13 #include "discontig.h"
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 extern struct flash_bank_info flash_bank_info[2];
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 flashcmd_erase(argc, argv, bank)
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 char **argv;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 {
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 struct flash_bank_info *bi;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 u_long offset, len;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 char *strtoul_endp;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 struct sector_info *startsec, *endsec, *sp;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 int stat;
616
4be92bcd1535 fc-loadtool: added operation time reporting to flash erase
Mychaela Falconia <falcon@freecalypso.org>
parents: 506
diff changeset
25 time_t start_time, finish_time;
4be92bcd1535 fc-loadtool: added operation time reporting to flash erase
Mychaela Falconia <falcon@freecalypso.org>
parents: 506
diff changeset
26 unsigned duration, mm, ss;
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 if (argc != 4) {
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 inv: fprintf(stderr, "usage: %s %s hex-start-offset hex-length\n",
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 argv[0], argv[1]);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 return(-1);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 }
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 offset = strtoul(argv[2], &strtoul_endp, 16);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 if (*strtoul_endp)
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 goto inv;
506
0dd2c87c1b63 fc-loadtool flash support overhaul
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
36 if (flash_detect(bank, 0) < 0)
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 return(-1);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 bi = flash_bank_info + bank;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 if (offset >= bi->geom->total_size) {
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 fprintf(stderr,
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 "error: specified offset exceeds flash bank size (0x%lx)\n",
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 (u_long) bi->geom->total_size);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 return(-1);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 }
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 len = strtoul(argv[3], &strtoul_endp, 16);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 if (*strtoul_endp)
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 goto inv;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 if (len > bi->geom->total_size - offset) {
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 fprintf(stderr,
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 "error: specified offset+length exceed flash bank size (0x%lx)\n",
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 (u_long) bi->geom->total_size);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 return(-1);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 }
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 if (!len) {
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 printf("Zero length specified - nothing to do!\n");
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 return(0);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 }
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 /* now enforce sector alignment for both offset and length */
669
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
59 if (get_flash_sector_table(bi) < 0)
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 return(-1);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 if (get_flash_sector_range(bi, offset, len, &startsec, &endsec) < 0)
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 return(-1);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 printf("Erasing %d sector(s)\n", endsec - startsec);
616
4be92bcd1535 fc-loadtool: added operation time reporting to flash erase
Mychaela Falconia <falcon@freecalypso.org>
parents: 506
diff changeset
64 time(&start_time);
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 for (sp = startsec; sp < endsec; sp++) {
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 stat = bi->ops->erase_sector(bi, sp);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 if (stat)
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 return(stat);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 putchar('.');
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 fflush(stdout);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 }
616
4be92bcd1535 fc-loadtool: added operation time reporting to flash erase
Mychaela Falconia <falcon@freecalypso.org>
parents: 506
diff changeset
72 time(&finish_time);
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 putchar('\n');
616
4be92bcd1535 fc-loadtool: added operation time reporting to flash erase
Mychaela Falconia <falcon@freecalypso.org>
parents: 506
diff changeset
74 duration = finish_time - start_time;
4be92bcd1535 fc-loadtool: added operation time reporting to flash erase
Mychaela Falconia <falcon@freecalypso.org>
parents: 506
diff changeset
75 mm = duration / 60;
4be92bcd1535 fc-loadtool: added operation time reporting to flash erase
Mychaela Falconia <falcon@freecalypso.org>
parents: 506
diff changeset
76 ss = duration - mm * 60;
692
185c9bf208d3 loadtools operation time reporting: two digits for seconds
Mychaela Falconia <falcon@freecalypso.org>
parents: 669
diff changeset
77 printf("Operation completed in %um%02us\n", mm, ss);
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 return(0);
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 }
669
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
80
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
81 erase_sectors_for_prog(bi, regions, nregions)
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
82 struct flash_bank_info *bi;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
83 struct discontig_prog *regions;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
84 unsigned nregions;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
85 {
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
86 struct sector_info *seclist[256], **seclp, **secendp, *sp;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
87 struct discontig_prog *regp, *regendp;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
88 uint32_t endaddr, secendaddr;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
89 int flag, stat;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
90 time_t start_time, finish_time;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
91 unsigned duration, mm, ss;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
92
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
93 if (get_flash_sector_table(bi) < 0)
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
94 return(-1);
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
95 seclp = seclist;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
96 endaddr = regions[nregions-1].end;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
97 regendp = regions + nregions;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
98 for (sp = bi->sectors; sp->size; sp++) {
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
99 if (sp->start >= endaddr)
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
100 break;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
101 secendaddr = sp->start + sp->size;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
102 flag = 0;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
103 for (regp = regions; regp < regendp; regp++) {
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
104 if (regp->start >= secendaddr)
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
105 break;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
106 if (sp->start >= regp->end)
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
107 continue;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
108 flag = 1;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
109 break;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
110 }
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
111 if (flag)
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
112 *seclp++ = sp;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
113 }
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
114 secendp = seclp;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
115 printf("Erasing %d sector(s)\n", secendp - seclist);
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
116 time(&start_time);
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
117 for (seclp = seclist; seclp < secendp; seclp++) {
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
118 sp = *seclp;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
119 stat = bi->ops->erase_sector(bi, sp);
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
120 if (stat)
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
121 return(stat);
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
122 putchar('.');
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
123 fflush(stdout);
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
124 }
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
125 time(&finish_time);
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
126 putchar('\n');
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
127 duration = finish_time - start_time;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
128 mm = duration / 60;
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
129 ss = duration - mm * 60;
692
185c9bf208d3 loadtools operation time reporting: two digits for seconds
Mychaela Falconia <falcon@freecalypso.org>
parents: 669
diff changeset
130 printf("Operation completed in %um%02us\n", mm, ss);
669
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
131 return(0);
ba9523ca6ed8 fc-loadtool code: preparations for e-program-* addition
Mychaela Falconia <falcon@freecalypso.org>
parents: 668
diff changeset
132 }