From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,e345213d4ef56138,start X-Google-Attributes: gidfee84,public From: haymanr@icefog.alaska.edu (Randy M. Hayman) Subject: routine for getting DU version (includes the letter) Date: 1996/10/10 Message-ID: <53j9u6$e6c@news.alaska.edu>#1/1 X-Deja-AN: 188681986 distribution: world organization: University of Alaska reply-to: haymanr@icefog.alaska.edu newsgroups: comp.unix.osf.osf1 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 "() Digital UNIX Vx.xN (Rev. x); " */ #include #include #include 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