AminetAminet
Search:
84480 packages online
About
Recent
Browse
Search
Upload
Setup
Services

util/cli/ATT-awk-1_0.lha

Mirror:Random
Showing:m68k-amigaosppc-amigaosppc-morphosi386-arosi386-amithlonppc-warpupppc-powerupgeneric
No screenshot available
Short:Fully functional AT&T awk for all Amigas
Author:AT&T
Uploader:torsten diku dk (Torsten Poulin)
Type:util/cli
Architecture:m68k-amigaos
Date:1994-06-05
Download:http://aminet.net/util/cli/ATT-awk-1_0.lha - View contents
Readme:http://aminet.net/util/cli/ATT-awk-1_0.readme
Downloads:2302

Version 1.0 of a fully functional Amiga port of the April 22, 1994
version of AT&T awk compiled with SAS/C 6.51.
------------------------------------------------------------------

The AT&T supplied code is 100% unchanged! The file "amiga.c" contains
all the necessary adaptions to the AmigaDOS environment. 

I have run the "awk.g.y" and "awk.lx.l" files through yacc and lex
respectively on an HP-UX workstation. The resulting C sources seem to
build okay on the Amiga. The included smakefile does not attempt to
recreate them. My advice is: do not delete "y.tab.c", "y.tab.h", and
"lex.yy.c"!

To rebuild using SAS/C 6.51, just unpack the Amiga and AT&T source to
the same directory and type smake.

Pipes are implemented in a very simplistic way. In fact they are not
really pipes at all. Instead they are simulated using temporary files
in the T: directory. This may change in the future, Matthew Dillon's
FifoLib looks like a promising candidate.

The awk ENVIRON array holds copies of the local shell variables, but
only under AmigaDOS 2.04+. Yes, awk should work with all versions of
AmigaDOS.

Command line arguments are treated a bit differently than with most
Amiga programs. Both the usual " as well as ' can be used to quote
arguments:

  awk "BEGIN { *"date*" |getline d; print d }"
  awk 'BEGIN { "date" |getline d; print d }'

Personally I tend to prefer the latter form, as it resembles the
examples in A.V.Aho et al. "The AWK Programming Language". The escape
character is the asterisk usually used in AmigaDOS. I tried using a
backslash, but at least with WShell it caused more trouble than it is
worth, because WShell (by necessity) tries to be clever about the
contents of the command line.

Liberal use of escapes may be necessary when using single quotes,
depending on which shell you use, e.g.,

  awk 'BEGIN { "date" *|getline d *; print d }'

The blanks before the asterisks are significant in WShell. If you
don't want to bother with all these pitfalls, you can of course always
put your script in a file and use the -f option...

Arguments are treated like AmigaDOS patterns, and expanded, if

  (1) they are not surrounded by single or double
      quotes, and
  (2) they contain at least one of the eight
      characters "~#?*%([|", and
  (3) awk is run under AmigaDOS V36+ OR arp.library
      is installed.

The program works with pre-V36 AmigaDOS even if arp.library isn't
installed, but it will not expand patterns. It will not attempt to
open arp.library if running under V36+.

This example prints the total number of characters, words, and lines
in the files in the current directory:

  awk "{ nc+=length($0)+1; nw+=NF} END { print nc, nw, NR }" #?.txt

With a little extra work, it can be turned into a clone of the UNIX wc
command :-)

A word of warning. If an AmigaDOS pattern doesn't match any filenames,
it expands to nothing, possibly causing an awk script to seem like
it is hanging, while it is in fact just waiting for input from stdin.
In that case you can just press Ctrl-\ (end of file).

Before I forget it, awk is pure and can be made resident.

Comments, questions and bug reports concerning this port can be sent
to me at the following address:

   Torsten Poulin
   Banebrinken 99, 2, 77
   DK-2400 København NV
   Denmark

or via e-mail: torsten at diku.dk (preferred)

Please note that my snail-mail address will change sometime this
autumn. The Danish Mail will forward any letters to me for half a year
after that, though.
 
Have fun,
Torsten

P.S. awk is copyrighted by AT&T. Please refer to the copyright notices
in the source and documentation files for details.


Contents of util/cli/ATT-awk-1_0.lha
 PERMSSN    UID  GID    PACKED    SIZE  RATIO     CRC       STAMP          NAME
---------- ----------- ------- ------- ------ ---------- ------------ -------------
[generic]                30497   30497 100.0% -lh0- 51b0 Jun  4  1994 AT&T-awk/Amigasrc.lha
[generic]                58088   58088 100.0% -lh0- 9778 Jun  4  1994 AT&T-awk/AT&Tsrc.lha
[generic]                52147  114040  45.7% -lh5- c33c Jun  4  1994 AT&T-awk/awk
[generic]                 3921    9653  40.6% -lh5- b45d May 11  1994 AT&T-awk/awk.1
[generic]                 4511   13281  34.0% -lh5- 08c0 Jun  2  1994 AT&T-awk/awk.man
[generic]                 5516   11942  46.2% -lh5- 9295 May 11  1994 AT&T-awk/FIXES
[generic]                 1418    2723  52.1% -lh5- b4d9 May 11  1994 AT&T-awk/README
[generic]                 1864    3623  51.4% -lh5- 2f6f Jun  4  1994 AT&T-awk/ReadMe.amiga
---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total         8 files  157962  243847  64.8%            Jun  5  1994

Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>