Path: utzoo!utgpu!watserv1!watdragon!lion!nrjwong From: nrjwong@lion.waterloo.edu Newsgroups: comp.sys.mac Subject: Re: Filenames, ARGH!! Keywords: filenames, csh, spam Message-ID: <20017@watdragon.waterloo.edu> Date: 21 Jan 90 00:26:25 GMT References: <591@lectroid.sw.stratus.com> Sender: daemon@watdragon.waterloo.edu Reply-To: jlee4@orchid.waterloo.edu Organization: U. of Waterloo, Ontario Lines: 49 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].