comparison loadtools/ltmain.c @ 232:353218c38996

fc-loadtool batch mode: added -B option
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 04 Aug 2017 08:06:36 +0000
parents a91dc7157544
children 8c011177adb9
comparison
equal deleted inserted replaced
231:a58a7bbc0618 232:353218c38996
16 extern void (*default_exit)(); 16 extern void (*default_exit)();
17 extern int gta_modem_poweron; 17 extern int gta_modem_poweron;
18 18
19 extern struct baudrate *find_baudrate_by_name(); 19 extern struct baudrate *find_baudrate_by_name();
20 20
21 static struct baudrate *reattach; 21 static struct baudrate *reattach, *batch_baud;
22 22
23 main(argc, argv) 23 main(argc, argv)
24 char **argv; 24 char **argv;
25 { 25 {
26 extern char *optarg; 26 extern char *optarg;
27 extern int optind; 27 extern int optind;
28 int c; 28 int c;
29 char command[512]; 29 char command[512];
30 30
31 while ((c = getopt(argc, argv, "a:b:c:C:h:H:i:nr:")) != EOF) 31 while ((c = getopt(argc, argv, "a:b:B:c:C:h:H:i:nr:")) != EOF)
32 switch (c) { 32 switch (c) {
33 case 'a': 33 case 'a':
34 iramimage.filename = optarg; 34 iramimage.filename = optarg;
35 continue; 35 continue;
36 case 'b': 36 case 'b':
37 set_romload_baudrate(optarg); 37 set_romload_baudrate(optarg);
38 continue;
39 case 'B':
40 batch_baud = find_baudrate_by_name(optarg);
41 if (!batch_baud)
42 exit(1); /* error msg already printed */
38 continue; 43 continue;
39 case 'c': 44 case 'c':
40 set_compalstage_short(optarg); 45 set_compalstage_short(optarg);
41 continue; 46 continue;
42 case 'C': 47 case 'C':
87 } else 92 } else
88 c = 0; 93 c = 0;
89 if (argc - optind > 1) { 94 if (argc - optind > 1) {
90 if (c) 95 if (c)
91 exit(1); 96 exit(1);
97 if (batch_baud) {
98 c = loadagent_switch_baud(batch_baud);
99 if (c)
100 exit(1);
101 }
92 printf("Executing command script %s\n", argv[optind+1]); 102 printf("Executing command script %s\n", argv[optind+1]);
93 c = loadtool_exec_script(argv[optind+1], 0); 103 c = loadtool_exec_script(argv[optind+1], 0);
94 if (c) 104 if (c)
95 exit(1); 105 exit(1);
96 default_exit(0); 106 default_exit(0);