vgparm(3)

NAME
vgparm - command line parsing routines

DESCRIPTION
vgparm contains many useful routines that perform miscellaneous tasks, most of which deal with I/O. The application programmer is highly encouraged to become familiar with these routines, as they are frequently needed, and programmers working under the Khoros system should always try to avoid "re-inventing the wheel". In addition, using these utilities whenever possible ensures that new programs developed under the Khoros system handle I/O in a way which is consistent with the rest of the system.

In addition, the vgparm library contains all routines that do the actual parsing and checking of arguments provided to an application program via the command line user interface (CLUI).

ALL programs that utilize these routines MUST include the statement:

#include "vinclude.h"

GENERAL I/O UTILITY ROUTINES

khoros_init()

A CALL TO THE khoros_init() ROUTINE SHOULD BE THE FIRST THING APPEARING IN ANY PROGRAM UNDER THE KHOROS SYSTEM. It sets the environment variables, and sets things up in order for a program to run properly and consistently under the Khoros system. It has no arguments.

khoros_close()

A CALL TO THE khoros_close() ROUTINE SHOULD BE THE LAST THING APPEARING IN ANY PROGRAM UNDER THE KHOROS SYSTEM. It will make sure that the program exits properly, and that it is consistent with the rest of the Khoros system. It has no arguments. Note that a call to khoros_close() replaces a call to exit().

check_args()

Each time a command line argument is taken off the command line, it is set to NULL in the av (argv) string array. This routine searches the av (argv) array for any arguments that have not been set to NULL after all defined command line arguments have been processed.If the ac (argv) array contains any arguments that have not been set to NULL (implying that the user has entered bogus input on the command line in addition to correct input) an error message results. check_args() has no arguments. Every routine that DOES NOT USE the X Toolkit MUST make a call to check_args().

Note that programs using the xvforms or xvutils libraries MUST NOT have this call. This is because extra arguments may not actually be bogus, but may actually be in reference to X Toolkit attributes.

consolidate_args()

This routine searches the command and packs all the arguments to the front of the av (argv) array. The ac (argc) count is set to the new number of arguments. Basically this consolidates arguments by getting rid of all NULL arguments.

Note that programs using the xvforms libraries will have this call made for them in xvf_initialize(). This is necessary because all remaining arguments must be passed to the X Toolkit, for use by various routines located there. consolidate_args() has no arguments.

kaccess()

This function is a replacement for the system access call. The only difference is that kaccess() checks all available transport mechanisms. The routine will check to see if the token specified by the transport is either readable (R_OK), writeable (W_OK), or accessible (X_OK), or any possible combination by OR'ing the flags together.

char *kaccess(path, mode)
char *path;
int mode;

kalloca()

Calls alloca() to allocate the size bytes of space in the stack frame of the caller, and returns a pointer to the allocated block. This temporary space is automatically freed when the caller returns. Note that if the allocated block is beyond the current stack limit, the resulting behavior is undefined. Checks to make sure that the user doesn't allocate 0 bytes, since this will fail on certain architectures. If the user requests 0 bytes, the request will be changed to allocate a single byte.

char *kalloca(size)
int size;

kcalloc()
Calls calloc() to allocate space for an array of num elements of the size specified, initialize the space to zeros, and return a pointer to the initialized block. Checks to make sure that the user doesn't allocate 0 bytes, since this will fail on certain architectures. If the user requests 0 bytes, the request will be changed to allocate a single byte.

char *kcalloc(num, size)
size_t num;
size_t size;

kfree()
Calls free() to free previously allocated data. Checks to make sure that the user doesn't free a NULL pointer.

kfree(ptr)
char *ptr;

kclose()

This function is a replacement for the system close() call. The only difference is that kclose() supports supports all available data transport mechanisms.

char *kclose(id)
int id;

kdescriptors()

This function is used to retrieve the input and output file descriptor associated with a transport. Note that this routine should not be used without extreme caution, since certain transports don't have file descriptors (such as shared memory). It is sometimes important to be able to have access to a transports real UNIX file descriptors so that such functions as the X Toolkit's XtAppAddInput() can be used. This should be used until the phantom becomes more advanced and starts to support the concept of threads and parallel processing.

int kdescriptors(file, inum, onum)
kfile *file;
int *inum;
int *onum;

kexecvp()
This function is a replacement for the system execvp() call. The only difference is that kexecvp() supports execution of processes on remote machines (distributed processing) enabled by a remote data transport mechanism. The routine will execute another process (specified by arg0) and replace the current core image with the specified core. For examples, please see the section on vgparm in Chapter 8 of the Khoros Programmer's Manual.

kexecvp(arg0, args)
char *arg0;
char *args[];

kfclose()

This function is a replacement for the system fclose() call. The only difference is that kfclose() supports all available transport mechanisms. Returns 0 on success, -1 on failure.

char *kfclose(file)
kfile *file;

kfgetc()
This function is a replacement for the system fgetc call. The only difference is that kfgetc() supports all available transport mechanisms. The routine will get a single character from the specified transport. If the character could not be written, EOF is returned; otherwise, the character that is read is returned.

int kfgetc(file)
kfile *file;

kfgets()
This function is a replacement for the system fgets call. The only difference is that kfgets() supports all available transport mechanisms. The routine will reads a single line of characters from the specified transport. If the characters could not be read then NULL is returned, otherwise the input character array is returned. kfgets() reads characters from the stream into the array pointed to by buffer until num-1 characters are read or a ' (newline character) or a EOF is encountered. The characters read are returned or if EOF or an error is encountered and no characters have been read then NULL is returned.

int kfgets(buffer, num, file)
char *buffer;
int num;
kfile *file;

kfileno()
This function is a replacement for the system fileno call. The only difference is that kfileno() is used to retrieve the corresponding kfile entry descriptor, which can be used with the (int fid) routines like, kread() and kwrite(). The entry indentifier or descriptor is returned, otherwise -1 is returned if no such entry exists in the transport table.

int kfileno(file)
kfile *file;

kfopen()
This function is a replacement for the system fopen() call. The only difference is that kfopen() supports all available transport mechanisms. The path should be in the form of an identifier, followed by an equal (=) indicator, which is in turn followed by the transport token. For example, a shared memory path would look like: "shm=1032". If a file was desired then either "/usr/tmp/vadd1235" or "file=/usr/tmp/vadd1235" would work. Returns the kfile structure or NULL upon failure.

kfile *kfopen(path, type)
char *path;
char *type;

kfputc()
This function is a replacement for the system fputc call. The only difference is that kfputc() supports all available transport mechanisms. The routine will write a single character to the specified transport. If the character could not be written, EOF is returned; otherwise, the character that is written is returned.

int kfputc(character, file)
int character;
kfile *file;

kfputs()
This function is a replacement for the system fputs call. The only difference is that kfputc() supports all available transport mechanisms. The routine will write a single line of characters to the specified transport. If the characters could not be written EOF is returned, otherwise the number of characters is returned.

int kfputs(buffer, file)
char *buffer;
kfile *file;

kfread()

This function is a replacement for the system fread() call. The only difference is that kfread() supports all available transport mechanisms. The routine will read nbytes into the character array "ptr". If not all nitems can be read, then the kfread() routine returns the number of items actually read.

int kfread(ptr, size, nitems, file)
void *ptr;
int size;
int nitems;
kfile *file;

kfseek()

This function is used to go to a particular byte location in the transport. Depending on the transport mechanism being used, the behavior of kfseek() will be different. For instance, with a file it calls fseek() to lock the file, but with shared memory, it it simply resets the internal offset pointer.

char *kfseek(file, offset, whence)
kfile *file;
int offset;
int whence;

kftell()

This function is used to tell the current position within the transport. The system call returns the offset of the current byte relative to the beginning of the file associated with the transport identifier. Depending on the different transport being used the behavior will be different. For a file it calls ftell() to locate the offset within the file, but for a shared memory segment it it simply indicates the internal offset. Returns -1 or the current offset depending on whether the operation failed or succeeded.

int kftell(file)
kfile *file;

kgethostname()

This function is a replacement for the system gethostname() call. The only difference is that kgethostname() supports all available transport mechanisms. It returns the standard host name for the current processor. The returned name is NULL-terminated unless insufficient space is provided. Returns 0 on success, -1 on failure.

char *kgethostname(machine, hostname, namelen)
char *machine;
char *hostname;
int namelen;

kfwrite(

This function is a replacement for the system fwrite() call. The only difference is that kfwrite() supports all available transport mechanisms. The routine will write nitems from the character array "ptr". If not all nitems can be written, then the kfwrite() routine returns the number of items actually written.

int kfwrite(ptr, size, nitems, file)
void *ptr;
int size;
int nitems;
kfile *file;

klseek()

This function is used to go to a particular byte location in the transport. Depending on the transport mechanism being used, the behavior of klseek() will be different. For instance, with a file it calls lseek() to lock the file, but with shared memory, it it simply resets the internal offset pointer.

char *klseek(id, offset, whence)
int id;
int offset;
int whence;

kmachtype()

Same as the Khoros routine machtype(), except that it supports all machines available for distributed processing. The machines that are currently supported and their identifying #define'd numbers can be found in KHOROS_HOME/include/machdefs.h. If the current machine is not defined, then the value of 255 is returned. If the "hosttype" parameter is set to NULL, then the string representation of the host type is not returned. If the "hosttype" parameter is passed in as an allocated string, the host type name is copied into that string.

long kmachtype(machine, hosttype)
char *machine;
char *hosttype;

kmalloc()

Calls malloc() to allocate the requested data; returns a pointer to a block of at least size bytes, appropriately aligned. Checks to make sure that the user doesn't allocate 0 bytes, since this will fail on certain architectures. If the user requests 0 bytes, the request will be changed to allocate a single byte.

char *kmalloc(size)
unsigned int size;

kopen()

This function is a replacement for the system open() call. The only difference is that kopen() supports all available data transport mechanisms. The path should be in the form of an identifier, followed by an equal (=) indicator, which is in turn followed by a transport token. For example, a shared memory path would look like: "shm=1032". If a file was desired, examples would be: "/usr/tmp/vadd1235", or "file=/usr/tmp/vadd1235". To find out which transport mechanisms are available on your computer architecture, and their associated identifiers, execute: % transinfo.

int kopen(path, flags, mode)
char *path;
int flags;
int mode;

kread()

Replaces for the system read() call. The only difference is that kread() supports all available transport mechanisms. The routine will read nbytes into the character array "buf". If not all nbytes can be read, then the kread() routine returns the number of bytes actually read.

int kread(id, buf, nbytes)
int id;
char *buf;
int nbytes;

krealloc()

Calls realloc() to re-allocate the requested data; changes the size of the block referenced by ptr to size bytes and returns a pointer to the (possibly moved) block. The contents will be unchanged up to the lesser of the new and old sizes. If unable to honor a reallocation request, krealloc() leaves its first argument unaltered.

char *krealloc(ptr, size)
char *ptr;
unsigned int size;

krewind()

This function is used to seek the transport to the beginning of a file. In essence it performs a kfseek(file, 0L, 0);. Depending on the different transport being used the behavior will be different. For a file it calls fseek() to seek the file, but for a shared memory segment it it simply resets the internal offset pointer.

void krewind(file)
kfile *file;

ksystem()

This function is a replacement for the system() library call. The only difference is that ksystem() supports all available data transport mechanisms.

char *ksystem(command)
char *command;

ktempnam()

A front end for vtempname(), this module is used to create temporary files for calling programs that support the data transport and distributed processing mechanisms. Ktempnam() is called with a template filename which is used to help identify the calling program. The type of temporary file created depends on the identifier. If a unique temporary shared memory key is desired, then the template should look like: "shm=XXXX". If a file is desired, then either "XXXXXXXXX" or "file=XXXX" will work. The convention should be as follows: an identifier followed by an equals indicator (=), which is in turn followed by an optional template. To find out which transport mechanisms are available on your computer architecture, and their associated identifiers, execute: % transinfo.

char *ktempnam(machine, template)
char *machine;

ktell()

This function is used to tell the current position within the transport. The system call returns the offset of the current byte relative to the beginning of the file associated with the transport identifier. Depending on the different transport being used the behavior will be different. For a file it calls tell() to locate the offset within the file, but for a shared memory segment it it simply indicates the internal offset. Returns -1 or the current offset depending on whether the operation failed or succeeded.

int ktell(id)
int id;

kunlink()

This function is used to unlink the transport mechanism. Depending on the transport being used, the behavior of kunlink() will be different. For instance, with a file it will unlink the file; however, with a shared memory segment it initializes the memory segment before using a call to shmctl() to destroy it. Returns 0 on success, -1 on failure.

char *kunlink(path)
char *path;

kwrite()

This function is a replacement for the system write() call. The only difference is that kwrite() supports all available transport mechanisms. The routine will write nbytes from the character array "buf" into the appropriate transport mechanism specified by id. If not all nbytes can be written, then the kwrite() routine returns the number of bytes actually written.

char *kwrite(id, buf, nbytes)
int id;
char *buf;
int nbytes;

VStrcat()

Same as strcat(); appends a copy of string2 to the end of string1. Improved in that that it will malloc for you.

char *VStrcat(string1, string2)
char *string1;
char *string2;

VStr3cat()

Appends string3 to string2, and then appends the result to string 1. Malloc's for you.

char *VStr3cat(string1, string2, string3)
char *string1;
char *string2;
char *string3;

VStrcmp()

Improved version of strcmp(); compares the two input strings and returns a status indicating whether string1 < string2 (-1), string1 = string2 (0), or string1 > string2 (1). If either of the strings are NULL, then the NULL string is considered less than the other. If both strings are NULL, they are considered equal (0).

int VStrcmp(string1, string2)
char *string1;
char *string2;

VStrncmp()

Improved version of strncmp(); compares the two input strings up until the nth character, and returns a status indicating whether string1 < string2 (-1), string1 = string2 (0), or string1 > string2 (1). If either of the strings are NULL, then the NULL string is considered less than the other. If both strings are NULL, they are considered equal (0).

int VStrncmp(string1, string2, n)
char *string1;
char *string2;
int n;

VStrcpy()

Returns a copy of its string argument, and calloc's for you.

char *VStrcpy(string)
char *string;

VStrncpy()

Copies string argument until n characters have been copied, returns the result. Improved in that it calloc's for you.

char *VStrncpy(string, n)
char *string;
int n;

VStrlen()

Same as strlen(); returns the number of characters in its string argument, not counting the null-terminating character. Improved in that it checks for NULL pointers and returns zero if the argument is NULL.

int *VStrlen(string)
char *string;

vbasename()

This function is used to strip the filename off of the path passed in.

char *vbasename(directory_path)
char *directory_path;

vdirname()

This function is used to strip the path off the directory path passed in.

char *vdirname(directory_path)
char *directory_path;

vexpandpath()
This function expands any path to an absolute path from the root directory "/".

vexpandpath(filename, directory, return_file)
char *filename;
char *directory;
char *return_file;

veditfile()
This function automatically brings up a window, and puts the user into a session with the editor.

veditfile(filename)
char *filename;

vfreelist()

This function should be used to free the list of strings created by vlistdir() or vlistfile(). This routine can be used to free any array of strings created via the memory allocation routines such as malloc or calloc. See vlistdir() or vlistfile() for more details.

vfreelist(list, num_entries)
char **list;
int num_entries;

vfullpath()

This function returns the full, expanded path to the supplied file. It will expand the KHOROS_HOME environment variable if this it is currently set in the user's environment. vfullpath() will also expand a "~". If desired, the caller may pass in a directory path which will be prepended to the front of the filename. If it is a directory path, and not a file path that needs to be expanded, simply provide the directory path to be expanded as the first argument, and not the second. Will return NULL if the file and/or directory path is invalid. vfullpath() will allocate the return string for you or not, as indicated by the value of return_file.

char *vfullpath(filename, directory_path, return_file)
char *filename;
char *directory_path;
char *return_file;

vget_type()
This utility routine takes a string describing a data type and returns the integer that represents it's #define'd name in the Khoros system.

It takes as input a string that must be one of:
"bit", "byte", "short", "int", "float", "complex", or "double"

It passes back the corresponding integer which will (respectively) be one of:
VFF_TYP_BIT, VFF_TYP_1_BYTE, VFF_TYP_2_BYTE, VFF_TYP_4_BYTE, VFF_TYP_FLOAT, VFF_TYP_COMPLEX, or VFF_TYP_DOUBLE.

vget_type() will return False (0) if an error occurs, non-zero if it was successful.

int *vget_type(type, string)
int *type;
char *string;

vlistdir()
This function is used to create a list of files according to a user supplied basename and a initial directory. The directory_path field is to be used in the same way as the directory_path field in vfullpath(). The basename can be either a path or partial path to the directory in which a listing will be performed. If the basename is a partial path such as "image" in a directory where "image1" and "image2" exists, then vlistdir() will return the two filenames and any other files that may match the "image" base. If the basename is NULL then the entire directory specified by the directory_path will be listed.

The list mode is used to indicate what we are going to list in the directory. The possible defines are listed in KHOROS_HOME/include/vdefines.h. The following is a list of possible modes:

		XV_PATH         - prepend the path to each file
		XV_FILE         - list plain text files
		XV_DIR          - list directories
		XV_DOT          - list dot files
		XV_LINK		- list symbolic files
		XV_SOCK         - list socket files
		XV_READ         - file is readable by caller
		XV_WRITE        - file is writable by caller
		XV_EXEC         - file is executable by caller

The selections are or'ed together in order to choose which attribute is desired. ie) (XV_FILE | XV_DIR) will list only files and directories that match the basename. The read, write, execute flags should be used when the caller wishes to know if they have the correct permissions for the list of files. ie) (XV_FILE | XV_WRITE) will list only files that the caller has write permissions.

The format field is used to prepend a type to the filename, similar to the UNIX "ls -F" command. Directories will have "/", "@" for symbolic links, and "=" for sockets.

vlistdir() will return an array of character strings and the number of entries will be returned within the num_entries field. If the path to be listed does not exist or no files are matched from the basename, then vlistdir() will return NULL. Since the list is allocated the programmer should use the vfreelist() call to free the list (or use the UNIX free(3) routine).

char **vlistdir(basename, directory_path, list_mode, format, num_entries)
char *basename;
char *directory_path;
int list_mode;
int format;
int *num_entries;

vlistfile()

This routine is used to create a list from the contents of the supplied file. It reads the contents of the specified file and returns the words in the file in an array of strings. The file may contain a word on each line or several words on each line. Each word will be put into the list seperately and the list sorted if the sort_list flag is specified. Note: All 'sh' and 'C' style comments lines will be skipped. 'sh' style comments are delineated by the # character. The contents from that point untiil the end of line will be ignored. A C style comment is delineated by a /*. The contents of the file will be skipped until a */ is encountered; the */ can be located on the same or any proceeding line.

If desired, the caller may pass in a directory path which will be prepended to the front of the filename. Most applications set this argument to NULL. The programmer also has the option of specifying if they want the resulting strings sorted or not. If the sort_list field is specified the list will be sorted into descending order.

vlistfile() will return an array of character strings and the number of entries will be returned within the num_entries field. If the path to be listed does not exist or the specified file does not exist, then vlistfile() will return NULL. The programmer should use the vfreelist() call to free the list (or use the UNIX free(3) routine) after it will no longer be used.

char **vlistfile(filename, directory_path, sort_list, num_entries)
char *filename;
char *directory_path;
int sort_list;
int *num_entries;

vlower_string()
This function returns the lower case representation of the supplied input string.

char *vlower_string(input_string, output_string)
char *input_string;
char *output_string;

vputenv()

This module is used to put an environment variable in the user's environment variable list. If "PUTENV" is defined, then we use the system call putenv(); otherwise, we use our own put environment code.

vputenv(string)
char *string;

vtempnam()

This function creates names for temporary files. The template filename supplied should help to identify the application which created it. If no template filename is given, TEMPLATE is used. If a temporary file cannot be created, NULL is returned. The application should remove temporary files after using them.

vtempnam(template)
char *template;

vread_ascii()

This function gets the read device for ascii reading. This routine should be used whenever you are reading from an ascii file.

vread_ascii(input_filename, device)
char *input_filename;
FILE **device;

vreplace_char()

This function performs a global change of character on the input string. It returns a string where every occurrence of the scan character is replaced with the replacement character. If output_string is sent in as NULL, the result will be malloc'ed for you. If output_string is provided as non-null, the result will be stored in output_string. Note that if the latter use is chosen, output_string must be previously allocated with a sufficient amount of storage space before this routine is called.

char *vreplace_char(input_string, scan_char, replace_char, output_string)
char *input_string;
char scan_char;
char replace_char;
char *output_string;

vreplace_string()

This function performs a global change of text on the input string. It returns a string where every occurrence of the scan text is replaced with the replacement text. If output_string is sent in as NULL, the result will be malloc'ed for you. If output_string is provided as non-null, the result will be stored in output_string. Note that if the latter use is chosen, output_string must be previously allocated with a sufficient amount of storage space before this routine is called.

char *vreplace_string(input_string, scan_str, replace_str, output_string)
char *input_string;
char *scan_str;
char *replace_str;
char *output_string;

vstrstr()

This function returns a pointer to the first occurrence of the pattern string sub_string in input_string. For example, if input_string is "This is a string thing" and sub_string is "ing", vstrstr() returns "ing thing". If sub_string does not occur in the input_string, vstrstr() returns NULL

char *vstrstr(input_string, sub_string)
char *input_string;
char *sub_string;

vupper_string()

This function returns the upper case representation of the supplied input string.

char *vupper_string(input_string, output_string)
char *input_string;
char *output_string;

vwait3()

This routine emulates the BSD wait3() command. The wait3 process waits until any child has completed, without hanging (WNOHANG). If "WAIT3" is defined, we use the system call wait3(); otherwise, we use our own wait3 code. If wait3() is not defined on your machine, the options and rusage parameters will not be used; pass dummy variables if desired. This new routine is compliments of Bob Weaver, at Idaho National Labs. If wait3() is defined on your system, do % man wait for more information.

vwait3(status, options, rusage)
vstatus *status;
int options;
struct rusage *rusage;

vwrite_ascii()

This function gets the write device for ascii writing. This routine should be used whenever you are writing to an ascii file.

vwrite_ascii(output_filename, device)
char *output_filename;
FILE **device;

ROUTINES FOR OBTAINING CLUI ARGUMENTS

vget_infile()

Gets an input file, and returns it to the caller. May get the input file directly from the command line, may use interactive prompting to obtain a input filename from the user, or may get the input file from an answer file. Checks to make sure that the file exists, and that the file is readable by the user. Note that when stdin is to be used in place of an input file on the command line, a "-" may be substituted for the filename. Returns a status of True (1) if the flag_string specified was found; returns False (0) otherwise.

int vget_infile(fd_ansr, prompt_flag, flag_string, prompt_string, infile_return)
int fd_ansr;
int prompt_flag;
char *flag_string;
char *prompt_str;
char **infile_return;

vget_outfile()

Gets an output file, and returns it to the caller. May get the output file directly from the command line, may use interactive prompting to obtain a output filename from the user, or may get the output file from an answer file. Checks to make sure that the directory referenced exists, and that the directory is writable by the user. Note that when stdout is to be used in place of an output file on the command line, a "-" may be substituted for the filename. Returns a status of True (1) if the flag_string specified was found; returns False (0) otherwise.

int vget_outfile(fd_ansr, prompt_flag, flag_string, prompt_string, outfile_return)
int prompt_flag;
char *flag_string;
char *prompt_str;
char **outfile_return;

vget_int()

Gets an integer, and returns it to the caller. May get the integer directly from the command line, may use interactive prompting to obtain the integer from the user, or may get the integer from an answer file. Checks to make sure that the input is a proper integer, and that the integer is within given bounds, if bounds are specified. Returns a status of True (1) if the flag_string specified was found; returns False (0) otherwise. If the flag_string specified could not be found, vget_int() will return the value of the integer default specified.

int vget_int(fd_ansr, prompt_flag, flag_string, prompt_string, int_return, int_default, int_min, int_max);
int fd_ansr;
int prompt_flag;
char *flag_string;
char *prompt_str;
int *int_return;
int int_default;
int int_min, int_max;

vget_float()

Gets a float, and returns it to the caller. May get the float directly from the command line, may use interactive prompting to obtain the float from the user, or may get the float from an answer file. Checks to make sure that the input is a proper float, and that the float is within given bounds, if bounds are specified. Returns a status of True (1) if the flag_string specified was found; returns False (0) otherwise. If the flag_string specified could not be found, vget_float() will return the value of the float default specified.

int vget_float(fd_ansr, prompt_flag, flag_string, prompt_string, float_return, float_default, float_min, float_max);
int fd_ansr;
int prompt_flag;
char *flag_string;
char *prompt_str;
float *float_return;
float float_default;
float float_min, float_max;

vget_logic()

Gets a logical (boolean) value, and returns it to the caller. May get the boolean directly from the command line, may use interactive prompting to obtain the boolean from the user, or may get the boolean from an answer file. Checks to make sure that the input is a proper boolean, Returns a status of True (1) if the flag_string specified was found; returns False (0) otherwise. If the flag_string specified could not be found, vget_logic() will return the value of the boolean default specified.

Note that vget_logic will only accept proper boolean values from the user. These include:
1 and 0,
"yes" and "no", "Yes" and "No", "YES" and "NO"
"y" and "n", "Y" and "N"
"true" and "false", "True" and "False", "TRUE" and "FALSE"
"t" and "f", "T" and "F".

Where, in each of the above pairs, the first entry has a value of 1, and the second entry has a value of 0.

int vget_logic(fd_ansr, prompt_flag, flag_string, prompt_string, logic_return, logic_default);
int fd_ansr;
int prompt_flag;
char *flag_string;
char *prompt_str;
int *logic_return;
int logic_default;

vget_string()

Gets a string, and returns it to the caller. May get the string directly from the command line, may use interactive prompting to obtain a string from the user, or may get the string from an answer file. Returns a status of True (1) if the flag_string specified was found; returns False (0) otherwise. If the flag_string cannot be found, the string returned will take on the value of the default string provided.

int vget_string(fd_ansr, prompt_flag, flag_string, prompt_string, string_return, string_default)
int fd_ansr;
int prompt_flag;
char *flag_string;
char *prompt_str;
char **string_return;
char *string_default;