Changes in uspace/app/bdsh/cmds/modules/ls/ls.c [26c02b22:6afc9d7] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/ls/ls.c
r26c02b22 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; … … 362 363 argc = cli_count_args(argv); 363 364 364 for (c = 0, opt ind = 0, opt_ind = 0; c != -1;) {365 for (c = 0, optreset = 1, optind = 0, opt_ind = 0; c != -1;) { 365 366 c = getopt_long(argc, argv, "hur", long_options, &opt_ind); 366 367 switch (c) { … … 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.