File: convert.sh

package info (click to toggle)
libdate-calc-perl 4.2-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 584 kB
  • ctags: 171
  • sloc: perl: 3,382; ansic: 1,972; makefile: 56; sh: 54
file content (57 lines) | stat: -rwxr-xr-x 1,770 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

###############################################################################
##                                                                           ##
##    Copyright (c) 1998 by Steffen Beyer.                                   ##
##    All rights reserved.                                                   ##
##                                                                           ##
##    This program is free software; you can redistribute it                 ##
##    and/or modify it under the same terms as Perl.                         ##
##                                                                           ##
###############################################################################

self=`basename $0`

compile ()
{
    target=$1
    source="${target}.c"
    if [ -f "$target" ]
    then
        echo "$self: skipping compilation of '$source': '$target' exists!" >&2
    else
        echo "$self: compiling '$source'..."
        gcc -ansi -O2 -o $target $source
        if [ "$?" != "0" ]
        then
            echo "$self: unable to compile '$source'!" >&2
            echo "Please fix problem (or compile manually) and re-run $self.">&2
            exit 1
        fi
    fi
}

convert ()
{
    source=$1
    target="${source}_"
    if [ -f "$target" ]
    then
        echo "$self: skipping renaming of '$source': '$target' exists!" >&2
    else
        echo "$self: renaming '$source' to '$target'..."
        mv $source $target
    fi
    echo "$self: converting '$target' to '$source'..."
    ./iso2pc -dos <$target >$source
}

compile 'iso2pc'
compile 'pc2iso'

convert '../Calc.pm'
convert '../DateCalc.c'
convert '../DateCalc.h'
convert '../examples/age_in_days_eu.pl'
convert '../examples/age_in_days_us.pl'