Generally useful utility functions are located in the file utilities.C, with an associated header file utilities.h. These functions include:
Creates a duplicate of the given string.
Converts the given string to upper case; returns pointer to the same string.
Compares string a to string b in a case-insensitive manner. Otherwise acts like a call to strcmp.
Like strupcmp, but only considers the first n characters.
Takes the filename in string s and breaks it into the file name n and directory d. Space is allocated for both the name and path strings.
Breaks the command string s into tokens, provides as pointers to the different token strings in argv ( argv should be an array of pointers to char with enough items to hold a pointer for each token in the given string). argc is set to the total number of tokens found. Tokens are only searched for in the string until a # character is reached; the rest of the string s is then skipped if this comment character is found. If the first non-whitespace character is a # symbol, the routine returns NULL. A command string is a string of the form
<keyword> = <string>If the equal sign is not present as the second token in the string, this routine returns NULL.
Similar to command_tokenize, without the restriction of having the string in the format of a command string, instead s may be any string.
Returns the elapsed time, in seconds, from some reference time (which may vary between different versions of Unix). Best used for calculating time differences, not for finding the ``current'' time.
Returns a pointer to a string with the username of the person running the program.
Returns 1 if the string s is any type of string indicating ``yes'' in some form, or 0 if the string indicates ``no'' in some form. If the routine cannot determine if yes or no was indicates, this returns -1.
Calculates , and returns a pointer to x1. The array x1 must be different than the storage used for x2 and x3.
Returns the value of .
Normalizes the vector ; returns a pointer to x.
Returns the norm (length) n of a vector :
.
Computes quickly .
Computes quickly .