Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: How do I deal with (null) filenames? Message-ID: <18765@mimsy.UUCP> Date: 27 Jul 89 11:23:13 GMT References: <2131@jhunix.HCF.JHU.EDU> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 35 In article <2131@jhunix.HCF.JHU.EDU> bio_zwbb@jhunix.HCF.JHU.EDU (Dr. William B. Busa) writes: >I am using some software which has a horrible bug -- it generates data >files which have null names; for instance, ls will list these files as >(null).001 >(null).002 >(null).003 >etc. These truly are nulls -- in an alphabetical directory listing, >they are listed *before* . and ..! They are not truly `nulls', they are the sequence left-paren n u l l right-paren dot zero zero . They come before `.' and `..' in sorted directory listings because `(' comes before `.' in ASCII. >My question is this: how can I change these to manageable filenames? % sh # if using csh $ for i in '(null)'.*; do > mv "$i" "`echo \"$i\" | sed 's/(null)/foo/'`" > done The other thing to do is fix the software. Probably a `helpful' C library is receiving a call of the form char *p = NULL; int seq = 0; ... (void) sprintf(buffer, "%s.%3d", p, seq); and instead of crashing the program (thus pointing directly to the bug), it is formatting `%s' with an argument of (char *)0 as the six-letter sequence `(null)'. Suns and 4.3BSD-tahoe machines do this, for instance. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris