home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
EFFO
/
forum16.lzh
/
SOFTWARE
/
C
/
VERSION
/
oskversion.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-01-06
|
3KB
|
99 lines
/* ------------------------------------------------------------------- *
|
| OS9Lib: osk_version()
|
|
| Copyright (c) 1990 by Wolfgang Ocker, Puchheim
| (W-Germany)
|
| This program can be copied and distributed freely for any
| non-commercial purposes. It can only be incorporated into
| commercial software with the written permission of the author.
|
| If you should modify this program, the author would appreciate
| a notice about the changes. Please send a (context) diff or the
| complete source to:
|
| address: reccoware systems
| Wolfgang Ocker
| Lochhauser Strasse 35a
| D-8039 Puchheim
| West Germany
|
| e-mail: weo@chi.sub.org
|
* ----------------------------------------------------------------- */
#include <stdio.h>
#include <module.h>
#include <setsys.h>
#include <strings.h>
#include "oskversion.h"
static struct oskversion v;
/*
* o s k _ v e r s i o n
*
* Return version information of OSK
*/
int osk_version(version)
register struct oskversion *version;
{
register mod_config *mod;
if ((mod = (mod_config *) modlink("init", mktypelang(MT_SYSTEM, ML_ANY))) ==
(mod_config *) -1) /* yep, this tells us the manual! */
return(-1); /* error */
version->level = mod->_mos9lvl[0];
version->version = mod->_mos9lvl[1];
version->revision = mod->_mos9lvl[2];
version->edition = mod->_mos9lvl[3];
version->cpu = mod->_mcputyp; /* CPU type of init module */
version->cpu_run = _getsys(D_MPUType, sizeof(long)); /* real CPU */
(void) strncpy(version->mainframe, ((char *) mod) + mod->_minstal, 64);
version->mainframe[63] = '\0';
(void) strncpy(version->os9rev, ((char *) mod) + mod->_mos9rev, 64);
version->os9rev[63] = '\0';
(void) munlink(mod);
return(0);
}
/* `Patch` Tyko: */
main(argc,argv)
int argc;
char **argv;
{
if (argc > 1) {
printf("Syntax: OSKversion\n");
printf("Function: prints some useful informations ");
printf("about the operating system.\n");
printf("Options: none\n");
exit(0);
}
if (osk_version(&v) != 0) {
printf("Error due to manual ...\n");
exit(1);
}
printf("OSK level : %d\n",v.level);
printf("OSK version : %d\n",v.version);
printf("Revision : %d\n",v.revision);
printf("Edition : %d\n",v.edition);
printf("CPU type (from init module) : %d\n",v.cpu);
printf("CPU type (real CPU, from system globals) : %d\n",v.cpu_run);
printf("Mainframe : %s\n",v.mainframe);
printf("OS9 revision string : %s\n",v.os9rev);
}