home *** CD-ROM | disk | FTP | other *** search
- #ifdef __TURBOC__
- #include <tos.h>
- #else
- #ifdef __GNUC__
- #include <osbind.h>
- #else
- #include <tosbind.h>
- #endif
- #endif
-
- #include <stddef.h>
- #include <string.h>
- #include "cookie.h"
- #include "cjar.h"
-
- #define _p_cookies (void *)0x5a0l
-
- CookieEntry *CookieJar = NULL;
-
- int CjarInit(void)
- { long OldStack;
-
- OldStack = Super(0L);
- CookieJar = *((CookieEntry**)_p_cookies);
- Super((void *)OldStack);
- return (CookieJar != NULL);
- }
-
- CookieEntry *CjarSearchL(long Name)
- { CookieEntry *AktCookie;
-
- if (CookieJar != NULL)
- CjarInit();
- if (CookieJar != NULL)
- {
- AktCookie = CookieJar;
- while (!CookieIsNullCookie(AktCookie) &&
- !CookieIsCookie(AktCookie,Name))
- {
- AktCookie++;
- }
- if (CookieIsNullCookie(AktCookie))
- return NULL;
- else
- return AktCookie;
- }
- else
- return NULL;
- }
-
- CookieEntry *CjarSearchS(char *Name)
- { long CookieNameAsLong;
-
- memcpy(&CookieNameAsLong, Name, 4);
- return CjarSearchL(CookieNameAsLong);
- }
-
- void CjarTraverse(CookieAction ActionFkt)
- { CookieEntry *AktCookie;
-
- if (CookieJar != NULL)
- CjarInit();
- if (CookieJar != NULL)
- {
- AktCookie = CookieJar;
- while (!CookieIsNullCookie(AktCookie))
- {
- (*ActionFkt)(AktCookie);
- AktCookie++;
- }
- }
- }
-