home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / MAWK113.ZIP / mawk113 / version.c < prev    next >
C/C++ Source or Header  |  1993-01-20  |  4KB  |  179 lines

  1.  
  2. /********************************************
  3. version.c
  4. copyright 1991, 1992.  Michael D. Brennan
  5.  
  6. This is a source file for mawk, an implementation of
  7. the AWK programming language.
  8.  
  9. Mawk is distributed without warranty under the terms of
  10. the GNU General Public License, version 2, 1991.
  11. ********************************************/
  12.  
  13. /*$Log: version.c,v $
  14.  * Revision 5.6.1.2  1993/01/20  12:53:13  mike
  15.  * d_to_l()
  16.  *
  17.  * Revision 5.6.1.1  1993/01/15  03:33:54  mike
  18.  * patch3: safer double to int conversion
  19.  *
  20.  * Revision 5.6  1992/12/17  02:48:01  mike
  21.  * 1.1.2d changes for DOS
  22.  *
  23.  * Revision 5.5  1992/12/02  03:18:12  mike
  24.  * coherent patch
  25.  *
  26.  * Revision 5.4  1992/08/27  11:50:38  mike
  27.  * patch2
  28.  *
  29.  * Revision 5.3  1992/03/03  16:42:23  brennan
  30.  * patch 1
  31.  *
  32.  * Revision 5.2  92/01/22  05:34:10  brennan
  33.  * version 1.1
  34.  * 
  35.  * Revision 5.1  91/12/05  07:56:33  brennan
  36.  * 1.1 pre-release
  37.  * 
  38. */
  39.  
  40. #include "mawk.h"
  41. #include "patchlev.h"
  42.  
  43. static char rcsid[] =
  44. "@(#) $Id: version.c,v 5.6.1.2 1993/01/20 12:53:13 mike Exp $" ;
  45.  
  46. #define  VERSION_STRING  \
  47.   "mawk 1.1%s%s %s, Copyright (C) Michael D. Brennan\n\n"
  48.  
  49. #define  DOS_STRING     ""
  50.  
  51. /* If use different command line syntax for MSDOS
  52.    mark that in VERSION  */
  53.  
  54. #if  MSDOS 
  55. #undef   DOS_STRING
  56.  
  57. #if  SM_DOS
  58.  
  59. #if  HAVE_REARGV
  60. #define  DOS_STRING     "SM"
  61. #else
  62. #define  DOS_STRING     "SMDOS"
  63. #endif  
  64.  
  65. #else  /* LM_DOS  */
  66.  
  67. #if  HAVE_REARGV
  68. #define  DOS_STRING     "LM"
  69. #else
  70. #define  DOS_STRING     "LMDOS"
  71. #endif  
  72.  
  73. #endif
  74. #endif  /* MSDOS */
  75.  
  76. #ifdef THINK_C
  77. #undef DOS_STRING
  78. #define DOS_STRING ":Mac"
  79. #endif
  80.  
  81. static char fmt[] = "%-14s%10lu\n" ;
  82.  
  83. /* print VERSION and exit */
  84. void print_version()
  85.  
  86.   printf(VERSION_STRING, PATCH_STRING, DOS_STRING, DATE_STRING) ;
  87.   fflush(stdout) ;
  88.  
  89.   print_compiler_id() ;
  90.   fprintf(stderr, "compiled limits:\n") ;
  91.   fprintf(stderr, fmt,  "largest field", (long)MAX_FIELD) ;
  92.   fprintf(stderr, fmt,  "sprintf buffer", (long)SPRINTF_SZ) ;
  93.   print_aux_limits() ;
  94.   exit(0) ;
  95. }
  96.  
  97.  
  98. /*
  99.   Extra info for MSDOS.  This code contributed by
  100.   Ben Myers 
  101. */
  102.  
  103. #ifdef __TURBOC__
  104. #include <alloc.h>   /* coreleft() */
  105. #define  BORL
  106. #endif
  107.  
  108. #ifdef __BORLANDC__
  109. #include <alloc.h>   /* coreleft() */
  110. #define  BORL
  111. #endif
  112.  
  113. #ifdef  BORL 
  114. #if     LM_DOS
  115. extern unsigned  _stklen = 16 * 1024U ; 
  116.    /*  4K of stack is enough for a user function call 
  117.        nesting depth of 75 so this is enough for 300 */
  118. #endif
  119. #endif
  120.  
  121. #ifdef _MSC_VER
  122. #include <malloc.h>
  123. #endif
  124.  
  125. #ifdef __ZTC__
  126. #include <dos.h>              /* _chkstack */
  127. #endif
  128.  
  129.  
  130. int print_compiler_id()
  131. {
  132.  
  133. #ifdef  __TURBOC__
  134.   fprintf(stderr, "MsDOS Turbo C++ %d.%d\n",
  135.                 __TURBOC__>>8, __TURBOC__&0xff) ;
  136. #endif
  137.   
  138. #ifdef __BORLANDC__
  139.   fprintf (stderr, "MS-DOS Borland C++ __BORLANDC__ %x\n",
  140.         __BORLANDC__ );
  141. #endif
  142.  
  143. #ifdef _MSC_VER
  144.   fprintf (stderr, "MS-DOS Microsoft C/C++ _MSC_VER %u\n", _MSC_VER );
  145. #endif
  146.  
  147. #ifdef __ZTC__
  148.   fprintf (stderr, "MS-DOS Zortech C++ __ZTC__ %x\n", __ZTC__ );
  149. #endif
  150.  
  151.   return 0 ; /*shut up */
  152. }
  153.  
  154.  
  155. int  print_aux_limits()
  156. {
  157. #ifdef BORL
  158.   extern unsigned _stklen ;
  159.   fprintf(stderr, fmt,  "stack size", (unsigned long)_stklen) ;
  160.   fprintf(stderr, fmt,  "heap size",  (unsigned long) coreleft()) ;
  161. #endif
  162.  
  163. #ifdef _MSC_VER
  164.   fprintf(stderr, fmt,  "stack size", (unsigned long)_stackavail()) ;
  165. #if   SM_DOS
  166.   fprintf(stderr, fmt,  "heap size", (unsigned long) _memavl()) ;
  167. #endif
  168. #endif
  169.  
  170. #ifdef __ZTC__
  171. /* large memory model only with ztc */
  172.   fprintf(stderr, fmt,  "stack size??", (unsigned long)_chkstack()) ;
  173.   fprintf(stderr, fmt,  "heap size", farcoreleft()) ;
  174. #endif
  175.  
  176.   return 0 ;
  177. }
  178.