Files
modules/xref/cmdPath.c.html
2006-01-18 05:27:50 +00:00

438 lines
19 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- This HTML file generated by cxref (version 1.6a). -->
<!-- cxref program (c) Andrew M. Bishop 1995,96,97,98,99,2000,01,02,03,04,05. -->
<!--
Cxref: cxref -block-comments -verbatim-comments -xref-all -index-all -html-src -Oxref cmdPath.c
CPP : cxref-cpp -lang-c -C -dD -dI
-->
<HTML>
<HEAD>
<TITLE>Cross reference for cmdPath.c of cxref.</TITLE>
<LINK rel="stylesheet" href="cxref.css" type="text/css">
</HEAD>
<BODY>
<h1><a name="file" href="cmdPath.c.src.html">File cmdPath.c</a></h1>
<pre>
** ** 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: **
** **
** ************************************************************************ **
</pre>
<table>
<tr>
<td>References Variables:
<td><a href="cmdPath.c.html#var-Id">Id</a>
<td><a href="cmdPath.c.html#var-Id">cmdPath.c</a>
</tr>
</table>
<hr>
<h2>Included Files</h2>
<ul class="cxref-include">
<li class="cxref-include-local"><tt><span class="cxref-include-local"><a href="modules_def.h.html#file">#include "modules_def.h"</a></span></tt>
<ul class="cxref-include">
<li class="cxref-include-system"><tt><span class="cxref-include-system">#include &lt;stdio.h&gt;</span></tt>
<li class="cxref-include-system"><tt><span class="cxref-include-system">#include &lt;stdarg.h&gt;</span></tt>
<li class="cxref-include-system"><tt><span class="cxref-include-system">#include &lt;tcl.h&gt;</span></tt>
<li class="cxref-include-local"><tt><span class="cxref-include-local"><a href="config.h.html#file">#include "config.h"</a></span></tt>
<li class="cxref-include-system"><tt><span class="cxref-include-system">#include &lt;stdlib.h&gt;</span></tt>
<li class="cxref-include-system"><tt><span class="cxref-include-system">#include &lt;string.h&gt;</span></tt>
<li class="cxref-include-system"><tt><span class="cxref-include-system">#include &lt;unistd.h&gt;</span></tt>
<li class="cxref-include-system"><tt><span class="cxref-include-system">#include &lt;sys/types.h&gt;</span></tt>
<li class="cxref-include-system"><tt><span class="cxref-include-system">#include &lt;ctype.h&gt;</span></tt>
<li class="cxref-include-system"><tt><span class="cxref-include-system">#include &lt;sys/stat.h&gt;</span></tt>
<li class="cxref-include-system"><tt><span class="cxref-include-system">#include &lt;sys/termios.h&gt;</span></tt>
<li class="cxref-include-system"><tt><span class="cxref-include-system">#include &lt;fcntl.h&gt;</span></tt>
<li class="cxref-include-system"><tt><span class="cxref-include-system">#include &lt;sys/ioctl.h&gt;</span></tt>
<li class="cxref-include-system"><tt><span class="cxref-include-system">#include &lt;dirent.h&gt;</span></tt>
<li class="cxref-include-system"><tt><span class="cxref-include-system">#include &lt;errno.h&gt;</span></tt>
</ul>
</ul>
<hr>
<h2>Preprocessor definitions</h2>
<tt><span class="cxref-define"><a href="cmdPath.c.src.html#line58">#define PATH_BUFLEN</a> 1024</span></tt><br>
<p>
<tt><span class="cxref-define"><a href="cmdPath.c.src.html#line65">#define _TCLCHK</a>( a )</span></tt><br>
<hr>
<h2>Local Variables</h2>
<b><a name="var-Id">Id</a></b><br>
<tt><span class="cxref-variable"><a href="cmdPath.c.src.html#line33">static char Id[]</a></span></tt><br>
<table>
<tr>
<td>Used in:
<td>&nbsp; <td><span class="cxref-reference-local"><a href="cmdPath.c.html#file">cmdPath.c</a></span>
</tr>
</table>
<p>
<b><a name="var-UseId">UseId</a></b><br>
<tt><span class="cxref-variable"><a href="cmdPath.c.src.html#line34">static void* UseId[]</a></span></tt><br>
<p>
<b><a name="var-module_name">module_name</a></b><br>
<tt><span class="cxref-variable"><a href="cmdPath.c.src.html#line72">static char module_name[]</a></span></tt><br>
<table>
<tr>
<td>Used in:
<td><a href="#func-Remove_Path">Remove_Path()</a>
<td>&nbsp;
</tr>
<tr>
<td>&nbsp;
<td><a href="#func-cmdRemovePath">cmdRemovePath()</a>
<td>&nbsp;
</tr>
<tr>
<td>&nbsp;
<td><a href="#func-cmdSetPath">cmdSetPath()</a>
<td>&nbsp;
</tr>
</table>
<p>
<b><a name="var-buffer">buffer</a></b><br>
<tt><span class="cxref-variable"><a href="cmdPath.c.src.html#line80">static char buffer[1024]</a></span></tt><br>
<table>
<tr>
<td>Used in:
<td><a href="#func-Remove_Path">Remove_Path()</a>
<td>&nbsp;
</tr>
<tr>
<td>&nbsp;
<td><a href="#func-cmdSetPath">cmdSetPath()</a>
<td>&nbsp;
</tr>
</table>
<hr>
<h2><a name="func-cmdRemovePath">Global Function cmdRemovePath()</a></h2>
<pre>
** ** 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 **
** **
** ************************************************************************ **
</pre>
<tt><span class="cxref-function"><a href="cmdPath.c.src.html#line400">int cmdRemovePath ( ClientData client_data, Tcl_Interp* interp, int argc, const char* argv[] )</a></span></tt><br>
<table>
<tr>
<td>Prototyped in:
<td colspan=2><span class="cxref-reference-local"><a href="modules_def.h.html#file">modules_def.h</a></span>
</tr>
<tr>
<td>Calls:
<td><span class="cxref-reference-local"><a href="error.c.html#func-Module_Error">Module_Error()</a></span>
<td><span class="cxref-reference-local"><a href="error.c.html#func-Module_Error">error.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#func-Remove_Path">Remove_Path()</a></span>
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#func-Remove_Path">cmdPath.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="locate_module.c.html#func-SplitIntoList">SplitIntoList()</a></span>
<td><span class="cxref-reference-local"><a href="locate_module.c.html#func-SplitIntoList">locate_module.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td colspan=2><span class="cxref-reference-system">fprintf(), strncmp()</span>
</tr>
<tr>
<td>Called by:
<td><span class="cxref-reference-local"><a href="ModuleCmd_Use.c.html#func-ModuleCmd_UnUse">ModuleCmd_UnUse()</a></span>
<td><span class="cxref-reference-local"><a href="ModuleCmd_Use.c.html#func-ModuleCmd_UnUse">ModuleCmd_Use.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="utility.c.html#func-Update_LoadedList">Update_LoadedList()</a></span>
<td><span class="cxref-reference-local"><a href="utility.c.html#func-Update_LoadedList">utility.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#func-cmdSetPath">cmdSetPath()</a></span>
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#func-cmdSetPath">cmdPath.c</a></span>
</tr>
<tr>
<td>Used in:
<td><span class="cxref-reference-local"><a href="init.c.html#func-InitializeModuleCommands">InitializeModuleCommands()</a></span>
<td><span class="cxref-reference-local"><a href="init.c.html#func-InitializeModuleCommands">init.c</a></span>
</tr>
<tr>
<td>References Variables:
<td><span class="cxref-reference-local"><a href="main.c.html#var-g_flags">g_flags</a></span>
<td><span class="cxref-reference-local"><a href="main.c.html#var-g_flags">main.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#var-module_name">module_name</a></span>
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#var-module_name">cmdPath.c</a></span>
</tr>
</table>
<hr>
<h2><a name="func-cmdSetPath">Global Function cmdSetPath()</a></h2>
<pre>
** ** 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 **
** **
** ************************************************************************ **
</pre>
<tt><span class="cxref-function"><a href="cmdPath.c.src.html#line118">int cmdSetPath ( ClientData client_data, Tcl_Interp* interp, int argc, const char* argv[] )</a></span></tt><br>
<table>
<tr>
<td>Prototyped in:
<td colspan=2><span class="cxref-reference-local"><a href="modules_def.h.html#file">modules_def.h</a></span>
</tr>
<tr>
<td>Calls:
<td><span class="cxref-reference-local"><a href="error.c.html#func-Module_Error">Module_Error()</a></span>
<td><span class="cxref-reference-local"><a href="error.c.html#func-Module_Error">error.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="locate_module.c.html#func-SplitIntoList">SplitIntoList()</a></span>
<td><span class="cxref-reference-local"><a href="locate_module.c.html#func-SplitIntoList">locate_module.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="utility.c.html#func-cleanse_path">cleanse_path()</a></span>
<td><span class="cxref-reference-local"><a href="utility.c.html#func-cleanse_path">utility.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#func-cmdRemovePath">cmdRemovePath()</a></span>
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#func-cmdRemovePath">cmdPath.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="cmdSetenv.c.html#func-moduleSetenv">moduleSetenv()</a></span>
<td><span class="cxref-reference-local"><a href="cmdSetenv.c.html#func-moduleSetenv">cmdSetenv.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="utility.c.html#func-null_free">null_free()</a></span>
<td><span class="cxref-reference-local"><a href="utility.c.html#func-null_free">utility.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="utility.c.html#func-stringer">stringer()</a></span>
<td><span class="cxref-reference-local"><a href="utility.c.html#func-stringer">utility.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td colspan=2><span class="cxref-reference-system">Tcl_GetVar2(), Tcl_RegExpCompile(), Tcl_RegExpExec(), Tcl_RegExpRange(), fprintf(), strcat(), strcmp(), strcpy(), strlen(), strncmp()</span>
</tr>
<tr>
<td>Called by:
<td><span class="cxref-reference-local"><a href="ModuleCmd_Use.c.html#func-ModuleCmd_Use">ModuleCmd_Use()</a></span>
<td><span class="cxref-reference-local"><a href="ModuleCmd_Use.c.html#func-ModuleCmd_Use">ModuleCmd_Use.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="utility.c.html#func-Update_LoadedList">Update_LoadedList()</a></span>
<td><span class="cxref-reference-local"><a href="utility.c.html#func-Update_LoadedList">utility.c</a></span>
</tr>
<tr>
<td>Used in:
<td><span class="cxref-reference-local"><a href="init.c.html#func-InitializeModuleCommands">InitializeModuleCommands()</a></span>
<td><span class="cxref-reference-local"><a href="init.c.html#func-InitializeModuleCommands">init.c</a></span>
</tr>
<tr>
<td>References Variables:
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#var-buffer">buffer</a></span>
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#var-buffer">cmdPath.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="main.c.html#var-g_flags">g_flags</a></span>
<td><span class="cxref-reference-local"><a href="main.c.html#var-g_flags">main.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#var-module_name">module_name</a></span>
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#var-module_name">cmdPath.c</a></span>
</tr>
</table>
<hr>
<h2><a name="func-Remove_Path">Local Function Remove_Path()</a></h2>
<pre>
** ** 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 **
** **
** ************************************************************************ **
</pre>
<tt><span class="cxref-function"><a href="cmdPath.c.src.html#line519">static int Remove_Path ( Tcl_Interp* interp, char* variable, char* item, char* sw_marker )</a></span></tt><br>
<table>
<tr>
<td>Prototyped in:
<td colspan=2><span class="cxref-reference-local"><a href="cmdPath.c.html#file">cmdPath.c</a></span>
</tr>
<tr>
<td>Calls:
<td><span class="cxref-reference-local"><a href="error.c.html#func-Module_Error">Module_Error()</a></span>
<td><span class="cxref-reference-local"><a href="error.c.html#func-Module_Error">error.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="utility.c.html#func-cleanse_path">cleanse_path()</a></span>
<td><span class="cxref-reference-local"><a href="utility.c.html#func-cleanse_path">utility.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="utility.c.html#func-clear_hash_value">clear_hash_value()</a></span>
<td><span class="cxref-reference-local"><a href="utility.c.html#func-clear_hash_value">utility.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="cmdSetenv.c.html#func-moduleUnsetenv">moduleUnsetenv()</a></span>
<td><span class="cxref-reference-local"><a href="cmdSetenv.c.html#func-moduleUnsetenv">cmdSetenv.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="utility.c.html#func-null_free">null_free()</a></span>
<td><span class="cxref-reference-local"><a href="utility.c.html#func-null_free">utility.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="utility.c.html#func-store_hash_value">store_hash_value()</a></span>
<td><span class="cxref-reference-local"><a href="utility.c.html#func-store_hash_value">utility.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="utility.c.html#func-stringer">stringer()</a></span>
<td><span class="cxref-reference-local"><a href="utility.c.html#func-stringer">utility.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td colspan=2><span class="cxref-reference-system">Tcl_GetVar2(), Tcl_RegExpCompile(), Tcl_RegExpExec(), Tcl_RegExpRange(), Tcl_SetVar2(), strcpy(), strlen()</span>
</tr>
<tr>
<td>Called by:
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#func-cmdRemovePath">cmdRemovePath()</a></span>
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#func-cmdRemovePath">cmdPath.c</a></span>
</tr>
<tr>
<td>References Variables:
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#var-buffer">buffer</a></span>
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#var-buffer">cmdPath.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="main.c.html#var-g_flags">g_flags</a></span>
<td><span class="cxref-reference-local"><a href="main.c.html#var-g_flags">main.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#var-module_name">module_name</a></span>
<td><span class="cxref-reference-local"><a href="cmdPath.c.html#var-module_name">cmdPath.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="main.c.html#var-setenvHashTable">setenvHashTable</a></span>
<td><span class="cxref-reference-local"><a href="main.c.html#var-setenvHashTable">main.c</a></span>
</tr>
<tr>
<td>&nbsp;
<td><span class="cxref-reference-local"><a href="main.c.html#var-unsetenvHashTable">unsetenvHashTable</a></span>
<td><span class="cxref-reference-local"><a href="main.c.html#var-unsetenvHashTable">main.c</a></span>
</tr>
</table>
</BODY>
</HTML>