[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] #1 Update on port to OS400/EBCDIC

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2006-02-10 23:06:36 CET

Paul Burba wrote:
>
> [[[
> OS400/EBCDIC Port: Convert command-line arguments from EBCDIC to UTF-8.
>
> This is the first of several patches to allow Subversion to run on under

(Trivia: you might want to delete "on" or "under" at the end of that line.)

> IBM's OS400 V5R4. Despite IBM's building of APR/Apache with UTF support
> in V5R4, command line arguments to main() are still encoded in EBCDIC.
>
> * subversion/include/svn_cmdline.h
> (svn_cmdline_args_from_ebcdic): New function declaration.
>
> * subversion/libsvn_subr/cmdline.c
> (SVN_UTF_ETOU_XLATE_HANDLE): New xlate key for EBCDIC (CCSID 0) to
> UTF-8 (CCSID 1208) conversions.
> (svn_cmdline_args_from_ebcdic): New function definition.
>
> * subversion/svn/main.c
> * subversion/svnadmin/main.c
> * subversion/svndumpfilter/main.c
> * subversion/svnlook/main.c
> * subversion/svnserve/main.c
> * subversion/svnsync/main.c

And you might as well do the seventh and final program, "svnversion", while
you're at it - unless there is some reason why you deliberately left it out.

> (main): Convert command line arguments from EBCDIC to UTF-8
> with svn_cmdline_args_from_ebcdic().
> ]]]

[...]
> +svn_error_t *
> +svn_cmdline_args_from_ebcdic (int argc,
> + const char *const **argv_p,
> + apr_pool_t *pool)
> +{
> + int i;
> + const char **argv_utf8 = apr_palloc (pool, sizeof(char *) * argc);

Sorry, one more thing that I didn't think of until now: argv should be an array
of (argc + 1) entries, terminated by a null entry, because that's how it's
defined (IIRC) in standard C, regardless of whether any of our programs
currently rely on that.

> + for (i = 0; i < argc; i++)
> + {
> + SVN_ERR (svn_utf_cstring_to_utf8_ex (&argv_utf8[i], (*argv_p)[i],
> "0",
> + SVN_UTF_ETOU_XLATE_HANDLE,
> + pool));
> + }

So "argv_utf8[argc] = NULL;"

> + *argv_p = argv_utf8;
> + return SVN_NO_ERROR;
> +}

With at least the null-terminator fix, no need to post it here again, I'm happy
for you to check this in. (I believe you're supposed to put "Approved by:
julianfoad" in the log message.)

Thanks.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Feb 10 23:07:41 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.