Changeset c878693 in mainline for uspace/app/bdsh/cmds/modules/ls/ls.c
- Timestamp:
- 2019-06-01T14:49:46Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- de9e28e
- Parents:
- 4a764d1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/ls/ls.c
r4a764d1 rc878693 103 103 if (ls.exact_size) { 104 104 printf("%-40s\t%*llu\n", de->name, width, (long long) de->s.size); 105 } else { 106 cap_spec_t cap; 107 108 cap_from_blocks(de->s.size, 1, &cap); 109 cap_simplify(&cap); 110 111 char *rptr; 112 errno_t rc = cap_format(&cap, &rptr); 113 if (rc == EOK) { 114 char *sep = str_rchr(rptr, ' '); 115 if (sep == NULL) { 116 free(rptr); 117 return ENOENT; 118 } 119 120 *sep = '\0'; 121 122 printf("%-40s\t%*s %2s\n", de->name, width - 3, rptr, sep + 1); 123 free(rptr); 124 } else 125 return rc; 126 } 105 return EOK; 106 } 107 108 cap_spec_t cap; 109 cap_from_blocks(de->s.size, 1, &cap); 110 cap_simplify(&cap); 111 112 char *rptr; 113 errno_t rc = cap_format(&cap, &rptr); 114 if (rc != EOK) { 115 return rc; 116 } 117 118 char *sep = str_rchr(rptr, ' '); 119 if (sep == NULL) { 120 free(rptr); 121 return ENOENT; 122 } 123 124 *sep = '\0'; 125 126 printf("%-40s\t%*s %2s\n", de->name, width - 3, rptr, sep + 1); 127 free(rptr); 127 128 } else if (de->s.is_directory) 128 129 printf("%-40s\t%*s\n", de->name, width, "<dir>");
Note:
See TracChangeset
for help on using the changeset viewer.