diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2014-01-10 12:30:37 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2014-01-10 12:30:37 +0200 |
commit | 1daf400c55ab311c43f1cfa0a253955d81c0c2e7 (patch) | |
tree | 8951b5772f56ee5086fce670261777356858b606 | |
parent | 54684e9a410c64bcde42c39e02832d586ffd1074 (diff) | |
parent | 664868f72b741ba448398d609e18a4cbb1ca20be (diff) | |
download | egawk-1daf400c55ab311c43f1cfa0a253955d81c0c2e7.tar.gz egawk-1daf400c55ab311c43f1cfa0a253955d81c0c2e7.tar.bz2 egawk-1daf400c55ab311c43f1cfa0a253955d81c0c2e7.zip |
Merge branch 'gawk-4.1-stable'
62 files changed, 8616 insertions, 1425 deletions
@@ -45,6 +45,11 @@ systems. * awk.h (HAVE_VPRINTF): Remove check. +2013-12-12 John E. Malmberg <wb8tyw@qsl.net> + + * io.c (redirect): Add additional VMS error codes. + (nextfile): Retry open after closing some files. + 2013-12-10 Scott Deifik <scottd.mail@sbcglobal.net> * io.c (closemaybesocket): Add definition for DJGPP. @@ -42,6 +42,11 @@ Changes from 4.1.0 to 4.1.1 10. The configure script now accepts a --disable-extensions option, which disables checking for and building the extensions. +11. The VMS port has been considerably improved. In particular config.h +is now generated by a DCL script. Also, the extension facility works +and several of the extensions can be built and used. Currently, the +extension facility only works on Alpha and Itanium. + XXX. A number of bugs have been fixed. See the ChangeLog. Changes from 4.0.2 to 4.1.0 @@ -1,4 +1,4 @@ - Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013 + Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, diff --git a/README_d/ChangeLog b/README_d/ChangeLog index 49c30f13..392ce0e2 100644 --- a/README_d/ChangeLog +++ b/README_d/ChangeLog @@ -1,3 +1,20 @@ +2013-12-23 John E. Malmberg <wb8tyw@qsl.net> + + * README.VMS: Add documentation about building dynamic + extensions. + +2013-12-23 John E. Malmberg <wb8tyw@qsl.net> + + * README.VMS: Document decoding Gawk VMS exit codes. + +2013-12-16 John E. Malmberg <wb8tyw@qsl.net> + + * README.VMS: Further updates. + +2013-12-05 John E. Malmberg <wb8tyw@qsl.net> + + * README.VMS: updated with current build information. + 2013-07-02 Arnold D. Robbins <arnold@skeeve.com> * README.pc: Update that |& also now works on MinGW. diff --git a/README_d/README.VMS b/README_d/README.VMS index b47cb0f7..ef15a04d 100644 --- a/README_d/README.VMS +++ b/README_d/README.VMS @@ -6,21 +6,112 @@ CC and LINK commands, and there's also a Makefile for use with the MMS utility. From the source directory, use either |$ @[.VMS]VMSBUILD.COM or - |$ MMS/DECRIPTION=[.VMS]DECSRIP.MMS GAWK + |$ MMS/DESCRIPTION=[.VMS]DESCRIP.MMS gawk +or + |$ MMK/DESCRIPTION=[.VMS]DESCRIP.MMS gawk + +Note that on IA64 and Alpha the case of the target may be important. +MMS has had problems on ODS-5 volumes. MMK does not have these issues. +MMK is available free from https://github.com/endlesssoftware/mmk. +The most recent builds of gawk on VMS used MMK. + +Support of the vmsbuild.com may get dropped in a future release. DEC C -- use either vmsbuild.com or descrip.mms as is. + DEC C is also known as Compaq C and HP C. + VAX C -- use `@vmsbuild VAXC' or `MMS/MACRO=("VAXC")'. On a system with both VAX C and DEC C installed where DEC C is the default, use `MMS/MACRO=("VAXC","CC=CC/VAXC")' for the MMS variant; for the vmsbuild.com variant, any need for `/VAXC' will be detected automatically. + * IMPORTANT NOTE * VAX C should not be used on VAX/VMS 5.5-2 and + later. Use DEC C instead. + GNU C -- use `@vmsbuild GNUC' or `MMS/MACRO=("GNUC")'. On a system where the GCC command is not already defined, use either `@vmsbuild GNUC DO_GNUC_SETUP' or `MMS/MACRO=("GNUC","DO_GNUC_SETUP")'. - Tested under Alpha/VMS V7.1 using DEC C V6.4. GAWK should work -without modifications for VMS V4.6 and up. +Most recent builds are using: + OpenVMS VAX 7.3 using DEC C 6.4 + OpenVMS Alpha 8.3 using HP C V 7.3 + OpenVMS Alpha 8.4 using HP C V 7.3 + OpenVMS IA64 8.4 using HP C V 7.3 + +GAWK was originally ported for VMS V4.6 and up. It has not been tested +with a release that old for some time. + +Compiling dynamic extensions on VMS: + +GAWK comes with some dynamic extensions. The extensions that have been +ported to VMS can be built using one of the following commands. + + |$ MMS/DESCRIPTION=[.VMS]DESCRIP.MMS extensions +or + |$ MMK/DESCRIPTION=[.VMS]DESCRIP.MMS extensions + +GAWK uses AWKLIBPATH as either an environment variable or a logical name +to find the dynamic extensions. + +Dynamic extensions need to be compiled with the same compiler options for +floating point, pointer size, and symbol name handling as gawk. +Alpha and Itanium should use IEEE floating point. The pointer size is 32 bits, +and the symbol name handling is to be exact case with CRC shortening for +symbols longer than 32 bits. + +Currently dynamic extensions have only been tested to work on VMS 8.3 and later +on both Alpha and Itanium. Dynamic extensions are not currently working on +VAX/VMS 7.3. + +Compile time are macros needed to be defined before the first VMS supplied +header file is included. Usually this will be done with a config.h file. + +#if (__CRTL_VER >= 70200000) && !defined (__VAX) +#define _LARGEFILE 1 +#endif + +#ifndef __VAX +#ifdef __CRTL_VER +#if __CRTL_VER >= 80200000 +#define _USE_STD_STAT 1 +#endif +#endif +#endif + +Alpha and Itanium: + +/name=(as_is,short) +/float=ieee/ieee_mode=denorm_results + +VAX: + +/name=(as_is,short) + +The linker option files are [.vms]gawk_plugin.opt for Alpha and Itanium. + +As the VAX dynamic plug-in feature is not yet working, the files potentially +needed for a future VAX plugin are in [.vms.vax] directory of the source. + + +Testing GAWK on VMS: + +After you build gawk, you can test it with the [.vms]vmstest.com procedure. +The procedure takes a parameter that is either for a list of tests or +a specific test. The parameter clean cleans up files left over from running +the tests. + + $ set def [.test] + $ @[-.vms]vmstest.com bigtest + $ @[-.vms]vmstest.com clean + $ set def [-] + +To test the dynamic extensions on VMS 8.3 and later, use: + + $ set def [.test] + $ @[-.vms]vmstest.com extension + $ @[-.vms]vmstest.com clean + $ set def [-] Installing GAWK on VMS: @@ -33,6 +124,11 @@ That symbol should be placed in the user's login.com or in the system- wide sylogin.com procedure so that it will be defined every time the user logs on. +If your gawk was installed by a PCSI kit into the GNV$GNU: directory tree, +the program will be known as GNV$GNU:[bin]gnv$gawk.exe and the help file +will be GNV$GNU:[vms_help]gawk.hlp. The GNV$GNU:[vms_bin]gawk_verb.cld can be +used to add GAWK and the alias AWK to a DCL command table. + Optionally, the help entry can be loaded into a VMS help library. |$ LIBRARY/HELP SYS$HELP:HELPLIB [.VMS]GAWK.HLP (You may want to substitute a site-specific help library rather than @@ -79,9 +175,49 @@ separated list of directory specifications. When defining it, the value should be quoted so that it retains a single translation, not a multi-translation RMS searchlist. ------------------------------- -Thu Jun 18 05:22:10 IDT 2009 -============================ + The exit status from Gawk is encoded in the the VMS $status exit +value so that the severity bits are set as expected and the original +Gawk exit value can be extracted. + +To extract the actual gawk exit code from the VMS status use: + unix_status = (vms_status .and. &x7f8) / 8 + +The exit value is encoded to comply with VMS coding standards and +will have the C_FACILITY_NO of 0x350000 with the constant 0xA000 +added to the number shifted over by 3 bits to make room for the +severity codes. + +The Gawk exit value of 1 will result in the VMS status having the +ERROR severity status set. The Gawk exit value of 2 will result in +the FATAL severity status set. All other Gawk exit values will have +the Success severity status set. + +This change was needed to provide all Gawk exit values to VMS programs and +for compatibilty with programs written in C and the GNV environment. + +Older versions of Gawk incorrectly mostly passed through the Gawk +status values instead of encoding them. DCL scripts that were checking +the severity values will probably not need changing. DCL scripts that +were checking the exact exit status will need an update. + +VAX/VMS floating point uses unbiased rounding. This is generaly incompatible +with the expected behavior. The ofmta test in the test directory will +fail on VAX. + +Gawk needs the SYS$TIMEZONE_RULE or TZ logical name to be defined or it +will output times in GMT. + +The vmstest.com script needs SYS$TIMEZONE_NAME to be defined to match +the SYS$TIMEZONE_RULE. Older versions of VMS do not define these logical +names. + +TO DO Items (not in order of priority) + +1. Implement dynamic plug-ins on VAX. + +2. With the system() function, the status for DCL commands are not being + returned. -On OpenVMS V7.3 (Alpha) the "manyfiles" test is known to fail. The reason -is not (yet) known. +3. Need gawk to accept logical names GNV$AWKPATH, GNV$AWKLIB, and + GNV$AWK_LIBARARY in addtion to the unprefixed names. This will allow + system wide default values to be set by an installation kit. diff --git a/doc/ChangeLog b/doc/ChangeLog index b953d1b0..8508436e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -3,20 +3,32 @@ * gawktexi.in (Full Line Fields): New node. Update copyright year. +2013-12-29 John E. Malmberg <wb8tyw@qsl.net> + + * gawktexi.in: VMS dynamic extensions. + 2013-12-26 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: More minor additions / fixes. - Add John Malmberg for VMS, minor edits. + (Bugs): Add John Malmberg for VMS. Other minor edits. 2013-12-25 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Minor additions / fixes. +2013-12-23 John E. Malmberg <wb8tyw@qsl.net> + + * gawktexi.in: Document the VMS exit status encoding. + 2013-12-21 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in (Additional Configuration Options): Document the --disable-extensions option. +2013-12-16 John E. Malmberg <wb8tyw@qsl.net> + + * gawktexi.in: Updates to VMS sections. + 2013-12-12 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Fix the presentation of asort() and asorti(). diff --git a/doc/gawk.info b/doc/gawk.info index 91962482..b60ecf82 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -615,9 +615,12 @@ texts being (a) (see below), and with the Back-Cover Texts being (b) * VMS Installation:: Installing `gawk' on VMS. * VMS Compilation:: How to compile `gawk' under VMS. +* VMS Dynamic Extensions:: Compiling `gawk' dynamic + extensions on VMS. * VMS Installation Details:: How to install `gawk' under VMS. * VMS Running:: How to run `gawk' under VMS. +* VMS GNV:: The VMS GNV Project. * VMS Old Gawk:: An old version comes with some VMS systems. * Bugs:: Reporting Problems and Bugs. @@ -10764,7 +10767,7 @@ File: gawk.info, Node: Multidimensional, Next: Arrays of Arrays, Prev: Uninit * Menu: -* Multiscanning:: Scanning multidimensional arrays. +* Multiscanning:: Scanning multidimensional arrays. A multidimensional array is an array in which an element is identified by a sequence of indices instead of a single index. For @@ -25237,6 +25240,8 @@ the current version of `gawk'. - Prestandard VAX C compiler for VAX/VMS + - GCC for VAX and Alpha has not been tested for a while. + @@ -26273,51 +26278,119 @@ older designation "VMS" is used throughout to refer to OpenVMS. * Menu: * VMS Compilation:: How to compile `gawk' under VMS. +* VMS Dynamic Extensions:: Compiling `gawk' dynamic extensions on + VMS. * VMS Installation Details:: How to install `gawk' under VMS. * VMS Running:: How to run `gawk' under VMS. +* VMS GNV:: The VMS GNV Project. * VMS Old Gawk:: An old version comes with some VMS systems. -File: gawk.info, Node: VMS Compilation, Next: VMS Installation Details, Up: VMS Installation +File: gawk.info, Node: VMS Compilation, Next: VMS Dynamic Extensions, Up: VMS Installation B.3.2.1 Compiling `gawk' on VMS ............................... To compile `gawk' under VMS, there is a `DCL' command procedure that issues all the necessary `CC' and `LINK' commands. There is also a -`Makefile' for use with the `MMS' utility. From the source directory, -use either: +`Makefile' for use with the `MMS' and `MMK' utilities. From the source +directory, use either: + + $ @[.vms]vmsbuild.com + +or: - $ @[.VMS]VMSBUILD.COM + $ MMS/DESCRIPTION=[.vms]descrip.mms gawk or: - $ MMS/DESCRIPTION=[.VMS]DESCRIP.MMS GAWK + $ MMK/DESCRIPTION=[.vms]descrip.mms gawk + + `MMK' is an open source, free, near-clone of `MMS' and can better +handle `ODS-5' volumes with upper- and lowercase filenames. `MMK' is +available from `https://github.com/endlesssoftware/mmk'. + + With `ODS-5' volumes and extended parsing enabled, the case of the +target parameter may need to be exact. Older versions of `gawk' could be built with VAX C or GNU C on VAX/VMS, as well as with DEC C, but that is no longer supported. DEC C (also briefly known as "Compaq C" and now known as "HP C," but referred -to here as "DEC C") is required. Both `VMSBUILD.COM' and `DESCRIP.MMS' +to here as "DEC C") is required. Both `vmsbuild.com' and `descrip.mms' contain some obsolete support for the older compilers but are set up to use DEC C by default. - `gawk' has been tested under Alpha/VMS 7.3-1 using Compaq C V6.4, -and on Alpha/VMS 7.3, Alpha/VMS 7.3-2, and IA64/VMS 8.3.(1) + `gawk' has been tested under VAX/VMS 7.3 and Alpha/VMS 7.3-1 using +Compaq C V6.4, and Alpha/VMS 7.3, Alpha/VMS 7.3-2, and IA64/VMS 8.3. +The most recent builds used HP C V7.3 on Alpha VMS 8.3 and both Alpha +and IA64 VMS 8.4 used HP C 7.3.(1) + + Work is currently being done for a procedure to build `gawk' and +create a PCSI kit for compatible with the GNV product. ---------- Footnotes ---------- (1) The IA64 architecture is also known as "Itanium." -File: gawk.info, Node: VMS Installation Details, Next: VMS Running, Prev: VMS Compilation, Up: VMS Installation +File: gawk.info, Node: VMS Dynamic Extensions, Next: VMS Installation Details, Prev: VMS Compilation, Up: VMS Installation + +B.3.2.2 Compiling `gawk' Dynamic Extensions on VMS +.................................................. + +The extensions that have been ported to VMS can be built using one of +the following commands. + + $ MMS/DESCRIPTION=[.vms]descrip.mms extensions + +or: + + $ MMK/DESCRIPTION=[.vms]descrip.mms extensions + + `gawk' uses `AWKLIBPATH' as either an environment variable or a +logical name to find the dynamic extensions. + + Dynamic extensions need to be compiled with the same compiler +options for floating point, pointer size, and symbol name handling as +were used to compile `gawk' itself. Alpha and Itanium should use IEEE +floating point. The pointer size is 32 bits, and the symbol name +handling should be exact case with CRC shortening for symbols longer +than 32 bits. + + For Alpha and Itanium: + + /name=(as_is,short) + /float=ieee/ieee_mode=denorm_results + + For VAX: + + /name=(as_is,short) + + Compile time macros need to be defined before the first VMS-supplied +header file is included. + + #if (__CRTL_VER >= 70200000) && !defined (__VAX) + #define _LARGEFILE 1 + #endif + + #ifndef __VAX + #ifdef __CRTL_VER + #if __CRTL_VER >= 80200000 + #define _USE_STD_STAT 1 + #endif + #endif + #endif + + +File: gawk.info, Node: VMS Installation Details, Next: VMS Running, Prev: VMS Dynamic Extensions, Up: VMS Installation -B.3.2.2 Installing `gawk' on VMS +B.3.2.3 Installing `gawk' on VMS ................................ -To install `gawk', all you need is a "foreign" command, which is a -`DCL' symbol whose value begins with a dollar sign. For example: +To use `gawk', all you need is a "foreign" command, which is a `DCL' +symbol whose value begins with a dollar sign. For example: - $ GAWK :== $disk1:[gnubin]GAWK + $ GAWK :== $disk1:[gnubin]gawk Substitute the actual location of `gawk.exe' for `$disk1:[gnubin]'. The symbol should be placed in the `login.com' of any user who wants to run @@ -26325,9 +26398,14 @@ symbol should be placed in the `login.com' of any user who wants to run Alternatively, the symbol may be placed in the system-wide `sylogin.com' procedure, which allows all users to run `gawk'. + If your `gawk' was installed by a PCSI kit into the `GNV$GNU:' +directory tree, the program will be known as +`GNV$GNU:[bin]gnv$gawk.exe' and the help file will be +`GNV$GNU:[vms_help]gawk.hlp'. + Optionally, the help entry can be loaded into a VMS help library: - $ LIBRARY/HELP SYS$HELP:HELPLIB [.VMS]GAWK.HLP + $ LIBRARY/HELP sys$help:helplib [.vms]gawk.hlp (You may want to substitute a site-specific help library rather than the standard VMS library `HELPLIB'.) After loading the help text, the @@ -26349,9 +26427,9 @@ If `AWK_LIBRARY' has no definition, a default value of `SYS$LIBRARY:' is used for it. -File: gawk.info, Node: VMS Running, Next: VMS Old Gawk, Prev: VMS Installation Details, Up: VMS Installation +File: gawk.info, Node: VMS Running, Next: VMS GNV, Prev: VMS Installation Details, Up: VMS Installation -B.3.2.3 Running `gawk' on VMS +B.3.2.4 Running `gawk' on VMS ............................. Command-line parsing and quoting conventions are significantly different @@ -26377,6 +26455,35 @@ If any other dash-type options (or multiple parameters such as data files to process) are present, there is no ambiguity and `--' can be omitted. + The `exit' value is a Unix-style value and is encoded to a VMS exit +status value when the program exits. + + The VMS severity bits will be set based on the `exit' value. A +failure is indicated by 1 and VMS sets the `ERROR' status. A fatal +error is indicated by 2 and VMS will set the `FATAL' status. All other +values will have the `SUCCESS' status. The exit value is encoded to +comply with VMS coding standards and will have the `C_FACILITY_NO' of +`0x350000' with the constant `0xA000' added to the number shifted over +by 3 bits to make room for the severity codes. + + To extract the actual `gawk' exit code from the VMS status use: + + unix_status = (vms_status .and. &x7f8) / 8 + +A C program that uses `exec()' to call `gawk' will get the original +Unix-style exit value. + + Older versions of `gawk' treated a Unix exit code 0 as 1, a failure +as 2, a fatal error as 4, and passed all the other numbers through. +This violated the VMS exit status coding requirements. + + VAX/VMS floating point uses unbiased rounding. *Note Round +Function::. + + VMS reports time values in GMT unless one of the `SYS$TIMEZONE_RULE' +or `TZ' logical names is set. Older versions of VMS, such as VAX/VMS +7.3 do not set these logical names. + The default search path, when looking for `awk' program files specified by the `-f' option, is `"SYS$DISK:[],AWK_LIBRARY:"'. The logical name `AWKPATH' can be used to override this default. The format @@ -26385,9 +26492,25 @@ When defining it, the value should be quoted so that it retains a single translation and not a multitranslation `RMS' searchlist. -File: gawk.info, Node: VMS Old Gawk, Prev: VMS Running, Up: VMS Installation +File: gawk.info, Node: VMS GNV, Next: VMS Old Gawk, Prev: VMS Running, Up: VMS Installation + +B.3.2.5 The VMS GNV Project +........................... + +The VMS GNV package provides a build environment similar to POSIX with +ports of a collection of open source tools. The `gawk' found in the GNV +base kit is an older port. Currently the GNV project is being +reorganized to supply individual PCSI packages for each component. See +`https://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/'. + + The normal build procedure for `gawk' produces a program that is +suitable for use with GNV. At this time work is being done to create +the procedures for building a PCSI kit to replace the older `gawk' port. + + +File: gawk.info, Node: VMS Old Gawk, Prev: VMS GNV, Up: VMS Installation -B.3.2.4 Some VMS Systems Have An Old Version of `gawk' +B.3.2.6 Some VMS Systems Have An Old Version of `gawk' ...................................................... Some versions of VMS have an old version of `gawk'. To access it, @@ -30537,6 +30660,7 @@ Index * exclamation point (!), !~ operator: Regexp Usage. (line 19) * exit statement: Exit Statement. (line 6) * exit status, of gawk: Exit Status. (line 6) +* exit status, of VMS: VMS Running. (line 29) * exp() function: Numeric Functions. (line 18) * expand utility: Very Simple. (line 69) * Expat XML parser library: gawkextlib. (line 35) @@ -30686,6 +30810,7 @@ Index (line 6) * floating-point, numbers <1>: Unexpected Results. (line 6) * floating-point, numbers: General Arithmetic. (line 6) +* floating-point, VAX/VMS: VMS Running. (line 51) * fnmatch extension function: Extension Sample Fnmatch. (line 6) * FNR variable <1>: Auto-set. (line 112) @@ -31766,13 +31891,13 @@ Index * Schorr, Andrew: Acknowledgments. (line 60) * Schreiber, Bert: Acknowledgments. (line 38) * Schreiber, Rita: Acknowledgments. (line 38) -* search paths <1>: VMS Running. (line 29) +* search paths <1>: VMS Running. (line 58) * search paths <2>: PC Using. (line 11) * search paths <3>: Igawk Program. (line 368) * search paths <4>: AWKLIBPATH Variable. (line 6) * search paths: AWKPATH Variable. (line 6) * search paths, for shared libraries: AWKLIBPATH Variable. (line 6) -* search paths, for source files <1>: VMS Running. (line 29) +* search paths, for source files <1>: VMS Running. (line 58) * search paths, for source files <2>: PC Using. (line 11) * search paths, for source files <3>: Igawk Program. (line 368) * search paths, for source files: AWKPATH Variable. (line 6) @@ -32228,522 +32353,524 @@ Index Tag Table: Node: Top1366 -Node: Foreword40552 -Node: Preface44897 -Ref: Preface-Footnote-147950 -Ref: Preface-Footnote-248046 -Node: History48278 -Node: Names50652 -Ref: Names-Footnote-152129 -Node: This Manual52201 -Ref: This Manual-Footnote-157975 -Node: Conventions58075 -Node: Manual History60231 -Ref: Manual History-Footnote-163679 -Ref: Manual History-Footnote-263720 -Node: How To Contribute63794 -Node: Acknowledgments64938 -Node: Getting Started69147 -Node: Running gawk71526 -Node: One-shot72712 -Node: Read Terminal73937 -Ref: Read Terminal-Footnote-175587 -Ref: Read Terminal-Footnote-275863 -Node: Long76034 -Node: Executable Scripts77410 -Ref: Executable Scripts-Footnote-179243 -Ref: Executable Scripts-Footnote-279345 -Node: Comments79892 -Node: Quoting82359 -Node: DOS Quoting86982 -Node: Sample Data Files87657 -Node: Very Simple90701 -Node: Two Rules95300 -Node: More Complex97447 -Ref: More Complex-Footnote-1100377 -Node: Statements/Lines100462 -Ref: Statements/Lines-Footnote-1104924 -Node: Other Features105189 -Node: When106117 -Node: Invoking Gawk108264 -Node: Command Line109725 -Node: Options110508 -Ref: Options-Footnote-1125900 -Node: Other Arguments125925 -Node: Naming Standard Input128583 -Node: Environment Variables129677 -Node: AWKPATH Variable130235 -Ref: AWKPATH Variable-Footnote-1132993 -Node: AWKLIBPATH Variable133253 -Node: Other Environment Variables133971 -Node: Exit Status136934 -Node: Include Files137609 -Node: Loading Shared Libraries141178 -Node: Obsolete142542 -Node: Undocumented143239 -Node: Regexp143481 -Node: Regexp Usage144870 -Node: Escape Sequences146896 -Node: Regexp Operators152565 -Ref: Regexp Operators-Footnote-1159945 -Ref: Regexp Operators-Footnote-2160092 -Node: Bracket Expressions160190 -Ref: table-char-classes162080 -Node: GNU Regexp Operators164603 -Node: Case-sensitivity168326 -Ref: Case-sensitivity-Footnote-1171294 -Ref: Case-sensitivity-Footnote-2171529 -Node: Leftmost Longest171637 -Node: Computed Regexps172838 -Node: Reading Files176175 -Node: Records178177 -Ref: Records-Footnote-1187066 -Node: Fields187103 -Ref: Fields-Footnote-1190136 -Node: Nonconstant Fields190222 -Node: Changing Fields192424 -Node: Field Separators198383 -Node: Default Field Splitting201085 -Node: Regexp Field Splitting202202 -Node: Single Character Fields205544 -Node: Command Line Field Separator206603 -Node: Full Line Fields210037 -Ref: Full Line Fields-Footnote-1210545 -Node: Field Splitting Summary210591 -Ref: Field Splitting Summary-Footnote-1213690 -Node: Constant Size213791 -Node: Splitting By Content218375 -Ref: Splitting By Content-Footnote-1222101 -Node: Multiple Line222141 -Ref: Multiple Line-Footnote-1227988 -Node: Getline228167 -Node: Plain Getline230383 -Node: Getline/Variable232478 -Node: Getline/File233625 -Node: Getline/Variable/File234966 -Ref: Getline/Variable/File-Footnote-1236565 -Node: Getline/Pipe236652 -Node: Getline/Variable/Pipe239351 -Node: Getline/Coprocess240458 -Node: Getline/Variable/Coprocess241710 -Node: Getline Notes242447 -Node: Getline Summary245234 -Ref: table-getline-variants245642 -Node: Read Timeout246554 -Ref: Read Timeout-Footnote-1250295 -Node: Command line directories250352 -Node: Printing250982 -Node: Print252613 -Node: Print Examples253950 -Node: Output Separators256734 -Node: OFMT258494 -Node: Printf259852 -Node: Basic Printf260758 -Node: Control Letters262297 -Node: Format Modifiers266109 -Node: Printf Examples272118 -Node: Redirection274833 -Node: Special Files281798 -Node: Special FD282331 -Ref: Special FD-Footnote-1285956 -Node: Special Network286030 -Node: Special Caveats286880 -Node: Close Files And Pipes287676 -Ref: Close Files And Pipes-Footnote-1294659 -Ref: Close Files And Pipes-Footnote-2294807 -Node: Expressions294957 -Node: Values296089 -Node: Constants296765 -Node: Scalar Constants297445 -Ref: Scalar Constants-Footnote-1298304 -Node: Nondecimal-numbers298486 -Node: Regexp Constants301486 -Node: Using Constant Regexps301961 -Node: Variables305016 -Node: Using Variables305671 -Node: Assignment Options307395 -Node: Conversion309267 -Ref: table-locale-affects314768 -Ref: Conversion-Footnote-1315392 -Node: All Operators315501 -Node: Arithmetic Ops316131 -Node: Concatenation318636 -Ref: Concatenation-Footnote-1321428 -Node: Assignment Ops321548 -Ref: table-assign-ops326536 -Node: Increment Ops327867 -Node: Truth Values and Conditions331301 -Node: Truth Values332384 -Node: Typing and Comparison333433 -Node: Variable Typing334226 -Ref: Variable Typing-Footnote-1338123 -Node: Comparison Operators338245 -Ref: table-relational-ops338655 -Node: POSIX String Comparison342204 -Ref: POSIX String Comparison-Footnote-1343160 -Node: Boolean Ops343298 -Ref: Boolean Ops-Footnote-1347376 -Node: Conditional Exp347467 -Node: Function Calls349199 -Node: Precedence352793 -Node: Locales356462 -Node: Patterns and Actions357551 -Node: Pattern Overview358605 -Node: Regexp Patterns360274 -Node: Expression Patterns360817 -Node: Ranges364502 -Node: BEGIN/END367468 -Node: Using BEGIN/END368230 -Ref: Using BEGIN/END-Footnote-1370961 -Node: I/O And BEGIN/END371067 -Node: BEGINFILE/ENDFILE373349 -Node: Empty376263 -Node: Using Shell Variables376579 -Node: Action Overview378864 -Node: Statements381221 -Node: If Statement383075 -Node: While Statement384574 -Node: Do Statement386618 -Node: For Statement387774 -Node: Switch Statement390926 -Node: Break Statement393023 -Node: Continue Statement395013 -Node: Next Statement396806 -Node: Nextfile Statement399196 -Node: Exit Statement401839 -Node: Built-in Variables404255 -Node: User-modified405350 -Ref: User-modified-Footnote-1413708 -Node: Auto-set413770 -Ref: Auto-set-Footnote-1427240 -Ref: Auto-set-Footnote-2427445 -Node: ARGC and ARGV427501 -Node: Arrays431352 -Node: Array Basics432857 -Node: Array Intro433683 -Node: Reference to Elements438000 -Node: Assigning Elements440270 -Node: Array Example440761 -Node: Scanning an Array442493 -Node: Controlling Scanning444807 -Ref: Controlling Scanning-Footnote-1449894 -Node: Delete450210 -Ref: Delete-Footnote-1452975 -Node: Numeric Array Subscripts453032 -Node: Uninitialized Subscripts455215 -Node: Multidimensional456842 -Node: Multiscanning459934 -Node: Arrays of Arrays461523 -Node: Functions466163 -Node: Built-in466982 -Node: Calling Built-in468060 -Node: Numeric Functions470048 -Ref: Numeric Functions-Footnote-1473880 -Ref: Numeric Functions-Footnote-2474237 -Ref: Numeric Functions-Footnote-3474285 -Node: String Functions474554 -Ref: String Functions-Footnote-1497474 -Ref: String Functions-Footnote-2497603 -Ref: String Functions-Footnote-3497851 -Node: Gory Details497938 -Ref: table-sub-escapes499617 -Ref: table-sub-posix-92500971 -Ref: table-sub-proposed502322 -Ref: table-posix-sub503676 -Ref: table-gensub-escapes505221 -Ref: Gory Details-Footnote-1506397 -Ref: Gory Details-Footnote-2506448 -Node: I/O Functions506599 -Ref: I/O Functions-Footnote-1513584 -Node: Time Functions513731 -Ref: Time Functions-Footnote-1524664 -Ref: Time Functions-Footnote-2524732 -Ref: Time Functions-Footnote-3524890 -Ref: Time Functions-Footnote-4525001 -Ref: Time Functions-Footnote-5525113 -Ref: Time Functions-Footnote-6525340 -Node: Bitwise Functions525606 -Ref: table-bitwise-ops526168 -Ref: Bitwise Functions-Footnote-1530389 -Node: Type Functions530573 -Node: I18N Functions531724 -Node: User-defined533351 -Node: Definition Syntax534155 -Ref: Definition Syntax-Footnote-1539065 -Node: Function Example539134 -Node: Function Caveats541728 -Node: Calling A Function542149 -Node: Variable Scope543264 -Node: Pass By Value/Reference546227 -Node: Return Statement549735 -Node: Dynamic Typing552716 -Node: Indirect Calls553647 -Node: Library Functions563332 -Ref: Library Functions-Footnote-1566845 -Ref: Library Functions-Footnote-2566988 -Node: Library Names567159 -Ref: Library Names-Footnote-1570630 -Ref: Library Names-Footnote-2570850 -Node: General Functions570936 -Node: Strtonum Function571964 -Node: Assert Function574894 -Node: Round Function578220 -Node: Cliff Random Function579763 -Node: Ordinal Functions580779 -Ref: Ordinal Functions-Footnote-1583849 -Ref: Ordinal Functions-Footnote-2584101 -Node: Join Function584310 -Ref: Join Function-Footnote-1586081 -Node: Getlocaltime Function586281 -Node: Readfile Function590022 -Node: Data File Management591861 -Node: Filetrans Function592493 -Node: Rewind Function596562 -Node: File Checking597949 -Node: Empty Files599043 -Node: Ignoring Assigns601273 -Node: Getopt Function602826 -Ref: Getopt Function-Footnote-1614129 -Node: Passwd Functions614332 -Ref: Passwd Functions-Footnote-1623307 -Node: Group Functions623395 -Node: Walking Arrays631479 -Node: Sample Programs633616 -Node: Running Examples634290 -Node: Clones635018 -Node: Cut Program636242 -Node: Egrep Program646087 -Ref: Egrep Program-Footnote-1653860 -Node: Id Program653970 -Node: Split Program657586 -Ref: Split Program-Footnote-1661105 -Node: Tee Program661233 -Node: Uniq Program664036 -Node: Wc Program671465 -Ref: Wc Program-Footnote-1675731 -Ref: Wc Program-Footnote-2675931 -Node: Miscellaneous Programs676023 -Node: Dupword Program677211 -Node: Alarm Program679242 -Node: Translate Program683995 -Ref: Translate Program-Footnote-1688382 -Ref: Translate Program-Footnote-2688630 -Node: Labels Program688764 -Ref: Labels Program-Footnote-1692135 -Node: Word Sorting692219 -Node: History Sorting696103 -Node: Extract Program697942 -Ref: Extract Program-Footnote-1705445 -Node: Simple Sed705573 -Node: Igawk Program708635 -Ref: Igawk Program-Footnote-1723792 -Ref: Igawk Program-Footnote-2723993 -Node: Anagram Program724131 -Node: Signature Program727199 -Node: Advanced Features728299 -Node: Nondecimal Data730185 -Node: Array Sorting731768 -Node: Controlling Array Traversal732465 -Node: Array Sorting Functions740749 -Ref: Array Sorting Functions-Footnote-1744618 -Node: Two-way I/O744812 -Ref: Two-way I/O-Footnote-1750244 -Node: TCP/IP Networking750314 -Node: Profiling753158 -Node: Internationalization760655 -Node: I18N and L10N762080 -Node: Explaining gettext762766 -Ref: Explaining gettext-Footnote-1767834 -Ref: Explaining gettext-Footnote-2768018 -Node: Programmer i18n768183 -Node: Translator i18n772385 -Node: String Extraction773178 -Ref: String Extraction-Footnote-1774139 -Node: Printf Ordering774225 -Ref: Printf Ordering-Footnote-1777009 -Node: I18N Portability777073 -Ref: I18N Portability-Footnote-1779522 -Node: I18N Example779585 -Ref: I18N Example-Footnote-1782223 -Node: Gawk I18N782295 -Node: Debugger782916 -Node: Debugging783887 -Node: Debugging Concepts784320 -Node: Debugging Terms786176 -Node: Awk Debugging788773 -Node: Sample Debugging Session789665 -Node: Debugger Invocation790185 -Node: Finding The Bug791517 -Node: List of Debugger Commands798005 -Node: Breakpoint Control799339 -Node: Debugger Execution Control803003 -Node: Viewing And Changing Data806363 -Node: Execution Stack809719 -Node: Debugger Info811186 -Node: Miscellaneous Debugger Commands815168 -Node: Readline Support820344 -Node: Limitations821175 -Node: Arbitrary Precision Arithmetic823427 -Ref: Arbitrary Precision Arithmetic-Footnote-1825076 -Node: General Arithmetic825224 -Node: Floating Point Issues826944 -Node: String Conversion Precision827825 -Ref: String Conversion Precision-Footnote-1829530 -Node: Unexpected Results829639 -Node: POSIX Floating Point Problems831792 -Ref: POSIX Floating Point Problems-Footnote-1835617 -Node: Integer Programming835655 -Node: Floating-point Programming837394 -Ref: Floating-point Programming-Footnote-1843725 -Ref: Floating-point Programming-Footnote-2843995 -Node: Floating-point Representation844259 -Node: Floating-point Context845424 -Ref: table-ieee-formats846263 -Node: Rounding Mode847647 -Ref: table-rounding-modes848126 -Ref: Rounding Mode-Footnote-1851141 -Node: Gawk and MPFR851320 -Node: Arbitrary Precision Floats852575 -Ref: Arbitrary Precision Floats-Footnote-1855018 -Node: Setting Precision855334 -Ref: table-predefined-precision-strings856020 -Node: Setting Rounding Mode858165 -Ref: table-gawk-rounding-modes858569 -Node: Floating-point Constants859756 -Node: Changing Precision861185 -Ref: Changing Precision-Footnote-1862582 -Node: Exact Arithmetic862756 -Node: Arbitrary Precision Integers865894 -Ref: Arbitrary Precision Integers-Footnote-1868912 -Node: Dynamic Extensions869059 -Node: Extension Intro870517 -Node: Plugin License871782 -Node: Extension Mechanism Outline872467 -Ref: load-extension872884 -Ref: load-new-function874362 -Ref: call-new-function875357 -Node: Extension API Description877372 -Node: Extension API Functions Introduction878585 -Node: General Data Types883451 -Ref: General Data Types-Footnote-1889056 -Node: Requesting Values889355 -Ref: table-value-types-returned890086 -Node: Constructor Functions891040 -Node: Registration Functions894060 -Node: Extension Functions894745 -Node: Exit Callback Functions896970 -Node: Extension Version String898219 -Node: Input Parsers898869 -Node: Output Wrappers908626 -Node: Two-way processors913136 -Node: Printing Messages915344 -Ref: Printing Messages-Footnote-1916421 -Node: Updating `ERRNO'916573 -Node: Accessing Parameters917312 -Node: Symbol Table Access918542 -Node: Symbol table by name919054 -Node: Symbol table by cookie920801 -Ref: Symbol table by cookie-Footnote-1924931 -Node: Cached values924994 -Ref: Cached values-Footnote-1928443 -Node: Array Manipulation928534 -Ref: Array Manipulation-Footnote-1929632 -Node: Array Data Types929671 -Ref: Array Data Types-Footnote-1932374 -Node: Array Functions932466 -Node: Flattening Arrays936232 -Node: Creating Arrays943084 -Node: Extension API Variables947809 -Node: Extension Versioning948445 -Node: Extension API Informational Variables950346 -Node: Extension API Boilerplate951432 -Node: Finding Extensions955236 -Node: Extension Example955796 -Node: Internal File Description956526 -Node: Internal File Ops960617 -Ref: Internal File Ops-Footnote-1972125 -Node: Using Internal File Ops972265 -Ref: Using Internal File Ops-Footnote-1974618 -Node: Extension Samples974884 -Node: Extension Sample File Functions976408 -Node: Extension Sample Fnmatch984893 -Node: Extension Sample Fork986619 -Node: Extension Sample Inplace987837 -Node: Extension Sample Ord989615 -Node: Extension Sample Readdir990451 -Node: Extension Sample Revout991983 -Node: Extension Sample Rev2way992576 -Node: Extension Sample Read write array993266 -Node: Extension Sample Readfile995149 -Node: Extension Sample API Tests995967 -Node: Extension Sample Time996492 -Node: gawkextlib997856 -Node: Language History1000637 -Node: V7/SVR3.11002159 -Node: SVR41004479 -Node: POSIX1005921 -Node: BTL1007307 -Node: POSIX/GNU1008041 -Node: Common Extensions1013576 -Node: Ranges and Locales1014882 -Ref: Ranges and Locales-Footnote-11019500 -Ref: Ranges and Locales-Footnote-21019527 -Ref: Ranges and Locales-Footnote-31019787 -Node: Contributors1020008 -Node: Installation1025083 -Node: Gawk Distribution1025977 -Node: Getting1026461 -Node: Extracting1027287 -Node: Distribution contents1028979 -Node: Unix Installation1034684 -Node: Quick Installation1035301 -Node: Additional Configuration Options1037745 -Node: Configuration Philosophy1039481 -Node: Non-Unix Installation1041835 -Node: PC Installation1042293 -Node: PC Binary Installation1043592 -Node: PC Compiling1045440 -Node: PC Testing1048384 -Node: PC Using1049560 -Node: Cygwin1053745 -Node: MSYS1054745 -Node: VMS Installation1055259 -Node: VMS Compilation1055862 -Ref: VMS Compilation-Footnote-11056869 -Node: VMS Installation Details1056927 -Node: VMS Running1058562 -Node: VMS Old Gawk1060169 -Node: Bugs1060643 -Node: Other Versions1064563 -Node: Notes1070647 -Node: Compatibility Mode1071447 -Node: Additions1072230 -Node: Accessing The Source1073157 -Node: Adding Code1074597 -Node: New Ports1080642 -Node: Derived Files1084777 -Ref: Derived Files-Footnote-11090098 -Ref: Derived Files-Footnote-21090132 -Ref: Derived Files-Footnote-31090732 -Node: Future Extensions1090830 -Node: Implementation Limitations1091413 -Node: Extension Design1092665 -Node: Old Extension Problems1093819 -Ref: Old Extension Problems-Footnote-11095327 -Node: Extension New Mechanism Goals1095384 -Ref: Extension New Mechanism Goals-Footnote-11098749 -Node: Extension Other Design Decisions1098935 -Node: Extension Future Growth1101041 -Node: Old Extension Mechanism1101877 -Node: Basic Concepts1103617 -Node: Basic High Level1104298 -Ref: figure-general-flow1104569 -Ref: figure-process-flow1105168 -Ref: Basic High Level-Footnote-11108397 -Node: Basic Data Typing1108582 -Node: Glossary1111937 -Node: Copying1137399 -Node: GNU Free Documentation License1174956 -Node: Index1200093 +Node: Foreword40737 +Node: Preface45082 +Ref: Preface-Footnote-148135 +Ref: Preface-Footnote-248231 +Node: History48463 +Node: Names50837 +Ref: Names-Footnote-152314 +Node: This Manual52386 +Ref: This Manual-Footnote-158160 +Node: Conventions58260 +Node: Manual History60416 +Ref: Manual History-Footnote-163864 +Ref: Manual History-Footnote-263905 +Node: How To Contribute63979 +Node: Acknowledgments65123 +Node: Getting Started69332 +Node: Running gawk71711 +Node: One-shot72897 +Node: Read Terminal74122 +Ref: Read Terminal-Footnote-175772 +Ref: Read Terminal-Footnote-276048 +Node: Long76219 +Node: Executable Scripts77595 +Ref: Executable Scripts-Footnote-179428 +Ref: Executable Scripts-Footnote-279530 +Node: Comments80077 +Node: Quoting82544 +Node: DOS Quoting87167 +Node: Sample Data Files87842 +Node: Very Simple90886 +Node: Two Rules95485 +Node: More Complex97632 +Ref: More Complex-Footnote-1100562 +Node: Statements/Lines100647 +Ref: Statements/Lines-Footnote-1105109 +Node: Other Features105374 +Node: When106302 +Node: Invoking Gawk108449 +Node: Command Line109910 +Node: Options110693 +Ref: Options-Footnote-1126085 +Node: Other Arguments126110 +Node: Naming Standard Input128768 +Node: Environment Variables129862 +Node: AWKPATH Variable130420 +Ref: AWKPATH Variable-Footnote-1133178 +Node: AWKLIBPATH Variable133438 +Node: Other Environment Variables134156 +Node: Exit Status137119 +Node: Include Files137794 +Node: Loading Shared Libraries141363 +Node: Obsolete142727 +Node: Undocumented143424 +Node: Regexp143666 +Node: Regexp Usage145055 +Node: Escape Sequences147081 +Node: Regexp Operators152750 +Ref: Regexp Operators-Footnote-1160130 +Ref: Regexp Operators-Footnote-2160277 +Node: Bracket Expressions160375 +Ref: table-char-classes162265 +Node: GNU Regexp Operators164788 +Node: Case-sensitivity168511 +Ref: Case-sensitivity-Footnote-1171479 +Ref: Case-sensitivity-Footnote-2171714 +Node: Leftmost Longest171822 +Node: Computed Regexps173023 +Node: Reading Files176360 +Node: Records178362 +Ref: Records-Footnote-1187251 +Node: Fields187288 +Ref: Fields-Footnote-1190321 +Node: Nonconstant Fields190407 +Node: Changing Fields192609 +Node: Field Separators198568 +Node: Default Field Splitting201270 +Node: Regexp Field Splitting202387 +Node: Single Character Fields205729 +Node: Command Line Field Separator206788 +Node: Full Line Fields210222 +Ref: Full Line Fields-Footnote-1210730 +Node: Field Splitting Summary210776 +Ref: Field Splitting Summary-Footnote-1213875 +Node: Constant Size213976 +Node: Splitting By Content218560 +Ref: Splitting By Content-Footnote-1222286 +Node: Multiple Line222326 +Ref: Multiple Line-Footnote-1228173 +Node: Getline228352 +Node: Plain Getline230568 +Node: Getline/Variable232663 +Node: Getline/File233810 +Node: Getline/Variable/File235151 +Ref: Getline/Variable/File-Footnote-1236750 +Node: Getline/Pipe236837 +Node: Getline/Variable/Pipe239536 +Node: Getline/Coprocess240643 +Node: Getline/Variable/Coprocess241895 +Node: Getline Notes242632 +Node: Getline Summary245419 +Ref: table-getline-variants245827 +Node: Read Timeout246739 +Ref: Read Timeout-Footnote-1250480 +Node: Command line directories250537 +Node: Printing251167 +Node: Print252798 +Node: Print Examples254135 +Node: Output Separators256919 +Node: OFMT258679 +Node: Printf260037 +Node: Basic Printf260943 +Node: Control Letters262482 +Node: Format Modifiers266294 +Node: Printf Examples272303 +Node: Redirection275018 +Node: Special Files281983 +Node: Special FD282516 +Ref: Special FD-Footnote-1286141 +Node: Special Network286215 +Node: Special Caveats287065 +Node: Close Files And Pipes287861 +Ref: Close Files And Pipes-Footnote-1294844 +Ref: Close Files And Pipes-Footnote-2294992 +Node: Expressions295142 +Node: Values296274 +Node: Constants296950 +Node: Scalar Constants297630 +Ref: Scalar Constants-Footnote-1298489 +Node: Nondecimal-numbers298671 +Node: Regexp Constants301671 +Node: Using Constant Regexps302146 +Node: Variables305201 +Node: Using Variables305856 +Node: Assignment Options307580 +Node: Conversion309452 +Ref: table-locale-affects314953 +Ref: Conversion-Footnote-1315577 +Node: All Operators315686 +Node: Arithmetic Ops316316 +Node: Concatenation318821 +Ref: Concatenation-Footnote-1321613 +Node: Assignment Ops321733 +Ref: table-assign-ops326721 +Node: Increment Ops328052 +Node: Truth Values and Conditions331486 +Node: Truth Values332569 +Node: Typing and Comparison333618 +Node: Variable Typing334411 +Ref: Variable Typing-Footnote-1338308 +Node: Comparison Operators338430 +Ref: table-relational-ops338840 +Node: POSIX String Comparison342389 +Ref: POSIX String Comparison-Footnote-1343345 +Node: Boolean Ops343483 +Ref: Boolean Ops-Footnote-1347561 +Node: Conditional Exp347652 +Node: Function Calls349384 +Node: Precedence352978 +Node: Locales356647 +Node: Patterns and Actions357736 +Node: Pattern Overview358790 +Node: Regexp Patterns360459 +Node: Expression Patterns361002 +Node: Ranges364687 +Node: BEGIN/END367653 +Node: Using BEGIN/END368415 +Ref: Using BEGIN/END-Footnote-1371146 +Node: I/O And BEGIN/END371252 +Node: BEGINFILE/ENDFILE373534 +Node: Empty376448 +Node: Using Shell Variables376764 +Node: Action Overview379049 +Node: Statements381406 +Node: If Statement383260 +Node: While Statement384759 +Node: Do Statement386803 +Node: For Statement387959 +Node: Switch Statement391111 +Node: Break Statement393208 +Node: Continue Statement395198 +Node: Next Statement396991 +Node: Nextfile Statement399381 +Node: Exit Statement402024 +Node: Built-in Variables404440 +Node: User-modified405535 +Ref: User-modified-Footnote-1413893 +Node: Auto-set413955 +Ref: Auto-set-Footnote-1427425 +Ref: Auto-set-Footnote-2427630 +Node: ARGC and ARGV427686 +Node: Arrays431537 +Node: Array Basics433042 +Node: Array Intro433868 +Node: Reference to Elements438185 +Node: Assigning Elements440455 +Node: Array Example440946 +Node: Scanning an Array442678 +Node: Controlling Scanning444992 +Ref: Controlling Scanning-Footnote-1450079 +Node: Delete450395 +Ref: Delete-Footnote-1453160 +Node: Numeric Array Subscripts453217 +Node: Uninitialized Subscripts455400 +Node: Multidimensional457027 +Node: Multiscanning460120 +Node: Arrays of Arrays461709 +Node: Functions466349 +Node: Built-in467168 +Node: Calling Built-in468246 +Node: Numeric Functions470234 +Ref: Numeric Functions-Footnote-1474066 +Ref: Numeric Functions-Footnote-2474423 +Ref: Numeric Functions-Footnote-3474471 +Node: String Functions474740 +Ref: String Functions-Footnote-1497660 +Ref: String Functions-Footnote-2497789 +Ref: String Functions-Footnote-3498037 +Node: Gory Details498124 +Ref: table-sub-escapes499803 +Ref: table-sub-posix-92501157 +Ref: table-sub-proposed502508 +Ref: table-posix-sub503862 +Ref: table-gensub-escapes505407 +Ref: Gory Details-Footnote-1506583 +Ref: Gory Details-Footnote-2506634 +Node: I/O Functions506785 +Ref: I/O Functions-Footnote-1513770 +Node: Time Functions513917 +Ref: Time Functions-Footnote-1524850 +Ref: Time Functions-Footnote-2524918 +Ref: Time Functions-Footnote-3525076 +Ref: Time Functions-Footnote-4525187 +Ref: Time Functions-Footnote-5525299 +Ref: Time Functions-Footnote-6525526 +Node: Bitwise Functions525792 +Ref: table-bitwise-ops526354 +Ref: Bitwise Functions-Footnote-1530575 +Node: Type Functions530759 +Node: I18N Functions531910 +Node: User-defined533537 +Node: Definition Syntax534341 +Ref: Definition Syntax-Footnote-1539251 +Node: Function Example539320 +Node: Function Caveats541914 +Node: Calling A Function542335 +Node: Variable Scope543450 +Node: Pass By Value/Reference546413 +Node: Return Statement549921 +Node: Dynamic Typing552902 +Node: Indirect Calls553833 +Node: Library Functions563518 +Ref: Library Functions-Footnote-1567031 +Ref: Library Functions-Footnote-2567174 +Node: Library Names567345 +Ref: Library Names-Footnote-1570816 +Ref: Library Names-Footnote-2571036 +Node: General Functions571122 +Node: Strtonum Function572150 +Node: Assert Function575080 +Node: Round Function578406 +Node: Cliff Random Function579949 +Node: Ordinal Functions580965 +Ref: Ordinal Functions-Footnote-1584035 +Ref: Ordinal Functions-Footnote-2584287 +Node: Join Function584496 +Ref: Join Function-Footnote-1586267 +Node: Getlocaltime Function586467 +Node: Readfile Function590208 +Node: Data File Management592047 +Node: Filetrans Function592679 +Node: Rewind Function596748 +Node: File Checking598135 +Node: Empty Files599229 +Node: Ignoring Assigns601459 +Node: Getopt Function603012 +Ref: Getopt Function-Footnote-1614315 +Node: Passwd Functions614518 +Ref: Passwd Functions-Footnote-1623493 +Node: Group Functions623581 +Node: Walking Arrays631665 +Node: Sample Programs633802 +Node: Running Examples634476 +Node: Clones635204 +Node: Cut Program636428 +Node: Egrep Program646273 +Ref: Egrep Program-Footnote-1654046 +Node: Id Program654156 +Node: Split Program657772 +Ref: Split Program-Footnote-1661291 +Node: Tee Program661419 +Node: Uniq Program664222 +Node: Wc Program671651 +Ref: Wc Program-Footnote-1675917 +Ref: Wc Program-Footnote-2676117 +Node: Miscellaneous Programs676209 +Node: Dupword Program677397 +Node: Alarm Program679428 +Node: Translate Program684181 +Ref: Translate Program-Footnote-1688568 +Ref: Translate Program-Footnote-2688816 +Node: Labels Program688950 +Ref: Labels Program-Footnote-1692321 +Node: Word Sorting692405 +Node: History Sorting696289 +Node: Extract Program698128 +Ref: Extract Program-Footnote-1705631 +Node: Simple Sed705759 +Node: Igawk Program708821 +Ref: Igawk Program-Footnote-1723978 +Ref: Igawk Program-Footnote-2724179 +Node: Anagram Program724317 +Node: Signature Program727385 +Node: Advanced Features728485 +Node: Nondecimal Data730371 +Node: Array Sorting731954 +Node: Controlling Array Traversal732651 +Node: Array Sorting Functions740935 +Ref: Array Sorting Functions-Footnote-1744804 +Node: Two-way I/O744998 +Ref: Two-way I/O-Footnote-1750430 +Node: TCP/IP Networking750500 +Node: Profiling753344 +Node: Internationalization760841 +Node: I18N and L10N762266 +Node: Explaining gettext762952 +Ref: Explaining gettext-Footnote-1768020 +Ref: Explaining gettext-Footnote-2768204 +Node: Programmer i18n768369 +Node: Translator i18n772571 +Node: String Extraction773364 +Ref: String Extraction-Footnote-1774325 +Node: Printf Ordering774411 +Ref: Printf Ordering-Footnote-1777195 +Node: I18N Portability777259 +Ref: I18N Portability-Footnote-1779708 +Node: I18N Example779771 +Ref: I18N Example-Footnote-1782409 +Node: Gawk I18N782481 +Node: Debugger783102 +Node: Debugging784073 +Node: Debugging Concepts784506 +Node: Debugging Terms786362 +Node: Awk Debugging788959 +Node: Sample Debugging Session789851 +Node: Debugger Invocation790371 +Node: Finding The Bug791703 +Node: List of Debugger Commands798191 +Node: Breakpoint Control799525 +Node: Debugger Execution Control803189 +Node: Viewing And Changing Data806549 +Node: Execution Stack809905 +Node: Debugger Info811372 +Node: Miscellaneous Debugger Commands815354 +Node: Readline Support820530 +Node: Limitations821361 +Node: Arbitrary Precision Arithmetic823613 +Ref: Arbitrary Precision Arithmetic-Footnote-1825262 +Node: General Arithmetic825410 +Node: Floating Point Issues827130 +Node: String Conversion Precision828011 +Ref: String Conversion Precision-Footnote-1829716 +Node: Unexpected Results829825 +Node: POSIX Floating Point Problems831978 +Ref: POSIX Floating Point Problems-Footnote-1835803 +Node: Integer Programming835841 +Node: Floating-point Programming837580 +Ref: Floating-point Programming-Footnote-1843911 +Ref: Floating-point Programming-Footnote-2844181 +Node: Floating-point Representation844445 +Node: Floating-point Context845610 +Ref: table-ieee-formats846449 +Node: Rounding Mode847833 +Ref: table-rounding-modes848312 +Ref: Rounding Mode-Footnote-1851327 +Node: Gawk and MPFR851506 +Node: Arbitrary Precision Floats852761 +Ref: Arbitrary Precision Floats-Footnote-1855204 +Node: Setting Precision855520 +Ref: table-predefined-precision-strings856206 +Node: Setting Rounding Mode858351 +Ref: table-gawk-rounding-modes858755 +Node: Floating-point Constants859942 +Node: Changing Precision861371 +Ref: Changing Precision-Footnote-1862768 +Node: Exact Arithmetic862942 +Node: Arbitrary Precision Integers866080 +Ref: Arbitrary Precision Integers-Footnote-1869098 +Node: Dynamic Extensions869245 +Node: Extension Intro870703 +Node: Plugin License871968 +Node: Extension Mechanism Outline872653 +Ref: load-extension873070 +Ref: load-new-function874548 +Ref: call-new-function875543 +Node: Extension API Description877558 +Node: Extension API Functions Introduction878771 +Node: General Data Types883637 +Ref: General Data Types-Footnote-1889242 +Node: Requesting Values889541 +Ref: table-value-types-returned890272 +Node: Constructor Functions891226 +Node: Registration Functions894246 +Node: Extension Functions894931 +Node: Exit Callback Functions897156 +Node: Extension Version String898405 +Node: Input Parsers899055 +Node: Output Wrappers908812 +Node: Two-way processors913322 +Node: Printing Messages915530 +Ref: Printing Messages-Footnote-1916607 +Node: Updating `ERRNO'916759 +Node: Accessing Parameters917498 +Node: Symbol Table Access918728 +Node: Symbol table by name919240 +Node: Symbol table by cookie920987 +Ref: Symbol table by cookie-Footnote-1925117 +Node: Cached values925180 +Ref: Cached values-Footnote-1928629 +Node: Array Manipulation928720 +Ref: Array Manipulation-Footnote-1929818 +Node: Array Data Types929857 +Ref: Array Data Types-Footnote-1932560 +Node: Array Functions932652 +Node: Flattening Arrays936418 +Node: Creating Arrays943270 +Node: Extension API Variables947995 +Node: Extension Versioning948631 +Node: Extension API Informational Variables950532 +Node: Extension API Boilerplate951618 +Node: Finding Extensions955422 +Node: Extension Example955982 +Node: Internal File Description956712 +Node: Internal File Ops960803 +Ref: Internal File Ops-Footnote-1972311 +Node: Using Internal File Ops972451 +Ref: Using Internal File Ops-Footnote-1974804 +Node: Extension Samples975070 +Node: Extension Sample File Functions976594 +Node: Extension Sample Fnmatch985079 +Node: Extension Sample Fork986805 +Node: Extension Sample Inplace988023 +Node: Extension Sample Ord989801 +Node: Extension Sample Readdir990637 +Node: Extension Sample Revout992169 +Node: Extension Sample Rev2way992762 +Node: Extension Sample Read write array993452 +Node: Extension Sample Readfile995335 +Node: Extension Sample API Tests996153 +Node: Extension Sample Time996678 +Node: gawkextlib998042 +Node: Language History1000823 +Node: V7/SVR3.11002345 +Node: SVR41004665 +Node: POSIX1006107 +Node: BTL1007493 +Node: POSIX/GNU1008227 +Node: Common Extensions1013828 +Node: Ranges and Locales1015134 +Ref: Ranges and Locales-Footnote-11019752 +Ref: Ranges and Locales-Footnote-21019779 +Ref: Ranges and Locales-Footnote-31020039 +Node: Contributors1020260 +Node: Installation1025335 +Node: Gawk Distribution1026229 +Node: Getting1026713 +Node: Extracting1027539 +Node: Distribution contents1029231 +Node: Unix Installation1034936 +Node: Quick Installation1035553 +Node: Additional Configuration Options1037997 +Node: Configuration Philosophy1039733 +Node: Non-Unix Installation1042087 +Node: PC Installation1042545 +Node: PC Binary Installation1043844 +Node: PC Compiling1045692 +Node: PC Testing1048636 +Node: PC Using1049812 +Node: Cygwin1053997 +Node: MSYS1054997 +Node: VMS Installation1055511 +Node: VMS Compilation1056275 +Ref: VMS Compilation-Footnote-11057890 +Node: VMS Dynamic Extensions1057948 +Node: VMS Installation Details1059321 +Node: VMS Running1061155 +Node: VMS GNV1063989 +Node: VMS Old Gawk1064698 +Node: Bugs1065168 +Node: Other Versions1069088 +Node: Notes1075172 +Node: Compatibility Mode1075972 +Node: Additions1076755 +Node: Accessing The Source1077682 +Node: Adding Code1079122 +Node: New Ports1085167 +Node: Derived Files1089302 +Ref: Derived Files-Footnote-11094623 +Ref: Derived Files-Footnote-21094657 +Ref: Derived Files-Footnote-31095257 +Node: Future Extensions1095355 +Node: Implementation Limitations1095938 +Node: Extension Design1097190 +Node: Old Extension Problems1098344 +Ref: Old Extension Problems-Footnote-11099852 +Node: Extension New Mechanism Goals1099909 +Ref: Extension New Mechanism Goals-Footnote-11103274 +Node: Extension Other Design Decisions1103460 +Node: Extension Future Growth1105566 +Node: Old Extension Mechanism1106402 +Node: Basic Concepts1108142 +Node: Basic High Level1108823 +Ref: figure-general-flow1109094 +Ref: figure-process-flow1109693 +Ref: Basic High Level-Footnote-11112922 +Node: Basic Data Typing1113107 +Node: Glossary1116462 +Node: Copying1141924 +Node: GNU Free Documentation License1179481 +Node: Index1204618 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 90fa06bd..663783f3 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -824,9 +824,12 @@ particular records in a file and perform operations upon them. * VMS Installation:: Installing @command{gawk} on VMS. * VMS Compilation:: How to compile @command{gawk} under VMS. +* VMS Dynamic Extensions:: Compiling @command{gawk} dynamic + extensions on VMS. * VMS Installation Details:: How to install @command{gawk} under VMS. * VMS Running:: How to run @command{gawk} under VMS. +* VMS GNV:: The VMS GNV Project. * VMS Old Gawk:: An old version comes with some VMS systems. * Bugs:: Reporting Problems and Bugs. @@ -15057,7 +15060,7 @@ on the command line (@pxref{Options}). @section Multidimensional Arrays @menu -* Multiscanning:: Scanning multidimensional arrays. +* Multiscanning:: Scanning multidimensional arrays. @end menu @cindex subscripts in arrays, multidimensional @@ -33595,6 +33598,9 @@ Tandem (non-POSIX) @item Prestandard VAX C compiler for VAX/VMS +@item +GCC for VAX and Alpha has not been tested for a while. + @end itemize @end itemize @@ -34879,8 +34885,11 @@ The older designation ``VMS'' is used throughout to refer to OpenVMS. @menu * VMS Compilation:: How to compile @command{gawk} under VMS. +* VMS Dynamic Extensions:: Compiling @command{gawk} dynamic extensions on + VMS. * VMS Installation Details:: How to install @command{gawk} under VMS. * VMS Running:: How to run @command{gawk} under VMS. +* VMS GNV:: The VMS GNV Project. * VMS Old Gawk:: An old version comes with some VMS systems. @end menu @@ -34888,41 +34897,117 @@ The older designation ``VMS'' is used throughout to refer to OpenVMS. @appendixsubsubsec Compiling @command{gawk} on VMS @cindex compiling @command{gawk} for VMS -To compile @command{gawk} under VMS, there is a @code{DCL} command procedure that -issues all the necessary @code{CC} and @code{LINK} commands. There is -also a @file{Makefile} for use with the @code{MMS} utility. From the source -directory, use either: +To compile @command{gawk} under VMS, there is a @code{DCL} command procedure +that issues all the necessary @code{CC} and @code{LINK} commands. There is +also a @file{Makefile} for use with the @code{MMS} and @code{MMK} utilities. +From the source directory, use either: + +@example +$ @kbd{@@[.vms]vmsbuild.com} +@end example + +@noindent +or: @example -$ @kbd{@@[.VMS]VMSBUILD.COM} +$ @kbd{MMS/DESCRIPTION=[.vms]descrip.mms gawk} @end example @noindent or: @example -$ @kbd{MMS/DESCRIPTION=[.VMS]DESCRIP.MMS GAWK} +$ @kbd{MMK/DESCRIPTION=[.vms]descrip.mms gawk} @end example +@code{MMK} is an open source, free, near-clone of @code{MMS} and +can better handle @code{ODS-5} volumes with upper- and lowercase filenames. +@code{MMK} is available from @uref{https://github.com/endlesssoftware/mmk}. + +With @code{ODS-5} volumes and extended parsing enabled, the case of the target +parameter may need to be exact. + Older versions of @command{gawk} could be built with VAX C or GNU C on VAX/VMS, as well as with DEC C, but that is no longer supported. DEC C (also briefly known as ``Compaq C'' and now known as ``HP C,'' but referred to here as ``DEC C'') is required. Both -@code{VMSBUILD.COM} and @code{DESCRIP.MMS} contain some obsolete support +@code{vmsbuild.com} and @code{descrip.mms} contain some obsolete support for the older compilers but are set up to use DEC C by default. -@command{gawk} has been tested under Alpha/VMS 7.3-1 using Compaq C V6.4, -and on Alpha/VMS 7.3, Alpha/VMS 7.3-2, and IA64/VMS 8.3.@footnote{The IA64 -architecture is also known as ``Itanium.''} +@command{gawk} has been tested under VAX/VMS 7.3 and Alpha/VMS 7.3-1 +using Compaq C V6.4, and Alpha/VMS 7.3, Alpha/VMS 7.3-2, and IA64/VMS 8.3. +The most recent builds used HP C V7.3 on Alpha VMS 8.3 and both +Alpha and IA64 VMS 8.4 used HP C 7.3.@footnote{The IA64 architecture +is also known as ``Itanium.''} + +Work is currently being done for a procedure to build @command{gawk} and create +a PCSI kit for compatible with the GNV product. + +@node VMS Dynamic Extensions +@appendixsubsubsec Compiling @command{gawk} Dynamic Extensions on VMS + +The extensions that have been ported to VMS can be built using one of +the following commands. + +@example +$ @kbd{MMS/DESCRIPTION=[.vms]descrip.mms extensions} +@end example + +@noindent +or: + +@example +$ @kbd{MMK/DESCRIPTION=[.vms]descrip.mms extensions} +@end example + +@command{gawk} uses @code{AWKLIBPATH} as either an environment variable +or a logical name to find the dynamic extensions. + +Dynamic extensions need to be compiled with the same compiler options for +floating point, pointer size, and symbol name handling as were used +to compile @command{gawk} itself. +Alpha and Itanium should use IEEE floating point. The pointer size is 32 bits, +and the symbol name handling should be exact case with CRC shortening for +symbols longer than 32 bits. + +For Alpha and Itanium: + +@example +/name=(as_is,short) +/float=ieee/ieee_mode=denorm_results +@end example + +For VAX: + +@example +/name=(as_is,short) +@end example + +Compile time macros need to be defined before the first VMS-supplied +header file is included. + +@example +#if (__CRTL_VER >= 70200000) && !defined (__VAX) +#define _LARGEFILE 1 +#endif + +#ifndef __VAX +#ifdef __CRTL_VER +#if __CRTL_VER >= 80200000 +#define _USE_STD_STAT 1 +#endif +#endif +#endif +@end example @node VMS Installation Details @appendixsubsubsec Installing @command{gawk} on VMS -To install @command{gawk}, all you need is a ``foreign'' command, which is -a @code{DCL} symbol whose value begins with a dollar sign. For example: +To use @command{gawk}, all you need is a ``foreign'' command, which is a +@code{DCL} symbol whose value begins with a dollar sign. For example: @example -$ @kbd{GAWK :== $disk1:[gnubin]GAWK} +$ @kbd{GAWK :== $disk1:[gnubin]gawk} @end example @noindent @@ -34934,10 +35019,15 @@ Alternatively, the symbol may be placed in the system-wide @file{sylogin.com} procedure, which allows all users to run @command{gawk}. +If your @command{gawk} was installed by a PCSI kit into the +@file{GNV$GNU:} directory tree, the program will be known as +@file{GNV$GNU:[bin]gnv$gawk.exe} and the help file will be +@file{GNV$GNU:[vms_help]gawk.hlp}. + Optionally, the help entry can be loaded into a VMS help library: @example -$ @kbd{LIBRARY/HELP SYS$HELP:HELPLIB [.VMS]GAWK.HLP} +$ @kbd{LIBRARY/HELP sys$help:helplib [.vms]gawk.hlp} @end example @noindent @@ -34991,6 +35081,39 @@ flag is required to force Unix-style parsing rather than @code{DCL} parsing. If other dash-type options (or multiple parameters such as data files to process) are present, there is no ambiguity and @option{--} can be omitted. +@cindex exit status, of VMS +The @code{exit} value is a Unix-style value and is encoded to a VMS exit +status value when the program exits. + +The VMS severity bits will be set based on the @code{exit} value. +A failure is indicated by 1 and VMS sets the @code{ERROR} status. +A fatal error is indicated by 2 and VMS will set the @code{FATAL} status. +All other values will have the @code{SUCCESS} status. The exit value is +encoded to comply with VMS coding standards and will have the +@code{C_FACILITY_NO} of @code{0x350000} with the constant @code{0xA000} +added to the number shifted over by 3 bits to make room for the severity codes. + +To extract the actual @command{gawk} exit code from the VMS status use: + +@example +unix_status = (vms_status .and. &x7f8) / 8 +@end example + +@noindent +A C program that uses @code{exec()} to call @command{gawk} will get the original +Unix-style exit value. + +Older versions of @command{gawk} treated a Unix exit code 0 as 1, a failure +as 2, a fatal error as 4, and passed all the other numbers through. +This violated the VMS exit status coding requirements. + +@cindex floating-point, VAX/VMS +VAX/VMS floating point uses unbiased rounding. @xref{Round Function}. + +VMS reports time values in GMT unless one of the @code{SYS$TIMEZONE_RULE} +or @code{TZ} logical names is set. Older versions of VMS, such as VAX/VMS +7.3 do not set these logical names. + @c @cindex directory search @c @cindex path, search @cindex search paths @@ -35002,6 +35125,20 @@ of @env{AWKPATH} is a comma-separated list of directory specifications. When defining it, the value should be quoted so that it retains a single translation and not a multitranslation @code{RMS} searchlist. +@node VMS GNV +@appendixsubsubsec The VMS GNV Project + +The VMS GNV package provides a build environment similar to POSIX with ports +of a collection of open source tools. The @command{gawk} found in the GNV +base kit is an older port. Currently the GNV project is being reorganized +to supply individual PCSI packages for each component. +See @uref{https://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/}. + +The normal build procedure for @command{gawk} produces a program that +is suitable for use with GNV. At this time work is being done to create +the procedures for building a PCSI kit to replace the older @command{gawk} +port. + @ignore @c The VMS POSIX product, also known as POSIX for OpenVMS, is long defunct @c and building gawk for it has not been tested in many years, but these diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 8fe83dae..94f77e9e 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -819,9 +819,12 @@ particular records in a file and perform operations upon them. * VMS Installation:: Installing @command{gawk} on VMS. * VMS Compilation:: How to compile @command{gawk} under VMS. +* VMS Dynamic Extensions:: Compiling @command{gawk} dynamic + extensions on VMS. * VMS Installation Details:: How to install @command{gawk} under VMS. * VMS Running:: How to run @command{gawk} under VMS. +* VMS GNV:: The VMS GNV Project. * VMS Old Gawk:: An old version comes with some VMS systems. * Bugs:: Reporting Problems and Bugs. @@ -14396,7 +14399,7 @@ on the command line (@pxref{Options}). @section Multidimensional Arrays @menu -* Multiscanning:: Scanning multidimensional arrays. +* Multiscanning:: Scanning multidimensional arrays. @end menu @cindex subscripts in arrays, multidimensional @@ -32744,6 +32747,9 @@ Tandem (non-POSIX) @item Prestandard VAX C compiler for VAX/VMS +@item +GCC for VAX and Alpha has not been tested for a while. + @end itemize @end itemize @@ -34028,8 +34034,11 @@ The older designation ``VMS'' is used throughout to refer to OpenVMS. @menu * VMS Compilation:: How to compile @command{gawk} under VMS. +* VMS Dynamic Extensions:: Compiling @command{gawk} dynamic extensions on + VMS. * VMS Installation Details:: How to install @command{gawk} under VMS. * VMS Running:: How to run @command{gawk} under VMS. +* VMS GNV:: The VMS GNV Project. * VMS Old Gawk:: An old version comes with some VMS systems. @end menu @@ -34037,41 +34046,117 @@ The older designation ``VMS'' is used throughout to refer to OpenVMS. @appendixsubsubsec Compiling @command{gawk} on VMS @cindex compiling @command{gawk} for VMS -To compile @command{gawk} under VMS, there is a @code{DCL} command procedure that -issues all the necessary @code{CC} and @code{LINK} commands. There is -also a @file{Makefile} for use with the @code{MMS} utility. From the source -directory, use either: +To compile @command{gawk} under VMS, there is a @code{DCL} command procedure +that issues all the necessary @code{CC} and @code{LINK} commands. There is +also a @file{Makefile} for use with the @code{MMS} and @code{MMK} utilities. +From the source directory, use either: + +@example +$ @kbd{@@[.vms]vmsbuild.com} +@end example + +@noindent +or: @example -$ @kbd{@@[.VMS]VMSBUILD.COM} +$ @kbd{MMS/DESCRIPTION=[.vms]descrip.mms gawk} @end example @noindent or: @example -$ @kbd{MMS/DESCRIPTION=[.VMS]DESCRIP.MMS GAWK} +$ @kbd{MMK/DESCRIPTION=[.vms]descrip.mms gawk} @end example +@code{MMK} is an open source, free, near-clone of @code{MMS} and +can better handle @code{ODS-5} volumes with upper- and lowercase filenames. +@code{MMK} is available from @uref{https://github.com/endlesssoftware/mmk}. + +With @code{ODS-5} volumes and extended parsing enabled, the case of the target +parameter may need to be exact. + Older versions of @command{gawk} could be built with VAX C or GNU C on VAX/VMS, as well as with DEC C, but that is no longer supported. DEC C (also briefly known as ``Compaq C'' and now known as ``HP C,'' but referred to here as ``DEC C'') is required. Both -@code{VMSBUILD.COM} and @code{DESCRIP.MMS} contain some obsolete support +@code{vmsbuild.com} and @code{descrip.mms} contain some obsolete support for the older compilers but are set up to use DEC C by default. -@command{gawk} has been tested under Alpha/VMS 7.3-1 using Compaq C V6.4, -and on Alpha/VMS 7.3, Alpha/VMS 7.3-2, and IA64/VMS 8.3.@footnote{The IA64 -architecture is also known as ``Itanium.''} +@command{gawk} has been tested under VAX/VMS 7.3 and Alpha/VMS 7.3-1 +using Compaq C V6.4, and Alpha/VMS 7.3, Alpha/VMS 7.3-2, and IA64/VMS 8.3. +The most recent builds used HP C V7.3 on Alpha VMS 8.3 and both +Alpha and IA64 VMS 8.4 used HP C 7.3.@footnote{The IA64 architecture +is also known as ``Itanium.''} + +Work is currently being done for a procedure to build @command{gawk} and create +a PCSI kit for compatible with the GNV product. + +@node VMS Dynamic Extensions +@appendixsubsubsec Compiling @command{gawk} Dynamic Extensions on VMS + +The extensions that have been ported to VMS can be built using one of +the following commands. + +@example +$ @kbd{MMS/DESCRIPTION=[.vms]descrip.mms extensions} +@end example + +@noindent +or: + +@example +$ @kbd{MMK/DESCRIPTION=[.vms]descrip.mms extensions} +@end example + +@command{gawk} uses @code{AWKLIBPATH} as either an environment variable +or a logical name to find the dynamic extensions. + +Dynamic extensions need to be compiled with the same compiler options for +floating point, pointer size, and symbol name handling as were used +to compile @command{gawk} itself. +Alpha and Itanium should use IEEE floating point. The pointer size is 32 bits, +and the symbol name handling should be exact case with CRC shortening for +symbols longer than 32 bits. + +For Alpha and Itanium: + +@example +/name=(as_is,short) +/float=ieee/ieee_mode=denorm_results +@end example + +For VAX: + +@example +/name=(as_is,short) +@end example + +Compile time macros need to be defined before the first VMS-supplied +header file is included. + +@example +#if (__CRTL_VER >= 70200000) && !defined (__VAX) +#define _LARGEFILE 1 +#endif + +#ifndef __VAX +#ifdef __CRTL_VER +#if __CRTL_VER >= 80200000 +#define _USE_STD_STAT 1 +#endif +#endif +#endif +@end example @node VMS Installation Details @appendixsubsubsec Installing @command{gawk} on VMS -To install @command{gawk}, all you need is a ``foreign'' command, which is -a @code{DCL} symbol whose value begins with a dollar sign. For example: +To use @command{gawk}, all you need is a ``foreign'' command, which is a +@code{DCL} symbol whose value begins with a dollar sign. For example: @example -$ @kbd{GAWK :== $disk1:[gnubin]GAWK} +$ @kbd{GAWK :== $disk1:[gnubin]gawk} @end example @noindent @@ -34083,10 +34168,15 @@ Alternatively, the symbol may be placed in the system-wide @file{sylogin.com} procedure, which allows all users to run @command{gawk}. +If your @command{gawk} was installed by a PCSI kit into the +@file{GNV$GNU:} directory tree, the program will be known as +@file{GNV$GNU:[bin]gnv$gawk.exe} and the help file will be +@file{GNV$GNU:[vms_help]gawk.hlp}. + Optionally, the help entry can be loaded into a VMS help library: @example -$ @kbd{LIBRARY/HELP SYS$HELP:HELPLIB [.VMS]GAWK.HLP} +$ @kbd{LIBRARY/HELP sys$help:helplib [.vms]gawk.hlp} @end example @noindent @@ -34140,6 +34230,39 @@ flag is required to force Unix-style parsing rather than @code{DCL} parsing. If other dash-type options (or multiple parameters such as data files to process) are present, there is no ambiguity and @option{--} can be omitted. +@cindex exit status, of VMS +The @code{exit} value is a Unix-style value and is encoded to a VMS exit +status value when the program exits. + +The VMS severity bits will be set based on the @code{exit} value. +A failure is indicated by 1 and VMS sets the @code{ERROR} status. +A fatal error is indicated by 2 and VMS will set the @code{FATAL} status. +All other values will have the @code{SUCCESS} status. The exit value is +encoded to comply with VMS coding standards and will have the +@code{C_FACILITY_NO} of @code{0x350000} with the constant @code{0xA000} +added to the number shifted over by 3 bits to make room for the severity codes. + +To extract the actual @command{gawk} exit code from the VMS status use: + +@example +unix_status = (vms_status .and. &x7f8) / 8 +@end example + +@noindent +A C program that uses @code{exec()} to call @command{gawk} will get the original +Unix-style exit value. + +Older versions of @command{gawk} treated a Unix exit code 0 as 1, a failure +as 2, a fatal error as 4, and passed all the other numbers through. +This violated the VMS exit status coding requirements. + +@cindex floating-point, VAX/VMS +VAX/VMS floating point uses unbiased rounding. @xref{Round Function}. + +VMS reports time values in GMT unless one of the @code{SYS$TIMEZONE_RULE} +or @code{TZ} logical names is set. Older versions of VMS, such as VAX/VMS +7.3 do not set these logical names. + @c @cindex directory search @c @cindex path, search @cindex search paths @@ -34151,6 +34274,20 @@ of @env{AWKPATH} is a comma-separated list of directory specifications. When defining it, the value should be quoted so that it retains a single translation and not a multitranslation @code{RMS} searchlist. +@node VMS GNV +@appendixsubsubsec The VMS GNV Project + +The VMS GNV package provides a build environment similar to POSIX with ports +of a collection of open source tools. The @command{gawk} found in the GNV +base kit is an older port. Currently the GNV project is being reorganized +to supply individual PCSI packages for each component. +See @uref{https://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/}. + +The normal build procedure for @command{gawk} produces a program that +is suitable for use with GNV. At this time work is being done to create +the procedures for building a PCSI kit to replace the older @command{gawk} +port. + @ignore @c The VMS POSIX product, also known as POSIX for OpenVMS, is long defunct @c and building gawk for it has not been tested in many years, but these diff --git a/extension/ChangeLog b/extension/ChangeLog index 328d58ba..965e0c66 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,19 @@ +2013-12-29 John E. Malmberg <wb8tyw@qsl.net> + + * filefuncs.c: Fix compile on VMS. + * time.c: Fix compile on VMS. + +2013-12-29 Arnold D. Robbins <arnold@skeeve.com> + + * gawkfts.c: Wrap include of <sys/param.h> in HAVE_SYS_PARAM_H, + as I should have done to start with. For VMS. + +2013-12-29 John E. Malmberg <wb8tyw@qsl.net> + + * gawkdirfd.h: Adjust include for VMS. + * filefuncs.c: Make it compile on VMS. + * fnmatch.c: Make it compile on VMS. + 2013-12-21 Mike Frysinger <vapier@gentoo.org> * configure.ac: Remove MirBSD and OS/390 hack to create diff --git a/extension/filefuncs.c b/extension/filefuncs.c index 61cadfec..3eb2a6b5 100644 --- a/extension/filefuncs.c +++ b/extension/filefuncs.c @@ -36,6 +36,34 @@ #define _BSD_SOURCE +#ifdef __VMS +#if (__CRTL_VER >= 70200000) && !defined (__VAX) +#define _LARGEFILE 1 +#endif + +#ifndef __VAX +#ifdef __CRTL_VER +#if __CRTL_VER >= 80200000 +#define _USE_STD_STAT 1 +#endif +#endif +#endif +#define _POSIX_C_SOURCE 1 +#define _XOPEN_SOURCE 1 +#include <stat.h> +#ifndef S_ISVTX +#define S_ISVTX (0) +#endif +#ifndef major +#define major(s) (s) +#endif +#ifndef minor +#define minor(s) (0) +#endif +#include <unixlib.h> +#endif + + #include <stdio.h> #include <assert.h> #include <errno.h> diff --git a/extension/fnmatch.c b/extension/fnmatch.c index a67bc25f..a85bcc78 100644 --- a/extension/fnmatch.c +++ b/extension/fnmatch.c @@ -45,15 +45,29 @@ #define _(msgid) gettext(msgid) #define N_(msgid) msgid +#ifdef __VMS +#define __iswctype iswctype +#define __btowc btowc +#endif + #define _GNU_SOURCE 1 /* use GNU extensions if they're there */ #ifdef HAVE_FNMATCH_H #include <fnmatch.h> #else +#ifdef __VMS +#include "fnmatch.h" /* version that comes with gawk */ +#else #include "../missing_d/fnmatch.h" /* version that comes with gawk */ #endif +#define HAVE_FNMATCH_H +#endif #ifndef HAVE_FNMATCH +#ifdef __VMS +#include "fnmatch.c" /* ditto */ +#else #include "../missing_d/fnmatch.c" /* ditto */ +#endif #define HAVE_FNMATCH #endif diff --git a/extension/gawkdirfd.h b/extension/gawkdirfd.h index a3a2b6a6..d1edf65f 100644 --- a/extension/gawkdirfd.h +++ b/extension/gawkdirfd.h @@ -35,7 +35,11 @@ * Unlike the main gawk code base, this include is NOT dependant * upon MinGW or EMX. */ +#ifndef __VMS #include "../nonposix.h" +#else +#include "nonposix.h" +#endif #ifndef DIR_TO_FD # define DIR_TO_FD(d) (FAKE_FD_VALUE) diff --git a/extension/gawkfts.c b/extension/gawkfts.c index 81803b88..25a4c108 100644 --- a/extension/gawkfts.c +++ b/extension/gawkfts.c @@ -43,11 +43,11 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; #include <limits.h> /* #include "namespace.h" */ -#ifndef ZOS_USS +#ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #else #include <stdio.h> -#endif /* ZOS_USS */ +#endif #include <sys/stat.h> #include <assert.h> diff --git a/extension/time.c b/extension/time.c index 9fadfe54..b1e9a40a 100644 --- a/extension/time.c +++ b/extension/time.c @@ -39,6 +39,30 @@ #include <sys/types.h> #include <sys/stat.h> +#ifdef __VMS +#define HAVE_NANOSLEEP +#define HAVE_GETTIMEOFDAY +#ifdef gettimeofday +#undef gettimeofday +#endif +#ifdef __ia64__ +/* nanosleep not working on IA64 */ +static int +vms_fake_nanosleep(const struct timespec *rqdly, struct timespec *rmdly) +{ + int result; + + result = sleep(rqdly->tv_sec); + if (result == 0) { + return 0; + } else { + return -1; + } +} +#define nanosleep(x,y) vms_fake_nanosleep(x, y) +#endif +#endif + #include "gawkapi.h" #include "gettext.h" @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991-2013 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991-2014 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -121,6 +121,11 @@ #endif #if defined(VMS) +#include <ssdef.h> +#ifndef SS$_EXBYTLM +#define SS$_EXBYTLM 0x2a14 /* VMS 8.4 seen */ +#endif +#include <rmsdef.h> #define closemaybesocket(fd) close(fd) #endif @@ -462,6 +467,11 @@ nextfile(IOBUF **curfile, bool skipping) /* IOBUF management: */ errno = 0; fd = devopen(fname, binmode("r")); + if (fd == INVALID_HANDLE && errno == EMFILE) { + close_one(); + close_one(); + fd = devopen(fname, binmode("r")); + } errcode = errno; if (! do_traditional) update_ERRNO_int(errno); @@ -948,13 +958,13 @@ redirect(NODE *redir_exp, int redirtype, int *errflg) if (errno == EMFILE || errno == ENFILE) close_one(); #ifdef VMS - /* Alpha/VMS V7.1's C RTL is returning this instead + /* Alpha/VMS V7.1+ C RTL is returning these instead of EMFILE (haven't tried other post-V6.2 systems) */ -#define SS$_EXQUOTA 0x001C -#define SS$_EXBYTLM 0x2a14 /* VMS 8.4 seen */ - else if (errno == EIO && + else if ((errno == EIO || errno == EVMSERR) && (vaxc$errno == SS$_EXQUOTA || - vaxc$errno == SS$_EXBYTLM)) + vaxc$errno == SS$_EXBYTLM || + vaxc$errno == RMS$_ACC || + vaxc$errno == RMS$_SYN)) close_one(); #endif else { @@ -194,7 +194,6 @@ static const struct option optab[] = { { NULL, 0, NULL, '\0' } }; - /* main --- process args, parse program, run it, clean up */ int diff --git a/old-extension/spec_array.c b/old-extension/spec_array.c index 248783bb..34d15fc5 100644 --- a/old-extension/spec_array.c +++ b/old-extension/spec_array.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 2012 the Free Software Foundation, Inc. + * Copyright (C) 2012, 2014 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. diff --git a/test/ChangeLog b/test/ChangeLog index 5b911fa0..29dff6c3 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -4,6 +4,11 @@ seems that plain en_US doesn't exist anymore. Thanks to Richard Palo. +2013-12-29 John E. Malmberg <wb8tyw@qsl.net> + + * fts.awk: Adjust for VMS. + * rwarray.awk: Adjust for VMS. + 2013-12-10 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am: Remove instances of "" that were incorrect. diff --git a/test/fts.awk b/test/fts.awk index a1b49cbd..70af560f 100644 --- a/test/fts.awk +++ b/test/fts.awk @@ -3,8 +3,19 @@ BEGIN { Level = 0 - system("rm -fr d1 d2") - system("mkdir d1 d2 ; touch d1/f1 d1/f2 d2/f1 d2/f2") + os = "" + if (ENVIRON["AWKLIBPATH"] == "sys$disk:[-]") { + os = "VMS" + system("create/dir/prot=o:rwed [.d1]") + system("create/dir/prot=o:rwed [.d2]") + system("copy fts.awk [.d1]f1") + system("copy fts.awk [.d1]f2") + system("copy fts.awk [.d2]f1") + system("copy fts.awk [.d2]f2") + } else { + system("rm -fr d1 d2") + system("mkdir d1 d2 ; touch d1/f1 d1/f2 d2/f1 d2/f2") + } pathlist[1] = "d1" pathlist[2] = "d2" flags = FTS_PHYSICAL @@ -19,7 +30,14 @@ BEGIN { traverse(data2) close(output) - system("rm -fr d1 d2") + if (os == "VMS") { + system("delete [.d1]*.*;*") + system("delete [.d2]*.*;*") + system("delete d1.dir;*") + system("delete d2.dir;*") + } else { + system("rm -fr d1 d2") + } } function indent( i) @@ -96,6 +114,13 @@ function process(pathname, data_array, for (i in stat_data) data_array[pathname]["."]["stat"][i] = stat_data[i] + os = "" + if (ENVIRON["AWKLIBPATH"] == "sys$disk:[-]") { + os = "VMS" + # Command in next section not valid on VMS. + return + } + command = ("ls -f " pathname) while ((command | getline direntry) > 0) { if (direntry == "." || direntry == "..") diff --git a/test/rwarray.awk b/test/rwarray.awk index 5d1b7e9d..0cb214ee 100644 --- a/test/rwarray.awk +++ b/test/rwarray.awk @@ -21,13 +21,20 @@ BEGIN { printf("dict[%s] = %s\n", dictindices[i], dict[dictindices[i]]) > "new.out" close("new.out"); - ret = system("cmp orig.out new.out") - - if (ret == 0) - print "old and new are equal - GOOD" - else - print "old and new are not equal - BAD" - - if (ret == 0 && !("KEEPIT" in ENVIRON)) - system("rm -f orig.bin orig.out new.out") + os = "" + if (ENVIRON["AWKLIBPATH"] == "sys$disk:[-]") { + os = "VMS" + # return status from system() on VMS can not be used here + } + if (os != "VMS") { + ret = system("cmp orig.out new.out") + + if (ret == 0) + print "old and new are equal - GOOD" + else + print "old and new are not equal - BAD" + + if (ret == 0 && !("KEEPIT" in ENVIRON)) + system("rm -f orig.bin orig.out new.out") + } } diff --git a/vms/ChangeLog b/vms/ChangeLog index f8344654..0db7efd2 100644 --- a/vms/ChangeLog +++ b/vms/ChangeLog @@ -1,3 +1,105 @@ +2014-01-03 John E. Malmberg <wb8tyw@qsl.net> + + * config_h.com, generate_config_vms_h_gawk.com, + vms_args.c, vms_cli.c, vms_fwrite.c, vms_gawk.c, vms_misc.c, + vms_popen.c: Update copyright to 2014. + * descrip.mms: Improve spotless cleanup. + * vmstest.com: Improve test cleanup. + * backup_gawk_src.com: New file. Create backup savesets for gawk source. + * build_gawk_pcsi_desc.com: New file. Create a pcsi$desc manifest + file for building a gawk package. + * build_gawk_pcsi_text.com: New file. Create a pcsi$text file for + building a gawk package. + * build_gawk_release_notes.com: New file. Create a VMS release notes + file based on the gawk README and COPYING files and the release note + start and build instruction files. + * compare_gawk_source.com: New file. Helper file to compare and + optionally update two gawk source directories. Used to copy + source from an NFS volume to a VMS native volume for backup. + * gawk_alias_setup.com: New file. Used at installation time to + create hard links for for some files instead of copies. + * gawk_build_steps.txt: New file. Document how to build a PCSI kit. + * gawk_release_note_start.txt: New file. Start of release notes. + * gawk_verb.com: New file. Converts the gawk.cld file into a + gawk_verb.cld file for setting up GAWK as a DCL command. + * gnv_gawk_startup.com: New file. Makes sure that the GNV$GNU logical + name need to easily find the gawk image is defined. + * make_pcsi_gawk_kit_name.com: New File. Create the PCSI kit name + based on the GAWK version. + * pcsi_gawk_file_list.txt: New File. Input file for creating the + pcsi$desc manifest file. + * pcsi_product_gawk.com: New file. File to create the PCSI kit. + * remove_old_gawk.com: New file. File to remove obsolete GNV gawk + files replaced by the new PCSI kit. + * stage_gawk_install.com: New file. Stages an install for the + pcsi kit building. + +2013-12-29 John E. Malmberg <wb8tyw@qsl.net> + + * gawk_plugin.opt: New file. Needed to build plugins on IA64 + and ALPHA. + * generate_config_vms_h_gawk.com: Document which version + of VMS the mkstemp issue was seen. + * vms_popen: (pclose): Tolerate invalid file pointer. + * vmstest.com: Add tests for extensions ported to VMS. + +2013-12-23 John E. Malmberg <wb8tyw@qsl.net> + + * gawkmisc.vms: Fix program name calculation on VAX. + * vms_cli.c: Fix case of public symbol. + * vms.hlp: Fix typo, add cautions on rounding and timezones. + * vmstest.com: Dcl symbol tz causing conflict with test. + +2013-12-20 John E. Malmberg <wb8tyw@qsl.net> + + * descrip.mms: Set CC exact symbol names, cleanup repository. + * generate_config_vms_h_gawk.com: Use correct VMS exit codes. + * vmsbuild.com: Set CC exact symbol names. + * vmstest.com: Extract correct Unix status for failed tests. + * vms.h, vms_args.c, vms_cli.c, vms_fwrite.c, vms_gawk.c, + vms_misc.c, vms_popen.c: Correct case of function names. + * vms.hlp: Updated with new information about exit codes. + +2013-12-10 John E. Malmberg <wb8tyw@qsl.net> + + * gawkmisc.vms: Add lots of includes. + (sys_trnlnm): New function. + (gawk_name): Improved. + (os_arg_fixup): Fix up time zone. + +2013-12-08 John E. Malmberg <wb8tyw@qsl.net> + + * descrip.mms: Add IEEE float for non-vax. + Add vms_crtl_init.c. + Remove code to generate version.c + * generate_config_vms_h_gawk.com (__attribute__): Removed + definition from here. + * version_c.com: removed no longer used. + * vmsbuild.com: Add IEEE float for non-vax. + Add vms_crtl_init.c + Remove code to generate version.c + Changes that should have been in the previous commit. + * vms_misc.c (vms_open): VMS CRTL for 8.3 Alpha is setting + errno to ENOENT instead of EISDIR for ".". + +2013-12-05 John E. Malmberg <wb8tyw@qsl.net> + + * New config_h.com to generate config.h + * New gawk_ident.com generates ident line for link option file. + * Add version_c.com to create version.c from version.in. + * Remove fcntl.h covering up real fcntl.h. If an older version + of VMS needs this file, the build procedure should be updated + to generate it from a template. + * descrip.mms: Use command files to generate files based + on same input files as a Linux build. + * gawkmisc.vms (files_are_same): support _USE_STD_STAT for VMS 8.x. + * generate_config_vms_h_gawk.com: Generates a helper file + config_vms.h to cover issues config_h.com can not handle. + * vmsbuild.com: Use command files to generate files based + on the same input files as a Linux build. + * vms_misc.c (vms_open): VMS CRTL setting errno to ENOENT where + it should be set to EMFILE. + 2013-12-06 Arnold D. Robbins <arnold@skeeve.com> * vms-conf.h (__attribute__): Removed definition from here; fixed diff --git a/vms/backup_gawk_src.com b/vms/backup_gawk_src.com new file mode 100644 index 00000000..d1e47fbe --- /dev/null +++ b/vms/backup_gawk_src.com @@ -0,0 +1,113 @@ +$! File: Backup_gawk_src.com +$! +$! Procedure to create backup save sets for installing in a PCSI kit. +$! +$! To comply with most Open Source licenses, the source used for building +$! a kit will be packaged with the distribution kit for the binary. +$! +$! Backup save sets are the only storage format that I can expect a +$! VMS system to be able to extract ODS-5 filenames and directories. +$! +$! The make_pcsi_kit_name.com needs to be run before this procedure to +$! properly name the files that will be created. +$! +$! This file is created from a template file for the purpose of making it +$! easier to port Unix code, particularly open source code to VMS. +$! Therefore permission is freely granted for any use. +$! +$! 13-Jun-2009 J. Malmberg +$! +$!=========================================================================== +$! +$! Save default +$ default_dir = f$environment("DEFAULT") +$! +$ arch_type = f$getsyi("ARCH_NAME") +$ arch_code = f$extract(0, 1, arch_type) +$! +$ if arch_code .nes. "V" +$ then +$ set proc/parse=extended +$ endif +$! +$ ss_abort = 44 +$ status = ss_abort +$! +$ kit_name = f$trnlnm("GNV_PCSI_KITNAME") +$ if kit_name .eqs. "" +$ then +$ write sys$output "@MAKE_PCSI_GAWK_KIT_NAME.COM has not been run." +$ goto all_exit +$ endif +$ producer = f$trnlnm("GNV_PCSI_PRODUCER") +$ if producer .eqs. "" +$ then +$ write sys$output "@MAKE_PCSI_GAWK_KIT_NAME.COM has not been run." +$ goto all_exit +$ endif +$ filename_base = f$trnlnm("GNV_PCSI_FILENAME_BASE") +$ if filename_base .eqs. "" +$ then +$ write sys$output "@MAKE_PCSI_GAWK_KIT_NAME.COM has not been run." +$ goto all_exit +$ endif +$! +$ node_swvers = f$getsyi("NODE_SWVERS") +$ node_swvers_type = f$extract(0, 1, node_swvers) +$ node_swvers_vers = f$extract(1, f$length(node_swvers), node_swvers) +$ swvers_maj = f$element(0, ".", node_swvers_vers) +$ node_swvers_min_update = f$element(1, ".", node_swvers_vers) +$ swvers_min = f$element(0, "-", node_swvers_min_update) +$ swvers_update = f$element(1, "-", node_swvers_min_update) +$! +$ if swvers_update .eqs. "-" then swvers_update = "" +$! +$ vms_vers = f$fao("!2ZB!2ZB!AS", 'swvers_maj', 'swvers_min', swvers_update) +$! +$! +$! +$! If available make an interchange save set +$!------------------------------------------- +$ interchange = "" +$ if arch_code .eqs. "V" +$ then +$ interchange = "/interchange" +$ endif +$ if (swvers_maj .ges. "8") .and. (swvers_min .ges. 4) +$ then +$ interchange = "/interchange/noconvert" +$ endif +$! +$! +$! Put things back on error. +$ on warning then goto all_exit +$! +$ current_default = f$environment("DEFAULT") +$ my_dir = f$parse(current_default,,,"DIRECTORY") - "[" - "<" - ">" - "]" +$! +$ src_root = "src_root:" +$ if f$trnlnm("src_root1") .nes. "" then src_root = "src_root1:" +$ backup'interchange' 'src_root'[gawk...]*.*;0 - + 'filename_base'_original_src.bck/sav +$ status = $status +$! +$! There may be a VMS specific source kit +$!----------------------------------------- +$ vms_root = "vms_root:" +$ if f$trnlnm("vms_root1") .nes. "" then vms_root = "vms_root1:" +$ files_found = 0 +$ define/user sys$error nl: +$ define/user sys$output nl: +$ directory 'vms_root'[...]*.*;*/exc=*.dir +$ if '$severity' .eq. 1 then files_found = 1 +$! +$ if files_found .eq. 1 +$ then +$ backup'interchange' 'vms_root'[gawk...]*.*;0 - + 'filename_base'_vms_src.bck/sav +$ status = $status +$ endif +$! +$all_exit: +$ set def 'default_dir' +$ exit diff --git a/vms/build_gawk_pcsi_desc.com b/vms/build_gawk_pcsi_desc.com new file mode 100644 index 00000000..63d149e6 --- /dev/null +++ b/vms/build_gawk_pcsi_desc.com @@ -0,0 +1,428 @@ +$! File: Build_GAWK_PCSI_DESC.COM +$! +$! Build the *.pcsi$text file in the following sections: +$! Required software dependencies. +$! install/upgrade/postinstall steps. +$! 1. Duplicate filenames need an alias procedure. +$! 2. ODS-5 filenames need an alias procedure. +$! 3. Special alias links for executables (cp. -> gnv$cp.exe) +$! if a lot, then an alias procedure is needed. +$! 4. Rename the files to lowercase. +$! Move Release Notes to destination +$! Source kit option +$! Create directory lines +$! Add file lines for gawk. +$! Add Link alias procedure file (used for gawk) +$! Add [.SYS$STARTUP]gawk_startup file +$! Add Release notes file. +$! +$! The file PCSI_GAWK_FILE_LIST.TXT is read in to get the files other +$! than the release notes file and the source backup file. +$! +$! The PCSI system can really only handle ODS-2 format filenames and +$! assumes that there is only one source directory. It also assumes that +$! all destination files with the same name come from the same source file. +$! Fortunately GAWK does not trip most of these issues, so those steps +$! above are marked N/A. +$! +$! A rename action section is needed to make sure that the files are +$! created in the GNV$GNU: in the correct case, and to create the alias +$! link [usr.bin]gawk. for [usr.bin]gawk.exe. +$! +$! 02-Jan-2014 J. Malmberg - Gawk version +$! +$!=========================================================================== +$! +$ kit_name = f$trnlnm("GNV_PCSI_KITNAME") +$ if kit_name .eqs. "" +$ then +$ write sys$output "@[.vms]MAKE_PCSI_GAWK_KIT_NAME.COM has not been run." +$ goto all_exit +$ endif +$ producer = f$trnlnm("GNV_PCSI_PRODUCER") +$ if producer .eqs. "" +$ then +$ write sys$output "@[.vms]MAKE_PCSI_GAWK_KIT_NAME.COM has not been run." +$ goto all_exit +$ endif +$ filename_base = f$trnlnm("GNV_PCSI_FILENAME_BASE") +$ if filename_base .eqs. "" +$ then +$ write sys$output "@[.vms]MAKE_PCSI_GAWK_KIT_NAME.COM has not been run." +$ goto all_exit +$ endif +$! +$! +$! Parse the kit name into components. +$!--------------------------------------- +$ producer = f$element(0, "-", kit_name) +$ base = f$element(1, "-", kit_name) +$ product = f$element(2, "-", kit_name) +$ mmversion = f$element(3, "-", kit_name) +$ majorver = f$extract(0, 3, mmversion) +$ minorver = f$extract(3, 2, mmversion) +$ updatepatch = f$element(4, "-", kit_name) +$ if updatepatch .eqs. "-" then updatepatch = "" +$! +$! kit type of "D" means a daily build +$ kit_type = f$edit(f$extract(0, 1, majorver), "upcase") +$! +$! +$ product_line = "product ''producer' ''base' ''product'" +$ if updatepatch .eqs. "" +$ then +$ product_name = " ''majorver'.''minorver'" +$ else +$ product_name = " ''majorver'.''minorver'-''updatepatch'" +$ endif +$ product_line = product_line + " ''product_name' full;" +$!write sys$output product_line +$! +$! +$! +$! Create the file as a VMS text file. +$!---------------------------------------- +$ base_file = kit_name +$ create 'base_file'.pcsi$desc +$! +$! +$! Start building file. +$!---------------------- +$ open/append pdsc 'base_file'.pcsi$desc +$! +$ write pdsc product_line +$! +$! Required product dependencies. +$!---------------------------------- +$ vmsprd = "DEC" +$ if base .eqs. "I64VMS" then vmsprd = "HP" +$! +$ write pdsc " software ''vmsprd' ''base' VMS ;" +$ arch_type = f$getsyi("ARCH_NAME") +$ node_swvers = f$getsyi("node_swvers") +$ vernum = f$extract(1, f$length(node_swvers), node_swvers) +$ majver = f$element(0, ".", vernum) +$ minverdash = f$element(1, ".", vernum) +$ minver = f$element(0, "-", minverdash) +$ dashver = f$element(1, "-", minverdash) +$ if dashver .eqs. "-" then dashver = "" +$ vmstag = majver + minver + dashver +$ code = f$extract(0, 1, arch_type) +$ arch_code = f$extract(0, 1, arch_type) +$ write pdsc - + " if (not <software ''vmsprd' ''base' VMS version minimum ''node_swvers'>) ;" +$ write pdsc " error NEED_VMS''vmstag';" +$ write pdsc " end if;" +$! +$! +$! +$! install/upgrade/postinstall steps. +$!----------------------------------- +$! 1. Duplicate filenames need an alias procedure. +$! 2. ODS-5 filenames need an alias procedure. +$! 3. Special alias links for executables (gawk. -> gnv$gawk.exe) +$! if a lot, then an alias procedure is needed. +$! 4. Rename the files to lowercase. +$! +$! +$! Alias links needed. +$!------------------------- +$ add_alias_lines = "" +$ rem_alias_lines = "" +$ line_out = "" +$! +$! Read through the file list to set up aliases and rename commands. +$!--------------------------------------------------------------------- +$ open/read flst [.vms]pcsi_gawk_file_list.txt +$! +$inst_alias_loop: +$ read/end=inst_alias_loop_end flst line_in +$ line_in = f$edit(line_in,"compress,trim,uncomment") +$ if line_in .eqs. "" then goto inst_alias_loop +$ pathname = f$element(0, " ", line_in) +$ linkflag = f$element(1, " ", line_in) + +$ if linkflag .nes. "->" then goto inst_alias_write +$! +$ linktarget = f$element(2, " ", line_in) +$ nlink = "pcsi$destination:" + pathname +$ ntarg = "pcsi$destination:" + linktarget +$ new_add_alias_line = - + """if f$search(""""''nlink'"""") .eqs. """""""" then" + - + " set file/enter=''nlink' ''ntarg'""" +$ if add_alias_lines .nes. "" +$ then +$ add_alias_lines = add_alias_lines + "," + new_add_alias_line +$ else +$ add_alias_lines = new_add_alias_line +$ endif +$! +$ new_rem_alias_line = - + """if f$search(""""''nlink'"""") .nes. """""""" then" + - + " set file/remove ''nlink';""" +$ if rem_alias_lines .nes. "" +$ then +$ rem_alias_lines = rem_alias_lines + "," + new_rem_alias_line +$ else +$ rem_alias_lines = new_rem_alias_line +$ endif +$! +$ goto inst_alias_loop +$! +$inst_alias_write: +$! +$! execute install / remove +$ write pdsc " execute install (" +$! add aliases +$ i = 0 +$ex_ins_loop: +$ line = f$element(i, ",", add_alias_lines) +$ i = i + 1 +$ if line .eqs. "" then goto ex_ins_loop +$ if line .eqs. "," then goto ex_ins_loop_end +$ if line_out .nes. "" then write pdsc line_out,"," +$ line_out = line +$ goto ex_ins_loop +$ex_ins_loop_end: +$ if line_out .eqs. "" then line_out = " ""continue""" +$ write pdsc line_out +$ line_out = "" +$ write pdsc " )" +$ write pdsc " remove (" +$! remove aliases +$ line_out = - + " ""@pcsi$destination:[gnv.vms_bin]gawk_alias_setup.com remove""" +$ i = 0 +$ex_rem_loop: +$ line = f$element(i, ",", rem_alias_lines) +$ i = i + 1 +$ if line .eqs. "" then goto ex_rem_loop +$ if line .eqs. "," then goto ex_rem_loop_end +$ if line_out .nes. "" then write pdsc line_out,"," +$ line_out = line +$ goto ex_rem_loop +$ex_rem_loop_end: +$ if line_out .eqs. "" then line_out = " ""continue""" +$ write pdsc line_out +$ line_out = "" +$ write pdsc " ) ;" +$! +$! execute upgrade +$ write pdsc " execute upgrade (" +$ line_out = - + " ""@pcsi$destination:[gnv.vms_bin]gawk_alias_setup.com remove""" +$ i = 0 +$ex_upg_loop: +$ line = f$element(i, ",", rem_alias_lines) +$ i = i + 1 +$ if line .eqs. "" then goto ex_upg_loop +$ if line .eqs. "," then goto ex_upg_loop_end +$ if line_out .nes. "" then write pdsc line_out,"," +$ line_out = line +$ goto ex_upg_loop +$ex_upg_loop_end: +$ if line_out .eqs. "" then line_out = " ""continue""" +$ write pdsc line_out +$ line_out = "" +$! remove aliases +$ write pdsc " ) ;" +$! +$! execute postinstall +$ write pdsc " execute postinstall (" +$ if arch_code .nes. "V" +$ then +$ line_out = " ""set process/parse=extended""," +$ write pdsc line_out +$ endif +$ line_out = " ""@pcsi$destination:[gnv.vms_bin]remove_old_gawk.com""," +$ write pdsc line_out +$ line_out = " ""@pcsi$destination:[gnv.vms_bin]gawk_alias_setup.com""" +$ i = 0 +$ex_pins_loop: +$ line = f$element(i, ",", add_alias_lines) +$ i = i + 1 +$ if line .eqs. "" then goto ex_pins_loop +$ if line .eqs. "," then goto ex_pins_loop_end +$ if line_out .nes. "" then write pdsc line_out,"," +$ line_out = line +$ goto ex_pins_loop +$ex_pins_loop_end: +$ if line_out .eqs. "" then line_out = " ""continue""" +$! write pdsc line_out +$! line_out = "" +$! add aliases and follow with renames. +$! +$goto inst_dir +$! +$inst_dir_loop: +$ read/end=inst_alias_loop_end flst line_in +$ line_in = f$edit(line_in,"compress,trim,uncomment") +$ if line_in .eqs. "" then goto inst_dir_loop +$inst_dir: +$ pathname = f$element(0, " ", line_in) +$! +$! Ignore the directory entries for now. +$!----------------------------------------- +$ filedir = f$parse(pathname,,,"DIRECTORY") +$ if pathname .eqs. filedir then goto inst_dir_loop +$! +$! process .dir extensions for rename +$! If this is not a directory then start processing files. +$!------------------------- +$ filetype = f$parse(pathname,,,"TYPE") +$ filetype_u = f$edit(filetype, "upcase") +$ filename = f$parse(pathname,,,"NAME") +$ if filetype_u .nes. ".DIR" then goto inst_file +$! +$! process directory lines for rename. +$!-------------------------------------- +$ if line_out .nes. "" +$ then +$ write pdsc line_out,"," +$ line_out = "" +$ endif +$ if arch_code .nes. "V" +$ then +$ if line_out .nes. "" then write pdsc line_out,"," +$ line_out = " ""rename pcsi$destination:''pathname' ''filename'.DIR""" +$ else +$ if line_out .nes. "" then write pdsc line_out +$ line_out = "" +$ endif +$ goto inst_dir_loop +$! +$! +$! process file lines for rename +$!--------------------------------- +$inst_file_loop: +$ read/end=inst_alias_loop_end flst line_in +$ line_in = f$edit(line_in,"compress,trim,uncomment") +$ if line_in .eqs. "" then goto inst_dir_loop +$ pathname = f$element(0, " ", line_in) +$! +$! Filenames with $ in them are VMS special and do not need to be lowercased. +$! -------------------------------------------------------------------------- +$ if f$locate("$", pathname) .lt. f$length(pathname) then goto inst_file_loop +$! +$ filetype = f$parse(pathname,,,"TYPE") +$ filename = f$parse(pathname,,,"NAME") + filetype +$inst_file: +$ if arch_code .nes. "V" +$ then +$ if line_out .nes. "" then write pdsc line_out,"," +$ filetype = f$parse(pathname,,,"TYPE") +$ filename = f$parse(pathname,,,"NAME") + filetype +$ line_out = " ""rename pcsi$destination:''pathname' ''filename'""" +$ else +$ if line_out .nes. "" then write pdsc line_out +$ line_out = "" +$ endif +$ goto inst_file_loop +$! +$inst_alias_loop_end: +$! +$write pdsc line_out +$write pdsc " ) ;" +$close flst +$! +$! Move Release Notes to destination +$!------------------------------------- +$write pdsc " information RELEASE_NOTES phase after ;" +$! +$! Source kit option +$!--------------------- +$write pdsc " option SOURCE default 0;" +$write pdsc " directory ""[gnv.common_src]"" PROTECTION PUBLIC ;" +$write pdsc - + " file ""[gnv.common_src]''filename_base'_original_src.bck""" +$write pdsc - + " source [common_src]''filename_base'_original_src.bck ;" +$if f$search("sys$disk:''filename_base'_vms_src.bck") .nes. "" +$then +$ write pdsc " directory ""[gnv.vms_src]"" PROTECTION PUBLIC ;" +$ write pdsc " file ""[gnv.vms_src]''filename_base'_vms_src.bck""" +$ write pdsc " source [vms_src]''filename_base'_vms_src.bck ;" +$endif +$write pdsc " end option;" +$! +$! +$! Read through the file list again. +$!---------------------------------- +$open/read flst [.vms]pcsi_gawk_file_list.txt +$! +$! +$! Create directory lines +$!------------------------- +$flst_dir_loop: +$ read/end=flst_loop_end flst line_in +$ line_in = f$edit(line_in,"compress,trim,uncomment") +$ if line_in .eqs. "" then goto flst_dir_loop +$! +$ filename = f$element(0, " ", line_in) +$ linkflag = f$element(1, " ", line_in) +$ if linkflag .eqs. "->" then goto flst_dir_loop +$! +$! Ignore .dir extensions +$!------------------------- +$ filetype = f$edit(f$parse(filename,,,"TYPE"), "upcase") +$ if filetype .eqs. ".DIR" then goto flst_dir_loop +$! +$ destname = filename +$! +$! It should be just a directory then. +$!------------------------------------- +$ filedir = f$edit(f$parse(filename,,,"DIRECTORY"), "lowercase") +$! If this is not a directory then start processing files. +$!--------------------------------------------------------- +$ if filename .nes. filedir then goto flst_file +$! +$ write pdsc " directory ""''destname'"" PROTECTION PUBLIC ;" +$ goto flst_dir_loop +$! +$! +$! Add file lines for gawk. +$!--------------------------- +$flst_file_loop: +$ read/end=flst_loop_end flst line_in +$ line_in = f$edit(line_in,"compress,trim,uncomment") +$ if line_in .eqs. "" then goto flst_file_loop +$ filename = f$element(0, " ", line_in) +$ destname = filename +$flst_file: +$ if arch_code .eqs. "V" +$ then +$! ! These files not available on VAX. +$ src_dir = f$parse(destname,,,"DIRECTORY") +$ if src_dir .eqs. "[GNV.USR.LIB.GAWK]" then goto flst_file_loop +$ endif +$ srcfile = filename - "gnv." +$ write pdsc " file ""''destname'"" " +$ write pdsc " source ""''srcfile'"" ;" +$ goto flst_file_loop +$! +$flst_loop_end: +$ close flst +$! +$! Add Link alias procedure file (N/A for gawk) +$!----------------------------------------------------- +$ write pdsc " file ""[vms_bin]gawk_alias_setup.com""" +$ write pdsc " source [vms_bin]gawk_alias_setup.com ;" +$! +$! Add [.SYS$STARTUP]gawk_startup file +$!--------------------------------------- +$ write pdsc " file ""[sys$startup]gnv$gawk_startup.com""" +$ write pdsc " source [vms_bin]gnv$gawk_startup.com ;" +$! +$! Add Release notes file. +$!------------------------------ +$ write pdsc - + " file ""[SYSHLP]''filename_base'.release_notes"" release notes ;" +$! +$! Close the product file +$!------------------------ +$ write pdsc "end product;" +$! +$close pdsc +$! +$all_exit: +$ exit diff --git a/vms/build_gawk_pcsi_text.com b/vms/build_gawk_pcsi_text.com new file mode 100644 index 00000000..a1053cf6 --- /dev/null +++ b/vms/build_gawk_pcsi_text.com @@ -0,0 +1,179 @@ +$! File: build_gawk_pcsi_text.com +$! +$! Build the *.pcsi$text file from the four components: +$! 1. Generated =product header section +$! 2. readme. file from the Gawk distribution, modified to fit +$! a pcsi$text file format. +$! 3. copying file from the Gawk distribution, modified to fit +$! a pcsi$text file format. +$! 4. Generated Producer section. +$! +$! Set the name of the release notes from the GNV_PCSI_FILENAME_BASE +$! +$! +$! 02-Jan-2014 J. Malmberg - Gawk version +$! +$!=========================================================================== +$! +$ kit_name = f$trnlnm("GNV_PCSI_KITNAME") +$ if kit_name .eqs. "" +$ then +$ write sys$output "@MAKE_PCSI_GAWK_KIT_NAME.COM has not been run." +$ goto all_exit +$ endif +$ producer = f$trnlnm("GNV_PCSI_PRODUCER") +$ if producer .eqs. "" +$ then +$ write sys$output "@MAKE_PCSI_GAWK_KIT_NAME.COM has not been run." +$ goto all_exit +$ endif +$ producer_full_name = f$trnlnm("GNV_PCSI_PRODUCER_FULL_NAME") +$ if producer_full_name .eqs. "" +$ then +$ write sys$output "@MAKE_PCSI_GAWK_KIT_NAME.COM has not been run." +$ goto all_exit +$ endif +$! +$! +$! Parse the kit name into components. +$!--------------------------------------- +$ producer = f$element(0, "-", kit_name) +$ base = f$element(1, "-", kit_name) +$ product = f$element(2, "-", kit_name) +$ mmversion = f$element(3, "-", kit_name) +$ majorver = f$extract(0, 3, mmversion) +$ minorver = f$extract(3, 2, mmversion) +$ updatepatch = f$element(4, "-", kit_name) +$ if updatepatch .eqs. "-" then updatepatch = "" +$! +$! +$ product_line = "=product ''producer' ''base' ''product'" +$ if updatepatch .eqs. "" +$ then +$ product_name = " ''majorver'.''minorver'" +$ else +$ product_name = " ''majorver'.''minorver'-''updatepatch'" +$ endif +$ product_line = product_line + " ''product_name' full" +$! +$! +$! If this is VAX and the file is on NFS, the names may be mangled. +$!----------------------------------------------------------------- +$ readme_file = "" +$ if f$search("readme.") .nes. "" +$ then +$ readme_file = "readme." +$ else +$ if f$search("$README.") .nes. "" +$ then +$ readme_file = "$README." +$ else +$ write sys$output "Can not find readme file." +$ goto all_exit +$ endif +$ endif +$ copying_file = "" +$ if f$search("copying.") .nes. "" +$ then +$ copying_file = "copying." +$ else +$ if f$search("$COPYING.") .nes. "" +$ then +$ copying_file = "$COPYING." +$ else +$ write sys$output "Can not find copying file." +$ goto all_exit +$ endif +$ endif +$! +$! Create the file as a VMS text file. +$!---------------------------------------- +$ base_file = kit_name +$ create 'base_file'.pcsi$text +$! +$! +$! Start building file. +$!---------------------- +$ open/append ptxt 'base_file'.pcsi$text +$ write ptxt product_line +$! +$! +$! First insert the Readme file. +$! +$ open/read rf 'readme_file' +$! +$ write ptxt "1 'PRODUCT" +$ write ptxt "=prompt ''producter' ''product' for OpenVMS" +$! +$rf_loop: +$ read/end=rf_loop_end rf line_in +$ if line_in .nes. "" +$ then +$! PCSI files use the first character in for their purposes. +$!-------------------------------------------------------------- +$ first_char = f$extract(0, 1, line_in) +$ if first_char .nes. " " then line_in = " " + line_in +$ endif +$ write ptxt line_in +$ goto rf_loop +$rf_loop_end: +$ close rf +$! +$! +$! Now add in the copying file +$!-------------------------------- +$ write ptxt "" +$ write ptxt "1 'NOTICE" +$ write ptxt "" +$! +$ open/read cf 'copying_file' +$! +$cf_loop: +$ read/end=cf_loop_end cf line_in +$ if line_in .nes. "" +$ then +$! PCSI files use the first character in for their purposes. +$!-------------------------------------------------------------- +$ first_char = f$extract(0, 1, line_in) +$ if first_char .nes. " " then line_in = " " + line_in +$ endif +$ write ptxt line_in +$ goto cf_loop +$cf_loop_end: +$ close cf +$! +$! Now we need the rest of the boiler plate. +$!-------------------------------------------- +$ write ptxt "" +$ write ptxt "1 'PRODUCER" +$ write ptxt "=prompt ''producer_full_name'" +$ write ptxt - + "This software product is provided by ''producer_full_name' with no warranty." +$! +$ arch_type = f$getsyi("ARCH_NAME") +$ node_swvers = f$getsyi("node_swvers") +$ vernum = f$extract(1, f$length(node_swvers), node_swvers) +$ majver = f$element(0, ".", vernum) +$ minverdash = f$element(1, ".", vernum) +$ minver = f$element(0, "-", minverdash) +$ dashver = f$element(1, "-", minverdash) +$ if dashver .eqs. "-" then dashver = "" +$ vmstag = majver + minver + dashver +$ code = f$extract(0, 1, arch_type) +$! +$ write ptxt "1 NEED_VMS''vmstag'" +$ write ptxt - + "=prompt OpenVMS ''vernum' or later is not installed on your system." +$ write ptxt "This product requires OpenVMS ''vernum' or later to function." +$ write ptxt "1 SOURCE" +$ write ptxt "=prompt Source modules for ''product'" +$ write ptxt "The Source modules for ''product' will be installed." +$ write ptxt "1 RELEASE_NOTES" +$ write ptxt "=prompt Release notes are available in the [SYSHLP] directory." +$! +$ close ptxt +$! +$! +$! +$all_exit: +$ exit diff --git a/vms/build_gawk_release_notes.com b/vms/build_gawk_release_notes.com new file mode 100644 index 00000000..c088ff8c --- /dev/null +++ b/vms/build_gawk_release_notes.com @@ -0,0 +1,67 @@ +$! File: Build_gawk_release_notes.com +$! +$! Build the release note file from the three components: +$! 1. The gawk_release_note_start.txt +$! 2. readme. file from the Gawk distribution. +$! 3. The gawk_build_steps.txt. +$! +$! Set the name of the release notes from the GNV_PCSI_FILENAME_BASE +$! logical name. +$! +$! +$! 31-Dec-2013 J. Malmberg +$! +$!=========================================================================== +$! +$ base_file = f$trnlnm("GNV_PCSI_FILENAME_BASE") +$ if base_file .eqs. "" +$ then +$ write sys$output "@MAKE_PCSI_GAWK_KIT_NAME.COM has not been run." +$ goto all_exit +$ endif +$! +$ gawk_vms_readme = f$search("sys$disk:[.readme_d]readme.vms") +$ if gawk_vms_readme .eqs. "" +$ then +$ gawk_vms_readme = f$search("sys$disk:[.$README_$D]$README.VMS") +$ endif +$ if gawk_vms_readme .eqs. "" +$ then +$ write sys$output "Can not find gawk README.VMS file." +$ goto all_exit +$ endif +$! +$ gawk_readme = f$search("sys$disk:[]readme.") +$ if gawk_readme .eqs. "" +$ then +$ gawk_readme = f$search("sys$disk:[]$README.") +$ endif +$ if gawk_readme .eqs. "" +$ then +$ write sys$output "Can not find gawk readme file." +$ goto all_exit +$ endif +$! +$ gawk_copying = f$search("sys$disk:[]copying.") +$ if gawk_copying .eqs. "" +$ then +$ gawk_copying = f$search("sys$disk:[]$COPYING.") +$ endif +$ if gawk_copying .eqs. "" +$ then +$ write sys$output "Can not find gawk copying file." +$ goto all_exit +$ endif +$! +$ type/noheader sys$disk:[.vms]gawk_release_note_start.txt,- + 'gawk_readme',- + 'gawk_vms_readme',- + 'gawk_copying', - + sys$disk:[.vms]gawk_build_steps.txt - + /out='base_file'.release_notes +$! +$ purge 'base_file'.release_notes +$ rename 'base_file.release_notes ;1 +$! +$all_exit: +$ exit diff --git a/vms/compare_gawk_source.com b/vms/compare_gawk_source.com new file mode 100644 index 00000000..260ec4eb --- /dev/null +++ b/vms/compare_gawk_source.com @@ -0,0 +1,367 @@ +$! Compare_gawk_source.com +$! +$! This procedure compares the files in two directories and reports the +$! differences. +$! +$! It needs to be customized to the local site directories. +$! +$! This is used by me for these purposes: +$! 1. Compare the original source of a project with an existing +$! VMS port. +$! 2. Compare the checked out repository of a project with the +$! the local working copy to make sure they are in sync. +$! 3. Keep a copy directory up to date. The third is needed by +$! me because VMS Backup can create a saveset of files from a +$! NFS mounted volume. +$! +$! First the files in the original source directory which is assumed to be +$! under source codde control are compared with the copy directory. +$! +$! Then the files are are only in the copy directory are listed. +$! +$! The result will five diagnostics about of files: +$! 1. Files that are not generation 1. +$! 2. Files missing in the copy directory. +$! 3. Files in the copy directory not in the source directory. +$! 4. Files different from the source directory. +$! 5. Files that VMS DIFF can not process. +$! +$! This needs to be run on an ODS-5 volume. +$! +$! If UPDATE is given as a second parameter, files missing or different in the +$! copy directory will be updated. +$! +$! By default: +$! The source directory is source_root:[gawk.reference.gawk], +$! the logical used on my system for the GNV Mecurial repository checkout. +$! If source_root: is not defined, then src_root:[gawk] will be +$! translated to something like DISK:[dir.gawk.reference.gawk] +$! and then DISK:[dir.gawk.vms_source.gawk] will be used. +$! +$! The copy directory is vms_root:[gawk] +$! The UPDATE parameter is ignored. +$! +$! This setting is used to make sure that the working vms directory +$! and the VMS specific repository checkout directory have the same +$! contents if they are different. +$! +$! If P1 is "SRCBCK" then this +$! The source directory tree is: src_root:[gawk] +$! The copy directory is src_root1:[gawk] +$! +$! src_root1:[gawk] is used by me to work around that VMS backup will +$! not use NFS as a source directory so I need to make a copy. +$! +$! This is to make sure that the backup save set for the unmodified +$! source is up to date. +$! +$! If your repository checkout is not on an NFS mounted volume, you do not +$! need to use this option or have the logical name src_root1 defined. +$! +$! If P1 is "VMSBCK" then this changes the two directories: +$! The source directory is vms_root:[gawk] +$! The copy directory is vms_root1:[gawk] +$! +$! vms_root: +$! src_root1:[gawk] is used by me to work around that VMS backup will +$! not use NFS as a source directory so I need to make a copy. +$! +$! This is to make sure that the backup save set for the unmodified +$! source is up to date. +$! +$! If your repository checkout is not on an NFS mounted volume, you do not +$! need to use this option or have the logical name src_root1 defined. +$! +$! 02-Jan-2014 J. Malmberg +$!========================================================================== +$! +$! Update missing/changed files. +$update_file = 0 +$if (p2 .eqs. "UPDATE") +$then +$ update_file = 1 +$endif +$! +$myproc = f$environment("PROCEDURE") +$myprocdir = f$parse(myproc,,,"DIRECTORY") - "[" - "]" - "<" - ">" +$myprocdir = f$edit(myprocdir, "LOWERCASE") +$mydefault = f$environment("DEFAULT") +$mydir = f$parse(mydefault,,,"DIRECTORY") +$mydir = f$edit(mydir, "LOWERCASE") +$odelim = f$extract(0, 1, mydir) +$mydir = mydir - "[" - "]" - "<" - ">" +$mydev = f$parse(mydefault,,,"DEVICE") +$! +$ref = "" +$if P1 .eqs. "" +$then +$ ref_base_dir = myprocdir - ".vms" +$ wrk_base_dir = mydir +$ update_file = 0 +$ resultd = f$parse("src_root:",,,,"NO_CONCEAL") +$ resultd = f$edit(resultd, "LOWERCASE") +$ resultd = resultd - "][" - "><" - ".;" - ".." +$ resultd_len = f$length(resultd) - 1 +$ delim = f$extract(resultd_len, 1, resultd) +$ ref_root_base = mydir + delim +$ if f$locate(".reference.", resultd) .lt. resultd_len +$ then +$ resultd = resultd - ref_root_base - "reference." + "vms_source." +$ else +$ resultd = resultd - ref_root_base - "gnu." + "gnu_vms." +$ endif +$ ref = resultd + ref_base_dir +$ wrk = "VMS_ROOT:" + odelim + wrk_base_dir +$ resultd_len = f$length(resultd) - 1 +$ resultd = f$extract(0, resultd_len, resultd) + delim +$ ref_root_dir = f$parse(resultd,,,"DIRECTORY") +$ ref_root_dir = f$edit(ref_root_dir, "LOWERCASE") +$ ref_root_dir = ref_root_dir - "[" - "]" +$ ref_base_dir = ref_root_dir + "." + ref_base_dir +$endif +$! +$if p1 .eqs. "SRCBCK" +$then +$ ref_base_dir = "gawk" +$ wrk_base_dir = "gawk" +$ ref = "src_root:[" + ref_base_dir +$ wrk = "src_root1:[" + wrk_base_dir +$ if update_file +$ then +$ if f$search("src_root1:[000000]gawk.dir") .eqs. "" +$ then +$ create/dir/prot=o:rwed src_root1:[gawk] +$ endif +$ endif +$endif +$! +$! +$if p1 .eqs. "VMSBCK" +$then +$ ref_base_dir = "gawk" +$ wrk_base_dir = "gawk" +$ ref = "vms_root:[" + ref_base_dir +$ wrk = "vms_root1:[" + wrk_base_dir +$ if update_file +$ then +$ if f$search("vms_root1:[000000]gawk.dir") .eqs. "" +$ then +$ create/dir/prot=o:rwed vms_root1:[gawk] +$ endif +$ endif +$endif +$! +$! +$if ref .eqs. "" +$then +$ write sys$output "Unknown compare type specified!" +$ exit 44 +$endif +$! +$! +$! +$! Future - check the device types involved for the +$! the syntax to check. +$ODS2_SYNTAX = 0 +$NFS_MANGLE = 0 +$PWRK_MANGLE = 0 +$! +$vax = f$getsyi("HW_MODEL") .lt. 1024 +$if vax +$then +$ ODS2_SYNTAX = 1 +$endif +$! +$report_missing = 1 +$! +$if .not. ODS2_SYNTAX +$then +$ set proc/parse=extended +$endif +$! +$loop: +$ ref_spec = f$search("''ref'...]*.*;",1) +$ if ref_spec .eqs. "" then goto loop_end +$! +$ ref_dev = f$parse(ref_spec,,,"DEVICE") +$ ref_dir = f$parse(ref_spec,,,"DIRECTORY") +$ ref_dir = f$edit(ref_dir, "LOWERCASE") +$ ref_name = f$parse(ref_spec,,,"NAME") +$ ref_type = f$parse(ref_spec,,,"TYPE") +$! +$! +$ if f$locate(".CVS]", ref_dir) .lt. f$length(ref_dir) then goto loop +$ if f$locate(".cvs]", ref_dir) .lt. f$length(ref_dir) then goto loop +$ if f$locate(".$cvs]", ref_dir) .lt. f$length(ref_dir) then goto loop +$ if f$locate(".^.git", ref_dir) .lt. f$length(ref_dir) then goto loop +$ if f$locate(".$5ngit", ref_dir) .lt. f$length(ref_dir) then goto loop +$! +$ rel_path = ref_dir - "[" - ref_base_dir +$! rel_path_len = f$length(rel_path) - 1 +$! delim = f$extract(rel_path_len, 1, rel_path) +$! rel_path = rel_path - ".]" - ".>" - "]" - ">" +$! rel_path = rel_path + delim +$! +$ if ODS2_SYNTAX +$ then +$ endif +$! +$ wrk_path = wrk + rel_path +$! +$ ref_name_type = ref_name + ref_type +$! +$ if ref_name_type .eqs. "CVS.DIR" then goto loop +$ if ref_name_type .eqs. "cvs.dir" then goto loop +$ if ref_name_type .eqs. "$CVS.DIR" then goto loop +$ if ref_name_type .eqs. "^.git.DIR" then goto loop +$ if ref_name_type .eqs. "$5ngit.DIR" then goto loop +$ if ref_name_type .eqs. "$5NGIT.DIR" then goto loop +$ if ODS2_SYNTAX +$ then +$! +$ endif +$! +$ wrk_spec = wrk_path + ref_name_type +$! +$! +$ wrk_chk = f$search(wrk_spec, 0) +$ if wrk_chk .eqs. "" +$ then +$ if report_missing +$ then +$ write sys$output "''wrk_spec' is missing" +$ endif +$ if update_file +$ then +$ copy/log 'ref_spec' 'wrk_spec' +$ endif +$ goto loop +$ endif +$! +$ wrk_name = f$parse(wrk_spec,,,"NAME") +$ wrk_type = f$parse(wrk_spec,,,"TYPE") +$ wrk_fname = wrk_name + wrk_type" +$ ref_fname = ref_name + ref_type +$! +$ if ref_fname .nes. wrk_fname +$ then +$ write sys$output "''wrk_spc' wrong name, should be ""''ref_fname'""" +$ endif +$! +$ ref_type = f$edit(ref_type, "UPCASE") +$ if ref_type .eqs. ".DIR" then goto loop +$! +$ if ODS2_SYNTAX +$ then +$ ref_fname = f$edit(ref_fname, "LOWERCASE") +$ endif +$! +$! These files have records to long to diff, and we don't change them anyway. +$ ref_skip = 0 +$ if ref_type .eqs. ".GMO" then ref_skip = 1 +$ if ref_type .eqs. ".PDF" then ref_skip = 1 +$ if ref_type .eqs. ".PNG" then ref_skip = 1 +$ if ref_type .eqs. ".JPG" then ref_skip = 1 +$ if ref_fname .eqs. "inftest.ok" then ref_skip = 1 +$ if ref_fname .eqs. "longsub.in" then ref_skip = 1 +$ if ref_fname .eqs. "longsub.ok" then ref_skip = 1 +$ if ref_fname .eqs. "nasty2.ok" then ref_skip = 1 +$ if ref_fname .eqs. "profile5.awk" then ref_skip = 1 +$ if ref_fname .eqs. "profile5.ok" then ref_skip = 1 +$ if ref_fname .eqs. "po.m4" then ref_skip = 1 +$! +$! +$ if ref_skip .ne. 0 +$ then +$ if report_missing +$ then +$ write sys$output "Skipping diff of ''ref_fname'" +$ endif +$ goto loop +$ endif +$! +$! +$ wrk_ver = f$parse(wrk_chk,,,"VERSION") +$ if wrk_ver .nes. ";1" +$ then +$ write sys$output "Version for ''wrk_spec' is not 1" +$ endif +$ set noon +$ diff/out=nl: 'wrk_spec' 'ref_spec' +$ if $severity .nes. "1" +$ then +$ write sys$output "''wrk_spec' is different from ''ref_spec'" +$ if update_file +$ then +$ delete 'wrk_spec';* +$ copy/log 'ref_spec' 'wrk_spec' +$ endif +$ endif +$ set on +$ +$! +$ goto loop +$loop_end: +$! +$! +$missing_loop: +$! For missing loop, check the latest generation. +$ ref_spec = f$search("''wrk'...]*.*;") +$ if ref_spec .eqs. "" then goto missing_loop_end +$! +$ ref_dev = f$parse(ref_spec,,,"DEVICE") +$ ref_dir = f$parse(ref_spec,,,"DIRECTORY") +$ ref_dir = f$edit(ref_dir, "LOWERCASE") +$ ref_name = f$parse(ref_spec,,,"NAME") +$ ref_type = f$parse(ref_spec,,,"TYPE") +$! +$ rel_path = ref_dir - "[" - wrk_base_dir +$! +$! +$ wrk_path = ref + rel_path +$ wrk_spec = wrk_path + ref_name + ref_type +$ wrk_name = f$parse(wrk_spec,,,"NAME") +$ wrk_type = f$parse(wrk_spec,,,"TYPE") +$! +$ wrk_fname = wrk_name + wrk_type" +$ ref_fname = ref_name + ref_type +$! +$ wrk_skip = 0 +$ ref_utype = f$edit(ref_type,"UPCASE") +$ ref_ufname = f$edit(ref_fname,"UPCASE") +$! +$! +$ if wrk_skip .eq. 0 +$ then +$ wrk_chk = f$search(wrk_spec, 0) +$ if wrk_chk .eqs. "" +$ then +$ if report_missing +$ then +$ write sys$output "''wrk_spec' is missing" +$ endif +$ goto missing_loop +$ endif +$ else +$ goto missing_loop +$ endif +$! +$ if ref_fname .nes. wrk_fname +$ then +$ write sys$output "''wrk_spc' wrong name, should be ""''ref_fname'""" +$ endif +$! +$ if ref_utype .eqs. ".DIR" then goto missing_loop +$! +$ wrk_ver = f$parse(wrk_chk,,,"VERSION") +$ if wrk_ver .nes. ";1" +$ then +$ write sys$output "Version for ''wrk_spec' is not 1" +$ endif +$! +$ goto missing_loop +$! +$! +$missing_loop_end: +$! +$exit diff --git a/vms/config_h.com b/vms/config_h.com new file mode 100644 index 00000000..c1d3becf --- /dev/null +++ b/vms/config_h.com @@ -0,0 +1,1661 @@ +$! File: config_h.com +$! +$! $Id: config_h.com,v 1.1.1.1 2012/12/02 19:25:21 wb8tyw Exp $ +$! +$! This procedure attempts to figure out how to build a config.h file +$! for the current project. +$! +$! The P1 parameter of "NOBUILTINS" inhibits the default #include <builtins.h> +$! that is normally added. This include can cause side effects if +$! special VMS compiler settings are used. +$! +$! The CONFIGURE shell script will be examined for hints and a few symbols +$! but most of the tests will not produce valid results on OpenVMS. Some +$! will produce false positives and some will produce false negatives. +$! +$! It is easier to just read the config.h_in file and make up tests based +$! on what is in it! +$! +$! This file will create an empty config_vms.h file if one does not exist. +$! The config_vms.h is intended for manual edits to handle things that +$! this procedure can not. +$! +$! The config_vms.h will be invoked by the resulting config.h file. +$! +$! This procedure knows about the DEC C RTL on the system it is on. +$! Future versions may be handle the GNV, the OpenVMS porting library, +$! and others. +$! +$! This procedure may not guess the options correctly for all architectures, +$! and is a work in progress. +$! +$! Copyright (C) 2014 the Free Software Foundation, Inc. +$! +$! This file is part of GAWK, the GNU implementation of the +$! AWK Progamming Language. +$! +$! GAWK is free software; you can redistribute it and/or modify +$! it under the terms of the GNU General Public License as published by +$! the Free Software Foundation; either version 3 of the License, or +$! (at your option) any later version. +$! +$! GAWK is distributed in the hope that it will be useful, +$! but WITHOUT ANY WARRANTY; without even the implied warranty of +$! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +$! GNU General Public License for more details. +$! +$! You should have received a copy of the GNU General Public License +$! along with this program; if not, write to the Free Software +$! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +$! USA +$! +$! Per assignment agreement with FSF, similar procedures may be present +$! in other packages under other licensing agreements and copyrights +$! +$! 15-Jan-2001 J. Malmberg Original +$! 29-Apr-2001 J. Malmberg Also look for config.*in* in a [.include] +$! subdirectory +$! 30-Apr-2001 J. Malmberg Update for SAMBA checks +$! 09-Apr-2005 J. Malmberg Update for RSYNC and large file. +$! 29-Sep-2011 J. Malmberg Update for Bash 4.2 +$! 01-Mar-2012 J. Malmberg Warn about getcwd(0,0) +$! 21-Dec-2012 J. Malmberg Update for gawk +$!============================================================================ +$! +$ss_normal = 1 +$ss_abort = 44 +$ss_control_y = 1556 +$status = ss_normal +$on control_y then goto control_y +$on warning then goto general_error +$! +$! Some information for writing timestamps to created files +$!---------------------------------------------------------- +$my_proc = f$environment("PROCEDURE") +$my_proc_file = f$parse(my_proc,,,"NAME") + f$parse(my_proc,,,"TYPE") +$tab[0,8] = 9 +$datetime = f$element(0,".",f$cvtime(,"ABSOLUTE","DATETIME")) +$username = f$edit(f$getjpi("","USERNAME"),"TRIM") +$! +$pid = f$getjpi("","PID") +$tfile1 = "SYS$SCRATCH:config_h_temp1_''pid'.TEMP" +$dchfile = "SYS$SCRATCH:config_h_decc_''pid'.TEMP" +$configure_script = "SYS$SCRATCH:configure_script_''pid'.TEMP" +$! +$! Get the system type +$!---------------------- +$arch_type = f$getsyi("arch_type") +$! +$! Does config_vms.h exist? +$!------------------------- +$update_config_vms = 0 +$file = f$search("sys$disk:[]config_vms.h") +$if file .nes. "" +$then +$ write sys$output "Found existing custom file ''file'." +$else +$ update_config_vms = 1 +$ write sys$output "Creating new sys$disk:[]config_vms.h for you." +$ gosub write_config_vms +$endif +$! +$! +$! On some platforms, DCL search has problems with searching a file +$! on a NFS mounted volume. So copy it to sys$scratch: +$! +$if f$search(configure_script) .nes. "" then delete 'configure_script';* +$copy PRJ_ROOT:configure 'configure_script' +$! +$! +$! Write out the header +$!---------------------- +$gosub write_config_h_header +$! +$! +$! +$! config.h.in could have at least five different names depending +$! on how it was transferred to OpenVMS +$!------------------------------------------------------------------ +$cfile = f$search("sys$disk:[]config.h.in") +$if cfile .eqs. "" +$then +$ cfile = f$search("sys$disk:[]config.h_in") +$ if cfile .eqs. "" +$ then +$ cfile = f$search("sys$disk:[]configh.in") +$ if cfile .eqs. "" +$ then +$ cfile = f$search("sys$disk:[]config__2eh.in") +$ if cfile .eqs. "" +$ then +$ cfile = f$search("sys$disk:[]config.h__2ein") +$ endif +$ endif +$ endif +$endif +$if f$trnlnm("PRJ_INCLUDE") .nes. "" +$then +$ cfile = f$search("PRJ_INCLUDE:config.h.in") +$ if cfile .eqs. "" +$ then +$ cfile = f$search("PRJ_INCLUDE:config.h_in") +$ if cfile .eqs. "" +$ then +$ cfile = f$search("PRJ_INCLUDE:config__2eh.in") +$ if cfile .eqs. "" +$ then +$ cfile = f$search("PRJ_INCLUDE:config__2eh.in") +$ if cfile .eqs. "" +$ then +$ cfile = f$search("PRJ_INCLUDE:config.h__2ein") +$ endif +$ endif +$ endif +$ endif +$endif +$if cfile .eqs. "" +$then +$ write sys$output "Can not find sys$disk:config.h.in" +$ line_out = "Looked for config.h.in, config.h_in, configh.in, " +$ line_out = line_out + "config__2eh.in, "config.h__2ein" +$ write/symbol sys$output line_out +$ if f$trnlnm("PRJ_INCLUDE") .nes. "" +$ then +$ write sys$output "Also looked in PRJ_INCLUDE: for these files." +$ endif +$! +$ write tf "" +$ write tf - + " /* Could not find sys$disk:config.h.in */" +$ write tf - + " /* Looked also for config.h_in, configh.in, config__2eh.in, */" +$ write tf - + " /* config.h__2ein */" +$ if f$trnlnm("PRJ_INCLUDE") .nes. "" +$ then +$ write tf - + " /* Also looked in PRJ_INCLUDE: for these files. */" +$ endif +$ write tf - + "/*--------------------------------------------------------------*/ +$ write tf "" +$ goto write_tail +$endif +$! +$! +$! Locate the DECC libraries in use +$!----------------------------------- +$decc_rtldef = f$parse("decc$rtldef","sys$library:.tlb;0") +$decc_shr = f$parse("decc$shr","sys$share:.exe;0") +$! +$! Dump the DECC header names into a file +$!---------------------------------------- +$if f$search(dchfile) .nes. "" then delete 'dchfile';* +$if f$search(tfile1) .nes. "" then delete 'tfile1';* +$define/user sys$output 'tfile1' +$library/list 'decc_rtldef' +$open/read/error=rtldef_loop1_end tf1 'tfile1' +$open/write/error=rtldef_loop1_end tf2 'dchfile' +$rtldef_loop1: +$ read/end=rtldef_loop1_end tf1 line_in +$ line_in = f$edit(line_in,"TRIM,COMPRESS") +$ key1 = f$element(0," ",line_in) +$ key2 = f$element(1," ",line_in) +$ if key1 .eqs. " " .or. key1 .eqs. "" then goto rtldef_loop1 +$ if key2 .nes. " " .and. key2 .nes. "" then goto rtldef_loop1 +$ write tf2 "|",key1,"|" +$ goto rtldef_loop1 +$rtldef_loop1_end: +$if f$trnlnm("tf1","lnm$process",,"SUPERVISOR") .nes. "" then close tf1 +$if f$trnlnm("tf2","lnm$process",,"SUPERVISOR") .nes. "" then close tf2 +$if f$search(tfile1) .nes. "" then delete 'tfile1';* +$! +$! +$! Now calculate what should be in the file from reading +$! config.h.in and CONFIGURE. +$!--------------------------------------------------------------- +$open/read inf 'cfile' +$do_comment = 0 +$if_block = 0 +$cfgh_in_loop1: +$!set nover +$ read/end=cfgh_in_loop1_end inf line_in +$ xline = f$edit(line_in,"TRIM,COMPRESS") +$! +$! Blank line handling +$!--------------------- +$ if xline .eqs. "" +$ then +$ write tf "" +$ goto cfgh_in_loop1 +$ endif +$ xlen = f$length(xline) +$ key = f$extract(0,2,xline) +$! +$! deal with comments by copying exactly +$!----------------------------------------- +$ if (do_comment .eq. 1) .or. (key .eqs. "/*") +$ then +$ do_comment = 1 +$ write tf line_in +$ key = f$extract(xlen - 2, 2, xline) +$ if key .eqs. "*/" then do_comment = 0 +$ goto cfgh_in_loop1 +$ endif +$! +$! Some quick parsing +$!---------------------- +$ keyif = f$extract(0,3,xline) +$ key1 = f$element(0," ",xline) +$ key2 = f$element(1," ",xline) +$ key2a = f$element(0,"_",key2) +$ key2b = f$element(1,"_",key2) +$ key2_len = f$length(key2) +$ key2_h = f$extract(key2_len - 2, 2, key2) +$ key2_t = f$extract(key2_len - 5, 5, key2) +$ if key2_t .eqs. "_TYPE" then key2_h = "_T" +$ key64 = 0 +$ if f$locate("64", xline) .lt. xlen then key64 = 1 +$! +$!write sys$output "xline = ''xline'" +$! +$! Comment out this section of the ifblock +$!----------------------------------------- +$ if if_block .ge. 3 +$ then +$ write tf "/* ", xline, " */" +$ if keyif .eqs. "#en" then if_block = 0 +$ goto cfgh_in_loop1 +$ endif +$! +$! Handle the end of an ifblock +$!------------------------------- +$ if keyif .eqs. "#en" +$ then +$ write tf xline +$ if_block = 0 +$ goto cfgh_in_loop1 +$ endif +$! +$ if key1 .eqs. "#ifndef" +$ then +$! Manual check for _ALL_SOURCE on AIX error +$!----------------------------------------------- +$ if key2 .eqs. "_ALL_SOURCE" +$ then +$ write tf "/* ", xline, " */" +$! +$! Ignore the rest of the block +$!-------------------------------------- +$ if_block = 3 +$ goto cfgh_in_loop1 +$ endif +$ endif +$! +$! +$! Default action for an #if/#else/#endif +$!------------------------------------------ +$ if keyif .eqs. "#if" .or. keyif .eqs. "#el" +$ then +$ if_block = 1 +$ write tf xline +$ goto cfgh_in_loop1 +$ endif +$! +$! +$! Process "normal?" stuff +$!--------------------------- +$ if key1 .eqs. "#undef" +$ then +$ key2c = f$element(2, "_", key2) +$ if (key2c .eqs. "_") .or. (key2c .eqs. "H") then key2c = "" +$ key2d = f$element(3, "_", key2) +$ if (key2d .eqs. "_") .or. (key2d .eqs. "H") then key2d = "" +$ key2e = f$element(4, "_", key2) +$ if (key2e .eqs. "_") .or. (key2e .eqs. "H") then key2e = "" +$ if key2d .eqs. "T" +$ then +$ if key2e .eqs. "TYPE" +$ then +$ key2_h = "_T" +$ key2d = "" +$ endif +$ endif +$! +$ double_under = 0 +$! +$ if key2 .eqs. "bits16_t" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' short" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "u_bits16_t" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' unsigned short" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "bits32_t" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' int" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "u_bits32_t" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' unsigned int" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "intmax_t" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#ifdef __VAX" +$ write tf "#define ''key2' long" +$ write tf "#else" +$ write tf "#define ''key2' long long" +$ write tf "#endif" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "uintmax_t" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#ifdef __VAX" +$ write tf "#define ''key2' unsigned long" +$ write tf "#else" +$ write tf "#define ''key2' unsigned long long" +$ write tf "#endif" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "socklen_t" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' int" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "GETGROUPS_T" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' gid_t" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_DECL_SYS_SIGLIST" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 0" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_SYS_ERRLIST" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_STRUCT_DIRENT_D_INO" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$! ! The header files have this information, however +$! ! The ioctl() call only works on sockets. +$! if key2 .eqs. "FIONREAD_IN_SYS_IOCTL" +$! then +$! write tf "#ifndef ''key2'" +$! write tf "#define ''key2' 1" +$! write tf "#endif" +$! goto cfgh_in_loop1 +$! endif +$! +$! ! The header files have this information, however +$! ! The ioctl() call only works on sockets. +$! if key2 .eqs. "GWINSZ_IN_SYS_IOCTL" +$! then +$! write tf "#ifndef ''key2'" +$! write tf "#define ''key2' 1" +$! write tf "#endif" +$! goto cfgh_in_loop1 +$! endif +$! +$! ! The header files have this information, however +$! ! The ioctl() call only works on sockets. +$! if key2 .eqs. "STRUCT_WINSIZE_IN_SYS_IOCTL" +$! then +$! write tf "#ifndef ''key2'" +$! write tf "#define ''key2' 0" +$! write tf "#endif" +$! goto cfgh_in_loop1 +$! endif +$! +$ if key2 .eqs. "HAVE_STRUCT_TM_TM_ZONE" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_TM_ZONE" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_TIMEVAL" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_TZNAME" +$ then +$ write tf "#if __CRTL_VER >= 70000000" +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "WEXITSTATUS_OFFSET" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 2" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_GETPW_DECLS" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_DECL_CONFSTR" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_DECL_PRINTF" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_DECL_SBRK" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_DECL_STRSIGNAL" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 0" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2a .eqs. "HAVE_DECL_STRTOLD" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 0" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_DECL_STRTOIMAX" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 0" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_DECL_STRTOL" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_DECL_STRTOLL" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_DECL_STRTOUL" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_DECL_STRTOULL" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_DECL_STRTOUMAX" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 0" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "GETPGRP_VOID" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "NAMED_PIPES_MISSING" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "OPENDIR_NOT_ROBUST" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "PGRP_PIPE" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "CAN_REDEFINE_GETENV" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_PRINTF_A_FORMAT" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "CTYPE_NON_ASCII" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_LANGINFO_CODESET" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_LC_MESSAGES" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$! This wants execve() to do this automagically to pass. +$! if key2 .eqs. "HAVE_HASH_BANG_EXEC" +$! then +$! write tf "#ifndef ''key2'" +$! write tf "#define ''key2' 1" +$! write tf "#endif" +$! goto cfgh_in_loop1 +$! endif +$! +$ if key2 .eqs. "ICONV_CONST" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2'" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "VOID_SIGHANDLER" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_POSIX_SIGNALS" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "UNUSABLE_RT_SIGNALS" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2a .eqs. "HAVE_DECL_FPURGE" +$ then +$ write tf "#ifndef ''key2a'" +$ write tf "#define ''key2a' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_DECL_SETREGID" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_POSIX_SIGSETJMP" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "HAVE_LIBDL" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "STRCOLL_BROKEN" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2 .eqs. "DUP_BROKEN" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$! This is for a test that getcwd(0,0) works. +$! It does not on VMS. +$!-------------------------- +$ if key2 .eqs. "GETCWD_BROKEN" +$ then +$ write sys$output "" +$ write sys$output - + "%CONFIG_H-I-NONPORT, ''key2' being tested for!" +$ write sys$output - + "-CONFIG_H-I-GETCWD, GETCWD(0,0) does not work on VMS." +$ write sys$output - + "-CONFIG_H-I-GETCWD2, Work around hack probably required." +$ write sys$output - + "-CONFIG_H-I-REVIEW, Manual Code review required!" +$ if update_config_vms +$ then +$ open/append tfcv sys$disk:[]config_vms.h +$ write tfcv "" +$ write tfcv - + "/* Check config.h for use of ''key2' settings */" +$ write tfcv "" +$ close tfcv +$ endif +$ +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2a .eqs. "HAVE" .or. key2a .eqs. "STAT" +$ then +$! +$! Process extra underscores +$!------------------------------------ +$ if f$locate("HAVE___", key2) .lt. key2_len +$ then +$ key2b = "__" + key2d +$ key2d = "" +$ double_under = 1 +$ else +$ if f$locate("HAVE__", key2) .lt. key2_len +$ then +$ key2b = "_" + key2c +$ key2c = "" +$ double_under = 1 +$ endif +$ endif +$! +$ if key2_h .eqs. "_H" +$ then +$! +$! Looking for a header file +$!--------------------------------------- +$ headf = key2b +$ if key2c .nes. "" then headf = headf + "_" + key2c +$ if key2d .nes. "" then headf = headf + "_" + key2d +$! +$! (key2b .eqs. "READLINE") +$! +$! Some special parsing +$!------------------------------------------ +$ if (key2b .eqs. "SYS") .or. (key2b .eqs. "ARPA") .or. - + (key2b .eqs. "NET") .or. (key2b .eqs. "NETINET") +$ then +$ if key2c .nes. "" +$ then +$ headf = key2c +$ if key2d .nes. "" then headf = key2c + "_" + key2d +$ endif +$ endif +$! +$! And of course what's life with out some special cases +$!-------------------------------------------------------------------- +$ if key2b .eqs. "FILE" +$ then +$ write sys$output "" +$ write sys$output - + "%CONFIG_H-I-NONPORT, ''key2' being asked for!" +$ write sys$output - + "-CONFIG_H-I-FILE_OLD, file.h will not be configured as is obsolete!" +$ write sys$output - + "-CONFIG_H_I-FCNTL_NEW, "Expecting fcntl.h to be configured instead!" +$ write sys$output - + "-CONFIG_H_I-FCNTL_CHK, "Unable to verify at this time!" +$ write sys$output - + "-CONFIG_H-I-REVIEW, Manual Code review required!" +$! +$ if update_config_vms +$ then +$ open/append tfcv sys$disk:[]config_vms.h +$ write tfcv "" +$ write tfcv - + "/* Check config.h for use of fcntl.h instead of file.h */" +$ write tfcv "" +$ close tfcv +$ endif +$ endif +$! +$! Now look it up in the DEC C RTL +$!--------------------------------------------- +$ define/user sys$output nl: +$ define/user sys$error nl: +$ search/output=nl: 'dchfile' |'headf'|/exact +$ if '$severity' .eq. 1 +$ then +$ if key64 then write tf "#ifndef __VAX" +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$if p2 .nes. "" then write sys$output "''dchfile' - #define ''key2' 1" +$ write tf "#endif" +$ if key64 then write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ else +$! +$! Looking for a routine or a symbol +$!------------------------------------------------ +$ if key2c .eqs. "MACRO" +$ then +$ if (key2b .eqs. "FILE") .or. (key2b .eqs. "DATE") - + .or. (key2b .eqs. "LINE") .or. (key2b .eqs. "TIME") +$ then +$ write tf "#ifndef HAVE_''key2b'" +$ write tf "#define HAVE_''key2b' 1" +$ write tf "#endif" +$ endif +$ goto cfgh_in_loop1 +$ endif +$! +$! Special false tests +$!------------------------------------- +$ if double_under +$ then +$ if key2b .eqs. "_FCNTL" .or. key2b .eqs. "__FCNTL" +$ then +$ write tf "/* #undef HAVE_''key2b' */" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2b .eqs. "_STAT" .or. key2b .eqs. "__STAT" +$ then +$ write tf "/* #undef HAVE_''key2b' */" +$ goto cfgh_in_loop1 +$ endif +$! +$ if key2b .eqs. "_READ" .or. key2b .eqs. "__READ" +$ then +$ write tf "/* #undef HAVE_''key2b' */" +$ goto cfgh_in_loop1 +$ endif +$ endif +$! +$ keysym = key2b +$ if key2c .nes. "" then keysym = keysym + "_" + key2c +$ if key2d .nes. "" then keysym = keysym + "_" + key2d +$ if key2e .nes. "" then keysym = keysym + "_" + key2e +$! +$! +$! Stat structure members +$!------------------------------------- +$ if key2b .eqs. "STRUCT" +$ then +$ if key2c .eqs. "STAT" .and (key2d .nes. "") +$ then +$ key2b = key2b + "_" + key2c + "_" + key2d +$ key2c = key2e +$ key2d = "" +$ key2e = "" +$ endif +$ endif +$ if (key2b .eqs. "ST") .or. (key2b .eqs. "STRUCT_STAT_ST") +$ then +$ keysym = "ST" + "_" + key2c +$ keysym = f$edit(keysym,"LOWERCASE") +$ endif +$ if key2a .eqs. "STAT" +$ then +$ if (f$locate("STATVFS", key2b) .eq. 0) .and. key2c .eqs. "" +$ then +$ keysym = f$edit(key2b, "LOWERCASE") +$ endif +$!$ if (key2b .eqs. "STATVFS" .or. key2b .eqs. "STATFS2" - +$! .or. key2b .eqs. "STATFS3") .and. key2c .nes. "" +$! +$ if (key2b .eqs. "STATVFS") .and. key2c .nes. "" +$ then +$! Should really verify that the structure +$! named by key2b actually exists first. +$!------------------------------------------------------------ +$! +$! Statvfs structure members +$!------------------------------------------------- +$ keysym = "f_" + f$edit(key2c,"LOWERCASE") +$ endif +$ endif +$! +$! UTMPX structure members +$!-------------------------------------- +$ if key2b .eqs. "UT" .and. key2c .eqs. "UT" +$ then +$ keysym = "ut_" + f$edit(key2d,"LOWERCASE") +$ endif +$! +$ if f$locate("MMAP",key2) .lt. key2_len +$ then +$ write sys$output "" +$ write sys$output - + "%CONFIG_H-I-NONPORT, ''key2' being asked for!" +$ write sys$output - + "-CONFIG_H-I-MMAP, MMAP operations only work on STREAM and BINARY files!" +$ write sys$output - + "-CONFIG_H-I-REVIEW, Manual Code review required!" +$ if update_config_vms +$ then +$ open/append tfcv sys$disk:[]config_vms.h +$ write tfcv "" +$ write tfcv - + "/* Check config.h for use of ''key2' settings */" +$ write tfcv "" +$ close tfcv +$ endif +$ endif +$! +$! +$ if keysym .eqs. "CRYPT" +$ then +$ write sys$output "" +$ write sys$output - + "%CONFIG_H-I-NONPORT, ''key2' being asked for!" +$ write sys$output - + "-CONFIG_H-I-CRYPT, CRYPT operations on the VMS SYSUAF may not work!" +$ write sys$output - + "-CONFIG_H-I-REVIEW, Manual Code review required!" +$ if update_config_vms +$ then +$ open/append tfcv sys$disk:[]config_vms.h +$ write tfcv "" +$ write tfcv - + "/* Check config.h for use of ''keysym' */" +$ write tfcv "" +$ close tfcv +$ endif +$ endif +$! +$! +$ if keysym .eqs. "EXECL" +$ then +$ write sys$output "" +$ write sys$output - + "%CONFIG_H-I-NONPORT, ''key2' being asked for!" +$ write sys$output - + "-CONFIG_H-I-EXCEL, EXECL configured, Will probably not work." +$ write sys$output - + "-CONFIG_H-I-REVIEW, Manual Code review required!" +$ if update_config_vms +$ then +$ open/append tfcv sys$disk:[]config_vms.h +$ write tfcv "" +$ write tfcv - + "/* Check config.h for use of ''keysym' */" +$ write tfcv "" +$ close tfcv +$ endif +$ endif +$! +$! +$! Process if cpp supports ANSI-C stringizing '#' operator +$!----------------------------------------------------------------------- +$ if keysym .eqs. "STRINGIZE" +$ then +$ write tf "#ifndef HAVE_STRINGIZE" +$ write tf "#define HAVE_STRINGSIZE 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if keysym .eqs. "VOLATILE" +$ then +$ write tf "#ifndef HAVE_VOLATILE" +$ write tf "#define HAVE_VOLATILE 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if keysym .eqs. "ALLOCA" +$ then +$ write tf "#ifndef HAVE_ALLOCA" +$ write tf "#define HAVE_ALLOCA 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if keysym .eqs. "ERRNO_DECL" +$ then +$ write tf "#ifndef HAVE_ERRNO_DECL" +$ write tf "#define HAVE_ERRNO_DECL 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if keysym .eqs. "LONGLONG" +$ then +$ write tf "#ifndef __VAX" +$ write tf "#pragma message disable longlongtype" +$ write tf "#ifndef HAVE_LONGLONG" +$ write tf "#define HAVE_LONGLONG 1" +$ write tf "#endif" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$! May need to test compiler version +$!----------------------------------------------- +$ if (keysym .eqs. "LONG_LONG") .or. - + (keysym .eqs. "LONG_LONG_INT") +$ then +$ write tf "#ifndef __VAX" +$ write tf "#pragma message disable longlongtype" +$ write tf "#ifndef HAVE_''keysym'" +$ write tf "#define HAVE_''keysym' 1" +$ write tf "#endif" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$! May need to test compiler version +$!----------------------------------------------- +$ if keysym .eqs. "UNSIGNED_LONG_LONG" +$ then +$ write tf "#ifndef __VAX" +$ write tf "#pragma message disable longlongtype" +$ write tf "#ifndef HAVE_UNSIGNED_LONG_LONG" +$ write tf "#define HAVE_UNSIGNED_LONG_LONG 1" +$ write tf "#endif" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$! May need to test compiler version +$!----------------------------------------------- +$ if keysym .eqs. "UNSIGNED_LONG_LONG_INT" +$ then +$ write tf "#ifndef __VAX" +$ write tf "#pragma message disable longlongtype" +$ write tf "#ifndef HAVE_UNSIGNED_LONG_LONG_INT" +$ write tf "#define HAVE_UNSIGNED_LONG_LONG_INT 1" +$ write tf "#endif" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$! May need to test compiler version +$!----------------------------------------------- +$ if keysym .eqs. "LONG_DOUBLE" +$ then +$ write tf "#ifndef __VAX" +$ write tf "#pragma message disable longlongtype" +$ write tf "#ifndef HAVE_LONG_DOUBLE" +$ write tf "#define HAVE_LONG_DOUBLE 1" +$ write tf "#endif" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ if keysym .eqs. "FCNTL_LOCK" +$ then +$ write sys$output - + "%CONFIG_H-I-NONPORT, ''key2' being asked for! +$ write sys$output - + "-CONFIG_H-I-REVIEW, Manual Code review required!" +$ goto cfgh_in_loop1 +$ endif +$! +$! +$! These libraries are provided by the DEC C RTL +$!------------------------------------------------------------- +$ if keysym .eqs. "LIBINET" .or. keysym .eqs. "LIBSOCKET" +$ then +$ write tf "#ifndef HAVE_''keysym'" +$ write tf "#define HAVE_''keysym' 1" +$if p2 .nes. "" then write sys$output "''decc_shr' #define ''keysym' 1" +$ write tf "#endif +$ goto cfgh_in_loop1 +$ endif +$! +$! +$ if keysym .eqs. "HERRNO" then keysym = "h_errno" +$ if keysym .eqs. "UTIMBUF" then keysym = "utimbuf" +$ if key2c .eqs. "STRUCT" +$ then +$ keysym = f$edit(key2d,"LOWERCASE") +$ else +$ if key2_h .eqs. "_T" +$ then +$ if key2_t .eqs. "_TYPE" +$ then +$ keysym = f$extract(0, key2_len - 5, key2) - "HAVE_" +$ endif +$ keysym = f$edit(keysym,"LOWERCASE") +$ endif +$ endif +$! +$! Check the DEC C RTL shared image first +$!------------------------------------------------------ +$ if f$search(tfile1) .nes. "" then delete 'tfile1';* +$ define/user sys$output nl: +$ define/user sys$error nl: +$ search/format=nonull/out='tfile1' 'decc_shr' 'keysym' +$ if '$severity' .eq. 1 +$ then +$! +$! Not documented, but from observation +$!------------------------------------------------------ +$ define/user sys$output nl: +$ define/user sys$error nl: +$ if arch_type .eq. 3 +$ then +$ keyterm = "''keysym'<SOH>" +$ else +$ if arch_type .eq. 2 +$ then +$ keyterm = "''keysym'<BS>" +$ else +$ keyterm = "''keysym'<STX>" +$ endif +$ endif +$ search/out=nl: 'tfile1' - + "$''keyterm'","$g''keyterm'","$__utc_''keyterm'",- + "$__utctz_''keyterm'","$__bsd44_''keyterm'","$bsd_''keyterm'",- + "$''keysym'decc$","$G''keysym'decc$","$GX''keyterm'" +$ severity = '$severity' +$! +$! +$! Of course the 64 bit stuff is different +$!--------------------------------------------------------- +$ if severity .ne. 1 .and. key64 +$ then +$ define/user sys$output nl: +$ define/user sys$error nl: +$ search/out=nl: 'tfile1' "$_''keyterm'" +$! search/out 'tfile1' "$_''keyterm'" +$ severity = '$severity' +$ endif +$! +$! UNIX compatability routines +$!--------------------------------------------- +$ if severity .ne. 1 +$ then +$ define/user sys$output nl: +$ define/user sys$error nl: +$ search/out=nl: 'tfile1' - + "$__unix_''keyterm'","$__vms_''keyterm'","$_posix_''keyterm'" +$ severity = '$severity' +$ endif +$! +$! VAX special handling routines +$!--------------------------------------------- +$ if (severity .ne. 1) .and. (arch_type .eq. 1) +$ then +$ define/user sys$output nl: +$ define/user sys$error nl: +$ search/out=nl: 'tfile1' "DECC$''keysym'<SOH>" +$ severity = '$severity' +$ endif +$! +$! Show the result of the search +$!------------------------------------------------ +$ if 'severity' .eq. 1 +$ then +$ if key64 then write tf "#ifndef __VAX" +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$if p2 .nes. "" then write sys$output "''decc_shr' #define ''key2' 1" +$ write tf "#endif" +$ if key64 then write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$ endif +$ if f$search(tfile1) .nes. "" then delete 'tfile1';* +$! +$! Check the DECC Header files next +$!---------------------------------------------- +$ define/user sys$output nl: +$ define/user sys$error nl: +$ search/out=nl: 'decc_rtldef' - + "''keysym';", "''keysym'[", "struct ''keysym'"/exact +$ severity = '$severity' +$ if severity .eq. 1 +$ then +$ if key64 then write tf "#ifndef __VAX" +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$if p2 .nes. "" then write sys$output "''decc_rtldef' #define ''key2' 1" +$ write tf "#endif" +$ if key64 then write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$ endif +$ write tf "/* ", xline, " */" +$ goto cfgh_in_loop1 +$ endif +$! +$! +$! Process SIZEOF directives found in SAMBA +$!------------------------------------------------ +$ if key2a .eqs. "SIZEOF" +$ then +$ if key2b .eqs. "INO" .and. key2_h .eqs. "_T" +$ then +$ write tf "#ifndef SIZEOF_INO_T" +$ write tf "#define SIZEOF_INO_T (6)" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$ if key2b .eqs. "INTMAX" .and. key2_h .eqs. "_T" +$ then +$ write tf "#ifndef SIZEOF_INTMAX_T" +$ write tf "#ifdef __VAX" +$ write tf "#define SIZEOF_INTMAX_T (4)" +$ write tf "#else" +$ write tf "#define SIZEOF_INTMAX_T (8)" +$ write tf "#endif" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$ if key2b .eqs. "OFF" .and. key2_h .eqs. "_T" +$ then +$ write tf "#ifndef SIZEOF_OFF_T" +$ write tf "#ifdef __VAX" +$ write tf "#define SIZEOF_OFF_T (4)" +$ write tf "#else" +$ write tf "#define SIZEOF_OFF_T (8)" +$ write tf "#endif" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$ if key2b .eqs. "CHAR" .and. key2_h .eqs. "_P" +$ then +$ write tf "#ifndef SIZEOF_CHAR_P" +$ write tf "#define SIZEOF_CHAR_P (4)" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$ if (key2b .eqs. "INT") +$ then +$ write tf "#ifndef SIZEOF_''key2b'" +$ write tf "#define SIZEOF_''key2b' (4)" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$ if key2b .eqs. "UNSIGNED" +$ then +$ if key2c .eqs. "INT" .or. key2c .eqs. "LONG" +$ then +$ write tf "#ifndef SIZEOF_''key2b'_''key2c'" +$ write tf "#define SIZEOF_''key2b'_''key2c' (4)" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$ endif +$ if key2b .eqs. "DOUBLE" +$ then +$ write tf "#ifndef SIZEOF_DOUBLE" +$ write tf "#define SIZEOF_DOUBLE (8)" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$ if key2b .eqs. "LONG" +$ then +$ if key2c .eqs. "" +$ then +$ write tf "#ifndef SIZEOF_LONG" +$ write tf "#define SIZEOF_LONG (4)" +$ write tf "#endif" +$ else +$ write tf "#ifndef SIZEOF_LONG_LONG" +$ write tf "#ifndef __VAX" +$ write tf "#define SIZEOF_LONG_LONG (8)" +$ write tf "#endif" +$ write tf "#endif" +$ endif +$ goto cfgh_in_loop1 +$ endif +$ if key2b .eqs. "SHORT" +$ then +$ write tf "#ifndef SIZEOF_SHORT" +$ write tf "#define SIZEOF_SHORT (2)" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$ write tf "/* ", xline, " */" +$ goto cfgh_in_loop1 +$ endif +$! +$! Process NEED directives +$!------------------------------- +$ if key2a .eqs. "NEED" +$ then +$ if key2b .eqs. "STRINGS" .and. key2_h .eqs. "_H" +$ then +$ write tf "#ifndef NEED_STRINGS_H" +$ write tf "#define NEED_STRINGS_H 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$ write tf "/* ", xline, " */" +$ goto cfgh_in_loop1 +$ endif +$! +$! +$! Process STATFS directives +$!------------------------------- +$! if key2a .eqs. "STATFS" +$! then +$! write tf "/* ", xline, " */" +$! goto cfgh_in_loop1 +$! endif +$! +$! Process inline directive +$!------------------------------ +$ if key2 .eqs. "inline" +$ then +$ write tf "#ifndef inline" +$ write tf "#define inline __inline" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$! Process restrict directive +$!-------------------------------- +$ if key2 .eqs. "restrict" +$ then +$ write tf "#ifndef restrict" +$ write tf "#define restrict __restrict" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$! Process RETSIGTYPE directive +$!---------------------------------- +$ if key2 .eqs. "RETSIGTYPE" +$ then +$ write tf "#ifndef RETSIGTYPE" +$ write tf "#define RETSIGTYPE void" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$! Process STDC_HEADERS (SAMBA!) +$!--------------------------- +$ if key2 .eqs. "STDC_HEADERS" +$ then +$ write tf "#ifndef STDC_HEADERS" +$ write tf "#define STDC_HEADERS 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$! Process PROTOTYPES directive +$!------------------------------------- +$ if key2 .eqs. "PROTOTYPES" +$ then +$ write tf "#ifndef PROTOTYPES" +$ write tf "#define PROTOTYPES 1" +$ write tf "#endif" +$ goto cfgh_in_loop1 +$ endif +$! +$! Special for SEEKDIR_RETURNS_VOID +$!--------------------------------------- +$ if key2 .eqs. "SEEKDIR_RETURNS_VOID" +$ then +$ write tf "#ifndef SEEKDIR_RETURNS_VOID" +$ write tf "#define SEEKDIR_RETURNS_VOID 1" +$ write tf "#endif" +$ endif +$! +$! TIME_WITH_SYS_TIME note: On VMS time.h and sys/time.h are same module. +$! +$! TIME_T_IN_SYS_TYPES_H +$!------------------------------ +$ if key2 .eqs. "TIME_T_IN_TYPES_H" +$ then +$ write tf "#ifndef ''key2'" +$ write tf "#define ''key2' 1" +$ write tf "#endif" +$ endif +$! +$! Unknown - See if CONFIGURE can give a clue for this +$!---------------------------------------------------------- +$ pflag = 0 +$ set_flag = 0 +$! gproj_name = proj_name - "_VMS" - "-VMS" +$ if f$search(tfile1) .nes. "" then delete 'tfile1';* +$ define/user sys$output nl: +$ define/user sys$error nl: +$! if f$locate("FILE", key2) .lt. key2_len then pflag = 1 +$! if f$locate("DIR", key2) .eq. key2_len - 3 then pflag = 1 +$! if f$locate("PATH", key2) .eq. key2_len - 4 then pflag = 1 +$! +$ search/out='tfile1' 'configure_script' "''key2'="/exact +$ search_sev = '$severity' +$ if 'search_sev' .eq. 1 +$ then +$ open/read/err=unknown_cf_rd_error sf 'tfile1' +$search_file_rd_loop: +$ read/end=unknown_cf_rd_err sf line_in +$ line_in = f$edit(line_in, "TRIM") +$ skey1 = f$element(0,"=",line_in) +$ if skey1 .eqs. key2 +$ then +$ skey2 = f$element(1,"=",line_in) +$ skey2a = f$extract(0,2,skey2) +$! +$! Keep these two cases separate to make it easier to add +$! more future intelligence to this routine +$!---------------------------------------------------------------------- +$ if skey2a .eqs. """`" +$ then +$! if pflag .eq. 1 +$! then +$! write tf "#ifndef ''key2'" +$! write tf "#define ",key2," """,gproj_name,"_",key2,"""" +$! write tf "#endif" +$! else +$! Ignore this for now +$!------------------------------------------ +$ write tf "/* ", xline, " */" +$! endif +$ set_flag = 1 +$ goto found_in_configure +$ endif +$ if skey2a .eqs. """$" +$ then +$! if pflag .eq. 1 +$! then +$! write tf "#ifndef ''key2'" +$! write tf "#define ",key2," """,gproj_name,"_",key2,"""" +$! write tf "#endif" +$! else +$! Ignore this for now +$!------------------------------------------- +$ write tf "/* ", xline, " */" +$! endif +$ set_flag = 1 +$ goto found_in_configure +$ endif +$ if f$extract(0, 1, skey2) .eqs. "'" +$ then +$ skey2 = skey2 - "'" - "'" +$ endif +$ write tf "#ifndef ''key2'" +$ write tf "#define ",key2," """,skey2,"""" +$ write tf "#endif" +$ set_flag = 1 +$ else +$ goto search_file_rd_loop +$! if pflag .eq. 1 +$! then +$! write tf "#ifndef ''key2'" +$! write tf "#define ",key2," """,gproj_name,"_",key2,"""" +$! write tf "#endif" +$! set_flag = 1 +$! endif +$ endif +$found_in_configure: +$unknown_cf_rd_err: +$ if f$trnlnm("sf","lnm$process",,"SUPERVISOR") .nes. "" +$ then +$ close sf +$ endif +$ if f$search(tfile1) .nes. "" then delete 'tfile1';* +$ if set_flag .eq. 1 then goto cfgh_in_loop1 +$ endif +$ endif +$! +$! +$! +$! If it falls through everything else, comment it out +$!----------------------------------------------------- +$ write tf "/* ", xline, " */" +$ goto cfgh_in_loop1 +$cfgh_in_loop1_end: +$close inf +$! +$! +$! Write out the tail +$!-------------------- +$write_tail: +$gosub write_config_h_tail +$! +$! Exit and clean up +$!-------------------- +$general_error: +$status = '$status' +$all_exit: +$set noon +$if f$trnlnm("sf","lnm$process",,"SUPERVISOR") .nes. "" then close sf +$if f$trnlnm("tf","lnm$process",,"SUPERVISOR") .nes. "" then close tf +$if f$trnlnm("inf","lnm$process",,"SUPERVISOR") .nes. "" then close inf +$if f$trnlnm("tf1","lnm$process",,"SUPERVISOR") .nes. "" then close tf1 +$if f$trnlnm("tf2","lnm$process",,"SUPERVISOR") .nes. "" then close tf2 +$if f$trnlnm("tfcv","lnm$process",,"SUPERVISOR") .nes. "" then close tfcv +$if f$type(tfile1) .eqs. "STRING" +$then +$ if f$search(tfile1) .nes. "" then delete 'tfile1';* +$endif +$if f$type(dchfile) .eqs. "STRING" +$then +$ if f$search(dchfile) .nes. "" then delete 'dchfile';* +$endif +$if f$type(configure_script) .eqs. "STRING" +$then +$ if f$search(configure_script) .nes. "" then delete 'configure_script';* +$endif +$exit 'status' +$! +$! +$control_y: +$ status = ss_control_y +$ goto all_exit +$! +$! +$! +$! Gosub to write a new config_vms.h +$!----------------------------------- +$write_config_vms: +$outfile = "sys$disk:[]config_vms.h" +$create 'outfile' +$open/append tf 'outfile' +$write tf "/* File: config_vms.h" +$write tf "**" +$write tf "** This file contains the manual edits needed for porting" +$!write tf "** the ''proj_name' package to OpenVMS. +$write tf "**" +$write tf "** Edit this file as needed. The procedure that automatically" +$write tf "** generated this header stub will not overwrite or make any" +$write tf "** changes to this file." +$write tf "**" +$write tf - + "** ", datetime, tab, username, tab, "Generated by ''my_proc_file'" +$write tf "**" +$write tf - + "**========================================================================*/" +$write tf "" +$close tf +$return +$! +$! gosub to write out a documentation header for config.h +$!---------------------------------------------------------------- +$write_config_h_header: +$outfile = "sys$disk:[]config.h" +$create 'outfile' +$open/append tf 'outfile' +$write tf "#ifndef CONFIG_H" +$write tf "#define CONFIG_H" +$write tf "/* File: config.h" +$write tf "**" +$write tf - + "** This file contains the options needed for porting " +$write tf "** the project on a VMS system." +$write tf "**" +$write tf "** Try not to make any edits to this file, as it is" +$write tf "** automagically generated." +$write tf "**" +$write tf "** Manual edits should be made to the config_vms.h file." +$write tf "**" +$write tf - + "** ", datetime, tab, username, tab, "Generated by ''my_proc_file'" +$write tf "**" +$write tf - + "**========================================================================*/" +$write tf "" +$write tf "#if (__CRTL_VER >= 70200000) && !defined (__VAX)" +$write tf "#define _LARGEFILE 1" +$write tf "#endif" +$write tf "" +$write tf "#ifndef __VAX" +$write tf "#ifdef __CRTL_VER" +$write tf "#if __CRTL_VER >= 80200000" +$write tf "#define _USE_STD_STAT 1" +$write tf "#endif" +$write tf "#endif" +$write tf "#endif" +$write tf "" +$! +$if P1 .nes. "NOBUILTINS" +$then +$ write tf " /* Allow compiler builtins */" +$ write tf "/*-------------------------*/" +$ write tf "#ifdef __DECC_VER" +$ write tf "#include <non_existant_dir:builtins.h>" +$ write tf "#endif" +$endif +$! +$write tf "" +$return +$! +$! gosub to write out the tail for config.h and close it +$!--------------------------------------------------------- +$write_config_h_tail: +$write tf "" +$write tf " /* Include the hand customized settings */" +$write tf "/*--------------------------------------*/" +$write tf "#include ""sys$disk:config_vms.h""" +$write tf "" +$write tf "#endif /* CONFIG_H */" +$close tf +$return +$! diff --git a/vms/descrip.mms b/vms/descrip.mms index 77dad90a..1f24f8f1 100644 --- a/vms/descrip.mms +++ b/vms/descrip.mms @@ -47,6 +47,7 @@ MAKEFILE = $(VMSDIR)Descrip.MMS #CCFLAGS = /noOpt/Debug # a comma separated list of macros to define +# Do not specify _POSIX_EXIT here, other tricks are used for this. CDEFS = "GAWK","HAVE_CONFIG_H" .ifdef GNUC @@ -67,8 +68,15 @@ 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) +.ifdef __VAX__ +CFLOAT = +.else +CFLOAT = /float=ieee/ieee_mode=denorm_results +.endif +CNAME = /NAME=(AS_IS,SHORT) +CC = cc/DECC/Prefix=All/NESTED_INCLUDE=NONE$(CFLOAT) +CFLAGS = /Incl=([],[.vms])/Obj=[]/Def=($(CDEFS))$(CNAME) $(CCFLAGS) +CEFLAGS = /Incl=([],[.vms],[.missing_d],[.extension])$(CNAME) $(CCFLAGS) LIBS = # DECC$SHR instead of VAXCRTL, no special link option needed .endif !VAXC .endif !GNUC @@ -106,7 +114,7 @@ AWKOBJS = $(AWKOBJ1),$(AWKOBJ2) # VMSOBJS # VMS specific stuff VMSCODE = vms_misc.obj,vms_popen.obj,vms_fwrite.obj,vms_args.obj,\ - vms_gawk.obj,vms_cli.obj + vms_gawk.obj,vms_cli.obj,vms_crtl_init.obj VMSCMD = gawk_cmd.obj # built from .cld file VMSOBJS = $(VMSCODE),$(VMSCMD) @@ -128,8 +136,8 @@ gawk : gawk.exe gawk.exe : $(GAWKOBJ) $(AWKOBJS) $(VMSOBJS) gawk.opt $(LINK) $(LINKFLAGS) gawk.opt/options -gawk.opt : $(MAKEFILE) # create linker options file - @ open/write opt sys$disk:[]gawk.opt ! ~ 'cat <<close >gawk.opt' +gawk.opt : $(MAKEFILE) config.h # create linker options file + @ open/write opt sys$disk:[]gawk.opt ! ~ 'cat <<close >gawk.opt' @ write opt "! GAWK -- GNU awk" @ write opt "$(GAWKOBJ)" @ write opt "$(AWKOBJ1)" @@ -139,17 +147,19 @@ gawk.opt : $(MAKEFILE) # create linker options file @ 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 + @ close opt + $ @$(VMSDIR)gawk_ident.com $(VMSCODE) : awk.h config.h $(VMSDIR)redirect.h $(VMSDIR)vms.h -$(AWKOBJS) : awk.h gettext.h mbsupport.h regex.h dfa.h config.h $(VMSDIR)redirect.h +$(AWKOBJS) : awk.h gettext.h mbsupport.h regex.h dfa.h config.h \ + $(VMSDIR)redirect.h $(GAWKOBJ) : awk.h config.h $(VMSDIR)redirect.h #----------------------------------------------------------------------------- # Older versions of MMS have problems handling lower case file names typically # found on ODS-5 disks. Fix this by adding explicit dependencies. #_____________________________________________________________________________ + array.obj : array.c awkgram.obj : awkgram.c awk.h builtin.obj : builtin.c floatmagic.h random.h @@ -174,7 +184,8 @@ node.obj : node.c profile.obj : profile.c random.obj : random.c random.h re.obj : re.c -regex.obj : regex.c regcomp.c regex_internal.c regexec.c regex.h regex_internal.h +regex.obj : regex.c regcomp.c regex_internal.c regexec.c regex.h \ + regex_internal.h str_array.obj : str_array.c symbol.obj : symbol.c version.obj : version.c @@ -184,12 +195,14 @@ vms_fwrite.obj : $(VMSDIR)vms_fwrite.c vms_args.obj : $(VMSDIR)vms_args.c vms_gawk.obj : $(VMSDIR)vms_gawk.c vms_cli.obj : $(VMSDIR)vms_cli.c +vms_crtl_init.obj : $(VMSDIR)vms_crtl_init.c replace.obj : replace.c $(MISSNGD)system.c $(MISSNGD)memcmp.c \ $(MISSNGD)memcpy.c $(MISSNGD)memset.c $(MISSNGD)memmove.c \ $(MISSNGD)strncasecmp.c $(MISSNGD)strerror.c \ $(MISSNGD)strftime.c $(MISSNGD)strchr.c $(MISSNGD)strtod.c \ $(MISSNGD)strtoul.c $(MISSNGD)tzset.c $(MISSNGD)mktime.c \ - $(MISSNGD)snprintf.c $(MISSNGD)getaddrinfo.c $(MISSNGD)usleep.c \ + $(MISSNGD)snprintf.c $(MISSNGD)getaddrinfo.c \ + $(MISSNGD)usleep.c \ $(MISSNGD)setenv.c $(MISSNGD)strcoll.c $(MISSNGD)wcmisc.c # bison or yacc required @@ -201,7 +214,8 @@ awkgram.c : awkgram.y # foo.y :: yacc => y[_]tab.c, bison => foo_tab.c $(PARSER) $(YFLAGS) $< @- if f$search("ytab.c") .nes."" then rename/new_vers ytab.c $@ @- if f$search("y_tab.c") .nes."" then rename/new_vers y_tab.c $@ - @- if f$search("awkgram_tab.c").nes."" then rename/new_vers awkgram_tab.c $@ + @- if f$search("awkgram_tab.c").nes."" then \ + rename/new_vers awkgram_tab.c $@ command.c : command.y @- if f$search("ytab.c") .nes."" then delete ytab.c;* @@ -211,10 +225,14 @@ command.c : command.y $(PARSER) $(YFLAGS) $< @- if f$search("ytab.c") .nes."" then rename/new_vers ytab.c $@ @- if f$search("y_tab.c") .nes."" then rename/new_vers y_tab.c $@ - @- if f$search("command_tab.c").nes."" then rename/new_vers command_tab.c $@ + @- if f$search("command_tab.c").nes."" then \ + rename/new_vers command_tab.c $@ -config.h : $(VMSDIR)vms-conf.h - copy $< sys$disk:[]$@ +config_vms.h : $(VMSDIR)generate_config_vms_h_gawk.com + $ @$(VMSDIR)generate_config_vms_h_gawk.com + +config.h : configh.in config_vms.h $(VMSDIR)config_h.com + $ @$(VMSDIR)config_h.com $(VMSCMD) : $(VMSDIR)gawk.cld set command $(CLDFLAGS)/object=$@ $< @@ -223,6 +241,96 @@ $(VMSCMD) : $(VMSDIR)gawk.cld install.help : $(VMSDIR)gawk.hlp library/help $(HELPLIB) $< /log + +# Build dynamic extensions - Alpha/Itanium only. +.ifdef __VAX__ +# VAX not complete yet. +plug_opt = [.VMS.VAX]gawk_plugin_xfer.opt +.else +plug_opt = [.vms]gawk_plugin.opt +.endif + +ext_gawkdirfd_h = [.extension]gawkdirfd.h config.h nonposix.h + +extensions : filefuncs.exe fnmatch.exe inplace.exe ordchr.exe readdir.exe \ + revoutput.exe revtwoway.exe rwarray.exe testext.exe time.exe + +filefuncs.exe : filefuncs.obj stack.obj gawkfts.obj $(plug_opt) + link/share=$(MMS$TARGET) $(MMS$SOURCE), stack.obj, gawkfts.obj, \ + $(plug_opt)/opt + +fnmatch.exe : fnmatch.obj $(plug_opt) + link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt + +inplace.exe : inplace.obj $(plug_opt) + link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt + +ordchr.exe : ordchr.obj $(plug_opt) + link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt + +readdir.exe : readdir.obj $(plug_opt) + link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt + +revoutput.exe : revoutput.obj $(plug_opt) + link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt + +revtwoway.exe : revtwoway.obj $(plug_opt) + link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt + +rwarray.exe : rwarray.obj $(plug_opt) + link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt + +testext.exe : testext.obj $(plug_opt) + link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt + +time.exe : time.obj $(plug_opt) + link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt + +stack.obj : [.extension]stack.c config.h gawkapi.h \ + [.extension]gawkfts.h, [.extension]stack.h + $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE) + +gawkfts.obj : [.extension]gawkfts.c config.h [.extension]gawkfts.h \ + $(ext_gawkdirfd_h) + $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H, ZOS_USS, "fchdir(x)=(-1)") \ + /object=$(MMS$TARGET) $(MMS$SOURCE) + +filefuncs.obj : [.extension]filefuncs.c config.h gawkapi.h \ + [.extension]gawkfts.h + $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE) + +fnmatch.obj : [.extension]fnmatch.c config.h gawkapi.h \ + [.missing_d]fnmatch.h [.missing_d]fnmatch.c + $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE) + +inplace.obj : [.extension]inplace.c config.h gawkapi.h + $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE) + +ordchr.obj : [.extension]ordchr.c config.h gawkapi.h + $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE) + +readdir.obj : [.extension]readdir.c config.h gawkapi.h \ + $(ext_gawkdirfd_h) + $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H, HAVE_DIRENT_H) \ + /object=$(MMS$TARGET) $(MMS$SOURCE) + +revoutput.obj : [.extension]revoutput.c config.h gawkapi.h + $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE) + +revtwoway.obj : [.extension]revtwoway.c config.h gawkapi.h + $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H, HAVE_GETDTABLESIZE) \ + /object=$(MMS$TARGET) $(MMS$SOURCE) + +rwarray.obj : [.extension]rwarray.c config.h gawkapi.h + $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE) + +testext.obj : [.extension]testext.c config.h gawkapi.h + $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE) + +time.obj : [.extension]time.c config.h gawkapi.h + $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE) + + # miscellaneous other targets tidy : - if f$search("*.*;-1").nes."" then purge @@ -230,13 +338,35 @@ tidy : clean : - if f$search ("*.obj") .nes. "" then delete *.obj;* + - if f$search ("*.lis") .nes. "" then delete *.lis;* - if f$search ("gawk.opt") .nes. "" then delete gawk.opt;* spotless : clean tidy - - if f$search("config.h").nes."" then rename config.h config.h-old/New + - if f$search("config.h").nes."" then delete config.h;* + - if f$search("config_vms.h").nes."" then delete config_vms.h;* - if f$search("gawk.exe").nes."" then delete gawk.exe;* + - if f$search("*.dsf").nes."" then delete *.dsf;* + - if f$search("*.map").nes."" then delete *.map;* + - if f$search("*.pcsi$desc").nes."" then delete *.pcsi$desc;* + - if f$search("*.pcsi$text").nes."" then delete *.pcsi$text;* + - if f$search("gawk*_src.bck").nes."" then delete gawk*_src.bck;* + - if f$search("*.release_notes").nes."" then delete *.release_notes;* + - if f$search("filefuncs.exe").nes."" then delete filefuncs.exe;* + - if f$search("fnmatch.exe").nes."" then delete fnmatch.exe;* + - if f$search("inplace.exe").nes."" then delete inplace.exe;* + - if f$search("ordchr.exe").nes."" then delete ordchr.exe;* + - if f$search("readdir.exe").nes."" then delete readdir.exe;* + - if f$search("revoutput.exe").nes."" then delete revoutput.exe;* + - if f$search("revtwoway.exe").nes."" then delete revtwoway.exe;* + - if f$search("rwarray.exe").nes."" then delete rwarray.exe;* + - if f$search("testext.exe").nes."" then delete testext.exe;* + - if f$search("time.exe").nes."" then delete time.exe;* + - if f$search("gawk_verb.cld").nes."" then delete gawk_verb.cld;* - if f$search("gawk.dvi").nes."" then delete gawk.dvi;* - - if f$search("[.doc]texindex.exe").nes."" then delete [.doc]texindex.exe;* + - if f$search("[.doc]texindex.exe").nes."" then \ + delete [.doc]texindex.exe;* + - if f$search("[.cxx_repository]*.*;").nes."" then \ + delete [.cxx_repository]*.*;* # # Note: this only works if you kept a copy of [.support]texindex.c @@ -258,7 +388,8 @@ gawk.dvi : [.doc]texindex.exe [.doc]gawk.texi @ write sys$output " Third (final) pass" TeX gawk.texi -@ purge - -@ delete gawk.lis;,.aux;,gawk.%%;,.cps;,.fns;,.kys;,.pgs;,.toc;,.tps;,.vrs; + -@ delete \ + gawk.lis;,.aux;,gawk.%%;,.cps;,.fns;,.kys;,.pgs;,.toc;,.tps;,.vrs; @ rename/new_vers gawk.dvi [-]*.* @ set default [-] diff --git a/vms/fcntl.h b/vms/fcntl.h deleted file mode 100644 index d975db7a..00000000 --- a/vms/fcntl.h +++ /dev/null @@ -1,10 +0,0 @@ -/* "fcntl.h" -- constants for BSD-style I/O routines (ala VAX C's <file.h>) */ -#define O_RDONLY 0 -#define O_WRONLY 1 -#define O_RDWR 2 -#define O_NDELAY 4 -#define O_NOWAIT 4 -#define O_APPEND 8 -#define O_CREAT 0x0200 -#define O_TRUNC 0x0400 -#define O_EXCL 0x0800 diff --git a/vms/gawk.hlp b/vms/gawk.hlp index 4b82e7e9..a14ad72b 100644 --- a/vms/gawk.hlp +++ b/vms/gawk.hlp @@ -1183,6 +1183,10 @@ the default is systime(); if u is present and non-zero then t is treated as a UTC value, otherwise it is considered to be local time + +5 time_logical_names + Gawk needs the SYS$TIMEZONE_RULE or TZ logical names defined or it will + output the time in the GMT timezone. 5 time_formats Formatting directives similar to the 'printf' & 'sprintf' functions (each is introduced in the format string by preceding it with a @@ -1557,9 +1561,28 @@ 4 exit The exit statement can optionally pass a final status value to the operating system. GAWK expects a UN*X-style value instead of a - VMS status value, so 0 indicates success and non-zero indicates - failure. The final exit status will be 1 (VMS success) if 0 is - used, or even (VMS non-success) if non-zero is used. + VMS status value, so 0 indicates success. A failure is indicated + by 1 and VMS will set the ERROR status. A fatal error is indicated + by 2 and VMS will set the FATAL status. All other values will will have + the SUCCESS status. The exit value is encoded to comply with VMS + coding standards and will have the C_FACILITY_NO of 0x350000 with + the constant 0xA000 added to the number shifted over by 3 bits to + make room for the severity codes. + + To extract the actual gawk exit code from the VMS status use: + unix_status = (vms_status .and. &x7f8) / 8 + + A C program that uses exec() to call gawk will get the original + UN*X-style exit value. + + Older versions of Gawk treated Unix exit code 0 as 1, A failure as + 2, and a fatal error as 4, and passed all the other numbers through. + This violated the VMS exit status coding requirements. + +4 rounding + VAX/VMS floating point uses unbiased rounding. This is different than + what portable gawk programs expect. + 3 changes Changes between version 4.0.0 and earlier versions @@ -1569,6 +1592,7 @@ General dgawk.exe does interactive debugging of awk programs pgawk.exe does comprehensive execution profiling of awk programs + pgawk.exe is not currently supplied for VMS. -d[file] and -p[file] options added -Wcompat and -Wusage options dropped; use -Wtraditional and -Whelp BEGINFILE and ENDFILE built-in rule patterns @@ -1594,6 +1618,10 @@ support for radix prefix '0' (octal) and '0x' (hexadecimal) VMS-specific + The VMS exit codes now correctly encode the gawk exit status and + the VMS severity bits are set. + Large file support is enabled on the platforms that support it. + Extended filename support is enabled on the platforms that support it. New command qualifiers: /EXTRA_COMMANDS, /PROFILE, /DUMP_VARIABLES, /OPTIMIZE, /TRADITIONAL, /SANDBOX, /NON_DECIMAL_DATA Revised qualifier: /LINT, takes optional argument list diff --git a/vms/gawk_alias_setup.com b/vms/gawk_alias_setup.com new file mode 100644 index 00000000..73f70d15 --- /dev/null +++ b/vms/gawk_alias_setup.com @@ -0,0 +1,110 @@ +$! File: gawk_alias_setup.com +$! +$! The PCSI procedure needs a helper script to set up and remove aliases. +$! +$! If p1 starts with "R" then remove instead of install. +$! +$! +$! 02-Jan-2014 J. Malmberg - Gawk Version +$! +$!=========================================================================== +$! +$ mode = "install" +$ code = f$extract(0, 1, p1) +$ if code .eqs. "R" .or. code .eqs. "r" then mode = "remove" +$! +$ arch_type = f$getsyi("ARCH_NAME") +$ arch_code = f$extract(0, 1, arch_type) +$! +$ if arch_code .nes. "V" +$ then +$ set proc/parse=extended +$ endif +$! +$! +$ call do_alias "gawk" "[bin]" +$ call do_alias "gawk" "[bin]" "awk" +$ call do_alias "gawk" "[bin]" "gawk" "[usr.bin]" +$ call do_alias "gawk" "[bin]" "awk" "[usr.bin]" +$ call do_alias "gawk.1" "[usr.share.man.man1]" "awk.1" +$! +$ exit +$!! +$! +$do_alias: subroutine +$ if mode .eqs. "install" +$ then +$ call add_alias "''p1'" "''p2'" "''p3'" "''p4'" +$ else +$ call remove_alias "''p1'" "''p2'" "''p3'" "''p4'" +$ endif +$ exit +$ENDSUBROUTINE ! do_alias +$! +$! +$! P1 is the filename, p2 is the directory prefix, +$! p3 is the alias name if different than p1 +$! p4 is the alias directory if different than p2 +$add_alias: subroutine +$ if p3 .eqs. "" then p3 = p1 +$ if p4 .eqs. "" then p4 = p2 +$ ftype = f$element(1, ".", p1) +$ if ftype .eqs. "." +$ then +$ file = "gnv$gnu:''p2'gnv$''p1'.EXE" +$ alias = "gnv$gnu:''p4'''p3'." +$ else +$ file = "gnv$gnu:''p2'''p1'" +$ alias = "gnv$gnu:''p4'''p3'" +$ endif +$ if f$search(file) .nes. "" +$ then +$ if f$search(alias) .eqs. "" +$ then +$ set file/enter='alias' 'file' +$ endif +$ alias1 = alias + "exe" +$ if (ftype .eqs. ".") .and. (f$search(alias1) .eqs. "") +$ then +$ set file/enter='alias1' 'file' +$ endif +$ endif +$ exit +$ENDSUBROUTINE ! add_alias +$! +$remove_alias: subroutine +$ if p3 .eqs. "" then p3 = p1 +$ if p4 .eqs. "" then p4 = p2 +$ ftype = f$element(1, ".", p1) +$ if ftype .eqs. "." +$ then +$ file = "gnv$gnu:''p2'''p1'.EXE" +$ alias = "gnv$gnu:''p4'''p3'." +$ else +$ file = "gnv$gnu:''p2'''p1'" +$ alias = "gnv$gnu:''p4'''p3'" +$ endif +$ file_fid = "No_file_fid" +$ if f$search(file) .nes. "" +$ then +$ fid = f$file_attributes(file, "FID") +$ if f$search(alias) .nes. "" +$ then +$ afid = f$file_attributes(alias, "FID") +$ if (afid .eqs. fid) +$ then +$ set file/remove 'alias'; +$ endif +$ endif +$ alias1 = alias + "exe" +$ if (ftype .eqs. ".") .and. (f$search(alias1) .nes. "") +$ then +$ afid = f$file_attributes(alias1, "FID") +$ if (afid .eqs. fid) +$ then +$ set file/remove 'alias1'; +$ endif +$ endif +$ endif +$ exit +$ENDSUBROUTINE ! remove_alias diff --git a/vms/gawk_build_steps.txt b/vms/gawk_build_steps.txt new file mode 100644 index 00000000..b3bb281b --- /dev/null +++ b/vms/gawk_build_steps.txt @@ -0,0 +1,220 @@ +From File: gawk_build_steps.txt + +Building GAWK on OpenVMS for use with GNV requires a current HP C compiler +and MMK. + +The HP C 7.x compilers were used for building on Alpha and Itanium. +The Compaq C 6.4 compiler is being used on VAX. + +MMK was obtained from https://github.com/endlesssoftware/mmk + +Several special things were done in this port of Gawk to VMS to make it +easier to keep it up to date with the Unix version. + +Note the GNV$ prefix is registered for the GNV project to prevent name +collisions with other products and packages. This is a VMS convention. + +The files are stored with GNV_ instead of GNV$ most open source source +code maintainers do not want to files with $ in their source repositories. + +The build procedure will copy the files to have the GNV$ names as needed. + +1. The original GNU Gawk source files are in their own directory tree which +is never written to by the build process. This directory is kept up to date +with the current official patches. See below about the how this is done +with logical names. + +2. A file vms_eco_level.h is used to set the ECO of the package. The +vms_eco_level.h needs to be set back to zero if the version or patch level +of the GNU Unix source is changed. This file is currently only used +by the kit building procedure. + +The source kits are provided in backup savesets inside of the PCSI install kit. + +Backup save sets are currently the only distribution medium that I can be +sure is installed on a target VMS system that will correctly unpack files +with extended character sets in them. You may need to adjust the ownership +of the restored files for kits on Alpha/Itanium VMS versions 8.1 and earlier. + +On VAX, the filenames will be as seen on the VAX system, typically with non +ODS-2 characters and case changes prefixed with $ characters. + +[gnv.common_src]gawk_*_original_src.bck is the original source of the +gawk kit as provided by the GNV project. +[gnv.vms_src]gawk-*_vms_src.bck, if present, has the changed files that +are used for building that are not yet in the gawk source kits +distributed by the GNU gawk project. + +These backup savesets should be restored to different directory trees on +an ODS-5 volume(s) which are referenced by concealed rooted logical names, +unless on VAX, where either an NFS or ODS-2 volume can be used. + +SRC_ROOT: is for the source files common to all platforms. This can be a + read only copy of the files from a change control repository. + + In my build environment, the TRUNK_ROOT:[gawk] is the + same directory as src_root:[gawk]. TRUNK_ROOT:[gawk] is a + checkout of the gawk repository used for the build. + +VMS_ROOT: is for the files that were changed from the repository copy of + SRC_ROOT: + + Note, you should create the VMS_ROOT: directory tree even if it is + initially empty. This is where you should put edits if you are + making changes. + + In my build environment, the source_root:[gnu_vms.gawk] is a + directory with the checked out code and vms_root:[gawk] is + a copy with any local modifications. + + The command procedure compare_gawk_source.com will report any + differences in the source_root:[gnu_vms.gawk] directory and the + vms_root:[gawk] directory. If the source_root: logical is not + defined, it will translate the logical name src_root to do the + effective of src_root:[gawk.-.-.gnu_vms.gawk] to find the + VMS specific code CVS checkout based on where the checkout for + the GNU source is expected to be. + +LCL_ROOT: is manually created to have the same base and sub-directories as + SRC_ROOT: and VMS_ROOT: This is for the architecture specific + binaries and other files created during the build. + +The logical name REF_ROOT: is optionally defined to be a logical name that +is a search list for VMS_ROOT:,SRC_ROOT: + +The logical name PRJ_ROOT: is defined to be a logical name that is a search +list for LCL_ROOT:,REF_ROOT: + +The VMS_ROOT and LCL_ROOT directory trees can be created with commands +similar to: + + $ create/dir lcl_root:[gawk]/prot=w:re + $ copy src_root:[gawk...]*.dir - + lcl_root:[gawk...]/prot=(o:rwed,w:re) + $ create/dir vms_root:[gawk]/prot=w:re + $ copy src_root:[gawk...]*.dir - + vms_root:[gawk...]/prot=(o:rwed,w:re) + +One of the ways with to protect the source from being modified is to have +the directories under src_root: owned by a user or resource where the build +username only has read access to it. + +Edit the file gawk_release_note_start.txt or other text files to reflect +any changes. + +Edit the file PCSI_GAWK_FILE_LIST.TXT if there are new files added to the +kit. These files should all be ODS-2 legal filenames and directories. + +Note that if src_root: or vms_root: are NFS mounted disks, the +step of backing up the source files will probably hang or fail. + +You need to copy the source files to VMS mounted disks and create +logical names SRC_ROOT1 and VMS_ROOT1 to work around this to to +reference local disks. Make sure src_root1:[000000] and +vms_root1:[000000] exist and can be written to. + +The command procedure compare_gawk_source can be used to check +those directories and keep them up to date. + + @[.vms]compare_gawk_source.com SRCBCK UPDATE + + This compares the reference GNU source with the backup + staging directory for it and updates with any changes. + + @[.vms]compare_gawk_source.com VMSBCK UPDATE + + This compares the VMS specific source with the backup + staging directory for it and updates with any changes. + + Leave off "UPDATE" to just check without doing any changes. + + If you are not using NFS mounted disks and do not want to have a + separate directory for staging the sources for backup make sure + that src_root1: and vms_root1: do not exist. + +The kits will be built in the directory STAGE_ROOT:[KIT], which must be +writable to the build procedure. + +Define the logical name GNV_PCSI_PRODUCER to indicate who is making the +distribution. + +Define the logical name GNV_PCSI_PRODUCER_FULL_NAME to be your full name +or full name of your company. + +These two GNV_PCSI_* logical names need to be manually defined to indicate +the "branding" to differentiate the source of the kit. + +A limitation of the PCSI kitting procedure is that when selecting files, it +tends to ignore the directory structure and assumes that all files with the +same name are the same file, so every file placed in the kit must have a +unique ODS-2 legal name. Then a procedure needs to be added to the kit to +create an alias link on install and remove the link on remove. + +While newer versions of PCSI can support ODS-5 filenames, not all verions +of PCSI on systems that have ODS-5 filenames do. So as a post install step, +the PCSI kit built by these steps does a rename to the correct case. + +With these search lists set up and the logical names described, Gawk can +be built and kitted by setting your default to PRJ_ROOT:[gawk] +and then issuing the command: + + $ @[.vms]pcsi_product_gawk.com + +First it will build the binaries by using MMK utility. The case of the +parameter may be significant on ODS-5. + + $ mmk/descrip=[.vms]descrip.mms gawk + +Then for Alpha and Itanium, it will build the dynamic extensions. + + $ mmk/descrip=[.vms]descrip.mms extensions + +To clean up after a build to start over, run mmk with the target spotless. + + $ mmk/descrip=[.vms]descrip.mms spotless + +The files are installed into a NEW_GNU directory for staging by running the +procedure stage_gawk_install.com. This copies the binaries and creates +alias links to them. + + $ @[.vms]stage_gawk_install.com remove + $ @[.vms]stage_gawk_install.com + +On the VAX platform, the staged files are needed for building the PCSI +kit, as the VAX source was staged on an NFS volume, which encodes the +filenames that have any upper case or special symbols in them. + +To remove the staged files, the procedure is run again with the parameter +"REMOVE". This makes sure that the alias links are removed. + +The names and contents of the PCSI files requires that the version of +gawk be encoded in a special format. This is done by: + + @[.vms]make_pcsi_gawk_kit_name.com + +The release notes are built from the release note start, readme files and +this file: + + @[.release]build_gawk_release_notes.com + +Then the backup the source kits. + +Building a PCSI kit for an architecture takes the following steps after +making sure that you have a working build environment. + +On VAX, the product command always prompts to the terminal for a confirmation. + +If there is another kit for this same version of gawk, but for a different +base platform or operating system version, the product command will prompt +to the terminal to select which one to compress. + + The following message is normal: + %PCSI-I-CANNOTVAL, cannot validate + EAGLE$DQA0:[stage_root.][kit]GNV-AXPVMS-GAWK-V--1.PCSI;1 + -PCSI-I-NOTSIGNED, product kit is not signed and therefore has + no manifest file + +This will result in both compressed and uncompressed kits for the target +platform. + +Good Luck. diff --git a/vms/gawk_ident.com b/vms/gawk_ident.com new file mode 100644 index 00000000..5b3966f9 --- /dev/null +++ b/vms/gawk_ident.com @@ -0,0 +1,21 @@ +$! gawk_ident.com - Append ident with version to gawk. +$! +$! +$ open/read cfgh config.h +$cfgh_loop: +$ read/end=cfgh_loop_end cfgh line_in +$ key1 = f$element(0, " ", line_in) +$ if key1 .nes. "#define" then goto cfgh_loop +$ key2 = f$element(1, " ", line_in) +$ if key2 .nes. "VERSION" then goto cfgh_loop +$ version_string = f$element(2, " ", line_in) - """" - """" +$ ver_major = f$element(0, ".", version_string) +$ ver_minor = f$element(1, ".", version_string) +$ REL = ver_major + "." + ver_minor +$ PATCHLVL = f$element(2, ".", version_string) +$cfgh_loop_end: +$ close cfgh +$! +$ open/append Fopt gawk.opt +$ write Fopt "identification=""V''REL'.''PATCHLVL'""" +$ close Fopt diff --git a/vms/gawk_plugin.opt b/vms/gawk_plugin.opt new file mode 100644 index 00000000..b0523d08 --- /dev/null +++ b/vms/gawk_plugin.opt @@ -0,0 +1,5 @@ +CASE_SENSITIVE=YES +SYMBOL_VECTOR=(plugin_is_GPL_compatible=DATA) +SYMBOL_VECTOR=(PLUGIN_IS_GPL_COMPATIBLE/plugin_is_GPL_compatible=DATA) +SYMBOL_VECTOR=(dl_load=PROCEDURE) +SYMBOL_VECTOR=(DL_LOAD/dl_load=PROCEDURE) diff --git a/vms/gawk_release_note_start.txt b/vms/gawk_release_note_start.txt new file mode 100644 index 00000000..44fceaf5 --- /dev/null +++ b/vms/gawk_release_note_start.txt @@ -0,0 +1,189 @@ +From file: gawk_release_note_start.com + +This is GNU gawk packaged for VMS. + +The original readme files for GAWK for standalone building on VMS are +supplied here along with a procedure for building GAWK for the making +a PCSI kit. + +Note: I am a hobbyist and am not providing any support or any commitment +to supply bug fixes or future releases. This code is as-is with no +warrantees. + +The testing of this port of Gawk involved running some self tests that +were provided with the source. + +This version of gawk supports dynamically loaded extensions on Alpha and +Itanium versions of VMS. The pre-built dynamically loaded extensions +are in gnv$gnu:[usr.lib.gawk]. + +The linker option file used to build a dynamically loaded extension is +located in gnv$gnu:[usr.src.gawk.extension.vms], and the gawkapi.h file +is in gnv$gnu:[usr.include]. + +Special installation notes: + +* Please see https://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/ + for the latest information on installing GNV related PCSI kits. + +* We are updating and replacing GNV one kit at a time and transitioning + GNV to be a set of kits that the GNV package will install. During + this transition some extra issues will need to be handled during + installs and upgrades. + +* Due to the way that PCSI identifies packages, if you install a package + from one producer and then want to upgrade it from another producer, + you will probably need to uninstall the previous package first. + + Some of these packages were previously created with different producer + prefixes. We are standardizing on VMSPORTS and GNV as the branding + prefixes. GNV will be for packages that are part of the GNV product + suite, and VMSPORTS will be for most other packages. + + This uninstall can cause warning messages about dependencies. If you + are transitioning to an upwardly compatible package, you can ignore + those warnings. + +* This package should be installed to the same volume as GNV is installed. + + If you uninstall or upgrade GNV or install a GNV from before the + transition is complete, you will need to reinstall all other packages + that install to the same GNV directory tree. + + This is because at least some of the existing GNV installation procedures + have bugs in them were instead of just deleting the files that were + installed, they delete all files in the GNV directory tree. + +* Because this is a transition, this package is replacing files from the + old GNV packages. This is a necessary issue to allow incremental + improvement as we can not replace the GNV package until we get all + the component packages done. + +* The GNV 2.x through at least the 3.0.1 kits make an unusual change + to the disk directory structure where they are installed where + they use the [vms$common.gnv] as a mount point and mount the posix + root on it. This is a bug because it causes many problems and does + not offer any advantages. One of the problems is that it causes + problems with other PCSI installs and uninstalls to that directory. + + This bug can be manually repaired such as has been done on + on encompasserve.org as documented in PORTING_TO_VMS notes conference. + + At this time, we do not have a scripted repair to this bug, and it + may not be possible to fully script a repair because this bug can + cause the POSIX root and [vms$common.gnv] to have different contents + when they should be the same directory, and it will take a manual + inspection to select which files go where. + +* Because of the directory change bug, the gnv$startup.com in the GNV + kit must be run when the system boots up or the [vms$common.gnv] + directory will appear to be empty. + + If a PCSI kit like this one is installed when the GNV startup has not + been run, it will create a new directory tree under [vms$common.gnv] + that will not be visible to the posix root. If you uninstall this + PCSI kit before running the gnv$startup.com procedure then you can + install it after running the gnv$startup.com procedure. If you have + run the gnv$startup.com procedure after the install, then you have + a mess, and you will need to use the GNV umnt to un-mount the + [vms$common.gnv] directory before the uninstall of this kit will + work. + +An analyze/disk/repair step on the installation disk should be done after +installation to collect files left over from incomplete deletions into the +SYSLOST directory. This step should be done on a "quiet" system per HP +recomendations. + +Bugs can be logged at the tracker with https://sourceforge.net/projects/gnv/. +There is no guarantee that bugs will be fixed for a hobbyist build. + +VMS specific port information: + +The logical name GNV$GNU is used to find the simulated posix root and defines +the logical name SYS$POSIX_ROOT in the process table in user mode for child +processes if needed. This is to comply with VMS logical name conventions. +The logical name BIN is also set in the process table in user mode to be +GNV$GNU:[BIN] if it is not already set. + +The following DECC$Feature settings are in in effect for Gawk by default: + +DECC$ACL_ACCESS_CHECK enabled. +DECC$ALLOW_REMOVE_OPEN_FILES enabled. +DECC$ARGV_PARSE_STYLE enabled. +DECC$EFS_CASE_PRESERVE enabled. +DECC$EFS_CHARSET enabled. +DECC$EFS_FILE_TIMESTAMPS enabled. +DECC$ENABLE_GETENV_CACHE enabled. +DECC$EXEC_FILEATTR_INHERITANCE set to 2. +DECC$FILE_PERMISSION_UNIX enabled. +DECC$FILE_SHARING enabled. +DECC$FILE_OWNER_UNIX enabled. +DECC$FILENAME_REPORT_UNIX enabled. +DECC$FILENAME_UNIX_NO_VERSION enabled. +DECC$GLOB_UNIX_STYLE enabled. +DECC$POSIX_SEEK_STREAM_FILE enabled. +DECC$READDIR_DROPDOTNOTYPE enabled. +DECC$RENAME_NO_INHERIT enabled. +DECC$STDIO_CTX_EOL enabled. +DECC$STRTOL_ERANGE enabled. +DECC$UNIX_PATH_BEFORE_LOGNAME enabled. + +While more strict UNIX compatibility feature settings can be applied by users +by setting feature logical names, these settings are all the Bash and most +ported programs need. + +This port of Gawk uses the VMS CRTL to handle the Unix format pathnames +and as such is dependent on them. It is a known issue that directories with +a Unix name "file.dir/" and some symbolic links are not handled correctly. +This is a combination of problems with RMS and CRTL. The RMS portion is +fixed with the VMS84?_RMS-V0300 ECO kit. I am not aware of a CRTL kit that +fixes the issues. + +This kit is designed to be used with the GNV Bash 4.2.45 or later kit. + +Fixes and enhancements: + +* No logical names required for proper Gawk operations other than GNV$GNU + for locating the simulated "/". + +* GNV$GNU is used to find the posix root and locally sets SYS$POSIX_ROOT + for child processes if needed. This is to comply with VMS logical + name conventions. The logical name BIN is also set locally to be + GNV$GNU:[BIN] if it is not already set. + +* config.h now generated at part of the build from a template. + +The supplied GNV$GAWK_STARTUP.COM procedure is provided in +[VMS$COMMON.SYS$STARTUP] can be put in your VMS startup procedure to install +selected images as known because they need privileges. It is recommended +that the GNV$STARTUP.COM procedure be run first, followed by the +GNV$BASH_STARTUP.COM procedure before the GNV$GAWK_STARTUP.COM is +executed. + +The names of the gawk image have been prefixed with GNV$ to prevent +possible naming conflicts with other programs that are on the system. The +GNV$ prefix has been registered with HP for this purpose. + +OpenVMS specific building and kitting instructions are after the standard +bash readme file below. + +The source kits contains files for building Gawk using MMK. +MMK 4.0 was used for this build on Alpha and Itanium Itanium. + +Currently, the focus of the OpenVMS GNV porting team is to address bugs in +the OpenVMS port of GNV components that pose immediate barriers to running +configure and make scripts for Open Source Software packages targeting +OpenVMS environments. + +The GNV development team is involved in an ongoing effort to identify and +document the underlying technical causes for these current limitations and (if +available) workarounds as well as developing code fixes to eliminate them. The +VMS-Ports Source Forge project at https://sourceforge.net/p/vms-ports/tickets/ +currently documents OpenVMS CRTL bugs and limitations with respect to porting +Open Source Software using OpenVMS. The VMS-Ports Source Forge Project also +contains examples of ported packages provided by volunteer contributors as well +as documentation with recommendations on how to setup, modify and use the +OpenVMS GNV environment for the purpose of porting Open Source software +packages to OpenVMS. Browse to https://sourceforge.net/p/vms-ports/wiki/Home/ +for more information. + diff --git a/vms/gawk_verb.com b/vms/gawk_verb.com new file mode 100644 index 00000000..b74c49ed --- /dev/null +++ b/vms/gawk_verb.com @@ -0,0 +1,26 @@ +$! gawk_verb.com - build the gawk_verb.cld from the gawk.cld. +$! +$! The CLD file needed to modify a DCL command table is different +$! from the CLD file needed to build the product by specifying an image. +$! +$! So read in the [.vms]gawk.cld and generate a gawk_verb.cld. +$! +$! 23-Dec-2012 - J. Malmberg +$! +$outfile = "sys$disk:[]gawk_verb.cld" +$infile = "[.vms]gawk.cld" +$open/read cld 'infile' +$create 'outfile' +$open/append cldv 'outfile' +$loop: +$read cld/end=loop_end line_in +$if f$locate("image gawk", line_in) .lt. f$length(line_in) +$then +$ write cldv " image gnv$gnu:[bin]gnv$gawk" +$ goto loop +$endif +$write cldv line_in +$goto loop +$loop_end: +$close cldv +$close cld diff --git a/vms/gawkmisc.vms b/vms/gawkmisc.vms index cbc59cd7..725cf669 100644 --- a/vms/gawkmisc.vms +++ b/vms/gawkmisc.vms @@ -3,7 +3,8 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991-1996, 2003, 2011 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991-1996, 2003, 2011, 2014 + * the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Progamming Language. @@ -23,30 +24,441 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdio.h> +#include <string.h> +#include <ctype.h> +#include <stdlib.h> + +#include <descrip.h> +#include <dvidef.h> +#include <efndef.h> +#include <fscndef.h> +#include <stsdef.h> +#include <time.h> +#include <lnmdef.h> + + +#pragma member_alignment save +#pragma nomember_alignment longword +struct item_list_3 { + unsigned short len; + unsigned short code; + void * bufadr; + unsigned short * retlen; +}; + +struct filescan_itmlst_2 { + unsigned short length; + unsigned short itmcode; + char * component; +}; + +#pragma member_alignment + +int SYS$GETDVIW( + unsigned long efn, + unsigned short chan, + const struct dsc$descriptor_s * devnam, + const struct item_list_3 * itmlst, + void * iosb, + void (* astadr)(unsigned long), + unsigned long astprm, + void * nullarg); + +int SYS$FILESCAN( + const struct dsc$descriptor_s * srcstr, + struct filescan_itmlst_2 * valuelist, + unsigned long * fldflags, + struct dsc$descriptor_s *auxout, + unsigned short * retlen); + +int SYS$TRNLNM( + const unsigned long * attr, + const struct dsc$descriptor_s * table_dsc, + struct dsc$descriptor_s * name_dsc, + const unsigned char * acmode, + const struct item_list_3 * item_list); + char quote = '\''; char *defpath = DEFPATH; char *deflibpath = DEFLIBPATH; char envsep = ','; +#define VMS_NAME_LEN 255 +static char vms_name[VMS_NAME_LEN+1]; + +/* Take all the fun out of simply looking up a logical name */ +static int sys_trnlnm + (const char * logname, + char * value, + int value_len) +{ + const $DESCRIPTOR(table_dsc, "LNM$FILE_DEV"); + const unsigned long attr = LNM$M_CASE_BLIND; + struct dsc$descriptor_s name_dsc; + int status; + unsigned short result; + struct item_list_3 itlst[2]; + + itlst[0].len = value_len; + itlst[0].code = LNM$_STRING; + itlst[0].bufadr = value; + itlst[0].retlen = &result; + + itlst[1].len = 0; + itlst[1].code = 0; + + name_dsc.dsc$w_length = strlen(logname); + name_dsc.dsc$a_pointer = (char *)logname; + name_dsc.dsc$b_dtype = DSC$K_DTYPE_T; + name_dsc.dsc$b_class = DSC$K_CLASS_S; + + status = SYS$TRNLNM(&attr, &table_dsc, &name_dsc, 0, itlst); + + if ($VMS_STATUS_SUCCESS(status)) { + + /* Null terminate and return the string */ + value[result] = '\0'; + } + + return status; +} + /* gawk_name --- pull out the "gawk" part from how the OS called us */ +/* You would not think that this should be a such a problem, but + * VMS extended file specifications are tricky to parse, and we have + * to tell the difference between a CRTL generated argv[0] and a + * passed exec() argv[0] and handle both cases. + */ + char * gawk_name(filespec) const char *filespec; { - char *p, *q; + int status; + int result; + char * shell; + int lcname = 0; + + /* If the path name starts with a /, then it is an absolute path + * that may have been generated by the CRTL instead of the command + * name. If it is the device name between the slashes, then this + * was likely from the run command and needs to be fixed up. + * If the DECC$POSIX_COMPLIANT_PATHNAMES is set to 2, then it is + * the DISK$VOLUME that will be present, and it will still need to + * be fixed. + */ + + result = 0; + if (filespec[0] == '/') { + char * nextslash; + int length; + struct item_list_3 itemlist[3]; + unsigned short dvi_iosb[4]; + char alldevnam[64]; + unsigned short alldevnam_len; + struct dsc$descriptor_s devname_dsc; + char diskvolnam[256]; + unsigned short diskvolnam_len; + + /* Get some information about the disk */ + /*--------------------------------------*/ + itemlist[0].len = (sizeof alldevnam) - 1; + itemlist[0].code = DVI$_ALLDEVNAM; + itemlist[0].bufadr = alldevnam; + itemlist[0].retlen = &alldevnam_len; + itemlist[1].len = (sizeof diskvolnam) - 1 - 5; + itemlist[1].code = DVI$_VOLNAM; + itemlist[1].bufadr = &diskvolnam[5]; + itemlist[1].retlen = &diskvolnam_len; + itemlist[2].len = 0; + itemlist[2].code = 0; + + /* Add the prefix for the volume name. */ + /* SYS$GETDVI will append the volume name to this */ + strcpy(diskvolnam,"DISK$"); + + nextslash = strchr(&filespec[1], '/'); + if (nextslash != NULL) { + length = nextslash - filespec - 1; + + /* DECC requires a cast here */ + devname_dsc.dsc$a_pointer = (char *)&filespec[1]; + devname_dsc.dsc$w_length = length; + devname_dsc.dsc$b_dtype = DSC$K_DTYPE_T; + devname_dsc.dsc$b_class = DSC$K_CLASS_S; + + status = SYS$GETDVIW( + EFN$C_ENF, + 0, + &devname_dsc, + itemlist, + dvi_iosb, + NULL, 0, 0); + if (!$VMS_STATUS_SUCCESS(status)) { + /* If the sys$getdviw fails, then this path + * was passed by an exec() program and not + * from DCL, so do nothing. + * An example is "/tmp/program" where tmp: + * does not exist + */ + result = 0; + } else if (!$VMS_STATUS_SUCCESS(dvi_iosb[0])) { + result = 0; + } else { + char * devnam; + int devnam_len; + char argv_dev[64]; + + /* Null terminate the returned alldevnam */ + alldevnam[alldevnam_len] = 0; + devnam = alldevnam; + devnam_len = alldevnam_len; + + /* Need to skip past any leading underscore */ + if (devnam[0] == '_') { + devnam++; + devnam_len--; + } + + /* And remove the trailing colon */ + if (devnam[devnam_len - 1] == ':') { + devnam_len--; + devnam[devnam_len] = 0; + } + + /* Null terminate the returned volnam */ + diskvolnam_len += 5; + diskvolnam[diskvolnam_len] = 0; + + /* Check first for normal CRTL behavior */ + if (devnam_len == length) { + strncpy(vms_name, &filespec[1], length); + vms_name[length] = 0; + result = (strcasecmp(devnam, vms_name) == 0); + } + + /* If we have not got a match check for + * POSIX Compliant behavior. To be more + * accurate, we could also check to see + * if that feature is active. + */ + if ((result == 0) && + (diskvolnam_len == length)) { + int cmp; + strncpy(vms_name, &filespec[1], length); + vms_name[length] = 0; + cmp = strcasecmp(diskvolnam, vms_name); + result = (cmp == 0); + } + } + } + } else { + /* The path did not start with a slash, so it could be VMS + * format. If it is vms format, it has a volume/device in + * it as it must be an absolute path + */ + struct dsc$descriptor_s path_desc; + int status; + unsigned long field_flags; + struct filescan_itmlst_2 item_list[5]; + char * volume; + char * name; + int name_len; + char * ext; + + /* DECC requires a cast here */ + path_desc.dsc$a_pointer = (char *)filespec; + path_desc.dsc$w_length = strlen(filespec); + path_desc.dsc$b_dtype = DSC$K_DTYPE_T; + path_desc.dsc$b_class = DSC$K_CLASS_S; + + /* Don't actually need to initialize anything buf itmcode */ + /* I just do not like uninitialized input values */ + + /* Sanity check, this must be the same length as input */ + item_list[0].itmcode = FSCN$_FILESPEC; + item_list[0].length = 0; + item_list[0].component = NULL; + + /* If the device is present, then it if a VMS spec */ + item_list[1].itmcode = FSCN$_DEVICE; + item_list[1].length = 0; + item_list[1].component = NULL; + + /* we need the program name and type */ + item_list[2].itmcode = FSCN$_NAME; + item_list[2].length = 0; + item_list[2].component = NULL; + + item_list[3].itmcode = FSCN$_TYPE; + item_list[3].length = 0; + item_list[3].component = NULL; + + /* End the list */ + item_list[4].itmcode = 0; + item_list[4].length = 0; + item_list[4].component = NULL; + + status = SYS$FILESCAN( + (const struct dsc$descriptor_s *)&path_desc, + item_list, &field_flags, NULL, NULL); + + if ($VMS_STATUS_SUCCESS(status) && + (item_list[0].length == path_desc.dsc$w_length) && + (item_list[1].length != 0)) { + + char * dollar; + int keep_ext; + int i; + + /* We need the filescan to be successful, + * same length as input, and a volume to be present. + * + * We will assume that we only get to this path on + * a version of VMS that does not support the EFS + * character set. + * + * There may be a xxx$ prefix on the image name. + * Linux programs do not handle that well, so + * strip the prefix. + */ + name = item_list[2].component; + name_len = item_list[2].length; + dollar = strrchr(name, '$'); + if (dollar != NULL) { + dollar++; + name_len = name_len - (dollar - name); + name = dollar; + } + + strncpy(vms_name, name, name_len); + vms_name[name_len] = 0; + result = 1; + + /* We only keep the extension if it is not ".exe" */ + keep_ext = 0; + ext = item_list[3].component; + + if (item_list[3].length != 1) { + if (item_list[3].length != 4) { + keep_ext = 1; + } else { + int x; + x = strncmp(ext, ".exe", 4); + if (x != 0) { + keep_ext = 1; + } + } + } + + if (keep_ext == 1) { + strncpy(&vms_name[name_len], + ext, item_list[3].length); + } + } + } - /* "device:[root.][directory.subdir]GAWK.EXE;n" -> "GAWK" */ - p = strrchr(filespec, ']'); /* directory punctuation */ - q = strrchr(filespec, '>'); /* alternate <international> punct */ + if (result) { + char * lastslash; + char * dollar; + char * dotexe; + char * lastdot; + char * extension; + + /* This means it is probably the name from a DCL command + * Find the last slash which separates the file from the + * path. + */ + lastslash = strrchr(filespec, '/'); + + if (lastslash != NULL) { + int i; + + lastslash++; + + /* There may be a xxx$ prefix on the image name. */ + /* Linux programs do not handle that well, so */ + /* strip the prefix */ + dollar = strrchr(lastslash, '$'); + + if (dollar != NULL) { + dollar++; + lastslash = dollar; + } + + strcpy(vms_name, lastslash); + + /* In UNIX mode + EFS character set, there should + * not be a version present, as it is not possible + * when parsing to tell if it is a version or part + * of the UNIX filename as UNIX programs use numeric + * extensions for many reasons. + */ + + lastdot = strrchr(vms_name, '.'); + if (lastdot != NULL) { + int i; + + i = 1; + while (isdigit(lastdot[i])) { + i++; + } + if (lastdot[i] == 0) { + *lastdot = 0; + } + } + + /* Find the .exe on the name (case insenstive) + * and toss it + */ + dotexe = strrchr(vms_name, '.'); + if (dotexe != NULL) { + if ((dotexe[1] == 'e' || dotexe[1] == 'E') && + (dotexe[2] == 'x' || dotexe[2] == 'X') && + (dotexe[3] == 'e' || dotexe[3] == 'E') && + (dotexe[4] == 0)) { + + *dotexe = 0; + } else { + /* Also need to handle a null + * extension because of a CRTL bug. + */ + if (dotexe[1] == 0) { + *dotexe = 0; + } + } + } + } + } else { + /* No changes needed */ + strncpy(vms_name, filespec, VMS_NAME_LEN); + vms_name[VMS_NAME_LEN] = 0; + } - if (p == NULL || q > p) - p = q; - p = strdup(p == NULL ? filespec : (p + 1)); - if ((q = strrchr(p, '.')) != NULL) - *q = '\0'; /* strip .typ;vers */ - return p; + /* + * The above fixes up the name, but for the DCL shell + * may leave it in upper case, which messes up the self tests. + * force it to lower case here. + */ + shell = getenv("SHELL"); + if (shell != NULL) { + if (strcmp(shell, "DCL") == 0) { + lcname = 1; + } + } else { + lcname = 1; + } + if (lcname == 1) { + int i = 0; + while (vms_name[i] != 0) { + vms_name[i] = tolower(vms_name[i]); + i++; + } + } + return vms_name; } /* os_arg_fixup --- fixup the command line */ @@ -56,7 +468,24 @@ os_arg_fixup(argcp, argvp) int *argcp; char ***argvp; { + char *tz_rule; + int status; + (void) vms_arg_fixup(argcp, argvp); + + /* Fix up the time zone */ + /* For some reason it gets trashed */ + tz_rule = malloc(1024); + status = sys_trnlnm("TZ", tz_rule, 1024); + if ($VMS_STATUS_SUCCESS(status)) { + setenv("TZ", tz_rule, 1); + } else { + status = sys_trnlnm("SYS$TIMEZONE_RULE", tz_rule, 1024); + if ($VMS_STATUS_SUCCESS(status)) { + setenv("TZ", tz_rule, 1); + } + } + free(tz_rule); } /* os_devopen --- open special per-OS devices */ @@ -208,11 +637,17 @@ files_are_same(char *newfile, SRCFILE *oldfile) f2 = &oldfile->sbuf; /* compare device string */ +#ifdef _USE_STD_STAT + return (f1->st_dev == f2->st_dev + /* and 48-bit file id cookie */ + && f1->st_ino == f2->st_ino); + #else return (strcmp(f1->st_dev, f2->st_dev) == 0 /* and 48-bit file id cookie stored in 3 short ints */ && f1->st_ino[0] == f2->st_ino[0] && f1->st_ino[1] == f2->st_ino[1] && f1->st_ino[2] == f2->st_ino[2]); +#endif } int diff --git a/vms/generate_config_vms_h_gawk.com b/vms/generate_config_vms_h_gawk.com new file mode 100644 index 00000000..3a02fdfe --- /dev/null +++ b/vms/generate_config_vms_h_gawk.com @@ -0,0 +1,286 @@ +$! File: GENERATE_CONFIG_H_VMS_GAWK.COM +$! +$! Gawk like most open source products uses a variant of a config.h file. +$! Depending on the curl version, this could be config.h or curl_config.h. +$! +$! For GNV based builds, the configure script is run and that produces +$! a [curl_]config.h file. Configure scripts on VMS generally do not +$! know how to do everything, so there is also a [-.lib]config-vms.h file +$! that has VMS specific code that compensates for bugs in some of the +$! VMS shared images. +$! +$! This generates a []config.h file and also a config_vms.h file, +$! which is used to supplement that file. +$! +$! +$! Copyright 2013, John Malmberg +$! +$! Permission to use, copy, modify, and/or distribute this software for any +$! purpose with or without fee is hereby granted, provided that the above +$! copyright notice and this permission notice appear in all copies. +$! +$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +$! +$! +$! 28-Nov-2013 J. Malmberg +$! +$!========================================================================= +$! +$! Allow arguments to be grouped together with comma or separated by spaces +$! Do no know if we will need more than 8. +$ args = "," + p1 + "," + p2 + "," + p3 + "," + p4 + "," +$ args = args + p5 + "," + p6 + "," + p7 + "," + p8 + "," +$! +$! Provide lower case version to simplify parsing. +$ args_lower = f$edit(args, "LOWERCASE") +$! +$ args_len = f$length(args) +$! +$ if (f$getsyi("HW_MODEL") .lt. 1024) +$ then +$ arch_name = "VAX" +$ else +$ arch_name = "" +$ arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE") +$ if (arch_name .eqs. "") then arch_name = "UNK" +$ endif +$! +$! +$! Start the configuration file. +$! Need to do a create and then an append to make the file have the +$! typical file attributes of a VMS text file. +$ create sys$disk:[]config_vms.h +$ open/append cvh sys$disk:[]config_vms.h +$! +$! Write the defines to prevent multiple includes. +$! These are probably not needed in this case, +$! but are best practice to put on all header files. +$ write cvh "#ifndef __CONFIG_VMS_H__" +$ write cvh "#define __CONFIG_VMS_H__" +$ write cvh "" +$! +$ write cvh "#if __CRTL_VER >= 70000000" +$ write cvh "#define VMS_V7" +$ write cvh "#else" +$ write cvh "#define HAVE_TZNAME 1 /* (faked in vms/vms_misc.c) */ +$ write cvh "#define HAVE_TZSET 1 /* (faked in vms/vms_misc.c) */ +$ write cvh "#endif" +$ write cvh "#if __CRTL_VER >= 70200000" +$ write cvh "#define DYNAMIC 1" +$ write cvh "#endif" +$ write cvh "" +$ write cvh "#define PRINTF_HAS_F_FORMAT 1" +$ write cvh "" +$ write cvh "/* The _Noreturn keyword of C11. */" +$ write cvh "#ifndef _Noreturn" +$ write cvh "# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \" +$ write cvh " || 0x5110 <= __SUNPRO_C)" +$ write cvh "# define _Noreturn __attribute__ ((__noreturn__))" +$ write cvh "# elif defined _MSC_VER && 1200 <= _MSC_VER" +$ write cvh "# define _Noreturn __declspec (noreturn)" +$ write cvh "# else" +$ write cvh "# define _Noreturn" +$ write cvh "# endif" +$ write cvh "#endif" +$ write cvh "" +$ write cvh "/*" +$ write cvh " * VAXCRTL is pre-ANSI and does some variations of numeric" +$ write cvh " * formatting differently than gawk expects." +$ write cvh " */" +$ write cvh "#if defined(VAX) && !defined(__DECC)" +$ write cvh - + "/* '0' format modifier for %e,%f,%g gives wrong results in many cases */" +$ write cvh "#define VAXCRTL" +$ write cvh "/* %g format chooses %e format when should use %f */" +$ write cvh "#define GFMT_WORKAROUND 1" +$ write cvh "#endif" +$ write cvh "" +$ write cvh "/*" +$ write cvh " * VAX C" +$ write cvh " *" +$ write cvh - + " * As of V3.2, VAX C is not yet ANSI-compliant. But it's close enough" +$ write cvh - + " * for GAWK's purposes. Comment this out for VAX C V2.4 and earlier." +$ write cvh - + " * YYDEBUG definition is needed for combination of VAX C V2.x and Bison." +$ write cvh " */" +$ write cvh "#if defined(VAXC) && !defined(__STDC__)" +$ write cvh "#define __STDC__ 0" +$ write cvh "#define NO_TOKEN_PASTING" +$ write cvh "#define signed /*empty*/" +$ write cvh "#define inline /*empty*/" +$ write cvh "#ifndef __DECC /* DEC C does not support #pragma builtins */" +$ write cvh "#define VAXC_BUILTINS" +$ write cvh "#endif" +$ write cvh "/* #define YYDEBUG 0 */" +$ write cvh - + "#define NO_MBSUPPORT /* VAX C's preprocessor can't handle mbsupport.h */" +$ write cvh "#endif" +$ write cvh "" +$ write cvh "" +$ write cvh "#if __DECC_VER >= 60400000 && !defined(DEBUG)" +$ write cvh "/* disable ""new feature in C99"" diagnostics (for regex code); " +$ write cvh " NEWC99 ought to suffice but doesn't (at least in V6.4) */" +$ write cvh "#pragma message disable (NEWC99,DESIGNATORUSE)" +$ write cvh "#ifdef __VAX +$ write cvh "#endif +$ write cvh "#pragma message disable (LONGDOUBLENYI)" +$ write cvh "#endif" +$! +$! This stuff seems needed for VMS 7.3 and earlier, but not VMS 8.2+ +$! Need some more data as to which versions these issues are fixed in. +$ write cvh "#if __VMS_VER <= 80200000" +$! mkstemp goes into an infinte loop in gawk in VAX/VMS 7.3 +$ write cvh "#ifdef HAVE_MKSTEMP" +$ write cvh "#undef HAVE_MKSTEMP" +$ write cvh "#endif" +$ write cvh "#endif" +$ write cvh "" +$! +$! VMS not legal for ANSI compiler to pre-define +$ write cvh "#ifndef VMS" +$ write cvh "#define VMS 1" +$ write cvh "#endif" +$ write cvh "" +$! +$! Need to temp hide stuff that gawk is replacing or redefining before +$! including the header. +$ write cvh "/* Need to hide some stuff */" +$ write cvh "#define getopt hide_getopt" +$ write cvh "#define optopt hide_optopt" +$ write cvh "#define optind hide_optind" +$ write cvh "#define optarg hide_optarg" +$ write cvh "#define opterr hide_opterr" +$ write cvh "#define getpgrp hide_getpgrp" +$ write cvh "#define unsetenv hide_unsetenv" +$ write cvh "#define read hide_read" +$ write cvh "#define delete hide_delete" +$ write cvh "#define getcwd hide_getcwd" +$ write cvh "#define getgid hide_getgid" +$ write cvh "#define getegid hide_getegid" +$ write cvh "#define setgid hide_setgid" +$ write cvh "#define exit hide_exit" +$ write cvh "#define _exit hide__exit" +$ write cvh "#include <unistd.h>" +$ write cvh "#include <stdlib.h>" +$ write cvh "#include <stdio.h>" +$ write cvh "#include <time.h>" +$ write cvh "#include <stsdef.h>" +$ write cvh "#include <string.h>" +$ write cvh "#undef getopt" +$ write cvh "#undef optopt" +$ write cvh "#undef optind" +$ write cvh "#undef optarg" +$ write cvh "#undef opterr" +$ write cvh "#undef getpgrp" +$ write cvh "#undef getcwd" +$ write cvh "#undef unsetenv" +$ write cvh "#undef read" +$ write cvh "#undef delete" +$ write cvh "#undef getgid" +$ write cvh "#undef getegid" +$ write cvh "#undef setgid" +$ write cvh "#undef exit" +$ write cvh "#undef _exit" +$! +$write cvh "#ifdef HAVE_STRNCASECMP" +$write cvh "#undef HAVE_STRNCASECMP" +$write cvh "#endif" +$! +$ write cvh "#define IN_CONFIG_H" +$ write cvh "#include ""redirect.h""" +$ write cvh "#undef IN_CONFIG_H" +$ write cvh "#define getpgrp gawk_vms_getpgrp" +$ write cvh "#ifdef HAVE_SETENV" +$ write cvh "#undef HAVE_SETENV" +$ write cvh "#endif" +$ write cvh "#ifdef HAVE_UNSETENV" +$ write cvh "#undef HAVE_UNSETENV" +$ write cvh "#endif" +$ write cvh "#ifdef HAVE_STRFTIME" +$ write cvh "#undef HAVE_STRFTIME" +$ write cvh "#define USE_INCLUDED_STRFTIME" +$ write cvh "#endif /* HAVE_STRFTIME */" +$ write cvh "" +$ write cvh "#include <bitypes.h>" +$ write cvh "#define INT32_MAX __INT32_MAX" +$ write cvh "#define INT32_MIN __INT32_MIN" +$ write cvh "" +$ write cvh "/*" +$ write cvh " * DEFPATH" +$ write cvh " * VMS: ""/AWK_LIBRARY"" => ""AWK_LIBRARY:""" +$ write cvh " * The default search path for the -f option of gawk. It is" +$ write cvh " * used if the AWKPATH environment variable is undefined." +$ write cvh " *" +$ write cvh " * Note: OK even if no AWK_LIBRARY logical name has been defined." +$ write cvh " */" +$ write cvh "" +$ write cvh "#define DEFPATH "".,/AWK_LIBRARY""" +$ write cvh "#define DEFLIBPATH "".,/AWK_LIBRARY""" +$ write cvh "#define ENVSEP ','" +$ write cvh "" +$ write cvh "/*" +$ write cvh " * Extended source file access." +$ write cvh " */" +$ write cvh "#define DEFAULT_FILETYPE "".awk""" +$ write cvh "" +$ write cvh "/*" +$ write cvh " * fork/Pipe handling." +$ write cvh " */" +$ write cvh "#define PIPES_SIMULATED 1" +$ write cvh "" +$ write cvh "/* Extension for shared libraries */" +$ write cvh "#define SHLIBEXT ""exe""" +$ write cvh "" +$! GAWK does not want to use ALLOCA +$ write cvh "#define NO_ALLOCA" +$ write cvh "#define STACK_DIRECTION (-1)" +$ write cvh "" +$ write cvh "void decc$exit(int status);" +$ write cvh "#define _exit(foo) vms_exit(foo)" +$ write cvh "#define exit(foo) vms_exit(foo)" +$ write cvh "" +$ write cvh "/* Use POSIX exit codes here */" +$ write cvh "#ifdef EXIT_FAILURE" +$ write cvh "#undef EXIT_FAILURE" +$ write cvh "#endif" +$ write cvh "#define EXIT_FAILURE (1)" +$ write cvh "" +$ write cvh "#define EXIT_FATAL (2)" +$ write cvh "" +$ write cvh "#ifndef C_FACILITY_NO" +$ write cvh "#define C_FACILITY_NO 0x350000" +$ write cvh "#endif" +$ write cvh "" +$ write cvh "/* Build a Posix Exit with VMS severity */ +$ write cvh "static void vms_exit(int status) {" +$ write cvh " int vms_status;" +$ write cvh " /* Fake the __posix_exit with severity added */" +$ write cvh " /* Undocumented correct way to do this. */" +$ write cvh " vms_status = C_FACILITY_NO | 0xA000 | STS$M_INHIB_MSG;" +$ write cvh " vms_status |= (status << 3);" +$ write cvh " if (status == EXIT_FAILURE) {" +$ write cvh " vms_status |= STS$K_ERROR;" +$ write cvh " } else if (status == EXIT_FATAL) {" +$ write cvh " vms_status |= STS$K_SEVERE;" +$ write cvh " } else {" +$ write cvh " vms_status |= STS$K_SUCCESS;" +$ write cvh " }" +$ write cvh " decc$exit(vms_status);" +$ write cvh "}" +$! +$! Close out the file +$! +$ write cvh "" +$ write cvh "#endif /* __CONFIG_VMS_H__ */" +$ close cvh +$! +$all_exit: +$ exit diff --git a/vms/gnv_gawk_startup.com b/vms/gnv_gawk_startup.com new file mode 100644 index 00000000..e691965e --- /dev/null +++ b/vms/gnv_gawk_startup.com @@ -0,0 +1,75 @@ +$! File: gnv$gawk_Startup.com / gnv_gawk_startup.com +$! +$! Procedure to setup the GAWK images for use by programs from the +$! VMS SYSTARTUP*.COM procedure. +$! +$! 14-Mar-2011 J. Malmberg +$! 04-May-2011 J. Malmberg Use GNV_PCSI_DESTINATION to find the +$! value to assing GNV$GNU per suggestion +$! by Martin Vorlander. +$! 02-Jan-2014 J. Malmberg Gawk Version +$!======================================================================== +$! +$! +$! GNV$GNU if needed. +$ if f$trnlnm("GNV$GNU") .eqs. "" +$ then +$ x = f$trnlnm("GNU","LNM$SYSTEM_TABLE") +$ if x .nes. "" +$ then +$ write sys$output - + "Notice: logical name GNU: was found in the system table instead of GNV$GNU:" +$ write sys$output - + "This is a known bug in the GNV 2.1.3 and earlier kits." +$ define/system/exec/trans=conc GNV$GNU 'x' +$ else +$! +$! File name per VMS standards +$! --------------------------- +$ file1 = "sys$startup:gnv$destination_''f$getsyi("ARCH_NAME")'.com" +$! +$! File name in GNV 2.1.3 +$! ---------------------- +$ file2 = "sys$startup:gnv_destination_''f$getsyi("ARCH_NAME")'.com" +$! +$! File name before GNV 2.1.3 +$! --------------------------- +$ file3 = "sys$startup:gnv_destination''f$getsyi("ARCH_NAME")'.com" +$ arch_file = "" +$ if f$search(file1) .nes. "" +$ then +$ arch_file = file1 +$ else +$ if f$search(file2) .nes. "" +$ then +$ arch_file = file2 +$ else +$ if f$search("file3") .nes. "" then arch_file = file3 +$ endif +$ endif +$ if (arch_file) .nes. "" then @'arch_file' +$! +$! Logical name per VMS standards +$! ------------------------------- +$ destination = f$trnlnm("GNV$PCSI_DESTINATION") +$! +$! Logical name in GNV 2.1.3 +$! -------------------------- +$ if destination .eqs. "" +$ then +$ destination = f$trnlnm("GNV_PCSI_DESTINATION") +$ endif +$ if destination .eqs. "" +$ then +$ !Assume this procedure is on the same volume as the GNV install. +$ my_proc = f$environment("PROCEDURE") +$ my_dev = f$parse(my_proc,,,"DEVICE","NO_CONCEAL") +$ destination = "''my_dev'[vms$common.gnv.]" +$ endif +$ define/system/exec/trans=conc gnv$gnu 'destination' +$ endif +$ endif +$! +$! +$all_exit: +$ exit diff --git a/vms/make_pcsi_gawk_kit_name.com b/vms/make_pcsi_gawk_kit_name.com new file mode 100644 index 00000000..daaa37a4 --- /dev/null +++ b/vms/make_pcsi_gawk_kit_name.com @@ -0,0 +1,189 @@ +$! File: MAKE_PCSI_GAWK_KIT_NAME.COM +$! +$! Calculates the PCSI kit name for use in building an installation kit. +$! PCSI is HP's PolyCenter Software Installation Utility. +$! +$! The results are stored in as logical names so that other procedures +$! can use them. +$! +$! 92-Jan-2014 J. Malmberg Gawk version +$!======================================================================== +$! +$! Save default +$default_dir = f$environment("DEFAULT") +$! +$! Put things back on error. +$on warning then goto all_exit +$! +$! The producer is the name or common abbreviation for the entity that is +$! making the kit. It must be set as a logical name before running this +$! procedure. +$! +$! HP documents the producer as the legal owner of the software, but for +$! open source work, it should document who is creating the package for +$! distribution. +$! +$producer = f$trnlnm("GNV_PCSI_PRODUCER") +$if producer .eqs. "" +$then +$ write sys$output "The logical name GNV_PCSI_PRODUCER needs to be defined." +$ write sys$output "This should be set to the common abbreviation or name of" +$ write sys$output "the entity creating this kit. If you are an individual" +$ write sys$output "then use your initials as long as they do not match" +$ write sys$output "a different well known producer prefix." +$ goto all_exit +$endif +$producer_full_name = f$trnlnm("GNV_PCSI_PRODUCER_FULL_NAME") +$if producer_full_name .eqs. "" +$then +$ write sys$output "The logical name GNV_PCSI_PRODUCER_FULL_NAME needs to" +$ write sys$output "be defined. This should be set to the full name of" +$ write sys$output "the entity creating this kit. If you are an individual" +$ write sys$output "then use your name." +$ write sys$output "EX: DEFINE GNV_PCSI_PRODUCER_FULL_NAME ""First M. Last""" +$ goto all_exit +$endif +$! +$write sys$output "*****" +$write sys$output "***** Producer = ''producer'" +$write sys$output "*****" +$! +$! +$! Base is one of 'VMS', 'AXPVMS', 'I64VMS', 'VAXVMS' and indicates what +$! binaries are in the kit. A kit with just 'VMS' can be installed on all +$! architectures. +$! +$base = "VMS" +$arch_type = f$getsyi("ARCH_NAME") +$code = f$extract(0, 1, arch_type) +$if (code .eqs. "I") then base = "I64VMS" +$if (code .eqs. "V") then base = "VAXVMS" +$if (code .eqs. "A") then base = "AXPVMS" +$! +$! +$product = "gawk" +$! +$! +$! We need to get the version from config.h. It will have a lines like +$! #define PACKAGE_VERSION "4.1.0a" +$! +$! +$open/read/error=version_loop_end verf config.h +$version_loop: +$ read/end=version_loop_end verf line_in +$ if line_in .eqs. "" then goto version_loop +$ if f$locate("#define PACKAGE_VERSION", line_in) .ne. 0 +$ then +$ goto version_loop +$ endif +$ tag = f$element(1, " ", line_in) +$ value = f$element(2, " ", line_in) - """" - """" +$ if tag .eqs. "PACKAGE_VERSION" +$ then +$ distversion = value +$ goto version_loop_end +$ endif +$ goto version_loop +$version_loop_end: +$close verf +$! +$! +$! Optional ECO file. +$ECO_LEVEL = "" +$vms_eco_file = "[.vms]vms_eco_level.h" +$if f$search(vms_eco_file) .nes. "" +$then +$ open/read ef 'vms_eco_file' +$ecolevel_loop: +$ read/end=ecolevel_loop_end ef line_in +$ prefix = f$element(0, " ", line_in) +$ if prefix .nes. "#define" then goto ecolevel_loop +$ key = f$element(1, " ", line_in) +$ value = f$element(2, " ", line_in) - """" - """" +$ if key .eqs. "VMS_ECO_LEVEL" +$ then +$ ECO_LEVEL = value +$ if ECO_LEVEL .eq. 0 +$ then +$ ECO_LEVEL = "" +$ else +$ ECO_LEVEL = "E" + ECO_LEVEL +$ endif +$ goto ecolevel_loop_end +$ endif +$ goto ecolevel_loop +$ecolevel_loop_end: +$ close ef +$endif +$! +$raw_version = distversion +$! +$! +$! This translates to V0114-08 or D0115-01 +$! We can not encode the snapshot date into the version due to the way that +$! the Polycenter Software Installation Utility evaluates the name. +$! +$! version_type = 'V' for a production release, and 'D' for a build from a +$! daily repository snapshot, and a code for a build from a pre-release branch +$majorver = f$element(0, ".", raw_version) +$minorver = f$element(1, ".", raw_version) +$update = f$element(2,".", raw_version) +$if update .eqs. "." then update = "" +$vtype = "V" +$if update .nes. "" +$then +$ update_len = f$length(update) +$ code = f$extract(update_len - 1, 1, update) +$ code = f$edit(code, "UPCASE") +$ if (code .ges. "A") .and. (code .les. "Z") +$ then +$ update = f$extract(0, update_len - 1, update) +$ vtype = code +$ endif +$endif +$if update .eqs. "0" then update = "" +$! +$! +$version_fao = "!2ZB!2ZB" +$mmversion = f$fao(version_fao, 'majorver', 'minorver') +$version = vtype + "''mmversion'" +$if update .nes. "" .or. ECO_LEVEL .nes. "" +$then +$! The presence of an ECO implies an update +$ if update .eqs. "" .and. ECO_LEVEL .nes. "" then update = "0" +$ version = version + "-" + update + ECO_LEVEL +$ fversion = version +$else +$ fversion = version +$ version = version + "-" +$endif +$! +$! Kit type 1 is complete kit, the only type that this procedure will make. +$Kittype = 1 +$! +$! Write out a logical name for the resulting base kit name. +$name = "''producer'-''base'-''product'-''version'-''kittype'" +$define GNV_PCSI_KITNAME "''name'" +$fname = "''product'-''fversion'" +$! +$! No ECO or Patch level +$fname_len = f$length(fname) +$if f$extract(fname_len - 1, 1, fname) .eqs. "-" +$then +$ fname = f$extract(0, fname_len - 1, fname) +$ fname_len = fname_len - 1 +$endif +$if f$extract(fname_len - 1, 1, fname) .eqs. "-" +$then +$ fname = f$extract(0, fname_len - 1, fname) +$ fname_len = fname_len - 1 +$endif +$define GNV_PCSI_FILENAME_BASE 'fname' +$write sys$output "*****" +$write sys$output "***** GNV_PCSI_KITNAME = ''name'." +$write sys$output "***** GNV_PCSI_FILENAME_BASE = ''fname'." +$write sys$output "*****" +$! +$all_exit: +$set def 'default_dir' +$exit '$status' diff --git a/vms/pcsi_gawk_file_list.txt b/vms/pcsi_gawk_file_list.txt new file mode 100644 index 00000000..67d2d324 --- /dev/null +++ b/vms/pcsi_gawk_file_list.txt @@ -0,0 +1,120 @@ +! File: pcsi_gawk_file_list.txt +! +! File list for building a PCSI kit. +! Very simple format so that the parsing logic can be simple. +! links first, directory second, and files third. +! +! link -> file tells procedure to create/remove a link on install/uninstall +! If more than one link, consider using an alias file. +! +! [xxx.yyy]foo.dir is a directory file for the rename phase. +! [xxx.yyy.foo] is a directory file for the create phase. +! Each subdirectory needs to be on its own pair of lines. +! +! [xxx.yyy]file.ext is a file for the rename and add phases. +! +! 14-Mar-2011 J. Malmberg +! 08-Dec-2013 J. Malmberg This list is based on what was found on +! some Linux systems and what can be currently +! built on VMS. +! +!============================================================================ +![gnv.bin]awk. -> [gnv.bin]gnv$gawk.exe +![gnv.bin]awk.exe -> [gnv.bin]gnv$gawk.exe +![gnv.bin]gawk. -> [gnv.bin]gnv$gawk.exe +![gnv.bin]gawk.exe -> [gnv.bin]gnv$gawk.exe +![gnv.usr.bin]awk. -> [gnv.bin]gnv$gawk.exe +![gnv.usr.bin]awk.exe -> [gnv.bin]gnv$gawk.exe +![gnv.usr.bin]gawk. -> [gnv.bin]gnv$gawk.exe +![gnv.usr.bin]gawk.exe -> [gnv.bin]gnv$gawk.exe +![gnv.usr.share.man.man1]awk.1 -> [gnv.usr.share.man.man1]gawk.1 +[gnv] +[000000]gnv.dir +[gnv.bin] +[gnv]bin.dir +[gnv.vms_bin] +[gnv]vms_bin.dir +[gnv.vms_help] +[gnv]vms_help.dir +[gnv.lib] +[gnv]lib.dir +[gnv.usr] +[gnv]usr.dir +[gnv.usr.bin] +[gnv.usr]bin.dir +[gnv.usr.include] +[gnv.usr]include.dir +[gnv.usr.lib] +[gnv.usr]lib.dir +[gnv.usr.lib.gawk] +[gnv.usr.lib]gawk.dir +[gnv.usr.share] +[gnv.usr]share.dir +[gnv.usr.share.awk] +[gnv.usr.share]awk.dir +[gnv.usr.share.doc] +[gnv.usr.share]doc.dir +[gnv.usr.share.doc.gawk] +[gnv.usr.share.doc]gawk.dir +[gnv.usr.share.info] +[gnv.usr.share]info.dir +[gnv.usr.share.man] +[gnv.usr.share]man.dir +[gnv.usr.share.man.man1] +[gnv.usr.share.man]man1.dir +![gnv.usr.share.man.man7] +![gnv.usr.share.man]man7.dir +[gnv.usr]src.dir +[gnv.usr.src] +[gnv.usr.src]gawk.dir +[gnv.usr.src.gawk]extension.dir +[gnv.usr.src.gawk.extension] +[gnv.usr.src.gawk.extension]vms.dir +[gnv.usr.src.gawk.extension.vms] +[gnv.bin]gnv$gawk.exe +[gnv.bin]igawk. +[gnv.vms_bin]remove_old_gawk.com +[gnv.vms_bin]gawk_alias_setup.com +[gnv.vms_bin]gawk_verb.cld +[gnv.vms_help]gawk.hlp +[gnv.usr.include]gawkapi.h +[gnv.usr.lib.gawk]filefuncs.exe +[gnv.usr.lib.gawk]fnmatch.exe +[gnv.usr.lib.gawk]inplace.exe +[gnv.usr.lib.gawk]ordchr.exe +[gnv.usr.lib.gawk]readdir.exe +[gnv.usr.lib.gawk]revoutput.exe +[gnv.usr.lib.gawk]revtwoway.exe +[gnv.usr.lib.gawk]rwarray.exe +[gnv.usr.lib.gawk]time.exe +[gnv.usr.share.awk]assert.awk +[gnv.usr.share.awk]bits2str.awk +[gnv.usr.share.awk]cliff_rand.awk +[gnv.usr.share.awk]ctime.awk +[gnv.usr.share.awk]ftrans.awk +[gnv.usr.share.awk]getopt.awk +[gnv.usr.share.awk]gettime.awk +[gnv.usr.share.awk]join.awk +[gnv.usr.share.awk]libintl.awk +[gnv.usr.share.awk]noassign.awk +[gnv.usr.share.awk]ord.awk +[gnv.usr.share.awk]readable.awk +[gnv.usr.share.awk]readfile.awk +[gnv.usr.share.awk]rewind.awk +[gnv.usr.share.awk]round.awk +[gnv.usr.share.awk]strtonum.awk +[gnv.usr.share.awk]walkarray.awk +[gnv.usr.share.awk]zerofile.awk +[gnv.usr.share.doc.gawk]COPYING. +[gnv.usr.share.doc.gawk]NEWS. +[gnv.usr.share.doc.gawk]POSIX.STD +[gnv.usr.share.doc.gawk]README. +[gnv.usr.share.doc.gawk]README.vms +[gnv.usr.share.doc.gawk]README.multibyte +[gnv.usr.share.doc.gawk]README.tests +[gnv.usr.share.info]gawk.info +[gnv.usr.share.info]gawkinet.info +[gnv.usr.share.man.man1]gawk.1 +[gnv.usr.share.man.man1]igawk.1 +![gnv.usr.share.man.man7] +[gnv.usr.src.gawk.extension.vms]gawk_plugin.opt diff --git a/vms/pcsi_product_gawk.com b/vms/pcsi_product_gawk.com new file mode 100644 index 00000000..b0d9febd --- /dev/null +++ b/vms/pcsi_product_gawk.com @@ -0,0 +1,187 @@ +$! File: pcsi_product_gawk.com +$! +$! This command file packages up the product GAWK into a sequential +$! format kit +$! +$! 13-Dec-2013 J.Malmberg +$! +$!========================================================================= +$! +$! Save default +$ default_dir = f$environment("DEFAULT") +$! +$! Put things back on error. +$ on warning then goto all_exit +$! +$ arch_type = f$getsyi("ARCH_NAME") +$ arch_code = f$extract(0, 1, arch_type) +$! +$ can_build = 1 +$ producer = f$trnlnm("GNV_PCSI_PRODUCER") +$ if producer .eqs. "" +$ then +$ write sys$output "GNV_PCSI_PRODUCER logical name has not been set." +$ can_build = 0 +$ endif +$ producer_full_name = f$trnlnm("GNV_PCSI_PRODUCER_FULL_NAME") +$ if producer_full_name .eqs. "" +$ then +$ write sys$output - + "GNV_PCSI_PRODUCER_FULL_NAME logical name has not been set." +$ can_build = 0 +$ endif +$ stage_root_name = f$trnlnm("STAGE_ROOT") +$ if stage_root_name .eqs. "" +$ then +$ write sys$output "STAGE_ROOT logical name has not been set." +$ can_build = 0 +$ endif +$! +$ if (can_build .eq. 0) +$ then +$ write sys$output "Not able to build a kit." +$ goto all_exit +$ endif +$! +$! +$! Build the gawk image(s) +$!------------------------- +$ if f$search("gawk.exe") .eqs. "" +$ then +$ mmk/descrip=[.vms]descrip.mms gawk +$ endif +$ if arch_code .nes. "V" +$ then +$ if f$search("filefuncs.exe") .eqs. "" +$ then +$ mmk/descrip=[.vms]descrip.mms extensions +$ endif +$ endif +$! +$! Build the gawk_verb.cld +$!------------------------- +$ if f$search("gawk_verb.cld") .eqs. "" +$ then +$ @[.vms]gawk_verb.com +$ endif +$! +$! Stage the images for building the kit +$!-------------------------------------- +$ @[.vms]stage_gawk_install.com remove +$ @[.vms]stage_gawk_install.com +$! +$! +$! +$! Make sure that the kit name is up to date for this build +$!---------------------------------------------------------- +$ @[.vms]make_pcsi_gawk_kit_name.com +$! +$! Make sure that the release note file name is up to date +$!--------------------------------------------------------- +$ @[.vms]build_gawk_release_notes.com +$! +$! +$! Make sure that the source has been backed up. +$!---------------------------------------------- +$ @[.vms]backup_gawk_src.com +$! +$! Regenerate the PCSI description file. +$!-------------------------------------- +$ @[.vms]build_gawk_pcsi_desc.com +$! +$! Regenerate the PCSI Text file. +$!--------------------------------- +$ @[.vms]build_gawk_pcsi_text.com +$! +$! +$! Parse the kit name into components. +$!--------------------------------------- +$ kit_name = f$trnlnm("GNV_PCSI_KITNAME") +$ if kit_name .eqs. "" +$ then +$ write sys$output "@[.vms]make_pcsi_gawk_kit_name.com has not been run." +$ goto all_exit +$ endif +$ producer = f$element(0, "-", kit_name) +$ base = f$element(1, "-", kit_name) +$ product_name = f$element(2, "-", kit_name) +$ mmversion = f$element(3, "-", kit_name) +$ majorver = f$extract(0, 3, mmversion) +$ minorver = f$extract(3, 2, mmversion) +$ updatepatch = f$element(4, "-", kit_name) +$ if updatepatch .eqs. "" then updatepatch = "" +$! +$ version_fao = "!AS.!AS" +$ mmversion = f$fao(version_fao, "''majorver'", "''minorver'") +$ if updatepatch .nes. "" +$ then +$ version = "''mmversion'" + "-" + updatepatch +$ else +$ version = "''mmversion'" +$ endif +$! +$! +$! Move to the base directories +$ current_default = f$environment("DEFAULT") +$ my_dir = f$parse(current_default,,,"DIRECTORY") - "[" - "<" - ">" - "]" +$! +$! +$ source = "''default_dir'" +$ src1 = "new_gnu:[bin]," +$ src2 = "new_gnu:[usr.bin]," +$ src3 = "new_gnu:[vms_bin]," +$ src4 = "new_gnu:[vms_help]," +$ src5 = "new_gnu:[vms_src]," +$ src6 = "new_gnu:[common_src]," +$ src7 = "sys$disk:[''my_dir'],sys$disk:[''my_dir'.vms]," +$ src8 = "new_gnu:[usr.share.awk]," +$ src9 = "new_gnu:[usr.share.man.man1]," +$ src10 = "new_gnu:[usr.share.doc.gawk]," +$ src11 = "new_gnu:[usr.share.info]," +$ src12 = "sys$disk:[''m_dir'.pc.awklib]" +$ gnu_src = src1 + src2 + src3 + src4 + src5 + src6 + src7 + src8 + src9 +$ gnu_src = gnu_src + src10 + src11 + src12 +$! +$! +$ base = "" +$ arch_name = f$edit(f$getsyi("arch_name"),"UPCASE") +$ if arch_name .eqs. "ALPHA" then base = "AXPVMS" +$ if arch_name .eqs. "IA64" then base = "I64VMS" +$ if arch_name .eqs. "VAX" then base = "VAXVMS" +$! +$ if base .eqs. "" then exit 44 +$! +$ pcsi_option = "/option=noconfirm" +$ if arch_code .eqs. "V" +$ then +$ pcsi_option = "" +$ endif +$! +$! +$product package 'product_name' - + /base='base' - + /producer='producer' - + /source='source' - + /destination=STAGE_ROOT:[KIT] - + /material=('gnu_src','source') - + /format=sequential 'pcsi_option' +$! +$! +$! VAX can not do a compressed kit. +$! ZIP -9 "-V" does a better job, so no reason to normally build a compressed +$! kit. +$!---------------------------------- +$if p1 .eqs. "COMPRESSED" +$then +$ if arch_code .nes. "V" +$ then +$ product copy /options=(novalidate, noconfirm) /format=compressed - + 'product_name' - + /source=stage_root:[kit]/dest=stage_root:[kit] - + /version='version'/base='base' +$ endif +$endif +$! +$all_exit: +$ set def 'default_dir' +$ exit diff --git a/vms/remove_old_gawk.com b/vms/remove_old_gawk.com new file mode 100644 index 00000000..ed68fc45 --- /dev/null +++ b/vms/remove_old_gawk.com @@ -0,0 +1,113 @@ +$! File: remove_old_gawk.com +$! +$! This is a procedure to remove the old gawk images that were installed +$! by the GNV kits and replace them with links to the new image. +$! +$! 02-Jan-2014 J. Malmberg Gawk version +$! +$!========================================================================== +$! +$vax = f$getsyi("HW_MODEL") .lt. 1024 +$old_parse = "" +$if .not. VAX +$then +$ old_parse = f$getjpi("", "parse_style_perm") +$ set process/parse=extended +$endif +$! +$old_cutils = "gawk,awk," +$! +$! +$ i = 0 +$cutils_loop: +$ file = f$element(i, ",", old_cutils) +$ if file .eqs. "" then goto cutils_loop_end +$ if file .eqs. "," then goto cutils_loop_end +$ call update_old_image 'file' +$ i = i + 1 +$ goto cutils_loop +$cutils_loop_end: +$! +$! +$if .not. VAX +$then +$ file = "gnv$gnu:[usr.share.man.cat1]awk^.1.gz" +$ if f$search(file) .nes. "" then delete 'file';* +$ file = "gnv$gnu:[usr.share.man.cat1]gawk^.1.gz" +$ if f$search(file) .nes. "" then delete 'file';* +$ file = "gnv$gnu:[usr.share.man.cat1]iawk^.1.gz" +$ if f$search(file) .nes. "" then delete 'file';* +$endif +$! +$! +$if .not. VAX +$then +$ set process/parse='old_parse' +$endif +$! +$all_exit: +$ exit +$! +$! Remove old image or update it if needed. +$!------------------------------------------- +$update_old_image: subroutine +$! +$ file = p1 +$! First get the FID of the new gawk image. +$! Don't remove anything that matches it. +$ new_gawk = f$search("GNV$GNU:[BIN]GNV$''file'.EXE") +$! +$ new_gawk_fid = "No_new_gawk_fid" +$ if new_gawk .nes. "" +$ then +$ new_gawk_fid = f$file_attributes(new_gawk, "FID") +$ endif +$! +$! +$! +$! Now get check the "''file'." and "''file'.exe" +$! May be links or copies. +$! Ok to delete and replace. +$! +$! +$ old_gawk_fid = "No_old_gawk_fid" +$ old_gawk = f$search("gnv$gnu:[bin]''file'.") +$ old_gawk_exe_fid = "No_old_gawk_fid" +$ old_gawk_exe = f$search("gnv$gnu:[bin]''file'.exe") +$ if old_gawk_exe .nes. "" +$ then +$ old_gawk_exe_fid = f$file_attributes(old_gawk_exe, "FID") +$ endif +$! +$ if old_gawk .nes. "" +$ then +$ fid = f$file_attributes(old_gawk, "FID") +$ if fid .nes. new_gawk_fid +$ then +$ if fid .eqs. old_gawk_exe_fid +$ then +$ set file/remove 'old_gawk' +$ else +$ delete 'old_gawk' +$ endif +$ if new_gawk .nes. "" +$ then +$ set file/enter='old_gawk' 'new_gawk' +$ endif +$ endif +$ endif +$! +$ if old_gawk_exe .nes. "" +$ then +$ if old_gawk_fid .nes. new_gawk_fid +$ then +$ delete 'old_gawk_exe' +$ if new_gawk .nes. "" +$ then +$ set file/enter='old_gawk_exe' 'new_gawk' +$ endif +$ endif +$ endif +$! +$ exit +$ENDSUBROUTINE ! Update old image diff --git a/vms/stage_gawk_install.com b/vms/stage_gawk_install.com new file mode 100644 index 00000000..22daf7f5 --- /dev/null +++ b/vms/stage_gawk_install.com @@ -0,0 +1,300 @@ +$! File: stage_gawk_install.com +$! +$! Stages the build products to new_gnu:[...] for testing and for building +$! a kit. +$! +$! If p1 starts with "R" then remove instead of install. +$! +$! The file PCSI_GAWK_FILE_LIST.TXT is read in to get the files other +$! than the release notes file and the source backup file. +$! +$! The PCSI system can really only handle ODS-2 format filenames and +$! assumes that there is only one source directory. It also assumes that +$! all destination files with the same name come from the same source file. +$! +$! +$! 29-Sep-2013 J. Malmberg +$! +$!=========================================================================== +$! +$ arch_type = f$getsyi("ARCH_NAME") +$ arch_code = f$extract(0, 1, arch_type) +$! +$ mode = "install" +$ code = f$extract(0, 1, p1) +$ if code .eqs. "R" .or. code .eqs. "r" then mode = "remove" +$! +$! First create the directories +$!-------------------------------- +$ if mode .eqs. "install" +$ then +$ create/dir new_gnu:[bin]/prot=o:rwed +$ create/dir new_gnu:[vms_bin]/prot=o:rwed +$ create/dir new_gnu:[vms_help]/prot=o:rwed +$ create/dir new_gnu:[lib]/prot=o:rwed +$ create/dir new_gnu:[usr.bin]/prot=o:rwed +$ create/dir new_gnu:[usr.include]/prot=o:rwed +$ create/dir new_gnu:[usr.lib.gawk]/prot=o:rwed +$ create/dir new_gnu:[usr.share.awk]/prot=o:rwed +$ create/dir new_gnu:[usr.share.doc.gawk]/prot=o:rwed +$ create/dir new_gnu:[usr.share.info]/prot=o:rwed +$ create/dir new_gnu:[usr.src.gawk.extension.vms]/prot=o:rwed +$ create/dir new_gnu:[usr.share.doc.man.man1]/prot=o:rwed +$ endif +$! +$ if mode .eqs. "install" +$ then +$ copy [.vms]gnv_gawk_startup.com - + new_gnu:[vms_bin]gnv$gawk_startup.com +$ else +$ file = "new_gnu:[vms_bin]gnv$gawk_startup.com" +$ if f$search(file) .nes. "" then delete 'file';* +$ endif +$! +$! +$! Read through the file list to set up aliases and rename commands. +$!--------------------------------------------------------------------- +$ open/read flst [.vms]pcsi_gawk_file_list.txt +$! +$inst_alias_loop: +$ ! Skip the aliases +$ read/end=inst_file_loop_end flst line_in +$ line_in = f$edit(line_in,"compress,trim,uncomment") +$ if line_in .eqs. "" then goto inst_alias_loop +$ pathname = f$element(0, " ", line_in) +$ linkflag = f$element(1, " ", line_in) +$ if linkflag .nes. "->" then goto inst_alias_done +$ goto inst_alias_loop +$! +$inst_file_loop: +$! +$ read/end=inst_file_loop_end flst line_in +$ line_in = f$edit(line_in,"compress,trim,uncomment") +$ if line_in .eqs. "" then goto inst_file_loop +$! +$inst_alias_done: +$! +$! +$! Skip the directories as we did them above. +$! Just process the files. +$ tdir = f$parse(line_in,,,"DIRECTORY") +$ tdir_len = f$length(tdir) +$ tname = f$parse(line_in,,,"NAME") +$ lctname = f$edit(tname, "LOWERCASE") +$ ttype = f$parse(line_in,,,"TYPE") +$ if arch_code .eqs. "V" +$ then +$ tname = lctname +$ ttype = f$edit(ttype, "LOWERCASE") +$ tdir = f$edit(tdir, "LOWERCASE") +$ endif +$ if tname .eqs. "" then goto inst_file_loop +$ if ttype .eqs. ".dir" then goto inst_file_loop +$! +$! if p1 starts with "R" then remove instead of install. +$! +$! If gnv$xxx.exe, then: +$! Source is []gnv$gawk.exe +$! Destination1 is new_gnu:[bin]gnv$gawk.exe +$! Destination2 is new_gnu:[bin]xxx. (alias) +$! Destination2 is new_gnu:[bin]xxx.exe (alias) +$! We put all in new_gnu:[bin] instead of some in [usr.bin] because +$! older GNV kits incorrectly put some images in [bin] and [bin] +$! comes first in the search list. +$ if f$locate("gnv$", tname) .eq. 0 +$ then +$ myfile_len = f$length(tname) +$ myfile = f$extract(4, myfile_len, tname) +$ source = "[]''myfile'''ttype'" +$ dest1 = "new_gnu:[bin]''tname'''ttype'" +$ dest2 = "new_gnu:[bin]''myfile'." +$ dest3 = "new_gnu:[bin]''myfile'.exe" +$ if mode .eqs. "install" +$ then +$ if f$search(dest1) .eqs. "" then copy 'source' 'dest1' +$ if f$search(dest2) .eqs. "" then set file/enter='dest2' 'dest1' +$ if f$search(dest3) .eqs. "" then set file/enter='dest3' 'dest1' +$ else +$ if f$search(dest2) .nes. "" then set file/remove 'dest2';* +$ if f$search(dest3) .nes. "" then set file/remove 'dest3';* +$ if f$search(dest1) .nes. "" then delete 'dest1';* +$ endif +$ goto inst_file_loop +$ endif +$! +$! If lib.gawk] then +$! source is sys$disk:[] +$! dest is new_gnu:[usr.lib.gawk] +$ if f$locate("lib.gawk]", tdir) .lt. tdir_len +$ then +$! ! Not yet available on VAX/VMS +$ if arch_code .eqs. "V" then goto inst_file_loop +$! +$ source = "[]''tname'''ttype'" +$ dest = "new_gnu:[usr.lib.gawk]''tname'''ttype'" +$ if mode .eqs. "install" +$ then +$ if f$search(dest) .eqs. "" then copy 'source' 'dest' +$ else +$ if f$search(dest) .nes. "" then delete 'dest';* +$ endif +$ goto inst_file_loop +$ endif +$! +$! If .vms_bin] then +$! source is sys$disk:[] +$! dest is [vms_bin] +$ if (f$locate("vms_bin]", tdir) .lt. tdir_len) +$ then +$ if (ttype .eqs. ".cld") +$ then +$ source = "sys$disk:[]''tname'''ttype'" +$ else +$ source = "sys$disk:[.vms]''tname'''ttype'" +$ endif +$ dest = "new_gnu:[vms_bin]''tname'''ttype'" +$ if mode .eqs. "install" +$ then +$ if f$search(dest) .eqs. "" then copy 'source' 'dest' +$ else +$ if f$search(dest) .nes. "" then delete 'dest';* +$ endif +$ goto inst_file_loop +$ endif +$! +$! If .vms_hlp] then +$! source is sys$disk:[.vms] +$! dest is [vms_help] +$ if (f$locate("vms_help]", tdir) .lt. tdir_len) .and. (ttype .eqs. ".hlp") +$ then +$ source = "sys$disk:[.vms]''tname'''ttype'" +$ dest = "new_gnu:[vms_help]''tname'''ttype'" +$ if mode .eqs. "install" +$ then +$ if f$search(dest) .eqs. "" then copy 'source' 'dest' +$ else +$ if f$search(dest) .nes. "" then delete 'dest';* +$ endif +$ goto inst_file_loop +$ endif +$! +$! If doc.gawk] then +$! source is sys$disk:[] or [.readme_d] +$! dest is [usr.share.doc.gawk] +$ if f$locate(".doc.gawk]", tdir) .lt. tdir_len +$ then +$ if lctname .eqs. "readme" .and. ttype .nes. "." +$ then +$ source = "sys$disk:[.README_D]''tname'''ttype'" +$ if f$search(source) .eqs. "" +$ then +$! ! This may be an NFS mangled name on VAX. +$ stype = ttype - "." +$ if stype .nes. "vms" then stype = "$" + stype +$ source = "sys$disk:[.$README_$D]$README.''stype'" +$ endif +$ else +$ source = "sys$disk:[]''tname'''ttype'" +$ if f$search(source) .eqs. "" +$ then +$ source = "sys$disk:[]$''tname'''ttype'" +$ endif +$ endif +$ dest = "new_gnu:[usr.share.doc.gawk]''tname'''ttype'" +$ if mode .eqs. "install" +$ then +$ if f$search(dest) .eqs. "" then copy 'source' 'dest' +$ else +$ if f$search(dest) .nes. "" then delete 'dest';* +$ endif +$ goto inst_file_loop +$ endif +$! +$! If .awk] then +$! source is sys$disk:[.awklib.eg.lib] +$! dest is new_gnu:[usr.share.awk] +$ if f$locate(".awk]", tdir) .lt. tdir_len +$ then +$ source = "[.awklib.eg.lib]''tname'''ttype'" +$ dest = "new_gnu:[usr.share.awk]''tname'''ttype'" +$ if mode .eqs. "install" +$ then +$ if f$search(dest) .eqs. "" then copy 'source' 'dest' +$ else +$ if f$search(dest) .nes. "" then delete 'dest';* +$ endif +$ goto inst_file_loop +$ endif +$! +$! If *.info then +$! source is [.doc]gawk.info +$! dest is [.usr.share.info] +$ if ttype .eqs. ".info" +$ then +$ source = "[.doc]''tname'''ttype'" +$ dest = "new_gnu:[usr.share.info]''tname'''ttype'" +$ if mode .eqs. "install" +$ then +$ if f$search(dest) .eqs. "" then copy 'source' 'dest' +$ else +$ if f$search(dest) .nes. "" then delete 'dest';* +$ endif +$ goto inst_file_loop +$ endif +$! +$! If *.h then +$! source is []*.h +$! dest is [.usr.include] +$ if ttype .eqs. ".h" +$ then +$ source = "[]''tname'''ttype'" +$ dest = "new_gnu:[usr.include]''tname'''ttype'" +$ if mode .eqs. "install" +$ then +$ if f$search(dest) .eqs. "" then copy 'source' 'dest' +$ else +$ if f$search(dest) .nes. "" then delete 'dest';* +$ endif +$ goto inst_file_loop +$ endif +$! +$! If *.opt then +$! source is [.vms]gawk_plugin.opt +$! dest is [.usr.src.gawk.extension.vms] +$ if ttype .eqs. ".opt" +$ then +$ source = "[.vms]''tname'''ttype'" +$ dest = "new_gnu:[usr.src.gawk.extension.vms]''tname'''ttype'" +$ if mode .eqs. "install" +$ then +$ if f$search(dest) .eqs. "" then copy 'source' 'dest' +$ else +$ if f$search(dest) .nes. "" then delete 'dest';* +$ endif +$ goto inst_file_loop +$ endif +$! +$! If xxx.1 then +$! source is [.doc]xxx.1 +$! dest is [usr.share.man.man1] +$ if ttype .eqs. ".1" +$ then +$ source = "[.doc]''tname'''ttype'" +$ dest = "new_gnu:[usr.share.man.man1]''tname'''ttype'" +$ if mode .eqs. "install" +$ then +$ if f$search(dest) .eqs. "" then copy 'source' 'dest' +$ else +$ if f$search(dest) .nes. "" then delete 'dest';* +$ endif +$ goto inst_file_loop +$ endif +$! +$ goto inst_file_loop +$! +$inst_file_loop_end: +$! +$close flst +$! +$all_exit: +$ exit diff --git a/vms/vax/ChangeLog b/vms/vax/ChangeLog new file mode 100644 index 00000000..526bc420 --- /dev/null +++ b/vms/vax/ChangeLog @@ -0,0 +1,7 @@ +2013-12-29 John Malmberg <wb8tyw@qsl.net> + + * ChangeLog: New directory. + * gawk_plugin_xfer.mar_exact, gawk_plugin_xfer.opt, + macro32_exactcase.com, macro32_exactcase.patch: + These are experimental files for future support of + dynamic extensions on VAX/VMS. diff --git a/vms/vax/gawk_plugin_xfer.mar_exact b/vms/vax/gawk_plugin_xfer.mar_exact new file mode 100644 index 00000000..e90babbd --- /dev/null +++ b/vms/vax/gawk_plugin_xfer.mar_exact @@ -0,0 +1,13 @@ + .PSECT GAWK_PLUGIN_XFERVECTORS - + PIC,USR,CON,REL,GBL,SHR,EXE,RD,NOWRT,QUAD + +; Exact case transfer vector and universal symbols +; + .ALIGN QUAD + .EXTERNAL plugin_is_GPL_compatible + + .TRANSFER dl_load + .MASK dl_load + JMP L^dl_load+2 + + .END diff --git a/vms/vax/gawk_plugin_xfer.opt b/vms/vax/gawk_plugin_xfer.opt new file mode 100644 index 00000000..75c134f7 --- /dev/null +++ b/vms/vax/gawk_plugin_xfer.opt @@ -0,0 +1,5 @@ +CASE_SENSITIVE=YES +UNIVERSAL=plugin_is_GPL_compatible +UNIVERSAL=dl_load +!CLUSTER=GAWK_PLUGIN_XFER +!COLLECT=GAWK_GLOBAL, GAWK_PLUGIN_XFERVECTORS diff --git a/vms/vax/macro32_exactcase.com b/vms/vax/macro32_exactcase.com new file mode 100644 index 00000000..79194e21 --- /dev/null +++ b/vms/vax/macro32_exactcase.com @@ -0,0 +1,16 @@ +$! +$! Patch the Macro32 compiler and optional assemble +$!----------------------------------------------------- +$ patched_macro = "sys$disk:[]macro32_exactcase.exe" +$ if f$search(patched_macro) .eqs. "" +$ then +$ copy sys$system:macro32.exe 'patched_macro' +$ patch @[.vms]macro32_exactcase.patch +$ endif +$! Usage: +$ xfer_file_source = p1 +$ if f$search(p1) .nes. "" +$ then +$ define/user macro32 'patched_macro' +$ macro/lis 'p1' +$ endif diff --git a/vms/vax/macro32_exactcase.patch b/vms/vax/macro32_exactcase.patch new file mode 100644 index 00000000..eda5cac7 --- /dev/null +++ b/vms/vax/macro32_exactcase.patch @@ -0,0 +1,11 @@ +macro32_exactcase.exe +SE EC +^X00000001 +RE /I +^X00012B1D +'BICB2 #^X00000020,R3' +EXIT +'BICB2 #^X00000000,R3' +EXI +U +EXI diff --git a/vms/vms-conf.h b/vms/vms-conf.h deleted file mode 100644 index 575b5de6..00000000 --- a/vms/vms-conf.h +++ /dev/null @@ -1,678 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H -/* - * config.h -- configuration definitions for gawk. - * - * For VMS (assumes V4.6 or later; tested on V7.3-1, V8.3. - */ - -/* - * Copyright (C) 1991-1992, 1995-1996, 1999, 2001-2003, 2005, 2009, 2010, 2011, - * 2012, the Free Software Foundation, Inc. - * - * This file is part of GAWK, the GNU implementation of the - * AWK Programming Language. - * - * GAWK is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * GAWK is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#if 0 /* no longer used */ -/* Define to 1 if using alloca.c. */ -#define C_ALLOCA 1 -#else -#define NO_ALLOCA /* vms/vms_fwrite.c needs this */ -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -#define STACK_DIRECTION (-1) -#endif /*0*/ - -#include <bitypes.h> -#define INT32_MAX __INT32_MAX -#define INT32_MIN __INT32_MIN - -/* dynamic loading is possible */ -#undef DYNAMIC - -/* Define to 1 if translation of program messages to the user's native - language is requested. */ -#undef ENABLE_NLS - -/* Define to the type of elements in the array set by `getgroups'. Usually - this is either `int' or `gid_t'. */ -#define GETGROUPS_T int - -/* Define to 1 if the `getpgrp' function requires zero arguments. */ -#define GETPGRP_VOID 1 - -/* Define to 1 if you have the `alarm' function. */ -#define HAVE_ALARM 1 - -/* Define to 1 if you have the <arpa/inet.h> header file. */ -#undef HAVE_ARPA_INET_H - -/* Define to 1 if you have the `atexit' function. */ -#define HAVE_ATEXIT 1 - -/* Define to 1 if you have the `btowc' function. */ -#undef HAVE_BTOWC - -/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the - CoreFoundation framework. */ -#undef HAVE_CFLOCALECOPYCURRENT - -/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in - the CoreFoundation framework. */ -#undef HAVE_CFPREFERENCESCOPYAPPVALUE - -/* Define if the GNU dcgettext() function is already present or preinstalled. - */ -#undef HAVE_DCGETTEXT - -/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. - */ -#undef HAVE_DECL_TZNAME - -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -#undef HAVE_DOPRNT - -/* Define to 1 if you have the <fcntl.h> header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the `fmod' function. */ -#define HAVE_FMOD 1 - -/* have getaddrinfo */ -#undef HAVE_GETADDRINFO - -/* Define to 1 if you have the `getgrent' function. */ -#undef HAVE_GETGRENT - -/* Define to 1 if you have the `getgroups' function. */ -#undef HAVE_GETGROUPS - -/* Define if the GNU gettext() function is already present or preinstalled. */ -#undef HAVE_GETTEXT - -/* Define to 1 if you have the `grantpt' function. */ -#undef HAVE_GRANTPT - -/* Define if you have the iconv() function. */ -#undef HAVE_ICONV - -/* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */ -#undef HAVE_INTMAX_T - -/* Define to 1 if you have the <inttypes.h> header file. */ -#undef HAVE_INTTYPES_H - -/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and - declares uintmax_t. */ -#undef HAVE_INTTYPES_H_WITH_UINTMAX - -/* Define to 1 if you have the `isascii' function. */ -#define HAVE_ISASCII 1 - -/* Define to 1 if you have the `iswctype' function. */ -#define HAVE_ISWCTYPE 1 - -/* Define to 1 if you have the `iswlower' function. */ -#define HAVE_ISWLOWER 1 - -/* Define to 1 if you have the `iswupper' function. */ -#define HAVE_ISWUPPER 1 - -/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ -#undef HAVE_LANGINFO_CODESET - -/* Define if your <locale.h> file defines LC_MESSAGES. */ -#undef HAVE_LC_MESSAGES - -/* Define to 1 if you have the <libintl.h> header file. */ -#undef HAVE_LIBINTL_H - -/* Define if you have the libsigsegv library. */ -#undef HAVE_LIBSIGSEGV - -/* Define to 1 if you have the `m' library (-lm). */ -#undef HAVE_LIBM - -/* Define to 1 if you have a fully functional readline library. */ -#undef HAVE_LIBREADLINE - -/* Define to 1 if you have the <limits.h> header file. */ -#define HAVE_LIMITS_H 1 - -/* Define to 1 if you have the <locale.h> header file. */ -#undef HAVE_LOCALE_H - -/* Define if you have the 'long long' type. */ -#undef HAVE_LONG_LONG - -/* Define to 1 if the system has the type `long long int'. */ -#undef HAVE_LONG_LONG_INT - -/* Define to 1 if you have the `mbrlen' function. */ -#define HAVE_MBRLEN 1 - -/* Define to 1 if mbrtowc and mbstate_t are properly declared. */ -#define HAVE_MBRTOWC 1 - -/* Define to 1 if you have the <mcheck.h> header file. */ -#undef HAVE_MCHECK_H - -/* Define to 1 if you have the `memcmp' function. */ -#define HAVE_MEMCMP 1 - -/* Define to 1 if you have the `memcpy' function. */ -#define HAVE_MEMCPY 1 - -/* Define to 1 if you have the `memcpy_ulong' function. */ -#undef HAVE_MEMCPY_ULONG - -/* Define to 1 if you have the `memmove' function. */ -#define HAVE_MEMMOVE 1 - -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `memset' function. */ -#define HAVE_MEMSET 1 - -/* Define to 1 if you have the `memset_ulong' function. */ -#undef HAVE_MEMSET_ULONG - -/* Define to 1 if you have the `mkstemp' function. */ -#undef HAVE_MKSTEMP - -/* we have the mktime function */ -#define HAVE_MKTIME 1 - -/* Define to 1 if you have the <netdb.h> header file. */ -#undef HAVE_NETDB_H - -/* Define to 1 if you have the <netinet/in.h> header file. */ -#undef HAVE_NETINET_IN_H - -/* we'll use the one in [.missing_d] */ -#undef HAVE_SETENV - -/* Define to 1 if you have the `setlocale' function. */ -#undef HAVE_SETLOCALE - -/* Define to 1 if you have the `setsid' function. */ -#undef HAVE_SETSID - -/* Define to 1 if you have the `snprintf' function. */ -#undef HAVE_SNPRINTF - -/* newer systems define this type here */ -#undef HAVE_SOCKADDR_STORAGE - -/* we have sockets on this system */ -#undef HAVE_SOCKETS - -/* Define to 1 if you have the <stdarg.h> header file. */ -#define HAVE_STDARG_H 1 - -/* Define to 1 if you have the <stddef.h> header file. */ -#define HAVE_STDDEF_H 1 - -/* Define to 1 if you have the <stdint.h> header file. */ -#undef HAVE_STDINT_H - -/* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares - uintmax_t. */ -#undef HAVE_STDINT_H_WITH_UINTMAX - -/* Define to 1 if you have the <stdlib.h> header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strchr' function. */ -#define HAVE_STRCHR 1 - -/* Define to 1 if you have the `strcoll' function. */ -#define HAVE_STRCOLL 1 - -/* Define to 1 if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - -/* Define to 1 if you have the `strftime' function. */ -#undef HAVE_STRFTIME /* use the missing_d/strfime.c version */ - -/* Define to 1 if cpp supports the ANSI # stringizing operator. */ -#ifdef VAXC -#undef HAVE_STRINGIZE -#else -#define HAVE_STRINGIZE 1 -#endif - -/* Define to 1 if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strncasecmp' function. */ -#undef HAVE_STRNCASECMP - -/* Define to 1 if you have the <stropts.h> header file. */ -#undef HAVE_STROPTS_H - -/* Define to 1 if you have the `strtod' function. */ -#define HAVE_STRTOD 1 - -/* Define to 1 if you have the `strtoul' function. */ -#define HAVE_STRTOUL 1 - -/* Define to 1 if `st_blksize' is a member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_BLKSIZE - -/* Define to 1 if `tm_zone' is a member of `struct tm'. */ -#undef HAVE_STRUCT_TM_TM_ZONE - -/* Define to 1 if you have the `system' function. */ -#define HAVE_SYSTEM 1 - -/* Define to 1 if you have the <sys/ioctl.h> header file. */ -#undef HAVE_SYS_IOCTL_H - -/* Define to 1 if you have the <sys/param.h> header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the <sys/socket.h> header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the <sys/time.h> header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ -#undef HAVE_SYS_WAIT_H - -/* Define to 1 if you have the <termios.h> header file. */ -#undef HAVE_TERMIOS_H - -/* Define to 1 if you have the `tmpfile' function. */ -#define HAVE_TMPFILE 1 -/* Force snprintf.c to use tmpfile() instead of mkstemp(). */ -#ifdef HAVE_MKSTEMP -#undef HAVE_MKSTEMP -#endif - -/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use - `HAVE_STRUCT_TM_TM_ZONE' instead. */ -#undef HAVE_TM_ZONE - -/* Define to 1 if you have the `towlower' function. */ -#define HAVE_TOWLOWER 1 - -/* Define to 1 if you have the `towupper' function. */ -#define HAVE_TOWUPPER 1 - -/* Define to 1 if you don't have `tm_zone' but do have the external array - `tzname'. */ -#define HAVE_TZNAME 1 /* (faked in vms/vms_misc.c) */ - -/* Define to 1 if you have the `tzset' function. */ -#define HAVE_TZSET 1 /* (faked in vms/vms_misc.c) */ - -/* Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>. */ -#undef HAVE_UINTMAX_T - -/* Define to 1 if you have the <unistd.h> header file. */ -#ifdef __DECC -#define HAVE_UNISTD_H 1 -#else -#undef HAVE_UNISTD_H -#endif - -/* Define if you have the 'unsigned long long' type. */ -#undef HAVE_UNSIGNED_LONG_LONG - -/* Define to 1 if the system has the type `unsigned long long int'. */ -#undef HAVE_UNSIGNED_LONG_LONG_INT - -/* Define to 1 if you have the `usleep' function. */ -#define HAVE_USLEEP 1 - -/* Define to 1 if you have the `vprintf' function. */ -#define HAVE_VPRINTF 1 - -/* Define to 1 if you have the <wchar.h> header file. */ -#define HAVE_WCHAR_H 1 - -/* Define to 1 if you have the `wcrtomb' function. */ -#define HAVE_WCRTOMB 1 - -/* Define to 1 if you have the `wcscoll' function. */ -#define HAVE_WCSCOLL 1 - -/* Define to 1 if you have the `wctype' function. */ -#define HAVE_WCTYPE 1 - -/* Define to 1 if you have the <wctype.h> header file. */ -#define HAVE_WCTYPE_H 1 - -/* systems should define this type here */ -#define HAVE_WCTYPE_T 1 - -/* systems should define this type here */ -#undef HAVE_WINT_T - -/* disable fatal errors on directories */ -#undef NO_DIRECTORY_FATAL - -/* disable lint checks */ -#undef NO_LINT - -/* Name of package */ -#define PACKAGE "gawk" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "bug-gawk@gnu.org" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "GNU Awk" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "GNU Awk 4.1.0" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "gawk" - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "4.1.0" - -/* Define to 1 if *printf supports %F format */ -#undef PRINTF_HAS_F_FORMAT - -/* Define as the return type of signal handlers (`int' or `void'). */ -#define RETSIGTYPE void - -/* The size of a `unsigned int', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_INT 4 - -/* The size of a `unsigned long', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_LONG 4 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* some systems define this type here */ -#undef TIME_T_IN_SYS_TYPES_H - -/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ -#undef TIME_WITH_SYS_TIME - -/* Define to 1 if your <sys/time.h> declares `struct tm'. */ -#undef TM_IN_SYS_TIME - -/* force use of our version of strftime */ -#define USE_INCLUDED_STRFTIME 1 - -/* Version number of package */ -#define VERSION "4.1.0" - -/* Define to 1 if on AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif - -/* Number of bits in a file offset, on hosts where this is settable. */ -#undef _FILE_OFFSET_BITS - -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif - -/* Define for large files, on AIX-style hosts. */ -#undef _LARGE_FILES - -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* The _Noreturn keyword of C11. */ -#ifndef _Noreturn -# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ - || 0x5110 <= __SUNPRO_C) -# define _Noreturn __attribute__ ((__noreturn__)) -# elif defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn -# endif -#endif - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE - -/* Define to 1 if type `char' is unsigned and you are not using gcc. */ -#ifndef __CHAR_UNSIGNED__ -# undef __CHAR_UNSIGNED__ -#endif - -/* Enable extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `int' if <sys/types.h> doesn't define. */ -#undef gid_t - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Define to widest signed type if <inttypes.h> doesn't define. */ -#define intmax_t long int - -/* Define to `int' if <sys/types.h> doesn't define. */ -#undef pid_t - -/* Define to the equivalent of the C99 'restrict' keyword, or to - nothing if this is not supported. Do not define if restrict is - supported directly. */ -#define restrict -#if defined(__DECC) && (__DECC_VER >= 60400000) -#undef restrict -#endif - -/* Define to `unsigned' if <sys/types.h> doesn't define. */ -#undef size_t - -/* type to use in place of socklen_t if not defined */ -#undef socklen_t - -/* Define to `int' if <sys/types.h> does not define. */ -#define ssize_t int - -/* Define to `int' if <sys/types.h> doesn't define. */ -#undef uid_t - -/* Define to unsigned long or unsigned long long if <stdint.h> and - <inttypes.h> don't define. */ -#define uintmax_t unsigned long - -#if 0 -#include "custom.h" /* overrides for stuff autoconf can't deal with */ -#else - -/* Whether `time_t' is an unsigned type. */ -#define TIME_T_UNSIGNED 1 - -/* Extension for shared libraries */ -#define SHLIBEXT "exe" - - -/*******************************/ -/* Gawk configuration options. */ -/*******************************/ - -/* - * DEFPATH - * VMS: "/AWK_LIBRARY" => "AWK_LIBRARY:" - * The default search path for the -f option of gawk. It is used - * if the AWKPATH environment variable is undefined. - * - * Note: OK even if no AWK_LIBRARY logical name has been defined. - */ - -#define DEFPATH ".,/AWK_LIBRARY" -#define DEFLIBPATH ".,/AWK_LIBRARY" -#define ENVSEP ',' - -/* - * Extended source file access. - */ -#define DEFAULT_FILETYPE ".awk" - -/* - * Pipe handling. - */ -#define PIPES_SIMULATED 1 - -/* - * VAXCRTL is pre-ANSI and does some variations of numeric formatting - * differently than gawk expects. - */ -#if defined(VAX) && !defined(__DECC) -/* '0' format modifier for %e,%f,%g gives wrong results in many cases */ -#define VAXCRTL -/* %g format chooses %e format when should use %f */ -#define GFMT_WORKAROUND 1 -#endif - -/* - * VAX C - * - * As of V3.2, VAX C is not yet ANSI-compliant. But it's close enough - * for GAWK's purposes. Comment this out for VAX C V2.4 and earlier. - * YYDEBUG definition is needed for combination of VAX C V2.x and Bison. - */ -#if defined(VAXC) && !defined(__STDC__) -#define __STDC__ 0 -#define NO_TOKEN_PASTING -#define signed /*empty*/ -#define inline /*empty*/ -#ifndef __DECC /* DEC C does not support #pragma builtins even in VAXC mode */ -#define VAXC_BUILTINS -#endif -/* #define YYDEBUG 0 */ -#define NO_MBSUPPORT /* VAX C's preprocessor can't handle mbsupport.h */ -#endif - -/* - * DEC C - * - * Digital's ANSI complier. - */ -#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 -#if __CRTL_VER >= 60200000 -# if __CRTL_VER >= 70320000 -# define CRTL_VER_V732 -# define HAVE_SNPRINTF 1 -# endif -# if __CRTL_VER >= 70301000 -# define CRTL_VER_V731 -# endif -# undef __CRTL_VER -# define __CRTL_VER 60100000 -#endif -#if __DECC_VER >= 60400000 && !defined(DEBUG) -/* disable "new feature in C99" diagnostics (for regex code); - NEWC99 ought to suffice but doesn't (at least in V6.4) */ -#pragma message disable (NEWC99,DESIGNATORUSE) -#endif -#endif /* __DECC */ - -/* - * GNU C - * - * Versions of GCC (actually GAS) earlier than 1.38 don't produce the - * right code for ``extern const'' constructs, and other usages of - * const might not be right either. The old set of include files from - * the gcc-vms distribution did not contain prototypes, and this could - * provoke some const-related compiler warnings. If you've got an old - * version of gcc for VMS, define 'const' out of existance, and by all - * means obtain the most recent version! - * - * Note: old versions of GCC should also avoid defining STDC_HEADERS, - * because most of the ANSI-C required header files are missing. - */ -#ifdef __GNUC__ -/* #define const */ -/* #undef STDC_HEADERS */ -/* #undef HAVE_STDDEF_H */ -#ifndef STDC_HEADERS -#define alloca __builtin_alloca -#define environ $$PsectAttributes_NOSHR$$environ /* awful GAS kludge */ -#endif -#undef REGEX_MALLOC /* use true alloca() in regex.c */ -#endif - -/* EXIT_SUCCESS and EXIT_FAILURE normally come from <stdlib.h> */ -#ifndef HAVE_STDLIB_H -# define EXIT_SUCCESS 1 /* SYS$_NORMAL */ -# define EXIT_FAILURE 0x10000002 /* STS$M_INHIB_MSG|STS$K_ERROR */ -#endif -/* EXIT_FATAL is specific to gawk, not part of Standard C */ -#define EXIT_FATAL 0x10000004 /* STS$M_INHIB_MSG|STS$K_SEVERE */ - -#define IN_CONFIG_H -#include "vms/redirect.h" -#undef IN_CONFIG_H - -#endif /*"custom.h"*/ - -#endif /*CONFIG_H*/ diff --git a/vms/vms-notes b/vms/vms-notes index 23943bb9..2d57648e 100644 --- a/vms/vms-notes +++ b/vms/vms-notes @@ -6,3 +6,1143 @@ Per Anders Wallin, the HP VMS porting guide is available at http://h71000.www7.hp.com/portability/portingguidelines.html This file documents this fact, and anything else of interest. +From wb8tyw@qsl.net Wed Dec 11 20:03:44 2013 +Return-Path: <wb8tyw@qsl.net> +Received: from skeeve.com (skeeve.com [127.0.0.1]) + by skeeve.com (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id rBBI3gNX002464 + for <arnold@localhost>; Wed, 11 Dec 2013 20:03:43 +0200 +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + frenzy.freefriends.org +X-Spam-Level: +X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM + autolearn=ham version=3.3.1 +X-Envelope-From: wb8tyw@qsl.net +X-Envelope-To: <arnold@skeeve.com> +Received: from frenzy.freefriends.org [66.54.153.139] + by skeeve.com with IMAP (fetchmail-6.3.21) + for <arnold@localhost> (single-drop); Wed, 11 Dec 2013 20:03:43 +0200 (IST) +Received: from Encompasserve.org (Eisner.encompasserve.org [67.53.90.116]) + by freefriends.org (8.14.6/8.14.6) with ESMTP id rBB5jaW9020988 + for <arnold@skeeve.com>; Tue, 10 Dec 2013 22:45:40 -0700 +Received: from [192.168.0.101] + (173-19-202-206.client.mchsi.com [173.19.202.206]) + by Encompasserve.org (PMDF V6.6 #13031) + with ESMTPSA id <01P1SYL5LELG002FZE@Encompasserve.org> for arnold@skeeve.com; + Tue, 10 Dec 2013 23:45:35 -0600 (CST) +Date: Tue, 10 Dec 2013 23:45:36 -0600 +From: "John E. Malmberg" <wb8tyw@qsl.net> +Subject: Re: Some questions... +In-reply-to: <201312110426.rBB4QXXc003297@skeeve.com> +To: Aharon Robbins <arnold@skeeve.com> +Cc: wb8tyw@qsl.net +Message-id: <52A7FC00.2040905@qsl.net> +MIME-version: 1.0 +Content-type: text/plain; charset=ISO-8859-1; format=flowed +Content-transfer-encoding: 7BIT +User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130215 + Thunderbird/17.0.3 +References: <529A9537.7090404@qsl.net> <201312110426.rBB4QXXc003297@skeeve.com> +Status: RO + +On 12/10/2013 10:26 PM, Aharon Robbins wrote: +> Hi. Some questions about your changes. +> +> 1. I notice that there is at least one instance of #if __VMS, where as +> it seems most code uses #if VMS. Is that on purpose? If not, which +> is correct? + +VMS is a macro historically pre-defined by C compilers on C before the +ANSI rules. + +Under strict ANSI rules, a standards compliant compiler is not allowed +to pre-define macros that are not prefixed by "__". + +Which means that you can not count on the VMS macro being defined unless +you do it yourself. + +So __VMS is the ANSI correct definition. But it would be a lot of work +to change all the code. + +The vms_config.h that is now generated has these lines in it to make +sure that VMS is defined. + +#ifdef __VMS /* ANSI compliant */ +#ifndef VMS /* PRE-ansi */ +#define VMS 1 +#endif +#endif + +This may be needed for other architectures. It only shows up as an +issue if you set a "strict" compliance flag on the compile command. + +> 2. For the include of the main wrapper. Gawk already has a routine +> os_arg_fixup which is intended to manipulate argc and argv as needed +> by an OS-specific routine before main() parses it. A quick look at +> the wrapper looks to me like it could be made to fit within that framework, +> which would keep #if and the include out of the mainline code. + +I can look at that. I can also look to see if I can move the logic from +vms_crtl_init.c into it in a way that would sidestep that it has no +copyright notice at all. The result would be code that is almost +identical to code that is in the official Perl distribution. + +GNV was started as a user project and when the VMS POSIX product was +dropped and they needed a Unix like environment, Digital took over the +GNV product, but did not really do much to keep it up to date. + +The routine in vms_crtl_init.c is actually called before main() is +called, so just linking a module with it in is all that it takes to +activate the change. Unfortunately I do not know how to get it to +magically fix up the argv array. + +> If that looks reasonable to you, can you make that change? You can send +> it as a diff against what you currently have already done. + +I will look at it tomorrow night. I also found another change needed +for vms_args.c to work properly under a bash shell. + +> I'm sorry about the hassle on the copyrights, but I really have to play +> this game by the FSF rules. I hope we can get it clarified soon +> so that I can include the files in the dist. + +I hope so. I have not seen a reply from Karl yet. He did say that +there are other options. + +This would clear the way for getting the similar code accepted into the +Bash and coreutils repositories. I have a report that the first bash +4.3 beta built on VMS and looked real good on the test run. + +I am currently working on adapting the packaging scripts from bash and +coreutils to gawk. Each product has had it unique features, so I have +not yet come up with a generic set of scripts. + +This is a preview what will be coming: + +backup_gawk_src.com - Builds a VMS equivalent to tar archive. By +placing the source in the PCSI kit, it covers the requirement of +providing source somewhere with the binary. + +build_gawk_pcsi_desc.com - Creates a VMS PCSI package manifest file. + +build_gawk_pcsi_text.com - text output by the VMS PCSI package installer. + +compare_gawk_source.com - I have the source checked out on an NFS +server. The backup program needs me to copy it to a VMS volume first. +This procedure makes sure that the two copies are the same and ready for +backup. + +gawk_alias_setup.com - Sets up gawk and awk links to gnv$gawk.exe. +Needed to repair when sins of the past partially break an install. + +gawk_verb.cld - for gawk to use gnv$gawk.exe as an image. Different +than gawk.cld. To properly add an image to the VMS command table, it +needs a prefix. I have "GNV$" registered as a prefix for this purpose. + +gnv_gawk_kit_name.com - Calculates the VMS PCSI package name, used for +both file names and file contents. + +gnv_gawk_startup.com - Run at VMS startup to make sure that the +environment is set up properly for gawk. + +pcsi_gawk_file_list.txt - Source file for build_gawk_pcsi_desc.com. + +remove_old_gawk.com - Needed to properly clean up sins of the past. +Only touches the the GNV provided gawk and awk programs. + +stage_gawk_install.com - Does a pre-install into a fake "root" directory +tree for the kitting procedure to pull files out of. + +Regards, +-John + +From wb8tyw@qsl.net Thu Dec 12 12:21:57 2013 +Return-Path: <wb8tyw@qsl.net> +Received: from skeeve.com (skeeve.com [127.0.0.1]) + by skeeve.com (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id rBCAIn2l004322 + for <arnold@localhost>; Thu, 12 Dec 2013 12:21:55 +0200 +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + frenzy.freefriends.org +X-Spam-Level: +X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM + autolearn=ham version=3.3.1 +X-Envelope-From: wb8tyw@qsl.net +X-Envelope-To: <arnold@skeeve.com> +Received: from frenzy.freefriends.org [66.54.153.139] + by skeeve.com with IMAP (fetchmail-6.3.21) + for <arnold@localhost> (single-drop); Thu, 12 Dec 2013 12:21:55 +0200 (IST) +Received: from Encompasserve.org (Eisner.encompasserve.org [67.53.90.116]) + by freefriends.org (8.14.6/8.14.6) with ESMTP id rBC6FboY024650 + for <arnold@skeeve.com>; Wed, 11 Dec 2013 23:15:41 -0700 +Received: from [192.168.0.101] + (173-19-202-206.client.mchsi.com [173.19.202.206]) + by Encompasserve.org (PMDF V6.6 #13031) + with ESMTPSA id <01P1UDWPUU7M002J4J@Encompasserve.org> for arnold@skeeve.com; + Thu, 12 Dec 2013 00:15:35 -0600 (CST) +Date: Thu, 12 Dec 2013 00:15:38 -0600 +From: "John E. Malmberg" <wb8tyw@qsl.net> +Subject: Re: Some questions... +In-reply-to: <201312110755.rBB7tIrb026097@freefriends.org> +To: arnold@skeeve.com +Cc: wb8tyw@qsl.net +Message-id: <52A9548A.5060604@qsl.net> +MIME-version: 1.0 +Content-type: multipart/mixed; boundary="Boundary_(ID_0V6xQMBg8dMk2LzZyR0ioQ)" +User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130215 + Thunderbird/17.0.3 +References: <529A9537.7090404@qsl.net> <201312110426.rBB4QXXc003297@skeeve.com> + <52A7FC00.2040905@qsl.net> <201312110755.rBB7tIrb026097@freefriends.org> +Status: RO +X-Status: A + +This is a multi-part message in MIME format. + +--Boundary_(ID_0V6xQMBg8dMk2LzZyR0ioQ) +Content-type: text/plain; charset=ISO-8859-1; format=flowed +Content-transfer-encoding: 7BIT + +I moved the vms_gawk_main_wrapper.c code into gawkmisc.vms so that file +is not needed anymore. + +I also discovered that we were not building with exact case public +symbols, so I fixed up the source to build with exact case symbols. +This will be more important when building dynamic plug-ins, and in the +future if and when the other related packages can be built with it. + +This caused small changes to most of the source files in VMS, as all the +system services routines were in the wrong case. + +I see that just about everything has been backed out of git until the +legal stuff is resolved. + +This is what I currently have for io.c changes based on a branch I just +made against master. + +And this is what the diff for the vms/gawkmisc.vms changes are, which +eliminates the change to main.c. + +Regards, +-John + + + +On 12/11/2013 1:55 AM, arnold@skeeve.com wrote: +> Hi. +> +> Thahks for the answers. I will address some of this later; I'm at work now. +> +> I would like to emphasize that, from my perspective, the priorities are: +> +> 1. Code changes (os_arg_fixup, etc.). +> 2. Documentation revisions. +> 3. The other VMS-only goodies that you described. +> +> The documentation revisions are not optional; I have to have them. +> +> But, as I said, it's enough if you give me plain text. I can do the +> markup. If the markup is what's holding you back then don't bother, +> just send me text, with some kind of clear indication of the sectioning / +> subsectioning (if any), and I'll do the markup. +> +> Karl replied further to me; I don't know if it was on purpose or +> by accident that he didn't include you. I will include you on the +> further correspondance that I need to send. +> +> Believe me, I very much want to move this forward, but I really do +> have to play by the rules. +> +> Thanks, +> +> Arnold +> + + +--Boundary_(ID_0V6xQMBg8dMk2LzZyR0ioQ) +Content-type: application/gzip; name=gawk_io_c_vms.patch.gz +Content-transfer-encoding: base64 +Content-disposition: attachment; filename=gawk_io_c_vms.patch.gz + +H4sICANRqVICAzAwMDEtaW8uYy1yZWRpcmVjdC1BZGQtYWRkaXRpb25hbC1WTVMtZXJyb3It +Y29kZXMucGF0Y2gAnVV/b9pIEP0bf4q5pmptwI5tzM82FRRImyqQXEhzV51OyPaOwY3t5Wwn +TdT0u9/sGhNIIuVyKyTvzs6bfTNvdjlMeQy+7Ti+z3zT902n6wZdz/acltU0zQBNn7VZs2m2 +ut0GTHgCM1yB1QbT7Mkf2KZpKYcUpgdf+DKBiRvFHqYLeP/D6+S3P/r/ZJGRYP5BGbk59uAP +ZHWwLBihT1irAXaj12z0GjboZss0ldmV9x39vAd/nQ7Oh5//hpAbPqgpsjAlu9aDAWPgMhbm +IU/cCC4mM8A05Sn4nGFmSIACaoI3eRBGSIgzzNNb4CtMwA1yJM+IZ2GygIzHCMIpMxRF13UF +hks3WeAxX8Ad0HCgRkMpSMghzLYpzVtD1yXaLoKBL6OIRLsQJhmmgmum1rQ6NIFhhMVa1xSF +hUEAur4Ic3D370/37udKmDC8AdfqYIc1DAO7zGx6Llim2XIcQXsbqRCbHXS/D7pVb0DNqreh +31dqouq6ZeskQjmkcmPjXjw5HilYK/2rL1blMfal+pAKG+bmhvnM53lOzRQG4eXGCO8zYWZG +7IZRP/P8RcQ9d50EKFApOYhzMHZvPcy4f4llHgyDMJGZQEAZjL58Oj01dpWSeE9+1vo4AV2j +Junjt5sMW51dfaRjIY2cSlVsq94iXehDWpA0sIcJnSIo7oVBQQOZSrXUlNpemPjRFUNKLqMd +Y/lB2AI6O4DZ7PV8/OfHb+fHEzIWuG0jmDe2azkA+1WpTMdwIEMqd3Wf/ItDtw5I4/IEKIM9 +rJQaMK0ijWK2xVwk5rRskZjTaheJQam1enTy8eshVKv+VSrWdfA4jyC7DFcr0pviVCoV4li4 +xW7iLjDGhF4DIir2qKUSDgdgvpPLgNGc4bVoHTVI3FhEDJOYWk59lb7StHdKjdyolqoqfA/g +aHoxOD4azT8PpqPjsQZv3oC6DnoA48nhERk1+ClhRX5znqC6DvSE5T9S+FXSF9eBEPLMIgnB +7jdgfJ6nbnl/ikpUrlaMHs35+OxsejIPk7ygSiFFlbtOp07vZ63blF8ylddRnZ6MxlCVyzne +rOr0COXFbn67wmJZpVhBtK654PCgDHB3B/emqaxMwWqnCKJTRQtSWyl6od4gWi3dfdFnF23D +epvBEM7OjyHMiEJ+lSbiZudLWtLTmKPLZIEe4WpPwzDDDU6wodvOg5KyunSvMXmbQ56GyICT +ewornuX6RcuwIbslXJxpopv03Wvy+9eT8wFdE/o3Gz7ce/YKibwxEsR2ynh0ItpLZrfZ3d3e +KTFFJaFlSyrw7FCv3Rv/9Qa9ncXdnaI/H+ApvMxU0+4f6/8BF8e/GH82oQCD4VCCK1LWJxxm +36ba0z24fn3KSv+kVxcUy2gbXUX5F+2/BB3kCAAA + +--Boundary_(ID_0V6xQMBg8dMk2LzZyR0ioQ) +Content-type: application/gzip; name=gawk_gawkmisc_vms.gdiff.gz +Content-transfer-encoding: base64 +Content-disposition: attachment; filename=gawk_gawkmisc_vms.gdiff.gz + +H4sICINTqVICA2dhd2tfZ2F3a21pc2Nfdm1zLmdkaWZmAJ0aa1PbSPKz+RWzDgU22MY2JLsX +X3LLgtmllpBUTPZxHKWSpbGtQ5YUjcRj9/jv193z0OhhlrtUBdBMT09Pv7tn+v0+OxCp56Rx +nB0s3fvbg7u1oD/WgfAG8NH6lfvslHtsNGLj8dvX3709/I6Nh6PDrf39fYbgL198OH47/ptc +/P33rD8+7B0O2T78Ojp6w77/fouxPXYW55HvZkEc9dh55A167PWInaVudBsGEZtlKedZj50F +i2zFzsI4Tnvsh1hkCP7hmLHheDQa9keHw1GPfZkdI8qDLba1/yqIvDD3Ofu7yPwgHqzel8fS +IFpWBr3sMeE1QD8M5jRoD/tceGmQVID9u8Dni8ogX0T1wYXwGkZFJuqDWbCuEhVGaw1HZCWp +u1y7bM3Xc546bhgsozWPMibcO15MR3ENIIyj5X2c+lv7wJDcy1iQ8bUTBiJzDtmfW/utPBIA +CzIVqzgFeB5N6qNe7HMcvosDHwQ6zxeunzbA7bGUZxLF0wQJV5sughDY6UZOkK1D2HqMWzP4 +V999ma0mjXOwVJGBk97KTWE7L14ncQQHNTtuYhXOBcCQ2e+z7R+nV6e/nP/akahKeyG/GAi0 +1zCneLFy7VkvjgTIQZ7TF962UpwsTh0BFPr8LnLXmxbY0thjkjsWrOJ3EIt5dbSzx1yRgRi6 +nRLx3d6mUwF4kq7r2KM8DN102Z3YLDo7v5jOTo4vOy8/KTgdmLTwbxT+Hrtzw5zjuTdSu8cW +ob8I3aWoY6xv7uYPcZ5tFppWzOKQjI559fny4vJD7ZBVUtysdLC/4kTmzkPuwMRLSGegHlXg +ChVK2V1vDQbwUlVSX3RiieFrHmecvWO7/9rdnaixPXAziQuO9x07nZ59Or76yZ4Bx1hMXpz/ +YM/z6E7whCG+HqDbfwXwQcTZLx9mzuXxh6lzMb1kI3QB4Po9uQZDCx732gbaH92QVA722JV7 +y5kbhixbcbbIIwZCZfGCiWCdhI8gjfgWnDrLE+bCxzLw3JDYhxFBb4TCFY/CydIIvCgxqyMZ +pdgIC3FNr+RISCHVEGKgbwc1Zmsf3aTEsH0KRvH5/NPVx8+dQsisDTpEFuOcTn9pI8dbTXqE +WgTsQuAPzsnxbOr8cHF+eYrgm7RD6wbC0MHgjLlo8LwpF3mYWahsdQgysLvrsWRzS34NbwZw +OiDHnHRiz6GrVbQ6s6vP55c/lqZlBNCrS1PS0GBqx9Bkpkd60+HEHlObDSWoPvMAuXHvyJgA +03Aw+LujxEdcLoG6ThIDjziS1ZFi7SrgGuzc8TEVQMWenWz/7Jxe/f5p6lw1wHmhK4SBO7k4 +ns2cmSRUCgPmLE+yQ66C7VjasWMMnA17UhZdxZQF62yjKcyujq++wK8vJyfT2awjEXe7GCUB +rAWWcZmjVfB0HUQuGLEb+ejR8jQiU5HJDllBq0UiuZbMvyFzH6J9tp4ImVplFAlH2RaDLTDL +I+tkfcghE9wQzQ/xt3GuzRIXNG2Rxmu2iu9p4uOMgQ2GoIbACJmWAabf45zdx3noQ0aCCILo +Fn669KdAhcWpOZyCidxbwa8kjYFd6x5kFhCowRyBKYw/ZBxSKJ8CCBMJ94IFWDzmkYK5KWdw +aO/2kWUxEiZ4j7hyz9mKkiL0wzGwTHkTP1gseMojj8PO2T0HNXTZyeerC7bkEU+BqT4gXd6B +ChMelzAkIHyY4A/c63RL85AF+EDWPAbd9FzBxQAXHBhnu7dVMLRDIRAO0N1itivSw+BS/9zq +t+Rg0mN7X+v2jl+FkSuvJVZwPD0beiQ8Y0cgiPMFnZ18OE0CvjQT7D7IkO0HPZyOQCcZyMUF +jsxFHOaZXAEokIcot7X7SFwF1gF4wbD5I+EnNgZwLu766K5xDDKzNbBIIsG9BwzJkVuRQPhd +AMIgsrRESJfB4FZcKNJQYySOe1ewMLjlEAdIBRE2hRChNiKhRJz7AsUOyrUIHlAtk4Fcrlhx +Oj052f70cXb+m3Py8cOni/PjyysHwxpGoxnSJniGGMY2bzQrYP357OftXz5efPkwlay5D0DB +YLsEhANpplTCQI2LDH8iVYBSItGUSbIOjB/QuoD69Q6M9mCXzL+lRR2BORBrUNxS3jpZbjX7 +fL7GP68PbwikEi+gkHEwrbw+ktO0C1iyTFev3xw1rjIAOl5sDFwSzMQuid8PxO1dHOIG49dv +mukyIGoLhEHv9COIRUB9A3q2iNM1uQHQV+2hcJ3yfwd7/Rf9k9CGTyYgdkTwBwctNoftsj4b +TarAKmhBIbHtHF9cQOQHFapBmUBpsNVAioBZZ6+BG1WpKxhF5MH/17UVNomgszX6RhZ9O5Zw +Xt/U4AoiaxKyAMel+F4aL8d4dE7Hvi+9UwqJ4wMDqdIn4M7XXLkMLVGrbJOW5SYJBIfqAvL4 +GGPkOlBOL3nsFBT32mS/bRV/W8aoZHrhrdLOjjHE0U2PzFAeBUy0gP7mHbv8cnGhLLRlUpQC +os80HqU8BAgHQQcEjvxrHoDDAB8MsSNjK4hMiuaWZTkb0xqbyEnjKitvsvxEDeyZPKgJ+Jlk +qFVOh4oSG2Za07PL7RNnennWk99D9XvH2kINaZ1Rn9pPqU/kOqVRQykWkss3f5VDtSTrVQiA +4mB7yTPAfM8WbhDaoUYHPvinQo7KACDSQXxUeQCkK8vUXcuQE2cGnuLS6QlQKGLmxzi3wiaU +AThGFC7UMhwjTfsgWycHClmb3ZMWwNBbA+/HoCOYQ/EHYIkelnrSktmAMbbWE+OhAMSbOGJc +/vCmYMsGJGpWxR7LccnQU/FSOnxAeuTAlIoehu+V3JUCN2WhmHJpl2eOVQShkju8KWhUillz +qnrCkT6o6k0LemQ8ZuI2SFC+ENciKC4heaHiEnLOVHhxYZGkZIomFZ2dXcNBten+/qT0jZv2 ++2rsydr9mFL3dXwnOZGloIK4rxdDkdi0pXUocCVy/7e1/Uv7tWpLbfY9vVA20mcaksqOn+2/ +UxHHnrkuA91YHp+2O1lx7xZcYwpMR4cfYSgPZQI555BiBjBY54GUqHZlxdHBZ0fo4XVfAYqt +kvtW8IpM032QwzZLjBl0MAxAOu+tE7V3z3QtukiCdjwlLoJnUXUHWesS/ruQNGdQ3HjyxHFq +jJqyT3YSgxsIXDAmfW5IkK8oc12D7hlo1/NyTLZ7uINHlZMbgnuReFGLeQEcLGRSuuDg/FJy +Mq6XBXd8UPEdyNqOPjQeiu3sKBDsl1REXXC+YD26AWDS5P+SxHOiaAFWFY61HIr4XchCQxeS +o3VlAemf+MP2bNhq0nWRH8gylUojXRlRECc3HmSK63NqbVE6usdkCmqXNECYGsUaH3QBg7tM +TQ5UqRNEajXMwzT8XOcio0K4Xnq1ihymMcFGMAdHTD1Q1Iqtct9pEfDQd6iXaufs9b6sqR90 +BqibY3QMe0Q3VWhjiuA6FigASISKTO+vch5zlo0JT1Ep18DrHSJTbTdAP5fwVCGfy3bwVHG0 +m6F95RBpHnWVB1IOssANIUvHsEIJAF6Y6PuLIqU9Z/9G8cs8gUpbiD3FaqgioyRXnUihS0XK +hV0AepQeoCfTFq1IlN9gIqx4gmpGWIpix9F1hyboHTubnVxuO9Ty/zQ9mdQgDYOH9TlzA8Nk +TlzwR6VbWvlFUSKbwhqKLGr1UJ5cJXFUJxGKrPOT6aQGt5HA0XMEgkOVQqMiRKZ0VEVgXkda +UiVpXCcJ+waTGtRGgsYbCSpgDuu7oJZOalAbdzl87thTVTchZO2ER/beVbRHz2x5tHHLUl1g +3SupWPMXlyndHWOWPb2mcFQUZox36zFZH1Btptn6fI9VxT0kpFHl37Fmb9O8sFDFbzAQmQau +SaRjvGpTlQvw6ZbzxJGuUo0EVqn4q6Wf2lmr5pbIPY8LschDWRhhL7DB7GU3SschtVaZ4UAt +1OthN1lZC0Gw1NziLI7Aty1lT8xUSDCqlwFySJexGRMvyJZpoSlcRJ4k2NfBM0zPZnoV8gM8 +J/h4wWuUXFFowJ4j9YgfHh62dZMglj3CYO0uVYtAL7oIovyBaTsW2q2qNq06TRhiTDccy0DN +rBaExiVzJNVMbTbdiQFRxUaD9asimkQugxM1GGR2tLu9a1WwCqjSVlBrTWVhbWf+7JvFfWbn +RYp6W+GetthWH/WqLV3y22t85TG4gZw95R6Y2+NA5HP4uPnx+NefB9PfppOozfrvWRu/28iX +fiuxTqLjLJzmBk7DsE1ncLEkjzA0Up+Oln5tXvpeL3VD0AeqQv5O4T+itW74XqIiJIAG+UWJ +HrKK/ec/7CsDiC7MEHFfJwWVfp5YoP8oWjJvEcU+G3W7E4WxY1OXAFmDXTBfLRBEvvdV36UQ +tVJ5BhAmJmgAWmvqeXDx01EX0Hb+q8dVBowSUjc0KrWWfoCsEL0FqSvdjJDNBTr9RF1vD/gD +b2tKtG8pUmv50RwltNtBXjTFGODEyOjlM0BHRYVgETDSKXmpu0AO70En8g9SABFm/LCqp47T +A5QaBPd9kK7V4GjaRqX+RQVgjlYA2+fRQtupi0X1nVpEUcOZu5NKlWEa+rIwKTfxIaG0mvj1 +oGBGMjj6pLIQRisZtlSCIrJfUSrI3UgorcB7NXceylsacgnUonKxSWXd0KAzPAt0WoDJuWxi +3q8CqGAFT1ysQIUJROYCRq3FkDCwahZzzGaLlz1VHZwL4Ir7K4VDA0XeUFvG/xQptGEc6GDx +kliB2UaxrhoxTM+26uQNucbT/4++3mZh2YnrZmtadjNmQdfiz3nEvlye/8bw3Qj4OwjA5chL +qThwUF7J6riIvCB+6she3G0Jy90ksRDBPOR62T1m9XgTixWPvno1DsrKE1K6SNbL1H0h0YlK +IjNwIQeMiHJwGxHkJWng6YXGAKjwBi2IHqHIdAUMWJHcaA+YjyWggnHo6YtIrCGr4ikpYyuw +nA0YCShNJxB+sAwyjeA6uLGbJUauT4UHLSBVC0ZD7xXkDidNnuzAMld0klrZiXUdbJvgbSww +B1s/XZOp4QqQGQiklOhIb/MC3ijAGmswfMq5a9We5LsYmMtj091qk0lOj+X0g71Ejf22Yclh +wy6Hz+9ypJhcpOTAZ3PyYXN8wm4t9tp0aa8chEtP5hSMrYhgNZ6Lmoq3h6qpmev2f9F8s5ip +mGPHszpVjeGsRKpxhWSa7N591O8tOL3d1G8uONggJfMIrPXiWGCe74ZgO/4jWmkAJZVfIAB/ +LW9CpBco6c4iScEyFlBN+TxNVbBsqwYFXq5gFxKvbeXlBuwTxthvR6T/iuRTqabu3GVM7yyX +WEUA84Ec0w2rpFdFXLHflEnEjc/NTK/xSb6the3kzTx2BN059uXxgl7gKzNtVPQwxdxQYvCk +lxdyHYafkGPvFz1dBOsS4DJaYU9F0DWUagVCwUNweRzctXqaAHg9WgwqFsb3ajHJyLwSaNGG +QDpIj0d3nfbsp+nFhWQgqpOcLpsmjUOcgISKpiGlAtLb3ZLGmVcjo0ZZlKef1G56tEiiyD8a +nVU+0fAfXJydtdnj7+DUdGgbWjsd5TZVYqUzYw0I6fKTersUC8dNlw4IDpiMz5fkX9ZDFBbi +40RgJT5Tf/2m9y3bP/p23Bsf0St1JH8PMHiJef64h993Cb3N0Q9usj+cNA957XXOFmt18DVt +l2gzlHQIY48uxpKueZVzBomDIg6ffrM/4ki1mnASlIzeOchQhmoBIhd4TwRCVHag6ADmrd0w +jL3OaDiWabJpthRPIDvtq39CGq3W9JiBfcnzMzA5pXAVJITB1pTGnell3PmH6T8/Xk6dz18u +po2EvJCSZ0kxSrJIOe+oyW5ZRaDujRMsmkFB6A96VOaGDAy2/3GmWpVCa8l4+F1vNGL7b45G +vdG3pCcg6MUYX0HEoY+ep/9ezPMF7EJeC6spfJimWp7Wq7xXwcLnC+Z8mU3hjKd0zkKhO4sR +IMqQPrSpxVh/KW+I6nv0XX8eyKY9C3zYKr4NdINyZ4cpDAF4/wIDfCFv2CuUEtCot1NOodi1 +Z+0p3YM60eadBRT51KNmh/qBfpTJN4AVgtSdaUETDNSBRlWgUQPQuAo0Jlfxikd+sFCiBjK2 +/gvg4az2BTMAAA== + +--Boundary_(ID_0V6xQMBg8dMk2LzZyR0ioQ)-- + +From wb8tyw@qsl.net Sun Dec 8 19:58:11 2013 +Return-Path: <wb8tyw@qsl.net> +Received: from skeeve.com (skeeve.com [127.0.0.1]) + by skeeve.com (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id rB8Hw8Y1002346 + for <arnold@localhost>; Sun, 8 Dec 2013 19:58:10 +0200 +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + frenzy.freefriends.org +X-Spam-Level: +X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM + autolearn=ham version=3.3.1 +X-Envelope-From: wb8tyw@qsl.net +X-Envelope-To: <arnold@skeeve.com> +Received: from frenzy.freefriends.org [66.54.153.139] + by skeeve.com with IMAP (fetchmail-6.3.21) + for <arnold@localhost> (single-drop); Sun, 08 Dec 2013 19:58:10 +0200 (IST) +Received: from Encompasserve.org (Eisner.encompasserve.org [67.53.90.116]) + by freefriends.org (8.14.6/8.14.6) with ESMTP id rB84BBd2018585 + for <arnold@skeeve.com>; Sat, 7 Dec 2013 21:11:14 -0700 +Received: from [192.168.0.101] + (173-19-202-206.client.mchsi.com [173.19.202.206]) + by Encompasserve.org (PMDF V6.6 #13031) + with ESMTPSA id <01P1OOF0VUTE001YI1@Encompasserve.org> for arnold@skeeve.com; + Sat, 07 Dec 2013 22:11:09 -0600 (CST) +Date: Sat, 07 Dec 2013 22:11:05 -0600 +From: "John E. Malmberg" <wb8tyw@qsl.net> +Subject: Re: VMS patch for config.h generation, passing tests. +In-reply-to: <52A277C3.303@qsl.net> +To: "John E. Malmberg" <wb8tyw@qsl.net> +Cc: arnold@skeeve.com, r.pat.rankin@gmail.com, anders_s_wallin@yahoo.se +Message-id: <52A3F159.9000607@qsl.net> +MIME-version: 1.0 +Content-type: text/plain; charset=ISO-8859-1; format=flowed +Content-transfer-encoding: 7BIT +User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130215 + Thunderbird/17.0.3 +References: <52A17089.9060701@qsl.net> + <201312060840.rB68eH2F029601@freefriends.org> <52A277C3.303@qsl.net> +Status: R +X-Status: A + +I have merged in your changes with my local copy, but not sure yet what +to do to get the git status happy. + +Unfortunately the VMS 8.3 Alpha manyfile test failed. Closing 2 files +in io.c was not good enough. I am trying again with closing 4 files. +Still failed. I am going to have to add some diagnostics to identify +the failure. + +And the beginfile1 test also is failing on VMS 8.3 Alpha. I will look +at that after I resolve the manyfile issue. + +I also did not notice that ofmta test failed on VMS 7.3 VAX. The +floating point number is rounding differently. I get the same result +with the replacement SNPRINTF or the VMS provided SNPRINTF. + +TOAD> diff ofmta.ok sys$disk:[]_ofmta.tmp +************ +File SRC_ROOT:[GAWK.TEST]OFMTA.OK;1 + 5 4.234 + 6 4.2345 hi +****** +File LCL_ROOT:[GAWK.TEST]_OFMTA.TMP;2 + 5 4.235 + 6 4.2345 hi +************ + +I tried that build again with #undef HAVE_VPRINTF, and it failed. + + From eval.c: + I1 8733 #ifndef HAVE_VPRINTF + I1 8734 #error "you lose: you need a system with vfprintf" + .1 +%CC-E-ERRORMESSAGE, (1) #error "you lose: you need a system with vfprintf" + +Note that the error message has the wrong routine name. + +I have looked over the manual, and will try to get some detailed changes +to it. + +Some preliminary things to help collect my thoughts. + +As the MMS program has a lot of issues with ODS-5, Some open source +programmers have switched to Madgoat Make, known as MMK from +https://github.com/endlesssoftware/mmk . MMK uses most unmodified MMS +description files and handles ODS-5 volumes better than MMS does. + +The optional POSIX subsystem is no longer supported on VMS. While I +used to know at what version this support stopped in my head, I have +forgotten, and so far have not found that with an online search. + +Most of the C runtime routines that formerly required the POSIX +subsystem are in the VMS C runtime, so there no separate POSIX builds +needed for newer versions of VMS. + +The behavior of the VMS C runtime is controlled by feature settings that +can be set by logical names before the program is run. + +These feature settings include the support of longer filenames with +almost any characters including UTF-8, on ODS-5 volumes and if routines +should behave in a more Unix like fashion. + +I will be adding vms_crtl_init.c to the next commit for vmsbuild.com and +descrip.mms. This vms_crtl_init.c detects when the program is running +under a bash or similar shell and sets the feature settings for better +UNIX compatibility, or sets them for better DCL compatibilities. +It makes sure that the extended filename support is enabled. +This way a single binary can be used for both the VMS environment and +the DCL environment. + +As a replacement, a GNV https://sourceforge.net/projects/gnv/ was +created. There is older version of gawk that is provided by that package. + +Recently a group of programmers have started trying to correct issues +with the GNV project and reorganize it as a collection of packages along +wth a VMSPORTS https://sourceforge.net/projects/vms-ports/ effort. + +The GNV environment provides a Bash shell and several other utilities +intended to simulate a Unix environment. + +The web page https://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/ +documents what needs to be done before installing these newer packages +while GNV is in the transition phase. + +Currently only Bash 4.2.45 and Coreutils 8.21 have been packaged, both +are fixing critical issues in GNV. + +I plan to have a GAWK PCSI package that will be installed with the VMS +PRODUCT command. This package will install into the GNV directory +structure, which mimics a Linux directory tree, so I will need to +determine where to put the gawk.hlp file in it. + +Regards, +-John + + + +On 12/6/2013 7:20 PM, John E. Malmberg wrote: +> Hello Arnold, +> +> I almost missed this, the gmail randomizer threw it in the spam folder. +> It tends to do that with about 1 to 5 percent of my incoming e-mail. +> +> I am still learning git, so I am not sure how to regenerate the patch +> set. If you can help me with the commands, I can try to regenerate it. +> +> I ended up doing two patches, because I forgot that VMS execute +> permission is interpreted differently than Unix, so is usually on. +> +> I did not change the commands to kick off the build procedure, just the +> internals. +> +> Unfortunately Texinfo is not in my toolbox. I will look at the *.tex* +> files to see what I can figure out for editing the source format for any +> changes. I did update the readme.vms FILE. +> +> Also this patch should enable the dynamic extension loading, which I +> forgot to put in the change list. +> +> To better support dynamic extensions, gawk on VMS/ALPHA should be built +> using IEEE floating point. +> +> This slightly changes the precision of floating point output. I am not +> sure that anyone would notice. IA64 defaults to IEEE, and VAX can not +> support IEEE. +> +> The reason for this is that most open source packages expect the IEEE +> behavior, so it seems best to default to that when possible. +> +> When we get this step resolved, I am going to work on the procedure to +> generate a installable package in the VMS PCSI format. +> +> Regards, +> -John +> +> +> +> On 12/6/2013 2:40 AM, arnold@skeeve.com wrote: +>> Hi. +>> +>> Thanks for this. I already pushed the change you suggested about +>> version.c. Do you want to pull and regenerate this patch set? +>> Or should I just apply it all and you'll send me an updated patch? +>> +>> Finally, we need the manual updated about the build procedure. If +>> Texinfo isn't in your toolbox, you can just send me plain text and I'll +>> handle the formatting, but the manual needs to be updated and also +>> and README files. +>> +>> This is great work and it's exciting that VMS gawk is progressing +>> this way. +>> +>> Thanks, +>> +>> Arnold +>> +>> "John E. Malmberg" <wb8tyw@qsl.net> wrote: +>> +>>> Forgot to document that the previous strftime test was incorrect as it +>>> was not specifying a timezone on VMS versions that support timezones +>>> which made the behavior different than on Unix/Linux. The test has been +>>> fixed. +>>> +>>> All tests now passing on VAX/VMS 7.3, Alpha and IA64/VMS 8.4. +>>> Tests are still running on ALPHA/VMS 8.3, but I am expecting them to +>>> also pass. +>>> +>>> VMS build procedures no longer need to be edited when the version number +>>> changes. +>>> +>>> 2013-12-05 John E. Malmberg <wb8tyw@qsl.net> +>>> +>>> * New config_h.com to generate config.h +>>> +>>> * New gawk_ident.com generates ident line for link option file. +>>> +>>> * Add version_c.com to create version.c from version.in. +>>> +>>> * Remove fcntl.h covering up real fcntl.h. If an older version +>>> of VMS needs this file, the build procedure should be updated +>>> to generate it from a template. +>>> +>>> * descrip.mms: Use command files to generate files based +>>> on same input files as a Linux build. +>>> +>>> * gawkmisc.vms (files_are_same): support _USE_STD_STAT for VMS 8.x. +>>> +>>> * generate_config_vms_h_gawk.com: Generates a helper file +>>> config_vms.h to cover issues config_h.com can not handle. +>>> +>>> * vmsbuild.com: Use command files to generate files based +>>> on the same input files as a Linux build. +>>> +>>> * vms_misc.c (vms_open): VMS CRTL setting errno to ENOENT where +>>> it should be set to EMFILE. +>>> +>>> Regards, +>>> -John +> + +From wb8tyw@gmail.com Mon Dec 16 21:27:20 2013 +Return-Path: <wb8tyw@gmail.com> +Received: from skeeve.com (skeeve.com [127.0.0.1]) + by skeeve.com (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id rBGJQJfQ002202 + for <arnold@localhost>; Mon, 16 Dec 2013 21:27:19 +0200 +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + frenzy.freefriends.org +X-Spam-Level: +X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham + version=3.3.1 +X-Envelope-From: wb8tyw@gmail.com +X-Envelope-To: <arnold@skeeve.com> +Received: from frenzy.freefriends.org [66.54.153.139] + by skeeve.com with IMAP (fetchmail-6.3.21) + for <arnold@localhost> (single-drop); Mon, 16 Dec 2013 21:27:19 +0200 (IST) +Received: from mail-ie0-f173.google.com (mail-ie0-f173.google.com [209.85.223.173]) + by freefriends.org (8.14.6/8.14.6) with ESMTP id rBG6Tatb002732 + for <arnold@skeeve.com>; Sun, 15 Dec 2013 23:29:39 -0700 +Received: by mail-ie0-f173.google.com with SMTP id to1so5932042ieb.4 + for <arnold@skeeve.com>; Sun, 15 Dec 2013 22:29:36 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20120113; + h=message-id:date:from:user-agent:mime-version:to:cc:subject + :content-type; + bh=ksiNjtwxRvh74kzY1LKaRL/l+Ja2PriUxgPwwm+Igho=; + b=BiJLgaDXXU4R0IwBKeNvon0qca3q3Le4HtVArPhKruA9rRhSqfVcTRHrQ8fF1r0f5h + N28vQidBEX3PNHi9k0uzfHF1sqT7LHGxOfSS/7ipk8UWoa4BVB3taSOFAAMzTkQUeduC + 2RNaWLJHjFR4xRvkOwYqJPVikLyg2atmds6iLoxKOFbNCz+KUFQacDmaCLiibEg4pxV1 + DsZWlBKLFrl8wXF5+gy3ZAj3FafIZluCgY5rUqrfXxrV9a7kumGrgljPG84MAOT01eCe + nXnlrhJgxIAjndT7sYPSYGZkeieSagmN57kRqefNkHk9PhdF5RbY3J0PBC7r0cJn/MKE + Uh0A== +X-Received: by 10.50.154.102 with SMTP id vn6mr13663789igb.1.1387175375953; + Sun, 15 Dec 2013 22:29:35 -0800 (PST) +Received: from [192.168.0.101] (173-19-202-206.client.mchsi.com. [173.19.202.206]) + by mx.google.com with ESMTPSA id da14sm14704681igc.1.2013.12.15.22.29.33 + for <multiple recipients> + (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); + Sun, 15 Dec 2013 22:29:34 -0800 (PST) +Message-ID: <52AE9DD7.1020409@gmail.com> +Date: Mon, 16 Dec 2013 00:29:43 -0600 +From: John Malmberg <wb8tyw@gmail.com> +User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 +MIME-Version: 1.0 +To: Aharon Robbins <arnold@skeeve.com> +CC: "John E. Malmberg" <wb8tyw@qsl.net> +Subject: Updates for gawktexi.in,readme.vms +Content-Type: multipart/mixed; + boundary="------------040502020402090508010905" +Status: RO +X-Status: A + +This is a multi-part message in MIME format. +--------------040502020402090508010905 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Hello Arnold, + +These are the preliminary updates for the VMS documentation. + +I forgot to document (not sure where to put it) + + * The exit code reporting in GAWK is wrong and violates VMS + standards. This is a common problem in older ports because + the exit() was not implemented correctly, and neither was + the rest of the C runtime. Day 1 porting bug that was inevitable. + + The first problem is that if I fix it to report the correct exit + status, it would break DCL procedures written to expect the + wrong value. + + The second problem is that the new exit() call does not + allow setting the severity values and the existing gawk code + is setting them for tests to use. + + Using reverse engineering, I have determined how to encode + the correct exit codes with severity into the old exit() + API. + + If the shell is a UNIX shell: + + * The input parameters and options are handled the same as Unix. + (I have forgotten if I sent you that patch yet) + + * The exit codes are correct. The DCL severity information + is also added even though most C programs will not use them. + +I do not know if would be permissible to change the behavior to always +use the correct exit code with the severity values set. + +Existing DCL code using the severity values would not notice this change. + +I would have to document how to convert UNIX exit codes to DCL values +for people to get the original codes back. + + + +In the documentation, I have been trying to change the case of the +filenames referenced in the VMS sections to be exact instead in upper case. + + +In general, on the older ODS-2 VMS file system, the files were stored +and displayed in upper case. + +In the newer ODS-5 file system, filenames are stored in a case preserved +state and are when unpacked from a repository are still in lower case. + +The VMS DCL shell also has an optional mode /PARSE=EXTEND mode where it +handles those names. + +In the normal mode DCL converts all unquoted parameters to upper case, +and then the C runtime converts all unquoted parameters to lower case. +A slight but significant difference. + +In the extended mode, DCL and the C runtime will also not do any +conversion of parameters. + +Which means that in extended mode, the target to the MMS or MMK program +needs to be in the exact case, or it may not be found. + +When you have an NFS mounted volume, like I do, things get a bit strange +on older VMS, like VAX/VMS, because it presents lower case filenames in +upper case, and uses the $ character to indicate when the case gets +inverted. + +Example: + +TOAD> dir src_root:[gawk.readme_d]readme.vms +%DIRECT-E-OPENIN, error opening SRC_ROOT:[GAWK.README_D]README.VMS;* as +input + +TOAD> dir src_root:[gawk.$readme_$d]$readme.vms + +Directory SRC_ROOT:[GAWK.$README_$D] + +$README.VMS;1 + +On current versions of VMS that support ODS-5, the exact case of the +files are seen. + +EAGLE> dir src_root:[gawk.readme_d]readme.vms + +Directory SRC_ROOT:[gawk.README_d] + +README.VMS;1 + +This affects build procedures as they must look for both path names. + +Regards, +-John + +--------------040502020402090508010905 +Content-Type: text/plain; charset=windows-1252; + name="gawktexti_in.gdiff" +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; + filename="gawktexti_in.gdiff" + +--- /src_root/gawk/doc/gawktexi.in Fri Dec 13 17:43:41 2013 ++++ /vms_root/gawk/doc/gawktexi.in Sun Dec 15 23:28:13 2013 +@@ -32713,6 +32713,9 @@ + @item + Prestandard VAX C compiler for VAX/VMS + ++@item ++GCC for VAX and Alpha has not been tested for a while. ++ + @end itemize + + @end itemize +@@ -33993,41 +33996,96 @@ + @appendixsubsubsec Compiling @command{gawk} on VMS + @cindex compiling @command{gawk} for VMS + +-To compile @command{gawk} under VMS, there is a @code{DCL} command procedure that +-issues all the necessary @code{CC} and @code{LINK} commands. There is +-also a @file{Makefile} for use with the @code{MMS} utility. From the source +-directory, use either: ++To compile @command{gawk} under VMS, there is a @code{DCL} command procedure ++that issues all the necessary @code{CC} and @code{LINK} commands. There is ++also a @file{Makefile} for use with the @code{MMS} or @code{MMK} utility. ++From the source directory, use either: + + @example +-$ @kbd{@@[.VMS]VMSBUILD.COM} ++$ @kbd{@@[.vms]vmsbuild.com} + @end example + + @noindent + or: + + @example +-$ @kbd{MMS/DESCRIPTION=[.VMS]DESCRIP.MMS GAWK} ++$ @kbd{MMS/DESCRIPTION=[.vms]descrip.mms gawk} + @end example ++or: ++ ++@example ++$ @kbd{MMK/DESCRIPTION=[.vms]descrip.mms gawk} ++@end example ++ ++The @code{MMK} is an open source freeware near clone of @code{MMS} and ++can better handle @code{ODS-5} volumes with upper and lower case filenames. ++@code{MMK} is available from @url{https://github.com/endlesssoftware/mmk}. ++ ++With @CODE{ODS-5} volumes and extended parsing enabled, the case of the target ++parameter may need to be exact. + + Older versions of @command{gawk} could be built with VAX C or + GNU C on VAX/VMS, as well as with DEC C, but that is no longer + supported. DEC C (also briefly known as ``Compaq C'' and now known + as ``HP C,'' but referred to here as ``DEC C'') is required. Both +-@code{VMSBUILD.COM} and @code{DESCRIP.MMS} contain some obsolete support ++@code{vmsbuild.com} and @code{descrip.mms} contain some obsolete support + for the older compilers but are set up to use DEC C by default. + +-@command{gawk} has been tested under Alpha/VMS 7.3-1 using Compaq C V6.4, +-and on Alpha/VMS 7.3, Alpha/VMS 7.3-2, and IA64/VMS 8.3.@footnote{The IA64 +-architecture is also known as ``Itanium.''} ++@command{gawk} has been tested under VAX/VMS 7.3 and Alpha/VMS 7.3-1 ++using Compaq C V6.4, and Alpha/VMS 7.3, Alpha/VMS 7.3-2, and IA64/VMS 8.3. ++Most recent builds are were using HP C V7.3 on Alpha VMS 8.3 and both ++Alpha and IA64 VMS 8.4 using HP C 7.3. ++@footnote{The IA64 architecture is also known as ``Itanium.''} ++ ++Work is currently being done for a procedure to build @code{gawk} and create ++a PCSI kit for compatible with the GNV product. ++ ++@appendixsubsubsec Compiling @command{gawk} Dynamic Extensions on VMS ++ ++Dynamic extensions need to be compiled with the same compiler options for ++floating point, pointer size, and symbol name handling as @code{gawk}. ++Alpha and Itanium should use IEEE floating point. The pointer size is 32 bits, ++and the symbol name handling is to be exact case with CRC shortening for ++symbols longer than 32 bits. ++ ++Alpha and Itanium: ++ ++@example ++/name=(as_is,short) ++/float=ieee/ieee_mode=denorm_results ++@end example ++ ++VAX: ++ ++@example ++/name=(as_is,short) ++@end example ++ ++Compile time macros needed to be defined before the first VMS supplied ++header file is included. ++ ++@example ++#if (__CRTL_VER >= 70200000) && !defined (__VAX) ++#define _LARGEFILE 1 ++#endif ++ ++#ifndef __VAX ++#ifdef __CRTL_VER ++#if __CRTL_VER >= 80200000 ++#define _USE_STD_STAT 1 ++#endif ++#endif ++#endif ++@end example + + @node VMS Installation Details + @appendixsubsubsec Installing @command{gawk} on VMS + +-To install @command{gawk}, all you need is a ``foreign'' command, which is +-a @code{DCL} symbol whose value begins with a dollar sign. For example: ++To use @command{gawk}, all you need is a ``foreign'' command, which is a ++@code{DCL} symbol whose value begins with a dollar sign. For example: + + @example +-$ @kbd{GAWK :== $disk1:[gnubin]GAWK} ++$ @kbd{GAWK :== $disk1:[gnubin]gawk} + @end example + + @noindent +@@ -34039,10 +34097,15 @@ + @file{sylogin.com} procedure, which allows all users + to run @command{gawk}. + ++If your @command{gawk} was installed by a PCSI kit into the ++@file{GNV$GNU:} directory tree, the program will be known as ++@file{GNV$GNU:[bin]gnv$gawk.exe} and the help file will be ++@file{GNV$GNU:[vms_help]gawk.hlp}. ++ + Optionally, the help entry can be loaded into a VMS help library: + + @example +-$ @kbd{LIBRARY/HELP SYS$HELP:HELPLIB [.VMS]GAWK.HLP} ++$ @kbd{LIBRARY/HELP sys$help:helplib [.vms]gawk.hlp} + @end example + + @noindent +@@ -34106,6 +34169,19 @@ + of @env{AWKPATH} is a comma-separated list of directory specifications. + When defining it, the value should be quoted so that it retains a single + translation and not a multitranslation @code{RMS} searchlist. ++ ++@node VMS GNV ++ ++The VMS GNV package provides a build environment similar to POSIX with ports ++of a collection of open source tools. The @command{gawk} found in the GNV ++base kit is an older port. Currently the GNV project is being reorganized ++to be individual PCSI packages for each component. ++@url{https://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/} ++ ++The normal build procedure @command{gawk} will produce a program that ++is suitable for use with GNV. At this time work is being done to create ++the procedures for building a PCSI kit to replace the older @code{gawk} ++port. + + @ignore + @c The VMS POSIX product, also known as POSIX for OpenVMS, is long defunct + +--------------040502020402090508010905 +Content-Type: text/plain; charset=windows-1252; + name="readme_vms.gdiff" +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; + filename="readme_vms.gdiff" + +--- /src_root/gawk/readme_d/README.VMS Fri Dec 13 17:43:41 2013 ++++ /vms_root/gawk/readme_d/README.VMS Sun Dec 15 22:57:42 2013 +@@ -37,6 +37,38 @@ + GAWK was originally ported for VMS V4.6 and up. It has not been tested + with a release that old for some time. + ++Compiling dynamic extensions on VMS: ++ ++Dynamic extensions need to be compiled with the same compiler options for ++floating point, pointer size, and symbol name handling as gawk. ++Alpha and Itanium should use IEEE floating point. The pointer size is 32 bits, ++and the symbol name handling is to be exact case with CRC shortening for ++symbols longer than 32 bits. ++ ++Alpha and Itanium: ++ ++/name=(as_is,short) ++/float=ieee/ieee_mode=denorm_results ++ ++VAX: ++ ++/name=(as_is,short) ++ ++Compile time macros needed to be defined before the first VMS supplied ++header file is included. ++ ++#if (__CRTL_VER >= 70200000) && !defined (__VAX) ++#define _LARGEFILE 1 ++#endif ++ ++#ifndef __VAX ++#ifdef __CRTL_VER ++#if __CRTL_VER >= 80200000 ++#define _USE_STD_STAT 1 ++#endif ++#endif ++#endif ++ + + Installing GAWK on VMS: + +@@ -47,6 +79,10 @@ + That symbol should be placed in the user's login.com or in the system- + wide sylogin.com procedure so that it will be defined every time the + user logs on. ++ ++If your gawk was installed by a PCSI kit into the GNV$GNU: directory tree, ++the program will be known as GNV$GNU:[bin]gnv$gawk.exe and the help file ++will be GNV$GNU:[vms_help]gawk.hlp. + + Optionally, the help entry can be loaded into a VMS help library. + |$ LIBRARY/HELP SYS$HELP:HELPLIB [.VMS]GAWK.HLP + +--------------040502020402090508010905-- + +From wb8tyw@qsl.net Wed Dec 11 20:03:44 2013 +Return-Path: <wb8tyw@qsl.net> +Received: from skeeve.com (skeeve.com [127.0.0.1]) + by skeeve.com (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id rBBI3gNX002464 + for <arnold@localhost>; Wed, 11 Dec 2013 20:03:43 +0200 +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + frenzy.freefriends.org +X-Spam-Level: +X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM + autolearn=ham version=3.3.1 +X-Envelope-From: wb8tyw@qsl.net +X-Envelope-To: <arnold@skeeve.com> +Received: from frenzy.freefriends.org [66.54.153.139] + by skeeve.com with IMAP (fetchmail-6.3.21) + for <arnold@localhost> (single-drop); Wed, 11 Dec 2013 20:03:43 +0200 (IST) +Received: from Encompasserve.org (Eisner.encompasserve.org [67.53.90.116]) + by freefriends.org (8.14.6/8.14.6) with ESMTP id rBB5jaW9020988 + for <arnold@skeeve.com>; Tue, 10 Dec 2013 22:45:40 -0700 +Received: from [192.168.0.101] + (173-19-202-206.client.mchsi.com [173.19.202.206]) + by Encompasserve.org (PMDF V6.6 #13031) + with ESMTPSA id <01P1SYL5LELG002FZE@Encompasserve.org> for arnold@skeeve.com; + Tue, 10 Dec 2013 23:45:35 -0600 (CST) +Date: Tue, 10 Dec 2013 23:45:36 -0600 +From: "John E. Malmberg" <wb8tyw@qsl.net> +Subject: Re: Some questions... +In-reply-to: <201312110426.rBB4QXXc003297@skeeve.com> +To: Aharon Robbins <arnold@skeeve.com> +Cc: wb8tyw@qsl.net +Message-id: <52A7FC00.2040905@qsl.net> +MIME-version: 1.0 +Content-type: text/plain; charset=ISO-8859-1; format=flowed +Content-transfer-encoding: 7BIT +User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130215 + Thunderbird/17.0.3 +References: <529A9537.7090404@qsl.net> <201312110426.rBB4QXXc003297@skeeve.com> +Status: R + +On 12/10/2013 10:26 PM, Aharon Robbins wrote: +> Hi. Some questions about your changes. +> +> 1. I notice that there is at least one instance of #if __VMS, where as +> it seems most code uses #if VMS. Is that on purpose? If not, which +> is correct? + +VMS is a macro historically pre-defined by C compilers on C before the +ANSI rules. + +Under strict ANSI rules, a standards compliant compiler is not allowed +to pre-define macros that are not prefixed by "__". + +Which means that you can not count on the VMS macro being defined unless +you do it yourself. + +So __VMS is the ANSI correct definition. But it would be a lot of work +to change all the code. + +The vms_config.h that is now generated has these lines in it to make +sure that VMS is defined. + +#ifdef __VMS /* ANSI compliant */ +#ifndef VMS /* PRE-ansi */ +#define VMS 1 +#endif +#endif + +This may be needed for other architectures. It only shows up as an +issue if you set a "strict" compliance flag on the compile command. + +> 2. For the include of the main wrapper. Gawk already has a routine +> os_arg_fixup which is intended to manipulate argc and argv as needed +> by an OS-specific routine before main() parses it. A quick look at +> the wrapper looks to me like it could be made to fit within that framework, +> which would keep #if and the include out of the mainline code. + +I can look at that. I can also look to see if I can move the logic from +vms_crtl_init.c into it in a way that would sidestep that it has no +copyright notice at all. The result would be code that is almost +identical to code that is in the official Perl distribution. + +GNV was started as a user project and when the VMS POSIX product was +dropped and they needed a Unix like environment, Digital took over the +GNV product, but did not really do much to keep it up to date. + +The routine in vms_crtl_init.c is actually called before main() is +called, so just linking a module with it in is all that it takes to +activate the change. Unfortunately I do not know how to get it to +magically fix up the argv array. + +> If that looks reasonable to you, can you make that change? You can send +> it as a diff against what you currently have already done. + +I will look at it tomorrow night. I also found another change needed +for vms_args.c to work properly under a bash shell. + +> I'm sorry about the hassle on the copyrights, but I really have to play +> this game by the FSF rules. I hope we can get it clarified soon +> so that I can include the files in the dist. + +I hope so. I have not seen a reply from Karl yet. He did say that +there are other options. + +This would clear the way for getting the similar code accepted into the +Bash and coreutils repositories. I have a report that the first bash +4.3 beta built on VMS and looked real good on the test run. + +I am currently working on adapting the packaging scripts from bash and +coreutils to gawk. Each product has had it unique features, so I have +not yet come up with a generic set of scripts. + +This is a preview what will be coming: + +backup_gawk_src.com - Builds a VMS equivalent to tar archive. By +placing the source in the PCSI kit, it covers the requirement of +providing source somewhere with the binary. + +build_gawk_pcsi_desc.com - Creates a VMS PCSI package manifest file. + +build_gawk_pcsi_text.com - text output by the VMS PCSI package installer. + +compare_gawk_source.com - I have the source checked out on an NFS +server. The backup program needs me to copy it to a VMS volume first. +This procedure makes sure that the two copies are the same and ready for +backup. + +gawk_alias_setup.com - Sets up gawk and awk links to gnv$gawk.exe. +Needed to repair when sins of the past partially break an install. + +gawk_verb.cld - for gawk to use gnv$gawk.exe as an image. Different +than gawk.cld. To properly add an image to the VMS command table, it +needs a prefix. I have "GNV$" registered as a prefix for this purpose. + +gnv_gawk_kit_name.com - Calculates the VMS PCSI package name, used for +both file names and file contents. + +gnv_gawk_startup.com - Run at VMS startup to make sure that the +environment is set up properly for gawk. + +pcsi_gawk_file_list.txt - Source file for build_gawk_pcsi_desc.com. + +remove_old_gawk.com - Needed to properly clean up sins of the past. +Only touches the the GNV provided gawk and awk programs. + +stage_gawk_install.com - Does a pre-install into a fake "root" directory +tree for the kitting procedure to pull files out of. + +Regards, +-John + @@ -54,26 +54,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(void); -extern U_Long lib$find_file(const Dsc *, Dsc *, void *, ...); -extern U_Long lib$find_file_end(void *); +extern U_Long LIB$FIND_FILE(const Dsc *, Dsc *, void *, ...); +extern U_Long LIB$FIND_FILE_END(void *); #ifndef NO_TTY_FWRITE -extern U_Long lib$get_ef(long *); -extern U_Long sys$assign(const Dsc *, short *, long, const Dsc *); -extern U_Long sys$dassgn(short); -extern U_Long sys$qio(U_Long, U_Long, U_Long, void *, +extern U_Long LIB$GET_EF(long *); +extern U_Long SYS$ASSIGN(const Dsc *, short *, long, const Dsc *); +extern U_Long SYS$DASSGN(short); +extern U_Long SYS$QIO(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(long, void *); +extern U_Long SYS$SYNCH(long, void *); #endif /*!NO_TTY_FWRITE*/ -extern U_Long lib$spawn(const Dsc *,const Dsc *,const Dsc *, +extern U_Long LIB$SPAWN(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(const U_Long *,const Dsc *,const Dsc *, +extern U_Long SYS$TRNLNM(const U_Long *,const Dsc *,const Dsc *, const unsigned char *,Itm *); -extern U_Long sys$crelnm(const U_Long *,const Dsc *,const Dsc *, +extern U_Long SYS$CRELNM(const U_Long *,const Dsc *,const Dsc *, const unsigned char *,const Itm *); -extern U_Long sys$crelog(int,const Dsc *,const Dsc *,unsigned char); -extern U_Long sys$dellnm(const Dsc *,const Dsc *,const unsigned char *); +extern U_Long SYS$CRELOG(int,const Dsc *,const Dsc *,unsigned char); +extern U_Long SYS$DELLNM(const Dsc *,const Dsc *,const unsigned char *); extern void v_add_arg(int, const char *); extern void vms_exit(int); diff --git a/vms/vms_args.c b/vms/vms_args.c index 0a296105..12165131 100644 --- a/vms/vms_args.c +++ b/vms/vms_args.c @@ -1,7 +1,7 @@ /* vms_args.c -- command line parsing, to emulate shell i/o redirection. [ Escape sequence parsing now suppressed. ] - Copyright (C) 1991-1996, 1997, 2011 the Free Software Foundation, Inc. + Copyright (C) 1991-1996, 1997, 2011, 2014 the Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -106,10 +106,26 @@ vms_arg_fixup( int *pargc, char ***pargv ) char **argv = *pargv; int i, argc = *pargc; int err_to_out_redirect = 0, out_to_err_redirect = 0; + char * shell; + int using_shell; /* make sure AWK_LIBRARY has a value */ if (!getenv("AWK_LIBRARY")) vms_define("AWK_LIBRARY", "SYS$LIBRARY:"); + + /* Check if running under a shell instead of DCL */ + using_shell = 1; + shell = getenv("SHELL"); + if (shell != NULL) { + if (strcmp(shell, "DCL") == 0) { + using_shell = 0; + } + } else { + using_shell = 0; + } + if (using_shell) { + return; + } #ifdef CHECK_DECSHELL /* don't define this if linking with DECC$SHR */ if (shell$is_shell()) return; /* don't do anything if we're running DEC/Shell */ @@ -325,12 +341,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; @@ -395,7 +411,7 @@ 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' */ diff --git a/vms/vms_cli.c b/vms/vms_cli.c index ac793c1a..08e2d142 100644 --- a/vms/vms_cli.c +++ b/vms/vms_cli.c @@ -1,6 +1,6 @@ /* vms_cli.c -- interface to CLI$xxx routines for fetching command line components - Copyright (C) 1991-1993, 2003, 2011 the Free Software Foundation, Inc. + Copyright (C) 1991-1993, 2003, 2011, 2014 the Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,13 +29,13 @@ #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 */ @@ -43,10 +43,10 @@ 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); + return CLI$PRESENT(&item_dsc); } /* Cli_Get_Value() - call CLI$GET_VALUE to retreive the value of a */ @@ -57,11 +57,11 @@ Cli_Get_Value( const char *item, char *result, int size ) Dsc item_dsc, res_dsc; 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; - sts = cli$get_value(&item_dsc, &res_dsc, &len); + sts = CLI$GET_VALUE(&item_dsc, &res_dsc, &len); result[len] = '\0'; return sts; } @@ -79,11 +79,11 @@ Cli_Parse_Command( const void *cmd_tables, const char *cmd_verb ) U_Long sts; int ltmp; char longbuf[8200]; - (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) */ @@ -92,7 +92,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 */ } @@ -102,7 +102,7 @@ Cli_Parse_Command( const void *cmd_tables, const char *cmd_verb ) cmd.rdesc.len = sizeof longbuf - ltmp; strncpy(&longbuf[ltmp], cmd.rdesc.adr, cmd.rdesc.len); cmd.rdesc.len += ltmp, cmd.rdesc.adr = longbuf; - sts = cli$dcl_parse(&cmd.rdesc, cmd_tables); + sts = CLI$DCL_PARSE(&cmd.rdesc, cmd_tables); } return sts; diff --git a/vms/vms_crtl_init.c b/vms/vms_crtl_init.c new file mode 100644 index 00000000..081ae2cc --- /dev/null +++ b/vms/vms_crtl_init.c @@ -0,0 +1,470 @@ +/* File: VMS_CRTL_INIT.C + + This file is common to a lot of projects. + + $Id: vms_crtl_init.c,v 1.1.1.1 2012/12/02 19:25:22 wb8tyw Exp $ + + Module that provides a LIB$INITIALIZE routine for the GNV toolset that + will turn on some CRTL features that are not enabled by default. + + The CRTL features can also be turned on via logical names, but that + impacts all programs and some aren't ready, willing, or able to handle + the settings that GNV needs. + + The original module was found linked with GPL V2 modules, and thus must + be able to be distributed under the GPL V2 provisions. + + As this module or similar is needed for virtually all programs built to run + under GNV or UNIX, it can be distributed with other licenses. + + Edit History + + 1-001 John Reagan Initial version using the old style interface + but with the new version commented out. + + 1-002 John Reagan Switch to new API for setting features + + 1-003 Steve Pitcher Add DECC$RENAME_NO_INHERIT. + + 1-004 Steve Pitcher Quiet these, if the DECC feature doesn't exist. + + 2-001 J. Malmberg New GNV requirements: + Three variations of object modules: + 1. For use with shells, sets the logical + name GNV$UNIX_SHELL. + + 2. For utilities, if the logical name + GNV$UNIX_SHELL is set, it means that the + settings should assume that they are + running under a UNIX like shell. + + 3. A third setting is for utilities that + always should behave as if they are + running under a UNIX shell. + + If GNV$GNU is defined, then locally define + SYS$POSIX_ROOT to it. GNV$GNU can be set in + the SYSTEM table by the GNV setup. + SYS$POSIX_ROOT can not. + + The logical name BIN also needs to be defined + here, otherwise the CRTL replaces it with + SYS$SYSTEM: + + Never set the POSIX UID here, it will break + every reference to a GID/UID on systems that + do not have every VMS account mapped to a UID/GID + by TCPIP services. + + Reformat text to fit 80 columns. + + Remove all VAX C specific code. + + Linker is probably using exact case, so public + symbols for LIB$* and SYS$* must be in upper case. + + 2-002 J. Malmberg Support for VAX builds. OpenVMS/VAX does not have the + 17-Jun-2010 DECC$FEATURE routines. At this time I will not + be concerned if a feature setting exists on VAX, + as all we are doing is setting a logical name. + + 2-003 J. Malmberg Add DECC$FILENAME_UNIX_NOVERSION as version numbers + will usually mess up ported programs. + +*/ + +#include <stdio.h> +#include <descrip.h> +#include <lnmdef.h> +#include <stsdef.h> +#include <string.h> + +#pragma message disable pragma +#pragma message disable dollarid +#pragma message disable valuepres + +#pragma member_alignment save +#pragma nomember_alignment longword +#pragma message save +#pragma message disable misalgndmem +struct itmlst_3 { + unsigned short int buflen; + unsigned short int itmcode; + void *bufadr; + unsigned short int *retlen; +}; +#pragma message restore +#pragma member_alignment restore + +#ifdef __VAX +#define ENABLE "ENABLE" +#define DISABLE "DISABLE" +#else + +#define ENABLE TRUE +#define DISABLE 0 +int decc$feature_get_index (const char *name); +int decc$feature_set_value (int index, int mode, int value); + +#endif + +int SYS$TRNLNM( + const unsigned long * attr, + const struct dsc$descriptor_s * table_dsc, + struct dsc$descriptor_s * name_dsc, + const unsigned char * acmode, + const struct itmlst_3 * item_list); +int SYS$CRELNM( + const unsigned long * attr, + const struct dsc$descriptor_s * table_dsc, + const struct dsc$descriptor_s * name_dsc, + const unsigned char * acmode, + const struct itmlst_3 * item_list); +int LIB$SIGNAL(int); + +/* Take all the fun out of simply looking up a logical name */ +static int sys_trnlnm + (const char * logname, + char * value, + int value_len) +{ + const $DESCRIPTOR(table_dsc, "LNM$FILE_DEV"); + const unsigned long attr = LNM$M_CASE_BLIND; + struct dsc$descriptor_s name_dsc; + int status; + unsigned short result; + struct itmlst_3 itlst[2]; + + itlst[0].buflen = value_len; + itlst[0].itmcode = LNM$_STRING; + itlst[0].bufadr = value; + itlst[0].retlen = &result; + + itlst[1].buflen = 0; + itlst[1].itmcode = 0; + + name_dsc.dsc$w_length = strlen(logname); + name_dsc.dsc$a_pointer = (char *)logname; + name_dsc.dsc$b_dtype = DSC$K_DTYPE_T; + name_dsc.dsc$b_class = DSC$K_CLASS_S; + + status = SYS$TRNLNM(&attr, &table_dsc, &name_dsc, 0, itlst); + + if ($VMS_STATUS_SUCCESS(status)) { + + /* Null terminate and return the string */ + /*--------------------------------------*/ + value[result] = '\0'; + } + + return status; +} + +/* How to simply create a logical name */ +static int sys_crelnm + (const char * logname, + const char * value) +{ + int ret_val; + const char * proc_table = "LNM$PROCESS_TABLE"; + struct dsc$descriptor_s proc_table_dsc; + struct dsc$descriptor_s logname_dsc; + struct itmlst_3 item_list[2]; + + proc_table_dsc.dsc$a_pointer = (char *) proc_table; + proc_table_dsc.dsc$w_length = strlen(proc_table); + proc_table_dsc.dsc$b_dtype = DSC$K_DTYPE_T; + proc_table_dsc.dsc$b_class = DSC$K_CLASS_S; + + logname_dsc.dsc$a_pointer = (char *) logname; + logname_dsc.dsc$w_length = strlen(logname); + logname_dsc.dsc$b_dtype = DSC$K_DTYPE_T; + logname_dsc.dsc$b_class = DSC$K_CLASS_S; + + item_list[0].buflen = strlen(value); + item_list[0].itmcode = LNM$_STRING; + item_list[0].bufadr = (char *)value; + item_list[0].retlen = NULL; + + item_list[1].buflen = 0; + item_list[1].itmcode = 0; + + ret_val = SYS$CRELNM(NULL, &proc_table_dsc, &logname_dsc, NULL, item_list); + + return ret_val; +} + + + /* Start of DECC RTL Feature handling */ + +/* +** Sets default value for a feature +*/ +#ifdef __VAX +static void set_feature_default(const char *name, const char *value) +{ + sys_crelnm(name, value); +} +#else +static void set_feature_default(const char *name, int value) +{ + int index; + + index = decc$feature_get_index(name); + + if (index > 0) + decc$feature_set_value (index, 0, value); +} +#endif + +static void set_coe ( void ) +{ + + char gnv_posix_root[4096]; + char unix_shell_name[255]; + int use_unix_settings = 0; + int status; + int gnv_posix_root_found = 0; + + /* If this is compiled for use with a UNIX shell, then the logical + * name GNV$UNIX_SHELL will be set to that shell name. + * + * Else, if the GNV$UNIX_SHELL logical name is set, then this application + * is running under some UNIX like shell, so it should modify it's + * behavior to be UNIX like. + * + * If the above logical name is not set, then the application should + * expect that it is running under DCL, and should expect VMS filenames + * on input, and may need to output filenames in VMS format. + * + * This can be overriden at compile time with GNV_UNIX_TOOL being + * defined. + * + * So this means that there will be multiple object modules from this + * source module. One for each shell, one for programs that can function + * in both DCL and UNIX environments, and one for programs that require + * a UNIX environment. + */ + +#ifdef GNV_UNIX_SHELL + use_unix_settings = 1; + + status = sys_crelnm("GNV$UNIX_SHELL", GNV_UNIX_SHELL); + if (!$VMS_STATUS_SUCCESS(status)) { + /* We have a big problem */ + LIB$SIGNAL(status); + } +#else + +#ifdef GNV_UNIX_TOOL + use_unix_settings = 1; +#else + status = sys_trnlnm("GNV$UNIX_SHELL", + unix_shell_name, sizeof + unix_shell_name -1); + if (!$VMS_STATUS_SUCCESS(status)) { + unix_shell_name[0] = 0; + use_unix_settings = 0; + } +#endif /* GNV_UNIX_TOOL */ + +#endif /* GNV_UNIX_SHELL */ + + /* New style interface that works only on very recent + (Apr 2001 and beyond) CRTLs */ + + /* + * Only setting defaults allows logical names to + * override these settings. + */ + + /* Always set */ + + /* ACCESS should check ACLs or it is lying. */ + set_feature_default("DECC$ACL_ACCESS_CHECK" , ENABLE); + + /* We always want the new parse style */ + set_feature_default ("DECC$ARGV_PARSE_STYLE" , ENABLE); + + /* Unless we are in POSIX compliant mode, we want the old POSIX root + * enabled. + */ + set_feature_default("DECC$DISABLE_POSIX_ROOT", DISABLE); + + /* EFS charset, means UTF-8 support */ + /* VTF-7 support is controlled by a feature setting called UTF8 */ + set_feature_default ("DECC$EFS_CHARSET" , ENABLE); + set_feature_default ("DECC$EFS_CASE_PRESERVE" , ENABLE); + + + /* Support timestamps when available */ + set_feature_default ("DECC$EFS_FILE_TIMESTAMPS" , ENABLE); + + /* Cache environment varibles - performance improvements */ + set_feature_default ("DECC$ENABLE_GETENV_CACHE" , ENABLE); + + /* Start out with new file attribute inheritance */ +#ifdef __VAX + set_feature_default ("DECC$EXEC_FILEATTR_INHERITANCE", "2"); +#else + set_feature_default ("DECC$EXEC_FILEATTR_INHERITANCE", 2); +#endif + + /* Don't display trailing dot after files without type */ + set_feature_default ("DECC$READDIR_DROPDOTNOTYPE" , ENABLE); + + /* For standard output channels buffer output until terminator */ + /* Gets rid of output logs with single character lines in them. */ + set_feature_default ("DECC$STDIO_CTX_EOL" , ENABLE); + + /* Fix mv aa.bb aa */ + set_feature_default ("DECC$RENAME_NO_INHERIT" , ENABLE); + + if (use_unix_settings) { + + /* POSIX requires that open files be able to be removed */ + set_feature_default ("DECC$ALLOW_REMOVE_OPEN_FILES", ENABLE); + + set_feature_default ("DECC$FILENAME_UNIX_ONLY" , ENABLE); + /* FILENAME_UNIX_ONLY Implicitly sets + decc$disable_to_vms_logname_translation */ + + set_feature_default ("DECC$FILE_PERMISSION_UNIX", ENABLE); + + /* For now this only with UNIX mode, applications can override + * with out using a LIB$INITIALIZE setting. + * This should be an application specific setting only enabled + * if the application requires it. + * Left here for now for backwards compatibility + */ + set_feature_default ("DECC$FILE_SHARING" , ENABLE); + + set_feature_default ("DECC$FILE_OWNER_UNIX" , ENABLE); + set_feature_default ("DECC$POSIX_SEEK_STREAM_FILE", ENABLE); + + } else { + set_feature_default("DECC$FILENAME_UNIX_REPORT", ENABLE); + } + + /* When reporting UNIX filenames, glob the same way */ + set_feature_default ("DECC$GLOB_UNIX_STYLE" , ENABLE); + + /* The VMS version numbers on Unix filenames is incompatible with most */ + /* ported packages. */ + set_feature_default("DECC$FILENAME_UNIX_NO_VERSION", ENABLE); + + /* The VMS version numbers on Unix filenames is incompatible with most */ + /* ported packages. */ + set_feature_default("DECC$UNIX_PATH_BEFORE_LOGNAME", ENABLE); + + /* Set strtol to proper behavior */ + set_feature_default("DECC$STRTOL_ERANGE", ENABLE); + + /* Pipe feature settings are longer needed with virtual memory pipe + code. Programs that use pipe need to be converted to use the + virtual memory pipe code, which effectively removes the hangs and + left over temporary files. + + Comment left here to prevent regressions, as the larger pipe size + actually hurts memory usage with the new algorithm. + */ + /* do_not_set_default ("DECC$PIPE_BUFFER_SIZE" , 8192); */ + + + /* Rather than remove this completely, a comment is left here to warn + * someone from putting this bug back in. + * + * POSIX style UIDs require that the system administrator have set the + * system up to use POSIX style UIDs and GIDs. And if they have done + * so, then they should set the DECC$POSIX_STYLE_UID as a system wide + * logical name. + * + * Setting them in a program will break all routines that expect GID/UID + * stuff to work on systems set up by default with out mappings. + * + * Most utilities do not reference GID/UID values, so it took a while for + * this bug to surface. + */ + /* do_not_set_default ("DECC$POSIX_STYLE_UID" , TRUE); */ + + + + /* GNV depends on SYS$POSIX_ROOT to be properly set. Since SYS$POSIX_ROOT + * globally affects all C applications, SYS$POSIX_ROOT can not be set + * anywhere that can be seen by other applications. + * + * So GNV$GNU is used instead, and SYS$POSIX_ROOT will be set in + * in the process table in user mode to that value. + * + * Restriction: The system manager should not point GNV$GNU at + * SYS$POSIX_ROOT, or anything that resolves to SYS$POSIX_ROOT. + * + */ + + status = sys_trnlnm("GNV$GNU", + gnv_posix_root, + sizeof gnv_posix_root - 1); + if ($VMS_STATUS_SUCCESS(status)) { + status = sys_crelnm("SYS$POSIX_ROOT", "GNV$GNU:"); + gnv_posix_root_found = 1; + } + + /* GNV depends on BIN being set to GNV$GNU:[bin]. Since BIN + * is not prefixed, and it affects everything globally, it needs to + * be set here if it is not defined already. + * If it is set already, assume that it is correct, rather than + * trying to second guess the user. + * If GNV$GNU is not defined, then define bin to be SYS$POSIX_ROOT. + */ + + status = sys_trnlnm("BIN", + gnv_posix_root, + sizeof gnv_posix_root - 1); + if (!$VMS_STATUS_SUCCESS(status)) { + if (gnv_posix_root_found) { + status = sys_crelnm("BIN", "GNV$GNU:[BIN]"); + } else { + status = sys_crelnm("BIN", "SYS$POSIX_ROOT:[BIN]"); + } + } + +} + +#pragma nostandard +#pragma extern_model save +#ifdef __VAX +#pragma extern_model strict_refdef "LIB$INITIALIZE" nowrt, long, nopic +#else +#pragma extern_model strict_refdef "LIB$INITIALIZE" nowrt, long +# if __INITIAL_POINTER_SIZE +# pragma __pointer_size __save +# pragma __pointer_size 32 +# else +# pragma __required_pointer_size __save +# pragma __required_pointer_size 32 +# endif +#endif +/* Set our contribution to the LIB$INITIALIZE array */ +void (* const iniarray[])(void) = {set_coe, } ; +#ifndef __VAX +# if __INITIAL_POINTER_SIZE +# pragma __pointer_size __restore +# else +# pragma __required_pointer_size __restore +# endif +#endif + + +/* +** Force a reference to LIB$INITIALIZE to ensure it +** exists in the image. +*/ +int LIB$INITIALIZE(void); +#ifdef __DECC +#pragma extern_model strict_refdef +#endif + int lib_init_ref = (int) LIB$INITIALIZE; +#ifdef __DECC +#pragma extern_model restore +#pragma standard +#endif diff --git a/vms/vms_fwrite.c b/vms/vms_fwrite.c index 1a16f58c..f29ec832 100644 --- a/vms/vms_fwrite.c +++ b/vms/vms_fwrite.c @@ -1,6 +1,6 @@ /* vms_fwrite.c - augmentation for the fwrite() function. - Copyright (C) 1991-1996, 2010, 2011 the Free Software Foundation, Inc. + Copyright (C) 1991-1996, 2010, 2011, 2014 the Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -83,9 +83,9 @@ tty_fwrite( const void *buf, size_t size, size_t number, FILE *file ) 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 */ @@ -119,19 +119,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 (*)(U_Long))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; @@ -202,7 +202,7 @@ tty_fclose( FILE *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 f22e2fa9..4080e1db 100644 --- a/vms/vms_gawk.c +++ b/vms/vms_gawk.c @@ -1,6 +1,7 @@ /* vms_gawk.c -- parse GAWK command line using DCL syntax - Copyright (C) 1991-1993, 1996, 2003, 2005, 2011 the Free Software Foundation, Inc. + Copyright (C) 1991-1993, 1996, 2003, 2005, 2011, 2014 + the Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,16 +38,16 @@ #define Present(arg) vmswork(Cli_Present(arg)) #define Get_Value(arg,buf,siz) vmswork(Cli_Get_Value(arg,buf,siz)) -#ifndef __ia64__ -extern void gawk_cmd(); /* created with $ SET COMMAND/OBJECT */ -#define GAWK_CMD ((const void *)gawk_cmd) -#else /* linker on Itanium is much pickier about such things */ +#ifndef __DECC +extern void GAWK_CMD(); /* created with $ SET COMMAND/OBJECT */ +#define gawk_cmd ((const void *)GAWK_CMD) */ +#else /* Use ANSI definitions for DEC C */ #pragma extern_model save #pragma extern_model strict_refdef /* (could use globalvalue rather than _refdef if we omit GAWK_CMD's `&') */ -extern void *gawk_cmd; +extern void *GAWK_CMD; #pragma extern_model restore -#define GAWK_CMD ((const void *)&gawk_cmd) +#define gawk_cmd ((const void *)&GAWK_CMD) #endif extern void _exit(int); static int vms_usage(int); @@ -88,7 +89,7 @@ vms_gawk() command, so we'll now attempt to generate a command from the foreign command string and parse that. */ - sts = Cli_Parse_Command(GAWK_CMD, "GAWK"); /* (*not* CmdName) */ + sts = Cli_Parse_Command(gawk_cmd, "GAWK"); /* (*not* CmdName) */ if (vmswork(sts)) sts = Cli_Present("GAWK_P1"); } diff --git a/vms/vms_misc.c b/vms/vms_misc.c index cd92d7ef..82c2f8a8 100644 --- a/vms/vms_misc.c +++ b/vms/vms_misc.c @@ -1,6 +1,6 @@ /* vms_misc.c -- sustitute code for missing/different run-time library routines. - Copyright (C) 1991-1993, 1996-1997, 2001, 2003, 2009, 2010, 2011 + Copyright (C) 1991-1993, 1996-1997, 2001, 2003, 2009, 2010, 2011, 2014 the Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -118,15 +118,24 @@ vms_open( const char *name, int mode, ... ) result = creat(name, 0, "rfm=stmlf", "rat=cr", "shr=nil", "mbc=32"); } else { struct stat stb; + int stat_result; const char *mbc, *shr = "shr=get", *ctx = "ctx=stm"; - - if (stat((char *)name, &stb) < 0) { /* assume DECnet */ + + stat_result = stat((char *)name, &stb); + if ( stat_result < 0) { /* assume DECnet */ mbc = "mbc=8"; } else { /* ordinary file; allow full sharing iff record format */ mbc = "mbc=32"; if ((stb.st_fab_rfm & 0x0F) < FAB$C_STM) shr = "shr=get,put,upd"; } result = open(name, mode, 0, shr, mbc, "mbf=2"); + if ((stat_result >= 0) && (result < 0) && (errno == ENOENT)) { + /* ENOENT not possible because stat succeeded */ + errno = EMFILE; + if (S_ISDIR(stb.st_mode)) { + errno = EISDIR; /* Bug seen in VMS 8.3 */ + } + } } /* This is only approximate; the ACP -> RMS -> VAXCRTL interface @@ -165,8 +174,8 @@ vms_devopen( const char *name, int mode ) #define VMS_UNITS_PER_SECOND 10000000L /* hundreds of nanoseconds, 1e-7 */ #define UNIX_EPOCH "01-JAN-1970 00:00:00.00" -extern U_Long sys$bintim(), sys$gettim(); -extern U_Long lib$subx(), lib$ediv(); +extern U_Long SYS$BINTIM(), SYS$GETTIM(); +extern U_Long LIB$SUBX(), LIB$EDIV(); /* * Get current time in microsecond precision. @@ -183,13 +192,13 @@ vms_gettimeofday(struct timeval *tv, void *timezone__not_used) const long thunk = VMS_UNITS_PER_SECOND; long now[2], quad[2]; - if (!epoch[0]) sys$bintim(&epoch_dsc, epoch); /* 1 Jan 0:0:0 1970 */ + if (!epoch[0]) SYS$BINTIM(&epoch_dsc, epoch); /* 1 Jan 0:0:0 1970 */ /* get current time, as VMS quadword time */ - sys$gettim(now); + SYS$GETTIM(now); /* convert the quadword time so that it's relative to Unix epoch */ - lib$subx(now, epoch, quad); /* quad = now - epoch; */ + LIB$SUBX(now, epoch, quad); /* quad = now - epoch; */ /* convert 1e-7 units into seconds and fraction of seconds */ - lib$ediv(&thunk, quad, &tv->tv_sec, &tv->tv_usec); + LIB$EDIV(&thunk, quad, &tv->tv_sec, &tv->tv_usec); /* convert fraction of seconds into microseconds */ tv->tv_usec /= (VMS_UNITS_PER_SECOND / 1000000); @@ -272,7 +281,7 @@ int fork( void ) { #include <fab.h> #include <nam.h> -extern unsigned long sys$parse(), sys$search(); +extern unsigned long SYS$PARSE(), SYS$SEARCH(); /* Work around a VAXCRTL bug. If a file is located via a searchlist, and if the device it's on is not the same device as the one specified diff --git a/vms/vms_popen.c b/vms/vms_popen.c index 62f3f719..23482df1 100644 --- a/vms/vms_popen.c +++ b/vms/vms_popen.c @@ -1,6 +1,7 @@ /* [.vms]vms_popen.c -- substitute routines for missing pipe calls. - Copyright (C) 1991-1993, 1996, 2010, 2011 the Free Software Foundation, Inc. + Copyright (C) 1991-1993, 1996, 2010, 2011, 2014 + the Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -133,8 +134,8 @@ pclose( FILE *current ) int rval, cur = fileno(current); /* assert( cur >= 0 && cur < pipes_lim ); */ - if (pipes[cur].pmode == unopened) - return -1; /* should never happen */ + if ((cur < 0) || (pipes[cur].pmode == unopened)) + return -1; /* should never happen, but does with two-way */ rval = fclose(current); /* close temp file; if reading, we're done */ if (pipes[cur].pmode == writing) { @@ -172,7 +173,7 @@ 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, (U_Long *)0, + sts = LIB$SPAWN(&cmd, in_p, out_p, (U_Long *)0, (Dsc *)0, (U_Long *)0, &cmpltn_sts); pop_logicals(); /* restore environment */ @@ -219,9 +220,9 @@ 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)) @@ -333,7 +334,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 95c6aeb3..2c0d39f0 100644 --- a/vms/vmsbuild.com +++ b/vms/vmsbuild.com @@ -15,9 +15,18 @@ $! $ REL = "4.1" !release version number $ PATCHLVL = "0" $! +$ if (f$getsyi("HW_MODEL") .lt. 1024) +$ then +$ arch_name = "VAX" +$ else +$ arch_name = f$edit(f$getsyi("ARCH_NAME"), "UPCASE") +$ endif $! $ CCFLAGS = "/noList" ! "/noOpt/Debug" +$! CCFLAGS = "/list/show=(expan,incl) $ CDEFS = "GAWK,HAVE_CONFIG_H" +$! Do not specify _POSIX_EXIT here, we are using other tricks for that. +$! $! $ if p1.eqs."" then p1 = "DECC" !default compiler $ if p1.eqs."GNUC" @@ -38,8 +47,17 @@ $ 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) +$ if arch_name .eqs. "vax" +$ then +$ CFLOAT = "" +$ else +$ CFLOAT = "/float=ieee/ieee_mode=denorm_results" +$ endif $ CC = "cc/DECC/Prefix=All" -$ CFLAGS = "/Incl=[]/Obj=[]/Def=(''CDEFS')''CCFLAGS'" +$ CNAME = "/NAME=(AS_IS,SHORT) +$ CINC = "/NESTED_INCLUDE=NONE" +$ CFLAGS = "/Incl=([],[.vms])/Obj=[]/Def=(''CDEFS')''CINC'''CCFLAGS'" +$ CFLAGS = CNAMES + CFLOAT + CFLAGS $ LIBS = "" ! DECC$SHR instead of VAXCRTL, no special link option needed $ endif !VAXC $ endif !GNUC @@ -47,12 +65,15 @@ $! $ 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)' +$ if f$search("config.h") .nes. "" +$ then +$ if f$cvtime(f$file_attr("config.h", "RDT")) .ges. - + f$cvtime(f$file_attr("configh.in","RDT")) then goto config_ok +$ endif +$ v = f$verify(0) +$ @[.vms]generate_config_vms_h_gawk.com +$ @[.vms]config_h.com NOBUILTINS +$! $config_ok: $ if f$search("awkgram.c").nes."" then goto awkgram_ok $ write sys$output " You must process `awkgram.y' with ""yacc"" or ""bison""" @@ -70,7 +91,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 `command.c'." $ exit $command_ok: -$ v = f$verify(1) +$ v1 = f$verify(1) $ cc array.c $ cc awkgram.c $ cc builtin.c @@ -106,7 +127,8 @@ $ 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 +$ cc [.vms]vms_crtl_init.c +$ set command/Object=[]gawk_cmd.obj sys$disk:[.vms]gawk.cld $! 'f$verify(v)' $! $ close/noLog Fopt @@ -116,18 +138,21 @@ array.obj,awkgram.obj,builtin.obj,dfa.obj,ext.obj,field.obj,floatcomp.obj gawkmisc.obj,getopt.obj,getopt1.obj,io.obj main.obj,msg.obj,node.obj random.obj,re.obj,regex.obj,replace.obj,version.obj,eval.obj,profile.obj -command.obj,debug.obj,int_array.obj,cint_array.obj,gawkapi.obj,mpfr.obj,str_array.obj,symbol.obj +command.obj,debug.obj,int_array.obj,cint_array.obj,gawkapi.obj,mpfr.obj +str_array.obj,symbol.obj []vms_misc.obj,vms_popen.obj,vms_fwrite.obj,vms_args.obj -[]vms_gawk.obj,vms_cli.obj,gawk_cmd.obj +[]vms_gawk.obj,vms_cli.obj,gawk_cmd.obj,vms_crtl_init.obj psect_attr=environ,noshr !extern [noshare] char ** stack=48 !preallocate more pages (default is 20) iosegment=128 !ditto (default is 32) +$! +$ v1 = f$verify(1) +$ @[.vms]gawk_ident.com $ open/append Fopt gawk.opt $ write Fopt libs -$ write Fopt "identification=""V''REL'.''PATCHLVL'""" $ close Fopt $! -$ v = f$verify(1) +$ v1 = f$verify(1) $ link/exe=gawk.exe gawk.opt/options $! 'f$verify(v)' $ exit diff --git a/vms/vmstest.com b/vms/vmstest.com index 25404373..6d46c4d7 100644 --- a/vms/vmstest.com +++ b/vms/vmstest.com @@ -25,6 +25,7 @@ $ rm = "delete/noConfirm/noLog" $ mv = "rename/New_Vers" $ gawk = "$sys$disk:[-]gawk" $ AWKPATH_srcdir = "define/User AWKPATH sys$disk:[]" +$ AWKLIBPATH_dir = "define/User AWKLIBPATH sys$disk:[-]" $ $ listdepth = 0 $ pipeok = 0 @@ -159,6 +160,13 @@ $ type sys$input: $ list = "inetechu inetecht inetdayu inetdayt" $ gosub list_of_tests $ return +$! +$extension: echo "extension...." +$ list = "inplace1 filefuncs fnmatch fts functab4 ordchr" - + + " readdir revout revtwoway rwarray time" + gosub list_of_tests + return + $ $! list_of_tests: process 'list', a space-separated list of tests. $! Some tests assign their own 'list' and call us recursively, @@ -578,7 +586,7 @@ $defref: echo "defref" $ set noOn $ AWKPATH_srcdir $ gawk --lint -f defref.awk >_defref.tmp 2>&1 -$ if .not.$status then call exit_code 2 _defref.tmp +$ if .not. $status then call exit_code '$status' _defref.tmp $ set On $ cmp defref.ok sys$disk:[]_defref.tmp $ if $status then rm _defref.tmp; @@ -594,6 +602,8 @@ $ $strftime: echo "strftime" $ ! this test could fail on slow machines or on a second boundary, $ ! so if it does, double check the actual results +$ ! This test needs SYS$TIMEZONE_NAME and SYS$TIMEZONE_RULE +$ ! to be properly defined. $!! date | gawk -v "OUTPUT"=_strftime.tmp -f strftime.awk $ now = f$time() $ wkd = f$extract(0,3,f$cvtime(now,,"WEEKDAY")) @@ -601,11 +611,12 @@ $ mon = f$cvtime(now,"ABSOLUTE","MONTH") $ mon = f$extract(0,1,mon) + f$edit(f$extract(1,2,mon),"LOWERCASE") $ day = f$cvtime(now,,"DAY") $ tim = f$extract(0,8,f$cvtime(now,,"TIME")) -$ tz = "" +$! Can not use tz as it shows up in the C environment. +$ timezone = f$trnlnm("SYS$TIMEZONE_NAME") $ yr = f$cvtime(now,,"YEAR") $ if f$trnlnm("FTMP").nes."" then close/noLog ftmp $ open/Write ftmp strftime.in -$ write ftmp wkd," ",mon," ",day," ",tim," ",tz," ",yr +$ write ftmp wkd," ",mon," ",day," ",tim," ",timezone," ",yr $ close ftmp $ gawk -v "OUTPUT"=_strftime.tmp -f strftime.awk strftime.in $ set noOn @@ -637,7 +648,7 @@ $ $incdupe: echo "''test'" $ set noOn $ gawk --lint -i inclib -i inclib.awk "BEGIN {print sandwich(""a"", ""b"", ""c"")}" > _'test'.tmp 2>&1 -$ if .not. $status then call exit_code 1 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp;* $ set On @@ -646,7 +657,7 @@ $ $incdupe2: echo "''test'" $ set noOn $ gawk --lint -f inclib -f inclib.awk >_'test'.tmp 2>&1 -$ if .not. $status then call exit_code 1 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp;* $ set On @@ -661,7 +672,7 @@ $ $incdupe4: echo "''test'" $ set NoOn $ gawk --lint -f hello -i hello.awk >_'test'.tmp 2>&1 -$ if .not. $status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp;* $ set On @@ -670,7 +681,7 @@ $ $incdupe5: echo "''test'" $ set NoOn $ gawk --lint -i hello -f hello.awk >_'test'.tmp 2>&1 -$ if .not. $status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp;* $ set On @@ -679,7 +690,7 @@ $ $incdupe6: echo "''test'" $ set NoOn $ gawk --lint -i inchello -f hello.awk >_'test'.tmp 2>&1 -$ if .not. $status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp;* $ set On @@ -688,7 +699,7 @@ $ $incdupe7: echo "''test'" $ set NoOn $ gawk --lint -f hello -i inchello >_'test'.tmp 2>&1 -$ if .not. $status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp;* $ set On @@ -706,7 +717,7 @@ $symtab2: $symtab3: echo "''test'" $ set noOn $ gawk -f 'test'.awk >_'test'.tmp 2>&1 -$ if .not. $status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp;* $ set On @@ -717,7 +728,7 @@ $symtab5: $symtab7: echo "''test'" $ set noOn $ gawk -f 'test'.awk <'test'.in >_'test'.tmp 2>&1 -$ if .not. $status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp;* $ set On @@ -897,7 +908,7 @@ $noparms: echo "noparms" $ set noOn $ AWKPATH_srcdir $ gawk -f noparms.awk >_noparms.tmp 2>&1 -$ if .not.$status then call exit_code 1 _noparms.tmp +$ if .not. $status then call exit_code '$status' _noparms.tmp $ set On $ cmp noparms.ok sys$disk:[]_noparms.tmp $ if $status then rm _noparms.tmp; @@ -938,7 +949,12 @@ $ gawk -f nasty.awk >_nasty.tmp $ call fixup_LRL nasty.ok $ call fixup_LRL _nasty.tmp "purge" $ cmp nasty.ok sys$disk:[]_nasty.tmp -$ if $status then rm _nasty.tmp; +$ if $status +$ then +$ rm _nasty.tmp; +$ file = "lcl_root:[]nasty.ok" +$ if f$search(file) .nes. "" then rm 'file';* +$ endif $ set On $ return $ @@ -948,7 +964,12 @@ $ gawk -f nasty2.awk >_nasty2.tmp $ call fixup_LRL nasty2.ok $ call fixup_LRL _nasty2.tmp "purge" $ cmp nasty2.ok sys$disk:[]_nasty2.tmp -$ if $status then rm _nasty2.tmp; +$ if $status +$ then +$ rm _nasty2.tmp; +$ file = "lcl_root:[]nasty2.ok" +$ if f$search(file) .nes. "" then rm 'file';* +$ endif $ set On $ return $ @@ -968,7 +989,7 @@ $subslash: $ echo "''test'" $ set noOn $ gawk -f 'test'.awk >_'test'.tmp 2>&1 -$ if .not.$status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ set On $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp; @@ -1077,7 +1098,7 @@ $lintwarn: echo "lintwarn" $ set noOn $ AWKPATH_srcdir $ gawk --lint -f lintwarn.awk >_lintwarn.tmp 2>&1 -$ if .not.$status then call exit_code 1 _lintwarn.tmp +$ if .not. $status then call exit_code '$status' _lintwarn.tmp $ set On $ cmp lintwarn.ok sys$disk:[]_lintwarn.tmp $ if $status then rm _lintwarn.tmp; @@ -1120,7 +1141,7 @@ $sclifin: $ echo "''test'" $ set noOn $ gawk -f 'test'.awk 'test'.in >_'test'.tmp 2>&1 -$ if .not.$status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ set On $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp; @@ -1132,7 +1153,7 @@ $ ! $ echo "''test'" $ set noOn $ gawk -f 'test'.awk <'test'.in >_'test'.tmp 2>&1 -$ if .not.$status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ set On $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp; @@ -1157,7 +1178,7 @@ $unterm: $ echo "''test'" $ set noOn $ gawk -f 'test'.awk 'test'.in >_'test'.tmp 2>&1 -$ if .not.$status then call exit_code 1 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ set On $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp; @@ -1217,7 +1238,7 @@ $synerr2: $ echo "''test'" $ set noOn $ gawk -f 'test'.awk >_'test'.tmp 2>&1 -$ if .not.$status then call exit_code 1 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ set On $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp; @@ -1237,7 +1258,7 @@ $ $space: echo "space" $ set noOn $ gawk -f " " space.awk >_space.tmp 2>&1 -$ if .not.$status then call exit_code 2 _space.tmp +$ if .not. $status then call exit_code '$status' _space.tmp $ set On $! we get a different error from what space.ok expects $ gawk "{gsub(""file specification syntax error"", ""no such file or directory""); print}" - @@ -1320,7 +1341,7 @@ $ $! This test is somewhat suspect for vms due to exit code manipulation $exitval1: echo "exitval1" $ gawk -f exitval1.awk >_exitval1.tmp 2>&1 -$ if $status then call exit_code 0 _exitval1.tmp +$ if $status then call exit_code '$status' _exitval1.tmp $ cmp exitval1.ok sys$disk:[]_exitval1.tmp $ if $status then rm _exitval1.tmp; $ return @@ -1424,7 +1445,7 @@ $! nofile.ok expects no/such/file, but using that name in the test would $! yield "file specification syntax error" instead of "no such file..." $ set noOn $ gawk "{}" no-such-file >_nofile.tmp 2>&1 -$ if .not.$status then call exit_code 2 _nofile.tmp +$ if .not. $status then call exit_code '$status' _nofile.tmp $ set On $! restore altered file name $ gawk "{gsub(""no-such-file"", ""no/such/file""); print}" _nofile.tmp >_nofile.too @@ -1496,7 +1517,7 @@ $ $mixed1: echo "mixed1" $ set noOn $ gawk -f /dev/null --source "BEGIN {return junk}" >_mixed1.tmp 2>&1 -$ if .not.$status then call exit_code 1 _mixed1.tmp +$ if .not. $status then call exit_code '$status' _mixed1.tmp $ set On $ cmp mixed1.ok sys$disk:[]_mixed1.tmp $ if $status then rm _mixed1.tmp; @@ -1758,7 +1779,7 @@ World! $ endif $ gawk /Commands="BEGIN { print ""World!"" }" _NL: /Output=_vms_cmd.tmp $ cmp vms_cmd.ok sys$disk:[]_vms_cmd.tmp -$ if $status then rm _vms_cmd.tmp; +$ if $status then rm _vms_cmd.tmp;,vms_cmd.ok;* $ return $ $vms_io1: echo "vms_io1" @@ -1771,7 +1792,7 @@ $ gawk -f - >_vms_io1.tmp # prior to 3.0.4, gawk crashed doing any redirection after closing stdin BEGIN { print "Hello" >"/dev/stdout" } $ cmp vms_io1.ok sys$disk:[]_vms_io1.tmp -$ if $status then rm _vms_io1.tmp; +$ if $status then rm _vms_io1.tmp;,vms_io1.ok;* $ return $ $vms_io2: echo "vms_io2" @@ -1799,7 +1820,89 @@ $ set On $ cmp _NL: sys$disk:[]_vms_io2.tmp $ if $status then rm _vms_io2.tmp; $ cmp vms_io2.ok sys$disk:[]_vms_io2.vfc -$ if $status then rm _vms_io2.vfc;* +$ if $status then rm _vms_io2.vfc;*,vms_io2.ok;* +$ return +$! +$! +$inplace1: +$ set process/parse=extended ! ODS-5 only +$ echo "''test'" +$ filefunc_file = "[-]gawkapi.o" +$ open/write awkfile _'test'.awk +$ write awkfile "@load ""inplace""" +$! write awkfile "BEGIN {print ""before""}" +$ write awkfile " {gsub(/foo/, ""bar""); print}" +$! write awkfile "END {print ""after""}" +$ close awkfile +$ copy inplace^.1.in _'test'.1 +$ copy inplace^.2.in _'test'.2 +$ set noOn +$ AWKLIBPATH_dir +$ gawk -f _'test'.awk _'test'.1 <inplace.in >_'test'.1.tmp 2>&1 +$ if .not. $status then call exit_code '$status' _'test'.1.tmp +$ AWKLIBPATH_dir +$ gawk -f _'test'.awk _'test'.2 <inplace.in >_'test'.2.tmp 2>&1 +$ if .not. $status then call exit_code '$status' _'test'.2.tmp +$ set On +$ cmp 'test'.1.ok sys$disk:[]_'test'.1.tmp +$ if $status then rm _'test'.1.tmp;,_'test'.1; +$ cmp 'test'.2.ok sys$disk:[]_'test'.2.tmp +$ if $status then rm _'test'.2.tmp;,_'test'.2;,_'test'.awk; +$ return +$! +$filefuncs: +$fnmatch: +$functab4: +$ordchr: +$revout: +$revtwoway: +$time: +$ echo "''test'" +$ filefunc_file = "[-]gawkapi.o" +$ open/write gapi 'filefunc_file' +$ close gapi +$ set noOn +$ AWKLIBPATH_dir +$ gawk -f 'test'.awk 'test'.in >_'test'.tmp 2>&1 +$ if .not. $status then call exit_code '$status' _'test'.tmp +$ set On +$ cmp 'test'.ok sys$disk:[]_'test'.tmp +$ if $status then rm _'test'.tmp; +$ if f$search(filefunc_file) .nes. "" then rm 'filefunc_file';* +$ return +$! +$rwarray: +$ echo "''test'" +$ set noOn +$ AWKLIBPATH_dir +$ gawk -f 'test'.awk 'test'.in >_'test'.tmp 2>&1 +$ if .not. $status then call exit_code '$status' _'test'.tmp +$ set On +$ cmp orig.out new.out +$ if $status +$ then +$ open/append tout _'test'.tmp +$ write tout "old and new are equal - GOOD" +$ close tout +$ endif +$ cmp 'test'.ok sys$disk:[]_'test'.tmp +$ if $status then rm _'test'.tmp;,orig.bin;,orig.out;,new.out; +$ return +$! +$readdir: +$fts: +$ echo "''test'" +$ set noOn +$ AWKLIBPATH_dir +$ gawk -f 'test'.awk >_'test'.tmp 2>&1 +$ if .not. $status +$ then +$ call exit_code '$status' _'test'.tmp +$ write sys$output _'test'.tmp +$ else +$ rm _'test'.tmp;*,_'test'.;* +$ endif +$ set On $ return $ $clean: @@ -1869,10 +1972,12 @@ $ endsubroutine !fixup_LRL $ $! add a fake "EXIT CODE" record to the end of the temporary output file $! to simulate the ``|| echo EXIT CODE $$? >>_$@'' shell script usage +$! Unix code = vms_code & (255 * 2^3) >> 3 $exit_code: subroutine +$ unix_status = (p1 .and. %x7f8) / 8 $ if f$trnlnm("FTMP").nes."" then close/noLog ftmp $ open/Append ftmp 'p2' -$ write ftmp "EXIT CODE: ",p1 +$ write ftmp "EXIT CODE: ",'unix_status' $ close ftmp $ endsubroutine !exit_code $ |