From: Andrea Zagli Date: Sat, 13 Feb 2016 08:56:29 +0000 (+0100) Subject: Added function ZakCgiMain::out_not_null_term. X-Git-Tag: v0.1.0~15 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=32b8d062deb44ff6e9f29e494d78cf82ceeb7aef;p=libzakcgi Added function ZakCgiMain::out_not_null_term. --- diff --git a/src/main.c b/src/main.c index 0065548..e666e99 100644 --- a/src/main.c +++ b/src/main.c @@ -102,6 +102,7 @@ ZakCgiMain /** * zak_cgi_main_out: + * header: * body: * */ @@ -127,6 +128,41 @@ zak_cgi_main_out (const gchar *header, const gchar *body) g_free (_header); } +/** + * zak_cgi_main_out_not_null_term: + * header: + * body: + * length: + * + */ +void +zak_cgi_main_out_not_null_term (const gchar *header, const gchar *body, guint length) +{ + guint i; + gchar *_header; + + if (header == NULL) + { + _header = g_strdup (ZAK_CGI_STANDARD_HEADER_HTML); + } + else + { + _header = g_strdup (header); + } + + g_printf ("%s%c%c\n", + _header, + 13, 10); + + for (i = 0; i < length; i++) + { + g_printf ("%c", body[i]); + } + g_printf ("\n"); + + g_free (_header); +} + static GHashTable *_zak_cgi_main_get_env (ZakCgiMain *zakcgimain) { diff --git a/src/main.h b/src/main.h index e24b71e..50253ea 100644 --- a/src/main.h +++ b/src/main.h @@ -55,6 +55,7 @@ GType zak_cgi_main_get_type (void); ZakCgiMain *zak_cgi_main_new (void); void zak_cgi_main_out (const gchar *header, const gchar *body); +void zak_cgi_main_out_not_null_term (const gchar *header, const gchar *body, guint length); G_DEPRECATED_FOR (zak_cgi_main_get_env_field) GHashTable *zak_cgi_main_get_env (ZakCgiMain *zakcgimain);