Crossfire Client, Trunk  R20612
misc.c File Reference
#include "client.h"
#include <errno.h>
#include <sys/wait.h>
+ Include dependency graph for misc.c:

Go to the source code of this file.


static const char * getLogLevelText (LogLevel level)
void LOG (LogLevel level, const char *origin, const char *format,...)
int make_path_to_file (char *filename)
void replace_chars_with_string (char *buffer, const guint16 buffer_size, const char find, const char *replace)



Detailed Description

Contains misc useful functions that may be useful to various parts of code, but are not especially tied to it.

Definition in file misc.c.

Function Documentation

static const char* getLogLevelText ( LogLevel  level)

Definition at line 92 of file misc.c.

References LOG_CRITICAL.

Referenced by LOG().

+ Here is the caller graph for this function:

void LOG ( LogLevel  level,
const char *  origin,
const char *  format,

Log messages of a certain importance to stderr. See 'client.h' for a full list of possible log levels.

Definition at line 109 of file misc.c.

References getLogLevelText(), and MINLOG.

Referenced by AccountPlayersCmd(), add_marked_text_to_pane(), AddMeFail(), AddMeSuccess(), AddspellCmd(), AnimCmd(), cache_newpng(), client_disconnect(), client_negotiate(), client_run(), common_item_command(), CompleteCmd(), config_check(), config_load_legacy(), DeleteInventory(), DeleteItem(), DeleteSpell(), display_newpng(), do_num_free_items(), draw_magic_map(), DrawExtInfoCmd(), DrawInfoCmd(), event_loop(), Face2Cmd(), FailureCmd(), finish_face_cmd(), get_class_info(), get_exp_info(), get_image_info(), get_image_sums(), get_new_char_info(), get_race_info(), get_skill_info(), get_starting_map_info(), get_type_from_name(), GoodbyeCmd(), handle_query(), Image2Cmd(), image_add_hash(), image_find_hash(), image_process_line(), image_remove_hash(), init_default_keybindings(), init_image_cache_data(), init_ui(), inventory_get_styles(), inventory_init(), keybind_insert(), keybinding_get_data(), keybinding_selection_func(), keyfunc(), list_selection_func(), load_image(), load_theme(), MagicMapCmd(), Map2Cmd(), map_scrollCmd(), mapdata_init(), mapdata_set_anim_layer(), menu_quit_program(), metaserver_connect_to(), MusicCmd(), on_combobox_rcs_changed(), on_keybinding_button_remove_clicked(), on_keybinding_button_update_clicked(), on_spell_cast_clicked(), on_spell_invoke_clicked(), on_spell_treeview_row_activated(), on_window_destroy_event(), parse_args(), parse_keybind_line(), parse_keys_file(), pickup_init(), PlayerCmd(), png_to_data(), process_race_class_info(), ReplyInfoCmd(), rescale_rgba_data(), save_keys(), script_init(), send_command(), setup_config_dialog(), SetupCmd(), SockList_AddChar(), SockList_AddInt(), SockList_AddShort(), SockList_Send(), Sound2Cmd(), spell_get_styles(), stats_get_styles(), StatsCmd(), trigger_skill(), unbind_key(), UpdateItemCmd(), UpdspellCmd(), and VersionCmd().

+ Here is the call graph for this function:

int make_path_to_file ( char *  filename)

If any directories in the given path doesn't exist, they are created.

Definition at line 85 of file misc.c.

Referenced by save_keys().

+ Here is the caller graph for this function:

void replace_chars_with_string ( char *  buffer,
const guint16  buffer_size,
const char  find,
const char *  replace 

Convert a buffer of a specified maximum size by replacing token characters with a provided string. Given a buffered template string "/input/to/edit", the maximum size of the buffer, a token '/', and a replacement string ":", the input string is transformed to ":input:to:edit". If the replacement string is empty, the token characters are simply removed. The template is processed from left to right, replacing token characters as they are found. Replacement strings are always inserted whole. If token replacement would overflow the size of the conversion buffer, the token is not replaced, and the remaining portion of the input string is appended after truncating it as required to avoid overfilling the buffer.

bufferA string to perform a find and replace operation on.
buffer_sizeAllocated buffer size (used to avoid buffer overflow).
findA token character to find and replace in the buffer.
replaceA string that is to replace each token in the buffer.

Definition at line 50 of file misc.c.

Variable Documentation


Log level, or the threshold below which messages are suppressed.

Definition at line 32 of file misc.c.

Referenced by LOG(), and parse_args().