2015-12-04 15:47:52 +01:00
|
|
|
/**
|
2016-09-11 22:20:15 +02:00
|
|
|
* Author......: See docs/credits.txt
|
2015-12-04 15:47:52 +01:00
|
|
|
* License.....: MIT
|
|
|
|
*/
|
|
|
|
|
2016-09-06 18:44:05 +02:00
|
|
|
#ifndef _SHARED_H
|
|
|
|
#define _SHARED_H
|
2016-09-05 21:47:26 +02:00
|
|
|
|
2016-12-24 00:40:40 +01:00
|
|
|
#include <stdarg.h>
|
2016-09-08 14:11:35 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2016-09-05 21:47:26 +02:00
|
|
|
#include <unistd.h>
|
2016-09-28 23:53:46 +02:00
|
|
|
#include <time.h>
|
2016-09-29 00:25:36 +02:00
|
|
|
#include <fcntl.h>
|
2015-12-04 15:47:52 +01:00
|
|
|
|
2016-09-20 17:04:31 +02:00
|
|
|
bool is_power_of_2 (const u32 v);
|
|
|
|
|
2016-09-08 10:01:49 +02:00
|
|
|
u32 get_random_num (const u32 min, const u32 max);
|
2015-12-04 15:47:52 +01:00
|
|
|
|
2016-09-08 10:01:49 +02:00
|
|
|
u32 mydivc32 (const u32 dividend, const u32 divisor);
|
|
|
|
u64 mydivc64 (const u64 dividend, const u64 divisor);
|
|
|
|
|
2016-09-24 21:44:43 +02:00
|
|
|
char *filename_from_filepath (char *filepath);
|
|
|
|
|
2016-09-30 17:41:40 +02:00
|
|
|
void naive_replace (char *s, const char key_char, const char replace_char);
|
|
|
|
void naive_escape (char *s, size_t s_max, const char key_char, const char escape_char);
|
2015-12-04 15:47:52 +01:00
|
|
|
|
2016-12-24 00:40:40 +01:00
|
|
|
void hc_asprintf (char **strp, const char *fmt, ...);
|
|
|
|
|
2016-10-17 13:44:07 +02:00
|
|
|
void hc_sleep_msec (const u32 msec);
|
|
|
|
void hc_sleep (const u32 sec);
|
2016-09-08 10:48:38 +02:00
|
|
|
|
2016-10-30 18:55:27 +01:00
|
|
|
void setup_environment_variables (void);
|
|
|
|
void setup_umask (void);
|
2016-09-28 23:53:46 +02:00
|
|
|
void setup_seeding (const bool rp_gen_seed_chgd, const u32 rp_gen_seed);
|
|
|
|
|
2016-10-31 11:28:06 +01:00
|
|
|
int hc_stat (const char *pathname, hc_stat_t *buf);
|
|
|
|
int hc_fstat (int fd, hc_stat_t *buf);
|
|
|
|
|
2016-11-16 10:22:57 +01:00
|
|
|
void hc_qsort_r (void *base, size_t nmemb, size_t size, int (*compar) (const void *, const void *, void *), void *arg);
|
|
|
|
void *hc_bsearch_r (const void *key, const void *base, size_t nmemb, size_t size, int (*compar) (const void *, const void *, void *), void *arg);
|
|
|
|
|
2016-09-06 18:44:05 +02:00
|
|
|
#endif // _SHARED_H
|