=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/radioctl/radioctl.c,v retrieving revision 1.10 retrieving revision 1.11 diff -c -r1.10 -r1.11 *** src/usr.bin/radioctl/radioctl.c 2004/08/08 00:23:15 1.10 --- src/usr.bin/radioctl/radioctl.c 2005/07/28 17:15:11 1.11 *************** *** 1,4 **** ! /* $OpenBSD: radioctl.c,v 1.10 2004/08/08 00:23:15 deraadt Exp $ */ /* $RuOBSD: radioctl.c,v 1.4 2001/10/20 18:09:10 pva Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: radioctl.c,v 1.11 2005/07/28 17:15:11 robert Exp $ */ /* $RuOBSD: radioctl.c,v 1.4 2001/10/20 18:09:10 pva Exp $ */ /* *************** *** 86,102 **** void print_value(int); void change_value(const struct opt_t); ! void update_value(int, u_long *, u_long); void warn_unsupported(int); void usage(void); void show_verbose(const char *, int); ! void show_int_val(u_long, const char *, char *, int); void show_float_val(float, const char *, char *, int); void show_char_val(const char *, const char *, int); int str_to_opt(const char *); ! u_long str_to_long(char *, int); /* * Control behavior of a FM tuner - set frequency, volume etc --- 86,102 ---- void print_value(int); void change_value(const struct opt_t); ! void update_value(int, int *, int); void warn_unsupported(int); void usage(void); void show_verbose(const char *, int); ! void show_int_val(int, const char *, char *, int); void show_float_val(float, const char *, char *, int); void show_char_val(const char *, const char *, int); int str_to_opt(const char *); ! u_int str_to_int(char *, int); /* * Control behavior of a FM tuner - set frequency, volume etc *************** *** 266,279 **** switch (o.option) { case OPTION_VOLUME: ! update_value(o.sign, (u_long *)&ri.volume, o.value); break; case OPTION_FREQUENCY: ! update_value(o.sign, (u_long *)&ri.freq, o.value); break; case OPTION_REFERENCE: if (ri.caps & RADIO_CAPS_REFERENCE_FREQ) ! update_value(o.sign, (u_long *)&ri.rfreq, o.value); else unsupported++; break; --- 266,279 ---- switch (o.option) { case OPTION_VOLUME: ! update_value(o.sign, &ri.volume, o.value); break; case OPTION_FREQUENCY: ! update_value(o.sign, &ri.freq, o.value); break; case OPTION_REFERENCE: if (ri.caps & RADIO_CAPS_REFERENCE_FREQ) ! update_value(o.sign, &ri.rfreq, o.value); else unsupported++; break; *************** *** 287,293 **** break; case OPTION_SENSITIVITY: if (ri.caps & RADIO_CAPS_LOCK_SENSITIVITY) ! update_value(o.sign, (u_long *)&ri.lock, o.value); else unsupported++; break; --- 287,293 ---- break; case OPTION_SENSITIVITY: if (ri.caps & RADIO_CAPS_LOCK_SENSITIVITY) ! update_value(o.sign, &ri.lock, o.value); else unsupported++; break; *************** *** 326,332 **** } void ! update_value(int sign, u_long *value, u_long update) { switch (sign) { case SIGN_NONE: --- 326,332 ---- } void ! update_value(int sign, int *value, int update) { switch (sign) { case SIGN_NONE: *************** *** 344,361 **** /* * Convert string to unsigned integer */ ! u_long ! str_to_long(char *str, int optval) { ! u_long val; if (str == NULL || *str == '\0') return VALUE_NONE; if (optval == OPTION_FREQUENCY) ! val = (u_long)1000 * atof(str); else ! val = (u_long)strtol(str, (char **)NULL, 10); return val; } --- 344,361 ---- /* * Convert string to unsigned integer */ ! u_int ! str_to_int(char *str, int optval) { ! int val; if (str == NULL || *str == '\0') return VALUE_NONE; if (optval == OPTION_FREQUENCY) ! val = (int)(1000 * atof(str)); else ! val = (int)strtol(str, (char **)NULL, 10); return val; } *************** *** 411,417 **** case '+': case '-': o->sign = (*topt == '+') ? SIGN_PLUS : SIGN_MINUS; ! o->value = str_to_long(&topt[1], o->option); break; case 'o': if (strncmp(topt, offchar, --- 411,417 ---- case '+': case '-': o->sign = (*topt == '+') ? SIGN_PLUS : SIGN_MINUS; ! o->value = str_to_int(&topt[1], o->option); break; case 'o': if (strncmp(topt, offchar, *************** *** 431,437 **** break; default: if (*topt > 47 && *topt < 58) ! o->value = str_to_long(topt, o->option); break; } --- 431,437 ---- break; default: if (*topt > 47 && *topt < 58) ! o->value = str_to_int(topt, o->option); break; } *************** *** 481,490 **** } void ! show_int_val(u_long val, const char *nick, char *append, int silent) { show_verbose(nick, silent); ! printf("%lu%s\n", val, append); } void --- 481,490 ---- } void ! show_int_val(int val, const char *nick, char *append, int silent) { show_verbose(nick, silent); ! printf("%u%s\n", val, append); } void