\begindata{text,538511608}
\textdsversion{12}
\template{help}
\define{global
}
\chapter{sys: Report System Type

}
\section{What sys is

}\leftindent{
The sys program reports the type and operating system version of the 
workstation it is run on.

}
\section{Quick reference

}\leftindent{
To run sys, type


\leftindent{sys}


at the operating system prompt and press Enter.  The value returned is in the 
form 

\leftindent{
\italic{cpu_os} }


where \italic{cpu} is a string specifying the CPU of the machine and 
\italic{os} is a string specifying the version of the operating system.  Some 
values returned by \italic{sys} are:


\bold{value	meaning}

rt_r3	RT PC running Palo Alto Release 3 (BSD 4.3)

sun2_35	Sun 2 running Sun version 3.5 of UNIX

sun3_35	Sun 3 running Sun version 3.5 of UNIX

vax_22	MicroVax running Ultrix version 2.2


Other programs now use the system type in their own respective contexts (see 
the section on \italic{Related tools}).


Typing


\leftindent{sys -c }


returns only the cpu type (i.e. "rt" or "sun3").

}
\section{Shell scripts and @sys

}
\leftindent{In shell scripts, it is often necessary or useful to determine the 
CPU or operating system of a workstation.  Here is an example of using 
\italic{sys} to set the path depending on the CPU:


\bold{Example 1:}

\typewriter{\smaller{setenv PATH $\{PATH\}:/afs/andrew/usr/zz1z/bin/@sys}}


This example will dynamically change your path if you "rem" to a different 
machine.  The @sys is not evaluated until it is used by the Andrew Cache 
Manager and so will work correctly under almost any circumstance. 


You can also use something like this example:


\bold{Example 2:}

\typewriter{\smaller{setenv SYS `sys`

setenv PATH $\{PATH\}:/afs/andrew/usr/zz1z/bin/$SYS}}


Note that the environment variable $SYS is set in this example to the value 
returned by \italic{sys}.  $SYS is not set globally.  However, a version of 
$SYS is set by the Build program, as described below. 


Using \italic{sys} and $SYS in the this way would work, but if you set the 
path using the second example above, your path will not change when you use 
"rem" to get to another kind of machine because $SYS gets translated to the 
specific machine type when you log in.  

}
\section{Sys and switches for rem and butler}


\leftindent{When butler places a free workstation in the butler pool, it 
identifies the workstation with its system type.  Users of rem can us a switch 
of the form "-systemtype" to ask for machines of a certain type.  For example, 
a user might use


	rem -sun3_35 help


to run Help on a Sun3.  By default, rem asks for a machine of the same system 
type as the machine on which rem is running.}


\section{An include file for determining system type}


\leftindent{The file


/usr/andrew/include/system.h


can be used by programs to determine the system for which they are being 
compiled.  For an rt_r3 workstation, for example, it includes the lines


\typewriter{\smaller{#define sys_rt_r3 1

#define SYS_NAME	"rt_r3"}}


Programs can use the identifier SYS_NAME to get a string value for the system 
type.  They can also use the identifier sys_rt_r3 (or the other identifiers 
for other system types) in #ifdef lines to isolate system dependencies.  Use 
of the latter is discouraged, however.}


\section{$(SYS) in the Build program}


\leftindent{The build program defines a variable named SYS which contains the 
system type  for the current machine.  It can be used in the Buildfile when 
setting the OBJECTPATH variable that specifies where object files will be 
placed.}


\section{Related tools}


Select (highlight) one of the italicized names and choose "Show Help on 
Selected Word" from the pop-up menu to see the help document for: 


\leftindent{\helptopic{\italic{build}}

\helptopic{\italic{package}}

\italic{rem}

\italic{acm}     (the Andrew Cache Manager)}


\begindata{bp,537558784}
\enddata{bp,537558784}
\view{bpv,537558784,1725,0,0}
Copyright 1992 Carnegie Mellon University and IBM.  All rights reserved.

\smaller{\smaller{$Disclaimer: 

Permission to use, copy, modify, and distribute this software and its 

documentation for any purpose is hereby granted without fee, 

provided that the above copyright notice appear in all copies and that 

both that copyright notice, this permission notice, and the following 

disclaimer appear in supporting documentation, and that the names of 

IBM, Carnegie Mellon University, and other copyright holders, not be 

used in advertising or publicity pertaining to distribution of the software 

without specific, written prior permission.



IBM, CARNEGIE MELLON UNIVERSITY, AND THE OTHER COPYRIGHT HOLDERS 

DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 

ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT 

SHALL IBM, CARNEGIE MELLON UNIVERSITY, OR ANY OTHER COPYRIGHT HOLDER 

BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 

DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 

WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 

ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 

OF THIS SOFTWARE.

 $

}}\enddata{text,538511608}
