Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!genrad!panda!teddy!jpn From: jpn@teddy.UUCP Newsgroups: comp.unix.questions Subject: Re: Let the Sun-3 beep! How??? - (nf) Message-ID: <3977@teddy.UUCP> Date: Thu, 23-Apr-87 13:30:21 EST Article-I.D.: teddy.3977 Posted: Thu Apr 23 13:30:21 1987 Date-Received: Sat, 25-Apr-87 05:41:45 EST References: <8200006@iaoobelix.UUCP> Reply-To: jpn@teddy.UUCP (John P. Nelson) Organization: GenRad, Inc., Concord, Mass. Lines: 57 >Apparently, it is impossible to let the Sun console beep without using >`window_bell'. Does anybody out there know of a possiblity other than this >function (e.g. by accessing the keyboard bell) to generate a beep? For your beeping pleasure: beep.c ------------------ #include #include #include #include #include #define BELL 0x07 /* Control-G */ #define NULL 0 main(argc, argv) int argc; char **argv; { int bell; int cmd; int iterations = 1; static struct timeval ring_time = {0, 100000}; static struct timeval pause_time = {0, 50000}; if ( argc > 1 && isdigit(argv[1][0])) { iterations = atoi(argv[1]); } if ( (bell = open("/dev/kbd",2)) < 0 ) { /* no /dev/kbd. Fail gracefully */ char out; out = BELL; write(1, &out, 1); exit(0); } do { cmd = KBD_CMD_BELL; ioctl(bell, KIOCCMD, &cmd); select(0, NULL, NULL, NULL, &ring_time); cmd = KBD_CMD_NOBELL; ioctl(bell, KIOCCMD, &cmd); if (iterations > 1) select(0, NULL, NULL, NULL, &pause_time); } while (--iterations > 0); exit(0); }