blob: 8d70608ebae5afd2a6fe421031bce2ffcbf404b1 (
plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
:
# derrived from /etc/rc_d/os.sh
# RCSid:
# $Id: machine.sh,v 1.2 2004/04/11 03:12:17 heinz Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.
# Permission to copy, redistribute or otherwise
# use this file is hereby granted provided that
# the above copyright notice and this notice are
# left intact.
#
# Please send copies of changes and bug-fixes to:
# sjg@quick.com.au
#
OS=`uname`
OSREL=`uname -r`
OSMAJOR=`IFS=.; set $OSREL; echo $1`
machine=`uname -m`
MACHINE=
# Great! Solaris keeps moving arch(1)
# we need this here, and it is not always available...
Which() {
pathcomponents=`IFS=:; echo ${2:-$PATH}`
for d in ${pathcomponents}
do
test -x $d/$1 && { echo $d/$1; break; }
done
}
arch=`Which arch /usr/bin:/usr/ucb:$PATH`
test "$arch" && MACHINE_ARCH=`$arch`
case $OS in
OpenBSD)
MACHINE=$OS$OSMAJOR.$machine
MACHINE_ARCH=`$arch -s`;
;;
*BSD)
MACHINE=$OS$OSMAJOR.$machine
;;
SunOS)
MACHINE=$OS$OSMAJOR
case "$MACHINE_ARCH" in
sparc|sun4*) ;;
sun386*) MACHINE=$MACHINE_ARCH;;
*) MACHINE=$MACHINE.$machine;;
esac
;;
HP-UX)
MACHINE_ARCH=`IFS="/-."; set $machine; echo $1`
;;
IRIX)
MACHINE_ARCH=`uname -p 2>/dev/null`
;;
Interix)
MACHINE=i386
MACHINE_ARCH=i386
;;
UnixWare)
OSREL=`uname -v`
OSMAJOR=`IFS=.; set $OSREL; echo $1`
;;
esac
MACHINE=${MACHINE:-$OS$OSMAJOR}
MACHINE_ARCH=${MACHINE_ARCH:-$machine}
(
case "$0" in
arch*) echo $MACHINE_ARCH;;
*)
case "$1" in
"") echo $MACHINE;;
*) echo $MACHINE_ARCH;;
esac
;;
esac
) | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
|