#define CMDLINE_PARSE_COMPLETED_BUFFER 2
#define CMDLINE_MAX_TOKEN_SIZE 128 /* including '\0' */
+#define CMDLINE_MAX_DSTBUF_SIZE 1024
/**
* Stores a pointer to the ops struct, and the offset: the place to
*
* parse() takes the token as first argument, then the source buffer
* starting at the token we want to parse. The 3rd arg is a pointer
- * where we store the parsed data (as binary). It returns the number of
- * parsed chars on success and a negative value on error.
+ * where we store the parsed data (as binary), and the 4th arg is the
+ * size of this area. It returns 0 on success and a negative value on
+ * error.
*
* complete_get_nb() returns the number of possible values for this
* token if completion is possible. If it is NULL or if it returns 0,
* no completion is possible.
*
* complete_get_elt() copy in dstbuf (the size is specified in the
- * parameter) the i-th possible completion for this token. returns 0
- * on success or and a negative value on error.
+ * parameter) the i-th possible completion for this token. Return 0
+ * on success or a negative value on error.
*
* get_help() fills the dstbuf with the help for the token. It returns
* -1 on error and 0 on success.
*/
struct cmdline_token_ops {
/** parse(token ptr, buf, res pts) */
- int (*parse)(cmdline_parse_token_hdr_t *, const char *, void *);
+ int (*parse)(cmdline_parse_token_hdr_t *, const char *, void *,
+ unsigned int);
/** return the num of possible choices for this token */
int (*complete_get_nb)(cmdline_parse_token_hdr_t *);
/** return the elt x for this token (token, idx, dstbuf, size) */
- int (*complete_get_elt)(cmdline_parse_token_hdr_t *, int, char *, unsigned int);
+ int (*complete_get_elt)(cmdline_parse_token_hdr_t *, int, char *,
+ unsigned int);
/** get help for this token (token, dstbuf, size) */
int (*get_help)(cmdline_parse_token_hdr_t *, char *, unsigned int);
};