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