1
/* $Id: indep.h,v 1.16 2003/09/22 21:02:19 ukai Exp $ */
20
extern unsigned char QUOTE_MAP[];
21
extern char *HTML_QUOTE_MAP[];
22
#define HTML_QUOTE_MASK 0x07 /* &, <, >, " */
23
#define SHELL_UNSAFE_MASK 0x08 /* [^A-Za-z0-9_./:\200-\377] */
24
#define URL_QUOTE_MASK 0x10 /* [\0- \177-\377] */
25
#define FILE_QUOTE_MASK 0x30 /* [\0- #%&+:?\177-\377] */
26
#define URL_UNSAFE_MASK 0x70 /* [^A-Za-z0-9_$\-.] */
27
#define GET_QUOTE_TYPE(c) QUOTE_MAP[(int)(unsigned char)(c)]
28
#define is_html_quote(c) (GET_QUOTE_TYPE(c) & HTML_QUOTE_MASK)
29
#define is_shell_unsafe(c) (GET_QUOTE_TYPE(c) & SHELL_UNSAFE_MASK)
30
#define is_url_quote(c) (GET_QUOTE_TYPE(c) & URL_QUOTE_MASK)
31
#define is_file_quote(c) (GET_QUOTE_TYPE(c) & FILE_QUOTE_MASK)
32
#define is_url_unsafe(c) (GET_QUOTE_TYPE(c) & URL_UNSAFE_MASK)
33
#define html_quote_char(c) HTML_QUOTE_MAP[(int)is_html_quote(c)]
35
extern clen_t strtoclen(const char *s);
36
extern char *conv_entity(unsigned int ch);
37
extern int getescapechar(char **s);
38
extern char *getescapecmd(char **s);
39
extern char *allocStr(const char *s, int len);
40
extern int strCmp(const void *s1, const void *s2);
41
extern char *currentdir(void);
42
extern char *cleanupName(char *name);
43
extern char *expandPath(char *name);
45
extern char *strchr(const char *s, int c);
46
#endif /* not HAVE_STRCHR */
47
#ifndef HAVE_STRCASECMP
48
extern int strcasecmp(const char *s1, const char *s2);
49
extern int strncasecmp(const char *s1, const char *s2, size_t n);
50
#endif /* not HAVE_STRCASECMP */
51
#ifndef HAVE_STRCASESTR
52
extern char *strcasestr(const char *s1, const char *s2);
54
extern int strcasemstr(char *str, char *srch[], char **ret_ptr);
55
int strmatchlen(const char *s1, const char *s2, int maxlen);
56
extern char *remove_space(char *str);
57
extern int non_null(char *s);
58
extern void cleanup_line(Str s, int mode);
59
extern char *html_quote(char *str);
60
extern char *html_unquote(char *str);
61
extern char *file_quote(char *str);
62
extern char *file_unquote(char *str);
63
extern char *url_quote(char *str);
64
extern Str Str_url_unquote(Str x, int is_form, int safe);
65
extern Str Str_form_quote(Str x);
66
#define Str_form_unquote(x) Str_url_unquote((x), TRUE, FALSE)
67
extern char *shell_quote(char *str);
69
extern char *w3m_auxbin_dir();
70
extern char *w3m_lib_dir();
71
extern char *w3m_etc_dir();
72
extern char *w3m_conf_dir();
73
extern char *w3m_help_dir();
75
#define New(type) ((type*)GC_MALLOC(sizeof(type)))
76
#define NewAtom(type) ((type*)GC_MALLOC_ATOMIC(sizeof(type)))
77
#define New_N(type,n) ((type*)GC_MALLOC((n)*sizeof(type)))
78
#define NewAtom_N(type,n) ((type*)GC_MALLOC_ATOMIC((n)*sizeof(type)))
79
#define New_Reuse(type,ptr,n) ((type*)GC_REALLOC((ptr),(n)*sizeof(type)))