- wvdial patch from Guillaume Rousse <rousse@ccr.jussieu.fr>

This commit is contained in:
ianmacd 2003-12-31 23:51:46 +00:00
parent 408553e471
commit 3eb3e5724b

View File

@ -1,6 +1,6 @@
# bash_completion - some programmable completion functions for bash 2.05b # bash_completion - some programmable completion functions for bash 2.05b
# #
# $Id: bash_completion,v 1.668 2004/01/01 00:48:05 ianmacd Exp $ # $Id: bash_completion,v 1.669 2004/01/01 00:51:46 ianmacd Exp $
# #
# Copyright (C) Ian Macdonald <ian@caliban.org> # Copyright (C) Ian Macdonald <ian@caliban.org>
# #
@ -4859,7 +4859,7 @@ _dcop()
have wvdial && have wvdial &&
_wvdial() _wvdial()
{ {
local cur prev configfile i local cur prev config i IFS=$'\t\n'
COMPREPLY=() COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]} cur=${COMP_WORDS[COMP_CWORD]}
@ -4875,21 +4875,26 @@ _wvdial()
case $cur in case $cur in
-*) -*)
COMPREPLY=( $( compgen -W '--config --chat \ COMPREPLY=( $( compgen -W '--config --chat \
--remotename --help --version --no-syslog' -- $cur ) ) --remotename --help --version --no-syslog' \
-- $cur ) )
;; ;;
*) *)
# find which config file to use # start with global and personal config files
configfile=/etc/wvdial.conf config="/etc/wvdial.conf"$'\t'"$HOME/.wvdialrc"
# replace with command line config file if present
for (( i=1; i < COMP_CWORD; i++ )); do for (( i=1; i < COMP_CWORD; i++ )); do
if [[ "${COMP_WORDS[i]}" == $1 ]]; then if [[ "${COMP_WORDS[i]}" == "--config" ]]; then
configfile=${COMP_WORDS[i+1]} config=${COMP_WORDS[i+1]}
break break
fi fi
done done
[ ! -f $configfile ] && return 0 # parse config files for sections and
# parse config file for sections # remove default section
COMPREPLY=( $( awk '/\[Dialer .+\]/ {print $0}' $configfile |\ COMPREPLY=( $( sed -ne \
sed -e '1d' -e 's/^\[Dialer //' -e 's/\]$//' | grep "^$cur" ) ) "s|^\[Dialer \($cur.*\)\]$|\1|p" \
$config 2>/dev/null |grep -v '^Defaults$'))
# escape spaces
COMPREPLY=${COMPREPLY// /\\ }
;; ;;
esac esac