From 56c86964b2497b68ad29a6d0e7501d892b570522 Mon Sep 17 00:00:00 2001 From: Cestmir Houska Date: Fri, 22 Apr 2011 02:23:37 +0200 Subject: [PATCH 1/3] Added defines.h Signed-off-by: Cestmir Houska --- defines.h | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 defines.h 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 + From 564f8ab87c35ea42e993837d5555b1b919056b59 Mon Sep 17 00:00:00 2001 From: Cestmir Houska Date: Fri, 22 Apr 2011 02:24:06 +0200 Subject: [PATCH 2/3] brmbar.c uses definitions now Signed-off-by: Cestmir Houska --- brmbar.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/brmbar.c b/brmbar.c index 16ad8cd..8d6b80c 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]; void fill_items() { @@ -12,7 +13,7 @@ void fill_items() FILE *f = fopen("items.txt", "r"); while (fgets(buf, 128, f)) { printf("%s\n", buf); - } + } fclose(f); } @@ -21,3 +22,4 @@ int main() fill_items(); return 0; } + From 842a6eb13fc8a3f7bedeb66becb8569ab50ad4dd Mon Sep 17 00:00:00 2001 From: Cestmir Houska Date: Fri, 22 Apr 2011 02:25:29 +0200 Subject: [PATCH 3/3] Makefile: Added defines.h to dependencies for brmbar.c Signed-off-by: Cestmir Houska --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: