Changeset 0feb39b in mainline
- Timestamp:
- 2019-06-01T12:32:46Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4a764d1
- Parents:
- f4f4b95
- Location:
- uspace/app/bdsh/cmds/modules/ls
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/ls/ls.c
rf4f4b95 r0feb39b 66 66 /* Prototypes for the ls command, excluding entry points. */ 67 67 static unsigned int ls_start(ls_job_t *); 68 static boolls_print(struct dir_elem_t *);69 static boolls_print_single_column(struct dir_elem_t *);68 static errno_t ls_print(struct dir_elem_t *); 69 static errno_t ls_print_single_column(struct dir_elem_t *); 70 70 static int ls_cmp_type_name(const void *, const void *); 71 71 static int ls_cmp_name(const void *, const void *); … … 96 96 * @param de Directory element. 97 97 */ 98 static boolls_print(struct dir_elem_t *de)98 static errno_t ls_print(struct dir_elem_t *de) 99 99 { 100 100 int width = 13; … … 110 110 111 111 char *rptr; 112 if (cap_format(&cap, &rptr) == EOK) { 112 errno_t rc = cap_format(&cap, &rptr); 113 if (rc == EOK) { 113 114 char bytes[9], suffix[3]; 114 115 sscanf(rptr, "%s %s", bytes, suffix); … … 117 118 printf("%-40s\t%*s %2s\n", de->name, width - 3, bytes, suffix); 118 119 } else 119 return false;120 return rc; 120 121 } 121 122 } else if (de->s.is_directory) … … 124 125 printf("%-40s\n", de->name); 125 126 126 return true;127 } 128 129 static boolls_print_single_column(struct dir_elem_t *de)127 return EOK; 128 } 129 130 static errno_t ls_print_single_column(struct dir_elem_t *de) 130 131 { 131 132 if (de->s.is_file) { … … 135 136 } 136 137 137 return true;138 return EOK; 138 139 } 139 140 … … 253 254 254 255 for (i = 0; i < nbdirs; i++) { 255 if ( !ls.printer(&tosort[i])) {256 if (ls.printer(&tosort[i]) != EOK) { 256 257 cli_error(CL_ENOMEM, "%s: Out of memory", cmdname); 257 258 goto out; … … 470 471 switch (scope) { 471 472 case LS_FILE: 472 if ( !ls.printer(&de)) {473 if (ls.printer(&de) != EOK) { 473 474 cli_error(CL_ENOMEM, "%s: Out of memory", cmdname); 474 475 return CMD_FAILURE; -
uspace/app/bdsh/cmds/modules/ls/ls.h
rf4f4b95 r0feb39b 27 27 bool exact_size; 28 28 29 bool(*printer)(struct dir_elem_t *);29 errno_t (*printer)(struct dir_elem_t *); 30 30 } ls_job_t; 31 31
Note:
See TracChangeset
for help on using the changeset viewer.