Submitted By: Robert Connolly <cendres at videotron dot ca> (ashes)
Date: 2004-02-28
Initial Package Version: 5.2.0
Origin: lfs coreutils-5.0-uname.patch
Description: Adds functions to uname to fix 'unknown' to display something usefull.

diff -Naur coreutils-5.2.0.orig/src/uname.c coreutils-5.2.0/src/uname.c
--- coreutils-5.2.0.orig/src/uname.c	2004-02-28 04:52:41.010401088 +0000
+++ coreutils-5.2.0/src/uname.c	2004-02-28 05:20:18.453431448 +0000
@@ -243,13 +243,19 @@
   if (toprint & PRINT_PROCESSOR)
     {
       char const *element = unknown;
-#if HAVE_SYSINFO && defined SI_ARCHITECTURE
-      {
-	static char processor[257];
-	if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
-	  element = processor;
+      char processor[BUFSIZ]="unknown";
+      FILE *ffd;
+      char temp_string[BUFSIZ];
+
+      if ((ffd=fopen("/proc/cpuinfo", "r") )!=NULL) {
+              while ( fscanf(ffd, "%s :", temp_string) != EOF)
+                      if (!(strcmp(temp_string, "vendor_id"))) {
+                                      fscanf(ffd, "%s", processor);
+                                      break;
+                      }
+              fclose(ffd);
       }
-#endif
+      element = processor;
 #ifdef UNAME_PROCESSOR
       if (element == unknown)
 	{
