Functions

The non-class string functions are summarized in table String functions. This includes functions for copying strings, adding strings to a system-wide hash table and creating temporary filenames. The non-class pathname functions are summarized in table Path search functions. These functions are for expanding filenames that might begin with a reference to a user’s home directory ~user or contain a shell environment variable $VAR. Also provided is a function for verifying that an external program to be invoked is available, and a function for searching the user’s path.

String functions

Function

Parameter

Description

char* savestring (...)

 

create a new copy of the given text and return a pointer to it; the caller must eventually delete the string

 

const char* text

the text to copy

const char* hashstring (...)

 

save a copy of the text in a system-wide hash table, if it isn't already there, and return a pointer to the entry.

 

const char* text

the text to copy

char* tempFileName ()

 

return a new, unique temporary filename; the caller must eventually delete the string

const char* expandPathName (...)

 

return an expanded version of the filename argument, which may start with ~, ~user or $VAR; the expanded result is in static storage and will be overwritten by the next call.

 

const char* text

the path to expand

Path search functions

Function

Parameter

Description

int progNotFound (...)

 

flag an error and return TRUE if a program is not found

 

const char* program

the name of the program to find in the user's path

 

const char* extramsg = 0

message to add to error message if the program is not found

const char* pathSearch (...)

 

find a file in a Unix-style path, returning the directory name

 

const char* file

filename to find in the path

 

const char* path = 0

if non-zero, the path to use instead of the user's path