Sunday, January 17, 2010

part of the original file [ uname.c ]


/* uname -- print system information

Copyright (C) 1989, 1992, 1993, 1996, 1997, 1999-2005,
2007-2009 Free Software Foundation, Inc.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program 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 General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see . */

/* Written by David MacKenzie */

/* This kludge works around a bug in Mac OS X. */
if (element == unknown)
{
cpu_type_t cputype;
size_t s = sizeof cputype;
NXArchInfo const *ai;
if (sysctlbyname ("hw.cputype", &cputype, &s, NULL, 0) == 0
&& (ai = NXGetArchInfoFromCpuType (cputype,
CPU_SUBTYPE_MULTIPLE))
!= NULL)
element = ai->name;

http://en.wikipedia.org/wiki/Kludge