Fossil

Check-in [100ac83b]
Login

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

Overview
Comment:Integrate andygoth-help-option.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 100ac83b6407c8f2b3058d6a73a9fdc4926c7f58
User & Date: andygoth 2015-06-22 04:37:21.465
Context
2015-06-25
01:45
Minor spelling corrections to comment. ... (check-in: c048aac0 user: andybradford tags: trunk)
2015-06-22
04:37
Integrate andygoth-help-option. ... (check-in: 100ac83b user: andygoth tags: trunk)
2015-06-20
17:42
Use !if for all NMAKE feature macros, not !ifdef/!ifndef. Add preliminary support for Visual Studio 2015 to the MSVC batch build tool. ... (check-in: 0aa2896d user: mistachkin tags: trunk)
2015-06-19
16:19
Rework -help implementation so -help can be added to any command line even if it already contained an option that the help command would have interpreted. For example, "fossil clean -x -help" now prints help about the clean command, whereas before it was did the same as "fossil help -x", i.e. list auxiliary commands without mentioning clean. Make sure to fall back on the current implementation so "fossil -help -x" and such still work correctly. ... (Closed-Leaf check-in: 3a9017f9 user: andygoth tags: andygoth-help-option)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
681
682
683
684
685
686
687
688


689
690
691


692



693





694
695

696
697
698
699
700
701
702
703
    fossil_init_flags_from_options();
    if( find_option("utc",0,0) ) g.fTimeFormat = 1;
    if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
    if( zChdir && file_chdir(zChdir, 0) ){
      fossil_fatal("unable to change directories to %s", zChdir);
    }
    if( find_option("help",0,0)!=0 ){
      /* --help anywhere on the command line is translated into


      ** "fossil help argv[1] argv[2]..." */
      int i;
      char **zNewArgv = fossil_malloc( sizeof(char*)*(g.argc+2) );


      for(i=1; i<g.argc; i++) zNewArgv[i+1] = g.argv[i];



      zNewArgv[i+1] = 0;





      zNewArgv[0] = g.argv[0];
      zNewArgv[1] = "help";

      g.argc++;
      g.argv = zNewArgv;
    }
    zCmdName = g.argv[1];
  }
#ifndef _WIN32
  /* There is a bug in stunnel4 in which it sometimes starts up client
  ** processes without first opening file descriptor 2 (standard error).







|
>
>
|
|

>
>
|
>
>
>
|
>
>
>
>
>
|
|
>
|







681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
    fossil_init_flags_from_options();
    if( find_option("utc",0,0) ) g.fTimeFormat = 1;
    if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
    if( zChdir && file_chdir(zChdir, 0) ){
      fossil_fatal("unable to change directories to %s", zChdir);
    }
    if( find_option("help",0,0)!=0 ){
      /* If --help is found anywhere on the command line, translate the command
       * to "fossil help cmdname" where "cmdname" is the first argument that
       * does not begin with a "-" character.  If all arguments start with "-",
       * translate to "fossil help argv[1] argv[2]...". */
      int i, nNewArgc;
      char **zNewArgv = fossil_malloc( sizeof(char*)*(g.argc+2) );
      zNewArgv[0] = g.argv[0];
      zNewArgv[1] = "help";
      for(i=1; i<g.argc; i++){
        if( g.argv[i][0]!='-' ){
          nNewArgc = 3;
          zNewArgv[2] = g.argv[i];
          zNewArgv[3] = 0;
          break;
        }
      }
      if( i==g.argc ){
        for(i=1; i<g.argc; i++) zNewArgv[i+1] = g.argv[i];
        nNewArgc = g.argc+1;
        zNewArgv[i+1] = 0;
      }
      g.argc = nNewArgc;
      g.argv = zNewArgv;
    }
    zCmdName = g.argv[1];
  }
#ifndef _WIN32
  /* There is a bug in stunnel4 in which it sometimes starts up client
  ** processes without first opening file descriptor 2 (standard error).