From: khan AT xraylith DOT wisc DOT edu (Mumit Khan) Subject: Re: uname and machine identity 6 Jan 1999 03:15:36 -0800 Message-ID: <199901060605.AAA04909.cygnus.gnu-win32@modi.xraylith.wisc.edu> References: To: Ian Collins Cc: "Gnu-Win32 (E-mail)" Ian Collins writes: > I need to get a unique system identity from an application running on b20.1. > On other Unixes, I use, > > typedef struct utsname UTS > > UTS uts; > > uname(uts) What problem(s) did you have? It should work just fine, at least the POSIX part. The only gotcha is the domainname parameter, which lots of systems either do not implement (SunOS 4.1.x, Newlib in Cygwin) or implement under a different name (eg., glibc2 requires __USE_GNU, otherwise __domainname). I don't remember offhand if POSIX requires the domainname field; it's usually not that meaningful, or at best ambiguous as to what it means. Here's a code snippet out of my platform configuration sources: #include #include int main () { struct utsname u; if (uname (&u)) { perror ("uname"); exit (1); } printf ("sysname = %s\n", u.sysname); printf ("nodename = %s\n", u.nodename); printf ("release = %s\n", u.release); printf ("version = %s\n", u.version); printf ("machine = %s\n", u.machine); return 0; } I of course believe there are better ways to configure your software without using ``uname'' (eg., via a built-time configuration tool such as GNU configure). Regards, Mumit - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".