# HG changeset patch # User Mychaela Falconia # Date 1501726376 0 # Node ID a91dc71575441dc1d558175c3e2b7c3ea64a89c7 # Parent 96332d875fc98408eb01506b15be02b9b37cd494 fc-loadtool: automated command script mode implemented diff -r 96332d875fc9 -r a91dc7157544 loadtools/ltmain.c --- a/loadtools/ltmain.c Thu Aug 03 01:33:06 2017 +0000 +++ b/loadtools/ltmain.c Thu Aug 03 02:12:56 2017 +0000 @@ -62,10 +62,10 @@ case '?': default: usage: fprintf(stderr, - "usage: fc-loadtool [options] ttyport\n"); + "usage: fc-loadtool [options] ttyport [command-script]\n"); exit(1); } - if (argc - optind != 1) + if (argc - optind < 1 || argc - optind > 2) goto usage; target_ttydev = argv[optind]; if (!iramimage.filename) @@ -83,7 +83,17 @@ putchar('\n'); if (hw_init_script[0]) { printf("Executing init script %s\n", hw_init_script); - loadtool_exec_script(hw_init_script, 1); + c = loadtool_exec_script(hw_init_script, 1); + } else + c = 0; + if (argc - optind > 1) { + if (c) + exit(1); + printf("Executing command script %s\n", argv[optind+1]); + c = loadtool_exec_script(argv[optind+1], 0); + if (c) + exit(1); + default_exit(0); } } for (;;) {