File: HTParse.h

package info (click to toggle)
echoping 6.0.2-8
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,456 kB
  • ctags: 472
  • sloc: sh: 8,951; ansic: 3,355; makefile: 170
file content (98 lines) | stat: -rw-r--r-- 2,734 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*                                   HTParse:  URL parsing in the WWW Library
   **                           HTPARSE
   **
   **  This module of the WWW library contains code to parse URLs and various
   **  related things.
   **  Implemented by HTParse.c .
 */

#include "echoping.h" 
#include <ctype.h>

#ifndef HTPARSE_H
#define HTPARSE_H

/*
   **  The following are flag bits which may be ORed together to form
   **  a number to give the 'wanted' argument to HTParse.
 */
#define PARSE_ACCESS            16
#define PARSE_HOST               8
#define PARSE_PATH               4
#define PARSE_ANCHOR             2
#define PARSE_PUNCTUATION        1
#define PARSE_ALL               31

/*
   **  The following are valid mask values. The terms are the BNF names
   **  in the URL document.
 */
#define URL_XALPHAS     (unsigned char) 1
#define URL_XPALPHAS    (unsigned char) 2
#define URL_PATH        (unsigned char) 4

/*

   Macros for declarations

 */
#define PUBLIC			/* Accessible outside this module     */
#define PRIVATE static		/* Accessible only within this module */

#ifdef __STDC__
#define CONST const		/* "const" only exists in STDC */
#else
#define CONST
#endif
#define NOPARAMS (void)
#define PARAMS(parameter_list) parameter_list
#define NOARGS (void)
#define ARGS1(t,a) \
                (t a)
#define ARGS2(t,a,u,b) \
                (t a, u b)
#define ARGS3(t,a,u,b,v,c) \
                (t a, u b, v c)


/*      Parse a Name relative to another name.                  HTParse()
   **   --------------------------------------
   **
   **   This returns those parts of a name which are given (and requested)
   **   substituting bits from the related name where necessary.
   **
   ** On entry,
   **   aName           A filename given
   **      relatedName     A name relative to which aName is to be parsed
   **      wanted          A mask for the bits which are wanted.
   **
   ** On exit,
   **   returns         A pointer to a malloc'd string which MUST BE FREED
 */
extern char *HTParse PARAMS((
			       CONST char *aName,
			       CONST char *relatedName,
			       int wanted));

#ifndef TOLOWER
  /* Pyramid and Mips can't uppercase non-alpha */
#define TOLOWER(c) (isupper((unsigned char)c) ? tolower((unsigned char)c) : (c))
#define TOUPPER(c) (islower((unsigned char)c) ? toupper((unsigned char)c) : (c))
#endif /* ndef TOLOWER */

#define outofmem(file, func)\
 { fprintf(stderr,\
  "\r\n\r\n\r\n%s %s: out of memory.  Aborting...\r\n", file, func);\
   exit(-1);}

#define StrAllocCopy(dest, src) HTSACopy (&(dest), src)
#define StrAllocCat(dest, src)  HTSACat  (&(dest), src)

PUBLIC void HTSimplify ARGS1 (
			       char *, filename);

#endif /* HTPARSE_H */

/*
   end of HTParse
 */