Debian Codegraph @

GUI/PWgui/pwgui_reformat

raw
1 #!/bin/sh
2 # ----------------------------------------------------------------------
3 # PROGRAM: pwgui_reformat
4 # PURPOSE: reformat the input for nice lookout of a particular PWSCF module
5 # ----------------------------------------------------------------------
6 # Anton Kokalj
7 # Jozef Stefan Institute, Ljubljana, Slovenia
8 # INFM DEMOCRITOS National Simulation Center, Trieste, Italy
9 # Email: [email protected]
10 # ======================================================================
11 # Copyright (c) 2003--2004 Anton Kokalj
12 # ======================================================================
13 #
14 #
15 # This file is distributed under the terms of the GNU General Public
16 # License. See the file `COPYING' in the root directory of the present
17 # distribution, or http://www.gnu.org/copyleft/gpl.txt .
18 #
19 #
20 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 # NONINFRINGEMENT. IN NO EVENT SHALL ANTON KOKALJ BE LIABLE FOR ANY
24 # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #
28
29 if test "x`type readlink`" = "x"; then
30 # no readlink cmd; make a function-substitute
31 readlink() {
32 echo `ls -l $1 | awk '{print $NF}'`
33 }
34 fi
35
36 pathname() {
37 file=`type -p $1`
38 if test $? -gt 0; then
39 file=`which $1`
40 if test $? -gt 0; then
41 # give-up
42 file=$1
43 fi
44 fi
45 echo $file
46 }
47
48 pathdir() {
49 file=`pathname $1`
50
51 while test -h $file; do
52 file=`readlink $file`
53 done
54
55 dir=`dirname $file`
56 ( cd $dir; pwd )
57 }
58
59 if [ -z "$PWGUI" ]; then
60 # try to guess the PWGUI value
61 export PWGUI=`pathdir $0`
62 fi
63
64
65 if [ -d $PWGUI/bin ]; then
66 $PWGUI/bin/itkwish $PWGUI/pwgui_reformat.tcl $@
67 else
68 tclsh $PWGUI/pwgui_reformat.tcl $@
69 fi