Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Q: somebody has awklib.c?

69 views
Skip to first unread message

PEZ

unread,
Sep 9, 1999, 3:00:00 AM9/9/99
to
Hello,

Some 5 years ago or so I used to have a c file with some very good
implementation of awk funktions like split() and sub() and such. I
think it was named awklib.c. Now I would have REALLY good use for those
functions again and I wonder if someone knows where I can find that
source file again? I don't know where I put my copy...

Regards,
/Peter Strömberg
-= Spam safe(?) e-mail address: pez68 at netscape.net =-


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

brian hiles

unread,
Oct 14, 1999, 3:00:00 AM10/14/99
to
PEZ <pe...@my-deja.com> wrote:
> Some 5 years ago or so I used to have a c file with some very good
> implementation of awk funktions like split() and sub() and such. I
> think it was named awklib.c. Now I would have REALLY good use for those
> functions again and I wonder if someone knows where I can find that
> source file again? I don't know where I put my copy...

You are not the only one. I was in the exact same condition -- minus the
grave necessity to use it, thankfully.

You are referring to the awk compiler and library distributed by
(IIRC) Bell Labs, and you are correct that this distribution is
indeed defunct. However, not to disappoint you entirely I can
direct you to the awk FAQ (http://www.faqs.org/faqs/computer-lang/awk/faq/)
and this resource will echo our frustration but provides for some
alternative awk "compilers".

http://www.unipress.com/att/new/awkcc.html (commercial)

BTW, did you know that awk has _always_ been a compiler? The
undocumented options -R and -S enable preparsing and image store
of the awk source; the image is not formally a compilation because
awk(1) is still necessary to execute it, but no parsing stage is
necessary -- with a few caveats. Here are my notes on this feature:
Note that this is not implemented (broken or not) in gawk or other
awk clones.

Script "Compilation"

The command

awk -S -f script.awk

produces a file named awk.out. This is a core image of awk
after parsing the file script.awk. The command

awk -Rawk.out datafile

causes awk.out to be applied to datafile (or the standard
input if no input file is given). This avoids having to
reparse large scripts each time they are used. Unfortu-
nately, the way this is implemented requires some special
action on the part of the person installing awk.

As awk is delivered with 4.2 BSD (and 4.3 BSD), awk.out is
created by the awk -S ... process by calling sbrk() with
'0', writing out the returned value, then writing out the
core image from location 0 to the returned address. The awk
-R... process reads the first word of awk.out to get the
length of the image, calls brk() with that length, and then
reads the image into itself starting at location 0. For
this to work, awk must have been loaded with its text seg-
ment writeable. Unfortunately, the BSD default for ld is to
load with the text read-only and shareable. Thus, the
installer must remember to take special action (e.g. "cc -N
Also, due to what appears to be a lapse in logic, the first
non-flag argument following -Rawk.out is discarded.

Would you do me the favor of emailing me when you have (or not) a
solution? I would be curious to know the outcome.

-Brian

brian hiles

unread,
Oct 14, 1999, 3:00:00 AM10/14/99
to
Oh yes, I forgot....

http://www.linuxstart.com/~awka/

-Brian

PEZ

unread,
Oct 18, 1999, 3:00:00 AM10/18/99
to
In article <s0cpf5...@corp.supernews.com>,

brian hiles <b...@rainey.blueneptune.com> wrote:
> PEZ <pe...@my-deja.com> wrote:
> > Some 5 years ago or so I used to have a c file with some very good
> > implementation of awk funktions like split() and sub() and such. I
> > think it was named awklib.c. Now I would have REALLY good use for
those
> > functions again and I wonder if someone knows where I can find that
> > source file again? I don't know where I put my copy...
>
> You are not the only one. I was in the exact same condition -- minus
the
> grave necessity to use it, thankfully.
>
> You are referring to the awk compiler and library distributed by
> (IIRC) Bell Labs, and you are correct that this distribution is
> indeed defunct. However, not to disappoint you entirely I can
> direct you to the awk FAQ (http://www.faqs.org/faqs/computer-
lang/awk/faq/)
> and this resource will echo our frustration but provides for some
> alternative awk "compilers".

Thanks for this info. Though I know I am not referring to the awk
compiler. The awklib.c I had was a tiny file with some c funtctions
that were named after their awk counterparts. I could compile and link
this library with my othe c code and have surprisingly much of awk
power available. The file was maybe 10k in size at the very most. I
tweeked my copy of it some so I could compile a Windows DLL that I used
from my Delphi projects. It was great. Now I didn't take as good care
about the file as I should have, but how was I to know that the little
file should dissapear from the face of the earth?

> BTW, did you know that awk has _always_ been a compiler? The
> undocumented options -R and -S enable preparsing and image store
> of the awk source; the image is not formally a compilation because
> awk(1) is still necessary to execute it, but no parsing stage is
> necessary -- with a few caveats. Here are my notes on this feature:
> Note that this is not implemented (broken or not) in gawk or other
> awk clones.
>
> Script "Compilation"
>
> The command
>
> awk -S -f script.awk
>
> produces a file named awk.out. This is a core image of awk
> after parsing the file script.awk. The command
>
> awk -Rawk.out datafile

[snip]

I had absolutely no idea what so ever! Thanks Brian for this info. Even
if I don't have much practical use for it, Curious George within just
loved to know! I will check my awks out to see it work.

I'll take the opportunity to again ask if someone has seen this
awklib.c file around? I'd love to get my hands on it again.

/Peter
--


-= Spam safe(?) e-mail address: pez68 at netscape.net =-


Sent via Deja.com http://www.deja.com/

Before you buy.

Peter S Tillier

unread,
Oct 18, 1999, 3:00:00 AM10/18/99
to
PEZ wrote:
>
<snip>
> I had absolutely no idea what so ever! Thanks Brian for this info. Even
> if I don't have much practical use for it, Curious George within just
> loved to know! I will check my awks out to see it work.
>
> I'll take the opportunity to again ask if someone has seen this
> awklib.c file around? I'd love to get my hands on it again.
<snip>
I too would like a copy of awklib.c - I wrote versions of gsub() and
sub() (that work on strings only - no REs) some time ago, but would
really like versions using REs.

I could only find a reference to the library awklib.c in a document
without a URL to find the source by doing a 'net search via AltaVista.

PEZ, if you're interested I could send you my non-RE gsub() and sub().

Peter
--
Peter S Tillier pet...@eq1152.demon.co.uk
Peter....@BTinternet.com
Fax2Email 0870 052 2717
Opinions expressed are my own and not necessarily those of my employer.

Peter J. Farley III

unread,
Oct 18, 1999, 3:00:00 AM10/18/99
to
> PEZ <pe...@my-deja.com> wrote:
> Some 5 years ago or so I used to have a c file with some very good
> implementation of awk funktions like split() and sub() and such. I
> think it was named awklib.c. Now I would have REALLY good use for those
> functions again and I wonder if someone knows where I can find that
> source file again? I don't know where I put my copy...

You might also want to check out section 6.8 of the awk FAQ, which
mentions the Awka project being done by Andrew Sumner,
<mailto:andrew...@bigfoot.com>, though the url in the FAQ is now
redirected to <http://www.linuxstart.com/~awka/index.html>. His code
is still in beta, but he has what looks like a reasonable approach to
licensing of the library he's developing there.

----------------------------------------------------
Peter J. Farley III (pjfa...@nospam.dorsai.org OR
pjfa...@nospam.banet.net)

Peter J. Farley III

unread,
Oct 18, 1999, 3:00:00 AM10/18/99
to
>You might also want to check out section 6.8 of the awk FAQ, which
^^^

I really meant section 6.9, of course. Sorry for the typo.

PEZ

unread,
Oct 19, 1999, 3:00:00 AM10/19/99
to
In article <380B1455...@BTInternet.com>,

Peter S Tillier <Peter....@BTInternet.com> wrote:
> PEZ wrote:
> >
> <snip>
> > I had absolutely no idea what so ever! Thanks Brian for this info.
Even
> > if I don't have much practical use for it, Curious George within
just
> > loved to know! I will check my awks out to see it work.
> >
> > I'll take the opportunity to again ask if someone has seen this
> > awklib.c file around? I'd love to get my hands on it again.
> <snip>
> I too would like a copy of awklib.c - I wrote versions of gsub() and
> sub() (that work on strings only - no REs) some time ago, but would
> really like versions using REs.

I have concidered using the gnu regexp library, but it's such a biggy
solution for a small problem. And I would have to write my own awk-ish
sub(), split(), etc. That was what was so neat about this awklib.c
library. Smallish and efficient. It had two variants of split(), sub()
and the lot. One that would take a precompiled RE and one that would
compile a RE on the fly.

> I could only find a reference to the library awklib.c in a document
> without a URL to find the source by doing a 'net search via AltaVista.

Yes, I found that one too. Frustrating.

> PEZ, if you're interested I could send you my non-RE gsub() and sub().

Yes, please do. A straight string search is great for many tasks.

Regards,

Greg Nunan

unread,
Oct 21, 1999, 3:00:00 AM10/21/99
to
Hello,

Is this what you are looking for?:

/*
* awklib.c - C callable routines that provide field splitting and regular
* expression matching functions much like those found in AWK.
*
* Copyright 1988, Jim Mischel. All rights reserved.
*/

If so then you can find it at
ftp://ftp.ceu.fi.udc.es/development/c/msdos/awklib.rar

Hope this helps,

Greg.

brian hiles <b...@rainey.blueneptune.com> wrote in article
<s0cpf5...@corp.supernews.com>...


> PEZ <pe...@my-deja.com> wrote:
> > Some 5 years ago or so I used to have a c file with some very good
> > implementation of awk funktions like split() and sub() and such. I
> > think it was named awklib.c. Now I would have REALLY good use for those
> > functions again and I wonder if someone knows where I can find that
> > source file again? I don't know where I put my copy...
>

Sam Hobbs

unread,
Oct 21, 1999, 3:00:00 AM10/21/99
to
OK, I know this must be naive, but what is an "rar" file extension. I've run
across tar, shar, gz, zip BUT to date not rar and it is difficult to decode
without a little more info.

Sorry for off-topic, but it is relevant to "awklib.rar"
Sam

Sam Hobbs

unread,
Oct 21, 1999, 3:00:00 AM10/21/99
to
I searched AltaVista for "rar" and "file extension" and eventually ended up
at the site:
http://www.pastmidnight.com/pme.htm
where I downloaded xtrax.zip which contains xtrax which will extract rar
files among other things. There appear to be some other utilities out there
also, but this one appears reliable. (It did indeed uncompress awklib.rar
which contains awklib.c, awklib.h, a couple of make files and a couple of
undocumented application programs. A reading of the c and h file should be
enough if you're into c.)

Regards
Sa,

Charles Demas

unread,
Oct 22, 1999, 3:00:00 AM10/22/99
to
In article <7uo7ti$kn9$1...@eeyore.ymp.gov>,

Sam Hobbs <samh...@mindspring.com> wrote:
>OK, I know this must be naive, but what is an "rar" file extension. I've run
>across tar, shar, gz, zip BUT to date not rar and it is difficult to decode
>without a little more info.

Probably a typo. The letter "r" is right next to "t" on the
keyboard. I didn't check the URL.


Chuck Demas
Needham, Mass.

--
Eat Healthy | _ _ | Nothing would be done at all,
Stay Fit | @ @ | If a man waited to do it so well,
Die Anyway | v | That no one could find fault with it.
de...@tiac.net | \___/ | http://www.tiac.net/users/demas

Colin R. DeVilbiss

unread,
Oct 22, 1999, 3:00:00 AM10/22/99
to
Charles Demas <de...@sunspot.tiac.net> wrote:
> In article <7uo7ti$kn9$1...@eeyore.ymp.gov>,
> Sam Hobbs <samh...@mindspring.com> wrote:
> >OK, I know this must be naive, but what is an "rar" file extension. I've run
> >across tar, shar, gz, zip BUT to date not rar and it is difficult to decode
> >without a little more info.

> Probably a typo. The letter "r" is right next to "t" on the
> keyboard. I didn't check the URL.

well, unfortunately, .rar is yet another file compression ``standard'',
this one popular in DOS. it is very similar in use to DOS arj.

IIRC, I have seen *nix utilities to deal with it, but not sure.

HTH.

Colin DeVilbiss
crde...@mtu.edu

Charles Demas

unread,
Oct 22, 1999, 3:00:00 AM10/22/99
to
In article <7uod9m$ebd$1...@campus3.mtu.edu>,

I just checked the URL, and it isn't a typo.

Live and learn. :-)

Rik Blok

unread,
Oct 22, 1999, 3:00:00 AM10/22/99
to
I've repacked it as a zip. Haven't tried it myself but I thought it
might save you some trouble. You can find it here:

http://www.physics.ubc.ca/~blok/download/awklib.zip

- Rik.

Sam Hobbs wrote:
>
> OK, I know this must be naive, but what is an "rar" file extension. I've run
> across tar, shar, gz, zip BUT to date not rar and it is difficult to decode
> without a little more info.
>

> Sorry for off-topic, but it is relevant to "awklib.rar"
> Sam

--
Rik Blok <bl...@physics.ubc.ca>
Department of Physics and Astronomy,
University of British Columbia, Canada
http://www.physics.ubc.ca/~blok/

Levin A.A.

unread,
Oct 22, 1999, 3:00:00 AM10/22/99
to
> Charles Demas <de...@sunspot.tiac.net> wrote:
> > In article <7uo7ti$kn9$1...@eeyore.ymp.gov>,
> > Sam Hobbs <samh...@mindspring.com> wrote:
> > >OK, I know this must be naive, but what is an "rar" file extension. I've run
> > >across tar, shar, gz, zip BUT to date not rar and it is difficult to decode
> > >without a little more info.
>
> > Probably a typo. The letter "r" is right next to "t" on the
> > keyboard. I didn't check the URL.
>
> well, unfortunately, .rar is yet another file compression ``standard'',
> this one popular in DOS. it is very similar in use to DOS arj.
>
Yes, RAR is a russian ARJ, very popular archiver in the former USSR and
better than ARJ.

Sandy

> IIRC, I have seen *nix utilities to deal with it, but not sure.
>
> HTH.
>

> Colin DeVilbiss
> crde...@mtu.edu
>


PEZ

unread,
Oct 23, 1999, 3:00:00 AM10/23/99
to
In article <01bf1bbe$76cf5a60$6a02010a@grn_686>,

"Greg Nunan" <greg....@motionmedia.co.uk> wrote:
> Is this what you are looking for?:
>
> /*
> * awklib.c - C callable routines that provide field splitting and
regular
> * expression matching functions much like those found in AWK.
> *
> * Copyright 1988, Jim Mischel. All rights reserved.
> */

Indeed YES!!!!!

> Hope this helps,

You bet it did! Thanks a bunch!

0 new messages