home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xibm.zip / apa16 / apa16OSD.c < prev    next >
C/C++ Source or Header  |  1991-12-30  |  3KB  |  119 lines

  1. /***********************************************************
  2.         Copyright IBM Corporation 1987,1988
  3.  
  4.                       All Rights Reserved
  5.  
  6. Permission to use, copy, modify, and distribute this software and its 
  7. documentation for any purpose and without fee is hereby granted, 
  8. provided that the above copyright notice appear in all copies and that
  9. both that copyright notice and this permission notice appear in 
  10. supporting documentation, and that the name of IBM not be
  11. used in advertising or publicity pertaining to distribution of the
  12. software without specific, written prior permission.  
  13.  
  14. IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  15. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  16. IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  17. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  18. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  19. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  20. SOFTWARE.
  21.  
  22. ******************************************************************/
  23.  
  24. /* $Header: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/apa16/RCS/apa16OSD.c,v 5.0 1991/12/30 19:22:51 jfc Exp $ */
  25. /* $Source: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/apa16/RCS/apa16OSD.c,v $ */
  26.  
  27. #ifndef lint
  28. static char *rcsid = "$Header: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/apa16/RCS/apa16OSD.c,v 5.0 1991/12/30 19:22:51 jfc Exp $";
  29. #endif /* lint */
  30.  
  31. #include "ibmTrace.h"
  32.  
  33. extern void ibmInfoMsg() ;
  34.  
  35. /***==================================================================***/
  36.  
  37. #if defined(BSDrt)
  38. /* Only Works for TCS BSD4.3 */
  39. #include <sys/file.h>
  40. #include <sys/ioctl.h>
  41.  
  42. #include "bsdIO.h"
  43.  
  44. int
  45. apa16Probe()
  46. {
  47. register int fd;
  48. struct screen_control scr ;
  49.  
  50.     TRACE(("apa16Probe()\n")) ;
  51.  
  52.     if ( ( fd = open( "/dev/apa16", O_RDWR | O_NDELAY | O_EXCL ) ) < 0 ) 
  53.     return -1 ;
  54.     scr.device = CONS_APA16;
  55.     if ( ioctl( fd, SCRIOCGETF, &scr ) < 0 ) {
  56.     ErrorF( "WSGO! ioctl SCRIOCGETF failed in apa16Probe()\n" ) ;
  57.     (void) close( fd ) ;
  58.     return -1 ;
  59.     }
  60.     if ( scr.switches & CONSDEV_PRESENT ) {
  61.     ibmInfoMsg( "Found an apa16\n" ) ;
  62.     return fd ;
  63.     }
  64.     else {
  65.     (void) close( fd ) ;
  66.     return -1 ;
  67.     }
  68. /*NOTREACHED*/
  69. }
  70.  
  71. #if 0
  72. void
  73. apa16SaveScreen(pScreen)
  74. ScreenPtr pScreen;
  75. {
  76.  ErrorF("apa16SaveScreen(%x)\n", pScreen);
  77. }
  78.  
  79. void
  80. apa16RestoreScreen(pScreen)
  81. ScreenPtr pScreen;
  82. {
  83.  ErrorF("apa16RestoreScreen(%x)\n", pScreen);
  84. }
  85. #endif
  86. #else
  87. #if defined(AIXrt)
  88.  
  89. #include <sys/hft.h>
  90. #include "hftUtils.h"
  91. #include "OSio.h"
  92.  
  93. /***==================================================================***/
  94.  
  95. int
  96. apa16Probe()
  97. {
  98. register int fd ;
  99.  
  100.     TRACE(("apa16Probe()\n")) ;
  101.  
  102.     if ( ( fd = hftProbe( HFT_APA16_ID ) ) < 0 ) {
  103.     ibmInfoMsg(
  104.         "Didn't find a 6155 Extended Monochrome Graphics Adapter\n" ) ;
  105.     return -1 ;
  106.     }
  107.     else  {
  108.     ibmInfoMsg( "Found a 6155 Extended Monochrome Graphics Adapter\n" ) ;
  109.     return fd ;
  110.     }
  111.     /*NOTREACHED*/
  112. }
  113.  
  114. }
  115. #else
  116.     ******** ERROR ******** Not BSDrt or AIXrt
  117. #endif /*RtAIX*/
  118. #endif /*RtAIX*/
  119.