diff --git a/Makefile b/Makefile index 0544401..340c194 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CC=bcc CFLAGS=-Md -W -brmbar.com: brmbar.c +brmbar.com: brmbar.c defines.h $(CC) $(CFLAGS) brmbar.c -o brmbar.com clean: diff --git a/brmbar.c b/brmbar.c index 439c2b0..2f23434 100644 --- a/brmbar.c +++ b/brmbar.c @@ -1,10 +1,11 @@ #include +#include "defines.h" struct item { - char *ean; - char *name; + char ean[EAN_MAXLEN]; + char name[NAME_MAXLEN]; int price; -} items[100]; +} items[ITEM_MAXNUM]; int items_count; @@ -14,7 +15,7 @@ void fill_items() FILE *f = fopen("items.txt", "r"); while (fgets(buf, 128, f)) { printf("%s\n", buf); - } + } fclose(f); } @@ -48,3 +49,4 @@ int main() } return 0; } + diff --git a/defines.h b/defines.h new file mode 100644 index 0000000..694f74c --- /dev/null +++ b/defines.h @@ -0,0 +1,9 @@ +#ifndef _BRMBAR_DEFINES_H_ +#define _BRMBAR_DEFINES_H_ + +#define EAN_MAXLEN 32 +#define NAME_MAXLEN 128 +#define ITEM_MAXNUM 128 + +#endif +