summaryrefslogtreecommitdiffstats
path: root/lib/qfstring.c
diff options
context:
space:
mode:
authorChris Hall <chris.hall@highwayman.com>2011-02-13 23:11:45 +0000
committerChris Hall <chris.hall@highwayman.com>2011-02-13 23:11:45 +0000
commit5cae7eea451f2b7d65b5892e2c1dafc70f8b836e (patch)
tree0fbd9679e9ae28e7d061b5bdda08756077415ecb /lib/qfstring.c
parent64be6d766a65dc0749d17f5023d714678e9c96a6 (diff)
downloadquagga-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/qfstring.c')
-rw-r--r--lib/qfstring.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/qfstring.c b/lib/qfstring.c
index 3db3fedf..f40f1417 100644
--- a/lib/qfstring.c
+++ b/lib/qfstring.c
@@ -26,10 +26,10 @@
*/
/*------------------------------------------------------------------------------
- * Initialise qf_str -- to given size (which includes the '\n')
+ * Initialise qf_str -- to given size (which includes the '\0')
*
* Sets pointers and terminates an empty string with one byte reserved for the
- * terminating '\n'.
+ * terminating '\0'.
*
* This operation is async-signal-safe.
*/
@@ -47,12 +47,12 @@ qfs_init(qf_str qfs, char* str, size_t size)
/*------------------------------------------------------------------------------
* Initialise qf_str which already contains string -- to given size (which
- * includes the '\n')
+ * includes the '\0')
*
* This may be used to prepare for appending to a buffer which already contains
* something.
*
- * Sets pointers, setting the write pointer to the existing terminating '\n'.
+ * Sets pointers, setting the write pointer to the existing terminating '\0'.
*
* This operation is async-signal-safe.
*/
@@ -331,7 +331,7 @@ qfs_pointer(qf_str qfs, void* p_val, enum pf_flags flags,
*
* If the precision is < 0 it is ignored (unless pf_hex, see below).
*
- * If the precision is 0 it is ignored unless bf_precision is set.
+ * If the precision is 0 it is ignored unless pf_precision is set.
*
* Precedence issues:
*
@@ -776,7 +776,7 @@ qfs_vprintf(qf_str qfs, const char *format, va_list args)
if (precision < 0)
{
precision = 0 ;
- flags &= ~pf_precision ;
+ flags &= ~pf_precision ; /* completely ignore */
} ;
}
else
@@ -885,7 +885,7 @@ qfs_vprintf(qf_str qfs, const char *format, va_list args)
* %s handler -- tolerates NULL pointer
*
* Accepts: width
- * precision
+ * precision -- ignored if < 0
* pf_precision -- explicit precision
*
* Rejects: pf_commas -- "'" seen
@@ -913,6 +913,12 @@ qfs_arg_string(qf_str qfs, va_list args, enum pf_flags flags,
if (flags != (flags & pf_precision))
return pfp_failed ;
+ if (precision < 0) /* make sure */
+ {
+ precision = 0 ;
+ flags &= ~pf_precision ;
+ } ;
+
len = (src != NULL) ? strlen(src) : 0 ;
if (((precision > 0) || (flags & pf_precision)) && (len > precision))
len = precision ;