Commit a0cff581d86a4958fe50989abac953fbde0bbb3f

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

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

Showing 2 changed files with 4 additions and 162 deletions   Show diff stats
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 {
... ...
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.
... ...