Commit 3cc1e803 authored by Adam Wujek's avatar Adam Wujek 💬

userspace/tools: rename network interfaces from wrX to wriX+1 in rtu_stat

Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 343a89b7
...@@ -102,7 +102,7 @@ char *decode_ports(int dpm, int nports) ...@@ -102,7 +102,7 @@ char *decode_ports(int dpm, int nports)
for (i = 0; i < nports; i++) for (i = 0; i < nports; i++)
{ {
sprintf(str2,"%d ", i); sprintf(str2, "%d ", i + 1);
if(dpm&(1<<i)) strcat(str,str2); if(dpm&(1<<i)) strcat(str,str2);
} }
...@@ -322,29 +322,57 @@ int main(int argc, char **argv) ...@@ -322,29 +322,57 @@ int main(int argc, char **argv)
isok=0; isok=0;
if(argc>1) if(argc>1)
{ {
if(strcmp(argv[1], "remove")==0) if (strcmp(argv[1], "remove") == 0) {
{
i=atoidef(argv[2],-1); i=atoidef(argv[2],-1);
if((0 <= i && i < 18) && (rtudexp_clear_entries(i,atoidef(argv[3],0))==0)) isok=1; /* interface number 1..18*/
else printf("Could not %s entry for wr%d\n",argv[1],i); if ((0 < i && i <= 18)
} && (rtudexp_clear_entries(i - 1,
else if(strcmp(argv[1], "add")==0) atoidef(argv[3], 0)
{ ) == 0)) {
if((argc > 3) && (rtudexp_add_entry(argv[2],atoi(argv[3]),atoidef(argv[4],0))==0)) isok=1; /* ok */
else printf("Could not %s entry for %s\n",argv[2],argv[3]); isok = 1;
} } else {
else if(strcmp(argv[1], "vlan")==0) printf("Could not %s entry for wri%d\n",
{ argv[1], i);
if((argc > 3 ) && (rtudexp_vlan_entry(atoi(argv[2]),atoi(argv[3]),argv[4], exit(1);
atoidef(argv[5],0),atoidef(argv[6],0),atoidef(argv[7],0), }
atoidef(argv[8],0))==0)) isok=1; } else if (strcmp(argv[1], "add") == 0) {
else printf("Could not %s entry for %s\n",argv[2],argv[3]); /* interface number 1..18*/
exit(1); if ((argc > 3)
} && (rtudexp_add_entry(argv[2],
else if(strcmp(argv[1], "list")==0) isok=1; atoi(argv[3]) - 1,
atoidef(argv[4], 0)
) == 0)) {
/* ok */
isok = 1;
} else {
printf("Could not %s entry for %s\n", argv[2],
argv[3] - 1);
exit(1);
}
} else if (strcmp(argv[1], "vlan") == 0) {
if ((argc > 3)
&& (rtudexp_vlan_entry(atoi(argv[2]),
atoi(argv[3]) - 1,
argv[4],
atoidef(argv[5], 0),
atoidef(argv[6], 0),
atoidef(argv[7], 0),
atoidef(argv[8], 0)
) == 0)) {
/* ok */
isok = 1;
} else {
printf("Could not %s entry for %s\n", argv[2],
argv[3]);
exit(1);
}
} else if (strcmp(argv[1], "list") == 0)
isok = 1;
//Does not continue //Does not continue
if(!isok) show_help(argv[0]); if (!isok)
show_help(argv[0]);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment