Commit: 61d9c04362e9bdb06cb450cd7bcc7a50fc957f51
Parent: 170c96734af26a2b925c74c99a46b08a108dce1f
Author: opask
Date: Wed, 11 Jul 2018 05:45:16 -0600
remove unused code
Diffstat:
9 files changed, 7 insertions(+), 202 deletions(-)
diff --git a/default.c b/default.c
@@ -1323,7 +1323,7 @@ static unsigned char *lookup_cmd(struct option *o, unsigned char ***argv, int *a
static unsigned char *version_cmd(struct option *o, unsigned char ***argv, int *argc)
{
- printf("Links " VERSION_STRING "\n");
+ printf("Links " VERSION "\n");
fflush(stdout);
do_exit(RET_OK);
return NULL;
diff --git a/http.c b/http.c
@@ -371,7 +371,7 @@ static void add_user_agent(unsigned char **hdr, int *l)
if (SCRUB_HEADERS) {
add_to_str(hdr, l, cast_uchar "Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0\r\n");
} else if (!(*http_options.header.fake_useragent)) {
- add_to_str(hdr, l, cast_uchar("Links (" VERSION_STRING "; "));
+ add_to_str(hdr, l, cast_uchar("Links (" VERSION "; "));
add_to_str(hdr, l, system_name);
add_to_str(hdr, l, cast_uchar "; ");
add_to_str(hdr, l, compiler_name);
diff --git a/language.inc b/language.inc
@@ -22,7 +22,7 @@ static_const struct translation translation_english [] = {
{T_BOOKMARK_ERROR, "Bookmark error" },
{T_UNABLE_TO_WRITE_TO_BOOKMARK_FILE, "Unable to write to bookmark file" },
{T_ABOUT, "About" },
- {T_LINKS__LYNX_LIKE, "Links " VERSION_STRING "\n\nText and graphics WWW browser" },
+ {T_LINKS__LYNX_LIKE, "Links " VERSION "\n\nText and graphics WWW browser" },
{T_VERSION, "Version" },
{T_VERSION_INFORMATION, "Version information" },
{T_LINKS_VERSION, "Links version" },
@@ -59,7 +59,7 @@ static_const struct translation translation_english [] = {
{T_KEYS_DESC, "ESC display menu\n^C, q, Q quit\np, l scroll up, down\n[, ] scroll left, right\nup, down select link\n-> follow link\n<-, z go back\n', x go forward\nTAB switch frames\ng go to url\nG go to url based on current url\n^G go to url based on current link\n* toggle image displaying\n^W complete URL or search string\n^B,^X,^V,^K copy, cut, paste, cut line to/from clipboard\nAlt-1 .. Alt-9 switch virtual screens (svgalib and fb)" },
{T_KEYS_BRAILLE_DESC, "a, w cursor to status line or title\n{, } cursor to start/end of a line\n^Y,^T,y,t,^O go to next/previous link/word/form entry" },
{T_COPYING, "Copying" },
- {T_COPYING_DESC, "Links " VERSION_STRING "\n\n" LINKS_COPYRIGHT "\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version." },
+ {T_COPYING_DESC, "Links " VERSION "\n\n" LINKS_COPYRIGHT "\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version." },
{T_RESOURCES, "Resources" },
{T_MEMORY_CACHE, "Memory cache" },
{T_DECOMPRESSED_CACHE, "Decompressed cache" },
diff --git a/links.h b/links.h
@@ -2913,7 +2913,6 @@ struct f_data_c *find_frame(struct session *ses, unsigned char *target, struct f
unsigned char *get_current_url(struct session *, unsigned char *, size_t);
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);
/* bfu.c */
diff --git a/main.c b/main.c
@@ -495,169 +495,21 @@ static void terminate_all_subsystems(void)
terminate_osdep();
}
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
{
g_argc = argc;
g_argv = (unsigned char **)argv;
-#if 0
- if (argc != 3)
- fprintf(stderr, "two args expected\n"), exit(1);
- printf("cookie %saccepted\n", allow_cookie_domain(cast_uchar argv[1], cast_uchar argv[2]) ? "" : "not ");
- return 0;
-#endif
-
init_heap();
init_os();
get_path_to_exe();
-#if 0
- {
- int i;
- int ix, iy, ox, oy, rep;
- ulonglong tm = 0;
- parse_options(g_argc - 1, g_argv + 1);
- ix = getenv("SRC_X") ? atoi(getenv("SRC_X")) : 100;
- iy = getenv("SRC_Y") ? atoi(getenv("SRC_Y")) : ix;
- ox = getenv("DST_X") ? atoi(getenv("DST_X")) : 100;
- oy = getenv("DST_Y") ? atoi(getenv("DST_Y")) : ox;
- rep = getenv("REP") ? atoi(getenv("REP")) : 1;
- for (i = 0; i <= rep; i++) {
- unsigned short *dst;
- unsigned short *src;
- struct timeval tv1, tv2;
- src = mem_alloc(sizeof(unsigned short) * ix * iy * 3);
- memset(src, 0x12, sizeof(unsigned short) * ix * iy * 3);
- gettimeofday(&tv1, NULL);
- scale_color(src, ix, iy, &dst, ox, oy);
- gettimeofday(&tv2, NULL);
- if (dst) mem_free(dst);
- if (i)
- tm += ((ulonglong)tv2.tv_sec * 1000000 + tv2.tv_usec) - ((ulonglong)tv1.tv_sec * 1000000 + tv1.tv_usec);
- }
- fprintf(stderr, "time: %f\n", (double)tm / 1000 / rep);
- check_memory_leaks();
- return 0;
- }
-#endif
-#if 0
- {
- int i;
- for (i = 0; i < 100; i++) {
- unsigned char *a = mem_calloc(i);
- unsigned char *b = base64_encode(a, i, cast_uchar "", cast_uchar "", 5);
- fprintf(stderr, "X:\n%.*s\n", (int)strlen(cast_const_char b), b);
- mem_free(a);
- mem_free(b);
- }
- check_memory_leaks();
- return 0;
- }
-#endif
-#if 0
- {
- unsigned char *puny_encode(unsigned char *s);
- unsigned char *puny_decode(unsigned char *s);
- int i;
- for (i = 1; i < g_argc; i++) {
- unsigned char *str = puny_encode(g_argv[i]);
- if (str) {
- fprintf(stderr, "'%s'\n", str);
- unsigned char *d = puny_decode(str);
- if (!d || strcmp(cast_const_char d, cast_const_char g_argv[i])) {
- internal("mismatch - %s", d);
- }
- mem_free(str);
- mem_free(d);
- }
- }
- check_memory_leaks();
- return 0;
- }
-#endif
-#if 0
- while (1) {
-#define maxn 12
- static unsigned long long count = 0;
- unsigned char *puny_encode(unsigned char *s, int len);
- unsigned char *puny_decode(unsigned char *s, int len);
- int punycode_encode(size_t input_length, const uint32_t input[], const unsigned char case_flags[], size_t *output_length, char output[]);
- int punycode_decode(size_t input_length, const char input[], size_t * output_length, uint32_t output[], unsigned char case_flags[]);
- uint32_t unistr[maxn];
- unsigned i, n;
- unsigned char *utfstr, *puny, *dec;
- int utfstr_l;
- char pce_o[60];
- size_t pce_ol;
- int pce_s;
- n = random() % (maxn + 1);
- for (i = 0; i < n; i++) {
- uint32_t uni;
- uni = random() % (0x10FFFF + 1);
- if (uni >= 0xd800 && uni <= 0xdfff)
- uni = random() % 128;
- while (uni < 128 && !(
- uni == '-' ||
- (uni >= '0' && uni <= '9') ||
- (uni >= 'A' && uni <= 'Z') ||
- (uni >= 'a' && uni <= 'z'))) {
- uni = random() % 128;
- }
- unistr[i] = uni;
- }
- utfstr = init_str();
- utfstr_l = 0;
- for (i = 0; i < n; i++) {
- unsigned char *us = encode_utf_8(unistr[i]);
- add_to_str(&utfstr, &utfstr_l, us);
- }
- puny = puny_encode(utfstr, utfstr_l);
- if (!puny) {
- fprintf(stderr, "failed:");
- goto err;
- }
- dec = puny_decode(puny, (int)strlen(cast_const_char puny));
- if (!dec)
- dec = stracpy(puny);
- if (strcmp(cast_const_char utfstr, cast_const_char dec)) {
- fprintf(stderr, "mismatch(%s,%s):", utfstr, dec);
- goto err;
- }
- pce_ol = 59;
- pce_s = punycode_encode(n, unistr, NULL, &pce_ol, pce_o);
- if (pce_s) {
- fprintf(stderr, "punycode_encode(%d):", pce_s);
- goto err;
- }
- pce_o[pce_ol] = 0;
- if (!strncmp(cast_const_char puny, "xn--", 4) && strcmp(cast_const_char puny + 4, pce_o)) {
- fprintf(stderr, "punycode_encode differs(%s,%s):", puny, pce_o);
- goto err;
- }
- mem_free(dec);
- mem_free(puny);
- mem_free(utfstr);
- if (0) {
-err:
- for (i = 0; i < n; i++) {
- fprintf(stderr, " %u", unistr[i]);
- }
- internal("failed");
- }
- count++;
- if (!(count % 10000)) {
- printf("%llu\r", count);
- fflush(stdout);
- }
- }
-#endif
-
select_loop(init);
terminate_all_subsystems();
check_memory_leaks();
return retval;
}
-
diff --git a/menu.c b/menu.c
@@ -59,7 +59,7 @@ static void menu_version(void *term_)
text_ptr = version_texts;
add_and_pad(&s, &l, term, *text_ptr++, maxlen);
- add_to_str(&s, &l, cast_uchar VERSION_STRING);
+ add_to_str(&s, &l, cast_uchar VERSION);
add_to_str(&s, &l, cast_uchar "\n");
add_and_pad(&s, &l, term, *text_ptr++, maxlen);
diff --git a/session.c b/session.c
@@ -2927,33 +2927,3 @@ unsigned char *get_current_title(struct f_data_c *fd, unsigned char *str, size_t
return str;
}
-
-#if 0
-/*
- Gets the url of the link currently selected. Writes it into str.
- A maximum of str_size bytes (including null) will be written.
-*/
-unsigned char *get_current_link_url(struct session *ses, unsigned char *str, size_t str_size)
-{
- struct f_data_c *fd;
- struct link *l;
-
- fd = (struct f_data_c *)current_frame(ses);
- /* What the hell is an 'fd'? */
- if (!fd)
- return NULL;
-
- /* Nothing selected? */
- if (fd->vs->current_link == -1 || fd->vs->current_link >= fd->f_data->nlinks)
- return NULL;
-
- l = &fd->f_data->links[fd->vs->current_link];
- /* Only write a link */
- if (l->type != L_LINK)
- return NULL;
-
- safe_strncpy(str, l->where, str_size);
-
- return str;
-}
-#endif
diff --git a/setup.h b/setup.h
@@ -3,12 +3,6 @@
* This file is a part of the Links program, released under GPL.
*/
-#if 0
-#define VERSION_STRING VERSION " ["__DATE__ " " __TIME__"]"
-#else
-#define VERSION_STRING VERSION
-#endif
-
/* DEBUG LEVEL:
* 0=vsechno vypnuty
* 1=leaky
diff --git a/view.c b/view.c
@@ -3996,17 +3996,7 @@ unsigned char *print_current_title(struct session *ses)
static inline int find_in_cache_idn(unsigned char *xurl, struct cache_entry **ce)
{
-#if 0
- unsigned char *url;
- int r;
- url = idn_encode_url(xurl, 0);
- if (!url) url = stracpy(xurl);
- r = find_in_cache(url, ce);
- mem_free(url);
- return r;
-#else
return find_in_cache(xurl, ce);
-#endif
}
void loc_msg(struct terminal *term, struct location *lo, struct f_data_c *frame)