--- AboutEtoileEntry.m.ORG	Tue May  9 21:09:10 2006
+++ AboutEtoileEntry.m	Wed May 10 11:59:02 2006
@@ -201,55 +201,107 @@
           break;
         }
     }
+  
 #elif defined( FREEBSD )
 
   int mib[2];
   size_t len;
   char *p;
   
-  // machine architecture, eg: i386
-  {
+  // machine architecture, eg: "Intel Pentium III Mobile"
+  do {
+    NSMutableString *str;
+    NSRange range;
+    
     mib[0] = CTL_HW;
     mib[1] = HW_MODEL;
     
-    if( sysctl(mib, 2, NULL, &len, NULL, 0) ) perror("sysctl");
+    if( sysctl(mib, 2, NULL, &len, NULL, 0) )
+    {
+      perror("sysctl: can't get HW_MODEL");
+      break;
+    }
+    
     p = malloc(len);
-    if( sysctl(mib, 2, p, &len, NULL, 0) ) perror("sysctl");
     
-    [machine setStringValue: [NSString stringWithCString: p]];
-  }
-  free(p);
+    if( sysctl(mib, 2, p, &len, NULL, 0) )
+    {
+      perror("sysctl: can't get HW_MODEL");
+      free(p);
+      break;
+    }
+    
+    str = [NSMutableString stringWithCString: p];
+    
+    // remove all (R) in string
+    range = NSMakeRange(0, [str length]);
+    [str replaceOccurrencesOfString: @"(R)"
+                         withString: @""
+                            options: 0
+                              range: range];
+    
+    // find occurrence of "CPU"...
+    range = [str rangeOfString: @"CPU"];
+    
+    // ...and remove it and everything after that
+    [machine setStringValue: [str substringToIndex: range.location]];
+    
+    free(p);
+  } while( 0 );
   
-  // machine model, eg. "Intel(R) Celeron(R) CPU"
-  {
+  // machine model, eg. "i386"
+  do {
     mib[0] = CTL_HW;
     mib[1] = HW_MACHINE_ARCH;
     
-    if( sysctl(mib, 2, NULL, &len, NULL, 0) ) perror("sysctl");
+    if( sysctl(mib, 2, NULL, &len, NULL, 0) )
+    {
+      perror("sysctl: can't get HW_MACHINE_ARCH");
+      break;
+    }
+    
     p = malloc(len);
-    if( sysctl(mib, 2, p, &len, NULL, 0) ) perror("sysctl");
+    
+    if( sysctl(mib, 2, p, &len, NULL, 0) )
+    {
+      perror("sysctl: can't get HW_MACHINE_ARCH");
+      free(p);
+      break;
+    }
     
     [cpu setStringValue: [NSString stringWithCString: p]];
-  }
-  free(p);
+    
+    free(p);
+  } while( 0 );
   
   // cpu frequency
-  {
+  do {
     long mhz;
     
     len = sizeof(mhz);
     
     mhz = 1;
-    if( sysctlbyname("hw.clockrate", NULL, &len, NULL, 0) ) perror("sysctl");
-    if( sysctlbyname("hw.clockrate", &mhz, &len, NULL, 0) ) perror("sysctl");
+    if( sysctlbyname("hw.clockrate", NULL, &len, NULL, 0) )
+    {
+      perror("sysctl: can't get HW_CLOCKRATE");
+      break;
+    }
+    
+    if( sysctlbyname("hw.clockrate", &mhz, &len, NULL, 0) )
+    {
+      perror("sysctl: can't get HW_CLOCKRATE");
+      break;
+    }
+    
+    mhz++;
     
     [cpuFreq setStringValue: [NSString stringWithFormat:	// I'm lazy...
-      ( ( mhz > 1000 ) ? @"%.2f GHz" : @"%d MHz" ), 		//   format
-      ( ( mhz > 1000 ) ? (float) mhz / 1000 : mhz )]];		//   value
-  }
+      ( ( mhz > 999 ) ? @"%.2f GHz" : @"%.0f MHz" ), 		//   format
+      ( ( mhz > 999 ) ? (float) mhz / 1000 : mhz )]];		//   value
+  } while( 0 );
   
   // total memory
-  {
+  do {
     unsigned int mem = 0;
     
     len = sizeof mem;
@@ -258,11 +310,22 @@
     mib[1] = HW_REALMEM;
     
     mem = 1;
-    if( 0 != sysctl(mib, 2, NULL, &len, NULL, 0) ) perror("sysctl");
-    if( 0 != sysctl(mib, 2, &mem, &len, NULL, 0) ) perror("sysctl");
+    
+    if( 0 != sysctl(mib, 2, NULL, &len, NULL, 0) )
+    {
+      perror("sysctl: can't get HW_REALMEM");
+      break;
+    }
+    
+    if( 0 != sysctl(mib, 2, &mem, &len, NULL, 0) )
+    {
+      perror("sysctl: can't get HW_REALMEM");
+      break;
+    }
     
     [memory setStringValue: sizeDescription((double)mem)];
-  }
+  } while( 0 );
+  
 #else // ! Linux && ! FreeBSD
 #  warning System not yet supported!
 #endif


