source: trunk/third/sysinfo/getosname.c @ 12269

Revision 12269, 1.3 KB checked in by ghudson, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r12268, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2 * Copyright (c) 1992-1998 Michael A. Cooper.
3 * This software may be freely used and distributed provided it is not
4 * sold for profit or used in part or in whole for commercial gain
5 * without prior written agreement, and the author is credited
6 * appropriately.
7 */
8
9#ifndef lint
10static char *RCSid = "$Revision: 1.1.1.3 $";
11#endif
12
13/*
14 * Get OS name information
15 */
16
17#include "defs.h"
18
19/*
20 * Get OS name using sysinfo() system call.
21 */
22extern char *GetOSNameSysinfo()
23{
24    static char                 Buff[128];
25
26#if     defined(HAVE_SYSINFO)
27    if (Buff[0])
28        return(Buff);
29
30    if (sysinfo(SI_SYSNAME, Buff, sizeof(Buff)) < 0)
31        return((char *) NULL);
32#endif  /* HAVE_SYSINFO */
33
34    return( (Buff[0]) ? Buff : (char *) NULL );
35}
36
37/*
38 * Get name of OS using uname()
39 */
40extern char *GetOSNameUname()
41{
42#if     defined(HAVE_UNAME)
43    static struct utsname       un;
44
45    if (uname(&un) >= 0)
46        return(un.sysname);
47#endif  /* HAVE_UNAME */
48
49    return((char *)NULL);
50}
51
52/*
53 * Use predefined value.
54 */
55extern char *GetOSNameDef()
56{
57#if     defined(OS_NAME)
58    return(OS_NAME);
59#else
60    return((char *)NULL);
61#endif  /* OS_NAME */
62}
63
64/*
65 * Get Operating System name.
66 */
67extern char *GetOSName()
68{
69    extern PSI_t               GetOSNamePSI[];
70    static char               *Str = NULL;
71
72    if (Str)
73        return(Str);
74
75    return(Str = PSIquery(GetOSNamePSI));
76}
77
Note: See TracBrowser for help on using the repository browser.