Commit b9fdc4bdbd03219085227a9b6f7f8ae48839b933

Authored by perry.werneck@gmail.com
1 parent 87cfcc55

Arquivos a transferir devem sempre ser abertos com modo binário no windows

Makefile.in
... ... @@ -52,7 +52,7 @@ BINDIR=.bin
52 52 EXEEXT=@EXEEXT@
53 53 DBGLIB=-L../../$(BINDIR)/Debug@DLLDIR@ -l3270
54 54 RLSLIB=-L../../$(BINDIR)/Release@DLLDIR@ -l3270
55   -TMPDIR=.tmp
  55 +TMPDIR ?= .tmp
56 56 GLOBAL_DEPS=$(PWD)/include/*.h $(PWD)/include/lib3270/*.h
57 57 LANG_FILES=$(wildcard po/*.po)
58 58  
... ... @@ -116,6 +116,7 @@ po/%.po: $(PACKAGE_NAME).po
116 116 @cp $@ $(TMPDIR)/$@ 2> $(TMPDIR)/cp.err > $(TMPDIR)/cp.out || true
117 117 @touch $(TMPDIR)/$@
118 118 @$(MSGMERGE) $(TMPDIR)/$@ $(PACKAGE_NAME).po --output-file=$@
  119 + @rm -fr $(TMPDIR)/po
119 120  
120 121 $(BINDIR)/Release/$(localedir)/%/LC_MESSAGES/$(PACKAGE_NAME).mo: po/%.po
121 122 @echo " FMT `basename $@`"
... ...
po/pt_BR.po
... ... @@ -5,7 +5,7 @@ msgid ""
5 5 msgstr ""
6 6 "Project-Id-Version: pw3270 5.0\n"
7 7 "Report-Msgid-Bugs-To: \n"
8   -"POT-Creation-Date: 2012-12-26 10:34-0200\n"
  8 +"POT-Creation-Date: 2012-12-26 11:20-0200\n"
9 9 "PO-Revision-Date: 2012-12-26 10:36-0200\n"
10 10 "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n"
11 11 "Language-Team: Português <>\n"
... ... @@ -268,7 +268,7 @@ msgstr &quot;Não posso aceitar elemento %s sem nome&quot;
268 268 msgid "Can't connect to %s:%d"
269 269 msgstr "Não foi possível conectar a %s:%d"
270 270  
271   -#: host.c:316
  271 +#: host.c:154
272 272 msgid "Can't connect to host"
273 273 msgstr "Não foi possível conectar ao servidor"
274 274  
... ... @@ -281,7 +281,7 @@ msgstr &quot;Não foi possível converter a linha %d de %s para %s&quot;
281 281 msgid "Can't cut rectangular regions"
282 282 msgstr "Recortar não permitido em seleção retangular"
283 283  
284   -#: ft.c:307
  284 +#: ft.c:311
285 285 msgid "Can't get file size"
286 286 msgstr "Não foi possível obter o tamanho do arquivo"
287 287  
... ... @@ -294,7 +294,7 @@ msgstr &quot;Não foi possível carregar %s&quot;
294 294 msgid "Can't load file"
295 295 msgstr "Não foi possível carregar arquivo"
296 296  
297   -#: ft.c:226
  297 +#: ft.c:230
298 298 msgid "Can't open local file"
299 299 msgstr "Não foi possível abrir arquivo local"
300 300  
... ... @@ -511,15 +511,15 @@ msgstr &quot;EOR recebido fora do modo 3270, ignorado.&quot;
511 511 msgid "ET_A"
512 512 msgstr "ET_A"
513 513  
514   -#: host.c:340
  514 +#: host.c:178
515 515 msgid "Empty LU name"
516 516 msgstr "Nome da LU está em branco"
517 517  
518   -#: host.c:267 host.c:394
  518 +#: host.c:105 host.c:232
519 519 msgid "Empty hostname"
520 520 msgstr "Nome do servidor em branco"
521 521  
522   -#: host.c:447
  522 +#: host.c:285
523 523 msgid "Empty port name"
524 524 msgstr "Porta em branco"
525 525  
... ... @@ -675,7 +675,7 @@ msgstr &quot;HTTP Proxy: Resposta desconhecida&quot;
675 675 msgid "Help"
676 676 msgstr "Ajuda"
677 677  
678   -#: ft.c:524
  678 +#: ft.c:528
679 679 msgid "Host disconnected, transfer cancelled"
680 680 msgstr "Servidor desconectou, transferência cancelada"
681 681  
... ... @@ -707,8 +707,8 @@ msgstr &quot;Tipo do sistema no servidor&quot;
707 707 msgid "Host to connect"
708 708 msgstr "Servidor a conectar"
709 709  
710   -#: host.c:315 host.c:340 host.c:352 host.c:378 host.c:390 host.c:394
711   -#: host.c:447 host.c:462
  710 +#: host.c:153 host.c:178 host.c:190 host.c:216 host.c:228 host.c:232
  711 +#: host.c:285 host.c:300
712 712 msgid "Hostname syntax error"
713 713 msgstr "Formato inválido no nome do servidor"
714 714  
... ... @@ -740,7 +740,7 @@ msgstr &quot;Intensificado/Protegido&quot;
740 740 msgid "Intensified/Unprotected"
741 741 msgstr "Intensificado/Desprotegido"
742 742  
743   -#: host.c:496
  743 +#: host.c:334
744 744 msgid "Invalid (empty) hostname"
745 745 msgstr "Nome do host é invalido (vazio)"
746 746  
... ... @@ -791,7 +791,7 @@ msgstr &quot;Barra lateral&quot;
791 791 msgid "Misc colors"
792 792 msgstr "Cores diversas"
793 793  
794   -#: host.c:390
  794 +#: host.c:228
795 795 msgid "Missing ']'"
796 796 msgstr "Faltando ']'"
797 797  
... ... @@ -812,7 +812,7 @@ msgstr &quot;Monocromático&quot;
812 812 msgid "Move action needs target & direction attributes"
813 813 msgstr "Ação \"move\" precisa dos atributos \"target\" e \"direction\""
814 814  
815   -#: host.c:462
  815 +#: host.c:300
816 816 msgid "Multiple port names"
817 817 msgstr "Múltiplos nomes de porta"
818 818  
... ... @@ -852,7 +852,7 @@ msgstr &quot;Normal/Desprotegido&quot;
852 852 msgid "Not available"
853 853 msgstr "Não disponível"
854 854  
855   -#: ft.c:531
  855 +#: ft.c:535
856 856 msgid "Not in 3270 mode, transfer cancelled"
857 857 msgstr "Não está no modo 3270, transferência cancelada"
858 858  
... ... @@ -876,7 +876,7 @@ msgstr &quot;Estado inválido na OIA&quot;
876 876 msgid "OIA status ok"
877 877 msgstr "Estado normal na OIA"
878 878  
879   -#: host.c:317
  879 +#: host.c:155
880 880 #, c-format
881 881 msgid "Option '%c:' is not supported"
882 882 msgstr "Opção não suportada: '%c:'"
... ... @@ -1342,7 +1342,7 @@ msgstr &quot;Erro de leitura SSL&quot;
1342 1342 msgid "SSL connect failed!"
1343 1343 msgstr "Conexão SSL falhou"
1344 1344  
1345   -#: host.c:302
  1345 +#: host.c:140
1346 1346 msgid "SSL error"
1347 1347 msgstr "Erro SSL"
1348 1348  
... ... @@ -1491,7 +1491,7 @@ msgstr &quot;Erro ao enviar dados para a rede&quot;
1491 1491 msgid "Space allocation units"
1492 1492 msgstr "Space allocation units"
1493 1493  
1494   -#: host.c:352
  1494 +#: host.c:190
1495 1495 msgid "Space in LU name"
1496 1496 msgstr "Espaço no nome da LU"
1497 1497  
... ... @@ -1519,7 +1519,7 @@ msgstr &quot;T_otal&quot;
1519 1519 msgid "Terminal colors"
1520 1520 msgstr "Cores do terminal"
1521 1521  
1522   -#: host.c:378
  1522 +#: host.c:216
1523 1523 msgid "Text before '['"
1524 1524 msgstr "Texto antes de '['"
1525 1525  
... ... @@ -1565,7 +1565,7 @@ msgstr &quot;&quot;
1565 1565 msgid "This program requires GTK version %d.%d.%d"
1566 1566 msgstr "Este programa precisa do GTK versão %d.%d.%d"
1567 1567  
1568   -#: host.c:304
  1568 +#: host.c:142
1569 1569 #, c-format
1570 1570 msgid ""
1571 1571 "This version of %s was built without support for secure sockets layer (SSL)."
... ... @@ -1615,7 +1615,7 @@ msgstr &quot;UTF-8&quot;
1615 1615 msgid "Uknown DFT Open type from host"
1616 1616 msgstr "Servidor enviou código de abertura DFT desconhecido"
1617 1617  
1618   -#: host.c:303
  1618 +#: host.c:141
1619 1619 msgid "Unable to connect to secure hosts"
1620 1620 msgstr "Não é possível conectar em servidores seguros"
1621 1621  
... ... @@ -1623,7 +1623,7 @@ msgstr &quot;Não é possível conectar em servidores seguros&quot;
1623 1623 msgid "Unable to paste text"
1624 1624 msgstr "Incapaz de colar texto"
1625 1625  
1626   -#: ft.c:391
  1626 +#: ft.c:395
1627 1627 msgid "Unable to send file-transfer request"
1628 1628 msgstr "Não foi possível enviar a requisição de transferência de arquivo"
1629 1629  
... ... @@ -1766,11 +1766,11 @@ msgstr &quot;WSAEventSelect falhou&quot;
1766 1766 msgid "WSAStartup failed"
1767 1767 msgstr "WSAStartup falhou"
1768 1768  
1769   -#: ft.c:400
  1769 +#: ft.c:404
1770 1770 msgid "Waiting for GET response"
1771 1771 msgstr "Aguardando resposta do pedido de download"
1772 1772  
1773   -#: ft.c:402
  1773 +#: ft.c:406
1774 1774 msgid "Waiting for PUT response"
1775 1775 msgstr "Aguardando resposta do pedido de upload"
1776 1776  
... ...
src/lib3270/ft.c
... ... @@ -219,7 +219,11 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
219 219 }
220 220  
221 221 // Open local file
  222 +#ifdef _WIN32
  223 + ft_local_file = fopen(local,(flags & LIB3270_FT_OPTION_RECEIVE) ? ((flags & LIB3270_FT_OPTION_APPEND) ? "ab" : "wb") : "rb");
  224 +#else
222 225 ft_local_file = fopen(local,(flags & LIB3270_FT_OPTION_RECEIVE) ? ((flags & LIB3270_FT_OPTION_APPEND) ? "a" : "w") : "r");
  226 +#endif // _WIN32
223 227  
224 228 if(!ft_local_file)
225 229 {
... ...
src/lib3270/host.c
... ... @@ -60,168 +60,6 @@
60 60 static void try_reconnect(H3270 *session);
61 61  
62 62 /*
63   -static char * stoken(char **s)
64   -{
65   - char *r;
66   - char *ss = *s;
67   -
68   - if (!*ss)
69   - return NULL;
70   - r = ss;
71   - while (*ss && *ss != ' ' && *ss != '\t')
72   - ss++;
73   - if (*ss) {
74   - *ss++ = '\0';
75   - while (*ss == ' ' || *ss == '\t')
76   - ss++;
77   - }
78   - *s = ss;
79   - return r;
80   -}
81   -*/
82   -
83   -/*
84   - * Read the host file
85   - */ /*
86   -void
87   -hostfile_init(void)
88   -{
89   - FILE *hf;
90   - char buf[1024];
91   - static Boolean hostfile_initted = False;
92   - struct host *h;
93   - char *hostfile_name;
94   -
95   - if (hostfile_initted)
96   - return;
97   -
98   - hostfile_initted = True;
99   - hostfile_name = appres.hostsfile;
100   - if (hostfile_name == CN)
101   - hostfile_name = xs_buffer("%s/ibm_hosts", appres.conf_dir);
102   - else
103   - hostfile_name = do_subst(appres.hostsfile, True, True);
104   - hf = fopen(hostfile_name, "r");
105   - if (hf != (FILE *)NULL) {
106   - while (fgets(buf, sizeof(buf), hf)) {
107   - char *s = buf;
108   - char *name, *entry_type, *hostname;
109   - char *slash;
110   -
111   - if (strlen(buf) > (unsigned)1 &&
112   - buf[strlen(buf) - 1] == '\n') {
113   - buf[strlen(buf) - 1] = '\0';
114   - }
115   - while (isspace(*s))
116   - s++;
117   - if (!*s || *s == '#')
118   - continue;
119   - name = stoken(&s);
120   - entry_type = stoken(&s);
121   - hostname = stoken(&s);
122   - if (!name || !entry_type || !hostname) {
123   - popup_an_error("Bad %s syntax, entry skipped",
124   - ResHostsFile);
125   - continue;
126   - }
127   - h = (struct host *)lib3270_malloc(sizeof(*h));
128   - if (!split_hier(NewString(name), &h->name,
129   - &h->parents)) {
130   - lib3270_free(h);
131   - continue;
132   - }
133   - h->hostname = NewString(hostname);
134   -
135   - //
136   - // Quick syntax extension to allow the hosts file to
137   - // specify a port as host/port.
138   - //
139   - if ((slash = strchr(h->hostname, '/')))
140   - *slash = ':';
141   -
142   - if (!strcmp(entry_type, "primary"))
143   - h->entry_type = PRIMARY;
144   - else
145   - h->entry_type = ALIAS;
146   - if (*s)
147   - h->loginstring = NewString(s);
148   - else
149   - h->loginstring = CN;
150   - h->prev = last_host;
151   - h->next = (struct host *)NULL;
152   - if (last_host)
153   - last_host->next = h;
154   - else
155   - hosts = h;
156   - last_host = h;
157   - }
158   - (void) fclose(hf);
159   - } else if (appres.hostsfile != CN) {
160   - popup_an_errno(errno, "Cannot open " ResHostsFile " '%s'",
161   - appres.hostsfile);
162   - }
163   - lib3270_free(hostfile_name);
164   -
165   -// #if defined(X3270_DISPLAY)
166   -// save_recent(CN);
167   -// #endif
168   -}
169   -*/
170   -
171   -/*
172   - * Look up a host in the list. Turns aliases into real hostnames, and
173   - * finds loginstrings.
174   - */ /*
175   -static int
176   -hostfile_lookup(const char *name, char **hostname, char **loginstring)
177   -{
178   - struct host *h;
179   -
180   - hostfile_init();
181   - for (h = hosts; h != (struct host *)NULL; h = h->next) {
182   - if (h->entry_type == RECENT)
183   - continue;
184   - if (!strcmp(name, h->name)) {
185   - *hostname = h->hostname;
186   - if (h->loginstring != CN) {
187   - *loginstring = h->loginstring;
188   - } else {
189   - *loginstring = appres.login_macro;
190   - }
191   - return 1;
192   - }
193   - }
194   - return 0;
195   -}
196   -*/
197   -
198   -/*
199   -#if defined(LOCAL_PROCESS)
200   -// Recognize and translate "-e" options.
201   -static const char *
202   -parse_localprocess(const char *s)
203   -{
204   - int sl = strlen(OptLocalProcess);
205   -
206   - if (!strncmp(s, OptLocalProcess, sl)) {
207   - if (s[sl] == ' ')
208   - return(s + sl + 1);
209   - else if (s[sl] == '\0') {
210   - char *r;
211   -
212   - r = getenv("SHELL");
213   - if (r != CN)
214   - return r;
215   - else
216   - return "/bin/sh";
217   - }
218   - }
219   - return CN;
220   -}
221   -#endif
222   -*/
223   -
224   -/*
225 63 * Strip qualifiers from a hostname.
226 64 * Returns the hostname part in a newly-malloc'd string.
227 65 * 'needed' is returned True if anything was actually stripped.
... ...