#include <unistd.h>
#include <stdio.h>
#include <ctype.h>
Go to the source code of this file.
◆ ABS
#define ABS |
( |
|
a | ) |
((a) < 0 ? -(a) : (a)) |
◆ ALLOC
#define ALLOC |
( |
|
type, |
|
|
|
num |
|
) |
| ((type *) MMalloc((long) sizeof(type) * (long) (num))) |
◆ assert
Value:{\
if (! (ex)) {\
(void) fprintf(stderr,\
"Assertion failed: file %s, line %d\n\"%s\"\n",\
__FILE__, __LINE__, "ex");\
(void) fflush(stdout);\
abort();\
}\
}
Definition at line 141 of file util.h.
◆ fail
Value:{\
(void) fprintf(stderr, "Fatal error: file %s, line %d\n%s\n",\
__FILE__, __LINE__, why);\
(void) fflush(stdout);\
abort();\
}
Definition at line 156 of file util.h.
◆ FREE
#define FREE |
( |
|
obj | ) |
((obj) ? (free((char *) (obj)), (obj) = 0) : 0) |
◆ MAX
#define MAX |
( |
|
a, |
|
|
|
b |
|
) |
| ((a) > (b) ? (a) : (b)) |
◆ MIN
#define MIN |
( |
|
a, |
|
|
|
b |
|
) |
| ((a) < (b) ? (a) : (b)) |
◆ NIL
#define NIL |
( |
|
type | ) |
((type *) 0) |
◆ REALLOC
#define REALLOC |
( |
|
type, |
|
|
|
obj, |
|
|
|
num |
|
) |
| ((type *) MMrealloc((char *) (obj), (long) sizeof(type) * (long) (num))) |
◆ SIZEOF_INT
◆ SIZEOF_LONG
◆ SIZEOF_VOID_P
◆ strsav
◆ UTIL_INLINE
◆ UTIL_UNUSED
◆ VOID_OR_CHAR
#define VOID_OR_CHAR char |
◆ VOID_OR_INT
◆ util_ptrint
◆ abort()
◆ atof()
◆ exit()
◆ free()
◆ getenv()
◆ getSoftDataLimit()
unsigned long getSoftDataLimit |
( |
void |
| ) |
|
Definition at line 35 of file datalimit.c.
37 #if HAVE_SYS_RESOURCE_H == 1 && HAVE_GETRLIMIT == 1 && defined(RLIMIT_DATA) 41 result = getrlimit(RLIMIT_DATA, &rl);
42 if (result != 0 || rl.rlim_cur == RLIM_INFINITY)
45 return((
unsigned long) rl.rlim_cur);
47 return((
unsigned long) RLIMIT_DATA_DEFAULT);
#define RLIMIT_DATA_DEFAULT
◆ malloc()
◆ memccpy()
◆ memchr()
◆ memcmp()
◆ memcpy()
◆ memmove()
◆ memset()
◆ MMalloc()
char * MMalloc |
( |
long |
size | ) |
|
Definition at line 51 of file safe_mem.c.
57 if (
MMoutOfMemory != (
void (*)(
long)) 0 ) (*MMoutOfMemory)(size);
61 if (size == 0) size =
sizeof(long);
62 if ((p = (
char *)
malloc((
unsigned long) size)) ==
NIL(
char)) {
void(* MMoutOfMemory)(long)
◆ MMout_of_memory()
void MMout_of_memory |
( |
long |
size | ) |
|
Definition at line 41 of file safe_mem.c.
43 (void) fflush(stdout);
44 (void) fprintf(stderr,
"\nout of memory allocating %lu bytes\n",
45 (
unsigned long) size);
◆ MMrealloc()
char * MMrealloc |
( |
char * |
obj, |
|
|
long |
size |
|
) |
| |
Definition at line 71 of file safe_mem.c.
82 if (size <= 0) size =
sizeof(long);
83 if ((p = (
char *)
realloc(obj, (
unsigned long) size)) ==
NIL(
char)) {
void(* MMoutOfMemory)(long)
◆ pclose()
◆ popen()
◆ realloc()
◆ strcat()
◆ strchr()
◆ strcmp()
◆ strcoll()
◆ strcpy()
◆ strcspn()
◆ strerror()
◆ strlen()
◆ strncat()
◆ strncmp()
◆ strncpy()
◆ strpbrk()
◆ strrchr()
◆ strspn()
◆ strstr()
◆ strtok()
◆ strxfrm()
◆ system()
◆ tmpfile()
◆ util_cpu_time()
long util_cpu_time |
( |
void |
| ) |
|
Definition at line 34 of file cpu_time.c.
40 (void) getrusage(RUSAGE_SELF, &rusage);
41 t = (long) rusage.ru_utime.tv_sec*1000 + rusage.ru_utime.tv_usec/1000;
53 t = buffer.tms_utime * 16.6667;
59 t = buffer.tms_utime * 10;
72 t = buffer.proc_user_time * 10;
◆ util_file_search()
char* util_file_search |
( |
char const * |
, |
|
|
char * |
, |
|
|
char const * |
|
|
) |
| |
◆ util_path_search()
char* util_path_search |
( |
char const * |
| ) |
|
◆ util_pipefork()
int util_pipefork |
( |
char *const * |
, |
|
|
FILE ** |
, |
|
|
FILE ** |
, |
|
|
int * |
|
|
) |
| |
◆ util_print_cpu_stats()
void util_print_cpu_stats |
( |
FILE * |
| ) |
|
◆ util_print_time()
char* util_print_time |
( |
unsigned |
long | ) |
|
◆ util_restart()
void util_restart |
( |
char const * |
, |
|
|
char const * |
, |
|
|
int |
|
|
) |
| |
◆ util_save_image()
int util_save_image |
( |
char const * |
, |
|
|
char const * |
|
|
) |
| |
◆ util_strsav()
char* util_strsav |
( |
char const * |
| ) |
|
◆ util_tilde_expand()
char* util_tilde_expand |
( |
char const * |
| ) |
|
◆ MMoutOfMemory
void(* MMoutOfMemory) (long) |