Xref: utzoo comp.unix.programmer:1133 comp.unix.internals:2112 Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!samsung!uunet!bria!mike Newsgroups: comp.unix.programmer,comp.unix.internals Subject: Re: ls & file pipes (FIFO), curses... Message-ID: <471@bria> Date: 20 Feb 91 16:29:53 GMT References: Reply-To: uunet!bria!mike Followup-To: comp.unix.programmer Organization: MGI Group International, Los Angeles, CA Lines: 19 In an article, coombs.anu.edu.au!avalon (avalon) writes: >G'day, can anyone tell me how 'ls' knows whether a >file is a regular file or a pipe ? > >When i do a stat(2) call on the file, it is returned >as a regular file. What tricks does ls perform ? A file that is a named pipe shoould have S_IFIFO set in st_mode; such as: if ( stat(file,&buf) != -1 && buf.st_mode & S_IFIFO ) printf("%s is a pipe\n",file); Cheers, -- Michael Stefanik, MGI Inc., Los Angeles| Opinions stated are not even my own. Title of the week: Systems Engineer | UUCP: ...!uunet!bria!mike ------------------------------------------------------------------------------- Remember folks: If you can't flame MS-DOS, then what _can_ you flame?