Commit | Line | Data |
---|---|---|
bdf737ca GW |
1 | /* |
2 | * This file is in the public domain. | |
3 | * Written by Garrett A. Wollman <wollman@freefall.cdrom.com>. | |
4 | * | |
5 | * $Id$ | |
6 | */ | |
7 | ||
8 | #include <stdlib.h> | |
9 | #include <string.h> | |
10 | #include <sys/types.h> | |
11 | #include <sys/utsname.h> | |
12 | ||
13 | /* | |
14 | * _osname - return the name of the current operating system. | |
15 | */ | |
16 | char * | |
17 | _osname(void) { | |
18 | static struct utsname uts; | |
19 | if(uname(&uts)) | |
20 | return "unknown"; | |
21 | else | |
22 | return uts.sysname; | |
23 | } | |
24 | ||
25 | /* | |
26 | * _osnamever - return the name and version of the current operating system. | |
27 | */ | |
28 | char * | |
29 | _osnamever(void) { | |
30 | static struct utsname uts; | |
31 | static char name[2*SYS_NMLN + 1]; | |
32 | if(uname(&uts)) { | |
33 | return "unknown"; | |
34 | } else { | |
35 | strcpy(name, uts.sysname); | |
36 | strcat(name, " "); | |
37 | strcat(name, uts.release); | |
38 | return name; | |
39 | } | |
40 | } | |
41 | ||
42 | ||
43 |