By default, parsed arguments from the parser module are not valid
strings. This patch introduces string length to each string parameter.
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@5220
38d2e660-2303-0410-9eaa-
f027e97ec537
break;
case 's':
- (*argv++).s = begin;
+ (*argv).str.p = begin;
+ (*argv).str.sz = end - begin;
+ argv++;
break;
default:
if (!input)
return false;
- args[0].s = cmdp->name;
+ args[0].str.p = cmdp->name;
if (!parseArgs(cmdp->arg_fmt, input, args + 1))
return false;
RC_SKIP = 2 ///< Skip following commands
} ResultCode;
+typedef struct
+{
+ const char *p;
+ int sz;
+} str_parm;
+
/** union that contains parameters passed to and from commands */
-typedef union { long l; const char *s; } parms;
+typedef union { long l; str_parm str; } parms;
/** pointer to commands */
typedef ResultCode (*CmdFuncPtr)(parms args_results[]);