home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 11 / AUCD11B.iso / LANGUAGES / WraithSet / AwkStuff / MawkSrc / c / version < prev    next >
Encoding:
Text File  |  1996-07-28  |  2.8 KB  |  145 lines

  1.  
  2. /********************************************
  3. version.c
  4. copyright 1991-95.  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 1.10  1996/07/28 21:47:07  mike
  15.  *gnuish patch
  16.  *
  17.  * Revision 1.9  1996/02/01  04:44:15  mike
  18.  * roll a beta version
  19.  *
  20.  * Revision 1.8  1995/08/20  17:40:45  mike
  21.  * changed _stackavail to stackavail for MSC
  22.  *
  23.  * Revision 1.7  1995/06/10  17:04:10  mike
  24.  * "largest field" replaced by "max NF"
  25.  *
  26. */
  27.  
  28. #include "mawk.h"
  29. #include "patchlev.h"
  30.  
  31. static char mawkid[] = MAWK_ID ;
  32.  
  33. #define     VERSION_STRING     \
  34.   "mawk 1.3%s%s %s, Copyright (C) Michael D. Brennan\n\n"
  35.  
  36. /* If use different command line syntax for MSDOS
  37.    mark that in VERSION     */
  38.  
  39. #ifndef DOS_STRING
  40. #if  MSDOS && ! HAVE_REARGV
  41. #define DOS_STRING  "MsDOS"
  42. #endif
  43. #endif
  44.  
  45. #ifndef DOS_STRING
  46. #define DOS_STRING    ""
  47. #endif
  48.  
  49. static char fmt[] = "%-14s%10lu\n" ;
  50.  
  51. /* print VERSION and exit */
  52. void
  53. print_version()
  54. {
  55.  
  56.    printf(VERSION_STRING, PATCH_STRING, DOS_STRING, DATE_STRING) ;
  57.    fflush(stdout) ;
  58.  
  59.    print_compiler_id() ;
  60.    fprintf(stderr, "compiled limits:\n") ;
  61.    fprintf(stderr, fmt, "max NF", (long) MAX_FIELD) ;
  62.    fprintf(stderr, fmt, "sprintf buffer", (long) SPRINTF_SZ) ;
  63.    print_aux_limits() ;
  64.    exit(0) ;
  65. }
  66.  
  67.  
  68. /*
  69.   Extra info for MSDOS.     This code contributed by
  70.   Ben Myers
  71. */
  72.  
  73. #ifdef __TURBOC__
  74. #include <alloc.h>        /* coreleft() */
  75. #define     BORL
  76. #endif
  77.  
  78. #ifdef __BORLANDC__
  79. #include <alloc.h>        /* coreleft() */
  80. #define     BORL
  81. #endif
  82.  
  83. #ifdef    BORL
  84. extern unsigned _stklen = 16 * 1024U ;
  85.  /*  4K of stack is enough for a user function call
  86.        nesting depth of 75 so this is enough for 300 */
  87. #endif
  88.  
  89. #ifdef _MSC_VER
  90. #include <malloc.h>
  91. #endif
  92.  
  93. #ifdef __ZTC__
  94. #include <dos.h>        /* _chkstack */
  95. #endif
  96.  
  97.  
  98. int
  99. print_compiler_id()
  100. {
  101.  
  102. #ifdef    __TURBOC__
  103.    fprintf(stderr, "MsDOS Turbo C++ %d.%d\n",
  104.        __TURBOC__ >> 8, __TURBOC__ & 0xff) ;
  105. #endif
  106.  
  107. #ifdef __BORLANDC__
  108.    fprintf(stderr, "MS-DOS Borland C++ __BORLANDC__ %x\n",
  109.        __BORLANDC__) ;
  110. #endif
  111.  
  112. #ifdef _MSC_VER
  113.    fprintf(stderr, "Microsoft C/C++ _MSC_VER %u\n", _MSC_VER) ;
  114. #endif
  115.  
  116. #ifdef __ZTC__
  117.    fprintf(stderr, "MS-DOS Zortech C++ __ZTC__ %x\n", __ZTC__) ;
  118. #endif
  119.  
  120.    return 0 ;             /*shut up */
  121. }
  122.  
  123.  
  124. int
  125. print_aux_limits()
  126. {
  127. #ifdef BORL
  128.    extern unsigned _stklen ;
  129.    fprintf(stderr, fmt, "stack size", (unsigned long) _stklen) ;
  130.    fprintf(stderr, fmt, "heap size", (unsigned long) coreleft()) ;
  131. #endif
  132.  
  133. #ifdef _MSC_VER
  134.    fprintf(stderr, fmt, "stack size", (unsigned long) stackavail()) ;
  135. #endif
  136.  
  137. #ifdef __ZTC__
  138. /* large memory model only with ztc */
  139.    fprintf(stderr, fmt, "stack size??", (unsigned long) _chkstack()) ;
  140.    fprintf(stderr, fmt, "heap size", farcoreleft()) ;
  141. #endif
  142.  
  143.    return 0 ;
  144. }
  145.