1 #!/bin/csh
2 #@(#)Open vi at file containing target (reg expr) (function or typedef).
3 #Allows user to choose which file if several exist.
4 #Uses vi options (excluding set) in envvar VTWINIT. Eg "ai nonu wm=0"
5
6 #1. Copy matching lines from std VTWTAGS file to temp VTWTAGS file (VTWTAGS)
7 #2. Show numbered list of functions/typedefs & their filenames
8 #3. Get user's choice (default 1)
9 #4. set EXINIT to VTWINIT + temp VTWTAGS file pathname
10 #5. cd to /tmp to avoid .exrc in current directory
11 #6. vt -t to function in temp VTWTAGS file (read only if called via vtv)
12 #6. If user wants to, pushd to file's directory.
13
14 #set VTWTARGET = ( !* )
15 set VTWTARGET = $1
16 set VTWFLAG = -R
17
18 if ( $VTWTARGET == "" ) then
19 echo "usage: vtw <target>"
20 unset VTWTARGET
21 exit
22 endif
23
24 set VTWTAGS = /tmp/vtw.$$
25
26 #Copy matching lines from old VTWTAGS file to temp VTWTAGS file & show menu
27 sed -n "/^[^ ]*$VTWTARGET/p" /usr/local/tina-libs/tina/ntags |\
28 sed 's?/^.*$??' |\
29 nl -nln >\
30 $VTWTAGS
31
32 cat $VTWTAGS
33
34 #Target found?
35 if (-f $VTWTAGS && ! -z $VTWTAGS ) then
36 #If several functions, show filenames & prompt (default 1st)
37 if ( `cat $VTWTAGS | wc -l` == 1 ) then
38 set VTWLINENO = 1
39 else
40 echo -n "Enter file number: "
41 set VTWLINENO = $<
42 endif
43
44 set VIFILE = `grep $VTWLINENO $VTWTAGS | head -n 1 | cut -f3`
45 set VSTRING = `grep $VTWLINENO $VTWTAGS | head -n 1 | cut -f2`
46 # echo $VIFILE
47 # echo $VSTRING
48 vi -R -c /$VSTRING $VIFILE
49 else
50 echo vtw: $VTWTARGET not found
51 endif
52
53 \rm $VTWTAGS
54
55 unset VTWFLAG VTWLINENO VTWTAGS VTWTARGET VTWVIEW
56
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.