diff options
Diffstat (limited to 'vms')
-rw-r--r-- | vms/ChangeLog | 61 | ||||
-rw-r--r-- | vms/descrip.mms | 108 | ||||
-rw-r--r-- | vms/gawkmisc.vms | 4 | ||||
-rw-r--r-- | vms/redirect.h | 12 | ||||
-rw-r--r-- | vms/vms-conf.h | 18 | ||||
-rw-r--r-- | vms/vms.h | 43 | ||||
-rw-r--r-- | vms/vms_args.c | 17 | ||||
-rw-r--r-- | vms/vms_cli.c | 34 | ||||
-rw-r--r-- | vms/vms_fwrite.c | 20 | ||||
-rw-r--r-- | vms/vms_gawk.c | 6 | ||||
-rw-r--r-- | vms/vms_misc.c | 13 | ||||
-rw-r--r-- | vms/vms_popen.c | 32 | ||||
-rw-r--r-- | vms/vmsbuild.com | 72 | ||||
-rw-r--r-- | vms/vmstest.com | 587 |
14 files changed, 862 insertions, 165 deletions
diff --git a/vms/ChangeLog b/vms/ChangeLog index 570c031b..4d5a0918 100644 --- a/vms/ChangeLog +++ b/vms/ChangeLog @@ -1,3 +1,64 @@ +Fri Dec 6 20:55:57 1996 Pat Rankin <rankin@eql.caltech.edu> + + * redirect.h, vms-conf.h: Refine Sep 20th change: include + <stdlib.h> and <string.h> in redirect.h rather than vms-conf.h + so that it occurs for VMS POSIX as well as for normal VMS. + +Wed Nov 20 15:47:02 1996 Pat Rankin <rankin@eql.caltech.edu> + + * descrip.mms (LIBOBJS): Rename from GNUOBJS; add random.obj. + (LIBSRC): Rename from GNUSRC; add random.c. + (AWKSRC): Add random.h. + (random.obj, builtin.obj): Depend upon random.h. + * vmsbuild.com: compile random.c, link random.obj. + + * vmstest.com (childin): Split message about expected failure + in order to avoid consecutive tick marks in the quoted string. + +Wed Nov 13 15:32:58 1996 Pat Rankin <rankin@eql.caltech.edu> + + * vmstest.com: New file to execute test suite. + +Fri Nov 8 18:29:42 1996 Pat Rankin <rankin@eql.caltech.edu> + + Revise makefiles so that no editing should be needed. + + * descrip.mms: Use DEC C as the default compiler, since + the same compile and link options for it can be used as-is + on both VAX and Alpha. + (GNUC, VAXC): New `make' macros for specifying an alternate + compiler on the MMS or MMK command line. + (PATCHLVL): Update to 1. + * vmsbuild.com: Make the equivalent changes. + +Mon Oct 28 17:02:39 1996 Pat Rankin <rankin@eql.caltech.edu> + + * vms.h (U_Long, U_Short): Replace u_long and u_short typedefs. + * vms_*.c: Use them. + + * vms.h, vms_*.c: Change SYS$ and LIB$ routines to lower case + equivalents; fully prototype sys$ and lib$ routines rather than + just declare them. + +Fri Sep 20 17:33:05 1996 Pat Rankin <rankin@eql.caltech.edu> + + * vms-conf.h: directly include <stdlib.h> and <string.h>. + * vms-conf.h (strftime): delete this macro. + * redirect.h (strftime): define it here instead. + +Fri May 17 09:08:16 1996 Arnold Robbins <arnold@skeeve.atl.ga.us> + + * gawkmisc.vms (envsep): Now initialized to ',' instead of ':', + per email from Pat Rankin. + +Thu Jan 11 15:20:14 1996 Pat Rankin <rankin@eql.caltech.edu> + + * vms-conf.h [#if __DECC]: Changes to support V5.x of DEC C. + (_DECC_V4SOURCE, __SOCKET_TYPEDEFS): Define these to avoid + duplicate u_long and u_short typedefs. + (__VMS_VER): If value indicates VMS V6.2 or later, redefine it to + indicate V6.1 in order to avoid conflicting prototype for getopt. + Wed Jan 10 22:58:55 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us> * ChangeLog created. diff --git a/vms/descrip.mms b/vms/descrip.mms index 6d01aa75..f5de76f3 100644 --- a/vms/descrip.mms +++ b/vms/descrip.mms @@ -2,13 +2,15 @@ # # usage: # $ MMS /Description=[.vms]Descrip.MMS gawk +# possibly add `/Macro=(GNUC)' to compile with GNU C, +# or add `/Macro=(GNUC,DO_GNUC_SETUP)' to compile with GNU C on +# a system where GCC is not installed as a defined command, +# or add `/Macro=(VAXC)' to compile with VAX C, +# or add `/Macro=(VAXC,"CC=cc/VAXC")' to compile with VAX C on +# a system which has DEC C installed as the default compiler. # # gawk.exe : -# You'll need to modify this Makefile to use gcc or vaxc v2.x rather -# than vaxc v3.x. Change the CFLAGS macro definition (move '#' from -# beginning of 2nd alternative to beginning of 1st), and also perhaps -# enable the following ".first" rule and its associated action. For -# GNU C, change the LIBS macro definition. +# This is the default target. DEC C has become the default compiler. # # awktab.c : # If you don't have bison but do have VMS POSIX or DEC/Shell, @@ -39,33 +41,33 @@ MAKEFILE = $(VMSDIR)Descrip.MMS # debugging &c !'ccflags' is an escape to allow external compile flags #CCFLAGS = /noOpt/Debug -# work within the main directory, even when handling files in [.vms] -# note: use 2nd variant for either VAX C V2.x or for GNU C -CFLAGS = /Include=[]/Object=[]/Opt=noInline/Define=("GAWK","HAVE_CONFIG_H") $(CCFLAGS) -#CFLAGS = /Include=([],$(VMSDIR))/Object=[]/Define=("GAWK","HAVE_CONFIG_H") $(CCFLAGS) - -# uncomment this for GNU C -#CC = gcc -# beta VAX/VMS -> Alpha/VMS cross-compiler -#CC = gemcc/Standard=VAXC/G_Float -# Alpha/VMS -#CC = cc/Standard=VAXC/G_Float - -# uncomment these two lines for GNU C _if_ it's not installed system-wide -#.first !compiler init, needed if there's no system-wide setup -# set command gnu_cc:[000000]gcc - -# uncomment these three lines for VAX C V2.x -#.first !compiler init, find all #include files -# define/nolog vaxc$library sys$library:,sys$disk:$(VMSDIR) -# define/nolog c$library [],$(VMSDIR) -#!(it appears that if vaxc$library is defined, then the /Include -#! qualifier is ignored, making a c$library definition essential) - -# run-time libraries; use the 2nd one for GNU C +# a comma separated list of macros to define +CDEFS = "GAWK","HAVE_CONFIG_H" + +.ifdef GNUC +# assumes VAX +CC = gcc +CFLAGS = /Incl=([],$(VMSDIR))/Obj=[]/Def=($(CDEFS)) $(CCFLAGS) +LIBS = gnu_cc:[000000]gcclib.olb/Library,sys$library:vaxcrtl.olb/Library +.ifdef DO_GNUC_SETUP +# in case GCC command verb needs to be manually defined +.first + set command gnu_cc:[000000]gcc +.endif !DO_GNUC_SETUP +.else !!GNUC +.ifdef VAXC +# always VAX; version V3.x of VAX C assumed (for V2.x, remove /Opt=noInline) +CC = cc +CFLAGS = /Incl=[]/Obj=[]/Opt=noInline/Def=($(CDEFS)) $(CCFLAGS) LIBS = sys$share:vaxcrtl.exe/Shareable -#LIBS = gnu_cc:[000000]gcclib.olb/Library,sys$library:vaxcrtl.olb/Library -#LIBS = # DECC$SHR instead of VAXCRTL; for Alpha/VMS (or VMS V6.x?) +.else !!VAXC +# neither GNUC nor VAXC, assume DECC (same for either VAX or Alpha) +CC = cc/DECC/Prefix=All +CFLAGS = /Incl=[]/Obj=[]/Def=($(CDEFS)) $(CCFLAGS) +LIBS = # DECC$SHR instead of VAXCRTL, no special link option needed +.endif !VAXC +.endif !GNUC + PARSER = bison PARSERINIT = set command gnu_bison:[000000]bison @@ -93,9 +95,9 @@ AWKOBJS = array.obj,builtin.obj,eval.obj,field.obj,gawkmisc.obj,\ ALLOBJS = $(AWKOBJS),awktab.obj -# GNUOBJS -# GNU stuff that gawk uses as library routines. -GNUOBJS = getopt.obj,getopt1.obj,regex.obj,dfa.obj,$(ALLOCA) +# LIBOBJS +# GNU and other stuff that gawk uses as library routines. +LIBOBJS = getopt.obj,getopt1.obj,regex.obj,dfa.obj,random.obj,$(ALLOCA) # VMSOBJS # VMS specific stuff @@ -110,9 +112,9 @@ SRC = array.c,builtin.c,eval.c,field.c,gawkmisc.c,io.c,main.c,\ ALLSRC= $(SRC),awktab.c -AWKSRC= awk.h,awk.y,$(ALLSRC),patchlevel.h,protos.h +AWKSRC= awk.h,awk.y,$(ALLSRC),patchlevel.h,protos.h,random.h -GNUSRC = alloca.c,dfa.c,dfa.h,regex.c,regex.h,getopt.h,getopt.c,getopt1.c +LIBSRC = alloca.c,dfa.c,dfa.h,regex.c,regex.h,getopt.h,getopt.c,getopt1.c,random.c VMSSRCS = $(VMSDIR)gawkmisc.vms,$(VMSDIR)vms_misc.c,$(VMSDIR)vms_popen.c,\ $(VMSDIR)vms_fwrite.c,$(VMSDIR)vms_args.c,$(VMSDIR)vms_gawk.c,\ @@ -126,7 +128,7 @@ DOCS= $(DOCDIR)gawk.1,$(DOCDIR)gawk.texi,$(DOCDIR)texinfo.tex # Release of gawk REL=3.0 -PATCHLVL=0 +PATCHLVL=1 # generic target all : gawk @@ -137,19 +139,19 @@ gawk : gawk.exe $(ECHO) " GAWK " # rules to build gawk -gawk.exe : $(ALLOBJS) $(GNUOBJS) $(VMSOBJS) gawk.opt +gawk.exe : $(ALLOBJS) $(LIBOBJS) $(VMSOBJS) gawk.opt $(LINK) $(LINKFLAGS) gawk.opt/options gawk.opt : $(MAKEFILE) # create linker options file open/write opt gawk.opt ! ~ 'cat <<close >gawk.opt' - write opt "! GAWK -- Gnu AWK" + write opt "! GAWK -- GNU awk" @ write opt "$(ALLOBJS)" - @ write opt "$(GNUOBJS)" + @ write opt "$(LIBOBJS)" @ write opt "$(VMSOBJS)" - @ write opt "$(LIBS)" - @ write opt "psect_attr=environ,noshr !extern [noshare] char **" - @ write opt "stack=48 !preallocate more pages (default is 20)" - @ write opt "iosegment=128 !ditto (default is 32)" + @ write opt "psect_attr=environ,noshr !extern [noshare] char **" + @ write opt "stack=48 !preallocate more pages (default is 20)" + @ write opt "iosegment=128 !ditto (default is 32)" + write opt "$(LIBS)" write opt "identification=""V$(REL).$(PATCHLVL)""" close opt @@ -163,9 +165,11 @@ $(VMSCODE) : awk.h config.h $(VMSDIR)vms.h gawkmisc.obj : gawkmisc.c $(VMSDIR)gawkmisc.vms -$(ALLOBJS) : awk.h dfa.h regex.h config.h -getopt.obj : getopt.h -getopt1.obj : getopt.h +$(ALLOBJS) : awk.h dfa.h regex.h config.h $(VMSDIR)redirect.h +getopt.obj : getopt.h config.h $(VMSDIR)redirect.h +getopt1.obj : getopt.h config.h $(VMSDIR)redirect.h +random.obj : random.h +builtin.obj : random.h main.obj : patchlevel.h awktab.obj : awk.h awktab.c @@ -184,8 +188,8 @@ config.h : $(VMSDIR)vms-conf.h copy $< $@ # Alloca - C simulation -alloca.obj : alloca.c - $(CC) $(CFLAGS) /define=("STACK_DIRECTION=(-1)","exit=vms_exit") $< +alloca.obj : alloca.c config.h $(VMSDIR)redirect.h + $(CC) $(CFLAGS) /define=($(CDEFS),"STACK_DIRECTION=(-1)","exit=vms_exit") $< $(VMSCMD) : $(VMSDIR)gawk.cld set command $(CLDFLAGS)/object=$@ $< @@ -206,6 +210,8 @@ spotless : clean tidy - delete gawk.dvi;*,gawk.exe;*,[.support]texindex.exe;* # +# note: this is completely out of date +# # build gawk.dvi from within the 'support' subdirectory # gawk.dvi : [.support]texindex.exe gawk.texi @@ -223,6 +229,10 @@ gawk.dvi : [.support]texindex.exe gawk.texi @ rename/new_vers gawk.dvi [-]*.* @ set default [-] +# +# note: besides being out of date, this assumes VAX C +# + [.support]texindex.exe : [.support]texindex.c @ set default [.support] $(CC) /noOpt/noList/Define=("lines=tlines") texindex.c diff --git a/vms/gawkmisc.vms b/vms/gawkmisc.vms index 9d58b51e..95983351 100644 --- a/vms/gawkmisc.vms +++ b/vms/gawkmisc.vms @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991-1995 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991-1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Progamming Language. @@ -25,7 +25,7 @@ char quote = '\''; char *defpath = DEFPATH; -char envsep = ':'; +char envsep = ','; /* gawk_name --- pull out the "gawk" part from how the OS called us */ diff --git a/vms/redirect.h b/vms/redirect.h index 74fe622e..ce58901d 100644 --- a/vms/redirect.h +++ b/vms/redirect.h @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 88, 89, 91-93, 1995 the Free Software Foundation, Inc. + * Copyright (C) 1986, 88, 89, 91-93, 1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -40,6 +40,16 @@ #define regexec gnu_regexec #define regfree gnu_regfree #define regerror gnu_regerror +#ifndef VMS_POSIX +#define strftime gnu_strftime /* always use missing/strftime.c */ +#endif + +#ifdef STDC_HEADERS +/* This is for getopt.c and alloca.c (compiled with HAVE_CONFIG_H defined), + to prevent diagnostics about various implicitly declared functions. */ +#include <stdlib.h> +#include <string.h> +#endif #else /* awk.h, not POSIX */ diff --git a/vms/vms-conf.h b/vms/vms-conf.h index d1593e6a..b8b98de1 100644 --- a/vms/vms-conf.h +++ b/vms/vms-conf.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 1991, 1992, 1995 the Free Software Foundation, Inc. + * Copyright (C) 1991, 1992, 1995, 1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -128,6 +128,13 @@ #ifdef __DECC /* DEC C implies DECC$SHR, which doesn't have the %g problem of VAXCRTL */ #undef GFMT_WORKAROUND + /* DEC C V5.x introduces incompatibilities with prior porting efforts */ +#define _DECC_V4_SOURCE +#define __SOCKET_TYPEDEFS +#if __VMS_VER >= 60200000 +# undef __VMS_VER +# define __VMS_VER 60100000 +#endif #endif /* @@ -154,15 +161,6 @@ #undef REGEX_MALLOC /* use true alloca() in regex.c */ #endif -#ifndef HAVE_STRFTIME -/* - * Always use the version of strftime() in missing/strftime.c instead of - * the [as yet undocumented/unsupported] one in VAXCRTL. Renaming it here - * guarantees that it won't clash with the library routine. - */ -#define strftime gnu_strftime -#endif - #define IN_CONFIG_H #include "vms/redirect.h" #undef IN_CONFIG_H @@ -39,13 +39,13 @@ #define PSL$C_USER 3 /* user mode */ #endif -#if !defined(_TYPES_) || !defined(__GNUC__) -typedef unsigned long u_long; -typedef unsigned short u_short; -#endif +/* note: `ulong' and `u_long' end up conflicting with various header files */ +typedef unsigned long U_Long; +typedef unsigned short U_Short; + typedef struct _dsc { int len; char *adr; } Dsc; /* limited string descriptor */ /* standard VMS itemlist-3 structure */ -typedef struct _itm { u_short len, code; void *buffer; u_short *retlen; } Itm; +typedef struct _itm { U_Short len, code; void *buffer; U_Short *retlen; } Itm; #define vmswork(sts) ((sts)&1) #define vmsfail(sts) (!vmswork(sts)) @@ -53,23 +53,26 @@ typedef struct _itm { u_short len, code; void *buffer; u_short *retlen; } Itm; #define Descrip(strdsc,strbuf) Dsc strdsc = {sizeof strbuf - 1, (char *)strbuf} extern int shell$is_shell P((void)); -extern u_long LIB$FIND_FILE P((const Dsc *, Dsc *, void *, ...)); -extern u_long LIB$FIND_FILE_END P((void *)); +extern U_Long lib$find_file P((const Dsc *, Dsc *, void *, ...)); +extern U_Long lib$find_file_end P((void *)); #ifndef NO_TTY_FWRITE -extern u_long LIB$GET_EF P((long *)); -extern u_long SYS$ASSIGN P((const Dsc *, short *, long, const Dsc *)); -extern u_long SYS$DASSGN P((short)); -extern u_long SYS$QIO P((u_long, u_long, u_long, void *, void (*)(), u_long, - const char *, int, int, u_long, int, int)); -extern u_long SYS$SYNCH P((long, void *)); +extern U_Long lib$get_ef P((long *)); +extern U_Long sys$assign P((const Dsc *, short *, long, const Dsc *)); +extern U_Long sys$dassgn P((short)); +extern U_Long sys$qio P((U_Long, U_Long, U_Long, void *, + void (*)(U_Long), U_Long, + const char *, int, int, U_Long, int, int)); +extern U_Long sys$synch P((long, void *)); #endif /*!NO_TTY_FWRITE*/ +extern U_Long lib$spawn P((const Dsc *,const Dsc *,const Dsc *, + const U_Long *,const Dsc *,U_Long *,U_Long *,...)); /* system services for logical name manipulation */ -extern u_long SYS$TRNLNM P((const u_long *,const Dsc *,const Dsc *, +extern U_Long sys$trnlnm P((const U_Long *,const Dsc *,const Dsc *, const unsigned char *,Itm *)); -extern u_long SYS$CRELNM P((const u_long *,const Dsc *,const Dsc *, +extern U_Long sys$crelnm P((const U_Long *,const Dsc *,const Dsc *, const unsigned char *,const Itm *)); -extern u_long SYS$CRELOG P((int,const Dsc *,const Dsc *,unsigned char)); -extern u_long SYS$DELLNM P((const Dsc *,const Dsc *,const unsigned char *)); +extern U_Long sys$crelog P((int,const Dsc *,const Dsc *,unsigned char)); +extern U_Long sys$dellnm P((const Dsc *,const Dsc *,const unsigned char *)); extern void v_add_arg P((int, const char *)); extern void vms_exit P((int)); @@ -78,7 +81,7 @@ extern char *vms_strdup P((const char *)); extern int vms_devopen P((const char *,int)); extern int vms_execute P((const char *, const char *, const char *)); extern int vms_gawk P((void)); -extern u_long Cli_Present P((const char *)); -extern u_long Cli_Get_Value P((const char *, char *, int)); -extern u_long Cli_Parse_Command P((const void *, const char *)); +extern U_Long Cli_Present P((const char *)); +extern U_Long Cli_Get_Value P((const char *, char *, int)); +extern U_Long Cli_Parse_Command P((const void *, const char *)); diff --git a/vms/vms_args.c b/vms/vms_args.c index 945d7bf6..5371dfb8 100644 --- a/vms/vms_args.c +++ b/vms/vms_args.c @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 1991-1995 the Free Software Foundation, Inc. + * Copyright (C) 1991-1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -92,7 +92,7 @@ void v_add_arg(int, const char *); static char *skipblanks(const char *); static void vms_expand_wildcards(const char *); -static u_long vms_define(const char *, const char *); +static U_Long vms_define(const char *, const char *); static char *t_strstr(const char *, const char *); #define strstr t_strstr /* strstr() missing from vaxcrtl for V4.x */ @@ -302,7 +302,7 @@ ordinary_arg: static void vms_expand_wildcards( const char *prospective_filespec ) { - char *p, spec_buf[255+1], res_buf[255+1], *strstr(); + char *p, spec_buf[255+1], res_buf[255+1]; Dsc spec, result; void *context; register int len = strlen(prospective_filespec); @@ -325,12 +325,12 @@ vms_expand_wildcards( const char *prospective_filespec ) */ len = -1; /* overload 'len' with flag value */ context = NULL; /* init */ - while (vmswork(LIB$FIND_FILE(&spec, &result, &context))) { + while (vmswork(lib$find_file(&spec, &result, &context))) { for (len = sizeof(res_buf)-1; len > 0 && res_buf[len-1] == ' '; len--) ; res_buf[len] = '\0'; /* terminate after discarding trailing blanks */ v_add_arg(v_argc++, strdup(res_buf)); /* store result */ } - (void)LIB$FIND_FILE_END(&context); + (void)lib$find_file_end(&context); if (len >= 0) /* (still -1 => never entered loop) */ --v_argc; /* undo final post-increment */ return; @@ -376,12 +376,12 @@ skipblanks( const char *ptr ) } /* vms_define() - assign a value to a logical name [define/process/user_mode] */ -static u_long +static U_Long vms_define( const char *log_name, const char *trans_val ) { Dsc log_dsc; static Descrip(lnmtable,"LNM$PROCESS_TABLE"); - static u_long attr = LNM$M_CONFINE; + static U_Long attr = LNM$M_CONFINE; static Itm itemlist[] = { {0,LNM$_STRING,0,0}, {0,0} }; static unsigned char acmode = PSL$C_USER; unsigned len = strlen(log_name); @@ -395,10 +395,11 @@ vms_define( const char *log_name, const char *trans_val ) log_dsc.len = len; itemlist[0].buffer = (char *)trans_val; itemlist[0].len = strlen(trans_val); - return SYS$CRELNM(&attr, &lnmtable, &log_dsc, &acmode, itemlist); + return sys$crelnm(&attr, &lnmtable, &log_dsc, &acmode, itemlist); } /* t_strstr -- strstr() substitute; search 'str' for 'sub' */ +/* [strstr() was not present in VAXCRTL prior to VMS V5.0] */ static char *t_strstr ( const char *str, const char *sub ) { register const char *s0, *s1, *s2; diff --git a/vms/vms_cli.c b/vms/vms_cli.c index 2f475b11..a9386216 100644 --- a/vms/vms_cli.c +++ b/vms/vms_cli.c @@ -11,21 +11,21 @@ #include <string.h> #endif -extern u_long CLI$PRESENT(const Dsc *); -extern u_long CLI$GET_VALUE(const Dsc *, Dsc *, short *); -extern u_long CLI$DCL_PARSE(const Dsc *, const void *, ...); -extern u_long SYS$CLI(void *, ...); -extern u_long SYS$FILESCAN(const Dsc *, void *, long *); -extern void *LIB$ESTABLISH(u_long (*handler)(void *, void *)); -extern u_long LIB$SIG_TO_RET(void *, void *); /* condition handler */ +extern U_Long CLI$PRESENT(const Dsc *); +extern U_Long CLI$GET_VALUE(const Dsc *, Dsc *, short *); +extern U_Long CLI$DCL_PARSE(const Dsc *, const void *, ...); +extern U_Long sys$cli(void *, ...); +extern U_Long sys$filescan(const Dsc *, void *, long *); +extern void *lib$establish(U_Long (*handler)(void *, void *)); +extern U_Long lib$sig_to_ret(void *, void *); /* condition handler */ /* Cli_Present() - call CLI$PRESENT to determine whether a parameter or */ /* qualifier is present on the [already parsed] command line */ -u_long +U_Long Cli_Present( const char *item ) { Dsc item_dsc; - (void)LIB$ESTABLISH(LIB$SIG_TO_RET); + (void)lib$establish(lib$sig_to_ret); item_dsc.len = strlen(item_dsc.adr = (char *)item); return CLI$PRESENT(&item_dsc); @@ -33,13 +33,13 @@ Cli_Present( const char *item ) /* Cli_Get_Value() - call CLI$GET_VALUE to retreive the value of a */ /* parameter or qualifier from the command line */ -u_long +U_Long Cli_Get_Value( const char *item, char *result, int size ) { Dsc item_dsc, res_dsc; - u_long sts; + U_Long sts; short len = 0; - (void)LIB$ESTABLISH(LIB$SIG_TO_RET); + (void)lib$establish(lib$sig_to_ret); item_dsc.len = strlen(item_dsc.adr = (char *)item); res_dsc.len = size, res_dsc.adr = result; @@ -52,20 +52,20 @@ Cli_Get_Value( const char *item, char *result, int size ) /* retreive the actual command line (which might be */ /* "run prog" or "mcr prog [params]") and then call */ /* CLI$DCL_PARSE to parse it using specified tables */ -u_long +U_Long Cli_Parse_Command( const void *cmd_tables, const char *cmd_verb ) { struct { short len, code; void *adr; } fscn[2]; struct { char rqtype, rqindx, rqflags, rqstat; unsigned :32; Dsc rdesc; unsigned :32; unsigned :32; unsigned :32; } cmd; - u_long sts; + U_Long sts; int ltmp; char longbuf[2600]; - (void)LIB$ESTABLISH(LIB$SIG_TO_RET); + (void)lib$establish(lib$sig_to_ret); memset(&cmd, 0, sizeof cmd); cmd.rqtype = CLI$K_GETCMD; /* command line minus the verb */ - sts = SYS$CLI( &cmd, (void *)0, (void *)0); /* get actual command line */ + sts = sys$cli(&cmd, (void *)0, (void *)0); /* get actual command line */ if (vmswork(sts)) { /* ok => cli available & verb wasn't "RUN" */ /* invoked via symbol => have command line (which might be empty) */ @@ -74,7 +74,7 @@ Cli_Parse_Command( const void *cmd_tables, const char *cmd_verb ) /* need to strip image name from MCR invocation */ memset(fscn, 0, sizeof fscn); fscn[0].code = FSCN$_FILESPEC; /* full file specification */ - (void)SYS$FILESCAN( &cmd.rdesc, fscn, (long *)0); + (void)sys$filescan(&cmd.rdesc, fscn, (long *)0); cmd.rdesc.len -= fscn[0].len; /* shrink size */ cmd.rdesc.adr += fscn[0].len; /* advance ptr */ } diff --git a/vms/vms_fwrite.c b/vms/vms_fwrite.c index ab9bbbd0..8f0ebcab 100644 --- a/vms/vms_fwrite.c +++ b/vms/vms_fwrite.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1991-1995 the Free Software Foundation, Inc. + * Copyright (C) 1991-1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -85,20 +85,20 @@ tty_fwrite( const void *buf, size_t size, size_t number, FILE *file ) char devnam[255+1]; fgetname(file, devnam); /* get 'file's name */ device.len = strlen(device.adr = devnam); /* create descriptor */ - if (vmswork(SYS$ASSIGN(&device, &chan, 0, (Dsc *)0))) { + if (vmswork(sys$assign(&device, &chan, 0, (Dsc *)0))) { /* get an event flag; use #0 if problem */ - if (evfn == -1 && vmsfail(LIB$GET_EF(&evfn))) evfn = 0; + if (evfn == -1 && vmsfail(lib$get_ef(&evfn))) evfn = 0; } else chan = 0; /* $ASSIGN failed */ } /* store channel for later use; -1 => don't repeat failed init attempt */ channel[file_num] = (chan > 0 ? chan : -1); } if (chan > 0) { /* chan > 0 iff 'file' is a terminal */ - struct _iosbw { u_short status, count; u_long rt_kludge; } iosb; - register u_long sts = 1; + struct _iosbw { U_Short status, count; U_Long rt_kludge; } iosb; + register U_Long sts = 1; register char *pt = (char *)buf; register int offset, pos, count = size * number; - u_long cc_fmt, io_func = IO$_WRITEVBLK; + U_Long cc_fmt, io_func = IO$_WRITEVBLK; int extra = 0; result = 0; if (is_stderr(file_num)) /* if it's SYS$ERROR (stderr)... */ @@ -118,19 +118,19 @@ tty_fwrite( const void *buf, size_t size, size_t number, FILE *file ) else if (pos < count) pos++, cc_fmt |= POSTFIX_CR, extra++; /* wait for previous write, if any, to complete */ if (pt > (char *)buf) { - sts = SYS$SYNCH(evfn, &iosb); + sts = sys$synch(evfn, &iosb); if (vmswork(sts)) sts = iosb.status, result += iosb.count; if (vmsfail(sts)) break; } /* queue an asynchronous write */ - sts = SYS$QIO(evfn, chan, io_func, &iosb, (void (*)())0, 0L, + sts = sys$qio(evfn, chan, io_func, &iosb, (void (*)(U_Long))0, 0L, pt, pos, 0, cc_fmt, 0, 0); if (vmsfail(sts)) break; /*(should never happen)*/ pt += pos, count -= pos; } /* wait for last write to complete */ if (pt > (char *)buf && vmswork(sts)) { - sts = SYS$SYNCH(evfn, &iosb); + sts = sys$synch(evfn, &iosb); if (vmswork(sts)) sts = iosb.status, result += iosb.count; } if (vmsfail(sts)) errno = EVMSERR, vaxc$errno = sts; @@ -199,7 +199,7 @@ tty_fclose( FILE *file ) int file_num = fileno(file); short chan = file_num < _NFILE ? channel[file_num] : -1; if (chan > 0) - (void)SYS$DASSGN(chan); /* deassign the channel (ie, close) */ + (void)sys$dassgn(chan); /* deassign the channel (ie, close) */ if (file_num < _NFILE) channel[file_num] = 0; /* clear stale info */ } diff --git a/vms/vms_gawk.c b/vms/vms_gawk.c index f65b9cbd..d98bb801 100644 --- a/vms/vms_gawk.c +++ b/vms/vms_gawk.c @@ -1,9 +1,9 @@ /* - * vms_gawk.c -- parse GAWK command line using DCL syntax ] + * vms_gawk.c -- parse GAWK command line using DCL syntax */ /* - * Copyright (C) 1991-1993 the Free Software Foundation, Inc. + * Copyright (C) 1991-1993, 1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -67,7 +67,7 @@ union arg_w_prefix { /* structure used to simplify prepending of "-" */ int vms_gawk() { - u_long sts; + U_Long sts; union arg_w_prefix buf; char misc_args[10], *misc_argp; int argc, W_cnt; diff --git a/vms/vms_misc.c b/vms/vms_misc.c index 748b3b94..d876534c 100644 --- a/vms/vms_misc.c +++ b/vms/vms_misc.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1991-1993 the Free Software Foundation, Inc. + * Copyright (C) 1991-1993, 1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -58,11 +58,12 @@ vms_exit( int final_status ) #ifdef strerror # undef strerror #endif +extern char *strerror P((int,...)); + /* vms_strerror() -- convert numeric error code into text string */ char * vms_strerror( int errnum ) { - extern char *strerror P((int,...)); return ( errnum != EVMSERR ? strerror(errnum) : strerror(EVMSERR, vaxc$errno) ); } @@ -169,14 +170,14 @@ vms_devopen( const char *name, int mode ) } /* - * VMS has no timezone support. + * VMS prior to V7.x has no timezone support unless DECnet/OSI is used. */ /* these are global for use by missing/strftime.c */ char *tzname[2] = { "local", "" }; int daylight = 0, timezone = 0, altzone = 0; -/* dummy to satisfy linker */ -void tzset() +/* tzset() -- dummy to satisfy linker */ +void tzset(void) { return; } @@ -184,7 +185,7 @@ void tzset() /* getpgrp() -- there's no such thing as process group under VMS; * job tree might be close enough to be useful though. */ -int getpgrp() +int getpgrp(void) { return 0; } diff --git a/vms/vms_popen.c b/vms/vms_popen.c index dcd8425b..d92dca90 100644 --- a/vms/vms_popen.c +++ b/vms/vms_popen.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1991-1993 the Free Software Foundation, Inc. + * Copyright (C) 1991-1993, 1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -161,7 +161,7 @@ int vms_execute( const char *command, const char *input, const char *output ) { Dsc cmd, in, out, *in_p, *out_p; - u_long sts, cmpltn_sts, LIB$SPAWN(); + U_Long sts, cmpltn_sts; cmd.len = strlen(cmd.adr = (char *)command); if (input) @@ -174,8 +174,8 @@ vms_execute( const char *command, const char *input, const char *output ) out_p = 0; push_logicals(); /* guard against user-mode definitions of sys$Xput */ - sts = LIB$SPAWN(&cmd, in_p, out_p, (long *)0, - (Dsc *)0, (u_long *)0, &cmpltn_sts); + sts = lib$spawn(&cmd, in_p, out_p, (U_Long *)0, + (Dsc *)0, (U_Long *)0, &cmpltn_sts); pop_logicals(); /* restore environment */ if (vmswork(sts) && vmsfail(cmpltn_sts)) sts = cmpltn_sts; @@ -221,14 +221,14 @@ static const Descrip(sys_output,"SYS$OUTPUT"); static const unsigned char acmode = PSL$C_USER; /* only care about user-mode */ /* macros for simplfying the code a bunch */ -#define DelTrans(l) SYS$DELLNM(&lnmtable, (l), &acmode) -#define GetTrans(l,i) SYS$TRNLNM((u_long *)0, &lnmtable, (l), &acmode, (i)) -#define SetTrans(l,i) SYS$CRELNM((u_long *)0, &lnmtable, (l), &acmode, (i)) +#define DelTrans(l) sys$dellnm(&lnmtable, (l), &acmode) +#define GetTrans(l,i) sys$trnlnm((U_Long *)0, &lnmtable, (l), &acmode, (i)) +#define SetTrans(l,i) sys$crelnm((U_Long *)0, &lnmtable, (l), &acmode, (i)) /* itemlist manipulation macros; separate versions for aggregate and scalar */ #define SetItmA(i,c,p,r) ((i).code = (c), (i).len = sizeof (p),\ - (i).buffer = (p), (i).retlen = (u_short *)(r)) + (i).buffer = (p), (i).retlen = (U_Short *)(r)) #define SetItmS(i,c,p) ((i).code = (c), (i).len = sizeof *(p),\ - (i).buffer = (p), (i).retlen = (u_short *)0) + (i).buffer = (p), (i).retlen = (U_Short *)0) #define EndItm0(i) ((i).code = (i).len = 0) /* translate things once, then hold the results here for multiple re-use */ @@ -282,10 +282,10 @@ save_translation( const Dsc *logname ) itmlst_size = (3 * (max_trans_indx + 1) + 1) * sizeof(Itm); emalloc(itmlst, Itm *, itmlst_size, "save_translation"); for (i = 0; i <= max_trans_indx; i++) { - struct def { u_long indx, attr; u_short len; + struct def { U_Long indx, attr; U_Short len; char str[LNM$C_NAMLENGTH], eos; } *wrk; emalloc(wrk, struct def *, sizeof (struct def), "save_translation"); - wrk->indx = (u_long)i; /* this one's an input value for $trnlnm */ + wrk->indx = (U_Long)i; /* this one's an input value for $trnlnm */ SetItmS(itmlst[3*i+0], LNM$_INDEX, &wrk->indx); SetItmS(itmlst[3*i+1], LNM$_ATTRIBUTES, &wrk->attr), wrk->attr = 0; SetItmA(itmlst[3*i+2], LNM$_STRING, &wrk->str, &wrk->len), wrk->len = 0; @@ -298,7 +298,7 @@ save_translation( const Dsc *logname ) */ if (vmswork(GetTrans(logname, itmlst))) { for (i = 0, j = -1; i <= max_trans_indx; i++) { - u_long *attr_p; + U_Long *attr_p; attr_p = itmlst[3*i+1].buffer; /* copy (void *) to true type */ if (*attr_p & LNM$M_EXISTS) { *attr_p &= ~LNM$M_EXISTS; /* must clear this bit */ @@ -307,7 +307,7 @@ save_translation( const Dsc *logname ) itmlst[3*j+2] = itmlst[3*i+2]; if (itmlst[3*j+2].retlen) { /* fixup buffer length */ itmlst[3*j+2].len = *itmlst[3*j+2].retlen; - itmlst[3*j+2].retlen = (u_short *)0; + itmlst[3*j+2].retlen = (U_Short *)0; } } } @@ -322,12 +322,12 @@ static void restore_translation( const Dsc *logname, const Itm *itemlist ) { Dsc trans_val; - u_long *attr_p; + U_Long *attr_p; # define LOG_PROCESS_TABLE 2 /* <obsolete> */ # define LOG_USERMODE PSL$C_USER /* assert( itemlist[1].code == LNM$_ATTRIBUTES ); */ - attr_p = itemlist[1].buffer; /* copy (void *) to (u_long *) */ + attr_p = itemlist[1].buffer; /* copy (void *) to (U_Long *) */ if (*attr_p & LNM$M_CRELOG) { /* check original creation method */ /* $crelog values can have only one translation; so it'll be the first string entry in the itemlist. @@ -335,7 +335,7 @@ restore_translation( const Dsc *logname, const Itm *itemlist ) /* assert( itemlist[2].code == LNM$_STRING ); */ trans_val.adr = itemlist[2].buffer; trans_val.len = itemlist[2].len; - (void) SYS$CRELOG(LOG_PROCESS_TABLE, logname, &trans_val, LOG_USERMODE); + (void) sys$crelog(LOG_PROCESS_TABLE, logname, &trans_val, LOG_USERMODE); } else { /* $crelnm definition; itemlist could specify multiple translations, but has already been setup properly for use as-is. diff --git a/vms/vmsbuild.com b/vms/vmsbuild.com index 40a9307c..04a54792 100644 --- a/vms/vmsbuild.com +++ b/vms/vmsbuild.com @@ -4,31 +4,50 @@ $! gawk 2.13 revised, Jun'91 $! gawk 2.14 revised, Sep'92 $! gawk 2.15 revised, Oct'93 $! gawk 3.0 revised, Dec'95 +$! gawk 3.0.1 revised, Nov'96 $! $ REL = "3.0" !release version number -$ PATCHLVL = "0" +$ PATCHLVL = "1" $! -$! [ remove "/optimize=noinline" for VAX C V2.x or DEC C ] -$! [ add "/standard=VAXC" for DEC C and "/g_float" for Alpha ] -$ if f$type(cc) .nes."STRING" then cc := cc/nolist/optimize=noinline -$ if f$type(link).nes."STRING" then link := link/nomap -$ if f$type(set_command).nes."STRING" then set_command := set command $! -$ cc := 'cc'/Include=[]/Define="(""GAWK"",""HAVE_CONFIG_H"")" -$ libs = "sys$share:vaxcrtl.exe/Shareable" -$ -$! uncomment for DEC C -$ ! libs = "" -$ -$! uncomment the next two lines for VAX C V2.x -$ ! define vaxc$library sys$library:,sys$disk:[.vms] -$ ! define c$library [],[.vms] +$ CCFLAGS = "/noList" ! "/noOpt/Debug" +$ CDEFS = "GAWK,HAVE_CONFIG_H" $! -$! uncomment next two lines for GNU C -$ ! cc := gcc/Include=([],[.vms])/Define="(""GAWK"",""HAVE_CONFIG_H"")" -$ ! libs = "gnu_cc:[000000]gcclib.olb/Library,sys$library:vaxcrtl.olb/Library" +$ if p1.eqs."" then p1 = "DECC" !default compiler +$ if p1.eqs."GNUC" +$ then +$! assumes VAX +$ CC = "gcc" +$ if f$type(gcc).eqs."STRING" then CC = gcc +$ CFLAGS = "/Incl=([],[.vms])/Obj=[]/Def=(''CDEFS')''CCFLAGS'" +$ LIBS = "gnu_cc:[000000]gcclib.olb/Library,sys$library:vaxcrtl.olb/Library" +$ if p2.eqs."DO_GNUC_SETUP" then set command gnu_cc:[000000]gcc +$ else !!GNUC +$ if p1.eqs."VAXC" +$ then +$! always VAX; version V3.x of VAX C assumed (for V2.x, remove /Opt=noInline) +$ CC = "cc" +$ if f$trnlnm("DECC$CC_DEFAULT").nes."" then CC = "cc/VAXC" +$ CFLAGS = "/Incl=[]/Obj=[]/Opt=noInline/Def=(''CDEFS')''CCFLAGS'" +$ LIBS = "sys$share:vaxcrtl.exe/Shareable" +$ else !!VAXC +$! neither GNUC nor VAXC, assume DECC (same for either VAX or Alpha) +$ CC = "cc/DECC/Prefix=All" +$ CFLAGS = "/Incl=[]/Obj=[]/Def=(''CDEFS')''CCFLAGS'" +$ LIBS = "" ! DECC$SHR instead of VAXCRTL, no special link option needed +$ endif !VAXC +$ endif !GNUC $! -$ if f$search("config.h").eqs."" then copy [.vms]vms-conf.h []config.h +$ cc = CC + CFLAGS +$ show symbol cc +$! +$ if f$search("config.h").nes."" then - + if f$cvtime(f$file_attr("config.h","RDT")).ges.- + f$cvtime(f$file_attr("[.vms]vms-conf.h","RDT")) then goto config_ok +$ v = f$verify(1) +$ copy [.vms]vms-conf.h []config.h +$! 'f$verify(v)' +$config_ok: $ if f$search("awktab.c").nes."" then goto awktab_ok $ write sys$output " You must process `awk.y' with ""yacc"" or ""bison""" $ if f$search("awk_tab.c").nes."" then - !bison was run manually @@ -37,6 +56,7 @@ $ if f$search("ytab.c").nes."" .or. f$search("y_tab.c").nes."" then - !yacc write sys$output " or else rename `ytab.c' or `y_tab.c' to `awktab.c'." $ exit $awktab_ok: +$ v = f$verify(1) $ cc array.c $ cc builtin.c $ cc eval.c @@ -54,20 +74,23 @@ $ cc getopt.c $ cc getopt1.c $ cc regex.c $ cc dfa.c -$ cc/define=("STACK_DIRECTION=(-1)","exit=vms_exit") alloca.c +$ cc random.c +$ cc/Define=('CDEFS',"STACK_DIRECTION=(-1)","exit=vms_exit") alloca.c $ cc [.vms]vms_misc.c $ cc [.vms]vms_popen.c $ cc [.vms]vms_fwrite.c $ cc [.vms]vms_args.c $ cc [.vms]vms_gawk.c $ cc [.vms]vms_cli.c -$ set_command/object=[]gawk_cmd.obj [.vms]gawk.cld +$ set command/Object=[]gawk_cmd.obj [.vms]gawk.cld +$! 'f$verify(v)' $! +$ close/noLog Fopt $ create gawk.opt -! GAWK -- Gnu AWK +! GAWK -- GNU awk array.obj,builtin.obj,eval.obj,field.obj,gawkmisc.obj io.obj,main.obj,missing.obj,msg.obj,node.obj,re.obj,version.obj,awktab.obj -getopt.obj,getopt1.obj,regex.obj,dfa.obj,alloca.obj +getopt.obj,getopt1.obj,regex.obj,dfa.obj,random.obj,alloca.obj []vms_misc.obj,vms_popen.obj,vms_fwrite.obj,vms_args.obj []vms_gawk.obj,vms_cli.obj,gawk_cmd.obj psect_attr=environ,noshr !extern [noshare] char ** @@ -78,4 +101,7 @@ $ write Fopt libs $ write Fopt "identification=""V''REL'.''PATCHLVL'""" $ close Fopt $! +$ v = f$verify(1) $ link/exe=gawk.exe gawk.opt/options +$! 'f$verify(v)' +$ exit diff --git a/vms/vmstest.com b/vms/vmstest.com new file mode 100644 index 00000000..59a3cd67 --- /dev/null +++ b/vms/vmstest.com @@ -0,0 +1,587 @@ +$! vmstest.com -- DCL script to perform test/Makefile actions for VMS +$! +$! Usage: +$! $ set default [-.test] +$! $ @[-.vms]vmstest.com bigtest +$! This assumes that newly built gawk.exe is in the next directory up. +$! +$ echo = "write sys$output" +$ cmp = "diff/Output=_NL:/Maximum=1" +$ rm = "delete/noConfirm/noLog" +$ gawk = "$sys$disk:[-]gawk" +$ AWKPATH_srcdir = "define/User AWKPATH sys$disk:[]" +$ +$ if p1.eqs."" then p1 = "bigtest" +$ gosub 'p1' +$ if p2.nes."" then gosub 'p2' +$ if p3.nes."" then gosub 'p3' +$ if p4.nes."" then gosub 'p4' +$ if p5.nes."" then gosub 'p5' +$ if p6.nes."" then gosub 'p6' +$ if p7.nes."" then gosub 'p7' +$ if p8.nes."" then gosub 'p8' +$ exit +$ +$all: +$bigtest: bigtest_list = "basic unix_tests gawk_ext" +$ echo "bigtest" +$bigtest_loop: bigtest_test = f$element(0," ",bigtest_list) +$ bigtest_list = bigtest_list - bigtest_test - " " +$ if bigtest_test.nes." " then gosub 'bigtest_test' +$ if bigtest_list.nes."" then goto bigtest_loop +$ return +$ +$basic: basic_list = "msg swaplns messages argarray longwrds" - + + " getline fstabplus compare arrayref rs fsrs rand" - + + " fsbs negexp asgext anchgsub splitargv awkpath nfset" - + + " reparse convfmt arrayparm paramdup nonl defref" - + + " nofmtch litoct resplit rswhite prmarscl sclforin" - + + " sclifin intprec childin noeffect numsubstr pcntplus" - + + " prmreuse math fldchg fldchgnf reindops sprintfc" - + + " backgsub tweakfld clsflnam mmap8k fnarray dynlj" - + + " substr eofsplit prt1eval splitwht back89 tradanch" +$ echo "basic" +$basic_loop: basic_test = f$element(0," ",basic_list) +$ basic_list = basic_list - basic_test - " " +$ if basic_test.nes." " then gosub 'basic_test' +$ if basic_list.nes."" then goto basic_loop +$ return +$ +$unix_tests: unix_tst_list = "poundbang fflush getlnhd" +$ echo "unix_tests" +$unix_tst_loop: unix_tst_test = f$element(0," ",unix_tst_list) +$ unix_tst_list = unix_tst_list - unix_tst_test - " " +$ if unix_tst_test.nes." " then gosub 'unix_tst_test' +$ if unix_tst_list.nes."" then goto unix_tst_loop +$ return +$ +$gawk_ext: gawk_ext_list = "fieldwdth ignrcase posix manyfiles" - + + " igncfs argtest badargs strftime gensub gnureops" +$ echo "gawk_ext (gawk.extensions)" +$gawk_ext_loop: gawk_ext_test = f$element(0," ",gawk_ext_list) +$ gawk_ext_list = gawk_ext_list - gawk_ext_test - " " +$ if gawk_ext_test.nes." " then gosub 'gawk_ext_test' +$ if gawk_ext_list.nes."" then goto gawk_ext_loop +$ return +$ +$extra: extra_list = "regtest inftest" +$ echo "extra" +$ gosub "regtest" +$ gosub "inftest" +$ return +$ +$poundbang: +$ echo "poundbang: useless for VMS, so skipped" +$ return +$ +$msg: +$ echo "Any output from ""DIFF"" is bad news, although some differences" +$ echo "in floating point values are probably benign -- in particular," +$ echo "some systems may omit a leading zero and the floating point" +$ echo "precision may lead to slightly different output in a few cases." +$ return +$ +$swaplns: echo "swaplns" +$ gawk -f swaplns.awk swaplns.in >tmp. +$ cmp swaplns.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$messages: echo "messages" +$ set noOn +$ gawk -f messages.awk > out2 >& out3 +$ cmp out1.ok out1. +$ if $status then rm out1.; +$ cmp out2.ok out2. +$ if $status then rm out2.; +$ cmp out3.ok out3. +$ if $status then rm out3.; +$ set On +$ return +$ +$argarray: echo "argarray" +$ define/User TEST "test" !this is useless... +$ gawk -f argarray.awk ./argarray.in - >tmp. +just a test +$ cmp argarray.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$fstabplus: echo "fstabplus" +$ gawk -f fstabplus.awk >tmp. +1 2 +$ cmp fstabplus.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$fsrs: echo "fsrs" +$ gawk -f fsrs.awk fsrs.in >tmp. +$ cmp fsrs.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$igncfs: echo "igncfs" +$ gawk -f igncfs.awk igncfs.in >tmp. +$ cmp igncfs.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$longwrds: echo "longwrds" +$ gawk -f longwrds.awk manpage >tmp.too +$ sort tmp.too tmp. +$ cmp longwrds.ok tmp. +$ if $status then rm tmp.;,tmp.too; +$ return +$ +$fieldwdth: echo "fieldwdth" +$ gawk -v "FIELDWIDTHS=2 3 4" "{ print $2}" >tmp. +123456789 +$ cmp fieldwdth.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$ignrcase: echo "ignrcase" +$ gawk -v "IGNORECASE=1" "{ sub(/y/, """"); print}" >tmp. +xYz +$ cmp ignrcase.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$regtest: +$ if f$search("regtest.com").eqs."" +$ then echo "regtest: not available" +$ else echo "regtest" +$ echo "Some of the output from regtest is very system specific, do not" +$ echo "be distressed if your output differs from that distributed." +$ echo "Manual inspection is called for." +$ @regtest.com +$ endif +$ return +$ +$posix: echo "posix" +$ gawk -f posix.awk >tmp. +1:2,3 4 +$ cmp posix.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$manyfiles: echo "manyfiles" +$ if f$search("[.junk]*.*").nes."" then rm [.junk]*.*;* +$ if f$parse("[.junk]").eqs."" then create/Dir/Prot=(O:rwed) [.junk] +$ gawk "BEGIN { for (i = 1; i <= 300; i++) print i, i}" >tmp. +$ echo "This may take quite a while..." +$ echo "" +$ gawk -f manyfiles.awk tmp. tmp. +$ define/User sys$error _NL: +$ define/User sys$output tmp.too +$ search/Match=Nor/Output=_NL:/Log [.junk]*.* "" +$!/Log output: "%SEARCH-S-NOMATCH, <filename> - <#> records" plus 1 line summary +$ gawk "$4!=2{++count}; END{if(NR!=301||count!=1){print ""Failed!""}}" tmp.too +$ rm tmp.;,tmp.too;,[.junk]*.*;*,[]junk.dir; +$ return +$ +$compare: echo "compare" +$ gawk -f compare.awk 0 1 compare.in >tmp. +$ cmp compare.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$arrayref: echo "arrayref" +$ gawk -f arrayref.awk >tmp. +$ cmp arrayref.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$rs: echo "rs" +$ gawk -v "RS=" "{ print $1, $2}" rs.in >tmp. +$ cmp rs.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$fsbs: echo "fsbs" +$ gawk -v "FS=\" "{ print $1, $2 }" fsbs.in >tmp. +$ cmp fsbs.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$inftest: echo "inftest" +$ !! echo "This test is very machine specific..." +$ gawk -f inftest.awk >tmp. +$ !! cmp inftest.ok tmp. !just care that gawk doesn't crash... +$ if $status then rm tmp.; +$ return +$ +$getline: echo "getline" +$ gawk -f getline.awk getline.awk getline.awk >tmp. +$ cmp getline.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$rand: echo "rand" +$ echo "The following line should just be 19 random numbers between 1 and 100" +$ echo "" +$ gawk -f rand.awk +$ return +$ +$negexp: echo "negexp" +$ gawk "BEGIN { a = -2; print 10^a }" >tmp. +$ cmp negexp.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$asgext: echo "asgext" +$ gawk -f asgext.awk asgext.in >tmp. +$ cmp asgext.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$anchgsub: echo "anchgsub" +$ gawk -f anchgsub.awk anchgsub.in >tmp. +$ cmp anchgsub.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$splitargv: echo "splitargv" +$ gawk -f splitargv.awk splitargv.in >tmp. +$ cmp splitargv.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$awkpath: echo "awkpath" +$ define/User AWK_LIBRARY [],[.lib] +$ gawk -f awkpath.awk >tmp. +$ cmp awkpath.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$nfset: echo "nfset" +$ gawk -f nfset.awk nfset.in >tmp. +$ cmp nfset.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$reparse: echo "reparse" +$ gawk -f reparse.awk reparse.in >tmp. +$ cmp reparse.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$argtest: echo "argtest" +$ gawk -f argtest.awk -x -y abc >tmp. +$ cmp argtest.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$badargs: echo "badargs" +$ on error then continue +$ gawk -f 2>&1 >tmp.too +$! search/Match=Nor tmp. "patchlevel" /Output=tmp. +$ gawk "/patchlevel/{next}; {gsub(""\"""",""'""); print}" <tmp.too >tmp. +$ cmp badargs.ok tmp. +$ if $status then rm tmp.;,tmp.too; +$ return +$ +$convfmt: echo "convfmt" +$ gawk -f convfmt.awk >tmp. +$ cmp convfmt.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$arrayparm: echo "arrayparm" +$ set noOn +$ AWKPATH_srcdir +$ gawk -f arrayparm.awk >tmp. 2>&1 +$ set On +$ cmp arrayparm.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$paramdup: echo "paramdup" +$ set noOn +$ AWKPATH_srcdir +$ gawk -f paramdup.awk >tmp. 2>&1 +$ set On +$ cmp paramdup.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$nonl: echo "nonl" +$ ! this one might fail, depending on how the distribution was unpacked, +$ ! because the nonl.awk might actually end up with a final newline +$ AWKPATH_srcdir +$ gawk --lint -f nonl.awk _NL: >tmp. 2>&1 +$ cmp nonl.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$defref: echo "defref" +$ set noOn +$ AWKPATH_srcdir +$ gawk --lint -f defref.awk >tmp. 2>&1 +$ set On +$ cmp defref.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$nofmtch: echo "nofmtch" +$ AWKPATH_srcdir +$ gawk --lint -f nofmtch.awk >tmp. 2>&1 +$ cmp nofmtch.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$strftime: echo "strftime" +$ ! this test could fail on slow machines or on a second boundary, +$ ! so if it does, double check the actual results +$!! date | gawk -- "{$3 = sprintf(""%02d"",$3+0); print >""strftime.ok""; print strftime() >""tmp.""}" +$ ! note: original test is too Unix-specific, so substitute an easier one +$ gawk -- "BEGIN {""show time"" | getline; print >""strftime.ok""; print strftime("" %v %T"") >""tmp.""}" +$ set noOn +$ cmp strftime.ok tmp. +$ if $status then rm tmp.;,strftime.ok;* +$ set On +$ return +$ +$litoct: echo "litoct" +$ gawk --traditional -f litoct.awk >tmp. +ab +$ cmp litoct.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$gensub: echo "gensub" +$ gawk -f gensub.awk gensub.in >tmp. +$ cmp gensub.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$resplit: echo "resplit" +$ gawk -- "{ FS = "":""; $0 = $0; print $2 }" >tmp. +a:b:c d:e:f +$ cmp resplit.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$rswhite: echo "rswhite" +$ gawk -f rswhite.awk rswhite.in >tmp. +$ cmp rswhite.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$prmarscl: echo "prmarscl" +$ set noOn +$ AWKPATH_srcdir +$ gawk -f prmarscl.awk >tmp. 2>&1 +$ set On +$ cmp prmarscl.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$sclforin: echo "sclforin" +$ set noOn +$ AWKPATH_srcdir +$ gawk -f sclforin.awk >tmp. 2>&1 +$ set On +$ cmp sclforin.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$sclifin: echo "sclifin" +$ set noOn +$ AWKPATH_srcdir +$ gawk -f sclifin.awk >tmp. 2>&1 +$ set On +$ cmp sclifin.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$intprec: echo "intprec" +$ gawk -f intprec.awk >tmp. 2>&1 +$ cmp intprec.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$! note: this `childin' test currently [gawk 3.0.1] fails for vms +$childin: echo "childin" +$ echo "note: type ``hi<return><ctrl/Z>'",- + "' if testing appears to hang in `childin'" +$!! @echo hi | gawk "BEGIN { ""cat"" | getline; print; close(""cat"") }" >tmp. +$ gawk "BEGIN { ""type sys$input:"" | getline; print; close(""type sys$input:"") }" >tmp. +hi +$ cmp childin.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$noeffect: echo "noeffect" +$ AWKPATH_srcdir +$ gawk --lint -f noeffect.awk >tmp. 2>&1 +$ cmp noeffect.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$numsubstr: echo "numsubstr" +$ AWKPATH_srcdir +$ gawk -f numsubstr.awk numsubstr.in >tmp. +$ cmp numsubstr.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$gnureops: echo "gnureops" +$ gawk -f gnureops.awk >tmp. +$ cmp gnureops.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$pcntplus: echo "pcntplus" +$ gawk -f pcntplus.awk >tmp. +$ cmp pcntplus.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$prmreuse: echo "prmreuse" +$ if f$search("prmreuse.ok").eqs."" then create prmreuse.ok +$ gawk -f prmreuse.awk >tmp. +$ cmp prmreuse.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$math: echo "math" +$ gawk -f math.awk >tmp. +$ cmp math.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$fflush: +$ echo "fflush: hopeless for VMS, so skipped" +$ return +$!!fflush: echo "fflush" +$ ! hopelessly Unix-specific +$!! @fflush.sh >tmp. +$ cmp fflush.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$fldchg: echo "fldchg" +$ gawk -f fldchg.awk fldchg.in >tmp. +$ cmp fldchg.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$fldchgnf: echo "fldchgnf" +$ gawk -f fldchgnf.awk fldchgnf.in >tmp. +$ cmp fldchgnf.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$reindops: echo "reindops" +$ gawk -f reindops.awk reindops.in >tmp. +$ cmp reindops.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$sprintfc: echo "sprintfc" +$ gawk -f sprintfc.awk sprintfc.in >tmp. +$ cmp sprintfc.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$getlnhd: +$ echo "getlnhd: uses Unix-specific command so won't work on VMS" +$ return +$!!getlnhd: echo "getlnhd" +$ gawk -f getlnhd.awk >tmp. +$ cmp getlnhd.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$backgsub: echo "backgsub" +$ gawk -f backgsub.awk backgsub.in >tmp. +$ cmp backgsub.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$tweakfld: echo "tweakfld" +$ gawk -f tweakfld.awk tweakfld.in >tmp. +$ if f$search("errors.cleanup").nes."" then rm errors.cleanup;* +$ cmp tweakfld.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$clsflnam: echo "clsflnam" +$ if f$search("clsflnam.ok").eqs."" then create clsflnam.ok +$ gawk -f clsflnam.awk clsflnam.in >tmp. +$ cmp clsflnam.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$mmap8k: echo "mmap8k" +$ gawk "{ print }" mmap8k.in >tmp. +$ cmp mmap8k.in tmp. +$ if $status then rm tmp.; +$ return +$ +$fnarray: echo "fnarray" +$ set noOn +$ AWKPATH_srcdir +$ gawk -f fnarray.awk >tmp. 2>&1 +$ set On +$ cmp fnarray.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$dynlj: echo "dynlj" +$ gawk -f dynlj.awk >tmp. +$ cmp dynlj.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$substr: echo "substr" +$ gawk -f substr.awk >tmp. +$ cmp substr.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$eofsplit: echo "eofsplit" +$ if f$search("eofsplit.ok").eqs."" then create eofsplit.ok +$ gawk -f eofsplit.awk >tmp. +$ cmp eofsplit.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$prt1eval: echo "prt1eval" +$ gawk -f prt1eval.awk >tmp. +$ cmp prt1eval.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$splitwht: echo "splitwht" +$ gawk -f splitwht.awk >tmp. +$ cmp splitwht.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$back89: echo "back89" +$ gawk "/a\8b/" back89.in >tmp. +$ cmp back89.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$tradanch: echo "tradanch" +$ if f$search("tradanch.ok").eqs."" then create tradanch.ok +$ gawk --traditional -f tradanch.awk tradanch.in >tmp. +$ cmp tradanch.ok tmp. +$ if $status then rm tmp.; +$ return +$ +$ +$clean: +$ if f$search("tmp.") .nes."" then rm tmp.;* +$ if f$search("tmp.too") .nes."" then rm tmp.too;* +$ if f$search("out%.") .nes."" then rm out%.;* +$ if f$search("strftime.ok").nes."" then rm strftime.ok;* +$ if f$search("[.junk]*.*").nes."" then rm [.junk]*.*;* +$ if f$parse("[.junk]") .nes."" then rm []junk.dir;1 +$ return +$ +$!NOTREACHED +$ exit |