Changeset a35b458 in mainline for uspace/app/sysinfo/sysinfo.c
- Timestamp:
- 2018-03-02T20:10:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sysinfo/sysinfo.c
r3061bc1 ra35b458 54 54 { 55 55 size_t offset = 0; 56 56 57 57 while (offset < size) { 58 58 wchar_t c = str_decode(data, &offset, size); … … 69 69 return rc; 70 70 } 71 71 72 72 printf("%s -> %" PRIu64 " (0x%" PRIx64 ")\n", ipath, 73 73 (uint64_t) value, (uint64_t) value); 74 74 75 75 return EOK; 76 76 } … … 84 84 return -1; 85 85 } 86 86 87 87 printf("%s -> ", ipath); 88 88 dump_bytes_hex(data, size); … … 90 90 dump_bytes_text(data, size); 91 91 fputs("')\n", stdout); 92 92 93 93 return EOK; 94 94 } … … 103 103 return -1; 104 104 } 105 105 106 106 printf("%s property %s -> ", ipath, iprop); 107 107 dump_bytes_hex(data, size); … … 109 109 dump_bytes_text(data, size); 110 110 fputs("')\n", stdout); 111 111 112 112 return EOK; 113 113 } … … 125 125 if ((keys == NULL) || (size == 0)) 126 126 return; 127 127 128 128 size_t pos = 0; 129 129 while (pos < size) { … … 132 132 if (keys[pos + cur_size] != 0) 133 133 break; 134 134 135 135 size_t path_size = str_size(path) + cur_size + 2; 136 136 char *cur_path = (char *) malloc(path_size); 137 137 if (cur_path == NULL) 138 138 break; 139 139 140 140 size_t length; 141 141 142 142 if (path[0] != 0) { 143 143 print_spaces(spaces); 144 144 printf(".%s\n", keys + pos); 145 145 length = str_length(keys + pos) + 1; 146 146 147 147 snprintf(cur_path, path_size, "%s.%s", path, keys + pos); 148 148 } else { 149 149 printf("%s\n", keys + pos); 150 150 length = str_length(keys + pos); 151 151 152 152 snprintf(cur_path, path_size, "%s", keys + pos); 153 153 } 154 154 155 155 print_keys(cur_path, spaces + length); 156 156 157 157 free(cur_path); 158 158 pos += cur_size + 1; 159 159 } 160 160 161 161 free(keys); 162 162 } … … 165 165 { 166 166 int rc = 0; 167 167 168 168 if (argc < 2) { 169 169 /* Print keys */ … … 171 171 return rc; 172 172 } 173 173 174 174 char *ipath = argv[1]; 175 175 176 176 if (argc < 3) { 177 177 sysinfo_item_val_type_t tag = sysinfo_get_val_type(ipath); 178 178 179 179 switch (tag) { 180 180 case SYSINFO_VAL_UNDEFINED: … … 194 194 break; 195 195 } 196 196 197 197 return rc; 198 198 } 199 199 200 200 char *iprop = argv[2]; 201 201 rc = print_item_property(ipath, iprop);
Note:
See TracChangeset
for help on using the changeset viewer.