home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
files
/
program
/
lynxlib
/
getcooki.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-23
|
991b
|
37 lines
/* getcookie(): C procedure to find cookies and values
This is taken from Atari's STE Developer Notes, January 12, 1990.
BOOLEAN getcookie(cookie, p_value)
LONG cookie; LONG *p_value;
Returns FALSE if 'cookie' is not found in the cookie jar. If the
cookie is found, it returns TRUE and places the cookie's value into
*p_value. If p_value == NULL, it doesn't put the value anywhere.
*/
#include <sysvar.h>
COOKIE *get_cookie_ptr(target)
LONG target; /* Cookie to search for */
{
COOKIE *p;
p = (COOKIE *)peekl(p_cookies);
if (p != NULL) do {
if (p->c == target) return p;
} while ((p++)->c != 0);
return NULL;
}
/* ------------------------------------------------------- */
BOOLEAN getcookie(target, p_value)
LONG target; /* Cookie to search for */
LONG *p_value; /* Place to store value of cookie */
{
COOKIE *p;
p = get_cookie_ptr(target);
if (p == NULL) return FALSE;
else {
if (p_value != NULL) *p_value = p->v;
return TRUE;
}
}