File: ref.sh

package info (click to toggle)
radare2 6.0.7%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 78,360 kB
  • sloc: ansic: 903,263; sh: 8,137; javascript: 7,911; makefile: 5,503; python: 2,730; cpp: 789; perl: 404; lisp: 122; sed: 85; asm: 57; cs: 37; xml: 32; ruby: 29; java: 21
file content (33 lines) | stat: -rwxr-xr-x 684 bytes parent folder | download | duplicates (2)
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
# create .h from .c
# > git grep R_API open.c |cut -d : -f 2- | sed -e 's, {,;,'

# find files with \r\n
# > git grep `printf "\r\n"`

# find and replace

case "$1" in
h)
	git grep ^R_API $2 |cut -d : -f 2- | sed -e 's, {,;,'
	;;
g)
	git grep "$2"
	;;
n)
	shift
	while : ; do
		A="$1"
		perl -ne 's/\r\n/\n/g;print' < $A > $A._
		mv $A._ $A
		shift
		[ -z "$1" ] && break
	done
	;;
*)
	echo "Usage sys/ref.sh [action] [...]"
	echo " h [path]          # print R_API function signatures from C to H"
	echo " s [sed]           # perform regex on a bunch of files"
	echo " n [newlines]      # newlines replacements"
	echo " g [regex] [path]  # perform regex on a bunch of files"
	;;
esac