X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-tools%2Fao-dbg%2Fao-dbg-main.c;h=25eca54b149cb7dae8ec654721ddd4ca043cbfd9;hp=72249a6b0855402d65f5093eb925a893dc2ec239;hb=ebb36d56c732ffe9cdb8d2ea53d00e1d4ece8f97;hpb=1c2a0b6653623b689d68d7349a6b2dce3e20a4a6 diff --git a/ao-tools/ao-dbg/ao-dbg-main.c b/ao-tools/ao-dbg/ao-dbg-main.c index 72249a6b..25eca54b 100644 --- a/ao-tools/ao-dbg/ao-dbg-main.c +++ b/ao-tools/ao-dbg/ao-dbg-main.c @@ -16,6 +16,10 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "ao-dbg.h" #include #include @@ -24,6 +28,7 @@ #include #include #include +#include static int s51_port = 0; static char *cpu = "8051"; @@ -32,6 +37,8 @@ char *s51_prompt = "> "; struct ccdbg *s51_dbg; int s51_interrupted = 0; int s51_monitor = 0; +char *s51_tty = NULL; +char *s51_device = NULL; static FILE *s51_input; static FILE *s51_output; @@ -48,6 +55,12 @@ void s51_sigint() s51_interrupted = 1; } +static const struct option options[] = { + { .name = "tty", .has_arg = 1, .val = 'T' }, + { .name = "device", .has_arg = 1, .val = 'D' }, + { 0, 0, 0, 0 }, +}; + int main(int argc, char **argv) { @@ -55,7 +68,7 @@ main(int argc, char **argv) char *endptr; struct sigvec vec, ovec; - while ((opt = getopt(argc, argv, "PVvHhmt:X:c:r:Z:s:S:p:")) != -1) { + while ((opt = getopt_long(argc, argv, "PVvHhmt:X:c:r:Z:s:S:p:T:", options, NULL)) != -1) { switch (opt) { case 't': cpu = optarg; @@ -104,6 +117,12 @@ main(int argc, char **argv) case 'm': s51_monitor = 1; break; + case 'T': + s51_tty = optarg; + break; + case 'D': + s51_device = optarg; + break; } } if (s51_port) { @@ -189,13 +208,16 @@ s51_putc(int c) putc(c, s51_output); } +#if HAVE_LIBREADLINE #include #include +#endif int s51_read_line(char *line, int len) { int ret; +#if HAVE_LIBREADLINE if (s51_output == stdout && s51_input == stdin && s51_prompt) { char *r; @@ -206,7 +228,9 @@ s51_read_line(char *line, int len) line[len-1] = '\0'; add_history(r); return 1; - } else { + } else +#endif + { if (s51_prompt) s51_printf("%s", s51_prompt); else