3 * UCC (University [of WA] Computer Club) Electronic Accounting System
5 * itemdb.c - Dispense Item Databse
7 * This file is licenced under the 3-clause BSD Licence. See the file COPYING
16 tItem *gaItems = NULL;
17 tHandler *gaHandlers = NULL;
18 char *gsItemListFile = DEFAULT_ITEM_FILE;
22 * \brief Read the item list from disk
24 void Load_Itemlist(void)
26 FILE *fp = fopen(gsItemListFile, "r");
32 fprintf(stderr, "Unable to open item file '%s'\n", gsItemListFile);
33 perror("Unable to open item file");
36 while( fgets(buffer, BUFSIZ, fp) )
39 char *type, *num, *price, *desc;
41 tmp = strchr(buffer, '#');
43 tmp = strchr(buffer, ';');
53 num = strchr(type, ' ');
54 if(num) while(*num == ' ' || *num == '\t');
56 fprintf(stderr, "Syntax error on line %i of item file\n", lineNum);
60 price = strchr(num, ' ');