Returns a string describing the current subarchitecture, e.g. "powermac_newworld".
00066 {
00067 FILE *cpuinfo;
00068 char line[1024];
00069 char entry[256];
00070 char *pos;
00071 int i;
00072
00073 cpuinfo = fopen("/proc/cpuinfo", "r");
00074 if (cpuinfo == NULL)
00075 return "unknown";
00076
00077 while (fgets(line, sizeof(line), cpuinfo) != NULL)
00078 {
00079 if (strstr(line, "Hardware") == line)
00080 {
00081 pos = strchr(line, ':');
00082 if (pos == NULL)
00083 continue;
00084 while (*++pos && (*pos == '\t' || *pos == ' '));
00085
00086 strncpy(entry, pos, sizeof(entry));
00087 break;
00088 }
00089 }
00090
00091 fclose(cpuinfo);
00092
00093 for (i = 0; map_hardware[i].entry; i++)
00094 {
00095 if (!strncasecmp(map_hardware[i].entry, entry,
00096 strlen(map_hardware[i].entry)))
00097 {
00098 return( map_hardware[i].ret );
00099 }
00100 }
00101
00102 return "unknown";
00103 }