vhost: get internal ops when registering
[dpdk.git] / lib / librte_cmdline / cmdline_parse.c
index 03e0b53..940480d 100644 (file)
@@ -1,35 +1,34 @@
 /*-
  *   BSD LICENSE
- * 
- *   Copyright(c) 2010-2012 Intel Corporation. All rights reserved.
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
  *   All rights reserved.
- * 
- *   Redistribution and use in source and binary forms, with or without 
- *   modification, are permitted provided that the following conditions 
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
  *   are met:
- * 
- *     * Redistributions of source code must retain the above copyright 
+ *
+ *     * Redistributions of source code must retain the above copyright
  *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright 
- *       notice, this list of conditions and the following disclaimer in 
- *       the documentation and/or other materials provided with the 
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
  *       distribution.
- *     * Neither the name of Intel Corporation nor the names of its 
- *       contributors may be used to endorse or promote products derived 
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
  *       from this software without specific prior written permission.
- * 
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
  */
 
 /*
@@ -271,7 +270,7 @@ cmdline_parse(struct cmdline *cl, const char * buf)
        }
 
 #ifdef RTE_LIBRTE_CMDLINE_DEBUG
-       rte_snprintf(debug_buf, (linelen>64 ? 64 : linelen), "%s", buf);
+       snprintf(debug_buf, (linelen>64 ? 64 : linelen), "%s", buf);
        debug_printf("Parse line : len=%d, <%s>\n", linelen, debug_buf);
 #endif
 
@@ -416,7 +415,7 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state,
                                if (!strncmp(partial_tok, tmpbuf,
                                             partial_tok_len)) {
                                        if (comp_len == -1) {
-                                               rte_snprintf(comp_buf, sizeof(comp_buf),
+                                               snprintf(comp_buf, sizeof(comp_buf),
                                                         "%s", tmpbuf + partial_tok_len);
                                                comp_len =
                                                        strnlen(tmpbuf + partial_tok_len,
@@ -453,7 +452,7 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state,
                                if ((unsigned)(comp_len + 1) > size)
                                        return 0;
 
-                               rte_snprintf(dst, size, "%s", comp_buf);
+                               snprintf(dst, size, "%s", comp_buf);
                                dst[comp_len] = 0;
                                return 2;
                        }
@@ -494,14 +493,14 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state,
                                                        sizeof(tmpbuf));
                                help_str = inst->help_str;
                                if (help_str)
-                                       rte_snprintf(dst, size, "[%s]: %s", tmpbuf,
+                                       snprintf(dst, size, "[%s]: %s", tmpbuf,
                                                 help_str);
                                else
-                                       rte_snprintf(dst, size, "[%s]: No help",
+                                       snprintf(dst, size, "[%s]: No help",
                                                 tmpbuf);
                        }
                        else {
-                               rte_snprintf(dst, size, "[RETURN]");
+                               snprintf(dst, size, "[RETURN]");
                        }
                        return 1;
                }
@@ -529,16 +528,16 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state,
                                        continue;
                                }
                                (*state)++;
-                               l=rte_snprintf(dst, size, "%s", tmpbuf);
+                               l=snprintf(dst, size, "%s", tmpbuf);
                                if (l>=0 && token_hdr.ops->get_help) {
                                        token_hdr.ops->get_help(token_p, tmpbuf,
                                                                sizeof(tmpbuf));
                                        help_str = inst->help_str;
                                        if (help_str)
-                                               rte_snprintf(dst+l, size-l, "[%s]: %s",
+                                               snprintf(dst+l, size-l, "[%s]: %s",
                                                         tmpbuf, help_str);
                                        else
-                                               rte_snprintf(dst+l, size-l,
+                                               snprintf(dst+l, size-l,
                                                         "[%s]: No help", tmpbuf);
                                }