dvgrab-3.01 for ubuntu gutsy (amd64): getopt() problem

Thomas Osterried thomas at x-berg.in-berlin.de
Thu Dec 6 18:07:56 GMT 2007


Hello,

this report goes to
  Maintainer: Ubuntu MOTU Developers <ubuntu-motu at lists.ubuntu.com>
  Original-Maintainer: Erik Schanze <eriks at debian.org>

dvgrab's commandline option "-" tells that the grabed shout go to stdout.
getopt_long_only() on my system does not honour the "-"-only option, specified
with char *opts = "d:hif:F:I:s:tVv-". At the point, "-" is evaluated,
the while loop terminates, and "-" is interpreted as filename, which results
in files like "-001.avi".

The patch below fixes the problem.

Generally, "-" may lead to misunderstandings: is it meant for stdin or
stdout.. - one has to look at the doku.
dvgrab has "-I -" or "-stin" for reading from stdin, and perhaps it
would be wise to be consequent and to also provide "-O -" and "-stdout"
for the stdout case. Thus, if getopt() on a system is broken, the user
would have still a chance to grab to stdout without the need of recompile ;)

Regards,
	- Thomas

Appendix: fix for grabing to stdout on ubuntu gutsy amd64
---------------------------------------------------------

diff -Naur dvgrab-3.0/dvgrab.cc.orig dvgrab-3.0/dvgrab.cc
--- dvgrab-3.0/dvgrab.cc.orig   2007-08-07 05:00:43.000000000 +0200
+++ dvgrab-3.0/dvgrab.cc        2007-12-06 18:55:58.000000000 +0100
@@ -447,8 +447,14 @@
 
        if ( optind < argc )
        {
-               m_dst_file_name = argv[ optind++ ];
-               set_format_from_name();
+               /* option "-" not evaluated above. getopt_long_only() compat issue? */
+               if (!strcmp(argv[ optind ], "-")) {
+                       m_raw_pipe = true;
+                       optind++;
+               } else {
+                       m_dst_file_name = argv[ optind++ ];
+                       set_format_from_name();
+               }
        }
 
        if ( optind < argc )




More information about the Ubuntu-motu mailing list