Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* routine for getting DU version (includes the letter)
@ 1996-10-10  4:00 Randy M. Hayman
  0 siblings, 0 replies; only message in thread
From: Randy M. Hayman @ 1996-10-10  4:00 UTC (permalink / raw)




Greetings - 

After running across some interesting things under /usr/include I came
up with the following code to return a character string of the *real*
Digital UNIX version number (i.e. V3.2C, V3.2D-1, V4.0A, etc...) - as
opposed to the uname command which doesn't return the version letter.  

enjoy.

Oh, and compile it as follows (no need to be root):  
	cc -o kernel_version -lpset -lmach kernel_version.c


/* kernel_version.c
 * 
 * returns the string "(<host>) Digital UNIX Vx.xN (Rev. x); <timestamp>"
 */
#include <mach.h>
#include <stdio.h>
#include <sys/utsname.h>

main()
{
long int                status;
kernel_version_t        version;
struct  utsname         uts_name;
char    ut_host[SYS_NMLN];

    if(-1 == (status = uname(&uts_name))) {
        fprintf(stdout, "error %d getting uname structure\n", status);
        exit(1);
    }
    if(KERN_SUCCESS != (status = host_kernel_version(host_self(), version))) {
        fprintf(stderr, "Error %d from host_kernel_version\n", status);
        exit(1);
    }
    fprintf(stdout, "(%s) %s\n", &uts_name.nodename[0],version);
}


-- 
Randy M. Hayman					haymanr@icefog.alaska.edu
	"Ethernet works in practice but not in theory" -- Bob Metcalfe



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-10-10  4:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-10-10  4:00 routine for getting DU version (includes the letter) Randy M. Hayman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox