]> sjero.net Git - wget/blobdiff - src/wget.h
[svn] Added support for cookies.
[wget] / src / wget.h
index 86fa953d99f69807d797bb6d87ea4979de5f6c2f..1236ff14368ecb0cc585fc06b4bbdea960520f9c 100644 (file)
@@ -66,6 +66,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 /* Include these, so random files need not include them.  */
 #include "sysdep.h"
 #include "options.h"
+/* locale independent replacement for ctype.h */
+#include "safe-ctype.h"
 
 #define DO_NOTHING do {} while (0)
 
@@ -146,6 +148,30 @@ char *xstrdup_debug PARAMS ((const char *, const char *, int));
 
 #define ARRAY_SIZE(array) (sizeof (array) / sizeof (*(array)))
 
+/* Copy the data delimited with BEG and END to alloca-allocated
+   storage, and zero-terminate it.  BEG and END are evaluated only
+   once, in that order.  */
+#define BOUNDED_TO_ALLOCA(beg, end, place) do {        \
+  const char *DTA_beg = (beg);                 \
+  int DTA_len = (end) - DTA_beg;               \
+  place = alloca (DTA_len + 1);                        \
+  memcpy (place, DTA_beg, DTA_len);            \
+  place[DTA_len] = '\0';                       \
+} while (0)
+
+/* Return non-zero if string bounded between BEG and END is equal to
+   STRING_LITERAL.  The comparison is case-sensitive.  */
+#define BOUNDED_EQUAL(beg, end, string_literal)        \
+  ((end) - (beg) == sizeof (string_literal) - 1        \
+   && !memcmp ((beg), (string_literal),                \
+              sizeof (string_literal) - 1))
+
+/* The same as above, except the comparison is case-insensitive. */
+#define BOUNDED_EQUAL_NO_CASE(beg, end, string_literal)        \
+  ((end) - (beg) == sizeof (string_literal) - 1                \
+   && !strncasecmp ((beg), (string_literal),           \
+                   sizeof (string_literal) - 1))
+
 /* Note that this much more elegant definition cannot be used:
 
    #define STRDUP_ALLOCA(str) (strcpy ((char *)alloca (strlen (str) + 1), str))
@@ -255,9 +281,10 @@ typedef enum
   URLBADHOST, FOPENERR, FWRITEERR, HOK, HLEXC, HEOF,
   HERR, RETROK, RECLEVELEXC, FTPACCDENIED, WRONGCODE,
   FTPINVPASV, FTPNOPASV,
-  RETRFINISHED, READERR, TRYLIMEXC, URLBADPATTERN,
-  FILEBADFILE, RANGEERR, RETRBADPATTERN, RETNOTSUP,
-  ROBOTSOK, NOROBOTS, PROXERR, AUTHFAILED, QUOTEXC, WRITEFAILED,
+  CONTNOTSUPPORTED, RETRFINISHED, READERR, TRYLIMEXC,
+  URLBADPATTERN, FILEBADFILE, RANGEERR, RETRBADPATTERN,
+  RETNOTSUP, ROBOTSOK, NOROBOTS, PROXERR, AUTHFAILED,
+  QUOTEXC, WRITEFAILED,
   SSLERRCERTFILE,SSLERRCERTKEY,SSLERRCTXCREATE
 } uerr_t;