summaryrefslogtreecommitdiff
path: root/miscutils/i2c_tools.c
diff options
context:
space:
mode:
Diffstat (limited to 'miscutils/i2c_tools.c')
-rw-r--r--miscutils/i2c_tools.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c
index 8d04d22..30f606e 100644
--- a/miscutils/i2c_tools.c
+++ b/miscutils/i2c_tools.c
@@ -455,14 +455,12 @@ int i2cget_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int i2cget_main(int argc UNUSED_PARAM, char **argv)
{
const unsigned opt_f = (1 << 0), opt_y = (1 << 1);
- const char *const optstr = "fy";
int bus_num, bus_addr, data_addr = -1, status;
int mode = I2C_SMBUS_BYTE, pec = 0, fd;
unsigned opts;
- opt_complementary = "-2:?4"; /* from 2 to 4 args */
- opts = getopt32(argv, optstr);
+ opts = getopt32(argv, "^" "fy" "\0" "-2:?4"/*from 2 to 4 args*/);
argv += optind;
bus_num = i2c_bus_lookup(argv[0]);
@@ -544,7 +542,6 @@ int i2cset_main(int argc, char **argv)
{
const unsigned opt_f = (1 << 0), opt_y = (1 << 1),
opt_m = (1 << 2), opt_r = (1 << 3);
- const char *const optstr = "fym:r";
int bus_num, bus_addr, data_addr, mode = I2C_SMBUS_BYTE, pec = 0;
int val, blen = 0, mask = 0, fd, status;
@@ -552,8 +549,7 @@ int i2cset_main(int argc, char **argv)
char *opt_m_arg = NULL;
unsigned opts;
- opt_complementary = "-3"; /* from 3 to ? args */
- opts = getopt32(argv, optstr, &opt_m_arg);
+ opts = getopt32(argv, "^" "fym:r" "\0" "-3"/*from 3 to ? args*/, &opt_m_arg);
argv += optind;
argc -= optind;
@@ -905,7 +901,6 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv)
{
const unsigned opt_f = (1 << 0), opt_y = (1 << 1),
opt_r = (1 << 2);
- const char *const optstr = "fyr:";
int bus_num, bus_addr, mode = I2C_SMBUS_BYTE_DATA, even = 0, pec = 0;
unsigned first = 0x00, last = 0xff, opts;
@@ -913,8 +908,11 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv)
char *opt_r_str, *dash;
int fd, res;
- opt_complementary = "-2:?3"; /* from 2 to 3 args */
- opts = getopt32(argv, optstr, &opt_r_str);
+ opts = getopt32(argv, "^"
+ "fyr:"
+ "\0" "-2:?3" /* from 2 to 3 args */,
+ &opt_r_str
+ );
argv += optind;
bus_num = i2c_bus_lookup(argv[0]);
@@ -1208,15 +1206,16 @@ int i2cdetect_main(int argc UNUSED_PARAM, char **argv)
const unsigned opt_y = (1 << 0), opt_a = (1 << 1),
opt_q = (1 << 2), opt_r = (1 << 3),
opt_F = (1 << 4), opt_l = (1 << 5);
- const char *const optstr = "yaqrFl";
int fd, bus_num, i, j, mode = I2CDETECT_MODE_AUTO, status, cmd;
unsigned first = 0x03, last = 0x77, opts;
unsigned long funcs;
- opt_complementary = "q--r:r--q:" /* mutually exclusive */
- "?3"; /* up to 3 args */
- opts = getopt32(argv, optstr);
+ opts = getopt32(argv, "^"
+ "yaqrFl"
+ "\0"
+ "q--r:r--q:"/*mutually exclusive*/ "?3"/*up to 3 args*/
+ );
argv += optind;
if (opts & opt_l)