FreeCalypso > hg > freecalypso-tools
changeset 230:a91dc7157544
fc-loadtool: automated command script mode implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 03 Aug 2017 02:12:56 +0000 |
parents | 96332d875fc9 |
children | a58a7bbc0618 |
files | loadtools/ltmain.c |
diffstat | 1 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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 (;;) {