diff options
-rw-r--r-- | source3/lib/readline.c | 2 | ||||
-rw-r--r-- | source3/rpcclient/rpcclient.c | 19 |
2 files changed, 4 insertions, 17 deletions
diff --git a/source3/lib/readline.c b/source3/lib/readline.c index 4a3c5434c7..75a38c6852 100644 --- a/source3/lib/readline.c +++ b/source3/lib/readline.c @@ -52,7 +52,7 @@ char *smb_readline(char *prompt, void (*callback)(void), rl_attempted_completion_function = completion_fn; } - rl_event_hook = (Function *)callback; + if (callback) rl_event_hook = (Function *)callback; ret = readline(prompt); if (ret && *ret) add_history(ret); return ret; diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 42d9d4e486..9934808c77 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -455,11 +455,6 @@ static void usage(char *pname) charset_initialise(); setlinebuf(stdout); -#ifdef HAVE_LIBREADLINE - /* Allow conditional parsing of the ~/.inputrc file. */ - rl_readline_name = "rpcclient"; -#endif - DEBUGLEVEL = 1; /* Parse options */ @@ -610,24 +605,16 @@ static void usage(char *pname) /* Loop around accepting commands */ while(1) { pstring prompt, cmd; + char *line; uint32 result; ZERO_STRUCT(cmd); slprintf(prompt, sizeof(prompt) - 1, "rpcclient $> "); -#if HAVE_READLINE - cmd = readline(prompt); -#else - printf("%s", prompt); - - if (!fgets(cmd, sizeof(cmd) - 1, stdin)) { - break; - } + line = smb_readline(prompt, NULL, NULL); - cmd[strlen(cmd) - 1] = '\0'; -#endif - result = process_cmd(&cli, cmd); + result = process_cmd(&cli, line); } return 0; |