- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# svn_opt.h

Go to the documentation of this file.

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

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines