Defines | Functions | Variables

utils.cpp File Reference

Provides basic utils. More...

#include <string>
#include <vector>
#include <stack>
#include <list>
#include <map>
#include <sstream>
#include <iostream>
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include <stdlib.h>
#include <errno.h>
#include "utils/memleak.h"
#include "utils/my_assert.h"
#include "utils.h"
#include "params.h"
#include "match.h"
#include "md5.h"
#include "stats.h"
#include "thread/mutex.h"
#include "log.h"
#include "utils/my_getpid.h"
#include "eval.h"
#include "misc/shutdown.h"
#include "irc.h"
#include "utils/precomp.h"

Go to the source code of this file.

Defines

#define VSNPRINTF   vsnprintf

Functions

void byte_stream_reverse (void *buf, size_t cnt)
 Reverses the buffer at bytes.
bool cmp_strings_case_insensitive (string s1, string s2)
 Compares two strings, case in-sensitive.
bool cmp_strings_case_insensitive (const char *s1, const char *s2, size_t size)
 Compares two strings, case in-sensitive.
double debug_timer_end (clock_t diff, const char *file, const char *func, int begin_line, int end_line, const char *debug, unsigned sleep_ms)
 Provides execution time measuring for debugging (end of measuring).
string escape_string_for_logs_1 (string str)
string explode (const string &src, char delim, vector< string > &res, bool accept_empties)
 Splits string by delimiter.
void explode (const string &str, const string &separator, vector< string > &res)
 Splits string by delimiter.
uint32 ip2long (const string &ip)
 Converts IPv4 string to decimal-integer-encoded IPv4 address.
string long2ip (uint32 ip)
 Converts decimal-integer-encoded IPv4 address to string.
string make_nice_time (my_time_t src, bool brackets, bool year_substract1970, bool for_filename)
 Returns text representation of time.
string make_nice_time_days_only (my_time_t src, const char *days_word)
 Returns text representation of time (without years and months, only number of days).
my_time_t my_time (my_time_t *ptr)
void nice_time_set_time_offset (const string &timezone)
 Sets time offset.
string return_string (string str)
 Simple returns string for preprocessor macros.
void str_kill_trailing_eol (char *str)
 Kills trailing EOL(s) in the string.
string str_to_lower (string str)
 Converts string to lower case (using tolowertab[] in match.cpp).
string str_to_upper (string str)
 Converts string to UPPER case (using touppertab[] in match.cpp).
uint32 swap_bytes (uint32 data)
void util_debug_report_close (bool close)
 Closes file for debug reports, or creates new one (for log rotation).
int util_debug_report_done (int rc)
 Closes file for debug reports.
string util_debug_report_init ()
 Opens file for debug reports.
void util_debug_report_suppress ()
 Suppresses debug reporting from now on.
void util_debug_report_sync ()
 Flushes both file descriptor and Windows(TM) file handle (synchronisation).
int util_my_report_hook (int rpt_type, char *msg, int *ret_val)
string utils_convert_unix_path (const string &path)
 On win32, convert slashes to backslashes, on UNIX it's harmless. Also removes redundant slashes (like "abc\\\\def", or "./abc//def///").
static string utils_create_debug_report_filename ()
 Constructs a filename for verbose debug log.
void utils_debug_report (int severity, const char *fl, const char *fn, int ln, const char *fmt,...)
 Debugging reports.
void utils_deep_sleep (int seconds)
 Causes bot to sleep, while giving CPU time to process tasks such as DCC loop, or checking for bot interrup event (Ctrl+C, or SIGINT signal, and so on).
string utils_get_timezone ()
 Report time offset to logs, on startup.

Variables

static bool debug_report_suppress = false
static string nice_time_offset = "+0000"
c_mutex nice_time_offset_m
static string nice_time_offset_old = "+0000"
static int nice_time_offset_to_add_secs = 0
string util_debug_file_timestamp
 Timestamp for creating unique debug report log filename.
FILE * util_debug_report_file = NULL
 File handle for debug reports.
c_mutex util_debug_report_file_m
bool utils_has_msvc_dbg_hook = false

Detailed Description

Provides basic utils.

Definition in file utils.cpp.


Generated on Sat Aug 7 2010 15:26:23 for VooDoo cIRCle by doxygen 1.7.1

Get VooDoo cIRCle at SourceForge.net. Fast, secure and Free Open Source software downloads