aboutsummaryrefslogtreecommitdiff
path: root/toys/android/setprop.c
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2019-06-07 10:38:36 -0700
committerRob Landley <rob@landley.net>2019-06-07 21:53:50 -0500
commit61ef1dccec4e6bf1c56384ed1cd45f93dcb6bd4c (patch)
tree5466c8b6204c8cb8cc22ad9dd2df97f79cb139ab /toys/android/setprop.c
parent7771204cf7bc161822eb636ff6fb30a1579b622d (diff)
downloadtoybox-61ef1dccec4e6bf1c56384ed1cd45f93dcb6bd4c.tar.gz
Remove getprop, setprop, start, and stop from toybox
These are Android specific, so not really helping the outside community, and are getting more and more Android dependencies to work correctly, so let's drop these from toybox and build them within Android. Change-Id: Ic6022f1f506e10868c61f55d64fa4e7c1b14eba2
Diffstat (limited to 'toys/android/setprop.c')
-rw-r--r--toys/android/setprop.c44
1 files changed, 0 insertions, 44 deletions
diff --git a/toys/android/setprop.c b/toys/android/setprop.c
deleted file mode 100644
index cda34a5d..00000000
--- a/toys/android/setprop.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* setprop.c - Set an Android system property
- *
- * Copyright 2015 The Android Open Source Project
-
-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
-
- Sets an Android system property.
-*/
-
-#define FOR_setprop
-#include "toys.h"
-
-void setprop_main(void)
-{
- char *name = toys.optargs[0], *value = toys.optargs[1];
- char *p;
- size_t name_len = strlen(name), value_len = strlen(value);
-
- // property_set doesn't tell us why it failed, and actually can't
- // recognize most failures (because it doesn't wait for init), so
- // we duplicate all of init's checks here to help the user.
-
- if (value_len >= PROP_VALUE_MAX && !strncmp(value, "ro.", 3))
- error_exit("value '%s' too long; try '%.*s'",
- value, PROP_VALUE_MAX - 1, value);
-
- if (*name == '.' || name[name_len - 1] == '.')
- error_exit("property names must not start or end with '.'");
- if (strstr(name, ".."))
- error_exit("'..' is not allowed in a property name");
- for (p = name; *p; ++p)
- if (!isalnum(*p) && !strchr(":@_.-", *p))
- error_exit("invalid character '%c' in name '%s'", *p, name);
-
- if (__system_property_set(name, value))
- error_msg("failed to set property '%s' to '%s'", name, value);
-}