xiaoxiang781216 commented on a change in pull request #1076: URL: https://github.com/apache/incubator-nuttx-apps/pull/1076#discussion_r827841633
########## File path: nshlib/nsh_fscmds.c ########## @@ -1215,16 +1215,56 @@ int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) #ifndef CONFIG_NSH_DISABLE_MKDIR int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { - FAR char *fullpath = nsh_getfullpath(vtbl, argv[1]); + FAR char *fullpath = NULL; + bool parent = false; int ret = ERROR; + int option; - if (fullpath != NULL) + while ((option = getopt(argc, argv, "p")) != ERROR) { - ret = mkdir(fullpath, 0777); - if (ret < 0) + switch (option) { - nsh_error(vtbl, g_fmtcmdfailed, argv[0], "mkdir", NSH_ERRNO); + case 'p': + parent = true; + break; } + } + + if (optind < argc) + { + fullpath = nsh_getfullpath(vtbl, argv[optind]); + } + + if (fullpath != NULL) + { + char *slash = parent ? fullpath : ""; + + for (; ; ) + { + slash = strstr(slash, "/"); Review comment: @anjiahao1 take a look. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org