links

lynx-like text mode web browser
git clone anongit@rnpnr.xyz:links.git
Log | Files | Refs | Feed | README | LICENSE

Commit: b2aa409e41d7691160a7c9d74ba153b3c2ec8f40
Parent: f8e367603df879c005a850530fd059420eb1b69c
Author: opask
Date:   Mon,  9 Jul 2018 19:58:11 -0600

remove unix domain support, delete more unused code

Diffstat:
MMakefile | 3---
Daf_unix.c | 273-------------------------------------------------------------------------------
Mcompress.c | 509-------------------------------------------------------------------------------
Mconfig.h | 218-------------------------------------------------------------------------------
Mconnect.c | 3---
Mdefault.c | 16+---------------
Mdip.c | 62--------------------------------------------------------------
Mdns.c | 40----------------------------------------
Dfn_impl.c | 379-------------------------------------------------------------------------------
Mhttp.c | 29-----------------------------
Mhttps.c | 117+------------------------------------------------------------------------------
Djsint.c | 50--------------------------------------------------
Mkbd.c | 66------------------------------------------------------------------
Mlinks.h | 176++-----------------------------------------------------------------------------
Mmain.c | 65-----------------------------------------------------------------
Mmenu.c | 144++-----------------------------------------------------------------------------
Mos_dep.c | 13+++----------
Mos_depx.h | 45++++-----------------------------------------
Mselect.c | 37-------------------------------------
Msession.c | 14++------------
Mstring.c | 8--------
Murl.c | 40----------------------------------------
22 files changed, 17 insertions(+), 2290 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,7 +1,6 @@ include config.mk SRC = \ - af_unix.c\ auth.c\ bfu.c\ block.c\ @@ -17,7 +16,6 @@ SRC = \ drivers.c\ error.c\ file.c\ - fn_impl.c\ html.c\ html_gr.c\ html_r.c\ @@ -25,7 +23,6 @@ SRC = \ http.c\ https.c\ img.c\ - jsint.c\ kbd.c\ language.c\ listedit.c\ diff --git a/af_unix.c b/af_unix.c @@ -1,273 +0,0 @@ -/* af_unix.c - * (c) 2002 Mikulas Patocka - * This file is a part of the Links program, released under GPL - */ - -#include "links.h" - -#ifdef DONT_USE_AF_UNIX - -int s_unix_fd = -1; - -int bind_to_af_unix(unsigned char *name) -{ - return -1; -} - -void af_unix_close(void) -{ -} - -#else - -#ifdef USE_AF_UNIX -#include <sys/un.h> -#endif - -#if defined(__GNU__) -#define SOCKET_TIMEOUT_HACK -#endif - -static void af_unix_connection(void *); - -#define ADDR_SIZE 4096 - -union address { - struct sockaddr s; -#ifdef USE_AF_UNIX - struct sockaddr_un suni; -#endif - struct sockaddr_in sin; - unsigned char buffer[ADDR_SIZE]; -}; - -static union address s_unix; -static union address s_unix_acc; - -static socklen_t s_unix_l; -int s_unix_fd = -1; -static int s_unix_master = 0; - - -#define S2C1_HANDSHAKE_LENGTH 6 -#define C2S2_HANDSHAKE_LENGTH sizeof(struct links_handshake) -#define S2C3_HANDSHAKE_LENGTH sizeof(struct links_handshake) - -static struct links_handshake { - unsigned char version[30]; - unsigned char system_name[32]; - unsigned char system_id; - unsigned char sizeof_long; -} links_handshake; - -#define HANDSHAKE_WRITE(hndl, sz) \ - if ((r = hard_write(hndl, (unsigned char *)&links_handshake, sz)) != (sz)) -#define HANDSHAKE_READ(hndl, sz) \ - if ((r = hard_read(hndl, (unsigned char *)&received_handshake, sz)) != (sz) || memcmp(&received_handshake, &links_handshake, sz)) - - -#ifdef USE_AF_UNIX - -static int get_address(unsigned char *name) -{ - unsigned char *path; - if (!links_home) return -1; - path = stracpy(links_home); - add_to_strn(&path, cast_uchar LINKS_SOCK_NAME); - if (anonymous) { - add_to_strn(&path, cast_uchar LINKS_ANONYMOUS_SOCK_SUFFIX); - } - if (name) { - unsigned char *n = stracpy(name); - check_filename(&n); - add_to_strn(&path, cast_uchar "-"); - add_to_strn(&path, n); - mem_free(n); - } - s_unix_l = (socklen_t)((unsigned char *)&s_unix.suni.sun_path - (unsigned char *)&s_unix.suni + strlen(cast_const_char path) + 1); - if (strlen(cast_const_char path) > sizeof(union address) || (size_t)s_unix_l > sizeof(union address)) { - mem_free(path); - return -1; - } - memset(&s_unix, 0, sizeof s_unix); - s_unix.suni.sun_family = AF_UNIX; - strcpy(cast_char s_unix.suni.sun_path, cast_const_char path); - mem_free(path); - return PF_UNIX; -} - -static void unlink_unix(void) -{ - int rs; - /*debug("unlink: %s", s_unix.suni.sun_path);*/ - EINTRLOOP(rs, unlink(s_unix.suni.sun_path)); - if (rs) { - /*perror("unlink");*/ - } -} - -#else - -static int get_address(unsigned char *name) -{ - unsigned short port; - if (!name) { - port = LINKS_PORT; - } else if (!strcmp(cast_const_char name, "pmshell")) { - port = LINKS_PORT + 2; - } else { - port = LINKS_PORT; - while (*name) { - port = 257 * port + (*name * 2); - name++; - } - port %= LINKS_G_PORT_LEN; - port += LINKS_G_PORT_START; - port &= ~1; - } - if (anonymous) { - port++; - } - memset(&s_unix, 0, sizeof s_unix); - s_unix.sin.sin_family = AF_INET; - s_unix.sin.sin_port = htons(port); - s_unix.sin.sin_addr.s_addr = htonl(0x7f000001); - s_unix_l = sizeof(struct sockaddr_in); - /*debug("get address %d", port);*/ - return PF_INET; -} - -static void unlink_unix(void) -{ -} - -#endif - -int bind_to_af_unix(unsigned char *name) -{ - int u = 0; - int a1 = 1; - int cnt = 0; - int af; - int r; - int rs; - struct links_handshake received_handshake; - memset(&links_handshake, 0, sizeof links_handshake); - safe_strncpy(links_handshake.version, cast_uchar("Links " VERSION_STRING), sizeof links_handshake.version); - safe_strncpy(links_handshake.system_name, system_name, sizeof links_handshake.system_name); - links_handshake.system_id = SYSTEM_ID; - links_handshake.sizeof_long = sizeof(long); - if ((af = get_address(name)) == -1) return -1; - again: - s_unix_fd = c_socket(af, SOCK_STREAM, 0); - if (s_unix_fd == -1) return -1; -#if defined(SOL_SOCKET) && defined(SO_REUSEADDR) - EINTRLOOP(rs, setsockopt(s_unix_fd, SOL_SOCKET, SO_REUSEADDR, (void *)&a1, sizeof a1)); -#endif - EINTRLOOP(rs, bind(s_unix_fd, &s_unix.s, s_unix_l)); - if (rs) { - /*debug("bind: %d, %s", errno, strerror(errno));*/ - if (af == PF_INET && errno == EADDRNOTAVAIL) { - /* do not try to connect if the user has not configured loopback interface */ - EINTRLOOP(rs, close(s_unix_fd)); - return -1; - } - EINTRLOOP(rs, close(s_unix_fd)); - s_unix_fd = c_socket(af, SOCK_STREAM, 0); - if (s_unix_fd == -1) return -1; -#if defined(SOL_SOCKET) && defined(SO_REUSEADDR) - EINTRLOOP(rs, setsockopt(s_unix_fd, SOL_SOCKET, SO_REUSEADDR, (void *)&a1, sizeof a1)); -#endif - EINTRLOOP(rs, connect(s_unix_fd, &s_unix.s, s_unix_l)); - if (rs) { -retry: - /*debug("connect: %d, %s", errno, strerror(errno));*/ - if (++cnt < MAX_BIND_TRIES) { - portable_sleep(100); - EINTRLOOP(rs, close(s_unix_fd)); - s_unix_fd = -1; - goto again; - } -#ifdef SOCKET_TIMEOUT_HACK -retry_unlink: -#endif - EINTRLOOP(rs, close(s_unix_fd)); - s_unix_fd = -1; - if (!u) { - unlink_unix(); - u = 1; - goto again; - } - return -1; - } -#ifdef SOCKET_TIMEOUT_HACK - if (!can_read_timeout(s_unix_fd, AF_UNIX_SOCKET_TIMEOUT)) - goto retry_unlink; -#endif - HANDSHAKE_READ(s_unix_fd, S2C1_HANDSHAKE_LENGTH) { - if (r != S2C1_HANDSHAKE_LENGTH) goto retry; - goto close_and_fail; - } - HANDSHAKE_WRITE(s_unix_fd, C2S2_HANDSHAKE_LENGTH) - goto close_and_fail; - HANDSHAKE_READ(s_unix_fd, S2C3_HANDSHAKE_LENGTH) - goto close_and_fail; - return s_unix_fd; - } - EINTRLOOP(rs, listen(s_unix_fd, 100)); - if (rs) { - error("ERROR: listen failed: %d", errno); - close_and_fail: - EINTRLOOP(rs, close(s_unix_fd)); - s_unix_fd = -1; - return -1; - } - s_unix_master = 1; - set_handlers(s_unix_fd, af_unix_connection, NULL, NULL); - return -1; -} - -static void af_unix_connection(void *xxx) -{ - socklen_t l = s_unix_l; - int ns; - int r; - int rs; - struct links_handshake received_handshake; - memset(&s_unix_acc, 0, sizeof s_unix_acc); - ns = c_accept(s_unix_fd, &s_unix_acc.s, &l); - if (ns == -1) return; - HANDSHAKE_WRITE(ns, S2C1_HANDSHAKE_LENGTH) { - EINTRLOOP(rs, close(ns)); - return; - } - HANDSHAKE_READ(ns, C2S2_HANDSHAKE_LENGTH) { - portable_sleep(100); /* workaround for a race in previous Links version */ - EINTRLOOP(rs, close(ns)); - return; - } - HANDSHAKE_WRITE(ns, S2C3_HANDSHAKE_LENGTH) { - EINTRLOOP(rs, close(ns)); - return; - } - if (!F) { - init_term(ns, ns, win_func); - set_highpri(); - } -#ifdef G - else { - gfx_connection(ns); - } -#endif -} - -void af_unix_close(void) -{ - close_socket(&s_unix_fd); - if (s_unix_master) { - unlink_unix(); - s_unix_master = 0; - } -} - -#endif diff --git a/compress.c b/compress.c @@ -257,444 +257,6 @@ static int decode_gzip(struct terminal *term, struct cache_entry *ce, int defl, } #endif -#ifdef HAVE_BROTLI -#if defined(__TINYC__) && defined(__STDC_VERSION__) -#undef __STDC_VERSION__ -#endif -#include <brotli/decode.h> -static void *brotli_alloc(void *opaque, size_t size) -{ - return mem_alloc_mayfail(size); -} -static void brotli_free(void *opaque, void *ptr) -{ - if (ptr) mem_free(ptr); -} -static int decode_brotli(struct terminal *term, struct cache_entry *ce, int *errp) -{ - unsigned char err; - BrotliDecoderState *br; - const unsigned char *next_in; - size_t avail_in; - unsigned char *next_out; - size_t avail_out; - off_t offset; - BrotliDecoderResult res; - unsigned char *p; - struct fragment *f; - struct list_head *lf; - size_t size; - - err = 0; - decoder_memory_init(&p, &size, ce->length); - next_out = p; - avail_out = size; - br = BrotliDecoderCreateInstance(brotli_alloc, brotli_free, NULL); - if (!br) { - decompress_error(term, ce, cast_uchar "brotli", TEXT_(T_OUT_OF_MEMORY), errp); - err = 1; - goto after_inflateend; - } - - offset = 0; - foreach(struct fragment, f, lf, ce->frag) { - if (f->offset != offset) break; - next_in = f->data; - avail_in = (size_t)f->length; - if ((off_t)avail_in != f->length) overalloc(); - repeat_frag: - res = BrotliDecoderDecompressStream(br, &avail_in, &next_in, &avail_out, &next_out, NULL); - if (res == BROTLI_DECODER_RESULT_ERROR) { - decompress_error(term, ce, cast_uchar "brotli", cast_uchar BrotliDecoderErrorString(BrotliDecoderGetErrorCode(br)), errp); - err = 1; - goto finish; - } - if (!avail_out) { - size_t addsize; - if (decoder_memory_expand(&p, size, &addsize) < 0) { - decompress_error(term, ce, cast_uchar "brotli", TEXT_(T_OUT_OF_MEMORY), errp); - err = 1; - goto finish; - } - next_out = p + size; - avail_out = addsize; - size += addsize; - goto repeat_frag; - } - if (avail_in) goto repeat_frag; - /* - BrotliDecoderHasMoreOutput(br) returns BROTLI_BOOL which is defined differently for different compilers, so we must not use it - if (BrotliDecoderHasMoreOutput(br)) goto repeat_frag; - */ - offset += f->length; - } - - finish: - BrotliDecoderDestroyInstance(br); - after_inflateend: - if (err && next_out == p) { - mem_free(p); - return 1; - } - ce->decompressed = p; - ce->decompressed_len = next_out - p; - decompressed_cache_size += ce->decompressed_len; - ce->decompressed = mem_realloc(ce->decompressed, ce->decompressed_len); - return 0; -} -#endif - -#ifdef HAVE_BZIP2 -#include <bzlib.h> -static int decode_bzip2(struct terminal *term, struct cache_entry *ce, int *errp) -{ - unsigned char err; - unsigned char memory_error; - bz_stream z; - off_t offset; - int r; - unsigned char *p; - struct fragment *f; - struct list_head *lf; - size_t size; - - retry_after_memory_error: - err = 0; - memory_error = 0; - decoder_memory_init(&p, &size, ce->length); - memset(&z, 0, sizeof z); - z.next_in = NULL; - z.avail_in = 0; - z.next_out = cast_char p; - z.avail_out = (unsigned)size; - z.bzalloc = NULL; - z.bzfree = NULL; - z.opaque = NULL; - r = BZ2_bzDecompressInit(&z, 0, 0); - init_failed: - switch (r) { - case BZ_OK: break; - case BZ_MEM_ERROR: memory_error = 1; - err = 1; - goto after_inflateend; - case BZ_PARAM_ERROR: - decompress_error(term, ce, cast_uchar "bzip2", cast_uchar "Invalid parameter", errp); - err = 1; - goto after_inflateend; - case BZ_CONFIG_ERROR: decompress_error(term, ce, cast_uchar "bzip2", cast_uchar "Bzlib is miscompiled", errp); - err = 1; - goto after_inflateend; - default: decompress_error(term, ce, cast_uchar "bzip2", cast_uchar "Unknown return value on BZ2_bzDecompressInit", errp); - err = 1; - goto after_inflateend; - } - offset = 0; - foreach(struct fragment, f, lf, ce->frag) { - if (f->offset != offset) break; - z.next_in = cast_char f->data; - z.avail_in = (unsigned)f->length; - if ((off_t)z.avail_in != f->length) overalloc(); - repeat_frag: - r = BZ2_bzDecompress(&z); - switch (r) { - case BZ_OK: break; - case BZ_STREAM_END: - r = BZ2_bzDecompressEnd(&z); - if (r != BZ_OK) goto end_failed; - r = BZ2_bzDecompressInit(&z, 0, 0); - if (r != BZ_OK) goto init_failed; - break; - case BZ_DATA_ERROR_MAGIC: - case BZ_DATA_ERROR: decompress_error(term, ce, cast_uchar "bzip2", TEXT_(T_COMPRESSED_ERROR), errp); - err = 1; - goto finish; - case BZ_PARAM_ERROR: decompress_error(term, ce, cast_uchar "bzip2", cast_uchar "Internal error on BZ2_bzDecompress", errp); - err = 1; - goto finish; - case BZ_MEM_ERROR: - mem_error: memory_error = 1; - err = 1; - goto finish; - default: decompress_error(term, ce, cast_uchar "bzip2", cast_uchar "Unknown return value on BZ2_bzDecompress", errp); - err = 1; - break; - } - if (!z.avail_out) { - size_t addsize; - if (decoder_memory_expand(&p, size, &addsize) < 0) - goto mem_error; - z.next_out = cast_char(p + size); - z.avail_out = (unsigned)addsize; - size += addsize; - goto repeat_frag; - } - if (z.avail_in) goto repeat_frag; - offset += f->length; - } - finish: - r = BZ2_bzDecompressEnd(&z); - end_failed: - switch (r) { - case BZ_OK: break; - case BZ_PARAM_ERROR: decompress_error(term, ce, cast_uchar "bzip2", cast_uchar "Internal error on BZ2_bzDecompressEnd", errp); - err = 1; - break; - case BZ_MEM_ERROR: memory_error = 1; - err = 1; - break; - default: decompress_error(term, ce, cast_uchar "bzip2", cast_uchar "Unknown return value on BZ2_bzDecompressEnd", errp); - err = 1; - break; - } - after_inflateend: - if (memory_error) { - mem_free(p); - if (out_of_memory(0, NULL, 0)) - goto retry_after_memory_error; - decompress_error(term, ce, cast_uchar "bzip2", TEXT_(T_OUT_OF_MEMORY), errp); - return 1; - } - if (err && (unsigned char *)z.next_out == p) { - mem_free(p); - return 1; - } - ce->decompressed = p; - ce->decompressed_len = (unsigned char *)z.next_out - (unsigned char *)p; - decompressed_cache_size += ce->decompressed_len; - ce->decompressed = mem_realloc(ce->decompressed, ce->decompressed_len); - return 0; -} -#endif - -#ifdef HAVE_LZMA -#undef internal -#include <lzma.h> -#define internal internal_ -static int decode_lzma(struct terminal *term, struct cache_entry *ce, int *errp) -{ - unsigned char err; - unsigned char memory_error; - lzma_stream z = LZMA_STREAM_INIT; - off_t offset; - int r; - unsigned char *p; - struct fragment *f; - struct list_head *lf; - size_t size; - - retry_after_memory_error: - err = 0; - memory_error = 0; - decoder_memory_init(&p, &size, ce->length); - z.next_in = NULL; - z.avail_in = 0; - z.next_out = p; - z.avail_out = size; - r = lzma_auto_decoder(&z, UINT64_MAX, 0); - init_failed: - switch (r) { - case LZMA_OK: break; - case LZMA_MEM_ERROR: memory_error = 1; - err = 1; - goto after_inflateend; - case LZMA_OPTIONS_ERROR: - decompress_error(term, ce, cast_uchar "lzma", cast_uchar "Invalid parameter", errp); - err = 1; - goto after_inflateend; - case LZMA_PROG_ERROR: decompress_error(term, ce, cast_uchar "lzma", cast_uchar "Lzma is miscompiled", errp); - err = 1; - goto after_inflateend; - default: decompress_error(term, ce, cast_uchar "lzma", cast_uchar "Unknown return value on lzma_auto_decoder", errp); - err = 1; - goto after_inflateend; - } - offset = 0; - foreach(struct fragment, f, lf, ce->frag) { - if (f->offset != offset) break; - z.next_in = f->data; - z.avail_in = (size_t)f->length; - if ((off_t)z.avail_in != f->length) overalloc(); - repeat_frag: - r = lzma_code(&z, LZMA_RUN); - switch (r) { - case LZMA_OK: - case LZMA_NO_CHECK: - case LZMA_UNSUPPORTED_CHECK: - case LZMA_GET_CHECK: - break; - case LZMA_STREAM_END: - lzma_end(&z); - r = lzma_auto_decoder(&z, UINT64_MAX, 0); - if (r != LZMA_OK) goto init_failed; - break; - case LZMA_MEM_ERROR: - mem_error: memory_error = 1; - err = 1; - goto finish; - case LZMA_MEMLIMIT_ERROR: - decompress_error(term, ce, cast_uchar "lzma", cast_uchar "Memory limit was exceeded", errp); - err = 1; - goto finish; - case LZMA_FORMAT_ERROR: - case LZMA_DATA_ERROR: - case LZMA_BUF_ERROR: - decompress_error(term, ce, cast_uchar "lzma", TEXT_(T_COMPRESSED_ERROR), errp); - err = 1; - goto finish; - case LZMA_OPTIONS_ERROR:decompress_error(term, ce, cast_uchar "lzma", cast_uchar "File contains unsupported options", errp); - err = 1; - goto finish; - case LZMA_PROG_ERROR: decompress_error(term, ce, cast_uchar "lzma", cast_uchar "Lzma is miscompiled", errp); - err = 1; - goto finish; - default: decompress_error(term, ce, cast_uchar "lzma", cast_uchar "Unknown return value on lzma_code", errp); - err = 1; - break; - } - if (!z.avail_out) { - size_t addsize; - if (decoder_memory_expand(&p, size, &addsize) < 0) - goto mem_error; - z.next_out = p + size; - z.avail_out = addsize; - size += addsize; - goto repeat_frag; - } - if (z.avail_in) goto repeat_frag; - offset += f->length; - } - finish: - lzma_end(&z); - after_inflateend: - if (memory_error) { - mem_free(p); - if (out_of_memory(0, NULL, 0)) - goto retry_after_memory_error; - decompress_error(term, ce, cast_uchar "lzma", TEXT_(T_OUT_OF_MEMORY), errp); - return 1; - } - if (err && (unsigned char *)z.next_out == p) { - mem_free(p); - return 1; - } - ce->decompressed = p; - ce->decompressed_len = (unsigned char *)z.next_out - (unsigned char *)p; - decompressed_cache_size += ce->decompressed_len; - ce->decompressed = mem_realloc(ce->decompressed, ce->decompressed_len); - return 0; -} -#endif - -#ifdef HAVE_LZIP -#include <lzlib.h> -static int decode_lzip(struct terminal *term, struct cache_entry *ce, int *errp) -{ - unsigned char err; - unsigned char memory_error; - void *lz; - off_t offset; - int r; - enum LZ_Errno le; - unsigned char *p; - struct fragment *f; - struct list_head *lf; - size_t size; - size_t used_size; - - retry_after_memory_error: - err = 0; - memory_error = 0; - decoder_memory_init(&p, &size, ce->length); - used_size = 0; - - lz = LZ_decompress_open(); - if (!lz) { - err = 1; - memory_error = 1; - goto after_inflateend; - } - if (LZ_decompress_errno(lz) != LZ_ok) { -lz_error: - le = LZ_decompress_errno(lz); - if (0) -mem_error: le = LZ_mem_error; - err = 1; - if (le == LZ_mem_error) { - memory_error = 1; - } else if (!ce->incomplete) { - decompress_error(term, ce, cast_uchar "lzip", cast_uchar LZ_strerror(le), errp); - } - goto finish; - } - - offset = 0; - foreach(struct fragment, f, lf, ce->frag) { - unsigned char *current_ptr; - int current_len; - if (f->offset != offset) break; - current_ptr = f->data; - current_len = (int)f->length; - while (current_len) { - r = LZ_decompress_write(lz, current_ptr, current_len); - if (r == -1) - goto lz_error; - current_ptr += r; - current_len -= r; - do { - if (used_size == size) { - size_t addsize; - if (decoder_memory_expand(&p, size, &addsize) < 0) - goto mem_error; - size += addsize; - } - r = LZ_decompress_read(lz, p + used_size, (int)(size - used_size)); - if (r == -1) - goto lz_error; - used_size += r; - } while (r); - } - offset += f->length; - } - r = LZ_decompress_finish(lz); - if (r == -1) - goto lz_error; - while ((r = LZ_decompress_finished(lz)) == 0) { - if (used_size == size) { - size_t addsize; - if (decoder_memory_expand(&p, size, &addsize) < 0) - goto mem_error; - size += addsize; - } - r = LZ_decompress_read(lz, p + used_size, (int)(size - used_size)); - if (r == -1) - goto lz_error; - used_size += r; - } - if (r == -1) - goto lz_error; - -finish: - LZ_decompress_close(lz); -after_inflateend: - if (memory_error) { - mem_free(p); - if (out_of_memory(0, NULL, 0)) - goto retry_after_memory_error; - decompress_error(term, ce, cast_uchar "lzip", TEXT_(T_OUT_OF_MEMORY), errp); - return 1; - } - if (err && !used_size) { - mem_free(p); - return 1; - } - ce->decompressed = p; - ce->decompressed_len = used_size; - decompressed_cache_size += ce->decompressed_len; - ce->decompressed = mem_realloc(ce->decompressed, ce->decompressed_len); - return 0; -} -#endif - int get_file_by_term(struct terminal *term, struct cache_entry *ce, unsigned char **start, unsigned char **end, int *errp) { unsigned char *enc; @@ -721,34 +283,6 @@ int get_file_by_term(struct terminal *term, struct cache_entry *ce, unsigned cha goto return_decompressed; } #endif -#ifdef HAVE_BROTLI - if (!casestrcmp(enc, cast_uchar "br")) { - mem_free(enc); - if (decode_brotli(term, ce, errp)) goto uncompressed; - goto return_decompressed; - } -#endif -#ifdef HAVE_BZIP2 - if (!casestrcmp(enc, cast_uchar "bzip2")) { - mem_free(enc); - if (decode_bzip2(term, ce, errp)) goto uncompressed; - goto return_decompressed; - } -#endif -#ifdef HAVE_LZMA - if (!casestrcmp(enc, cast_uchar "lzma") || !casestrcmp(enc, cast_uchar "lzma2")) { - mem_free(enc); - if (decode_lzma(term, ce, errp)) goto uncompressed; - goto return_decompressed; - } -#endif -#ifdef HAVE_LZIP - if (!casestrcmp(enc, cast_uchar "lzip")) { - mem_free(enc); - if (decode_lzip(term, ce, errp)) goto uncompressed; - goto return_decompressed; - } -#endif mem_free(enc); goto uncompressed; } @@ -804,49 +338,6 @@ void add_compress_methods(unsigned char **s, int *l) #endif } #endif -#ifdef HAVE_BROTLI - { - unsigned bv = BrotliDecoderVersion(); - if (!cl) cl = 1; else add_to_str(s, l, cast_uchar ", "); - add_to_str(s, l, cast_uchar "BROTLI"); - add_to_str(s, l, cast_uchar " ("); - add_num_to_str(s, l, bv >> 24); - add_to_str(s, l, cast_uchar "."); - add_num_to_str(s, l, (bv >> 12) & 0xfff); - add_to_str(s, l, cast_uchar "."); - add_num_to_str(s, l, bv & 0xfff); - add_to_str(s, l, cast_uchar ")"); - } -#endif -#ifdef HAVE_BZIP2 - { - unsigned char *b = (unsigned char *)BZ2_bzlibVersion(); - int bl = (int)strcspn(cast_const_char b, ","); - if (!cl) cl = 1; else add_to_str(s, l, cast_uchar ", "); - add_to_str(s, l, cast_uchar "BZIP2"); - add_to_str(s, l, cast_uchar " ("); - add_bytes_to_str(s, l, b, bl); - add_to_str(s, l, cast_uchar ")"); - } -#endif -#ifdef HAVE_LZMA - { - if (!cl) cl = 1; else add_to_str(s, l, cast_uchar ", "); - add_to_str(s, l, cast_uchar "LZMA"); - add_to_str(s, l, cast_uchar " ("); - add_to_str(s, l, cast_uchar lzma_version_string()); - add_to_str(s, l, cast_uchar ")"); - } -#endif -#ifdef HAVE_LZIP - { - if (!cl) cl = 1; else add_to_str(s, l, cast_uchar ", "); - add_to_str(s, l, cast_uchar "LZIP"); - add_to_str(s, l, cast_uchar " ("); - add_to_str(s, l, cast_uchar LZ_version()); - add_to_str(s, l, cast_uchar ")"); - } -#endif } #endif diff --git a/config.h b/config.h @@ -1,15 +1,3 @@ -/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define if you have the vprintf function. */ -#define HAVE_VPRINTF 1 - -/* Define as the return type of signal handlers (int or void). */ -#define RETSIGTYPE void - -/* Define if you can safely include both <sys/time.h> and <time.h>. */ -#define TIME_WITH_SYS_TIME 1 - /* The number of bytes in a unsigned. */ #define SIZEOF_UNSIGNED 4 @@ -31,18 +19,6 @@ /* Define if you have the OPENSSL_init_ssl function. */ /* #define HAVE_OPENSSL_INIT_SSL 1 */ -/* Define if you have the RAND_add function. */ -#define HAVE_RAND_ADD 1 - -/* Define if you have the RAND_file_name function. */ -#define HAVE_RAND_FILE_NAME 1 - -/* Define if you have the RAND_load_file function. */ -#define HAVE_RAND_LOAD_FILE 1 - -/* Define if you have the RAND_write_file function. */ -#define HAVE_RAND_WRITE_FILE 1 - /* Define if you have the SSL_get1_session function. */ #define HAVE_SSL_GET1_SESSION 1 @@ -82,30 +58,6 @@ /* Define if you have the XwcLookupString function. */ #define HAVE_XWCLOOKUPSTRING 1 -/* Define if you have the bcmp function. */ -#define HAVE_BCMP 1 - -/* Define if you have the bcopy function. */ -#define HAVE_BCOPY 1 - -/* Define if you have the bzero function. */ -#define HAVE_BZERO 1 - -/* Define if you have the calloc function. */ -#define HAVE_CALLOC 1 - -/* Define if you have the cfmakeraw function. */ -#define HAVE_CFMAKERAW 1 - -/* Define if you have the chmod function. */ -#define HAVE_CHMOD 1 - -/* Define if you have the clock_gettime function. */ -#define HAVE_CLOCK_GETTIME 1 - -/* Define if you have the dirfd function. */ -#define HAVE_DIRFD 1 - /* Define if you have the event_base_free function. */ #define HAVE_EVENT_BASE_FREE 1 @@ -130,15 +82,9 @@ /* Define if you have the freeaddrinfo function. */ #define HAVE_FREEADDRINFO 1 -/* Define if you have the gai_strerror function. */ -#define HAVE_GAI_STRERROR 1 - /* Define if you have the getaddrinfo function. */ #define HAVE_GETADDRINFO 1 -/* Define if you have the getcwd function. */ -#define HAVE_GETCWD 1 - /* Define if you have the getgrgid function. */ #define HAVE_GETGRGID 1 @@ -154,9 +100,6 @@ /* Define if you have the getrlimit function. */ #define HAVE_GETRLIMIT 1 -/* Define if you have the gettimeofday function. */ -#define HAVE_GETTIMEOFDAY 1 - /* Define if you have the herror function. */ #define HAVE_HERROR 1 @@ -169,24 +112,6 @@ /* Define if you have the kqueue function. */ #define HAVE_KQUEUE 1 -/* Define if you have the memchr function. */ -#define HAVE_MEMCHR 1 - -/* Define if you have the memcmp function. */ -#define HAVE_MEMCMP 1 - -/* Define if you have the memcpy function. */ -#define HAVE_MEMCPY 1 - -/* Define if you have the memmem function. */ -#define HAVE_MEMMEM 1 - -/* Define if you have the memmove function. */ -#define HAVE_MEMMOVE 1 - -/* Define if you have the memset function. */ -#define HAVE_MEMSET 1 - /* Define if you have the mktime function. */ #define HAVE_MKTIME 1 @@ -235,9 +160,6 @@ /* Define if you have the pthread_sigmask function. */ #define HAVE_PTHREAD_SIGMASK 1 -/* Define if you have the raise function. */ -#define HAVE_RAISE 1 - /* Define if you have the select function. */ #define HAVE_SELECT 1 @@ -268,69 +190,15 @@ /* Define if you have the sigsetmask function. */ #define HAVE_SIGSETMASK 1 -/* Define if you have the snprintf function. */ -#define HAVE_SNPRINTF 1 - -/* Define if you have the strchr function. */ -#define HAVE_STRCHR 1 - -/* Define if you have the strcmp function. */ -#define HAVE_STRCMP 1 - -/* Define if you have the strcpy function. */ -#define HAVE_STRCPY 1 - -/* Define if you have the strcspn function. */ -#define HAVE_STRCSPN 1 - -/* Define if you have the strdup function. */ -#define HAVE_STRDUP 1 - -/* Define if you have the strerror function. */ -#define HAVE_STRERROR 1 - -/* Define if you have the strlen function. */ -#define HAVE_STRLEN 1 - -/* Define if you have the strncmp function. */ -#define HAVE_STRNCMP 1 - /* Define if you have the strptime function. */ #define HAVE_STRPTIME 1 -/* Define if you have the strrchr function. */ -#define HAVE_STRRCHR 1 - -/* Define if you have the strspn function. */ -#define HAVE_STRSPN 1 - -/* Define if you have the strstr function. */ -#define HAVE_STRSTR 1 - -/* Define if you have the strtod function. */ -#define HAVE_STRTOD 1 - -/* Define if you have the strtoimax function. */ -#define HAVE_STRTOIMAX 1 - -/* Define if you have the strtol function. */ -#define HAVE_STRTOL 1 - -/* Define if you have the strtoll function. */ -#define HAVE_STRTOLL 1 - /* Define if you have the strtoq function. */ #define HAVE_STRTOQ 1 -/* Define if you have the strtoul function. */ -#define HAVE_STRTOUL 1 - /* Define if you have the tdelete function. */ #define HAVE_TDELETE 1 -/* Define if you have the tempnam function. */ -#define HAVE_TEMPNAM 1 - /* Define if you have the tfind function. */ #define HAVE_TFIND 1 @@ -453,9 +321,6 @@ /* Define if you have the <sys/select.h> header file. */ #define HAVE_SYS_SELECT_H 1 -/* Define if you have the <sys/time.h> header file. */ -#define HAVE_SYS_TIME_H 1 - /* Define if you have the <sys/un.h> header file. */ #define HAVE_SYS_UN_H 1 @@ -465,15 +330,9 @@ /* Define if you have the <termios.h> header file. */ #define HAVE_TERMIOS_H 1 -/* Define if you have the <time.h> header file. */ -#define HAVE_TIME_H 1 - /* Define if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 -/* Define if you have the <utime.h> header file. */ -#define HAVE_UTIME_H 1 - /* Define if you have the <zlib.h> header file. */ #define HAVE_ZLIB_H 1 @@ -523,54 +382,6 @@ #define RENAME_OVER_EXISTING_FILES 1 /* */ -#define HAVE_STRLEN 1 - -/* */ -#define HAVE_STRCPY 1 - -/* */ -#define HAVE_STRCHR 1 - -/* */ -#define HAVE_STRRCHR 1 - -/* */ -#define HAVE_STRCMP 1 - -/* */ -#define HAVE_STRNCMP 1 - -/* */ -#define HAVE_STRCSPN 1 - -/* */ -#define HAVE_STRSPN 1 - -/* */ -#define HAVE_STRSTR 1 - -/* */ -#define HAVE_MEMCMP 1 - -/* */ -#define HAVE_MEMCHR 1 - -/* */ -#define HAVE_MEMCPY 1 - -/* */ -#define HAVE_MEMMOVE 1 - -/* */ -#define HAVE_MEMSET 1 - -/* */ -#define HAVE_MEMMEM 1 - -/* */ -#define HAVE_STRERROR 1 - -/* */ #define HAVE_SIGFILLSET 1 /* */ @@ -583,9 +394,6 @@ #define DEBUGLEVEL 0 /* */ -#define HAVE_CLOCK_GETTIME 1 - -/* */ #define HAVE_GETHOSTBYNAME 1 /* */ @@ -621,36 +429,10 @@ #define HAVE_GETHOSTBYNAME 1 #define SUPPORT_IPV6 1 -#define NO_ASYNC_LOOKUP 1 #define DONT_USE_AF_UNIX 1 #undef HAVE_GETHOSTBYNAME_BUG #undef EXTERNAL_LOOKUP -#undef __CYGWIN__ -#undef HAVE_ATHEOS_THREADS_H -#undef OS2 -#undef OS2_ADVANCED_HEAP -#undef OPENVMS -#undef BEOS -#undef SPAD -#undef DOS -#undef DOS_FS -#undef DOS_FS_8_3 -#undef GRDRV_SVGALIB -#undef GRDRV_ATHEOS -#undef VMS_DEBUGLEVEL -#undef HAVE_BROTLI -#undef HAVE_BZIP2 -#undef HAVE_LZMA -#undef HAVE_LZIP -#undef HAVE_CYGWIN_CONV_PATH -#undef __ICC -#undef HAVE_OPENMP -#undef FLOOD_MEMORY -#undef OPENVMS_64BIT -#undef GRDRV_GRX -#undef GRDRV_VIRTUAL_DEVICES #undef USE_GPM #undef HAVE_BUILTIN_SSL_CERTIFICATES -#undef LEAK_DEBUG diff --git a/connect.c b/connect.c @@ -670,9 +670,6 @@ static void try_connect(struct connection *c) } if (rs) { if (errno != EALREADY && errno != EINPROGRESS) { -#ifdef BEOS - if (errno == EWOULDBLOCK) errno = ETIMEDOUT; -#endif retry_connect(c, get_error_from_errno(errno), 0); return; } diff --git a/default.c b/default.c @@ -11,10 +11,6 @@ unsigned char system_name[MAX_STR_LEN]; static void get_system_name(void) { -#ifdef OS2 - if (!os_get_system_name(system_name)) - return; -#endif #if defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME) { struct utsname name; @@ -183,14 +179,6 @@ static void get_compiler_name(void) unsigned char *os = !v0 ? "S/370" : v0 == 1 ? "OS/390" : v0 == 4 ? "z/OS" : ""; sprintf(cast_char compiler_name, "IBM%s%s XL C %X.%0X.%X", *os ? " " : "", os, v1, v2, v3); -#elif defined(__ICC) - - int w = __ICC+0; - int v1 = w / 100; - int v2 = w % 100; - if (!(v2 % 10)) sprintf(cast_char compiler_name, "Intel C %d.%d", v1, v2 / 10); - else sprintf(cast_char compiler_name, "Intel C %d.%02d", v1, v2); - #elif defined(__LCC__) sprintf(cast_char compiler_name, "LCC"); @@ -527,7 +515,7 @@ static unsigned char *create_config_string(struct option *options) int l = 0; int i; add_to_str(&s, &l, cast_uchar "# This file is automatically generated by Links -- please do not edit."); -#if defined(__DECC_VER) && !defined(OPENVMS) +#if defined(__DECC_VER) do_not_optimize_here(&options); #endif for (i = 0; options[i].p; i++) { @@ -733,9 +721,7 @@ static unsigned char *get_home(int *n) if (n) *n = 0; if ((st.st_mode & 07777) != 0700) { home_creat: -#ifdef HAVE_CHMOD EINTRLOOP(rs, chmod(cast_const_char home_links, 0700)); -#endif } add_to_strn(&home_links, cast_uchar "/"); mem_free(home); diff --git a/dip.c b/dip.c @@ -155,12 +155,6 @@ static void add_row_gray(unsigned *my_restrict row_buf, unsigned char *my_restri /* line_skip is in pixels. The column contains the whole pixels (R G B) * We assume unsigned short holds at least 16 bits. */ -#ifdef __ICC -#if __ICC >= 1000 && defined(__i386__) && defined(USE_FP_SCALE) -/* ICC for i386 misoptimizes this function when inlining it */ -ATTR_NOINLINE -#endif -#endif static void add_col_color(scale_t *my_restrict col_buf, unsigned short *my_restrict ptr, int line_skip, int n, ulonglong weight) { @@ -401,9 +395,6 @@ static inline longlong multiply_int(int a, int b) static void enlarge_color_horizontal(unsigned short *in, int ix, int y, unsigned short **outa, int ox) { -#ifdef HAVE_OPENMP - int use_omp; -#endif int n_threads; int alloc_size; scale_t *col_buf; @@ -442,28 +433,17 @@ static void enlarge_color_horizontal(unsigned short *in, int ix, int y, multiply_int(ix-1,ox-1); n_threads = omp_start(); -#ifdef HAVE_OPENMP - use_omp = !OPENMP_NONATOMIC & (n_threads > 1) & (ox >= 24); - if (!use_omp) - n_threads = 1; -#endif if ((unsigned)y > (MAXINT - SMP_ALIGN + 1) / 3 / sizeof(*col_buf)) overalloc(); alloc_size = (int)(y*3*sizeof(*col_buf)); alloc_size = (alloc_size + SMP_ALIGN - 1) & ~(SMP_ALIGN - 1); if (alloc_size > MAXINT / n_threads) overalloc(); col_buf = mem_alloc_mayfail(alloc_size * n_threads); if (!col_buf) goto skip_omp; -#ifdef HAVE_OPENMP -#pragma omp parallel default(none) firstprivate(col_buf,alloc_size,in,out,ix,ox,y,skip,oskip) if (use_omp) -#endif { scale_t *thread_col_buf; int out_idx; thread_col_buf = (scale_t *)((char *)col_buf + alloc_size * omp_get_thread_num()); bias_buf_color(thread_col_buf, y, (scale_t)(ox - 1) / 2); -#ifdef HAVE_OPENMP -#pragma omp for nowait -#endif for (out_idx = 0; out_idx <= ox - 1; out_idx++) { ulonglong out_pos, in_pos, in_end; int in_idx; @@ -554,9 +534,6 @@ static void scale_gray_horizontal(unsigned char *in, int ix, int y, static void scale_color_horizontal(unsigned short *in, int ix, int y, unsigned short **outa, int ox) { -#ifdef HAVE_OPENMP - int use_omp; -#endif int n_threads; int alloc_size; scale_t *col_buf; @@ -588,28 +565,17 @@ static void scale_color_horizontal(unsigned short *in, int ix, int y, } n_threads = omp_start(); -#ifdef HAVE_OPENMP - use_omp = !OPENMP_NONATOMIC & (n_threads > 1) & (ox >= 24); - if (!use_omp) - n_threads = 1; -#endif if ((unsigned)y > (MAXINT - SMP_ALIGN + 1) / 3 / sizeof(*col_buf)) overalloc(); alloc_size = (int)(y*3*sizeof(*col_buf)); alloc_size = (alloc_size + SMP_ALIGN - 1) & ~(SMP_ALIGN - 1); if (alloc_size > MAXINT / n_threads) overalloc(); col_buf = mem_alloc_mayfail(alloc_size * n_threads); if (!col_buf) goto skip_omp; -#ifdef HAVE_OPENMP -#pragma omp parallel default(none) firstprivate(col_buf,alloc_size,in,out,ix,ox,y,skip,oskip) if (use_omp) -#endif { scale_t *thread_col_buf; int out_idx; thread_col_buf = (scale_t *)((char *)col_buf + alloc_size * omp_get_thread_num()); bias_buf_color(thread_col_buf, y, (scale_t)ix / 2); -#ifdef HAVE_OPENMP -#pragma omp for nowait -#endif for (out_idx = 0; out_idx < ox; out_idx++) { ulonglong out_pos, out_end, in_pos; int in_idx; @@ -702,9 +668,6 @@ static void enlarge_gray_vertical(unsigned char *in, int x, int iy, static void enlarge_color_vertical(unsigned short *in, int x, int iy, unsigned short **outa ,int oy) { -#ifdef HAVE_OPENMP - int use_omp; -#endif int n_threads; int alloc_size; scale_t *row_buf; @@ -739,28 +702,17 @@ static void enlarge_color_vertical(unsigned short *in, int x, int iy, multiply_int(iy-1,oy-1); n_threads = omp_start(); -#ifdef HAVE_OPENMP - use_omp = (!OPENMP_NONATOMIC | !(x & 3)) & (n_threads > 1) & (oy >= 24); - if (!use_omp) - n_threads = 1; -#endif if ((unsigned)x > (MAXINT - SMP_ALIGN + 1) / 3 / sizeof(*row_buf)) overalloc(); alloc_size = (int)(x*3*sizeof(*row_buf)); alloc_size = (alloc_size + SMP_ALIGN - 1) & ~(SMP_ALIGN - 1); if (alloc_size > MAXINT / n_threads) overalloc(); row_buf = mem_alloc_mayfail(alloc_size * n_threads); if (!row_buf) goto skip_omp; -#ifdef HAVE_OPENMP -#pragma omp parallel default(none) firstprivate(row_buf,alloc_size,in,out,x,iy,oy) if (use_omp) -#endif { scale_t *thread_row_buf; int out_idx; thread_row_buf = (scale_t *)((char *)row_buf + alloc_size * omp_get_thread_num()); bias_buf_color(thread_row_buf,x,(scale_t)(oy-1) / 2); -#ifdef HAVE_OPENMP -#pragma omp for nowait -#endif for (out_idx = 0; out_idx <= oy - 1; out_idx++) { ulonglong out_pos, in_pos, in_end; int in_idx; @@ -853,9 +805,6 @@ static void scale_gray_vertical(unsigned char *in, int x, int iy, static void scale_color_vertical(unsigned short *in, int x, int iy, unsigned short **outa, int oy) { -#ifdef HAVE_OPENMP - int use_omp; -#endif int n_threads; int alloc_size; scale_t *row_buf; @@ -884,28 +833,17 @@ static void scale_color_vertical(unsigned short *in, int x, int iy, return; } n_threads = omp_start(); -#ifdef HAVE_OPENMP - use_omp = (!OPENMP_NONATOMIC | !(x & 3)) & (n_threads > 1) & (oy >= 24); - if (!use_omp) - n_threads = 1; -#endif if ((unsigned)x > (MAXINT - SMP_ALIGN + 1) / 3 / sizeof(*row_buf)) overalloc(); alloc_size = (int)(x*3*sizeof(*row_buf)); alloc_size = (alloc_size + SMP_ALIGN - 1) & ~(SMP_ALIGN - 1); if (alloc_size > MAXINT / n_threads) overalloc(); row_buf = mem_alloc_mayfail(alloc_size * n_threads); if (!row_buf) goto skip_omp; -#ifdef HAVE_OPENMP -#pragma omp parallel default(none) firstprivate(row_buf,alloc_size,in,out,x,iy,oy) if (use_omp) -#endif { scale_t *thread_row_buf; int out_idx; thread_row_buf = (scale_t *)((char *)row_buf + alloc_size * omp_get_thread_num()); bias_buf_color(thread_row_buf,x,(scale_t)iy / 2); -#ifdef HAVE_OPENMP -#pragma omp for nowait -#endif for (out_idx = 0; out_idx < oy; out_idx++) { ulonglong out_pos, out_end, in_pos; int in_idx; diff --git a/dns.c b/dns.c @@ -659,49 +659,9 @@ int ipv6_full_access(void) return 0; } -#ifdef FLOOD_MEMORY - -void flood_memory(void) -{ - struct list_head list; - size_t s = 32768 * 32; - struct dnsentry *de; - dns_cache_addr_preference = ipv6_options.addr_preference; -#if defined(HAVE__HEAPMIN) - _heapmin(); -#endif - init_list(list); - while (!list_empty(dns_cache)) { - de = list_struct(dns_cache.prev, struct dnsentry); - del_from_list(de); - add_to_list(list, de); - } - while (1) { - while ((de = mem_alloc_mayfail(s))) { - de->absolute_time = get_absolute_time(); - memset(&de->addr, 0, sizeof de->addr); - de->name[0] = 0; - add_to_list(list, de); - } - if (s == sizeof(struct dnsentry)) break; - s = s / 2; - if (s < sizeof(struct dnsentry)) s = sizeof(struct dnsentry); - } - while (!list_empty(list)) { - de = list_struct(list.prev, struct dnsentry); - del_from_list(de); - add_to_list(dns_cache, de); - } -} - -#endif - void init_dns(void) { register_cache_upcall(shrink_dns_cache, 0, cast_uchar "dns"); -#ifdef FLOOD_MEMORY - flood_memory(); -#endif #ifdef SUPPORT_IPV6 { int h, rs; diff --git a/fn_impl.c b/fn_impl.c @@ -1,379 +0,0 @@ -#include "links.h" - -#ifndef HAVE_SNPRINTF - -#define B_SZ 65536 - -static char snprtintf_buffer[B_SZ]; - -int my_snprintf(char *str, int n, char *f, ...) -{ - int i; - va_list l; - if (!n) return -1; - va_start(l, f); -#ifdef HAVE_VPRINTF - vsprintf(snprtintf_buffer, f, l); -#elif defined(HAVE_DOPRNT) - { - struct _iobuf strbuf; - strbuf._flag = _IOWRT+_IOSTRG; - strbuf._ptr = snprtintf_buffer; - strbuf._cnt = 32767; - _doprnt(f, l, &strbuf); - putc('\0', &strbuf); - } -#else - fatal_exit("No vsprintf!"); -#endif - va_end(l); - i = strlen(snprtintf_buffer); - if (i >= B_SZ) { - fatal_exit("String size too large!"); - } - if (i >= n) { - memcpy(str, snprtintf_buffer, n); - str[n - 1] = 0; - return -1; - } - strcpy(str, snprtintf_buffer); - return i; -} - -#endif - -#ifndef HAVE_RAISE -int raise(int s) -{ -#ifdef HAVE_GETPID - pid_t p; - EINTRLOOP(p, getpid()); - if (p == -1) return -1; - return kill(p, s); -#else - return 0; -#endif -}; -#endif -#ifndef HAVE_GETTIMEOFDAY -int gettimeofday(struct timeval *tv, struct timezone *tz) -{ - time_t t; - errno = 0; - EINTRLOOPX(t, time(NULL), (time_t)-1); - if (tv) tv->tv_sec = t, tv->tv_usec = 0; - if (tz) tz->tz_minuteswest = tz->tz_dsttime = 0; - return 0; -} -#endif -#ifndef HAVE_GETCWD -char *getcwd(char *buf, size_t size) -{ -#ifndef MAXPATHLEN -#define MAXPATHLEN 1024 -#endif - static char cwd[MAXPATHLEN]; - if (!getwd(cwd)) - return NULL; - if (strlen(cwd) >= size) { - errno = ERANGE; - return NULL; - } - strcpy(buf, cwd); - return 0; -} -#endif -#ifndef HAVE_TEMPNAM -char *tempnam(const char *dir, const char *pfx) -{ - static int counter = 0; - unsigned char *d, *s, *a; - int l; - if (!(d = cast_uchar getenv("TMPDIR"))) { - if (dir) d = cast_uchar dir; - else if (!(d = cast_uchar getenv("TMP")) && !(d = cast_uchar getenv("TEMP"))) { -#ifdef P_tmpdir - d = cast_uchar(P_tmpdir); -#else - d = cast_uchar "/tmp"; -#endif - } - } - l = 0; - s = init_str(); - add_to_str(&s, &l, d); - if (s[0] && s[strlen(cast_const_char s) - 1] != '/') add_chr_to_str(&s, &l, '/'); - add_to_str(&s, &l, cast_uchar pfx); - add_num_to_str(&s, &l, counter++); - a = cast_uchar strdup(cast_const_char s); - mem_free(s); - return cast_char a; -} -#endif -#ifndef HAVE_STRDUP -char *strdup(const char *s) -{ - char *a = malloc(strlen(s) + 1); - if (!a) return NULL; - return strcpy(a, s); -} -#endif -#ifndef HAVE_STRTOL -long strtol(const char *nptr, char **endptr, int base) -{ - unsigned long result; - char negative = 0; - if (*nptr == '-') { - negative = 1; - nptr++; - } - result = 0; - while (1) { - char c = *nptr; - char val; - unsigned long nr; - if (c >= '0' && c <= '9') val = c - '0'; - else if (c >= 'A' && c <= 'Z') val = c - 'A' + 10; - else if (c >= 'a' && c <= 'z') val = c - 'a' + 10; - else break; - if (val >= base) break; - nr = result * base + val; - if ((long)nr < val || (nr - val) / base != result) break; - result = nr; - nptr++; - } - if (endptr) *endptr = (char *)nptr; - if (negative) return -result; - return result; -} -#endif -#ifndef HAVE_STRTOUL -unsigned long strtoul(const char *nptr, char **endptr, int base) -{ - if (*nptr == '-') { - if (endptr) *endptr = nptr; - return 0; - } - return (unsigned long)strtol(nptr,endptr,base); -}; -#endif -#ifndef HAVE_STRTOD -double strtod(const char *nptr, char **endptr) -{ - double d = 0; - char dummy; - if (endptr) *endptr = (char *)nptr; - if (sscanf(nptr, "%lf%c", &d, &dummy) == 1) { - if (endptr) *endptr = strchr(nptr, 0); - } - return d; -} -#endif -#ifndef HAVE_STRLEN -size_t strlen(const char *s) -{ - size_t len = 0; - while (s[len]) len++; - return len; -} -#endif -#ifndef HAVE_STRCPY -char *strcpy(char *dst, const char *src) -{ - return memcpy(dst, src, strlen(src) + 1); -} -#endif -#ifndef HAVE_STRNCPY -char *strncpy(char *dst, const char *src, size_t len) -{ - size_t sl = strlen(src); - if (sl >= len) { - memcpy(dst, src, len); - } else { - memcpy(dst, src, sl); - memset(dst + sl, 0, len - sl); - } - return dst; -} -#endif -#ifndef HAVE_STRCHR -char *strchr(const char *s, int c) -{ - do { - if (*s == (char)c) - return (char *)s; - } while (*s++); - return NULL; -} -#endif -#ifndef HAVE_STRRCHR -char *strrchr(const char *s, int c) -{ - char *ret = NULL; - do { - if (*s == (char)c) - ret = (char *)s; - } while (*s++); - return ret; -} -#endif -#ifndef HAVE_STRCMP -int strcmp(const char *s1, const char *s2) -{ - while (1) { - unsigned char c1 = (unsigned char)*s1; - unsigned char c2 = (unsigned char)*s2; - if (c1 != c2) { - return (int)c1 - (int)c2; - } - if (!c1) break; - s1++, s2++; - } - return 0; -} -#endif -#ifndef HAVE_STRNCMP -int strncmp(const char *s1, const char *s2, size_t n) -{ - while (n--) { - unsigned char c1 = (unsigned char)*s1; - unsigned char c2 = (unsigned char)*s2; - if (c1 != c2) { - return (int)c1 - (int)c2; - } - if (!c1) break; - s1++, s2++; - } - return 0; -} -#endif -#ifndef HAVE_STRCSPN -size_t strcspn(const char *s, const char *reject) -{ - size_t r; - for (r = 0; *s; r++, s++) { - const char *rj; - for (rj = reject; *rj; rj++) if (*s == *rj) goto brk; - } - brk: - return r; -} -#endif -#ifndef HAVE_STRSPN -size_t strspn(const char *s, const char *accept) -{ - size_t r; - for (r = 0; *s; r++, s++) { - const char *rj; - for (rj = accept; *rj; rj++) if (*s == *rj) goto ac; - break; - ac:; - } - return r; -} -#endif -#ifndef HAVE_STRSTR -char *strstr(const char *haystack, const char *needle) -{ - size_t hs = strlen(haystack); - size_t ns = strlen(needle); - if (!ns) return (char *)haystack; - while (hs >= ns) { - if (*haystack == *needle && !memcmp(haystack, needle, ns)) return (char *)haystack; - haystack++, hs--; - } - return NULL; -} -#endif -#ifndef HAVE_MEMCHR -void *memchr(const void *s, int c, size_t length) -{ - const char *sp = s; - while (length--) { - if (*sp == (char)c) - return (char *)s; - sp++; - } - return NULL; -} -#endif -#ifndef HAVE_MEMCMP -int memcmp(const void *src0, const void *src1, size_t length) -{ - const unsigned char *s0, *s1; -#ifdef HAVE_BCMP - if (!bcmp(src0, src1, length)) - return 0; -#endif - s0 = src0; - s1 = src1; - while (length--) { - int c = *s0 - *s1; - if (c) return c; - s0++, s1++; - } - return 0; -} -#endif -#ifndef HAVE_MEMCPY -void *memcpy(void *dst0, const void *src0, size_t length) -{ - return memmove(dst0, src0, length); -} -#endif -#ifndef HAVE_MEMMOVE -void *memmove(void *dst0, const void *src0, size_t length) -{ -#ifdef HAVE_BCOPY - bcopy(src0, dst0, length); - return dst0; -#else - unsigned char *dst = dst0; - const unsigned char *src = src0; - - if ((const unsigned char *)dst == src || !length) - return dst0; - - if ((const unsigned char *)dst <= src) { - while (length--) *dst++ = *src++; - } else { - dst += length - 1; - src += length - 1; - while (length--) *dst-- = *src--; - } - return dst0; -#endif -} -#endif -#ifndef HAVE_MEMSET -void *memset(void *s, int c, size_t n) -{ - char *sc = s; -#ifdef HAVE_BZERO - if (!c) bzero(s, n); - else -#endif - while (n--) *sc++ = c; - return s; -} -#endif -#ifndef HAVE_MEMMEM -void *memmem(const void *haystack, size_t hs, const void *needle, size_t ns) -{ - if (!ns) return (void *)haystack; - while (hs >= ns) { - if (*(const char *)haystack == *(const char *)needle && !memcmp(haystack, needle, ns)) return (void *)haystack; - haystack = (const void *)((const char *)haystack + 1), hs--; - } - return NULL; -} -#endif -#ifndef HAVE_STRERROR -extern char *sys_errlist[]; -extern int sys_nerr; -char *strerror(int errnum) -{ - if (errnum < 0 || errnum >= sys_nerr) return "Unknown error"; - return sys_errlist[errnum]; -}; -#endif diff --git a/http.c b/http.c @@ -525,35 +525,6 @@ static void add_accept_encoding(unsigned char **hdr, int *l, unsigned char *url, if (*l != l1) add_to_str(hdr, l, cast_uchar ", "); add_to_str(hdr, l, cast_uchar "gzip, deflate"); #endif -#if defined(HAVE_BROTLI) - if ((!SCRUB_HEADERS -#ifdef HAVE_SSL - || c->ssl -#endif - ) && !(info->bl_flags & BL_NO_BZIP2)) { - if (*l != l1) add_to_str(hdr, l, cast_uchar ", "); - add_to_str(hdr, l, cast_uchar "br"); - } -#endif -#if defined(HAVE_BZIP2) - if (!SCRUB_HEADERS && !(info->bl_flags & BL_NO_BZIP2)) { - if (*l != l1) add_to_str(hdr, l, cast_uchar ", "); - add_to_str(hdr, l, cast_uchar "bzip2"); - } -#endif - /* LZMA on DOS often fails with out of memory, don't announce it */ -#if defined(HAVE_LZMA) && !defined(DOS) - if (!SCRUB_HEADERS && !(info->bl_flags & BL_NO_BZIP2)) { - if (*l != l1) add_to_str(hdr, l, cast_uchar ", "); - add_to_str(hdr, l, cast_uchar "lzma, lzma2"); - } -#endif -#if defined(HAVE_LZIP) - if (!SCRUB_HEADERS && !(info->bl_flags & BL_NO_BZIP2)) { - if (*l != l1) add_to_str(hdr, l, cast_uchar ", "); - add_to_str(hdr, l, cast_uchar "lzip"); - } -#endif if (*l != l1) add_to_str(hdr, l, cast_uchar "\r\n"); else *l = orig_l; } diff --git a/https.c b/https.c @@ -29,12 +29,7 @@ #define LINKS_CRT_FILE links.crt #endif -#ifdef HAVE_BUILTIN_SSL_CERTIFICATES -#include "certs.inc" -#define N_SSL_CONTEXTS 2 -#else #define N_SSL_CONTEXTS 1 -#endif static int ssl_initialized = 0; static SSL_CTX *contexts[N_SSL_CONTEXTS]; @@ -94,107 +89,6 @@ static void free_hook(void *ptr file_line_arg) #define ssl_set_private_paths(c) (-1) -#ifdef HAVE_BUILTIN_SSL_CERTIFICATES -static void ssl_load_private_certificates(SSL_CTX *ctx) -{ - int i; - int errs = 0; - int succeeded = 0; - int total_certificates = (int)array_elements(certificates); - X509_STORE *store = SSL_CTX_get_cert_store(ctx); - if (!store) - errs |= 1; - else for (i = 0; i < total_certificates; i++) { - BIO *bio; - X509 *cert; - unsigned char *data = cast_uchar certificates[i].data; - int len = certificates[i].len; - unsigned char *b64; - if (data[len]) - internal("invalid builtin certificate %u", i); -#if 1 - b64 = base64_encode(data, len, cast_uchar "-----BEGIN CERTIFICATE-----\n", cast_uchar "-----END CERTIFICATE-----", 6); - bio = BIO_new_mem_buf(b64, (int)strlen(cast_const_char b64)); -#else - { - static_const unsigned char base64_chars[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - int l, x; - int col = 0; - b64 = init_str(); - l = 0; - add_to_str(&b64, &l, cast_uchar "-----BEGIN CERTIFICATE-----\n"); - for (x = 0; x < len; x += 3) { - unsigned char out[4]; - out[0] = base64_chars[data[x] >> 2]; - out[1] = base64_chars[((data[x] << 4) & 63) | (data[x + 1] >> 4)]; - if (x + 1 < len) - out[2] = base64_chars[((data[x + 1] << 2) & 63) | (data[x + 2] >> 6)]; - else - out[2] = '='; - if (x + 2 < len) - out[3] = base64_chars[data[x + 2] & 63]; - else - out[3] = '='; - add_bytes_to_str(&b64, &l, out, 4); - if (!((col += 4) & 63)) - add_chr_to_str(&b64, &l, '\n'); - } - if (b64[l - 1] != '\n') - add_chr_to_str(&b64, &l, '\n'); - add_to_str(&b64, &l, cast_uchar "-----END CERTIFICATE-----"); - bio = BIO_new_mem_buf(b64, l); - } -#endif - /*fprintf(stderr, "%s\n", b64);*/ - if (!bio) { - errs |= 2; - mem_free(b64); - continue; - } - cert = PEM_read_bio_X509(bio, NULL, 0, NULL); - if (cert) { - if (!X509_STORE_add_cert(store, cert)) { - errs |= 8; - } else { - succeeded++; - } - X509_free(cert); - } else { - errs |= 4; - } - mem_free(b64); - BIO_free(bio); - clear_ssl_errors(__LINE__); - } - if (errs) { - static_const char * const err_strings[4] = { "SSL_CTX_get_cert_store", "BIO_new_mem_buf", "PEM_read_bio_X509", "X509_STORE_add_cert" }; - struct session *ses; - unsigned char *err_str = init_str(); - int err_strl = 0; - unsigned char *numfail_str = init_str(); - int numfail_strl = 0; - int e; - ses = get_download_ses(NULL); - for (e = 0; e < 4; e++) { - if (errs & (1 << e)) { - if (err_strl) add_to_str(&err_str, &err_strl, cast_uchar ", "); - add_to_str(&err_str, &err_strl, cast_uchar err_strings[e]); - } - } - add_num_to_str(&numfail_str, &numfail_strl, total_certificates - succeeded); - add_chr_to_str(&numfail_str, &numfail_strl, '/'); - add_num_to_str(&numfail_str, &numfail_strl, total_certificates); - if (!ses) { - error("error initializing built-in certificates: %s, failed %s", err_str, numfail_str); - mem_free(err_str); - mem_free(numfail_str); - } else { - msg_box(ses->term, getml(err_str, numfail_str, NULL), TEXT_(T_SSL_ERROR), AL_CENTER, TEXT_(T_ERROR_INITIALIZING_BUILT_IN_CERTIFICATES), ": ", err_str, ", ", TEXT_(T_FAILED), " ", numfail_str, MSG_BOX_END, NULL, 1, TEXT_(T_CANCEL), msg_box_null, B_ENTER | B_ESC); - } - } -} -#endif - int ssl_asked_for_password; static int ssl_password_callback(char *buf, int size, int rwflag, void *userdata) @@ -216,7 +110,7 @@ links_ssl *getSSL(void) CRYPTO_set_mem_functions(malloc_hook, realloc_hook, free_hook); #endif -#if defined(HAVE_RAND_EGD) && defined(HAVE_RAND_FILE_NAME) && defined(HAVE_RAND_LOAD_FILE) && defined(HAVE_RAND_WRITE_FILE) +#if defined(HAVE_RAND_EGD) { unsigned char f_randfile[PATH_MAX]; const unsigned char *f = (const unsigned char *)RAND_file_name(cast_char f_randfile, sizeof(f_randfile)); @@ -228,7 +122,6 @@ links_ssl *getSSL(void) } #endif -#if defined(HAVE_RAND_ADD) { unsigned char *os_pool; int os_pool_size; @@ -236,7 +129,6 @@ links_ssl *getSSL(void) if (os_pool_size) RAND_add(os_pool, os_pool_size, os_pool_size); mem_free(os_pool); } -#endif #if defined(HAVE_OPENSSL_INIT_SSL) OPENSSL_init_ssl(0, NULL); @@ -249,10 +141,6 @@ links_ssl *getSSL(void) } idx = 0; -#ifdef HAVE_BUILTIN_SSL_CERTIFICATES - if (ssl_options.built_in_certificates || proxies.only_proxies) - idx = 1; -#endif if (!contexts[idx]) { SSL_CTX *ctx; const SSL_METHOD *m; @@ -283,9 +171,6 @@ links_ssl *getSSL(void) if (ssl_set_private_paths(ctx)) SSL_CTX_set_default_verify_paths(ctx); } else { -#ifdef HAVE_BUILTIN_SSL_CERTIFICATES - ssl_load_private_certificates(ctx); -#endif } SSL_CTX_set_default_passwd_cb(ctx, ssl_password_callback); } diff --git a/jsint.c b/jsint.c @@ -1,50 +0,0 @@ -/* jsint.c - * (c) 2002 Mikulas Patocka (Vrxni Ideolog), Petr 'Brain' Kulhavy - * This file is a part of the Links program, relased under GPL. - */ - -/* - * Ve vsech upcallech plati, ze pokud dostanu ID nejakeho objektu, tak - * javascript ma k tomu objektu pristupova prava. Jinymi slovy pristupova prava - * se testuji v upcallech jen, aby se neco neproneslo vratnici ven. Dovnitr se - * muze donaset vsechno, co si javascript donese, na to ma prava. - * - * Navic vsechny upcally dostanou pointer na f_data_c, kde bezi javascript, - * takze se bude moci testovat, zda javascript nesaha na f_data_c, ke kteremu - * nema pristupova prava. - * - * Brain - */ - -/* Uctovani pameti: - * js_mem_alloc/js_mem_free se bude pouzivat na struktury fax_me_tender - * dale se bude pouzivat take ve funkcich pro praci s cookies, protoze string - * cookies v javascript_context se tez alokuje pomoci js_mem_alloc/js_mem_free. - */ - -/* - Retezce: - - vsechny retezce v ramci javascriptu jsou predavany v kodovani f_data->cp - (tedy tak, jak prisly v dokumentu ze site) - */ - - -#include "links.h" - -void jsint_execute_code(struct f_data_c *fd, unsigned char *code, int len, int write_pos, int onclick_submit, int onsubmit, struct links_event *ev) -{ -} - -void jsint_destroy(struct f_data_c *fd) -{ -} - -void jsint_scan_script_tags(struct f_data_c *fd) -{ -} - -int jsint_get_source(struct f_data_c *fd, unsigned char **start, unsigned char **end) -{ - return 0; -} diff --git a/kbd.c b/kbd.c @@ -173,20 +173,10 @@ static void resize_terminal(void) static void os_cfmakeraw(struct termios *t) { -#ifdef HAVE_CFMAKERAW cfmakeraw(t); #ifdef VMIN t->c_cc[VMIN] = 1; #endif -#else - t->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); - t->c_oflag &= ~OPOST; - t->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); - t->c_cflag &= ~(CSIZE|PARENB); - t->c_cflag |= CS8; - t->c_cc[VMIN] = 1; - t->c_cc[VTIME] = 0; -#endif #if defined(NO_CTRL_Z) && defined(VSUSP) t->c_cc[VSUSP] = 0; #endif @@ -1296,59 +1286,3 @@ static void in_kbd(void *itrm_) while (process_queue(itrm)) ; } - -#ifdef GRDRV_VIRTUAL_DEVICES - -int kbd_set_raw; - -void svgalib_free_trm(struct itrm *itrm) -{ - /*debug("svgalib_free: %p", itrm);*/ - if (!itrm) return; - if (kbd_set_raw) setcooked(itrm->ctl_in); - set_handlers(itrm->std_in, NULL, NULL, NULL); - unregister_bottom_half(itrm_error, itrm); - if (itrm->tm != NULL) kill_timer(itrm->tm); - mem_free(itrm); - if (itrm == ditrm) ditrm = NULL; -} - -struct itrm *handle_svgalib_keyboard(void (*queue_event)(struct itrm *, unsigned char *, int)) -{ - struct itrm *itrm; - itrm = mem_calloc(sizeof(struct itrm)); - ditrm = itrm; - itrm->queue_event = queue_event; - itrm->free_trm = svgalib_free_trm; - itrm->std_in = 0; - itrm->ctl_in = 0; - itrm->tm = NULL; - if (kbd_set_raw) setraw(itrm->ctl_in, 1); - set_handlers(itrm->std_in, in_kbd, NULL, itrm); - /*debug("svgalib_handle: %p", itrm);*/ - return itrm; -} - -int svgalib_unblock_itrm(struct itrm *itrm) -{ - /*debug("svgalib_unblock: %p", itrm);*/ - if (!itrm) return -1; - if (kbd_set_raw) if (setraw(itrm->ctl_in, 0)) return -1; - itrm->blocked = 0; - set_handlers(itrm->std_in, in_kbd, NULL, itrm); - unblock_stdin(); - return 0; -} - -void svgalib_block_itrm(struct itrm *itrm) -{ - /*debug("svgalib_block: %p", itrm);*/ - if (!itrm) return; - itrm->blocked = 1; - block_stdin(); - if (kbd_set_raw) setcooked(itrm->ctl_in); - set_handlers(itrm->std_in, NULL, NULL, itrm); -} - -#endif - diff --git a/links.h b/links.h @@ -38,7 +38,7 @@ #if defined(__GNUC__) && defined(__GNUC_MINOR__) #if ((__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))) && \ - !(defined(__clang__) || defined(__llvm__) || defined(__ICC) || defined(__OPEN64__) || defined(__PATHSCALE__) || defined(__PGI) || defined(__PGIC__)) && \ + !(defined(__clang__) || defined(__llvm__) || defined(__OPEN64__) || defined(__PATHSCALE__) || defined(__PGI) || defined(__PGIC__)) && \ defined(__OPTIMIZE__) && !defined(__OPTIMIZE_SIZE__) && \ !(defined(__arm__) && defined(__thumb__) && !defined(__thumb2__)) /* avoid gcc bug */ #pragma GCC optimize ("-ftree-vectorize", "-ffast-math") @@ -81,20 +81,8 @@ #define X_S #define _XOPEN_SOURCE 5 /* The 5 is a kludge to get a strptime() prototype in NetBSD */ #endif -#ifdef TIME_WITH_SYS_TIME -#ifdef HAVE_SYS_TIME_H #include <sys/time.h> -#endif -#ifdef HAVE_TIME_H -#include <time.h> -#endif -#else -#if defined(TM_IN_SYS_TIME) && defined(HAVE_SYS_TIME_H) -#include <sys/time.h> -#elif defined(HAVE_TIME_H) #include <time.h> -#endif -#endif #ifdef X_S #undef _XOPEN_SOURCE #endif @@ -112,10 +100,7 @@ #ifdef HAVE_SYS_FILE_H #include <sys/file.h> #endif -#if defined(HAVE_DIRENT_H) || defined(__CYGWIN__) -#if defined(__CYGWIN__) && !defined(NAME_MAX) -#define NAME_MAX 255 -#endif +#if defined(HAVE_DIRENT_H) #include <dirent.h> #elif defined(HAVE_SYS_NDIR_H) #include <sys/ndir.h> @@ -128,18 +113,13 @@ #include <ndir.h> #endif #include <signal.h> -#ifdef HAVE_SYS_WAIT_H #include <sys/wait.h> -#endif #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #endif #ifdef HAVE_SYS_RESOURCE_H #include <sys/resource.h> #endif -#ifdef HAVE_SYS_CYGWIN_H -#include <sys/cygwin.h> -#endif #ifdef HAVE_UWIN_H #include <uwin.h> #endif @@ -149,12 +129,6 @@ #ifdef HAVE_PROCESS_H #include <process.h> #endif -#ifdef HAVE_CYGWIN_PROCESS_H -#include <cygwin/process.h> -#endif -#ifdef HAVE_CYGWIN_VERSION_H -#include <cygwin/version.h> -#endif #ifdef HAVE_UNIXLIB_H #include <unixlib.h> #endif @@ -193,9 +167,7 @@ #ifdef HAVE_ARPA_INET_H #include <arpa/inet.h> #endif -#ifdef HAVE_UTIME_H #include <utime.h> -#endif #if defined(HAVE_CRYPTO_SET_MEM_FUNCTIONS_1) && defined(HAVE_CRYPTO_SET_MEM_FUNCTIONS_2) #undef HAVE_CRYPTO_SET_MEM_FUNCTIONS_1 @@ -263,7 +235,7 @@ #include <poll.h> #endif -#if (defined(HAVE_EVENT_H) || defined(HAVE_EV_EVENT_H)) && (defined(HAVE_LIBEVENT) || defined(HAVE_LIBEV)) && !defined(OPENVMS) && !defined(DOS) +#if (defined(HAVE_EVENT_H) || defined(HAVE_EV_EVENT_H)) && (defined(HAVE_LIBEVENT) || defined(HAVE_LIBEV)) #if defined(HAVE_EVENT_H) #include <event.h> #else @@ -272,14 +244,9 @@ #define USE_LIBEVENT #endif -#ifdef HAVE_OPENMP -#include <omp.h> -#define SMP_ALIGN 256 -#else #define omp_get_num_threads() 1 #define omp_get_thread_num() 0 #define SMP_ALIGN 1 -#endif #if (defined(__alpha__) || defined(__alpha)) && !defined(__alpha_bwx__) #define OPENMP_NONATOMIC 1 #else @@ -322,91 +289,6 @@ #define RET_FATAL 4 #define RET_INTERNAL 127 -#ifndef HAVE_SNPRINTF -int my_snprintf(char *, int n, char *format, ...) PRINTF_FORMAT(3, 4); -#define snprintf my_snprintf -#endif -#ifndef HAVE_RAISE -int raise(int); -#endif -#ifndef HAVE_GETTIMEOFDAY -struct timeval { - long tv_sec; - long tv_usec; -}; -struct timezone { - int tz_minuteswest; - int tz_dsttime; -}; -int gettimeofday(struct timeval *tv, struct timezone *tz); -#endif -#ifndef HAVE_TEMPNAM -char *tempnam(const char *dir, const char *pfx); -#endif -#ifndef HAVE_STRDUP -char *strdup(const char *s); -#endif -#ifndef HAVE_STRTOL -long strtol(const char *, char **, int); -#endif -#ifndef HAVE_STRTOUL -unsigned long strtoul(const char *, char **, int); -#endif -#ifndef HAVE_STRTOD -double strtod(const char *nptr, char **endptr); -#endif -#ifndef HAVE_STRLEN -size_t strlen(const char *s); -#endif -#ifndef HAVE_STRCPY -char *strcpy(char *dst, const char *src); -#endif -#ifndef HAVE_STRNCPY -char *strncpy(char *dst, const char *src, size_t len); -#endif -#ifndef HAVE_STRCHR -char *strchr(const char *s, int c); -#endif -#ifndef HAVE_STRRCHR -char *strrchr(const char *s, int c); -#endif -#ifndef HAVE_STRCMP -int strcmp(const char *s1, const char *s2); -#endif -#ifndef HAVE_STRNCMP -int strncmp(const char *s1, const char *s2, size_t n); -#endif -#ifndef HAVE_STRCSPN -size_t strcspn(const char *s, const char *reject); -#endif -#ifndef HAVE_STRSPN -size_t strspn(const char *s, const char *accept); -#endif -#ifndef HAVE_STRSTR -char *strstr(const char *haystack, const char *needle); -#endif -#ifndef HAVE_MEMCHR -void *memchr(const void *s, int c, size_t length); -#endif -#ifndef HAVE_MEMCMP -int memcmp(const void *, const void *, size_t); -#endif -#ifndef HAVE_MEMCPY -void *memcpy(void *, const void *, size_t); -#endif -#ifndef HAVE_MEMMOVE -void *memmove(void *, const void *, size_t); -#endif -#ifndef HAVE_MEMSET -void *memset(void *, int, size_t); -#endif -#ifndef HAVE_MEMMEM -void *memmem(const void *haystack, size_t hs, const void *needle, size_t ns); -#endif -#ifndef HAVE_STRERROR -char *strerror(int); -#endif - #define EINTRLOOPX(ret_, call_, x_) \ do { \ (ret_) = (call_); \ @@ -560,12 +442,7 @@ extern unsigned char *errfile; void fatal_tty_exit(void); -#ifdef __ICC -/* ICC OpenMP bug */ -#define overalloc_condition 0 -#else #define overalloc_condition 1 -#endif #define overalloc_at(f, l) \ do { \ @@ -642,21 +519,9 @@ static inline void *debug_mem_realloc(unsigned char *f, int l, void *p, size_t s static inline void set_mem_comment(void *p, unsigned char *c, int l) {} static inline unsigned char *get_mem_comment(void *p){return (unsigned char *)"";} -#if !(defined(LEAK_DEBUG) && defined(LEAK_DEBUG_LIST)) - unsigned char *memacpy(const unsigned char *src, size_t len); unsigned char *stracpy(const unsigned char *src); -#else - -unsigned char *debug_memacpy(unsigned char *f, int l, const unsigned char *src, size_t len); -#define memacpy(s, l) debug_memacpy((unsigned char *)__FILE__, __LINE__, s, l) - -unsigned char *debug_stracpy(unsigned char *f, int l, const unsigned char *src); -#define stracpy(s) debug_stracpy((unsigned char *)__FILE__, __LINE__, s) - -#endif - #define pr(code) if (1) {code;} else static inline void nopr(void) {} static inline void xpr(void) {} @@ -767,11 +632,7 @@ void add_unsigned_long_num_to_str(unsigned char **s, int *l, my_uintptr_t n); void add_num_to_str(unsigned char **s, int *l, off_t n); void add_knum_to_str(unsigned char **s, int *l, off_t n); long strtolx(unsigned char *c, unsigned char **end); -#if defined(HAVE_STRTOLL) || defined(HAVE_STRTOQ) || defined(HAVE_STRTOIMAX) #define my_strtoll_t longlong -#else -#define my_strtoll_t long -#endif my_strtoll_t my_strtoll(unsigned char *string, unsigned char **end); void safe_strncpy(unsigned char *dst, const unsigned char *src, size_t dst_size); @@ -824,18 +685,7 @@ typedef unsigned long tcount; #define USE_GPM #endif -#if defined(OS2) && defined(HAVE_UMALLOC_H) && defined(HAVE__UCREATE) && defined(HAVE__UOPEN) && defined(HAVE__UDEFAULT) && defined(HAVE_BEGINTHREAD) -#define OS2_ADVANCED_HEAP -#define MEMORY_REQUESTED -extern unsigned long mem_requested; -extern unsigned long blocks_requested; -#endif - -#ifdef OS2_ADVANCED_HEAP -void mem_freed_large(size_t size); -#else #define mem_freed_large(x) do { } while (0) -#endif struct terminal; @@ -1005,13 +855,8 @@ void interruptible_signal(int sig, int in); void block_signals(int except1, int except2); void unblock_signals(void); void set_sigcld(void); -#ifdef HAVE_OPENMP -int omp_start(void); -void omp_end(void); -#else #define omp_start() 1 #define omp_end() do { } while (0) -#endif /* dns.c */ @@ -2243,12 +2088,6 @@ void set_language(void); /* Used in error.c */ #define dos_poll_break() do { } while (0) -/* af_unix.c */ - -extern int s_unix_fd; -int bind_to_af_unix(unsigned char *name); -void af_unix_close(void); - /* main.c */ extern int terminal_pipe[2]; @@ -2315,7 +2154,7 @@ void detach_object_connection(struct object_request *, off_t); /* compress.c */ -#if defined(HAVE_ZLIB) || defined(HAVE_BROTLI) || defined(HAVE_BZIP2) || defined(HAVE_LZMA) || defined(HAVE_LZIP) +#if defined(HAVE_ZLIB) #define HAVE_ANY_COMPRESSION #endif @@ -3188,13 +3027,6 @@ unsigned char *get_current_title(struct f_data_c *, unsigned char *, size_t); /*unsigned char *get_current_link_url(struct session *, unsigned char *, size_t);*/ unsigned char *get_form_url(struct session *ses, struct f_data_c *f, struct form_control *form, int *onsubmit); -/* jsint.c */ - -void jsint_execute_code(struct f_data_c *, unsigned char *, int, int, int, int, struct links_event *); -void jsint_destroy(struct f_data_c *); -void jsint_scan_script_tags(struct f_data_c *); -int jsint_get_source(struct f_data_c *, unsigned char **, unsigned char **); - /* bfu.c */ extern struct style *bfu_style_wb, *bfu_style_bw, *bfu_style_wb_b, *bfu_style_bw_u, *bfu_style_bw_mono, *bfu_style_wb_mono, *bfu_style_wb_mono_u; diff --git a/main.c b/main.c @@ -331,7 +331,6 @@ static void fixup_g(void) static void init(void) { - int uh; void *info; int len; unsigned char *u; @@ -350,19 +349,6 @@ static void init(void) if (!dmp && !ggr) { init_os_terminal(); } - if (!ggr && !no_connect && (uh = bind_to_af_unix(NULL)) != -1) { - close_socket(&terminal_pipe[0]); - close_socket(&terminal_pipe[1]); - info = create_session_info(base_session, u, default_target, &len); - initialize_all_subsystems_2(); - handle_trm(get_input_handle(), get_output_handle(), uh, uh, get_ctl_handle(), info, len); - handle_basic_signals(NULL); /* OK, this is race condition, but it must be so; GPM installs it's own buggy TSTP handler */ - mem_free(info); -#if defined(HAVE_MALLOC_TRIM) - malloc_trim(8192); -#endif - return; - } if ((dds.assume_cp = get_cp_index(cast_uchar "ISO-8859-1")) == -1) dds.assume_cp = 0; load_config(); if (proxies.only_proxies) @@ -398,57 +384,7 @@ static void init(void) add_to_strn(&n, cast_uchar "-"); add_to_strn(&n, nn); } - uh = bind_to_af_unix(n); mem_free(n); - if (uh != -1) { - unsigned char hold_conn; - unsigned char *w; - int lw; - shutdown_graphics(); - if (os_receive_fg_cookie(uh)) { - retval = RET_ERROR; - goto ttt; - } - w = get_cwd(); - if (!w) w = stracpy(cast_uchar ""); - if (strlen(cast_const_char w) >= MAX_CWD_LEN) - w[MAX_CWD_LEN - 1] = 0; - lw = (int)strlen(cast_const_char w) + 1; - if (hard_write(uh, w, lw) != lw) { - mem_free(w); - retval = RET_ERROR; - goto ttt; - } - mem_free(w); - w = mem_calloc(MAX_CWD_LEN - lw); - if (hard_write(uh, w, MAX_CWD_LEN - lw) != MAX_CWD_LEN - lw) { - mem_free(w); - retval = RET_ERROR; - goto ttt; - } - mem_free(w); - hold_conn = *u != 0; - if (hard_write(uh, &hold_conn, 1) != 1) { - retval = RET_ERROR; - goto ttt; - } - info = create_session_info(base_session, u, default_target, &len); - if (hard_write(uh, (unsigned char *)&len, sizeof len) != sizeof len) { - mem_free(info); - retval = RET_ERROR; - goto ttt; - } - if (hard_write(uh, info, len) != len) { - mem_free(info); - retval = RET_ERROR; - goto ttt; - } - mem_free(info); - set_handlers(uh, gfx_connection_terminate, NULL, (void *)(my_intptr_t)uh); - initialize_all_subsystems_2(); - heap_trim(); - return; - } } spawn_font_thread(); init_dither(drv->depth); @@ -555,7 +491,6 @@ static void terminate_all_subsystems(void) shutdown_trans(); GF(free_dither()); GF(shutdown_graphics()); - af_unix_close(); os_free_clipboard(); if (fg_poll_timer != NULL) kill_timer(fg_poll_timer), fg_poll_timer = NULL; terminate_select(); diff --git a/menu.c b/menu.c @@ -18,12 +18,9 @@ static unsigned char * const version_texts[] = { TEXT_(T_COMPRESSION_METHODS), TEXT_(T_ENCRYPTION), TEXT_(T_UTF8_TERMINAL), -#if defined(__linux__) || defined(__LINUX__) || defined(__SPAD__) || defined(USE_GPM) +#if defined(__linux__) || defined(__LINUX__) TEXT_(T_GPM_MOUSE_DRIVER), #endif -#ifdef OS2 - TEXT_(T_XTERM_FOR_OS2), -#endif TEXT_(T_GRAPHICS_MODE), #ifdef G TEXT_(T_IMAGE_LIBRARIES), @@ -135,23 +132,9 @@ static void menu_version(void *term_) add_to_str(&s, &l, get_text_translation(TEXT_(T_YES), term)); add_to_str(&s, &l, cast_uchar "\n"); -#if defined(__linux__) || defined(__LINUX__) || defined(__SPAD__) || defined(USE_GPM) - add_and_pad(&s, &l, term, *text_ptr++, maxlen); -#ifdef USE_GPM - add_gpm_version(&s, &l); -#else - add_to_str(&s, &l, get_text_translation(TEXT_(T_NO), term)); -#endif - add_to_str(&s, &l, cast_uchar "\n"); -#endif - -#ifdef OS2 +#if defined(__linux__) || defined(__LINUX__) add_and_pad(&s, &l, term, *text_ptr++, maxlen); -#ifdef X2 - add_to_str(&s, &l, get_text_translation(TEXT_(T_YES), term)); -#else add_to_str(&s, &l, get_text_translation(TEXT_(T_NO), term)); -#endif add_to_str(&s, &l, cast_uchar "\n"); #endif @@ -177,23 +160,7 @@ static void menu_version(void *term_) #ifdef G add_and_pad(&s, &l, term, *text_ptr++, maxlen); -#ifndef HAVE_OPENMP add_to_str(&s, &l, get_text_translation(TEXT_(T_NO), term)); -#else - if (!F) { - add_to_str(&s, &l, get_text_translation(TEXT_(T_NOT_USED_IN_TEXT_MODE), term)); - } else if (disable_openmp) { - add_to_str(&s, &l, get_text_translation(TEXT_(T_DISABLED), term)); - } else { - int thr = omp_start(); - omp_end(); - add_num_to_str(&s, &l, thr); - add_to_str(&s, &l, cast_uchar " "); - if (thr == 1) add_to_str(&s, &l, get_text_translation(TEXT_(T_THREAD), term)); - else if (thr >= 2 && thr <= 4) add_to_str(&s, &l, get_text_translation(TEXT_(T_THREADS), term)); - else add_to_str(&s, &l, get_text_translation(TEXT_(T_THREADS5), term)); - } -#endif add_to_str(&s, &l, cast_uchar "\n"); #endif @@ -603,78 +570,8 @@ static void downloads_menu(struct terminal *term, void *ddd, void *ses_) else do_menu(term, mi, ses); } -#ifndef GRDRV_VIRTUAL_DEVICES - #define have_windows_menu 0 -#else - -#define have_windows_menu (F && drv->init_device == init_virtual_device) - -static void window_switch(struct terminal *term, void *nump, void *ses) -{ - int n = (int)(my_intptr_t)nump; - switch_virtual_device(n); -} - -static void windows_menu(struct terminal *term, void *xxx, void *ses_) -{ - struct session *ses = (struct session *)ses_; - struct menu_item *mi = new_menu(15); - int i; - int selected = 0; - int pos = 0; - int have_free_slot = 0; - int o; - for (i = 0; i < n_virtual_devices; i++) { - if (virtual_devices[i]) { - struct session *xs; - struct list_head *ls; - unsigned char *l = init_str(), *r = init_str(), *h = init_str(); - int ll = 0, rr = 0, hh = 0; - add_num_to_str(&l, &ll, i + 1); - add_to_str(&l, &ll, cast_uchar "."); - foreach(struct session, xs, ls, sessions) if ((void *)xs->term == virtual_devices[i]->user_data) { - if (xs->screen && xs->screen->f_data && xs->screen->f_data->title) { - add_chr_to_str(&l, &ll, ' '); - if (xs->screen->f_data->title[0]) { - add_to_str(&l, &ll, xs->screen->f_data->title); - } else if (xs->screen->rq && xs->screen->rq->url) { - unsigned char *url = display_url(term, xs->screen->rq->url, 1); - add_to_str(&l, &ll, url); - mem_free(url); - } - } - break; - } - if (n_virtual_devices > 10) { - add_to_str(&r, &rr, cast_uchar "Alt-F"); - add_num_to_str(&r, &rr, i + 1); - } else { - add_to_str(&r, &rr, cast_uchar "Alt-"); - add_chr_to_str(&r, &rr, (i + 1) % 10 + '0'); - } - if (i < 10) { - add_chr_to_str(&h, &hh, (i + 1) % 10 + '0'); - } - if (current_virtual_device == virtual_devices[i]) - selected = pos; - add_to_menu(&mi, l, r, h, window_switch, (void *)(my_intptr_t)i, 0, pos++); - } else { - have_free_slot = 1; - } - } - if ((o = can_open_in_new(term)) && have_free_slot) { - add_to_menu(&mi, cast_uchar "", cast_uchar "", M_BAR, NULL, NULL, 0, pos++); - mi[pos - 1].free_i = 1; - add_to_menu(&mi, TEXT_(T_NEW_WINDOW), cast_uchar "", TEXT_(T_HK_NEW_WINDOW), open_in_new_window, (void *)&send_open_new_xterm_ptr, o - 1, pos++); - mi[pos - 1].free_i = 1; - } - do_menu_selected(term, mi, ses, selected, NULL, NULL); -} - -#endif - static void menu_doc_info(struct terminal *term, void *ddd, void *ses_) { struct session *ses = (struct session *)ses_; @@ -1722,9 +1619,6 @@ static unsigned char * const ssl_labels[] = { TEXT_(T_ACCEPT_INVALID_CERTIFICATES), TEXT_(T_WARN_ON_INVALID_CERTIFICATES), TEXT_(T_REJECT_INVALID_CERTIFICATES), -#ifdef HAVE_BUILTIN_SSL_CERTIFICATES - TEXT_(T_USE_BUILT_IN_CERTIFICATES), -#endif TEXT_(T_CLIENT_CERTIFICATE_KEY_FILE), TEXT_(T_CLIENT_CERTIFICATE_FILE), TEXT_(T_CLIENT_CERTIFICATE_KEY_PASSWORD), @@ -1782,9 +1676,6 @@ static void dlg_ssl_options(struct terminal *term, void *xxx, void *yyy) struct dialog *d; int a = 0; const int items = 8 -#ifdef HAVE_BUILTIN_SSL_CERTIFICATES - + 1 -#endif ; d = mem_calloc(sizeof(struct dialog) + items * sizeof(struct dialog_item)); d->title = TEXT_(T_SSL_OPTIONS); @@ -1809,13 +1700,6 @@ static void dlg_ssl_options(struct terminal *term, void *xxx, void *yyy) d->items[a].dlen = sizeof(int); d->items[a].data = (void *)&ssl_options.certificates; a++; -#ifdef HAVE_BUILTIN_SSL_CERTIFICATES - d->items[a].type = D_CHECKBOX; - d->items[a].gid = 0; - d->items[a].dlen = sizeof(int); - d->items[a].data = (void *)&ssl_options.built_in_certificates; - a++; -#endif d->items[a].type = D_FIELD; d->items[a].dlen = MAX_STR_LEN; d->items[a].data = ssl_options.client_cert_key; @@ -3407,26 +3291,6 @@ static_const struct menu_item main_menu[] = { { NULL, NULL, 0, NULL, NULL, 0, 0 } }; -#ifdef G - -#ifdef GRDRV_VIRTUAL_DEVICES - -static_const struct menu_item main_menu_g_windows[] = { - { TEXT_(T_FILE), cast_uchar "", TEXT_(T_HK_FILE), do_file_menu, NULL, 1, 1 }, - { TEXT_(T_VIEW), cast_uchar "", TEXT_(T_HK_VIEW), do_view_menu, NULL, 1, 1 }, - { TEXT_(T_LINK), cast_uchar "", TEXT_(T_HK_LINK), link_menu, NULL, 1, 1 }, - { TEXT_(T_DOWNLOADS), cast_uchar "", TEXT_(T_HK_DOWNLOADS), downloads_menu, NULL, 1, 1 }, - { TEXT_(T_WINDOWS), cast_uchar "", TEXT_(T_HK_WINDOWS), windows_menu, NULL, 1, 1 }, - { TEXT_(T_SETUP), cast_uchar "", TEXT_(T_HK_SETUP), do_setup_menu, NULL, 1, 1 }, - { TEXT_(T_HELP), cast_uchar "", TEXT_(T_HK_HELP), do_help_menu, NULL, 1, 1 }, - { NULL, NULL, 0, NULL, NULL, 0, 0 } -}; - -#endif - -#endif - - /* lame technology rulez ! */ void activate_bfu_technology(struct session *ses, int item) @@ -3436,10 +3300,6 @@ void activate_bfu_technology(struct session *ses, int item) struct menu_item * decc_volatile m = (struct menu_item *)main_menu; #ifdef G struct menu_item * decc_volatile mg = m; -#ifdef GRDRV_VIRTUAL_DEVICES - if (have_windows_menu) - mg = (struct menu_item *)main_menu_g_windows; -#endif #endif do_mainmenu(term, gf_val(m, mg), ses, item); } diff --git a/os_dep.c b/os_dep.c @@ -135,7 +135,7 @@ uttime get_absolute_time(void) uttime get_time(void) { -#if defined(HAVE_CLOCK_GETTIME) && defined(TIME_WITH_SYS_TIME) && (defined(CLOCK_MONOTONIC_RAW) || defined(CLOCK_MONOTONIC)) +#if defined(CLOCK_MONOTONIC_RAW) || defined(CLOCK_MONOTONIC) struct timespec ts; int rs; #if defined(CLOCK_MONOTONIC_RAW) @@ -422,7 +422,6 @@ void close_fork_tty(void) if (drv && drv->after_fork) drv->after_fork(); #endif if (terminal_pipe[1] != -1) EINTRLOOP(rs, close(terminal_pipe[1])); - if (s_unix_fd != -1) EINTRLOOP(rs, close(s_unix_fd)); foreach(struct terminal, t, lt, terminals) { if (t->fdin > 0) EINTRLOOP(rs, close(t->fdin)); @@ -539,7 +538,7 @@ int resize_window(int x, int y) /* Threads */ -#if (defined(HAVE_BEGINTHREAD) && defined(OS2)) || defined(BEOS) || defined(HAVE_PTHREADS) || defined(HAVE_ATHEOS_THREADS_H) +#if defined(HAVE_PTHREADS) struct tdata { void (*fn)(void *, int); @@ -696,10 +695,8 @@ int start_thread(void (*fn)(void *, int), void *ptr, int l, int counted) #endif -#if !defined(USING_OS2_MOUSE) && !defined(DOS) void want_draw(void) {} void done_draw(void) {} -#endif int get_output_handle(void) { return 1; } @@ -739,13 +736,9 @@ int get_input_handle(void) #endif /* defined(HAVE_BEGINTHREAD) && defined(HAVE__READ_KBD) */ -#if !defined(USING_OS2_MOUSE) && !defined(DOS) - void *handle_mouse(int cons, void (*fn)(void *, unsigned char *, int), void *data) { return NULL; } void unhandle_mouse(void *data) { } -#endif - int get_system_env(void) { return 0; @@ -895,7 +888,7 @@ void os_detach_console(void) { pid_t rp; /* Intel and PathScale handle fork gracefully */ -#if !defined(__ICC) && !defined(__PATHSCALE__) +#if !defined(__PATHSCALE__) disable_openmp = 1; #endif EINTRLOOP(rp, fork()); diff --git a/os_depx.h b/os_depx.h @@ -123,51 +123,18 @@ extern int errno; #define SIG_ERR ((int (*)())-1) #endif -#if !defined(HAVE_STRTOIMAX) && defined(strtoimax) && defined(HAVE___STRTOLL) -#define HAVE_STRTOIMAX 1 -#endif - #ifndef SA_RESTART #define SA_RESTART 0 #endif -#ifdef OS2 -int bounced_read(int fd, void *buf, size_t size); -int bounced_write(int fd, const void *buf, size_t size); -#define read bounced_read -#define write bounced_write -#endif - #ifdef __EMX__ -#ifndef HAVE_GETCWD -#define HAVE_GETCWD 1 -#endif #define getcwd _getcwd2 #define chdir _chdir2 #endif -#ifdef BEOS -#define socket be_socket -#define connect be_connect -#define getpeername be_getpeername -#define getsockname be_getsockname -#define listen be_listen -#define accept be_accept -#define bind be_bind -#define pipe be_pipe -#define read be_read -#define write be_write -#define close be_close -#define select be_select -#define getsockopt be_getsockopt -#ifndef SO_ERROR -#define SO_ERROR 10001 -#endif -#endif - #if defined(O_SIZE) && defined(__EMX__) #define HAVE_OPEN_PREALLOC -#elif (defined(HAVE_FALLOCATE) || defined(HAVE_POSIX_FALLOCATE)) && !defined(OPENVMS) +#elif (defined(HAVE_FALLOCATE) || defined(HAVE_POSIX_FALLOCATE)) #define HAVE_OPEN_PREALLOC #endif @@ -226,7 +193,7 @@ int bounced_write(int fd, const void *buf, size_t size); #define ATTR_NOINLINE #endif -#if defined(HAVE_GETADDRINFO) && defined(HAVE_FREEADDRINFO) && !defined(ATHEOS) +#if defined(HAVE_GETADDRINFO) && defined(HAVE_FREEADDRINFO) #define USE_GETADDRINFO #endif @@ -253,7 +220,7 @@ int bounced_write(int fd, const void *buf, size_t size); #endif #endif -#if defined(__DECC_VER) && !defined(OPENVMS) +#if defined(__DECC_VER) #define static_const static #define decc_volatile volatile #else @@ -267,11 +234,7 @@ int bounced_write(int fd, const void *buf, size_t size); #define highc_volatile #endif -#ifdef __ICC -#define icc_volatile volatile -#else #define icc_volatile -#endif #ifdef __SUNPRO_C #define sun_volatile volatile @@ -281,7 +244,7 @@ int bounced_write(int fd, const void *buf, size_t size); typedef const char *const_char_ptr; -#if defined(BEOS) || (defined(HAVE_BEGINTHREAD) && defined(OS2)) || defined(HAVE_PTHREADS) || (defined(HAVE_ATHEOS_THREADS_H) && defined(HAVE_SPAWN_THREAD) && defined(HAVE_RESUME_THREAD)) +#if defined(HAVE_PTHREADS) #define EXEC_IN_THREADS #endif diff --git a/select.c b/select.c @@ -861,43 +861,6 @@ void set_sigcld(void) } #endif -#ifdef HAVE_OPENMP - -static int num_threads = -1; - -int omp_start(void) -{ - int thr; - if (disable_openmp || num_threads == 1) - return 1; - block_signals(0, 0); - if (num_threads != -1) - return num_threads; - omp_set_dynamic(0); - thr = omp_get_max_threads(); - if (thr > OPENMP_MAX_THREADS) - thr = OPENMP_MAX_THREADS; - omp_set_num_threads(thr); - if (thr > 1) { -#pragma omp parallel shared(thr) -#pragma omp single - thr = omp_get_num_threads(); - omp_set_num_threads(thr); - } - num_threads = thr; - if (thr == 1) - unblock_signals(); - return thr; -} - -void omp_end(void) -{ - if (!disable_openmp || num_threads == 1) - unblock_signals(); -} - -#endif - void reinit_child(void) { #if !defined(NO_SIGNAL_HANDLERS) diff --git a/session.c b/session.c @@ -118,10 +118,6 @@ int get_error_from_errno(int errn) { if (errn > 0 && (errn < -S__OK || errn > -S_MAX)) return -errn; -#ifdef BEOS - if (-errn > 0 && (-errn < -S__OK || -errn > -S_MAX)) - return errn; -#endif return S_UNKNOWN_ERROR; } @@ -138,9 +134,6 @@ unsigned char *get_err_msg(int state) unk: return TEXT_(T_UNKNOWN_ERROR); } -#ifdef BEOS - if ((e = cast_uchar strerror(state)) && *e && !strstr(cast_const_char e, "No Error")) goto have_error; -#endif if ((e = cast_uchar strerror(-state)) && *e) goto have_error; goto unk; have_error: @@ -1281,7 +1274,7 @@ static struct f_data *format_html(struct f_data_c *fd, struct object_request *rq if (fd->af) foreach(struct additional_file, af, laf, fd->af->af) if (af->need_reparse > 0) af->need_reparse = 0; get_file(rq, &start, &end); - if (jsint_get_source(fd, &start, &end)) f->uncacheable = 1; + f->uncacheable = 1; if (opt->plain == 2) { start = init_str(); stl = 0; @@ -1488,7 +1481,7 @@ struct f_data *cached_format_html(struct f_data_c *fd, struct object_request *rq } if (opt->plain == 2) opt->margin = 0, opt->display_images = 1; pr( - if (!jsint_get_source(fd, NULL, NULL) && ses) { + if (ses) { if (fd->f_data && !strcmp(cast_const_char fd->f_data->rq->url, cast_const_char url) && !compare_opt(&fd->f_data->opt, opt) && is_format_cache_entry_uptodate(fd->f_data)) { f = fd->f_data; xpr(); @@ -1818,7 +1811,6 @@ void reinit_f_data_c(struct f_data_c *fd) if (fd == current_frame(fd->ses)) fd->ses->locked_link = 0; #endif - jsint_destroy(fd); foreach(struct f_data_c, fd1, lfd1, fd->subframes) { if (fd->ses->wtd_target_base == fd1) fd->ses->wtd_target_base = NULL; reinit_f_data_c(fd1); @@ -2637,7 +2629,6 @@ void map_selected(struct terminal *term, void *ld_, void *ses_) int x = 0; if (ld->onclick) { struct f_data_c *fd = current_frame(ses); - jsint_execute_code(fd, ld->onclick, (int)strlen(cast_const_char ld->onclick), -1, -1, -1, NULL); x = 1; } if (ld->link) goto_url_f(ses, NULL, ld->link, ld->target, current_frame(ses), -1, x, 0, 0); @@ -2697,7 +2688,6 @@ static void reload_frame(struct f_data_c *fd, int no_cache) fd->done = 0; fd->parsed_done = 0; mem_free(u); - jsint_destroy(fd); } void reload(struct session *ses, int no_cache) diff --git a/string.c b/string.c @@ -159,15 +159,7 @@ my_strtoll_t my_strtoll(unsigned char *string, unsigned char **end) { my_strtoll_t f; errno = 0; -#if defined(HAVE_STRTOLL) f = strtoll(cast_const_char string, (char **)(void *)end, 10); -#elif defined(HAVE_STRTOQ) - f = strtoq(cast_const_char string, (char **)(void *)end, 10); -#elif defined(HAVE_STRTOIMAX) - f = strtoimax(cast_const_char string, (char **)(void *)end, 10); -#else - f = strtol(cast_const_char string, (char **)(void *)end, 10); -#endif if (f < 0 || errno) return -1; return f; } diff --git a/url.c b/url.c @@ -576,9 +576,6 @@ unsigned char *translate_url(unsigned char *url, unsigned char *cwd) } ch = url + strcspn(cast_const_char url, ".:/@"); sl = 0; -#ifdef SPAD - if (strchr(cast_const_char url, ':') && _is_local(cast_const_char url)) goto set_prefix; -#endif if (*ch != ':' || *(url + strcspn(cast_const_char url, "/@")) == '@') { if (*url != '.' && *ch == '.') { unsigned char *e, *f, *g; @@ -694,43 +691,6 @@ void add_conv_str(unsigned char **s, int *l, unsigned char *b, int ll, int encod void convert_file_charset(unsigned char **s, int *l, int start_l) { -#ifdef __CYGWIN__ - int win_charset = windows_charset(); - unsigned char *cpy = stracpy(*s + start_l); - unsigned char *ptr, *end; - (*s)[*l = start_l] = 0; - end = cast_uchar strchr(cast_const_char cpy, 0); - for (ptr = cpy; ptr < end; ptr++) { - unsigned char chr = *ptr; - unsigned u; - unsigned char *p; - if (chr == 0x18) { - p = ptr + 1; - goto try_get_utf; - } - if (chr >= 128) { - if (win_charset != utf8_table) { - u = (unsigned)cp2u(chr, win_charset); - if (u != -1U) - goto put_u; - } else { - p = ptr; -try_get_utf: - GET_UTF_8(p, u); - if (u) { - ptr = p - 1; -put_u: - add_to_str(s, l, cast_uchar "&#"); - add_num_to_str(s, l, (int)u); - add_chr_to_str(s, l, ';'); - continue; - } - } - } - add_chr_to_str(s, l, chr); - } - mem_free(cpy); -#endif } static_const unsigned char xn[] = "xn--";