Fossil

Check-in [cd969ec5]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:If verify_all_options() is called more than once, ignore the second invocation because it won't work as expected anyway as the first invocation has already tossed out the ability to pass in arguments that might be consumed by the second caller. Moving because apparently some subcommands may actually need to call this a second time, in which case I suppose we need to "define" its behavior.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | mistake
Files: files | file ages | folders
SHA3-256: cd969ec5da8174026ca6875507cf1cc27a7efc5ce79c4aa0dc55b5d86c65d434
User & Date: andybradford 2019-10-03 13:38:58
Original Comment: If verify_all_options() is called more than once, ignore the second invocation because it won't work as expected anyway as the first invocation has already tossed out the ability to pass in arguments that might be consumed by the second caller.
Context
2019-10-03
13:38
If verify_all_options() is called more than once, ignore the second invocation because it won't work as expected anyway as the first invocation has already tossed out the ability to pass in arguments that might be consumed by the second caller. Moving because apparently some subcommands may actually need to call this a second time, in which case I suppose we need to "define" its behavior. Closed-Leaf check-in: cd969ec5 user: andybradford tags: mistake
2019-10-02
16:14
Removed a debugging-only function. check-in: 05cde4f8 user: stephan tags: double-dash-flag2
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/main.c.

1039
1040
1041
1042
1043
1044
1045
1046
1047

1048
1049

1050



1051
1052
1053
1054
1055
1056
1057
** an error message and quit.
**
** Exception: if "--" is encountered, it is consumed from the argument
** list and this function immediately returns. The effect is to treat
** all arguments after "--" as non-flags (conventionally used to
** enable passing-in of filenames which start with a dash).
**
** This function must only be called one time per app invokation.
** Calling it more than once results in undefined behaviour.

*/
void verify_all_options(void){

  int i;



  for(i=1; i<g.argc; i++){
    const char * arg = g.argv[i];
    if( arg[0]=='-' ){
      if( arg[1]=='-' && arg[2]==0 ){
        /* Remove "--" from the list and treat all following
        ** arguments as non-flags. */
        remove_from_argv(i, 1);







|
|
>


>

>
>
>







1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
** an error message and quit.
**
** Exception: if "--" is encountered, it is consumed from the argument
** list and this function immediately returns. The effect is to treat
** all arguments after "--" as non-flags (conventionally used to
** enable passing-in of filenames which start with a dash).
**
** This function must only be called one time per app invocation.
** Calling it more than once is not supported and is a no-op on 
** the second invocation.
*/
void verify_all_options(void){
  static int fCalled = 0;
  int i;

  if( fCalled ) return;
  fCalled = 1;
  for(i=1; i<g.argc; i++){
    const char * arg = g.argv[i];
    if( arg[0]=='-' ){
      if( arg[1]=='-' && arg[2]==0 ){
        /* Remove "--" from the list and treat all following
        ** arguments as non-flags. */
        remove_from_argv(i, 1);