mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-19 02:17:37 +08:00
Move string trimming logic in nsh_fsutils.c as nsh_trimspaces()
This commit is contained in:
@@ -316,23 +316,11 @@ int cmd_pwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
int cmd_set(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
FAR char *value;
|
||||
int ndx;
|
||||
int ret;
|
||||
|
||||
/* Strip leading whitespace from the value */
|
||||
/* Trim whitespace from the value */
|
||||
|
||||
for (value = argv[2];
|
||||
*value != '\0' && isspace(*value);
|
||||
value++);
|
||||
|
||||
/* Strip trailing whitespace from the value */
|
||||
|
||||
for (ndx = strlen(value) - 1;
|
||||
ndx >= 0 && isspace(value[ndx]);
|
||||
ndx--)
|
||||
{
|
||||
value[ndx] = '\0';
|
||||
}
|
||||
value = nsh_trimspaces(argv[2]);
|
||||
|
||||
/* Set the environment variable */
|
||||
|
||||
|
Reference in New Issue
Block a user