source: trunk/third/sysinfo/getmisc.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 * Miscellaneous Get*() functions
15 */
16
17#include "defs.h"
18
19/*
20 * Get host ID
21 */
22extern char *GetHostID()
23{
24    static char                 Buff[100];
25
26#if     defined(HAVE_GETHOSTID)
27    (void) snprintf(Buff, sizeof(Buff),  "%08x", gethostid());
28#endif  /* HAVE_GETHOSTID */
29
30    return( (Buff[0]) ? Buff : (char *)NULL );
31}
32
33#if     defined(HAVE_SYSINFO) && defined(SI_HW_SERIAL)
34/*
35 * Get Serial Number using sysinfo()
36 */
37extern char *GetSerialSysinfo()
38{
39    static char                 Buff[128];
40    static int                  done = 0;
41    static char                *retval;
42
43    if (done)
44        return((char *) retval);
45
46    done = 1;
47    if (sysinfo(SI_HW_SERIAL, Buff, sizeof(Buff)) < 0)
48        Buff[0] = CNULL;
49
50    return((retval = ((Buff[0]) ? Buff : (char *)NULL)) );
51}
52#endif  /* HAVE_SYSINFO ... */
53
54/*
55 * Get serial number
56 */
57extern char *GetSerial()
58{
59    extern PSI_t               GetSerialPSI[];
60
61    return(PSIquery(GetSerialPSI));
62}
63
64/*
65 * Get ROM Version
66 */
67extern char *GetRomVer()
68{
69    extern PSI_t               GetRomVerPSI[];
70
71    return(PSIquery(GetRomVerPSI));
72}
Note: See TracBrowser for help on using the repository browser.