Freeciv-3.3: /fast/freeciv/nightly/main/utility/support.h File Reference

Freeciv-3.3

Loading...
Searching...
No Matches
Macros | Typedefs | Functions
support.h File Reference
`#include <freeciv_config.h>`
`#include <stdarg.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <sys/stat.h>`

Go to the source code of this file.

## Macros

#define | TRUE true
#define | FALSE false
#define | nullptr NULL
#define | bool unsigned int
#define | true 1
#define | false 0
#define | __bool_true_false_are_defined 1
#define | fc__attribute(x)
#define | fc__warn_unused_result
#define | fc__fallthrough
#define | fc__noreturn
#define | fc__unreachable(_cond_) fc_assert(!(_cond_))
#define | RETURN_VALUE_AFTER_EXIT(_val_)
#define | fc_strncmp(_s1_, _s2_, _len_) strncmp(_s1_, _s2_, _len_)
#define | sz_strlcpy(dest, src) ((void) fc_strlcpy((dest), (src), sizeof(dest)))
#define | sz_strlcat(dest, src) ((void) fc_strlcat((dest), (src), sizeof(dest)))

## Typedefs

typedef int | fc_errno

## Functions

int | fc_strcasecmp (const char *str0, const char *str1)
int | fc_strncasecmp (const char *str0, const char *str1, size_t n)
int | fc_strncasequotecmp (const char *str0, const char *str1, size_t n)
void | fc_support_init (void)
void | fc_support_free (void)
bool | are_support_services_available (void)
size_t | effectivestrlenquote (const char *str)
char * | fc_strcasestr (const char *haystack, const char *needle)
int | fc_strcoll (const char *str0, const char *str1)
int | fc_stricoll (const char *str0, const char *str1)
FILE * | fc_fopen (const char *filename, const char *opentype)
int | fc_remove (const char *filename)
int | fc_stat (const char *filename, struct stat *buf)
fc_errno | fc_get_errno (void)
const char * | fc_strerror (fc_errno err)
void | fc_usleep (unsigned long usec)
bool | fc_strrep (char *str, size_t len, const char *search, const char *replace)
char * | fc_strrep_resize (char *str, size_t *len, const char *search, const char *replace) fc__warn_unused_result
size_t | fc_strlcpy (char *dest, const char *src, size_t n)
size_t | fc_strlcat (char *dest, const char *src, size_t n)
int | fc_snprintf (char *str, size_t n, const char *format,...) fc__attribute((__format__(__printf__
int | fc__attribute ((nonnull(1, 3)))
int | fc_vsnprintf (char *str, size_t n, const char *format, va_list ap) fc__attribute((nonnull(1
int int | cat_snprintf (char *str, size_t n, const char *format,...) fc__attribute((__format__(__printf__
int | fc_gethostname (char *buf, size_t len)
bool | is_reg_file_for_access (const char *name, bool write_access)
int | fc_break_lines (char *str, size_t desired_len)
bool | fc_isalnum (char c)
bool | fc_isalpha (char c)
bool | fc_isdigit (char c)
bool | fc_isprint (char c)
bool | fc_isspace (char c)
bool | fc_isupper (char c)
char | fc_toupper (char c)
char | fc_tolower (char c)
const char * | fc_basename (const char *path)
struct tm * | fc_localtime (const time_t *timep, struct tm *result)
static bool | is_bigendian (void)
void | make_escapes (const char *str, char *buf, size_t buf_len)
void | remove_escapes (const char *str, bool full_escapes, char *buf, size_t buf_len)
int | fc_at_quick_exit (void(*func)(void))

## Macro Definition Documentation

## ◆ __bool_true_false_are_defined

#define __bool_true_false_are_defined 1

Definition at line 74 of file support.h.

## ◆ bool

#define bool unsigned int

Definition at line 71 of file support.h.

## ◆ FALSE

#define FALSE false

Definition at line 47 of file support.h.

## ◆ false

#define false 0

Definition at line 73 of file support.h.

## ◆ fc__attribute

#define fc__attribute | ( |  | x | ) |

Definition at line 99 of file support.h.

## ◆ fc__fallthrough

#define fc__fallthrough

Definition at line 119 of file support.h.

## ◆ fc__noreturn

#define fc__noreturn

Definition at line 125 of file support.h.

## ◆ fc__unreachable

#define fc__unreachable | ( |  | _cond_ | ) | fc_assert(!(_cond_))

Definition at line 134 of file support.h.

## ◆ fc__warn_unused_result

#define fc__warn_unused_result

Definition at line 109 of file support.h.

## ◆ fc_strncmp

#define fc_strncmp | ( |  | _s1_,
|  |  | _s2_,
|  |  | _len_
| ) |  | strncmp(_s1_, _s2_, _len_)

Definition at line 154 of file support.h.

## ◆ nullptr

#define nullptr NULL

Definition at line 55 of file support.h.

## ◆ RETURN_VALUE_AFTER_EXIT

#define RETURN_VALUE_AFTER_EXIT | ( |  | _val_ | ) |

Definition at line 146 of file support.h.

## ◆ sz_strlcat

#define sz_strlcat | ( |  | dest,
|  |  | src
| ) |  | ((void) fc_strlcat((dest), (src), sizeof(dest)))

Definition at line 190 of file support.h.

## ◆ sz_strlcpy

#define sz_strlcpy | ( |  | dest,
|  |  | src
| ) |  | ((void) fc_strlcpy((dest), (src), sizeof(dest)))

Definition at line 189 of file support.h.

## ◆ TRUE

#define TRUE true

Definition at line 46 of file support.h.

## ◆ true

#define true 1

Definition at line 72 of file support.h.

## Typedef Documentation

## ◆ fc_errno

typedef int fc_errno

Definition at line 140 of file support.h.

## Function Documentation

## ◆ are_support_services_available()

bool are_support_services_available | ( | void |  | ) |

Is the support module currently in usable state?

Definition at line 1369 of file support.c.

Referenced by audio_shutdown_atexit().

## ◆ cat_snprintf()

int int cat_snprintf | ( | char * | str,
|  | size_t | n,
|  | const char * | format,
|  |  | ...
| ) |  |

## ◆ effectivestrlenquote()

size_t effectivestrlenquote | ( | const char * | str | ) |

Count length of string without possible surrounding quotes.

Definition at line 356 of file support.c.

Referenced by conn_by_user_prefix(), and player_by_name_prefix().

## ◆ fc__attribute()

int fc__attribute | ( | (nonnull(1, 3)) |  | ) |

## ◆ fc_at_quick_exit()

int fc_at_quick_exit | ( | void(*)(void) | func | ) |

Set quick_exit() callback if possible.

Definition at line 1317 of file support.c.

Referenced by client_main().

## ◆ fc_basename()

const char * fc_basename | ( | const char * | path | ) |

basename() replacement that always takes const parameter. POSIX basename() modifies its parameter, GNU one does not. Ideally we would like to use GNU one, when available, directly without extra string copies.

Definition at line 1287 of file support.c.

Referenced by cmdhelp_new().

## ◆ fc_break_lines()

int fc_break_lines | ( | char * | str,
|  | size_t | desired_len
| ) |  |

Replace the spaces by line breaks when the line length is over the desired one. 'str' is modified. Returns number of lines in modified s.

Definition at line 1135 of file support.c.

Referenced by astr_break_lines(), create_races_dialog(), manual_commands(), manual_settings(), option_widget_new(), show_help_command(), show_help_intro(), show_help_option(), show_nationsets(), show_ruleset_info(), and show_settings_one().

## ◆ fc_fopen()

FILE * fc_fopen | ( | const char * | filename,
|  | const char * | opentype
| ) |  |

Wrapper function for fopen() with filename conversion to local encoding on Windows.

Definition at line 505 of file support.c.

Referenced by fc_querysocket(), fz_from_file(), img_save_ppm(), log_civ_score_now(), log_real(), manual_start(), netfile_download_file(), rank_users(), read_init_script_real(), save_script_lua(), script_server_load_file(), write_chatline_content(), and write_init_script().

## ◆ fc_get_errno()

fc_errno fc_get_errno | ( | void |  | ) |

Returns last error code.

Definition at line 592 of file support.c.

Referenced by begin_lanserver_scan(), fc_init_network(), fc_nonblock(), fileinfolist(), find_next_free_port(), fz_strerror(), get_lanserver_announcement(), make_dir(), read_from_connection(), send_lanserver_response(), server_accept_connection(), server_open_socket(), server_sniff_all_input(), setup_interrupt_handlers(), and try_to_connect().

## ◆ fc_gethostname()

int fc_gethostname | ( | char * | buf,
|  | size_t | len
| ) |  |

Call gethostname() if supported, else just returns -1.

Definition at line 1007 of file support.c.

Referenced by establish_new_connection(), and send_lanserver_response().

## ◆ fc_isalnum()

bool fc_isalnum | ( | char | c | ) |

Wrapper function to work around broken libc implementations. See above.

Definition at line 1196 of file support.c.

Referenced by find_option(), get_token_value(), handle_stdin_input_real(), is_legal_table_entry_name(), is_secfile_entry_name_valid(), and year_suffix().

## ◆ fc_isalpha()

bool fc_isalpha | ( | char | c | ) |

Wrapper function to work around broken libc implementations. See above.

Definition at line 1207 of file support.c.

Referenced by extract_sequence_text(), fc_vsnprintcf(), and is_legal_table_entry_name().

## ◆ fc_isdigit()

bool fc_isdigit | ( | char | c | ) |

Wrapper function to work around broken libc implementations. See above.

Definition at line 1218 of file support.c.

Referenced by entry_from_token(), extract_escapes(), get_token_value(), is_good_password(), is_valid_username(), str_to_float(), str_to_int(), and str_to_uint().

## ◆ fc_isprint()

bool fc_isprint | ( | char | c | ) |

Wrapper function to work around broken libc implementations. See above.

Definition at line 1229 of file support.c.

## ◆ fc_isspace()

bool fc_isspace | ( | char | c | ) |

Wrapper function to work around broken libc implementations. See above.

Definition at line 1240 of file support.c.

Referenced by check_include(), conn_pattern_from_string(), extract_sequence_text(), fc_break_lines(), find_option(), get_token_entry_name(), get_token_eol(), get_token_value(), get_token_white_char(), is_plain_public_message(), load_city_name_list(), remove_trailing_spaces(), skip_leading_spaces(), str_to_float(), str_to_int(), and str_to_uint().

## ◆ fc_isupper()

bool fc_isupper | ( | char | c | ) |

Wrapper function to work around broken libc implementations. See above.

Definition at line 1251 of file support.c.

Referenced by is_good_password().

## ◆ fc_localtime()

struct tm * fc_localtime | ( | const time_t * | timep,
|  | struct tm * | result
| ) |  |

Thread safe localtime() replacement

Definition at line 1301 of file support.c.

Referenced by real_luaconsole_append(), real_output_window_append(), and send_pending_events().

## ◆ fc_remove()

int fc_remove | ( | const char * | filename | ) |

Wrapper function for gzopen() with filename conversion to local encoding on Windows. Wrapper function for remove() with filename conversion to local encoding on Windows.

Definition at line 555 of file support.c.

Referenced by handle_single_want_hack_reply(), and save_dialog_response_callback().

## ◆ fc_snprintf()

int fc_snprintf | ( | char * | str,
|  | size_t | n,
|  | const char * | format,
|  |  | ...
| ) |  |

## ◆ fc_stat()

int fc_stat | ( | const char * | filename,
|  | struct stat * | buf
| ) |  |

Wrapper function for stat() with filename conversion to local encoding on Windows.

Definition at line 574 of file support.c.

Referenced by fileinfolist_infix(), fileinfoname(), get_usable_themes_in_directory(), is_reg_file_for_access(), load_install_info_lists(), lua_command(), script_server_load_file(), and secfile_load().

## ◆ fc_strcasecmp()

int fc_strcasecmp | ( | const char * | str0,
|  | const char * | str1
| ) |  |

Compare strings like strcmp(), but ignoring case. UTF8 aware.

Definition at line 186 of file support.c.

Referenced by achievement_by_rule_name(), action_by_rule_name(), advance_by_rule_name(), ai_level_help(), ai_level_name_update_cb(), ai_type_by_name(), api_edit_trait_mod_set(), api_edit_unit_kill(), api_effects_city_bonus(), api_effects_player_bonus(), api_effects_tile_bonus(), api_effects_unit_bonus(), api_effects_unit_vs_tile_bonus(), api_effects_world_bonus(), api_find_role_unit_type(), api_methods_nation_trait_default(), api_methods_nation_trait_max(), api_methods_nation_trait_min(), api_methods_player_has_flag(), api_methods_player_trait(), api_methods_player_trait_base(), api_methods_player_trait_current_mod(), api_methods_unit_type_has_flag(), api_methods_unit_type_has_role(), api_utilities_str2dir(), boot_help_texts(), cancelvote_command(), check_leader_names(), check_sprite_type(), city_list_find_name(), city_name_compare(), city_style_by_rule_name(), client_main(), cmdarg_compare(), cmdlevel_command(), compar_event_message_texts(), compat_load_020400(), compat_load_020500(), compat_load_020600(), compat_load_030000(), compat_load_030100(), compat_load_030200(), compat_load_030300(), conn_by_user(), conn_pattern_from_string(), counter_by_rule_name(), counter_by_translated_name(), create_diplomacy_dialog(), delegate_command(), diplrel_by_rule_name(), disaster_by_rule_name(), download_modpack_list(), download_modpack_recursive(), effect_edit::effect_type_menu(), event_cache_load(), extra_type_by_rule_name(), fc_cmp(), fc_stricoll(), edit_impr::genus_menu(), get_lan_server_list(), goods_by_rule_name(), government_by_rule_name(), handle_login_request(), improvement_by_rule_name(), init_character_encodings(), is_default_city_name(), is_on_allowed_list(), is_valid_username(), load_action_range_max(), load_building_names(), load_city_name_list(), load_install_info_list(), load_ruleset_buildings(), load_ruleset_effects(), load_ruleset_game(), load_ruleset_nations(), load_ruleset_techs(), load_ruleset_terrain(), load_ruleset_units(), load_tech_names(), load_terrain_names(), load_unit_names(), lookup_cbonus_list(), lookup_option_level(), main(), mapimg_define(), message_options_load(), metaconnection_command(), modpack_file_from_ruleset_cache(), modpack_file_from_tileset_cache(), modpack_tileset_target(), multiplier_by_rule_name(), effect_edit::multiplier_menu(), nation_by_rule_name(), nation_group_by_rule_name(), nation_leader_by_name(), nation_set_by_rule_name(), ordered_gfx_fextensions(), output_type_by_identifier(), player_by_name(), player_by_user(), player_by_user_delegated(), player_name_check(), playercolor_command(), req_from_str(), req_edit::req_range_menu(), req_edit::req_type_menu(), rscompat_names(), save_game_ruleset(), secfile_lookup_enum_data(), server_player_name_is_allowed(), set_ai_level_named(), setcompat_name_generic(), setcompat_S3_2_val_from_S3_1(), setting_bitwise_secfile_str(), setting_ruleset_one(), settings_game_load(), settings_list_cmp(), sex_by_name(), sg_load_game(), sg_load_player_cities(), sg_load_player_cities(), sg_load_player_city(), sg_load_player_main(), sg_load_player_main(), sg_load_player_unit(), sg_load_player_unit(), sg_load_player_vision_city(), sg_load_savefile(), sg_load_savefile(), sg_load_treaties(), sg_load_treaties(), specialist_by_rule_name(), style_by_rule_name(), team_slot_by_rule_name(), tech_class_by_rule_name(), technology_load(), technology_load(), terrain_by_rule_name(), tileset_read_toplevel(), tileset_setup_extra(), trade_route_cancelling_type_by_name(), trade_route_type_by_name(), unit_class_by_rule_name(), unit_type_by_rule_name(), universal_by_rule_name(), and universal_value_from_str().

## ◆ fc_strcasestr()

char * fc_strcasestr | ( | const char * | haystack,
|  | const char * | needle
| ) |  |

Return the needle in the haystack (or nullptr). Naive implementation.

Definition at line 437 of file support.c.

Referenced by property_filter_match().

## ◆ fc_strcoll()

int fc_strcoll | ( | const char * | str0,
|  | const char * | str1
| ) |  |

Wrapper function for strcoll().

Definition at line 471 of file support.c.

Referenced by cmp_func(), compare_file_name_ptrs(), compare_fileinfo_name(), compare_strings(), compare_strings_ptrs(), compare_strings_strvec(), and sort_advance_names().

## ◆ fc_strerror()

const char * fc_strerror | ( | fc_errno | err | ) |

Return a string which describes a given error (errno-style.) The string is converted as necessary from the local_encoding to internal_encoding, for inclusion in translations. May be subsequently converted back to local_encoding for display.

Note that this is not the reentrant form.

Definition at line 609 of file support.c.

Referenced by begin_lanserver_scan(), fc_init_network(), fc_nonblock(), fileinfolist(), find_next_free_port(), fz_strerror(), get_lanserver_announcement(), read_from_connection(), send_lanserver_response(), server_accept_connection(), server_open_socket(), server_sniff_all_input(), setup_interrupt_handlers(), and try_to_connect().

## ◆ fc_stricoll()

int fc_stricoll | ( | const char * | str0,
|  | const char * | str1
| ) |  |

Wrapper function for stricoll().

Definition at line 485 of file support.c.

Referenced by cmp_name().

## ◆ fc_strlcat()

size_t fc_strlcat | ( | char * | dest,
|  | const char * | src,
|  | size_t | n
| ) |  |

fc_strlcat() provides utf-8 version of (non-standard) function strlcat() It is intended as more user-friendly version of strncat(), in particular easier to use safely and correctly, and ensuring nul-terminated results while being able to detect truncation.

Definition at line 822 of file support.c.

Referenced by boot_help_texts(), client_start_server(), get_city_dialog_production_full(), get_effect_req_text(), handle_page_msg_part(), handle_ruleset_description_part(), helptext_building(), helptext_goods(), helptext_government(), helptext_specialist(), historian_generic(), load_ruleset_nations(), meswin_add(), rebuild_citydlg_title_str(), req_text_insert(), req_text_insert_nl(), setting_bitwise_to_str(), tile_info_pollution(), and universal_name_translation().

## ◆ fc_strlcpy()

size_t fc_strlcpy | ( | char * | dest,
|  | const char * | src,
|  | size_t | n
| ) |  |

fc_strlcpy() provides utf-8 version of (non-standard) function strlcpy() It is intended as more user-friendly version of strncpy(), in particular easier to use safely and correctly, and ensuring nul-terminated results while being able to detect truncation.

n is the full size of the destination buffer, including space for trailing nul, and including the pre-existing string for fc_strlcat(). Thus can eg use sizeof(buffer), or exact size malloc-ed.

Result is always nul-terminated, whether or not truncation occurs, and the return value is the strlen the destination would have had without truncation. I.e., a return value >= input n indicates truncation occurred.

Not sure about the asserts below, but they are easier than trying to ensure correct behaviour on strange inputs. In particular note that n == 0 is prohibited (e.g., since there must at least be room for a nul); could consider other options.

Definition at line 777 of file support.c.

Referenced by astr_vadd_at(), capitalized_string(), client_conn_close_callback(), client_option_font_set(), client_option_str_set(), client_start_server(), cmafec_preset_add(), compat_load_030200(), configure_single(), conn_pattern_from_string(), create_clause_menu(), desired_settable_options_update(), edit_buffer_get_status_string(), extract_sequence_text(), fc_basename(), fc_strlcat(), fc_utf8_validate_rep_len(), find_option(), fit_nationset_to_players(), get_city_dialog_production(), get_city_dialog_production_full(), get_city_dialog_production_row(), get_city_mapview_name_and_growth(), get_common_prefix(), get_full_nation(), get_full_username(), get_prod_complete_string(), get_server_address(), get_tokens(), get_unique_guest_name(), handle_chat_msg_req(), handle_ruleset_nation(), handle_ruleset_summary(), helptext_advance(), helptext_unit(), is_allowed_to_take(), load_ruleset_game(), loud_strlcpy(), main(), mapimg_def2str(), mapimg_define(), musicspec_load(), name_and_sort_items(), plrdata_slot_replace(), popup_load_game_dialog(), popup_newcity_dialog(), popup_worklist_editor(), property_page_set_store_value(), req_vec_problem_new_transl(), research_pretty_name(), ruleset_cache_sendclient_cb(), scan_score_log(), secfile_lookup_bitwise_enum_default_full(), secfile_lookup_bitwise_enum_full(), secfile_lookup_enum_data(), secfile_lookup_enum_default_data(), server_player_name_is_allowed(), server_player_set_name_full(), settable_options_load(), setting_bitwise_to_str(), setting_bitwise_validate_base(), setting_bool_to_str(), setting_enum_to_str(), setting_game_set(), setting_set_to_default(), setting_str_set(), setting_str_to_str(), settings_game_load(), sg_save_map_startpos(), team_pretty_name(), tileset_lookup_sprite_tags(), tileset_read_toplevel(), tileset_use_preferred_theme(), try_to_connect(), update_cma_preset_list(), and user_username().

## ◆ fc_strncasecmp()

int fc_strncasecmp | ( | const char * | str0,
|  | const char * | str1,
|  | size_t | n
| ) |  |

Compare strings like strncmp(), but ignoring case. i.e. only compares first n chars. UTF8 aware.

Definition at line 235 of file support.c.

Referenced by api_fcdb_option(), check_player_or_user_name(), command_named(), delegate_command(), entry_from_token(), extract_sequence_text(), fc_strcasestr(), fcdb_command(), handle_event(), is_guest_name(), log_parse_level_str(), lookup_option(), lua_command(), mapimg_command(), reset_command(), setting_match_prefix_base(), show_help(), show_list(), show_settings(), text_tag_init_from_sequence(), and vote_command().

## ◆ fc_strncasequotecmp()

int fc_strncasequotecmp | ( | const char * | str0,
|  | const char * | str1,
|  | size_t | n
| ) |  |

Compare strings like strncasecmp() but ignoring surrounding quotes in either string.

Definition at line 377 of file support.c.

Referenced by conn_by_user_prefix(), and player_by_name_prefix().

## ◆ fc_strrep()

bool fc_strrep | ( | char * | str,
|  | size_t | len,
|  | const char * | search,
|  | const char * | replace
| ) |  |

Replace 'search' by 'replace' within 'str'. sizeof(str) should be large enough for the modified value of 'str'. Returns TRUE if the replacement was successful.

Definition at line 720 of file support.c.

Referenced by fc_strrep_resize().

## ◆ fc_strrep_resize()

char * fc_strrep_resize | ( | char * | str,
|  | size_t * | len,
|  | const char * | search,
|  | const char * | replace
| ) |  |

Replace 'search' by 'replace' within 'str'. If needed 'str' is resized using realloc() to fit the modified string. The new pointer to the string is returned.

Definition at line 681 of file support.c.

Referenced by html_special_chars().

## ◆ fc_support_free()

void fc_support_free | ( | void |  | ) |

Free misc resources allocated by the support module.

Definition at line 1347 of file support.c.

Referenced by libfreeciv_free().

## ◆ fc_support_init()

void fc_support_init | ( | void |  | ) |

Initialize support module.

Definition at line 1329 of file support.c.

Referenced by libfreeciv_init().

## ◆ fc_tolower()

char fc_tolower | ( | char | c | ) |

Wrapper function to work around broken libc implementations. See above.

Definition at line 1273 of file support.c.

Referenced by cmdarg_compare(), events_init(), fc_strncasequotecmp(), and load_city_name_list().

## ◆ fc_toupper()

char fc_toupper | ( | char | c | ) |

Wrapper function to work around broken libc implementations. See above.

Definition at line 1262 of file support.c.

Referenced by capitalized_string(), and server_player_set_name_full().

## ◆ fc_usleep()

void fc_usleep | ( | unsigned long | usec | ) |

Suspend execution for the specified number of microseconds.

Definition at line 639 of file support.c.

Referenced by client_start_server(), move_unit_map_canvas(), put_nuke_mushroom_pixmaps(), and timer_usleep_since_start().

## ◆ fc_vsnprintf()

int fc_vsnprintf | ( | char * | str,
|  | size_t | n,
|  | const char * | format,
|  | va_list | ap
| ) |  |

## ◆ is_bigendian()

static bool is_bigendian | ( | void |  | ) |

inlinestatic

Return whether the program is currently running on a bigendian system.

Definition at line 229 of file support.h.

Referenced by create_sprite(), create_surfaces(), get_first_pixel(), get_smaller_surface_rect(), getpixel(), load_gfxfile(), pixmap_put_overlay_tile_draw(), sprite_get_bounding_box(), and surface_get_pixbuf().

## ◆ is_reg_file_for_access()

bool is_reg_file_for_access | ( | const char * | name,
|  | bool | write_access
| ) |  |

Returns TRUE iff the file is a regular file or a link to a regular file or write_access is TRUE and the file doesn't exists yet.

Definition at line 1120 of file support.c.

Referenced by fz_from_file(), lua_command(), manual_start(), read_init_script_real(), and write_init_script().

## ◆ make_escapes()

void make_escapes | ( | const char * | str,
|  | char * | buf,
|  | size_t | buf_len
| ) |  |

Copies a string and convert the following characters:

- '
  ' to "\\n".
- '\' to "\\\\". - '\"' to "\"". See also remove_escapes().

Definition at line 294 of file support.c.

Referenced by entry_to_file().

## ◆ remove_escapes()

void remove_escapes | ( | const char * | str,
|  | bool | full_escapes,
|  | char * | buf,
|  | size_t | buf_len
| ) |  |

Copies a string. Backslash followed by a genuine newline always removes the newline. If full_escapes is TRUE:

- '
  ' -> newline translation.
- Other '\?' sequences (any character '?') are just passed through with the '\' removed (eg, includes '\', '"'). See also make_escapes().

Definition at line 330 of file support.c.

Referenced by entry_from_token().