xref: /illumos-gate/usr/src/tools/smatch/src/smatch_data/db/apply_return_fixes.sh (revision 71815ce76261aa773c97600750fdce92334d1990)
1#!/bin/bash
2
3if echo $1 | grep -q '^-p' ; then
4    PROJ=$(echo $1 | cut -d = -f 2)
5    shift
6fi
7
8bin_dir=$(dirname $0)
9db_file=$1
10if [ "$db_file" == "" ] ; then
11    echo "usage: $0 -p=<project> <db_file>"
12    exit
13fi
14
15test -e  ${bin_dir}/${PROJ}.return_fixes && \
16cat ${bin_dir}/${PROJ}.return_fixes | \
17while read func old new ; do
18    echo "update return_states set return = '$new' where function = '$func' and return = '$old';" | sqlite3 $db_file
19done
20
21