[PATCH] svnversion should output its help messages to stdout (Take 2)
From: Kobayashi Noritada <nori1_at_dolphin.c.u-tokyo.ac.jp>
Date: 2005-02-23 14:59:56 CET
Hi,
This is a patch to make the default error message for svnversion shorter
> If you want to change the behaviour it's probably be better to make
In this patch I've done as pointed out.
Regards,
-- |: Noritada KOBAYASHI |: Dept. of General Systems Studies, |: Graduate School of Arts and Sciences, Univ. of Tokyo |: E-mail: nori1@dolphin.c.u-tokyo.ac.jp (preferable) |: nori@esa.c.u-tokyo.ac.jp Log: Make the default error message for svnversion shorter and add an option '--help', which display the long help message that was the default error message. * subversion/svnversion/main.c (usage): Make the error message shorter, which suggests an option, '--help'. Also remove an argument , 'options', which is no longer used in the function. (help): A new function to display the help message, which was the error message displayed with 'usage', to stdout. (main): Add lines for a new option '--help'. Also remove 'options' from arguments of 'usage'. Index: subversion/svnversion/main.c =================================================================== --- subversion/svnversion/main.c (revision 13122) +++ subversion/svnversion/main.c (working copy) @@ -117,11 +117,20 @@ } static void -usage(const apr_getopt_option_t *options, apr_pool_t *pool) +usage(apr_pool_t *pool) { + svn_error_clear (svn_cmdline_fprintf + (stderr, pool, _("Type 'svnversion --help' for usage.\n"))); + exit(1); +} + + +static void +help(const apr_getopt_option_t *options, apr_pool_t *pool) +{ svn_error_clear (svn_cmdline_fprintf - (stderr, pool, + (stdout, pool, _("usage: svnversion [OPTIONS] WC_PATH [TRAIL_URL]\n\n" " Produce a compact 'version number' for the working copy path\n" " WC_PATH. TRAIL_URL is the trailing portion of the URL used to\n" @@ -150,9 +159,11 @@ { const char *optstr; svn_opt_format_option(&optstr, options, TRUE, pool); - svn_error_clear (svn_cmdline_fprintf(stderr, pool, " %s\n", optstr)); + svn_error_clear (svn_cmdline_fprintf(stdout, pool, " %s\n", optstr)); ++options; } + svn_error_clear (svn_cmdline_fprintf(stdout, pool, "\n")); + exit(1); } @@ -197,6 +208,7 @@ { {"no-newline", 'n', 0, N_("do not output the trailing newline")}, {"committed", 'c', 0, N_("last changed rather than current revisions")}, + {"help", 'h', 0, N_("display this help")}, {"version", SVNVERSION_OPT_VERSION, 0, N_("show version information")}, {0, 0, 0, 0} }; @@ -247,7 +259,7 @@ break; if (status != APR_SUCCESS) { - usage(options, pool); + usage(pool); return EXIT_FAILURE; } switch (opt) @@ -258,19 +270,22 @@ case 'c': sb.committed = TRUE; break; + case 'h': + help(options, pool); + break; case SVNVERSION_OPT_VERSION: SVN_INT_ERR(version(os, pool)); exit(0); break; default: - usage(options, pool); + usage(pool); return EXIT_FAILURE; } } if (os->ind >= argc || os->ind < argc - 2) { - usage(options, pool); + usage(pool); return EXIT_FAILURE; } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org For additional commands, e-mail: dev-help@subversion.tigris.orgReceived on Wed Feb 23 15:01:24 2005 |
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.