unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Update 'uname' emulation on MS-Windows
@ 2016-07-16  7:27 Eli Zaretskii
  2016-07-16  8:58 ` Andy Wingo
  2016-07-16 21:40 ` Andy Moreton
  0 siblings, 2 replies; 9+ messages in thread
From: Eli Zaretskii @ 2016-07-16  7:27 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guile-devel

The processors and OS versions of the emulated 'uname' need an update;
the patch below does that:

2016-07-16  Eli Zaretskii  <eliz@gnu.org>

	* libguile/posix-w32.c (uname): Update to modern processors (ia64
	and x86_64) and OS versions (Vista to Windows 10).  Delete
	trailing whitespace.

--- libguile/posix-w32.c~1	2016-07-15 19:18:26.835750000 +0300
+++ libguile/posix-w32.c	2016-07-16 10:22:08.273250000 +0300
@@ -64,13 +64,26 @@ uname (struct utsname *uts)
         strcpy (uts->sysname, "Windows NT3x"); /* NT3x */
       else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion < 1)
         strcpy (uts->sysname, "Windows 2000"); /* 2k */
-      else if (osver.dwMajorVersion >= 5)
+      else if (osver.dwMajorVersion < 6)
         strcpy (uts->sysname, "Windows XP");   /* XP */
+      else if (osver.dwMajorVersion == 6)
+	{
+	  if (osver.dwMinorVersion < 1)
+	    strcpy (uts->sysname, "Windows Vista");   /* Vista */
+	  else if (osver.dwMinorVersion < 2)
+	    strcpy (uts->sysname, "Windows 7"); /* Windows 7 */
+	  else if (osver.dwMinorVersion < 3)
+	    strcpy (uts->sysname, "Windows 8"); /* Windows 8 */
+	  else if (osver.dwMinorVersion < 4)
+	    strcpy (uts->sysname, "Windows 8.1"); /* Windows 8.1 */
+	}
+      else if (osver.dwMajorVersion >= 10)
+        strcpy (uts->sysname, "Windows 10 or later"); /* Windows 10 and later */
       os = WinNT;
       break;
 
     case VER_PLATFORM_WIN32_WINDOWS: /* Win95, Win98 or WinME */
-      if ((osver.dwMajorVersion > 4) || 
+      if ((osver.dwMajorVersion > 4) ||
           ((osver.dwMajorVersion == 4) && (osver.dwMinorVersion > 0)))
         {
 	  if (osver.dwMinorVersion >= 90)
@@ -91,11 +104,11 @@ uname (struct utsname *uts)
       break;
     }
 
-  sprintf (uts->version, "%ld.%02ld", 
+  sprintf (uts->version, "%ld.%02ld",
            osver.dwMajorVersion, osver.dwMinorVersion);
 
   if (osver.szCSDVersion[0] != '\0' &&
-      (strlen (osver.szCSDVersion) + strlen (uts->version) + 1) < 
+      (strlen (osver.szCSDVersion) + strlen (uts->version) + 1) <
       sizeof (uts->version))
     {
       strcat (uts->version, " ");
@@ -115,10 +128,13 @@ uname (struct utsname *uts)
     case PROCESSOR_ARCHITECTURE_MIPS:
       strcpy (uts->machine, "mips");
       break;
+    case PROCESSOR_ARCHITECTURE_IA64:
+      strcpy (uts->machine, "ia64");
+      break;
     case PROCESSOR_ARCHITECTURE_INTEL:
-      /* 
+      /*
        * dwProcessorType is only valid in Win95 and Win98 and WinME
-       * wProcessorLevel is only valid in WinNT 
+       * wProcessorLevel is only valid in WinNT
        */
       switch (os)
         {
@@ -142,13 +158,16 @@ uname (struct utsname *uts)
         default:
           strcpy (uts->machine, "unknown");
           break;
-      }
+        }
+      break;
+    case PROCESSOR_ARCHITECTURE_AMD64:
+      strcpy (uts->machine, "x86_64");
       break;
     default:
       strcpy (uts->machine, "unknown");
       break;
   }
-  
+
   sLength = sizeof (uts->nodename) - 1;
   GetComputerName (uts->nodename, &sLength);
   return 0;



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-07-24 17:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-16  7:27 Update 'uname' emulation on MS-Windows Eli Zaretskii
2016-07-16  8:58 ` Andy Wingo
2016-07-16 10:33   ` Eli Zaretskii
2016-07-16 21:40 ` Andy Moreton
2016-07-17  2:37   ` Eli Zaretskii
2016-07-17 12:04     ` Eli Zaretskii
2016-07-23 21:03       ` Andy Wingo
2016-07-24 14:32         ` Eli Zaretskii
2016-07-24 17:04           ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).