/*
 *  This file is part of ixemul.library for the Amiga.
 *  Copyright (C) 1995 Lars G. Hecking
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Library General Public
 *  License as published by the Free Software Foundation; either
 *  version 2 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public
 *  License along with this library; if not, write to the Free
 *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <sys/utsname.h>

#define _KERNEL
#include "ixemul.h"
#include "kprintf.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>

static char sysname[] = "AmigaOS";
static char version[] = "1";
static char machine[] = "m68k";

int
uname (struct utsname *name)
{
  char host[__SYS_NMLN];
  char release[__SYS_NMLN];
  int res = -1, err = EFAULT;

  if (name)
    {

      if (gethostname(&host[0],__SYS_NMLN) == 0)
	{

	  sprintf (release, "%d.%d", SysBase->LibNode.lib_Version, SysBase->SoftVer);
	  strncpy (name->sysname, sysname,__SYS_NMLN);
	  strncpy (name->nodename, &host[0],__SYS_NMLN);
	  strncpy (name->release, release,__SYS_NMLN);
	  strncpy (name->version, version,__SYS_NMLN);
	  strncpy (name->machine, machine,__SYS_NMLN);
	  res = err = 0;
	}
    }

  errno = err;
  KPRINTF (("&errno = %lx, errno = %ld\n", &errno, errno));
  return res;
}
