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

📄 default.c

📁 ELinks is an advanced and well-established feature-rich text mode web (HTTP/FTP/..) browser. ELinks
💻 C
📖 第 1 页 / 共 4 页
字号:
	end:	return NULL;	err_f:	mem_free(w);	err:	return "Error reading terminal specification";}void term_wr(struct option *o, unsigned char **s, int *l){	struct term_spec *ts;	foreachback(ts, term_specs) {		add_nm(o, s, l);		add_quoted_to_str(s, l, ts->term);		add_to_str(s, l, " ");		add_num_to_str(s, l, ts->mode);		add_to_str(s, l, " ");		add_num_to_str(s, l, !!ts->m11_hack + !!ts->braille * 2);		add_to_str(s, l, " ");		add_num_to_str(s, l, !!ts->col + !!ts->restrict_852 * 2 + !!ts->block_cursor * 4);		add_to_str(s, l, " ");		add_to_str(s, l, get_cp_mime_name(ts->charset));	}}struct list_head driver_params = { &driver_params, &driver_params };struct driver_param *get_driver_param(unsigned char *n){	struct driver_param *dp;	foreach(dp, driver_params) if (!strcasecmp(dp->name, n)) return dp;	dp = mem_calloc(sizeof(struct driver_param) + strlen(n) + 1);	dp->codepage = get_cp_index("iso-8859-1");	strcpy(dp->name, n);	dp->shell = mem_calloc(1);	dp->nosave = 1;	add_to_list(driver_params, dp);	return dp;}unsigned char *dp_rd(struct option *o, unsigned char *c){	int cc;	unsigned char *n, *param, *cp, *shell;	struct driver_param *dp;	if (!(n = get_token(&c))) goto err;	if (!(param = get_token(&c))) {		mem_free(n);		goto err;	}	if (!(shell = get_token(&c))){		mem_free(n);		mem_free(param);		goto err;	}	if (!(cp = get_token(&c))) {		mem_free(n);		mem_free(param);		mem_free(shell);		goto err;	}	if ((cc=get_cp_index(cp)) == -1 || is_cp_special(cc)) {		mem_free(n);		mem_free(param);		mem_free(shell);		mem_free(cp);		goto err;	}	dp=get_driver_param(n);	dp->codepage=cc;	if (dp->param) mem_free(dp->param);	dp->param=param;	if (dp->shell) mem_free(dp->shell);	dp->shell=shell;	dp->nosave = 0;	mem_free(cp);	mem_free(n);	return NULL;	err:	return "Error reading driver mode specification";}void dp_wr(struct option *o, unsigned char **s, int *l){	struct driver_param *dp;	foreachback(dp, driver_params) {		if ((!dp->param || !*dp->param) && !dp->codepage && !*dp->shell) continue;		if (dp->nosave) continue;		add_nm(o, s, l);		add_quoted_to_str(s, l, dp->name);		add_to_str(s, l, " ");		add_quoted_to_str(s, l, dp->param ? dp->param : (unsigned char*)"");		add_to_str(s, l, " ");		add_quoted_to_str(s, l, dp->shell);		add_to_str(s, l, " ");		add_to_str(s, l, get_cp_mime_name(dp->codepage));	}}unsigned char *gen_cmd(struct option *o, unsigned char ***argv, int *argc){	unsigned char *e;	int l;	unsigned char *r;	if (!*argc) return "Parameter expected";	e = init_str();	l = 0;	add_quoted_to_str(&e, &l, **argv);	r = o->rd_cfg(o, e);	mem_free(e);	if (r) return r;	(*argv)++; (*argc)--;	return NULL;}unsigned char *lookup_cmd(struct option *o, unsigned char ***argv, int *argc){	ip__address addr;	unsigned char *p = (unsigned char *)&addr;	if (!*argc) return "Parameter expected";	if (*argc >= 2) return "Too many parameters";	(*argv)++; (*argc)--;	if (do_real_lookup(*(*argv - 1), &addr)) {#ifdef HAVE_HERROR		herror("error");#else		fprintf(stderr, "error: host not found\n");#endif		return "";	}	printf("%d.%d.%d.%d\n", (int)p[0], (int)p[1], (int)p[2], (int)p[3]);	fflush(stdout);	return "";}unsigned char *version_cmd(struct option *o, unsigned char ***argv, int *argc){	printf("Links " VERSION_STRING "\n");	fflush(stdout);	return "";}unsigned char *set_cmd(struct option *o, unsigned char ***argv, int *argc){	*(int *)o->ptr = 1;	return NULL;}unsigned char *unset_cmd(struct option *o, unsigned char ***argv, int *argc){	*(int *)o->ptr = 0;	return NULL;}unsigned char *setstr_cmd(struct option *o, unsigned char ***argv, int *argc){	if (!*argc) return "Parameter expected";	strncpy(o->ptr, **argv, o->max);	((unsigned char *)o->ptr)[o->max - 1] = 0;	(*argv)++; (*argc)--;	return NULL;}unsigned char *force_html_cmd(struct option *o, unsigned char ***argv, int *argc){	force_html = 1;	return NULL;}unsigned char *dump_cmd(struct option *o, unsigned char ***argv, int *argc){	if (dmp != o->min && dmp) return "Can't use both -dump and -source";	dmp = o->min;	no_connect = 1;	return NULL;}unsigned char *printhelp_cmd(struct option *o, unsigned char ***argv, int *argc){/* Changed and splited - translation is much easier. * Print to stdout instead stderr (,,links -help | more'' * is much better than ,,links -help 2>&1 | more''). */fprintf(stdout, "%s%s%s%s%s%s\n",("links [options] URL\n""Options are:\n""\n"" -g\n""  Run in graphics mode.\n""\n"" -no-g\n""  Run in text mode (overrides previous -g).\n""\n"" -driver <driver name>\n""  Graphics driver to use. Drivers are: x, svgalib, fb, directfb, pmshell,\n""    atheos.\n""  List of drivers will be shown if you give it an unknown driver.\n""  Available drivers depend on your operating system and available libraries.\n""\n"" -mode <graphics mode>\n""  Graphics mode. For SVGALIB it is in format COLUMNSxROWSxCOLORS --\n""    for example 640x480x256, 800x600x64k, 960x720x16M, 1024x768x16M32\n""    List of modes will be shown if you give it an unknown videomode.\n""  For framebuffer it is number of pixels in border --- LEFT,TOP,RIGHT,BOTTOM\n""    other 3 values are optional --- i.e. -mode 10 will set all borders to 10,\n""    -mode 10,20 will set left & right border to 10 and top & bottom to 20.\n""  For Xwindow it is size of a window in format WIDTHxHEIGHT.\n""\n"" -display <x-display>\n""  Set Xwindow display.\n""\n"" -force-html\n""  Treat files with unknown type as html rather than text.\n""    (can be toggled with '\\' key)\n""\n"" -source <url>\n""  Write unformatted data stream to stdout.\n""\n"" -dump <url>\n""  Write formatted document to stdout.\n""\n"" -width <number>\n""  For dump, document will be formatted to this screen width (but it can still\n""    exceed it if lines can't be broken).\n""\n"" -codepage <codepage>\n""  For dump, convert output to specified character set --\n""    for eaxmple iso-8859-2, windows-1250.\n""\n"" -anonymous\n""  Restrict links so that it can run on an anonymous account.\n""  No local file browsing. No downloads. Executing viewers\n""    is allowed, but user can't add or modify entries in\n""    association table.\n""\n"" -no-connect\n""  Runs links as a separate instance - instead of connecting to\n""    existing instance.\n""\n"" -download-utime <0>/<1>\n""  Set time of downloaded files to last modification time reported by server.\n""\n"" -async-dns <0>/<1>\n""  Asynchronous DNS resolver on(1)/off(0).\n""\n"" -max-connections <max>\n""  Maximum number of concurrent connections.\n""    (default: 10)\n""\n"),(" -max-connections-to-host <max>\n""  Maximum number of concurrent connection to a given host.\n""    (default: 2)\n""\n"" -retries <retry>\n""  Number of retries.\n""    (default: 3)\n""\n"" -receive-timeout <sec>\n""  Timeout on receive.\n""    (default: 120)\n""\n"),(" -unrestartable-receive-timeout <sec>\n""  Timeout on non restartable connections.\n""    (default: 600)\n""\n"" -format-cache-size <num>\n""  Number of formatted document pages cached.\n""    (default: 5)\n""\n"" -memory-cache-size <bytes>\n""  Cache memory in bytes.\n""    (default: 1048576)\n""\n"" -image-cache-size <bytes>\n""  Cache memory in bytes.\n""    (default: 1048576)\n""\n"),(" -http-proxy <host:port>\n""  Host and port number of the HTTP proxy, or blank.\n""    (default: blank)\n""\n"" -ftp-proxy <host:port>\n""  Host and port number of the FTP proxy, or blank.\n""    (default: blank)\n""\n"" -socks-proxy <user@host:port>\n""  Userid, host and port of Socks4a, or blank.\n""    (default: blank)\n""\n"" -only-proxies <0>/<1>\n""    (default 0)\n""  \"1\" causes that Links won't initiate any non-proxy connection.\n""    It is useful for anonymization with tor or similar networks.\n""\n"" -download-dir <path>\n""  Default download directory.\n""    (default: actual dir)\n""\n"),(" -language <language>\n""  Set user interface language.\n""\n"" -http-bugs.http10 <0>/<1>\n""    (default 0)\n""  \"1\" forces using only HTTP/1.0 protocol. (useful for buggy servers\n""    that claim to be HTTP/1.1 compliant but are not)\n""  \"0\" use both HTTP/1.0 and HTTP/1.1.\n""\n"" -http-bugs.allow-blacklist <0>/<1>\n""    (default 1)\n""  \"1\" defaults to using list of servers that have broken HTTP/1.1 support.\n""     When links finds such server, it will retry the request with HTTP/1.0.\n""\n"" -http-bugs.bug-302-redirect <0>/<1>\n""    (default 1)\n""  Process 302 redirect in a way that is incompatible with RFC1945 and RFC2068,\n""    but the same as Netscape and MSIE. Many pages depend on it.\n""\n"" -http-bugs.bug-post-no-keepalive <0>/<1>\n""    (default 0)\n""  No keepalive connection after post requests. For some buggy servers.\n""\n"" -http-bugs.bug-no-accept-charset <0>/<1>\n""    (default 0)\n""  Do not send Accept-Charset field of HTTP header. Because it is too long\n""    some servers will deny the request. Other servers will convert content\n""    to plain ascii when Accept-Charset is missing.\n""\n"" -http-bugs.no-compression <0>/<1>\n""    (default 0)\n""  \"1\" causes that links won't advertise HTTP compression support (but it\n""    will still accept compressed data). Use it when you communicate with\n""    server that has broken compression support.\n""\n"" -http-bugs.retry-internal-errors <0>/<1>\n""    (default 0)\n""  Retry on internal server errors (50x).\n""\n"" -http-bugs.aggressive-cache <0>/<1>\n""    (default 1)\n""  Always cache everything regardless of server's caching recomendations.\n""    Many servers deny caching even if their content is not changing\n""    just to get more hits and more money from ads.\n""\n"" -http-referer <0>/<1>/<2>/<3>\n""    (default 0)\n""  0 - do not send referer\n""  1 - send the requested URL as referer\n""  2 - send fake referer\n""  3 - send real referer\n""  4 - send real referer only to the same server\n""\n"" -fake-referer <string>\n""  Fake referer value.\n""\n"" -fake-user-agent <string>\n""  Fake user agent value.\n""\n"" -ftp.anonymous-password <string>\n""  Password for anonymous ftp access.\n""\n"" -ftp.use-passive <0>/<1>\n""  Use ftp PASV command to bypass firewalls.\n""\n"" -ftp.fast <0>/<1>\n""  Send more ftp commands simultaneously. Faster response when\n""    browsing ftp directories, but it is incompatible with RFC\n""    and some servers don't like it.\n""\n"" -ftp.set-iptos <0>/<1>\n""  Set IP Type-of-service to high throughput on ftp connections.\n""\n"" -menu-font-size <size>\n""  Size of font in menu.\n""\n"" -background-color 0xRRGGBB\n""  Set menu background color in graphics mode, RRGGBB are hex.\n""\n"" -foreground-color 0xRRGGBB\n""  Set menu foreground color in graphics mode.\n""\n"" -scroll-bar-area-color 0xRRGGBB\n""  Set color of scroll bar area.\n""\n"" -scroll-bar-bar-color 0xRRGGBB\n""  Set color of scroll bar.\n""\n"" -scroll-bar-frame-color 0xRRGGBB\n""  Set color of scroll bar frame.\n""\n"" -display-red-gamma <fp-value>\n""  Red gamma of display.\n""    (default 2.2)\n""\n"" -display-green-gamma <fp-value>\n""  Green gamma of display.\n""    (default 2.2)\n""\n"" -display-blue-gamma <fp-value>\n""  Blue gamma of display.\n""    (default 2.2)\n""\n"" -user-gamma <fp-value>\n""  Additional gamma.\n""    (default 1)\n""\n"" -bfu-aspect <fp-value>\n""  Display aspect ration.\n""\n"" -aspect-on <0>/<1>\n""  Enable aspect ratio correction.\n""\n"" -dither-letters <0>/<1>\n""  Do letter dithering.\n"

⌨️ 快捷键说明

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