1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582
|
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_CONFIG2_H
#include "config2.h"
#endif
#include "os_dep.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <errno.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#include <sys/types.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#include <sys/stat.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_DIRENT_H
#include <dirent.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_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#else
#ifdef HAVE_NETINET_IN_SYSETM_H
#include <netinet/in_system.h>
#endif
#endif
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#ifdef HAVE_NETINET_IP_H
#include <netinet/ip.h>
#endif
#include <termios.h>
#include "os_depx.h"
#include "setup.h"
#define get_text(a) (a)
#define DUMMY ((void *)-1L)
/* error.c */
void check_memory_leaks();
void error(unsigned char *, ...);
void debug_msg(unsigned char *, ...);
void int_error(unsigned char *, ...);
extern int errline;
extern unsigned char *errfile;
#define internal errfile = __FILE__, errline = __LINE__, int_error
#define debug errfile = __FILE__, errline = __LINE__, debug_msg
#ifdef SPECIAL_MALLOC
void *sp_malloc(size_t);
void sp_free(void *);
void *sp_realloc(void *, size_t);
#define xmalloc sp_malloc
#define xfree sp_free
#define xrealloc sp_realloc
#else
#define xmalloc malloc
#define xfree free
#define xrealloc realloc
#endif
/* inline */
#ifdef LEAK_DEBUG
extern long mem_amount;
extern long last_mem_amount;
#define L_D_S sizeof(size_t)
extern long debug_sizes[];
extern long last_debug_sizes[];
struct md {
void *p;
size_t size;
unsigned char *file;
int line;
unsigned char *comment;
};
extern struct md memory_list[];
extern struct md last_memory_list[];
#endif
#ifdef LEAK_DEBUG
void *debug_mem_alloc(unsigned char *, int, size_t);
void debug_mem_free(unsigned char *, int, void *);
void *debug_mem_realloc(unsigned char *, int, void *, size_t);
void set_mem_comment(void *, unsigned char *, int l);
#define mem_alloc(x) debug_mem_alloc(__FILE__, __LINE__, x)
#define mem_free(x) debug_mem_free(__FILE__, __LINE__, x)
#define mem_realloc(x, y) debug_mem_realloc(__FILE__, __LINE__, x, y)
#else
static inline void *mem_alloc(size_t size)
{
void *p;
if (!size) return DUMMY;
if (!(p = malloc(size))) {
error("ERROR: out of memory (malloc returned NULL)\n");
return NULL;
}
return p;
}
static inline void mem_free(void *p)
{
if (p == DUMMY) return;
if (!p) {
internal("mem_free(NULL)");
return;
}
free(p);
}
static inline void *mem_realloc(void *p, size_t size)
{
if (p == DUMMY) return mem_alloc(size);
if (!p) {
internal("mem_realloc(NULL, %d)", size);
return NULL;
}
if (!size) {
mem_free(p);
return DUMMY;
}
if (!(p = realloc(p, size))) {
error("ERROR: out of memory (realloc returned NULL)\n");
return NULL;
}
return p;
}
#define set_mem_comment(x, y, z) do { } while (0)
#endif
static inline unsigned char upcase(unsigned char a)
{
if (a>='a' && a<='z') a -= 0x20;
return a;
}
static inline int xstrcmp(unsigned char *s1, unsigned char *s2)
{
if (!s1 && !s2) return 0;
if (!s1) return -1;
if (!s2) return 1;
return strcmp(s1, s2);
}
static inline int cmpbeg(unsigned char *str, unsigned char *b)
{
while (*str && upcase(*str) == upcase(*b)) str++, b++;
return !!*b;
}
#if !(defined(LEAK_DEBUG) && defined(MAX_LIST_SIZE))
static inline unsigned char *memacpy(unsigned char *src, int len)
{
unsigned char *m;
if ((m = mem_alloc(len + 1))) {
memcpy(m, src, len);
m[len] = 0;
}
return m;
}
static inline unsigned char *stracpy(unsigned char *src)
{
return src ? memacpy(src, src != DUMMY ? strlen(src) : 0) : NULL;
}
#else
static inline unsigned char *debug_memacpy(unsigned char *f, int l, unsigned char *src, int len)
{
unsigned char *m;
if ((m = debug_mem_alloc(f, l, len + 1))) {
memcpy(m, src, len);
m[len] = 0;
}
return m;
}
#define memacpy(s, l) debug_memacpy(__FILE__, __LINE__, s, l)
static inline unsigned char *debug_stracpy(unsigned char *f, int l, unsigned char *src)
{
return src ? debug_memacpy(f, l, src, src != DUMMY ? strlen(src) : 0) : NULL;
}
#define stracpy(s) debug_stracpy(__FILE__, __LINE__, s)
#endif
static inline int snprint(unsigned char *s, int n, unsigned num)
{
int q = 1;
while (q <= num / 10) q *= 10;
while (n-- > 1 && q) *(s++) = num / q + '0', num %= q, q /= 10;
*s = 0;
return !!q;
}
static inline int snzprint(unsigned char *s, int n, int num)
{
if (n > 1 && num < 0) *(s++) = '-', num = -num, n--;
return snprint(s, n, num);
}
static inline void add_to_strn(unsigned char **s, unsigned char *a)
{
unsigned char *p;
if (!(p = mem_realloc(*s, strlen(*s) + strlen(a) + 1))) return;
strcat(p, a);
*s = p;
}
#define ALLOC_GR 0x100 /* must be power of 2 */
static inline unsigned char *init_str()
{
unsigned char *p;
if ((p = mem_alloc(ALLOC_GR))) *p = 0;
return p;
}
static inline void add_to_str(unsigned char **s, int *l, unsigned char *a)
{
unsigned char *p;
int ll = strlen(a);
if ((*l & ~(ALLOC_GR - 1)) != ((*l + ll) & ~(ALLOC_GR - 1)) &&
(!(p = mem_realloc(*s, (*l + ll + ALLOC_GR) & ~(ALLOC_GR - 1))) ||
!(*s = p))) return;
strcpy(*s + *l, a); *l += ll;
}
static inline void add_bytes_to_str(unsigned char **s, int *l, unsigned char *a, int ll)
{
unsigned char *p;
if ((*l & ~(ALLOC_GR - 1)) != ((*l + ll) & ~(ALLOC_GR - 1)) &&
(!(p = mem_realloc(*s, (*l + ll + ALLOC_GR) & ~(ALLOC_GR - 1))) ||
!(*s = p))) return;
memcpy(*s + *l, a, ll); (*s)[*l += ll] = 0;
}
static inline void add_chr_to_str(unsigned char **s, int *l, unsigned char a)
{
unsigned char *p;
if ((*l & (ALLOC_GR - 1)) == ALLOC_GR - 1 &&
(!(p = mem_realloc(*s, (*l + 1 + ALLOC_GR) & ~(ALLOC_GR - 1))) ||
!(*s = p))) return;
*(*s + *l) = a; *(*s + ++(*l)) = 0;
}
static inline void add_num_to_str(unsigned char **s, int *l, int n)
{
unsigned char a[64];
/*sprintf(a, "%d", n);*/
snzprint(a, 64, n);
add_to_str(s, l, a);
}
static inline void add_knum_to_str(unsigned char **s, int *l, int n)
{
unsigned char a[13];
if (n && n / (1024 * 1024) * (1024 * 1024) == n) snzprint(a, 12, n / (1024 * 1024)), strcat(a, "M");
else if (n && n / 1024 * 1024 == n) snzprint(a, 12, n / 1024), strcat(a, "k");
else snzprint(a, 13, n);
add_to_str(s, l, a);
}
static inline long strtolx(unsigned char *c, unsigned char **end)
{
long l = strtol(c, (char **)end, 10);
if (!*end) return l;
if (upcase(**end) == 'K') {
(*end)++;
if (l < LONG_MIN / 1024) return LONG_MIN;
if (l > LONG_MAX / 1024) return LONG_MAX;
return l * 1024;
}
if (upcase(**end) == 'M') {
(*end)++;
if (l < LONG_MIN / (1024 * 1024)) return LONG_MIN;
if (l > LONG_MAX / (1024 * 1024)) return LONG_MAX;
return l * (1024 * 1024);
}
return l;
}
static inline unsigned char *copy_string(unsigned char **dst, unsigned char *src)
{
if ((*dst = src) && (*dst = mem_alloc(strlen(src) + 1))) strcpy(*dst, src);
return *dst;
}
struct list_head {
void *next;
void *prev;
};
struct xlist_head {
struct xlist_head *next;
struct xlist_head *prev;
};
#define init_list(x) {(x).next=&(x); (x).prev=&(x);}
#define list_empty(x) ((x).next == &(x))
#define del_from_list(x) {((struct list_head *)(x)->next)->prev=(x)->prev; ((struct list_head *)(x)->prev)->next=(x)->next;}
/*#define add_to_list(l,x) {(x)->next=(l).next; (x)->prev=(typeof(x))&(l); (l).next=(x); if ((l).prev==&(l)) (l).prev=(x);}*/
#define add_at_pos(p,x) do {(x)->next=(p)->next; (x)->prev=(p); (p)->next=(x); (x)->next->prev=(x);} while(0)
/*#define add_to_list(l,x) add_at_pos((typeof(x))&(l),(x))
#define foreach(e,l) for ((e)=(l).next; (e)!=(typeof(e))&(l); (e)=(e)->next)
#define foreachback(e,l) for ((e)=(l).prev; (e)!=(typeof(e))&(l); (e)=(e)->prev)*/
#define add_to_list(l,x) add_at_pos((struct xlist_head *)&(l),(struct xlist_head *)(x))
#define foreach(e,l) for ((e)=(l).next; (e)!=(void *)&(l); (e)=(e)->next)
#define foreachback(e,l) for ((e)=(l).prev; (e)!=(void *)&(l); (e)=(e)->prev)
#define free_list(l) {while ((l).next != &(l)) {struct list_head *a=(l).next; del_from_list(a); mem_free(a); }}
#define WHITECHAR(x) ((x) == 9 || (x) == 10 || (x) == 12 || (x) == 13 || (x) == ' ')
#define U(x) ((x) == '"' || (x) == '\'')
static inline int isA(unsigned char c)
{
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') ||
c == '_' || c == '-';
}
static inline int casecmp(unsigned char *c1, unsigned char *c2, int len)
{
int i;
for (i = 0; i < len; i++) if (upcase(c1[i]) != upcase(c2[i])) return 1;
return 0;
}
static inline int can_write(int fd)
{
fd_set fds;
struct timeval tv = {0, 0};
FD_ZERO(&fds);
FD_SET(fd, &fds);
return select(fd + 1, NULL, &fds, NULL, &tv);
}
static inline int can_read(int fd)
{
fd_set fds;
struct timeval tv = {0, 0};
FD_ZERO(&fds);
FD_SET(fd, &fds);
return select(fd + 1, &fds, NULL, NULL, &tv);
}
#define CI_BYTES 1
#define CI_FILES 2
#define CI_LOCKED 3
#define CI_LOADING 4
#define CI_TIMERS 5
#define CI_TRANSFER 6
#define CI_CONNECTING 7
#define CI_KEEP 8
#define CI_LIST 9
/* os_dep.c */
int get_terminal_size(int, int *, int *);
void handle_terminal_resize(int, void (*)());
void unhandle_terminal_resize(int);
void set_bin(int);
int c_pipe(int *);
int get_input_handle();
void *handle_mouse(int, void (*)(void *, unsigned char *, int), void *);
void unhandle_mouse(void *);
int check_file_name(unsigned char *);
int start_thread(void (*)(void *, int), void *, int);
void check_shell_security(unsigned char **);
/* select.c */
#ifndef FD_SETSIZE
#define FD_SETSIZE 1024
#endif
typedef long ttime;
typedef unsigned tcount;
extern int terminate;
long select_info(int);
void select_loop(void (*)());
int register_bottom_half(void (*)(void *), void *);
void check_bottom_halves();
int install_timer(ttime, void (*)(void *), void *);
void kill_timer(int);
ttime get_time();
void set_handlers(int, void (*)(void *), void (*)(void *), void (*)(void *), void *);
void install_signal_handler(int, void (*)(void *), void *, int);
void set_sigcld();
/* dns.c */
typedef unsigned ip;
int do_real_lookup(unsigned char *, ip *);
void shrink_dns_cache(int);
void find_host(unsigned char *, ip *, void **, void (*)(void *, int), void *);
void find_host_no_cache(unsigned char *, ip *, void **, void (*)(void *, int), void *);
void kill_dns_request(void **);
/* cache.c */
struct cache_entry {
struct cache_entry *next;
struct cache_entry *prev;
unsigned char *url;
unsigned char *head;
unsigned char *redirect;
int redirect_get;
int length;
int incomplete;
int tgc;
unsigned char *last_modified;
int data_size;
struct list_head frag;
tcount count;
int refcount;
};
struct fragment {
struct fragment *next;
struct fragment *prev;
int offset;
int length;
unsigned char data[1];
};
long cache_info(int);
int find_in_cache(unsigned char *, struct cache_entry **);
int get_cache_entry(unsigned char *, struct cache_entry **);
int get_cache_data(struct cache_entry *e, unsigned char **, int *);
int add_fragment(struct cache_entry *, int, unsigned char *, int);
void truncate_entry(struct cache_entry *, int);
void delete_entry_content(struct cache_entry *);
void delete_cache_entry(struct cache_entry *);
void garbage_collection(int);
/* sched.c */
#define PRI_MAIN 0
#define PRI_DOWNLOAD 0
#define PRI_FRAME 1
#define PRI_NEED_IMG 2
#define PRI_IMG 3
#define PRI_PRELOAD 4
#define PRI_CANCEL 5
#define N_PRI 6
struct remaining_info {
int valid;
int size, loaded, last_loaded, cur_loaded;
int pos;
ttime elapsed;
ttime last_time;
ttime dis_b;
int data_in_secs[CURRENT_SPD_SEC];
int timer;
};
struct connection {
struct connection *next;
struct connection *prev;
unsigned char *url;
int running;
int state;
int prev_error;
int from;
int pri[N_PRI];
int no_cache;
int sock1;
int sock2;
void *dnsquery;
int tries;
struct list_head statuss;
void *info;
void *buffer;
void (*conn_func)(void *);
struct cache_entry *cache;
int received;
int est_length;
int unrestartable;
struct remaining_info prg;
int timer;
};
static inline int getpri(struct connection *c)
{
int i;
for (i = 0; i < N_PRI; i++) if (c->pri[i]) return i;
internal("connection has no owner");
return N_PRI;
}
#define NC_ALWAYS_CACHE 0
#define NC_CACHE 1
#define NC_IF_MOD 2
#define NC_RELOAD 3
#define NC_PR_NO_CACHE 4
#define S_WAIT 0
#define S_DNS 1
#define S_CONN 2
#define S_SENT 3
#define S_GETH 4
#define S_PROC 5
#define S_TRANS 6
#define S_WAIT_REDIR -999
#define S_OK -1000
#define S_INTERRUPTED -1001
#define S_EXCEPT -1002
#define S_INTERNAL -1003
#define S_OUT_OF_MEM -1004
#define S_NO_DNS -1005
#define S_CANT_WRITE -1006
#define S_CANT_READ -1007
#define S_MODIFIED -1008
#define S_BAD_URL -1009
#define S_TIMEOUT -1010
#define S_RESTART -1011
#define S_HTTP_ERROR -1100
#define S_HTTP_100 -1101
#define S_HTTP_204 -1102
#define S_FILE_TYPE -1200
#define S_FILE_ERROR -1201
#define S_FTP_ERROR -1300
#define S_FTP_UNAVAIL -1301
#define S_FTP_LOGIN -1302
#define S_FTP_PORT -1303
#define S_FTP_NO_FILE -1304
#define S_FTP_FILE_ERROR -1305
extern struct s_msg_dsc {
int n;
unsigned char *msg;
} msg_dsc[];
struct status {
struct status *next;
struct status *prev;
int state;
int prev_error;
void (*end)(struct status *, void *);
void *data;
struct remaining_info *prg;
};
long connect_info(int);
void send_connection_info(struct connection *c);
void setcstate(struct connection *c, int);
int get_keepalive_socket(struct connection *c);
void add_keepalive_socket(struct connection *c, ttime);
void run_connection(struct connection *c);
void retry_connection(struct connection *c);
void abort_connection(struct connection *c);
void end_connection(struct connection *c);
int load_url(unsigned char *, struct status *, int, int);
void change_connection(unsigned char *url, struct status *, struct status *, int, int);
void abort_all_connections();
void abort_background_connections();
int is_entry_used(struct cache_entry *);
void connection_timeout(struct connection *);
void set_timeout(struct connection *);
void add_blacklist_entry(unsigned char *, int);
int get_blacklist_flags(unsigned char *);
void free_blacklist();
#define BL_HTTP10 1
/* url.c */
#define POST_CHAR 1
static inline int end_of_dir(unsigned char c)
{
return c == POST_CHAR || c == '#' || c == ';' || c == '?';
}
unsigned char *get_host_name(unsigned char *);
unsigned char *get_host_and_pass(unsigned char *);
unsigned char *get_user_name(unsigned char *);
unsigned char *get_pass(unsigned char *);
int get_port(unsigned char *);
void (*get_protocol_handle(unsigned char *))(struct connection *);
unsigned char *get_url_data(unsigned char *);
unsigned char *join_urls(unsigned char *, unsigned char *);
unsigned char *translate_url(unsigned char *);
unsigned char *extract_position(unsigned char *);
void get_filename_from_url(unsigned char *, unsigned char **, int *);
/* connect.c */
struct read_buffer {
int sock;
int len;
int close;
void (*done)(struct connection *, struct read_buffer *);
unsigned char data[1];
};
void exception(struct connection *);
void close_socket(int *);
void make_connection(struct connection *, int, int *, void (*)(struct connection *));
int get_pasv_socket(struct connection *, int, int *, unsigned char *);
void write_to_socket(struct connection *, int, unsigned char *, int, void (*)(struct connection *));
struct read_buffer *alloc_read_buffer(struct connection *c);
void read_from_socket(struct connection *, int, struct read_buffer *, void (*)(struct connection *, struct read_buffer *));
void kill_buffer_data(struct read_buffer *, int);
/* http.c */
unsigned char *parse_http_header(unsigned char *, unsigned char *);
unsigned char *parse_header_param(unsigned char *, unsigned char *);
void http_func(struct connection *);
void proxy_func(struct connection *);
/* file.c */
void file_func(struct connection *);
/* ftp.c */
void ftp_func(struct connection *);
/* kbd.c */
#define BM_BUTT 3
#define B_LEFT 0
#define B_MIDDLE 1
#define B_RIGHT 2
#define BM_ACT 12
#define B_DOWN 0
#define B_UP 4
#define B_DRAG 8
#define KBD_ENTER 0x100
#define KBD_BS 0x101
#define KBD_TAB 0x102
#define KBD_ESC 0x103
#define KBD_LEFT 0x104
#define KBD_RIGHT 0x105
#define KBD_UP 0x106
#define KBD_DOWN 0x107
#define KBD_INS 0x108
#define KBD_DEL 0x109
#define KBD_HOME 0x10a
#define KBD_END 0x10b
#define KBD_PAGE_UP 0x10c
#define KBD_PAGE_DOWN 0x10d
#define KBD_F1 0x120
#define KBD_F2 0x121
#define KBD_F3 0x122
#define KBD_F4 0x123
#define KBD_F5 0x124
#define KBD_F6 0x125
#define KBD_F7 0x126
#define KBD_F8 0x127
#define KBD_F9 0x128
#define KBD_F10 0x129
#define KBD_F11 0x12a
#define KBD_F12 0x12b
#define KBD_SHIFT 1
#define KBD_CTRL 2
#define KBD_ALT 4
void handle_trm(int, int, int, int, void *, int);
void free_all_itrms();
/* terminal.c */
typedef unsigned short chr;
struct event {
long ev;
long x;
long y;
long b;
};
#define EV_INIT 0
#define EV_KBD 1
#define EV_MOUSE 2
#define EV_REDRAW 3
#define EV_RESIZE 4
#define EV_ABORT 5
struct window {
struct window *next;
struct window *prev;
void (*handler)(struct window *, struct event *, int fwd);
void *data;
int xp, yp;
struct terminal *term;
};
#define MAX_TERM_LEN 16 /* hardcoded in kbd.c! */
struct terminal {
struct terminal *next;
struct terminal *prev;
int fdin;
int fdout;
int x;
int y;
int xwin;
unsigned char term[MAX_TERM_LEN];
unsigned *screen;
unsigned *last_screen;
int cx;
int cy;
int lcx;
int lcy;
int dirty;
int redrawing;
int blocked;
unsigned char *input_queue;
int qlen;
struct list_head windows;
};
struct term_spec {
struct term_spec *next;
struct term_spec *prev;
unsigned char term[MAX_TERM_LEN];
int mode;
int m11_hack;
int restrict_852;
int col;
int charset;
};
#define TERM_DUMB 0
#define TERM_VT100 1
#define TERM_LINUX 2
#define ATTR_FRAME 0x8000
extern struct list_head term_specs;
int hard_write(int, unsigned char *, int);
struct terminal *init_term(int, int, void (*)(struct window *, struct event *, int));
struct term_spec *get_term_spec(unsigned char *);
struct term_spec *new_term_spec(unsigned char *);
void free_term_specs();
void destroy_terminal(struct terminal *);
void redraw_terminal(struct terminal *);
void redraw_terminal_all(struct terminal *);
void redraw_terminal_cls(struct terminal *);
void redraw_from_window(struct window *);
void redraw_below_window(struct window *);
void add_window(struct terminal *, void (*)(struct window *, struct event *, int), void *);
void add_window_at_pos(struct terminal *, void (*)(struct window *, struct event *, int), void *, struct window *);
void delete_window(struct window *);
void delete_window_ev(struct window *, struct event *ev);
void set_window_ptr(struct window *, int, int);
void get_parent_ptr(struct window *, int *, int *);
struct window *get_root_window(struct terminal *);
void add_empty_window(struct terminal *, void (*)(void *), void *);
void redraw_screen(struct terminal *);
void redraw_all_terminals();
void set_char(struct terminal *, int, int, unsigned);
unsigned get_char(struct terminal *, int, int);
void set_color(struct terminal *, int, int, unsigned);
void set_only_char(struct terminal *, int, int, unsigned);
void set_line(struct terminal *, int, int, int, chr *);
void set_line_color(struct terminal *, int, int, int, unsigned);
void fill_area(struct terminal *, int, int, int, int, unsigned);
void draw_frame(struct terminal *, int, int, int, int, unsigned, int);
void print_text(struct terminal *, int, int, int, unsigned char *, unsigned);
void set_cursor(struct terminal *, int, int);
void exec_on_terminal(struct terminal *, unsigned char *, unsigned char *, int);
void destroy_all_terminals();
void block_itrm(int);
void unblock_itrm(int);
/* main.c */
extern unsigned char *path_to_exe;
int attach_terminal(int, int, void *, int);
void program_exit();
void shrink_memory(int);
/* types.c */
struct assoc {
struct assoc *next;
struct assoc *prev;
tcount cnt;
unsigned char *label;
unsigned char *ct;
unsigned char *prog;
int cons;
int xwin;
int ask;
int system;
};
struct extension {
struct extension *next;
struct extension *prev;
tcount cnt;
unsigned char *ext;
unsigned char *ct;
};
extern struct list_head assoc;
extern struct list_head extensions;
unsigned char *get_content_type(unsigned char *, unsigned char *);
struct assoc *get_type_assoc(struct terminal *term, unsigned char *);
void update_assoc(struct assoc *);
void update_ext(struct extension *);
void free_types();
void menu_add_ct(struct terminal *, void *, void *);
void menu_del_ct(struct terminal *, void *, void *);
void menu_list_assoc(struct terminal *, void *, void *);
void menu_add_ext(struct terminal *, void *, void *);
void menu_del_ext(struct terminal *, void *, void *);
void menu_list_ext(struct terminal *, void *, void *);
/* session.c */
struct link_def {
unsigned char *link;
unsigned char *target;
};
struct line {
int l;
chr c;
chr *d;
};
struct point {
int x;
int y;
};
struct form {
int ctrl_num;
unsigned char *action;
int method;
};
#define FM_GET 0
#define FM_POST 1
#define FM_POST_MP 2
#define FC_TEXT 1
#define FC_PASSWORD 2
#define FC_FILE 3
#define FC_TEXTAREA 4
#define FC_CHECKBOX 5
#define FC_RADIO 6
#define FC_SELECT 7
#define FC_SUBMIT 8
#define FC_IMAGE 9
#define FC_RESET 10
#define FC_HIDDEN 11
struct form_control {
struct form_control *next;
struct form_control *prev;
int form_num;
int ctrl_num;
int g_ctrl_num;
int position;
int method;
unsigned char *action;
int type;
unsigned char *name;
unsigned char *alt;
int ro;
unsigned char *default_value;
int default_state;
int size;
int cols, rows, wrap;
int maxlength;
int nvalues;
unsigned char **values;
unsigned char **labels;
struct menu_item *menu;
};
struct form_state {
int form_num;
int ctrl_num;
int g_ctrl_num;
int position;
int type;
unsigned char *value;
int state;
int vpos;
int vypos;
};
struct link {
struct link *next;
struct link *prev;
int type;
unsigned char *where;
unsigned char *target;
unsigned char *where_img;
struct form_control *form;
unsigned sel_color;
int n;
struct point *pos;
};
#define L_LINK 0
#define L_BUTTON 1
#define L_CHECKBOX 2
#define L_SELECT 3
#define L_FIELD 4
#define L_AREA 5
#define SIZEOF_F_DATA (sizeof(struct f_data) > sizeof(struct f_frame) ? sizeof(struct f_data) : sizeof(struct f_frame))
struct link_bg {
int x, y;
unsigned c;
};
struct tag {
struct tag *next;
struct tag *prev;
int x;
int y;
unsigned char name[1];
};
struct rgb {
int r, g, b;
};
struct document_options {
int xw, yw; /* size of window */
int xp, yp; /* pos of window */
int col, cp, assume_cp;
int tables, frames, margin;
int plain;
struct rgb default_fg;
struct rgb default_bg;
struct rgb default_link;
struct rgb default_vlink;
unsigned char *framename;
};
struct node {
struct node *next;
struct node *prev;
int x, y;
int xw, yw;
};
struct search {
unsigned char c;
int x, y, n;
};
struct f_data {
struct f_data *next;
struct f_data *prev;
int refcount;
unsigned char *url;
struct document_options opt;
int cp, ass;
unsigned char *title;
int x, y; /* size of document */
ttime time_to_get;
tcount use_tag;
int frame;
int bg;
struct line *data;
struct link *links;
int nlinks;
struct link **lines1;
struct link **lines2;
struct list_head forms;
struct list_head tags;
struct list_head nodes;
struct search *search;
int nsearch;
struct search **slines1;
struct search **slines2;
};
struct f_frame {
struct f_data *next;
struct f_data *prev;
int refcount;
unsigned char *url;
int xw, yw;
int xp, yp;
int x, y;
int col;
ttime time_to_get;
tcount use_tag;
int frame;
int div;
int flag;
};
struct f_data_c {
struct f_data *f_data;
int xw, yw; /* size of window */
int xp, yp; /* pos of window */
int xl, yl; /* last pos of window */
struct link_bg *link_bg;
int link_bg_n;
unsigned char *search_word;
struct f_data *f1;
struct f_data *f2;
struct view_state *vs;
};
struct view_state {
int view_pos;
int view_posx;
int current_link;
int plain;
unsigned char *goto_position;
struct form_state *form_info;
int form_info_len;
struct f_data_c *f;
unsigned char url[1];
};
struct frame {
struct frame *next;
struct frame *prev;
unsigned char *name;
struct status stat;
struct view_state vs;
};
struct location {
struct location *next;
struct location *prev;
struct list_head frames;
struct status stat;
struct view_state vs;
};
#define WTD_NO 0
#define WTD_FORWARD 1
#define WTD_IMGMAP 2
#define WTD_RELOAD 3
#define WTD_BACK 4
#define cur_loc(x) ((struct location *)((x)->history.next))
struct kbdprefix {
int rep;
int rep_num;
int prefix;
};
struct download {
struct download *next;
struct download *prev;
unsigned char *url;
struct status stat;
unsigned char *file;
int last_pos;
int handle;
int redirect_cnt;
unsigned char *prog;
int prog_flags;
struct session *ses;
struct window *win;
struct window *ask;
};
extern struct list_head downloads;
struct session {
struct session *next;
struct session *prev;
struct list_head history;
struct terminal *term;
struct window *win;
int id;
struct f_data_c *screen;
struct status loading;
int wtd;
unsigned char *loading_url;
int display_timer;
unsigned char *goto_position;
unsigned char *imgmap_href_base;
unsigned char *imgmap_target_base;
int assume_cp;
struct kbdprefix kbdprefix;
int reloadlevel;
int redirect_cnt;
struct status tq;
unsigned char *tq_url;
struct cache_entry *tq_ce;
unsigned char *tq_goto_position;
unsigned char *tq_prog;
int tq_prog_flags;
unsigned char *dn_url;
unsigned char *search_word;
unsigned char *last_search_word;
int search_direction;
};
extern struct list_head sessions;
void print_screen_status(struct session *);
void print_error_dialog(struct session *, struct status *, unsigned char *);
void start_download(struct session *, unsigned char *);
void display_download(struct terminal *, struct download *, struct session *);
int read_session_info(int, struct session *, void *, int);
void *create_session_info(int, unsigned char *, int *);
void win_func(struct window *, struct event *, int);
void goto_url(struct session *, unsigned char *);
void goto_imgmap(struct session *, unsigned char *, unsigned char *, unsigned char *);
void go_back(struct session *);
void reload(struct session*, int);
void map_selected(struct terminal *, struct link_def *, struct session *);
void destroy_session(struct session *);
void destroy_all_sessions();
void abort_all_downloads();
/* bfu.c */
struct memory_list {
int n;
void *p[1];
};
struct memory_list *getml(void *, ...);
void add_to_ml(struct memory_list **, ...);
void freeml(struct memory_list *);
#define MENU_FUNC (void (*)(struct terminal *, void *, void *))
#define M_BAR '\001'
struct menu_item {
unsigned char *text;
unsigned char *rtext;
unsigned char hotkey;
void (*func)(struct terminal *, void *, void *);
void *data;
int in_m;
int free_i;
};
struct menu {
int selected;
int view;
int xp, yp;
int x, y, xw, yw;
int ni;
void *data;
struct window *win;
struct menu_item *items;
};
struct mainmenu {
int selected;
int sp;
int ni;
void *data;
struct window *win;
struct menu_item *items;
};
struct history_item {
struct history_item *next;
struct history_item *prev;
unsigned char d[1];
};
struct history {
int n;
struct list_head items;
};
#define D_END 0
#define D_CHECKBOX 1
#define D_FIELD 2
#define D_BUTTON 3
#define B_ENTER 1
#define B_ESC 2
struct dialog_item_data;
struct dialog_data;
struct dialog_item {
int type;
int gid, gnum; /* for buttons: gid - flags B_XXX */ /* for fields: min/max */
int (*fn)(struct dialog_data *, struct dialog_item_data *);
struct history *history;
int dlen;
unsigned char *data;
void *udata;
};
struct dialog_item_data {
int x, y, l;
int vpos, cpos;
int checked;
struct dialog_item *item;
struct list_head history;
struct history_item *cur_hist;
unsigned char *cdata;
};
struct dialog {
unsigned char *title;
void (*fn)(struct dialog_data *);
void (*abort)(struct dialog_data *);
void *udata;
void *udata2;
int align;
void (*refresh)(void *);
void *refresh_data;
struct dialog_item items[1];
};
struct dialog_data {
struct window *win;
struct dialog *dlg;
int x, y, xw, yw;
int n;
int selected;
struct memory_list *ml;
struct dialog_item_data items[1];
};
struct menu_item *new_menu(int);
void add_to_menu(struct menu_item **, unsigned char *, unsigned char *, unsigned char, void (*)(struct terminal *, void *, void *), void *, int);
void do_menu(struct terminal *, struct menu_item *, void *);
void do_menu_selected(struct terminal *, struct menu_item *, void *, int);
void do_mainmenu(struct terminal *, struct menu_item *, void *, int);
void do_dialog(struct terminal *, struct dialog *, struct memory_list *);
int check_number(struct dialog_data *, struct dialog_item_data *);
int check_nonempty(struct dialog_data *, struct dialog_item_data *);
void max_text_width(unsigned char *, int *);
void min_text_width(unsigned char *, int *);
void dlg_format_text(struct terminal *, unsigned char *, int, int *, int, int *, int, int);
void max_buttons_width(struct dialog_item_data *, int, int *);
void min_buttons_width(struct dialog_item_data *, int, int *);
void dlg_format_buttons(struct terminal *, struct dialog_item_data *, int, int, int *, int, int *, int);
void checkboxes_width(unsigned char **, int *, void (*)(unsigned char *, int *));
void dlg_format_checkbox(struct terminal *, struct dialog_item_data *, int, int *, int, int *, unsigned char *);
void dlg_format_checkboxes(struct terminal *, struct dialog_item_data *, int, int, int *, int, int *, unsigned char **);
void dlg_format_field(struct terminal *, struct dialog_item_data *, int, int *, int, int *, int);
void max_group_width(unsigned char **, struct dialog_item_data *, int, int *);
void min_group_width(unsigned char **, struct dialog_item_data *, int, int *);
void dlg_format_group(struct terminal *, unsigned char **, struct dialog_item_data *, int, int, int *, int, int *);
void checkbox_list_fn(struct dialog_data *);
void group_fn(struct dialog_data *);
void center_dlg(struct dialog_data *);
void draw_dlg(struct dialog_data *);
int ok_dialog(struct dialog_data *, struct dialog_item_data *);
int cancel_dialog(struct dialog_data *, struct dialog_item_data *);
void msg_box(struct terminal *, struct memory_list *, unsigned char *, int, unsigned char *, void *, int , ...);
void input_field(struct terminal *, struct memory_list *, unsigned char *, unsigned char *, unsigned char *, unsigned char *, void *, struct history *, int, unsigned char *, void (*)(void *, unsigned char *), void (*)(void *));
/* menu.c */
void activate_bfu_technology(struct session *, int);
void dialog_goto_url(struct session *ses);
void dialog_save_url(struct session *ses);
void free_history_lists();
void query_file(struct session *, unsigned char *, void (*)(struct session *, unsigned char *), void (*)(struct session *));
void search_dlg(struct session *, struct f_data_c *, int);
void search_back_dlg(struct session *, struct f_data_c *, int);
void exit_prog(struct terminal *, void *, struct session *);
/* charsets.c */
struct conv_table {
int t;
union {
unsigned char *str;
struct conv_table *tbl;
} u;
};
struct conv_table *get_translation_table(int, int);
unsigned char *get_entity_string(unsigned char *, int, int);
unsigned char *convert_string(struct conv_table *, unsigned char *, int);
int get_cp_index(unsigned char *n);
unsigned char *get_cp_name(int);
unsigned char *get_cp_mime_name(int);
int is_cp_special(int);
void free_conv_table();
/* view.c */
void destroy_fc(struct form_control *);
void sort_links(struct f_data *);
void destroy_formatted(struct f_data *);
void clear_formatted(struct f_data *);
void init_formatted(struct f_data *);
void detach_formatted(struct f_data_c *);
void init_vs(struct view_state *, unsigned char *);
void destroy_vs(struct view_state *);
void draw_doc(struct terminal *, struct f_data_c *);
void draw_formatted(struct session *);
void send_event(struct session *, struct event *);
void link_menu(struct terminal *, void *, struct session *);
void save_as(struct terminal *, void *, struct session *);
void save_url(struct session *, unsigned char *);
void selected_item(struct terminal *, void *, struct session *);
void toggle(struct session *, struct f_data_c *, int);
void do_for_frame(struct session *, void (*)(struct session *, struct f_data_c *, int), int);
int get_current_state(struct session *);
unsigned char *print_current_link(struct session *);
unsigned char *print_current_title(struct session *);
void loc_msg(struct terminal *, struct location *);
void state_msg(struct session *);
void search_for(struct session *, unsigned char *);
void search_for_back(struct session *, unsigned char *);
void find_next(struct session *, struct f_data_c *, int);
void find_next_back(struct session *, struct f_data_c *, int);
/* html.c */
#define AT_BOLD 1
#define AT_ITALIC 2
#define AT_UNDERLINE 4
#define AT_FIXED 8
#define AT_GRAPHICS 16
#define AL_LEFT 0
#define AL_CENTER 1
#define AL_RIGHT 2
#define AL_BLOCK 3
#define AL_NO 4
struct text_attrib {
int attr;
struct rgb fg;
struct rgb bg;
int fontsize;
unsigned char *link;
unsigned char *target;
unsigned char *image;
struct form_control *form;
struct rgb clink;
struct rgb vlink;
unsigned char *href_base;
unsigned char *target_base;
unsigned char *select;
int select_disabled;
};
#define P_NUMBER 1
#define P_alpha 2
#define P_ALPHA 3
#define P_roman 4
#define P_ROMAN 5
#define P_STAR 1
#define P_O 2
#define P_PLUS 3
#define P_LISTMASK 7
#define P_COMPACT 8
struct par_attrib {
int align;
int leftmargin;
int rightmargin;
int width;
int list_level;
unsigned list_number;
int dd_margin;
int flags;
struct rgb bgcolor;
};
struct html_element {
struct html_element *next;
struct html_element *prev;
struct text_attrib attr;
struct par_attrib parattr;
int invisible;
unsigned char *name;
int namelen;
unsigned char *options;
int linebreak;
int dontkill;
};
extern struct list_head html_stack;
extern int line_breax;
extern unsigned char *startf;
extern unsigned char *eofff;
#define format (((struct html_element *)html_stack.next)->attr)
#define par_format (((struct html_element *)html_stack.next)->parattr)
#define html_top (*(struct html_element *)html_stack.next)
extern void *ff;
extern void (*put_chars_f)(void *, unsigned char *, int);
extern void (*line_break_f)(void *);
extern void (*init_f)(void *);
extern void *(*special_f)(void *, int, ...);
void ln_break(int, void (*)(void *), void *);
void put_chrs(unsigned char *, int, void (*)(void *, unsigned char *, int), void *);
extern int table_level;
extern int empty_format;
extern int form_num;
extern int g_ctrl_num;
extern struct form form;
int parse_element(unsigned char *, unsigned char *, unsigned char **, int *, unsigned char **, unsigned char **);
unsigned char *get_attr_val(unsigned char *, unsigned char *);
int has_attr(unsigned char *, unsigned char *);
int get_num(unsigned char *, unsigned char *);
int get_width(unsigned char *, unsigned char *, int);
int get_color(unsigned char *, unsigned char *, struct rgb *);
int get_bgcolor(unsigned char *, struct rgb *);
void html_stack_dup();
void kill_html_stack_item(struct html_element *);
unsigned char *skip_comment(unsigned char *, unsigned char *);
void parse_html(unsigned char *, unsigned char *, void (*)(void *, unsigned char *, int), void (*)(void *), void (*)(void *), void *(*)(void *, int, ...), void *, unsigned char *);
int get_image_map(unsigned char *, unsigned char *, unsigned char *, unsigned char *a, struct menu_item **, struct memory_list **, unsigned char *, unsigned char *, int, int);
void scan_http_equiv(unsigned char *, unsigned char *, unsigned char **, int *, unsigned char **);
#define SP_TAG 0
#define SP_CONTROL 1
#define SP_TABLE 2
#define SP_USED 3
void free_menu(struct menu_item *);
void do_select_submenu(struct terminal *, struct menu_item *, struct session *);
/* html-r.c */
struct part {
int x, y;
int xp, yp;
int xmax;
int xa;
int cx, cy;
struct f_data *data;
int bgcolor;
unsigned char *spaces;
int spl;
};
struct sizes {
int xmin, xmax, y;
};
extern struct document_options *d_opt;
extern int last_link_to_move;
extern int margin;
int xxpand_line(struct part *, int, int);
int xxpand_lines(struct part *, int);
void xset_hchar(struct part *, int, int, unsigned);
void xset_hchars(struct part *, int, int, int, unsigned);
void align_line(struct part *, int);
struct conv_table *get_convert_table(unsigned char *, int, int, int *, int *);
extern int format_cache_entries;
long formatted_info(int);
void shrink_format_cache(int);
void count_format_cache();
void delete_unused_format_cache_entries();
struct part *format_html_part(unsigned char *, unsigned char *, int, int, int, struct f_data *, int, int, unsigned char *);
void html_interpret(struct session *);
void get_search_data(struct f_data *);
/* html-tbl.c */
void format_table(unsigned char *, unsigned char *, unsigned char *, unsigned char **, void *);
/* default.c */
#define MAX_STR_LEN 1024
unsigned char *parse_options(int, unsigned char *[]);
void init_home();
void load_config();
void write_config(struct terminal *);
void end_config();
extern unsigned char system_name[];
extern unsigned char *links_home;
extern int first_use;
extern unsigned char *config_file;
extern int created_cfg;
extern int async_lookup;
extern int max_connections;
extern int max_connections_to_host;
extern int max_tries;
extern int receive_timeout;
extern int unrestartable_receive_timeout;
extern int max_format_cache_entries;
extern long memory_cache_size;
extern int enable_html_tables;
extern int enable_html_frames;
extern int display_images;
extern int assume_cp;
extern struct rgb default_fg;
extern struct rgb default_bg;
extern struct rgb default_link;
extern struct rgb default_vlink;
extern int default_left_margin;
extern unsigned char http_proxy[];
extern unsigned char ftp_proxy[];
extern unsigned char download_dir[];
extern int bug_302_redirect;
extern int bug_post_no_keepalive;
|