mg_get_cookie( cookie, var_name, buf, buf_len );
|The cookie name|
|The variable name|
|The buffer where to store the contents of the cookie|
|The length of the cookie buffer, including the terminating NUL|
|The length of the cookie or an error code|
mg_get_cookie() tries to fetch the value of a certain cookie variable. The contents will either be stored in an application provided buffer, or an error code will be returned. The destination buffer is guaranteed to be NUL terminated if the pointer of the buffer is not a NULL pointer and the size of the buffer is at least one byte.
If the function succeeds, the return value of the function is the length in bytes of the cookie. The value
-1 is returned if the requested cookie could not be found and
-2 if the destination buffer is represented by a NULL pointer, is zero length or too short to store the whole cookie.