61#ifdef HAVE_SYS_IOCTL_H
64#ifdef HAVE_SYS_SELECT_H
65#include <sys/select.h>
70#ifdef FREECIV_HAVE_SYS_TYPES_H
79#ifdef HAVE_SYS_UTSNAME_H
80#include <sys/utsname.h>
82#ifdef FREECIV_HAVE_LIBZ
85#ifdef FREECIV_MSWINDOWS
97#ifdef FREECIV_HAVE_LIBZ
102#include "unicode/ustring.h"
121#ifndef HAVE_WORKING_VSNPRINTF
126#ifndef HAVE_LOCALTIME_R
304 while (*
str !=
'\0' && dest < max) {
339 while (*
str !=
'\0' && dest < max) {
340 if (*
str ==
'\\' && *(
str + 1) ==
'\n') {
369 if (
str[0] ==
'"' &&
str[
len-1] ==
'"') {
397 if (
str0[0] ==
'"') {
405 if (
str1[0] ==
'"') {
442#ifdef HAVE_STRCASESTR
475#if defined(ENABLE_NLS) && defined(HAVE_STRCOLL)
477#elif defined(ENABLE_NLS) && defined(HAVE__STRCOLL)
492#if defined(ENABLE_NLS) && defined(HAVE__STRICOLL)
494#elif defined(ENABLE_NLS) && defined(HAVE_STRICOLL)
496#elif defined(ENABLE_NLS) && defined(HAVE_STRCASECOLL)
511#ifdef FREECIV_MSWINDOWS
525#ifdef FREECIV_MSWINDOWS
536#ifdef FREECIV_HAVE_LIBZ
539#ifdef FREECIV_MSWINDOWS
559#ifdef FREECIV_MSWINDOWS
578#ifdef FREECIV_MSWINDOWS
596#ifdef FREECIV_MSWINDOWS
613#ifdef FREECIV_MSWINDOWS
614 static char buf[256];
619 _(
"error %ld (failed FormatMessage)"),
err);
624 static char buf[256];
632 _(
"error %d (compiled without strerror)"),
err);
646 if (usec >= 1000000) {
647 ts.tv_sec = usec / 1000000;
648 ts.tv_nsec = (usec % 1000000) * 1000;
651 ts.tv_nsec = usec * 1000;
673#ifdef FREECIV_MSWINDOWS
715#ifndef FREECIV_NDEBUG
722 "Can't replace '%s' by '%s' in '%s'. Too small "
844 return fc_strlcpy(dest + start, src,
n - start) + start;
899#define VSNP_BUF_SIZE (8096*1024)
902#ifdef HAVE_WORKING_VSNPRINTF
911#ifdef HAVE_WORKING_VSNPRINTF
934 fprintf(
stderr,
"Could not allocate %i bytes for vsnprintf() "
1023#ifdef HAVE_GETHOSTNAME
1030#ifdef FREECIV_SOCKET_ZERO_NOT_STDIN
1035#define CONSOLE_BUF_SIZE 100
1040#ifdef FREECIV_MSWINDOWS
1065#ifdef FREECIV_MSWINDOWS
1094#ifdef FREECIV_MSWINDOWS
1212 if (128 <= (
unsigned char) c) {
1215 return isalnum((
int) ((
unsigned char) c)) != 0;
1223 if (128 <= (
unsigned char) c) {
1226 return isalpha((
int) ((
unsigned char) c)) != 0;
1234 if (128 <= (
unsigned char) c) {
1237 return isdigit((
int) ((
unsigned char) c)) != 0;
1245 if (128 <= (
unsigned char) c) {
1248 return isprint((
int) ((
unsigned char) c)) != 0;
1256 if (128 <= (
unsigned char) c) {
1259 return isspace((
int) ((
unsigned char) c)) != 0;
1267 if (128 <= (
unsigned char) c) {
1270 return isupper((
int) ((
unsigned char) c)) != 0;
1278 if (128 <= (
unsigned char) c) {
1281 return (
char)
toupper((
int) ((
unsigned char) c));
1289 if (128 <= (
unsigned char) c) {
1292 return (
char)
tolower((
int) ((
unsigned char) c));
1303 static char buf[2048];
1317#ifdef HAVE_LOCALTIME_R
1333#ifdef HAVE_AT_QUICK_EXIT
1347#ifndef HAVE_WORKING_VSNPRINTF
1351#ifndef HAVE_LOCALTIME_R
1365#ifndef HAVE_WORKING_VSNPRINTF
1373#ifndef HAVE_LOCALTIME_R
char * internal_to_local_string_malloc(const char *text)
char * local_to_internal_string_buffer(const char *text, char *buf, size_t bufsz)
void fc_mutex_allocate(fc_mutex *mutex)
void fc_mutex_init(fc_mutex *mutex)
void fc_mutex_release(fc_mutex *mutex)
void fc_mutex_destroy(fc_mutex *mutex)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define fc_assert_ret_val_msg(condition, val, message,...)
#define fc_realloc(ptr, sz)
void fc_nonblock(int sockfd)
int fc_select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, fc_timeval *timeout)
struct timeval fc_timeval
int fc_snprintf(char *str, size_t n, const char *format,...)
int fc_gethostname(char *buf, size_t len)
size_t fc_strlcpy(char *dest, const char *src, size_t n)
static bool support_initialized
void make_escapes(const char *str, char *buf, size_t buf_len)
int fc_strcasecmp(const char *str0, const char *str1)
void fc_usleep(unsigned long usec)
void fc_support_init(void)
const char * fc_strerror(fc_errno err)
size_t fc_strlcat(char *dest, const char *src, size_t n)
char * fc_strcasestr(const char *haystack, const char *needle)
bool fc_strrep(char *str, size_t len, const char *search, const char *replace)
struct tm * fc_localtime(const time_t *timep, struct tm *result)
int cat_snprintf(char *str, size_t n, const char *format,...)
int fc_vsnprintf(char *str, size_t n, const char *format, va_list ap)
FILE * fc_fopen(const char *filename, const char *opentype)
static void fc_strAPI_free(void)
int fc_break_lines(char *str, size_t desired_len)
static fc_mutex localtime_mutex
static UChar * icu_buffer1
fc_mutex icu_buffer_mutex
fc_errno fc_get_errno(void)
void fc_support_free(void)
void remove_escapes(const char *str, bool full_escapes, char *buf, size_t buf_len)
int fc_strcoll(const char *str0, const char *str1)
int fc_stat(const char *filename, struct stat *buf)
bool is_reg_file_for_access(const char *name, bool write_access)
const char * fc_basename(const char *path)
static void icu_buffers_initial(void)
static char * vsnprintf_buf
static int icu_buffer_uchars
int fc_strncasequotecmp(const char *str0, const char *str1, size_t n)
static fc_mutex vsnprintf_mutex
static void fc_strAPI_init(void)
size_t effectivestrlenquote(const char *str)
static void icu_buffers_increase(void)
int fc_at_quick_exit(void(*func)(void))
int fc_stricoll(const char *str0, const char *str1)
int fc_remove(const char *filename)
int fc_strncasecmp(const char *str0, const char *str1, size_t n)
char * fc_strrep_resize(char *str, size_t *len, const char *search, const char *replace)
static UChar * icu_buffer2
bool are_support_services_available(void)