File: utils.h

package info (click to toggle)
lebiniou 3.30-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,240 kB
  • sloc: ansic: 19,339; sh: 4,154; makefile: 893; awk: 148
file content (67 lines) | stat: -rw-r--r-- 1,678 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 *  Copyright 1994-2019 Olivier Girondel
 *
 *  This file is part of lebiniou.
 *
 *  lebiniou 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.
 *
 *  lebiniou 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with lebiniou. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __BINIOU_UTILS_H
#define __BINIOU_UTILS_H

#if HAVE_CONFIG_H
#include "config.h"
#include "includes.h"
#else
#error "No config.h"
#endif

/*
#ifdef ICC_COMPILER
#pragma warning(disable:981)
#endif
*/

#if __STDC_VERSION__ < 199901L
#if __GNUC__ >= 2
#define __func__ __FUNCTION__
#else
#define __func__ "<unknown>"
#endif
#endif

void xerror(const char *, ...);
void xperror(const char *);
void okdone(const char *);
void *xmalloc(const size_t);
void *xcalloc(const size_t, const size_t);

#define xfree(ptr) do { free(ptr); ptr = NULL; } while (0)

void *xrealloc(void *, size_t);
long xatol(const char *);
void rmkdir(const char *);

uint32_t FNV_hash(const char*);
void ms_sleep(const u_long);
int parse_two_shorts(const char *, const int, short *, short *);

extern u_char       libbiniou_verbose;
#define VERBOSE(X) if (libbiniou_verbose) X

int check_command(const char *);

time_t unix_timestamp();

#endif /* __BINIOU_UTILS_H */