iproute2: re-enable batching
(probably not useful without rest of patch series)
Bug: 65674744
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I58752686f3e1583960e842aa7e3ae66b2446f97b
diff --git a/ip/ip.c b/ip/ip.c
index c0eae95..e2da46d 100644
--- a/ip/ip.c
+++ b/ip/ip.c
@@ -119,7 +119,6 @@
return EXIT_FAILURE;
}
-#ifndef ANDROID
static int batch(const char *name)
{
char *line = NULL;
@@ -168,15 +167,12 @@
rtnl_close(&rth);
return ret;
}
-#endif
int main(int argc, char **argv)
{
char *basename;
-#ifndef ANDROID
char *batch_file = NULL;
-#endif
basename = strrchr(argv[0], '/');
if (basename == NULL)
@@ -254,14 +250,12 @@
exit(0);
} else if (matches(opt, "-force") == 0) {
++force;
-#ifndef ANDROID
} else if (matches(opt, "-batch") == 0) {
argc--;
argv++;
if (argc <= 1)
usage();
batch_file = argv[1];
-#endif
} else if (matches(opt, "-brief") == 0) {
++brief;
} else if (matches(opt, "-json") == 0) {
@@ -303,10 +297,8 @@
if (json)
check_if_color_enabled();
-#ifndef ANDROID
if (batch_file)
return batch(batch_file);
-#endif
if (rtnl_open(&rth, 0) < 0)
exit(1);
diff --git a/tc/tc.c b/tc/tc.c
index 82a3004..06229ff 100644
--- a/tc/tc.c
+++ b/tc/tc.c
@@ -214,11 +214,7 @@
static void usage(void)
{
fprintf(stderr, "Usage: tc [ OPTIONS ] OBJECT { COMMAND | help }\n"
-#ifdef ANDROID
- " tc [-force]\n"
-#else
" tc [-force] -batch filename\n"
-#endif
"where OBJECT := { qdisc | class | filter | action | monitor | exec }\n"
" OPTIONS := { -s[tatistics] | -d[etails] | -r[aw] | -p[retty] | -b[atch] [filename] | -n[etns] name |\n"
" -nm | -nam[es] | { -cf | -conf } path }\n");
@@ -248,7 +244,6 @@
return -1;
}
-#ifndef ANDROID
static int batch(const char *name)
{
char *line = NULL;
@@ -293,15 +288,12 @@
rtnl_close(&rth);
return ret;
}
-#endif
int main(int argc, char **argv)
{
int ret;
-#ifndef ANDROID
char *batch_file = NULL;
-#endif
while (argc > 1) {
if (argv[1][0] != '-')
@@ -327,13 +319,11 @@
return 0;
} else if (matches(argv[1], "-force") == 0) {
++force;
-#ifndef ANDROID
} else if (matches(argv[1], "-batch") == 0) {
argc--; argv++;
if (argc <= 1)
usage();
batch_file = argv[1];
-#endif
} else if (matches(argv[1], "-netns") == 0) {
NEXT_ARG();
if (netns_switch(argv[1]))
@@ -357,10 +347,8 @@
argc--; argv++;
}
-#ifndef ANDROID
if (batch_file)
return batch(batch_file);
-#endif
if (argc <= 1) {
usage();