#!/usr/local/bin/perl # 'arch' for the Perl Power Tools project, # By: Theo Van Dinter (felicity@kluge.net) # # It's sad, the docs are longer than the code... # $Id: arch.pl,v 1.3 1999/03/08 17:48:03 felicity Exp $ use POSIX qw(uname); $arch=(uname())[4]; # machine ... (uname -m) $system=(uname())[0]; # system ... (uname -s) # sun3.* -> sun3, sun4.* -> sun4, etc. SunOS hooey. # looks like `uname -m` eq `arch -k` on suns ... unless ( $ARGV[0] =~ /^-k$/i ) { $arch=~s/^(sun\d+).*$/$1/; } $arch = "$system.$arch" if ( $system eq "OpenBSD" ); # OpenBSD hooey. print "$arch\n"; =head1 NAME arch - display system machine type =head1 SYNOPSIS B [ C<-k> ] =head1 DESCRIPTION arch displays the current system architecture type. It tends to be equivilent to C (except on SunOS platforms, see B). =head1 OPTIONS C<-k> Displays kernel architecture on SunOS platforms. =head1 NOTES SunOS tends to differentiate between kernel and system architecture. I will return kernel architecture. System architecture is the same information except it doesn't include the trailing alpha chars. I.e.: 'sun4m' (kernel) = 'sun4' (system), 'sun3x' = 'sun3', etc, etc. =head1 HISTORY Perl version rewritten for the Perl Power Tools project from the description of the arch program in OpenBSD. =head1 AUTHOR Theo Van Dinter (felicity@kluge.net) =head1 SEE ALSO uname(1) uname(2) machine(1)