python:tests: Store keys as bytes rather than as lists of ints
[samba.git] / libcli / smbreadline / smbreadline.c
index c58555400ca90095daf3806f3ad60428966577be..0a95c6319e51673b969a46539495031fb6c715c8 100644 (file)
@@ -47,7 +47,7 @@
 
 static bool smb_rl_done;
 
-#if HAVE_LIBREADLINE
+#ifdef HAVE_LIBREADLINE
 /*
  * MacOS/X does not have rl_done in readline.h, but
  * readline.so has it
@@ -58,7 +58,7 @@ extern int rl_done;
 void smb_readline_done(void)
 {
        smb_rl_done = true;
-#if HAVE_LIBREADLINE
+#ifdef HAVE_LIBREADLINE
        rl_done = 1;
 #endif
 }
@@ -71,13 +71,13 @@ static char *smb_readline_replacement(const char *prompt, void (*callback)(void)
                                char **(completion_fn)(const char *text, int start, int end))
 {
        char *line = NULL;
-       int fd = x_fileno(x_stdin);
+       int fd = fileno(stdin);
        char *ret;
 
        /* Prompt might be NULL in non-interactive mode. */
        if (prompt) {
-               x_fprintf(x_stdout, "%s", prompt);
-               x_fflush(x_stdout);
+               printf("%s", prompt);
+               fflush(stdout);
        }
 
        line = (char *)malloc(BUFSIZ);
@@ -93,7 +93,7 @@ static char *smb_readline_replacement(const char *prompt, void (*callback)(void)
                pfd.events = POLLIN|POLLHUP;
 
                if (sys_poll_intr(&pfd, 1, 5000) == 1) {
-                       ret = x_fgets(line, BUFSIZ, x_stdin);
+                       ret = fgets(line, BUFSIZ, stdin);
                        if (ret == 0) {
                                SAFE_FREE(line);
                        }
@@ -117,14 +117,14 @@ char *smb_readline(const char *prompt, void (*callback)(void),
        char *ret;
        bool interactive;
 
-       interactive = isatty(x_fileno(x_stdin)) || getenv("CLI_FORCE_INTERACTIVE");
+       interactive = isatty(fileno(stdin)) || getenv("CLI_FORCE_INTERACTIVE");
        if (!interactive) {
                return smb_readline_replacement(NULL, callback, completion_fn);
        }
 
-#if HAVE_LIBREADLINE
+#ifdef HAVE_LIBREADLINE
 
-       /* Aargh!  Readline does bizzare things with the terminal width
+       /* Aargh!  Readline does bizarre things with the terminal width
        that mucks up expect(1).  Set CLI_NO_READLINE in the environment
        to force readline not to be used. */
 
@@ -145,7 +145,7 @@ char *smb_readline(const char *prompt, void (*callback)(void),
                rl_basic_word_break_characters = " \t\n";
        }
 
-#if HAVE_DECL_RL_EVENT_HOOK
+#ifdef HAVE_DECL_RL_EVENT_HOOK
        if (callback)
                rl_event_hook = (rl_hook_func_t *)callback;
 #endif