X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=debugger%2Fmcs51%2Fsdcdb.c;h=fc132d8c87acf772b96d625c79e440e5a8c0d0b1;hb=bb226788dab3832b0ec0cda70874ce3fce4eebc6;hp=507ad1bfc7b7337b8b598f32a0b230b663de1649;hpb=3abe9c9ebb6edf00418306f026fd256c52e42af4;p=fw%2Fsdcc diff --git a/debugger/mcs51/sdcdb.c b/debugger/mcs51/sdcdb.c index 507ad1bf..fc132d8c 100644 --- a/debugger/mcs51/sdcdb.c +++ b/debugger/mcs51/sdcdb.c @@ -27,6 +27,9 @@ #include "break.h" #include "cmd.h" #include "newalloc.h" +#if defined HAVE_LIBREADLINE && HAVE_LIBREADLINE != -1 +#define HAVE_READLINE_COMPLETITION 1 +#endif #ifdef HAVE_LIBREADLINE #include #include @@ -62,7 +65,7 @@ int lineno = 0; int fatalError = 0; static void commandLoop(FILE *cmdfile); -#ifdef HAVE_LIBREADLINE +#ifdef HAVE_READLINE_COMPLETITION char *completionCmdSource(const char *text, int state); char *completionCmdFile(const char *text, int state); char *completionCmdInfo(const char *text, int state); @@ -86,18 +89,18 @@ char *completionCmdSetOption(const char *text, int state); #define completionCmdUnDisplay NULL #define completionCmdSetUserBp NULL #define completionCmdSetOption NULL -#endif /* HAVE_LIBREADLINE */ +#endif /* HAVE_READLINE_COMPLETITION */ /* command table */ struct cmdtab { char *cmd ; /* command the user will enter */ int (*cmdfunc)(char *,context *); /* function to execute when command is entered */ -#ifdef HAVE_LIBREADLINE +#ifdef HAVE_READLINE_COMPLETITION rl_compentry_func_t *completion_func; #else void *dummy; -#endif /* HAVE_LIBREADLINE */ +#endif /* HAVE_READLINE_COMPLETITION */ char *htxt ; /* short help text */ } cmdTab[] = { @@ -958,7 +961,7 @@ void stopCommandList() stopcmdlist = 1; } -#ifdef HAVE_LIBREADLINE +#ifdef HAVE_READLINE_COMPLETITION // helper function for doing readline completion. // input: toknum=index of token to find (0=first token) // output: *start=first character index of the token, @@ -1419,7 +1422,7 @@ char *completionMain(const char *text, int state) return (*compl_func)(text,state); } -#endif /* HAVE_LIBREADLINE */ +#endif /* HAVE_READLINE_COMPLETITION */ /*-----------------------------------------------------------------*/ /* commandLoop - the main command loop or loop over command file */ @@ -1433,7 +1436,9 @@ static void commandLoop(FILE *cmdfile) FILE *old_rl_instream, *old_rl_outstream; actualcmdfile = cmdfile; +#ifdef HAVE_READLINE_COMPLETITION rl_completion_entry_function = completionMain; +#endif /* HAVE_READLINE_COMPLETITION */ rl_readline_name = "sdcdb"; // Allow conditional parsing of the ~/.inputrc file. // save readline's input/output streams @@ -1453,9 +1458,9 @@ static void commandLoop(FILE *cmdfile) if ( cmdfile == stdin ) { if (sim_cmd_mode) - line_read = (char*)readline ("(sim)"); + line_read = (char*)readline ("(sim) "); else - line_read = (char*)readline ("(sdcdb)"); + line_read = (char*)readline ("(sdcdb) "); } else line_read = (char*)readline ("");