Merge "Remove long-dead readtty."
diff --git a/libnetutils/dhcp_utils.c b/libnetutils/dhcp_utils.c
index e1df874..0f7c384 100644
--- a/libnetutils/dhcp_utils.c
+++ b/libnetutils/dhcp_utils.c
@@ -166,14 +166,6 @@
     return 0;
 }
 
-static const char *ipaddr_to_string(in_addr_t addr)
-{
-    struct in_addr in_addr;
-
-    in_addr.s_addr = addr;
-    return inet_ntoa(in_addr);
-}
-
 /*
  * Start the dhcp client daemon, and wait for it to finish
  * configuring the interface.
@@ -242,7 +234,6 @@
         return -1;
     }
     if (strcmp(prop_value, "ok") == 0) {
-        char dns_prop_name[PROPERTY_KEY_MAX];
         if (fill_ip_info(interface, ipaddr, gateway, prefixLength, dns,
                 server, lease, vendorInfo, domain, mtu) == -1) {
             return -1;
diff --git a/libnetutils/dhcpclient.c b/libnetutils/dhcpclient.c
index b58120e..700b02f 100644
--- a/libnetutils/dhcpclient.c
+++ b/libnetutils/dhcpclient.c
@@ -150,7 +150,7 @@
 
 void dump_dhcp_info(dhcp_info *info)
 {
-    char addr[20], gway[20], mask[20];
+    char addr[20], gway[20];
     ALOGD("--- dhcp %s (%d) ---",
             dhcp_type_to_name(info->type), info->type);
     strcpy(addr, ipaddr(info->ipaddr));
diff --git a/libnetutils/ifc_utils.c b/libnetutils/ifc_utils.c
index 913f51e..bfe7121 100644
--- a/libnetutils/ifc_utils.c
+++ b/libnetutils/ifc_utils.c
@@ -421,7 +421,6 @@
 
 int ifc_set_hwaddr(const char *name, const void *ptr)
 {
-    int r;
     struct ifreq ifr;
     ifc_init_ifr(name, &ifr);
 
diff --git a/libnetutils/packet.c b/libnetutils/packet.c
index 3cdefb0..a878dd3 100644
--- a/libnetutils/packet.c
+++ b/libnetutils/packet.c
@@ -41,7 +41,7 @@
 
 int open_raw_socket(const char *ifname __attribute__((unused)), uint8_t *hwaddr, int if_index)
 {
-    int s, flag;
+    int s;
     struct sockaddr_ll bindaddr;
 
     if((s = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP))) < 0) {
diff --git a/logcat/tests/logcat_test.cpp b/logcat/tests/logcat_test.cpp
index b1412ff..b358485 100644
--- a/logcat/tests/logcat_test.cpp
+++ b/logcat/tests/logcat_test.cpp
@@ -548,7 +548,6 @@
             static const char rotated_log_filename_prefix[] = "log.txt.";
             static const size_t rotated_log_filename_prefix_len =
                 strlen(rotated_log_filename_prefix);
-            static const char total[] = "total ";
             static const char log_filename[] = "log.txt";
 
             if (!strncmp(buffer, rotated_log_filename_prefix, rotated_log_filename_prefix_len)) {
diff --git a/toolbox/Android.mk b/toolbox/Android.mk
index be70db4..5d557fa 100644
--- a/toolbox/Android.mk
+++ b/toolbox/Android.mk
@@ -153,13 +153,11 @@
     id \
     ifconfig \
     iftop \
-    insmod \
     ioctl \
     ionice \
     load_policy \
     log \
     ls \
-    lsmod \
     lsof \
     md5 \
     mkdir \
@@ -175,7 +173,6 @@
     readlink \
     renice \
     restorecon \
-    rmmod \
     route \
     runcon \
     schedtop \
diff --git a/toolbox/insmod.c b/toolbox/insmod.c
deleted file mode 100644
index d252433..0000000
--- a/toolbox/insmod.c
+++ /dev/null
@@ -1,97 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <malloc.h>
-#include <errno.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-extern int init_module(void *, unsigned long, const char *);
-
-static void *read_file(const char *filename, ssize_t *_size)
-{
-	int ret, fd;
-	struct stat sb;
-	ssize_t size;
-	void *buffer = NULL;
-
-	/* open the file */
-	fd = open(filename, O_RDONLY);
-	if (fd < 0)
-		return NULL;
-
-	/* find out how big it is */
-	if (fstat(fd, &sb) < 0)
-		goto bail;
-	size = sb.st_size;
-
-	/* allocate memory for it to be read into */
-	buffer = malloc(size);
-	if (!buffer)
-		goto bail;
-
-	/* slurp it into our buffer */
-	ret = read(fd, buffer, size);
-	if (ret != size)
-		goto bail;
-
-	/* let the caller know how big it is */
-	*_size = size;
-
-bail:
-	close(fd);
-	return buffer;
-}
-
-int insmod_main(int argc, char **argv)
-{
-	void *file;
-	ssize_t size = 0;
-	char opts[1024];
-	int ret;
-
-	/* make sure we've got an argument */
-	if (argc < 2) {
-		fprintf(stderr, "usage: insmod <module.o>\n");
-		return -1;
-	}
-
-	/* read the file into memory */
-	file = read_file(argv[1], &size);
-	if (!file) {
-		fprintf(stderr, "insmod: can't open '%s'\n", argv[1]);
-		return -1;
-	}
-
-	opts[0] = '\0';
-	if (argc > 2) {
-		int i, len;
-		char *end = opts + sizeof(opts) - 1;
-		char *ptr = opts;
-
-		for (i = 2; (i < argc) && (ptr < end); i++) {
-			len = MIN(strlen(argv[i]), (size_t)(end - ptr));
-			memcpy(ptr, argv[i], len);
-			ptr += len;
-			*ptr++ = ' ';
-		}
-		*(ptr - 1) = '\0';
-	}
-
-	/* pass it to the kernel */
-	ret = init_module(file, size, opts);
-	if (ret != 0) {
-		fprintf(stderr,
-                "insmod: init_module '%s' failed (%s)\n",
-                argv[1], strerror(errno));
-	}
-
-	/* free the file buffer */
-	free(file);
-
-	return ret;
-}
-
diff --git a/toolbox/lsmod.c b/toolbox/lsmod.c
deleted file mode 100644
index 8b55ee6..0000000
--- a/toolbox/lsmod.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <stdio.h>
-
-extern int cat_main(int argc, char **argv);
-
-int lsmod_main(int argc, char **argv)
-{
-	char *cat_argv[] = { "cat", "/proc/modules", NULL };
-	return cat_main(2, cat_argv);
-}
-
diff --git a/toolbox/rmmod.c b/toolbox/rmmod.c
deleted file mode 100644
index c7e0d6a..0000000
--- a/toolbox/rmmod.c
+++ /dev/null
@@ -1,53 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <malloc.h>
-#include <errno.h>
-#include <asm/unistd.h>
-
-extern int delete_module(const char *, unsigned int);
-
-int rmmod_main(int argc, char **argv)
-{
-	int ret, i;
-	char *modname, *dot;
-
-	/* make sure we've got an argument */
-	if (argc < 2) {
-		fprintf(stderr, "usage: rmmod <module>\n");
-		return -1;
-	}
-
-	/* if given /foo/bar/blah.ko, make a weak attempt
-	 * to convert to "blah", just for convenience
-	 */
-	modname = strrchr(argv[1], '/');
-	if (!modname)
-		modname = argv[1];
-	else modname++;
-
-	dot = strchr(argv[1], '.');
-	if (dot)
-		*dot = '\0';
-
-	/* Replace "-" with "_". This would keep rmmod
-	 * compatible with module-init-tools version of
-	 * rmmod
-	 */
-	for (i = 0; modname[i] != '\0'; i++) {
-		if (modname[i] == '-')
-			modname[i] = '_';
-	}
-
-	/* pass it to the kernel */
-	ret = delete_module(modname, O_NONBLOCK | O_EXCL);
-	if (ret != 0) {
-		fprintf(stderr, "rmmod: delete_module '%s' failed (errno %d)\n",
-						modname, errno);
-		return -1;
-	}
-
-	return 0;
-}
-