source: trunk/third/sysinfo/getmodel.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 system model name
15 */
16
17#include "defs.h"
18
19/*
20 * Read MODELFILE to get name of system model.
21 */
22char *GetModelFile()
23{
24    static char                 Buf[MAXPATHLEN];
25    FILE                       *fd;
26    int                         Len;
27
28    /*
29     * Use model file if it exists.
30     */
31    if ((fd = fopen(MODELFILE, "r")) != NULL) {
32        fgets(Buf, sizeof(Buf), fd);
33        Len = strlen(Buf);
34        if (Buf[Len-1] == '\n')
35            Buf[Len-1] = C_NULL;
36        return(Buf);
37    }
38
39    return(NULL);
40}
41
42/*
43 * Run a command to get system model
44 */
45char *GetModelCmd()
46{
47#if     defined(MODEL_COMMAND)
48    extern char                *ModelCommand[];
49
50    return(RunCmds(ModelCommand, FALSE));
51#else
52    return((char *) NULL);
53#endif  /* MODEL_COMMAND */
54}
55
56/*
57 * Return the predefined symbol MODEL_NAME
58 */
59extern char *GetModelDef()
60{
61#if     defined(MODEL_NAME)
62    return(MODEL_NAME);
63#else   /* !MODEL_NAME */
64    return((char *) NULL);
65#endif  /* MODEL_NAME */
66}
67
68/*
69 * Get system model
70 */
71extern char *GetModel()
72{
73    extern PSI_t               GetModelPSI[];
74
75    return(PSIquery(GetModelPSI));
76}
77
Note: See TracBrowser for help on using the repository browser.