~ubuntu-branches/debian/wheezy/eperl/wheezy

« back to all changes in this revision

Viewing changes to etc/shtool

  • Committer: Bazaar Package Importer
  • Author(s): Denis Barbier
  • Date: 2001-12-18 20:40:24 UTC
  • Revision ID: james.westby@ubuntu.com-20011218204024-k0oaqq2eaw733v30
Tags: 2.2.14-4
* Remove emacs crap from debian/changelog
* Fix misspelling in debian/copyright

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
##
 
3
##  GNU shtool -- The GNU Portable Shell Tool
 
4
##  Copyright (c) 1994-2000 Ralf S. Engelschall <rse@engelschall.com>
 
5
##
 
6
##  See http://www.gnu.org/software/shtool/ for more information.
 
7
##  See ftp://ftp.gnu.org/gnu/shtool/ for latest version.
 
8
##
 
9
##  Version:  1.5.1 (29-Jul-2000)
 
10
##  Contents: 5/17 available modules
 
11
##
 
12
 
 
13
##
 
14
##  This program is free software; you can redistribute it and/or modify
 
15
##  it under the terms of the GNU General Public License as published by
 
16
##  the Free Software Foundation; either version 2 of the License, or
 
17
##  (at your option) any later version.
 
18
##
 
19
##  This program is distributed in the hope that it will be useful,
 
20
##  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
21
##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
22
##  General Public License for more details.
 
23
##
 
24
##  You should have received a copy of the GNU General Public License
 
25
##  along with this program; if not, write to the Free Software
 
26
##  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 
27
##  USA, or contact Ralf S. Engelschall <rse@engelschall.com>.
 
28
##
 
29
##  Notice: Given that you include this file verbatim into your own
 
30
##  source tree, you are justified in saying that it remains separate
 
31
##  from your package, and that this way you are simply just using GNU
 
32
##  shtool. So, in this situation, there is no requirement that your
 
33
##  package itself is licensed under the GNU General Public License in
 
34
##  order to take advantage of GNU shtool.
 
35
##
 
36
 
 
37
##
 
38
##  Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]
 
39
##
 
40
##  Available commands:
 
41
##    echo       Print string with optional construct expansion
 
42
##    install    Install a program, script or datafile
 
43
##    mkdir      Make one or more directories
 
44
##    fixperm    Fix file permissions inside a source tree
 
45
##    version    Maintain a version information file
 
46
##
 
47
##  Not available commands (because module was not built-in):
 
48
##    mdate      Pretty-print modification time of a file or dir
 
49
##    table      Pretty-print a field-separated list as a table
 
50
##    prop       Display progress with a running propeller
 
51
##    move       Move files with simultaneous substitution
 
52
##    mkln       Make link with calculation of relative paths
 
53
##    mkshadow   Make a shadow tree through symbolic links
 
54
##    tarball    Roll distribution tarballs
 
55
##    guessos    Simple operating system guesser
 
56
##    arx        Extended archive command
 
57
##    slo        Separate linker options by library class
 
58
##    scpp       Sharing C Pre-Processor
 
59
##    path       Deal with program paths
 
60
##
 
61
 
 
62
if [ $# -eq 0 ]; then
 
63
    echo "$0:Error: invalid command line" 1>&2
 
64
    echo "$0:Hint:  run \`$0 -h' for usage" 1>&2
 
65
    exit 1
 
66
fi
 
67
if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
 
68
    echo "This is GNU shtool, version 1.5.1 (29-Jul-2000)"
 
69
    echo "Copyright (c) 1994-2000 Ralf S. Engelschall <rse@engelschall.com>"
 
70
    echo "Report bugs to <bug-shtool@gnu.org>"
 
71
    echo ''
 
72
    echo "Usage: shtool [<options>] [<cmd-name> [<cmd-options>] [<cmd-args>]]" 
 
73
    echo ''
 
74
    echo 'Available global <options>:'
 
75
    echo '  -v, --version   display shtool version information'
 
76
    echo '  -h, --help      display shtool usage help page (this one)'
 
77
    echo '  -d, --debug     display shell trace information'
 
78
    echo '  -r, --recreate  recreate this shtool script via shtoolize'
 
79
    echo ''
 
80
    echo 'Available <cmd-name> [<cmd-options>] [<cmd-args>]:'
 
81
    echo '  echo     [-n] [-e] [<str> ...]'
 
82
    echo '  install  [-v] [-t] [-c] [-C] [-s] [-m<mode>] [-o<owner>] [-g<group>]'
 
83
    echo '           [-e<ext>] <file> [<file> ...] <path>'
 
84
    echo '  mkdir    [-t] [-f] [-p] [-m<mode>] <dir> [<dir> ...]'
 
85
    echo '  fixperm  [-v] [-t] <path> [<path> ...]'
 
86
    echo '  version  [-l<lang>] [-n<name>] [-p<prefix>] [-s<version>] [-e]'
 
87
    echo '           [-i<knob>] [-d<type>] <file>'
 
88
    echo ''
 
89
    echo 'Not available <cmd-name> (because module was not built-in):'
 
90
    echo '  mdate    [-n] [-z] [-s] [-d] [-f<str>] [-o<spec>] <path>'
 
91
    echo '  table    [-F<sep>] [-w<width>] [-c<cols>] [-s<strip>] <str><sep><str>...'
 
92
    echo '  prop     [-p<str>]'
 
93
    echo '  move     [-v] [-t] [-e] [-p] <src-file> <dst-file>'
 
94
    echo '  mkln     [-t] [-f] [-s] <src-path> [<src-path> ...] <dst-path>'
 
95
    echo '  mkshadow [-v] [-t] [-a] <src-dir> <dst-dir>'
 
96
    echo '  tarball  [-t] [-v] [-o <tarball>] [-c <prog>] [-d <dir>] [-u'
 
97
    echo '           <user>] [-g <group>] [-e <pattern>] <path> [<path> ...]'
 
98
    echo '  guessos  '
 
99
    echo '  arx      [-t] [-C<cmd>] <op> <archive> [<file> ...]'
 
100
    echo '  slo      [-p<str>] -- -L<dir> -l<lib> [-L<dir> -l<lib> ...]'
 
101
    echo '  scpp     [-v] [-p] [-f<filter>] [-o<ofile>] [-t<tfile>] [-M<mark>]'
 
102
    echo '           [-D<dname>] [-C<cname>] <file> [<file> ...]'
 
103
    echo '  path     [-s] [-r] [-d] [-b] [-m] [-p<path>] <str> [<str> ...]'
 
104
    echo ''
 
105
    exit 0
 
106
fi
 
107
if [ ".$1" = ".-v" -o ".$1" = ."--version" ]; then
 
108
    echo "GNU shtool 1.5.1 (29-Jul-2000)"
 
109
    exit 0
 
110
fi
 
111
if [ ".$1" = ".-r" -o ".$1" = ."--recreate" ]; then
 
112
    shtoolize -oetc/shtool echo install mkdir fixperm version
 
113
    exit 0
 
114
fi
 
115
if [ ".$1" = ".-d" -o ".$1" = ."--debug" ]; then
 
116
    shift
 
117
    set -x
 
118
fi
 
119
name=`echo "$0" | sed -e 's;.*/\([^/]*\)$;\1;' -e 's;-sh$;;' -e 's;\.sh$;;'`
 
120
case "$name" in
 
121
    echo|install|mkdir|fixperm|version )
 
122
        #   implicit tool command selection
 
123
        tool="$name"
 
124
        ;;
 
125
    * )
 
126
        #   explicit tool command selection
 
127
        tool="$1"
 
128
        shift
 
129
        ;;
 
130
esac
 
131
arg_spec=""
 
132
opt_spec=""
 
133
gen_tmpfile=no
 
134
 
 
135
##
 
136
##  DISPATCH INTO SCRIPT PROLOG
 
137
##
 
138
 
 
139
case $tool in
 
140
    echo )
 
141
        str_tool="echo"
 
142
        str_usage="[-n] [-e] [<str> ...]"
 
143
        arg_spec="0+"
 
144
        opt_spec="n.e."
 
145
        opt_n=no
 
146
        opt_e=no
 
147
        ;;
 
148
    install )
 
149
        str_tool="install"
 
150
        str_usage="[-v] [-t] [-c] [-C] [-s] [-m<mode>] [-o<owner>] [-g<group>] [-e<ext>] <file> [<file> ...] <path>"
 
151
        arg_spec="2+"
 
152
        opt_spec="v.t.c.C.s.m:o:g:e:"
 
153
        opt_v=no
 
154
        opt_t=no
 
155
        opt_c=no
 
156
        opt_C=no
 
157
        opt_s=no
 
158
        opt_m=""
 
159
        opt_o=""
 
160
        opt_g=""
 
161
        opt_e=""
 
162
        ;;
 
163
    mkdir )
 
164
        str_tool="mkdir"
 
165
        str_usage="[-t] [-f] [-p] [-m<mode>] <dir> [<dir> ...]"
 
166
        arg_spec="1+"
 
167
        opt_spec="t.f.p.m:"
 
168
        opt_t=no
 
169
        opt_f=no
 
170
        opt_p=no
 
171
        opt_m=""
 
172
        ;;
 
173
    fixperm )
 
174
        str_tool="fixperm"
 
175
        str_usage="[-v] [-t] <path> [<path> ...]"
 
176
        arg_spec="1+"
 
177
        opt_spec="v.t."
 
178
        opt_v=no
 
179
        opt_t=no
 
180
        ;;
 
181
    version )
 
182
        str_tool="version"
 
183
        str_usage="[-l<lang>] [-n<name>] [-p<prefix>] [-s<version>] [-e] [-i<knob>] [-d<type>] <file>"
 
184
        arg_spec="1="
 
185
        opt_spec="l:n:p:s:i:e.d:"
 
186
        opt_l="txt"
 
187
        opt_n="unknown"
 
188
        opt_p=""
 
189
        opt_s=""
 
190
        opt_e="no"
 
191
        opt_i=""
 
192
        opt_d="short"
 
193
        ;;
 
194
    -* )
 
195
        echo "$0:Error: unknown option \`$tool'" 2>&1
 
196
        echo "$0:Hint:  run \`$0 -h' for usage" 2>&1
 
197
        exit 1
 
198
        ;;
 
199
    * )
 
200
        echo "$0:Error: unknown command \`$tool'" 2>&1
 
201
        echo "$0:Hint:  run \`$0 -h' for usage" 2>&1
 
202
        exit 1
 
203
        ;;
 
204
esac
 
205
 
 
206
##
 
207
##  COMMON UTILITY CODE
 
208
##
 
209
 
 
210
#   determine name of tool
 
211
if [ ".$tool" != . ]; then
 
212
    #   used inside shtool script
 
213
    toolcmd="$0 $tool"
 
214
    toolcmdhelp="shtool $tool"
 
215
    msgprefix="shtool:$tool"
 
216
else
 
217
    #   used as standalone script
 
218
    toolcmd="$0"
 
219
    toolcmdhelp="sh $0"
 
220
    msgprefix="$str_tool"
 
221
fi
 
222
 
 
223
#   parse argument specification string
 
224
eval `echo $arg_spec |\
 
225
      sed -e 's/^\([0-9]*\)\([+=]\)/arg_NUMS=\1; arg_MODE=\2/'`
 
226
 
 
227
#   parse option specification string
 
228
eval `echo h.$opt_spec |\
 
229
      sed -e 's/\([a-zA-Z0-9]\)\([.:+]\)/opt_MODE_\1=\2;/g'`
 
230
 
 
231
#   interate over argument line
 
232
opt_PREV=''
 
233
while [ $# -gt 0 ]; do
 
234
    #   special option stops processing
 
235
    if [ ".$1" = ".--" ]; then
 
236
        shift
 
237
        break
 
238
    fi
 
239
 
 
240
    #   determine option and argument
 
241
    opt_ARG_OK=no
 
242
    if [ ".$opt_PREV" != . ]; then
 
243
        #   merge previous seen option with argument
 
244
        opt_OPT="$opt_PREV"
 
245
        opt_ARG="$1"
 
246
        opt_ARG_OK=yes
 
247
        opt_PREV=''
 
248
    else
 
249
        #   split argument into option and argument
 
250
        case "$1" in
 
251
            -[a-zA-Z0-9]*)
 
252
                eval `echo "x$1" |\
 
253
                      sed -e 's/^x-\([a-zA-Z0-9]\)/opt_OPT="\1";/' \
 
254
                          -e 's/";\(.*\)$/"; opt_ARG="\1"/'`
 
255
                ;;
 
256
            -[a-zA-Z0-9])
 
257
                opt_OPT=`echo "x$1" | cut -c3-`
 
258
                opt_ARG=''
 
259
                ;;
 
260
            *)
 
261
                break
 
262
                ;;
 
263
        esac
 
264
    fi
 
265
 
 
266
    #   eat up option
 
267
    shift
 
268
 
 
269
    #   determine whether option needs an argument
 
270
    eval "opt_MODE=\$opt_MODE_${opt_OPT}"
 
271
    if [ ".$opt_ARG" = . -a ".$opt_ARG_OK" != .yes ]; then
 
272
        if [ ".$opt_MODE" = ".:" -o ".$opt_MODE" = ".+" ]; then
 
273
            opt_PREV="$opt_OPT"
 
274
            continue
 
275
        fi
 
276
    fi
 
277
 
 
278
    #   process option
 
279
    case $opt_MODE in
 
280
        '.' )
 
281
            #   boolean option
 
282
            eval "opt_${opt_OPT}=yes"
 
283
            ;;
 
284
        ':' )
 
285
            #   option with argument (multiple occurances override)
 
286
            eval "opt_${opt_OPT}=\"\$opt_ARG\""
 
287
            ;;
 
288
        '+' )
 
289
            #   option with argument (multiple occurances append)
 
290
            eval "opt_${opt_OPT}=\"\$opt_${opt_OPT} \$opt_ARG\""
 
291
            ;;
 
292
        * )
 
293
            echo "$msgprefix:Error: unknown option: \`-$opt_OPT'" 1>&2
 
294
            echo "$msgprefix:Hint:  run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2
 
295
            exit 1
 
296
            ;;
 
297
    esac
 
298
done
 
299
if [ ".$opt_PREV" != . ]; then
 
300
    echo "$msgprefix:Error: missing argument to option \`-$opt_PREV'" 1>&2
 
301
    echo "$msgprefix:Hint:  run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2
 
302
    exit 1
 
303
fi
 
304
 
 
305
#   process help option
 
306
if [ ".$opt_h" = .yes ]; then
 
307
    echo "Usage: $toolcmdhelp $str_usage"
 
308
    exit 0
 
309
fi
 
310
 
 
311
#   complain about incorrect number of arguments
 
312
case $arg_MODE in
 
313
    '=' )
 
314
        if [ $# -ne $arg_NUMS ]; then
 
315
            echo "$msgprefix:Error: invalid number of arguments (exactly $arg_NUMS expected)" 1>&2
 
316
            echo "$msgprefix:Hint:  run \`$toolcmd -h' or \`man shtool' for details" 1>&2
 
317
            exit 1
 
318
        fi
 
319
        ;;
 
320
    '+' )
 
321
        if [ $# -lt $arg_NUMS ]; then
 
322
            echo "$msgprefix:Error: invalid number of arguments (at least $arg_NUMS expected)" 1>&2
 
323
            echo "$msgprefix:Hint:  run \`$toolcmd -h' or \`man shtool' for details" 1>&2
 
324
            exit 1
 
325
        fi
 
326
        ;;
 
327
esac
 
328
 
 
329
#   establish a temporary file on request
 
330
if [ ".$gen_tmpfile" = .yes ]; then
 
331
    if [ ".$TMPDIR" != . ]; then
 
332
        tmpdir="$TMPDIR"
 
333
    elif [ ".$TEMPDIR" != . ]; then
 
334
        tmpdir="$TEMPDIR"
 
335
    else
 
336
        tmpdir="/tmp"
 
337
    fi
 
338
    tmpfile="$tmpdir/.shtool.$$"
 
339
    rm -f $tmpfile >/dev/null 2>&1
 
340
    touch $tmpfile
 
341
fi
 
342
 
 
343
##
 
344
##  DISPATCH INTO SCRIPT BODY
 
345
##
 
346
 
 
347
case $tool in
 
348
 
 
349
echo )
 
350
    ##
 
351
    ##  echo -- Print string with optional construct expansion
 
352
    ##  Copyright (c) 1998-2000 Ralf S. Engelschall <rse@engelschall.com>
 
353
    ##  Originally written for WML as buildinfo
 
354
    ##
 
355
    
 
356
    text="$*"
 
357
    
 
358
    #   check for broken escape sequence expansion
 
359
    seo=''
 
360
    bytes=`echo '\1' | wc -c | awk '{ printf("%s", $1); }'`
 
361
    if [ ".$bytes" != .3 ]; then
 
362
        bytes=`echo -E '\1' | wc -c | awk '{ printf("%s", $1); }'`
 
363
        if [ ".$bytes" = .3 ]; then
 
364
            seo='-E'
 
365
        fi
 
366
    fi
 
367
    
 
368
    #   check for existing -n option (to suppress newline)
 
369
    minusn=''
 
370
    bytes=`echo -n 123 2>/dev/null | wc -c | awk '{ printf("%s", $1); }'`
 
371
    if [ ".$bytes" = .3 ]; then
 
372
        minusn='-n'
 
373
    fi
 
374
    
 
375
    #   determine terminal bold sequence
 
376
    term_bold='' 
 
377
    term_norm=''
 
378
    if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[Bb]'`" != . ]; then
 
379
        case $TERM in
 
380
            #   for the most important terminal types we directly know the sequences
 
381
            xterm|xterm*|vt220|vt220*)
 
382
                term_bold=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
 
383
                term_norm=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
 
384
                ;;
 
385
            vt100|vt100*)
 
386
                term_bold=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' </dev/null 2>/dev/null`
 
387
                term_norm=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/null 2>/dev/null`
 
388
                ;;
 
389
            #   for all others, we try to use a possibly existing `tput' or `tcout' utility
 
390
            * )
 
391
                paths=`echo $PATH | sed -e 's/:/ /g'`
 
392
                for tool in tput tcout; do
 
393
                    for dir in $paths; do
 
394
                        if [ -r "$dir/$tool" ]; then
 
395
                            for seq in bold md smso; do # 'smso' is last
 
396
                                bold="`$dir/$tool $seq 2>/dev/null`"
 
397
                                if [ ".$bold" != . ]; then
 
398
                                    term_bold="$bold"
 
399
                                    break
 
400
                                fi
 
401
                            done
 
402
                            if [ ".$term_bold" != . ]; then
 
403
                                for seq in sgr0 me rmso reset; do # 'reset' is last
 
404
                                    norm="`$dir/$tool $seq 2>/dev/null`"
 
405
                                    if [ ".$norm" != . ]; then
 
406
                                        term_norm="$norm"
 
407
                                        break
 
408
                                    fi
 
409
                                done
 
410
                            fi
 
411
                            break
 
412
                        fi
 
413
                    done
 
414
                    if [ ".$term_bold" != . -a ".$term_norm" != . ]; then
 
415
                        break;
 
416
                    fi
 
417
                done
 
418
                ;;
 
419
        esac
 
420
        if [ ".$term_bold" = . -o ".$term_norm" = . ]; then
 
421
            echo "$msgprefix:Warning: unable to determine terminal sequence for bold mode" 1>&2
 
422
        fi
 
423
    fi
 
424
    
 
425
    #   determine user name
 
426
    username=''
 
427
    if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[uU]'`" != . ]; then
 
428
        username="$LOGNAME"
 
429
        if [ ".$username" = . ]; then
 
430
            username="$USER"
 
431
            if [ ".$username" = . ]; then
 
432
                username="`(whoami) 2>/dev/null |\
 
433
                           awk '{ printf("%s", $1); }'`"
 
434
                if [ ".$username" = . ]; then
 
435
                    username="`(who am i) 2>/dev/null |\
 
436
                               awk '{ printf("%s", $1); }'`"
 
437
                    if [ ".$username" = . ]; then
 
438
                        username='unknown'
 
439
                    fi
 
440
                fi
 
441
            fi
 
442
        fi
 
443
    fi
 
444
    
 
445
    #   determine user id
 
446
    userid=''
 
447
    if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%U'`" != . ]; then
 
448
        userid="`(id -u) 2>/dev/null`"
 
449
        if [ ".$userid" = . ]; then
 
450
            str="`(id) 2>/dev/null`"
 
451
            if [ ".`echo $str | grep '^uid[     ]*=[    ]*[0-9]*('`" != . ]; then
 
452
                userid=`echo $str | sed -e 's/^uid[     ]*=[    ]*//' -e 's/(.*//'`
 
453
            fi
 
454
            if [ ".$userid" = . ]; then
 
455
                userid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \
 
456
                        sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
 
457
                if [ ".$userid" = . ]; then
 
458
                    userid=`(ypcat passwd) 2>/dev/null |
 
459
                            egrep "^${username}:" | \
 
460
                            sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'`
 
461
                    if [ ".$userid" = . ]; then
 
462
                        userid='?'
 
463
                    fi
 
464
                fi
 
465
            fi
 
466
        fi
 
467
    fi
 
468
    
 
469
    #   determine host name
 
470
    hostname=''
 
471
    if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%h'`" != . ]; then
 
472
        hostname="`(uname -n) 2>/dev/null |\
 
473
                   awk '{ printf("%s", $1); }'`"
 
474
        if [ ".$hostname" = . ]; then
 
475
            hostname="`(hostname) 2>/dev/null |\
 
476
                       awk '{ printf("%s", $1); }'`"
 
477
            if [ ".$hostname" = . ]; then
 
478
                hostname='unknown'
 
479
            fi
 
480
        fi
 
481
        case $hostname in
 
482
            *.* )
 
483
                domainname=".`echo $hostname | cut -d. -f2-`"
 
484
                hostname="`echo $hostname | cut -d. -f1`"
 
485
                ;;
 
486
        esac
 
487
    fi
 
488
    
 
489
    #   determine domain name
 
490
    domainname=''
 
491
    if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%d'`" != . ]; then
 
492
        if [ ".$domainname" = . ]; then
 
493
            if [ -f /etc/resolv.conf ]; then
 
494
                domainname="`egrep '^[  ]*domain' /etc/resolv.conf | head -1 |\
 
495
                             sed -e 's/.*domain//' \
 
496
                                 -e 's/^[       ]*//' -e 's/^ *//' -e 's/^      *//' \
 
497
                                 -e 's/^\.//' -e 's/^/./' |\
 
498
                             awk '{ printf("%s", $1); }'`"
 
499
                if [ ".$domainname" = . ]; then
 
500
                    domainname="`egrep '^[      ]*search' /etc/resolv.conf | head -1 |\
 
501
                                 sed -e 's/.*search//' \
 
502
                                     -e 's/^[   ]*//' -e 's/^ *//' -e 's/^      *//' \
 
503
                                     -e 's/ .*//' -e 's/        .*//' \
 
504
                                     -e 's/^\.//' -e 's/^/./' |\
 
505
                                 awk '{ printf("%s", $1); }'`"
 
506
                fi
 
507
            fi
 
508
        fi
 
509
    fi
 
510
    
 
511
    #   determine current time
 
512
    time_day=''
 
513
    time_month=''
 
514
    time_year=''
 
515
    time_monthname=''
 
516
    if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[DMYm]'`" != . ]; then
 
517
        time_day=`date '+%d'`
 
518
        time_month=`date '+%m'`
 
519
        time_year=`date '+%Y' 2>/dev/null`
 
520
        if [ ".$time_year" = . ]; then
 
521
            time_year=`date '+%y'`
 
522
            case $time_year in
 
523
                [5-9][0-9]) time_year="19$time_year" ;;
 
524
                [0-4][0-9]) time_year="20$time_year" ;;
 
525
            esac
 
526
        fi
 
527
        case $time_month in
 
528
            1|01) time_monthname='Jan' ;;
 
529
            2|02) time_monthname='Feb' ;;
 
530
            3|03) time_monthname='Mar' ;;
 
531
            4|04) time_monthname='Apr' ;;
 
532
            5|05) time_monthname='May' ;;
 
533
            6|06) time_monthname='Jun' ;;
 
534
            7|07) time_monthname='Jul' ;;
 
535
            8|08) time_monthname='Aug' ;;
 
536
            9|09) time_monthname='Sep' ;;
 
537
              10) time_monthname='Oct' ;;
 
538
              11) time_monthname='Nov' ;;
 
539
              12) time_monthname='Dec' ;;
 
540
        esac
 
541
    fi
 
542
    
 
543
    #   expand special ``%x'' constructs
 
544
    if [ ".$opt_e" = .yes ]; then
 
545
        text=`echo $seo "$text" |\
 
546
              sed -e "s/%B/${term_bold}/g" \
 
547
                  -e "s/%b/${term_norm}/g" \
 
548
                  -e "s/%u/${username}/g" \
 
549
                  -e "s/%U/${userid}/g" \
 
550
                  -e "s/%h/${hostname}/g" \
 
551
                  -e "s/%d/${domainname}/g" \
 
552
                  -e "s/%D/${time_day}/g" \
 
553
                  -e "s/%M/${time_month}/g" \
 
554
                  -e "s/%Y/${time_year}/g" \
 
555
                  -e "s/%m/${time_monthname}/g" 2>/dev/null`
 
556
    fi
 
557
    
 
558
    #   create output
 
559
    if [ .$opt_n = .no ]; then
 
560
        echo $seo "$text"
 
561
    else
 
562
        #   the harder part: echo -n is best, because
 
563
        #   awk may complain about some \xx sequences.
 
564
        if [ ".$minusn" != . ]; then
 
565
            echo $seo $minusn "$text"
 
566
        else
 
567
            echo dummy | awk '{ printf("%s", TEXT); }' TEXT="$text"
 
568
        fi
 
569
    fi
 
570
    ;;
 
571
 
 
572
install )
 
573
    ##
 
574
    ##  install -- Install a program, script or datafile
 
575
    ##  Copyright (c) 1997-2000 Ralf S. Engelschall <rse@engelschall.com>
 
576
    ##  Originally written for shtool
 
577
    ##
 
578
    
 
579
    #   determine source(s) and destination 
 
580
    argc=$#
 
581
    srcs=""
 
582
    while [ $# -gt 1 ]; do
 
583
        srcs="$srcs $1"
 
584
        shift
 
585
    done
 
586
    dstpath="$1"
 
587
    
 
588
    #   type check for destination
 
589
    dstisdir=0
 
590
    if [ -d $dstpath ]; then
 
591
        dstpath=`echo "$dstpath" | sed -e 's:/$::'`
 
592
        dstisdir=1
 
593
    fi
 
594
    
 
595
    #   consistency check for destination
 
596
    if [ $argc -gt 2 -a $dstisdir = 0 ]; then
 
597
        echo "$msgprefix:Error: multiple sources require destination to be directory" 1>&2
 
598
        exit 1
 
599
    fi
 
600
    
 
601
    #   iterate over all source(s)
 
602
    for src in $srcs; do
 
603
        dst=$dstpath
 
604
    
 
605
        #  If destination is a directory, append the input filename
 
606
        if [ $dstisdir = 1 ]; then
 
607
            dstfile=`echo "$src" | sed -e 's;.*/\([^/]*\)$;\1;'`
 
608
            dst="$dst/$dstfile"
 
609
        fi
 
610
    
 
611
        #  Add a possible extension to src and dst
 
612
        if [ ".$opt_e" != . ]; then
 
613
            src="$src$opt_e"
 
614
            dst="$dst$opt_e"
 
615
        fi
 
616
    
 
617
        #  Check for correct arguments
 
618
        if [ ".$src" = ".$dst" ]; then
 
619
            echo "$msgprefix:Warning: source and destination are the same - skipped" 1>&2
 
620
            continue
 
621
        fi
 
622
        if [ -d "$src" ]; then
 
623
            echo "$msgprefix:Warning: source \`$src' is a directory - skipped" 1>&2
 
624
            continue
 
625
        fi
 
626
    
 
627
        #  Make a temp file name in the destination directory
 
628
        dsttmp=`echo $dst |\
 
629
                sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;' \
 
630
                    -e "s;\$;/#INST@$$#;"`
 
631
    
 
632
        #  Verbosity
 
633
        if [ ".$opt_v" = .yes ]; then
 
634
            echo "$src -> $dst" 1>&2
 
635
        fi
 
636
    
 
637
        #  Copy or move the file name to the temp name
 
638
        #  (because we might be not allowed to change the source)
 
639
        if [ ".$opt_C" = .yes ]; then
 
640
            opt_c=yes
 
641
        fi
 
642
        if [ ".$opt_c" = .yes ]; then
 
643
            if [ ".$opt_t" = .yes ]; then
 
644
                echo "cp $src $dsttmp" 1>&2
 
645
            fi
 
646
            cp $src $dsttmp || exit $?
 
647
        else
 
648
            if [ ".$opt_t" = .yes ]; then
 
649
                echo "mv $src $dsttmp" 1>&2
 
650
            fi
 
651
            mv $src $dsttmp || exit $?
 
652
        fi
 
653
    
 
654
        #  Adjust the target file
 
655
        #  (we do chmod last to preserve setuid bits)
 
656
        if [ ".$opt_s" = .yes ]; then
 
657
            if [ ".$opt_t" = .yes ]; then
 
658
                echo "strip $dsttmp" 1>&2
 
659
            fi
 
660
            strip $dsttmp || exit $?
 
661
        fi
 
662
        if [ ".$opt_o" != . ]; then
 
663
            if [ ".$opt_t" = .yes ]; then
 
664
                echo "chown $opt_o $dsttmp" 1>&2
 
665
            fi
 
666
            chown $opt_o $dsttmp || exit $?
 
667
        fi
 
668
        if [ ".$opt_g" != . ]; then
 
669
            if [ ".$opt_t" = .yes ]; then
 
670
                echo "chgrp $opt_g $dsttmp" 1>&2
 
671
            fi
 
672
            chgrp $opt_g $dsttmp || exit $?
 
673
        fi
 
674
        if [ ".$opt_m" != . ]; then
 
675
            if [ ".$opt_t" = .yes ]; then
 
676
                echo "chmod $opt_m $dsttmp" 1>&2
 
677
            fi
 
678
            chmod $opt_m $dsttmp || exit $?
 
679
        fi
 
680
    
 
681
        #   Determine whether to do a quick install
 
682
        #   (has to be done _after_ the strip was already done)
 
683
        quick=no
 
684
        if [ ".$opt_C" = .yes ]; then
 
685
            if [ -r $dst ]; then
 
686
                if cmp -s $src $dst; then
 
687
                    quick=yes
 
688
                fi
 
689
            fi
 
690
        fi
 
691
    
 
692
        #   Finally install the file to the real destination
 
693
        if [ $quick = yes ]; then
 
694
            if [ ".$opt_t" = .yes ]; then
 
695
                echo "rm -f $dsttmp" 1>&2
 
696
            fi
 
697
            rm -f $dsttmp
 
698
        else
 
699
            if [ ".$opt_t" = .yes ]; then
 
700
                echo "rm -f $dst && mv $dsttmp $dst" 1>&2
 
701
            fi
 
702
            rm -f $dst && mv $dsttmp $dst
 
703
        fi
 
704
    done
 
705
    ;;
 
706
 
 
707
mkdir )
 
708
    ##
 
709
    ##  mkdir -- Make one or more directories
 
710
    ##  Copyright (c) 1996-2000 Ralf S. Engelschall <rse@engelschall.com>
 
711
    ##  Originally written for public domain by Noah Friedman <friedman@prep.ai.mit.edu>
 
712
    ##  Cleaned up and enhanced for shtool
 
713
    ##
 
714
    
 
715
    errstatus=0
 
716
    for p in ${1+"$@"}; do
 
717
        #   if the directory already exists...
 
718
        if [ -d "$p" ]; then
 
719
            if [ ".$opt_f" = .no ] && [ ".$opt_p" = .no ]; then
 
720
                echo "$msgprefix:Error: directory already exists: $p" 1>&2
 
721
                errstatus=1
 
722
                break
 
723
            else
 
724
                continue
 
725
            fi
 
726
        fi
 
727
        #   if the directory has to be created...
 
728
        if [ ".$opt_p" = .no ]; then
 
729
            if [ ".$opt_t" = .yes ]; then
 
730
                echo "mkdir $p" 1>&2
 
731
            fi
 
732
            mkdir $p || errstatus=$?
 
733
        else
 
734
            #   the smart situation
 
735
            set fnord `echo ":$p" |\
 
736
                       sed -e 's/^:\//%/' \
 
737
                           -e 's/^://' \
 
738
                           -e 's/\// /g' \
 
739
                           -e 's/^%/\//'`
 
740
            shift
 
741
            pathcomp=''
 
742
            for d in ${1+"$@"}; do
 
743
                pathcomp="$pathcomp$d"
 
744
                case "$pathcomp" in
 
745
                    -* ) pathcomp="./$pathcomp" ;;
 
746
                esac
 
747
                if [ ! -d "$pathcomp" ]; then
 
748
                    if [ ".$opt_t" = .yes ]; then
 
749
                        echo "mkdir $pathcomp" 1>&2
 
750
                    fi
 
751
                    mkdir $pathcomp || errstatus=$?
 
752
                    if [ ".$opt_m" != . ]; then
 
753
                        if [ ".$opt_t" = .yes ]; then
 
754
                            echo "chmod $opt_m $pathcomp" 1>&2
 
755
                        fi
 
756
                        chmod $opt_m $pathcomp || errstatus=$?
 
757
                    fi
 
758
                fi
 
759
                pathcomp="$pathcomp/"
 
760
            done
 
761
        fi
 
762
    done
 
763
    exit $errstatus
 
764
    ;;
 
765
 
 
766
fixperm )
 
767
    ##
 
768
    ##  fixperm -- Fix file permissions inside a source tree
 
769
    ##  Copyright (c) 1996-2000 Ralf S. Engelschall <rse@engelschall.com>
 
770
    ##  Originally written for ePerl
 
771
    ##
 
772
    
 
773
    paths="$*"
 
774
    
 
775
    #   check whether the test command supports the -x option
 
776
    if [ -x /bin/sh ] 2>/dev/null; then
 
777
        minusx="-x"
 
778
    else
 
779
        minusx="-r"
 
780
    fi
 
781
    
 
782
    #   iterate over paths
 
783
    for p in $paths; do
 
784
        for file in `find $p -depth -print`; do
 
785
            if [ -f $file ]; then
 
786
                if [ $minusx $file ]; then
 
787
                    if [ ".$opt_v" = .yes ]; then
 
788
                        echo "-rwxrwxr-x $file" 2>&1
 
789
                    fi
 
790
                    if [ ".$opt_t" = .yes ]; then
 
791
                        echo "chmod 775 $file" 2>&1
 
792
                    fi
 
793
                    chmod 775 $file
 
794
                else
 
795
                    if [ ".$opt_v" = .yes ]; then
 
796
                        echo "-rw-rw-r-- $file" 2>&1
 
797
                    fi
 
798
                    if [ ".$opt_t" = .yes ]; then
 
799
                        echo "chmod 664 $file" 2>&1
 
800
                    fi
 
801
                    chmod 664 $file
 
802
                fi
 
803
                continue
 
804
            fi
 
805
            if [ -d $file ]; then
 
806
                if [ ".$opt_v" = .yes ]; then
 
807
                    echo "drwxrwxr-x $file" 2>&1
 
808
                fi
 
809
                if [ ".$opt_t" = .yes ]; then
 
810
                    echo "chmod 775 $file" 2>&1
 
811
                fi
 
812
                chmod 775 $file
 
813
                continue
 
814
            fi
 
815
            if [ ".$opt_v" = .yes ]; then
 
816
                echo "?????????? $file" 2>&1
 
817
            fi
 
818
        done
 
819
    done
 
820
    ;;
 
821
 
 
822
version )
 
823
    ##
 
824
    ##  version -- Maintain a version information file
 
825
    ##  Copyright (c) 1994-2000 Ralf S. Engelschall <rse@engelschall.com>
 
826
    ##  Originally written for ePerl, rewritten from scratch for shtool
 
827
    ##
 
828
    
 
829
    file="$1"
 
830
    
 
831
    #   determine prefix and name
 
832
    name="$opt_n"
 
833
    prefix="$opt_p"
 
834
    
 
835
    #   determine current version
 
836
    triple="$opt_s"
 
837
    if [ ".$triple" != . ]; then
 
838
        #   use given triple
 
839
        if [ ".`echo $triple | grep '[0-9]*.[0-9]*[sabp.][0-9]*'`" = . ]; then
 
840
            echo "$msgprefix:Error: invalid argument to option \`-s': \`$opt_s'" 1>&2
 
841
            exit 1
 
842
        fi
 
843
        eval `echo $triple |\
 
844
              sed -e 's%\([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\).*%\
 
845
              ver="\1";rev="\2";typ="\3";lev="\4"%'`
 
846
        tim=calc
 
847
    elif [ -r $file ]; then
 
848
        #   determine triple from given file
 
849
        eval `grep 'Version [0-9]*.[0-9]*[sabp.][0-9]* ([0-9]*-[a-zA-Z]*-[0-9]*)' $file |\
 
850
              head -1 | sed -e 's%.*Version \([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\) (\([0-9]*-[a-zA-Z]*-[0-9]*\)).*%\
 
851
              ver="\1";rev="\2";typ="\3";lev="\4";tim="\5"%'`
 
852
    else
 
853
        #   intialise to first version
 
854
        ver=0
 
855
        rev=1
 
856
        typ=.
 
857
        lev=0
 
858
        tim=calc
 
859
    fi
 
860
    
 
861
    #   determine new version in batch
 
862
    if [ ".$opt_i" != . ]; then
 
863
        case $opt_i in
 
864
            v ) ver=`expr $ver + 1`
 
865
                rev=0
 
866
                lev=0
 
867
                ;;
 
868
            r ) rev=`expr $rev + 1`
 
869
                lev=0
 
870
                ;;
 
871
            l ) lev=`expr $lev + 1`
 
872
                ;;
 
873
            * ) echo "$msgprefix:Error: invalid argument to option \`-i': \`$opt_i'" 1>&2
 
874
                exit 1
 
875
                ;;
 
876
        esac
 
877
        tim=calc
 
878
    fi
 
879
    
 
880
    #   determine new version interactively
 
881
    if [ ".$opt_e" = .yes ]; then
 
882
        echo "old version: ${ver}.${rev}${typ}${lev}"
 
883
        while [ 1 ]; do
 
884
            echo dummy | awk '{ printf("new version: "); }'
 
885
            read triple
 
886
            case $triple in
 
887
                [0-9]*.[0-9]*[sabp.][0-9]* ) 
 
888
                    ;;
 
889
                * ) echo "$msgprefix:Error: invalid version string entered: \`$triple'" 1>&2
 
890
                    continue
 
891
                    ;;
 
892
            esac
 
893
            break
 
894
        done
 
895
        eval `echo $triple |\
 
896
              sed -e 's%^\([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\)$%\
 
897
              ver="\1";rev="\2";typ="\3";lev="\4"%'`
 
898
        tim=calc
 
899
    fi
 
900
    
 
901
    #   determine hexadecimal and libtool value of version
 
902
    case $typ in
 
903
        a     ) typnum=0;  levnum=$lev ;;
 
904
        b     ) typnum=1;  levnum=$lev ;;
 
905
        p | . ) typnum=2;  levnum=$lev ;;
 
906
        s     ) typnum=15; levnum=255  ;; # snapshots are special
 
907
    esac
 
908
    hex=`echo "$ver:$rev:$typnum:$levnum" |\
 
909
         awk -F: '{ printf("0x%x%02x%1x%02x", $1, $2, $3, $4); }' |\
 
910
         tr 'abcdef' 'ABCDEF'`
 
911
    ltv=`echo "$ver:$rev:$typnum:$levnum" |\
 
912
         awk -F: '{ printf("%d:%d", $1*10 + $2, $3*10 + $4); }'`
 
913
    
 
914
    #   determine date
 
915
    if [ ".$tim" = .calc ]; then
 
916
        day=`date '+%d'`
 
917
        month=`date '+%m'`
 
918
        year=`date '+%Y' 2>/dev/null`
 
919
        if [ ".$time_year" = . ]; then
 
920
            year=`date '+%y'`
 
921
            case $year in
 
922
                [5-9][0-9]) year="19$year" ;;
 
923
                [0-4][0-9]) year="20$year" ;;
 
924
            esac
 
925
        fi
 
926
        case $month in
 
927
            1|01) month='Jan' ;;
 
928
            2|02) month='Feb' ;;
 
929
            3|03) month='Mar' ;;
 
930
            4|04) month='Apr' ;;
 
931
            5|05) month='May' ;;
 
932
            6|06) month='Jun' ;;
 
933
            7|07) month='Jul' ;;
 
934
            8|08) month='Aug' ;;
 
935
            9|09) month='Sep' ;;
 
936
              10) month='Oct' ;;
 
937
              11) month='Nov' ;;
 
938
              12) month='Dec' ;;
 
939
        esac
 
940
        tim="${day}-${month}-${year}"
 
941
    fi
 
942
    
 
943
    #   perform result actions
 
944
    mode=show
 
945
    if [ ".$opt_i" != . ]; then
 
946
        mode=edit
 
947
    elif [ ".$opt_e" = .yes ]; then
 
948
        mode=edit
 
949
    elif [ ".$opt_s" != . ]; then
 
950
        mode=edit
 
951
    fi
 
952
    if [ ".$mode" = .show ]; then
 
953
        #   just display the current version
 
954
        case $opt_d in
 
955
            short )
 
956
                echo "${ver}.${rev}${typ}${lev}"
 
957
                ;;
 
958
            long )
 
959
                echo "${ver}.${rev}${typ}${lev} ($tim)"
 
960
                ;;
 
961
            libtool )
 
962
                echo "${ltv}"
 
963
                ;;
 
964
            hex )
 
965
                echo "${hex}"
 
966
                ;;
 
967
            * ) echo "$msgprefix:Error: invalid argument to option \`-d': \`$opt_d'" 1>&2
 
968
                exit 1
 
969
                ;;
 
970
        esac
 
971
    else 
 
972
        #   update the version file
 
973
    
 
974
        #   pre-generate various strings
 
975
        triple="${ver}.${rev}${typ}${lev}"
 
976
        vHex="$hex"
 
977
        vShort="${triple}"
 
978
        vLong="${triple} (${tim})"
 
979
        vTeX="This is ${name}, Version ${triple} (${tim})"
 
980
        vGNU="${name} ${triple} (${tim})"
 
981
        vWeb="${name}/${triple}"
 
982
        vSCCS="@(#)${name} ${triple} (${tim})"
 
983
        vRCS="\$Id: ${name} ${triple} (${tim}) \$"
 
984
    
 
985
        #   determine string out of filename
 
986
        #   (do NOT try to optimize this in any way because of portability)
 
987
        filestr=`echo $file |\
 
988
                 tr 'abcdefghijklmnopqrstuvwxyz./%+' \
 
989
                    'ABCDEFGHIJKLMNOPQRSTUVWXYZ____' | sed -e 's/-/_/g'`
 
990
    
 
991
        #   generate uppercase prefix
 
992
        prefixupper=`echo $prefix |\
 
993
                     tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
 
994
        
 
995
        #   create the version file according the the selected language
 
996
        echo "new version: ${vLong}"
 
997
    
 
998
        cp /dev/null $file
 
999
        case $opt_l in
 
1000
            txt )
 
1001
                echo >>$file ""
 
1002
                echo >>$file "  ${file} -- Version Information for ${name} (syntax: Text)"
 
1003
                echo >>$file "  [automatically generated and maintained by GNU shtool]"
 
1004
                echo >>$file ""
 
1005
                echo >>$file "  $vTeX"
 
1006
                echo >>$file ""
 
1007
                ;;
 
1008
            c )
 
1009
                echo >>$file "/*"
 
1010
                echo >>$file "**  ${file} -- Version Information for ${name} (syntax: C/C++)"
 
1011
                echo >>$file "**  [automatically generated and maintained by GNU shtool]"
 
1012
                echo >>$file "*/"
 
1013
                echo >>$file ""
 
1014
                echo >>$file "#ifdef _${filestr}_AS_HEADER_"
 
1015
                echo >>$file ""
 
1016
                echo >>$file "#ifndef _${filestr}_"
 
1017
                echo >>$file "#define _${filestr}_"
 
1018
                echo >>$file ""
 
1019
                echo >>$file "#define ${prefixupper}VERSION ${vHex}"
 
1020
                echo >>$file ""
 
1021
                echo >>$file "typedef struct {"
 
1022
                echo >>$file "    const int   v_hex;"
 
1023
                echo >>$file "    const char *v_short;"
 
1024
                echo >>$file "    const char *v_long;"
 
1025
                echo >>$file "    const char *v_tex;"
 
1026
                echo >>$file "    const char *v_gnu;"
 
1027
                echo >>$file "    const char *v_web;"
 
1028
                echo >>$file "    const char *v_sccs;"
 
1029
                echo >>$file "    const char *v_rcs;"
 
1030
                echo >>$file "} ${prefix}version_t;"
 
1031
                echo >>$file ""
 
1032
                echo >>$file "extern ${prefix}version_t ${prefix}version;"
 
1033
                echo >>$file ""
 
1034
                echo >>$file "#endif /* _${filestr}_ */"
 
1035
                echo >>$file ""
 
1036
                echo >>$file "#else /* _${filestr}_AS_HEADER_ */"
 
1037
                echo >>$file ""
 
1038
                echo >>$file "#define _${filestr}_AS_HEADER_"
 
1039
                echo >>$file "#include \"${file}\""
 
1040
                echo >>$file "#undef  _${filestr}_AS_HEADER_"
 
1041
                echo >>$file ""
 
1042
                echo >>$file "${prefix}version_t ${prefix}version = {"
 
1043
                echo >>$file "    ${vHex},"
 
1044
                echo >>$file "    \"${vShort}\","
 
1045
                echo >>$file "    \"${vLong}\","
 
1046
                echo >>$file "    \"${vTeX}\","
 
1047
                echo >>$file "    \"${vGNU}\","
 
1048
                echo >>$file "    \"${vWeb}\","
 
1049
                echo >>$file "    \"${vSCCS}\","
 
1050
                echo >>$file "    \"${vRCS}\""
 
1051
                echo >>$file "};"
 
1052
                echo >>$file ""
 
1053
                echo >>$file "#endif /* _${filestr}_AS_HEADER_ */"
 
1054
                echo >>$file ""
 
1055
                ;;
 
1056
            perl )
 
1057
                echo >>$file "##"
 
1058
                echo >>$file "##  ${file} -- Version Information for ${name} (syntax: Perl)"
 
1059
                echo >>$file "##  [automatically generated and maintained by GNU shtool]"
 
1060
                echo >>$file "##"
 
1061
                echo >>$file ""
 
1062
                echo >>$file "my \$${prefix}version = {"
 
1063
                echo >>$file "    'v_hex'   => ${vHex},"
 
1064
                echo >>$file "    'v_short' => \"${vShort}\","
 
1065
                echo >>$file "    'v_long'  => \"${vLong}\","
 
1066
                echo >>$file "    'v_tex'   => \"${vTeX}\","
 
1067
                echo >>$file "    'v_gnu'   => \"${vGNU}\","
 
1068
                echo >>$file "    'v_web'   => \"${vWeb}\","
 
1069
                echo >>$file "    'v_sccs'  => \"${vSCCS}\","
 
1070
                echo >>$file "    'v_rcs'   => \"\\${vRCS}/\""
 
1071
                echo >>$file "};"
 
1072
                echo >>$file ""
 
1073
                echo >>$file "1;"
 
1074
                echo >>$file ""
 
1075
                ;;
 
1076
            python )
 
1077
                echo >>$file "##"
 
1078
                echo >>$file "##  ${file} -- Version Information for ${name} (syntax: Python)"
 
1079
                echo >>$file "##  [automatically generated and maintained by GNU shtool]"
 
1080
                echo >>$file "##"
 
1081
                echo >>$file ""
 
1082
                echo >>$file "class ${prefix}version:"
 
1083
                echo >>$file "    v_hex       = ${vHex}"
 
1084
                echo >>$file "    v_short     = \"${vShort}\""
 
1085
                echo >>$file "    v_long      = \"${vLong}\""
 
1086
                echo >>$file "    v_tex       = \"${vTeX}\""
 
1087
                echo >>$file "    v_gnu       = \"${vGNU}\""
 
1088
                echo >>$file "    v_web       = \"${vWeb}\""
 
1089
                echo >>$file "    v_sccs      = \"${vSCCS}\""
 
1090
                echo >>$file "    v_rcs       = \"${vRCS}\""
 
1091
                echo >>$file ""
 
1092
                ;;
 
1093
            * ) echo "$msgprefix:Error: invalid argument to option \`-l': \`$opt_l'" 1>&2
 
1094
                exit 1
 
1095
                ;;
 
1096
        esac
 
1097
    fi
 
1098
    ;;
 
1099
 
 
1100
esac
 
1101
 
 
1102
exit 0
 
1103
 
 
1104
##EOF##