File ModuleCmd_Avail.c

 ** ** Module Header ******************************************************* **
 ** 									     **
 **   Modules Revision 3.0						     **
 **   Providing a flexible user environment				     **
 ** 									     **
 **   File:		ModuleCmd_Avail.c				     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Authors:	John Furlan, jlf@behere.com				     **
 **		Jens Hamisch, jens@Strawberry.COM			     **
 ** 									     **
 **   Description: 	This module command prints out the modulefiles that  **
 **			are available in the directories listed in the	     **
 **			MODULEPATH environment variable.		     **
 ** 									     **
 **   Exports:		ModuleCmd_Avail					     **
 **			print_aligned_files				     **
 **			check_dir					     **
 **			get_dir						     **
 **			dirlst_to_list					     **
 **			delete_dirlst					     **
 **			delete_cache_list				     **
 ** 									     **
 **   Notes:								     **
 ** 									     **
 ** ************************************************************************ **
References Variables: IdModuleCmd_Avail.c

Included Files


Preprocessor definitions

#define DIREST 50

#define CACHE_VERSION "v3.0.0"

#define CACHE_UMASK 0

#define FILE_LIST_SEGM_SIZE 100


Typedef sd_node

typedef struct _subdir_node sd_node
struct _subdir_node 
   { 
     fi_ent* sd_dir; 
     struct _subdir_node* sd_next; 
   } 

Global Variable long_header

char long_header[]
Visible in:  ModuleCmd_Avail.c
   ModuleCmd_Clear.c
   ModuleCmd_Display.c
   ModuleCmd_Help.c
   ModuleCmd_Init.c
   ModuleCmd_List.c
   ModuleCmd_Load.c
   ModuleCmd_Purge.c
   ModuleCmd_Switch.c
   ModuleCmd_Update.c
   ModuleCmd_Use.c
   ModuleCmd_Whatis.c
   cmdAlias.c
   cmdConflict.c
   cmdInfo.c
   cmdIsLoaded.c
   cmdLog.c
   cmdMisc.c
   cmdModule.c
   cmdPath.c
   cmdSetenv.c
   cmdTrace.c
   cmdUlvl.c
   cmdUname.c
   cmdVerbose.c
   cmdVersion.c
   cmdWhatis.c
   cmdXResource.c
   error.c
   getopt.c
   init.c
   locate_module.c
   main.c
   utility.c
Used in: ModuleCmd_Avail()ModuleCmd_Avail.c
  ModuleCmd_List()ModuleCmd_List.c

Local Variables

Id
static char Id[]
Used in:  ModuleCmd_Avail.c

UseId
static void* UseId[]

namebuf
static char* namebuf
Used in: ModuleCmd_Avail()
  check_cache()
  print_dir()
  store_files()

buf
static char buf[8192]
Used in: check_cache()
  create_cache_list()
  dirlst_to_list()

module_name
static char module_name[]
Used in: ModuleCmd_Avail()
  _add_file_list()
  check_cache()
  check_dir()
  create_cache_list()
  dirlst_to_list()
  get_dir()
  mkdirnm()
  print_aligned_files()
  print_dir()
  store_files()

short_format
static char short_format[]
Used in: print_aligned_files()

short_format_part
static char short_format_part[]
Used in: print_aligned_files()

short_format_full
static char short_format_full[]
Used in: print_aligned_files()

long_format
static char long_format[]
Used in: print_aligned_files()

_file_list_buffer
static char _file_list_buffer[200]
Used in: print_aligned_files()

_file_list_ptr
static char** _file_list_ptr
Used in: _add_file_list()
  _get_file_list()
  _init_file_list()
  _pick_file_list()

_file_list_cnt
static int _file_list_cnt
Used in: _add_file_list()
  _init_file_list()

_file_list_wr_ndx
static int _file_list_wr_ndx
Used in: _add_file_list()
  _get_file_list()
  _init_file_list()
  _pick_file_list()
  print_aligned_files()
  print_terse_files()

_file_list_rd_ndx
static int _file_list_rd_ndx
Used in: _add_file_list()
  _get_file_list()
  _init_file_list()


Global Function ModuleCmd_Avail()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		ModuleCmd_Avail					     **
 ** 									     **
 **   Description:	Execution of the 'module avail' command		     **
 ** 									     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Parameters:	Tcl_Interp	*interp		Current Tcl Interpr. **
 **			char		*argv[]		Arguments to the     **
 **							command		     **
 ** 									     **
 **   Result:		int	TCL_OK		Successfull operation	     **
 **				TCL_ERROR	Any failure		     **
 ** 									     **
 **   Attached Globals:	specified_module	The module name from the     **
 **						command line.		     **
 ** 									     **
 ** ************************************************************************ **
int ModuleCmd_Avail ( Tcl_Interp* interp, int argc, char* argv[] )
Prototyped in: modules_def.h
Calls: Module_Error()error.c
  check_dir()ModuleCmd_Avail.c
  print_dir()ModuleCmd_Avail.c
  xgetenv()utility.c
  fprintf(), malloc(), strchr()
Called by: cmdModule()cmdModule.c
References Variables: long_headerModuleCmd_Avail.c
  module_nameModuleCmd_Avail.c
  namebufModuleCmd_Avail.c
  specified_modulemain.c
  sw_formatmain.c

Global Function check_dir()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		check_dir					     **
 ** 									     **
 **   Description:	Open and close the passed directory in order to check**
 **			if it does exist and is readable		     **
 ** 									     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Parameters:	char	*dirname	Name of the directory to be  **
 **						checked			     **
 ** 									     **
 **   Result:		int	0	Not a directory or unreadable	     **
 **				1	OK				     **
 ** 									     **
 **   Attached Globals:	-						     **
 ** 									     **
 ** ************************************************************************ **
int check_dir ( char* dirname )
Prototyped in: modules_def.h
Calls: Module_Error()error.c
  closedir(), opendir()
Called by: ModuleCmd_Apropos()ModuleCmd_Whatis.c
  ModuleCmd_Avail()ModuleCmd_Avail.c
  ModuleCmd_Whatis()ModuleCmd_Whatis.c
References Variables: module_nameModuleCmd_Avail.c

Global Function delete_cache_list()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		delete_cache_list				     **
 ** 									     **
 **   Description:	Remove an entire list of allocated strings and free  **
 **			up the used memory				     **
 ** 									     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Parameters:	char	**list		List of filenames to be print**
 **			int	  tcount	Size ofd the list in elements**
 ** 									     **
 **   Result:		-						     **
 ** 									     **
 **   Attached Globals:	-						     **
 ** 									     **
 ** ************************************************************************ **
void delete_cache_list ( char** list, int tcount )
Prototyped in: modules_def.h
Called by: print_dir()ModuleCmd_Avail.c
  whatis_dir()ModuleCmd_Whatis.c

Global Function delete_dirlst()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		delete_dirlst					     **
 ** 									     **
 **   Description:	Delete an entire directory list including all sub-   **
 **			directory lists					     **
 ** 									     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Parameters:	fi_ent	*dirlst_head	Head of the list to be re-   **
 **						moved			     **
 ** 									     **
 **   Result:		-						     **
 ** 									     **
 **   Attached Globals:	-						     **
 ** 									     **
 ** ************************************************************************ **
void delete_dirlst ( fi_ent* dirlst_head, int count )
Prototyped in: modules_def.h
Calls: delete_dirlst()ModuleCmd_Avail.c
Called by: delete_dirlst()ModuleCmd_Avail.c
  print_dir()ModuleCmd_Avail.c
  whatis_dir()ModuleCmd_Whatis.c

Global Function dirlst_to_list()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		dirlst_to_list					     **
 ** 									     **
 **   Description:	Transform the passed nested directory list into a    **
 **			flat list of strings				     **
 ** 									     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Parameters:	char	**list		List to be created	     **
 **			fi_ent	 *dirlst_head	Head of the directory list   **
 **						to be transformed	     **
 **			int	  count		Number of elements in the    **
 **						directory list		     **
 **			int	 *beginning	Index of the element in List **
 **						to start appending the file- **
 **						names at.		     **
 **			char	 *path		prepend pathname to list     **
 **			char	 *module	A search pattern	     **
 **									     **
 **   Result:		-						     **
 ** 									     **
 **   Attached Globals:	-						     **
 ** 									     **
 ** ************************************************************************ **
void dirlst_to_list ( char** list, fi_ent* dirlst_head, int count, int* beginning, char* path, char* module )
Prototyped in: modules_def.h
Calls: Module_Error()error.c
  dirlst_to_list()ModuleCmd_Avail.c
  strcat(), strcpy(), strdup(), strlen(), strncmp()
Called by: dirlst_to_list()ModuleCmd_Avail.c
  print_dir()ModuleCmd_Avail.c
  whatis_dir()ModuleCmd_Whatis.c
References Variables: bufModuleCmd_Avail.c
  module_nameModuleCmd_Avail.c

Global Function get_dir()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		get_dir						     **
 ** 									     **
 **   Description:	Read in the passed directory and save every interes- **
 **			ting item in the directory list			     **
 ** 									     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Parameters:	char	*dir		Directory to be read	     **
 **			char	*prefix		Directory prefix (path)	     **
 **			int	*listcount	Buffer to store the number of**
 **						elements in the current      **
 **						directory list		     **
 **			int 	*total_count	Buffer for the total number  **
 **						of files read		     **
 ** 									     **
 **   Result:		fi_ent*		NULL	Failure			     **
 **					else	Directory list base pointer  **
 **			*listcount		Number of elements in the    **
 **						top level directory list     **
 **			*total_count		Total number of files read   **
 ** 									     **
 **   Attached Globals:	-						     **
 ** 									     **
 ** ************************************************************************ **
fi_ent* get_dir ( char* dir, char* prefix, int* listcount, int* total_count )
Prototyped in: modules_def.h
Calls: Module_Error()error.c
  check_magic()utility.c
  get_dir()ModuleCmd_Avail.c
  mkdirnm()ModuleCmd_Avail.c
  calloc(), closedir(), opendir(), qsort(), readdir(), realloc(), stat(), strdup(), strlen()
Called by: get_dir()ModuleCmd_Avail.c
  print_dir()ModuleCmd_Avail.c
  whatis_dir()ModuleCmd_Whatis.c
References Functions: fi_ent_cmp()ModuleCmd_Avail.c
References Variables: module_nameModuleCmd_Avail.c

Global Function print_aligned_files()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		print_aligned_files				     **
 ** 									     **
 **   Description:	Print out the filenames passed in a sorted array     **
 **			column by column taking care of the order being re-  **
 **			flected to the single columns			     **
 ** 									     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Parameters:	char	**list		List of filenames to print   **
 **			char	 *path		common path		     **
 **			char	 *header	List header		     **
 **			int	  tcount	Size of the list in elements **
 **			int	  numbered	Controls printing of numbers **
 ** 						set to -1 for none	     **
 ** 									     **
 **   Result:		-						     **
 ** 									     **
 **   Attached Globals:	g_current_module	The module which is handled  **
 **						by the current command	     **
 ** 									     **
 ** ************************************************************************ **
void print_aligned_files ( Tcl_Interp* interp, char* path, char* header, char** list, int tcount, int numbered )
Prototyped in: modules_def.h
Calls: ExpandVersions()cmdVersion.c
  Locate_ModuleFile()locate_module.c
  Module_Error()error.c
  SourceRC()locate_module.c
  SourceVers()locate_module.c
  _add_file_list()ModuleCmd_Avail.c
  _init_file_list()ModuleCmd_Avail.c
  print_terse_files()ModuleCmd_Avail.c
  xgetenv()utility.c
  fileno(), fprintf(), gmtime(), ioctl(), isatty(), sprintf(), stat(), strchr(), strdup(), strlen(), strncmp(), strrchr()
Called by: ModuleCmd_List()ModuleCmd_List.c
  print_dir()ModuleCmd_Avail.c
References Variables: _file_list_bufferModuleCmd_Avail.c
  _file_list_wr_ndxModuleCmd_Avail.c
  g_current_modulemain.c
  long_formatModuleCmd_Avail.c
  module_nameModuleCmd_Avail.c
  modulerc_filemain.c
  short_formatModuleCmd_Avail.c
  short_format_fullModuleCmd_Avail.c
  short_format_partModuleCmd_Avail.c
  sw_formatmain.c

Local Function _add_file_list()

static void _add_file_list ( char* name )
Prototyped in: ModuleCmd_Avail.c
Calls: Module_Error()error.c
  malloc(), realloc(), strdup()
Called by: print_aligned_files()ModuleCmd_Avail.c
References Variables: _file_list_cntModuleCmd_Avail.c
  _file_list_ptrModuleCmd_Avail.c
  _file_list_rd_ndxModuleCmd_Avail.c
  _file_list_wr_ndxModuleCmd_Avail.c
  module_nameModuleCmd_Avail.c

Local Function _get_file_list()

static char* _get_file_list ( void )
Prototyped in: ModuleCmd_Avail.c
Called by: print_terse_files()ModuleCmd_Avail.c
References Variables: _file_list_ptrModuleCmd_Avail.c
  _file_list_rd_ndxModuleCmd_Avail.c
  _file_list_wr_ndxModuleCmd_Avail.c

Local Function _init_file_list()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		_add_file_list   				     **
 **			_init_file_list					     **
 **			_get_file_list					     **
 **			_pick_file_list					     **
 ** 									     **
 **   Description:	File list functions for terse module display mode    **
 ** 									     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Parameters:	char	*name		Name to be stored	     **
 ** 									     **
 **   Result:		-						     **
 ** 									     **
 **   Attached Globals:	-						     **
 ** 									     **
 ** ************************************************************************ **
static void _init_file_list ( void )
Prototyped in: ModuleCmd_Avail.c
Called by: print_aligned_files()ModuleCmd_Avail.c
References Variables: _file_list_cntModuleCmd_Avail.c
  _file_list_ptrModuleCmd_Avail.c
  _file_list_rd_ndxModuleCmd_Avail.c
  _file_list_wr_ndxModuleCmd_Avail.c

Local Function _pick_file_list()

static char* _pick_file_list ( int ndx )
Prototyped in: ModuleCmd_Avail.c
Called by: print_terse_files()ModuleCmd_Avail.c
References Variables: _file_list_ptrModuleCmd_Avail.c
  _file_list_wr_ndxModuleCmd_Avail.c

Local Function check_cache()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		check_cache					     **
 ** 									     **
 **   Description:	Check whether an avail cache exists and is not out   **
 **			of date						     **
 ** 									     **
 **   First Edition:	96/01/03					     **
 ** 									     **
 **   Parameters:	char	*dir		Directory to be checked	     **
 ** 									     **
 **   Result:		int	0	Do not use the cache		     **
 **				1	Use the cache			     **
 ** 									     **
 **   Attached Globals:	-						     **
 ** 									     **
 ** ************************************************************************ **
static int check_cache ( char* dir )
Prototyped in: ModuleCmd_Avail.c
Calls: Module_Error()error.c
  fclose(), feof(), fopen(), fscanf(), stat(), strcat(), strcpy()
Called by: print_dir()ModuleCmd_Avail.c
References Variables: bufModuleCmd_Avail.c
  module_nameModuleCmd_Avail.c
  namebufModuleCmd_Avail.c

Local Function create_cache_list()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		create_cache_list				     **
 ** 									     **
 **   Description:	Read the passed cache-file and create a list of file-**
 **			names out of it					     **
 ** 									     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Parameters:	FILE	*cacheinput	Opened cache file	     **
 **			int	*count		Buffer to save the number of **
 **						filename to		     **
 **			char	*module		A module pattern ...	     **
 ** 									     **
 **   Result:		char**	NULL		Abort on failure	     **
 **				else		Pointer to the just created  **
 **						list			     **
 **			*count			Number of elements in the    **
 **						list			     **
 ** 									     **
 **   Attached Globals:	-						     **
 ** 									     **
 ** ************************************************************************ **
static char** create_cache_list ( FILE* cacheinput, int* count, char* module )
Prototyped in: ModuleCmd_Avail.c
Calls: Module_Error()error.c
  fscanf(), malloc(), memset(), strcmp(), strdup(), strlen(), strncmp()
Called by: print_dir()ModuleCmd_Avail.c
References Variables: bufModuleCmd_Avail.c
  module_nameModuleCmd_Avail.c

Local Function fi_ent_cmp()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		fi_ent_cmp					     **
 ** 									     **
 **   Description:	compares two file entry structures		     **
 **			Different cmdline arguments (i.e. -u, -c, -t, -z)    **
 **			will change what value is compared. As a default,    **
 **			the name is used.				     **
 **									     **
 **   Notes:		This procedure is used as comparison function for    **
 **			qsort()					 	     **
 ** 									     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Parameters:	const void *fi1		First file entry	     **
 **			const void *fi2		Second one to compare	     **
 ** 									     **
 **   Result:		int	1 	fi2 > fi1			     **
 **    				-1	fi2 < fi1			     **
 **	  			0	fi2 == fi1			     **
 ** 									     **
 **   Attached Globals:							     **
 ** 									     **
 ** ************************************************************************ **
static int fi_ent_cmp ( const void* fi1, const void* fi2 )
Prototyped in: ModuleCmd_Avail.c
Calls: strcmp()
Used in: get_dir()ModuleCmd_Avail.c

Local Function mkdirnm()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		mkdirnm						     **
 ** 									     **
 **   Description:	Build a full pathname out of the passed directory    **
 **			and file					     **
 ** 									     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Parameters:	char	*dir		The directory to be used     **
 **			char	*file		The filename w/o path	     **
 ** 									     **
 **   Result:		char*	NULL		Compound filename to long    **
 **				else		Pointer to the full path     **
 ** 									     **
 **   Attached Globals:	-						     **
 ** 									     **
 ** ************************************************************************ **
static char* mkdirnm ( char* dir, char* file )
Prototyped in: ModuleCmd_Avail.c
Calls: Module_Error()error.c
  strcat(), strcpy(), strlen()
Called by: get_dir()ModuleCmd_Avail.c
References Variables: module_nameModuleCmd_Avail.c

Local Function print_dir()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		print_dir					     **
 ** 									     **
 **   Description:	Print all files beyond the passed directory	     **
 ** 									     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Parameters:	char	*dir		Directory to be scanned	     **
 **			char	*module		A selcted module name or NULL**
 ** 									     **
 **   Result:		int	TCL_OK		Successfull operation	     **
 ** 									     **
 **   Attached Globals:	-						     **
 ** 									     **
 ** ************************************************************************ **
static int print_dir ( Tcl_Interp* interp, char* dir, char* module )
Prototyped in: ModuleCmd_Avail.c
Calls: Module_Error()error.c
  SourceRC()locate_module.c
  SourceVers()locate_module.c
  check_cache()ModuleCmd_Avail.c
  create_cache_list()ModuleCmd_Avail.c
  delete_cache_list()ModuleCmd_Avail.c
  delete_dirlst()ModuleCmd_Avail.c
  dirlst_to_list()ModuleCmd_Avail.c
  get_dir()ModuleCmd_Avail.c
  print_aligned_files()ModuleCmd_Avail.c
  store_files()ModuleCmd_Avail.c
  fclose(), fopen(), fprintf(), malloc(), memset(), strcat(), strchr(), strcpy(), strlen(), umask()
Called by: ModuleCmd_Avail()ModuleCmd_Avail.c
References Variables: module_nameModuleCmd_Avail.c
  modulerc_filemain.c
  namebufModuleCmd_Avail.c
  sw_createmain.c
  sw_formatmain.c

Local Function print_spaced_file()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		print_spaced_file				     **
 ** 									     **
 **   Description:	Print out the passed filename and fill the output    **
 **			area up to the passed number of characters	     **
 ** 									     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Parameters:	char	*name		Name to be printed	     **
 **			int	 maxwidth	With of the output field to  **
 **						be filled up		     **
 **			int	 space		Boolean value controlling if **
 **						the output area should be    **
 **						filled up with spaces or not **
 **			int	 number		value to start number list   **
 ** 						use -1 for none		     **
 ** 									     **
 **   Result:		-						     **
 ** 									     **
 **   Attached Globals:	-						     **
 ** 									     **
 ** ************************************************************************ **
static void print_spaced_file ( char* name, int maxwidth, int space, int number )
Prototyped in: ModuleCmd_Avail.c
Calls: chk4spch()utility.c
  _IO_putc(), fprintf(), strlen()
Called by: print_terse_files()ModuleCmd_Avail.c

Local Function print_terse_files()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		print_terse_files				     **
 ** 									     **
 **   Description:	Print out the filenames in the _file_list array in   **
 **			case of terse output 				     **
 ** 									     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Parameters:	int	  terminal_width	Terminal size	     **
 **			int	  len			max. filename length **
 **			char	 *header		header to print	     **
 **			int	  number		value to start number**
 ** 							use -1 for none	     **
 ** 									     **
 **   Result:		-						     **
 ** 									     **
 **   Attached Globals:	-						     **
 ** 									     **
 ** ************************************************************************ **
static void print_terse_files ( int terminal_width, int len, char* header, int numbered )
Prototyped in: ModuleCmd_Avail.c
Calls: _get_file_list()ModuleCmd_Avail.c
  _pick_file_list()ModuleCmd_Avail.c
  print_spaced_file()ModuleCmd_Avail.c
  fprintf(), strlen()
Called by: print_aligned_files()ModuleCmd_Avail.c
References Variables: _file_list_wr_ndxModuleCmd_Avail.c
  sw_formatmain.c

Local Function store_dirlst()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		store_dirlst					     **
 ** 									     **
 **   Description:	Write the contents of a cache file		     **
 ** 									     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Parameters:	FILE	*cacheoutput	Output stream to be used     **
 **			FILE	*cacheinfo	Cache log file to be written **
 **			fi_ent	*dirlist_head	List of files to be printed  **
 **			int	 count		Number of entries in the pas-**
 **						sed 'dirlist'		     **
 **   Result:		-						     **
 ** 									     **
 **   Attached Globals:	-						     **
 ** 									     **
 ** ************************************************************************ **
static void store_dirlst ( FILE* cacheinfo, FILE* cacheoutput, fi_ent* dirlst_head, int count, char* dir )
Prototyped in: ModuleCmd_Avail.c
Calls: store_dirlst()ModuleCmd_Avail.c
  store_file()ModuleCmd_Avail.c
  fprintf()
Called by: store_dirlst()ModuleCmd_Avail.c
  store_files()ModuleCmd_Avail.c

Local Function store_file()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		store_file					     **
 ** 									     **
 **   Description:	Store the name of the file passed as 'file entry' to **
 **			the specified output stream if it isn't a temp file  **
 ** 									     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Parameters:	FILE	*cacheoutput	Output stream to be used     **
 **			char	*dir		The current directory	     **
 **			fi_ent	*file		According file		     **
 ** 									     **
 **   Result:		-						     **
 ** 									     **
 **   Attached Globals:	-						     **
 ** 									     **
 ** ************************************************************************ **
static void store_file ( FILE* cacheoutput, char* dir, fi_ent* file )
Prototyped in: ModuleCmd_Avail.c
Calls: chk4spch()utility.c
  fprintf(), strlen()
Called by: store_dirlst()ModuleCmd_Avail.c

Local Function store_files()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		store_files					     **
 ** 									     **
 **   Description:	Write a cache file using the given directory list    **
 ** 									     **
 **   First Edition:	91/10/23					     **
 ** 									     **
 **   Parameters: 	fi_ent	*dirlist_head	List of files to be printed  **
 **			int	 count		Number of entries in the pas-**
 **						sed 'dirlist'		     **
 **			int	 tcount		Number of entries to write to**
 **						the cache file. This id the  **
 **						total number of files stores **
 **						in the nested directory lists**
 **			char	*dir		The current directory	     **
 **									     **
 **   Result:		-						     **
 ** 									     **
 **   Attached Globals:	-						     **
 ** 									     **
 ** ************************************************************************ **
static void store_files ( fi_ent* dirlst_head, int count, int tcount, char* dir )
Prototyped in: ModuleCmd_Avail.c
Calls: Module_Error()error.c
  store_dirlst()ModuleCmd_Avail.c
  fclose(), fopen(), fprintf(), strcat(), strcpy()
Called by: print_dir()ModuleCmd_Avail.c
References Variables: module_nameModuleCmd_Avail.c
  namebufModuleCmd_Avail.c