lib/readline.c

ソースコードを見る。

関数

static char * smb_readline_replacement (const char *prompt, void(*callback)(void), char **(completion_fn)(const char *text, int start, int end))
char * smb_readline (const char *prompt, void(*callback)(void), char **(completion_fn)(const char *text, int start, int end))
const char * smb_readline_get_line_buffer (void)
void smb_readline_ca_char (char c)
int cmd_history (void)


関数

static char* smb_readline_replacement ( const char *  prompt,
void(*)(void)  callback,
char **  (completion_fn)(const char *text, int start, int end) 
) [static]

readline.c53 行で定義されています。

参照先 callback()fdlinesys_select_intr()x_fflush()x_fgets()x_fileno()x_fprintf()x_stdinx_stdout.

参照元 smb_readline().

00055 {
00056         fd_set fds;
00057         static pstring line;
00058         struct timeval timeout;
00059         int fd = x_fileno(x_stdin);
00060         char *ret;
00061 
00062         /* Prompt might be NULL in non-interactive mode. */
00063         if (prompt) {
00064                 x_fprintf(x_stdout, "%s", prompt);
00065                 x_fflush(x_stdout);
00066         }
00067 
00068         while (1) {
00069                 timeout.tv_sec = 5;
00070                 timeout.tv_usec = 0;
00071 
00072                 FD_ZERO(&fds);
00073                 FD_SET(fd,&fds);
00074         
00075                 if (sys_select_intr(fd+1,&fds,NULL,NULL,&timeout) == 1) {
00076                         ret = x_fgets(line, sizeof(line), x_stdin);
00077                         return ret;
00078                 }
00079                 if (callback)
00080                         callback();
00081         }
00082 }

char* smb_readline ( const char *  prompt,
void(*)(void)  callback,
char **  (completion_fn)(const char *text, int start, int end) 
)

readline.c88 行で定義されています。

参照先 interactivesmb_readline_replacement()x_fileno()x_stdin.

参照元 main()net_rpc_shell()process_stdin().

00090 {
00091         char *ret;
00092         BOOL interactive;
00093 
00094         interactive = isatty(x_fileno(x_stdin)) || getenv("CLI_FORCE_INTERACTIVE");
00095         if (!interactive) {
00096             return smb_readline_replacement(NULL, callback, completion_fn);
00097         }
00098 
00099 #if HAVE_LIBREADLINE
00100 
00101         /* Aargh!  Readline does bizzare things with the terminal width
00102         that mucks up expect(1).  Set CLI_NO_READLINE in the environment
00103         to force readline not to be used. */
00104 
00105         if (getenv("CLI_NO_READLINE"))
00106                 return smb_readline_replacement(prompt, callback, completion_fn);
00107 
00108         if (completion_fn) {
00109                 /* The callback prototype has changed slightly between
00110                 different versions of Readline, so the same function
00111                 works in all of them to date, but we get compiler
00112                 warnings in some.  */
00113                 rl_attempted_completion_function = RL_COMPLETION_CAST completion_fn;
00114         }
00115 
00116 #if HAVE_DECL_RL_EVENT_HOOK
00117         if (callback)
00118                 rl_event_hook = (Function *)callback;
00119 #endif
00120         ret = readline(prompt);
00121         if (ret && *ret)
00122                 add_history(ret);
00123 
00124 #else
00125         ret = smb_readline_replacement(prompt, callback, completion_fn);
00126 #endif
00127 
00128         return ret;
00129 }

const char* smb_readline_get_line_buffer ( void   ) 

readline.c134 行で定義されています。

参照元 completion_fn().

00135 {
00136 #if defined(HAVE_LIBREADLINE)
00137         return rl_line_buffer;
00138 #else
00139         return NULL;
00140 #endif
00141 }

void smb_readline_ca_char ( char  c  ) 

readline.c147 行で定義されています。

参照元 completion_fn()completion_remote_filter().

00148 {
00149 #if defined(HAVE_LIBREADLINE)
00150         rl_completion_append_character = c;
00151 #endif
00152 }

int cmd_history ( void   ) 

readline.c157 行で定義されています。

参照先 line.

00158 {
00159 #if defined(HAVE_LIBREADLINE) && defined(HAVE_HISTORY_LIST)
00160         HIST_ENTRY **hlist;
00161         int i;
00162 
00163         hlist = history_list();
00164         
00165         for (i = 0; hlist && hlist[i]; i++) {
00166                 DEBUG(0, ("%d: %s\n", i, hlist[i]->line));
00167         }
00168 #else
00169         DEBUG(0,("no history without readline support\n"));
00170 #endif
00171 
00172         return 0;
00173 }


Sambaに対してSat Aug 29 21:23:36 2009に生成されました。  doxygen 1.4.7