Fossil SCM

In the "fossil diff" command, the use of --tclsh implies --tk.

drh 2019-06-30 03:38 trunk
Commit 2655a2d405ac3c5000820a74574f9d6136faafaacc807b1d73d2fefbc819db56
2 files changed +1 -1 +16
+1 -1
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -855,11 +855,11 @@
855855
int fIncludeBinary = 0; /* Include binary files for external diff */
856856
int againstUndo = 0; /* Diff against files in the undo buffer */
857857
u64 diffFlags = 0; /* Flags to control the DIFF */
858858
FileDirList *pFileDir = 0; /* Restrict the diff to these files */
859859
860
- if( find_option("tk",0,0)!=0 ){
860
+ if( find_option("tk",0,0)!=0 || has_option("tclsh") ){
861861
diff_tk("diff", 2);
862862
return;
863863
}
864864
isGDiff = g.argv[1][0]=='g';
865865
isInternDiff = find_option("internal","i",0)!=0;
866866
--- 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 @@
921921
break;
922922
}
923923
}
924924
return zReturn;
925925
}
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
+}
926942
927943
/*
928944
** Look for multiple occurrences of a command-line option with the
929945
** corresponding argument.
930946
**
931947
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button