⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 htutils.h

📁 elinks下lynx是最重要的二个文本浏览器, 在linux下非常实用, lynx比elinks早的多, 目前好像停止开发, 这是lynx源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
                t a; u b; v c; w d; x e; y f; z g; s h; r i; q j;#endif /* __STDC__ (ANSI) */#ifndef NULL#define NULL ((void *)0)#endif#define isEmpty(s)   ((s) == 0 || *(s) == 0)#define NonNull(s) (((s) != 0) ? s : "")#define NONNULL(s) (((s) != 0) ? s : "(null)")/* array/table size */#define	TABLESIZE(v)	(sizeof(v)/sizeof(v[0]))#define	typecalloc(cast)		(cast *)calloc(1,sizeof(cast))#define	typecallocn(cast,ntypes)	(cast *)calloc(ntypes,sizeof(cast))#define typeMalloc(cast)                (cast *)malloc(sizeof(cast))#define typeMallocn(cast,ntypes)        (cast *)malloc(ntypes*sizeof(cast))/*OFTEN USED INTEGER MACROS  Min and Max functions */#ifndef HTMIN#define HTMIN(a,b) ((a) <= (b) ? (a) : (b))#define HTMAX(a,b) ((a) >= (b) ? (a) : (b))#endif/*Booleans *//* Note: GOOD and BAD are already defined (differently) on RS6000 aix *//* #define GOOD(status) ((status)38;1)   VMS style status: test bit 0         *//* #define BAD(status)  (!GOOD(status))  Bit 0 set if OK, otherwise clear   */#ifndef _WINDOWS#ifndef BOOLEAN_DEFINED    typedef char    BOOLEAN;	/* Logical value */#ifndef CURSES#ifndef TRUE#define TRUE    (BOOLEAN)1#define FALSE   (BOOLEAN)0#endif#endif   /*  CURSES  */#endif	 /*  BOOLEAN_DEFINED */#define BOOLEAN_DEFINED#endif   /* _WINDOWS */#ifndef BOOL#define BOOL BOOLEAN#endif#ifndef YES#define YES (BOOLEAN)1#define NO (BOOLEAN)0#endifextern BOOL LYOutOfMemory;	/* Declared in LYexit.c - FM */#define TCP_PORT 80     /* Allocated to http by Jon Postel/ISI 24-Jan-92 */#define OLD_TCP_PORT 2784       /* Try the old one if no answer on 80 */#define DNP_OBJ 80      /* This one doesn't look busy, but we must check */                        /* That one was for decnet *//*      Inline Function WHITE: Is character c white space? *//*      For speed, include all control characters */#define WHITE(c) ((UCH(TOASCII(c))) <= 32)/*     Inline Function LYIsASCII: Is character c a traditional ASCII**     character (i.e. <128) after converting from host character set.  */#define LYIsASCII(c) (TOASCII(UCH(c)) < 128)/*Success (>=0) and failure (<0) codesSome of the values are chosen to be HTTP-like, but status return valuesare generally not the response status from any specific protocol. */#define HT_REDIRECTING 399#define HT_LOADED 200                   /* Instead of a socket */#define HT_PARTIAL_CONTENT      206     /* Partial Content */#define HT_INTERRUPTED -29998#define HT_NOT_LOADED -29999#define HT_OK           0               /* Generic success*/#define HT_ERROR                -1      /* Generic failure */#define HT_CANNOT_TRANSLATE -4#define HT_NO_DATA		-204	/* OK but no data was loaded - */					/* possibly other app started or forked */#define HT_NO_ACCESS            -401    /* Access not available */#define HT_FORBIDDEN            -403    /* Access forbidden */#define HT_NOT_ACCEPTABLE       -406    /* Not Acceptable */#define HT_PARSER_REOPEN_ELT     700    /* tells SGML parser to keep tag open */#define HT_PARSER_OTHER_CONTENT  701    /* tells SGML to change content model */#define HT_H_ERRNO_VALID        -800    /* see h_errno for resolver error */#define HT_INTERNAL             -900    /* Weird -- should never happen. */#define HT_BAD_EOF      -12             /* Premature EOF */#ifndef va_arg# if defined(HAVE_STDARG_H) && defined(ANSI_VARARGS)#  include <stdarg.h># else#  if HAVE_VARARGS_H#   include <varargs.h>#  endif# endif#endif#if defined(ANSI_VARARGS)#define LYva_start(ap,format) va_start(ap,format)#else#define LYva_start(ap,format) va_start(ap)#endif/* * GCC can be told that some functions are like printf (and do type-checking on * their parameters). */#ifndef GCC_PRINTFLIKE#if defined(GCC_PRINTF) && !defined(printf) && !defined(HAVE_LIBUTF8_H)#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))#else#define GCC_PRINTFLIKE(fmt,var) /*nothing*/#endif#endif#include <HTString.h>   /* String utilities *//*Out Of Memory checking for malloc() return: */#ifndef __FILE__#define __FILE__ ""#define __LINE__ ""#endif#include <LYexit.h>extern void outofmem PARAMS((CONST char *fname, CONST char *func));/* * Upper- and Lowercase macros * * The problem here is that toupper(x) is not defined officially unless * isupper(x) is.  These macros are CERTAINLY needed on #if defined(pyr) || * define(mips) or BDSI platforms.  For safefy, we make them mandatory. * * Note: Pyramid and Mips can't uppercase non-alpha. */#include <ctype.h>#include <string.h>#ifndef TOLOWER#ifdef EXP_ASCII_CTYPES#define TOLOWER(c) ascii_tolower(UCH(c))#define TOUPPER(c) ascii_toupper(UCH(c))#define ISUPPER(c) ascii_isupper(UCH(c))extern int ascii_toupper PARAMS((int));extern int ascii_tolower PARAMS((int));extern int ascii_isupper PARAMS((int));#else#define TOLOWER(c) (isupper(UCH(c)) ? tolower(UCH(c)) : UCH(c))#define TOUPPER(c) (islower(UCH(c)) ? toupper(UCH(c)) : UCH(c))#define ISUPPER(c) (isupper(UCH(c)))#endif#endif /* TOLOWER */#define FREE(x)    {if (x != 0) {free((char *)x); x = NULL;}}/*The local equivalents of CR and LF   We can check for these after net ascii text has been converted to the local   representation.  Similarly, we include them in strings to be sent as net ascii after   translation. */#define LF   FROMASCII('\012')  /* ASCII line feed LOCAL EQUIVALENT */#define CR   FROMASCII('\015')  /* Will be converted to ^M for transmission *//* * Debug message control. */#ifdef NO_LYNX_TRACE#define WWW_TraceFlag   0#define WWW_TraceMask   0#define LYTraceLogFP    0#elseextern BOOLEAN WWW_TraceFlag;extern int WWW_TraceMask;#endif#define TRACE           (WWW_TraceFlag)#define TRACE_bit(n)    (TRACE && (WWW_TraceMask & (1 << n)) != 0)#define TRACE_SGML      (TRACE_bit(0))#define TRACE_STYLE     (TRACE_bit(1))#define TRACE_TRST      (TRACE_bit(2))#define TRACE_CFG       (TRACE_bit(3))#define TRACE_BSTRING   (TRACE_bit(4))#if defined(LY_TRACELINE)#define LY_SHOWWHERE fprintf( tfp, "%s: %d: ", __FILE__, LY_TRACELINE ),#else#define LY_SHOWWHERE /* nothing */#endif#define CTRACE(p)         ((void)((TRACE) && ( LY_SHOWWHERE fprintf p )))#define CTRACE2(m,p)      ((void)((m)     && ( LY_SHOWWHERE fprintf p )))#define tfp TraceFP()#define CTRACE_SLEEP(secs) if (TRACE && LYTraceLogFP == 0) sleep(secs)#define CTRACE_FLUSH(fp)   if (TRACE) fflush(fp)extern FILE *TraceFP NOPARAMS;#include <www_tcp.h>/* * We force this include-ordering since socks.h contains redefinitions of * functions that probably are prototyped via other includes.  The socks.h * definitions have to be included everywhere, since they're making wrappers * for the stdio functions as well as the network functions. */#if defined(USE_SOCKS5) && !defined(DONT_USE_SOCKS5)#define SOCKS4TO5	/* turn on the Rxxxx definitions used in Lynx */#include <socks.h>/* * The AIX- and SOCKS4-specific definitions in socks.h are inconsistent. * Repair them so they're consistent (and usable). */#if defined(_AIX) && !defined(USE_SOCKS4_PREFIX)#undef  Raccept#define Raccept       accept#undef  Rgetsockname#define Rgetsockname  getsockname#undef  Rgetpeername#define Rgetpeername  getpeername#endif/* * Workaround for order-of-evaluation problem with gcc and socks5 headers * which breaks the Rxxxx names by attaching the prefix twice: */#ifdef INCLUDE_PROTOTYPES#undef  Raccept#undef  Rbind#undef  Rconnect#undef  Rlisten#undef  Rselect#undef  Rgetpeername#undef  Rgetsockname#define Raccept       accept#define Rbind         bind#define Rconnect      connect#define Rgetpeername  getpeername#define Rgetsockname  getsockname#define Rlisten       listen#define Rselect       select#endif#endif /* USE_SOCKS5 */#define SHORTENED_RBIND	/* FIXME: do this in configure-script */#ifdef USE_SSL#define free_func free__func#ifdef USE_OPENSSL_INCL#include <openssl/ssl.h>#include <openssl/crypto.h>#include <openssl/rand.h>#include <openssl/err.h>#else#ifdef USE_GNUTLS_INCL#include <gnutls/openssl.h>/* * GNUTLS's implementation of OpenSSL is very incomplete and rudimentary. * For a start, let's make it compile (TD - 2003/4/13). */#ifndef SSL_VERIFY_PEER#define SSL_VERIFY_PEER			0x01#endif#else	/* assume SSLeay */#include <ssl.h>#include <crypto.h>#include <rand.h>#include <err.h>#endif#endif /* USE_OPENSSL_INCL */#undef free_funcextern SSL * HTGetSSLHandle NOPARAMS;extern void HTSSLInitPRNG NOPARAMS;extern char HTGetSSLCharacter PARAMS((void * handle));#endif /* USE_SSL */#ifdef HAVE_LIBDMALLOC#include <dmalloc.h>    /* Gray Watson's library */#define show_alloc() dmalloc_log_unfreed()#endif#ifdef HAVE_LIBDBMALLOC#include <dbmalloc.h>   /* Conor Cahill's library */#define show_alloc() malloc_dump(fileno(stderr))#endif#ifndef show_alloc#define show_alloc()	/* nothing */#endif#include <userdefs.h>#endif /* HTUTILS_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -