diff -NarU5 aumix-2.8.orig/src/common.c aumix-2.8/src/common.c --- aumix-2.8.orig/src/common.c 2008-09-26 13:50:32.000000000 -0400 +++ aumix-2.8/src/common.c 2008-09-26 13:51:16.000000000 -0400 @@ -17,10 +17,11 @@ * You should have received a copy of the GNU General Public License along with * aumix; if not, write to the Free Software Foundation, Inc., 59 Temple Place, * Suite 330, Boston, MA 02111-1307, USA. */ +#include <errno.h> #include "common.h" #ifdef HAVE_CURSES #include "curses.h" #include "gpm-xterm.h" #endif /* HAVE_CURSES */ @@ -621,32 +622,33 @@ } int SetShowNoninter(int dev) { /* Change or display settings from the command line. */ - char *devstr, dest; + char *devstr; int change = 0, tmp, left, right; /* Increase or decrease levels, optionally by a number. */ - if (!strncmp(optarg, "+", 1) || !strncmp(optarg, "-", 1)) { + if ((*optarg == '+') || (*optarg == '-')) { ErrorExitWarn(ReadLevel(dev, &tmp), 'e'); right = tmp >> 8; /* I'll take the high byte, */ left = tmp & 0xFF; /* and you take the low byte. */ - strncpy(&dest, (optarg + 1), 3); - change = 1; /* For compatibility with versions 1.15 to 1.17, assume one if no number was given. */ - if (atoi(&dest)) - change = atoi(&dest); - if (*optarg == '+') { /* increase */ - right += change; - left += change; - right = (right > MAXLEVEL) ? MAXLEVEL : right; - left = (left > MAXLEVEL) ? MAXLEVEL : left; - } else { /* decrease */ - left -= change; - right -= change; - left = (left < 0) ? 0 : left; - right = (right < 0) ? 0 : right; + + change = (int) strtol(optarg, NULL, 10); + if (change == 0 && *(optarg + 1) != '0') { + /* For compat. w. 1.15 - 1.17: + assume 1 unless 0 given explicitly */ + change = (*optarg == '+') ? 1 : -1; } + + right += change; + left += change; + + if (right < 0) right = 0; + if (left < 0) left = 0; + if (right > MAXLEVEL) right = MAXLEVEL; + if (left > MAXLEVEL) left = MAXLEVEL; + tmp = left + (right << 8); ErrorExitWarn(WriteLevel(dev, tmp), 'e'); /* Try to write new settings to the mixer. */ return 0; } if ((*optarg == 'R') || (*optarg == 'P')) {