changeset 563:b24c4fe9f4fd

Use FLAG_ macros for echo optflags.
author Rob Landley <rob@landley.net>
date Sat, 14 Apr 2012 21:41:19 -0500
parents 4d802d438983
children 9530899eee51
files toys/echo.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/toys/echo.c	Sat Apr 14 21:27:00 2012 -0500
+++ b/toys/echo.c	Sat Apr 14 21:41:19 2012 -0500
@@ -32,8 +32,12 @@
 	   \xHH	 hexadecimal values (1 to 2 digits)
 */
 
+#define THIS echo
 #include "toys.h"
 
+#define FLAG_e (1<<1)
+#define FLAG_n (1<<0)
+
 void echo_main(void)
 {
 	int i = 0, out;
@@ -46,7 +50,7 @@
 
 		// Should we output arg verbatim?
 
-		if (!(toys.optflags&2)) {
+		if (!(toys.optflags&FLAG_e)) {
 			xprintf("%s", arg);
 			continue;
 		}
@@ -87,7 +91,7 @@
 	}
 
 	// Output "\n" if no -n
-	if (!(toys.optflags&1)) xputc('\n');
+	if (!(toys.optflags&FLAG_n)) xputc('\n');
 done:
 	xflush();
 }