]>
Commit | Line | Data |
---|---|---|
5b61754d MF |
1 | [[ $- != *i* ]] && return |
2 | ||
3 | alias bc='bc -q' | |
4 | alias duh='du . --max-depth=1 -h' | |
5 | alias eclipse='eclipse-3.1 -vmargs -Xmx512m' | |
6 | alias gdb='gdb --quiet' | |
7 | alias grep='grep --colour=auto' | |
8 | alias ls='ls --color=auto' | |
9 | alias lynx='lynx -nopause -accept_all_cookies -use_mouse' | |
10 | alias minicom='minicom -w -c on' | |
11 | alias nslookup='nslookup -sil' | |
12 | alias s='aspell -a' | |
13 | ss() { aspell -a <<<"$*"; } | |
14 | ||
15 | grep-svn() { find '(' -wholename '*/.svn' -prune -o -type f -print0 ')' | xargs -0 grep "$@" ; } | |
16 | ||
17 | scrub_patch() { | |
18 | sed -i \ | |
19 | -e '/^index /d' \ | |
20 | -e '/^new file mode /d' \ | |
21 | -e '/^Index:/d' \ | |
22 | -e '/^=========/d' \ | |
23 | -e '/^RCS file:/d' \ | |
24 | -e '/^retrieving/d' \ | |
25 | -e '/^diff/d' \ | |
26 | -e '/^Files .* differ$/d' \ | |
27 | -e '/^Only in /d' \ | |
28 | -e '/^Common subdirectories/d' \ | |
29 | -e '/^+++/s:\t.*::' \ | |
30 | -e '/^---/s:\t.*::' \ | |
31 | "$@" | |
32 | } | |
33 | ||
34 | cvs_gentoo_url() { | |
35 | _cvs_gentoo_url() { | |
36 | if [[ -n $2 ]] ; then | |
37 | echo "Usage: cvs_gentoo_url <file>[:rev1[:rev2]]" | |
38 | return 1 | |
39 | fi | |
40 | ||
41 | # spec has the form file:rev1[:rev2] | |
42 | # rev2 defaults to rev1-1 | |
43 | export IFS=: | |
44 | set -- $1 | |
45 | unset IFS | |
46 | ||
47 | local file=$1 | |
48 | if [[ ! -e ${file} ]] ; then | |
49 | echo "file '${file}' does not exist" | |
50 | return 1 | |
51 | fi | |
52 | local dir="." | |
53 | [[ ${file} == */* ]] && dir=${file%/*} | |
54 | file=${file##*/} | |
55 | ||
56 | local rev2=$2 | |
57 | if [[ -z ${rev2} ]] ; then | |
58 | rev2=$( | |
59 | cd ${dir} | |
60 | export IFS=/ | |
61 | set -- $(grep /${file}/ CVS/Entries) | |
62 | unset IFS | |
63 | echo $3 | |
64 | ) | |
65 | if [[ ${rev2} == "0" ]] ; then | |
66 | # new file | |
67 | rev2="1.1" | |
68 | else | |
69 | # existing file, bump rev automatically | |
70 | rev2="1.$((${rev2#1.}+1))" | |
71 | fi | |
72 | fi | |
73 | local rev2r=${rev2#1.} | |
74 | local rev1=${3:-1.$((rev2r - 1))} | |
75 | ||
76 | local cvsroot=$(<${dir}/CVS/Repository) | |
77 | if [[ ${cvsroot} == gentoo-x86* ]] ; then | |
78 | cvsroot=${cvsroot#gentoo-x86} | |
79 | cvsroot=${cvsroot#/} | |
80 | fi | |
81 | ||
82 | local urirev | |
83 | [[ ${rev2} == "1.1" || ${rev1} == "${rev2}" ]] \ | |
84 | && urirev="?rev=${rev2}" \ | |
85 | || urirev="?r1=${rev1}&r2=${rev2}" | |
86 | echo "http://sources.gentoo.org/${cvsroot}/${file}${urirev}" | |
87 | } | |
88 | local f | |
89 | for f in "$@" ; do | |
90 | _cvs_gentoo_url "${f}" | |
91 | done | |
92 | unset _cvs_gentoo_url | |
93 | } |