From 59224e484253b32432743248672d8d8ba69f110b Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Sat, 30 Nov 2019 18:53:03 +0300 Subject: [magi] fix --- examples/upload.c | 1 + 1 file changed, 1 insertion(+) (limited to 'examples') diff --git a/examples/upload.c b/examples/upload.c index 1947f93..c61562a 100644 --- a/examples/upload.c +++ b/examples/upload.c @@ -48,6 +48,7 @@ int main(int argc, char const * argv[]) } else { magi_error_cgi(request.error); } + magi_tempfiles_destroy(&tmps); magi_request_destroy(&request); return 0; } -- cgit v1.2.3 From b9a0844fe25cf717cdd796018bea2ae6eff58896 Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Fri, 6 Dec 2019 15:52:55 +0300 Subject: [magi] change of cookies and tempfile callback --- examples/echo.c | 4 ---- examples/upload.c | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'examples') diff --git a/examples/echo.c b/examples/echo.c index e9807f0..ca30ff7 100644 --- a/examples/echo.c +++ b/examples/echo.c @@ -22,10 +22,6 @@ void proceed_cookies(struct magi_cookie_list * cookies, magi_response_add(response, "] for domain ["); magi_response_add(response, cookies->item.domain); } - if (cookies->item.port) { - magi_response_add(response, "] for port ["); - magi_response_add(response, cookies->item.port); - } if (cookies->item.path) { magi_response_add(response, "] for path ["); magi_response_add(response, cookies->item.path); diff --git a/examples/upload.c b/examples/upload.c index c61562a..a880c53 100644 --- a/examples/upload.c +++ b/examples/upload.c @@ -35,7 +35,7 @@ void response_request(struct magi_request * req, struct magi_response * res) int main(int argc, char const * argv[]) { struct magi_request request; - struct magi_tempfiles tmps = { 0, 0, 0, 0 }; + struct magi_tempfiles tmps = { 0, 0 }; magi_request_setup(&request); magi_tempfiles_add(&tmps, "data", "data", 0); magi_request_setup_tempfiles(&request, &tmps); -- cgit v1.2.3 From 746c3f3076fe5994f08d729aa1b958465231b0c8 Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Tue, 4 Feb 2020 14:57:11 +0300 Subject: [magi] --- examples/Makefile | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/Makefile b/examples/Makefile index d93176b..2f57b1e 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -1,29 +1,48 @@ -# Uncomment following to enable debug mode: +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# Compilation Options +# Debug mode (allowing to debug the examples via gdb): # DEBUG = yes - +# Specify your favourite C compiler here (e.g. tcc): CC = gcc + + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# Preparations EXAMPLES = append cookie upload echo +# Compile under the most strict conditions: CFLAGS = -xc -ansi -pedantic -Wall +# Debug and optimisation are not compatible: ifeq '$(DEBUG)' 'yes' CFLAGS += -g -O0 else CFLAGS += -O3 endif +# Including magi library headers and setting linker to use it: INCLUDE = -I ../src LFLAGS = -L.. -lmagi +# Specification of library file to produce it, if not provided: MAGI = ../libmagi.a +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# Targets +# 'make' produces all examples by default: default: $(EXAMPLES) -$(MAGI): - cd ..; $(MAKE) +# Cleaning means removing everything automatically produced: +clean: + rm -f $(EXAMPLES) + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# Compilation +# Compile executables from corresponding sources and library: %: %.c $(MAGI) $(CC) $(CFLAGS) $(INCLUDE) $< $(LFLAGS) -o $@ -clean: - rm -f $(EXAMPLES) +# Run make for library to produce it: +$(MAGI): + cd ..; $(MAKE) -- cgit v1.2.3