Go to the source code of this file.
Functions | |
void | error (const char *format,...) |
Print a formated message to stderr or to the logfile if no tty exist. | |
int | is_strdefined (char *p) |
char * | stripfilename (char *path) |
Strip the path and return only the filename. | |
void | chomp (char *string) |
Removes everything from the first newline (CR|LF). | |
char * | trim (char *s) |
Remove leading and trailing space from the string. | |
char * | ltrim (char *s) |
Remove leading white space [ \t\r ] from the string. | |
char * | rtrim (char *s) |
Remove trailing white space [ \t\r ] from the string. | |
char * | trim_quotes (char *s) |
Remove any enclosing quotes ["'] from the string. | |
int | starts_with (char *a, char *b) |
Return TRUE if the string a starts with the string b. | |
void | handle_string_escapes (char *buf) |
Exchanges \escape sequences in a string. | |
Process_T | get_process (char *name) |
int | exist_process (char *name) |
void | printrunlist () |
Print the Runtime object. | |
void | printprocess (Process_T p) |
Print a process object. | |
void | printprocesslist () |
Print all the processes in the processlist. | |
pid_t | get_pid (char *pidfile) |
Open and read the pid from the given pidfile. | |
int | is_process_running (Process_T p) |
char * | get_RFC1123date (long *date) |
Returns a (RFC1123) Date string. | |
char * | get_ctime () |
Get a non terminated ctime. | |
char * | get_process_uptime (char *pidfile) |
Compute an uptime string for a process based on the ctime from the pidfile. | |
char * | get_uptime (time_t delta) |
Compute an uptime string based on the delta time in seconds. | |
int | set_md5sum (char **dest, char *file) |
Compute a md5 checksum for the given file and save the result in an allocated area pointed to by dest. | |
char * | get_md5sum (char *file) |
int | check_md5 (char *file, char *sum) |
char * | url_encode (char *uri) |
Escape an uri string converting unsafe characters to a hex (xx) representation. | |
char * | get_basic_authentication_header () |
char * | format (const char *s, va_list ap) |
Do printf style format line parsing. | |
void | redirect_stdfd () |
Redirect the standard file descriptors to /dev/null and route any error messages to the log file. |
Definition in file util.c.
|
Definition at line 918 of file util.c. References ASSERT, and get_md5sum(). |
|
Removes everything from the first newline (CR|LF).
Definition at line 143 of file util.c. References ASSERT. Referenced by check_ftp(), check_http(), check_imap(), check_nntp(), check_pop(), check_smtp(), check_ssh(), and get_ctime(). |
|
Print a formated message to stderr or to the logfile if no tty exist.
Definition at line 86 of file util.c. References ASSERT, format(), myrun::have_tty, log(), and Run. Referenced by check_process(), create_ssl_server_socket(), create_ssl_socket(), d_check_process(), embed_accepted_ssl_socket(), embed_ssl_socket(), init_ssl_server(), kill_daemon(), log_close(), new_ssl_connection(), recv_ssl_socket(), redirect_stdfd(), send_ssl_socket(), start_httpd(), xcalloc(), xmalloc(), and xresize(). |
|
Definition at line 343 of file util.c. References ASSERT, is, myprocess::name, myprocess::next, and processlist. |
|
Do printf style format line parsing.
Definition at line 1009 of file util.c. References ASSERT, xmalloc(), and xresize(). Referenced by error(). |
|
Definition at line 981 of file util.c. References myrun::Auth, myrun::myautentication::defined, encode_base64(), myrun::myautentication::passwd, Run, myrun::myautentication::uname, xmalloc(), and xstrdup(). Referenced by d_check_process(). |
|
Get a non
|
|
Definition at line 869 of file util.c. References ASSERT, isreg_file(), and xstrdup(). Referenced by check_md5(), and set_md5sum(). |
|
Open and read the pid from the given pidfile.
Definition at line 649 of file util.c. References ASSERT, exist_file(), isreg_file(), log(), prog, and STRERROR. Referenced by is_process_running(). |
|
Definition at line 321 of file util.c. References ASSERT, is, myprocess::name, myprocess::next, and processlist. Referenced by check_process(). |
|
Compute an uptime string for a process based on the ctime from the pidfile. The caller must free the returned string.
Definition at line 788 of file util.c. References ASSERT, get_timestamp(), get_uptime(), and xstrdup(). Referenced by status(). |
|
Returns a (RFC1123) Date string. If the given date is NULL compute the date now.
Definition at line 726 of file util.c. References xstrdup(). Referenced by sendmail(). |
|
Compute an uptime string based on the delta time in seconds. The caller must free the returned string.
Definition at line 814 of file util.c. References xstrdup(). Referenced by get_process_uptime(). |
|
Exchanges \escape sequences in a string.
Definition at line 262 of file util.c. References ASSERT. |
|
Definition at line 698 of file util.c. References ASSERT, get_pid(), getpgid(), and myprocess::pidfile. Referenced by check_process(), and exist_daemon(). |
|
|
|
Remove leading white space [ \t\r
Definition at line 176 of file util.c. References ASSERT. Referenced by trim(). |
|
|
Print all the processes in the processlist.
Definition at line 624 of file util.c. References myprocess::next, printprocess(), and processlist. |
|
Print the Runtime object.
Definition at line 361 of file util.c. References myrun::allowselfcert, myrun::Auth, myrun::bind_addr, myrun::controlfile, myrun::debug, myrun::myautentication::defined, myrun::dohttpd, myrun::dolog, myrun::doprocess, myrun::myformat::from, myrun::httpdport, myrun::httpdssl, myrun::httpsslclientpem, myrun::httpsslpem, myrun::isdaemon, myrun::logfile, myrun::MailFormat, myrun::mailserver, myrun::myformat::message, myrun::pidfile, myrun::polltime, Run, myrun::myformat::subject, and myrun::use_syslog. |
|
Redirect the standard file descriptors to /dev/null and route any error messages to the log file.
Definition at line 1042 of file util.c. References error(), myrun::have_tty, Run, and STRERROR. Referenced by daemonize(), and spawn(). |
|
Remove trailing white space [ \t\r
Definition at line 194 of file util.c. References ASSERT. Referenced by trim(). |
|
Compute a md5 checksum for the given file and save the result in an allocated area pointed to by dest. The caller is responsible for freeing dest.
Definition at line 853 of file util.c. References ASSERT, and get_md5sum(). |
|
Return TRUE if the string a starts with the string b.
|
|
Strip the path and return only the filename.
Definition at line 126 of file util.c. References ASSERT. Referenced by main(). |
|
Remove leading and trailing space from the string.
|
|
Remove any enclosing quotes ["'] from the string.
Definition at line 214 of file util.c. References ASSERT. |
|
Escape an uri string converting unsafe characters to a hex (xx) representation. The caller must free the returned string.
|