added busy command to the example + declared option parser options as const

This commit is contained in:
prozessorkern
2020-03-28 12:08:01 +01:00
parent d7962a54dc
commit 96cf0c8d65
5 changed files with 98 additions and 60 deletions

View File

@@ -124,7 +124,7 @@ static char peekNextHunk(shellmatta_instance_t *inst)
* #SHELLMATTA_ERROR - format error or option unknown
*/
static shellmatta_retCode_t parseShortOpt( shellmatta_instance_t *inst,
char *optionString,
const char *optionString,
char *option,
shellmatta_opt_argtype_t *argtype)
{
@@ -186,7 +186,7 @@ static shellmatta_retCode_t parseShortOpt( shellmatta_instance_t *inst,
* #SHELLMATTA_ERROR - format error or option unknown
*/
static shellmatta_retCode_t parseLongOpt( shellmatta_instance_t *inst,
shellmatta_opt_long_t *longOptions,
const shellmatta_opt_long_t *longOptions,
char *option,
shellmatta_opt_argtype_t *argtype)
{
@@ -253,12 +253,12 @@ static shellmatta_retCode_t parseLongOpt( shellmatta_instance_t *inst,
* @return errorcode #SHELLMATTA_OK - no error - keep on calling
* #SHELLMATTA_ERROR - error occured - e.g. argument missing
*/
static shellmatta_retCode_t shellmatta_opt_int( shellmatta_handle_t handle,
char *optionString,
shellmatta_opt_long_t *longOptions,
char *option,
char **argument,
uint32_t *argLen)
static shellmatta_retCode_t shellmatta_opt_int( shellmatta_handle_t handle,
const char *optionString,
const shellmatta_opt_long_t *longOptions,
char *option,
char **argument,
uint32_t *argLen)
{
shellmatta_retCode_t ret = SHELLMATTA_USE_FAULT;
shellmatta_instance_t *inst = (shellmatta_instance_t*)handle;
@@ -370,7 +370,7 @@ static shellmatta_retCode_t shellmatta_opt_int( shellmatta_handle_t handle,
* #SHELLMATTA_ERROR - error occured - e.g. argument missing
*/
shellmatta_retCode_t shellmatta_opt( shellmatta_handle_t handle,
char *optionString,
const char *optionString,
char *option,
char **argument,
uint32_t *argLen)
@@ -391,11 +391,11 @@ shellmatta_retCode_t shellmatta_opt( shellmatta_handle_t handle,
* @param[out] argument pointer to store the argument string to (can be NULL)
* @param[out] argLen pointer to store the argument lengh to (can be NULL)
*/
shellmatta_retCode_t shellmatta_opt_long( shellmatta_handle_t handle,
shellmatta_opt_long_t *longOptions,
char *option,
char **argument,
uint32_t *argLen)
shellmatta_retCode_t shellmatta_opt_long( shellmatta_handle_t handle,
const shellmatta_opt_long_t *longOptions,
char *option,
char **argument,
uint32_t *argLen)
{
return shellmatta_opt_int( handle,
NULL,

View File

@@ -23,16 +23,16 @@
#include <stdint.h>
shellmatta_retCode_t shellmatta_opt( shellmatta_handle_t handle,
char *optionString,
const char *optionString,
char *option,
char **argument,
uint32_t *argLen);
shellmatta_retCode_t shellmatta_opt_long( shellmatta_handle_t handle,
shellmatta_opt_long_t *longOptions,
char *option,
char **argument,
uint32_t *argLen);
shellmatta_retCode_t shellmatta_opt_long( shellmatta_handle_t handle,
const shellmatta_opt_long_t *longOptions,
char *option,
char **argument,
uint32_t *argLen);
shellmatta_retCode_t shellmatta_opt_init( shellmatta_instance_t *inst,
uint32_t argStart);