Fossil SCM
In the "fossil diff" command, the use of --tclsh implies --tk.
Commit
2655a2d405ac3c5000820a74574f9d6136faafaacc807b1d73d2fefbc819db56
Parent
9fc945c056ac3da…
2 files changed
+1
-1
+16
+1
-1
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -855,11 +855,11 @@ | ||
| 855 | 855 | int fIncludeBinary = 0; /* Include binary files for external diff */ |
| 856 | 856 | int againstUndo = 0; /* Diff against files in the undo buffer */ |
| 857 | 857 | u64 diffFlags = 0; /* Flags to control the DIFF */ |
| 858 | 858 | FileDirList *pFileDir = 0; /* Restrict the diff to these files */ |
| 859 | 859 | |
| 860 | - if( find_option("tk",0,0)!=0 ){ | |
| 860 | + if( find_option("tk",0,0)!=0 || has_option("tclsh") ){ | |
| 861 | 861 | diff_tk("diff", 2); |
| 862 | 862 | return; |
| 863 | 863 | } |
| 864 | 864 | isGDiff = g.argv[1][0]=='g'; |
| 865 | 865 | isInternDiff = find_option("internal","i",0)!=0; |
| 866 | 866 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -855,11 +855,11 @@ | |
| 855 | int fIncludeBinary = 0; /* Include binary files for external diff */ |
| 856 | int againstUndo = 0; /* Diff against files in the undo buffer */ |
| 857 | u64 diffFlags = 0; /* Flags to control the DIFF */ |
| 858 | FileDirList *pFileDir = 0; /* Restrict the diff to these files */ |
| 859 | |
| 860 | if( find_option("tk",0,0)!=0 ){ |
| 861 | diff_tk("diff", 2); |
| 862 | return; |
| 863 | } |
| 864 | isGDiff = g.argv[1][0]=='g'; |
| 865 | isInternDiff = find_option("internal","i",0)!=0; |
| 866 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -855,11 +855,11 @@ | |
| 855 | int fIncludeBinary = 0; /* Include binary files for external diff */ |
| 856 | int againstUndo = 0; /* Diff against files in the undo buffer */ |
| 857 | u64 diffFlags = 0; /* Flags to control the DIFF */ |
| 858 | FileDirList *pFileDir = 0; /* Restrict the diff to these files */ |
| 859 | |
| 860 | if( find_option("tk",0,0)!=0 || has_option("tclsh") ){ |
| 861 | diff_tk("diff", 2); |
| 862 | return; |
| 863 | } |
| 864 | isGDiff = g.argv[1][0]=='g'; |
| 865 | isInternDiff = find_option("internal","i",0)!=0; |
| 866 |
+16
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -921,10 +921,26 @@ | ||
| 921 | 921 | break; |
| 922 | 922 | } |
| 923 | 923 | } |
| 924 | 924 | return zReturn; |
| 925 | 925 | } |
| 926 | + | |
| 927 | +/* Return true if zOption exists in the command-line arguments, | |
| 928 | +** but do not remove it from the list or otherwise process it. | |
| 929 | +*/ | |
| 930 | +int has_option(const char *zOption){ | |
| 931 | + int i; | |
| 932 | + int n = (int)strlen(zOption); | |
| 933 | + for(i=1; i<g.argc; i++){ | |
| 934 | + char *z = g.argv[i]; | |
| 935 | + if( z[0]!='-' ) continue; | |
| 936 | + z++; | |
| 937 | + if( z[0]=='-' ) z++; | |
| 938 | + if( strncmp(z,zOption,n)==0 && (z[n]==0 || z[n]=='=') ) return 1; | |
| 939 | + } | |
| 940 | + return 0; | |
| 941 | +} | |
| 926 | 942 | |
| 927 | 943 | /* |
| 928 | 944 | ** Look for multiple occurrences of a command-line option with the |
| 929 | 945 | ** corresponding argument. |
| 930 | 946 | ** |
| 931 | 947 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -921,10 +921,26 @@ | |
| 921 | break; |
| 922 | } |
| 923 | } |
| 924 | return zReturn; |
| 925 | } |
| 926 | |
| 927 | /* |
| 928 | ** Look for multiple occurrences of a command-line option with the |
| 929 | ** corresponding argument. |
| 930 | ** |
| 931 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -921,10 +921,26 @@ | |
| 921 | break; |
| 922 | } |
| 923 | } |
| 924 | return zReturn; |
| 925 | } |
| 926 | |
| 927 | /* Return true if zOption exists in the command-line arguments, |
| 928 | ** but do not remove it from the list or otherwise process it. |
| 929 | */ |
| 930 | int has_option(const char *zOption){ |
| 931 | int i; |
| 932 | int n = (int)strlen(zOption); |
| 933 | for(i=1; i<g.argc; i++){ |
| 934 | char *z = g.argv[i]; |
| 935 | if( z[0]!='-' ) continue; |
| 936 | z++; |
| 937 | if( z[0]=='-' ) z++; |
| 938 | if( strncmp(z,zOption,n)==0 && (z[n]==0 || z[n]=='=') ) return 1; |
| 939 | } |
| 940 | return 0; |
| 941 | } |
| 942 | |
| 943 | /* |
| 944 | ** Look for multiple occurrences of a command-line option with the |
| 945 | ** corresponding argument. |
| 946 | ** |
| 947 |