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

  1. #include <string.h>
  2. #include <stdio.h>
  3. #include <ctype.h>
  4. #include "cookie.h"
  5.  
  6. void CookieSetL(CookieEntry *Cookie,long Name,long Value)
  7. {
  8.    Cookie->name.name_long = Name;
  9.    Cookie->value = Value;
  10. }
  11.  
  12. void CookieSetS(CookieEntry *Cookie,char *Name,long Value)
  13. {
  14.    memcpy(Cookie->name.name_array,Name,4);
  15.    Cookie->value = Value;
  16. }
  17.  
  18. void CookiePrint(CookieEntry *Cookie)
  19. {
  20.    printf("Name des Cookies: %d\n", Cookie->name.name_long);
  21.    printf("Wert des Cookies: %d\n", Cookie->value);
  22.    if (isgraph(Cookie->name.name_array[0]) &&
  23.        isgraph(Cookie->name.name_array[1]) &&
  24.        isgraph(Cookie->name.name_array[2]) &&
  25.        isgraph(Cookie->name.name_array[3]))
  26.     {
  27.        printf("Der Cookie besteht aus darstellbaren Zeichen\n");
  28.     }
  29. }
  30.  
  31. void CookieInput(CookieEntry *Cookie)
  32. {
  33.    printf("Name des Cookies (long): ");
  34.    scanf("%ld\n", &(Cookie->name.name_long));
  35.    printf("Wert des Cookies (long): ");
  36.    scanf("%ld\n", &(Cookie->value));
  37. }
  38.  
  39. int CookieIsNullCookie(CookieEntry *Cookie)
  40. {
  41.    return Cookie->name.name_long == NULL_COOKIE;
  42. }
  43.  
  44. int CookieIsCookie(CookieEntry *Cookie,long Name)
  45. {
  46.    return Cookie->name.name_long == Name;
  47. }
  48.  
  49. int CookieRead(CookieEntry *Cookie,FILE *stream)
  50. {
  51.    return(fread(Cookie,sizeof(CookieEntry),1,stream) == 1);
  52. }
  53.  
  54. int CookieWrite(CookieEntry *Cookie,FILE *stream)
  55. {
  56.    return(fwrite(Cookie,sizeof(CookieEntry),1,stream) == 1);
  57. }
  58.