diff options
Diffstat (limited to 'booki.c')
| -rw-r--r-- | booki.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -20,18 +20,19 @@ typedef struct DataField DataField; struct DataField { char* name; enum DataType type; + bool show; }; static const DataField BOOK_FIELDS[] = { - { "title", booki_string }, - { "author", booki_string }, - { "isbn", booki_string }, - { "pages", booki_number }, - { "published", booki_number }, - { "language", booki_string }, - { "translator", booki_string }, - { "on", booki_string }, - { "id", booki_number } + { "title", booki_string, true }, + { "author", booki_string, true }, + { "isbn", booki_string, true }, + { "pages", booki_number, true }, + { "published", booki_number, true }, + { "language", booki_string, true }, + { "translator", booki_string, true }, + { "on", booki_string, true }, + { "id", booki_number, false } }; #define BOOK_FIELDS_COUNT (sizeof(BOOK_FIELDS) / sizeof(BOOK_FIELDS[0])) @@ -460,6 +461,8 @@ void print_book(BOOK book, bool all_fields) { int number_field; for (int i = 2; i < BOOK_FIELDS_COUNT; i++) { datafield = BOOK_FIELDS[i]; + if (!datafield.show) + continue; // string fields if (datafield.type == booki_string) { @@ -471,9 +474,6 @@ void print_book(BOOK book, bool all_fields) { printf(esfmt, datafield.name, size, str); // number fields } else if (datafield.type == booki_number) { - // don't print the ID - if (ATTR_MATCH(datafield.name, "id")) - continue; number_field = get_number_field(book, datafield.name); if (!number_field) continue; |
