Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!uw-june!sung From: sung@cs.washington.edu (Sung Kwon Chung) Newsgroups: comp.os.minix Subject: Re: ls -lt *.c doesn't sort files by time as I expected it would Message-ID: <10346@june.cs.washington.edu> Date: 12 Jan 90 00:12:29 GMT References: <1990Jan11.070247.11716@virtech.uucp> Reply-To: sung@june.cs.washington.edu (Sung Kwon Chung) Organization: University of Washington, Computer Science, Seattle Lines: 31 In article <1990Jan11.070247.11716@virtech.uucp> dennis@virtech.uucp (Dennis P. Bednar) writes: >to list files sorted by time order. When I was testing it, I >discovered that if I did: > ls -lt >it properly sorted all of the files in the current directory, but >if I tried: > ls -lt *.c >it didn't sort by the time. Any easy fixes to ls.c? Does ls.c >have this same problem on minix (did I break something in my >port)? I found the same problem in minix, too. It doesn't sort file names specified in arguemnt. Here is a quick fix. (I didn't look carefully all the codes, so it might cause some bad side effects. But I havn't met any, yet.) -sung ================== *** ls.c.org Mon Jan 1 02:25:24 1990 --- ls.c Wed Jan 3 23:10:25 1990 *************** *** 430,435 **** --- 430,437 ---- } ostringp = stringp; + sortfiles(baseindex, lastindex - baseindex); /* sort file names in arg, too*/ + for (i = baseindex; i < lastindex; ++i) { if (!(flags_f && baseindex == 0) && (include_dirs || (sortindex[i]->f_stat.st_mode & S_IFMT) != S_IFDIR))