[go: up one dir, main page]

Menu

[904618]: / util / imps.sh  Maximize  Restore  History

Download this file

35 lines (24 with data), 576 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
LASTFILE=""
touch /tmp/$$
while read line
do
SRCFILE="$(echo $line | cut -d ' ' -f 1)"
THISFILE="$(echo $SRCFILE | cut -d ':' -f 1)"
NEEDFUNC="$(echo $line | cut -d ' ' -f 2)"
# Change of file?
if [ "$THISFILE" != "$LASTFILE" ]
then
sort < /tmp/$$ | uniq
LASTFILE=$THISFILE
echo "*** $THISFILE"
rm -f /tmp/$$
touch /tmp/$$
fi
# Header it is inside
GREPLINE=$(grep -rHn $NEEDFUNC *.h | head -n 1)
USETHIS=$(echo $GREPLINE | cut -d ':' -f 1)
echo '#include "'$USETHIS'"' >> /tmp/$$
done < "$1"
sort < /tmp/$$ | uniq
rm -f /tmp/$$