aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2012-08-20 16:23:36 +0000
committerdrh <drh@noemail.net>2012-08-20 16:23:36 +0000
commita6b0a9cb80be192265c0f63e0befd169558c0f7b (patch)
tree777b17710566c7b5506a1d0b0aa1be2178a900db
parentfc30b042aab5550ac3a9fb2202dc6d08c9a41981 (diff)
downloadsqlite-a6b0a9cb80be192265c0f63e0befd169558c0f7b.tar.gz
sqlite-a6b0a9cb80be192265c0f63e0befd169558c0f7b.zip
Change the checkSpacing utility program to ignore whitespace at end-of-line
unless the --wseol option is used. FossilOrigin-Name: be1faadebd9464f1c7d4cc26104f219ed35384b8
-rw-r--r--manifest12
-rw-r--r--manifest.uuid2
-rw-r--r--tool/checkSpacing.c31
3 files changed, 31 insertions, 14 deletions
diff --git a/manifest b/manifest
index d84c1121c..dd02782d4 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Silence\sharmless\scompiler\swarnings\sin\sthe\stest\scode.
-D 2012-08-20T16:08:29.473
+C Change\sthe\scheckSpacing\sutility\sprogram\sto\signore\swhitespace\sat\send-of-line\nunless\sthe\s--wseol\soption\sis\sused.
+D 2012-08-20T16:23:36.995
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in abd5c10d21d1395f140d9e50ea999df8fa4d6376
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -970,7 +970,7 @@ F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688
F test/zerodamage.test 0de750389990b1078bab203c712dc3fefd1d8b82
F tool/build-all-msvc.bat 1a18aa39983ae7354d834bc55a850a54fc007576 x
F tool/build-shell.sh b64a481901fc9ffe5ca8812a2a9255b6cfb77381
-F tool/checkSpacing.c 7971696f2749897ea3a7fd6431297a607934aa80
+F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
F tool/extract.c 054069d81b095fbdc189a6f5d4466e40380505e2
F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439
@@ -1011,7 +1011,7 @@ F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 67d8a99aceb56384a81b3f30d6c71743146d2cc9
-P 7edd10a960d5ff121e470b0549b0aa9fb7760022
-R a7c7fd498f14b2f1551a5ff041e6fb79
+P 7653973a525638b5e5e70ea8459f64e1a88befca
+R a5b8e6d2b4446ec76e5e5bca66913847
U drh
-Z 5fc0a92ff802ba7cd0b5d9f1b3ae83c1
+Z 527e591104d273b6a0b9a4827096d42e
diff --git a/manifest.uuid b/manifest.uuid
index 2333f305a..ac2e61e5f 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-7653973a525638b5e5e70ea8459f64e1a88befca \ No newline at end of file
+be1faadebd9464f1c7d4cc26104f219ed35384b8 \ No newline at end of file
diff --git a/tool/checkSpacing.c b/tool/checkSpacing.c
index 4cc289f18..ce38b08ce 100644
--- a/tool/checkSpacing.c
+++ b/tool/checkSpacing.c
@@ -11,7 +11,10 @@
#include <stdlib.h>
#include <string.h>
-static void checkSpacing(const char *zFile, int crok){
+#define CR_OK 0x001
+#define WSEOL_OK 0x002
+
+static void checkSpacing(const char *zFile, unsigned flags){
FILE *in = fopen(zFile, "rb");
int i;
int seenSpace;
@@ -32,7 +35,7 @@ static void checkSpacing(const char *zFile, int crok){
printf("%s:%d: tab (\\t) character\n", zFile, ln);
seenTab = 1;
}else if( zLine[i]=='\r' ){
- if( !crok ){
+ if( (flags & CR_OK)==0 ){
printf("%s:%d: carriage-return (\\r) character\n", zFile, ln);
}
}else if( zLine[i]==' ' ){
@@ -42,7 +45,7 @@ static void checkSpacing(const char *zFile, int crok){
seenSpace = 0;
}
}
- if( seenSpace ){
+ if( seenSpace && (flags & WSEOL_OK)==0 ){
printf("%s:%d: whitespace at end-of-line\n", zFile, ln);
}
}
@@ -55,12 +58,26 @@ static void checkSpacing(const char *zFile, int crok){
int main(int argc, char **argv){
int i;
- int crok = 0;
+ unsigned flags = WSEOL_OK;
for(i=1; i<argc; i++){
- if( strcmp(argv[i], "--crok")==0 ){
- crok = 1;
+ const char *z = argv[i];
+ if( z[0]=='-' ){
+ while( z[0]=='-' ) z++;
+ if( strcmp(z,"crok")==0 ){
+ flags |= CR_OK;
+ }else if( strcmp(z, "wseol")==0 ){
+ flags &= ~WSEOL_OK;
+ }else if( strcmp(z, "help")==0 ){
+ printf("Usage: %s [options] FILE ...\n", argv[0]);
+ printf(" --crok Do not report on carriage-returns\n");
+ printf(" --wseol Complain about whitespace at end-of-line\n");
+ printf(" --help This message\n");
+ }else{
+ printf("unknown command-line option: [%s]\n", argv[i]);
+ printf("use --help for additional information\n");
+ }
}else{
- checkSpacing(argv[i], crok);
+ checkSpacing(argv[i], flags);
}
}
return 0;