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

00047 {
00048         FILE *cpuinfo;
00049         char line[1024];
00050         char entry[256];
00051         char *pos;
00052         int i;
00053 
00054         cpuinfo = fopen("/proc/cpuinfo", "r");
00055         if (cpuinfo == NULL)
00056                 return "unknown";
00057 
00058         while (fgets(line, sizeof(line), cpuinfo) != NULL)
00059         {
00060             if (strstr(line, "Hardware") == line)
00061             {
00062                 pos = strchr(line, ':');
00063                 if (pos == NULL)
00064                            continue;
00065                 while (*++pos && (*pos == '\t' || *pos == ' '));
00066 
00067                 strncpy(entry, pos, sizeof(entry));
00068                 break;
00069             }
00070         }
00071 
00072         fclose(cpuinfo);
00073 
00074         for (i = 0; map_hardware[i].entry; i++)
00075         {
00076             if (!strncasecmp(map_hardware[i].entry, entry,
00077                         strlen(map_hardware[i].entry)))
00078             {
00079                 return( map_hardware[i].ret );
00080             }
00081         }
00082 
00083         return "unknown";
00084 }


Generated on Sat Sep 29 08:45:17 2007 for libdebian-installer by  doxygen 1.5.1