blob: 4bdbc602f6e1e061f062ed09b715b07f97561026 [file] [log] [blame]
yang.lie3351552022-03-25 09:46:02 +08001#! /bin/bash
2#
3# Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
4#
5# SPDX-License-Identifier: MIT
6#
7
yang.li8c78ed62022-03-08 13:50:52 +08008PARAM="-npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1 -bad"
yang.lie3351552022-03-25 09:46:02 +08009
10function read_dir(){
Kelvin Zhangb36fd412022-04-12 15:12:49 +080011 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.lie3351552022-03-25 09:46:02 +080021}
22
23#excute
Kelvin Zhangb36fd412022-04-12 15:12:49 +080024if [ -d $1 ]; then
25 read_dir ${1%*/}
26elif [ -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
31fi