~ubuntu-branches/ubuntu/utopic/linuxlogo/utopic

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Reichle-Schmehl
  • Date: 2010-03-10 11:25:34 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20100310112534-sbweh2jsk041w73u
Tags: 5.10-1
* New upstream release.
* Drop patches/01-s390x.patch and patches/02-sh.patch
  (both were pplied upstream)
* remove quilt, as we don't have any more patches
* Add $remote_fs to Required-Start and Required-Stop of the init scripts
  LSB header
* Bump standards version (no changes needed)

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
}