Fossil

Diff
Login

Differences From Artifact [8e76b5189c]:

To Artifact [454367d576]:


556
557
558
559
560
561
562
563




564
565
566
567
568
569
570


/*
** COMMAND: help
**
** Usage: %fossil help COMMAND
**
** Display information on how to use COMMAND




*/
void help_cmd(void){
  int rc, idx;
  const char *z;
  if( g.argc!=3 ){
    printf("Usage: %s help COMMAND.\nAvailable COMMANDs:\n", g.argv[0]);
    cmd_cmd_list();







|
>
>
>
>







556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574


/*
** COMMAND: help
**
** Usage: %fossil help COMMAND
**
** Display information on how to use COMMAND. If COMMAND is
** omitted, a list of available commands is displayed.
**
** This can also be viewed in the gui:
**  * Go to the <a href="help">help</a> page and click COMMAND
*/
void help_cmd(void){
  int rc, idx;
  const char *z;
  if( g.argc!=3 ){
    printf("Usage: %s help COMMAND.\nAvailable COMMANDs:\n", g.argv[0]);
    cmd_cmd_list();
582
583
584
585
586
587
588




589
590
591
592
593
594
595
    fossil_fatal("no help available for the %s command",
       aCommand[idx].zName);
  }
  while( *z ){
    if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
      printf("%s", g.argv[0]);
      z += 7;




    }else if( *z=='<' && strncmp(z,"<a>",3)==0 ){
      putchar('"');
      z += 3;
    }else if( *z=='<' && strncmp(z,"</a>",4)==0 ){
      putchar('"');
      z += 4;
    }else{







>
>
>
>







586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
    fossil_fatal("no help available for the %s command",
       aCommand[idx].zName);
  }
  while( *z ){
    if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
      printf("%s", g.argv[0]);
      z += 7;
    }else if( *z=='<' && strncmp(z,"<a ",3)==0 ){
      putchar('"');
      while( *z && *z!='>') z++;
      if( *z ) z++;
    }else if( *z=='<' && strncmp(z,"<a>",3)==0 ){
      putchar('"');
      z += 3;
    }else if( *z=='<' && strncmp(z,"</a>",4)==0 ){
      putchar('"');
      z += 4;
    }else{
633
634
635
636
637
638
639








640
641
642
643
644
645
646
            }else if( zSrc[src]=='<' && strncmp(zSrc+src, "</a>", 3)==0 ){
              src += 4;
              zDest[dest++]='<';
              zDest[dest++]='/';
              zDest[dest++]='a';
              zDest[dest++]='>';
              zDest[dest++]='"';








            }else if( zSrc[src]=='<' && strncmp(zSrc+src, "<a>", 3)==0 ){
              /* found an internal command cross reference,
              ** create an additional link
              */
              int start;

              len+=80;







>
>
>
>
>
>
>
>







641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
            }else if( zSrc[src]=='<' && strncmp(zSrc+src, "</a>", 3)==0 ){
              src += 4;
              zDest[dest++]='<';
              zDest[dest++]='/';
              zDest[dest++]='a';
              zDest[dest++]='>';
              zDest[dest++]='"';
            }else if( zSrc[src]=='<' && strncmp(zSrc+src, "<a ", 3)==0 ){
              len += 2;
	      zDest=realloc(zDest,len);
              zDest[dest++]='"';
              while( zSrc[src] && zSrc[src]!='>' ){
                zDest[dest++]=zSrc[src++];
              }
              if( zSrc[src] ) zDest[dest++]=zSrc[src++];
            }else if( zSrc[src]=='<' && strncmp(zSrc+src, "<a>", 3)==0 ){
              /* found an internal command cross reference,
              ** create an additional link
              */
              int start;

              len+=80;
924
925
926
927
928
929
930


931
932
933
934
935
936
937
**
**      #!/usr/bin/fossil
**      repository: /home/somebody/project.db
**
** The second line defines the name of the repository.  After locating
** the repository, fossil will generate a webpage on stdout based on
** the values of standard CGI environment variables.


*/
void cmd_cgi(void){
  const char *zFile;
  const char *zNotFound = 0;
  Blob config, line, key, value;
  if( g.argc==3 && strcmp(g.argv[1],"cgi")==0 ){
    zFile = g.argv[2];







>
>







940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
**
**      #!/usr/bin/fossil
**      repository: /home/somebody/project.db
**
** The second line defines the name of the repository.  After locating
** the repository, fossil will generate a webpage on stdout based on
** the values of standard CGI environment variables.
**
** See also the <a>http</a>, <a>server</a> and <a>ui</a> commands.
*/
void cmd_cgi(void){
  const char *zFile;
  const char *zNotFound = 0;
  Blob config, line, key, value;
  if( g.argc==3 && strcmp(g.argv[1],"cgi")==0 ){
    zFile = g.argv[2];
1037
1038
1039
1040
1041
1042
1043


1044
1045
1046
1047
1048
1049
1050
** repository.
**
** If REPOSITORY is a directory that contains one or more respositories
** with names of the form "*.fossil" then the first element of the URL
** pathname selects among the various repositories.  If the pathname does
** not select a valid repository and the --notfound option is available,
** then the server redirects (HTTP code 302) to the URL of --notfound.


*/
void cmd_http(void){
  const char *zIpAddr;
  const char *zNotFound;
  zNotFound = find_option("notfound", 0, 1);
  g.cgiOutput = 1;
  if( g.argc!=2 && g.argc!=3 && g.argc!=6 ){







>
>







1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
** repository.
**
** If REPOSITORY is a directory that contains one or more respositories
** with names of the form "*.fossil" then the first element of the URL
** pathname selects among the various repositories.  If the pathname does
** not select a valid repository and the --notfound option is available,
** then the server redirects (HTTP code 302) to the URL of --notfound.
**
** See also the <a>cgi</a>, <a>server</a> and <a>ui</a> commands.
*/
void cmd_http(void){
  const char *zIpAddr;
  const char *zNotFound;
  zNotFound = find_option("notfound", 0, 1);
  g.cgiOutput = 1;
  if( g.argc!=2 && g.argc!=3 && g.argc!=6 ){
1125
1126
1127
1128
1129
1130
1131


1132
1133
1134
1135
1136
1137
1138
** the web server.  The "ui" command also binds to 127.0.0.1 and so will
** only process HTTP traffic from the local machine.
**
** In the "server" command, the REPOSITORY can be a directory (aka folder)
** that contains one or more respositories with names ending in ".fossil".
** In that case, the first element of the URL is used to select among the
** various repositories.


*/
void cmd_webserver(void){
  int iPort, mxPort;        /* Range of TCP ports allowed */
  const char *zPort;        /* Value of the --port option */
  char *zBrowser;           /* Name of web browser program */
  char *zBrowserCmd = 0;    /* Command to launch the web browser */
  int isUiCmd;              /* True if command is "ui", not "server' */







>
>







1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
** the web server.  The "ui" command also binds to 127.0.0.1 and so will
** only process HTTP traffic from the local machine.
**
** In the "server" command, the REPOSITORY can be a directory (aka folder)
** that contains one or more respositories with names ending in ".fossil".
** In that case, the first element of the URL is used to select among the
** various repositories.
**
** See also the <a>cgi</a> and <a>http</a> commands.
*/
void cmd_webserver(void){
  int iPort, mxPort;        /* Range of TCP ports allowed */
  const char *zPort;        /* Value of the --port option */
  char *zBrowser;           /* Name of web browser program */
  char *zBrowserCmd = 0;    /* Command to launch the web browser */
  int isUiCmd;              /* True if command is "ui", not "server' */