Subversion Repositories lagranto.ecmwf

Rev

Rev 3 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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