weo@recco.chi.sub.org (Wolfgang Ocker) (03/28/90)
Since OSK version V2.3 we have a compatibility problem: makdir() bites
you (a V2.3 program which uses makdir() crashes on a V2.2 system).
So I've written one of the most useful functions for OSK:
osk_version(). It puts a lot of important version information into a
structure. It's really simple, therefore I don't have written any
documentation.
Best regards,
/// Wolfgang
---- Cut here ---- Cut here ---- Cut here ---- Cut here ---- Cut here ----
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 1 (of 1)."
# Contents: oskversion.h version.c
# Wrapped by oskst@recsys on Tue Mar 27 20:28:01 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'oskversion.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'oskversion.h'\"
else
echo shar: Extracting \"'oskversion.h'\" \(442 characters\)
sed "s/^X//" >'oskversion.h' <<'END_OF_FILE'
X/*
X * Structure for osk_version()
X */
X
Xstruct oskversion {
X int level; /* OSK level */
X int version; /* OSK version */
X int revision; /* revision */
X int edition; /* edition */
X int cpu; /* CPU type (from init module) */
X int cpu_run; /* CPU type (real CPU, from system globals) */
X
X char mainframe[64]; /* mainframe */
X char os9rev[64]; /* os9 revision string */
X};
X
END_OF_FILE
if test 442 -ne `wc -c <'oskversion.h'`; then
echo shar: \"'oskversion.h'\" unpacked with wrong size!
fi
# end of 'oskversion.h'
fi
if test -f 'version.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'version.c'\"
else
echo shar: Extracting \"'version.c'\" \(1902 characters\)
sed "s/^X//" >'version.c' <<'END_OF_FILE'
X/* ------------------------------------------------------------------- *
X |
X | OS9Lib: osk_version()
X |
X |
X | Copyright (c) 1990 by Wolfgang Ocker, Puchheim
X | (W-Germany)
X |
X | This program can be copied and distributed freely for any
X | non-commercial purposes. It can only be incorporated into
X | commercial software with the written permission of the author.
X |
X | If you should modify this program, the author would appreciate
X | a notice about the changes. Please send a (context) diff or the
X | complete source to:
X |
X | address: reccoware systems
X | Wolfgang Ocker
X | Lochhauser Strasse 35a
X | D-8039 Puchheim
X | West Germany
X |
X | e-mail: weo@chi.sub.org
X |
X * ----------------------------------------------------------------- */
X
X#include <stdio.h>
X#include <module.h>
X#include <setsys.h>
X#include <strings.h>
X#include <oskversion.h>
X
X/*
X * o s k _ v e r s i o n
X *
X * Return version information of OSK
X */
Xint osk_version(version)
X register struct oskversion *version;
X{
X register mod_config *mod;
X
X if ((mod = (mod_config *) modlink("init", mktypelang(MT_SYSTEM, ML_ANY))) ==
X (mod_config *) -1) /* yep, this tells us the manual! */
X return(-1); /* error */
X
X version->level = mod->_mos9lvl[0];
X version->version = mod->_mos9lvl[1];
X version->revision = mod->_mos9lvl[2];
X version->edition = mod->_mos9lvl[3];
X
X version->cpu = mod->_mcputyp; /* CPU type of init module */
X version->cpu_run = _getsys(D_MPUType, sizeof(long)); /* real CPU */
X
X (void) strncpy(version->mainframe, ((char *) mod) + mod->_minstal, 64);
X version->mainframe[63] = '\0';
X
X (void) strncpy(version->os9rev, ((char *) mod) + mod->_mos9rev, 64);
X version->os9rev[63] = '\0';
X
X (void) munlink(mod);
X return(0);
X}
END_OF_FILE
if test 1902 -ne `wc -c <'version.c'`; then
echo shar: \"'version.c'\" unpacked with wrong size!
fi
# end of 'version.c'
fi
echo shar: End of archive 1 \(of 1\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have the archive.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
---- Cut here ---- Cut here ---- Cut here ---- Cut here ---- Cut here ----
--
| Wolfgang Ocker | weo@recco.chi.sub.org |
| Lochhauser Strasse 35a +-------------------------------+
| D-8039 Puchheim | reccoware systems |
| Voice: +49 89 80 77 02 | |
| Fax: +49 89 80 29 67 | Huh, What? Where am I? |