"Fossies" - the Fresh Open Source Software Archive

Member "linux_logo-6.0/libsysinfo-0.3.0/all/sysinfo_common.c" (8 May 2020, 863 Bytes) of package /linux/misc/linux_logo-6.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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",
   17             VERSION_MAJOR,VERSION_MINOR,VERSION_SUBMINOR);
   18     return version;
   19 }
   20 
   21 int get_numeric_sysinfo_version(void) {
   22     return (VERSION_MAJOR*10000)+(VERSION_MINOR*100)+VERSION_SUBMINOR;
   23 }
   24 
   25 int set_cpuinfo_file(char *filename) {
   26     internal_state.custom_cpuinfo=1;
   27     strncpy(internal_state.cpuinfo_file,filename,BUFSIZ-1);
   28     return 0;
   29 }
   30 
   31 char *get_cpuinfo_file(void) {
   32     return internal_state.cpuinfo_file;
   33 }
   34 
   35 void set_pretty_printing(int value) {
   36     internal_state.pretty_printing=value;
   37 }
   38 
   39 int get_pretty_printing(void) {
   40     return internal_state.pretty_printing;
   41 }