summaryrefslogtreecommitdiffstats
path: root/source3
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-03-19 00:32:16 +0000
committerAndrew Tridgell <tridge@samba.org>2001-03-19 00:32:16 +0000
commit62711a9ceb375fef2c0af0f649d8c77eb94483f9 (patch)
tree95da07c42da5cd782c7db3272da490204db2975c /source3
parente17e7b64175dcfc9963405a9fa3724f8d7097d89 (diff)
downloadsamba-62711a9ceb375fef2c0af0f649d8c77eb94483f9.tar.gz
samba-62711a9ceb375fef2c0af0f649d8c77eb94483f9.tar.xz
samba-62711a9ceb375fef2c0af0f649d8c77eb94483f9.zip
fixed rpcclient readline code
(This used to be commit 4ec971e905cefada5f3980a25781730acdbf4469)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/readline.c2
-rw-r--r--source3/rpcclient/rpcclient.c19
2 files changed, 4 insertions, 17 deletions
diff --git a/source3/lib/readline.c b/source3/lib/readline.c
index 4a3c5434c79..75a38c68521 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 42d9d4e4862..9934808c773 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;