annotate extra/ar @ 387:a741d2e4869f

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