X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-tools%2Fao-dbg%2Fao-dbg-parse.c;h=b61d68b8db7266cf1696cda57a1162c92a6a3851;hp=5db6c01c1e9dc2bbc3bb7fe3649537c52df63dfc;hb=6f729ff46b2f4531db68f0af85e7e9fe0f6d1969;hpb=7c790fe859dff062692964338091ffbbcdf63257 diff --git a/ao-tools/ao-dbg/ao-dbg-parse.c b/ao-tools/ao-dbg/ao-dbg-parse.c index 5db6c01c..b61d68b8 100644 --- a/ao-tools/ao-dbg/ao-dbg-parse.c +++ b/ao-tools/ao-dbg/ao-dbg-parse.c @@ -68,41 +68,6 @@ static struct command_function functions[] = { #define TRUE 1 #endif -static int -string_to_int(char *s, int *v) -{ - char *endptr; - - if (isdigit(s[0]) || s[0] == '-' || s[0] == '+') { - *v = strtol(s, &endptr, 0); - if (endptr == s) - return FALSE; - } else if (*s == '\'') { - s++; - if (*s == '\\') { - s++; - switch (*s) { - case 'n': - *v = '\n'; - break; - case 't': - *v = '\t'; - break; - default: - *v = (int) *s; - break; - } - } else - *v = (int) *s; - s++; - if (*s != '\'') - return FALSE; - } - else - return FALSE; - return TRUE; -} - struct command_function * command_string_to_function(struct command_function *functions, char *name) { @@ -195,11 +160,14 @@ command_read (void) enum command_result result; struct command_function *func; - s51_dbg = ccdbg_open (); - if (!s51_dbg) { - perror("ccdbg_open"); - exit(1); + if (!s51_tty) { + if (!s51_device) + s51_device = getenv("AO_DBG_DEVICE"); + s51_tty = cc_usbdevs_find_by_arg(s51_device, "TeleDongle"); } + s51_dbg = ccdbg_open (s51_tty); + if (!s51_dbg) + exit(1); ccdbg_debug_mode(s51_dbg); ccdbg_halt(s51_dbg); s51_printf("Welcome to the non-simulated processor\n");