#! /bin/sh -e
## 10_filenames_with_brackets.dpatch by Erik Schanze <eriks@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: allow file names beginning with bracket, because not all, that
## DP: begins with '[' is a range. Closes: #177169
if [ $# -lt 1 ]; then
echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
exit 1
fi
[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
case "$1" in
-patch) patch -p1 ${patch_opts} < $0;;
-unpatch) patch -R -p1 ${patch_opts} < $0;;
*)
echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
exit 1;;
esac
exit 0
@DPATCH@
diff -urNad /home/es/devel/debian/mpgtx/mpgtx-1.3/commandline.cxx mpgtx-1.3/commandline.cxx
--- /home/es/devel/debian/mpgtx/mpgtx-1.3/commandline.cxx 2003-02-01 08:01:59.000000000 +0100
+++ mpgtx-1.3/commandline.cxx 2004-07-23 19:48:53.000000000 +0200
@@ -320,6 +320,7 @@
programname invocation;
bool demux=false;
int tmp_seq;
+ FILE *tmp_file=NULL;
@@ -539,10 +540,30 @@
case ']':
case '[':
- // this is a range
- lastarg=range;
- if(!Tab.ParseRange(argv[i])){
- return 1;
+ // this could be a range or a filename beginning with bracket
+ // so check if it is not a file in current dir
+ tmp_file=fopen(argv[i],"r");
+ if(tmp_file==NULL){
+ // this is a range
+ lastarg=range;
+ if(!Tab.ParseRange(argv[i])){
+ return 1;
+ }
+ }
+ else{
+ // might be an input file, check!
+ if (lastarg==file && !(want_info)){
+ // two file arguments encountered, apply 100% range to the first
+ // one
+ Tab.ParseRange("]0-]");
+ }
+ if(tmp_file)
+ fclose(tmp_file);
+ lastarg=file;
+ if(!Tab.AddFile(argv[i])){
+ fprintf(stderr,"%s is not a valid mpeg file\n",argv[i]);
+ if(!want_info) return 1;
+ }
}
break;
case '{':