🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9264

Re: reading directory under SYSTEM V

#9264
From: Barry Shein
Date: Sat, 06 Sep 1986 22:43
25 lines
1444 bytes
>> 
>> Cound anybody suggest a method of reading directory information from a C
>> program under SYSTEM V UNIX? I need something equivalent to the opendir and 
>> readdir functionality supplied under BSD.

>Ditto.
>
>Clayton E. Cramer

This may not thrill you, but have you considered forking an 'ls' into
a tmp file and reading that back? (or, similarly, using a popen() to
ls)?

It's not all that slow and shure is portable. I was happy I did that
with a program I wrote back in the old days that just came up on
various versions (consider the number of 'ls's done on your system
anyhow...) And you can even sort them this way and that trivially
(I presume by "functionally" above you mean you end up with the file
names, not the subroutine interface, if you're just trying to move
an application using the 4.2 calls this is not as helpful but it
wouldn't be crazy to implement them conditionally in terms of calls
to 'ls', shouldn't be hard.)

	-Barry Shein, Boston University
Technical Details
Message-ID: <1179@bu-cs.bu-cs.BU.EDU>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!uwvax!husc6!bu-cs!bzs

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!uwvax!husc6!bu-cs!bzs
From: bzs@bu-cs.BU.EDU (Barry Shein)
Newsgroups: net.lang.c
Subject: Re: reading directory under SYSTEM V
Message-ID: <1179@bu-cs.bu-cs.BU.EDU>
Date: Sat, 6-Sep-86 18:43:30 EDT
Article-I.D.: bu-cs.1179
Posted: Sat Sep  6 18:43:30 1986
Date-Received: Sat, 6-Sep-86 22:15:26 EDT
Organization: Boston U. Comp. Sci.
Lines: 25