]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tc/tc_util.c
lib: introduce print_nl
[mirror_iproute2.git] / tc / tc_util.c
index aceb0d9449337a64b71596072b5df370f49ea97b..d7578528a31b1932bab12d793ac1798fef4ac13f 100644 (file)
@@ -444,6 +444,17 @@ int get_size_and_cell(unsigned int *size, int *cell_log, char *str)
        return 0;
 }
 
+void print_devname(enum output_type type, int ifindex)
+{
+       const char *ifname = ll_index_to_name(ifindex);
+
+       if (!is_json_context())
+               printf("dev ");
+
+       print_color_string(type, COLOR_IFNAME,
+                          "dev", "%s ", ifname);
+}
+
 void print_size(char *buf, int len, __u32 sz)
 {
        double tmp = sz;
@@ -588,6 +599,7 @@ static int __parse_action_control(int *argc_p, char ***argv_p, int *result_p,
                }
                result |= jump_cnt;
        }
+       NEXT_ARG_FWD();
        *argc_p = argc;
        *argv_p = argv;
        *result_p = result;
@@ -684,8 +696,8 @@ out:
 int parse_action_control_slash(int *argc_p, char ***argv_p,
                               int *result1_p, int *result2_p, bool allow_num)
 {
+       int result1, result2, argc = *argc_p;
        char **argv = *argv_p;
-       int result1, result2;
        char *p = strchr(*argv, '/');
 
        if (!p)
@@ -704,6 +716,9 @@ int parse_action_control_slash(int *argc_p, char ***argv_p,
 
        *result1_p = result1;
        *result2_p = result2;
+       NEXT_ARG_FWD();
+       *argc_p = argc;
+       *argv_p = argv;
        return 0;
 }
 
@@ -827,8 +842,6 @@ void print_tcstats2_attr(FILE *fp, struct rtattr *rta, char *prefix, struct rtat
 
                memcpy(&re, RTA_DATA(tbs[TCA_STATS_RATE_EST]),
                       MIN(RTA_PAYLOAD(tbs[TCA_STATS_RATE_EST]), sizeof(re)));
-               fprintf(fp, "\n%srate %s %upps ",
-                       prefix, sprint_rate(re.bps, b1), re.pps);
                print_string(PRINT_FP, NULL, "\n%s", prefix);
                print_uint(PRINT_JSON, "rate", NULL, re.bps);
                print_string(PRINT_FP, NULL, "rate %s",