OSDN Git Service

Use FLAG_ macros for echo optflags.
authorRob Landley <rob@landley.net>
Sun, 15 Apr 2012 02:41:19 +0000 (21:41 -0500)
committerRob Landley <rob@landley.net>
Sun, 15 Apr 2012 02:41:19 +0000 (21:41 -0500)
toys/echo.c

index de4be54..6fb9e43 100644 (file)
@@ -32,8 +32,12 @@ config ECHO
           \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 @@ void echo_main(void)
 
                // Should we output arg verbatim?
 
-               if (!(toys.optflags&2)) {
+               if (!(toys.optflags&FLAG_e)) {
                        xprintf("%s", arg);
                        continue;
                }
@@ -87,7 +91,7 @@ void echo_main(void)
        }
 
        // Output "\n" if no -n
-       if (!(toys.optflags&1)) xputc('\n');
+       if (!(toys.optflags&FLAG_n)) xputc('\n');
 done:
        xflush();
 }