- fix for Browser localStorage (thanks to ohmza)
[oscam.git] / devtools / check_cmdline_opts.sh
blob715f6409107ef19ebb96d89b5ce75a90a85d677b
1 #!/bin/sh
3 if [ ! -f oscam.c ]
4 then
5 echo "ERROR: Run this script in the oscam source directory (where oscam.c file is)."
6 exit 1
7 fi
9 OPTS=`grep "static const char short_options" oscam.c | sed -e 's|.* \"||;s|\".*||;s|:||g;s|\(.\)|\1 |g'`
10 SOPTS=$((for i in $OPTS; do echo $i; done) | sort)
11 LOPTS=$(grep "^ { \"" oscam.c | sed -e 's|.*{ \"||;s|".*||')
12 FOPTS=""
14 #echo opts:$OPTS
15 #echo sopts:$SOPTS
16 #echo lopts:$LOPTS
17 #exit
19 echo -en "Short options that are free to use:\n "
20 for i in $(echo {A..Z}) $(echo {a..z}) $(echo {0..9})
22 echo $OPTS | grep -q $i 2>/dev/null
23 if [ $? != 0 ]
24 then
25 echo -n $i
26 FOPTS="$FOPTS $i"
28 done
29 echo
31 echo -en "Options that are not processed in oscam.c (missing case 'x'):\n "
32 #AOPTS="$FOPTS $SOPTS"
33 AOPTS="$SOPTS"
34 for i in $AOPTS
36 grep -q "case '$i'" oscam.c 2>/dev/null
37 [ $? != 0 ] && echo -n $i
38 done
39 echo
41 echo -en "Short options that are missing from 'struct long_options[]'\n "
42 for i in $AOPTS
44 grep -q "NULL, '$i' }," oscam.c 2>/dev/null
45 [ $? != 0 ] && echo -n $i
46 done
47 echo
49 echo -en "No help entry in usage() for short options:\n "
50 for i in $AOPTS
52 grep -q " printf(\" -$i" oscam.c 2>/dev/null
53 [ $? != 0 ] && echo -n $i
54 done
55 echo
57 echo "No help entry in usage() long options:"
58 for i in $LOPTS
60 grep -q " printf(\" -., --$i" oscam.c 2>/dev/null
61 [ $? != 0 ] && echo " $i"
62 done
63 echo