Changeset 1433ecda in mainline for uspace/app/bdsh/cmds/modules/rm/rm.c
- Timestamp:
- 2018-04-04T15:42:37Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2c4e1cc
- Parents:
- 47b2d7e3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/rm/rm.c
r47b2d7e3 r1433ecda 175 175 while ((dp = readdir(dirp))) { 176 176 int len = snprintf(buff, PATH_MAX - 1, "%s/%s", path, dp->d_name); 177 if (len > PATH_MAX -1) {177 if (len > PATH_MAX - 1) { 178 178 // TODO: Do not enforce arbitrary static limits. 179 179 cli_error(CL_EFAIL, "Path too long for %s/%s", path, dp->d_name); … … 229 229 help_cmd_rm(HELP_SHORT); 230 230 printf( 231 "Usage: %s [options] <path>\n"232 "Options:\n"233 " -h, --help A short option summary\n"234 " -v, --version Print version information and exit\n"235 " -r, --recursive Recursively remove sub directories\n"236 " -f, --force Do not prompt prior to removing files\n"237 " -s, --safe Stop if directories change during removal\n\n"238 "Currently, %s is under development, some options don't work.\n",239 cmdname, cmdname);231 "Usage: %s [options] <path>\n" 232 "Options:\n" 233 " -h, --help A short option summary\n" 234 " -v, --version Print version information and exit\n" 235 " -r, --recursive Recursively remove sub directories\n" 236 " -f, --force Do not prompt prior to removing files\n" 237 " -s, --safe Stop if directories change during removal\n\n" 238 "Currently, %s is under development, some options don't work.\n", 239 cmdname, cmdname); 240 240 } 241 241 return; … … 255 255 if (argc < 2) { 256 256 cli_error(CL_EFAIL, 257 257 "%s: insufficient arguments. Try %s --help", cmdname, cmdname); 258 258 return CMD_FAILURE; 259 259 } … … 293 293 if ((unsigned) optind == argc) { 294 294 cli_error(CL_EFAIL, 295 295 "%s: insufficient arguments. Try %s --help", cmdname, cmdname); 296 296 rm_end(&rm); 297 297 return CMD_FAILURE; … … 317 317 break; 318 318 case RM_DIR: 319 if (! 319 if (!rm.recursive) { 320 320 printf("%s is a directory, use -r to remove it.\n", buff); 321 ret 321 ret++; 322 322 } else { 323 323 ret += rm_recursive(buff);
Note:
See TracChangeset
for help on using the changeset viewer.