Subject: Re: Character conversion for sftp

Re: Character conversion for sftp

From: Fritz Elfert <fritz_at_fritz-elfert.de>
Date: Tue, 30 Mar 2010 19:32:19 +0200

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Peter Stuge schrieb:
> Fritz Elfert wrote:
>> IMHO, the easiest way of porting to z/OS is to treat the whole source
>> code as ASCII and then use special ioctls (provided by IBM's libc) to
>> enable auto-conversion back to EBCDIC for stdin, stdout and stderr (if
>> those are connected to a terminal).
>
> Can we somehow make this easier by changing libssh2 or the build
> system?

I'm afraid there's no really simple solution - especially when dealing
with a library. At the moment, i don't have a z/OS system available. I
can start digging in some backups of old porting projects though ...
just give me some time ...

Here's what i remember right now:

1. There are #pragma directives for switching encoding of the compiler:

#pragma convert(819)
const char *str1 = "hello"; /* ASCII string const. */
#pragma convert(37)
const char *str1 = "hello"; /* EBCDIC string const. */

2. On the filesystem level, you can tag source files to be interpreted
as ASCII using the command

chtag -tc ISO8859-1 mysource.c

But then, you would need a special ASCII editor like viascii to edit them.

3. The stdio functions use EBCDIC by default, e.g: if fgets() stumbles
over an ASCII-'\n', it would *not* see an end-of-line.

4. There are ioctl's which can switch a file descriptor into
auto-convert mode (sorry - can't remember the exact names/syntax).

Cheers
 -Fritz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFLsjWjboM4mAMyprARAgPLAJ9+MgwazBVaQI1WSVO++aRF0UOt5QCcCo7I
5YpCnmME4kynxStZR0/qavw=
=j9k8
-----END PGP SIGNATURE-----
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-03-30