lennox@paris.sw.stratus.com (Craig Scott Lennox) (01/19/90)
I'm trying to write a csh for a Mac SE. Say what you like, but there are some times when you need to type commands rather than mouse them. However, I'm stonewalled atthe beginning: How can you write an effective command interpreter when ANY character -- spaces, tabs, hyphens, underscores, colons, etc. can be in your filenames. Furthermore, with the limit on filename length being 31-characters, that could make for some mighty hairy pathnames. Are there any accepted or innovative ideas out there to overcome this hassle? Any information would be greatly appreciated (and given credit for!). -- | Craig Scott Lennox -- Stratus Computer - Marlborough, MA | | Dyslexic Existentialism: "Is there a dog?" | | Find out what I really said -- send for your free decoder ring! |
long@mcntsh.enet.dec.com (Richard C. Long) (01/20/90)
In article <591@lectroid.sw.stratus.com>, lennox@paris.sw.stratus.com (Craig Scott Lennox) writes... > >I'm trying to write a csh for a Mac SE. Say what you like, but there are some >times when you need to type commands rather than mouse them. > >[asks for ideas on handling filenames with embedded whitespace, etc.] Funny you bring this up! I've been working off and on (well, more off than on) on one of these for a while. One idea that struck me immediately (since I work on VMS) was to use a method similar to that of VMS' DCL, i.e. to quote the filenames. Something like so: COPY "this mac file" "another mac file" If the filename contains quotes, they would have to be doubled up, like COPY "this ""name" "that name" Admittedly, this is a bit of a pain, since almost all files (I suspect) would have to be quoted. I'm not really sure of any other way it could be done, though, off the top of my head. Some kind of delimiter is needed. Although I am somewhat biased, I think DCL is an excellent CLI, and would make a good model. Does this help at all? rich
levin@bbn.com (Joel B Levin) (01/20/90)
In article <591@lectroid.sw.stratus.com> lennox@paris.sw.stratus.com (Craig Scott Lennox) writes: |However, I'm stonewalled atthe beginning: How can you write an effective |command interpreter when ANY character -- spaces, tabs, hyphens, underscores, |colons, etc. can be in your filenames.... Why not do it the way csh, or for that matter, MPW(1), does it? You have a limited list of special characters, so require that they only appear in quoted strings or with a quote-character prefix. Csh allows spaces, asterisks, etc. in filenames, too, if you quote them properly. /JBL (1) MPW has a useful additional feature in some of its commands, e.g. the equivalent to 'ls': file names containing special characters are by default output quoted in '' so you can feed the output into another command. = Nets: levin@bbn.com | "There were sweetheart roses on Yancey Wilmerding's or {...}!bbn!levin | bureau that morning. Wide-eyed and distraught, she POTS: (617)873-3463 | stood with all her faculties rooted to the floor."
tonyrich@titanic.cs.wisc.edu (Anthony Rich) (01/20/90)
From article <591@lectroid.sw.stratus.com>: > >I'm trying to write a csh for a Mac SE. Say what you like, but there are some >times when you need to type commands rather than mouse them. > >However, I'm stonewalled at the beginning: How can you write an effective >command interpreter when ANY character -- spaces, tabs, hyphens, underscores, >colons, etc. can be in your filenames. Furthermore, with the limit on >filename length being 31 characters, that could make for some mighty hairy > pathnames. > >Are there any accepted or innovative ideas out there to overcome this hassle? Well, first of all I hope you know about MPW (Mac Programmer's Workshop). It's something like "Unix on the half-shell" which might save you from implementing csh at all if it does what you need. If not, though, you've stumbled onto what I think is one of the Mac's great strengths, not weaknesses: when you have a mouse, you don't have to type filenames. I find that liberating! (By the way, I'm using a Unix workstation as I write this. I've been there.) I don't think there are any easy answers. As a Unix user, I don't like typing long filenames and pathnames no matter WHAT characters they do or don't have. I wouldn't like it on the Mac, either. MPW works best with Unix-style filenames. The first thing the manual says to do when you install MPW is to rename your hard disk to something with no spaces. (That instantly got me mad. Who are THEY to tell me what to name my hard disk? *I* was the one who paid for my Mac hardware and software, wasn't I? Who's in control of it, MPW or me? What about all those pathnames already buried in my HyperCard Home stack? Grrr! Looks like I'm STILL mad...! :^) Anyway, MPW forces you to put quotes around Mac filenames that have spaces. Seems like that's reasonable in command scripts, ugly as they might get. What about a command-line interface? You might try something hybrid. Suppose you had a command line box at the bottom of the desktop. When you wanted to specify a filename somewhere in the command line, you might allow the option of either typing it directly (in quotes, if necessary), or clicking (or control-clicking, etc) on a visible icon, which would automagically append its (quoted) pathname to your command line, or perhaps you could allow some way to bring up something like the Standard File dialog to allow browsing around and finally selecting the file you want, again causing the pathname to be appended to the command line. (That "command line" might get kinda long. I think you'll want a "command window."] You might also try some kind of "filename completion" feature, perhaps based on valid filenames appearing in the currently open folder. Any other ideas out there? Tony -- ------------------------------------------------------------------------ Email: tonyrich@titanic.cs.wisc.edu Phone: 608-271-8450 Disclaimer: The opinions above are mine. Others may agree or disagree. ------------------------------------------------------------------------
hpoppe@bierstadt.scd.ucar.edu (Herb Poppe) (01/20/90)
In article <591@lectroid.sw.stratus.com> lennox@paris.sw.stratus.com (Craig Scott Lennox) writes: > >I'm trying to write a csh for a Mac SE. Say what you like, but there are some >times when you need to type commands rather than mouse them. > >However, I'm stonewalled atthe beginning: How can you write an effective >command interpreter when ANY character -- spaces, tabs, hyphens, underscores, >colons, etc. can be in your filenames. In UNIX, filenames can contain any character. (What, you haven't snuck over to your friends terminal while he was in the bathroom and renamed all his files to include the ACSII BEL character. It sounds so pretty when he does an ls!). You do what UNIX csh does: invent "quoting". There is this kind of quote ("), and this kind (') and of course don't forget (\). But people always forget to use them in their scripts, or use them incorrectly so that they never work with those special characters anyway. (Don't you just love CLLs!). >Furthermore, with the limit on filename >length being 31-characters, that could make for some mighty hairy pathnames. Not sure what you are getting at here. Surely you don't think that Mac "pathnames" are limited to 31 characters. In fact, I don't believe there is any limit on the number of folders in a hierarchy, so that Mac "pathnames" are essentially unlimited no matter how long (or short) the filenames are. Is that what you meant? >Are there any accepted or innovative ideas out there to overcome this hassle? Any >information would be greatly appreciated (and given credit for!). Unfortunately, an innovative CLL (one that clearly distinguishes between language and data) probably wouldn't be acceptable to the cabal that likes CLLs since it would require more typing, wouldn't be a macro language, and wouldn't work "just like csh". And don't ask me what THAT means; I got bored with the idea of inventing the ultimate CLL years ago. (About the time we started seeing those nifty machines from Xerox PARC; you know, the ones that use a GUI.) -- Herb Poppe NCAR INTERNET: hpoppe@ncar.ucar.edu (303) 497-1296 P.O. Box 3000 CSNET: hpoppe@ncar.CSNET Boulder, CO 80307 UUCP: hpoppe@ncar.UUCP
nrjwong@lion.waterloo.edu (01/21/90)
In article <591@lectroid.sw.stratus.com> lennox@paris.sw.stratus.com (Craig Scott Lennox) writes: > >I'm trying to write a csh for a Mac SE. Say what you like, but there are some >times when you need to type commands rather than mouse them. > >However, I'm stonewalled atthe beginning: How can you write an effective >command interpreter when ANY character -- spaces, tabs, hyphens, underscores, >colons, etc. can be in your filenames. Furthermore, with the limit on filename >length being 31-characters, that could make for some mighty hairy pathnames. > >Are there any accepted or innovative ideas out there to overcome this hassle? Any >information would be greatly appreciated (and given credit for!). > [This probably should've gone in comp.sys.mac.programmer if it isn't in there yet instead. Anyways...] I've thought about this a bit. One thing I came up with is why make the user spell out to the shell which file is the one the user wants when the shell can make a pretty good guess itself. Essentially if you get something like "ls Joe's Birthday", the obvious thing that shells assume is that a filename is a word [sequence of letters, etc] separated on either sides by a space. Well, if you try and find the file "Joe's" and it doesn't exist - don't give up and bitch to the user "I don't know what you're talking about man!", attach the next word to your original search word and try again. So you'd try "Joe's Birthday" and would succeed. I think that's where most of the problems occur. Now there are situations where you might have filenames "Joe's", "Birthday", and "Joe's Birthday" - stick up a dialog box or something to say you're not sure what file he's referring to. At least if the command line didn't have these words quoted. I don't know how much of a performance hit this might have on a shell. I really haven't thought this out much, so there are probably more than a few problems lurking around. Oh, about pathnames. The max filename length is 31 chars and the max pathname you can specify at once is 255 chars [or thereabouts]. So if you geta real long pathname, you'd have to split up the pathname and descend into the disk in two or more calls as opposed to one. But MPW is fine for 99% of the things I have to do in a shell. Greater speed would be appreciated. Fewer bugs in the C compiler. Johnny Lee jlee4@orchid.waterloo.edu [using nrjwong's account cause my machine doesn't get these newsgroups].
allbery@NCoast.ORG (Brandon S. Allbery) (01/22/90)
As quoted from <7612@shlump.nac.dec.com> by long@mcntsh.enet.dec.com (Richard C. Long): +--------------- | In article <591@lectroid.sw.stratus.com>, lennox@paris.sw.stratus.com (Craig Scott Lennox) writes... | >I'm trying to write a csh for a Mac SE. Say what you like, but there are some | >times when you need to type commands rather than mouse them. | | Funny you bring this up! I've been working off and on (well, more off than | on) on one of these for a while. One idea that struck me immediately (since I | work on VMS) was to use a method similar to that of VMS' DCL, i.e. to quote | the filenames. +--------------- IBM VM/CMS uses a rather strange convention for file names: the file extension is separated from the name by a space. This, of course, causes some problems for the CLI, which are solved by the use of keywords. (e.g. COPY FOO PASCAL TO BAR PASCAL -- because there is a *third* part possible in a filename, the "file mode" which identifies the virtual minidisk and some other attributes, the keyword is required.) This would, of course, be a bit more difficult on a Mac because in the VM/CMS environment there is a maximum filename size in space-delimited words (three, the name, type, and mode), so if a file type just happens to be "TO" you can get around it by giving the full name including the file mode; the Mac doesn't have this limitation, so it can't use this trick. However, it does suggest some possibilities for handling file names which can contain spaces. One other possibility: use multi-line commands. Copy User HD:Communications:Telecommunicators:ZTerm:ZTerm 0.85 To User HD:Backups:ZTerm 0.85 From the keyboard, RETURN would make a continuation line and ENTER would execute the constructed command. One would need to indicate the beginning of a command somehow, say by a blank line. Multiple file names could be simply listed one per line, or you could invent conjunctions: "Copy file1 And file2 To Folder". I would advise having a way to use SFGetFile on these, perhaps with a command- key combination. Paths can get pretty long, as shown above (the first path really does exist on my hard drive). ++Brandon -- Brandon S. Allbery allbery@NCoast.ORG, BALLBERY (MCI Mail), ALLBERY (Delphi) uunet!cwjcc.cwru.edu!ncoast!allbery ncoast!allbery@cwjcc.cwru.edu *(comp.sources.misc mail to comp-sources-misc[-request]@backbone.site, please)* *Third party vote-collection service: send mail to allbery@uunet.uu.net (ONLY)*