-
Notifications
You must be signed in to change notification settings - Fork 3
/
ascl
executable file
·61 lines (52 loc) · 1.13 KB
/
ascl
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /bin/csh -f
#
# a very simple accessor to the ascl online database in order to store
# a locally cashed version
#
# 1) warn if $dir doesn't exist
# 2) optionally use curl if wget doesn't exist
set mode=1
set dir=$HOME/ASCL
if ($mode == 1) then
set url=http://asterisk.apod.com/ascl.php
set test=$dir/ascl.php
else if ($mode == 2) then
set url=http://asterisk.apod.com/ascl2.php
set test=$dir/ascl2.php
else if ($mode == 3) then
set url=http://asterisk.apod.com/ascl_links.php
set test=$dir/ascl_links.php
else
exit 1
endif
if (! -e $test || $1 == new) then
echo Working in $test:h
cd $test:h
set f=$test:t
mv $f $f.prev
rm -f $test
if (-e /usr/bin/wget) then
wget $url
else if (-e /usr/bin/curl) then
echo curl $url not implemented
exit 0
else
wget $url
endif
cmp -s $f $f.prev
if ($status) then
echo $f was updated since the last fetch
echo tkdiff $f $f.prev
endif
exit 0
endif
if (
if ($#argv == 1) then
grep -i $1 $test
else if ($#argv == 2) then
grep -i $1 $test | grep -i $2
else if ($#argv == 3) then
grep -i $1 $test | grep -i $2 | grep -i $3
else
echo Usage:
endif