home *** CD-ROM | disk | FTP | other *** search
/ Fujiology Archive / fujiology_archive_v1_0.iso / !MAGS / ATOS / ATOS_ALL.ZIP / news / cjar2.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-21  |  1.4 KB  |  73 lines

  1. #ifdef __TURBOC__
  2. #include <tos.h>
  3. #else
  4. #ifdef __GNUC__
  5. #include <osbind.h>
  6. #else
  7. #include <tosbind.h>
  8. #endif
  9. #endif
  10.  
  11. #include <stddef.h>
  12. #include <string.h>
  13. #include "cookie.h"
  14. #include "cjar.h"
  15.  
  16. #define _p_cookies (void *)0x5a0l
  17.  
  18. CookieEntry *CookieJar = NULL;
  19.  
  20. int CjarInit(void)
  21. {  long OldStack;
  22.  
  23.    OldStack = Super(0L);
  24.    CookieJar = *((CookieEntry**)_p_cookies);
  25.    Super((void *)OldStack);
  26.    return (CookieJar != NULL);
  27. }
  28.  
  29. CookieEntry *CjarSearchL(long Name)
  30. {  CookieEntry *AktCookie;
  31.  
  32.    if (CookieJar != NULL)
  33.       CjarInit();
  34.    if (CookieJar != NULL)
  35.    {
  36.       AktCookie = CookieJar;
  37.       while (!CookieIsNullCookie(AktCookie) &&
  38.              !CookieIsCookie(AktCookie,Name))
  39.       {
  40.          AktCookie++;
  41.       }
  42.       if (CookieIsNullCookie(AktCookie))
  43.          return NULL;
  44.       else
  45.          return AktCookie;
  46.    }
  47.    else
  48.       return NULL;
  49. }
  50.  
  51. CookieEntry *CjarSearchS(char *Name)
  52. {  long CookieNameAsLong;
  53.  
  54.    memcpy(&CookieNameAsLong, Name, 4);
  55.    return CjarSearchL(CookieNameAsLong);
  56. }
  57.  
  58. void CjarTraverse(CookieAction ActionFkt)
  59. {  CookieEntry *AktCookie;
  60.  
  61.    if (CookieJar != NULL)
  62.       CjarInit();
  63.    if (CookieJar != NULL)
  64.    {
  65.       AktCookie = CookieJar;
  66.       while (!CookieIsNullCookie(AktCookie))
  67.       {
  68.          (*ActionFkt)(AktCookie);
  69.          AktCookie++;
  70.       }
  71.    }
  72. }
  73.