return 0;
}
-static int parse_noqopt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev)
+static int parse_noqopt(struct qdisc_util *qu, int argc, char **argv,
+ struct nlmsghdr *n, const char *dev)
{
if (argc) {
- fprintf(stderr, "Unknown qdisc \"%s\", hence option \"%s\" is unparsable\n", qu->id, *argv);
+ fprintf(stderr,
+ "Unknown qdisc \"%s\", hence option \"%s\" is unparsable\n",
+ qu->id, *argv);
return -1;
}
return 0;
return 0;
}
-static int parse_nofopt(struct filter_util *qu, char *fhandle, int argc, char **argv, struct nlmsghdr *n)
+static int parse_nofopt(struct filter_util *qu, char *fhandle,
+ int argc, char **argv, struct nlmsghdr *n)
{
__u32 handle;
if (argc) {
- fprintf(stderr, "Unknown filter \"%s\", hence option \"%s\" is unparsable\n", qu->id, *argv);
+ fprintf(stderr,
+ "Unknown filter \"%s\", hence option \"%s\" is unparsable\n",
+ qu->id, *argv);
return -1;
}
if (fhandle) {
static void usage(void)
{
- fprintf(stderr, "Usage: tc [ OPTIONS ] OBJECT { COMMAND | help }\n"
- " tc [-force] -batch filename\n"
- "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 } | -j[son]\n");
+ fprintf(stderr,
+ "Usage: tc [ OPTIONS ] OBJECT { COMMAND | help }\n"
+ " tc [-force] -batch filename\n"
+ "where OBJECT := { qdisc | class | filter | action | monitor | exec }\n"
+ " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[aw] |\n"
+ " -j[son] | -p[retty] |\n"
+ " -b[atch] [filename] | -n[etns] name |\n"
+ " -nm | -nam[es] | { -cf | -conf } path }\n");
}
static int do_cmd(int argc, char **argv, void *buf, size_t buflen)
char *c;
char *subc[TC_MAX_SUBC];
} table[] = {
- {"filter", {"add", "delete", "change", "replace", NULL}},
- {"actions", {"add", "change", "replace", NULL}},
+ { "filter", { "add", "delete", "change", "replace", NULL} },
+ { "actions", { "add", "change", "replace", NULL} },
{ NULL },
}, *iter;
char *s;
struct batch_buf *buf;
if (*pool == NULL)
- buf = calloc(1, sizeof (struct batch_buf));
+ buf = calloc(1, sizeof(struct batch_buf));
else {
buf = *pool;
*pool = (*pool)->next;
- memset(buf, 0, sizeof (struct batch_buf));
+ memset(buf, 0, sizeof(struct batch_buf));
}
if (*head == NULL)
batch_mode = 1;
if (name && strcmp(name, "-") != 0) {
if (freopen(name, "r", stdin) == NULL) {
- fprintf(stderr, "Cannot open file \"%s\" for reading: %s\n",
+ fprintf(stderr,
+ "Cannot open file \"%s\" for reading: %s\n",
name, strerror(errno));
return -1;
}
}
ret = do_cmd(largc, largv, tail == NULL ? NULL : tail->buf,
- tail == NULL ? 0 : sizeof (tail->buf));
+ tail == NULL ? 0 : sizeof(tail->buf));
if (ret != 0) {
fprintf(stderr, "Command failed %s:%d\n", name,
cmdlineno - 1);
struct batch_buf *buf;
struct nlmsghdr *n;
- iov = iovs = malloc(batchsize * sizeof (struct iovec));
+ iov = iovs = malloc(batchsize * sizeof(struct iovec));
for (buf = head; buf != NULL; buf = buf->next, ++iov) {
n = (struct nlmsghdr *)&buf->buf;
iov->iov_base = n;
} else if (matches(argv[1], "-json") == 0) {
++json;
} else {
- fprintf(stderr, "Option \"%s\" is unknown, try \"tc -help\".\n", argv[1]);
+ fprintf(stderr,
+ "Option \"%s\" is unknown, try \"tc -help\".\n",
+ argv[1]);
return -1;
}
argc--; argv++;