- /* FIXME: parsing yes/y/on/1 versus no/n/off/0 is too involved */
- arm_ioctl(args, BRCTL_SET_BRIDGE_STP_STATE,
- (unsigned)(**argv - '0'), 0);
+ static const char no_yes[] ALIGN1 =
+ "0\0" "off\0" "n\0" "no\0" /* 0 .. 3 */
+ "1\0" "on\0" "y\0" "yes\0"; /* 4 .. 7 */
+ int onoff = index_in_strings(no_yes, *argv);
+ if (onoff < 0)
+ bb_error_msg_and_die(bb_msg_invalid_arg, *argv, applet_name);
+ onoff = (unsigned)onoff / 4;
+ arm_ioctl(args, BRCTL_SET_BRIDGE_STP_STATE, onoff, 0);