Main Page | Modules | Data Structures | Directories | File List | Data Fields | Related Pages

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".

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


Generated on Wed Aug 3 16:15:55 2005 for libdebian-installer by  doxygen 1.4.4