* Add manc and msdn query scripts to rsc2

This commit is contained in:
capi 2011-03-18 14:07:52 +01:00
parent c0ab6cedd4
commit 44fa1dc253
2 changed files with 28 additions and 0 deletions

9
binr/rsc2/scripts/manc Normal file
View File

@ -0,0 +1,9 @@
#!/bin/bash
[[ -z $1 ]] && echo "$0 <Function>" && exit 1
MANPAGE=$(man 3 $1 2>/dev/null) ||
MANPAGE=$(man 2 $1 2>/dev/null) ||
MANPAGE=$(man 3C $1 2>/dev/null)
[[ -z "$MANPAGE" ]] && echo "Not found: $1" || (echo "$MANPAGE" | less)

19
binr/rsc2/scripts/msdn Normal file
View File

@ -0,0 +1,19 @@
#!/bin/bash
[[ -z $1 ]] && echo "$0 <Function>" && exit 1
TERM="xterm"
QUERY=$1
COLUMNS=$(tput cols)
URL=$(echo -e "$(curl "http://social.msdn.microsoft.com/Search/en-US/?Refinement=117%2c86&Query=$QUERY" 2>/dev/null | grep "Click(this, '117'" | head -1 | awk -F"'" '{print $4}')")
DUMP=$(links -no-g -width $COLUMNS -dump "$URL" 2>&1)
CDUMP="kk"
PRINT=0
echo "$DUMP" | while read LINE; do
[[ "$LINE" = *"$QUERY Function"* ]] && PRINT=1
[[ "$LINE" = *"Send comments about this topic to Microsoft"* ]] && PRINT=0
[[ $PRINT -eq 1 ]] && echo "$LINE"
done | less