[BACK]Return to bell.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

Annotation of src/usr.bin/mg/bell.c, Revision 1.2

1.2     ! lum         1: /*     $OpenBSD: bell.c,v 1.1 2013/05/31 18:03:43 lum Exp $    */
1.1       lum         2:
                      3: /*
                      4:  * This file is in the public domain.
                      5:  *
                      6:  * Author: Mark Lumsden <mark@showcomplex.com>
                      7:  *
                      8:  */
                      9:
                     10: /*
                     11:  * Control how mg communicates with the user.
                     12:  */
                     13:
                     14: #include "def.h"
                     15:
                     16: void
                     17: bellinit(void)
                     18: {
                     19:        doaudiblebell = 1;
                     20:        dovisiblebell = 0;
                     21: }
                     22:
                     23: void
                     24: dobeep(void)
                     25: {
                     26:        if (doaudiblebell) {
                     27:                ttbeep();
                     28:        }
                     29:        if (dovisiblebell) {
                     30:                sgarbf = TRUE;
                     31:                update(CNONE);
                     32:                usleep(50000);
                     33:        }
                     34: }
                     35:
                     36: /* ARGSUSED */
                     37: int
                     38: toggleaudiblebell(int f, int n)
                     39: {
                     40:        if (f & FFARG)
                     41:                doaudiblebell = n > 0;
                     42:        else
                     43:                doaudiblebell = !doaudiblebell;
                     44:
                     45:        return (TRUE);
                     46: }
                     47:
                     48: /* ARGSUSED */
                     49: int
                     50: togglevisiblebell(int f, int n)
                     51: {
                     52:        if (f & FFARG)
                     53:                dovisiblebell = n > 0;
                     54:        else
                     55:                dovisiblebell = !dovisiblebell;
                     56:
                     57:        return (TRUE);
                     58: }