Commit 2a4bf00694016189e8de8646561a6e44bcb1a336

Authored by perry.werneck@gmail.com
1 parent c9bcffc4

Removendo funções sem uso, atualizando tradução

Showing 4 changed files with 77 additions and 70 deletions   Show diff stats
iocalls.c
... ... @@ -55,7 +55,7 @@ static void * internal_add_input(int source, H3270 *session, void (*fn)(H3270 *s
55 55 static void * internal_add_output(int source, H3270 *session, void (*fn)(H3270 *session));
56 56 static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 *session));
57 57  
58   -static int internal_callthread(int(*callback)(H3270 *, void *), H3270 *session, void *parm);
  58 +// static int internal_callthread(int(*callback)(H3270 *, void *), H3270 *session, void *parm);
59 59 static int internal_wait(H3270 *hSession, int seconds);
60 60  
61 61 static int internal_event_dispatcher(H3270 *hSession, int block);
... ... @@ -81,8 +81,8 @@ static void internal_ring_bell(H3270 *);
81 81 static void * (*add_except)(int source, H3270 *session, void (*fn)(H3270 *session))
82 82 = internal_add_except;
83 83  
84   - static int (*callthread)(int(*callback)(H3270 *, void *), H3270 *session, void *parm)
85   - = internal_callthread;
  84 +// static int (*callthread)(int(*callback)(H3270 *, void *), H3270 *session, void *parm)
  85 +// = internal_callthread;
86 86  
87 87 static int (*wait)(H3270 *hSession, int seconds)
88 88 = internal_wait;
... ... @@ -621,10 +621,12 @@ retry:
621 621  
622 622 }
623 623  
  624 +/*
624 625 static int internal_callthread(int(*callback)(H3270 *, void *), H3270 *session, void *parm)
625 626 {
626 627 return callback(session,parm);
627 628 }
  629 +*/
628 630  
629 631 static int internal_wait(H3270 *hSession, int seconds)
630 632 {
... ... @@ -755,8 +757,8 @@ LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk
755 757 if(cbk->AddExcept)
756 758 add_except = cbk->AddExcept;
757 759  
758   - if(cbk->callthread)
759   - callthread = cbk->callthread;
  760 +// if(cbk->callthread)
  761 +// callthread = cbk->callthread;
760 762  
761 763 if(cbk->Wait)
762 764 wait = cbk->Wait;
... ... @@ -771,6 +773,7 @@ LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk
771 773  
772 774 }
773 775  
  776 +/*
774 777 LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 *h, void *parm)
775 778 {
776 779 int rc;
... ... @@ -786,6 +789,7 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 *
786 789  
787 790 return rc;
788 791 }
  792 +*/
789 793  
790 794 LIB3270_EXPORT void lib3270_main_iterate(H3270 *hSession, int block)
791 795 {
... ...
proxy.c
... ... @@ -694,15 +694,15 @@ static int proxy_socks4(H3270 *hSession, int fd, char *host, unsigned short port
694 694 }
695 695 #endif // HAVE_GETADDRINFO
696 696  
697   -/* SOCKS version 5 (RFC 1928) proxy. */
  697 +/* SOCKS version 5 (RFC 1928) proxy. */ /*
698 698 static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port, int force_d)
699 699 {
700 700 union {
701 701 struct sockaddr sa;
702 702 struct sockaddr_in sin;
703   -#if defined(AF_INET6) /*[*/
  703 +#if defined(AF_INET6)
704 704 struct sockaddr_in6 sin6;
705   -#endif /*]*/
  705 +#endif
706 706 } ha;
707 707 socklen_t ha_len = 0;
708 708 int use_name = 0;
... ... @@ -715,7 +715,7 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port
715 715 char nbuf[256];
716 716 int done = 0;
717 717  
718   -#if defined(X3270_TRACE) /*[*/
  718 +#if defined(X3270_TRACE)
719 719 const char *atype_name[] =
720 720 {
721 721 "",
... ... @@ -725,7 +725,7 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port
725 725 "IPv6"
726 726 };
727 727 unsigned char *portp;
728   -#endif /*]*/
  728 +#endif
729 729 unsigned short rport;
730 730  
731 731 if (force_d)
... ... @@ -734,7 +734,7 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port
734 734 char errmsg[1024];
735 735 int rv;
736 736  
737   - /* Resolve the hostname. */
  737 + // Resolve the hostname.
738 738 rv = resolve_host_and_port(hSession,host, CN, &rport, &ha.sa, &ha_len,errmsg, sizeof(errmsg));
739 739 if (rv == -2)
740 740 use_name = 1;
... ... @@ -744,22 +744,22 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port
744 744 }
745 745 }
746 746  
747   - /* Send the authentication request to the server. */
  747 + // Send the authentication request to the server.
748 748 strcpy((char *)rbuf, "\005\001\000");
749   -#if defined(X3270_TRACE) /*[*/
  749 +#if defined(X3270_TRACE)
750 750 trace_dsn(hSession,_("SOCKS5 Proxy: xmit version 5 nmethods 1 (no auth)\n"));
751 751 trace_netdata(hSession, '>', rbuf, 3);
752   -#endif /*]*/
  752 +#endif
753 753 if (send(fd, (const char *) rbuf, 3, 0) < 0)
754 754 {
755 755 popup_a_sockerr(hSession,_("SOCKS5 Proxy: send error"));
756 756 return -1;
757 757 }
758 758  
759   - /*
760   - * Wait for the server reply.
761   - * Read 2 bytes of response.
762   - */
  759 + //
  760 + // Wait for the server reply.
  761 + // Read 2 bytes of response.
  762 + //
763 763 nread = 0;
764 764 for (;;) {
765 765 fd_set rfds;
... ... @@ -772,10 +772,10 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port
772 772 if (select(fd + 1, &rfds, NULL, NULL, &tv) < 0)
773 773 {
774 774 popup_an_error(hSession,_("SOCKS5 Proxy: server timeout"));
775   -#if defined(X3270_TRACE) /*[*/
  775 +#if defined(X3270_TRACE)
776 776 if (nread)
777 777 trace_netdata(hSession, '<', rbuf, nread);
778   -#endif /*]*/
  778 +#endif
779 779 return -1;
780 780 }
781 781  
... ... @@ -783,28 +783,28 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port
783 783 if (nr < 0)
784 784 {
785 785 popup_a_sockerr(hSession,_("SOCKS5 Proxy: receive error"));
786   -#if defined(X3270_TRACE) /*[*/
  786 +#if defined(X3270_TRACE)
787 787 if (nread)
788 788 trace_netdata(hSession, '<', rbuf, nread);
789   -#endif /*]*/
  789 +#endif
790 790 return -1;
791 791 }
792 792 if (nr == 0)
793 793 {
794 794 popup_a_sockerr(hSession,_("SOCKS5 Proxy: unexpected EOF"));
795   -#if defined(X3270_TRACE) /*[*/
  795 +#if defined(X3270_TRACE)
796 796 if (nread)
797 797 trace_netdata(hSession, '<', rbuf, nread);
798   -#endif /*]*/
  798 +#endif
799 799 return -1;
800 800 }
801 801 if (++nread >= 2)
802 802 break;
803 803 }
804 804  
805   -#if defined(X3270_TRACE) /*[*/
  805 +#if defined(X3270_TRACE)
806 806 trace_netdata(hSession, '<', rbuf, nread);
807   -#endif /*]*/
  807 +#endif
808 808  
809 809 if (rbuf[0] != 0x05 || (rbuf[1] != 0 && rbuf[1] != 0xff))
810 810 {
... ... @@ -812,9 +812,9 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port
812 812 return -1;
813 813 }
814 814  
815   -#if defined(X3270_TRACE) /*[*/
  815 +#if defined(X3270_TRACE)
816 816 trace_dsn(hSession,"SOCKS5 Proxy: recv version %d method %d\n", rbuf[0],rbuf[1]);
817   -#endif /*]*/
  817 +#endif
818 818  
819 819 if (rbuf[1] == 0xff)
820 820 {
... ... @@ -822,40 +822,40 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port
822 822 return -1;
823 823 }
824 824  
825   - /* Send the request to the server. */
  825 + // Send the request to the server.
826 826 buf = lib3270_malloc(32 + strlen(host));
827 827 s = buf;
828   - *s++ = 0x05; /* protocol version 5 */
829   - *s++ = 0x01; /* CONNECT */
830   - *s++ = 0x00; /* reserved */
  828 + *s++ = 0x05; // protocol version 5
  829 + *s++ = 0x01; // CONNECT
  830 + *s++ = 0x00; // reserved
831 831 if (use_name) {
832   - *s++ = 0x03; /* domain name */
  832 + *s++ = 0x03; // domain name
833 833 *s++ = strlen(host);
834 834 strcpy(s, host);
835 835 s += strlen(host);
836 836 } else if (ha.sa.sa_family == AF_INET) {
837   - *s++ = 0x01; /* IPv4 */
  837 + *s++ = 0x01; // IPv4
838 838 memcpy(s, &ha.sin.sin_addr, 4);
839 839 s += 4;
840 840 strcpy(nbuf, inet_ntoa(ha.sin.sin_addr));
841   -#if defined(AF_INET6) /*[*/
  841 +#if defined(AF_INET6)
842 842 } else {
843   - *s++ = 0x04; /* IPv6 */
  843 + *s++ = 0x04; // IPv6
844 844 memcpy(s, &ha.sin6.sin6_addr, sizeof(struct in6_addr));
845 845 s += sizeof(struct in6_addr);
846 846 (void) inet_ntop(AF_INET6, &ha.sin6.sin6_addr, nbuf, sizeof(nbuf));
847   -#endif /*]*/
  847 +#endif
848 848 }
849 849 SET16(s, port);
850 850  
851   -#if defined(X3270_TRACE) /*[*/
  851 +#if defined(X3270_TRACE)
852 852 trace_dsn(hSession,"SOCKS5 Proxy: xmit version 5 connect %s %s port %u\n",
853 853 use_name? "domainname":
854 854 ((ha.sa.sa_family == AF_INET)? "IPv4": "IPv6"),
855 855 use_name? host: nbuf,
856 856 port);
857 857 trace_netdata(hSession, '>', (unsigned char *)buf, s - buf);
858   -#endif /*]*/
  858 +#endif
859 859  
860 860 if (send(fd, buf, s - buf, 0) < 0) {
861 861 popup_a_sockerr(hSession,_("SOCKS5 Proxy: send error"));
... ... @@ -864,11 +864,11 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port
864 864 }
865 865 lib3270_free(buf);
866 866  
867   - /*
868   - * Process the reply.
869   - * Only the first two bytes of the response are interesting;
870   - * skip the rest.
871   - */
  867 + //
  868 + // Process the reply.
  869 + // Only the first two bytes of the response are interesting;
  870 + // skip the rest.
  871 + //
872 872 nread = 0;
873 873 done = 0;
874 874 buf = NULL;
... ... @@ -892,19 +892,19 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port
892 892 if (nr < 0)
893 893 {
894 894 popup_a_sockerr(hSession,_("SOCKS5 Proxy: receive error"));
895   -#if defined(X3270_TRACE) /*[*/
  895 +#if defined(X3270_TRACE)
896 896 if (nread)
897 897 trace_netdata(hSession, '<', (unsigned char *)buf, nread);
898   -#endif /*]*/
  898 +#endif
899 899 return -1;
900 900 }
901 901 if (nr == 0)
902 902 {
903 903 popup_an_error(hSession, _("SOCKS5 Proxy: unexpected EOF"));
904   -#if defined(X3270_TRACE) /*[*/
  904 +#if defined(X3270_TRACE)
905 905 if (nread)
906 906 trace_netdata(hSession, '<', (unsigned char *)buf, nread);
907   -#endif /*]*/
  907 +#endif
908 908 return -1;
909 909 }
910 910  
... ... @@ -916,18 +916,18 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port
916 916 if (r != 0x05)
917 917 {
918 918 popup_an_error(hSession, _("SOCKS5 Proxy: incorrect reply version 0x%02x"), r);
919   -#if defined(X3270_TRACE) /*[*/
  919 +#if defined(X3270_TRACE)
920 920 if (nread)
921 921 trace_netdata(hSession, '<', (unsigned char *)buf, nread);
922   -#endif /*]*/
  922 +#endif
923 923 return -1;
924 924 }
925 925 break;
926 926 case 1:
927   -#if defined(X3270_TRACE) /*[*/
  927 +#if defined(X3270_TRACE)
928 928 if (r != 0x00)
929 929 trace_netdata(hSession, '<', (unsigned char *)buf, nread);
930   -#endif /*]*/
  930 +#endif
931 931 switch (r)
932 932 {
933 933 case 0x00:
... ... @@ -973,17 +973,17 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port
973 973 case 0x03:
974 974 n2read = -1;
975 975 break;
976   -#if defined(AF_INET6) /*[*/
  976 +#if defined(AF_INET6)
977 977 case 0x04:
978 978 n2read = sizeof(struct in6_addr) + 2;
979 979 break;
980   -#endif /*]*/
  980 +#endif
981 981 default:
982 982 popup_an_error(hSession, _("SOCKS5 Proxy: unknown server address type 0x%02x"), r);
983   -#if defined(X3270_TRACE) /*[*/
  983 +#if defined(X3270_TRACE)
984 984 if (nread)
985 985 trace_netdata(hSession, '<', (unsigned char *)buf, nread);
986   -#endif /*]*/
  986 +#endif
987 987 return -1;
988 988 }
989 989 break;
... ... @@ -996,29 +996,29 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port
996 996 }
997 997 }
998 998  
999   -#if defined(X3270_TRACE) /*[*/
  999 +#if defined(X3270_TRACE)
1000 1000 trace_netdata(hSession, '<', (unsigned char *)buf, nread);
1001 1001 switch (buf[3]) {
1002   - case 0x01: /* IPv4 */
  1002 + case 0x01: // IPv4
1003 1003 memcpy(&ha.sin.sin_addr, &buf[4], 4);
1004 1004 strcpy(nbuf, inet_ntoa(ha.sin.sin_addr));
1005 1005 portp = (unsigned char *)&buf[4 + 4];
1006 1006 break;
1007   - case 0x03: /* domainname */
  1007 + case 0x03: // domainname
1008 1008 strncpy(nbuf, &buf[5], buf[4]);
1009 1009 nbuf[(unsigned char)buf[4]] = '\0';
1010 1010 portp = (unsigned char *)&buf[5 + (unsigned char)buf[4]];
1011 1011 break;
1012   -#if defined(AF_INET6) /*[*/
1013   - case 0x04: /* IPv6 */
  1012 +#if defined(AF_INET6)
  1013 + case 0x04: // IPv6
1014 1014 memcpy(&ha.sin6.sin6_addr, &buf[4], sizeof(struct in6_addr));
1015 1015 (void) inet_ntop(AF_INET6, &ha.sin6.sin6_addr, nbuf,
1016 1016 sizeof(nbuf));
1017 1017 portp = (unsigned char *)&buf[4 + sizeof(struct in6_addr)];
1018 1018 break;
1019   -#endif /*]*/
  1019 +#endif
1020 1020 default:
1021   - /* can't happen */
  1021 + // can't happen
1022 1022 nbuf[0] = '\0';
1023 1023 portp = (unsigned char *)buf;
1024 1024 break;
... ... @@ -1029,8 +1029,9 @@ static int proxy_socks5(H3270 *hSession, int fd, char *host, unsigned short port
1029 1029 atype_name[(unsigned char)buf[3]],
1030 1030 nbuf,
1031 1031 rport);
1032   -#endif /*]*/
  1032 +#endif
1033 1033 lib3270_free(buf);
1034 1034  
1035 1035 return 0;
1036 1036 }
  1037 +*/
... ...
resolver.c
... ... @@ -83,7 +83,7 @@ struct parms
83 83 * Resolve a hostname and port.
84 84 * Returns 0 for success, -1 for fatal error (name resolution impossible),
85 85 * -2 for simple error (cannot resolve the name).
86   - */
  86 + */ /*
87 87 static int cresolve_host_and_port(H3270 *h, struct parms *p)
88 88 {
89 89 #if defined( HAVE_GETADDRINFO ) || defined(WIN32)
... ... @@ -91,7 +91,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p)
91 91 struct addrinfo hints, *res;
92 92 int rc;
93 93  
94   - /* Use getaddrinfo() to resolve the hostname and port together. */
  94 + // Use getaddrinfo() to resolve the hostname and port together.
95 95 (void) memset(&hints, '\0', sizeof(struct addrinfo));
96 96 hints.ai_flags = 0;
97 97 hints.ai_family = PF_UNSPEC;
... ... @@ -138,7 +138,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p)
138 138 char *ptr;
139 139 struct sockaddr_in *sin = (struct sockaddr_in *) p->sa;
140 140  
141   - /* Get the port number. */
  141 + // Get the port number.
142 142 lport = strtoul(p->portname, &ptr, 0);
143 143 if (ptr == p->portname || *ptr != '\0' || lport == 0L || lport & ~0xffff)
144 144 {
... ... @@ -155,7 +155,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p)
155 155 }
156 156 *p->pport = ntohs(port);
157 157  
158   - /* Use gethostbyname() to resolve the hostname. */
  158 + // Use gethostbyname() to resolve the hostname.
159 159 hp = gethostbyname(p->host);
160 160 if (hp == (struct hostent *) 0)
161 161 {
... ... @@ -178,8 +178,9 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p)
178 178 #endif // HAVE_GETADDRINFO
179 179  
180 180 return 0;
181   -}
  181 +} */
182 182  
  183 +/*
183 184 int resolve_host_and_port(H3270 *hSession, const char *host, char *portname, unsigned short *pport,struct sockaddr *sa, socklen_t *sa_len, char *errmsg, int em_len)
184 185 {
185 186 int rc;
... ... @@ -203,3 +204,4 @@ int resolve_host_and_port(H3270 *hSession, const char *host, char *portname, uns
203 204 return rc;
204 205  
205 206 }
  207 +*/
... ...
resolverc.h
... ... @@ -17,6 +17,6 @@
17 17 * Hostname resolution.
18 18 */
19 19  
20   -LIB3270_INTERNAL int resolve_host_and_port(H3270 *session, const char *host, char *portname, unsigned short *pport,struct sockaddr *sa, socklen_t *sa_len, char *errmsg, int em_size);
  20 +// LIB3270_INTERNAL int resolve_host_and_port(H3270 *session, const char *host, char *portname, unsigned short *pport,struct sockaddr *sa, socklen_t *sa_len, char *errmsg, int em_size);
21 21  
22 22  
... ...