#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <malloc.h>

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("\t--list-keymaps\t\tList available keymaps\n");
	printf("\t--dump\t\t\tDump debugging information\n");
	printf("\t--help\t\t\tThis help screen\n");
	printf("\t--quiet\t\t\tTurns off messages\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\tprovides a config that \"always works\"\n");

}

void usage()
{
	printf("usage: Xorgautoconfig [option]\n");
	help();
}
