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

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


Generated on Fri Mar 27 20:39:33 2009 for libdebian-installer by  doxygen 1.5.8