git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ethdev: init all builtin drivers
[dpdk.git]
/
lib
/
librte_cmdline
/
cmdline_parse.c
diff --git
a/lib/librte_cmdline/cmdline_parse.c
b/lib/librte_cmdline/cmdline_parse.c
index
f9d46ca
..
03e0b53
100644
(file)
--- a/
lib/librte_cmdline/cmdline_parse.c
+++ b/
lib/librte_cmdline/cmdline_parse.c
@@
-30,7
+30,6
@@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * version: DPDK.L.1.2.3-3
*/
/*
*/
/*
@@
-125,7
+124,7
@@
nb_common_chars(const char * s1, const char * s2)
{
unsigned int i=0;
{
unsigned int i=0;
- while (*s1==*s2 && *s1
&& *s2
) {
+ while (*s1==*s2 && *s1) {
s1++;
s2++;
i++;
s1++;
s2++;
i++;
@@
-229,11
+228,16
@@
cmdline_parse(struct cmdline *cl, const char * buf)
int parse_it = 0;
int err = CMDLINE_PARSE_NOMATCH;
int tok;
int parse_it = 0;
int err = CMDLINE_PARSE_NOMATCH;
int tok;
- cmdline_parse_ctx_t *ctx
= cl->ctx
;
+ cmdline_parse_ctx_t *ctx;
#ifdef RTE_LIBRTE_CMDLINE_DEBUG
char debug_buf[BUFSIZ];
#endif
#ifdef RTE_LIBRTE_CMDLINE_DEBUG
char debug_buf[BUFSIZ];
#endif
+ if (!cl || !buf)
+ return CMDLINE_PARSE_BAD_ARGS;
+
+ ctx = cl->ctx;
+
/*
* - look if the buffer contains at least one line
* - look if line contains only spaces or comments
/*
* - look if the buffer contains at least one line
* - look if line contains only spaces or comments
@@
-343,7
+347,12
@@
cmdline_complete(struct cmdline *cl, const char *buf, int *state,
unsigned int nb_non_completable;
int local_state = 0;
const char *help_str;
unsigned int nb_non_completable;
int local_state = 0;
const char *help_str;
- cmdline_parse_ctx_t *ctx = cl->ctx;
+ cmdline_parse_ctx_t *ctx;
+
+ if (!cl || !buf || !state || !dst)
+ return -1;
+
+ ctx = cl->ctx;
debug_printf("%s called\n", __func__);
memset(&token_hdr, 0, sizeof(token_hdr));
debug_printf("%s called\n", __func__);
memset(&token_hdr, 0, sizeof(token_hdr));
@@
-424,6
+433,7
@@
cmdline_complete(struct cmdline *cl, const char *buf, int *state,
}
}
next:
}
}
next:
+ debug_printf("next\n");
inst_num ++;
inst = ctx[inst_num];
}
inst_num ++;
inst = ctx[inst_num];
}