aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile18
-rw-r--r--src/cookies.c7
2 files changed, 14 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 4a1f80b..c6303fe 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,15 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Compilation Options
# Debug mode [yes/no] (allowing to debug the library via gdb):
-DEBUG = no
+DEBUG ?= no
# Specify your favourite C compiler here:
-CC = gcc
+COMPILE ?= gcc
# Specify your include directory (headers location):
-INCDIR = /usr/include
+INCDIR ?= /usr/include
# Specify your libraries directory:
-LIBDIR = /usr/lib
+LIBDIR ?= /usr/lib
# Specify location of man pages on your machine:
-MANDIR = /usr/share/man
+MANDIR ?= /usr/share/man
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@@ -91,11 +91,11 @@ $(TARGET): $(OBJ)
# Compile object files from corresponding source:
$(BUILD)/%.o: %.c
- $(CC) $(CFLAGS) $(SRCINC) -c $< -o $@
+ $(COMPILE) $(CFLAGS) $(SRCINC) -c $< -o $@
# Compile executables from corresponding sources and library:
$(BUILD)/%: %.c $(TARGET)
- $(CC) $(CFLAGS) $(XINC) $< $(LFLAGS) -o $@
+ $(COMPILE) $(CFLAGS) $(XINC) $< $(LFLAGS) -o $@
# Create build directories, if no such:
$(SRCBUILD) $(XBLD):
@@ -103,5 +103,5 @@ $(SRCBUILD) $(XBLD):
# Generate dependency file, adding corresponding build prefixes:
$(DEPS): $(SRC) $(EXASRC) $(EXTER_H) $(INTER_H) $(INCLUDE)/magi.h
- $(CC) $(SRCINC) $(SRC) -MM | sed '/^ /!s#^#$(SRCBUILD)/#' > $@
- $(CC) $(XINC) $(XSRC) -MM | sed '/^ /!s#^#$(XBLD)/#;s/\.o//' >> $@
+ $(COMPILE) $(SRCINC) $(SRC) -MM | sed '/^ /!s#^#$(SRCBUILD)/#' >$@
+ $(COMPILE) $(XINC) $(XSRC) -MM | sed '/^ /!s#^#$(XBLD)/#;s/\.o//' >>$@
diff --git a/src/cookies.c b/src/cookies.c
index d78214e..35d876f 100644
--- a/src/cookies.c
+++ b/src/cookies.c
@@ -85,7 +85,7 @@ static int end_data(struct automata *a)
static void *state_name(struct automata *a, char c);
static void *state_pre_name(struct automata *a, char c)
{
- if (c == ' ' || c == '\t'){
+ if (c == ' ' || c == '\t') {
return state_pre_name;
} else if (32 <= c && c <= 126 && !strchr("()<>@,;:\\\"/[]?={}", c)) {
magi_str_add(&a->buf, &a->buf_len, &a->buf_size, c);
@@ -185,7 +185,10 @@ static void parse_end(enum magi_error *e, struct automata *a, state s)
} else {
*e = magi_error_cookies;
}
- } else if (s != state_post_data) {
+ } else if (s == state_post_data) {
+ magi_cookies_add(a->list, &a->cookie);
+ nullify_cookie(a);
+ } else {
*e = magi_error_cookies;
}
}