/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef UTIL_H
#define UTIL_H

#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <time.h>

#ifdef USE_CRYPT
#if defined __Linux__
#include <crypt.h>
#endif
#endif
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <stdarg.h>
#include <pwd.h>
#include <grp.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <limits.h>

#include "io.h"
#include "wrapper.h"

int str2int(const char *);
char * substring(const char *, int, int);
char * str_replace(const char *, const char *, const char *);
char * trim(const char *);

char * stripcrlf(char *);
char * str2upper(const char *);
char * str2lower(const char *);
char * getlocaltime(void);
char * getdate(void);
char * gettime(void);
char * formatdate(int);
char * addslashes(char *);
char * xstrdup(const char *, ...);
#ifdef USE_CRYPT
char * md5(const char *);
#endif
void vsysdaemonlog(const char *, const char *, const char *, va_list);
void sysdaemonlog(const char *, const char *, const char *, ...);
int getuidbyname(const char *);
int getgidbyname(const char *);
char *get_homedir(void);
char *get_currentdir(void);
char *get_dir_cdup(const char *);
unsigned int fexist(const char *, char);
char * file_exists (const char *, const char *);

int init_perl_script(const char *, int *);
int process_daemon(void);
#endif


syntax highlighted by Code2HTML, v. 0.9.1