[comp.windows.news] Ring the bell, slowly, from NeWS server side

paul@ppgbms (Paul Evan Matz) (11/08/89)

A couple of weeks ago, I posted a request for information on ringing
the bell on a 386i.  As it turned out, the one response I got, from
Christopher Calabrese at AT&T (thanks Chris), is a C function that runs
on the client side.  Unfortunately, because it is called from the
client side, it has to figure out if it's running on the same machine
as the NeWS server, etc., so it ends up being quite a bit more complex
than I initial thought.

Well, one of our local NeWS experts (Pablo Gonzalez, philabs!ppgbms!pablo), 
after looking at Chris's code, figured he'd try and write to the
keyboard directly from the server.  So, here it is.  We've put it back
into GNU emacs, and psterm.  So far, it seems ok.  Beats the visual
bell.

Thanks again to Chris Calabrese.
_____________________________________________________________
|Regards,                           One Campus Drive        |
|Paul Matz                          PPG Biomedical Systems  |
|914-741-4685                       Pleasantville, NY. 10570|
-------------------------------------------------------------
path ppgbms!moe!paul@philabs.philips.com


-------------------------------------------------------------
%% *** 
 % Copyright (c) 1989 PPG Biomedical Systems
 % All rights reserved -
 % May be freely distributed with this header attached.
 %
 % DESCRIPTION:  This is the code that was put into GNU emacs 
 % and Grasshopper psterm to cause the keyboard, connected to
 % the server machine, to beep.  Not particularly optimized.
 % 
 % Created on Nov. 5, 1989 by Pablo Gonzalez
 %      
%/
    % Sends a BELL character (\02) to the keyboard (/dev/kbd); Pauses for
    %   a while, then deactives the bell by sending (\03)  
    /Beep { % - => - 
        % Open the keyboard file
        (/dev/kbd) (w) file             % fd
        dup                             % fd fd

        % Send BELL character to keyboard
        2 write                         % fd
        dup                             % fd fd
        flushfile                       % fd

        % Pause for a while
        .005 sleep

        % Turn off BELL
        dup                             % fd fd
        3 write                         % fd
        flushfile                       % -
    } def