Crossfire Client, Branches  R11627
misc.c File Reference
#include "client.h"
#include <stdarg.h>
#include <stdio.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
+ Include dependency graph for misc.c:

Go to the source code of this file.

Functions

void clearLogListener (void)
 
static const char * getLogLevelText (LogLevel level)
 
char * getLogText (const LogEntry *le)
 
char * getLogTextRaw (LogLevel level, const char *origin, const char *message)
 
void LOG (LogLevel level, const char *origin, const char *format,...)
 
void logChildPipe (ChildProcess *child, LogLevel level, int flag)
 
void logPipe (ChildProcess *child, LogLevel level, int pipe)
 
int make_path_to_dir (char *directory)
 
int make_path_to_file (char *filename)
 
void monitorChilds (void)
 
void purgePipe (ChildProcess *cp, int pipe)
 
ChildProcessraiseChild (char *name, int flag)
 
int setLogListener (LogListener li)
 
char * strdup_local (const char *str)
 

Variables

ChildProcessFirstChild =NULL
 
ChildProcessLastChild =NULL
 
int logcount =0
 
LogEntryLogFirst =NULL
 
LogEntryLogLast =NULL
 
static const char *const LogLevelTexts []
 
LogListener loglist =NULL
 
int MINLOG =MINLOGLEVEL
 
const char *const rcsid_common_misc_c
 

Function Documentation

void clearLogListener ( void  )

Definition at line 143 of file misc.c.

static const char* getLogLevelText ( LogLevel  level)
static

Definition at line 154 of file misc.c.

References LOG_CRITICAL.

Referenced by getLogTextRaw().

+ Here is the caller graph for this function:

char* getLogText ( const LogEntry le)

Definition at line 164 of file misc.c.

References getLogTextRaw(), LogEntry::level, LogEntry::message, and LogEntry::origin.

Referenced by createBugTracker(), gtkLogListener(), and LOG().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

char* getLogTextRaw ( LogLevel  level,
const char *  origin,
const char *  message 
)

Definition at line 157 of file misc.c.

References getLogLevelText().

Referenced by getLogText().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 178 of file misc.c.

References getLogText(), LogEntry::level, LOG_APPEND, LOG_NEW_ENTRY, LOG_SETMESSAGE, and LOG_SETORIGIN.

Referenced by add_to_textbuf(), AddMeFail(), AddMeSuccess(), AddspellCmd(), admin_callback(), AnimCmd(), book_callback(), check_x_events(), client_exit(), common_item_command(), CompleteCmd(), configdialog(), create_icon_image(), DeleteInventory(), DeleteItem(), DeleteSpell(), display_newpng(), do_network(), do_num_free_items(), draw_info(), draw_magic_map(), DrawExtInfoCmd(), DrawInfoCmd(), event_loop(), Face2Cmd(), fill_combobox_from_datadir(), finish_face_cmd(), get_exp_info(), get_image_info(), get_image_sums(), get_skill_info(), get_type_from_name(), gLogHandler(), GoodbyeCmd(), gtk_draw_map(), handle_query(), Image2Cmd(), image_add_hash(), image_find_hash(), image_process_line(), image_remove_hash(), info_get_styles(), init_cache_data(), init_client_vars(), init_connection(), init_keys(), init_sounds(), init_windows(), inscribe_magical_scroll(), insert_key(), inventory_get_styles(), inventory_init(), keybinding_get_data(), keybinding_selection_func(), keyfunc(), keys_init(), list_selection_func(), load_a_font(), load_defaults(), load_image(), load_theme(), load_window_positions(), logPipe(), MagicMapCmd(), main(), make_path_to_file(), Map2Cmd(), map_scrollCmd(), mapdata_init(), menu_quit_program(), message_callback(), metaserver1_get_info(), metaserver1_thread(), metaserver2_get_info(), metaserver2_writer(), monitorChilds(), motd_callback(), MusicCmd(), negotiate_connection(), 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(), pickup_init(), play_sound(), PlayerCmd(), png_to_data(), purgePipe(), raiseChild(), ReplyInfoCmd(), rescale_rgba_data(), save_defaults(), save_keys(), script_init(), send_command(), set_window_pos(), setup_config_window(), SetupCmd(), SockList_ReadPacket(), Sound2Cmd(), SoundCmd(), spell_get_styles(), stats_get_styles(), StatsCmd(), unbind_key(), UpdateItemCmd(), UpdspellCmd(), VersionCmd(), void_callback(), write_media_with_state(), and write_socket().

+ Here is the call graph for this function:

void logChildPipe ( ChildProcess child,
LogLevel  level,
int  flag 
)

Definition at line 290 of file misc.c.

References CHILD_STDERR, CHILD_STDOUT, ChildProcess::flag, and logPipe().

Referenced by init_sounds().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void logPipe ( ChildProcess child,
LogLevel  level,
int  pipe 
)

Definition at line 271 of file misc.c.

References PipeLog::level, LOG(), PipeLog::log, LOG_WARNING, ChildProcess::logger, PipeLog::name, ChildProcess::name, ChildProcess::pid, and ChildProcess::tube.

Referenced by logChildPipe().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int make_path_to_dir ( char *  directory)

Definition at line 53 of file misc.c.

References MAX_BUF.

int make_path_to_file ( char *  filename)

Definition at line 94 of file misc.c.

References LOG(), LOG_ERROR, and MAX_BUF.

Referenced by save_defaults(), and save_keys().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void monitorChilds ( void  )

Definition at line 239 of file misc.c.

References FirstChild, LOG(), PipeLog::log, LOG_INFO, ChildProcess::logger, ChildProcess::name, ChildProcess::next, ChildProcess::pid, and purgePipe().

Referenced by check_x_events(), and gtk_checkchilds().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void purgePipe ( ChildProcess cp,
int  pipe 
)

Definition at line 210 of file misc.c.

References PipeLog::level, LOG(), LOG_ERROR, ChildProcess::logger, PipeLog::name, ChildProcess::name, and ChildProcess::tube.

Referenced by monitorChilds().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ChildProcess* raiseChild ( char *  name,
int  flag 
)

Definition at line 297 of file misc.c.

References CHILD_PIPEERR, CHILD_PIPEIN, CHILD_PIPEOUT, CHILD_SILENTFAIL, CHILD_STDERR, CHILD_STDIN, CHILD_STDOUT, CHILD_TUBE, ChildProcess::flag, LOG(), LOG_ERROR, LOG_INFO, name, ChildProcess::name, ChildProcess::next, and ChildProcess::pid.

Referenced by init_sounds().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int setLogListener ( LogListener  li)

Definition at line 137 of file misc.c.

Referenced by main().

+ Here is the caller graph for this function:

char* strdup_local ( const char *  str)

Variable Documentation

ChildProcess* FirstChild =NULL

Definition at line 207 of file misc.c.

Referenced by monitorChilds().

ChildProcess* LastChild =NULL

Definition at line 208 of file misc.c.

int logcount =0

Definition at line 135 of file misc.c.

LogEntry* LogFirst =NULL

Definition at line 133 of file misc.c.

Referenced by createBugTracker().

LogEntry* LogLast =NULL

Definition at line 134 of file misc.c.

const char* const LogLevelTexts[]
static
Initial value:
= {
" DEBUG ",
" INFO ",
"WARNING ",
" ERROR ",
"CRITICAL",
"UNKNOWN ",
}

Definition at line 146 of file misc.c.

LogListener loglist =NULL

Definition at line 136 of file misc.c.

int MINLOG =MINLOGLEVEL

Definition at line 174 of file misc.c.

Referenced by init_windows(), and parse_args().

const char* const rcsid_common_misc_c
Initial value:
=
"$Id: misc.c 11626 2009-04-04 12:41:46Z lalo $"

Definition at line 1 of file misc.c.