~ubuntu-branches/ubuntu/trusty/linuxlogo/trusty

« back to all changes in this revision

Viewing changes to libsysinfo-0.2.1/all/sysinfo_common.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2008-06-20 09:19:00 UTC
  • mfrom: (4.1.2 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080620091900-4xzuv7c7ntxvs7wt
Tags: 5.03-4
* Adding patch to fix FTBFS on s390x.
* Updating to standards 3.8.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "version.h"
 
2
#include "sysinfo.h"
 
3
 
 
4
#include <string.h>
 
5
#include <stdio.h>
 
6
 
 
7
struct our_state {
 
8
    int pretty_printing;
 
9
    int custom_cpuinfo;
 
10
    char cpuinfo_file[BUFSIZ];
 
11
};
 
12
 
 
13
struct our_state internal_state={1,0,"/proc/cpuinfo"};
 
14
 
 
15
char *get_sysinfo_version(char *version) {
 
16
    snprintf(version,BUFSIZ,"%i.%i.%i",VERSION_MAJOR,VERSION_MINOR,VERSION_SUBMINOR);
 
17
    return version;
 
18
}
 
19
 
 
20
int get_numeric_sysinfo_version(void) {
 
21
    return (VERSION_MAJOR*10000)+(VERSION_MINOR*100)+VERSION_SUBMINOR;  
 
22
}
 
23
 
 
24
int set_cpuinfo_file(char *filename) {
 
25
    internal_state.custom_cpuinfo=1;
 
26
    strncpy(internal_state.cpuinfo_file,filename,BUFSIZ);
 
27
    return 0;
 
28
}
 
29
 
 
30
char *get_cpuinfo_file(void) {
 
31
    return internal_state.cpuinfo_file;  
 
32
}
 
33
 
 
34
void set_pretty_printing(int value) {
 
35
   internal_state.pretty_printing=value;
 
36
}
 
37
 
 
38
int get_pretty_printing(void) {
 
39
   return internal_state.pretty_printing;
 
40
}