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

From: Ivan Tham <pickfire_AT_riseup.net>
Date: Fri, 10 Jun 2016 12:53:49 +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..16150e7 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 (!strncmp(*arg, "-", sizeof(char)))
+				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 - 06:53:49 CEST

This archive was generated by hypermail 2.3.0 : Fri Jun 10 2016 - 07:00:18 CEST