From: martelli@cadlab.sublink.org (Alex Martelli)
Newsgroups: comp.unix.questions,comp.sys.hp
Subject: how to use "monocase" filenames (was Re: HP and windows NT)
Date: 1 Oct 92 09:59:20 GMT
Followup-To: comp.unix.questions
Organization: CAD.LAB S.p.A., Bologna, Italia

jason@jazz.cnd.hp.com (Jason Zions) writes (in comp.sys.hp):

:Here's a trick to make all files monocase. Press the caps lock key before
:you login; the system will revert to the canonical ALL-CAPS MODE THAT ALL
:OPERATING SYSTEMS USED TO USE. THIS SHOULD ACCOMPLISH YOUR OBJECTIVE OF
:FORCING ALL APPLICATIONS, EVERYWHERE, TO USE YOUR DESIRED CONVENTION.

This solution will not work.  By logging in in all-caps, you will make
Unix believe you have an ancient caps-only terminal, so that anything
you enter will be downcased, and everything that is displayed to you
will be uppercased (at least, this is the traditional way Unix behaves,
although I just checked and it seems that HP-UX 7.03 won't support
this, at least coming at an HP9000/400 over telnet).

BUT, even if supported, this behaviour does NOT guarantee that all
applications will comply and make files monocase!  Consider:

---cut: makemix.c
#include <stdio.h>
#include <ctype.h>
int main(argc,argv) char *argv[];
{
    int i,j; FILE *f; char buf[80];
    for(i=1;i<argc;i++) {
        strcpy(buf,argv[i]);
	for(j=0; buf[j]; j++) {
	    if(j&1) {
                if(isupper(buf[j])) buf[j]=tolower(buf[j]);
	    } else {
                if(islower(buf[j])) buf[j]=toupper(buf[j]);
	    }
	}
	f=fopen(buf,"w");
	if(!f) {perror(buf);continue;}
	fprintf(f,"File %s opened (from %s)\n",buf,argv[i]);
	fclose(f);
    }
    return 0;
}
---end cut

Now cc -o makemix makemix.c, and something like:

    ./makemix mixed-case-rules-ok

will make you a nice little file called MiXeD-CaSe-rUlEs-oK.  Now a

    echo fancy this > mixed-case-rules-ok

will let you have two distinct files, whose names only differ in casing...
and you can run this application (once you have it working) even without
releasing the capslock key from your keyboard (if the above-mentioned
convention is respected; else you will have to ln makemix MAKEMIX in
advance to make sure of being able to run this precious application).

How WAS that quote again?  Something like, "Unix does not stop you from
doing stupid things, because this is the only way of also not stopping
you from doing clever things".  I put mixed-case filenames in this
cathegory: they mostly enable silliness such as the above, BUT once in
a blue moon you do precious wonderful things with them, and THAT is
where you start chomping at the bit against filesystems that do not
allow normal Unix behaviour!!!

It would be nice if this behaviour should be configurable, IN THEORY, but
IN PRACTICE letting one have mixed- or monocase FS's depending, say, on
some environment variable, works HORRIBLY -- trust me, I have struggled
long enough against the DOWNCASE environment flag on the Domain (or
whatever Aegis is called this week) operating system on HP/Apollo boxes!
It breaks programs unexpectedly, and more generally works against the
principle of least astonishment... so, if I have my choice, it's case
sensitivity all the way, with the way OS/2 HPFS works as second choice,
but NOT configurability PLEASE!

Followups redirected to comp.unix.questions...
-- 
Email: martelli@cadlab.sublink.org                   Phone: ++39 (51) 6130360
CAD.LAB s.p.a., v. Ronzani 7/29, Casalecchio, Italia   Fax: ++39 (51) 6130294 
Newsgroups: comp.unix.questions