#include #include #include #include char * macMachineType(void) { FILE * fd; char buf[256], *bufptr, *rc; char *id; if (!(fd = fopen("/proc/cpuinfo", "r"))) return NULL; while ((rc = fgets(buf, 255, fd)) != NULL) { if (strncasecmp(buf, "machine", 7) == 0) { bufptr = buf + 7; /* Set up a pointer into the string */ /* Skip blanks and : */ while ((*bufptr == ':' || isspace(*bufptr)) && *bufptr != 0) bufptr++; id = malloc(sizeof(buf)); sprintf(id, "%s", bufptr); return id; } } return NULL; } void help() { printf("Options:\n"); printf("\t--keymap=KEYMAP\t\tUse local keymap instead of us\n"); printf("\n\tOnly one of the video options below may be used at a time:\n"); printf("\t--fbdepth\t\tuse current framebuffer color depth for X\n"); printf("\t--fbdev\t\t\tuse the fbdev driver in X\n"); printf("\t--safe\t\t\tcombines above two options to provide a config that \"always works\"\n"); } void usage() { printf("usage: Xorgautoconfig [option]\n"); help(); }