main(int argc, char **argv)
{
unsigned char val, *ptr;
int freq;

    if(argc > 1)
    {

         freq = 1193180/atoi(argv[1]);

         ptr = &freq;

         outportb(0x43,0xB6);
         outportb(0x42,*ptr);
         outportb(0x42,*(ptr+1));

         val = inportb(0x61);
         val = val | 3;
         outportb(0x61,val);

         delay(1000);

         val = inportb(0x61);
         outportb(0x61,val ^ 3);
    }
    else
    {
         printf("BEEPER Beeps the PC speaker with a tone\n");
         printf("usage: beeper <tone_freq>\n");
    }
}