svn_opt.h

Go to the documentation of this file.
00001 /**
00002  * @copyright
00003  * ====================================================================
00004  * Copyright (c) 2000-2007 CollabNet.  All rights reserved.
00005  *
00006  * This software is licensed as described in the file COPYING, which
00007  * you should have received as part of this distribution.  The terms
00008  * are also available at http://subversion.tigris.org/license-1.html.
00009  * If newer versions of this license are posted there, you may use a
00010  * newer version instead, at your option.
00011  *
00012  * This software consists of voluntary contributions made by many
00013  * individuals.  For exact contribution history, see the revision
00014  * history and logs, available at http://subversion.tigris.org/.
00015  * ====================================================================
00016  * @endcopyright
00017  *
00018  * @file svn_opt.h
00019  * @brief Option and argument parsing for Subversion command lines
00020  */
00021 
00022 #ifndef SVN_OPTS_H
00023 #define SVN_OPTS_H
00024 
00025 #include <apr.h>
00026 #include <apr_pools.h>
00027 #include <apr_getopt.h>
00028 
00029 #include "svn_types.h"
00030 #include "svn_error.h"
00031 
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif /* __cplusplus */
00035 
00036 
00037 
00038 /**
00039  * All subcommand procedures in Subversion conform to this prototype.
00040  *
00041  * @a os is the apr option state after getopt processing has been run; in
00042  * other words, it still contains the non-option arguments following
00043  * the subcommand.  See @a os->argv and @a os->ind.
00044  *
00045  * @a baton is anything you need it to be.
00046  *
00047  * @a pool is used for allocating errors, and for any other allocation
00048  * unless the instance is explicitly documented to allocate from a
00049  * pool in @a baton.
00050  */
00051 typedef svn_error_t *(svn_opt_subcommand_t)
00052        (apr_getopt_t *os, void *baton, apr_pool_t *pool);
00053 
00054 
00055 /** The maximum number of aliases a subcommand can have. */
00056 #define SVN_OPT_MAX_ALIASES 3
00057 
00058 /** The maximum number of options that can be accepted by a subcommand. */
00059 #define SVN_OPT_MAX_OPTIONS 50
00060 
00061 /** Options that have no short option char should use an identifying
00062  * integer equal to or greater than this.
00063  */
00064 #define SVN_OPT_FIRST_LONGOPT_ID 256
00065 
00066 
00067 /** One element of a subcommand dispatch table.
00068  *
00069  * @since New in 1.4.
00070  */
00071 typedef struct svn_opt_subcommand_desc2_t
00072 {
00073   /** The full name of this command. */
00074   const char *name;
00075 
00076   /** The function this command invokes. */
00077   svn_opt_subcommand_t *cmd_func;
00078 
00079   /** A list of alias names for this command (e.g., 'up' for 'update'). */
00080   const char *aliases[SVN_OPT_MAX_ALIASES];
00081 
00082   /** A brief string describing this command, for usage messages. */
00083   const char *help;
00084 
00085   /** A list of options accepted by this command.  Each value in the
00086    * array is a unique enum (the 2nd field in apr_getopt_option_t)
00087    */
00088   int valid_options[SVN_OPT_MAX_OPTIONS];
00089 
00090   /** A list of option help descriptions, keyed by the option unique enum
00091    * (the 2nd field in apr_getopt_option_t), which override the generic
00092    * descriptions given in an apr_getopt_option_t on a per-subcommand basis.
00093    */
00094   struct { int optch; const char *desc; } desc_overrides[SVN_OPT_MAX_OPTIONS];
00095 } svn_opt_subcommand_desc2_t;
00096 
00097 
00098 /** One element of a subcommand dispatch table.
00099  *
00100  * @deprecated Provided for backward compatibility with the 1.3 API.
00101  *
00102  * Like #svn_opt_subcommand_desc2_t but lacking the @c desc_overrides
00103  * member.
00104  */
00105 typedef struct svn_opt_subcommand_desc_t
00106 {
00107   /** The full name of this command. */
00108   const char *name;
00109 
00110   /** The function this command invokes. */
00111   svn_opt_subcommand_t *cmd_func;
00112 
00113   /** A list of alias names for this command (e.g., 'up' for 'update'). */
00114   const char *aliases[SVN_OPT_MAX_ALIASES];
00115 
00116   /** A brief string describing this command, for usage messages. */
00117   const char *help;
00118 
00119   /** A list of options accepted by this command.  Each value in the
00120    * array is a unique enum (the 2nd field in apr_getopt_option_t)
00121    */
00122   int valid_options[SVN_OPT_MAX_OPTIONS];
00123 
00124 } svn_opt_subcommand_desc_t;
00125 
00126 
00127 /**
00128  * Return the entry in @a table whose name matches @a cmd_name, or @c NULL if
00129  * none.  @a cmd_name may be an alias.
00130  *
00131  * @since New in 1.4.
00132  */
00133 const svn_opt_subcommand_desc2_t *
00134 svn_opt_get_canonical_subcommand2(const svn_opt_subcommand_desc2_t *table,
00135                                   const char *cmd_name);
00136 
00137 
00138 /**
00139  * Return the entry in @a table whose name matches @a cmd_name, or @c NULL if
00140  * none.  @a cmd_name may be an alias.
00141  *
00142  * Same as svn_opt_get_canonical_subcommand2(), but acts on
00143  * #svn_opt_subcommand_desc_t.
00144  *
00145  * @deprecated Provided for backward compatibility with the 1.3 API.
00146  */
00147 const svn_opt_subcommand_desc_t *
00148 svn_opt_get_canonical_subcommand(const svn_opt_subcommand_desc_t *table,
00149                                  const char *cmd_name);
00150 
00151 
00152 /**
00153  * Return pointer to an @c apr_getopt_option_t for the option whose
00154  * option code is @a code, or @c NULL if no match.  @a option_table must end
00155  * with an element whose every field is zero.  If @c command is non-NULL,
00156  * then return the subcommand-specific option description instead of the
00157  * generic one, if a specific description is defined.
00158  *
00159  * The returned value may be statically allocated, or allocated in @a pool.
00160  *
00161  * @since New in 1.4.
00162  */
00163 const apr_getopt_option_t *
00164 svn_opt_get_option_from_code2(int code,
00165                               const apr_getopt_option_t *option_table,
00166                               const svn_opt_subcommand_desc2_t *command,
00167                               apr_pool_t *pool);
00168 
00169 
00170 /**
00171  * Return the first entry from @a option_table whose option code is @a code,
00172  * or @c NULL if no match.  @a option_table must end with an element whose
00173  * every field is zero.
00174  *
00175  * @deprecated Provided for backward compatibility with the 1.3 API.
00176  */
00177 const apr_getopt_option_t *
00178 svn_opt_get_option_from_code(int code,
00179                              const apr_getopt_option_t *option_table);
00180 
00181 
00182 /**
00183  * Return @c TRUE iff subcommand @a command supports option @a
00184  * option_code, else return @c FALSE.  If @a global_options is
00185  * non-NULL, it is a zero-terminated array, and all subcommands take
00186  * the options listed in it.
00187  *
00188  * @since New in 1.5.
00189  */
00190 svn_boolean_t
00191 svn_opt_subcommand_takes_option3(const svn_opt_subcommand_desc2_t *command,
00192                                  int option_code,
00193                                  const int *global_options);
00194 
00195 /**
00196  * Same as svn_opt_subcommand_takes_option3(), but with @c NULL for @a
00197  * global_options.
00198  *
00199  * @deprecated Provided for backward compatibility with the 1.4 API.
00200  */
00201 svn_boolean_t
00202 svn_opt_subcommand_takes_option2(const svn_opt_subcommand_desc2_t *command,
00203                                  int option_code);
00204 
00205 
00206 /**
00207  * Return @c TRUE iff subcommand @a command supports option @a option_code,
00208  * else return @c FALSE.
00209  *
00210  * Same as svn_opt_subcommand_takes_option2(), but acts on
00211  * #svn_opt_subcommand_desc_t.
00212  *
00213  * @deprecated Provided for backward compatibility with the 1.3 API.
00214  */
00215 svn_boolean_t
00216 svn_opt_subcommand_takes_option(const svn_opt_subcommand_desc_t *command,
00217                                 int option_code);
00218 
00219 
00220 /**
00221  * Print a generic (not command-specific) usage message to @a stream.
00222  *
00223  * ### @todo Why is @a stream a stdio file instead of an svn stream?
00224  *
00225  * If @a header is non-NULL, print @a header followed by a newline.  Then
00226  * loop over @a cmd_table printing the usage for each command (getting
00227  * option usages from @a opt_table).  Then if @a footer is non-NULL, print
00228  * @a footer followed by a newline.
00229  *
00230  * Use @a pool for temporary allocation.
00231  *
00232  * @since New in 1.4.
00233  */
00234 void
00235 svn_opt_print_generic_help2(const char *header,
00236                             const svn_opt_subcommand_desc2_t *cmd_table,
00237                             const apr_getopt_option_t *opt_table,
00238                             const char *footer,
00239                             apr_pool_t *pool,
00240                             FILE *stream);
00241 
00242 
00243 /**
00244  * Same as svn_opt_print_generic_help2(), but acts on
00245  * #svn_opt_subcommand_desc_t.
00246  *
00247  * @deprecated Provided for backward compatibility with the 1.3 API.
00248  */
00249 void
00250 svn_opt_print_generic_help(const char *header,
00251                            const svn_opt_subcommand_desc_t *cmd_table,
00252                            const apr_getopt_option_t *opt_table,
00253                            const char *footer,
00254                            apr_pool_t *pool,
00255                            FILE *stream);
00256 
00257 
00258 /**
00259  * Print an option @a opt nicely into a @a string allocated in @a pool.
00260  * If @a doc is set, include the generic documentation string of @a opt,
00261  * localized to the current locale if a translation is available.
00262  */
00263 void
00264 svn_opt_format_option(const char **string,
00265                       const apr_getopt_option_t *opt,
00266                       svn_boolean_t doc,
00267                       apr_pool_t *pool);
00268 
00269 
00270 
00271 /**
00272  * Get @a subcommand's usage from @a table, and print it to @c stdout.
00273  * Obtain option usage from @a options_table.  If not @c NULL, @a
00274  * global_options is a zero-terminated list of global options.  Use @a
00275  * pool for temporary allocation.  @a subcommand may be a canonical
00276  * command name or an alias.  ### @todo Why does this only print to
00277  * @c stdout, whereas svn_opt_print_generic_help() gives us a choice?
00278  *
00279  * @since New in 1.5.
00280  */
00281 void
00282 svn_opt_subcommand_help3(const char *subcommand,
00283                          const svn_opt_subcommand_desc2_t *table,
00284                          const apr_getopt_option_t *options_table,
00285                          const int *global_options,
00286                          apr_pool_t *pool);
00287 
00288 /**
00289  * Same as svn_opt_subcommand_help3(), but with @a global_options
00290  * always NULL.
00291  *
00292  * @deprecated Provided for backward compatibility with the 1.4 API.
00293  */
00294 void
00295 svn_opt_subcommand_help2(const char *subcommand,
00296                          const svn_opt_subcommand_desc2_t *table,
00297                          const apr_getopt_option_t *options_table,
00298                          apr_pool_t *pool);
00299 
00300 
00301 /**
00302  * Same as svn_opt_subcommand_help2(), but acts on
00303  * #svn_opt_subcommand_desc_t.
00304  *
00305  * @deprecated Provided for backward compatibility with the 1.3 API.
00306  */
00307 void
00308 svn_opt_subcommand_help(const char *subcommand,
00309                         const svn_opt_subcommand_desc_t *table,
00310                         const apr_getopt_option_t *options_table,
00311                         apr_pool_t *pool);
00312 
00313 
00314 
00315 /* Parsing revision and date options. */
00316 
00317 /**
00318  * Various ways of specifying revisions.
00319  *
00320  * @note
00321  * In contexts where local mods are relevant, the `working' kind
00322  * refers to the uncommitted "working" revision, which may be modified
00323  * with respect to its base revision.  In other contexts, `working'
00324  * should behave the same as `committed' or `current'.
00325  */
00326 enum svn_opt_revision_kind {
00327   /** No revision information given. */
00328   svn_opt_revision_unspecified,
00329 
00330   /** revision given as number */
00331   svn_opt_revision_number,
00332 
00333   /** revision given as date */
00334   svn_opt_revision_date,
00335 
00336   /** rev of most recent change */
00337   svn_opt_revision_committed,
00338 
00339   /** (rev of most recent change) - 1 */
00340   svn_opt_revision_previous,
00341 
00342   /** .svn/entries current revision */
00343   svn_opt_revision_base,
00344 
00345   /** current, plus local mods */
00346   svn_opt_revision_working,
00347 
00348   /** repository youngest */
00349   svn_opt_revision_head
00350 };
00351 
00352 /**
00353  * A revision value, which can be specified as a number or a date.
00354  *
00355  * @note This union was formerly an anonymous inline type in
00356  * @c svn_opt_revision_t, and was converted to a named type just to
00357  * make things easier for SWIG.
00358  *
00359  * @since New in 1.3.
00360  */
00361 typedef union svn_opt_revision_value_t
00362 {
00363   /** The revision number */
00364   svn_revnum_t number;
00365 
00366   /** the date of the revision */
00367   apr_time_t date;
00368 } svn_opt_revision_value_t;
00369 
00370 /** A revision, specified in one of @c svn_opt_revision_kind ways. */
00371 typedef struct svn_opt_revision_t
00372 {
00373   enum svn_opt_revision_kind kind;  /**< See svn_opt_revision_kind */
00374   svn_opt_revision_value_t value;   /**< Extra data qualifying the @c kind */
00375 } svn_opt_revision_t;
00376 
00377 /** A revision range, specified in one of @c svn_opt_revision_kind ways. */
00378 typedef struct svn_opt_revision_range_t
00379 {
00380   /** The first revision in the range */
00381   svn_opt_revision_t start;
00382 
00383   /** The last revision in the range */
00384   svn_opt_revision_t end;
00385 } svn_opt_revision_range_t;
00386 
00387 /**
00388  * Set @a *start_revision and/or @a *end_revision according to @a arg,
00389  * where @a arg is "N" or "N:M", like so:
00390  *
00391  *    - If @a arg is "N", set @a *start_revision to represent N, and
00392  *      leave @a *end_revision untouched.
00393  *
00394  *    - If @a arg is "N:M", set @a *start_revision and @a *end_revision
00395  *      to represent N and M respectively.
00396  *
00397  * N and/or M may be one of the special revision descriptors
00398  * recognized by revision_from_word(), or a date in curly braces.
00399  *
00400  * If @a arg is invalid, return -1; else return 0.
00401  * It is invalid to omit a revision (as in, ":", "N:" or ":M").
00402  *
00403  * @note It is typical, though not required, for @a *start_revision and
00404  * @a *end_revision to be @c svn_opt_revision_unspecified kind on entry.
00405  *
00406  * Use @a pool for temporary allocations.
00407  */
00408 int svn_opt_parse_revision(svn_opt_revision_t *start_revision,
00409                            svn_opt_revision_t *end_revision,
00410                            const char *arg,
00411                            apr_pool_t *pool);
00412 
00413 /**
00414  * Parse @a arg, where @a arg is "N" or "N:M", into a
00415  * @c svn_opt_revision_range_t and push that onto @a opt_ranges.
00416  *
00417  *    - If @a arg is "N", set the @c start field of the
00418  *      @c svn_opt_revision_range_t to represent N and the @c end field
00419  *      to @c svn_opt_revision_unspecified.
00420  *
00421  *    - If @a arg is "N:M", set the @c start field of the
00422  *      @c svn_opt_revision_range_t to represent N and the @c end field
00423  *      to represent M.
00424  *
00425  * If @a arg is invalid, return -1; else return 0.  It is invalid to omit
00426  * a revision (as in, ":", "N:" or ":M").
00427  *
00428  * Use @a pool to allocate @c svn_opt_revision_range_t pushed to the array.
00429  *
00430  * @since New in 1.5.
00431  */
00432 int
00433 svn_opt_parse_revision_to_range(apr_array_header_t *opt_ranges,
00434                                 const char *arg,
00435                                 apr_pool_t *pool);
00436 
00437 /**
00438  * Resolve peg revisions and operational revisions in the following way:
00439  *
00440  *    - If @a is_url is set and @a peg_rev->kind is
00441  *      @c svn_opt_revision_unspecified, @a peg_rev->kind defaults to
00442  *      @c svn_opt_revision_head.
00443  *
00444  *    - If @a is_url is not set, and @a peg_rev->kind is
00445  *      @c svn_opt_revision_unspecified, @a peg_rev->kind defaults to
00446  *      @c svn_opt_revision_base.
00447  *
00448  *    - If @a op_rev->kind is @c svn_opt_revision_unspecified, @a op_rev
00449  *      defaults to @a peg_rev.
00450  *
00451  * Both @a peg_rev and @a op_rev may be modified as a result of this
00452  * function.  @a is_url should be set if the path the revisions refer to is
00453  * a url, and unset otherwise.
00454  *
00455  * If @a notice_local_mods is set, @c svn_opt_revision_working is used,
00456  * instead of @c svn_opt_revision_base.
00457  *
00458  * Use @a pool for allocations.
00459  *
00460  * @since New in 1.5.
00461  */
00462 svn_error_t *
00463 svn_opt_resolve_revisions(svn_opt_revision_t *peg_rev,
00464                           svn_opt_revision_t *op_rev,
00465                           svn_boolean_t is_url,
00466                           svn_boolean_t notice_local_mods,
00467                           apr_pool_t *pool);
00468 
00469 
00470 /* Parsing arguments. */
00471 
00472 /**
00473  * Pull remaining target arguments from @a os into @a *targets_p,
00474  * converting them to UTF-8, followed by targets from @a known_targets
00475  * (which might come from, for example, the "--targets" command line
00476  * option), which are already in UTF-8.
00477  *
00478  * On each URL target, do some IRI-to-URI encoding and some
00479  * auto-escaping.  On each local path, canonicalize case and path
00480  * separators.
00481  *
00482  * Allocate @a *targets_p and its elements in @a pool.
00483  *
00484  * If a path has the same name as a Subversion working copy
00485  * administrative directory, return SVN_ERR_RESERVED_FILENAME_SPECIFIED;
00486  * if multiple reserved paths are encountered, return a chain of
00487  * errors, all of which are SVN_ERR_RESERVED_FILENAME_SPECIFIED.  Do
00488  * not return this type of error in a chain with any other type of
00489  * error, and if this is the only type of error encountered, complete
00490  * the operation before returning the error(s).
00491  *
00492  * @since New in 1.5.
00493  */
00494 svn_error_t *
00495 svn_opt_args_to_target_array3(apr_array_header_t **targets_p,
00496                               apr_getopt_t *os,
00497                               apr_array_header_t *known_targets,
00498                               apr_pool_t *pool);
00499 
00500 /**
00501  * This is the same as svn_opt_args_to_target_array3() except that it
00502  * silently ignores paths that have the same name as a working copy
00503  * administrative directory.
00504  *
00505  * @since New in 1.2.
00506  *
00507  * @deprecated Provided for backward compatibility with the 1.4 API.
00508  */
00509 svn_error_t *
00510 svn_opt_args_to_target_array2(apr_array_header_t **targets_p,
00511                               apr_getopt_t *os,
00512                               apr_array_header_t *known_targets,
00513                               apr_pool_t *pool);
00514 
00515 
00516 /**
00517  * The same as svn_opt_args_to_target_array2() except that, in
00518  * addition, if @a extract_revisions is set, then look for trailing
00519  * "@rev" syntax on the first two paths.  If the first target in @a
00520  * *targets_p ends in "@rev", replace it with a canonicalized version of
00521  * the part before "@rev" and replace @a *start_revision with the value
00522  * of "rev".  If the second target in @a *targets_p ends in "@rev",
00523  * replace it with a canonicalized version of the part before "@rev"
00524  * and replace @a *end_revision with the value of "rev".  Ignore
00525  * revision specifiers on any further paths.  "rev" can be any form of
00526  * single revision specifier, as accepted by svn_opt_parse_revision().
00527  *
00528  * @deprecated Provided for backward compatibility with the 1.1 API.
00529  */
00530 svn_error_t *
00531 svn_opt_args_to_target_array(apr_array_header_t **targets_p,
00532                              apr_getopt_t *os,
00533                              apr_array_header_t *known_targets,
00534                              svn_opt_revision_t *start_revision,
00535                              svn_opt_revision_t *end_revision,
00536                              svn_boolean_t extract_revisions,
00537                              apr_pool_t *pool);
00538 
00539 
00540 /**
00541  * If no targets exist in @a *targets, add `.' as the lone target.
00542  *
00543  * (Some commands take an implicit "." string argument when invoked
00544  * with no arguments. Those commands make use of this function to
00545  * add "." to the target array if the user passes no args.)
00546  */
00547 void svn_opt_push_implicit_dot_target(apr_array_header_t *targets,
00548                                       apr_pool_t *pool);
00549 
00550 
00551 /**
00552  * Parse @a num_args non-target arguments from the list of arguments in
00553  * @a os->argv, return them as <tt>const char *</tt> in @a *args_p, without
00554  * doing any UTF-8 conversion.  Allocate @a *args_p and its values in @a pool.
00555  */
00556 svn_error_t *
00557 svn_opt_parse_num_args(apr_array_header_t **args_p,
00558                        apr_getopt_t *os,
00559                        int num_args,
00560                        apr_pool_t *pool);
00561 
00562 
00563 /**
00564  * Parse all remaining arguments from @a os->argv, return them as
00565  * <tt>const char *</tt> in @a *args_p, without doing any UTF-8 conversion.
00566  * Allocate @a *args_p and its values in @a pool.
00567  */
00568 svn_error_t *
00569 svn_opt_parse_all_args(apr_array_header_t **args_p,
00570                        apr_getopt_t *os,
00571                        apr_pool_t *pool);
00572 
00573 /**
00574  * Parse a working-copy or URL in @a path, extracting any trailing
00575  * revision specifier of the form "@rev" from the last component of
00576  * the path.
00577  *
00578  * Some examples would be:
00579  *
00580  *    "foo/bar"                      -> "foo/bar",       (unspecified)
00581  *    "foo/bar@13"                   -> "foo/bar",       (number, 13)
00582  *    "foo/bar@HEAD"                 -> "foo/bar",       (head)
00583  *    "foo/bar@{1999-12-31}"         -> "foo/bar",       (date, 1999-12-31)
00584  *    "http://a/b@27"                -> "http://a/b",    (number, 27)
00585  *    "http://a/b@COMMITTED"         -> "http://a/b",    (committed) [*]
00586  *    "http://a/b@{1999-12-31}       -> "http://a/b",    (date, 1999-12-31)
00587  *    "http://a/b@%7B1999-12-31%7D   -> "http://a/b",    (date, 1999-12-31)
00588  *    "foo/bar@1:2"                  -> error
00589  *    "foo/bar@baz"                  -> error
00590  *    "foo/bar@"                     -> "foo/bar",       (base)
00591  *    "foo/bar/@13"                  -> "foo/bar/",      (number, 13)
00592  *    "foo/bar@@13"                  -> "foo/bar@",      (number, 13)
00593  *    "foo/@bar@HEAD"                -> "foo/@bar",      (head)
00594  *    "foo@/bar"                     -> "foo@/bar",      (unspecified)
00595  *    "foo@HEAD/bar"                 -> "foo@HEAD/bar",  (unspecified)
00596  *
00597  *   [*] Syntactically valid but probably not semantically useful.
00598  *
00599  * If a trailing revision specifier is found, parse it into @a *rev and
00600  * put the rest of the path into @a *truepath, allocating from @a pool;
00601  * or return an @c SVN_ERR_CL_ARG_PARSING_ERROR if the revision
00602  * specifier is invalid.  If no trailing revision specifier is found,
00603  * set @a *truepath to @a path and @a rev->kind to @c
00604  * svn_opt_revision_unspecified.
00605  *
00606  * This function does not require that @a path be in canonical form.
00607  * No canonicalization is done and @a *truepath will only be in
00608  * canonical form if @a path is in canonical form.
00609  *
00610  * @since New in 1.1.
00611  */
00612 svn_error_t *
00613 svn_opt_parse_path(svn_opt_revision_t *rev,
00614                    const char **truepath,
00615                    const char *path,
00616                    apr_pool_t *pool);
00617 
00618 /**
00619  * Central dispatcher function for various kinds of help message.
00620  * Prints one of:
00621  *   * subcommand-specific help (svn_opt_subcommand_help)
00622  *   * generic help (svn_opt_print_generic_help)
00623  *   * version info
00624  *   * simple usage complaint: "Type '@a pgm_name help' for usage."
00625  *
00626  * If @a os is not @c NULL and it contains arguments, then try
00627  * printing help for them as though they are subcommands, using @a
00628  * cmd_table and @a option_table for option information.  If not @c
00629  * NULL, @a global_options is a zero-terminated array of options taken
00630  * by all subcommands.
00631  *
00632  * Else, if @a print_version is TRUE, then print version info, in
00633  * brief form if @a quiet is also TRUE; if @a quiet is FALSE, then if
00634  * @a version_footer is non-NULL, print it following the version
00635  * information.
00636  *
00637  * Else, if @a os is not @c NULL and does not contain arguments, print
00638  * generic help, via svn_opt_print_generic_help2() with the @a header,
00639  * @a cmd_table, @a option_table, and @a footer arguments.
00640  *
00641  * Else, when @a os is @c NULL, print the simple usage complaint.
00642  *
00643  * Use @a pool for temporary allocations.
00644  *
00645  * Notes: The reason this function handles both version printing and
00646  * general usage help is that a confused user might put both the
00647  * --version flag *and* subcommand arguments on a help command line.
00648  * The logic for handling such a situation should be in one place.
00649  *
00650  * @since New in 1.5.
00651  */
00652 svn_error_t *
00653 svn_opt_print_help3(apr_getopt_t *os,
00654                     const char *pgm_name,
00655                     svn_boolean_t print_version,
00656                     svn_boolean_t quiet,
00657                     const char *version_footer,
00658                     const char *header,
00659                     const svn_opt_subcommand_desc2_t *cmd_table,
00660                     const apr_getopt_option_t *option_table,
00661                     const int *global_options,
00662                     const char *footer,
00663                     apr_pool_t *pool);
00664 
00665 /**
00666  * Same as svn_opt_print_help3(), but with @a global_options always @c
00667  * NULL.
00668  *
00669  * @deprecated Provided for backward compatibility with the 1.4 API.
00670  */
00671 
00672 svn_error_t *
00673 svn_opt_print_help2(apr_getopt_t *os,
00674                     const char *pgm_name,
00675                     svn_boolean_t print_version,
00676                     svn_boolean_t quiet,
00677                     const char *version_footer,
00678                     const char *header,
00679                     const svn_opt_subcommand_desc2_t *cmd_table,
00680                     const apr_getopt_option_t *option_table,
00681                     const char *footer,
00682                     apr_pool_t *pool);
00683 
00684 
00685 /**
00686  * Same as svn_opt_print_help2(), but acts on #svn_opt_subcommand_desc_t.
00687  *
00688  * @deprecated Provided for backward compatibility with the 1.3 API.
00689  */
00690 svn_error_t *
00691 svn_opt_print_help(apr_getopt_t *os,
00692                    const char *pgm_name,
00693                    svn_boolean_t print_version,
00694                    svn_boolean_t quiet,
00695                    const char *version_footer,
00696                    const char *header,
00697                    const svn_opt_subcommand_desc_t *cmd_table,
00698                    const apr_getopt_option_t *option_table,
00699                    const char *footer,
00700                    apr_pool_t *pool);
00701 
00702 #ifdef __cplusplus
00703 }
00704 #endif /* __cplusplus */
00705 
00706 #endif /* SVN_OPTS_H */

Generated on Sun Dec 14 02:22:43 2008 for Subversion by  doxygen 1.4.7