Subarchitecture detection
[System]


Functions

const char * di_system_subarch_analyze (void)

Detailed Description


Function Documentation

const char* di_system_subarch_analyze ( void   ) 

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

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


Generated on Sun Oct 5 14:37:50 2008 for libdebian-installer by  doxygen 1.5.6