[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.1

1.1     ! lum         1: /*     $OpenBSD$       */
        !             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:        donebell = 0;
        !            22: }
        !            23:
        !            24: void
        !            25: dobeep(void)
        !            26: {
        !            27:        if (doaudiblebell) {
        !            28:                ttbeep();
        !            29:        }
        !            30:        if (dovisiblebell) {
        !            31:                sgarbf = TRUE;
        !            32:                update(CNONE);
        !            33:                usleep(50000);
        !            34:        }
        !            35:        donebell = 1;
        !            36: }
        !            37:
        !            38: /* ARGSUSED */
        !            39: int
        !            40: toggleaudiblebell(int f, int n)
        !            41: {
        !            42:        if (f & FFARG)
        !            43:                doaudiblebell = n > 0;
        !            44:        else
        !            45:                doaudiblebell = !doaudiblebell;
        !            46:
        !            47:        return (TRUE);
        !            48: }
        !            49:
        !            50: /* ARGSUSED */
        !            51: int
        !            52: togglevisiblebell(int f, int n)
        !            53: {
        !            54:        if (f & FFARG)
        !            55:                dovisiblebell = n > 0;
        !            56:        else
        !            57:                dovisiblebell = !dovisiblebell;
        !            58:
        !            59:        return (TRUE);
        !            60: }