s/SIOCTL_INTMAX/SIOCTL_VALMAX

This commit is contained in:
Alexandre Ratchov 2020-01-16 07:47:23 +01:00
parent 8ecb6c1721
commit 1534d4f816
3 changed files with 10 additions and 10 deletions

View File

@ -30,7 +30,7 @@
* limits * limits
*/ */
#define SIOCTL_NAMEMAX 12 /* max name length */ #define SIOCTL_NAMEMAX 12 /* max name length */
#define SIOCTL_INTMAX 127 /* max channel number */ #define SIOCTL_VALMAX 127 /* max channel number */
#define SIOCTL_HALF 64 /* also bool threshold */ #define SIOCTL_HALF 64 /* also bool threshold */
/* /*

View File

@ -442,8 +442,8 @@ parse_name(char **line, char *name)
int int
parse_dec(char **line, int *num) parse_dec(char **line, int *num)
{ {
#define MAXQ (SIOCTL_INTMAX / 10) #define MAXQ (SIOCTL_VALMAX / 10)
#define MAXR (SIOCTL_INTMAX % 10) #define MAXR (SIOCTL_VALMAX % 10)
char *p = *line; char *p = *line;
unsigned int dig, val; unsigned int dig, val;
@ -641,7 +641,7 @@ cmd(char *line)
if (!parse_modeval(&pos, &mode, &val)) if (!parse_modeval(&pos, &mode, &val))
return 0; return 0;
} else { } else {
val = SIOCTL_INTMAX; val = SIOCTL_VALMAX;
mode = MODE_SET; mode = MODE_SET;
} }
nent = 0; nent = 0;
@ -696,8 +696,8 @@ commit(void)
break; break;
case MODE_ADD: case MODE_ADD:
val = i->curval + i->newval; val = i->curval + i->newval;
if (val > SIOCTL_INTMAX) if (val > SIOCTL_VALMAX)
val = SIOCTL_INTMAX; val = SIOCTL_VALMAX;
break; break;
case MODE_SUB: case MODE_SUB:
val = i->curval - i->newval; val = i->curval - i->newval;
@ -705,7 +705,7 @@ commit(void)
val = 0; val = 0;
break; break;
case MODE_TOGGLE: case MODE_TOGGLE:
val = (i->curval >= SIOCTL_HALF) ? 0 : SIOCTL_INTMAX; val = (i->curval >= SIOCTL_HALF) ? 0 : SIOCTL_VALMAX;
} }
switch (i->desc.type) { switch (i->desc.type) {
case SIOCTL_NUM: case SIOCTL_NUM:

View File

@ -44,7 +44,7 @@
char *dev_name; char *dev_name;
struct pollfd pfds[16]; struct pollfd pfds[16];
struct sioctl_hdl *hdl; struct sioctl_hdl *hdl;
unsigned int output_addr, output_val = SIOCTL_INTMAX; unsigned int output_addr, output_val = SIOCTL_VALMAX;
int output_found = 0; int output_found = 0;
int verbose; int verbose;
@ -139,8 +139,8 @@ dev_incrvol(int incr)
if (!dev_connect()) if (!dev_connect())
return; return;
vol = output_val + incr; vol = output_val + incr;
if (vol > SIOCTL_INTMAX) if (vol > SIOCTL_VALMAX)
vol = SIOCTL_INTMAX; vol = SIOCTL_VALMAX;
if (vol < 0) if (vol < 0)
vol = 0; vol = 0;
if (output_val != (unsigned int)vol) { if (output_val != (unsigned int)vol) {