c_getdirs - Find all of the subdirectories for a specified directory

SYNTAX

FUNCTION c_getdirs (filespec, dir_names, ndirs, maxdirs, first_call)

    char	 *filespec;
    char	 dir_names[][CMLEN];
    long	 *ndirs;
    long	 maxdirs;
    long	 first_call;

PARAMETERS

filespec (char *, input)

Host file name which specifies the directory in which to search for all subdirectories. If this directory is specified relative to the current working directory, the subdirectory names will be relative to the current working directory as well. If this directory is an absolute path, the subdirectory names will be absolute paths as well.

dir_names (char [][CMLEN], output)

Array of subdirectory names.

ndirs (long *, output)

Number of subdirectories found.

maxdirs (long, input)

Maximum number of subdirectories to return.

first_call (long, input)

Flag indicating first call to this function:

     = TRUE  (1):       This is the first call to this function.
			Return the first maxdirs subdirectories.
     = FALSE (0):       This is not the first call to this function.
			Return the next maxdirs subdirectories.

DESCRIPTION

Transform the input file specification so that it will match subdirectories below it via the echo command. Create a pipe to store the list of desired directory names. Get the desired number of directory names from the pipe. Close the pipe and return.

NOTE: If the input UNIX directory specification is /sg2/csb/user/mydir/* or /sg2/csb/user/mydir/ then c_getdirs() will return all subdirectories in /sg2/csb/user/mydir/. If the UNIX directory specification is /sg2/csb/user/mydir then c_getdirs() will return all subdirectories in /sg2/csb/user/.

RETURN VALUE

c_getdirs() returns

     E_SUCC --> Successful completion
     E_FAIL --> Operation failed