version 1.16, 2008/10/16 14:32:57 |
version 1.17, 2010/06/29 05:00:05 |
|
|
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
#include <unistd.h> |
#include <unistd.h> |
|
#include <ctype.h> |
|
|
#define RADIO_ENV "RADIODEVICE" |
#define RADIO_ENV "RADIODEVICE" |
#define RADIODEVICE "/dev/radio" |
#define RADIODEVICE "/dev/radio" |
|
|
|
|
slen -= ++optlen; |
slen -= ++optlen; |
|
|
if ((topt = (char *)malloc(optlen)) == NULL) { |
if ((topt = malloc(optlen)) == NULL) { |
warn("memory allocation error"); |
warn("memory allocation error"); |
return 0; |
return 0; |
} |
} |
|
|
break; |
break; |
case 'o': |
case 'o': |
if (strncmp(topt, offchar, |
if (strncmp(topt, offchar, |
slen > OFFCHAR_LEN ? slen : OFFCHAR_LEN) == 0) |
slen > OFFCHAR_LEN ? slen : OFFCHAR_LEN) == 0) |
o->value = 0; |
o->value = 0; |
else if (strncmp(topt, onchar, |
else if (strncmp(topt, onchar, |
slen > ONCHAR_LEN ? slen : ONCHAR_LEN) == 0) |
slen > ONCHAR_LEN ? slen : ONCHAR_LEN) == 0) |
o->value = 1; |
o->value = 1; |
break; |
break; |
case 'u': |
case 'u': |
if (strncmp(topt, "up", slen > 2 ? slen : 2) == 0) |
if (strncmp(topt, "up", slen > 2 ? slen : 2) == 0) |
|
|
o->value = 0; |
o->value = 0; |
break; |
break; |
default: |
default: |
if (*topt > 47 && *topt < 58) |
if (isdigit(*topt)) |
o->value = str_to_int(topt, o->option); |
o->value = str_to_int(topt, o->option); |
break; |
break; |
} |
} |