Now fills in the machine field with something more appropriate (currently mimics

BeOS behaviour). Maybe we want to have some different values here later on.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13926 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-08-09 22:58:58 +00:00
parent 92ac3fafcf
commit 13d77a4cde

View File

@ -1,35 +1,52 @@
/*
** Copyright 2004, Jérôme Duval jerome.duval@free.fr. All rights reserved.
** Distributed under the terms of the Haiku License.
*/
* Copyright 2004, Jérôme Duval jerome.duval@free.fr. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include <OS.h>
#include <sys/utsname.h>
#include <OS.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
int
uname(struct utsname *info)
{
system_info sinfo;
system_info systemInfo;
const char *platform;
if (!info) {
errno = B_BAD_VALUE;
return -1;
}
get_system_info(&sinfo);
get_system_info(&systemInfo);
strlcpy(info->sysname, "Haiku", sizeof(info->sysname));
strlcpy(info->version, sinfo.kernel_build_date, sizeof(info->version));
strlcat(info->version, sinfo.kernel_build_time, sizeof(info->version));
snprintf(info->release, sizeof(info->release), "%lld", sinfo.kernel_version);
strlcpy(info->version, systemInfo.kernel_build_date, sizeof(info->version));
strlcat(info->version, systemInfo.kernel_build_time, sizeof(info->version));
snprintf(info->release, sizeof(info->release), "%lld", systemInfo.kernel_version);
// TODO: make this better
switch (systemInfo.platform_type) {
case B_BEBOX_PLATFORM:
platform = "BeBox";
break;
case B_MAC_PLATFORM:
platform = "BeMac";
break;
case B_AT_CLONE_PLATFORM:
platform = "BePC";
break;
default:
platform = "unknown";
break;
}
strlcpy(info->machine, platform, sizeof(info->machine));
// TODO fill machine field...
strlcpy(info->machine, "unknown", sizeof(info->machine));
// TODO fill nodename field when we have hostname info
strlcpy(info->nodename, "unknown", sizeof(info->nodename));