home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xibm.zip / mpel / mpelOSD.c < prev    next >
C/C++ Source or Header  |  1992-02-11  |  5KB  |  155 lines

  1. /*
  2.  * Copyright IBM Corporation 1987,1988,1989
  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. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  25. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  26.  
  27.                         All Rights Reserved
  28.  
  29. Permission to use, copy, modify, and distribute this software and its 
  30. documentation for any purpose and without fee is hereby granted, 
  31. provided that the above copyright notice appear in all copies and that
  32. both that copyright notice and this permission notice appear in 
  33. supporting documentation, and that the names of Digital or MIT not be
  34. used in advertising or publicity pertaining to distribution of the
  35. software without specific, written prior permission.  
  36.  
  37. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  38. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  39. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  40. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  41. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  42. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  43. SOFTWARE.
  44.  
  45. ******************************************************************/
  46. /***********************************************************
  47.         Copyright IBM Corporation 1987,1988
  48.  
  49.                       All Rights Reserved
  50.  
  51. Permission to use, copy, modify, and distribute this software and its 
  52. documentation for any purpose and without fee is hereby granted, 
  53. provided that the above copyright notice appear in all copies and that
  54. both that copyright notice and this permission notice appear in 
  55. supporting documentation, and that the name of IBM not be
  56. used in advertising or publicity pertaining to distribution of the
  57. software without specific, written prior permission.  
  58.  
  59. IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  60. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  61. IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  62. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  63. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  64. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  65. SOFTWARE.
  66.  
  67. ******************************************************************/
  68.  
  69. /* $Header: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/mpel/RCS/mpelOSD.c,v 5.1 1992/02/12 00:28:41 jfc Exp $ */
  70. /* $Source: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/mpel/RCS/mpelOSD.c,v $ */
  71.  
  72. #ifndef lint
  73. static char *rcsid = "$Header: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/mpel/RCS/mpelOSD.c,v 5.1 1992/02/12 00:28:41 jfc Exp $" ;
  74. #endif
  75.  
  76. #if defined(AIXrt)
  77. #include "OSio.h"
  78. #include <sys/hft.h>
  79. #include "hftUtils.h"
  80. #include "ibmXhftMap.h"
  81. extern int hftQFD;
  82. #else
  83. #if defined(BSDrt)
  84. #include <fcntl.h>
  85. #include "bsdIO.h"
  86. #else
  87.     ******** ERROR ********
  88. #endif
  89. #endif
  90.  
  91. #include "ibmTrace.h"
  92.  
  93. extern void ibmInfoMsg() ;
  94.  
  95. /***==================================================================***/
  96.  
  97. #if defined(AIXrt)
  98.  
  99. int
  100. mpelProbe()
  101. {
  102. register int fd ;
  103.  
  104.     TRACE( ( "mpelProbe()\n" ) ) ;
  105.  
  106. #ifdef AIXrt
  107. #define    HFT_MEGAPEL_ID    MEGAPELxHFTid
  108. #endif
  109.  
  110.     if ( ( fd = hftProbe( HFT_MEGAPEL_ID ) ) < 0 ) {
  111.     ibmInfoMsg( "Didn't find an IBM 5081 Graphics Adapter\n" ) ;
  112.     return -1 ;
  113.     }
  114.     else  {
  115.     ibmInfoMsg( "Found an IBM 5081 Graphics Adapter\n" ) ;
  116.     return fd ;
  117.     }
  118.     /*NOTREACHED*/
  119. }
  120.  
  121. #else
  122. #if defined(BSDrt)
  123. int
  124. mpelProbe()
  125. {
  126. register int fd ;
  127. struct screen_control scr ;
  128.  
  129.     TRACE( ( "mpelProbe()\n" ) ) ;
  130.  
  131.     if ( ( fd = open( "/dev/mpel", O_RDWR | O_NDELAY | O_EXCL ) ) < 0 )
  132.     return -1 ;
  133.  
  134.     scr.device= CONS_MPEL ;
  135.     if ( ioctl( fd, SCRIOCGETF, &scr ) < 0 )  {
  136.     ErrorF( "mpelProbe: ioctl SCRIOCGETF failed\n" ) ;
  137.     (void) close( fd ) ;
  138.     return -1 ;
  139.     }
  140.     if ( scr.switches & CONSDEV_PRESENT ) {
  141.     ibmInfoMsg( "Found a megapel\n" ) ;
  142.     return fd ;
  143.     }
  144.     else {
  145.     (void) close( fd ) ;
  146.     return -1 ;
  147.     }
  148. /*NOTREACHED*/
  149. }
  150.  
  151. #else
  152.     ******** ERROR ********
  153. #endif
  154. #endif
  155.