目的: 在joyme_lib文件目录中执行
joyme_lib下面有一个文件夹为joyme_cmcc,里面有文件名全部以joyme_cmcc开头的文件。
要求打印出所有函数名为
int joyme_cmcc_* 的传入参数。
此为第一版:还要修改:
shell 脚本
-
#!/usr/bin/sh
-
-
for file in ./joyme_cmcc/*
-
do
-
PARAM_LINE=`grep "int joyme_cmcc_" $file`
-
PARAMS_STRING=`echo $PARAM_LINE | grep -Po '(?<=\050)[^\051]+'`
-
echo $PARAMS_STRING
-
newline="joyme_printf(JOYME_INFO,\"<>: ";
-
newShow="";
-
newParams="";
-
-
i=1
-
while((1==1))
-
do
-
split=`echo $PARAMS_STRING|cut -d "," -f$i`
-
splitEqResp=$(echo $split | grep "response")
-
-
if [ "$split"x != ""x ]
-
then
-
if [ $i -eq 2 ] && [[ "$splitEqResp" != "" ]]
-
then
-
break
-
fi
-
-
# echo $i" "$split
-
-
-
if [ $i -ge 2 ];then
-
-
#echo $split"***************"
-
-
include_list=$(echo $split | grep "List")
-
include_void=$(echo $split | grep "void")
-
#char*hostMACList[]
-
if [[ "$include_list" != "" ]] ;then
-
newShow=$newShow"/*AAAAAA*/"
-
newParams=$newParams"/*AAAAAA*/"
-
elif [[ "$include_void" != "" ]] ;then
-
newShow=$newShow"/*BBBBBB*/"
-
newParams=$newParams"/*BBBBBB*/"
-
else
-
-
isString="0"
-
for element in $split
-
do
-
if [ "$element"x = "int"x ];then
-
newShow=$newShow",\n[%d]"
-
isString="0";
-
elif [ "$element"x = "char*"x ];then
-
newShow=$newShow",\n[%s]"
-
isString="1";
-
elif [ "$element"x = "char"x ];then
-
newShow=$newShow",\n[%s]"
-
isString="1";
-
else
-
include_star=$(echo $element | grep "*")
-
if [[ "$include_star" != "" ]] ;then
-
element=`echo ${element#*\*}`
-
if [ "$isString"x = "0"x ] ;then
-
newParams=$newParams","$element
-
else
-
newParams=$newParams",strlen("$element")?"$element":\"NULL\""
-
fi
-
else
-
if [ "$isString"x = "0"x ] ;then
-
newParams=$newParams","$element
-
else
-
newParams=$newParams",strlen("$element")?"$element":\"NULL\""
-
fi
-
fi
-
-
fi
-
done
-
fi
-
fi
-
-
((i++))
-
else
-
break
-
fi
-
done
-
-
-
newline=$newline$newShow"\n\"";
-
newline=$newline$newParams");";
-
-
#将$newline追加到$file中字符串<>所在行的行后
-
echo " "$newline > /var/tmp/aaaaa
-
cat /var/tmp/aaaaa
-
sed -i '/<>/ r /var/tmp/aaaaa' $file
-
done
阅读(1609) | 评论(0) | 转发(0) |