mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
fixed rpcclient readline code
This commit is contained in:
parent
386fdff2df
commit
4ec971e905
@ -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;
|
||||
|
@ -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);
|
||||
line = smb_readline(prompt, NULL, NULL);
|
||||
|
||||
if (!fgets(cmd, sizeof(cmd) - 1, stdin)) {
|
||||
break;
|
||||
}
|
||||
|
||||
cmd[strlen(cmd) - 1] = '\0';
|
||||
#endif
|
||||
result = process_cmd(&cli, cmd);
|
||||
result = process_cmd(&cli, line);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user