Qshell Interpreter (qsh) - FTP Directory Listing - IBM
Qshell Interpreter (qsh) - FTP Directory Listing - IBM
Qshell Interpreter (qsh) - FTP Directory Listing - IBM
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Output<br />
#include <br />
#include <br />
#include <br />
#include <br />
int main(int argc, char *argv[])<br />
{<br />
int status;<br />
char *command = “ls”;<br />
/* Verify the user has access to the specified command. */<br />
if (QzshCheckShellCommand(command, NULL) == 0) {<br />
/* Run the specified command. */<br />
status = QzshSystem(command);<br />
if (WIFEXITED(status)) {<br />
printf(“Command %s completed with exit status %d.\n”,<br />
command, WEXITSTATUS(status));<br />
}<br />
else if (WIFSIGNALED(status)) {<br />
printf(“Command %s ended with signal %d.\n”,<br />
command, WTERMSIG(status));<br />
}<br />
else if (WIFEXCEPTION(status)) {<br />
printf(“Command %s ended with exception.\n”, command);<br />
}<br />
}<br />
else<br />
printf(“Error %d finding command %s\n”, errno, command);<br />
return(0);<br />
}<br />
Command ls completed with exit status 0.<br />
[ Legal | AS/400 Glossary ]<br />
QzshCheckShellCommand() - Find QSH Command<br />
Parameters<br />
Syntax<br />
#include <br />
int QzshCheckShellCommand( const char *command, const char *path );<br />
Threadsafe: Yes<br />
The QzshCheckShellCommand() function finds the specified shell command by<br />
searching:<br />
v for a built-in utility, then<br />
v in each directory in the list specified by path or the PATH environment variable in<br />
turn.<br />
An application can use QzshCheckShellCommand() to verify that command exists<br />
and the user has authority to command before running it.<br />
*command<br />
(Input) Pointer to null-terminated string that contains the shell command to find.<br />
*path<br />
(Input) Pointer to null-terminated string that contains a colon delimited list of<br />
Chapter 5. <strong>Qshell</strong> APIs 115