All pastes #994754 Raw Edit

Mine

public text v1 · immutable
#994754 ·published 2008-04-23 17:12 UTC
rendered paste body
#define FLASHCAMRC "/.flashcamrc"

    home = getenv("HOME");
    mappath = (char*)alloca(strlen(home)+strlen(FLASHCAMRC)+1);
    strcpy(mappath, home);
    strcat(mappath, FLASHCAMRC);

    printf("Reading device map from '%s'\n", mappath);
    map = fopen(mappath, "r");
    while(map) {
	if (fgets(devicedef, sizeof(devicedef), map) == NULL) break;
	if (devicedef[0] == '/') {
	    devicedef[strlen(devicedef) - 1] = 0;	// Remove trailing '\n'
	    printf("Mapping /dev/video%d -> %s\n", nbVideoDevices, devicedef);
	    videoDevices = (char **)realloc(videoDevices, (nbVideoDevices+1)*sizeof(char *));
	    videoDevices[nbVideoDevices] = strdup(devicedef);
	    nbVideoDevices++;