]> granicus.if.org Git - jq/commitdiff
Better error msg for bad shell quoting (fix #538)
authorNicolas Williams <nico@cryptonector.com>
Wed, 6 Aug 2014 22:50:28 +0000 (17:50 -0500)
committerNicolas Williams <nico@cryptonector.com>
Wed, 6 Aug 2014 22:51:53 +0000 (17:51 -0500)
parser.y

index 72e2b28ffa87933d8844f0dd752a702934c07d44..7117b4ca3c317d3b934b779d0e2ca31e3af196a5 100644 (file)
--- a/parser.y
+++ b/parser.y
@@ -118,7 +118,15 @@ struct lexer_param {
 void yyerror(YYLTYPE* loc, block* answer, int* errors, 
              struct locfile* locations, struct lexer_param* lexer_param_ptr, const char *s){
   (*errors)++;
-  locfile_locate(locations, *loc, "error: %s", s);
+  if (strstr(s, "unexpected")) {
+#ifdef WIN32
+      locfile_locate(locations, *loc, "error: %s (Windows cmd shell quoting issues?)", s);
+#else
+      locfile_locate(locations, *loc, "error: %s (Unix shell quoting issues?)", s);
+#endif
+  } else {
+      locfile_locate(locations, *loc, "error: %s", s);
+  }
 }
 
 int yylex(YYSTYPE* yylval, YYLTYPE* yylloc, block* answer, int* errors,