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 SVN_DEPRECATED 00148 const svn_opt_subcommand_desc_t * 00149 svn_opt_get_canonical_subcommand(const svn_opt_subcommand_desc_t *table, 00150 const char *cmd_name); 00151 00152 00153 /** 00154 * Return pointer to an @c apr_getopt_option_t for the option whose 00155 * option code is @a code, or @c NULL if no match. @a option_table must end 00156 * with an element whose every field is zero. If @c command is non-NULL, 00157 * then return the subcommand-specific option description instead of the 00158 * generic one, if a specific description is defined. 00159 * 00160 * The returned value may be statically allocated, or allocated in @a pool. 00161 * 00162 * @since New in 1.4. 00163 */ 00164 const apr_getopt_option_t * 00165 svn_opt_get_option_from_code2(int code, 00166 const apr_getopt_option_t *option_table, 00167 const svn_opt_subcommand_desc2_t *command, 00168 apr_pool_t *pool); 00169 00170 00171 /** 00172 * Return the first entry from @a option_table whose option code is @a code, 00173 * or @c NULL if no match. @a option_table must end with an element whose 00174 * every field is zero. 00175 * 00176 * @deprecated Provided for backward compatibility with the 1.3 API. 00177 */ 00178 SVN_DEPRECATED 00179 const apr_getopt_option_t * 00180 svn_opt_get_option_from_code(int code, 00181 const apr_getopt_option_t *option_table); 00182 00183 00184 /** 00185 * Return @c TRUE iff subcommand @a command supports option @a 00186 * option_code, else return @c FALSE. If @a global_options is 00187 * non-NULL, it is a zero-terminated array, and all subcommands take 00188 * the options listed in it. 00189 * 00190 * @since New in 1.5. 00191 */ 00192 svn_boolean_t 00193 svn_opt_subcommand_takes_option3(const svn_opt_subcommand_desc2_t *command, 00194 int option_code, 00195 const int *global_options); 00196 00197 /** 00198 * Same as svn_opt_subcommand_takes_option3(), but with @c NULL for @a 00199 * global_options. 00200 * 00201 * @deprecated Provided for backward compatibility with the 1.4 API. 00202 */ 00203 SVN_DEPRECATED 00204 svn_boolean_t 00205 svn_opt_subcommand_takes_option2(const svn_opt_subcommand_desc2_t *command, 00206 int option_code); 00207 00208 00209 /** 00210 * Return @c TRUE iff subcommand @a command supports option @a option_code, 00211 * else return @c FALSE. 00212 * 00213 * Same as svn_opt_subcommand_takes_option2(), but acts on 00214 * #svn_opt_subcommand_desc_t. 00215 * 00216 * @deprecated Provided for backward compatibility with the 1.3 API. 00217 */ 00218 SVN_DEPRECATED 00219 svn_boolean_t 00220 svn_opt_subcommand_takes_option(const svn_opt_subcommand_desc_t *command, 00221 int option_code); 00222 00223 00224 /** 00225 * Print a generic (not command-specific) usage message to @a stream. 00226 * 00227 * ### @todo Why is @a stream a stdio file instead of an svn stream? 00228 * 00229 * If @a header is non-NULL, print @a header followed by a newline. Then 00230 * loop over @a cmd_table printing the usage for each command (getting 00231 * option usages from @a opt_table). Then if @a footer is non-NULL, print 00232 * @a footer followed by a newline. 00233 * 00234 * Use @a pool for temporary allocation. 00235 * 00236 * @since New in 1.4. 00237 */ 00238 void 00239 svn_opt_print_generic_help2(const char *header, 00240 const svn_opt_subcommand_desc2_t *cmd_table, 00241 const apr_getopt_option_t *opt_table, 00242 const char *footer, 00243 apr_pool_t *pool, 00244 FILE *stream); 00245 00246 00247 /** 00248 * Same as svn_opt_print_generic_help2(), but acts on 00249 * #svn_opt_subcommand_desc_t. 00250 * 00251 * @deprecated Provided for backward compatibility with the 1.3 API. 00252 */ 00253 SVN_DEPRECATED 00254 void 00255 svn_opt_print_generic_help(const char *header, 00256 const svn_opt_subcommand_desc_t *cmd_table, 00257 const apr_getopt_option_t *opt_table, 00258 const char *footer, 00259 apr_pool_t *pool, 00260 FILE *stream); 00261 00262 00263 /** 00264 * Print an option @a opt nicely into a @a string allocated in @a pool. 00265 * If @a doc is set, include the generic documentation string of @a opt, 00266 * localized to the current locale if a translation is available. 00267 */ 00268 void 00269 svn_opt_format_option(const char **string, 00270 const apr_getopt_option_t *opt, 00271 svn_boolean_t doc, 00272 apr_pool_t *pool); 00273 00274 00275 00276 /** 00277 * Get @a subcommand's usage from @a table, and print it to @c stdout. 00278 * Obtain option usage from @a options_table. If not @c NULL, @a 00279 * global_options is a zero-terminated list of global options. Use @a 00280 * pool for temporary allocation. @a subcommand may be a canonical 00281 * command name or an alias. ### @todo Why does this only print to 00282 * @c stdout, whereas svn_opt_print_generic_help() gives us a choice? 00283 * 00284 * @since New in 1.5. 00285 */ 00286 void 00287 svn_opt_subcommand_help3(const char *subcommand, 00288 const svn_opt_subcommand_desc2_t *table, 00289 const apr_getopt_option_t *options_table, 00290 const int *global_options, 00291 apr_pool_t *pool); 00292 00293 /** 00294 * Same as svn_opt_subcommand_help3(), but with @a global_options 00295 * always NULL. 00296 * 00297 * @deprecated Provided for backward compatibility with the 1.4 API. 00298 */ 00299 SVN_DEPRECATED 00300 void 00301 svn_opt_subcommand_help2(const char *subcommand, 00302 const svn_opt_subcommand_desc2_t *table, 00303 const apr_getopt_option_t *options_table, 00304 apr_pool_t *pool); 00305 00306 00307 /** 00308 * Same as svn_opt_subcommand_help2(), but acts on 00309 * #svn_opt_subcommand_desc_t. 00310 * 00311 * @deprecated Provided for backward compatibility with the 1.3 API. 00312 */ 00313 SVN_DEPRECATED 00314 void 00315 svn_opt_subcommand_help(const char *subcommand, 00316 const svn_opt_subcommand_desc_t *table, 00317 const apr_getopt_option_t *options_table, 00318 apr_pool_t *pool); 00319 00320 00321 00322 /* Parsing revision and date options. */ 00323 00324 /** 00325 * Various ways of specifying revisions. 00326 * 00327 * @note 00328 * In contexts where local mods are relevant, the `working' kind 00329 * refers to the uncommitted "working" revision, which may be modified 00330 * with respect to its base revision. In other contexts, `working' 00331 * should behave the same as `committed' or `current'. 00332 */ 00333 enum svn_opt_revision_kind { 00334 /** No revision information given. */ 00335 svn_opt_revision_unspecified, 00336 00337 /** revision given as number */ 00338 svn_opt_revision_number, 00339 00340 /** revision given as date */ 00341 svn_opt_revision_date, 00342 00343 /** rev of most recent change */ 00344 svn_opt_revision_committed, 00345 00346 /** (rev of most recent change) - 1 */ 00347 svn_opt_revision_previous, 00348 00349 /** .svn/entries current revision */ 00350 svn_opt_revision_base, 00351 00352 /** current, plus local mods */ 00353 svn_opt_revision_working, 00354 00355 /** repository youngest */ 00356 svn_opt_revision_head 00357 }; 00358 00359 /** 00360 * A revision value, which can be specified as a number or a date. 00361 * 00362 * @note This union was formerly an anonymous inline type in 00363 * @c svn_opt_revision_t, and was converted to a named type just to 00364 * make things easier for SWIG. 00365 * 00366 * @since New in 1.3. 00367 */ 00368 typedef union svn_opt_revision_value_t 00369 { 00370 /** The revision number */ 00371 svn_revnum_t number; 00372 00373 /** the date of the revision */ 00374 apr_time_t date; 00375 } svn_opt_revision_value_t; 00376 00377 /** A revision, specified in one of @c svn_opt_revision_kind ways. */ 00378 typedef struct svn_opt_revision_t 00379 { 00380 enum svn_opt_revision_kind kind; /**< See svn_opt_revision_kind */ 00381 svn_opt_revision_value_t value; /**< Extra data qualifying the @c kind */ 00382 } svn_opt_revision_t; 00383 00384 /** A revision range, specified in one of @c svn_opt_revision_kind ways. */ 00385 typedef struct svn_opt_revision_range_t 00386 { 00387 /** The first revision in the range */ 00388 svn_opt_revision_t start; 00389 00390 /** The last revision in the range */ 00391 svn_opt_revision_t end; 00392 } svn_opt_revision_range_t; 00393 00394 /** 00395 * Set @a *start_revision and/or @a *end_revision according to @a arg, 00396 * where @a arg is "N" or "N:M", like so: 00397 * 00398 * - If @a arg is "N", set @a *start_revision to represent N, and 00399 * leave @a *end_revision untouched. 00400 * 00401 * - If @a arg is "N:M", set @a *start_revision and @a *end_revision 00402 * to represent N and M respectively. 00403 * 00404 * N and/or M may be one of the special revision descriptors 00405 * recognized by revision_from_word(), or a date in curly braces. 00406 * 00407 * If @a arg is invalid, return -1; else return 0. 00408 * It is invalid to omit a revision (as in, ":", "N:" or ":M"). 00409 * 00410 * @note It is typical, though not required, for @a *start_revision and 00411 * @a *end_revision to be @c svn_opt_revision_unspecified kind on entry. 00412 * 00413 * Use @a pool for temporary allocations. 00414 */ 00415 int svn_opt_parse_revision(svn_opt_revision_t *start_revision, 00416 svn_opt_revision_t *end_revision, 00417 const char *arg, 00418 apr_pool_t *pool); 00419 00420 /** 00421 * Parse @a arg, where @a arg is "N" or "N:M", into a 00422 * @c svn_opt_revision_range_t and push that onto @a opt_ranges. 00423 * 00424 * - If @a arg is "N", set the @c start field of the 00425 * @c svn_opt_revision_range_t to represent N and the @c end field 00426 * to @c svn_opt_revision_unspecified. 00427 * 00428 * - If @a arg is "N:M", set the @c start field of the 00429 * @c svn_opt_revision_range_t to represent N and the @c end field 00430 * to represent M. 00431 * 00432 * If @a arg is invalid, return -1; else return 0. It is invalid to omit 00433 * a revision (as in, ":", "N:" or ":M"). 00434 * 00435 * Use @a pool to allocate @c svn_opt_revision_range_t pushed to the array. 00436 * 00437 * @since New in 1.5. 00438 */ 00439 int 00440 svn_opt_parse_revision_to_range(apr_array_header_t *opt_ranges, 00441 const char *arg, 00442 apr_pool_t *pool); 00443 00444 /** 00445 * Resolve peg revisions and operational revisions in the following way: 00446 * 00447 * - If @a is_url is set and @a peg_rev->kind is 00448 * @c svn_opt_revision_unspecified, @a peg_rev->kind defaults to 00449 * @c svn_opt_revision_head. 00450 * 00451 * - If @a is_url is not set, and @a peg_rev->kind is 00452 * @c svn_opt_revision_unspecified, @a peg_rev->kind defaults to 00453 * @c svn_opt_revision_base. 00454 * 00455 * - If @a op_rev->kind is @c svn_opt_revision_unspecified, @a op_rev 00456 * defaults to @a peg_rev. 00457 * 00458 * Both @a peg_rev and @a op_rev may be modified as a result of this 00459 * function. @a is_url should be set if the path the revisions refer to is 00460 * a url, and unset otherwise. 00461 * 00462 * If @a notice_local_mods is set, @c svn_opt_revision_working is used, 00463 * instead of @c svn_opt_revision_base. 00464 * 00465 * Use @a pool for allocations. 00466 * 00467 * @since New in 1.5. 00468 */ 00469 svn_error_t * 00470 svn_opt_resolve_revisions(svn_opt_revision_t *peg_rev, 00471 svn_opt_revision_t *op_rev, 00472 svn_boolean_t is_url, 00473 svn_boolean_t notice_local_mods, 00474 apr_pool_t *pool); 00475 00476 00477 /* Parsing arguments. */ 00478 00479 /** 00480 * Pull remaining target arguments from @a os into @a *targets_p, 00481 * converting them to UTF-8, followed by targets from @a known_targets 00482 * (which might come from, for example, the "--targets" command line 00483 * option), which are already in UTF-8. 00484 * 00485 * On each URL target, do some IRI-to-URI encoding and some 00486 * auto-escaping. On each local path, canonicalize case and path 00487 * separators. 00488 * 00489 * Allocate @a *targets_p and its elements in @a pool. 00490 * 00491 * If a path has the same name as a Subversion working copy 00492 * administrative directory, return SVN_ERR_RESERVED_FILENAME_SPECIFIED; 00493 * if multiple reserved paths are encountered, return a chain of 00494 * errors, all of which are SVN_ERR_RESERVED_FILENAME_SPECIFIED. Do 00495 * not return this type of error in a chain with any other type of 00496 * error, and if this is the only type of error encountered, complete 00497 * the operation before returning the error(s). 00498 * 00499 * @deprecated Provided for backward compatibility with the 1.5 API. 00500 * @see svn_client_args_to_target_array() 00501 */ 00502 SVN_DEPRECATED 00503 svn_error_t * 00504 svn_opt_args_to_target_array3(apr_array_header_t **targets_p, 00505 apr_getopt_t *os, 00506 apr_array_header_t *known_targets, 00507 apr_pool_t *pool); 00508 00509 /** 00510 * This is the same as svn_opt_args_to_target_array3() except that it 00511 * silently ignores paths that have the same name as a working copy 00512 * administrative directory. 00513 * 00514 * @since New in 1.2. 00515 * 00516 * @deprecated Provided for backward compatibility with the 1.4 API. 00517 */ 00518 SVN_DEPRECATED 00519 svn_error_t * 00520 svn_opt_args_to_target_array2(apr_array_header_t **targets_p, 00521 apr_getopt_t *os, 00522 apr_array_header_t *known_targets, 00523 apr_pool_t *pool); 00524 00525 00526 /** 00527 * The same as svn_opt_args_to_target_array2() except that, in 00528 * addition, if @a extract_revisions is set, then look for trailing 00529 * "@rev" syntax on the first two paths. If the first target in @a 00530 * *targets_p ends in "@rev", replace it with a canonicalized version of 00531 * the part before "@rev" and replace @a *start_revision with the value 00532 * of "rev". If the second target in @a *targets_p ends in "@rev", 00533 * replace it with a canonicalized version of the part before "@rev" 00534 * and replace @a *end_revision with the value of "rev". Ignore 00535 * revision specifiers on any further paths. "rev" can be any form of 00536 * single revision specifier, as accepted by svn_opt_parse_revision(). 00537 * 00538 * @deprecated Provided for backward compatibility with the 1.1 API. 00539 */ 00540 SVN_DEPRECATED 00541 svn_error_t * 00542 svn_opt_args_to_target_array(apr_array_header_t **targets_p, 00543 apr_getopt_t *os, 00544 apr_array_header_t *known_targets, 00545 svn_opt_revision_t *start_revision, 00546 svn_opt_revision_t *end_revision, 00547 svn_boolean_t extract_revisions, 00548 apr_pool_t *pool); 00549 00550 00551 /** 00552 * Parse revprop key/value pair from @a revprop_spec (name[=value]) into 00553 * @a revprops, making copies of both with @a pool. If @a revprops is 00554 * @c NULL, allocate a new apr_hash_t in it. @a revprops maps 00555 * const char * revprop names to svn_string_t * revprop values for use 00556 * with svn_repos_get_commit_editor5 and other get_commit_editor APIs. 00557 * 00558 * @since New in 1.6. 00559 */ 00560 svn_error_t * 00561 svn_opt_parse_revprop(apr_hash_t **revprops, const char *revprop_spec, 00562 apr_pool_t *pool); 00563 00564 00565 /** 00566 * If no targets exist in @a *targets, add `.' as the lone target. 00567 * 00568 * (Some commands take an implicit "." string argument when invoked 00569 * with no arguments. Those commands make use of this function to 00570 * add "." to the target array if the user passes no args.) 00571 */ 00572 void svn_opt_push_implicit_dot_target(apr_array_header_t *targets, 00573 apr_pool_t *pool); 00574 00575 00576 /** 00577 * Parse @a num_args non-target arguments from the list of arguments in 00578 * @a os->argv, return them as <tt>const char *</tt> in @a *args_p, without 00579 * doing any UTF-8 conversion. Allocate @a *args_p and its values in @a pool. 00580 */ 00581 svn_error_t * 00582 svn_opt_parse_num_args(apr_array_header_t **args_p, 00583 apr_getopt_t *os, 00584 int num_args, 00585 apr_pool_t *pool); 00586 00587 00588 /** 00589 * Parse all remaining arguments from @a os->argv, return them as 00590 * <tt>const char *</tt> in @a *args_p, without doing any UTF-8 conversion. 00591 * Allocate @a *args_p and its values in @a pool. 00592 */ 00593 svn_error_t * 00594 svn_opt_parse_all_args(apr_array_header_t **args_p, 00595 apr_getopt_t *os, 00596 apr_pool_t *pool); 00597 00598 /** 00599 * Parse a working-copy or URL in @a path, extracting any trailing 00600 * revision specifier of the form "@rev" from the last component of 00601 * the path. 00602 * 00603 * Some examples would be: 00604 * 00605 * "foo/bar" -> "foo/bar", (unspecified) 00606 * "foo/bar@13" -> "foo/bar", (number, 13) 00607 * "foo/bar@HEAD" -> "foo/bar", (head) 00608 * "foo/bar@{1999-12-31}" -> "foo/bar", (date, 1999-12-31) 00609 * "http://a/b@27" -> "http://a/b", (number, 27) 00610 * "http://a/b@COMMITTED" -> "http://a/b", (committed) [*] 00611 * "http://a/b@{1999-12-31} -> "http://a/b", (date, 1999-12-31) 00612 * "http://a/b@%7B1999-12-31%7D -> "http://a/b", (date, 1999-12-31) 00613 * "foo/bar@1:2" -> error 00614 * "foo/bar@baz" -> error 00615 * "foo/bar@" -> "foo/bar", (base) 00616 * "foo/bar/@13" -> "foo/bar/", (number, 13) 00617 * "foo/bar@@13" -> "foo/bar@", (number, 13) 00618 * "foo/@bar@HEAD" -> "foo/@bar", (head) 00619 * "foo@/bar" -> "foo@/bar", (unspecified) 00620 * "foo@HEAD/bar" -> "foo@HEAD/bar", (unspecified) 00621 * 00622 * [*] Syntactically valid but probably not semantically useful. 00623 * 00624 * If a trailing revision specifier is found, parse it into @a *rev and 00625 * put the rest of the path into @a *truepath, allocating from @a pool; 00626 * or return an @c SVN_ERR_CL_ARG_PARSING_ERROR (with the effect on 00627 * @a *truepath undefined) if the revision specifier is invalid. 00628 * If no trailing revision specifier is found, set @a *truepath to 00629 * @a path and @a rev->kind to @c svn_opt_revision_unspecified. 00630 * 00631 * This function does not require that @a path be in canonical form. 00632 * No canonicalization is done and @a *truepath will only be in 00633 * canonical form if @a path is in canonical form. 00634 * 00635 * @since New in 1.1. 00636 */ 00637 svn_error_t * 00638 svn_opt_parse_path(svn_opt_revision_t *rev, 00639 const char **truepath, 00640 const char *path, 00641 apr_pool_t *pool); 00642 00643 /** 00644 * Central dispatcher function for various kinds of help message. 00645 * Prints one of: 00646 * * subcommand-specific help (svn_opt_subcommand_help) 00647 * * generic help (svn_opt_print_generic_help) 00648 * * version info 00649 * * simple usage complaint: "Type '@a pgm_name help' for usage." 00650 * 00651 * If @a os is not @c NULL and it contains arguments, then try 00652 * printing help for them as though they are subcommands, using @a 00653 * cmd_table and @a option_table for option information. If not @c 00654 * NULL, @a global_options is a zero-terminated array of options taken 00655 * by all subcommands. 00656 * 00657 * Else, if @a print_version is TRUE, then print version info, in 00658 * brief form if @a quiet is also TRUE; if @a quiet is FALSE, then if 00659 * @a version_footer is non-NULL, print it following the version 00660 * information. 00661 * 00662 * Else, if @a os is not @c NULL and does not contain arguments, print 00663 * generic help, via svn_opt_print_generic_help2() with the @a header, 00664 * @a cmd_table, @a option_table, and @a footer arguments. 00665 * 00666 * Else, when @a os is @c NULL, print the simple usage complaint. 00667 * 00668 * Use @a pool for temporary allocations. 00669 * 00670 * Notes: The reason this function handles both version printing and 00671 * general usage help is that a confused user might put both the 00672 * --version flag *and* subcommand arguments on a help command line. 00673 * The logic for handling such a situation should be in one place. 00674 * 00675 * @since New in 1.5. 00676 */ 00677 svn_error_t * 00678 svn_opt_print_help3(apr_getopt_t *os, 00679 const char *pgm_name, 00680 svn_boolean_t print_version, 00681 svn_boolean_t quiet, 00682 const char *version_footer, 00683 const char *header, 00684 const svn_opt_subcommand_desc2_t *cmd_table, 00685 const apr_getopt_option_t *option_table, 00686 const int *global_options, 00687 const char *footer, 00688 apr_pool_t *pool); 00689 00690 /** 00691 * Same as svn_opt_print_help3(), but with @a global_options always @c 00692 * NULL. 00693 * 00694 * @deprecated Provided for backward compatibility with the 1.4 API. 00695 */ 00696 00697 SVN_DEPRECATED 00698 svn_error_t * 00699 svn_opt_print_help2(apr_getopt_t *os, 00700 const char *pgm_name, 00701 svn_boolean_t print_version, 00702 svn_boolean_t quiet, 00703 const char *version_footer, 00704 const char *header, 00705 const svn_opt_subcommand_desc2_t *cmd_table, 00706 const apr_getopt_option_t *option_table, 00707 const char *footer, 00708 apr_pool_t *pool); 00709 00710 00711 /** 00712 * Same as svn_opt_print_help2(), but acts on #svn_opt_subcommand_desc_t. 00713 * 00714 * @deprecated Provided for backward compatibility with the 1.3 API. 00715 */ 00716 SVN_DEPRECATED 00717 svn_error_t * 00718 svn_opt_print_help(apr_getopt_t *os, 00719 const char *pgm_name, 00720 svn_boolean_t print_version, 00721 svn_boolean_t quiet, 00722 const char *version_footer, 00723 const char *header, 00724 const svn_opt_subcommand_desc_t *cmd_table, 00725 const apr_getopt_option_t *option_table, 00726 const char *footer, 00727 apr_pool_t *pool); 00728 00729 #ifdef __cplusplus 00730 } 00731 #endif /* __cplusplus */ 00732 00733 #endif /* SVN_OPTS_H */
1.3.9.1