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

Re: Check min and max num targets in client args patch.

From: Mo DeJong <mdejong_at_cygnus.com>
Date: 2001-03-08 07:58:46 CET

> > Well, we could always just have it print out the command specific help...

And now for a new riddle. When is an error not an error?

I have been looking into putting more of the "smarts"
of client subcommand checking into the subcommand itself.

In add-cmd.c we could use some code like so:

  if (targets->nelts)
    ...
  else
    {
      (*((svn_string_t **) apr_array_push (targets)))
        = svn_string_create ("add", pool);

      svn_cl__help (NULL, targets, pool);
      return ?????
    }

Problem is, what do we return? If SVN_NO_ERROR
is returned then the process exit status will be 0.

The code that checks the return status in main.c
looks like:

  /* Run the subcommand. */
  err = (*subcommand->cmd_func) (&opt_state, targets, pool);
  if (err)
    svn_handle_error (err, stdout, 0);
  
  apr_pool_destroy (pool);
  return EXIT_SUCCESS;

This svn_handle_error bit seems to be the sticking point,
it will print extra stuff and the process will still
return 0 as the exit status.

An invocation like `svn add` should just print the
subcommand specific help text as if the user had
run `svn help add` except that is should not
have an exit status of 0.

Ideas? I am a bit new to this code so I don't
want to end up trying to solve a problem that
someone else has already dealt with.

Mo DeJong
Red Hat Inc
Received on Sat Oct 21 14:36:25 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.