29.06.2013 Views

Qshell Interpreter (qsh) - FTP Directory Listing - IBM

Qshell Interpreter (qsh) - FTP Directory Listing - IBM

Qshell Interpreter (qsh) - FTP Directory Listing - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Client program<br />

{<br />

va_list ap;<br />

/* Build the formatted string. */<br />

va_start(ap, format);<br />

vsprintf(log_buffer, format, ap);<br />

va_end(ap);<br />

/* Write the formatted string. */<br />

write(fd, log_buffer, strlen(log_buffer));<br />

return;<br />

} /* End of SendError() */<br />

/*<br />

* Handler to clean up when the program is canceled.<br />

*/<br />

void CleanupHandler(_CNL_Hndlr_Parms_T *cancel_info)<br />

{<br />

int sfd;<br />

sfd = *((int *)cancel_info->Com_Area);<br />

close(sfd);<br />

} /* End of CleanupHandler() */<br />

[ Legal | AS/400 Glossary ]<br />

Disclaimer<br />

<strong>IBM</strong> grants you a nonexclusive license to use this as an example from which you can<br />

generate similar function tailored to your own specific needs.<br />

This sample code is provided by <strong>IBM</strong> for illustrative purposes only. These examples have not<br />

been thoroughly tested under all conditions. <strong>IBM</strong>, therefore, cannot guarantee or imply<br />

reliability, serviceability, or function of these programs.<br />

All programs contained herein are provided to you “AS IS” without any warranties of any<br />

kind. The implied warranties of merchantability and fitness for a particular purpose are<br />

expressly disclaimed.<br />

/**********************************************************************/<br />

/* */<br />

/* Name: <strong>qsh</strong>c.c */<br />

/* */<br />

/* Description: This program is a client for an interactive <strong>qsh</strong> */<br />

/* session running on a remote AS/400. The program */<br />

/* first connects to a server on the specified */<br />

/* AS/400 and sends the user name and password of */<br />

/* the client. After the <strong>qsh</strong> session is started, */<br />

/* the program takes input from stdin and sends it */<br />

/* to the server and receives output from the server */<br />

/* and displays it on stdout. */<br />

/* */<br />

/* Parameters: 1. Host running the <strong>qsh</strong> server (either host name or */<br />

/* IP address). */<br />

/* */<br />

/* Options: 1. -n to force prompt for user name and password. */<br />

/* 2. -p to specify port of <strong>qsh</strong> server. */<br />

/* */<br />

/* Notes: 1. The user name and password are sent as plain text */<br />

/* to the server. */<br />

/* 2. All translations from ASCII to EBCDIC are done by */<br />

/* this program on the client. */<br />

/* 3. The program includes translation tables for */<br />

/* converting between EBCDIC code page 37 (US English)*/<br />

/* and ASCII code page 850 (US English). You can */<br />

/* modify these tables to support other code pages. */<br />

/* Or if your system supports the iconv APIs, you */<br />

/* can define USE_ICONV to translate using iconv(). */<br />

Chapter 6. Remote client examples 125

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!