Julian Foad <julianfoad@btopenworld.com> wrote on 02/13/2006 02:38:01 PM:
> Paul Burba wrote:
> > -main (int argc, const char * const *argv)
> > +main(int argc, char *argv[])
> [...]
> > - apr_getopt_init (&os, pool, argc, argv);
> > + svn_cmdline_getopt_init (&os, pool, argc, argv);
>
> subversion/svn/main.c:834: warning: passing argument 4 of
> 'svn_cmdline_getopt_init' from incompatible pointer type
>
> I think it's the C language and/or compiler that's being a bit
unreasonable
> about pointer compatibility here, but nevertheless I try to avoid
> this situation.
>
> Could we compromise and make it:
>
> main(int argc, const char *argv[])
>
> That won't be quite as the C standard says, but it will be a step closer
than
> what we have now. An alternative is to remove "const" from the
signature of
> svn_cmdline_getopt_init(), but that would require a cast inside the
function
> when calling apr_getopt_init.
New patch attached uses your first suggestion, is that acceptable to
everyone?
> Secondly, I'm a little uneasy about introducing a public API that's
> documented
> in terms of what it does on one particular platform, and that we maywell
want
> to change soon to do stuff on other platforms and/or to handle the "-m"
> argument differently. Can we make it private just by including a double
> underscore in it and adding a note to that effect?
>
> /* [...] This is a private API for Subversion's own use. */
> svn_cmdline__getopt_init ...
>
> (We've previously been unable to decide in exactly what ways we can
> use private
> symbols, but I hope this usage won't be objectionable.)
This is also in the latest patch, again is this acceptable to you all?
> Later you wrote:
> > - apr_getopt_init (&os, pool, argc, argv);
> > + err = svn_cmdline_getopt_init (&os, pool, argc, argv);
> > + if (err)
> > + return svn_cmdline_handle_exit_error (err, pool, "svn: ");
>
> +1 on that.
Added similar error handling to all callers of svn_cmdline__getopt_init.
[[[
OS400/EBCDIC Port: Convert command-line arguments from EBCDIC to UTF-8.
This is the second of several patches to allow Subversion to run on 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.
To avoid const restrictions and allow EBCDIC to UTF-8 conversion of
command line arguments in place, the signature of main() in all command
line programs is standardized to main(int argc, const char *argv[]).
Approved by: Julian Foad <julianfoad@btopenworld.com>
Suggestions by: Julian, Philip Martin <philip@codematters.co.uk>, and
Brane <brane@xbc.nu>
* subversion/include/svn_cmdline.h
Include apr_getopt.h
(svn_cmdline__getopt_init): 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__getopt_init): 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
* subversion/svnversion/main.c
(main): Standardize signature and replace call to apr_getopt_init()
with new wrapper function svn_cmdline__getopt_init().
]]]
_____________________________________________________________________________
Scanned for SoftLanding Systems, Inc. and SoftLanding Europe Plc by IBM Email Security Management Services powered by MessageLabs.
_____________________________________________________________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Feb 14 18:31:06 2006