diff 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
line wrap: on
line diff
--- a/loadtools/ltmain.c	Thu Aug 03 03:21:39 2017 +0000
+++ b/loadtools/ltmain.c	Fri Aug 04 08:06:36 2017 +0000
@@ -18,7 +18,7 @@
 
 extern struct baudrate *find_baudrate_by_name();
 
-static struct baudrate *reattach;
+static struct baudrate *reattach, *batch_baud;
 
 main(argc, argv)
 	char **argv;
@@ -28,7 +28,7 @@
 	int c;
 	char command[512];
 
-	while ((c = getopt(argc, argv, "a:b:c:C:h:H:i:nr:")) != EOF)
+	while ((c = getopt(argc, argv, "a:b:B:c:C:h:H:i:nr:")) != EOF)
 		switch (c) {
 		case 'a':
 			iramimage.filename = optarg;
@@ -36,6 +36,11 @@
 		case 'b':
 			set_romload_baudrate(optarg);
 			continue;
+		case 'B':
+			batch_baud = find_baudrate_by_name(optarg);
+			if (!batch_baud)
+				exit(1);	/* error msg already printed */
+			continue;
 		case 'c':
 			set_compalstage_short(optarg);
 			continue;
@@ -89,6 +94,11 @@
 		if (argc - optind > 1) {
 			if (c)
 				exit(1);
+			if (batch_baud) {
+				c = loadagent_switch_baud(batch_baud);
+				if (c)
+					exit(1);
+			}
 			printf("Executing command script %s\n", argv[optind+1]);
 			c = loadtool_exec_script(argv[optind+1], 0);
 			if (c)