xref: /illumos-gate/usr/src/tools/smatch/src/smatch_data/db/vim_smdb (revision 1b58875ad7966cf2c85ee8e92f3da04f0a3b2f7a)
1#!/bin/bash
2
3# Add these lines to your .vimrc file
4#
5# map <C-r> :! vim_smdb return_states <cword> <CR> :execute 'edit' system("cat ~/.smdb_tmp/cur") <CR>
6# map <C-c> :! vim_smdb <cword> <CR> :execute 'edit' system("cat ~/.smdb_tmp/cur") <CR>
7#
8# Now you can move your cursor over a function and hit CTRL-c to see how it's
9# called or CTRL-r to see what it returns.  Use the ":bd" command to get back to
10# your source.
11
12DIR="$HOME/.smdb_tmp"
13mkdir -p $DIR
14
15for i in $(seq 1 100) ; do
16	if [ ! -e $DIR/$i ] ; then
17		break
18	fi
19done
20
21if [ $i == 100 ] ; then
22	i=1
23fi
24
25next=$(($i + 1))
26
27rm -f $DIR/$next
28rm $DIR/.${i}.swp
29smdb $* > $DIR/$i
30
31echo "$DIR/$i" > $DIR/cur
32
33