58#ifdef HAVE_SYS_IOCTL_H
61#ifdef HAVE_SYS_SELECT_H
62#include <sys/select.h>
67#ifdef FREECIV_HAVE_SYS_TYPES_H
76#ifdef HAVE_SYS_UTSNAME_H
77#include <sys/utsname.h>
79#ifdef FREECIV_HAVE_LIBZ
82#ifdef FREECIV_MSWINDOWS
94#ifdef FREECIV_HAVE_LIBZ
99#include "unicode/ustring.h"
118#ifndef HAVE_WORKING_VSNPRINTF
123#ifndef HAVE_LOCALTIME_R
194 if (
str0 ==
nullptr) {
197 if (
str1 ==
nullptr) {
243 if (
str0 ==
nullptr) {
246 if (
str1 ==
nullptr) {
301 while (*
str !=
'\0' && dest < max) {
302 if (*
str ==
'\\' && *(
str + 1) ==
'\n') {
331 if (
str[0] ==
'"' &&
str[
len-1] ==
'"') {
349 if (
str0 ==
nullptr) {
352 if (
str1 ==
nullptr) {
359 if (
str0[0] ==
'"') {
367 if (
str1[0] ==
'"') {
404#ifdef HAVE_STRCASESTR
438#if defined(ENABLE_NLS) && defined(HAVE_STRCOLL)
440#elif defined(ENABLE_NLS) && defined(HAVE__STRCOLL)
455#if defined(ENABLE_NLS) && defined(HAVE__STRICOLL)
457#elif defined(ENABLE_NLS) && defined(HAVE_STRICOLL)
459#elif defined(ENABLE_NLS) && defined(HAVE_STRCASECOLL)
474#ifdef FREECIV_MSWINDOWS
488#ifdef FREECIV_MSWINDOWS
499#ifdef FREECIV_HAVE_LIBZ
502#ifdef FREECIV_MSWINDOWS
522#ifdef FREECIV_MSWINDOWS
541#ifdef FREECIV_MSWINDOWS
559#ifdef FREECIV_MSWINDOWS
576#ifdef FREECIV_MSWINDOWS
577 static char buf[256];
580 nullptr,
err, 0,
buf,
sizeof(
buf),
nullptr)) {
582 _(
"error %ld (failed FormatMessage)"),
err);
587 static char buf[256];
595 _(
"error %d (compiled without strerror)"),
err);
609 if (usec >= 1000000) {
610 ts.tv_sec = usec / 1000000;
611 ts.tv_nsec = (usec % 1000000) * 1000;
614 ts.tv_nsec = usec * 1000;
625#ifdef FREECIV_MSWINDOWS
654 if (
search ==
nullptr || replace ==
nullptr) {
666#ifndef FREECIV_NDEBUG
673 "Can't replace '%s' by '%s' in '%s'. Too small "
693 if (
search ==
nullptr || replace ==
nullptr) {
701 while (s !=
nullptr) {
795 return fc_strlcpy(dest + start, src,
n - start) + start;
850#define VSNP_BUF_SIZE (8096*1024)
853#ifdef HAVE_WORKING_VSNPRINTF
862#ifdef HAVE_WORKING_VSNPRINTF
885 fprintf(
stderr,
"Could not allocate %i bytes for vsnprintf() "
974#ifdef HAVE_GETHOSTNAME
981#ifdef FREECIV_SOCKET_ZERO_NOT_STDIN
986#define CONSOLE_BUF_SIZE 100
991#ifdef FREECIV_MSWINDOWS
1016#ifdef FREECIV_MSWINDOWS
1023 nullptr, 0,
nullptr);
1045#ifdef FREECIV_MSWINDOWS
1163 if (128 <= (
unsigned char) c) {
1166 return isalnum((
int) ((
unsigned char) c)) != 0;
1174 if (128 <= (
unsigned char) c) {
1177 return isalpha((
int) ((
unsigned char) c)) != 0;
1185 if (128 <= (
unsigned char) c) {
1188 return isdigit((
int) ((
unsigned char) c)) != 0;
1196 if (128 <= (
unsigned char) c) {
1199 return isprint((
int) ((
unsigned char) c)) != 0;
1207 if (128 <= (
unsigned char) c) {
1210 return isspace((
int) ((
unsigned char) c)) != 0;
1218 if (128 <= (
unsigned char) c) {
1221 return isupper((
int) ((
unsigned char) c)) != 0;
1229 if (128 <= (
unsigned char) c) {
1232 return (
char)
toupper((
int) ((
unsigned char) c));
1240 if (128 <= (
unsigned char) c) {
1243 return (
char)
tolower((
int) ((
unsigned char) c));
1254 static char buf[2048];
1268#ifdef HAVE_LOCALTIME_R
1284#ifdef HAVE_AT_QUICK_EXIT
1298#ifndef HAVE_WORKING_VSNPRINTF
1302#ifndef HAVE_LOCALTIME_R
1316#ifndef HAVE_WORKING_VSNPRINTF
1324#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
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)
gzFile fc_gzopen(const char *filename, const char *opentype)
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)