[hackers] [sbase][PATCH] [find] Better error reporting

From: Ivan Tham <pickfire_AT_riseup.net>
Date: Fri, 10 Jun 2016 13:33:29 +0800

Shows that primary or token is unknown instead of only showing that
paths must precede expression
---
 find.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/find.c b/find.c
index ad0c731..5222b99 100644
--- a/find.c
+++ b/find.c
_AT_@ -807,8 +807,11 @@ parse(int argc, char **argv)
 			}
 			tok->type = op->type;
 			tok->u.oinfo = op;
-		} else { /* token is neither primary nor operator, must be path in the wrong place */
-			eprintf("paths must precede expression: %s\n", *arg);
+		} else { /* token is neither primary nor operator */
+			if (**arg == '-')
+				eprintf("unknown primary or operator: %s\n", *arg);
+			else /* must be path in the wrong place */
+				eprintf("paths must precede expression: %s\n", *arg);
 		}
 		if (tok->type != LPAR && tok->type != RPAR)
 			ntok++; /* won't have parens in rpn */
-- 
2.8.3
Received on Fri Jun 10 2016 - 07:33:29 CEST

This archive was generated by hypermail 2.3.0 : Fri Jun 10 2016 - 07:36:14 CEST