#! /bin/sh -e ## 20_main_argc.dpatch by Denis Barbier ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Description: Fix handling of program arguments. ## DP: Date: 2004-08-02 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 /opt/tmp/kbd-1.12/src/getunimap.c kbd-1.12/src/getunimap.c --- /opt/tmp/kbd-1.12/src/getunimap.c 2004-08-01 20:33:38.000000000 +0200 +++ kbd-1.12/src/getunimap.c 2004-08-02 22:45:30.000000000 +0200 @@ -62,7 +62,7 @@ } } - if (argc != 1) + if (optind < argc) usage(); fd = getfd(console); diff -urNad /opt/tmp/kbd-1.12/src/loadunimap.c kbd-1.12/src/loadunimap.c --- /opt/tmp/kbd-1.12/src/loadunimap.c 2004-08-02 22:45:06.000000000 +0200 +++ kbd-1.12/src/loadunimap.c 2004-08-02 22:46:39.000000000 +0200 @@ -73,18 +73,18 @@ } } - if (argc > 2 || (argc == 1 && !outfnam)) + if (argc > optind+1 || (argc == optind && !outfnam)) usage(); fd = getfd(console); if (outfnam) { saveunicodemap(fd, outfnam); - if (argc == 1) + if (argc == optind) exit(0); } - if (argc == 2) + if (argc == optind+1) infnam = argv[optind]; loadunicodemap(fd, infnam); exit(0); diff -urNad /opt/tmp/kbd-1.12/src/showconsolefont.c kbd-1.12/src/showconsolefont.c --- /opt/tmp/kbd-1.12/src/showconsolefont.c 2004-08-02 22:44:30.000000000 +0200 +++ kbd-1.12/src/showconsolefont.c 2004-08-02 22:47:07.000000000 +0200 @@ -135,7 +135,7 @@ } } - if (argc != 1) + if (optind < argc) usage(); fd = getfd(console);