source: trunk/third/sysinfo/getmodel.c @ 11115

Revision 11115, 1.3 KB checked in by ghudson, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r11114, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2 * Copyright (c) 1992-1996 Michael A. Cooper.
3 * This software may be freely used and distributed provided it is not sold
4 * for profit or used for commercial gain and the author is credited
5 * appropriately.
6 */
7
8#ifndef lint
9static char *RCSid = "$Id: getmodel.c,v 1.1.1.2 1998-02-12 21:32:07 ghudson Exp $";
10#endif
11
12/*
13 * Get system model name
14 */
15
16#include "defs.h"
17
18/*
19 * Read MODELFILE to get name of system model.
20 */
21char *GetModelFile()
22{
23    static char                 Buf[BUFSIZ];
24    FILE                       *fd;
25    int                         Len;
26
27    /*
28     * Use model file if it exists.
29     */
30    if ((fd = fopen(MODELFILE, "r")) != NULL) {
31        fgets(Buf, sizeof(Buf), fd);
32        Len = strlen(Buf);
33        if (Buf[Len-1] == '\n')
34            Buf[Len-1] = C_NULL;
35        return(Buf);
36    }
37
38    return(NULL);
39}
40
41/*
42 * Run a command to get system model
43 */
44char *GetModelCmd()
45{
46#if     defined(MODEL_COMMAND)
47    extern char                *ModelCommand[];
48
49    return(RunCmds(ModelCommand, FALSE));
50#else
51    return((char *) NULL);
52#endif  /* MODEL_COMMAND */
53}
54
55/*
56 * Return the predefined symbol MODEL_NAME
57 */
58extern char *GetModelDef()
59{
60#if     defined(MODEL_NAME)
61    return(MODEL_NAME);
62#else   /* !MODEL_NAME */
63    return((char *) NULL);
64#endif  /* MODEL_NAME */
65}
66
67/*
68 * Get system model
69 */
70extern char *GetModel()
71{
72    extern PSI_t               GetModelPSI[];
73
74    return(PSIquery(GetModelPSI));
75}
76
Note: See TracBrowser for help on using the repository browser.