Main Page | Data Structures | File List | Globals

include/gu.h File Reference

Generally Useful Library. More...

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdarg.h>
#include <setjmp.h>

Go to the source code of this file.

Data Structures

struct  gu_getopt_opt
struct  gu_getopt_state
struct  GU_INI_ENTRY
struct  gu_snmp
 An object which can make SNMP queries. More...

struct  OPTIONS_STATE

Defines

#define _GU_H   1
#define FALSE   0
#define TRUE   !FALSE
#define UNIX_755   (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
#define UNIX_644   (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
#define UNIX_660   (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP)
#define UNIX_640   (S_IRUSR | S_IWUSR | S_IRGRP)
#define UNIX_600   (S_IRUSR | S_IWUSR)
#define UNIX_022   (S_IWGRP | S_IWOTH)
#define UNIX_002   S_IWOTH
#define UNIX_077   (S_IRWXG | S_IRWXO)
#define lmatch(a, b)   (!strncmp(a, b, sizeof(b) - 1))
 If b matches the first part of a, return true.

#define lmatchp(a, b)   (!strncmp(a, b, sizeof(b) - 1) ? a + sizeof(b) - 1 + strspn(a + sizeof(b) - 1, " \t") : NULL)
 If b matches the first part of a, return a pointer to the first word in a that comes after the match.

#define rmatch(a, b)   (strlen(a) >= strlen(b) && strcmp(a + strlen(a) - strlen(b), b) == 0)
 If b matches the last part of a, return true.

#define lmatchsp(a, b)   (!strncmp(a, b, sizeof(b) - 1) && isspace(a[sizeof(b) - 1]) ? a + sizeof(b) - 1 + strspn(a + sizeof(b) - 1, " \t") : NULL)
 If b matches the first part of a with a white space following, return pointer to first part after whitespace.

#define gu_write_string(fd, s)   (write(fd, s, sizeof(s) - 1))
 Write constant string s to file descriptor s using write().

#define gu_alloc_assert(assertion)   _gu_alloc_assert(__FILE__, __LINE__, assertion)
#define ANSWER   int
#define ANSWER_UNKNOWN   -1
#define ANSWER_FALSE   0
#define ANSWER_TRUE   1
#define gu_Try
 Start an exception handling Try block.

#define gu_Final
 Run cleanup code during exception handing.

#define gu_Catch
 Handle exceptions encountered in gu_Try.

#define GU_SNMP_INT   1
 tells gu_snmp_get() to fetch an integer value

#define GU_SNMP_STR   2
 tells gu_snmp_get() to fetch a string value

#define GU_SNMP_BIT   3
 tells gu_snmp_get() to fetch a bitstring value

#define strsignal(signum)   gu_strsignal(signum)
#define snprintf   gu_snprintf
#define vsnprintf(s, n, format, ap)   gu_vsnprintf(s, n, format, ap)
#define mkstemp(template)   gu_mkstemp(template)
#define strlcpy(a, b, c)   gu_strlcpy(a,b,c)
#define strlcat(a, b, c)   gu_strlcat(a,b,c)
#define strerror(err)   gu_strerror(err)

Typedefs

typedef int gu_boolean

Enumerations

enum  GU_INI_TYPES {
  GU_INI_TYPE_SKIP, GU_INI_TYPE_NONNEG_INT, GU_INI_TYPE_STRING, GU_INI_TYPE_NONEMPTY_STRING,
  GU_INI_TYPE_POSITIVE_DOUBLE, GU_INI_TYPE_NONNEG_DOUBLE, GU_INI_TYPE_END
}

Functions

void * gu_alloc (size_t number, size_t size)
 Allocate a memory block to hold an array.

void * gu_realloc (void *ptr, size_t number, size_t size)
 Change the size of an already allocated array.

char * gu_strdup (const char *string)
 Duplicate a string.

char * gu_strndup (const char *string, size_t len)
 Duplicate the initial segment of a string.

char * gu_restrdup (char *ptr, size_t *number, const char *string)
 Copy a string into a preexisting block, resizing if necessary.

void gu_free (void *ptr)
 Free memory.

void gu_alloc_checkpoint (void)
int gu_alloc_checkpoint_get (void)
void gu_alloc_checkpoint_put (int n)
void _gu_alloc_assert (const char *file, int line, int assertion)
GU_INI_ENTRY * gu_ini_section_load (FILE *file, const char section_name[])
 Read INI file section into memory.

const struct GU_INI_ENTRY * gu_ini_section_get_value (const struct GU_INI_ENTRY *section, const char key_name[])
 Extract value list from loaded section.

void gu_ini_section_free (struct GU_INI_ENTRY *section)
 Deallocate INI section.

const char * gu_ini_value_index (const struct GU_INI_ENTRY *array, int array_index, const char *default_value)
 Extract a value from a value list.

int gu_ini_assign (const struct GU_INI_ENTRY *array,...)
 Assign value list members to a series of variables.

int gu_ini_vassign (const struct GU_INI_ENTRY *array, va_list args)
 Assign value list members to a series of variables.

const char * gu_ini_scan_list (const char file_name[], const char section_name[], const char key_name[],...)
 Open INI and get a series of values.

char * gu_ini_query (const char file_name[], const char section_name[], const char key_name[], int index, const char default_value[])
 Get string value from INI file.

int gu_ini_section_from_sample (const char filename[], const char section_name[])
 Copy missing section from sample file to INI file.

char * gu_getline (char *line, int *space_available, FILE *fstream)
 read lines of unlimited length from a file efficiently

char * gu_strerror (int n)
int gu_wildmat (const char *text, const char *p)
int compile_string_escapes (char *s)
 This function is unused for now.

char * gu_strsep (char **stringp, const char *delim)
 extract fields from a string

char * gu_strsep_quoted (char **stringp, const char *delim, const char *discard)
void gu_set_cloexec (int fd)
void gu_nonblock (int fd, gu_boolean on)
void gu_trim_whitespace_right (char *s)
int gu_strcasecmp (const char *s1, const char *s2)
int gu_strncasecmp (const char *s1, const char *s2, int n)
int gu_lock_exclusive (int filenum, int waitmode)
int gu_torf (const char *s)
 Parse a boolean value.

int gu_torf_setBOOL (gu_boolean *b, const char *s)
 Parse a boolean value.

double gu_getdouble (const char *)
const char * gu_dtostr (double)
void ASCIIZ_to_padded (char *padded, const char *asciiz, int len)
void padded_to_ASCIIZ (char *asciiz, const char *padded, int len)
gu_boolean padded_cmp (const char *padded1, const char *padded2, int len)
gu_boolean padded_icmp (const char *padded1, const char *padded2, int len)
int gu_sscanf (const char *input, const char *pattern,...)
 safe sscanf()

void gu_sscanf_checkpoint (void)
void gu_sscanf_rollback (void)
int gu_fscanf (FILE *input, const char *format,...)
void gu_daemon (mode_t daemon_umask)
 become a daemon

int disk_space (const char *path, unsigned int *free_blocks, unsigned int *free_files)
void gu_wordwrap (char *string, int width)
int gu_vsnprintf (char *str, size_t count, const char *fmt, va_list args)
int gu_snprintf (char *str, size_t count, const char *fmt,...)
int gu_vasprintf (char **ptr, const char *format, va_list ap)
int gu_asprintf (char **ptr, const char *format,...)
size_t gu_strlcpy (char *dst, const char *src, size_t siz)
size_t gu_strlcat (char *dst, const char *src, size_t siz)
int gu_mkstemp (char *template)
char * gu_strsignal (int signum)
int gu_snprintfcat (char *buffer, size_t max, const char *format,...)
int gu_timeval_cmp (const struct timeval *t1, const struct timeval *t2)
 Compare two times in struct timeval format.

void gu_timeval_sub (struct timeval *t1, const struct timeval *t2)
 Subtract one time in struct timeval format from another.

void gu_timeval_add (struct timeval *t1, const struct timeval *t2)
 Add one time in struct timeval format to another.

void gu_timeval_cpy (struct timeval *t1, const struct timeval *t2)
 Copy a struct timeval.

void gu_timeval_zero (struct timeval *t)
int gu_runl (const char *myname, FILE *errors, const char *progname,...)
void gu_getopt_init (struct gu_getopt_state *state, int argc, char **argv, const char *opt_chars, const struct gu_getopt_opt *opt_words)
int ppr_getopt (struct gu_getopt_state *state)
void gu_getopt_default (const char myname[], int optchar, const struct gu_getopt_state *getopt_state, FILE *errors)
void options_start (const char *options_str, struct OPTIONS_STATE *o)
int options_get_one (struct OPTIONS_STATE *o, char *name, int maxnamelen, char *value, int maxvaluelen)
void gu_Try_funct (jmp_buf *p_jmp_buf)
 Start a block that catches exceptions.

void gu_Throw (const char message[],...)
 Throw an exception as a printf()-style formated string.

void gu_CodeThrow (int code, const char message[],...)
void gu_ReThrow (void)
 Re-throw The last exception.

gu_snmpgu_snmp_open (unsigned long int ip_address, const char community[])
 Create a gu_snmp object.

void gu_snmp_close (struct gu_snmp *p)
 destroy an SNMP object

void gu_snmp_get (struct gu_snmp *p,...)
 Perform an SNMP query.

void * gu_pcs_new (void)
 create a PCS object

void * gu_pcs_new_pcs (void **pcs)
 create new PCS and initialize from a PCS

void * gu_pcs_new_cstr (const char cstr[])
 create new PCS and initialize from a char[]

void gu_pcs_free (void **pcs)
 destroy a PCS object

char * gu_pcs_free_keep_cstr (void **pcs)
 Destroy a PCS object but keep the C string.

void gu_pcs_debug (void **pcs, const char name[])
 print a description of a PCS object on stdout

void * gu_pcs_snapshot (void **pcs)
 obtain a copy of a PCS object that won't be unexpectedly changed

void gu_pcs_grow (void **pcs, int size)
 expand the internal storage of a PCS in anticipation of future growth

void gu_pcs_set_cstr (void **pcs, const char cstr[])
 copy a char[] into an existing PCS

void gu_pcs_set_pcs (void **pcs, void **pcs2)
 copy a PCS into an existing PCS

const char * gu_pcs_get_cstr (void **pcs)
 get pointer to const char[] within PCS

char * gu_pcs_get_editable_cstr (void **pcs)
 Get pointer to an editable char[] within PCS.

int gu_pcs_length (void **pcs)
 get length of PCS in bytes

int gu_pcs_truncate (void **pcs, size_t newlen)
 Truncate a PCS to a specified length in bytes.

void gu_pcs_append_char (void **pcs, int c)
 append char to PCS

void gu_pcs_append_cstr (void **pcs, const char cstr[])
 append C char[] to PCS

void gu_pcs_append_pcs (void **pcs, void **pcs2)
 append PCS to existing PCS

int gu_pcs_cmp (void **pcs1, void **pcs2)
 compare PCSs

int gu_pcs_hash (void **pcs_key)
 create a hash value from a PCS


Variables

void(*)(int) signal_interupting (int signum, void(*handler)(int sig))
void(*)(int) signal_restarting (int signum, void(*handler)(int sig))
char gu_exception []
int gu_exception_code
int gu_exception_try_depth
int gu_exception_temp
int gu_exception_debug


Detailed Description

Generally Useful Library.

This file contains the prototypes and macros for a library of functions which are likely to be useful many programs, not just in PPR.


Define Documentation

#define gu_Catch
 

Value:

gu_exception_try_depth -= gu_exception_pop; \
        gu_exception_temp = gu_exception_setjmp_retcode; \
        } \
if(gu_exception_temp != 0)
Handle exceptions encountered in gu_Try.

The block introduced by this macro is executed if an exception was caught in the gu_Try block.

#define gu_Final
 

Value:

gu_exception_try_depth--; \
gu_exception_pop = 0; \
if(1)
Run cleanup code during exception handing.

A gu_Final block is executed after the gu_Try block regardless of whether an exception was caught. If an exception was caught, then the gu_Catch block is executed after the gu_Final block.

Note that the semantics of gu_Final are difference from the semantics of Java finally blocks. Java finally blocks are executed after any matching catch clauses.

Note that exceptions which occur in the gu_Final block are not caught by the associated gu_Catch block.

#define gu_Try
 

Value:

{ \
        jmp_buf gu_exception_jmp_buf; \
        int gu_exception_setjmp_retcode; \
        int gu_exception_pop = 1; \
        gu_Try_funct(&gu_exception_jmp_buf); \
        if((gu_exception_setjmp_retcode = setjmp(gu_exception_jmp_buf)) == 0)
Start an exception handling Try block.

This macro creates a setjmp() context can calls gu_Try_funct() which saves it in an array. The array enables gu_Throw() to find the context even if it is called from inside a function called by the function which called gu_Try().


Function Documentation

int compile_string_escapes char *  s  ) 
 

This function is unused for now.

This function takes a string with ANSI C string escape sequences in it and replaces the escape sequences with the values they represent. The length of the resulting string is returned.

void* gu_alloc size_t  number,
size_t  size
 

Allocate a memory block to hold an array.

The function gu_alloc() takes two arguments. The first is the number of items to allocate, the second is the size of each in bytes. This function will return a void pointer to the allocated memory. The memory is not initialized.

void gu_daemon mode_t  daemon_umask  ) 
 

become a daemon

This function is used to put the calling process into the background. It does this by forking, then parent half to exits. It does other things too, such as closing all open files and setting the session id.

void gu_free void *  ptr  ) 
 

Free memory.

The function gu_free() is used to free any memory allocated by the other functions.

char* gu_getline char *  line,
int *  space_available,
FILE *  fstream
 

read lines of unlimited length from a file efficiently

This function is used to read configuration file lines. It avoids the problem of buffers that are too small. The parameter "line" points to a buffer in gu_alloc()ed memory. On the first call this may be a NULL pointer. If it is too small, a new, longer one will be obtained and "space_available" will be updated. The new buffer is returned. The caller should initialy set "line_available" to a little bigger than the LIKELY line length. Notice that on EOF the line is automatically freed. If you don't read until EOF you must manually free the line. The file will still be open.

Use the function like this:

int line_available = 80;
char *line = NULL;

while((line = gu_getline(line, &line_available, stdin))
        {

        }

int gu_ini_assign const struct GU_INI_ENTRY *  array,
... 
 

Assign value list members to a series of variables.

This function leaks memory when it fails!!!

char* gu_ini_query const char  file_name[],
const char  section_name[],
const char  key_name[],
int  index,
const char  default_value[]
 

Get string value from INI file.

This returns a string value from the INI file. If there is none, the default value is returned. It is OK for the default value to be NULL. If a non-NULL value is returned, it is in memory allocated with gu_strdup().

This is coded oddly, but it really does produce the correct result when the file, section, key, or value is missing.

const char* gu_ini_scan_list const char  file_name[],
const char  section_name[],
const char  key_name[],
... 
 

Open INI and get a series of values.

This is used to quickly open a file, get a section, get values off of a line, close it again, and clean up.

The arguments are as follows:

file_name The name of the config file section_name The section, without the []'s key_name The name on the left hand side of the equals sign ... alternating enum GU_INI_TYPES and pointers

void gu_ini_section_free struct GU_INI_ENTRY *  section  ) 
 

Deallocate INI section.

This function de-allocates the memory used by the return value of gu_ini_section_load(). Notice that if the pointer is NULL, this function does nothing.

int gu_ini_section_from_sample const char  filename[],
const char  section_name[]
 

Copy missing section from sample file to INI file.

This copies a missing section from the sample configuration file. Note that the section_name must be in lower case and without spaces.

const struct GU_INI_ENTRY* gu_ini_section_get_value const struct GU_INI_ENTRY *  section,
const char  key_name[]
 

Extract value list from loaded section.

This function extracts a value from a section loaded by the gu_ini_section_load() function.

struct GU_INI_ENTRY* gu_ini_section_load FILE *  file,
const char  section_name[]
 

Read INI file section into memory.

This function reads a specified section out of a configuration file. The section is parsed and stored in a memory block and a pointer to that block is returned. Other functions may be used to extract name=value pairs from the memory block.

If the configuration file cannot be opened or the requested section cannot be found, then a NULL pointer is returned. The caller may test the pointer for a NULL value, but is not required to since all of the functions which take a pointer to such a memory block as an argument have a reasonable default action to take when they are passed a NULL pointer.

const char* gu_ini_value_index const struct GU_INI_ENTRY *  array,
int  array_index,
const char *  default_value
 

Extract a value from a value list.

The values returned by gu_ini_section_get_value() are lists (arrays). This function returns a value at a specified possition in the list. The first item is at possition 0.

int gu_ini_vassign const struct GU_INI_ENTRY *  array,
va_list  args
 

Assign value list members to a series of variables.

This function leaks memory when it fails!!!

void gu_pcs_append_char void **  pcs,
int  c
 

append char to PCS

This function appends a C char to the the PCS object.

void gu_pcs_append_cstr void **  pcs,
const char  cstr[]
 

append C char[] to PCS

This function appends a C string the the PCS object.

=cut

void gu_pcs_append_pcs void **  pcs,
void **  pcs2
 

append PCS to existing PCS

This function appends a PCS object to the the PCS object.

int gu_pcs_cmp void **  pcs1,
void **  pcs2
 

compare PCSs

This function does for PCSs what strcmp() does for C strings.

void gu_pcs_free void **  pcs  ) 
 

destroy a PCS object

This function decrements the reference count of a PCS object and sets the pointer pointed to by pcs to NULL. If the reference counter reaches zero, then the object is freed.

const char* gu_pcs_get_cstr void **  pcs  ) 
 

get pointer to const char[] within PCS

This function returns a pointer to a NULL terminated C string which contains the value of the PCS object. This pointer may cease to be valid if the PCS object is modified or freed, so if you won't be using the value imediately, you should call gu_strdup() on the result. Also, the string should not be modified by using this pointer.

char* gu_pcs_get_editable_cstr void **  pcs  ) 
 

Get pointer to an editable char[] within PCS.

This function should be called if you intend to edit the string in place. If anyone else has a reference to it, a new copy will be made just for you. If you will change the length of the string, call gu_pcs_length() to determine the initial length. If you are enlarging the string, you need to call gu_pcs_grow() first. If you are making the string smaller, you should call gu_pcs_truncate() when you are done.

void gu_pcs_grow void **  pcs,
int  new_size
 

expand the internal storage of a PCS in anticipation of future growth

This function enlarges the specified PCS so that it can hold a string of the specified size (excluding final NULL). If the requested size is smaller than the current storage size, this has no effect.

int gu_pcs_hash void **  pcs_key  ) 
 

create a hash value from a PCS

This function hashes a PCS. The hash function is attibuted to P. J Weinberger.

int gu_pcs_length void **  pcs  ) 
 

get length of PCS in bytes

This function returns the length in bytes of the PCS in bytes.

void* gu_pcs_new void   ) 
 

create a PCS object

This function creates a new PCS (Perl compatible string) object and returns a void pointer which should be passed to other gu_pcs_*() functions in order to use it.

void* gu_pcs_new_cstr const char  cstr[]  ) 
 

create new PCS and initialize from a char[]

This function creates a new PCS and initializes it from the C character array (string) provided.

void* gu_pcs_new_pcs void **  pcs  ) 
 

create new PCS and initialize from a PCS

This function creates a new PCS and copies the string value from the a pre-existing PCS supplied as an argument.

void gu_pcs_set_cstr void **  pcs,
const char  cstr[]
 

copy a char[] into an existing PCS

This function copies the contents of a C string (a NULL terminated character array into the PCS object. The function may have to allocate a new object and change the pointer pointed to by I<pcs> to point to the new object. A new object will be allocated if the value has a reference count greater than one (which means it should be copied on write).

void gu_pcs_set_pcs void **  pcs,
void **  pcs2
 

copy a PCS into an existing PCS

This function copies the contents of a PCS into the PCS object. The function may have to allocate a new object and change the pointer pointed to by I<pcs> to point to the new object. A new object will be allocated if the value has a reference count greater than one (which means it should be copied on write).

void* gu_pcs_snapshot void **  pcs  ) 
 

obtain a copy of a PCS object that won't be unexpectedly changed

This function increments the reference count of a PCS object. A function should call this if it is going to keep a pointer to a PCS object that was passed to it as an argument. If an attempt is made to modify a PCS object with a non-zero reference count, a copy is made and the caller gets a modified copy, but the copy held by other code is unmodified.

void* gu_realloc void *  ptr,
size_t  number,
size_t  size
 

Change the size of an already allocated array.

The function gu_realloc() changes the size of a memory block. The first argument is a pointer to the old block, the second is the desired new number of members, the third argument is the size of each member in bytes. This function returns a pointer to a resized block, possibly at a different location.

void gu_ReThrow void   ) 
 

Re-throw The last exception.

This is intended to be called from within a gu_Catch block in order to pass the exception higher up the call stack. It also is used to do the actually throwing for gu_Throw().

void gu_snmp_get struct gu_snmp p,
... 
 

Perform an SNMP query.

This uses a gu_snmp object to perform and SNMP query. The first argument is a pointer to a gu_snmp object. The subsequent arguments are a list of data types exepcted and pointers to storeage for them. This funciton throws exceptions on errors.

struct gu_snmp* gu_snmp_open unsigned long int  ip_address,
const char  community[]
 

Create a gu_snmp object.

This function creates an SNMP object, connects it to a remote system, and returns a pointer to it. If the community[] is NULL, then "public" will be used. This function throws exceptions on failure.

int gu_sscanf const char *  input,
const char *  format,
... 
 

safe sscanf()

This function is similiar to sscanf(). It has additional format specifiers which allocate memory and read quoted strings. Since it is meant to read PPR configuration files and queue files, it does out of its way not to heed the current locale.

It implements the following formats:

d
read an int. The argument should be a pointer to an int.

ld
read a long int. The argument should be a pointer to a long int.

hd
read a short int. The argument should be a pointer to a short int.

u
read an unsigned int

f
read a floating point number

s
Read characters up to the next whitespace. The argument should be a pointer to a char array with enough space to hold the string and the terminating NULL. To prevent overruns, the size of the array may be specified by a decimal number between the and the s or by a #. If the length of the array is specified with a # then the actuall length is read from gu_sscanf()'s next argument (the one before the pointer to the char array).

S
Read characters up to the next whitespace, allocate memory, and store them in the allocated memory. The argument should be a pointer to a char pointer which will be set to the address of the allocated memory.

z
Read characters up to the end of the string. The argument should be a char array. To prevent overruns, the size of the char array may be specified in the same manner as for the s format.

Z
Read characters up to the end of the string, allocate storeage for them, and copy them into that storage. The argument should be a pointer to a pointer to a char array.

Q
Read a quoted string and allocate storate for it.

A
If there is a quoted string, read to the closing quote. Otherwise, read to the end of the line. This is used for reading values which must be quoted if they have leading or trailing spaces but needn't if they just have internal spaces.

t
Get a time_t.

n
Store the number of characters read so far.

char* gu_strdup const char *  string  ) 
 

Duplicate a string.

The function gu_strdup() takes a string pointer as its sole argument and returns a pointer to a new copy of the string.

char* gu_strndup const char *  string,
size_t  len
 

Duplicate the initial segment of a string.

The function gu_strndup() takes a string pointer and a maximum length as its arguments. It returns a pointer to a new string containing a copy of the string truncated to the maximum length.

char* gu_strsep char **  stringp,
const char *  delim
 

extract fields from a string

This is intended as a clone of BSD strsep(). BSD strsep() differs from ANSI strtok() in that it can handle empty fields and in that it has no static storage, so it is thread safe.

p = line; if(!(f1 = gu_strsep(&p, ":")) || !(f2 = gu_strsep(&p, ":"))) { error(_("Not enough fields in \"s\" line %d"), filename, linenum); return -1; }

void gu_Throw const char  message[],
... 
 

Throw an exception as a printf()-style formated string.

When throwing an exception, one specifies a code number (which is passed to exit() if the exception is not caught) and an error message. The error message is a printf()-style format and arguments.

void gu_timeval_add struct timeval *  t1,
const struct timeval *  t2
 

Add one time in struct timeval format to another.

This utility function adds t2 to t1.

int gu_timeval_cmp const struct timeval *  t1,
const struct timeval *  t2
 

Compare two times in struct timeval format.

This utility function is used to compare times. It returns 1 if t1 is greater than t2, zero if t1 is equal to t2, and -1 if t1 is less than t2.

void gu_timeval_cpy struct timeval *  t1,
const struct timeval *  t2
 

Copy a struct timeval.

This utility function copies time t2 to time t1.

void gu_timeval_sub struct timeval *  t1,
const struct timeval *  t2
 

Subtract one time in struct timeval format from another.

This utility function is used to subtract time t2 from time t1.

int gu_torf const char *  s  ) 
 

Parse a boolean value.

Read a True or False answer and return ANSWER_TRUE, ANSWER_FALSE, or ANSWER_UNKNOWN.

int gu_torf_setBOOL gu_boolean *  b,
const char *  s
 

Parse a boolean value.

Set a gu_boolean to the answer. If the answer is not true or false, don't change the gu_boolean and return -1.

void gu_Try_funct jmp_buf *  p_jmp_buf  ) 
 

Start a block that catches exceptions.

This function is called by the gu_Try() macro.


Generated on Fri Feb 20 15:17:51 2004 for PPR Libraries by doxygen 1.3.5