logo       

svn commit: r13128 - trunk/subversion/svnversion: msg#00301

version-control.subversion.svn

Subject: svn commit: r13128 - trunk/subversion/svnversion

Author: nori
Date: Wed Feb 23 10:32:20 2005
New Revision: 13128

Modified:
trunk/subversion/svnversion/main.c
Log:
Make the default error message for svnversion shorter and add an option
'--help', which display a longer help message that was the default error
message.

* subversion/svnversion/main.c
(usage): Replace the error message with shorter one suggesting 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 by the function 'usage', to stdout.
(main): Add lines for a new option '--help'. Also remove 'options' from
arguments of 'usage'.

Approved by: julianfoad


Modified: trunk/subversion/svnversion/main.c
Url:
http://svn.collab.net/viewcvs/svn/trunk/subversion/svnversion/main.c?view=diff&rev=13128&p1=trunk/subversion/svnversion/main.c&r1=13127&p2=trunk/subversion/svnversion/main.c&r2=13128
==============================================================================
--- trunk/subversion/svnversion/main.c (original)
+++ trunk/subversion/svnversion/main.c Wed Feb 23 10:32:20 2005
@@ -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(0);
}


@@ -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;
}


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise