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