Subject: videogen: better error messages needed
Package: videogen
Version: 0.32-1
Severity: normal
Tags: patch
-- System Information:
Debian Release: testing/unstable
APT prefers breezy-security
APT policy: (500, 'breezy-security'), (500, 'breezy-backports'),
(500, 'breezy')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-10-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Versions of packages videogen depends on:
ii bc 1.06-17 The GNU bc arbitrary
precision calii libc62.3.5-1ubuntu12 GNU C
Library: Shared libraries an
videogen recommends no packages.
-- no debconf information
I became somewhat frustrated using videogen.
It worked OK when I used -m=1280x768
When I tried -m=1366x768 I got a confusing error.
$ /usr/X11R6/bin/videogen -m=1366x768
argument 1 (-m=1366x768) has an invalid parameter
command line syntax error
The error message dosen't explain what I'm doing wrong.
I had to read the souce code to figure out the problem.
When I read the source I noticed several other types of error messages
were also defaulting to a meaningless message.
I've attached a patch to fix the problem and provide better error
messages.
Regards,
Michael Sebastian
__
Yahoo! DSL Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com
diff -urN videogen-0.32/args.c videogen-0.32-new/args.c
--- videogen-0.32/args.c 2006-01-02 00:28:21.0 -0800
+++ videogen-0.32-new/args.c 2006-01-01 23:56:35.0 -0800
@@ -152,6 +152,44 @@
break;
}
+ case 2:
+ case -2: {
+ pmsg (VL_DEBUG, [cmdline] arg %u: %s has an invalid parameter \%s\: width must be between %u and %u\n,
+ ap-aindex, (*ap-options)[ap-oindex].ao_option, (*ap-options)[ap-oindex].ao_parameter,
+ CFG_WIDTH_MIN, CFG_WIDTH_MAX);
+ pmsg (VL_NORMAL, argument %u (%s) has an invalid parameter: width must be between %u and %u\n,
+ ap-aindex, ap-argv[ap-aindex], CFG_WIDTH_MIN, CFG_WIDTH_MAX);
+ return (-1);
+}
+
+ case 3:
+ case -3: {
+ pmsg (VL_DEBUG, [cmdline] arg %u: %s has an invalid parameter \%s\: height must be between %u and %u\n,
+ ap-aindex, (*ap-options)[ap-oindex].ao_option, (*ap-options)[ap-oindex].ao_parameter,
+ CFG_HEIGHT_MIN, CFG_HEIGHT_MAX);
+ pmsg (VL_NORMAL, argument %u (%s) has an invalid parameter: height must be between %u and %u\n,
+ ap-aindex, ap-argv[ap-aindex], CFG_HEIGHT_MIN, CFG_HEIGHT_MAX);
+ return (-1);
+}
+
+ case 4:
+ case -4: {
+ pmsg (VL_DEBUG, [cmdline] arg %u: %s has an invalid parameter \%s\: aspect ratio must be between %f and %f\n,
+ ap-aindex, (*ap-options)[ap-oindex].ao_option, (*ap-options)[ap-oindex].ao_parameter,
+ CFG_ASPECT_RATIO_MIN, CFG_ASPECT_RATIO_MAX);
+ pmsg (VL_NORMAL, argument %u (%s) has an invalid parameter: aspect ratio must be between %f and %f\n,
+ ap-aindex, ap-argv[ap-aindex], CFG_ASPECT_RATIO_MIN, CFG_ASPECT_RATIO_MAX);
+ return (-1);
+}
+
+ case 6: {
+ pmsg (VL_DEBUG, [cmdline] arg %u: %s has an invalid parameter \%s\: width must be a multiple of 8\n,
+ ap-aindex, (*ap-options)[ap-oindex].ao_option, (*ap-options)[ap-oindex].ao_parameter);
+ pmsg (VL_NORMAL, argument %u (%s) has an invalid parameter: width must be a multiple of 8\n,
+ ap-aindex, ap-argv[ap-aindex]);
+ return (-1);
+}
+
default: {
pmsg (VL_DEBUG, [cmdline] arg %u: %s has an invalid parameter \%s\\n, ap-aindex,
(*ap-options)[ap-oindex].ao_option, (*ap-options)[ap-oindex].ao_parameter);
diff -urN videogen-0.32/cfg.y videogen-0.32-new/cfg.y
--- videogen-0.32/cfg.y 2002-10-29 20:51:57.0 -0800
+++ videogen-0.32-new/cfg.y 2006-01-02 00:14:22.0 -0800
@@ -168,9 +168,44 @@
break;
}
+ case 2:
+ case -2: {
+pmsg (VL_DEBUG, [cfgfile] line %u: invalid parameter %lux%lu: width must be between %u and %u\n,
+lexer_num_lines, $2, $4, CFG_WIDTH_MIN, CFG_WIDTH_MAX);
+pmsg (VL_VERBOSE, error at line %u: invalid parameter %lux%lu: width must be between %u and %u\n,
+lexer_num_lines, $2, $4, CFG_WIDTH_MIN, CFG_WIDTH_MAX);
+YYABORT;
+ }
+
+ case 3:
+ case -3: {
+pmsg (VL_DEBUG, [cfgfile] line %u: invalid parameter %lux%lu: height must be between %u and %u\n,
+lexer_num_lines, $2, $4, CFG_HEIGHT_MIN, CFG_HEIGHT_MAX);
+pmsg (VL_VERBOSE, error at line %u: invalid parameter %lux%lu: height must be between %u and %u\n,
+lexer_num_lines, $2, $4, CFG_HEIGHT_MIN, CFG_HEIGHT_MAX);
+YYABORT;
+ }
+
+ case 4:
+ case -4: {
+pmsg (VL_DEBUG, [cfgfile] line %u: invalid parameter %lux%lu: aspect ratio must be between %f and %f\n