home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c070 / 4.ddi / TOOLS.4 / TCTSRC1.EXE / KBEXTEND.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-31  |  1.9 KB  |  61 lines

  1. /**
  2. *
  3. * Name        kbextend -- Select extended or normal BIOS keyboard
  4. *                services for use by KBGETKEY and KBREADY.
  5. *
  6. * Synopsis    result = kbextend(new_state);
  7. *
  8. *        int result      KB_ERROR if new_state is unavailable,
  9. *                    otherwise former state:
  10. *                    KB_USE_EXTEND or KB_USE_NORMAL.
  11. *        int new_state      KB_USE_EXTEND or KB_NORMAL.
  12. *
  13. * Description    This function directs KBGETKEY and KBREADY to use
  14. *        extended or traditional BIOS keyboard services.  If the
  15. *        operation is completed successfully, the former
  16. *        selection is returned.
  17. *
  18. *        An error occurs if KB_USE_EXTEND is selected and the
  19. *        extended BIOS keyboard services are not available.
  20. *
  21. * Returns    result          KB_ERROR if new_state is unavailable,
  22. *                    otherwise the former value of b_kbusex.
  23. *        b_kbusex      new_state (unless failure).
  24. *
  25. * Version    6.00 (C)Copyright Blaise Computing Inc.  1989
  26. *
  27. **/
  28.  
  29. #include <bkeybrd.h>
  30.  
  31. int kbextend(new_state)
  32. int new_state;
  33. {
  34.     int result;
  35.  
  36.     if (new_state == b_kbusex)         /* If nothing to do,          */
  37.     result     = b_kbusex;         /* just return setting.      */
  38.  
  39.     else if (new_state == KB_USE_NORMAL) /* If requesting traditional */
  40.     {                     /* services,              */
  41.     result     = b_kbusex;         /* just return former state  */
  42.     b_kbusex = new_state;         /* and set new state.          */
  43.     }
  44.     else if (new_state == KB_USE_EXTEND) /* If requesting extended    */
  45.     {                     /* services,              */
  46.     if (kbequip() == KB_EXTENDED)     /* first check for presence. */
  47.     {                 /* Extended services are     */
  48.         result   = b_kbusex;     /* available.              */
  49.         b_kbusex = new_state;
  50.     }
  51.     else
  52.         result   = KB_ERROR;     /* Error: extended services  */
  53.                      /* are not available.          */
  54.     }
  55.     else
  56.     result = KB_ERROR;         /* Unknown request.          */
  57.  
  58.     return result;             /* Return former value or    */
  59.                      /* error flag.           */
  60. }
  61.