003 File Manager
Current Path:
/usr/src/contrib/wpa/src/utils
usr
/
src
/
contrib
/
wpa
/
src
/
utils
/
📁
..
📄
base64.c
(4.52 KB)
📄
base64.h
(653 B)
📄
bitfield.c
(1.37 KB)
📄
bitfield.h
(558 B)
📄
browser-android.c
(2.62 KB)
📄
browser-system.c
(2.39 KB)
📄
browser-wpadebug.c
(3.14 KB)
📄
browser.c
(5.93 KB)
📄
browser.h
(451 B)
📄
build_config.h
(1.38 KB)
📄
common.c
(24.26 KB)
📄
common.h
(14.84 KB)
📄
const_time.h
(5.45 KB)
📄
crc32.c
(3.7 KB)
📄
crc32.h
(297 B)
📄
edit.c
(20.21 KB)
📄
edit.h
(612 B)
📄
edit_readline.c
(3.78 KB)
📄
edit_simple.c
(1.77 KB)
📄
eloop.c
(32.23 KB)
📄
eloop.h
(13.77 KB)
📄
eloop_win.c
(15.17 KB)
📄
ext_password.c
(2.02 KB)
📄
ext_password.h
(855 B)
📄
ext_password_i.h
(713 B)
📄
ext_password_test.c
(1.72 KB)
📄
http-utils.h
(1.71 KB)
📄
http_curl.c
(44.53 KB)
📄
includes.h
(1.09 KB)
📄
ip_addr.c
(1.02 KB)
📄
ip_addr.h
(608 B)
📄
json.c
(12.54 KB)
📄
json.h
(1.02 KB)
📄
list.h
(2.4 KB)
📄
module_tests.h
(438 B)
📄
os.h
(19.54 KB)
📄
os_internal.c
(8.66 KB)
📄
os_none.c
(3.3 KB)
📄
os_unix.c
(15.06 KB)
📄
os_win32.c
(4.68 KB)
📄
pcsc_funcs.c
(37.61 KB)
📄
pcsc_funcs.h
(1.4 KB)
📄
platform.h
(508 B)
📄
radiotap.c
(12.25 KB)
📄
radiotap.h
(10.67 KB)
📄
radiotap_iter.h
(2.86 KB)
📄
state_machine.h
(5.25 KB)
📄
trace.c
(8.28 KB)
📄
trace.h
(1.88 KB)
📄
utils_module_tests.c
(28.14 KB)
📄
uuid.c
(1.8 KB)
📄
uuid.h
(439 B)
📄
wpa_debug.c
(18.68 KB)
📄
wpa_debug.h
(12.38 KB)
📄
wpabuf.c
(7.44 KB)
📄
wpabuf.h
(4.14 KB)
📄
xml-utils.c
(9.29 KB)
📄
xml-utils.h
(4.01 KB)
📄
xml_libxml2.c
(9.07 KB)
Editing: edit_readline.c
/* * Command line editing and history wrapper for readline * Copyright (c) 2010, Jouni Malinen <j@w1.fi> * * This software may be distributed under the terms of the BSD license. * See README for more details. */ #include "includes.h" #include <readline/readline.h> #include <readline/history.h> #include "common.h" #include "eloop.h" #include "edit.h" static void *edit_cb_ctx; static void (*edit_cmd_cb)(void *ctx, char *cmd); static void (*edit_eof_cb)(void *ctx); static char ** (*edit_completion_cb)(void *ctx, const char *cmd, int pos) = NULL; static char **pending_completions = NULL; static void readline_free_completions(void) { int i; if (pending_completions == NULL) return; for (i = 0; pending_completions[i]; i++) os_free(pending_completions[i]); os_free(pending_completions); pending_completions = NULL; } static char * readline_completion_func(const char *text, int state) { static int pos = 0; static size_t len = 0; if (pending_completions == NULL) { rl_attempted_completion_over = 1; return NULL; } if (state == 0) { pos = 0; len = os_strlen(text); } for (; pending_completions[pos]; pos++) { if (strncmp(pending_completions[pos], text, len) == 0) return strdup(pending_completions[pos++]); } rl_attempted_completion_over = 1; return NULL; } static char ** readline_completion(const char *text, int start, int end) { readline_free_completions(); if (edit_completion_cb) pending_completions = edit_completion_cb(edit_cb_ctx, rl_line_buffer, end); return rl_completion_matches(text, readline_completion_func); } static void edit_read_char(int sock, void *eloop_ctx, void *sock_ctx) { rl_callback_read_char(); } static void trunc_nl(char *str) { char *pos = str; while (*pos != '\0') { if (*pos == '\n') { *pos = '\0'; break; } pos++; } } static void readline_cmd_handler(char *cmd) { if (cmd && *cmd) { HIST_ENTRY *h; while (next_history()) ; h = previous_history(); if (h == NULL || os_strcmp(cmd, h->line) != 0) add_history(cmd); next_history(); } if (cmd == NULL) { edit_eof_cb(edit_cb_ctx); return; } trunc_nl(cmd); edit_cmd_cb(edit_cb_ctx, cmd); } int edit_init(void (*cmd_cb)(void *ctx, char *cmd), void (*eof_cb)(void *ctx), char ** (*completion_cb)(void *ctx, const char *cmd, int pos), void *ctx, const char *history_file, const char *ps) { edit_cb_ctx = ctx; edit_cmd_cb = cmd_cb; edit_eof_cb = eof_cb; edit_completion_cb = completion_cb; rl_attempted_completion_function = readline_completion; if (history_file) { read_history(history_file); stifle_history(100); } eloop_register_read_sock(STDIN_FILENO, edit_read_char, NULL, NULL); if (ps) { size_t blen = os_strlen(ps) + 3; char *ps2 = os_malloc(blen); if (ps2) { os_snprintf(ps2, blen, "%s> ", ps); rl_callback_handler_install(ps2, readline_cmd_handler); os_free(ps2); return 0; } } rl_callback_handler_install("> ", readline_cmd_handler); return 0; } void edit_deinit(const char *history_file, int (*filter_cb)(void *ctx, const char *cmd)) { rl_set_prompt(""); rl_replace_line("", 0); rl_redisplay(); rl_callback_handler_remove(); readline_free_completions(); eloop_unregister_read_sock(STDIN_FILENO); if (history_file) { /* Save command history, excluding lines that may contain * passwords. */ HIST_ENTRY *h; history_set_pos(0); while ((h = current_history())) { char *p = h->line; while (*p == ' ' || *p == '\t') p++; if (filter_cb && filter_cb(edit_cb_ctx, p)) { h = remove_history(where_history()); if (h) { free(h->line); free(h->data); free(h); } else next_history(); } else next_history(); } write_history(history_file); } } void edit_clear_line(void) { } void edit_redraw(void) { rl_on_new_line(); rl_redisplay(); }
Upload File
Create Folder