Changeset 6afc9d7 in mainline for uspace/app/bdsh/cmds/modules/ls/ls.c
- Timestamp:
- 2015-10-06T19:01:36Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0328987
- Parents:
- f1f7584
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/ls/ls.c
rf1f7584 r6afc9d7 31 31 * As more stuff is completed and exposed in libc, this will improve */ 32 32 33 #include <errno.h> 33 34 #include <stdio.h> 34 35 #include <stdlib.h> … … 187 188 if (rc != 0) { 188 189 printf("ls: skipping bogus node %s\n", buff); 189 printf(" rc=%d\n", rc);190 printf("error=%d\n", errno); 190 191 goto out; 191 192 } … … 314 315 static unsigned int ls_scope(const char *path, struct dir_elem_t *de) 315 316 { 316 if (stat(path, &de->s) ) {317 if (stat(path, &de->s) != 0) { 317 318 cli_error(CL_ENOENT, "%s", path); 318 319 return LS_BOGUS; … … 376 377 } 377 378 } 378 379 379 380 argc -= optind; 380 381 381 382 de.name = (char *) malloc(PATH_MAX); 382 383 if (!de.name) { 383 cli_error(CL_ENOMEM, "%s: ", cmdname);384 cli_error(CL_ENOMEM, "%s: Out of memory", cmdname); 384 385 return CMD_FAILURE; 385 386 } 386 387 memset(de.name, 0, PATH_MAX); 387 388 if (argc == 0) 389 getcwd(de.name, PATH_MAX); 390 else 388 389 if (argc == 0) { 390 if (getcwd(de.name, PATH_MAX) == NULL) { 391 cli_error(CL_EFAIL, "%s: Failed determining working " 392 "directory", cmdname); 393 return CMD_FAILURE; 394 } 395 } else { 391 396 str_cpy(de.name, PATH_MAX, argv[optind]); 397 } 392 398 393 399 scope = ls_scope(de.name, &de);
Note:
See TracChangeset
for help on using the changeset viewer.