yang.li | e335155 | 2022-03-25 09:46:02 +0800 | [diff] [blame] | 1 | #! /bin/bash |
| 2 | # |
| 3 | # Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved. |
| 4 | # |
| 5 | # SPDX-License-Identifier: MIT |
| 6 | # |
| 7 | |
yang.li | 8c78ed6 | 2022-03-08 13:50:52 +0800 | [diff] [blame] | 8 | PARAM="-npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1 -bad" |
yang.li | e335155 | 2022-03-25 09:46:02 +0800 | [diff] [blame] | 9 | |
| 10 | function read_dir(){ |
Kelvin Zhang | b36fd41 | 2022-04-12 15:12:49 +0800 | [diff] [blame] | 11 | for file in `ls $1` |
| 12 | do |
| 13 | if [ -d $1"/"$file ] |
| 14 | then |
| 15 | read_dir $1"/"$file |
| 16 | elif [ "${file##*.}"x = "c"x ]||[ "${file##*.}"x = "cpp"x ]||[ "${file##*.}"x = "h"x ];then |
| 17 | echo $1"/"$file |
| 18 | indent $PARAM $1"/"$file -o $1"/"$file |
| 19 | fi |
| 20 | done |
yang.li | e335155 | 2022-03-25 09:46:02 +0800 | [diff] [blame] | 21 | } |
| 22 | |
| 23 | #excute |
Kelvin Zhang | b36fd41 | 2022-04-12 15:12:49 +0800 | [diff] [blame] | 24 | if [ -d $1 ]; then |
| 25 | read_dir ${1%*/} |
| 26 | elif [ -f $1 ]; then |
| 27 | if [ "${1##*.}"x = "c"x ]||[ "${1##*.}"x = "cpp"x ]||[ "${1##*.}"x = "h"x ];then |
| 28 | echo $1 |
| 29 | indent $PARAM $1 -o $1 |
| 30 | fi |
| 31 | fi |