Add -f -r flags to find-unused-errs
authorRich Salz <rsalz@openssl.org>
Sat, 15 Apr 2017 01:20:54 +0000 (21:20 -0400)
committerRich Salz <rsalz@openssl.org>
Sun, 16 Apr 2017 11:57:12 +0000 (07:57 -0400)
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3230)

util/find-unused-errs

index 68cf66b15f884802311f1fd8fc248223b97448f0..cd1026d5947c6c92a9ce033f171512fbac857a56 100755 (executable)
 export X1=/tmp/f.1.$$
 export X2=/tmp/f.2.$$
 
+case "$1" in
+    -f)
+        PAT='_F_'
+        echo Functions only
+        ;;
+    -[er])
+        PAT='_R_'
+        echo Reason codes only
+        ;;
+    "")
+        PAT='_[FR]_'
+        echo Function and reasons
+        ;;
+    *)
+        echo "Usage error; one of -[efr] required."
+        exit 1;
+        ;;
+esac
+
 cd include/openssl || exit 1
-grep '_[RF]_' * | awk '{print $3;}' | sort -u >$X1
+grep "$PAT" *  | grep -v ERR_FATAL_ERROR | awk '{print $3;}' | sort -u >$X1
 cd ../..
 
 for F in `cat $X1` ; do