about summary refs log tree commit diff stats
path: root/src/LYUtils.h
blob: 3545b6f893d5fd058fe284c515ce7188f37af0f8 (plain) (blame)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
/* $LynxId: LYUtils.h,v 1.92 2013/10/19 00:55:45 tom Exp $ */
#ifndef LYUTILS_H
#define LYUTILS_H

#include <LYCharVals.h>		/* S/390 -- gil -- 2149 */
#include <LYKeymap.h>

#ifndef HTLIST_H
#include <HTList.h>
#endif /* HTLIST_H */

#ifndef HTSTREAM_H
#include <HTStream.h>
#endif /* HTSTREAM_H */

#ifdef VMS
#include <HTFTP.h>
#include <HTVMSUtils.h>
#endif /* VMS */

#if defined(USE_DOS_DRIVES)
#include <HTDOS.h>
#endif

#if defined(SYSLOG_REQUESTED_URLS)
#include <syslog.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif
#ifdef VMS
#define HTSYS_name(path)   HTVMS_name("", path)
#define HTSYS_purge(path)  HTVMS_purge(path)
#define HTSYS_remove(path) HTVMS_remove(path)
#endif				/* VMS */
#if defined(USE_DOS_DRIVES)
#define HTSYS_name(path) HTDOS_name(path)
#endif
#ifndef HTSYS_name
#define HTSYS_name(path) path
#endif
#ifndef HTSYS_purge
#define HTSYS_purge(path)	/* nothing */
#endif
#ifndef HTSYS_remove
#define HTSYS_remove(path) remove(path)
#endif
#define LYIsPipeCommand(s) ((s)[0] == '|')
#ifdef VMS
#define TTY_DEVICE "tt:"
#define NUL_DEVICE "nl:"
#define LYIsNullDevice(s) (!strncasecomp(s, "nl:", 3) || !strncasecomp(s, "/nl/", 4))
#define LYSameFilename(a,b) (!strcasecomp(a,b))
#define LYSameHostname(a,b) (!strcasecomp(a,b))
#else
#if defined(DOSPATH) || defined(__EMX__)
#define TTY_DEVICE "con"
#define NUL_DEVICE "nul"
#define LYIsNullDevice(s) LYSameFilename(s,NUL_DEVICE)
#define LYSameFilename(a,b) (!strcasecomp(a,b))
#define LYSameHostname(a,b) (!strcasecomp(a,b))
#else
#if defined(__CYGWIN__)
#define TTY_DEVICE "/dev/tty"
#define NUL_DEVICE "/dev/null"
#define LYIsNullDevice(s) LYSameFilename(s,NUL_DEVICE)
#define LYSameFilename(a,b) (!strcasecomp(a,b))
#define LYSameHostname(a,b) (!strcasecomp(a,b))
#else
#define TTY_DEVICE "/dev/tty"
#define NUL_DEVICE "/dev/null"
#define LYIsNullDevice(s) LYSameFilename(s,NUL_DEVICE)
#define LYSameFilename(a,b) (!strcmp(a,b))
#define LYSameHostname(a,b) (!strcmp(a,b))
#endif				/* __CYGWIN__ */
#endif				/* DOSPATH */
#endif				/* VMS */
/* See definitions in src/LYCharVals.h.  The hardcoded values...
   This prohibits binding C-c and C-g.  Maybe it is better to remove this? */
#define LYCharIsINTERRUPT_HARD(ch)	\
  ((ch) == LYCharINTERRUPT1 || ch == LYCharINTERRUPT2)
#define LYCharIsINTERRUPT(ch)		\
  (LYCharIsINTERRUPT_HARD(ch) || LKC_TO_LAC(keymap,ch) == LYK_INTERRUPT)
#define LYCharIsINTERRUPT_NO_letter(ch)	\
  (LYCharIsINTERRUPT(ch) && !isprint(ch))
#if defined(USE_DOS_DRIVES)
#define PATHSEP_STR "\\"
#define LYIsPathSep(ch) ((ch) == '/' || (ch) == '\\')
#define LYIsDosDrive(s) (isalpha(UCH((s)[0])) && (s)[1] == ':')
#else
#define PATHSEP_STR "/"
#define LYIsPathSep(ch) ((ch) == '/')
#define LYIsDosDrive(s) FALSE	/* really nothing */
#endif
#ifdef USE_ADDRLIST_PAGE
#define LYIsListpageTitle(name) \
    (!strcmp((name), LIST_PAGE_TITLE) || \
     !strcmp((name), ADDRLIST_PAGE_TITLE))
#else
#define LYIsListpageTitle(name) \
    (!strcmp((name), LIST_PAGE_TITLE))
#endif
#define LYIsTilde(ch)     ((ch) == '~')
#define LYIsHtmlSep(ch) ((ch) == '/')
#define findPoundSelector(address) strchr(address, '#')
#define restorePoundSelector(pound) if ((pound) != NULL) *(pound) = '#'
    extern BOOL strn_dash_equ(const char *p1, const char *p2, int len);
    extern BOOLEAN LYAddSchemeForURL(char **AllocatedString, const char *default_scheme);
    extern BOOLEAN LYCachedTemp(char *result, char **cached);
    extern BOOLEAN LYCanDoHEAD(const char *address);
    extern BOOLEAN LYCanReadFile(const char *name);
    extern BOOLEAN LYCanWriteFile(const char *name);
    extern BOOLEAN LYCloseInput(FILE *fp);
    extern BOOLEAN LYCloseOutput(FILE *fp);
    extern BOOLEAN LYExpandHostForURL(char **AllocatedString,
				      char *prefix_list, char *suffix_list);
    extern BOOLEAN LYFixCursesOnForAccess(const char *addr, const char *physical);
    extern BOOLEAN LYPathOffHomeOK(char *fbuffer, size_t fbuffer_size);
    extern BOOLEAN LYValidateFilename(bstring **result, bstring **given);
    extern BOOLEAN LYisAbsPath(const char *path);
    extern BOOLEAN LYisLocalAlias(const char *filename);
    extern BOOLEAN LYisLocalFile(const char *filename);
    extern BOOLEAN LYisLocalHost(const char *filename);
    extern BOOLEAN LYisRootPath(const char *path);
    extern BOOLEAN inlocaldomain(void);
    extern FILE *InternalPageFP(char *filename, int reuse_flag);
    extern FILE *LYAppendToTxtFile(const char *name);
    extern FILE *LYNewBinFile(const char *name);
    extern FILE *LYNewTxtFile(const char *name);
    extern FILE *LYOpenScratch(char *result, const char *prefix);
    extern FILE *LYOpenTemp(char *result, const char *suffix, const char *mode);
    extern FILE *LYOpenTempRewrite(char *result, const char *suffix, const char *mode);
    extern FILE *LYReopenTemp(char *name);
    extern char *Current_Dir(char *pathname);
    extern char *LYAbsOrHomePath(char **fname);
    extern char *LYAddPathToSave(char *fname);
    extern char *LYGetEnv(const char *name);
    extern char *LYLastPathSep(const char *path);
    extern char *LYPathLeaf(char *pathname);
    extern char *LYTildeExpand(char **pathname, int embedded);
    extern char *LYgetXDisplay(void);
    extern char *strip_trailing_slash(char *my_dirname);
    extern char *trimPoundSelector(char *address);
    extern const char *Home_Dir(void);
    extern const char *LYGetHiliteStr(int cur, int count);
    extern const char *LYSysShell(void);
    extern const char *index_to_restriction(unsigned inx);
    extern const char *wwwName(const char *pathname);
    extern int HTCheckForInterrupt(void);
    extern int LYConsoleInputFD(int need_selectable);
    extern int LYCopyFile(char *src, char *dst);
    extern int LYGetHilitePos(int cur, int count);
    extern int LYRemoveTemp(char *name);
    extern int LYReopenInput(void);
    extern int LYSystem(char *command);
    extern int LYValidateOutput(char *filename);
    extern int find_restriction(const char *name, int len);
    extern int number2arrows(int number);
    extern size_t utf8_length(int utf_flag, const char *data);
    extern time_t LYmktime(char *string, int absolute);
    extern void BeginInternalPage(FILE *fp0, const char *Title, const char *HelpURL);
    extern void EndInternalPage(FILE *fp0);
    extern void HTAddSugFilename(char *fname);
    extern void HTSugFilenames_free(void);
    extern void LYAddHilite(int cur, char *text, int x);
    extern void LYAddHtmlSep(char **path);
    extern void LYAddHtmlSep0(char *path);
    extern void LYAddLocalhostAlias(char *alias);
    extern void LYAddPathSep(char **path);
    extern void LYAddPathSep0(char *path);
    extern void LYAddPathToHome(char *fbuffer, size_t fbuffer_size, const char *fname);
    extern void LYCheckBibHost(void);
    extern void LYCheckMail(void);
    extern void LYCleanupTemp(void);
    extern void LYCloseTemp(char *name);
    extern void LYCloseTempFP(FILE *fp);
    extern void LYConvertToURL(char **AllocatedString, int fixit);
    extern void LYDoCSI(char *url, const char *comment, char **csi);
    extern void LYEnsureAbsoluteURL(char **href, const char *name, int fixit);
    extern void LYFakeZap(int set);
    extern void LYFixCursesOn(const char *reason);
    extern void LYFreeHilites(int first, int last);
    extern void LYFreeStringList(HTList *list);
    extern void LYLocalFileToURL(char **target, const char *source);
    extern void LYLocalhostAliases_free(void);
    extern void LYRenamedTemp(char *oldname, char *newname);
    extern void LYSetHilite(int cur, const char *text);
    extern void LYTrimHtmlSep(char *path);
    extern void LYTrimPathSep(char *path);
    extern void LYTrimRelFromAbsPath(char *path);
    extern void LYhighlight(int flag, int cur, const char *target);
    extern void LYmsec_delay(unsigned msec);
    extern void LYsetXDisplay(char *new_display);
    extern void WriteInternalTitle(FILE *fp0, const char *Title);
    extern void WriteStreamTitle(HTStream *target, const char *Title);
    extern void change_sug_filename(char *fname);
    extern void convert_to_spaces(char *string, int condense);
    extern void free_and_clear(char **obj);
    extern void noviceline(int more_flag);
    extern void parse_restrictions(const char *s);
    extern void print_restrictions_to_fd(FILE *fp);
    extern void remove_backslashes(char *buf);
    extern void size_change(int sig);
    extern void statusline(const char *text);
    extern void toggle_novice_line(void);

#if defined(MULTI_USER_UNIX)
    extern BOOL IsOurFile(const char *name);
#else
#define IsOurFile(name) TRUE
#endif

#ifdef USE_ASCII_CTYPES
    extern int ascii_tolower(int i);
    extern int ascii_toupper(int i);
    extern int ascii_isupper(int i);
#endif

#ifdef __CYGWIN__
    extern int Cygwin_Shell(void);
#endif

#if defined(_WIN_CC) || defined(WIN_EX)
    extern int exec_command(char *cmd, int wait_flag);	/* xsystem.c */
    extern char *quote_pathname(char *pathname);
    extern int xsystem(char *cmd);
#endif

/* Keeping track of User Interface Pages: */
    typedef enum {
	UIP_UNKNOWN = -1
	,UIP_HISTORY = 0
	,UIP_DOWNLOAD_OPTIONS
	,UIP_PRINT_OPTIONS
	,UIP_SHOWINFO
	,UIP_LIST_PAGE
	,UIP_VLINKS
	,UIP_LYNXCFG
	,UIP_OPTIONS_MENU
	,UIP_DIRED_MENU
	,UIP_PERMIT_OPTIONS
	,UIP_UPLOAD_OPTIONS
	,UIP_ADDRLIST_PAGE
	,UIP_CONFIG_DEF
	,UIP_TRACELOG
	,UIP_INSTALL
    } UIP_t;

#define UIP_P_FRAG 0x0001	/* flag: consider "url#frag" as matching "url" */

    extern BOOL LYIsUIPage3(const char *url, UIP_t type, int flagparam);

#define LYIsUIPage(url,type) LYIsUIPage3(url, type, UIP_P_FRAG)
    extern void LYRegisterUIPage(const char *url, UIP_t type);

#define LYUnRegisterUIPage(type) LYRegisterUIPage(NULL, type)
    extern void LYUIPages_free(void);

#ifdef CAN_CUT_AND_PASTE
    extern int put_clip(const char *szBuffer);

/* get_clip_grab() returns a pointer to the string in the system area.
   get_clip_release() should be called ASAP after this. */
    extern char *get_clip_grab(void);
    extern void get_clip_release(void);

#  ifdef WIN_EX
#    define size_clip()	8192
#  else
    extern int size_clip(void);

#  endif
#endif

#if defined(WIN_EX)		/* 1997/10/16 (Thu) 20:13:28 */
    extern char *HTDOS_short_name(const char *path);
    extern char *w32_strerror(DWORD ercode);
#endif

#if defined(WIN_EX) || defined(__CYGWIN__)	/* 2000/03/07 (Tue) 17:17:46 */
    extern int unsafe_filename(const char *fname);
    extern FILE *safe_fopen(const char *fname, const char *mode);
#endif

#ifdef VMS
    extern void Define_VMSLogical(char *LogicalName, char *LogicalValue);
#endif				/* VMS */

#if ! HAVE_PUTENV
    extern int putenv(const char *string);
#endif				/* HAVE_PUTENV */

#if defined(MULTI_USER_UNIX)
    extern void LYRelaxFilePermissions(const char *name);

#else
#define LYRelaxFilePermissions(name)	/* nothing */
#endif

#if defined(_WINDOWS)
    extern int win32_check_interrupt(void);
#endif

/*
 *  Whether or not the status line must be shown.
 */
    extern BOOLEAN mustshow;

#define _statusline(msg)	mustshow = TRUE, statusline(msg)

/*
 *  For is_url().
 *
 *  Universal document id types (see LYCheckForProxyURL)
 */
    typedef enum {
	NOT_A_URL_TYPE = 0,
	UNKNOWN_URL_TYPE = 1,	/* must be nonzero */

	HTTP_URL_TYPE,
	FILE_URL_TYPE,
	FTP_URL_TYPE,
	NCFTP_URL_TYPE,
	WAIS_URL_TYPE,
	NEWS_URL_TYPE,
	NNTP_URL_TYPE,
	TELNET_URL_TYPE,
	TN3270_URL_TYPE,
	RLOGIN_URL_TYPE,
	GOPHER_URL_TYPE,
	HTML_GOPHER_URL_TYPE,
	TELNET_GOPHER_URL_TYPE,
	INDEX_GOPHER_URL_TYPE,
	MAILTO_URL_TYPE,
	BIBP_URL_TYPE,
	FINGER_URL_TYPE,
	CSO_URL_TYPE,
	HTTPS_URL_TYPE,
	SNEWS_URL_TYPE,
	PROSPERO_URL_TYPE,
	AFS_URL_TYPE,

	DATA_URL_TYPE,

	LYNXCGI_URL_TYPE,
	LYNXEXEC_URL_TYPE,
	LYNXPROG_URL_TYPE,

	NEWSPOST_URL_TYPE,
	NEWSREPLY_URL_TYPE,
	SNEWSPOST_URL_TYPE,
	SNEWSREPLY_URL_TYPE,

	LYNXCACHE_URL_TYPE,
	LYNXCFG_URL_TYPE,
	LYNXCOMPILE_OPTS_URL_TYPE,
	LYNXCOOKIE_URL_TYPE,
	LYNXDIRED_URL_TYPE,
	LYNXDOWNLOAD_URL_TYPE,
	LYNXEDITMAP_URL_TYPE,
	LYNXHIST_URL_TYPE,
	LYNXIMGMAP_URL_TYPE,
	LYNXKEYMAP_URL_TYPE,
	LYNXMESSAGES_URL_TYPE,
	LYNXOPTIONS_URL_TYPE,
	LYNXPRINT_URL_TYPE,

	PROXY_URL_TYPE

    } UrlTypes;

    extern UrlTypes LYCheckForProxyURL(char *filename);
    extern UrlTypes is_url(char *filename);

/* common URLs */
#define STR_BIBP_URL         "bibp:"
#define LEN_BIBP_URL         5
#define isBIBP_URL(addr)     !strncasecomp(addr, STR_BIBP_URL, LEN_BIBP_URL)

#define STR_CSO_URL          "cso:"
#define LEN_CSO_URL          4
#define isCSO_URL(addr)      !strncasecomp(addr, STR_CSO_URL, LEN_CSO_URL)

#define STR_FILE_URL         "file:"
#define LEN_FILE_URL         5
#define isFILE_URL(addr)     ((*addr == 'f' || *addr == 'F') &&\
                             !strncasecomp(addr, STR_FILE_URL, LEN_FILE_URL))

#define STR_FINGER_URL       "finger:"
#define LEN_FINGER_URL       7
#define isFINGER_URL(addr)   !strncasecomp(addr, STR_FINGER_URL, LEN_FINGER_URL)

#define STR_FTP_URL          "ftp:"
#define LEN_FTP_URL          4
#define isFTP_URL(addr)      !strncasecomp(addr, STR_FTP_URL, LEN_FTP_URL)

#define STR_GOPHER_URL       "gopher:"
#define LEN_GOPHER_URL       7
#define isGOPHER_URL(addr)   !strncasecomp(addr, STR_GOPHER_URL, LEN_GOPHER_URL)

#define STR_HTTP_URL         "http:"
#define LEN_HTTP_URL         5
#define isHTTP_URL(addr)     !strncasecomp(addr, STR_HTTP_URL, LEN_HTTP_URL)

#define STR_HTTPS_URL        "https:"
#define LEN_HTTPS_URL        6
#define isHTTPS_URL(addr)    !strncasecomp(addr, STR_HTTPS_URL, LEN_HTTPS_URL)

#define STR_MAILTO_URL       "mailto:"
#define LEN_MAILTO_URL       7
#define isMAILTO_URL(addr)   !strncasecomp(addr, STR_MAILTO_URL, LEN_MAILTO_URL)

#define STR_NEWS_URL         "news:"
#define LEN_NEWS_URL         5
#define isNEWS_URL(addr)     !strncasecomp(addr, STR_NEWS_URL, LEN_NEWS_URL)

#define STR_NNTP_URL         "nntp:"
#define LEN_NNTP_URL         5
#define isNNTP_URL(addr)     !strncasecomp(addr, STR_NNTP_URL, LEN_NNTP_URL)

#define STR_RLOGIN_URL       "rlogin:"
#define LEN_RLOGIN_URL       7
#define isRLOGIN_URL(addr)   !strncasecomp(addr, STR_RLOGIN_URL, LEN_RLOGIN_URL)

#define STR_SNEWS_URL        "snews:"
#define LEN_SNEWS_URL        6
#define isSNEWS_URL(addr)    !strncasecomp(addr, STR_SNEWS_URL, LEN_SNEWS_URL)

#define STR_TELNET_URL       "telnet:"
#define LEN_TELNET_URL       7
#define isTELNET_URL(addr)   !strncasecomp(addr, STR_TELNET_URL, LEN_TELNET_URL)

#define STR_TN3270_URL       "tn3270:"
#define LEN_TN3270_URL       7
#define isTN3270_URL(addr)   !strncasecomp(addr, STR_TN3270_URL, LEN_TN3270_URL)

#define STR_WAIS_URL         "wais:"
#define LEN_WAIS_URL         5
#define isWAIS_URL(addr)     !strncasecomp(addr, STR_WAIS_URL, LEN_WAIS_URL)

/* internal URLs */
#ifdef USE_CACHEJAR
#define STR_LYNXCACHE        "LYNXCACHE:"
#define LEN_LYNXCACHE        10
#define isLYNXCACHE(addr)    !strncasecomp(addr, STR_LYNXCACHE, LEN_LYNXCACHE)
#else
#define isLYNXCACHE(addr)    FALSE
#endif

#define STR_LYNXCFG          "LYNXCFG:"
#define LEN_LYNXCFG          8
#define isLYNXCFG(addr)      !strncasecomp(addr, STR_LYNXCFG, LEN_LYNXCFG)

#define STR_LYNXCFLAGS       "LYNXCOMPILEOPTS:"
#define LEN_LYNXCFLAGS       16
#define isLYNXCFLAGS(addr)   !strncasecomp(addr, STR_LYNXCFLAGS, LEN_LYNXCFLAGS)

#define STR_LYNXCGI          "lynxcgi:"
#define LEN_LYNXCGI          8
#define isLYNXCGI(addr)      ((*addr == 'l' || *addr == 'L') &&\
                             !strncasecomp(addr, STR_LYNXCGI, LEN_LYNXCGI))

#define STR_LYNXCOOKIE       "LYNXCOOKIE:"
#define LEN_LYNXCOOKIE       11
#define isLYNXCOOKIE(addr)   !strncasecomp(addr, STR_LYNXCOOKIE, LEN_LYNXCOOKIE)

#define STR_LYNXDIRED        "LYNXDIRED:"
#define LEN_LYNXDIRED        10
#define isLYNXDIRED(addr)    !strncasecomp(addr, STR_LYNXDIRED, LEN_LYNXDIRED)

#define STR_LYNXEXEC         "lynxexec:"
#define LEN_LYNXEXEC         9
#define isLYNXEXEC(addr)     ((*addr == 'l' || *addr == 'L') &&\
                             !strncasecomp(addr, STR_LYNXEXEC, LEN_LYNXEXEC))

#define STR_LYNXDOWNLOAD     "LYNXDOWNLOAD:"
#define LEN_LYNXDOWNLOAD     13
#define isLYNXDOWNLOAD(addr) !strncasecomp(addr, STR_LYNXDOWNLOAD, LEN_LYNXDOWNLOAD)

#define STR_LYNXEDITMAP      "LYNXEDITMAP:"
#define LEN_LYNXEDITMAP      11
#define isLYNXEDITMAP(addr)  !strncasecomp(addr, STR_LYNXEDITMAP, LEN_LYNXEDITMAP)

#define STR_LYNXHIST         "LYNXHIST:"
#define LEN_LYNXHIST         9
#define isLYNXHIST(addr)     !strncasecomp(addr, STR_LYNXHIST, LEN_LYNXHIST)

#define STR_LYNXKEYMAP       "LYNXKEYMAP:"
#define LEN_LYNXKEYMAP       11
#define isLYNXKEYMAP(addr)   !strncasecomp(addr, STR_LYNXKEYMAP, LEN_LYNXKEYMAP)

#define STR_LYNXIMGMAP       "LYNXIMGMAP:"
#define LEN_LYNXIMGMAP       11
#define isLYNXIMGMAP(addr)   !strncasecomp(addr, STR_LYNXIMGMAP, LEN_LYNXIMGMAP)

#define STR_LYNXMESSAGES     "LYNXMESSAGES:"
#define LEN_LYNXMESSAGES     13
#define isLYNXMESSAGES(addr) !strncasecomp(addr, STR_LYNXMESSAGES, LEN_LYNXMESSAGES)

#define STR_LYNXOPTIONS      "LYNXOPTIONS:"
#define LEN_LYNXOPTIONS      12
#define isLYNXOPTIONS(addr)  !strncasecomp(addr, STR_LYNXOPTIONS, LEN_LYNXOPTIONS)

#define STR_LYNXPRINT        "LYNXPRINT:"
#define LEN_LYNXPRINT        10
#define isLYNXPRINT(addr)    !strncasecomp(addr, STR_LYNXPRINT, LEN_LYNXPRINT)

#define STR_LYNXPROG         "lynxprog:"
#define LEN_LYNXPROG         9
#define isLYNXPROG(addr)     ((*addr == 'l' || *addr == 'L') &&\
                             !strncasecomp(addr, STR_LYNXPROG, LEN_LYNXPROG))

#define LYNXOPTIONS_PAGE(s)  STR_LYNXOPTIONS s
/*
 *  For change_sug_filename().
 */
    extern HTList *sug_filenames;

/*
 * syslog() facility
 */
#if defined(SYSLOG_REQUESTED_URLS)
    extern void LYOpenlog(const char *banner);
    extern void LYSyslog(char *arg);
    extern void LYCloselog(void);
#endif				/* SYSLOG_REQUESTED_URLS */

#undef STREQ			/* conflict with wais.h */

/*
 *  Miscellaneous.
 */
#define STREQ(a,b)    (strcmp(a,b) == 0)
#define STRNEQ(a,b,c) (StrNCmp(a,b,c) == 0)

#define HIDE_CHMOD 0600
#define HIDE_UMASK 0077

#if defined(DOSPATH) || defined(__CYGWIN__)
#define TXT_R	"rt"
#define TXT_W	"wt"
#define TXT_A	"at+"
#else
#define TXT_R	"r"
#define TXT_W	"w"
#define TXT_A	"a+"
#endif

#define BIN_R	"rb"
#define BIN_W	"wb"
#define BIN_A	"ab+"

#ifdef __cplusplus
}
#endif
#endif				/* LYUTILS_H */