ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahz_5.4.0.1/qzshchkc.htm

186 lines
4.7 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content=
"text/html; charset=utf-8">
<title>QzshCheckShellCommand() - Find QSH Command</title>
<LINK rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</HEAD>
<body bgcolor="#FFFFFF">
<!-- Java sync-link -->
<SCRIPT LANGUAGE="Javascript" SRC="../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
<h2>QzshCheckShellCommand() - Find QSH Command</h2>
<table border cellpadding="10" width="100%">
<tr>
<td>Syntax
<pre>
#include &lt;qshell.h&gt;
int QzshCheckShellCommand( const char <em>*command</em>, const char <em>*path</em> );
</pre>
<p><br>
Threadsafe: Yes</p>
</td>
</tr>
</table>
<p>The <strong>QzshCheckShellCommand()</strong> function finds the
specified shell command by searching:</p>
<ul>
<li>for a built-in utility, then</li>
<li>in each directory in the list specified by <em>path</em> or the
<strong>PATH</strong> environment variable in turn.</li>
</ul>
<p>An application can use <strong>QzshCheckShellCommand()</strong>
to verify that <em>command</em> exists and the user has authority
to <em>command</em> before running it.
<p><strong>Parameters</strong></p>
<p><em>*command</em><br>
(Input) Pointer to null-terminated string that contains the shell
command to find.</p>
<p><em>*path</em><br>
(Input) Pointer to null-terminated string that contains a colon
delimited list of directories to search. If this parameter is NULL,
<strong>QzshCheckShellCommand()</strong> uses the value of the
<strong>PATH</strong> environment variable.
<p><strong>Authorities</strong></p>
<p>When command is an executable file, the user must have the
following authorities.</p>
<table border cellpadding="5" width="100%">
<tr>
<th>Object Referred To</th>
<th>Authority Required</th>
<th>errno</th>
</tr>
<tr>
<td width="60%">Each directory in the path name preceding the executable
file</td>
<td width="20%">*X</td>
<td width="20%">EACCES</td>
</tr>
<tr>
<td>Executable file</td>
<td>*X</td>
<td>EACCES</td>
</tr>
<tr>
<td>If executable file is a shell script</td>
<td>*RX</td>
<td>EACCES</td>
</tr>
</table>
<p><strong>Return value</strong></p>
<dl>
<dt><strong>0</strong></dt>
<dd><strong>QzshCheckShellCommand()</strong> was successful. The
<em>command</em> was found in the current environment.<p></dd>
<dt><strong>-1</strong></dt>
<dd><strong>Qp0zCheckShellCommand()</strong> was not successful.
The <em>errno</em> value is set to indicate the error.<p></dd>
</dl>
<p><strong>Error conditions</strong></p>
<p>If <strong>QzshCheckShellCommand()</strong> is not successful,
<em>errno</em> typically indicates one of the following errors. Under
some conditions, <em>errno</em> could indicate an error other than
those listed here.</p>
<dl>
<dt><strong>[EACCES]</strong></dt>
<dd>Permission denied.<p></dd>
<dd>An attempt was made to access an object in a way forbidden by
its object access permissions.<p></dd>
<dd>The thread does not have access to the specified file,
directory, component, or path.<p></dd>
<dt><strong>[EFAULT]</strong></dt>
<dd>The address used for an argument is not correct.<p></dd>
<dd>In attempting to use an argument in a call, the system detected
an address that is not valid.<p></dd>
<dd>While attempting to access a parameter passed to this function,
the system detected an address that is not valid.<p></dd>
<dt><strong>[EINVAL]</strong></dt>
<dd>The value specified for the argument is not correct.<p></dd>
<dd>A function was passed incorrect argument values, or an
operation was attempted on an object and the operation specified is
not supported for that type of object.<p></dd>
<dt><strong>[ENOMEM]</strong></dt>
<dd>Storage allocation request failed.<p></dd>
<dd>A function needed to allocate storage, but no storage is
available.<p></dd>
<dd>There is not enough memory to perform the requested
function.<p></dd>
<dt><strong>[ENOENT]</strong></dt>
<dd>No such path or directory.<p></dd>
<dd>The directory or component of the path name specified does not
exist.<p></dd>
<dd>A named file or directory does not exist or is an empty
string.<p></dd>
<dt><strong>[EUNKNOWN]</strong></dt>
<dd>Unknown system state.<p></dd>
<dd>The operation failed because of an unknown system state. See
any messages in the job log and correct any errors that are
indicated. Then retry the operation.<p></dd>
</dl>
<p><strong>Related information</strong></p>
<ul>
<li><a href="qzshsyst.htm"><strong>QzshSystem()</strong> - Run a
QSH command</a></li>
</ul>
<p><strong>Example: Using the QzshCheckShellCommand()
function</strong></p>
<p>For an example of using this function, see the <a href=
"qzshsyst.htm"><strong>QzshSystem()</strong></a> function.</p>
</body>
</html>