4 |
michaesp |
1 |
#!/bin/csh
|
|
|
2 |
|
|
|
3 |
# ---------------------------------------------------------------------------
|
|
|
4 |
# Set parameters - handle arguments
|
|
|
5 |
# ---------------------------------------------------------------------------
|
|
|
6 |
|
|
|
7 |
# Set Lagranto
|
|
|
8 |
set LAGRANTO = ${LAGRANTOBASE}.${MODEL}
|
|
|
9 |
|
|
|
10 |
set dir = ${LAGRANTO}/docu/
|
|
|
11 |
set viewer = okular
|
|
|
12 |
set nargv = ${#argv}
|
|
|
13 |
|
|
|
14 |
if ( (${#argv} == 0) ) then
|
|
|
15 |
nroff -man ${dir}/man/lagrantohelp.0 | less
|
|
|
16 |
exit 0
|
|
|
17 |
endif
|
|
|
18 |
|
|
|
19 |
if ( "${nargv}" == "1" ) then
|
|
|
20 |
set mode = "$1"
|
|
|
21 |
set verb = "long"
|
|
|
22 |
else if ( "${nargv}" == "2" ) then
|
|
|
23 |
set mode = "$1"
|
|
|
24 |
set verb = "$2"
|
|
|
25 |
endif
|
|
|
26 |
|
|
|
27 |
# ---------------------------------------------------------------------------
|
|
|
28 |
# Tutorial, Reference, Presentation, Future Plans
|
|
|
29 |
# ---------------------------------------------------------------------------
|
|
|
30 |
|
|
|
31 |
if ( "$mode" == "future" ) then
|
|
|
32 |
nroff -man ${dir}/man/futureplans.0 | less
|
|
|
33 |
exit 0
|
|
|
34 |
endif
|
|
|
35 |
|
|
|
36 |
if ( "$mode" == "tutorial" ) then
|
|
|
37 |
${viewer} ${dir}/tutorial/tutorial.pdf
|
|
|
38 |
exit 0
|
|
|
39 |
endif
|
|
|
40 |
|
|
|
41 |
if ( "$mode" == "reference" ) then
|
|
|
42 |
${viewer} ${dir}/reference/reference.pdf
|
|
|
43 |
exit 0
|
|
|
44 |
endif
|
|
|
45 |
|
|
|
46 |
if ( "$mode" == "presentation" ) then
|
|
|
47 |
${viewer} ${dir}/presentation/presentation.pdf
|
|
|
48 |
exit 0
|
|
|
49 |
endif
|
|
|
50 |
|
|
|
51 |
# ---------------------------------------------------------------------------
|
|
|
52 |
# Manual
|
|
|
53 |
# ---------------------------------------------------------------------------
|
|
|
54 |
|
|
|
55 |
if ( "${verb}" == "long" ) then
|
|
|
56 |
nroff -man ${dir}/man/${mode}.0 | less
|
|
|
57 |
exit 0
|
|
|
58 |
endif
|
|
|
59 |
|
|
|
60 |
if ( "${verb}" == "short" ) then
|
|
|
61 |
echo
|
|
|
62 |
nroff -man ${dir}/man/${mode}.0 | grep -A 1 SYNOPSIS
|
|
|
63 |
echo
|
|
|
64 |
set i0 = `nroff -man ${dir}/man/${mode}.0 | grep -n EXAMPLES | awk -F ":" '{print $1}'`
|
|
|
65 |
set i1 = `nroff -man ${dir}/man/${mode}.0 | grep -n AUTHOR | awk -F ":" '{print $1}'`
|
|
|
66 |
set i1 = `echo "$i1 - 1" | bc`
|
|
|
67 |
if ( ( "$i0" != "" ) & ( "$i1" != "" ) ) then
|
|
|
68 |
nroff -man ${dir}/man/${mode}.0 | sed -ne ${i0},${i1}p
|
|
|
69 |
endif
|
|
|
70 |
endif
|
|
|
71 |
|
|
|
72 |
if ( "${verb}" == "synopsis" ) then
|
|
|
73 |
echo
|
|
|
74 |
nroff -man ${dir}/man/${mode}.0 | grep -A 1 SYNOPSIS
|
|
|
75 |
echo
|
|
|
76 |
exit 0
|
|
|
77 |
endif
|
|
|
78 |
|
|
|
79 |
if ( "${verb}" == "parameter" ) then
|
|
|
80 |
set i0 = `nroff -man ${dir}/man/${mode}.0 | grep -n PARAMETERS | awk -F ":" '{print $1}'`
|
|
|
81 |
set i1 = `nroff -man ${dir}/man/${mode}.0 | grep -n EXAMPLES | awk -F ":" '{print $1}'`
|
|
|
82 |
set i1 = `echo "$i1 - 1" | bc`
|
|
|
83 |
echo $i0
|
|
|
84 |
echo $i1
|
|
|
85 |
if ( ( "$i0" != "" ) & ( "$i1" != "" ) ) then
|
|
|
86 |
nroff -man ${dir}/man/${mode}.0 | sed -ne ${i0},${i1}p
|
|
|
87 |
endif
|
|
|
88 |
exit 0
|
|
|
89 |
endif
|
|
|
90 |
|
|
|
91 |
if ( "${verb}" == "examples" ) then
|
|
|
92 |
set i0 = `nroff -man ${dir}/man/${mode}.0 | grep -n EXAMPLES | awk -F ":" '{print $1}'`
|
|
|
93 |
set i1 = `nroff -man ${dir}/man/${mode}.0 | grep -n AUTHOR | awk -F ":" '{print $1}'`
|
|
|
94 |
set i1 = `echo "$i1 - 1" | bc`
|
|
|
95 |
if ( ( "$i0" != "" ) & ( "$i1" != "" ) ) then
|
|
|
96 |
nroff -man ${dir}/man/${mode}.0 | sed -ne ${i0},${i1}p
|
|
|
97 |
endif
|
|
|
98 |
exit 0
|
|
|
99 |
endif
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
exit 0
|