Switch setprop to use TOYBOX_ON_ANDROID and fix getprop include.
authorRob Landley <rob@landley.net>
Tue, 21 Apr 2015 01:59:00 +0000 (20:59 -0500)
committerRob Landley <rob@landley.net>
Tue, 21 Apr 2015 01:59:00 +0000 (20:59 -0500)
(I commented out the android-only #include in getprop to do what compile
testing I could, and then forgot to uncomment it.)

toys/android/getprop.c
toys/android/setprop.c

index 9d5398a..400d80e 100644 (file)
@@ -17,7 +17,7 @@ config GETPROP
 #define FOR_getprop
 #include "toys.h"
 
-//#include <cutils/properties.h>
+#include <cutils/properties.h>
 
 GLOBALS(
   size_t size;
index ef24c9a..cbcd152 100644 (file)
@@ -7,6 +7,7 @@ USE_SETPROP(NEWTOY(setprop, "<2>2", TOYFLAG_USR|TOYFLAG_SBIN))
 config SETPROP
   bool "setprop"
   default y
+  depends on TOYBOX_ON_ANDROID
   help
     usage: setprop NAME VALUE
 
@@ -16,13 +17,10 @@ config SETPROP
 #define FOR_setprop
 #include "toys.h"
 
-#if defined(__ANDROID__)
 #include <cutils/properties.h>
-#endif
 
 void setprop_main(void)
 {
-#if defined(__ANDROID__)
   char *name = toys.optargs[0], *value = toys.optargs[1];
   char *p;
   size_t name_len = strlen(name), value_len = strlen(value);
@@ -48,5 +46,4 @@ void setprop_main(void)
 
   if (property_set(name, value))
     error_msg("failed to set property '%s' to '%s'", name, value);
-#endif
 }