FreeCalypso > hg > freecalypso-sw
diff loadtools/ltmain.c @ 29:dacf45e3d20f
loadtool: scripting functionality implemented
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sat, 04 May 2013 07:15:51 +0000 |
parents | ae6294b8a015 |
children | 16315ed6401a |
line wrap: on
line diff
--- a/loadtools/ltmain.c Sat May 04 06:39:05 2013 +0000 +++ b/loadtools/ltmain.c Sat May 04 07:15:51 2013 +0000 @@ -12,17 +12,16 @@ extern char *target_ttydev; extern struct srecreader iramimage; extern char default_loadagent_image[]; - +extern char hw_init_script[]; extern void (*default_exit)(); -char loadtool_command[512]; - main(argc, argv) char **argv; { extern char *optarg; extern int optind; int c; + char command[512]; while ((c = getopt(argc, argv, "a:h:H:i:")) != EOF) switch (c) { @@ -55,13 +54,18 @@ putchar('\n'); if (tpinterf_pass_output(1) < 0) exit(1); + putchar('\n'); + if (hw_init_script) { + printf("Executing init script %s\n", hw_init_script); + loadtool_exec_script(hw_init_script); + } for (;;) { if (isatty(0)) { fputs("loadtool> ", stdout); fflush(stdout); } - if (!fgets(loadtool_command, sizeof loadtool_command, stdin)) + if (!fgets(command, sizeof command, stdin)) default_exit(); - loadtool_dispatch_cmd(); + loadtool_dispatch_cmd(command, 0); } }