annotate extra/ar @ 273:88bbffa404ea 2.5 2.5

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