1 /**
2  * Utility Functions
3  *
4  * Copyright (C) 2001-2014
5  * by Jeffrey Fulmer <jeff@joedog.org>, et al.
6  * This file is part of Siege
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  *
22  */
23 #ifndef  UTIL_H
24 #define  UTIL_H
25 
26 #include <setup.h>
27 #include <joedog/boolean.h>
28 
29 void    parse_time(char *p);
30 float   elapsed_time(clock_t time);
31 char *  substring(char *str, int start, int len);
32 void    pthread_sleep_np(unsigned int seconds);
33 void    pthread_usleep_np(unsigned long usec);
34 int     pthread_rand_np(unsigned int *ctx);
35 int     urandom();
36 BOOLEAN strmatch(char *str1, char *str2);
37 BOOLEAN startswith(const char *pre, const char *str);
38 BOOLEAN endswith(const char *suffix, const char *str);
39 BOOLEAN okay(int code);
40 void    echo(const char *fmt, ...);
41 void    debug (const char *fmt, ...);
42 char *  uppercase(char *s, size_t len);
43 char *  lowercase(char *s, size_t len);
44 char *  stristr(const char *haystack, const char *needle);
45 #ifndef strnlen
46 size_t  strnlen(const char *str, size_t len);
47 #endif
48 #ifndef strncasestr
49 const char * strncasestr(const char *str1, const char *str2, size_t len);
50 #endif
51 
52 #endif /*UTIL_H*/
53 
54