Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!helios.ee.lbl.gov!nosc!cod!hall From: hall@cod.NOSC.MIL (Robert R. Hall) Newsgroups: comp.os.minix Subject: Re: C. E. Chew's new ls.c Keywords: ls commands Message-ID: <1618@cod.NOSC.MIL> Date: 27 Aug 89 02:45:11 GMT Organization: Naval Ocean Systems Center, San Diego Lines: 107 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) and after line 859 adding the statement extern struct tm *localtime(); 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 following cdiff contains the total patches I needed to get it to compile with MINIX on the IBM-PC To compile this I used the command: cc -DMINIX -Di8088 -T. -o ls ls.c I have observed that this ls print dates that are more the a year old for the year as 3888 instead of 1988 Robert R. Hall hall@nosc.mil ----------------------- ls.cdif ---------------------------- echo x - ls.cdif sed '/^X/s///' > ls.cdif << '/' X*** /dr_a/ls/ls.c Mon Jul 31 08:30:03 1989 X--- ls.c Sat Aug 26 19:02:05 1989 X*************** X*** 43,51 **** X #ifdef MINIX X #include X #include X! #include X! #include X! #undef printf X #endif X X #define DEFAULTDIR "." /* default for ls without args */ X--- 43,52 ---- X #ifdef MINIX X #include X #include X! #include "../fs/const.h" X! #include "../fs/type.h" X! #undef printf X! extern int errno; X #endif X X #define DEFAULTDIR "." /* default for ls without args */ X*************** X*** 60,66 **** X #define HALFYEAR ((long) 60*60*24*365/2) /* half year in seconds */ X #define BASEYEAR 1900 /* struct tm.tm_year base */ X X! #define NIL ((void *) 0) /* nil pointer */ X X /* X * Flags are maintained in a bitmap. Access should be fast X--- 61,67 ---- X #define HALFYEAR ((long) 60*60*24*365/2) /* half year in seconds */ X #define BASEYEAR 1900 /* struct tm.tm_year base */ X X! #define NIL (0) /* nil pointer */ X X /* X * Flags are maintained in a bitmap. Access should be fast X*************** X*** 82,88 **** X * useful when working with the flags since these are X * read-only. X */ X! #define BOOL(b) static char b = 0 X #define EVAL(b,a) ((b ? b : (b = (a)+1)) > 1) X X /* X--- 83,89 ---- X * useful when working with the flags since these are X * read-only. X */ X! #define BOOL(b) char b = 0 X #define EVAL(b,a) ((b ? b : (b = (a)+1)) > 1) X X /* X*************** X*** 858,864 **** X X { X struct tm *tmbuf; /* output time */ X! X tmbuf = localtime(&t); X (void) printf("%.3s %2d ", X "JanFebMarAprMayJunJulAugSepOctNovDec"+tmbuf->tm_mon*3, X--- 859,866 ---- X X { X struct tm *tmbuf; /* output time */ X! extern struct tm *localtime(); X! X tmbuf = localtime(&t); X (void) printf("%.3s %2d ", X "JanFebMarAprMayJunJulAugSepOctNovDec"+tmbuf->tm_mon*3, /