分类:
2014-12-17 18:22:29
原文地址:查找项目中的线程不安全API使用 作者:CUDev
asctime basename catgets crypt ctermid ctime dbm_clearerr dbm_close dbm_delete dbm_error dbm_fetch dbm_firstkey dbm_nextkey dbm_open dbm_store dirname dlerror drand48 ecvt encrypt endgrent endpwent endutxent fcvt ftw gcvt getc_unlocked getchar_unlocked getdate getenv getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getopt getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getutxent getutxid getutxline gmtime hcreate hdestroy hsearch inet_ntoa l64a lgamma lgammaf lgammal localeconv localtime lrand48 mrand48 nftw nl_langinfo ptsname putc_unlocked putchar_unlocked putenv pututxline rand readdir setenv setgrent setkey setpwent setutxent strerror strtok tmpnam ttyname unsetenv wcrtomb wcsrtombs wcstombs wctomb |
FileList=$(find $WorkDir -type f | grep -iP '\.(c|cpp|cxx|h|hxx)$') |
APIList=$(cat api.txt) |
for file in $FileList do echo "Searching "$file" ......" for api in $APIList do grep -w "$api" $file -nH >> non-thread-safe.log done done |
if [ -z $1 ];then WorkDir="." else WorkDir=$1 fi #获得API列表 APIList=$(cat api.txt) #获得项目源代码文件列表 FileList=$(find $WorkDir -type f | grep -iP '\.(c|cpp|cxx|h|hxx)$') rm -f non-thread-safe.log for file in $FileList do echo "Searching "$file" ......" for api in $APIList do grep -w "$api" $file -nH >> non-thread-safe.log done done |