int oneline = 0;
int timestamp = 0;
char * _SL_ = NULL;
-char *batch_file = NULL;
int force = 0;
int max_flush_loops = 10;
+int batch_mode = 0;
struct rtnl_handle rth = { .fd = -1 };
size_t len = 0;
int ret = EXIT_SUCCESS;
+ batch_mode = 1;
+
if (name && strcmp(name, "-") != 0) {
if (freopen(name, "r", stdin) == NULL) {
fprintf(stderr, "Cannot open file \"%s\" for reading: %s\n",
int main(int argc, char **argv)
{
char *basename;
+ char *batch_file = NULL;
basename = strrchr(argv[0], '/');
if (basename == NULL)
#define MS_SHARED (1 << 20)
#endif
-extern char *batch_file;
-
#ifndef HAVE_SETNS
static int setns(int fd, int nstype)
{
fflush(stdout);
- if (batch_file) {
+ if (batch_mode) {
int status;
pid_t pid;
int show_details = 0;
int show_raw = 0;
int show_pretty = 0;
+int batch_mode = 0;
int resolve_hosts = 0;
int use_iec = 0;
size_t len = 0;
int ret = 0;
+ batch_mode = 1;
if (name && strcmp(name, "-") != 0) {
if (freopen(name, "r", stdin) == NULL) {
fprintf(stderr, "Cannot open file \"%s\" for reading: %s\n",
int main(int argc, char **argv)
{
int ret;
- int do_batching = 0;
- char *batchfile = NULL;
+ char *batch_file = NULL;
while (argc > 1) {
if (argv[1][0] != '-')
} else if (matches(argv[1], "-force") == 0) {
++force;
} else if (matches(argv[1], "-batch") == 0) {
- do_batching = 1;
- if (argc > 2)
- batchfile = argv[2];
argc--; argv++;
+ if (argc <= 1)
+ usage();
+ batch_file = argv[1];
} else {
fprintf(stderr, "Option \"%s\" is unknown, try \"tc -help\".\n", argv[1]);
return -1;
argc--; argv++;
}
- if (do_batching)
- return batch(batchfile);
+ if (batch_file)
+ return batch(batch_file);
if (argc <= 1) {
usage();