home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Magazine / wwwoffle-2.1.tar.gz / wwwoffle-2.1 / misc.h < prev    next >
C/C++ Source or Header  |  1998-02-11  |  3KB  |  89 lines

  1. /***************************************
  2.   $Header: /home/amb/wwwoffle/RCS/misc.h 2.10 1998/02/11 19:25:05 amb Exp $
  3.  
  4.   WWWOFFLE - World Wide Web Offline Explorer - Version 2.1.
  5.   Miscellaneous HTTP / HTML functions.
  6.   ******************/ /******************
  7.   Written by Andrew M. Bishop
  8.  
  9.   This file Copyright 1997,98 Andrew M. Bishop
  10.   It may be distributed under the GNU Public License, version 2, or
  11.   any higher version.  See section COPYING of the GNU Public license
  12.   for conditions under which this file may be redistributed.
  13.   ***************************************/
  14.  
  15.  
  16. #ifndef MISC_H
  17. #define MISC_H    /*+ To stop multiple inclusions. +*/
  18.  
  19. #include <stdio.h>
  20.  
  21. /*+ A forward definition of the protocol type. +*/
  22. typedef struct _Protocol *ProtocolP;
  23.  
  24. /*+ A URL data type. +*/
  25. typedef struct _URL
  26. {
  27.  char *name;                    /*+ The canonical URL for the object. +*/
  28.  
  29.  char *link;                    /*+ A URL that will work for browsers (may point to name). +*/
  30.  
  31.  char *hostp;                   /*+ A pointer to the host in the url. +*/
  32.  char *pathp;                   /*+ A pointer to the path in the url. +*/
  33.  
  34.  char *proto;                   /*+ The protocol. +*/
  35.  char *host;                    /*+ The host. +*/
  36.  char *path;                    /*+ The path. +*/
  37.  char *args;                    /*+ The arguments. +*/
  38.  
  39.  ProtocolP Protocol;            /*+ The protocol. +*/
  40.  
  41.  char *user;                    /*+ The username if supplied. +*/
  42.  char *pass;                    /*+ The password if supplied. +*/
  43.  
  44.  char local;                    /*+ Set to true if the host is the localhost. +*/
  45. }
  46. URL;
  47.  
  48. /* in misc.c */
  49.  
  50. URL *SplitURL(char *url);
  51. void FreeURL(URL *Url);
  52.  
  53. char *MakeHash(const char *args);
  54.  
  55. char *RFC822Date(long t,int utc);
  56. long DateToTimeT(const char *date);
  57.  
  58. char *UrlDecode(const char *str, int isform);
  59. char *UrlEncode(const char *str);
  60.  
  61. char *Base64Decode(const char *str,int *l);
  62. char *Base64Encode(const char *str,int l);
  63.  
  64. char* HTMLString(const char* c);
  65.  
  66. /* In io.c */
  67.  
  68. char *fgets_realloc(char *buffer,FILE *file);
  69.  
  70. void init_buffer(int fd);
  71.  
  72. int read_data(int fd,char *buffer,int n);
  73. int read_data_or_timeout(int fd,char *buffer,int n);
  74.  
  75. char *read_line(int fd,char *line);
  76. char *read_line_or_timeout(int fd,char *line);
  77.  
  78. int write_data(int fd,const char *data,int n);
  79.  
  80. int write_string(int fd,const char *str);
  81.  
  82. #ifdef __GNUC__
  83. int write_formatted(int fd,const char *fmt,...) __attribute__ ((format (printf,2,3)));
  84. #else
  85. int write_formatted(int fd,const char *fmt,...);
  86. #endif
  87.  
  88. #endif /* MISC_H */
  89.