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

« back to all changes in this revision

Viewing changes to libsysinfo-0.1.0/all/uname.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 "sysinfo.h"
2
 
 
3
 
#include <string.h>      /* strncpy */
4
 
#include <sys/utsname.h> /* uname   */
5
 
 
6
 
int uname_get_os_info(os_info_t *os_info) {  
7
 
    
8
 
    struct utsname buf;
9
 
 
10
 
    uname( &buf);
11
 
 
12
 
    strncpy(os_info->os_name,buf.sysname,32);
13
 
    strncpy(os_info->os_version,buf.release,32);
14
 
    strncpy(os_info->os_revision,buf.version,64);
15
 
/*   os_info->host_name=strdup(buf.nodename); */
16
 
    return 0;
17
 
}
18
 
 
19
 
char *uname_get_host_name(char hostname[65],char domain[65]) {
20
 
    
21
 
    struct utsname buf;
22
 
   
23
 
    uname(&buf);
24
 
   
25
 
    strncpy(hostname,buf.nodename,64);
26
 
/*    strncpy(domain,buf.domainname,64);*/
27
 
    strncpy(domain,"Unknown",64);  /* Can't get there from here */
28
 
    return hostname;
29
 
}
30