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

« back to all changes in this revision

Viewing changes to libsysinfo-0.2.1/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(struct os_info_type *os_info) {  
 
7
    
 
8
    struct utsname buf;
 
9
 
 
10
    uname(&buf);
 
11
 
 
12
    strncpy(os_info->os_name,buf.sysname,SYSINFO_OS_NAME_SIZE);
 
13
    strncpy(os_info->os_version,buf.release,SYSINFO_OS_VERSION_SIZE);
 
14
    strncpy(os_info->os_revision,buf.version,SYSINFO_OS_REVISION_SIZE);
 
15
/*   os_info->host_name=strdup(buf.nodename); */
 
16
    return 0;
 
17
}
 
18
 
 
19
char *uname_get_host_name(char *hostname,char *domain) {
 
20
    
 
21
    struct utsname buf;
 
22
   
 
23
    uname(&buf);
 
24
   
 
25
    strncpy(hostname,buf.nodename,SYSINFO_HOSTNAME_SIZE);
 
26
/*    strncpy(domain,buf.domainname,64);*/
 
27
    strncpy(domain,"Unknown",SYSINFO_DOMAIN_SIZE);  /* Can't get there from here */
 
28
    return hostname;
 
29
}