"Fossies" - the Fresh Open Source Software Archive 
Member "tcpflow-1.6.1/src/be13_api/utils.h" (19 Feb 2021, 2104 Bytes) of package /linux/misc/tcpflow-1.6.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "utils.h" see the
Fossies "Dox" file reference documentation and the last
Fossies "Diffs" side-by-side code changes report:
1.4.5_vs_1.5.0.
1 /****************************************************************
2 *** utils.h
3 ***
4 *** To use utils.c/utils.h, be sure this is in your configure.ac file:
5 m4_include([be13_api/be13_configure.m4])
6 ***
7 ****************************************************************/
8
9
10
11 #ifndef UTILS_H
12 #define UTILS_H
13
14 #include <sys/types.h>
15 #include <stdint.h>
16 #include <sys/time.h>
17
18 #if defined(__cplusplus)
19 #include <string>
20 #include <vector>
21 bool ends_with(const std::string &buf,const std::string &with);
22 bool ends_with(const std::wstring &buf,const std::wstring &with);
23 std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems);
24 std::vector<std::string> split(const std::string &s, char delim);
25 #endif
26
27
28
29 #ifndef __BEGIN_DECLS
30 #if defined(__cplusplus)
31 #define __BEGIN_DECLS extern "C" {
32 #define __END_DECLS }
33 #else
34 #define __BEGIN_DECLS
35 #define __END_DECLS
36 #endif
37 #endif
38
39 __BEGIN_DECLS
40
41 #ifdef HAVE_ERR_H
42 #include <err.h>
43 #else
44 [[noreturn]] void err(int eval,const char *fmt,...) __attribute__((format(printf, 2, 0)));
45 [[noreturn]] void errx(int eval,const char *fmt,...) __attribute__((format(printf, 2, 0)));
46 void warn(const char *fmt, ...) __attribute__((format(printf, 1, 0)));
47 void warnx(const char *fmt,...) __attribute__((format(printf, 1, 0)));
48 #endif
49
50 #ifndef HAVE_LOCALTIME_R
51 #ifdef __MINGW32__
52 #undef localtime_r
53 #endif
54 void localtime_r(time_t *t,struct tm *tm);
55 #endif
56
57 #ifndef HAVE_GMTIME_R
58 #ifdef __MINGW32__
59 #undef gmtime_r
60 #endif
61 void gmtime_r(time_t *t,struct tm *tm);
62 #endif
63
64 int64_t get_filesize(int fd);
65
66 #ifndef HAVE_ISHEXNUMBER
67 int ishexnumber(int c);
68 inline int ishexnumber(int c)
69 {
70 switch(c){
71 case '0': case '1': case '2': case '3': case '4':
72 case '5': case '6': case '7': case '8': case '9':
73 case 'A': case 'B': case 'C': case 'D': case 'E':
74 case 'F': case 'a': case 'b': case 'c': case 'd':
75 case 'e': case 'f':
76 return 1;
77 }
78 return 0;
79 }
80 #endif
81 __END_DECLS
82
83
84 #endif