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

00028 {
00029         FILE *cpuinfo;
00030         char line[1024];
00031         char entry[256];
00032         char *pos;
00033         int i;
00034 
00035         cpuinfo = fopen("/proc/cpuinfo", "r");
00036         if (cpuinfo == NULL)
00037                 return "unknown";
00038 
00039         while (fgets(line, sizeof(line), cpuinfo) != NULL)
00040         {
00041             if (strstr(line, "Hardware") == line)
00042             {
00043                 pos = strchr(line, ':');
00044                 if (pos == NULL)
00045                            continue;
00046                 while (*++pos && (*pos == '\t' || *pos == ' '));
00047 
00048                 strncpy(entry, pos, sizeof(entry));
00049                 break;
00050             }
00051         }
00052 
00053         fclose(cpuinfo);
00054 
00055         for (i = 0; map_hardware[i].entry; i++)
00056         {
00057             if (!strncasecmp(map_hardware[i].entry, entry,
00058                         strlen(map_hardware[i].entry)))
00059             {
00060                 return( map_hardware[i].ret );
00061             }
00062         }
00063 
00064         return "unknown";
00065 }


Generated on Mon Jun 19 11:58:33 2006 for libdebian-installer by  doxygen 1.4.6