Subarchitecture detection
[System]


Functions

const char * di_system_subarch_analyze (void)

Function Documentation

const char* di_system_subarch_analyze void   ) 
 

Returns a string describing the current subarchitecture, e.g. "powermac_newworld".

00086 {
00087         FILE *cpuinfo;
00088         char line[1024];
00089         char entry[256];
00090         char *pos;
00091         int i;
00092 
00093         cpuinfo = fopen("/proc/cpuinfo", "r");
00094         if (cpuinfo == NULL)
00095                 return "unknown";
00096 
00097         while (fgets(line, sizeof(line), cpuinfo) != NULL)
00098         {
00099             if (strstr(line, "Hardware") == line)
00100             {
00101                 pos = strchr(line, ':');
00102                 if (pos == NULL)
00103                            continue;
00104                 while (*++pos && (*pos == '\t' || *pos == ' '));
00105 
00106                 strncpy(entry, pos, sizeof(entry));
00107                 break;
00108             }
00109         }
00110 
00111         fclose(cpuinfo);
00112 
00113         for (i = 0; map_hardware[i].entry; i++)
00114         {
00115             if (!strncasecmp(map_hardware[i].entry, entry,
00116                         strlen(map_hardware[i].entry)))
00117             {
00118                 return( map_hardware[i].ret );
00119             }
00120         }
00121 
00122         return "unknown";
00123 }


Generated on Mon Jan 23 16:34:21 2006 for libdebian-installer by  doxygen 1.4.6