This is br.c in view mode; [Download] [Up]
/* br.c -- simply resets the video to a "comfortable level"; meaning that the
* video should be visible yet not overbearingly bright
*
* 5/92, CWS -- modified to use the evs driver, thus avoiding the need
* to directly use /dev/vid0.
*/
#import <stdio.h>
#import <nextdev/evsio.h>
#import <sys/file.h>
#import <sys/ioctl.h>
main() {
int fd, i, j;
/* open a file descriptor on /dev/evs0. Notice we open as RDONLY (read only)
* but, apparently, that is ignored by ioctl, because we can still set the
* brightness.
*
* if !fd, then output errno and let the user go figure out what and why...
* else, move on.
*/
if (!(fd = open("/dev/evs0", O_RDONLY, NULL))) {
fprintf(stdout,"open result:%d\n", errno);
exit(1);
}
/* brightness seems to run from 0 to 61-- go figure. 40 seems to be
* comfortably bright.
*
* call ioctl w/the fd and the operand EVSIOSB which asks for one integer
* variable in the varargs list. Check errno on return and tell the user
* about it, if something blew up.
*/
i=40;
if (ioctl(fd, EVSIOSB, &i) < 0) { /* was DKIOBRIGHT */
fprintf(stdout, "ioctl errno: %d\n", errno);
exit(1);
}
/* close the fd and get outta here
*/
close(fd);
exit(0);
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.