File indexing completed on 2026-05-29 07:35:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 usage() {
0015 echo "remove_tabs.sh -opt [-opt]";
0016 echo " -d <directory> Add directory to action list.";
0017 echo " --directory <directory> Add directory to action list.";
0018 echo " -h Show this help.";
0019 echo " --help Show this help.";
0020 exit EINVAL;
0021 }
0022
0023
0024 PARSED_ARGUMENTS=$(getopt -a -n remove_tabs -o hd: --longoptions help,directory: -- "[remove_tabs]" $*)
0025 VALID_ARGUMENTS=$?
0026 if [ "$VALID_ARGUMENTS" != "0" ]; then
0027 do_print "Invalid arguments to cmake step";
0028 usage;
0029 fi;
0030
0031 eval set -- "$PARSED_ARGUMENTS";
0032 while :
0033 do
0034 case "${1}" in
0035 -d | --directory) dirs="${2} ${dirs}"; echo ${2}; shift 2 ;;
0036 -h | --help) usage; shift ;;
0037
0038 --) shift; break;;
0039
0040
0041 *) do_print " Unexpected option: $1 - this should not happen."
0042 usage; shift; break;;
0043 esac;
0044 done;
0045
0046
0047 exec_command() {
0048 $* | gawk '{ print strftime("[%Y-%m-%d %H:%M:%S] | "), $0 }';
0049 }
0050
0051
0052
0053 current=`pwd`;
0054 line="==============================";
0055 TAB="`printf '\t'`";
0056 echo "TAB is: **${TAB}**";
0057 for dir in ${dirs}; do
0058 exec_command echo "${line}${line}${line}${line}${line}";
0059 cd ${dir};
0060 path=`pwd`;
0061 exec_command echo "Re moving tabs in directory: ${path}";
0062 headers=`grep "${TAB}" -r ${path} | tr ":" " "| awk '{ print $1}' | uniq -d | grep -e "${path}/.*\.h"`
0063 files=`grep "${TAB}" -r ${path} | tr ":" " "| awk '{ print $1}' | uniq -d | grep -e "${path}/.*\.cpp"`
0064 for file in ${headers} ${files}; do
0065 exec_command echo " --> Removing tabs from ${file}";
0066 sed -i 's/\t/ /g' ${file};
0067 dos2unix ${file};
0068 done;
0069 cd ${current};
0070 done;