1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-26 13:59:42 +02:00

usrp/sps/viz: reject unrecognized command-line options

This commit is contained in:
Werner Almesberger 2011-03-05 19:02:15 -03:00
parent 4759ea6f0c
commit 34722a54ef

View File

@ -2,7 +2,8 @@
usage() usage()
{ {
echo "usage: $0 [-f font] prefix frequency" 1>&2 echo "usage: $0 [-f font] [-m] [-o fft_file] [-p png_file] prefix \
frequency" 1>&2
exit 1 exit 1
} }
@ -10,30 +11,38 @@ usage()
font= font=
term= term=
output= output=
show_max=false
out=
while true; do while true; do
case "$1" in case "$1" in
-f) [ "$2" ] || usage -f) [ "$2" ] || usage
shift shift
font=$1 font=$1;;
shift;; -m) show_max=true;;
-o) [ "$2" ] || usage
shift
out=$1;;
-p) [ "$2" ] || usage -p) [ "$2" ] || usage
shift shift
term="set term png" term="set term png"
output="set output \"$1\"" output="set output \"$1\"";;
shift;; -*) usage;;
*) *)
break;; break;;
esac esac
shift
done done
[ "$2" ] || usage [ "$2" ] || usage
[ "$3" ] && usage [ "$3" ] && usage
tmp=${out:-_tmp}
prefix=$1 prefix=$1
f=$2 f=$2
../fft -s 100 -d -w hamming 100 <./$prefix-$f >_tmp ../fft -s 100 -d -w hamming 100 <./$prefix-$f >$tmp
set `./norm _tmp` set `./norm $tmp`
xm=$1.0 # sample number of y peak xm=$1.0 # sample number of y peak
ym=$2 # magnitude of y peak ym=$2 # magnitude of y peak
@ -70,8 +79,9 @@ set grid
set xlabel "MHz from nominal frequency of test wave" set xlabel "MHz from nominal frequency of test wave"
set style fill solid 1 set style fill solid 1
plot "_tmp" using ((\$0/$n-0.5)*$span+0.5):(\$1-$ym) with lines notitle, \ plot "$tmp" using ((\$0/$n-0.5)*$span+0.5):(\$1-$ym) with lines notitle, \
"<echo -0.9 $ymbar 0.2" with boxes lt $ymbarlt notitle "<echo -0.9 $ymbar 0.2" with boxes lt $ymbarlt notitle
EOF EOF
rm -f _tmp [ "$out" ] || rm -f $tmp
$show_max && echo $ym