[comp.os.msdos.apps] Filename expansion missing from MSDOS gawk, version 2.11

bsrdp@warwick.ac.uk (Hylton Boothroyd) (06/28/90)

On a UNIX system a command of the form
        gawk -f process.awk data*.*
has the wildcard filename expansion dealt with by the UNIX shell.

On an MSDOS system, at least with version 3.xx, there is no such shell
expansion.  Instead, wildcards are dealt with *within*each*application*
by first match (INT21H/4EH) and next match (INT21H/4FH).

The 2.02 beta version did that.
The 2.11 version currently on SIMTEL does not: all filenames have to be
explicitly entered.

Is a suitable upgrade on the way?
---
--
-----------------------
Hylton Boothroyd        Janet: h.boothroyd@uk.ac.warwick.cu
Warwick Business School Darpa: h.boothroyd%cu.warwick.ac.uk@relay-nsfnet.ac.uk
University of Warwick   Uucp:  h.boothroyd@warwick.uucp

a563@mindlink.UUCP (Dave Kirsch) (06/29/90)

> steve@cs.su.oz writes:
> 
> Msg-ID: <1074@cluster.cs.su.oz>
> Posted: 29 Jun 90 15:24:59 GMT
> 
> Org.  : Basser Dept of Computer Science, University of Sydney, Australia
> Person: Stephen Russell
> 
> In article <321@happym.wa.com> irv@happym.wa.com (Irving Wolfe) writes:
> > [ lack of globbing in gawk under MSDOS ... ]
> >A better solution than a mere upgrade to handle stars might be getting a
> >reasonable shell that will run under MSDOS.  They exist; MKS has made a fine
> >one and I'm sure there are others.
> 
> While the MKS shell is very neat, and I'm sure the others are too, they
> won't solve the problem completely. The 128 byte MSDOS command line
> puts a nasty limit on the length of the expanded line. The MKS utilities
> use a non-standard mechanism to get at the shell's expanded command
> line, but this is inherently nonportable.
> 
> Nope, under MSDOS you have to do the work yourself. Anyway feel like
> donating a glob() function to the public domain?

Sure, here's one that will do all the files ending in the extension .C:

  for %f in (*.c) do gawk %f

There, simple wild card expansion.  If you want, you can stick in in a batch
file, like this:

--- CUT HERE -- FILE GLOB.BAT --
for %%f in (%2 %3 %4 %5 %6 %7 %8 %9) do %1 %%f
--- CUT HERE -- FILE GLOB.BAT --

And you can just go:  GLOB gawk *.c *.h *.cpp
--
--
David Kirsch          UUCP: {uunet,ubc-cs}!van-bc!rsoft!mindlink!a563
Voice: (604) 327-4404       a563@mindlink.UUCP
                      Vancouver, British Columbia
'In-no-sense?  Nonsense!' - The Art Of Noise

darcy@druid.uucp (D'Arcy J.M. Cain) (06/29/90)

In article <1990Jun28.103243.7818@warwick.ac.uk> bsrdp@warwick.ac.uk (Hylton Boothroyd) writes:
>On a UNIX system a command of the form
>        gawk -f process.awk data*.*
>has the wildcard filename expansion dealt with by the UNIX shell.
>
>On an MSDOS system, at least with version 3.xx, there is no such shell
>expansion.  Instead, wildcards are dealt with *within*each*application*
>by first match (INT21H/4EH) and next match (INT21H/4FH).
>
>The 2.02 beta version did that.
>The 2.11 version currently on SIMTEL does not: all filenames have to be
>explicitly entered.
>
>Is a suitable upgrade on the way?

Actually, all you have to do is include the proper file during the link
phase.  If you are using Turbo C, this file is WILDARGS.OBJ.  I can't
recall the name of the MSC file but it does exist.  When included it does
the filename expansion and presents the arguments to main like Unix shell
does.

-- 
D'Arcy J.M. Cain (darcy@druid)     |   Government:
D'Arcy Cain Consulting             |   Organized crime with an attitude
West Hill, Ontario, Canada         |
(416) 281-6094                     |

irv@happym.wa.com (Irving Wolfe) (06/29/90)

bsrdp@warwick.ac.uk (Hylton Boothroyd) writes:

>On an MSDOS system, ...
>wildcards are dealt with *within*each*application*

>The 2.11 version currently on SIMTEL does not

A better solution than a mere upgrade to handle stars might be getting a 
reasonable shell that will run under MSDOS.  They exist; MKS has made a fine 
one and I'm sure there are others. 
-- 
 Irving Wolfe            irv@happym.wa.com              206/463-9399 ext.101
 Happy Man Corp.   4410 SW Pt. Robinson Road,  Vashon Island, WA  98070-7399
 SOLID VALUE, the investment letter for Benj. Graham's intelligent investors

creps@silver.ucs.indiana.edu (Steve Creps) (06/29/90)

In article <1990Jun28.103243.7818@warwick.ac.uk> bsrdp@warwick.ac.uk (Hylton Boothroyd) writes:
>On a UNIX system a command of the form
>        gawk -f process.awk data*.*
>has the wildcard filename expansion dealt with by the UNIX shell.
>
>On an MSDOS system, at least with version 3.xx, there is no such shell
>expansion.  Instead, wildcards are dealt with *within*each*application*

   If you are using Microsoft C, you can include the file SETARGV.OBJ
when you link the program together. This file should be on one of your
library disks for MSC. Of course, this only gives you wimpy MSDOS wildcard
expansion, but it's better than nothing.

-	-	-	-	-	-	-	-	-	-
Steve Creps
creps@silver.ucs.indiana.edu (129.79.1.6)
{inuxc,rutgers,uunet!uiucdcs,pur-ee}!iuvax!silver!creps

tomg@deceds.dec.com ( The Final Frontier) (06/29/90)

> 
> Actually, all you have to do is include the proper file during the link
> phase.  If you are using Turbo C, this file is WILDARGS.OBJ.  I can't
> recall the name of the MSC file but it does exist.  When included it does
> the filename expansion and presents the arguments to main like Unix shell
> does.

	For MSC you need to link with the file setargv.obj to get
	wildcard expansion.



-- 
| (UUCP)       {decvax, ucbvax, allegra}!decwrl!fstvax.dec.com!gallo |
| (ARPA)       gallo%fstvax.DEC@decwrl.ARPA                          |
| (BITNET)     gallo@fstvax.dec.com                                  |
| Opinions expressed here are my own,not those of my employer!!!     |

steve@cs.su.oz (Stephen Russell) (06/29/90)

In article <321@happym.wa.com> irv@happym.wa.com (Irving Wolfe) writes:
> [ lack of globbing in gawk under MSDOS ... ]
>A better solution than a mere upgrade to handle stars might be getting a 
>reasonable shell that will run under MSDOS.  They exist; MKS has made a fine 
>one and I'm sure there are others. 

While the MKS shell is very neat, and I'm sure the others are too, they
won't solve the problem completely. The 128 byte MSDOS command line
puts a nasty limit on the length of the expanded line. The MKS utilities
use a non-standard mechanism to get at the shell's expanded command
line, but this is inherently nonportable.

Nope, under MSDOS you have to do the work yourself. Anyway feel like
donating a glob() function to the public domain?

Cheers

Steve

steve@cs.su.oz (Stephen Russell) (07/04/90)

In article <2289@mindlink.UUCP> a563@mindlink.UUCP (Dave Kirsch) writes:
>> Nope, under MSDOS you have to do the work yourself. Anyway feel like
>> donating a glob() function to the public domain?
>
>Sure, here's one that will do all the files ending in the extension .C:
>
>  for %f in (*.c) do gawk %f
>
>There, simple wild card expansion.

This will often be enough, but not always, depending on what the awk
script does in its END action, for example. Some awk scripts may also
need all of the input file names (using ARGV[]) to perform their
function.

Unfortunately, you're also still stuck with MSDOS's simple wildcard
expansion.  No character classes, no embedded literals ("*[a-c]x???"),
etc. A full-blown UNIX style glob() would allow provide facilities.

Cheers,

Steve.

a563@mindlink.UUCP (Dave Kirsch) (07/12/90)

> imp@dancer.Solbourne.COM writes:
> In article <2289@mindlink.UUCP> a563@mindlink.UUCP (Dave Kirsch) writes:
> >> Nope, under MSDOS you have to do the work yourself. Anyway feel like
> >> donating a glob() function to the public domain?
> 
> Not sure about the attribute for the quote, but here goes:
> 
> If you compile GAWK with TURBO-C++ 1.0 then you can link it a special
> way that allows you to have wildcards to your hearts content.  You
> need to add the "WILDCARD.OBJ" file to your link.  Check out the
> manual for all the details.  I don't know if previous versions of
> Turbo-C have this or not.  Maybe someone should compile it with TC++
> and "post" the results to SIMTEL20.....

My solution with the for loop was for people who only have the EXE and can't
link it.   WILDCARD.OBJ is present in _all_ versions of Turbo C.  It replaces
SETARGV.OBJ that's in Cx.LIB.
--
--
David Kirsch          UUCP: {uunet,ubc-cs}!van-bc!rsoft!mindlink!a563
Voice: (604) 327-4404       a563@mindlink.UUCP
                      Vancouver, British Columbia
'In-no-sense?  Nonsense!' - The Art Of Noise

imp@dancer.Solbourne.COM (Warner Losh) (07/13/90)

In article <2289@mindlink.UUCP> a563@mindlink.UUCP (Dave Kirsch) writes:
>> Nope, under MSDOS you have to do the work yourself. Anyway feel like
>> donating a glob() function to the public domain?

Not sure about the attribute for the quote, but here goes:

If you compile GAWK with TURBO-C++ 1.0 then you can link it a special
way that allows you to have wildcards to your hearts content.  You
need to add the "WILDCARD.OBJ" file to your link.  Check out the
manual for all the details.  I don't know if previous versions of
Turbo-C have this or not.  Maybe someone should compile it with TC++
and "post" the results to SIMTEL20.....

Warner

--
Warner Losh		imp@Solbourne.COM
Boycott Lotus.		#include <std/disclaimer>

weisen@eniac.seas.upenn.edu (Neil Weisenfeld) (07/13/90)

In article <1990Jul12.175321.15923@Solbourne.COM> imp@dancer.Solbourne.COM (Warner Losh) writes:
>In article <2289@mindlink.UUCP> a563@mindlink.UUCP (Dave Kirsch) writes:
>>> Nope, under MSDOS you have to do the work yourself. Anyway feel like
>>> donating a glob() function to the public domain?
>
>Not sure about the attribute for the quote, but here goes:
>
>If you compile GAWK with TURBO-C++ 1.0 then you can link it a special
>way that allows you to have wildcards to your hearts content.  You
>need to add the "WILDCARD.OBJ" file to your link.  Check out the
>manual for all the details.  I don't know if previous versions of
>Turbo-C have this or not.  Maybe someone should compile it with TC++
>and "post" the results to SIMTEL20.....
>

Haven't really been following this thread so If this is out of context,
you have my apologies:

Under Microsoft C/Quick C, you can link with setargv.obj.  It should
be in with the libraries.  Also, link with the /NOE option.


Neil


>Warner
>
>--
>Warner Losh		imp@Solbourne.COM
>Boycott Lotus.		#include <std/disclaimer>



=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Neil I.  Weisenfeld                    | InterNet: weisen@eniac.seas.upenn.edu
Dept. of Computer and Info. Sciences   | USPS: I dunno, I'm moving...
University of Pennsylvania             | PENNmail: Don't even try it...
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=