/* * items.h -- dtbar: the lists behind Favourites and Recent Items (items.c) * * License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. * * One item a line, "LABELCOMMAND"; a line without a tab is its own * label and command; '#' starts a comment line. ~/.dt/favourites is * written by the user (the menu has "Edit Favourites..."); ~/.dt/recent by * dtbar, newest first. C99 and POSIX only: test_items.c tests it. */ #ifndef _dtbar_items_h #define _dtbar_items_h #include #define ITEMS_MAX 32 typedef struct { char label[96]; char command[512]; } Item; /* read FILE into ITEMS (at most MAX); returns the count, 0 if there is none */ extern int ItemsRead(const char *file, Item *items, int max); /* write ITEMS to FILE (a new file, renamed over the old); 0 or -1 */ extern int ItemsWrite(const char *file, const Item *items, int n); /* * ITEM to the front of the list (it moves there if it was in it already), the * list cut to MAX; returns the new count */ extern int ItemsPush(Item *items, int n, int max, const Item *item); #endif /* _dtbar_items_h */