util.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2011 Equinor ASA, Norway.
3
4 The file 'util.h' is part of ERT - Ensemble based Reservoir Tool.
5
6 ERT is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 ERT is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.
14
15 See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
16 for more details.
17*/
18
19#ifndef ERT_UTIL_H
20#define ERT_UTIL_H
21
22#include <stdbool.h>
23#include <stdio.h>
24#include <stdint.h>
25#include <stdarg.h>
26#include <sys/types.h>
27#include <time.h>
28
29
30#include <ert/util/ert_api_config.hpp>
31
32
33
34#ifdef ERT_HAVE_GETUID
35#include <sys/stat.h>
36#endif
37
38#ifdef ERT_WINDOWS
39#define UTIL_PATH_SEP_STRING "\\" /* A \0 terminated separator used when we want a (char *) instance. */
40#define UTIL_PATH_SEP_CHAR '\\' /* A simple character used when we want an actual char instance (i.e. not a pointer). */
41#else
42#define UTIL_PATH_SEP_STRING "/" /* A \0 terminated separator used when we want a (char *) instance. */
43#define UTIL_PATH_SEP_CHAR '/' /* A simple character used when we want an actual char instance (i.e. not a pointer). */
44#endif
45
46#define UTIL_WINDOWS_PATH_SEP_CHAR '\\'
47#define UTIL_POSIX_PATH_SEP_CHAR '/'
48
49#define UTIL_NEWLINE_STRING " \n"
50#define UTIL_DEFAULT_MKDIR_MODE 0777 /* Directories are by default created with mode a+rwx - and then comes the umask ... */
51
52
53#ifdef __cplusplus
54extern"C" {
55#endif
56
57
58/*
59 These ifdefs are an attempt to support large files (> 2GB)
60 transparently on both Windows and Linux. See source file
61 libert_util/src/util_lfs.c for more details.
62
63 During the configure step CMAKE should check the size of (void *)
64 and set the ERT_WINDOWS_LFS variable to true if a 64 bit platform is
65 detected.
66*/
67
68#ifdef ERT_WINDOWS_LFS
69typedef struct _stat64 stat_type;
70typedef __int64 offset_type;
71#else
72typedef struct stat stat_type;
73#ifdef HAVE_FSEEKO
74 typedef off_t offset_type;
75#else
76 typedef long offset_type;
77#endif
78#endif
79
80
81
82/*****************************************************************/
83/*
84
85*/
86
87
88/*****************************************************************/
89typedef void (walk_file_callback_ftype) (const char * , /* The current directory */
90 const char * , /* The current file / directory */
91 void *); /* Arbitrary argument */
92
93typedef bool (walk_dir_callback_ftype) (const char * , /* The current directory */
94 const char * , /* The current file / directory */
95 int , /* The current depth in the file hiearcrcy. */
96 void *); /* Arbitrary argument */
97
98
99 char * util_get_timezone(void);
100 time_t util_make_datetime_utc(int , int , int , int , int , int );
101 bool util_make_datetime_utc_validated(int sec, int min, int hour , int mday , int month , int year, time_t * t);
102 time_t util_make_date_utc(int , int , int);
104 void util_inplace_forward_seconds_utc(time_t * t , double seconds);
105 void util_inplace_forward_days_utc(time_t * t , double days);
106
107 time_t util_file_mtime(const char * file);
108 double util_difftime(time_t , time_t , int * , int * , int * , int *);
109 double util_difftime_days(time_t , time_t );
110 double util_difftime_seconds( time_t start_time , time_t end_time);
111 bool util_after( time_t t , time_t limit);
112 bool util_before( time_t t , time_t limit);
113 bool util_file_newer( const char * file , time_t t0);
114 bool util_file_older( const char * file , time_t t0);
115
118
119 double util_pow10(double x);
120 bool util_char_in(char c, int , const char *);
121 char * util_alloc_sprintf_va(const char * fmt , va_list ap);
122 char * util_alloc_sprintf(const char * , ...);
123 char * util_realloc_sprintf(char * , const char * , ...);
124 bool util_fscanf_date_utc(FILE * , time_t *);
125 bool util_sscanf_date_utc(const char * , time_t *);
126 bool util_sscanf_isodate(const char * , time_t *);
127 bool util_sscanf_percent(const char * string, double * value);
128 bool util_is_executable(const char * );
129 bool util_entry_exists( const char * entry );
130 bool util_file_exists(const char *);
131 bool util_is_abs_path(const char * );
132 char * util_alloc_abs_path( const char * path );
133 char * util_alloc_rel_path( const char * __root_path , const char * path);
134 bool util_fmt_bit8 (const char *);
135 bool util_fmt_bit8_stream(FILE * );
136 char * util_strstr_int_format(const char * string );
137 int util_int_format_count(const char * string );
138 bool util_mkdir_p(const char * path);
139 void util_make_path (const char *);
140 char * util_newest_file(const char *, const char *);
141 double util_file_difftime(const char * , const char *);
142 bool util_file_update_required(const char *, const char *);
143 size_t util_file_size(const char *);
144 size_t util_fd_size(int fd);
145 void util_clear_directory(const char *path, bool strict_uid , bool unlink_root);
146 void util_unlink_existing(const char *filename);
147 void util_strupr(char *);
148 bool util_string_equal(const char * s1 , const char * s2 );
149 char * util_alloc_strupr_copy(const char * );
150 void util_string_tr(char * , char , char);
151 bool util_copy_stream(FILE *, FILE *, size_t , void * , bool abort_on_error);
152 void util_move_file(const char * src_file , const char * target_file);
153 void util_move_file4( const char * src_name , const char * target_name , const char *src_path , const char * target_path);
154 bool util_copy_file(const char * , const char * );
155 bool util_copy_file__(const char * src_file , const char * target_file, size_t buffer_size , void * buffer , bool abort_on_error);
156 char * util_alloc_cwd(void);
157 bool util_is_cwd( const char * path );
158 char * util_alloc_normal_path( const char * input_path );
159 char * util_alloc_realpath(const char * );
160 char * util_alloc_realpath__(const char * input_path);
161 bool util_string_match(const char * string , const char * pattern);
162 bool util_string_has_wildcard( const char * s);
163 bool util_file_readable( const char * file );
164 bool util_entry_readable( const char * entry );
165 bool util_entry_writable( const char * entry );
166 bool util_ftruncate(FILE * stream , long size);
167
168 void util_usleep( unsigned long micro_seconds );
169
170 int util_roundf( float x );
171 int util_round( double x );
172
173 offset_type util_ftell(FILE * stream);
174 int util_fseek(FILE * stream, offset_type offset, int whence);
175 void util_rewind(FILE * stream);
176 int util_stat(const char * filename , stat_type * stat_info);
177 int util_fstat(int fileno, stat_type * stat_info);
178
179
180
181#ifdef ERT_HAVE_OPENDIR
182 void util_copy_directory_content(const char * src_path , const char * target_path);
183 void util_copy_directory(const char * , const char *);
184 void util_walk_directory(const char * root_path , walk_file_callback_ftype * file_callback , void * file_callback_arg , walk_dir_callback_ftype * dir_callback , void * dir_callback_arg);
185#endif
186
187
188#ifdef ERT_HAVE_GETUID
189 uid_t util_get_entry_uid( const char * file );
190 mode_t util_getmode( const char * filename);
191 bool util_addmode_if_owner( const char * filename , mode_t add_mode );
192 bool util_delmode_if_owner( const char * filename , mode_t del_mode);
193 bool util_chmod_if_owner( const char * filename , mode_t new_mode);
194#endif
195
196 int util_forward_line(FILE * , bool * );
197 void util_rewind_line(FILE *);
198
200 FILE * util_mkdir_fopen( const char * filename , const char * mode );
201 int util_fmove( FILE * stream , long offset , long shift);
202 FILE * util_fopen(const char * , const char *);
203 FILE * util_fopen__(const char * filename , const char * mode);
204 bool util_fopen_test(const char *, const char *);
205 char * util_split_alloc_dirname( const char * input_path );
206 char * util_split_alloc_filename( const char * input_path );
207 void util_alloc_file_components(const char * , char ** , char **, char **);
208 //char * util_realloc_full_path(char * , const char *, const char *);
209 char * util_alloc_tmp_file(const char * , const char * , bool );
210 char * util_fscanf_alloc_line(FILE *, bool *);
211 char * util_fscanf_alloc_token(FILE * );
212 void util_fskip_token(FILE * );
213 void util_fskip_space(FILE * , bool *);
214 void util_fskip_chars(FILE * , const char * , bool *);
215 void util_fskip_cchars(FILE * , const char * , bool *);
216 bool util_fscanf_int(FILE * , int * );
217 bool util_fscanf_bool(FILE * stream , bool * value);
218 bool util_sscanf_bool(const char * , bool *);
219 bool util_sscanf_octal_int(const char * buffer , int * value);
220 int util_strcmp_int( const char * s1 , const char * s2);
221 int util_strcmp_float( const char * s1 , const char * s2);
222 bool util_sscanf_int(const char * , int * );
223 const char * util_parse_int(const char * , int * , bool *);
224 const char * util_skip_sep(const char * , const char * , bool *);
225 bool util_sscanf_double(const char * , double * );
226 //char * util_alloc_full_path(const char *, const char *);
227 char * util_alloc_filename(const char * , const char * , const char * );
228 char * util_realloc_filename(char * , const char * , const char * , const char * );
229 char * util_alloc_strip_copy(const char *);
230 char * util_alloc_string_sum(const char ** , int);
231 char * util_strcat_realloc(char *, const char * );
232 char * util_alloc_string_copy(const char *);
233 char ** util_stringlist_append_copy(char ** , int , const char * );
234 char ** util_stringlist_append_ref(char ** , int , const char * );
235 char ** util_alloc_stringlist_copy(const char **, int );
236 void util_split_string(const char *, const char *, int *, char ***);
237 void util_path_split(const char * , int *, char ***);
238 char * util_alloc_parent_path( const char * path);
239 void util_binary_split_string(const char * , const char * , bool , char ** , char ** );
240 void util_binary_split_string_from_max_length(const char * , const char * , int , char ** , char ** );
241 char * util_alloc_joined_string(const char ** , int , const char * );
242 char * util_alloc_multiline_string(const char ** , int );
243 char * util_string_replace_alloc(const char *, const char *, const char *);
244 char * util_string_replacen_alloc(const char *, int , const char ** , const char **);
245 int util_string_replace_inplace(char ** , const char * , const char *);
246 char * util_string_strip_chars_alloc(const char *, const char * );
247 char * util_realloc_string_copy(char * , const char *);
248 char * util_realloc_substring_copy(char * , const char *, int N);
250 char * util_alloc_dequoted_copy(const char *s);
251 void util_free_stringlist(char **, int );
252 void util_free_NULL_terminated_stringlist(char ** string_list);
253 char * util_alloc_substring_copy(const char *, int offset , int N);
254 bool util_is_directory(const char * );
255 bool util_is_file(const char * );
256
257
258 void util_set_datetime_values_utc(time_t , int * , int * , int * , int * , int * , int *);
259 void util_set_date_values_utc(time_t , int * , int * , int * );
260
262
263 unsigned int util_dev_urandom_seed( );
264 unsigned int util_clock_seed( void );
265 void util_fread_dev_random(int , char * );
266 void util_fread_dev_urandom(int , char * );
267 bool util_string_isspace(const char * s);
268
271 bool util_addr2line_lookup(const void *, char **, char **, int *);
272 void util_exit(const char * fmt , ...);
275
276
277 void * util_realloc(void * , size_t );
278 void * util_malloc(size_t );
279 void * util_calloc( size_t elements , size_t element_size );
280 void * util_realloc_copy(void * org_ptr , const void * src , size_t byte_size );
281 void * util_alloc_copy(const void * , size_t );
282 void util_double_to_float(float * , const double * , int );
283 void util_float_to_double(double * , const float * , int );
284
285 int util_get_month_nr(const char * );
286
287 char * util_fread_alloc_file_content(const char * , int *);
288 void util_fwrite_string(const char * , FILE *);
289 char * util_fread_realloc_string(char * , FILE *);
291 void util_fskip_string(FILE *stream);
292 void util_endian_flip_vector(void * data , int element_size , int elements);
293
294
295 void util_clamp_double(double * value , double limit1, double limit2);
296 double util_double_vector_mean(int , const double * );
297 double util_double_vector_stddev(int , const double * );
298 void util_double_vector_max_min(int , const double *, double * , double *);
299 void util_update_double_max_min(double , double * , double * );
300 void util_update_float_max_min(float , float * , float * );
301 void util_update_int_max_min(int , int * , int * );
302 float util_float_max (float , float );
303 long int util_long_max(long int a , long int b);
304 int util_int_max (int , int);
305 double util_double_max(double , double );
306 float util_float_min (float , float );
307 int util_int_min (int , int);
308 size_t util_size_t_min(size_t a , size_t b);
309 size_t util_size_t_max(size_t a , size_t b);
310 time_t util_time_t_min(time_t a , time_t b);
311 time_t util_time_t_max(time_t a , time_t b);
312 double util_double_min(double , double );
313 void util_fskip_lines(FILE * , int);
314 bool util_same_file(const char * , const char * );
315 void util_fread (void *, size_t , size_t , FILE * , const char * );
316 void util_fwrite(const void *, size_t , size_t , FILE * , const char * );
317 time_t util_fread_time_t(FILE * stream);
318 int util_fread_int(FILE * );
319 long util_fread_long(FILE * );
320 bool util_fread_bool(FILE * );
321 double util_fread_double(FILE * stream);
323 void util_fwrite_size_t (size_t , FILE * );
324 void util_fwrite_int (int , FILE * );
325 void util_fwrite_long (long , FILE * );
326 void util_fwrite_bool (bool , FILE * );
327 void util_fwrite_time_t (time_t , FILE * );
328 void util_fwrite_double(double , FILE * );
329 void util_fwrite_int_vector (const int * , int , FILE * , const char * );
330 void util_fwrite_double_vector(const double * , int , FILE * , const char * );
331 void util_fread_char_vector(char * , int , FILE * , const char * );
332 int util_type_get_id( const void * data );
333
334
335 bool util_sscanf_bytesize(const char * , size_t *);
336 int util_get_current_linenr(FILE * stream);
337 const char * util_update_path_var(const char * , const char * , bool );
338
339
340 void util_fskip_int(FILE * stream);
341 void util_fskip_long(FILE * stream);
342 void util_fskip_bool(FILE * stream);
343 bool util_fseek_string(FILE * stream , const char * string , bool skip_string , bool case_sensitive);
344 char * util_fscanf_alloc_upto(FILE * stream , const char * stop_string, bool include_stop_string);
345 bool util_files_equal( const char * file1 , const char * file2 );
346 double util_kahan_sum(const double *data, size_t N);
347 bool util_double_approx_equal( double d1 , double d2);
348 bool util_double_approx_equal__( double d1 , double d2, double rel_eps, double abs_eps);
349 bool util_float_approx_equal__( float d1 , float d2, float rel_eps, float abs_eps);
350 int util_fnmatch( const char * pattern , const char * string );
351 void util_time_utc( time_t * t , struct tm * ts );
352
353 bool util_is_link(const char * ); // Will always return false on windows
354 int util_chdir(const char * path);
355 bool util_chdir_file( const char * filename );
356
357#ifdef ERT_HAVE_UNISTD
358#include <unistd.h>
359 bool util_access(const char * entry, mode_t mode);
360#else
361 bool util_access(const char * entry, int mode);
362#define F_OK 0
363#define R_OK 4
364#define W_OK 2
365#define X_OK 1
366#endif
367
368#define UTIL_FWRITE_SCALAR(s,stream) { if (fwrite(&s , sizeof s , 1 , stream) != 1) util_abort("%s: write failed: %s\n",__func__ , strerror(errno)); }
369
370#define UTIL_FREAD_SCALAR(s,stream) { \
371 int fread_return = fread(&s , sizeof s , 1 , stream); \
372 if (fread_return == 0) { \
373 if (errno == 0) \
374 util_abort("%s: read failed - premature EOF\n",__func__); \
375 \
376 util_abort("%s: read failed: %s\n",__func__ , strerror(errno)); \
377 } \
378}
379
380
381#define UTIL_FWRITE_VECTOR(s,n,stream) { if (fwrite(s , sizeof s , (n) , stream) != (n)) util_abort("%s: write failed: %s \n",__func__ , strerror(errno)); }
382#define UTIL_FREAD_VECTOR(s,n,stream) { if (fread(s , sizeof s , (n) , stream) != (n)) util_abort("%s: read failed: %s \n",__func__ , strerror(errno)); }
383
384#define CONTAINS_HEADER(TYPE) int util_sorted_contains_ ## TYPE(const TYPE * data , int size , TYPE value)
388#undef CONTAINS_HEADER
389
390#ifdef _MSC_VER
391#define util_abort(fmt , ...) util_abort__(__FILE__ , __func__ , __LINE__ , fmt , __VA_ARGS__)
392#elif __GNUC__
393/* Also clang defines the __GNUC__ symbol */
394#define util_abort(fmt , ...) util_abort__(__FILE__ , __func__ , __LINE__ , fmt , ##__VA_ARGS__)
395#endif
396
397
398
399/*****************************************************************/
400/* Conditional section below here */
401
402void util_abort__(const char * file , const char * function , int line , const char * fmt , ...);
404
405
406
407#ifdef ERT_HAVE_ZLIB
408 void util_compress_buffer(const void * , int , void * , unsigned long * );
409 int util_fread_sizeof_compressed(FILE * stream);
410 void util_fread_compressed(void * , FILE * );
411 void * util_fread_alloc_compressed(FILE * );
412 void util_fwrite_compressed(const void * , int , FILE * );
413#endif
414
415#ifdef ERT_HAVE_SYMLINK
416 void util_make_slink(const char *, const char * );
417 char * util_alloc_link_target(const char * link);
418#ifdef ERT_HAVE_READLINKAT
419 char * util_alloc_atlink_target(const char * path , const char * link);
420#endif
421#endif
422
423
424#ifdef ERT_HAVE_SPAWN
425 pid_t util_spawn(const char *executable, int argc, const char **argv, const char *stdout_file, const char *stderr_file);
426 int util_spawn_blocking(const char *executable, int argc, const char **argv, const char *stdout_file, const char *stderr_file);
427#endif
428
429
430#ifdef ERT_HAVE_LOCKF
431 FILE * util_fopen_lockf(const char * , const char * );
432 bool util_try_lockf(const char * , mode_t , int * );
433#endif
434
435#include "util_unlink.h"
436
437#ifdef __cplusplus
438}
439#endif
440#endif
const cJSON *const const cJSON_bool case_sensitive
Definition: cJSON.h:251
const cJSON *const b
Definition: cJSON.h:251
int cJSON_bool fmt
Definition: cJSON.h:158
char * buffer
Definition: cJSON.h:161
char bool
Definition: msvc_stdbool.h:17
std::function< double(double, double)> function
Definition: Operate.hpp:28
constexpr const double hour
Definition: custom-opm-common/opm-common/opm/parser/eclipse/Units/Units.hpp:106
constexpr const double year
Definition: custom-opm-common/opm-common/opm/parser/eclipse/Units/Units.hpp:108
T min(const T v0, const T v1)
Definition: exprtk.hpp:1400
T value(details::expression_node< T > *n)
Definition: exprtk.hpp:12955
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t t(t+t)") define_sfop3(16
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t x(y+z)
static std::string data()
Definition: exprtk.hpp:40022
float util_float_min(float, float)
char * util_alloc_dump_filename(void)
long int util_long_max(long int a, long int b)
void util_free_stringlist(char **, int)
void util_update_double_max_min(double, double *, double *)
char * util_realloc_filename(char *, const char *, const char *, const char *)
void util_fskip_int(FILE *stream)
char * util_alloc_tmp_file(const char *, const char *, bool)
double util_double_min(double, double)
void util_fskip_lines(FILE *, int)
void util_strupr(char *)
void util_fskip_string(FILE *stream)
FILE * util_fopen__(const char *filename, const char *mode)
bool util_sscanf_bytesize(const char *, size_t *)
void util_update_signals(void)
bool util_sscanf_percent(const char *string, double *value)
void util_binary_split_string_from_max_length(const char *, const char *, int, char **, char **)
float util_float_max(float, float)
bool util_is_executable(const char *)
void util_fwrite_time_t(time_t, FILE *)
offset_type util_ftell(FILE *stream)
void util_string_tr(char *, char, char)
double util_double_vector_stddev(int, const double *)
char * util_alloc_parent_path(const char *path)
time_t util_make_date_utc(int, int, int)
void util_fwrite_double(double, FILE *)
double util_kahan_sum(const double *data, size_t N)
char ** util_alloc_stringlist_copy(const char **, int)
void util_fwrite_size_t(size_t, FILE *)
void util_fwrite_double_vector(const double *, int, FILE *, const char *)
bool util_sscanf_double(const char *, double *)
double util_difftime(time_t, time_t, int *, int *, int *, int *)
char * util_alloc_strip_copy(const char *)
const char * util_skip_sep(const char *, const char *, bool *)
void util_install_signals(void)
int util_fmove(FILE *stream, long offset, long shift)
void util_fwrite_int(int, FILE *)
double util_file_difftime(const char *, const char *)
time_t util_time_t_min(time_t a, time_t b)
char * util_split_alloc_dirname(const char *input_path)
void util_fwrite_int_vector(const int *, int, FILE *, const char *)
bool util_files_equal(const char *file1, const char *file2)
int util_round(double x)
char * util_alloc_sprintf_va(const char *fmt, va_list ap)
bool util_same_file(const char *, const char *)
FILE * util_mkdir_fopen(const char *filename, const char *mode)
bool util_entry_exists(const char *entry)
long offset_type
Definition: util.h:76
void * util_realloc(void *, size_t)
char * util_alloc_date_stamp_utc(void)
void util_alloc_file_components(const char *, char **, char **, char **)
void util_unlink_existing(const char *filename)
char * util_realloc_substring_copy(char *, const char *, int N)
bool util_is_cwd(const char *path)
void util_endian_flip_vector(void *data, int element_size, int elements)
int util_fread_int(FILE *)
int util_fstat(int fileno, stat_type *stat_info)
void util_set_date_values_utc(time_t, int *, int *, int *)
struct stat stat_type
Definition: util.h:72
int util_chdir(const char *path)
void util_inplace_forward_days_utc(time_t *t, double days)
void util_free_NULL_terminated_stringlist(char **string_list)
bool util_char_in(char c, int, const char *)
char * util_fread_alloc_file_content(const char *, int *)
double util_pow10(double x)
char * util_fread_alloc_string(FILE *)
time_t util_time_t_max(time_t a, time_t b)
void util_fread_char_vector(char *, int, FILE *, const char *)
char * util_alloc_joined_string(const char **, int, const char *)
size_t util_fd_size(int fd)
void util_make_path(const char *)
char * util_get_timezone(void)
bool util_after(time_t t, time_t limit)
bool util_sscanf_date_utc(const char *, time_t *)
char * util_alloc_substring_copy(const char *, int offset, int N)
bool util_copy_file(const char *, const char *)
char * util_alloc_cwd(void)
time_t util_make_pure_date_utc(time_t t)
bool util_fopen_test(const char *, const char *)
double util_difftime_seconds(time_t start_time, time_t end_time)
void * util_malloc(size_t)
void util_binary_split_string(const char *, const char *, bool, char **, char **)
int util_string_replace_inplace(char **, const char *, const char *)
void util_fwrite_string(const char *, FILE *)
bool util_copy_file__(const char *src_file, const char *target_file, size_t buffer_size, void *buffer, bool abort_on_error)
char * util_string_replacen_alloc(const char *, int, const char **, const char **)
bool util_fscanf_bool(FILE *stream, bool *value)
void util_fwrite_bool(bool, FILE *)
char * util_alloc_strupr_copy(const char *)
time_t util_make_datetime_utc(int, int, int, int, int, int)
const char * util_parse_int(const char *, int *, bool *)
bool util_string_match(const char *string, const char *pattern)
char * util_alloc_multiline_string(const char **, int)
bool util_make_datetime_utc_validated(int sec, int min, int hour, int mday, int month, int year, time_t *t)
bool util_chdir_file(const char *filename)
int util_forward_line(FILE *, bool *)
int util_get_current_linenr(FILE *stream)
bool util_file_exists(const char *)
double util_double_max(double, double)
void util_fwrite(const void *, size_t, size_t, FILE *, const char *)
char * util_alloc_filename(const char *, const char *, const char *)
char * util_fscanf_alloc_line(FILE *, bool *)
void() walk_file_callback_ftype(const char *, const char *, void *)
Definition: util.h:89
int util_strcmp_int(const char *s1, const char *s2)
int util_roundf(float x)
size_t util_size_t_min(size_t a, size_t b)
bool util_mkdir_p(const char *path)
char ** util_stringlist_append_ref(char **, int, const char *)
char * util_alloc_dequoted_copy(const char *s)
char * util_fscanf_alloc_token(FILE *)
bool util_string_equal(const char *s1, const char *s2)
void util_abort_test_set_intercept_function(const char *)
double util_fread_double(FILE *stream)
void util_rewind(FILE *stream)
char * util_strstr_int_format(const char *string)
char * util_string_strip_chars_alloc(const char *, const char *)
unsigned int util_clock_seed(void)
bool() walk_dir_callback_ftype(const char *, const char *, int, void *)
Definition: util.h:93
bool util_is_abs_path(const char *)
char * util_alloc_string_sum(const char **, int)
void util_fread_dev_random(int, char *)
void util_fread_dev_urandom(int, char *)
bool util_float_approx_equal__(float d1, float d2, float rel_eps, float abs_eps)
void util_fskip_long(FILE *stream)
void util_double_vector_max_min(int, const double *, double *, double *)
char * util_string_replace_alloc(const char *, const char *, const char *)
void util_fwrite_offset(offset_type, FILE *)
bool util_before(time_t t, time_t limit)
void util_fwrite_long(long, FILE *)
void util_move_file4(const char *src_name, const char *target_name, const char *src_path, const char *target_path)
bool util_access(const char *entry, int mode)
void util_fskip_token(FILE *)
void util_inplace_forward_seconds_utc(time_t *t, double seconds)
double util_difftime_days(time_t, time_t)
#define CONTAINS_HEADER(TYPE)
Definition: util.h:384
bool util_string_has_wildcard(const char *s)
char * util_fread_realloc_string(char *, FILE *)
bool util_file_readable(const char *file)
bool util_sscanf_octal_int(const char *buffer, int *value)
bool util_fmt_bit8(const char *)
bool util_copy_stream(FILE *, FILE *, size_t, void *, bool abort_on_error)
char * util_newest_file(const char *, const char *)
bool util_entry_readable(const char *entry)
char * util_split_alloc_filename(const char *input_path)
bool util_sscanf_int(const char *, int *)
char * util_realloc_sprintf(char *, const char *,...)
char * util_alloc_date_string_utc(time_t t)
bool util_fseek_string(FILE *stream, const char *string, bool skip_string, bool case_sensitive)
bool util_is_link(const char *)
int util_int_min(int, int)
void util_exit(const char *fmt,...)
unsigned int util_dev_urandom_seed()
int util_strcmp_float(const char *s1, const char *s2)
bool util_sscanf_bool(const char *, bool *)
void util_move_file(const char *src_file, const char *target_file)
void util_path_split(const char *, int *, char ***)
char * util_realloc_dequoted_string(char *)
char ** util_stringlist_append_copy(char **, int, const char *)
char * util_alloc_string_copy(const char *)
bool util_file_update_required(const char *, const char *)
bool util_fscanf_date_utc(FILE *, time_t *)
char * util_alloc_normal_path(const char *input_path)
char * util_strcat_realloc(char *, const char *)
bool util_file_newer(const char *file, time_t t0)
char * util_alloc_realpath(const char *)
int util_type_get_id(const void *data)
int util_get_month_nr(const char *)
void util_double_to_float(float *, const double *, int)
bool util_ftruncate(FILE *stream, long size)
bool util_fscanf_int(FILE *, int *)
int util_count_content_file_lines(FILE *)
bool util_sscanf_isodate(const char *, time_t *)
void util_fskip_space(FILE *, bool *)
char * util_alloc_rel_path(const char *__root_path, const char *path)
bool util_double_approx_equal(double d1, double d2)
void util_update_float_max_min(float, float *, float *)
void util_time_utc(time_t *t, struct tm *ts)
time_t util_fread_time_t(FILE *stream)
void * util_calloc(size_t elements, size_t element_size)
void util_fskip_bool(FILE *stream)
void * util_realloc_copy(void *org_ptr, const void *src, size_t byte_size)
void util_usleep(unsigned long micro_seconds)
void * util_alloc_copy(const void *, size_t)
void util_clamp_double(double *value, double limit1, double limit2)
void util_float_to_double(double *, const float *, int)
int util_int_max(int, int)
long util_fread_long(FILE *)
int util_int_format_count(const char *string)
bool util_is_first_day_in_month_utc(time_t t)
void util_fread(void *, size_t, size_t, FILE *, const char *)
void util_abort_signal(int)
void util_fskip_cchars(FILE *, const char *, bool *)
char * util_alloc_abs_path(const char *path)
void util_split_string(const char *, const char *, int *, char ***)
int util_stat(const char *filename, stat_type *stat_info)
void util_set_datetime_values_utc(time_t, int *, int *, int *, int *, int *, int *)
int util_fnmatch(const char *pattern, const char *string)
char * util_alloc_realpath__(const char *input_path)
bool util_string_isspace(const char *s)
char * util_realloc_string_copy(char *, const char *)
size_t util_file_size(const char *)
void util_rewind_line(FILE *)
int util_fseek(FILE *stream, offset_type offset, int whence)
void util_abort__(const char *file, const char *function, int line, const char *fmt,...)
bool util_addr2line_lookup(const void *, char **, char **, int *)
void util_clear_directory(const char *path, bool strict_uid, bool unlink_root)
bool util_double_approx_equal__(double d1, double d2, double rel_eps, double abs_eps)
bool util_is_file(const char *)
char * util_alloc_sprintf(const char *,...)
void util_update_int_max_min(int, int *, int *)
size_t util_size_t_max(size_t a, size_t b)
double util_double_vector_mean(int, const double *)
bool util_entry_writable(const char *entry)
const char * util_update_path_var(const char *, const char *, bool)
void util_fskip_chars(FILE *, const char *, bool *)
bool util_is_directory(const char *)
char * util_fscanf_alloc_upto(FILE *stream, const char *stop_string, bool include_stop_string)
bool util_file_older(const char *file, time_t t0)
FILE * util_fopen(const char *, const char *)
bool util_fmt_bit8_stream(FILE *)
bool util_fread_bool(FILE *)
time_t util_file_mtime(const char *file)