Statistics
| Branch: | Revision:

root / arch-scripts / grep_xseg.sh @ 8e3ab0e2

History | View | Annotate | Download (685 Bytes)

1
#! /bin/bash
2

    
3
###################
4
# Initializations #
5
###################
6

    
7
set -e	#exit on error
8

    
9
# Find script location
10
ARCH_SCRIPTS=$(dirname "$(readlink /proc/$$/fd/255)")
11

    
12
#Include basic functions
13
source $ARCH_SCRIPTS/init.sh
14

    
15
SED_XSEG=$(echo "${XSEG}/" | sed 's/\//\\\//g')
16
INCLUDE="--include=*.c --include=*.h"
17

    
18
#############
19
# Arguments #
20
#############
21

    
22
if [[ -z $1 ]]; then
23
	red_echo "No parameters given."
24
	exit 1
25
elif [[ $1 = "-m" ]]; then
26
	INCLUDE="--include=Makefile --include=*.mk"
27
	shift
28
fi
29

    
30
#############
31
# Grep XSEG #
32
#############
33

    
34
grep -RIni --exclude-dir=${XSEG}/sys/user/python --exclude=test.c \
35
	${INCLUDE} --color=always -e $1 ${XSEG} | \
36
	sed 's/'$SED_XSEG'//'