home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / online / source / c / compilers / Tickle-4.0.sit.hqx / Tickle-4.0 / src / think_support.c < prev    next >
Text File  |  1993-11-18  |  2KB  |  95 lines

  1. /*
  2. ** This source code was written by Tim Endres
  3. ** Email: time@ice.com.
  4. ** USMail: 8840 Main Street, Whitmore Lake, MI  48189
  5. **
  6. ** Some portions of this application utilize sources
  7. ** that are copyrighted by ICE Engineering, Inc., and
  8. ** ICE Engineering retains all rights to those sources.
  9. **
  10. ** Neither ICE Engineering, Inc., nor Tim Endres, 
  11. ** warrants this source code for any reason, and neither
  12. ** party assumes any responsbility for the use of these
  13. ** sources, libraries, or applications. The user of these
  14. ** sources and binaries assumes all responsbilities for
  15. ** any resulting consequences.
  16. */
  17.  
  18. #include <types.h>
  19. #include <memory.h>
  20. #include <stdlib.h>
  21. #include <stdio.h>
  22. #include <ioctl.h>
  23. #include <math.h>
  24.  
  25. /*
  26.  * hypot - math function that is not supported by Think C
  27.  */
  28.  
  29. double hypot(x, y)
  30.     double x, y;
  31.     {
  32.     double sum;
  33.  
  34.     sum = (x * x) + (y * y);
  35.     return sqrt( sum );
  36.     }
  37.  
  38. char *
  39. cbMALLOC( int size )
  40.     {
  41.     return malloc( size );
  42.     }
  43.  
  44. #ifdef NEVER
  45.  
  46. /*
  47. ** Experiments with AEBuild translation from MPW...
  48. */
  49. int __nw__FUi;
  50. int __dl__FPv;
  51.  
  52. LDIVT( long l1, long l2 )
  53.     {
  54.     return l1 / l2;
  55.     }
  56.  
  57. #endif
  58.  
  59. int
  60. ioctl( int fildes, unsigned int cmd, long *arg )
  61.     {
  62.     int        result = -1;
  63.     char    buf[128];
  64.     
  65.     switch (cmd)
  66.         {
  67.         case FIOINTERACTIVE:
  68.             result = -1;
  69.             break;
  70.         
  71.         case FIOREFNUM:
  72.             *(short *)arg = __file[fildes].refnum;
  73.             result = 0;
  74.             break;
  75.             
  76.         case FIOSETEOF:
  77.             result = SetEOF( __file[fildes].refnum, (long)arg );
  78.             if (result != noErr)
  79.                 result = -1;
  80.             break;
  81.  
  82.         default:
  83. #ifdef NEVER_DEFINED
  84.             sprintf(&buf[1], "ioctl() fildes = %d cmd = %d ",
  85.                             fildes, cmd);
  86.             buf[0] = strlen(&buf[1]);
  87.             DebugStr(buf);
  88. #endif
  89.             result = -1;
  90.             break;
  91.         }
  92.     
  93.     return result;
  94.     }
  95.