Subject: Re: How to produce BEEP
To: Max Bell <mbell@europa.com>
From: Rahim Azizarab <ray@tezcat.com>
List: netbsd-help
Date: 10/16/1996 19:00:33
On Wed, 16 Oct 1996, Max Bell wrote:

> Date: Wed, 16 Oct 96 13:21 PDT
> From: Max Bell <mbell@europa.com>
> To: mike.long@analog.com, profeta@neomedia.it
> Cc: netbsd-help@NetBSD.ORG
> Subject: Re: How to produce BEEP
> 
> >From: Mike Long <mike.long@analog.com>
> >#include <unistd.h>
> >#include <fcntl.h>
> >
> >void beepbeep_beepbeep_yeah(void)
> >{
> >  const char buf = '\007';
> >  int f = open("/dev/console", O_WRONLY | O_NOCTTY);
> >  if (f >= 0) {
> >    write(f, &buf, 1);
> >    close(f);
> >  }
> >}
> 
> Or perhaps:
> 
> #include <unistd.h>
> #include <fcntl.h>
> #include <errno.h>
> 
> int beep(void)
> {
> 	int fd;
> 
> 	if ((fd = open("/dev/console", O_WRONLY | O_NOCTTY)) >= 0) {
> 		if (write(fd, "\007", 1) != 1) {
> 			perror("beep: write(2)");
> 			return(-1);
> 		}
> 		return(0);
> 	}
> 	perror("beep: open(2)");
> 	return(-1);
> }
> 
> Max
> 
While, I have not tried it personally, I read that \a would produce a beep
as well.
****************************************************************************

     .--.  __  .---------     Rahim Azizarab     
    / /  \(  )/   ----        1925 S. 3rd Ave    
   ////  ' \/ ` ---           Maywood,  IL  60153     
  // / / :    :--             708-344-6994    
 //      //..\\           
       =UU====UU=             ray@tezcat.com    
                              http://www.tezcat.com/users/ray
***************************************************************************