home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-4.ZIP / GSAMP / EXAMP14.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-09  |  750 b   |  34 lines

  1. /*
  2.  *  EXAMP14.C
  3.  *
  4.  *  The Greenleaf Comm Library
  5.  *
  6.  *  Copyright (C) 1989 Greenleaf Software Inc.  All Rights Reserved.
  7.  *
  8.  *  This example program demonstrates the use of the kbshift() routine.
  9.  *
  10.  */
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include "asiports.h"
  14. #include "ibmkeys.h"
  15. #include "gf.h"
  16.  
  17. char *states[]={ "Right shift", "Left shift", "Control",   "Alt",
  18.                  "Scroll lock", "Num lock",   "Caps lock", "Insert mode" };
  19.  
  20. void main( void );
  21.  
  22. void main()
  23. {
  24.     int shift_status;
  25.     int i;
  26.  
  27.     shift_status = kbshift();
  28.     for ( i = 0 ; i < 8 ; i++ ) {
  29.         printf( "%-15s: ", states[ i ] );
  30.         printf( "%s\n", shift_status & 1 ? "ON" : "OFF" );
  31.         shift_status >>= 1;
  32.     }
  33. }
  34.