File cmdPath.c

 ** ** Module Header ******************************************************* **
 ** 									     **
 **   Modules Revision 3.0						     **
 **   Providing a flexible user environment				     **
 ** 									     **
 **   File:		cmdPath.c					     **
 **   First Edition:	1991/10/23					     **
 ** 									     **
 **   Authors:	John Furlan, jlf@behere.com				     **
 **		Jens Hamisch, jens@Strawberry.COM			     **
 ** 									     **
 **   Description:	The path manipulation routines. Much of the heart of **
 **			Modules is contained in this file. These routines    **
 **			are responsible for adding and removing directories  **
 **			from given PATH-like variables.			     **
 ** 									     **
 **   Exports:		cmdSetPath					     **
 **			cmdRemovePath					     **
 ** 									     **
 **   Notes:								     **
 ** 									     **
 ** ************************************************************************ **
References Variables: Id cmdPath.c

Included Files


Preprocessor definitions

#define PATH_BUFLEN 1024

#define _TCLCHK( a )


Local Variables

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

UseId
static void* UseId[]

module_name
static char module_name[]

Used in: Remove_Path()  
  cmdRemovePath()  
  cmdSetPath()  

buffer
static char buffer[1024]

Used in: Remove_Path()  
  cmdSetPath()  

Global Function cmdRemovePath()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		cmdRemovePath					     **
 ** 									     **
 **   Description:	Remove the passed value (argv[2]) from the specified **
 **			variable (argv[1]). In case of switching this pro-   **
 **			cedure removes markers from the path, too. argv[0]   **
 **			specifies, if the append- or prepend-marker is af-   **
 **			fected						     **
 ** 									     **
 **   First Edition:	1991/10/23					     **
 ** 									     **
 **   Parameters:	ClientData	 client_data			     **
 **			Tcl_Interp	*interp		According Tcl interp.**
 **			int		 argc		Number of arguments  **
 **			char		*argv[]		Argument array	     **
 ** 									     **
 **   Result:		int	TCL_OK		Successfull completion	     **
 **				TCL_ERROR	Any error		     **
 ** 									     **
 **   Attached Globals:	g_flags		These are set up accordingly before  **
 **					this function is called in order to  **
 **					control everything		     **
 ** 									     **
 ** ************************************************************************ **
int cmdRemovePath ( ClientData client_data, Tcl_Interp* interp, int argc, const char* argv[] )
Prototyped in: modules_def.h
Calls: Module_Error() error.c
  Remove_Path() cmdPath.c
  SplitIntoList() locate_module.c
  fprintf(), strncmp()
Called by: ModuleCmd_UnUse() ModuleCmd_Use.c
  Update_LoadedList() utility.c
  cmdSetPath() cmdPath.c
Used in: InitializeModuleCommands() init.c
References Variables: g_flags main.c
  module_name cmdPath.c

Global Function cmdSetPath()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		cmdSetPath					     **
 ** 									     **
 **   Description:	Add the passed value (argv[2]) to the specified vari-**
 **			able (argv[1]). argv[0] specifies, if the variable   **
 **			is to be appended or prepended.  Each directory in   **
 **			the path is checked to see whether it is already     **
 **			in the path.  If so it is not added.		     **
 ** 									     **
 **   First Edition:	1991/10/23					     **
 ** 									     **
 **   Parameters:	ClientData	 client_data			     **
 **			Tcl_Interp	*interp		According Tcl interp.**
 **			int		 argc		Number of arguments  **
 **			char		*argv[]		Argument array	     **
 ** 									     **
 **   Result:		int	TCL_OK		Successfull completion	     **
 **				TCL_ERROR	Any error		     **
 ** 									     **
 **   Attached Globals:	g_flags		These are set up accordingly before  **
 **					this function is called in order to  **
 **					control everything		     **
 ** 									     **
 ** ************************************************************************ **
int cmdSetPath ( ClientData client_data, Tcl_Interp* interp, int argc, const char* argv[] )
Prototyped in: modules_def.h
Calls: Module_Error() error.c
  SplitIntoList() locate_module.c
  cleanse_path() utility.c
  cmdRemovePath() cmdPath.c
  moduleSetenv() cmdSetenv.c
  null_free() utility.c
  stringer() utility.c
  Tcl_GetVar2(), Tcl_RegExpCompile(), Tcl_RegExpExec(), Tcl_RegExpRange(), fprintf(), strcat(), strcmp(), strcpy(), strlen(), strncmp()
Called by: ModuleCmd_Use() ModuleCmd_Use.c
  Update_LoadedList() utility.c
Used in: InitializeModuleCommands() init.c
References Variables: buffer cmdPath.c
  g_flags main.c
  module_name cmdPath.c

Local Function Remove_Path()

 ** ** Function-Header ***************************************************** **
 ** 									     **
 **   Function:		Remove_Path					     **
 ** 									     **
 **   Description:	This function actually does the work of removing     **
 **			the item from the path.  It is done this way to      **
 **			support multiple items (often directories)	     **
 **			separated by colons in the variable value.	     **
 ** 									     **
 **   First Edition:	2001/08/08					     **
 ** 									     **
 **   Parameters:	Tcl_Interp	*interp		According Tcl interp.**
 **			char		*variable	Variable from which  **
 **							to remove item	     **
 **			char		*item		Item to remove	     **
 **			char		*sw_marker	Switch marker	     **
 ** 									     **
 **   Result:		int	TCL_OK		Successfull completion	     **
 **				TCL_ERROR	Any error		     **
 ** 									     **
 **   Attached Globals:	g_flags		These are set up accordingly before  **
 **					this function is called in order to  **
 **					control everything		     **
 ** 									     **
 ** ************************************************************************ **
static int Remove_Path ( Tcl_Interp* interp, char* variable, char* item, char* sw_marker )
Prototyped in: cmdPath.c
Calls: Module_Error() error.c
  cleanse_path() utility.c
  clear_hash_value() utility.c
  moduleUnsetenv() cmdSetenv.c
  null_free() utility.c
  store_hash_value() utility.c
  stringer() utility.c
  Tcl_GetVar2(), Tcl_RegExpCompile(), Tcl_RegExpExec(), Tcl_RegExpRange(), Tcl_SetVar2(), strcpy(), strlen()
Called by: cmdRemovePath() cmdPath.c
References Variables: buffer cmdPath.c
  g_flags main.c
  module_name cmdPath.c
  setenvHashTable main.c
  unsetenvHashTable main.c