OSI/AS and OSI/TS Supplement (Includes RFC-1006 Support)
IP Address Conversion Program
RFC-1006 Configuration Command Files
4–2 107751 Tandem Computers Incorporated
Alternatively, you may be able to make use of the following SCF commands, as the
displays for these commands show both IP address formats:
Command OSI/TS OSI/AS
CHECK ENTRY X
CHECK SU X X
INFO ENTRY #NSAP X
INFO SU, DETAIL X X
STATUS SU, DETAIL X X
The source-code file for this example is provided as part of the OSI/TS software. It
resides (by default) in $SYSTEM.ZOSITS.EXADCVTC. Below is the source code of this
program.
#pragma search "$system.ztcpip.libinetl"
/*
* This program converts an IP address in dotted decimal notation to
* an eight-digit hexadecimal string, or vice versa.
*
* The suggested way to compile this program is:
* c/in ipadcvtc/ipadcvt;suppress,symbols,saveabend,strict,runnable, &
* ssv0 "$system.system",ssv1 "$system.ztcpip"
* (One compiler warning is to be expected.)
*/
#include <stdioh>
#include <stringh>
#include "socketh"
#include "inh"
#include "netdbh"
#include <cextdecs(DNUMIN)>
#define PLAIN_FLAG (0x04 + 0x02) /* disallow sign and prefixes */
int main(int argc, char *argv[])
{
long l;
int error;
struct in_addr in;
if (argc > 1)
{
/*
* First, see if it's an IP address
*/
if ((l = inet_addr(argv[1])) != 0xFFFFFFFF)
{
printf("%.8lX\n", l);
return 0;
}