diff --git a/ft.c b/ft.c index 7174c4e..71dbf42 100644 --- a/ft.c +++ b/ft.c @@ -219,7 +219,11 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); } // Open local file +#ifdef _WIN32 + ft_local_file = fopen(local,(flags & LIB3270_FT_OPTION_RECEIVE) ? ((flags & LIB3270_FT_OPTION_APPEND) ? "ab" : "wb") : "rb"); +#else ft_local_file = fopen(local,(flags & LIB3270_FT_OPTION_RECEIVE) ? ((flags & LIB3270_FT_OPTION_APPEND) ? "a" : "w") : "r"); +#endif // _WIN32 if(!ft_local_file) { diff --git a/host.c b/host.c index 45b6ad4..10a5d8b 100644 --- a/host.c +++ b/host.c @@ -60,168 +60,6 @@ static void try_reconnect(H3270 *session); /* -static char * stoken(char **s) -{ - char *r; - char *ss = *s; - - if (!*ss) - return NULL; - r = ss; - while (*ss && *ss != ' ' && *ss != '\t') - ss++; - if (*ss) { - *ss++ = '\0'; - while (*ss == ' ' || *ss == '\t') - ss++; - } - *s = ss; - return r; -} -*/ - -/* - * Read the host file - */ /* -void -hostfile_init(void) -{ - FILE *hf; - char buf[1024]; - static Boolean hostfile_initted = False; - struct host *h; - char *hostfile_name; - - if (hostfile_initted) - return; - - hostfile_initted = True; - hostfile_name = appres.hostsfile; - if (hostfile_name == CN) - hostfile_name = xs_buffer("%s/ibm_hosts", appres.conf_dir); - else - hostfile_name = do_subst(appres.hostsfile, True, True); - hf = fopen(hostfile_name, "r"); - if (hf != (FILE *)NULL) { - while (fgets(buf, sizeof(buf), hf)) { - char *s = buf; - char *name, *entry_type, *hostname; - char *slash; - - if (strlen(buf) > (unsigned)1 && - buf[strlen(buf) - 1] == '\n') { - buf[strlen(buf) - 1] = '\0'; - } - while (isspace(*s)) - s++; - if (!*s || *s == '#') - continue; - name = stoken(&s); - entry_type = stoken(&s); - hostname = stoken(&s); - if (!name || !entry_type || !hostname) { - popup_an_error("Bad %s syntax, entry skipped", - ResHostsFile); - continue; - } - h = (struct host *)lib3270_malloc(sizeof(*h)); - if (!split_hier(NewString(name), &h->name, - &h->parents)) { - lib3270_free(h); - continue; - } - h->hostname = NewString(hostname); - - // - // Quick syntax extension to allow the hosts file to - // specify a port as host/port. - // - if ((slash = strchr(h->hostname, '/'))) - *slash = ':'; - - if (!strcmp(entry_type, "primary")) - h->entry_type = PRIMARY; - else - h->entry_type = ALIAS; - if (*s) - h->loginstring = NewString(s); - else - h->loginstring = CN; - h->prev = last_host; - h->next = (struct host *)NULL; - if (last_host) - last_host->next = h; - else - hosts = h; - last_host = h; - } - (void) fclose(hf); - } else if (appres.hostsfile != CN) { - popup_an_errno(errno, "Cannot open " ResHostsFile " '%s'", - appres.hostsfile); - } - lib3270_free(hostfile_name); - -// #if defined(X3270_DISPLAY) -// save_recent(CN); -// #endif -} -*/ - -/* - * Look up a host in the list. Turns aliases into real hostnames, and - * finds loginstrings. - */ /* -static int -hostfile_lookup(const char *name, char **hostname, char **loginstring) -{ - struct host *h; - - hostfile_init(); - for (h = hosts; h != (struct host *)NULL; h = h->next) { - if (h->entry_type == RECENT) - continue; - if (!strcmp(name, h->name)) { - *hostname = h->hostname; - if (h->loginstring != CN) { - *loginstring = h->loginstring; - } else { - *loginstring = appres.login_macro; - } - return 1; - } - } - return 0; -} -*/ - -/* -#if defined(LOCAL_PROCESS) -// Recognize and translate "-e" options. -static const char * -parse_localprocess(const char *s) -{ - int sl = strlen(OptLocalProcess); - - if (!strncmp(s, OptLocalProcess, sl)) { - if (s[sl] == ' ') - return(s + sl + 1); - else if (s[sl] == '\0') { - char *r; - - r = getenv("SHELL"); - if (r != CN) - return r; - else - return "/bin/sh"; - } - } - return CN; -} -#endif -*/ - -/* * Strip qualifiers from a hostname. * Returns the hostname part in a newly-malloc'd string. * 'needed' is returned True if anything was actually stripped. -- libgit2 0.21.2