339
|
1 #!/bin/sh
|
|
2 #
|
|
3 #
|
|
4 # Copyright 2009 by William Astle <lost@l-w.ca>
|
|
5 #
|
|
6 #This file is part of LWTOOLS.
|
|
7 #
|
|
8 #LWTOOLS is free software: you can redistribute it and/or modify it under the
|
|
9 #terms of the GNU General Public License as published by the Free Software
|
|
10 #Foundation, either version 3 of the License, or (at your option) any later
|
|
11 #version.
|
|
12 #
|
|
13 #This program is distributed in the hope that it will be useful, but WITHOUT
|
|
14 #ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 #FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
16 #more details.
|
|
17 #
|
|
18 #You should have received a copy of the GNU General Public License along with
|
|
19 #this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
|
21 # this was based somewhat on the "ar" script from gcc6809
|
|
22
|
|
23 # This script is a frontend to the lwar library manager, to make it
|
|
24 # look more like GNU ar. Not all ar features are supported here.
|
|
25 # It basically translates ar style options into lwar format.
|
|
26
|
|
27 # Parse and translate command-line options
|
|
28
|
|
29 # ar options cheatsheet:
|
|
30 # r: insert (with replace)
|
|
31 # c: create archive
|
|
32 # u: only replace newer files
|
|
33 # v: verbose mode
|
|
34 # x: extract files from archive
|
|
35
|
|
36 options=$1; shift
|
|
37 case $options in
|
|
38 rc|cru|-rc|-cru)
|
|
39 options="--replace --create"
|
|
40 ;;
|
|
41 rv)
|
|
42 options="--replace"
|
|
43 ;;
|
|
44 x|-x)
|
|
45 options="--extract"
|
|
46 ;;
|
|
47 -C|--cache)
|
|
48 exit 0
|
|
49 ;;
|
|
50 *)
|
|
51 options="--replace --create $options"
|
|
52 if [ "$libname" = "" ]; then
|
|
53 libname=$options
|
|
54 fi
|
|
55 ;;
|
|
56 esac
|
|
57
|
|
58 if [ "x$options" = "x" ]; then
|
|
59 echo "ar (m6809): no options given"
|
|
60 exit 1
|
|
61 fi
|
|
62
|
|
63 # Run the real lwar with translated options.
|
|
64 exec lwar $options $*
|