#ifdef __TURBOC__
#include <tos.h>
#else
#ifdef __GNUC__
#include <osbind.h>
#else
#include <tosbind.h>
#endif
#endif

#include <stddef.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)
{
   return NULL;
}

CookieEntry *CjarSearchS(char *Name)
{
   return NULL;
}

void CjarTraverse(CookieAction ActionFkt)
{  CookieEntry *AktCookie;

   if (CookieJar != NULL)
      CjarInit();
   if (CookieJar != NULL)
   {
      AktCookie = CookieJar;
      while (!CookieIsNullCookie(AktCookie))
      {
         (*ActionFkt)(AktCookie);
         AktCookie++;
      }
   }
}
