You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/10/25 22:36:35 UTC

svn commit: r1027262 - /subversion/trunk/subversion/svn/main.c

Author: stsp
Date: Mon Oct 25 20:36:35 2010
New Revision: 1027262

URL: http://svn.apache.org/viewvc?rev=1027262&view=rev
Log:
* subversion/svn/main.c
  (main): Parse argument to the --strip option with svn_cstring_atoi()
   instead of strtol(). Also make the error message printed if a negative
   argument is passed match the error message used for the --limit option.

Modified:
    subversion/trunk/subversion/svn/main.c

Modified: subversion/trunk/subversion/svn/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/main.c?rev=1027262&r1=1027261&r2=1027262&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/main.c (original)
+++ subversion/trunk/subversion/svn/main.c Mon Oct 25 20:36:35 2010
@@ -1749,20 +1749,17 @@ main(int argc, const char *argv[])
         break;
       case opt_strip:
         {
-          char *end;
-          opt_state.strip = (int) strtol(opt_arg, &end, 10);
-          if (end == opt_arg || *end != '\0')
+          err = svn_cstring_atoi(&opt_state.strip, opt_arg);
+          if (err)
             {
-              err = svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+              err = svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, err,
                                       _("Invalid strip count '%s'"), opt_arg);
               return svn_cmdline_handle_exit_error(err, pool, "svn: ");
             }
           if (opt_state.strip < 0)
             {
-              err = svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
-                                      _("Negative strip count '%i' "
-                                        "(strip count must be positive)"),
-                                      opt_state.strip);
+              err = svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
+                                     _("Argument to --strip must be positive"));
               return svn_cmdline_handle_exit_error(err, pool, "svn: ");
             }
         }