#endif /* not HAVE_USLEEP */
}
-#if defined(_MSC_VER) && _MSC_VER < 1300
+#if defined(__BORLANDC__) || (defined(_MSC_VER) && _MSC_VER < 1300)
static inline int
char_value (char c, int base)
return result;
}
-#else /* !defined(_MSC_VER) || _MSC_VER >= 1300 */
+#else /* !defined(__BORLANDC__) && (!defined(_MSC_VER) || _MSC_VER >= 1300) */
__int64
str_to_int64 (const char *nptr, char **endptr, int base)
#endif
}
-#endif /* !defined(_MSC_VER) || _MSC_VER >= 1300 */
-
-/* A simple clone of ftello. The normal ftell doesn't work for large
- files, so this is needed, and used by file_size(), which is itself
- used for the --post-file option.
-
- This function uses fgetpos incorrectly and should be considered a
- hack until a better way to tell the stream position is found. */
-
-__int64
-wget_ftello (FILE *fp)
-{
- fpos_t pos;
- if (fgetpos (fp, &pos) != 0)
- return -1;
- else
- return pos;
-}
+#endif /* !defined(__BORLANDC__) && (!defined(_MSC_VER) || _MSC_VER >= 1300) */
void
windows_main_junk (int *argc, char **argv, char **exec_name)
static void
ws_hangup (const char *reason)
{
- /* Whether we arrange our own version of opt.lfilename here. */
- int changedp = 0;
-
- if (!opt.lfilename)
- {
- opt.lfilename = unique_name (DEFAULT_LOGFILE, 0);
- changedp = 1;
- }
- printf (_("Continuing in background.\n"));
- if (changedp)
- printf (_("Output will be written to `%s'.\n"), opt.lfilename);
-
+ fprintf (stderr, _("Continuing in background.\n"));
log_request_redirect_output (reason);
/* Detach process from the current console. Under Windows 9x, if we
struct fake_fork_info
{
HANDLE event;
- int changedp;
+ int logfile_changed;
char lfilename[MAX_PATH + 1];
};
event = info->event;
+ info->logfile_changed = 0;
if (!opt.lfilename)
{
- opt.lfilename = unique_name (DEFAULT_LOGFILE, 0);
- info->changedp = 1;
- strncpy (info->lfilename, opt.lfilename, sizeof (info->lfilename));
- info->lfilename[sizeof (info->lfilename) - 1] = '\0';
+ /* See utils:fork_to_background for explanation. */
+ FILE *new_log_fp = unique_create (DEFAULT_LOGFILE, 0, &opt.lfilename);
+ if (new_log_fp)
+ {
+ info->logfile_changed = 1;
+ strncpy (info->lfilename, opt.lfilename, sizeof (info->lfilename));
+ info->lfilename[sizeof (info->lfilename) - 1] = '\0';
+ fclose (new_log_fp);
+ }
}
- else
- info->changedp = 0;
UnmapViewOfFile (info);
CloseHandle (section);
}
/* Ensure string is properly terminated. */
- if (info->changedp &&
+ if (info->logfile_changed &&
!memchr (info->lfilename, '\0', sizeof (info->lfilename)))
{
rv = FALSE;
}
printf (_("Continuing in background, pid %lu.\n"), pi.dwProcessId);
- if (info->changedp)
+ if (info->logfile_changed)
printf (_("Output will be written to `%s'.\n"), info->lfilename);
UnmapViewOfFile (info);