Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!uhccux!munnari.oz.au!bruce!cechew From: cechew@bruce.OZ (Earl Chew) Newsgroups: comp.os.minix Subject: Re: C. E. Chew's new ls.c Message-ID: <1480@bruce.OZ> Date: 28 Aug 89 00:43:55 GMT References: <1618@cod.NOSC.MIL> Organization: Monash Uni. Computer Science, Australia Lines: 49 From article <1618@cod.NOSC.MIL>, by hall@cod.NOSC.MIL (Robert R. Hall): > > All though C. E. Chew new ls.c may compile without errors on the > ST-ATARI and with Microsoft C, I got lots of error messages when > trying to compile with Version 1.3 Minix C compiler on the IBM-PC. > jerry@buita.BU.EDU suggested he got rid of the > warning messaged by changing the statement > #define NIL ((void *)0) > to > #define NIL (0) This change is relatively harmless although I would punt for ((char *) 0). > and after line 859 adding the statement > extern struct tm *localtime(); Hmm. The only reason this line isn't in ls.c is that I thought that time.h should contain a function prototype for it. Mine has such a prototype. So do the Pyramid and Sun systems here. > To get rid of the mutidefine error message, I found I need to > change the statement > #define BOOL(b) static char b = 0 > to > #define BOOL(b) char b = 0 The whole idea of BOOL(b) is to compute the result of a complicated boolean expression once. That's why it's static. On subsequent passes, the result of the expression is available in the boolean and the expression need not be reevaluated. Changing from static to automatic means that the boolean expression is reevaluated on every pass through the code. Is this because of a bug in the Minix C compiler? > > I have observed that this ls print dates that are more the a > year old for the year as 3888 instead of 1988 This does not appear to be a fault of ls. ls does not format the dates. localtime() does. It appears that your localtime is broken. The errno declaration has been inserted for the next release (real soon now). This also includes fixes to support fifos and limited stuff for symbolic links (which aren't in yet). Please note the bug fix which has been posted for getdents.c. Funny, I didn't notice that error ever occurring. Earl