File: utils.h

package info (click to toggle)
qstat 2.15-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,652 kB
  • ctags: 3,017
  • sloc: ansic: 24,995; sh: 4,109; makefile: 60
file content (55 lines) | stat: -rw-r--r-- 1,227 bytes parent folder | download | duplicates (3)
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
/*
 * Utility Functions
 * Copyright 2012 Steven Hartland
 *
 * Licensed under the Artistic License, see LICENSE.txt for license terms
 */
#ifndef QSTAT_UTILS_H
#define QSTAT_UTILS_H

// BSD has strnstr
#if defined(__FreeBSD__) || defined(__MidnightBSD__) || defined(__OpenBSD__)
#ifndef HAVE_STRNSTR
#define HAVE_STRNSTR 1
#endif /* HAVE_STRNSTR */
#endif

#ifndef _WIN32
#ifndef HAVE_ERR_H
#define HAVE_ERR_H 1
#endif /* HAVE_ERR */
#endif

#if !HAVE_STRNSTR
#include <string.h>
char * qstat_strnstr(const char *s, const char *find, size_t slen);
#define strnstr(s,find,slen) qstat_strnstr(s,find,slen)
#endif

#ifndef EX_OSERR
#define EX_OSERR 71  /* system error (e.g., can't fork) */
#endif

#if !HAVE_ERR_H
void err(int eval, const char *fmt, ...); 
void warn(const char *fmt, ...);
#endif

#if defined(_MSC_VER) && _MSC_VER < 1600
typedef __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#elif defined(_MSC_VER)  // && _MSC_VER >= 1600
#include <stdint.h>
#else
#include <stdint.h>
#endif

char *str_replace(char *, char *, char *);

#endif