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