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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

126 <strong>Qshell</strong> <strong>Interpreter</strong> (<strong>qsh</strong>)<br />

/* 4. This program has been tested on AIX 4.1.5 and */<br />

/* Linux 2.0.29. */<br />

/* */<br />

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

/* Remove the comments from the following line to use iconv(). */<br />

/* #define USE_ICONV 1 */<br />

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

/* Includes */<br />

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

#include /* perror() */<br />

#include /* socket(), bind(), etc. */<br />

#include /* sockaddr_in, INADDR_ANY, etc. */<br />

#include /* close(), read(), write() etc. */<br />

#include /* exit() */<br />

#include /* exit(), memset() */<br />

#include /* ioctl() */<br />

#include /* errno and values */<br />

#include /* strlen() */<br />

#include /* inet_addr() */<br />

#include /* gethostbyname() */<br />

#include /* getpwuid() */<br />

#include /* sigaction(), etc. */<br />

#ifdef _AIX<br />

#include /* select() */<br />

#include /* bzero() for FD_ZERO */<br />

#endif<br />

#ifdef __linux__<br />

#include /* FD_SET(), select */<br />

#endif<br />

#ifdef USE_ICONV<br />

#include /* iconv(), etc. */<br />

#endif<br />

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

/* Constants */<br />

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

#define QSH_PORT 6042<br />

#define DEFAULT_BUF 4096<br />

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

/* Types */<br />

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

typedef unsigned char uchar;<br />

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

/* Global Variables */<br />

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

char *sysname; /* Long host name of server system */<br />

#ifdef USE_ICONV<br />

iconv_t ecd; /* Conversion descriptor for ASCII to EBCDIC */<br />

iconv_t acd; /* Conversion descriptor for EBCDIC to ASCII */<br />

#else<br />

/* EBCDIC to ASCII translation table */<br />

static uchar AsciiTable[256] =<br />

{<br />

0x00,0x01,0x02,0x03,0x20,0x09,0x20,0x7f, /* 00-07 */<br />

0x20,0x20,0x20,0x0b,0x0c,0x0d,0x0e,0x0f, /* 08-0f */<br />

0x10,0x11,0x12,0x13,0x20,0x0a,0x08,0x20, /* 10-17 */<br />

0x18,0x19,0x20,0x20,0x20,0x1d,0x1e,0x1f, /* 18-1f */<br />

0x20,0x20,0x1c,0x20,0x20,0x0a,0x17,0x1b, /* 20-27 */<br />

0x20,0x20,0x20,0x20,0x20,0x05,0x06,0x07, /* 28-2f */<br />

0x20,0x20,0x16,0x20,0x20,0x20,0x20,0x04, /* 30-37 */<br />

0x20,0x20,0x20,0x20,0x14,0x15,0x20,0x1a, /* 38-3f */<br />

0x20,0x20,0x83,0x84,0x85,0xa0,0xc6,0x86, /* 40-47 */<br />

0x87,0xa4,0xbd,0x2e,0x3c,0x28,0x2b,0x7c, /* 48-4f */<br />

0x26,0x82,0x88,0x89,0x8a,0xa1,0x8c,0x8b, /* 50-57 */<br />

0x8d,0xe1,0x21,0x24,0x2a,0x29,0x3b,0xaa, /* 58-5f */<br />

0x2d,0x2f,0xb6,0x8e,0xb7,0xb5,0xc7,0x8f, /* 60-67 */<br />

0x80,0xa5,0xdd,0x2c,0x25,0x5f,0x3e,0x3f, /* 68-6f */<br />

0x9b,0x90,0xd2,0xd3,0xd4,0xd6,0xd7,0xd8, /* 70-77 */

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

Saved successfully!

Ooh no, something went wrong!