Changeset efb8d15 in mainline for uspace/app/sysinfo/sysinfo.c
- Timestamp:
- 2012-03-02T15:32:13Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 196c253
- Parents:
- 71232af
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sysinfo/sysinfo.c
r71232af refb8d15 92 92 } 93 93 94 static void print_keys(const char *path) 94 static void print_spaces(size_t spaces) 95 { 96 for (size_t i = 0; i < spaces; i++) 97 printf(" "); 98 } 99 100 static void print_keys(const char *path, size_t spaces) 95 101 { 96 102 size_t size; … … 103 109 /* Process each key with sanity checks */ 104 110 size_t cur_size = str_nsize(keys + pos, size - pos); 111 if (keys[pos + cur_size] != 0) 112 break; 113 105 114 size_t path_size = str_size(path) + cur_size + 2; 106 115 char *cur_path = (char *) malloc(path_size); … … 108 117 break; 109 118 110 if (path[0] != 0) 119 size_t length; 120 121 if (path[0] != 0) { 122 print_spaces(spaces); 123 printf(".%s\n", keys + pos); 124 length = str_length(keys + pos) + 1; 125 111 126 snprintf(cur_path, path_size, "%s.%s", path, keys + pos); 112 else 127 } else { 128 printf("%s\n", keys + pos); 129 length = str_length(keys + pos); 130 113 131 snprintf(cur_path, path_size, "%s", keys + pos); 132 } 114 133 115 printf("%s\n", cur_path); 116 print_keys(cur_path); 134 print_keys(cur_path, spaces + length); 117 135 118 136 free(cur_path); … … 127 145 if (argc != 2) { 128 146 /* Print keys */ 129 print_keys("" );147 print_keys("", 0); 130 148 return 0; 131 149 }
Note:
See TracChangeset
for help on using the changeset viewer.