[comp.sys.amiga] CLI/shells

page@swan.ulowell.edu (Bob Page) (05/06/88)

peter@sugar.UUCP (Peter da Silva) wrote:
>none of the Amiga shells will run without the CLI.

WShell runs without the CLI.  So does AmigaShell, the rumored shell
in the rumored 1.3 workbench release.  Probably more too; these
just spring to mind.

If you're talking about stuff like Matt's shell, your talking first
generation shell vs second generation.  Of course Matt's is still THE
shell for Csh compatability; while WShell and AmigaShell try to
maintain some CLI compatibility (like #? wildcards, semicolon to start
a comment, etc).

Machines, OSs, languages, editors, shells -- it's all religion.

..Bob
-- 
Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page

dillon@CORY.BERKELEY.EDU (Matt Dillon) (05/06/88)

:WShell runs without the CLI.  So does AmigaShell, the rumored shell
:in the rumored 1.3 workbench release.  Probably more too; these
:just spring to mind.
:
:If you're talking about stuff like Matt's shell, your talking first
:generation shell vs second generation.  Of course Matt's is still THE
:shell for Csh compatability; while WShell and AmigaShell try to
:maintain some CLI compatibility (like #? wildcards, semicolon to start
:a comment, etc).

	I'm flattered, but actually, my shell is no where near csh in
terms of script compatibility... no history or string modifiers, for instance.
I'm glad people are picking up on the shell idea ... can't wait to see what
C-A has for us in 1.3 .  I originally wrote my shell for four, and only
four reasons:

	(1) history (don't have to retype commands I want to repeat)
	(2) aliases (don't have to remember long argument strings)
	(3) get rid of that damn blasted #? wildcard crap and replace it 
	    with something more general (*/?). (ala unix)
	(4) internal shell commands.  Not external, Not rez'd, Not
	    resident ... internal and hardcoded.  Being just subroutines
	    such commands usually taken about a dozen longwords of memory
	    and have no overhead.

peter@sugar.UUCP (Peter da Silva) (05/06/88)

In article ... dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
> 	(3) get rid of that damn blasted #? wildcard crap and replace it 
> 	    with something more general (*/?). (ala unix)

What do you mean? #? is more general than *?, since # is actually a closure
operator (like * in regular expressions) not a wildcard. Now, "[]", "{,}",
and so on are more versatile than #?, but they can be added in (as they are
in Jeff Lydiatt's wildcard code... you know: the code you took out of my
file requestor).
-- 
-- Peter da Silva      `-_-'      ...!hoptoad!academ!uhnix1!sugar!peter
-- "Have you hugged your U wolf today?" ...!bellcore!tness1!sugar!peter
-- Disclaimer: These aren't mere opinions, these are *values*.

andy@cbmvax.UUCP (Andy Finkel) (05/07/88)

In article <8805052308.AA05229@cory.Berkeley.EDU> dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
>I'm glad people are picking up on the shell idea ... can't wait to see what
>C-A has for us in 1.3 .  I originally wrote my shell for four, and only
>four reasons:
>
>	(1) history (don't have to retype commands I want to repeat)
>	(2) aliases (don't have to remember long argument strings)

so far our reasons are in complete agreement; I hacked up the
C-A shell for this very reason.

>	(3) get rid of that damn blasted #? wildcard crap and replace it 
>	    with something more general (*/?). (ala unix)

Well, I adapted to this one, actually :-)

>	(4) internal shell commands.  Not external, Not rez'd, Not
>	    resident ... internal and hardcoded.  Being just subroutines
>	    such commands usually taken about a dozen longwords of memory
>	    and have no overhead.


I did think about building a lot of the common ones in;
but decided not to for the time being, as resident does
give the functionality of builtin, at a small price in size.

			andy
-- 
andy finkel		{ihnp4|seismo|allegra}!cbmvax!andy 
Commodore-Amiga, Inc.

"C combines the power of assembly language with the flexibility of
 assembly language."
		
Any expressed opinions are mine; but feel free to share.
I disclaim all responsibilities, all shapes, all sizes, all colors.

dillon@CORY.BERKELEY.EDU (Matt Dillon) (05/07/88)

>What do you mean? #? is more general than *?, since # is actually a closure
>operator (like * in regular expressions) not a wildcard. Now, "[]", "{,}",
>and so on are more versatile than #?, but they can be added in (as they are
>in Jeff Lydiatt's wildcard code... you know: the code you took out of my
>file requestor).

	When I want 'everything', I don't want to have to type two
characters to get it.

				-Matt

chekmate@athena.mit.edu (Adam Kao) (05/08/88)

In article <8805070851.AA04063@cory.Berkeley.EDU> dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
>	When I want 'everything', I don't want to have to type two
>characters to get it.
>
>				-Matt

Aw, poor baby.

Adam

dillon@CORY.BERKELEY.EDU (Matt Dillon) (05/08/88)

:In article <8805070851.AA04063@cory.Berkeley.EDU> dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
:>	When I want 'everything', I don't want to have to type two
:>characters to get it.
:>
:>				-Matt
:
:Aw, poor baby.
:
:Adam

	Let me put it another way:  I never heard of #? before I got my
Amiga.  Everybody else I know uses * ? [] etc...  I'm not about to change
from something streamlined to something bulky and non-intuitive.

	dir */*/c*.?
	dir #?/#?/c#?.?


					-Matt

peter@sugar.UUCP (Peter da Silva) (05/09/88)

In article ... dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
  [ He said "*? type wildcards are more general than #?". ]
> I said:
> >#? is more general than *?, since # is actually a closure operator...

> 	When I want 'everything', I don't want to have to type two
> characters to get it.

So what you mean is that *? is easier for the more common cases. It is not,
however, more general. And it conflicts with standard usage (* == Input()
and * being used as an escape) which is *already* way too overloaded.
-- 
-- Peter da Silva      `-_-'      ...!hoptoad!academ!uhnix1!sugar!peter
-- "Have you hugged your U wolf today?" ...!bellcore!tness1!sugar!peter
-- Disclaimer: These aren't mere opinions, these are *values*.

dillon@CORY.BERKELEY.EDU (Matt Dillon) (05/10/88)

:In article ... dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
:  [ He said "*? type wildcards are more general than #?". ]
:> I said:
:> >#? is more general than *?, since # is actually a closure operator...
:
:> 	When I want 'everything', I don't want to have to type two
:> characters to get it.
:
:So what you mean is that *? is easier for the more common cases. It is not,
:however, more general. And it conflicts with standard usage (* == Input()
:and * being used as an escape) which is *already* way too overloaded.

	Huh?  Where'd that come from?  '*' means 'match anything'.  There
never was, and never will be a '?' after it, unless you want 
'match anything but it had better be at least one character', as in:
	charlie*?  would NOT match charlie, but would match charlie<anything>

					-Matt

peter@sugar.UUCP (Peter da Silva) (05/13/88)

In article ... dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
  [ I said something about using "#?" instead of "*?"...

> 	Huh?  Where'd that come from?  '*' means 'match anything'.  There
> never was, and never will be a '?' after it, unless you want 
> 'match anything but it had better be at least one character', as in:
> charlie*?  would NOT match charlie, but would match charlie<anything>

Matt, "#?" is a 'name'. a shorthand for referring to AmigaDOS style
wildcards. "*?" is a name, too. It's a shorthand for referring to CP/M
style wildcards. UNIX style ones are much more complex than either:
since they include charsets, alternates, and so on.

Anyway. The point I was making is that AmigaDOS style wildcards may take
a couple of extra keystrokes, but they're a lot more general because
# is a closure operator, instead of a wildcard. It can be used as a wild
card, or it can be used to handle more complex cases.

* also has the disadvantage that it conflicts with AmigaDOS usage:

	1> COPY * to Filename.
	2> COPY My* Disk:Filename to Your* Disk:

It's already overloaded. # is the standard. Please stick to it. There is
an excellent wildcard handler witten by Jeff Lydiatt that I use extensively.
Not only does it handle the regular stuff, it also handles sets and
alternations much like UNIX (though the syntax is different):

I use "#?.(c|h)|Makefile" quite a bit when moving programs around. It's
equivalent to the csh "{*.[ch],Makefile}"
-- 
-- Peter da Silva      `-_-'      ...!hoptoad!academ!uhnix1!sugar!peter
-- "Have you hugged your U wolf today?" ...!bellcore!tness1!sugar!peter
-- Disclaimer: These aren't mere opinions, these are *values*.

dillon@CORY.BERKELEY.EDU (Matt Dillon) (05/15/88)

>It's already overloaded. # is the standard. Please stick to it. There is
>an excellent wildcard handler witten by Jeff Lydiatt that I use extensively.
>Not only does it handle the regular stuff, it also handles sets and
>alternations much like UNIX (though the syntax is different):
>
>I use "#?.(c|h)|Makefile" quite a bit when moving programs around. It's
>equivalent to the csh "{*.[ch],Makefile}"

	Each to our own.

				-Matt

doug-merritt@cup.portal.com (05/17/88)

Peter da Silva said:
>'*' also has the disadvantage that it conflicts with AmigaDOS usage [...]
>It's already overloaded. # is the standard. Please stick to it. There is
>an excellent wildcard handler witten by Jeff Lydiatt that I use extensively.
>[...] I use "#?.(c|h)|Makefile" quite a bit when moving programs around. It's
>equivalent to the csh "{*.[ch],Makefile}"

It also allows string alternation, like unix egrep: "(main|misc).#?" which
is real handy! Jeff's code is very nice, and very easy to interface to.

I suspect that the reason that Jeff's code hasn't been used more extensively
is that you've got to put a good wrapper around it. I did so this weekend
for my "filetype" program, and it was a few hundred lines of code to make
it 100% perfectly general. To search the current directory only requires
maybe 10-20 lines of code (foreach dir entry, check whether it matches
via Jeff's code). Handling *every* possible case, with error checking, is
more complex. But I was real pleased to see "filetype #?/#?/#?" work.

I was thinking about releasing this code I wrote as a library routine.
The interface looks like this: "av = Glob(&ac, av);" Pretty simple, eh?
Anyone need something like this? Is there already something like this
around that I somehow overlooked?

Even if there is, there's one feature I added that I'd bet is unique...
it wildcards *devices* too! I.e. "filetype #?:#?" matches the contents
of all the root directories on all the file system devices (and assigns).
This required surprisingly little extra code on top of the original stuff.

I'm feeling real pleased to have gotten this working nicely. I do have
one (dumb) question, though. For some reason I can't find the wildcard
documentation in the AmigaDOS manual. Where is it? I wanna know what
the magic char "%" is for. And to refresh my memory about uses of '#'
other than '#?'.

Pretty bad when some dummy doesn't even know what the code he implements
does, huh. (blush) :-)

      Doug Merritt        ucbvax!sun.com!cup.portal.com!doug-merritt
                      or  ucbvax!eris!doug (doug@eris.berkeley.edu)
                      or  ucbvax!unisoft!certes!doug

peter@sugar.UUCP (Peter da Silva) (05/20/88)

In article <5490@cup.portal.com>, doug-merritt@cup.portal.com writes:
> I suspect that the reason that Jeff's code hasn't been used more extensively
> is that you've got to put a good wrapper around it.

If you want to use it just for command line arguments, anyway. In the latest
version of Browser I use it to select groups of files.

> Handling *every* possible case, with error checking, is
> more complex. But I was real pleased to see "filetype #?/#?/#?" work.

Good stuff.

> I was thinking about releasing this code I wrote as a library routine.
> The interface looks like this: "av = Glob(&ac, av);" Pretty simple, eh?
> Anyone need something like this? Is there already something like this
> around that I somehow overlooked?

I used to use "buildav(&ac, &av)", but really you need to change _main
to do the globbing for command line args invisibly, and to provide an analog
of Examine/ExNext. The best way to implement that would be to duplicate the
name of and interface to Manx' "scdir()". Be my guest. I was going to do all
of that stuff, but I'd be as happy to let you.

char *scdir(pat)
char *pat;

Returns a pointer to a static area containing the null-terminated name of
the next file that matches a pattern. The area containing the name [and
presumably the FileInfoBlock(s) and stuff -- ed.] is statically allocated.

> one (dumb) question, though. For some reason I can't find the wildcard
> documentation in the AmigaDOS manual. Where is it? I wanna know what
> the magic char "%" is for. And to refresh my memory about uses of '#'
> other than '#?'.

How about "del foo#(.o)" to trash foo and foo.o when you're cleaning house?
The # can be used to indicate optional parts of a pattern (tho of course
del foo(|.o) should work as well).
-- 
-- Peter da Silva      `-_-'      ...!hoptoad!academ!uhnix1!sugar!peter
-- "Have you hugged your U wolf today?" ...!bellcore!tness1!sugar!peter
-- Disclaimer: These may be the official opinions of Hackercorp.

doug-merritt@cup.portal.com (05/22/88)

I write:
> I suspect that the reason that Jeff's code hasn't been used more extensively
> is that you've got to put a good wrapper around it.

Peter da Silva writes:
>If you want to use it just for command line arguments, anyway. In the latest
>version of Browser I use it to select groups of files.

Yes...I got it from an old Browser, actually. Just for the record, of
course *you* put a wrapper around it too...for the benefit of everyone
else, what's going on is that Jeff's code allows you to compare a
string against a pattern and see if they match. It has no awareness
of directories, filenames, full paths, etc. Hence the wrapper. For a
Workbench-based program, one might not need all of the full-path-wildcard
features I felt obligated to put into Glob()...expanding just the
current directory is sufficient, and much simpler.

>I used to use "buildav(&ac, &av)", but really you need to change _main
>to do the globbing for command line args invisibly, and to provide an analog
>of Examine/ExNext. The best way to implement that would be to duplicate the
>name of and interface to Manx' "scdir()". Be my guest. I was going to do all
>of that stuff, but I'd be as happy to let you.

Actually that's two separate interfaces you're talking about. For
enhancing _main(), you could just call the Glob(&ac, av) routine I
was talking about, and your command line gets wildcard expanded.

The second one is the scdir() you suggest, which would also be useful
for some purposes...like to drop into code that was previously using
ExNext() with minimum hassle. Question: does scdir() handle patterns
like "#?/#?/#?" or is it just current directory? The Manx documentation
doesn't say. BTW Manx's scdir() implements Unix style wildcards, while
everything that Peter and I are talking about is AmigaDOS style.

I'll probably do an scdir() equivalent next time I do a program that
needs it. :-)

>How about "del foo#(.o)" to trash foo and foo.o when you're cleaning house?
>The # can be used to indicate optional parts of a pattern (tho of course
>del foo(|.o) should work as well).

Ok, thanks. Someone else tells me that "del foo(%|.o)" is also
equivalent. Makes me wonder what the point of having '%' is...esthetics?
	Doug
---
      Doug Merritt        ucbvax!sun.com!cup.portal.com!doug-merritt
                      or  ucbvax!eris!doug (doug@eris.berkeley.edu)
                      or  ucbvax!unisoft!certes!doug

peter@sugar.UUCP (Peter da Silva) (06/01/88)

In article <5732@cup.portal.com>, doug-merritt@cup.portal.com writes:
> I write:
> > I suspect that the reason that Jeff's code hasn't been used more extensively
> > is that you've got to put a good wrapper around it.
> 
> Peter da Silva writes:
> >If you want to use it just for command line arguments, anyway. In the latest
> >version of Browser I use it to select groups of files.
> 
> Yes...I got it from an old Browser,...

You didn't get it from my "browser", I hope. The source shouldn't be out
there... :->

> >I used to use "buildav(&ac, &av)", but really you need to change _main
> >to do the globbing for command line args invisibly, and to provide an analog
> >of Examine/ExNext.

> Actually that's two separate interfaces you're talking about. For

Yeh, I know. I didn't intend to imply otherwise.

> enhancing _main(), you could just call the Glob(&ac, av) routine I
> was talking about, and your command line gets wildcard expanded.

I much prefer making this invisible. I mean, really: just how Amiga-
specific do you want your CLI programs to be? You should just be able
to recompile and link "uudecode" and have it go.

> The second one is the scdir() you suggest, which would also be useful
> for some purposes...like to drop into code that was previously using
> ExNext() with minimum hassle.

Or to drop into code that's already using scdir(), so it will suddenly
use AmigaDOS wildcarding!

> Question: does scdir() handle patterns
> like "#?/#?/#?" or is it just current directory?

Who cares? If you want to make your replacement code do it the right way
that's perfectly cool.
-- 
-- Peter da Silva      `-_-'      ...!hoptoad!academ!uhnix1!sugar!peter
-- "Have you hugged your U wolf today?" ...!bellcore!tness1!sugar!peter
-- Disclaimer: These may be the official opinions of Hackercorp.

doug-merritt@cup.portal.com (06/02/88)

Peter da Silva writes:
>You didn't get it from my "browser", I hope. The source shouldn't be out
>there... :->

Oh. Well, your file requester or whatever it was. I just scanned the
Cat Fish index and couldn't find the disk that contains the source I
pulled it out of, so I'm not sure exactly anymore.

I said:
> enhancing _main(), you could just call the Glob(&ac, av) routine I
> was talking about, and your command line gets wildcard expanded.

Peter replies:
>I much prefer making this invisible. I mean, really: just how Amiga-
>specific do you want your CLI programs to be? You should just be able
>to recompile and link "uudecode" and have it go.

Sure. But that's exactly what I said. Note the "_main()" in my quote
above, not "main()". In other words, if you have the (invisible) standard
startup function "_main()" call something like my Glob(), then the
wildcarding *does* happen automagically and invisibly.
	Doug
--
      Doug Merritt        ucbvax!sun.com!cup.portal.com!doug-merritt
                      or  ucbvax!eris!doug (doug@eris.berkeley.edu)
                      or  ucbvax!unisoft!certes!doug

peter@sugar.UUCP (Peter da Silva) (06/03/88)

In article <6141@cup.portal.com>, doug-merritt@cup.portal.com writes:
> I said: [basically, enhance "_main()"]

> Peter replies: [basically, don't want it in "main()"]

> Sure. But that's exactly what I said. Note the "_main()" in my quote
> above, not "main()". In other words...

In other words I'm a dodo. Do you want me to flame myself a-la Leo Schwab
for not reading what you wrote or will an apology do? :->

(How do you put a beard in a smiley-face?)
-- 
-- Peter da Silva      `-_-'      ...!hoptoad!academ!uhnix1!sugar!peter
-- "Have you hugged your U wolf today?" ...!bellcore!tness1!sugar!peter
-- Disclaimer: These may be the official opinions of Hackercorp.

doug-merritt@cup.portal.com (06/05/88)

In regard to installing wildcards in _main(), Peter da Silva writes:
>In other words I'm a dodo. Do you want me to flame myself a-la Leo Schwab
>for not reading what you wrote or will an apology do? :->

Thanks, but neither is necessary! We're talking about the same thing, after
all.

Unless you really *want* to amuse us with Schwabesque Schizoflames...

>(How do you put a beard in a smiley-face?)

I dunno. How about :-)=   Or ;-)### for a long one...
	Doug
--
      Doug Merritt        ucbvax!sun.com!cup.portal.com!doug-merritt
                      or  ucbvax!eris!doug (doug@eris.berkeley.edu)
                      or  ucbvax!unisoft!certes!doug

peter@sugar.UUCP (Peter da Silva) (06/13/88)

In article <6223@cup.portal.com>, doug-merritt@cup.portal.com writes:
> >(How do you put a beard in a smiley-face?)

> I dunno. How about :-)=   Or ;-)### for a long one...

Great. I get to look like Bork or Father Christmas. :->}
-- 
-- Peter da Silva      `-_-'      ...!hoptoad!academ!uhnix1!sugar!peter
-- "Have you hugged your U wolf today?" ...!bellcore!tness1!sugar!peter
-- Disclaimer: These may be the official opinions of Hackercorp.