version 1.6, 2020/04/27 21:44:47 |
version 1.7, 2020/05/17 05:32:01 |
|
|
int ismono(struct info *); |
int ismono(struct info *); |
void print_node(struct sioctl_node *, int); |
void print_node(struct sioctl_node *, int); |
void print_desc(struct info *, int); |
void print_desc(struct info *, int); |
|
void print_num(struct info *); |
void print_val(struct info *, int); |
void print_val(struct info *, int); |
void print_par(struct info *, int, char *); |
void print_par(struct info *, int, char *); |
int parse_name(char **, char *); |
int parse_name(char **, char *); |
|
|
} |
} |
} |
} |
|
|
|
void |
|
print_num(struct info *p) |
|
{ |
|
if (p->desc.maxval == 1) |
|
printf("%d", p->curval); |
|
else { |
|
/* |
|
* For now, maxval is always 127 or 255, |
|
* so three decimals is always ideal. |
|
*/ |
|
printf("%.3f", p->curval / (float)p->desc.maxval); |
|
} |
|
} |
|
|
/* |
/* |
* print parameter value |
* print parameter value |
*/ |
*/ |
|
|
switch (p->desc.type) { |
switch (p->desc.type) { |
case SIOCTL_NUM: |
case SIOCTL_NUM: |
case SIOCTL_SW: |
case SIOCTL_SW: |
if (p->desc.maxval == 1) |
print_num(p); |
printf("%d", p->curval); |
|
else |
|
/* |
|
* For now, maxval is always 127 or 255, |
|
* so three decimals is always ideal. |
|
*/ |
|
printf("%.3f", p->curval / (float)p->desc.maxval); |
|
break; |
break; |
case SIOCTL_VEC: |
case SIOCTL_VEC: |
case SIOCTL_LIST: |
case SIOCTL_LIST: |
|
|
if (more) |
if (more) |
printf(","); |
printf(","); |
print_node(&e->desc.node1, mono); |
print_node(&e->desc.node1, mono); |
if (e->desc.maxval == 1) |
printf(":"); |
printf(":%d", e->curval); |
print_num(e); |
else |
|
printf(":%.3f", |
|
e->curval / (float)e->desc.maxval); |
|
more = 1; |
more = 1; |
} |
} |
} |
} |