diff options
author | Chris Hall <chris.hall@highwayman.com> | 2011-02-13 23:11:45 +0000 |
---|---|---|
committer | Chris Hall <chris.hall@highwayman.com> | 2011-02-13 23:11:45 +0000 |
commit | 5cae7eea451f2b7d65b5892e2c1dafc70f8b836e (patch) | |
tree | 0fbd9679e9ae28e7d061b5bdda08756077415ecb /lib/vty_pipe.c | |
parent | 64be6d766a65dc0749d17f5023d714678e9c96a6 (diff) | |
download | quagga-5cae7eea451f2b7d65b5892e2c1dafc70f8b836e.tar.bz2 quagga-5cae7eea451f2b7d65b5892e2c1dafc70f8b836e.tar.xz |
Second tranche of updates for pipework branch.
modified: bgpd/bgp_connection.c
modified: bgpd/bgp_debug.c
modified: bgpd/bgp_engine.h
modified: bgpd/bgp_main.c
modified: bgpd/bgp_packet.c
modified: bgpd/bgp_peer.c
modified: bgpd/bgp_route.c
modified: bgpd/bgp_routemap.c
modified: bgpd/bgp_session.c
modified: bgpd/bgp_vty.c
modified: bgpd/bgpd.c
modified: bgpd/bgpd.h
modified: configure.ac
modified: isisd/dict.h
modified: isisd/isis_misc.c
modified: isisd/isis_routemap.c
modified: isisd/isis_spf.c
modified: lib/Makefile.am
modified: lib/command.c
modified: lib/command.h
modified: lib/command_execute.h
modified: lib/command_parse.c
modified: lib/command_parse.h
modified: lib/command_queue.c
modified: lib/command_queue.h
modified: lib/elstring.h
modified: lib/heap.c
modified: lib/if.c
modified: lib/if.h
modified: lib/keychain.c
modified: lib/keystroke.c
modified: lib/keystroke.h
modified: lib/list_util.c
modified: lib/list_util.h
modified: lib/log.c
modified: lib/log.h
modified: lib/memory.c
modified: lib/memory.h
modified: lib/memtypes.c
modified: lib/misc.h
modified: lib/mqueue.c
modified: lib/mqueue.h
deleted: lib/node_type.h
modified: lib/pthread_safe.c
modified: lib/qfstring.c
modified: lib/qiovec.c
modified: lib/qiovec.h
modified: lib/qpath.c
modified: lib/qpnexus.c
modified: lib/qpnexus.h
modified: lib/qpselect.c
modified: lib/qpthreads.h
modified: lib/qstring.c
modified: lib/qstring.h
modified: lib/qtime.c
modified: lib/qtime.h
modified: lib/qtimers.c
modified: lib/qtimers.h
modified: lib/routemap.c
modified: lib/symtab.h
modified: lib/thread.h
deleted: lib/uty.h
modified: lib/vector.c
modified: lib/vector.h
modified: lib/version.h.in
modified: lib/vio_fifo.c
modified: lib/vio_fifo.h
modified: lib/vio_lines.c
modified: lib/vio_lines.h
modified: lib/vty.c
modified: lib/vty.h
modified: lib/vty_cli.c
modified: lib/vty_cli.h
modified: lib/vty_io.c
modified: lib/vty_io.h
modified: lib/vty_io_basic.c
modified: lib/vty_io_basic.h
modified: lib/vty_io_file.c
modified: lib/vty_io_file.h
modified: lib/vty_io_shell.c
modified: lib/vty_io_term.c
modified: lib/vty_io_term.h
modified: lib/vty_local.h
modified: lib/vty_pipe.c
modified: lib/workqueue.h
modified: lib/zebra.h
modified: ospf6d/ospf6_lsa.c
modified: ripngd/ripngd.c
modified: tests/test-list_util.c
modified: tests/test-vector.c
modified: vtysh/vtysh.c
modified: vtysh/vtysh_config.c
Diffstat (limited to 'lib/vty_pipe.c')
-rw-r--r-- | lib/vty_pipe.c | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/lib/vty_pipe.c b/lib/vty_pipe.c index d4f1c9ba..3276085c 100644 --- a/lib/vty_pipe.c +++ b/lib/vty_pipe.c @@ -24,12 +24,11 @@ #include <zebra.h> #include "vty.h" -#include "uty.h" #include "vty_cli.h" +#include "vty_command.h" #include "vty_io.h" #include "vio_lines.h" -#include "command.h" #include "command_execute.h" #include "command_queue.h" @@ -194,7 +193,7 @@ * */ - +#if 0 @@ -684,7 +683,7 @@ uty_cli_dispatch(vty_io vio) cli_do = vio->cli_do ; /* current operation */ vio->cli_do = cli_do_nothing ; /* clear */ - qs_clear(&vio->cl) ; /* set cl empty (with '\0') */ + qs_clear(vio->cl) ; /* set cl empty (with '\0') */ /* Reset the command output FIFO and line_control */ assert(vio_fifo_empty(&vio->cmd_obuf)) ; @@ -706,7 +705,7 @@ uty_cli_dispatch(vty_io vio) break ; case cli_do_command: - ret = uty_command(vty) ; + ret = uty_dispatch_command(vty) ; break ; case cli_do_ctrl_c: @@ -1401,7 +1400,7 @@ uty_cli_draw_this(vty_io vio, enum node_type node) prompt = "%s ???: " ; } ; - qs_printf(&vio->cli_prompt_for_node, prompt, vty_host_name); + qs_printf(vio->cli_prompt_for_node, prompt, vty_host_name); vio->cli_prompt_node = node ; vio->cli_prompt_set = 1 ; @@ -1778,12 +1777,12 @@ uty_cli_insert (vty_io vio, const char* chars, int n) if (n <= 0) return n ; /* avoid trouble */ - after = qs_insert(&vio->cl, chars, n) ; + after = qs_insert(vio->cl, chars, n) ; - uty_cli_echo(vio, qs_cp_char(&vio->cl), after + n) ; + uty_cli_echo(vio, qs_cp_char(vio->cl), after) ; - if (after != 0) - uty_cli_echo_n(vio, telnet_backspaces, after) ; + if ((after - n) != 0) + uty_cli_echo_n(vio, telnet_backspaces, after - n) ; vio->cl.cp += n ; @@ -1806,7 +1805,7 @@ uty_cli_overwrite (vty_io vio, char* chars, int n) if (n > 0) { - qs_replace(&vio->cl, chars, n) ; + qs_replace(vio->cl, n, chars, n) ; uty_cli_echo(vio, chars, n) ; vio->cl.cp += n ; @@ -1854,7 +1853,7 @@ uty_cli_forwards(vty_io vio, int n) if (n > 0) { - uty_cli_echo(vio, qs_cp_char(&vio->cl), n) ; + uty_cli_echo(vio, qs_cp_char(vio->cl), n) ; vio->cl.cp += n ; } ; @@ -1907,10 +1906,10 @@ uty_cli_del_forwards(vty_io vio, int n) if (n <= 0) return 0 ; - after = qs_delete(&vio->cl, n) ; + after = qs_delete(vio->cl, n) ; if (after > 0) - uty_cli_echo(vio, qs_cp_char(&vio->cl), after) ; + uty_cli_echo(vio, qs_cp_char(vio->cl), after) ; uty_cli_echo_n(vio, telnet_spaces, n) ; uty_cli_echo_n(vio, telnet_backspaces, after + n) ; @@ -1969,8 +1968,8 @@ uty_cli_word_forwards_delta(vty_io vio) assert(vio->cl.cp <= vio->cl.len) ; - cp = qs_cp_char(&vio->cl) ; - ep = qs_ep_char(&vio->cl) ; + cp = qs_cp_char(vio->cl) ; + ep = qs_ep_char(vio->cl) ; tp = cp ; @@ -2013,8 +2012,8 @@ uty_cli_word_backwards_delta(vty_io vio, int eat_spaces) assert(vio->cl.cp <= vio->cl.len) ; - cp = qs_cp_char(&vio->cl) ; - sp = qs_chars(&vio->cl) ; + cp = qs_cp_char(vio->cl) ; + sp = qs_chars(vio->cl) ; tp = cp ; @@ -2128,7 +2127,7 @@ uty_cli_transpose_chars(vty_io vio) uty_cli_backwards(vio, 1) ; /* Pick up in the new order */ - cp = qs_cp_char(&vio->cl) ; + cp = qs_cp_char(vio->cl) ; chars[1] = *cp++ ; chars[0] = *cp ; @@ -2176,13 +2175,13 @@ uty_cli_hist_add (vty_io vio, const char* cmd_line) * Either way, replace the the previous line entry by moving hindex * back ! */ - if ((prev_line == NULL) || (qs_cmp_sig(prev_line, &line) == 0)) + if ((prev_line == NULL) || (qs_cmp_sig(prev_line, line) == 0)) vio->hindex = prev_index ; else prev_line = vector_get_item(vio->hist, vio->hindex) ; /* Now replace the hindex entry */ - vector_set_item(vio->hist, vio->hindex, qs_copy(prev_line, &line)) ; + vector_set_item(vio->hist, vio->hindex, qs_copy(prev_line, line)) ; /* Advance to the near future and reset the history pointer */ vio->hindex++; @@ -2225,7 +2224,7 @@ uty_cli_history_use(vty_io vio, int step) * current command line -- so can get back to it. */ hist = vector_get_item(&vio->hist, vio->hindex) ; - vector_set_item(vio->hist, vio->hindex, qs_copy(hist, &vio->cl)) ; + vector_set_item(vio->hist, vio->hindex, qs_copy(hist, vio->cl)) ; } ; /* Advance or retreat */ @@ -2255,7 +2254,7 @@ uty_cli_history_use(vty_io vio, int step) /* Get previous line from history buffer and echo that */ old_len = vio->cl.len ; - qs_copy(&vio->cl, hist) ; + qs_copy(vio->cl, hist) ; /* Sort out wiping out any excess and setting the cursor position */ if (old_len > vio->cl.len) @@ -2448,7 +2447,7 @@ static void uty_cli_describe_show(vty_io vio, vector describe) { unsigned int i, cmd_width, desc_width; - struct desc *desc, *desc_cr ; + struct desc *desc, *cr_item ; /* Get width of the longest "word" */ cmd_width = 0; @@ -2472,7 +2471,7 @@ uty_cli_describe_show(vty_io vio, vector describe) desc_width = vio->width - (cmd_width + 6); /* Print out description. */ - desc_cr = NULL ; /* put <cr> last if it appears */ + cr_item = NULL ; /* put <cr> last if it appears */ for (i = 0; i < vector_active (describe); i++) if ((desc = vector_slot (describe, i)) != NULL) @@ -2480,17 +2479,17 @@ uty_cli_describe_show(vty_io vio, vector describe) if (desc->cmd[0] == '\0') continue; - if (strcmp (desc->cmd, command_cr) == 0) + if (strcmp (desc->cmd, cr_string) == 0) { - desc_cr = desc; + cr_item = desc; continue; } uty_cli_describe_fold (vio, cmd_width, desc_width, desc); } - if (desc_cr != NULL) - uty_cli_describe_fold (vio, cmd_width, desc_width, desc_cr); + if (cr_item != NULL) + uty_cli_describe_fold (vio, cmd_width, desc_width, cr_item); } ; /*------------------------------------------------------------------------------ @@ -2865,3 +2864,5 @@ uty_telnet_command(vty_io vio, keystroke stroke, bool callback) return dealt_with ; } ; + +#endif |