| 243 | } |
| 244 | |
| 245 | static int process_list(int argc, char *argv[], const char store_file[]) |
| 246 | { |
| 247 | if (argc != 1) { |
| 248 | fprintf(stderr, "Invalid invocation\n"); |
| 249 | print_sub_command_usage(argv[0]); |
| 250 | } |
| 251 | |
| 252 | struct storage_t storage; |
| 253 | if (!storage_open(store_file, &storage, /*rw=*/false)) |
| 254 | return EXIT_FAILURE; |
| 255 | |
| 256 | for (struct var_t *v = storage.vs.vars; v != NULL; v = v->next) { |
| 257 | char *name = to_chars(v->name, v->name_size); |
| 258 | char *guid = format_guid(&v->guid, /*use_alias=*/true); |
| 259 | |
| 260 | printf("%-*s:%s (%zu %s)\n", GUID_LEN, guid, name, v->data_size, |
| 261 | v->data_size == 1 ? "byte" : "bytes"); |
| 262 | |
| 263 | free(name); |
| 264 | free(guid); |
| 265 | } |
| 266 | |
| 267 | storage_drop(&storage); |
| 268 | return EXIT_SUCCESS; |
| 269 | } |
| 270 | |
| 271 | static void help_get(FILE *f, const struct subcommand_t *info) |
| 272 | { |
nothing calls this directly
no test coverage detected