Fossil SCM
Add the ability to include -OR- omit support for TH1 hooks at compile-time.
Commit
b3c40dd49ea8de84f15c2effbb5d212e037a557f
Parent
3d28912ca377031…
8 files changed
+6
+20
-1
+18
+7
-1
+10
+10
+8
+5
M
auto.def
+6
| --- auto.def | ||
| +++ auto.def | ||
| @@ -4,10 +4,11 @@ | ||
| 4 | 4 | |
| 5 | 5 | options { |
| 6 | 6 | with-openssl:path|auto|none |
| 7 | 7 | => {Look for openssl in the given path, or auto or none} |
| 8 | 8 | with-zlib:path => {Look for zlib in the given path} |
| 9 | + with-th1-hooks=0 => {Enable TH1 hooks for commands and unknown web pages} | |
| 9 | 10 | with-tcl:path => {Enable Tcl integration, with Tcl in the specified path} |
| 10 | 11 | with-tcl-stubs=0 => {Enable Tcl integration via stubs library mechanism} |
| 11 | 12 | with-tcl-private-stubs=0 |
| 12 | 13 | => {Enable Tcl integration via private stubs mechanism} |
| 13 | 14 | internal-sqlite=1 => {Don't use the internal SQLite, use the system one} |
| @@ -79,10 +80,15 @@ | ||
| 79 | 80 | # have #ifdef guards around the whole file without |
| 80 | 81 | # reading config.h first. |
| 81 | 82 | define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_JSON |
| 82 | 83 | define FOSSIL_ENABLE_JSON |
| 83 | 84 | } |
| 85 | + | |
| 86 | +if {[opt-bool with-th1-hooks]} { | |
| 87 | + define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_TH1_HOOKS | |
| 88 | + define FOSSIL_ENABLE_TH1_HOOKS | |
| 89 | +} | |
| 84 | 90 | |
| 85 | 91 | #if {[opt-bool markdown]} { |
| 86 | 92 | # # no-op. Markdown is now enabled by default. |
| 87 | 93 | #} |
| 88 | 94 | |
| 89 | 95 |
| --- auto.def | |
| +++ auto.def | |
| @@ -4,10 +4,11 @@ | |
| 4 | |
| 5 | options { |
| 6 | with-openssl:path|auto|none |
| 7 | => {Look for openssl in the given path, or auto or none} |
| 8 | with-zlib:path => {Look for zlib in the given path} |
| 9 | with-tcl:path => {Enable Tcl integration, with Tcl in the specified path} |
| 10 | with-tcl-stubs=0 => {Enable Tcl integration via stubs library mechanism} |
| 11 | with-tcl-private-stubs=0 |
| 12 | => {Enable Tcl integration via private stubs mechanism} |
| 13 | internal-sqlite=1 => {Don't use the internal SQLite, use the system one} |
| @@ -79,10 +80,15 @@ | |
| 79 | # have #ifdef guards around the whole file without |
| 80 | # reading config.h first. |
| 81 | define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_JSON |
| 82 | define FOSSIL_ENABLE_JSON |
| 83 | } |
| 84 | |
| 85 | #if {[opt-bool markdown]} { |
| 86 | # # no-op. Markdown is now enabled by default. |
| 87 | #} |
| 88 | |
| 89 |
| --- auto.def | |
| +++ auto.def | |
| @@ -4,10 +4,11 @@ | |
| 4 | |
| 5 | options { |
| 6 | with-openssl:path|auto|none |
| 7 | => {Look for openssl in the given path, or auto or none} |
| 8 | with-zlib:path => {Look for zlib in the given path} |
| 9 | with-th1-hooks=0 => {Enable TH1 hooks for commands and unknown web pages} |
| 10 | with-tcl:path => {Enable Tcl integration, with Tcl in the specified path} |
| 11 | with-tcl-stubs=0 => {Enable Tcl integration via stubs library mechanism} |
| 12 | with-tcl-private-stubs=0 |
| 13 | => {Enable Tcl integration via private stubs mechanism} |
| 14 | internal-sqlite=1 => {Don't use the internal SQLite, use the system one} |
| @@ -79,10 +80,15 @@ | |
| 80 | # have #ifdef guards around the whole file without |
| 81 | # reading config.h first. |
| 82 | define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_JSON |
| 83 | define FOSSIL_ENABLE_JSON |
| 84 | } |
| 85 | |
| 86 | if {[opt-bool with-th1-hooks]} { |
| 87 | define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_TH1_HOOKS |
| 88 | define FOSSIL_ENABLE_TH1_HOOKS |
| 89 | } |
| 90 | |
| 91 | #if {[opt-bool markdown]} { |
| 92 | # # no-op. Markdown is now enabled by default. |
| 93 | #} |
| 94 | |
| 95 |
+20
-1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -194,11 +194,13 @@ | ||
| 194 | 194 | char zCsrfToken[12]; /* Value of the anti-CSRF token */ |
| 195 | 195 | int okCsrf; /* Anti-CSRF token is present and valid */ |
| 196 | 196 | |
| 197 | 197 | int parseCnt[10]; /* Counts of artifacts parsed */ |
| 198 | 198 | FILE *fDebug; /* Write debug information here, if the file exists */ |
| 199 | +#ifdef FOSSIL_ENABLE_TH1_HOOKS | |
| 199 | 200 | int fNoThHook; /* Disable all TH1 command/webpage hooks */ |
| 201 | +#endif | |
| 200 | 202 | int thTrace; /* True to enable TH1 debugging output */ |
| 201 | 203 | Blob thLog; /* Text of the TH1 debugging output */ |
| 202 | 204 | |
| 203 | 205 | int isHome; /* True if rendering the "home" page */ |
| 204 | 206 | |
| @@ -621,11 +623,13 @@ | ||
| 621 | 623 | g.fSshClient = 0; |
| 622 | 624 | g.zSshCmd = 0; |
| 623 | 625 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| 624 | 626 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 625 | 627 | g.fHttpTrace = find_option("httptrace", 0, 0)!=0; |
| 628 | +#ifdef FOSSIL_ENABLE_TH1_HOOKS | |
| 626 | 629 | g.fNoThHook = find_option("no-th-hook", 0, 0)!=0; |
| 630 | +#endif | |
| 627 | 631 | g.zHttpAuth = 0; |
| 628 | 632 | g.zLogin = find_option("user", "U", 1); |
| 629 | 633 | g.zSSLIdentity = find_option("ssl-identity", 0, 1); |
| 630 | 634 | g.zErrlog = find_option("errorlog", 0, 1); |
| 631 | 635 | if( find_option("utc",0,0) ) g.fTimeFormat = 1; |
| @@ -651,25 +655,29 @@ | ||
| 651 | 655 | if( !is_valid_fd(2) ) fossil_panic("file descriptor 2 not open"); |
| 652 | 656 | /* if( is_valid_fd(3) ) fossil_warning("file descriptor 3 is open"); */ |
| 653 | 657 | #endif |
| 654 | 658 | rc = name_search(zCmdName, aCommand, count(aCommand), &idx); |
| 655 | 659 | if( rc==1 ){ |
| 660 | +#ifdef FOSSIL_ENABLE_TH1_HOOKS | |
| 656 | 661 | if( !g.isHTTP && !g.fNoThHook ){ |
| 657 | 662 | rc = Th_CommandHook(zCmdName, 0); |
| 658 | 663 | }else{ |
| 659 | 664 | rc = TH_OK; |
| 660 | 665 | } |
| 661 | 666 | if( rc==TH_OK || rc==TH_RETURN || rc==TH_CONTINUE ){ |
| 662 | 667 | if( rc==TH_OK || rc==TH_RETURN ){ |
| 668 | +#endif | |
| 663 | 669 | fossil_fatal("%s: unknown command: %s\n" |
| 664 | 670 | "%s: use \"help\" for more information\n", |
| 665 | 671 | g.argv[0], zCmdName, g.argv[0]); |
| 672 | +#ifdef FOSSIL_ENABLE_TH1_HOOKS | |
| 666 | 673 | } |
| 667 | 674 | if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ |
| 668 | 675 | Th_CommandNotify(zCmdName, 0); |
| 669 | 676 | } |
| 670 | 677 | } |
| 678 | +#endif | |
| 671 | 679 | fossil_exit(0); |
| 672 | 680 | }else if( rc==2 ){ |
| 673 | 681 | int i, n; |
| 674 | 682 | Blob couldbe; |
| 675 | 683 | blob_zero(&couldbe); |
| @@ -684,10 +692,11 @@ | ||
| 684 | 692 | "%s: use \"help\" for more information\n", |
| 685 | 693 | g.argv[0], zCmdName, g.argv[0], blob_str(&couldbe), g.argv[0]); |
| 686 | 694 | fossil_exit(1); |
| 687 | 695 | } |
| 688 | 696 | atexit( fossil_atexit ); |
| 697 | +#ifdef FOSSIL_ENABLE_TH1_HOOKS | |
| 689 | 698 | /* |
| 690 | 699 | ** The TH1 return codes from the hook will be handled as follows: |
| 691 | 700 | ** |
| 692 | 701 | ** TH_OK: The xFunc() and the TH1 notification will both be executed. |
| 693 | 702 | ** |
| @@ -705,15 +714,20 @@ | ||
| 705 | 714 | rc = Th_CommandHook(aCommand[idx].zName, aCommand[idx].cmdFlags); |
| 706 | 715 | }else{ |
| 707 | 716 | rc = TH_OK; |
| 708 | 717 | } |
| 709 | 718 | if( rc==TH_OK || rc==TH_RETURN || rc==TH_CONTINUE ){ |
| 710 | - if( rc==TH_OK || rc==TH_RETURN ){ aCommand[idx].xFunc(); } | |
| 719 | + if( rc==TH_OK || rc==TH_RETURN ){ | |
| 720 | +#endif | |
| 721 | + aCommand[idx].xFunc(); | |
| 722 | +#ifdef FOSSIL_ENABLE_TH1_HOOKS | |
| 723 | + } | |
| 711 | 724 | if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ |
| 712 | 725 | Th_CommandNotify(aCommand[idx].zName, aCommand[idx].cmdFlags); |
| 713 | 726 | } |
| 714 | 727 | } |
| 728 | +#endif | |
| 715 | 729 | fossil_exit(0); |
| 716 | 730 | /*NOT_REACHED*/ |
| 717 | 731 | return 0; |
| 718 | 732 | } |
| 719 | 733 | |
| @@ -901,10 +915,13 @@ | ||
| 901 | 915 | fossil_print("SQLite %s %.30s\n", sqlite3_libversion(), sqlite3_sourceid()); |
| 902 | 916 | fossil_print("Schema version %s\n", AUX_SCHEMA); |
| 903 | 917 | fossil_print("zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion()); |
| 904 | 918 | #if defined(FOSSIL_ENABLE_SSL) |
| 905 | 919 | fossil_print("SSL (%s)\n", SSLeay_version(SSLEAY_VERSION)); |
| 920 | +#endif | |
| 921 | +#if defined(FOSSIL_ENABLE_TH1_HOOKS) | |
| 922 | + fossil_print("TH1_HOOKS\n"); | |
| 906 | 923 | #endif |
| 907 | 924 | #if defined(FOSSIL_ENABLE_TCL) |
| 908 | 925 | Th_FossilInit(TH_INIT_DEFAULT | TH_INIT_FORCE_TCL); |
| 909 | 926 | rc = Th_Eval(g.interp, 0, "tclInvoke info patchlevel", -1); |
| 910 | 927 | zRc = Th_ReturnCodeName(rc, 0); |
| @@ -1550,10 +1567,11 @@ | ||
| 1550 | 1567 | @ <h1>Server Configuration Error</h1> |
| 1551 | 1568 | @ <p>The database schema on the server is out-of-date. Please ask |
| 1552 | 1569 | @ the administrator to run <b>fossil rebuild</b>.</p> |
| 1553 | 1570 | } |
| 1554 | 1571 | }else{ |
| 1572 | +#ifdef FOSSIL_ENABLE_TH1_HOOKS | |
| 1555 | 1573 | /* |
| 1556 | 1574 | ** The TH1 return codes from the hook will be handled as follows: |
| 1557 | 1575 | ** |
| 1558 | 1576 | ** TH_OK: The xFunc() and the TH1 notification will both be executed. |
| 1559 | 1577 | ** |
| @@ -1577,10 +1595,11 @@ | ||
| 1577 | 1595 | if( rc==TH_OK || rc==TH_RETURN ){ aWebpage[idx].xFunc(); } |
| 1578 | 1596 | if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ |
| 1579 | 1597 | Th_WebpageNotify(aWebpage[idx].zName, aWebpage[idx].cmdFlags); |
| 1580 | 1598 | } |
| 1581 | 1599 | } |
| 1600 | +#endif | |
| 1582 | 1601 | } |
| 1583 | 1602 | |
| 1584 | 1603 | /* Return the result. |
| 1585 | 1604 | */ |
| 1586 | 1605 | cgi_reply(); |
| 1587 | 1606 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -194,11 +194,13 @@ | |
| 194 | char zCsrfToken[12]; /* Value of the anti-CSRF token */ |
| 195 | int okCsrf; /* Anti-CSRF token is present and valid */ |
| 196 | |
| 197 | int parseCnt[10]; /* Counts of artifacts parsed */ |
| 198 | FILE *fDebug; /* Write debug information here, if the file exists */ |
| 199 | int fNoThHook; /* Disable all TH1 command/webpage hooks */ |
| 200 | int thTrace; /* True to enable TH1 debugging output */ |
| 201 | Blob thLog; /* Text of the TH1 debugging output */ |
| 202 | |
| 203 | int isHome; /* True if rendering the "home" page */ |
| 204 | |
| @@ -621,11 +623,13 @@ | |
| 621 | g.fSshClient = 0; |
| 622 | g.zSshCmd = 0; |
| 623 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| 624 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 625 | g.fHttpTrace = find_option("httptrace", 0, 0)!=0; |
| 626 | g.fNoThHook = find_option("no-th-hook", 0, 0)!=0; |
| 627 | g.zHttpAuth = 0; |
| 628 | g.zLogin = find_option("user", "U", 1); |
| 629 | g.zSSLIdentity = find_option("ssl-identity", 0, 1); |
| 630 | g.zErrlog = find_option("errorlog", 0, 1); |
| 631 | if( find_option("utc",0,0) ) g.fTimeFormat = 1; |
| @@ -651,25 +655,29 @@ | |
| 651 | if( !is_valid_fd(2) ) fossil_panic("file descriptor 2 not open"); |
| 652 | /* if( is_valid_fd(3) ) fossil_warning("file descriptor 3 is open"); */ |
| 653 | #endif |
| 654 | rc = name_search(zCmdName, aCommand, count(aCommand), &idx); |
| 655 | if( rc==1 ){ |
| 656 | if( !g.isHTTP && !g.fNoThHook ){ |
| 657 | rc = Th_CommandHook(zCmdName, 0); |
| 658 | }else{ |
| 659 | rc = TH_OK; |
| 660 | } |
| 661 | if( rc==TH_OK || rc==TH_RETURN || rc==TH_CONTINUE ){ |
| 662 | if( rc==TH_OK || rc==TH_RETURN ){ |
| 663 | fossil_fatal("%s: unknown command: %s\n" |
| 664 | "%s: use \"help\" for more information\n", |
| 665 | g.argv[0], zCmdName, g.argv[0]); |
| 666 | } |
| 667 | if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ |
| 668 | Th_CommandNotify(zCmdName, 0); |
| 669 | } |
| 670 | } |
| 671 | fossil_exit(0); |
| 672 | }else if( rc==2 ){ |
| 673 | int i, n; |
| 674 | Blob couldbe; |
| 675 | blob_zero(&couldbe); |
| @@ -684,10 +692,11 @@ | |
| 684 | "%s: use \"help\" for more information\n", |
| 685 | g.argv[0], zCmdName, g.argv[0], blob_str(&couldbe), g.argv[0]); |
| 686 | fossil_exit(1); |
| 687 | } |
| 688 | atexit( fossil_atexit ); |
| 689 | /* |
| 690 | ** The TH1 return codes from the hook will be handled as follows: |
| 691 | ** |
| 692 | ** TH_OK: The xFunc() and the TH1 notification will both be executed. |
| 693 | ** |
| @@ -705,15 +714,20 @@ | |
| 705 | rc = Th_CommandHook(aCommand[idx].zName, aCommand[idx].cmdFlags); |
| 706 | }else{ |
| 707 | rc = TH_OK; |
| 708 | } |
| 709 | if( rc==TH_OK || rc==TH_RETURN || rc==TH_CONTINUE ){ |
| 710 | if( rc==TH_OK || rc==TH_RETURN ){ aCommand[idx].xFunc(); } |
| 711 | if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ |
| 712 | Th_CommandNotify(aCommand[idx].zName, aCommand[idx].cmdFlags); |
| 713 | } |
| 714 | } |
| 715 | fossil_exit(0); |
| 716 | /*NOT_REACHED*/ |
| 717 | return 0; |
| 718 | } |
| 719 | |
| @@ -901,10 +915,13 @@ | |
| 901 | fossil_print("SQLite %s %.30s\n", sqlite3_libversion(), sqlite3_sourceid()); |
| 902 | fossil_print("Schema version %s\n", AUX_SCHEMA); |
| 903 | fossil_print("zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion()); |
| 904 | #if defined(FOSSIL_ENABLE_SSL) |
| 905 | fossil_print("SSL (%s)\n", SSLeay_version(SSLEAY_VERSION)); |
| 906 | #endif |
| 907 | #if defined(FOSSIL_ENABLE_TCL) |
| 908 | Th_FossilInit(TH_INIT_DEFAULT | TH_INIT_FORCE_TCL); |
| 909 | rc = Th_Eval(g.interp, 0, "tclInvoke info patchlevel", -1); |
| 910 | zRc = Th_ReturnCodeName(rc, 0); |
| @@ -1550,10 +1567,11 @@ | |
| 1550 | @ <h1>Server Configuration Error</h1> |
| 1551 | @ <p>The database schema on the server is out-of-date. Please ask |
| 1552 | @ the administrator to run <b>fossil rebuild</b>.</p> |
| 1553 | } |
| 1554 | }else{ |
| 1555 | /* |
| 1556 | ** The TH1 return codes from the hook will be handled as follows: |
| 1557 | ** |
| 1558 | ** TH_OK: The xFunc() and the TH1 notification will both be executed. |
| 1559 | ** |
| @@ -1577,10 +1595,11 @@ | |
| 1577 | if( rc==TH_OK || rc==TH_RETURN ){ aWebpage[idx].xFunc(); } |
| 1578 | if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ |
| 1579 | Th_WebpageNotify(aWebpage[idx].zName, aWebpage[idx].cmdFlags); |
| 1580 | } |
| 1581 | } |
| 1582 | } |
| 1583 | |
| 1584 | /* Return the result. |
| 1585 | */ |
| 1586 | cgi_reply(); |
| 1587 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -194,11 +194,13 @@ | |
| 194 | char zCsrfToken[12]; /* Value of the anti-CSRF token */ |
| 195 | int okCsrf; /* Anti-CSRF token is present and valid */ |
| 196 | |
| 197 | int parseCnt[10]; /* Counts of artifacts parsed */ |
| 198 | FILE *fDebug; /* Write debug information here, if the file exists */ |
| 199 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 200 | int fNoThHook; /* Disable all TH1 command/webpage hooks */ |
| 201 | #endif |
| 202 | int thTrace; /* True to enable TH1 debugging output */ |
| 203 | Blob thLog; /* Text of the TH1 debugging output */ |
| 204 | |
| 205 | int isHome; /* True if rendering the "home" page */ |
| 206 | |
| @@ -621,11 +623,13 @@ | |
| 623 | g.fSshClient = 0; |
| 624 | g.zSshCmd = 0; |
| 625 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| 626 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 627 | g.fHttpTrace = find_option("httptrace", 0, 0)!=0; |
| 628 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 629 | g.fNoThHook = find_option("no-th-hook", 0, 0)!=0; |
| 630 | #endif |
| 631 | g.zHttpAuth = 0; |
| 632 | g.zLogin = find_option("user", "U", 1); |
| 633 | g.zSSLIdentity = find_option("ssl-identity", 0, 1); |
| 634 | g.zErrlog = find_option("errorlog", 0, 1); |
| 635 | if( find_option("utc",0,0) ) g.fTimeFormat = 1; |
| @@ -651,25 +655,29 @@ | |
| 655 | if( !is_valid_fd(2) ) fossil_panic("file descriptor 2 not open"); |
| 656 | /* if( is_valid_fd(3) ) fossil_warning("file descriptor 3 is open"); */ |
| 657 | #endif |
| 658 | rc = name_search(zCmdName, aCommand, count(aCommand), &idx); |
| 659 | if( rc==1 ){ |
| 660 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 661 | if( !g.isHTTP && !g.fNoThHook ){ |
| 662 | rc = Th_CommandHook(zCmdName, 0); |
| 663 | }else{ |
| 664 | rc = TH_OK; |
| 665 | } |
| 666 | if( rc==TH_OK || rc==TH_RETURN || rc==TH_CONTINUE ){ |
| 667 | if( rc==TH_OK || rc==TH_RETURN ){ |
| 668 | #endif |
| 669 | fossil_fatal("%s: unknown command: %s\n" |
| 670 | "%s: use \"help\" for more information\n", |
| 671 | g.argv[0], zCmdName, g.argv[0]); |
| 672 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 673 | } |
| 674 | if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ |
| 675 | Th_CommandNotify(zCmdName, 0); |
| 676 | } |
| 677 | } |
| 678 | #endif |
| 679 | fossil_exit(0); |
| 680 | }else if( rc==2 ){ |
| 681 | int i, n; |
| 682 | Blob couldbe; |
| 683 | blob_zero(&couldbe); |
| @@ -684,10 +692,11 @@ | |
| 692 | "%s: use \"help\" for more information\n", |
| 693 | g.argv[0], zCmdName, g.argv[0], blob_str(&couldbe), g.argv[0]); |
| 694 | fossil_exit(1); |
| 695 | } |
| 696 | atexit( fossil_atexit ); |
| 697 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 698 | /* |
| 699 | ** The TH1 return codes from the hook will be handled as follows: |
| 700 | ** |
| 701 | ** TH_OK: The xFunc() and the TH1 notification will both be executed. |
| 702 | ** |
| @@ -705,15 +714,20 @@ | |
| 714 | rc = Th_CommandHook(aCommand[idx].zName, aCommand[idx].cmdFlags); |
| 715 | }else{ |
| 716 | rc = TH_OK; |
| 717 | } |
| 718 | if( rc==TH_OK || rc==TH_RETURN || rc==TH_CONTINUE ){ |
| 719 | if( rc==TH_OK || rc==TH_RETURN ){ |
| 720 | #endif |
| 721 | aCommand[idx].xFunc(); |
| 722 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 723 | } |
| 724 | if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ |
| 725 | Th_CommandNotify(aCommand[idx].zName, aCommand[idx].cmdFlags); |
| 726 | } |
| 727 | } |
| 728 | #endif |
| 729 | fossil_exit(0); |
| 730 | /*NOT_REACHED*/ |
| 731 | return 0; |
| 732 | } |
| 733 | |
| @@ -901,10 +915,13 @@ | |
| 915 | fossil_print("SQLite %s %.30s\n", sqlite3_libversion(), sqlite3_sourceid()); |
| 916 | fossil_print("Schema version %s\n", AUX_SCHEMA); |
| 917 | fossil_print("zlib %s, loaded %s\n", ZLIB_VERSION, zlibVersion()); |
| 918 | #if defined(FOSSIL_ENABLE_SSL) |
| 919 | fossil_print("SSL (%s)\n", SSLeay_version(SSLEAY_VERSION)); |
| 920 | #endif |
| 921 | #if defined(FOSSIL_ENABLE_TH1_HOOKS) |
| 922 | fossil_print("TH1_HOOKS\n"); |
| 923 | #endif |
| 924 | #if defined(FOSSIL_ENABLE_TCL) |
| 925 | Th_FossilInit(TH_INIT_DEFAULT | TH_INIT_FORCE_TCL); |
| 926 | rc = Th_Eval(g.interp, 0, "tclInvoke info patchlevel", -1); |
| 927 | zRc = Th_ReturnCodeName(rc, 0); |
| @@ -1550,10 +1567,11 @@ | |
| 1567 | @ <h1>Server Configuration Error</h1> |
| 1568 | @ <p>The database schema on the server is out-of-date. Please ask |
| 1569 | @ the administrator to run <b>fossil rebuild</b>.</p> |
| 1570 | } |
| 1571 | }else{ |
| 1572 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 1573 | /* |
| 1574 | ** The TH1 return codes from the hook will be handled as follows: |
| 1575 | ** |
| 1576 | ** TH_OK: The xFunc() and the TH1 notification will both be executed. |
| 1577 | ** |
| @@ -1577,10 +1595,11 @@ | |
| 1595 | if( rc==TH_OK || rc==TH_RETURN ){ aWebpage[idx].xFunc(); } |
| 1596 | if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ |
| 1597 | Th_WebpageNotify(aWebpage[idx].zName, aWebpage[idx].cmdFlags); |
| 1598 | } |
| 1599 | } |
| 1600 | #endif |
| 1601 | } |
| 1602 | |
| 1603 | /* Return the result. |
| 1604 | */ |
| 1605 | cgi_reply(); |
| 1606 |
+18
| --- src/makemake.tcl | ||
| +++ src/makemake.tcl | ||
| @@ -408,10 +408,14 @@ | ||
| 408 | 408 | # FOSSIL_ENABLE_JSON = 1 |
| 409 | 409 | |
| 410 | 410 | #### Enable HTTPS support via OpenSSL (links to libssl and libcrypto) |
| 411 | 411 | # |
| 412 | 412 | # FOSSIL_ENABLE_SSL = 1 |
| 413 | + | |
| 414 | +#### Enable hooks for commands and unknown web pages via TH1 | |
| 415 | +# | |
| 416 | +# FOSSIL_ENABLE_TH1_HOOKS = 1 | |
| 413 | 417 | |
| 414 | 418 | #### Enable scripting support via Tcl/Tk |
| 415 | 419 | # |
| 416 | 420 | # FOSSIL_ENABLE_TCL = 1 |
| 417 | 421 | |
| @@ -537,10 +541,16 @@ | ||
| 537 | 541 | # With HTTPS support |
| 538 | 542 | ifdef FOSSIL_ENABLE_SSL |
| 539 | 543 | TCC += -DFOSSIL_ENABLE_SSL=1 |
| 540 | 544 | RCC += -DFOSSIL_ENABLE_SSL=1 |
| 541 | 545 | endif |
| 546 | + | |
| 547 | +# With TH1 hook support | |
| 548 | +ifdef FOSSIL_ENABLE_TH1_HOOKS | |
| 549 | +TCC += -DFOSSIL_ENABLE_TH1_HOOKS=1 | |
| 550 | +RCC += -DFOSSIL_ENABLE_TH1_HOOKS=1 | |
| 551 | +endif | |
| 542 | 552 | |
| 543 | 553 | # With Tcl support |
| 544 | 554 | ifdef FOSSIL_ENABLE_TCL |
| 545 | 555 | TCC += -DFOSSIL_ENABLE_TCL=1 |
| 546 | 556 | RCC += -DFOSSIL_ENABLE_TCL=1 |
| @@ -1024,10 +1034,13 @@ | ||
| 1024 | 1034 | # Uncomment to enable JSON API |
| 1025 | 1035 | # FOSSIL_ENABLE_JSON = 1 |
| 1026 | 1036 | |
| 1027 | 1037 | # Uncomment to enable SSL support |
| 1028 | 1038 | # FOSSIL_ENABLE_SSL = 1 |
| 1039 | + | |
| 1040 | +# Uncomment to enable TH1 hooks | |
| 1041 | +# FOSSIL_ENABLE_TH1_HOOKS = 1 | |
| 1029 | 1042 | |
| 1030 | 1043 | # Uncomment to enable Tcl support |
| 1031 | 1044 | # FOSSIL_ENABLE_TCL = 1 |
| 1032 | 1045 | |
| 1033 | 1046 | !ifdef FOSSIL_ENABLE_SSL |
| @@ -1082,10 +1095,15 @@ | ||
| 1082 | 1095 | TCC = $(TCC) /DFOSSIL_ENABLE_SSL=1 |
| 1083 | 1096 | RCC = $(RCC) /DFOSSIL_ENABLE_SSL=1 |
| 1084 | 1097 | LIBS = $(LIBS) $(SSLLIB) |
| 1085 | 1098 | LIBDIR = $(LIBDIR) /LIBPATH:$(SSLLIBDIR) |
| 1086 | 1099 | !endif |
| 1100 | + | |
| 1101 | +!ifdef FOSSIL_ENABLE_TH1_HOOKS | |
| 1102 | +TCC = $(TCC) /DFOSSIL_ENABLE_TH1_HOOKS=1 | |
| 1103 | +RCC = $(RCC) /DFOSSIL_ENABLE_TH1_HOOKS=1 | |
| 1104 | +!endif | |
| 1087 | 1105 | |
| 1088 | 1106 | !ifdef FOSSIL_ENABLE_TCL |
| 1089 | 1107 | TCC = $(TCC) /DFOSSIL_ENABLE_TCL=1 |
| 1090 | 1108 | RCC = $(RCC) /DFOSSIL_ENABLE_TCL=1 |
| 1091 | 1109 | TCC = $(TCC) /DFOSSIL_ENABLE_TCL_STUBS=1 |
| 1092 | 1110 |
| --- src/makemake.tcl | |
| +++ src/makemake.tcl | |
| @@ -408,10 +408,14 @@ | |
| 408 | # FOSSIL_ENABLE_JSON = 1 |
| 409 | |
| 410 | #### Enable HTTPS support via OpenSSL (links to libssl and libcrypto) |
| 411 | # |
| 412 | # FOSSIL_ENABLE_SSL = 1 |
| 413 | |
| 414 | #### Enable scripting support via Tcl/Tk |
| 415 | # |
| 416 | # FOSSIL_ENABLE_TCL = 1 |
| 417 | |
| @@ -537,10 +541,16 @@ | |
| 537 | # With HTTPS support |
| 538 | ifdef FOSSIL_ENABLE_SSL |
| 539 | TCC += -DFOSSIL_ENABLE_SSL=1 |
| 540 | RCC += -DFOSSIL_ENABLE_SSL=1 |
| 541 | endif |
| 542 | |
| 543 | # With Tcl support |
| 544 | ifdef FOSSIL_ENABLE_TCL |
| 545 | TCC += -DFOSSIL_ENABLE_TCL=1 |
| 546 | RCC += -DFOSSIL_ENABLE_TCL=1 |
| @@ -1024,10 +1034,13 @@ | |
| 1024 | # Uncomment to enable JSON API |
| 1025 | # FOSSIL_ENABLE_JSON = 1 |
| 1026 | |
| 1027 | # Uncomment to enable SSL support |
| 1028 | # FOSSIL_ENABLE_SSL = 1 |
| 1029 | |
| 1030 | # Uncomment to enable Tcl support |
| 1031 | # FOSSIL_ENABLE_TCL = 1 |
| 1032 | |
| 1033 | !ifdef FOSSIL_ENABLE_SSL |
| @@ -1082,10 +1095,15 @@ | |
| 1082 | TCC = $(TCC) /DFOSSIL_ENABLE_SSL=1 |
| 1083 | RCC = $(RCC) /DFOSSIL_ENABLE_SSL=1 |
| 1084 | LIBS = $(LIBS) $(SSLLIB) |
| 1085 | LIBDIR = $(LIBDIR) /LIBPATH:$(SSLLIBDIR) |
| 1086 | !endif |
| 1087 | |
| 1088 | !ifdef FOSSIL_ENABLE_TCL |
| 1089 | TCC = $(TCC) /DFOSSIL_ENABLE_TCL=1 |
| 1090 | RCC = $(RCC) /DFOSSIL_ENABLE_TCL=1 |
| 1091 | TCC = $(TCC) /DFOSSIL_ENABLE_TCL_STUBS=1 |
| 1092 |
| --- src/makemake.tcl | |
| +++ src/makemake.tcl | |
| @@ -408,10 +408,14 @@ | |
| 408 | # FOSSIL_ENABLE_JSON = 1 |
| 409 | |
| 410 | #### Enable HTTPS support via OpenSSL (links to libssl and libcrypto) |
| 411 | # |
| 412 | # FOSSIL_ENABLE_SSL = 1 |
| 413 | |
| 414 | #### Enable hooks for commands and unknown web pages via TH1 |
| 415 | # |
| 416 | # FOSSIL_ENABLE_TH1_HOOKS = 1 |
| 417 | |
| 418 | #### Enable scripting support via Tcl/Tk |
| 419 | # |
| 420 | # FOSSIL_ENABLE_TCL = 1 |
| 421 | |
| @@ -537,10 +541,16 @@ | |
| 541 | # With HTTPS support |
| 542 | ifdef FOSSIL_ENABLE_SSL |
| 543 | TCC += -DFOSSIL_ENABLE_SSL=1 |
| 544 | RCC += -DFOSSIL_ENABLE_SSL=1 |
| 545 | endif |
| 546 | |
| 547 | # With TH1 hook support |
| 548 | ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 549 | TCC += -DFOSSIL_ENABLE_TH1_HOOKS=1 |
| 550 | RCC += -DFOSSIL_ENABLE_TH1_HOOKS=1 |
| 551 | endif |
| 552 | |
| 553 | # With Tcl support |
| 554 | ifdef FOSSIL_ENABLE_TCL |
| 555 | TCC += -DFOSSIL_ENABLE_TCL=1 |
| 556 | RCC += -DFOSSIL_ENABLE_TCL=1 |
| @@ -1024,10 +1034,13 @@ | |
| 1034 | # Uncomment to enable JSON API |
| 1035 | # FOSSIL_ENABLE_JSON = 1 |
| 1036 | |
| 1037 | # Uncomment to enable SSL support |
| 1038 | # FOSSIL_ENABLE_SSL = 1 |
| 1039 | |
| 1040 | # Uncomment to enable TH1 hooks |
| 1041 | # FOSSIL_ENABLE_TH1_HOOKS = 1 |
| 1042 | |
| 1043 | # Uncomment to enable Tcl support |
| 1044 | # FOSSIL_ENABLE_TCL = 1 |
| 1045 | |
| 1046 | !ifdef FOSSIL_ENABLE_SSL |
| @@ -1082,10 +1095,15 @@ | |
| 1095 | TCC = $(TCC) /DFOSSIL_ENABLE_SSL=1 |
| 1096 | RCC = $(RCC) /DFOSSIL_ENABLE_SSL=1 |
| 1097 | LIBS = $(LIBS) $(SSLLIB) |
| 1098 | LIBDIR = $(LIBDIR) /LIBPATH:$(SSLLIBDIR) |
| 1099 | !endif |
| 1100 | |
| 1101 | !ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 1102 | TCC = $(TCC) /DFOSSIL_ENABLE_TH1_HOOKS=1 |
| 1103 | RCC = $(RCC) /DFOSSIL_ENABLE_TH1_HOOKS=1 |
| 1104 | !endif |
| 1105 | |
| 1106 | !ifdef FOSSIL_ENABLE_TCL |
| 1107 | TCC = $(TCC) /DFOSSIL_ENABLE_TCL=1 |
| 1108 | RCC = $(RCC) /DFOSSIL_ENABLE_TCL=1 |
| 1109 | TCC = $(TCC) /DFOSSIL_ENABLE_TCL_STUBS=1 |
| 1110 |
+7
-1
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -31,21 +31,23 @@ | ||
| 31 | 31 | #define TH_INIT_NEED_CONFIG ((u32)0x00000001) /* Open configuration first? */ |
| 32 | 32 | #define TH_INIT_FORCE_TCL ((u32)0x00000002) /* Force Tcl to be enabled? */ |
| 33 | 33 | #define TH_INIT_FORCE_RESET ((u32)0x00000004) /* Force TH commands re-added? */ |
| 34 | 34 | #define TH_INIT_FORCE_SETUP ((u32)0x00000008) /* Force eval of setup script? */ |
| 35 | 35 | #define TH_INIT_DEFAULT (TH_INIT_NONE) /* Default flags. */ |
| 36 | -#define TH_INIT_HOOK (TH_INIT_NEED_CONFIG|TH_INIT_FORCE_SETUP) | |
| 36 | +#define TH_INIT_HOOK (TH_INIT_NEED_CONFIG | TH_INIT_FORCE_SETUP) | |
| 37 | 37 | #endif |
| 38 | 38 | |
| 39 | +#ifdef FOSSIL_ENABLE_TH1_HOOKS | |
| 39 | 40 | /* |
| 40 | 41 | ** These are the "well-known" TH1 error messages that occur when no hook is |
| 41 | 42 | ** registered to be called prior to executing a command or processing a web |
| 42 | 43 | ** page, respectively. If one of these errors is seen, it will not be sent |
| 43 | 44 | ** or displayed to the remote user or local interactive user, respectively. |
| 44 | 45 | */ |
| 45 | 46 | #define NO_COMMAND_HOOK_ERROR "no such command: command_hook" |
| 46 | 47 | #define NO_WEBPAGE_HOOK_ERROR "no such command: webpage_hook" |
| 48 | +#endif | |
| 47 | 49 | |
| 48 | 50 | /* |
| 49 | 51 | ** Global variable counting the number of outstanding calls to malloc() |
| 50 | 52 | ** made by the th1 implementation. This is used to catch memory leaks |
| 51 | 53 | ** in the interpreter. Obviously, it also means th1 is not threadsafe. |
| @@ -1191,10 +1193,11 @@ | ||
| 1191 | 1193 | i += 2; |
| 1192 | 1194 | } |
| 1193 | 1195 | return i; |
| 1194 | 1196 | } |
| 1195 | 1197 | |
| 1198 | +#ifdef FOSSIL_ENABLE_TH1_HOOKS | |
| 1196 | 1199 | /* |
| 1197 | 1200 | ** This function is called by Fossil just prior to dispatching a command. |
| 1198 | 1201 | ** Returning a value other than TH_OK from this function (i.e. via an |
| 1199 | 1202 | ** evaluated script raising an error or calling [break]/[continue]) will |
| 1200 | 1203 | ** cause the actual command execution to be skipped. |
| @@ -1316,10 +1319,11 @@ | ||
| 1316 | 1319 | Th_Trace("[webpage_notify {%h}] => %h<br />\n", zName, |
| 1317 | 1320 | Th_ReturnCodeName(rc, 0)); |
| 1318 | 1321 | } |
| 1319 | 1322 | return rc; |
| 1320 | 1323 | } |
| 1324 | +#endif | |
| 1321 | 1325 | |
| 1322 | 1326 | /* |
| 1323 | 1327 | ** The z[] input contains text mixed with TH1 scripts. |
| 1324 | 1328 | ** The TH1 scripts are contained within <th1>...</th1>. |
| 1325 | 1329 | ** TH1 variables are $aaa or $<aaa>. The first form of |
| @@ -1419,10 +1423,11 @@ | ||
| 1419 | 1423 | zRc = Th_ReturnCodeName(rc, 1); |
| 1420 | 1424 | fossil_print("%s%s%s\n", zRc, zRc ? ": " : "", Th_GetResult(g.interp, 0)); |
| 1421 | 1425 | Th_PrintTraceLog(); |
| 1422 | 1426 | } |
| 1423 | 1427 | |
| 1428 | +#ifdef FOSSIL_ENABLE_TH1_HOOKS | |
| 1424 | 1429 | /* |
| 1425 | 1430 | ** COMMAND: test-th-hook |
| 1426 | 1431 | */ |
| 1427 | 1432 | void test_th_hook(void){ |
| 1428 | 1433 | int rc = TH_OK; |
| @@ -1447,5 +1452,6 @@ | ||
| 1447 | 1452 | sendText(Th_ReturnCodeName(rc, 0), -1, 0); |
| 1448 | 1453 | sendText("): ", -1, 0); |
| 1449 | 1454 | sendText(zResult, nResult, 0); |
| 1450 | 1455 | sendText("\n", -1, 0); |
| 1451 | 1456 | } |
| 1457 | +#endif | |
| 1452 | 1458 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -31,21 +31,23 @@ | |
| 31 | #define TH_INIT_NEED_CONFIG ((u32)0x00000001) /* Open configuration first? */ |
| 32 | #define TH_INIT_FORCE_TCL ((u32)0x00000002) /* Force Tcl to be enabled? */ |
| 33 | #define TH_INIT_FORCE_RESET ((u32)0x00000004) /* Force TH commands re-added? */ |
| 34 | #define TH_INIT_FORCE_SETUP ((u32)0x00000008) /* Force eval of setup script? */ |
| 35 | #define TH_INIT_DEFAULT (TH_INIT_NONE) /* Default flags. */ |
| 36 | #define TH_INIT_HOOK (TH_INIT_NEED_CONFIG|TH_INIT_FORCE_SETUP) |
| 37 | #endif |
| 38 | |
| 39 | /* |
| 40 | ** These are the "well-known" TH1 error messages that occur when no hook is |
| 41 | ** registered to be called prior to executing a command or processing a web |
| 42 | ** page, respectively. If one of these errors is seen, it will not be sent |
| 43 | ** or displayed to the remote user or local interactive user, respectively. |
| 44 | */ |
| 45 | #define NO_COMMAND_HOOK_ERROR "no such command: command_hook" |
| 46 | #define NO_WEBPAGE_HOOK_ERROR "no such command: webpage_hook" |
| 47 | |
| 48 | /* |
| 49 | ** Global variable counting the number of outstanding calls to malloc() |
| 50 | ** made by the th1 implementation. This is used to catch memory leaks |
| 51 | ** in the interpreter. Obviously, it also means th1 is not threadsafe. |
| @@ -1191,10 +1193,11 @@ | |
| 1191 | i += 2; |
| 1192 | } |
| 1193 | return i; |
| 1194 | } |
| 1195 | |
| 1196 | /* |
| 1197 | ** This function is called by Fossil just prior to dispatching a command. |
| 1198 | ** Returning a value other than TH_OK from this function (i.e. via an |
| 1199 | ** evaluated script raising an error or calling [break]/[continue]) will |
| 1200 | ** cause the actual command execution to be skipped. |
| @@ -1316,10 +1319,11 @@ | |
| 1316 | Th_Trace("[webpage_notify {%h}] => %h<br />\n", zName, |
| 1317 | Th_ReturnCodeName(rc, 0)); |
| 1318 | } |
| 1319 | return rc; |
| 1320 | } |
| 1321 | |
| 1322 | /* |
| 1323 | ** The z[] input contains text mixed with TH1 scripts. |
| 1324 | ** The TH1 scripts are contained within <th1>...</th1>. |
| 1325 | ** TH1 variables are $aaa or $<aaa>. The first form of |
| @@ -1419,10 +1423,11 @@ | |
| 1419 | zRc = Th_ReturnCodeName(rc, 1); |
| 1420 | fossil_print("%s%s%s\n", zRc, zRc ? ": " : "", Th_GetResult(g.interp, 0)); |
| 1421 | Th_PrintTraceLog(); |
| 1422 | } |
| 1423 | |
| 1424 | /* |
| 1425 | ** COMMAND: test-th-hook |
| 1426 | */ |
| 1427 | void test_th_hook(void){ |
| 1428 | int rc = TH_OK; |
| @@ -1447,5 +1452,6 @@ | |
| 1447 | sendText(Th_ReturnCodeName(rc, 0), -1, 0); |
| 1448 | sendText("): ", -1, 0); |
| 1449 | sendText(zResult, nResult, 0); |
| 1450 | sendText("\n", -1, 0); |
| 1451 | } |
| 1452 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -31,21 +31,23 @@ | |
| 31 | #define TH_INIT_NEED_CONFIG ((u32)0x00000001) /* Open configuration first? */ |
| 32 | #define TH_INIT_FORCE_TCL ((u32)0x00000002) /* Force Tcl to be enabled? */ |
| 33 | #define TH_INIT_FORCE_RESET ((u32)0x00000004) /* Force TH commands re-added? */ |
| 34 | #define TH_INIT_FORCE_SETUP ((u32)0x00000008) /* Force eval of setup script? */ |
| 35 | #define TH_INIT_DEFAULT (TH_INIT_NONE) /* Default flags. */ |
| 36 | #define TH_INIT_HOOK (TH_INIT_NEED_CONFIG | TH_INIT_FORCE_SETUP) |
| 37 | #endif |
| 38 | |
| 39 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 40 | /* |
| 41 | ** These are the "well-known" TH1 error messages that occur when no hook is |
| 42 | ** registered to be called prior to executing a command or processing a web |
| 43 | ** page, respectively. If one of these errors is seen, it will not be sent |
| 44 | ** or displayed to the remote user or local interactive user, respectively. |
| 45 | */ |
| 46 | #define NO_COMMAND_HOOK_ERROR "no such command: command_hook" |
| 47 | #define NO_WEBPAGE_HOOK_ERROR "no such command: webpage_hook" |
| 48 | #endif |
| 49 | |
| 50 | /* |
| 51 | ** Global variable counting the number of outstanding calls to malloc() |
| 52 | ** made by the th1 implementation. This is used to catch memory leaks |
| 53 | ** in the interpreter. Obviously, it also means th1 is not threadsafe. |
| @@ -1191,10 +1193,11 @@ | |
| 1193 | i += 2; |
| 1194 | } |
| 1195 | return i; |
| 1196 | } |
| 1197 | |
| 1198 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 1199 | /* |
| 1200 | ** This function is called by Fossil just prior to dispatching a command. |
| 1201 | ** Returning a value other than TH_OK from this function (i.e. via an |
| 1202 | ** evaluated script raising an error or calling [break]/[continue]) will |
| 1203 | ** cause the actual command execution to be skipped. |
| @@ -1316,10 +1319,11 @@ | |
| 1319 | Th_Trace("[webpage_notify {%h}] => %h<br />\n", zName, |
| 1320 | Th_ReturnCodeName(rc, 0)); |
| 1321 | } |
| 1322 | return rc; |
| 1323 | } |
| 1324 | #endif |
| 1325 | |
| 1326 | /* |
| 1327 | ** The z[] input contains text mixed with TH1 scripts. |
| 1328 | ** The TH1 scripts are contained within <th1>...</th1>. |
| 1329 | ** TH1 variables are $aaa or $<aaa>. The first form of |
| @@ -1419,10 +1423,11 @@ | |
| 1423 | zRc = Th_ReturnCodeName(rc, 1); |
| 1424 | fossil_print("%s%s%s\n", zRc, zRc ? ": " : "", Th_GetResult(g.interp, 0)); |
| 1425 | Th_PrintTraceLog(); |
| 1426 | } |
| 1427 | |
| 1428 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 1429 | /* |
| 1430 | ** COMMAND: test-th-hook |
| 1431 | */ |
| 1432 | void test_th_hook(void){ |
| 1433 | int rc = TH_OK; |
| @@ -1447,5 +1452,6 @@ | |
| 1452 | sendText(Th_ReturnCodeName(rc, 0), -1, 0); |
| 1453 | sendText("): ", -1, 0); |
| 1454 | sendText(zResult, nResult, 0); |
| 1455 | sendText("\n", -1, 0); |
| 1456 | } |
| 1457 | #endif |
| 1458 |
+10
| --- win/Makefile.mingw | ||
| +++ win/Makefile.mingw | ||
| @@ -47,10 +47,14 @@ | ||
| 47 | 47 | # FOSSIL_ENABLE_JSON = 1 |
| 48 | 48 | |
| 49 | 49 | #### Enable HTTPS support via OpenSSL (links to libssl and libcrypto) |
| 50 | 50 | # |
| 51 | 51 | # FOSSIL_ENABLE_SSL = 1 |
| 52 | + | |
| 53 | +#### Enable hooks for commands and unknown web pages via TH1 | |
| 54 | +# | |
| 55 | +# FOSSIL_ENABLE_TH1_HOOKS = 1 | |
| 52 | 56 | |
| 53 | 57 | #### Enable scripting support via Tcl/Tk |
| 54 | 58 | # |
| 55 | 59 | # FOSSIL_ENABLE_TCL = 1 |
| 56 | 60 | |
| @@ -176,10 +180,16 @@ | ||
| 176 | 180 | # With HTTPS support |
| 177 | 181 | ifdef FOSSIL_ENABLE_SSL |
| 178 | 182 | TCC += -DFOSSIL_ENABLE_SSL=1 |
| 179 | 183 | RCC += -DFOSSIL_ENABLE_SSL=1 |
| 180 | 184 | endif |
| 185 | + | |
| 186 | +# With TH1 hook support | |
| 187 | +ifdef FOSSIL_ENABLE_TH1_HOOKS | |
| 188 | +TCC += -DFOSSIL_ENABLE_TH1_HOOKS=1 | |
| 189 | +RCC += -DFOSSIL_ENABLE_TH1_HOOKS=1 | |
| 190 | +endif | |
| 181 | 191 | |
| 182 | 192 | # With Tcl support |
| 183 | 193 | ifdef FOSSIL_ENABLE_TCL |
| 184 | 194 | TCC += -DFOSSIL_ENABLE_TCL=1 |
| 185 | 195 | RCC += -DFOSSIL_ENABLE_TCL=1 |
| 186 | 196 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -47,10 +47,14 @@ | |
| 47 | # FOSSIL_ENABLE_JSON = 1 |
| 48 | |
| 49 | #### Enable HTTPS support via OpenSSL (links to libssl and libcrypto) |
| 50 | # |
| 51 | # FOSSIL_ENABLE_SSL = 1 |
| 52 | |
| 53 | #### Enable scripting support via Tcl/Tk |
| 54 | # |
| 55 | # FOSSIL_ENABLE_TCL = 1 |
| 56 | |
| @@ -176,10 +180,16 @@ | |
| 176 | # With HTTPS support |
| 177 | ifdef FOSSIL_ENABLE_SSL |
| 178 | TCC += -DFOSSIL_ENABLE_SSL=1 |
| 179 | RCC += -DFOSSIL_ENABLE_SSL=1 |
| 180 | endif |
| 181 | |
| 182 | # With Tcl support |
| 183 | ifdef FOSSIL_ENABLE_TCL |
| 184 | TCC += -DFOSSIL_ENABLE_TCL=1 |
| 185 | RCC += -DFOSSIL_ENABLE_TCL=1 |
| 186 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -47,10 +47,14 @@ | |
| 47 | # FOSSIL_ENABLE_JSON = 1 |
| 48 | |
| 49 | #### Enable HTTPS support via OpenSSL (links to libssl and libcrypto) |
| 50 | # |
| 51 | # FOSSIL_ENABLE_SSL = 1 |
| 52 | |
| 53 | #### Enable hooks for commands and unknown web pages via TH1 |
| 54 | # |
| 55 | # FOSSIL_ENABLE_TH1_HOOKS = 1 |
| 56 | |
| 57 | #### Enable scripting support via Tcl/Tk |
| 58 | # |
| 59 | # FOSSIL_ENABLE_TCL = 1 |
| 60 | |
| @@ -176,10 +180,16 @@ | |
| 180 | # With HTTPS support |
| 181 | ifdef FOSSIL_ENABLE_SSL |
| 182 | TCC += -DFOSSIL_ENABLE_SSL=1 |
| 183 | RCC += -DFOSSIL_ENABLE_SSL=1 |
| 184 | endif |
| 185 | |
| 186 | # With TH1 hook support |
| 187 | ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 188 | TCC += -DFOSSIL_ENABLE_TH1_HOOKS=1 |
| 189 | RCC += -DFOSSIL_ENABLE_TH1_HOOKS=1 |
| 190 | endif |
| 191 | |
| 192 | # With Tcl support |
| 193 | ifdef FOSSIL_ENABLE_TCL |
| 194 | TCC += -DFOSSIL_ENABLE_TCL=1 |
| 195 | RCC += -DFOSSIL_ENABLE_TCL=1 |
| 196 |
| --- win/Makefile.mingw.mistachkin | ||
| +++ win/Makefile.mingw.mistachkin | ||
| @@ -47,10 +47,14 @@ | ||
| 47 | 47 | FOSSIL_ENABLE_JSON = 1 |
| 48 | 48 | |
| 49 | 49 | #### Enable HTTPS support via OpenSSL (links to libssl and libcrypto) |
| 50 | 50 | # |
| 51 | 51 | FOSSIL_ENABLE_SSL = 1 |
| 52 | + | |
| 53 | +#### Enable hooks for commands and unknown web pages via TH1 | |
| 54 | +# | |
| 55 | +FOSSIL_ENABLE_TH1_HOOKS = 1 | |
| 52 | 56 | |
| 53 | 57 | #### Enable scripting support via Tcl/Tk |
| 54 | 58 | # |
| 55 | 59 | FOSSIL_ENABLE_TCL = 1 |
| 56 | 60 | |
| @@ -176,10 +180,16 @@ | ||
| 176 | 180 | # With HTTPS support |
| 177 | 181 | ifdef FOSSIL_ENABLE_SSL |
| 178 | 182 | TCC += -DFOSSIL_ENABLE_SSL=1 |
| 179 | 183 | RCC += -DFOSSIL_ENABLE_SSL=1 |
| 180 | 184 | endif |
| 185 | + | |
| 186 | +# With TH1 hook support | |
| 187 | +ifdef FOSSIL_ENABLE_TH1_HOOKS | |
| 188 | +TCC += -DFOSSIL_ENABLE_TH1_HOOKS=1 | |
| 189 | +RCC += -DFOSSIL_ENABLE_TH1_HOOKS=1 | |
| 190 | +endif | |
| 181 | 191 | |
| 182 | 192 | # With Tcl support |
| 183 | 193 | ifdef FOSSIL_ENABLE_TCL |
| 184 | 194 | TCC += -DFOSSIL_ENABLE_TCL=1 |
| 185 | 195 | RCC += -DFOSSIL_ENABLE_TCL=1 |
| 186 | 196 |
| --- win/Makefile.mingw.mistachkin | |
| +++ win/Makefile.mingw.mistachkin | |
| @@ -47,10 +47,14 @@ | |
| 47 | FOSSIL_ENABLE_JSON = 1 |
| 48 | |
| 49 | #### Enable HTTPS support via OpenSSL (links to libssl and libcrypto) |
| 50 | # |
| 51 | FOSSIL_ENABLE_SSL = 1 |
| 52 | |
| 53 | #### Enable scripting support via Tcl/Tk |
| 54 | # |
| 55 | FOSSIL_ENABLE_TCL = 1 |
| 56 | |
| @@ -176,10 +180,16 @@ | |
| 176 | # With HTTPS support |
| 177 | ifdef FOSSIL_ENABLE_SSL |
| 178 | TCC += -DFOSSIL_ENABLE_SSL=1 |
| 179 | RCC += -DFOSSIL_ENABLE_SSL=1 |
| 180 | endif |
| 181 | |
| 182 | # With Tcl support |
| 183 | ifdef FOSSIL_ENABLE_TCL |
| 184 | TCC += -DFOSSIL_ENABLE_TCL=1 |
| 185 | RCC += -DFOSSIL_ENABLE_TCL=1 |
| 186 |
| --- win/Makefile.mingw.mistachkin | |
| +++ win/Makefile.mingw.mistachkin | |
| @@ -47,10 +47,14 @@ | |
| 47 | FOSSIL_ENABLE_JSON = 1 |
| 48 | |
| 49 | #### Enable HTTPS support via OpenSSL (links to libssl and libcrypto) |
| 50 | # |
| 51 | FOSSIL_ENABLE_SSL = 1 |
| 52 | |
| 53 | #### Enable hooks for commands and unknown web pages via TH1 |
| 54 | # |
| 55 | FOSSIL_ENABLE_TH1_HOOKS = 1 |
| 56 | |
| 57 | #### Enable scripting support via Tcl/Tk |
| 58 | # |
| 59 | FOSSIL_ENABLE_TCL = 1 |
| 60 | |
| @@ -176,10 +180,16 @@ | |
| 180 | # With HTTPS support |
| 181 | ifdef FOSSIL_ENABLE_SSL |
| 182 | TCC += -DFOSSIL_ENABLE_SSL=1 |
| 183 | RCC += -DFOSSIL_ENABLE_SSL=1 |
| 184 | endif |
| 185 | |
| 186 | # With TH1 hook support |
| 187 | ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 188 | TCC += -DFOSSIL_ENABLE_TH1_HOOKS=1 |
| 189 | RCC += -DFOSSIL_ENABLE_TH1_HOOKS=1 |
| 190 | endif |
| 191 | |
| 192 | # With Tcl support |
| 193 | ifdef FOSSIL_ENABLE_TCL |
| 194 | TCC += -DFOSSIL_ENABLE_TCL=1 |
| 195 | RCC += -DFOSSIL_ENABLE_TCL=1 |
| 196 |
+8
| --- win/Makefile.msc | ||
| +++ win/Makefile.msc | ||
| @@ -21,10 +21,13 @@ | ||
| 21 | 21 | # Uncomment to enable JSON API |
| 22 | 22 | # FOSSIL_ENABLE_JSON = 1 |
| 23 | 23 | |
| 24 | 24 | # Uncomment to enable SSL support |
| 25 | 25 | # FOSSIL_ENABLE_SSL = 1 |
| 26 | + | |
| 27 | +# Uncomment to enable TH1 hooks | |
| 28 | +# FOSSIL_ENABLE_TH1_HOOKS = 1 | |
| 26 | 29 | |
| 27 | 30 | # Uncomment to enable Tcl support |
| 28 | 31 | # FOSSIL_ENABLE_TCL = 1 |
| 29 | 32 | |
| 30 | 33 | !ifdef FOSSIL_ENABLE_SSL |
| @@ -79,10 +82,15 @@ | ||
| 79 | 82 | TCC = $(TCC) /DFOSSIL_ENABLE_SSL=1 |
| 80 | 83 | RCC = $(RCC) /DFOSSIL_ENABLE_SSL=1 |
| 81 | 84 | LIBS = $(LIBS) $(SSLLIB) |
| 82 | 85 | LIBDIR = $(LIBDIR) /LIBPATH:$(SSLLIBDIR) |
| 83 | 86 | !endif |
| 87 | + | |
| 88 | +!ifdef FOSSIL_ENABLE_TH1_HOOKS | |
| 89 | +TCC = $(TCC) /DFOSSIL_ENABLE_TH1_HOOKS=1 | |
| 90 | +RCC = $(RCC) /DFOSSIL_ENABLE_TH1_HOOKS=1 | |
| 91 | +!endif | |
| 84 | 92 | |
| 85 | 93 | !ifdef FOSSIL_ENABLE_TCL |
| 86 | 94 | TCC = $(TCC) /DFOSSIL_ENABLE_TCL=1 |
| 87 | 95 | RCC = $(RCC) /DFOSSIL_ENABLE_TCL=1 |
| 88 | 96 | TCC = $(TCC) /DFOSSIL_ENABLE_TCL_STUBS=1 |
| 89 | 97 |
| --- win/Makefile.msc | |
| +++ win/Makefile.msc | |
| @@ -21,10 +21,13 @@ | |
| 21 | # Uncomment to enable JSON API |
| 22 | # FOSSIL_ENABLE_JSON = 1 |
| 23 | |
| 24 | # Uncomment to enable SSL support |
| 25 | # FOSSIL_ENABLE_SSL = 1 |
| 26 | |
| 27 | # Uncomment to enable Tcl support |
| 28 | # FOSSIL_ENABLE_TCL = 1 |
| 29 | |
| 30 | !ifdef FOSSIL_ENABLE_SSL |
| @@ -79,10 +82,15 @@ | |
| 79 | TCC = $(TCC) /DFOSSIL_ENABLE_SSL=1 |
| 80 | RCC = $(RCC) /DFOSSIL_ENABLE_SSL=1 |
| 81 | LIBS = $(LIBS) $(SSLLIB) |
| 82 | LIBDIR = $(LIBDIR) /LIBPATH:$(SSLLIBDIR) |
| 83 | !endif |
| 84 | |
| 85 | !ifdef FOSSIL_ENABLE_TCL |
| 86 | TCC = $(TCC) /DFOSSIL_ENABLE_TCL=1 |
| 87 | RCC = $(RCC) /DFOSSIL_ENABLE_TCL=1 |
| 88 | TCC = $(TCC) /DFOSSIL_ENABLE_TCL_STUBS=1 |
| 89 |
| --- win/Makefile.msc | |
| +++ win/Makefile.msc | |
| @@ -21,10 +21,13 @@ | |
| 21 | # Uncomment to enable JSON API |
| 22 | # FOSSIL_ENABLE_JSON = 1 |
| 23 | |
| 24 | # Uncomment to enable SSL support |
| 25 | # FOSSIL_ENABLE_SSL = 1 |
| 26 | |
| 27 | # Uncomment to enable TH1 hooks |
| 28 | # FOSSIL_ENABLE_TH1_HOOKS = 1 |
| 29 | |
| 30 | # Uncomment to enable Tcl support |
| 31 | # FOSSIL_ENABLE_TCL = 1 |
| 32 | |
| 33 | !ifdef FOSSIL_ENABLE_SSL |
| @@ -79,10 +82,15 @@ | |
| 82 | TCC = $(TCC) /DFOSSIL_ENABLE_SSL=1 |
| 83 | RCC = $(RCC) /DFOSSIL_ENABLE_SSL=1 |
| 84 | LIBS = $(LIBS) $(SSLLIB) |
| 85 | LIBDIR = $(LIBDIR) /LIBPATH:$(SSLLIBDIR) |
| 86 | !endif |
| 87 | |
| 88 | !ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 89 | TCC = $(TCC) /DFOSSIL_ENABLE_TH1_HOOKS=1 |
| 90 | RCC = $(RCC) /DFOSSIL_ENABLE_TH1_HOOKS=1 |
| 91 | !endif |
| 92 | |
| 93 | !ifdef FOSSIL_ENABLE_TCL |
| 94 | TCC = $(TCC) /DFOSSIL_ENABLE_TCL=1 |
| 95 | RCC = $(RCC) /DFOSSIL_ENABLE_TCL=1 |
| 96 | TCC = $(TCC) /DFOSSIL_ENABLE_TCL_STUBS=1 |
| 97 |
+5
| --- win/fossil.rc | ||
| +++ win/fossil.rc | ||
| @@ -101,10 +101,15 @@ | ||
| 101 | 101 | VALUE "CommandLineIsUnicode", "Yes\0" |
| 102 | 102 | #endif /* defined(BROKEN_MINGW_CMDLINE) */ |
| 103 | 103 | #if defined(FOSSIL_ENABLE_SSL) |
| 104 | 104 | VALUE "SslEnabled", "Yes, " OPENSSL_VERSION_TEXT "\0" |
| 105 | 105 | #endif /* defined(FOSSIL_ENABLE_SSL) */ |
| 106 | +#if defined(FOSSIL_ENABLE_TH1_HOOKS) | |
| 107 | + VALUE "Th1Hooks", "Yes\0" | |
| 108 | +#else | |
| 109 | + VALUE "Th1Hooks", "No\0" | |
| 110 | +#endif | |
| 106 | 111 | #if defined(FOSSIL_ENABLE_TCL) |
| 107 | 112 | VALUE "TclEnabled", "Yes, Tcl " TCL_PATCH_LEVEL "\0" |
| 108 | 113 | #if defined(USE_TCL_STUBS) |
| 109 | 114 | VALUE "UseTclStubsEnabled", "Yes\0" |
| 110 | 115 | #else |
| 111 | 116 |
| --- win/fossil.rc | |
| +++ win/fossil.rc | |
| @@ -101,10 +101,15 @@ | |
| 101 | VALUE "CommandLineIsUnicode", "Yes\0" |
| 102 | #endif /* defined(BROKEN_MINGW_CMDLINE) */ |
| 103 | #if defined(FOSSIL_ENABLE_SSL) |
| 104 | VALUE "SslEnabled", "Yes, " OPENSSL_VERSION_TEXT "\0" |
| 105 | #endif /* defined(FOSSIL_ENABLE_SSL) */ |
| 106 | #if defined(FOSSIL_ENABLE_TCL) |
| 107 | VALUE "TclEnabled", "Yes, Tcl " TCL_PATCH_LEVEL "\0" |
| 108 | #if defined(USE_TCL_STUBS) |
| 109 | VALUE "UseTclStubsEnabled", "Yes\0" |
| 110 | #else |
| 111 |
| --- win/fossil.rc | |
| +++ win/fossil.rc | |
| @@ -101,10 +101,15 @@ | |
| 101 | VALUE "CommandLineIsUnicode", "Yes\0" |
| 102 | #endif /* defined(BROKEN_MINGW_CMDLINE) */ |
| 103 | #if defined(FOSSIL_ENABLE_SSL) |
| 104 | VALUE "SslEnabled", "Yes, " OPENSSL_VERSION_TEXT "\0" |
| 105 | #endif /* defined(FOSSIL_ENABLE_SSL) */ |
| 106 | #if defined(FOSSIL_ENABLE_TH1_HOOKS) |
| 107 | VALUE "Th1Hooks", "Yes\0" |
| 108 | #else |
| 109 | VALUE "Th1Hooks", "No\0" |
| 110 | #endif |
| 111 | #if defined(FOSSIL_ENABLE_TCL) |
| 112 | VALUE "TclEnabled", "Yes, Tcl " TCL_PATCH_LEVEL "\0" |
| 113 | #if defined(USE_TCL_STUBS) |
| 114 | VALUE "UseTclStubsEnabled", "Yes\0" |
| 115 | #else |
| 116 |